xref: /trunk/main/sw/source/core/inc/UndoSection.hxx (revision ffd38472365e95f6a578737bc9a5eb0fac624a86)
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 #ifndef SW_UNDO_SECTION_HXX
23 #define SW_UNDO_SECTION_HXX
24 
25 #include <undobj.hxx>
26 
27 #include <memory>
28 
29 #include <swdllapi.h>
30 
31 class SfxItemSet;
32 class SwTxtNode;
33 class SwSectionData;
34 class SwSectionFmt;
35 class SwTOXBase;
36 
37 //------------ Undo of Insert-/Delete-Section ----------------------
38 
39 class SwUndoInsSection : public SwUndo, private SwUndRng
40 {
41 private:
42     const ::std::auto_ptr<SwSectionData> m_pSectionData;
43     const ::std::auto_ptr<SwTOXBase> m_pTOXBase; // set iff section is TOX
44     const ::std::auto_ptr<SfxItemSet> m_pAttrSet;
45     ::std::auto_ptr<SwHistory> m_pHistory;
46     ::std::auto_ptr<SwRedlineData> m_pRedlData;
47     sal_uLong m_nSectionNodePos;
48     bool m_bSplitAtStart : 1;
49     bool m_bSplitAtEnd : 1;
50     bool m_bUpdateFtn : 1;
51 
52     void Join( SwDoc& rDoc, sal_uLong nNode );
53 
54 public:
55     SwUndoInsSection(SwPaM const&, SwSectionData const&,
56         SfxItemSet const*const pSet, SwTOXBase const*const pTOXBase);
57 
58     virtual ~SwUndoInsSection();
59 
60     virtual void UndoImpl( ::sw::UndoRedoContext & );
61     virtual void RedoImpl( ::sw::UndoRedoContext & );
62     virtual void RepeatImpl( ::sw::RepeatContext & );
63 
64     void SetSectNdPos(sal_uLong const nPos) { m_nSectionNodePos = nPos; }
65     void SaveSplitNode(SwTxtNode *const pTxtNd, bool const bAtStart);
66     void SetUpdtFtnFlag(bool const bFlag)   { m_bUpdateFtn = bFlag; }
67 };
68 
69 SW_DLLPRIVATE SwUndo * MakeUndoDelSection(SwSectionFmt const&);
70 
71 SW_DLLPRIVATE SwUndo * MakeUndoUpdateSection(SwSectionFmt const&, bool const);
72 
73 #endif // SW_UNDO_SECTION_HXX
74 
75 /* vim: set noet sw=4 ts=4: */
76