Hi, I have submitted a patch for review:
https://gerrit.libreoffice.org/3213 To pull it, you can do: git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/13/3213/1 fdo#61541 : Count Number of selected Cells Change-Id: Ic9c911552f2b03bb496f47251917a3736494dce1 --- M sc/inc/global.hxx M sc/inc/globstr.hrc M sc/source/core/data/documen4.cxx M sc/source/filter/xml/XMLConverter.cxx M sc/source/ui/src/globstr.src M sc/source/ui/view/tabvwsha.cxx M svx/inc/helpid.hrc M svx/source/stbctrls/stbctrls.h M svx/source/stbctrls/stbctrls.src M xmloff/inc/xmloff/xmltoken.hxx M xmloff/source/core/xmltoken.cxx 11 files changed, 41 insertions(+), 13 deletions(-) diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 5b3a5ad..00e35d2 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -741,7 +741,8 @@ SUBTOTAL_FUNC_STDP = 8, SUBTOTAL_FUNC_SUM = 9, SUBTOTAL_FUNC_VAR = 10, - SUBTOTAL_FUNC_VARP = 11 + SUBTOTAL_FUNC_VARP = 11, + SUBTOTAL_FUNC_SELECTION_COUNT = 12 }; class ScArea; diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index 9eec9ce..07bb519 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -668,7 +668,9 @@ #define STR_COND_ABOVE_EQUAL_AVERAGE 535 #define STR_COND_BELOW_EQUAL_AVERAGE 536 -#define STR_COUNT 537 +#define STR_FUN_TEXT_SELECTION_COUNT 537 + +#define STR_COUNT 538 #endif diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 3df2fbc..87bd174 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -484,10 +484,15 @@ SCTAB nMax = static_cast<SCTAB>(maTabs.size()); ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end(); - for (; itr != itrEnd && *itr < nMax && !aData.bError; ++itr) - if (maTabs[*itr]) + + if ( aData.eFunc != SUBTOTAL_FUNC_SELECTION_COUNT ) + for (; itr != itrEnd && *itr < nMax && !aData.bError; ++itr) + if (maTabs[*itr]) maTabs[*itr]->UpdateSelectionFunction( aData, nStartCol, nStartRow, nEndCol, nEndRow, rMark ); + + double nCount; + nCount = ( nEndRow - nStartRow + 1 )*( nEndCol - nStartCol + 1 ); //! rMark an UpdateSelectionFunction uebergeben !!!!! @@ -497,6 +502,9 @@ case SUBTOTAL_FUNC_SUM: rResult = aData.nVal; break; + case SUBTOTAL_FUNC_SELECTION_COUNT: + rResult = nCount; + break; case SUBTOTAL_FUNC_CNT: case SUBTOTAL_FUNC_CNT2: rResult = aData.nCount; diff --git a/sc/source/filter/xml/XMLConverter.cxx b/sc/source/filter/xml/XMLConverter.cxx index 751ab1b..32680a5 100644 --- a/sc/source/filter/xml/XMLConverter.cxx +++ b/sc/source/filter/xml/XMLConverter.cxx @@ -153,6 +153,7 @@ case SUBTOTAL_FUNC_MIN: sFuncStr = GetXMLToken( XML_MIN ); break; case SUBTOTAL_FUNC_NONE: sFuncStr = GetXMLToken( XML_NONE ); break; case SUBTOTAL_FUNC_PROD: sFuncStr = GetXMLToken( XML_PRODUCT ); break; + case SUBTOTAL_FUNC_SELECTION_COUNT: sFuncStr = GetXMLToken( XML_SELECTION_COUNT ); break; case SUBTOTAL_FUNC_STD: sFuncStr = GetXMLToken( XML_STDEV ); break; case SUBTOTAL_FUNC_STDP: sFuncStr = GetXMLToken( XML_STDEVP ); break; case SUBTOTAL_FUNC_SUM: sFuncStr = GetXMLToken( XML_SUM ); break; diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src index 06d1170..2c6b810 100644 --- a/sc/source/ui/src/globstr.src +++ b/sc/source/ui/src/globstr.src @@ -694,6 +694,10 @@ { Text [ en-US ] = "Sum" ; }; + String STR_FUN_TEXT_SELECTION_COUNT + { + Text [ en-US ] = "Selection Count" ; + }; String STR_FUN_TEXT_COUNT { Text [ en-US ] = "Count" ; diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 5d8e622..0775485 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -79,6 +79,8 @@ case SUBTOTAL_FUNC_MAX: nGlobStrId = STR_FUN_TEXT_MAX; break; case SUBTOTAL_FUNC_MIN: nGlobStrId = STR_FUN_TEXT_MIN; break; case SUBTOTAL_FUNC_SUM: nGlobStrId = STR_FUN_TEXT_SUM; break; + case SUBTOTAL_FUNC_SELECTION_COUNT: nGlobStrId = STR_FUN_TEXT_SELECTION_COUNT; break; + default: { // added to avoid warnings @@ -105,7 +107,7 @@ // Number in the standard format, the other on the cursor position SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); sal_uInt32 nNumFmt = 0; - if ( eFunc != SUBTOTAL_FUNC_CNT && eFunc != SUBTOTAL_FUNC_CNT2 ) + if ( eFunc != SUBTOTAL_FUNC_CNT && eFunc != SUBTOTAL_FUNC_CNT2 && eFunc != SUBTOTAL_FUNC_SELECTION_COUNT) { // Zahlformat aus Attributen oder Formel pDoc->GetNumberFormat( nPosX, nPosY, nTab, nNumFmt ); diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc index 5455b33..b2088f6 100644 --- a/svx/inc/helpid.hrc +++ b/svx/inc/helpid.hrc @@ -134,6 +134,7 @@ #define HID_MNU_FUNC_MIN "SVX_HID_MNU_FUNC_MIN" #define HID_MNU_FUNC_NONE "SVX_HID_MNU_FUNC_NONE" #define HID_MNU_FUNC_SUM "SVX_HID_MNU_FUNC_SUM" +#define HID_MNU_FUNC_SELECTION_COUNT "SVX_HID_MNU_FUNC_SELECTION_COUNT" #define HID_MNU_ZOOM_100 "SVX_HID_MNU_ZOOM_100" #define HID_MNU_ZOOM_150 "SVX_HID_MNU_ZOOM_150" #define HID_MNU_ZOOM_200 "SVX_HID_MNU_ZOOM_200" diff --git a/svx/source/stbctrls/stbctrls.h b/svx/source/stbctrls/stbctrls.h index 7482c0b..601e327 100644 --- a/svx/source/stbctrls/stbctrls.h +++ b/svx/source/stbctrls/stbctrls.h @@ -31,15 +31,16 @@ #define ZOOM_PAGE_WIDTH 7 #define ZOOM_WHOLE_PAGE 8 -// IDs wie SUBTOTAL_FUNC im Calc +// IDs wise SUBTOTAL_FUNC in Calc -#define PSZ_FUNC_AVG 1 -#define PSZ_FUNC_COUNT2 3 -#define PSZ_FUNC_COUNT 2 -#define PSZ_FUNC_MAX 4 -#define PSZ_FUNC_MIN 5 -#define PSZ_FUNC_SUM 9 -#define PSZ_FUNC_NONE 16 +#define PSZ_FUNC_AVG 1 +#define PSZ_FUNC_COUNT2 3 +#define PSZ_FUNC_COUNT 2 +#define PSZ_FUNC_MAX 4 +#define PSZ_FUNC_MIN 5 +#define PSZ_FUNC_SUM 9 +#define PSZ_FUNC_SELECTION_COUNT 12 +#define PSZ_FUNC_NONE 16 #define XMLSEC_CALL 1 diff --git a/svx/source/stbctrls/stbctrls.src b/svx/source/stbctrls/stbctrls.src index a5b6799..5fb8e57 100644 --- a/svx/source/stbctrls/stbctrls.src +++ b/svx/source/stbctrls/stbctrls.src @@ -218,6 +218,12 @@ }; MenuItem { + Identifier = PSZ_FUNC_SELECTION_COUNT ; + HelpId = HID_MNU_FUNC_SELECTION_COUNT ; + Text [ en-US ] = "Selection Count" ; + }; + MenuItem + { Identifier = PSZ_FUNC_NONE ; HelpId = HID_MNU_FUNC_NONE ; Text [ en-US ] = "None" ; diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index 8ca24b48..d0345a9 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -1743,6 +1743,7 @@ XML_SUB_VIEW_SIZE, XML_SUFFIX, XML_SUM, + XML_SELECTION_COUNT, XML_SVGLINEARGRADIENT, XML_SWISS, XML_SYMBOL, diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index b195b94..d8e9e74 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -1748,6 +1748,7 @@ TOKEN( "sub-view-size", XML_SUB_VIEW_SIZE ), TOKEN( "suffix", XML_SUFFIX ), TOKEN( "sum", XML_SUM ), + TOKEN( "selection-count", XML_SELECTION_COUNT ), TOKEN( "linearGradient", XML_SVGLINEARGRADIENT ), TOKEN( "swiss", XML_SWISS ), TOKEN( "symbol", XML_SYMBOL ), -- To view, visit https://gerrit.libreoffice.org/3213 To unsubscribe, visit https://gerrit.libreoffice.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic9c911552f2b03bb496f47251917a3736494dce1 Gerrit-PatchSet: 1 Gerrit-Project: core Gerrit-Branch: master Gerrit-Owner: Prashant Pandey <prashant3.yi...@gmail.com> _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice