Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef SW_UNDO_SORT_HXX
21 : #define SW_UNDO_SORT_HXX
22 :
23 : #include <undobj.hxx>
24 : #include <boost/ptr_container/ptr_vector.hpp>
25 :
26 : struct SwSortOptions;
27 : class SwTableNode;
28 : class SwUndoAttrTbl;
29 :
30 : //-------------------- Undo for Sorting ------------------------------
31 : struct SwSortUndoElement
32 : {
33 : union {
34 : struct {
35 : sal_uLong nKenn;
36 : sal_uLong nSource, nTarget;
37 : } TXT;
38 : struct {
39 : String *pSource, *pTarget;
40 : } TBL;
41 : } SORT_TXT_TBL;
42 :
43 0 : SwSortUndoElement( const String& aS, const String& aT )
44 : {
45 0 : SORT_TXT_TBL.TBL.pSource = new String( aS );
46 0 : SORT_TXT_TBL.TBL.pTarget = new String( aT );
47 0 : }
48 0 : SwSortUndoElement( sal_uLong nS, sal_uLong nT )
49 : {
50 0 : SORT_TXT_TBL.TXT.nSource = nS;
51 0 : SORT_TXT_TBL.TXT.nTarget = nT;
52 0 : SORT_TXT_TBL.TXT.nKenn = 0xffffffff;
53 0 : }
54 : ~SwSortUndoElement();
55 : };
56 :
57 : typedef boost::ptr_vector<SwSortUndoElement> SwSortList;
58 : typedef std::vector<SwNodeIndex*> SwUndoSortList;
59 :
60 : class SwUndoSort : public SwUndo, private SwUndRng
61 : {
62 : SwSortOptions* pSortOpt;
63 : SwSortList aSortList;
64 : SwUndoAttrTbl* pUndoTblAttr;
65 : SwRedlineData* pRedlData;
66 : sal_uLong nTblNd;
67 :
68 : public:
69 : SwUndoSort( const SwPaM&, const SwSortOptions& );
70 : SwUndoSort( sal_uLong nStt, sal_uLong nEnd, const SwTableNode&,
71 : const SwSortOptions&, bool bSaveTable );
72 :
73 : virtual ~SwUndoSort();
74 :
75 : virtual void UndoImpl( ::sw::UndoRedoContext & );
76 : virtual void RedoImpl( ::sw::UndoRedoContext & );
77 : virtual void RepeatImpl( ::sw::RepeatContext & );
78 :
79 : void Insert( const String& rOrgPos, const String& rNewPos );
80 : void Insert( sal_uLong nOrgPos, sal_uLong nNewPos );
81 : };
82 :
83 : #endif // SW_UNDO_SORT_HXX
84 :
85 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|