xref: /aoo4110/main/sw/source/core/inc/UndoSection.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SW_UNDO_SECTION_HXX
25 #define SW_UNDO_SECTION_HXX
26 
27 #include <undobj.hxx>
28 
29 #include <memory>
30 
31 #include <swdllapi.h>
32 
33 
34 class SfxItemSet;
35 class SwTxtNode;
36 class SwSectionData;
37 class SwSectionFmt;
38 class SwTOXBase;
39 
40 
41 //------------ Undo of Insert-/Delete-Section ----------------------
42 
43 class SwUndoInsSection : public SwUndo, private SwUndRng
44 {
45 private:
46     const ::std::auto_ptr<SwSectionData> m_pSectionData;
47     const ::std::auto_ptr<SwTOXBase> m_pTOXBase; /// set iff section is TOX
48     const ::std::auto_ptr<SfxItemSet> m_pAttrSet;
49     ::std::auto_ptr<SwHistory> m_pHistory;
50     ::std::auto_ptr<SwRedlineData> m_pRedlData;
51     sal_uLong m_nSectionNodePos;
52     bool m_bSplitAtStart : 1;
53     bool m_bSplitAtEnd : 1;
54     bool m_bUpdateFtn : 1;
55 
56     void Join( SwDoc& rDoc, sal_uLong nNode );
57 
58 public:
59     SwUndoInsSection(SwPaM const&, SwSectionData const&,
60         SfxItemSet const*const pSet, SwTOXBase const*const pTOXBase);
61 
62     virtual ~SwUndoInsSection();
63 
64     virtual void UndoImpl( ::sw::UndoRedoContext & );
65     virtual void RedoImpl( ::sw::UndoRedoContext & );
66     virtual void RepeatImpl( ::sw::RepeatContext & );
67 
SetSectNdPos(sal_uLong const nPos)68     void SetSectNdPos(sal_uLong const nPos)     { m_nSectionNodePos = nPos; }
69     void SaveSplitNode(SwTxtNode *const pTxtNd, bool const bAtStart);
SetUpdtFtnFlag(bool const bFlag)70     void SetUpdtFtnFlag(bool const bFlag)   { m_bUpdateFtn = bFlag; }
71 };
72 
73 SW_DLLPRIVATE SwUndo * MakeUndoDelSection(SwSectionFmt const&);
74 
75 SW_DLLPRIVATE SwUndo * MakeUndoUpdateSection(SwSectionFmt const&, bool const);
76 
77 #endif // SW_UNDO_SECTION_HXX
78 
79