1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: docsort.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 #include <svtools/svarray.hxx>
34 #include <ndindex.hxx>
45 class CollatorWrapper
;
46 class LocaleDataWrapper
;
49 namespace com
{ namespace sun
{ namespace star
{ namespace lang
{
53 /*--------------------------------------------------------------------
54 Beschreibung: Liste aller sortierten Elemente
55 --------------------------------------------------------------------*/
56 typedef const _FndBox
* _FndBoxPtr
;
57 typedef SwSortElement
* SwSortElementPtr
;
58 typedef const SwTableBox
* SwMovedBoxPtr
;
60 SV_DECL_PTRARR_SORT(SwSortElements
, SwSortElementPtr
, 0, 1 )
61 SV_DECL_PTRARR(SwMovedBoxes
, SwMovedBoxPtr
, 10, 10 )
63 /*--------------------------------------------------------------------
64 Beschreibung: Funktionen zum Moven von Boxen
65 --------------------------------------------------------------------*/
67 void MoveCol(SwDoc
* pDoc
, const FlatFndBox
& rBox
,
68 USHORT nS
, USHORT nT
, SwMovedBoxes
& rMovedList
, SwUndoSort
* pUD
=0);
69 void MoveRow(SwDoc
* pDoc
, const FlatFndBox
& rBox
,
70 USHORT nS
, USHORT nT
, SwMovedBoxes
& rMovedList
, SwUndoSort
* pUD
=0);
71 void MoveCell(SwDoc
* pDoc
, const SwTableBox
* pSource
,
72 const SwTableBox
* pTar
, BOOL bMovedBefore
, SwUndoSort
* pUD
=0);
74 /*-------------------------------------------------------------------
75 Beschreibung: Elemente zum Sortieren von Text und Tabellen-Inhalt
76 --------------------------------------------------------------------*/
80 static SwSortOptions
* pOptions
;
82 static const FlatFndBox
* pBox
;
83 static CollatorWrapper
* pSortCollator
;
84 static ::com::sun::star::lang::Locale
* pLocale
;
85 static String
* pLastAlgorithm
;
86 static LocaleDataWrapper
* pLclData
;
88 static void Init( SwDoc
*, const SwSortOptions
& rOpt
, FlatFndBox
* = 0 );
91 virtual ~SwSortElement();
93 virtual String
GetKey(USHORT nKey
) const = 0;
94 virtual double GetValue(USHORT nKey
) const;
96 BOOL
operator==(const SwSortElement
& );
97 BOOL
operator<(const SwSortElement
& );
99 double StrToDouble(const String
& rStr
) const;
102 /*--------------------------------------------------------------------
103 Beschreibung: Sortieren Text
104 --------------------------------------------------------------------*/
106 struct SwSortTxtElement
: public SwSortElement
112 SwSortTxtElement( const SwNodeIndex
& rPos
);
113 virtual ~SwSortTxtElement();
115 virtual String
GetKey( USHORT nKey
) const;
118 /*--------------------------------------------------------------------
119 Beschreibung: Sortieren Tabelle
120 --------------------------------------------------------------------*/
122 struct SwSortBoxElement
: public SwSortElement
126 SwSortBoxElement( USHORT nRC
);
127 virtual ~SwSortBoxElement();
129 virtual String
GetKey( USHORT nKey
) const;
130 virtual double GetValue( USHORT nKey
) const;
134 /*--------------------------------------------------------------------
135 Beschreibung: SymFndBoxes stellt ein zweidimensionales
136 Array von FndBoxes dar
137 --------------------------------------------------------------------*/
142 FlatFndBox(SwDoc
* pDocPtr
, const _FndBox
& rBox
);
145 BOOL
IsSymmetric() const { return bSym
; }
146 USHORT
GetRows() const { return nRows
; }
147 USHORT
GetCols() const { return nCols
; }
149 const _FndBox
* GetBox(USHORT nCol
, USHORT nRow
) const;
151 inline BOOL
HasItemSets() const;
152 const SfxItemSet
* GetItemSet(USHORT nCol
, USHORT nRow
) const;
156 BOOL
CheckLineSymmetry(const _FndBox
& rBox
);
157 BOOL
CheckBoxSymmetry(const _FndLine
& rLn
);
158 USHORT
GetColCount(const _FndBox
& rBox
);
159 USHORT
GetRowCount(const _FndBox
& rBox
);
160 void FillFlat(const _FndBox
&, BOOL bLastBox
=FALSE
);
163 const _FndBox
& rBoxRef
;
165 SfxItemSet
** ppItemSets
;
177 inline BOOL
FlatFndBox::HasItemSets() const { return 0 != ppItemSets
; }
179 #endif // _NDSORT_HXX