Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SW_UNDO_SORT_HXX
30 : : #define SW_UNDO_SORT_HXX
31 : :
32 : : #include <undobj.hxx>
33 : : #include <boost/ptr_container/ptr_vector.hpp>
34 : :
35 : : struct SwSortOptions;
36 : : class SwTableNode;
37 : : class SwUndoAttrTbl;
38 : :
39 : : //-------------------- Undo for Sorting ------------------------------
40 : : struct SwSortUndoElement
41 : : {
42 : : union {
43 : : struct {
44 : : sal_uLong nKenn;
45 : : sal_uLong nSource, nTarget;
46 : : } TXT;
47 : : struct {
48 : : String *pSource, *pTarget;
49 : : } TBL;
50 : : } SORT_TXT_TBL;
51 : :
52 : 76 : SwSortUndoElement( const String& aS, const String& aT )
53 : : {
54 [ + - ]: 76 : SORT_TXT_TBL.TBL.pSource = new String( aS );
55 [ + - ]: 76 : SORT_TXT_TBL.TBL.pTarget = new String( aT );
56 : 76 : }
57 : 56 : SwSortUndoElement( sal_uLong nS, sal_uLong nT )
58 : : {
59 : 56 : SORT_TXT_TBL.TXT.nSource = nS;
60 : 56 : SORT_TXT_TBL.TXT.nTarget = nT;
61 : 56 : SORT_TXT_TBL.TXT.nKenn = 0xffffffff;
62 : 56 : }
63 : : ~SwSortUndoElement();
64 : : };
65 : :
66 : : typedef boost::ptr_vector<SwSortUndoElement> SwSortList;
67 : : typedef std::vector<SwNodeIndex*> SwUndoSortList;
68 : :
69 : : class SwUndoSort : public SwUndo, private SwUndRng
70 : : {
71 : : SwSortOptions* pSortOpt;
72 : : SwSortList aSortList;
73 : : SwUndoAttrTbl* pUndoTblAttr;
74 : : SwRedlineData* pRedlData;
75 : : sal_uLong nTblNd;
76 : :
77 : : public:
78 : : SwUndoSort( const SwPaM&, const SwSortOptions& );
79 : : SwUndoSort( sal_uLong nStt, sal_uLong nEnd, const SwTableNode&,
80 : : const SwSortOptions&, sal_Bool bSaveTable );
81 : :
82 : : virtual ~SwUndoSort();
83 : :
84 : : virtual void UndoImpl( ::sw::UndoRedoContext & );
85 : : virtual void RedoImpl( ::sw::UndoRedoContext & );
86 : : virtual void RepeatImpl( ::sw::RepeatContext & );
87 : :
88 : : void Insert( const String& rOrgPos, const String& rNewPos );
89 : : void Insert( sal_uLong nOrgPos, sal_uLong nNewPos );
90 : : };
91 : :
92 : : #endif // SW_UNDO_SORT_HXX
93 : :
94 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|