From d7d3d778b5e87191fcdaccd12f6f95cd04cce17c Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Wed, 23 Mar 2011 23:11:07 -0400 Subject: Moved ScSubTotalParam from global.* into own files. --- sc/inc/datauno.hxx | 1 + sc/inc/global.hxx | 33 ---- sc/inc/subtotalparam.hxx | 67 +++++++ sc/source/core/data/global2.cxx | 204 -------------------- sc/source/core/data/makefile.mk | 1 + sc/source/core/data/sortparam.cxx | 2 + sc/source/core/data/subtotalparam.cxx | 232 +++++++++++++++++++++++ sc/source/core/data/table3.cxx | 1 + sc/source/core/tool/dbcolect.cxx | 2 +- sc/source/filter/xml/XMLExportDatabaseRanges.cxx | 2 + sc/source/ui/inc/dbfunc.hxx | 1 + sc/source/ui/inc/tpsubt.hxx | 1 + sc/source/ui/inc/uiitems.hxx | 1 + sc/source/ui/inc/undodat.hxx | 1 + 14 files changed, 311 insertions(+), 238 deletions(-) create mode 100644 sc/inc/subtotalparam.hxx create mode 100644 sc/source/core/data/subtotalparam.cxx diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx index b15397dbb0ce..53df7124a861 100644 --- a/sc/inc/datauno.hxx +++ b/sc/inc/datauno.hxx @@ -31,6 +31,7 @@ #include "global.hxx" #include "queryparam.hxx" +#include "subtotalparam.hxx" #include #include diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 82e68c5f1c55..c2d70620764d 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -761,39 +761,6 @@ struct ScQueryEntry sal_Bool operator==( const ScQueryEntry& r ) const; }; -struct SC_DLLPUBLIC ScSubTotalParam -{ - SCCOL nCol1; // selected area - SCROW nRow1; - SCCOL nCol2; - SCROW nRow2; - sal_uInt16 nUserIndex; // index into list - bool bRemoveOnly:1; - bool bReplace:1; // replace existing results - bool bPagebreak:1; // page break at change of group - bool bCaseSens:1; // - bool bDoSort:1; // presort - bool bAscending:1; // sort ascending - bool bUserDef:1; // sort user defined - bool bIncludePattern:1; // sort formats - bool bGroupActive[MAXSUBTOTAL]; // active groups - SCCOL nField[MAXSUBTOTAL]; // associated field - SCCOL nSubTotals[MAXSUBTOTAL]; // number of SubTotals - SCCOL* pSubTotals[MAXSUBTOTAL]; // array of columns to be calculated - ScSubTotalFunc* pFunctions[MAXSUBTOTAL]; // array of associated functions - - ScSubTotalParam(); - ScSubTotalParam( const ScSubTotalParam& r ); - - ScSubTotalParam& operator= ( const ScSubTotalParam& r ); - bool operator== ( const ScSubTotalParam& r ) const; - void Clear(); - void SetSubTotals( sal_uInt16 nGroup, - const SCCOL* ptrSubTotals, - const ScSubTotalFunc* ptrFuncions, - sal_uInt16 nCount ); -}; - class ScArea; struct ScConsolidateParam diff --git a/sc/inc/subtotalparam.hxx b/sc/inc/subtotalparam.hxx new file mode 100644 index 000000000000..9e64c292f2c4 --- /dev/null +++ b/sc/inc/subtotalparam.hxx @@ -0,0 +1,67 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Kohei Yoshida (Novell, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef __SC_SUBTOTALPARAM_HXX__ +#define __SC_SUBTOTALPARAM_HXX__ + +#include "global.hxx" +#include "address.hxx" + +struct SC_DLLPUBLIC ScSubTotalParam +{ + SCCOL nCol1; // selected area + SCROW nRow1; + SCCOL nCol2; + SCROW nRow2; + sal_uInt16 nUserIndex; // index into list + bool bRemoveOnly:1; + bool bReplace:1; // replace existing results + bool bPagebreak:1; // page break at change of group + bool bCaseSens:1; // + bool bDoSort:1; // presort + bool bAscending:1; // sort ascending + bool bUserDef:1; // sort user defined + bool bIncludePattern:1; // sort formats + bool bGroupActive[MAXSUBTOTAL]; // active groups + SCCOL nField[MAXSUBTOTAL]; // associated field + SCCOL nSubTotals[MAXSUBTOTAL]; // number of SubTotals + SCCOL* pSubTotals[MAXSUBTOTAL]; // array of columns to be calculated + ScSubTotalFunc* pFunctions[MAXSUBTOTAL]; // array of associated functions + + ScSubTotalParam(); + ScSubTotalParam( const ScSubTotalParam& r ); + + ScSubTotalParam& operator= ( const ScSubTotalParam& r ); + bool operator== ( const ScSubTotalParam& r ) const; + void Clear(); + void SetSubTotals( sal_uInt16 nGroup, + const SCCOL* ptrSubTotals, + const ScSubTotalFunc* ptrFuncions, + sal_uInt16 nCount ); +}; + +#endif diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx index 14ab743ca791..908cdfc72bcf 100644 --- a/sc/source/core/data/global2.cxx +++ b/sc/source/core/data/global2.cxx @@ -227,210 +227,6 @@ utl::TextSearch* ScQueryEntry::GetSearchTextPtr( sal_Bool bCaseSens ) return pSearchText; } -//------------------------------------------------------------------------ -// struct ScSubTotalParam: - -ScSubTotalParam::ScSubTotalParam() -{ - for ( sal_uInt16 i=0; i 0) && r.pSubTotals[i] && r.pFunctions[i] ) - { - nSubTotals[i] = r.nSubTotals[i]; - pSubTotals[i] = new SCCOL [r.nSubTotals[i]]; - pFunctions[i] = new ScSubTotalFunc [r.nSubTotals[i]]; - - for (SCCOL j=0; j 0) && pSubTotals[i] && pFunctions[i] ) - { - for ( SCCOL j=0; j 0 ) - { - pSubTotals[i] = new SCCOL [r.nSubTotals[i]]; - pFunctions[i] = new ScSubTotalFunc [r.nSubTotals[i]]; - - for (SCCOL j=0; j 0) ) - { - bEqual = (pSubTotals != NULL) && (pFunctions != NULL); - - for (SCCOL j=0; (j MAXSUBTOTAL!" ); - DBG_ASSERT( ptrSubTotals, - "ScSubTotalParam::SetSubTotals(): ptrSubTotals == NULL!" ); - DBG_ASSERT( ptrFunctions, - "ScSubTotalParam::SetSubTotals(): ptrFunctions == NULL!" ); - DBG_ASSERT( (nCount > 0), - "ScSubTotalParam::SetSubTotals(): nCount <= 0!" ); - - if ( ptrSubTotals && ptrFunctions && (nCount > 0) && (nGroup <= MAXSUBTOTAL) ) - { - // 0 wird als 1 aufgefasst, sonst zum Array-Index dekrementieren - if (nGroup != 0) - nGroup--; - - delete [] pSubTotals[nGroup]; - delete [] pFunctions[nGroup]; - - pSubTotals[nGroup] = new SCCOL [nCount]; - pFunctions[nGroup] = new ScSubTotalFunc [nCount]; - nSubTotals[nGroup] = static_cast(nCount); - - for ( sal_uInt16 i=0; i diff --git a/sc/source/core/data/subtotalparam.cxx b/sc/source/core/data/subtotalparam.cxx new file mode 100644 index 000000000000..26f01e8e6da0 --- /dev/null +++ b/sc/source/core/data/subtotalparam.cxx @@ -0,0 +1,232 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Kohei Yoshida (Novell, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sc.hxx" + +#include "subtotalparam.hxx" + +ScSubTotalParam::ScSubTotalParam() +{ + for ( sal_uInt16 i=0; i 0) && r.pSubTotals[i] && r.pFunctions[i] ) + { + nSubTotals[i] = r.nSubTotals[i]; + pSubTotals[i] = new SCCOL [r.nSubTotals[i]]; + pFunctions[i] = new ScSubTotalFunc [r.nSubTotals[i]]; + + for (SCCOL j=0; j 0) && pSubTotals[i] && pFunctions[i] ) + { + for ( SCCOL j=0; j 0 ) + { + pSubTotals[i] = new SCCOL [r.nSubTotals[i]]; + pFunctions[i] = new ScSubTotalFunc [r.nSubTotals[i]]; + + for (SCCOL j=0; j 0) ) + { + bEqual = (pSubTotals != NULL) && (pFunctions != NULL); + + for (SCCOL j=0; (j MAXSUBTOTAL!" ); + DBG_ASSERT( ptrSubTotals, + "ScSubTotalParam::SetSubTotals(): ptrSubTotals == NULL!" ); + DBG_ASSERT( ptrFunctions, + "ScSubTotalParam::SetSubTotals(): ptrFunctions == NULL!" ); + DBG_ASSERT( (nCount > 0), + "ScSubTotalParam::SetSubTotals(): nCount <= 0!" ); + + if ( ptrSubTotals && ptrFunctions && (nCount > 0) && (nGroup <= MAXSUBTOTAL) ) + { + // 0 wird als 1 aufgefasst, sonst zum Array-Index dekrementieren + if (nGroup != 0) + nGroup--; + + delete [] pSubTotals[nGroup]; + delete [] pFunctions[nGroup]; + + pSubTotals[nGroup] = new SCCOL [nCount]; + pFunctions[nGroup] = new ScSubTotalFunc [nCount]; + nSubTotals[nGroup] = static_cast(nCount); + + for ( sal_uInt16 i=0; i diff --git a/sc/source/core/tool/dbcolect.cxx b/sc/source/core/tool/dbcolect.cxx index a7e27dcf4dd2..6b6bd458307c 100644 --- a/sc/source/core/tool/dbcolect.cxx +++ b/sc/source/core/tool/dbcolect.cxx @@ -40,7 +40,7 @@ #include "document.hxx" #include "queryparam.hxx" #include "globstr.hrc" - +#include "subtotalparam.hxx" //--------------------------------------------------------------------------------------- diff --git a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx index 3e0ca1857bff..103721d0bbc6 100644 --- a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx +++ b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx @@ -46,6 +46,8 @@ #include "globstr.hrc" #include "XMLExportSharedData.hxx" #include "rangeutl.hxx" +#include "subtotalparam.hxx" + #include #include #include diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx index 823b4509fcc5..e944ff171983 100644 --- a/sc/source/ui/inc/dbfunc.hxx +++ b/sc/source/ui/inc/dbfunc.hxx @@ -43,6 +43,7 @@ class ScDPObject; class ScDPSaveData; class ScStrCollection; struct ScDPNumGroupInfo; +struct ScSubTotalParam; // --------------------------------------------------------------------------- diff --git a/sc/source/ui/inc/tpsubt.hxx b/sc/source/ui/inc/tpsubt.hxx index 049633ad40b6..8a49eabe10d4 100644 --- a/sc/source/ui/inc/tpsubt.hxx +++ b/sc/source/ui/inc/tpsubt.hxx @@ -41,6 +41,7 @@ class ScViewData; class ScDocument; +struct ScSubTotalParam; //======================================================================== // Gruppenseiten: Basisklasse diff --git a/sc/source/ui/inc/uiitems.hxx b/sc/source/ui/inc/uiitems.hxx index f35302c92901..584b6e5dc815 100644 --- a/sc/source/ui/inc/uiitems.hxx +++ b/sc/source/ui/inc/uiitems.hxx @@ -33,6 +33,7 @@ #include "conditio.hxx" #include "sortparam.hxx" #include "queryparam.hxx" +#include "subtotalparam.hxx" #include "paramisc.hxx" #include diff --git a/sc/source/ui/inc/undodat.hxx b/sc/source/ui/inc/undodat.hxx index 2aebb30a0cc5..f8d26d008daa 100644 --- a/sc/source/ui/inc/undodat.hxx +++ b/sc/source/ui/inc/undodat.hxx @@ -35,6 +35,7 @@ #include "markdata.hxx" #include "sortparam.hxx" #include "queryparam.hxx" +#include "subtotalparam.hxx" #include "pivot.hxx" class ScDocShell; -- cgit