diff options
-rw-r--r-- | sc/inc/datauno.hxx | 6 | ||||
-rw-r--r-- | sc/inc/dbcolect.hxx | 10 | ||||
-rw-r--r-- | sc/inc/document.hxx | 5 | ||||
-rw-r--r-- | sc/inc/global.hxx | 47 | ||||
-rw-r--r-- | sc/inc/sortparam.hxx | 119 | ||||
-rw-r--r-- | sc/inc/table.hxx | 7 | ||||
-rw-r--r-- | sc/source/core/data/global2.cxx | 215 | ||||
-rw-r--r-- | sc/source/core/data/makefile.mk | 10 | ||||
-rw-r--r-- | sc/source/core/data/sortparam.cxx | 293 | ||||
-rw-r--r-- | sc/source/ui/inc/tpsort.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/inc/uiitems.hxx | 7 | ||||
-rw-r--r-- | sc/source/ui/inc/undodat.hxx | 8 |
12 files changed, 456 insertions, 276 deletions
diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx index c62a0d361e9f..203051c23d37 100644 --- a/sc/inc/datauno.hxx +++ b/sc/inc/datauno.hxx @@ -2,9 +2,9 @@ * * $RCSfile: datauno.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:44:48 $ + * last change: $Author: er $ $Date: 2001-03-12 16:43:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -143,6 +143,8 @@ class ScSubTotalFieldObj; class ScDatabaseRangeObj; class ScDataPilotDescriptorBase; +struct ScSortParam; + class ScDataUnoConversion { diff --git a/sc/inc/dbcolect.hxx b/sc/inc/dbcolect.hxx index 70bf65fa07e5..3a73a12f8dd5 100644 --- a/sc/inc/dbcolect.hxx +++ b/sc/inc/dbcolect.hxx @@ -2,9 +2,9 @@ * * $RCSfile: dbcolect.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:44:48 $ + * last change: $Author: er $ $Date: 2001-03-12 16:43:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -67,7 +67,11 @@ #endif #ifndef SC_SCGLOB_HXX -#include "global.hxx" // ->Konstanten (MAXSORT, MAXQUERY) +#include "global.hxx" // MAXQUERY +#endif + +#ifndef SC_SORTPARAM_HXX +#include "sortparam.hxx" // MAXSORT #endif diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 319dab5b3bac..391d55e6e9d4 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2,9 +2,9 @@ * * $RCSfile: document.hxx,v $ * - * $Revision: 1.27 $ + * $Revision: 1.28 $ * - * last change: $Author: nn $ $Date: 2001-03-12 09:29:21 $ + * last change: $Author: er $ $Date: 2001-03-12 16:43:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -160,6 +160,7 @@ class ScMatrix; class ScScriptTypeData; class ScPoolHelper; class ScImpExpLogMsg; +struct ScSortParam; namespace com { namespace sun { namespace star { namespace lang { diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 888b9c4a7b51..eb5ce9ab1cd3 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -2,9 +2,9 @@ * * $RCSfile: global.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: nn $ $Date: 2001-02-14 19:18:12 $ + * last change: $Author: er $ $Date: 2001-03-12 16:43:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -71,7 +71,6 @@ class ImageList; class Bitmap; -class International; class SfxItemSet; class Color; @@ -131,7 +130,6 @@ struct LabelData; #define MAXZOOM 400 #define MAXSUBTOTAL 3 -#define MAXSORT 3 #define MAXQUERY 8 #define PIVOT_MAXFIELD 8 @@ -499,6 +497,7 @@ class EditTextObject; class SfxObjectShell; class SvNumberFormatter; class ScUnitConverter; +class International; class CharClass; class LocaleDataWrapper; class CalendarWrapper; @@ -1322,46 +1321,6 @@ enum ScSubTotalFunc // ----------------------------------------------------------------------- -struct ScSubTotalParam; -struct ScQueryParam; - -// ----------------------------------------------------------------------- - -struct ScSortParam -{ - USHORT nCol1; - USHORT nRow1; - USHORT nCol2; - USHORT nRow2; - BOOL bHasHeader; - BOOL bByRow; - BOOL bCaseSens; - BOOL bUserDef; - USHORT nUserIndex; - BOOL bIncludePattern; - BOOL bInplace; - USHORT nDestTab; - USHORT nDestCol; - USHORT nDestRow; - BOOL bDoSort[MAXSORT]; - USHORT nField[MAXSORT]; - BOOL bAscending[MAXSORT]; - - ScSortParam(); - ScSortParam( const ScSortParam& r ); - // zum Sortieren von Zwischenergebnissen: - ScSortParam( const ScSubTotalParam& rSub, const ScSortParam& rOld ); - ScSortParam( const ScQueryParam&, USHORT nCol ); // TopTen Sortierung - - ScSortParam& operator= ( const ScSortParam& r ); - BOOL operator== ( const ScSortParam& rOther ) const; - void Clear (); - - void MoveToDest(); -}; - -// ----------------------------------------------------------------------- - /* * Dialog liefert die ausgezeichneten Feldwerte "leer"/"nicht leer" * als Konstanten SC_EMPTYFIELDS bzw. SC_NONEMPTYFIELDS in nVal in diff --git a/sc/inc/sortparam.hxx b/sc/inc/sortparam.hxx new file mode 100644 index 000000000000..9953a9c9ca07 --- /dev/null +++ b/sc/inc/sortparam.hxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * $RCSfile: sortparam.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: er $ $Date: 2001-03-12 16:41:44 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source 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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef SC_SORTPARAM_HXX +#define SC_SORTPARAM_HXX + +#ifndef _STRING_HXX +#include <tools/string.hxx> +#endif +#ifndef _SOLAR_H +#include <tools/solar.h> +#endif +#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_ +#include <com/sun/star/lang/Locale.hpp> +#endif + + +#define MAXSORT 3 + + +struct ScSubTotalParam; +struct ScQueryParam; + +struct ScSortParam +{ + USHORT nCol1; + USHORT nRow1; + USHORT nCol2; + USHORT nRow2; + BOOL bHasHeader; + BOOL bByRow; + BOOL bCaseSens; + BOOL bUserDef; + USHORT nUserIndex; + BOOL bIncludePattern; + BOOL bInplace; + USHORT nDestTab; + USHORT nDestCol; + USHORT nDestRow; + BOOL bDoSort[MAXSORT]; + USHORT nField[MAXSORT]; + BOOL bAscending[MAXSORT]; + ::com::sun::star::lang::Locale aCollatorLocale; + String aCollatorAlgorithm; + + ScSortParam(); + ScSortParam( const ScSortParam& r ); + /// SubTotals sort + ScSortParam( const ScSubTotalParam& rSub, const ScSortParam& rOld ); + /// TopTen sort + ScSortParam( const ScQueryParam&, USHORT nCol ); + + ScSortParam& operator= ( const ScSortParam& r ); + BOOL operator== ( const ScSortParam& rOther ) const; + void Clear (); + + void MoveToDest(); +}; + + +#endif // SC_SORTPARAM_HXX diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 2d336d1bb269..3e6eb51e5e0f 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -2,9 +2,9 @@ * * $RCSfile: table.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: sab $ $Date: 2001-02-23 06:55:58 $ + * last change: $Author: er $ $Date: 2001-03-12 16:43:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,6 +75,9 @@ #ifndef SC_COLUMN_HXX #include "column.hxx" #endif +#ifndef SC_SORTPARAM_HXX +#include "sortparam.hxx" +#endif namespace utl { class SearchParam; diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx index 4762b179214d..61f594f09eb2 100644 --- a/sc/source/core/data/global2.cxx +++ b/sc/source/core/data/global2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: global2.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: er $ $Date: 2001-01-31 19:31:45 $ + * last change: $Author: er $ $Date: 2001-03-12 16:47:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -176,217 +176,6 @@ BOOL ScImportParam::operator==( const ScImportParam& rOther ) const } -//======================================================================== -//======================================================================== -// Evtl. in dbdata.cxx auslagern (?): - -//------------------------------------------------------------------------ -// struct ScSortParam: - -ScSortParam::ScSortParam() -{ - Clear(); -} - -//------------------------------------------------------------------------ - -ScSortParam::ScSortParam( const ScSortParam& r ) : - nCol1(r.nCol1),nRow1(r.nRow1),nCol2(r.nCol2),nRow2(r.nRow2), - bHasHeader(r.bHasHeader),bCaseSens(r.bCaseSens), - bByRow(r.bByRow),bUserDef(r.bUserDef),nUserIndex(r.nUserIndex),bIncludePattern(r.bIncludePattern), - bInplace(r.bInplace), - nDestTab(r.nDestTab),nDestCol(r.nDestCol),nDestRow(r.nDestRow) -{ - for (USHORT i=0; i<MAXSORT; i++) - { - bDoSort[i] = r.bDoSort[i]; - nField[i] = r.nField[i]; - bAscending[i] = r.bAscending[i]; - } -} - -//------------------------------------------------------------------------ - -void ScSortParam::Clear() -{ - nCol1=nRow1=nCol2=nRow2=nDestTab=nDestCol=nDestRow=nUserIndex = 0; - bHasHeader=bCaseSens=bUserDef = FALSE; - bByRow=bIncludePattern=bInplace = TRUE; - - for (USHORT i=0; i<MAXSORT; i++) - { - bDoSort[i] = FALSE; - nField[i] = 0; - bAscending[i] = TRUE; - } -} - -//------------------------------------------------------------------------ - -ScSortParam& ScSortParam::operator=( const ScSortParam& r ) -{ - nCol1 = r.nCol1; - nRow1 = r.nRow1; - nCol2 = r.nCol2; - nRow2 = r.nRow2; - bHasHeader = r.bHasHeader; - bCaseSens = r.bCaseSens; - bByRow = r.bByRow; - bUserDef = r.bUserDef; - nUserIndex = r.nUserIndex; - bIncludePattern = r.bIncludePattern; - bInplace = r.bInplace; - nDestTab = r.nDestTab; - nDestCol = r.nDestCol; - nDestRow = r.nDestRow; - - for (USHORT i=0; i<MAXSORT; i++) - { - bDoSort[i] = r.bDoSort[i]; - nField[i] = r.nField[i]; - bAscending[i] = r.bAscending[i]; - } - - return *this; -} - -//------------------------------------------------------------------------ - -BOOL ScSortParam::operator==( const ScSortParam& rOther ) const -{ - BOOL bEqual = FALSE; - // Anzahl der Sorts gleich? - USHORT nLast = 0; - USHORT nOtherLast = 0; - while ( bDoSort[nLast++] && nLast < MAXSORT ); - while ( rOther.bDoSort[nOtherLast++] && nOtherLast < MAXSORT ); - nLast--; - nOtherLast--; - if ( (nLast == nOtherLast) - && (nCol1 == rOther.nCol1) - && (nRow1 == rOther.nRow1) - && (nCol2 == rOther.nCol2) - && (nRow2 == rOther.nRow2) - && (bHasHeader == rOther.bHasHeader) - && (bByRow == rOther.bByRow) - && (bCaseSens == rOther.bCaseSens) - && (bUserDef == rOther.bUserDef) - && (nUserIndex == rOther.nUserIndex) - && (bIncludePattern == rOther.bIncludePattern) - && (bInplace == rOther.bInplace) - && (nDestTab == rOther.nDestTab) - && (nDestCol == rOther.nDestCol) - && (nDestRow == rOther.nDestRow) ) - { - bEqual = TRUE; - for ( USHORT i=0; i<=nLast && bEqual; i++ ) - { - bEqual = (nField[i] == rOther.nField[i]) && (bAscending[i] == rOther.bAscending[i]); - } - } - return bEqual; -} - -//------------------------------------------------------------------------ - -ScSortParam::ScSortParam( const ScSubTotalParam& rSub, const ScSortParam& rOld ) : - nCol1(rSub.nCol1),nRow1(rSub.nRow1),nCol2(rSub.nCol2),nRow2(rSub.nRow2), - bHasHeader(TRUE),bCaseSens(rSub.bCaseSens), - bByRow(TRUE),bUserDef(rSub.bUserDef),nUserIndex(rSub.nUserIndex),bIncludePattern(rSub.bIncludePattern), - bInplace(TRUE), - nDestTab(0),nDestCol(0),nDestRow(0) -{ - USHORT nNewCount = 0; - USHORT i; - - // zuerst die Gruppen aus den Teilergebnissen - if (rSub.bDoSort) - for (i=0; i<MAXSUBTOTAL; i++) - if (rSub.bGroupActive[i]) - { - if (nNewCount < MAXSORT) - { - bDoSort[nNewCount] = TRUE; - nField[nNewCount] = rSub.nField[i]; - bAscending[nNewCount] = rSub.bAscending; - ++nNewCount; - } - } - - // dann dahinter die alten Einstellungen - for (i=0; i<MAXSORT; i++) - if (rOld.bDoSort[i]) - { - USHORT nThisField = rOld.nField[i]; - BOOL bDouble = FALSE; - for (USHORT j=0; j<nNewCount; j++) - if ( nField[j] == nThisField ) - bDouble = TRUE; - if (!bDouble) // ein Feld nicht zweimal eintragen - { - if (nNewCount < MAXSORT) - { - bDoSort[nNewCount] = TRUE; - nField[nNewCount] = nThisField; - bAscending[nNewCount] = rOld.bAscending[i]; - ++nNewCount; - } - } - } - - for (i=nNewCount; i<MAXSORT; i++) // Rest loeschen - { - bDoSort[i] = FALSE; - nField[i] = 0; - bAscending[i] = TRUE; - } -} - -//------------------------------------------------------------------------ - -ScSortParam::ScSortParam( const ScQueryParam& rParam, USHORT nCol ) : - nCol1(nCol),nRow1(rParam.nRow1),nRow2(rParam.nRow2),nCol2(nCol), - bHasHeader(rParam.bHasHeader),bCaseSens(rParam.bCaseSens), - bByRow(TRUE),bUserDef(FALSE),nUserIndex(0),bIncludePattern(FALSE), - bInplace(TRUE), - nDestTab(0),nDestCol(0),nDestRow(0) -{ - bDoSort[0] = TRUE; - nField[0] = nCol; - bAscending[0] = TRUE; - for (USHORT i=1; i<MAXSORT; i++) - { - bDoSort[i] = FALSE; - nField[i] = 0; - bAscending[i] = TRUE; - } -} - -//------------------------------------------------------------------------ - -void ScSortParam::MoveToDest() -{ - if (!bInplace) - { - short nDifX = ((short) nDestCol) - ((short) nCol1); - short nDifY = ((short) nDestRow) - ((short) nRow1); - - nCol1 += nDifX; - nRow1 += nDifY; - nCol2 += nDifX; - nRow2 += nDifY; - for (USHORT i=0; i<MAXSORT; i++) - if (bByRow) - nField[i] += nDifX; - else - nField[i] += nDifY; - - bInplace = TRUE; - } - else - DBG_ERROR("MoveToDest, bInplace == TRUE"); -} - //------------------------------------------------------------------------ // struct ScQueryParam: diff --git a/sc/source/core/data/makefile.mk b/sc/source/core/data/makefile.mk index 34a42aabac92..4eb1a46a09a3 100644 --- a/sc/source/core/data/makefile.mk +++ b/sc/source/core/data/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.5 $ +# $Revision: 1.6 $ # -# last change: $Author: gt $ $Date: 2001-02-14 09:29:47 $ +# last change: $Author: er $ $Date: 2001-03-12 16:47:50 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -136,7 +136,8 @@ CXXFILES = \ pagepar.cxx \ conditio.cxx \ validat.cxx \ - scimpexpmsg.cxx + scimpexpmsg.cxx \ + sortparam.cxx SLOFILES = \ $(SLO)$/bclist.obj \ @@ -193,7 +194,8 @@ SLOFILES = \ $(SLO)$/pagepar.obj \ $(SLO)$/conditio.obj \ $(SLO)$/validat.obj \ - $(SLO)$/scimpexpmsg.obj + $(SLO)$/scimpexpmsg.obj \ + $(SLO)$/sortparam.obj EXCEPTIONSFILES= \ $(SLO)$/documen6.obj \ diff --git a/sc/source/core/data/sortparam.cxx b/sc/source/core/data/sortparam.cxx new file mode 100644 index 000000000000..7e7b5185ff91 --- /dev/null +++ b/sc/source/core/data/sortparam.cxx @@ -0,0 +1,293 @@ +/************************************************************************* + * + * $RCSfile: sortparam.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: er $ $Date: 2001-03-12 16:47:23 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source 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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifdef PCH +#include "core_pch.hxx" +#endif + +#pragma hdrstop + +#include "sortparam.hxx" +#include "global.hxx" + +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif + + +//------------------------------------------------------------------------ + +ScSortParam::ScSortParam() +{ + Clear(); +} + +//------------------------------------------------------------------------ + +ScSortParam::ScSortParam( const ScSortParam& r ) : + nCol1(r.nCol1),nRow1(r.nRow1),nCol2(r.nCol2),nRow2(r.nRow2), + bHasHeader(r.bHasHeader),bCaseSens(r.bCaseSens), + bByRow(r.bByRow),bUserDef(r.bUserDef),nUserIndex(r.nUserIndex),bIncludePattern(r.bIncludePattern), + bInplace(r.bInplace), + nDestTab(r.nDestTab),nDestCol(r.nDestCol),nDestRow(r.nDestRow), + aCollatorLocale( r.aCollatorLocale ), aCollatorAlgorithm( r.aCollatorAlgorithm ) +{ + for (USHORT i=0; i<MAXSORT; i++) + { + bDoSort[i] = r.bDoSort[i]; + nField[i] = r.nField[i]; + bAscending[i] = r.bAscending[i]; + } +} + +//------------------------------------------------------------------------ + +void ScSortParam::Clear() +{ + nCol1=nRow1=nCol2=nRow2=nDestTab=nDestCol=nDestRow=nUserIndex = 0; + bHasHeader=bCaseSens=bUserDef = FALSE; + bByRow=bIncludePattern=bInplace = TRUE; + aCollatorLocale = ::com::sun::star::lang::Locale(); + aCollatorAlgorithm.Erase(); + + for (USHORT i=0; i<MAXSORT; i++) + { + bDoSort[i] = FALSE; + nField[i] = 0; + bAscending[i] = TRUE; + } +} + +//------------------------------------------------------------------------ + +ScSortParam& ScSortParam::operator=( const ScSortParam& r ) +{ + nCol1 = r.nCol1; + nRow1 = r.nRow1; + nCol2 = r.nCol2; + nRow2 = r.nRow2; + bHasHeader = r.bHasHeader; + bCaseSens = r.bCaseSens; + bByRow = r.bByRow; + bUserDef = r.bUserDef; + nUserIndex = r.nUserIndex; + bIncludePattern = r.bIncludePattern; + bInplace = r.bInplace; + nDestTab = r.nDestTab; + nDestCol = r.nDestCol; + nDestRow = r.nDestRow; + aCollatorLocale = r.aCollatorLocale; + aCollatorAlgorithm = r.aCollatorAlgorithm; + + for (USHORT i=0; i<MAXSORT; i++) + { + bDoSort[i] = r.bDoSort[i]; + nField[i] = r.nField[i]; + bAscending[i] = r.bAscending[i]; + } + + return *this; +} + +//------------------------------------------------------------------------ + +BOOL ScSortParam::operator==( const ScSortParam& rOther ) const +{ + BOOL bEqual = FALSE; + // Anzahl der Sorts gleich? + USHORT nLast = 0; + USHORT nOtherLast = 0; + while ( bDoSort[nLast++] && nLast < MAXSORT ); + while ( rOther.bDoSort[nOtherLast++] && nOtherLast < MAXSORT ); + nLast--; + nOtherLast--; + if ( (nLast == nOtherLast) + && (nCol1 == rOther.nCol1) + && (nRow1 == rOther.nRow1) + && (nCol2 == rOther.nCol2) + && (nRow2 == rOther.nRow2) + && (bHasHeader == rOther.bHasHeader) + && (bByRow == rOther.bByRow) + && (bCaseSens == rOther.bCaseSens) + && (bUserDef == rOther.bUserDef) + && (nUserIndex == rOther.nUserIndex) + && (bIncludePattern == rOther.bIncludePattern) + && (bInplace == rOther.bInplace) + && (nDestTab == rOther.nDestTab) + && (nDestCol == rOther.nDestCol) + && (nDestRow == rOther.nDestRow) + && (aCollatorLocale.Language == rOther.aCollatorLocale.Language) + && (aCollatorLocale.Country == rOther.aCollatorLocale.Country) + && (aCollatorLocale.Variant == rOther.aCollatorLocale.Variant) + && (aCollatorAlgorithm == rOther.aCollatorAlgorithm) + ) + { + bEqual = TRUE; + for ( USHORT i=0; i<=nLast && bEqual; i++ ) + { + bEqual = (nField[i] == rOther.nField[i]) && (bAscending[i] == rOther.bAscending[i]); + } + } + return bEqual; +} + +//------------------------------------------------------------------------ + +ScSortParam::ScSortParam( const ScSubTotalParam& rSub, const ScSortParam& rOld ) : + nCol1(rSub.nCol1),nRow1(rSub.nRow1),nCol2(rSub.nCol2),nRow2(rSub.nRow2), + bHasHeader(TRUE),bCaseSens(rSub.bCaseSens), + bByRow(TRUE),bUserDef(rSub.bUserDef),nUserIndex(rSub.nUserIndex),bIncludePattern(rSub.bIncludePattern), + bInplace(TRUE), + nDestTab(0),nDestCol(0),nDestRow(0), + aCollatorLocale( rOld.aCollatorLocale ), aCollatorAlgorithm( rOld.aCollatorAlgorithm ) +{ + USHORT nNewCount = 0; + USHORT i; + + // zuerst die Gruppen aus den Teilergebnissen + if (rSub.bDoSort) + for (i=0; i<MAXSUBTOTAL; i++) + if (rSub.bGroupActive[i]) + { + if (nNewCount < MAXSORT) + { + bDoSort[nNewCount] = TRUE; + nField[nNewCount] = rSub.nField[i]; + bAscending[nNewCount] = rSub.bAscending; + ++nNewCount; + } + } + + // dann dahinter die alten Einstellungen + for (i=0; i<MAXSORT; i++) + if (rOld.bDoSort[i]) + { + USHORT nThisField = rOld.nField[i]; + BOOL bDouble = FALSE; + for (USHORT j=0; j<nNewCount; j++) + if ( nField[j] == nThisField ) + bDouble = TRUE; + if (!bDouble) // ein Feld nicht zweimal eintragen + { + if (nNewCount < MAXSORT) + { + bDoSort[nNewCount] = TRUE; + nField[nNewCount] = nThisField; + bAscending[nNewCount] = rOld.bAscending[i]; + ++nNewCount; + } + } + } + + for (i=nNewCount; i<MAXSORT; i++) // Rest loeschen + { + bDoSort[i] = FALSE; + nField[i] = 0; + bAscending[i] = TRUE; + } +} + +//------------------------------------------------------------------------ + +ScSortParam::ScSortParam( const ScQueryParam& rParam, USHORT nCol ) : + nCol1(nCol),nRow1(rParam.nRow1),nRow2(rParam.nRow2),nCol2(nCol), + bHasHeader(rParam.bHasHeader),bCaseSens(rParam.bCaseSens), +//! TODO: what about Locale and Algorithm? + bByRow(TRUE),bUserDef(FALSE),nUserIndex(0),bIncludePattern(FALSE), + bInplace(TRUE), + nDestTab(0),nDestCol(0),nDestRow(0) +{ + bDoSort[0] = TRUE; + nField[0] = nCol; + bAscending[0] = TRUE; + for (USHORT i=1; i<MAXSORT; i++) + { + bDoSort[i] = FALSE; + nField[i] = 0; + bAscending[i] = TRUE; + } +} + +//------------------------------------------------------------------------ + +void ScSortParam::MoveToDest() +{ + if (!bInplace) + { + short nDifX = ((short) nDestCol) - ((short) nCol1); + short nDifY = ((short) nDestRow) - ((short) nRow1); + + nCol1 += nDifX; + nRow1 += nDifY; + nCol2 += nDifX; + nRow2 += nDifY; + for (USHORT i=0; i<MAXSORT; i++) + if (bByRow) + nField[i] += nDifX; + else + nField[i] += nDifY; + + bInplace = TRUE; + } + else + DBG_ERROR("MoveToDest, bInplace == TRUE"); +} + diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx index 6d2b769f9cb4..b2b871272cde 100644 --- a/sc/source/ui/inc/tpsort.hxx +++ b/sc/source/ui/inc/tpsort.hxx @@ -2,9 +2,9 @@ * * $RCSfile: tpsort.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:45:01 $ + * last change: $Author: er $ $Date: 2001-03-12 16:49:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,6 +98,7 @@ class ScViewData; class ScSortDlg; +struct ScSortParam; //======================================================================== // Kriterien diff --git a/sc/source/ui/inc/uiitems.hxx b/sc/source/ui/inc/uiitems.hxx index 89d3cb1df1ca..f64f4b2989f8 100644 --- a/sc/source/ui/inc/uiitems.hxx +++ b/sc/source/ui/inc/uiitems.hxx @@ -2,9 +2,9 @@ * * $RCSfile: uiitems.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:45:01 $ + * last change: $Author: er $ $Date: 2001-03-12 16:49:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,6 +65,9 @@ #ifndef SC_CONDITIO_HXX #include "conditio.hxx" #endif +#ifndef SC_SORTPARAM_HXX +#include "sortparam.hxx" +#endif #ifndef _SFXPOOLITEM_HXX //autogen #include <svtools/poolitem.hxx> diff --git a/sc/source/ui/inc/undodat.hxx b/sc/source/ui/inc/undodat.hxx index 3e794f8da85b..caac620d033e 100644 --- a/sc/source/ui/inc/undodat.hxx +++ b/sc/source/ui/inc/undodat.hxx @@ -2,9 +2,9 @@ * * $RCSfile: undodat.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:45:02 $ + * last change: $Author: er $ $Date: 2001-03-12 16:49:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,6 +78,10 @@ #include "markdata.hxx" #endif +#ifndef SC_SORTPARAM_HXX +#include "sortparam.hxx" +#endif + class ScDocShell; class ScDocument; |