tdf#139602 Added all subtotal functions to autosum

For every function that is an option for SUBTOTAL that was not already an
option in autosum (that is COUNTA, PRODUCT, STDEV, STDEVP, VAR, VARP),
the option was added in the autosum menu.

Change-Id: Ic560cd45df206dafaa2d960550aaf185a1806806
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127600
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
This commit is contained in:
Dhiraj Holden
2021-12-28 15:23:45 +01:00
committed by Eike Rathke
parent 9d0568609b
commit 75705bc48e
3 changed files with 105 additions and 2 deletions
+24
View File
@@ -1039,6 +1039,30 @@ void ScInputWindow::MenuHdl(std::string_view command)
{
eCode = ocCount;
}
else if ( command == "counta" )
{
eCode = ocCount2;
}
else if ( command == "product" )
{
eCode = ocProduct;
}
else if (command == "stdev")
{
eCode = ocStDev;
}
else if (command == "stdevp")
{
eCode = ocStDevP;
}
else if (command == "var")
{
eCode = ocVar;
}
else if (command == "varp")
{
eCode = ocVarP;
}
AutoSum( bRangeFinder, bSubTotal, eCode );
}
+33 -2
View File
@@ -255,7 +255,14 @@ enum ScAutoSum
ScAutoSumAverage,
ScAutoSumMax,
ScAutoSumMin,
ScAutoSumCount
ScAutoSumCount,
ScAutoSumCountA,
ScAutoSumProduct,
ScAutoSumStDev,
ScAutoSumStDevP,
ScAutoSumVar,
ScAutoSumVarP,
ScAutoSumEnd
};
}
@@ -284,6 +291,18 @@ static ScAutoSum lcl_IsAutoSumData( ScDocument& rDoc, SCCOL nCol, SCROW nRow,
break;
case ocCount : val = ScAutoSumCount;
break;
case ocCount2 : val = ScAutoSumCountA;
break;
case ocProduct : val = ScAutoSumProduct;
break;
case ocStDev : val = ScAutoSumStDev;
break;
case ocStDevP : val = ScAutoSumStDevP;
break;
case ocVar : val = ScAutoSumVar;
break;
case ocVarP : val = ScAutoSumVarP;
break;
default :
break;
}
@@ -469,6 +488,18 @@ static sal_Int8 GetSubTotal( const OpCode eCode )
break;
case ocCount : val = 2;
break;
case ocCount2 : val = 3;
break;
case ocProduct : val = 6;
break;
case ocStDev : val = 7;
break;
case ocStDevP : val = 8;
break;
case ocVar : val = 10;
break;
case ocVarP : val = 11;
break;
default : val = 9;
}
@@ -521,7 +552,7 @@ bool ScViewFunc::GetAutoSumArea( ScRangeList& rRangeList )
if ( bRow )
{
nStartRow = nSeekRow; // nSeekRow might be adjusted via reference
if ( eSum >= ScAutoSumSum && eSum <= ScAutoSumCount )
if ( eSum >= ScAutoSumSum && eSum < ScAutoSumEnd )
nEndRow = nStartRow; // only sum sums
else
nEndRow = nRow - 1; // maybe extend data area at bottom
+48
View File
@@ -45,5 +45,53 @@
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="counta">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="autosum|counta">CountA</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="product">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="autosum|product">Product</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="stdev">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="autosum|stdev">Stdev</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="stdevp">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="autosum|stdevp">StdevP</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="var">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="autosum|var">Var</property>
<property name="use_underline">True</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="varp">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="autosum|varp">VarP</property>
<property name="use_underline">True</property>
</object>
</child>
</object>
</interface>