Bug 61541 - UI: Count Number of selected Cells
Summary: UI: Count Number of selected Cells
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other All
: low enhancement
Assignee: Prashant
URL:
Whiteboard: target:4.1.0
Keywords: difficultyBeginner, easyHack, skillCpp, topicCleanup
Depends on:
Blocks:
 
Reported: 2013-02-27 06:11 UTC by Reza Heidari
Modified: 2015-12-15 23:56 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot (108.75 KB, image/png)
2013-06-11 07:45 UTC, Emir Sarı
Details
Screenshot2 (143.08 KB, image/png)
2013-06-11 08:21 UTC, Jorendc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Reza Heidari 2013-02-27 06:11:25 UTC
Problem description: 
This is very Basically Function to View numbers of selected cells, NOT sum, Count Of cells.

Steps to reproduce:
1. Count Cells
2. view in status bar
3. this is very simple :(

Current behavior:

Expected behavior:

              
Operating System: All
Version: 4.1.0.0.alpha0+ Master
Comment 1 Jorendc 2013-03-03 20:21:13 UTC
Hi,

Thanks for reporting.
I mark this as an enhancement request and NEW because I can't find any duplicates for this request.

Kind regards,
Joren
Comment 2 Michael Meeks 2013-04-03 14:36:15 UTC
Shouldn't be so hard to implement; the existing pop-up combo box in the status bar that changes 'Sum=0' to something else, could easily have a 'Selection' entry.

svx/source/stbctrls/stbctrls.src

has:

 // Choice of functions on the SvxPosSizeStatusBarControl for Calc
Menu RID_SVXMNU_PSZ_FUNC

svx/source/stbctrls/pszctrl.cxx

has the relevant code to render that string which comes into there via the SID_TABLE_CELL property I think cf.

sc/source/ui/view/cellsh.cxx /SID_TABLE_CELL/

and

sc/source/ui/view/tabvwsha.cxx:sal_Bool ScTabViewShell::GetFunction( String& rFuncStr, sal_uInt16 nErrCode )

And Eike might be a good person to review this ;-)
Comment 3 Prashant 2013-04-03 20:25:21 UTC
Hi,

This was a thing I too wished there to be in LO calc.
Got a good chance now to implement it myself. :-)

Thanks and Regards,
Prashant
Comment 4 Eike Rathke 2013-04-04 18:21:12 UTC
Rough sketch:

Add a new enum constant to ScSubTotalFunc in sc/inc/global.hxx, e.g. SUBTOTAL_FUNC_SELECTION_COUNT

In svx/source/stbctrls/stbctrls.h define a new PSZ_FUNC_SELECTION_COUNT with the same numeric value.

In svx/inc/helpid.hrc define HID_MNU_FUNC_SELECTION_COUNT

In svx/source/stbctrls/stbctrls.src add a MenuItem resource with
Text [ en-US ] = "Selection count";
and the defined constants.

In sc/inc/globstr.hrc define STR_FUN_TEXT_SELECTION_COUNT

In sc/source/ui/src/globstr.src add a String resource for STR_FUN_TEXT_SELECTION_COUNT

In sc/source/ui/view/tabvwsha.cxx
Add SUBTOTAL_FUNC_SELECTION_COUNT to the switch(eFunc).
Add (eFunc != SUBTOTAL_FUNC_SELECTION_COUNT) to the if below.

In sc/source/core/data/documen4.cxx ScDocument::GetSelectionFunction() handle the SUBTOTAL_FUNC_SELECTION_COUNT case.

In sc/source/core/data/column2.cxx ScColumn::UpdateSelectionFunction() and ScColumn::UpdateAreaFunction() treat the rData.eFunc==SUBTOTAL_FUNC_SELECTION_COUNT case special such that it does not call lcl_UpdateSubTotal(0 with a cell but instead calculates the selection count.

Hope I didn't forget anything ;-)
Comment 5 Prashant 2013-04-05 16:45:58 UTC
Hi Eike,

So, that was a lot to write and guide. Thanks a lot :-) 

Many thanks Michael and Eike for the code pointers and rough draft.
A simple easyhack but a lot more to learn and understand the flow of structure 
;-)

I've submitted a patch for the same: https://gerrit.libreoffice.org/#/c/3213/

Thanks and Regards,
Prashant
Comment 6 Commit Notification 2013-04-19 16:39:55 UTC
Prashant Pandey committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e7a5f5ef80c3e66101cfb063cbed0527c0559319

fdo#61541 : Count Number of selected Cells in calc



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 7 Emir Sarı 2013-06-11 07:45:54 UTC
Created attachment 80655 [details]
Screenshot

Something weird here, I cannot see this feature on 4.1.0b2 on OS X. 

SS attached. 

Could someone confirm this please?
Comment 8 Jorendc 2013-06-11 08:20:46 UTC
(In reply to comment #7)
> Created attachment 80655 [details]
> Screenshot
> 
> Something weird here, I cannot see this feature on 4.1.0b2 on OS X. 
> 
> SS attached. 
> 
> Could someone confirm this please?

You have to 'enable' it by right clicking on the 'sum' count in your status bar (right bottom). Once you clicked it, you can choose 'selection count' in that list :-).

Works here using Mac OSX 10.8.3. 

Kind regards,
Joren
Comment 9 Jorendc 2013-06-11 08:21:34 UTC
Created attachment 80664 [details]
Screenshot2
Comment 10 Emir Sarı 2013-06-23 02:33:29 UTC
(In reply to comment #8)
 
> You have to 'enable' it by right clicking on the 'sum' count in your status
> bar (right bottom). Once you clicked it, you can choose 'selection count' in
> that list :-).
> 
> Works here using Mac OSX 10.8.3. 
> 
> Kind regards,
> Joren


Oops!

Thanks for the info, I should have dug this further before posting.

Best regards,
Emir
Comment 11 Hamid Sattari 2013-09-09 04:44:04 UTC
@ Reza Heidari : 


Khafe shooooo
Comment 12 Jorendc 2013-09-09 09:09:54 UTC
(In reply to comment #11)
> @ Reza Heidari : 
> 
> 
> Khafe shooooo

NOTABUG is _NOT_ a correct status for this bug.
Comment 13 Robinson Tryon (qubit) 2015-12-15 23:56:11 UTC
Migrating Whiteboard tags to Keywords: (EasyHack,DifficultyBeginner,SkillCpp,TopicCleanup)
[NinjaEdit]