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 INCLUDED_SW_SOURCE_CORE_INC_UNDOSORT_HXX
21 : #define INCLUDED_SW_SOURCE_CORE_INC_UNDOSORT_HXX
22 :
23 : #include <undobj.hxx>
24 : #include <boost/ptr_container/ptr_vector.hpp>
25 : #include <rtl/ustring.hxx>
26 :
27 : struct SwSortOptions;
28 : class SwTableNode;
29 : class SwUndoAttrTbl;
30 :
31 : //-------------------- Undo for Sorting ------------------------------
32 : struct SwSortUndoElement
33 : {
34 : union {
35 : struct {
36 : sal_uLong nKenn;
37 : sal_uLong nSource, nTarget;
38 : } TXT;
39 : struct {
40 : OUString *pSource, *pTarget;
41 : } TBL;
42 : } SORT_TXT_TBL;
43 :
44 38 : SwSortUndoElement( const OUString& aS, const OUString& aT )
45 : {
46 38 : SORT_TXT_TBL.TBL.pSource = new OUString( aS );
47 38 : SORT_TXT_TBL.TBL.pTarget = new OUString( aT );
48 38 : }
49 28 : SwSortUndoElement( sal_uLong nS, sal_uLong nT )
50 : {
51 28 : SORT_TXT_TBL.TXT.nSource = nS;
52 28 : SORT_TXT_TBL.TXT.nTarget = nT;
53 28 : SORT_TXT_TBL.TXT.nKenn = 0xffffffff;
54 28 : }
55 : ~SwSortUndoElement();
56 : };
57 :
58 : typedef boost::ptr_vector<SwSortUndoElement> SwSortList;
59 : typedef std::vector<SwNodeIndex*> SwUndoSortList;
60 :
61 : class SwUndoSort : public SwUndo, private SwUndRng
62 : {
63 : SwSortOptions* pSortOpt;
64 : SwSortList aSortList;
65 : SwUndoAttrTbl* pUndoTblAttr;
66 : SwRedlineData* pRedlData;
67 : sal_uLong nTblNd;
68 :
69 : public:
70 : SwUndoSort( const SwPaM&, const SwSortOptions& );
71 : SwUndoSort( sal_uLong nStt, sal_uLong nEnd, const SwTableNode&,
72 : const SwSortOptions&, bool bSaveTable );
73 :
74 : virtual ~SwUndoSort();
75 :
76 : virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
77 : virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE;
78 : virtual void RepeatImpl( ::sw::RepeatContext & ) SAL_OVERRIDE;
79 :
80 : void Insert( const OUString& rOrgPos, const OUString& rNewPos );
81 : void Insert( sal_uLong nOrgPos, sal_uLong nNewPos );
82 : };
83 :
84 : #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOSORT_HXX
85 :
86 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|