xref: /aoo41x/main/sw/source/core/inc/rolbck.hxx (revision 69a74367)
11d2dbeb0SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
31d2dbeb0SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
41d2dbeb0SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
51d2dbeb0SAndrew Rist  * distributed with this work for additional information
61d2dbeb0SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
71d2dbeb0SAndrew Rist  * to you under the Apache License, Version 2.0 (the
81d2dbeb0SAndrew Rist  * "License"); you may not use this file except in compliance
91d2dbeb0SAndrew Rist  * with the License.  You may obtain a copy of the License at
101d2dbeb0SAndrew Rist  *
111d2dbeb0SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
121d2dbeb0SAndrew Rist  *
131d2dbeb0SAndrew Rist  * Unless required by applicable law or agreed to in writing,
141d2dbeb0SAndrew Rist  * software distributed under the License is distributed on an
151d2dbeb0SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
161d2dbeb0SAndrew Rist  * KIND, either express or implied.  See the License for the
171d2dbeb0SAndrew Rist  * specific language governing permissions and limitations
181d2dbeb0SAndrew Rist  * under the License.
191d2dbeb0SAndrew Rist  *
201d2dbeb0SAndrew Rist  *************************************************************/
211d2dbeb0SAndrew Rist 
221d2dbeb0SAndrew Rist 
23cdf0e10cSrcweir #ifndef _ROLBCK_HXX
24cdf0e10cSrcweir #define _ROLBCK_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <tools/solar.h>
27cdf0e10cSrcweir #ifndef _SVSTDARR_HXX
28cdf0e10cSrcweir #define _SVSTDARR_USHORTS
29cdf0e10cSrcweir #define _SVSTDARR_USHORTSSORT
30cdf0e10cSrcweir #include <svl/svstdarr.hxx>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #include <svl/itemset.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir //Nur die History anziehen, um das docnew.cxx gegen die CLOOK's zu behaupten.
35cdf0e10cSrcweir 
36cdf0e10cSrcweir namespace sfx2 {
37cdf0e10cSrcweir     class MetadatableUndo;
38cdf0e10cSrcweir }
39cdf0e10cSrcweir 
40cdf0e10cSrcweir class SwDoc;
41cdf0e10cSrcweir class SwFmt;
42cdf0e10cSrcweir class SwFmtColl;
43cdf0e10cSrcweir class SwHistoryHint;
44cdf0e10cSrcweir class SwTxtAttr;
45cdf0e10cSrcweir class SfxPoolItem;
46cdf0e10cSrcweir class SwTxtNode;
47cdf0e10cSrcweir class SwUndoSaveSection;
48cdf0e10cSrcweir class SwTxtFtn;
49cdf0e10cSrcweir class SwTxtFlyCnt;
50cdf0e10cSrcweir class SwUndoDelLayFmt;
51cdf0e10cSrcweir class SwFlyFrmFmt;
52cdf0e10cSrcweir class SwFmtFld;
53cdf0e10cSrcweir class SwTxtFld;
54cdf0e10cSrcweir class SwFieldType;
55cdf0e10cSrcweir class SwTxtTOXMark;
56cdf0e10cSrcweir class SwTxtRefMark;
57cdf0e10cSrcweir class SwFrmFmt;
58cdf0e10cSrcweir class SwpHints;
59cdf0e10cSrcweir class SwFmtChain;
60cdf0e10cSrcweir class SwNode;
61cdf0e10cSrcweir class SwCharFmt;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir #ifndef ROLBCK_HISTORY_ONLY
64cdf0e10cSrcweir 
65cdf0e10cSrcweir #include <tox.hxx>
66cdf0e10cSrcweir 
67cdf0e10cSrcweir #include <SwNumberTreeTypes.hxx>
68cdf0e10cSrcweir // --> OD 2007-10-17 #i81002#
69cdf0e10cSrcweir #include <IDocumentMarkAccess.hxx>
70cdf0e10cSrcweir // <--
71cdf0e10cSrcweir 
72cdf0e10cSrcweir #include <memory>
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 
75cdf0e10cSrcweir enum HISTORY_HINT {
76cdf0e10cSrcweir     HSTRY_SETFMTHNT,
77cdf0e10cSrcweir     HSTRY_RESETFMTHNT,
78cdf0e10cSrcweir     HSTRY_SETTXTHNT,
79cdf0e10cSrcweir     HSTRY_SETTXTFLDHNT,
80cdf0e10cSrcweir     HSTRY_SETREFMARKHNT,
81cdf0e10cSrcweir     HSTRY_SETTOXMARKHNT,
82cdf0e10cSrcweir     HSTRY_RESETTXTHNT,
83cdf0e10cSrcweir     HSTRY_SETFTNHNT,
84cdf0e10cSrcweir     HSTRY_CHGFMTCOLL,
85cdf0e10cSrcweir     HSTRY_FLYCNT,
86cdf0e10cSrcweir     HSTRY_BOOKMARK,
87cdf0e10cSrcweir     HSTRY_SETATTRSET,
88cdf0e10cSrcweir     HSTRY_RESETATTRSET,
89cdf0e10cSrcweir     HSTRY_CHGFLYANCHOR,
90cdf0e10cSrcweir     HSTRY_CHGFLYCHAIN,
91cdf0e10cSrcweir     HSTRY_CHGCHARFMT, // #i27615#
92cdf0e10cSrcweir     HSTRY_END
93cdf0e10cSrcweir };
94cdf0e10cSrcweir 
95cdf0e10cSrcweir class SwHistoryHint
96cdf0e10cSrcweir {
97cdf0e10cSrcweir     const HISTORY_HINT m_eWhichId;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir public:
SwHistoryHint(HISTORY_HINT eWhich)100cdf0e10cSrcweir     SwHistoryHint( HISTORY_HINT eWhich ) : m_eWhichId( eWhich ) {}
~SwHistoryHint()101cdf0e10cSrcweir     virtual ~SwHistoryHint() {}
102cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ) = 0;
Which() const103cdf0e10cSrcweir     HISTORY_HINT Which() const                     { return m_eWhichId; }
104cdf0e10cSrcweir     virtual String GetDescription() const;
105cdf0e10cSrcweir };
106cdf0e10cSrcweir 
107cdf0e10cSrcweir class SwHistorySetFmt : public SwHistoryHint
108cdf0e10cSrcweir {
109cdf0e10cSrcweir     ::std::auto_ptr<SfxPoolItem> m_pAttr;
110cdf0e10cSrcweir     const sal_uLong m_nNodeIndex;
111cdf0e10cSrcweir 
112cdf0e10cSrcweir public:
113cdf0e10cSrcweir     SwHistorySetFmt( const SfxPoolItem* pFmtHt, sal_uLong nNode );
114cdf0e10cSrcweir     virtual ~SwHistorySetFmt();
115cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
116cdf0e10cSrcweir     virtual String GetDescription() const;
117cdf0e10cSrcweir 
118cdf0e10cSrcweir };
119cdf0e10cSrcweir 
120cdf0e10cSrcweir class SwHistoryResetFmt : public SwHistoryHint
121cdf0e10cSrcweir {
122cdf0e10cSrcweir     const sal_uLong m_nNodeIndex;
123cdf0e10cSrcweir     const sal_uInt16 m_nWhich;
124cdf0e10cSrcweir 
125cdf0e10cSrcweir public:
126cdf0e10cSrcweir     // --> OD 2008-02-27 #refactorlists# - removed <rDoc>
127cdf0e10cSrcweir     SwHistoryResetFmt( const SfxPoolItem* pFmtHt, sal_uLong nNodeIdx );
128cdf0e10cSrcweir     // <--
129cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
130cdf0e10cSrcweir 
131cdf0e10cSrcweir };
132cdf0e10cSrcweir 
133cdf0e10cSrcweir class SwHistorySetTxt : public SwHistoryHint
134cdf0e10cSrcweir {
135cdf0e10cSrcweir     ::std::auto_ptr<SfxPoolItem> m_pAttr;
136cdf0e10cSrcweir     const sal_uLong m_nNodeIndex;
137cdf0e10cSrcweir     const xub_StrLen m_nStart;
138cdf0e10cSrcweir     const xub_StrLen m_nEnd;
139cdf0e10cSrcweir 
140cdf0e10cSrcweir public:
141cdf0e10cSrcweir     SwHistorySetTxt( SwTxtAttr* pTxtHt, sal_uLong nNode );
142cdf0e10cSrcweir     virtual ~SwHistorySetTxt();
143cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
144cdf0e10cSrcweir 
145cdf0e10cSrcweir };
146cdf0e10cSrcweir 
147cdf0e10cSrcweir class SwHistorySetTxtFld : public SwHistoryHint
148cdf0e10cSrcweir {
149cdf0e10cSrcweir     //!! beware of the order for the declation of the auto_ptrs.
150cdf0e10cSrcweir     //!! If they get destroyed in the wrong order sw may crash (namely mail-merge as well)
151cdf0e10cSrcweir     ::std::auto_ptr<SwFieldType> m_pFldType;
152cdf0e10cSrcweir     const ::std::auto_ptr<SwFmtFld> m_pFld;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir     sal_uLong m_nNodeIndex;
155cdf0e10cSrcweir     xub_StrLen m_nPos;
156cdf0e10cSrcweir     sal_uInt16 m_nFldWhich;
157cdf0e10cSrcweir 
158cdf0e10cSrcweir public:
159cdf0e10cSrcweir     SwHistorySetTxtFld( SwTxtFld* pTxtFld, sal_uLong nNode );
160cdf0e10cSrcweir     virtual ~SwHistorySetTxtFld();
161cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
162cdf0e10cSrcweir 
163cdf0e10cSrcweir     virtual String GetDescription() const;
164cdf0e10cSrcweir 
165cdf0e10cSrcweir };
166cdf0e10cSrcweir 
167cdf0e10cSrcweir class SwHistorySetRefMark : public SwHistoryHint
168cdf0e10cSrcweir {
169cdf0e10cSrcweir     const String m_RefName;
170cdf0e10cSrcweir     const sal_uLong m_nNodeIndex;
171cdf0e10cSrcweir     const xub_StrLen m_nStart;
172cdf0e10cSrcweir     const xub_StrLen m_nEnd;
173cdf0e10cSrcweir 
174cdf0e10cSrcweir public:
175cdf0e10cSrcweir     SwHistorySetRefMark( SwTxtRefMark* pTxtHt, sal_uLong nNode );
176cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
177cdf0e10cSrcweir 
178cdf0e10cSrcweir };
179cdf0e10cSrcweir 
180cdf0e10cSrcweir class SwHistorySetTOXMark : public SwHistoryHint
181cdf0e10cSrcweir {
182cdf0e10cSrcweir     SwTOXMark m_TOXMark;
183cdf0e10cSrcweir     const String m_TOXName;
184cdf0e10cSrcweir     const TOXTypes m_eTOXTypes;
185cdf0e10cSrcweir     const sal_uLong m_nNodeIndex;
186cdf0e10cSrcweir     const xub_StrLen m_nStart;
187cdf0e10cSrcweir     const xub_StrLen m_nEnd;
188cdf0e10cSrcweir 
189cdf0e10cSrcweir public:
190cdf0e10cSrcweir     SwHistorySetTOXMark( SwTxtTOXMark* pTxtHt, sal_uLong nNode );
191cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
192cdf0e10cSrcweir     int IsEqual( const SwTOXMark& rCmp ) const;
193cdf0e10cSrcweir 
194cdf0e10cSrcweir };
195cdf0e10cSrcweir 
196cdf0e10cSrcweir class SwHistoryResetTxt : public SwHistoryHint
197cdf0e10cSrcweir {
198cdf0e10cSrcweir     const sal_uLong m_nNodeIndex;
199cdf0e10cSrcweir     const xub_StrLen m_nStart;
200cdf0e10cSrcweir     const xub_StrLen m_nEnd;
201cdf0e10cSrcweir     const sal_uInt16 m_nAttr;
202cdf0e10cSrcweir 
203cdf0e10cSrcweir public:
204cdf0e10cSrcweir     SwHistoryResetTxt( sal_uInt16 nWhich, xub_StrLen nStt, xub_StrLen nEnd,
205cdf0e10cSrcweir                        sal_uLong nNode );
206cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
207cdf0e10cSrcweir 
GetWhich() const208cdf0e10cSrcweir     sal_uInt16 GetWhich() const         { return m_nAttr; }
GetNode() const209cdf0e10cSrcweir     sal_uLong GetNode() const           { return m_nNodeIndex; }
GetCntnt() const210cdf0e10cSrcweir     xub_StrLen GetCntnt() const     { return m_nStart; }
211cdf0e10cSrcweir 
212cdf0e10cSrcweir };
213cdf0e10cSrcweir 
214cdf0e10cSrcweir class SwHistorySetFootnote : public SwHistoryHint
215cdf0e10cSrcweir {
216cdf0e10cSrcweir     const ::std::auto_ptr<SwUndoSaveSection> m_pUndo;
217cdf0e10cSrcweir     const String m_FootnoteNumber;
218cdf0e10cSrcweir     sal_uLong m_nNodeIndex;
219cdf0e10cSrcweir     const xub_StrLen m_nStart;
220cdf0e10cSrcweir     const bool m_bEndNote;
221cdf0e10cSrcweir 
222cdf0e10cSrcweir public:
223cdf0e10cSrcweir     SwHistorySetFootnote( SwTxtFtn* pTxtFtn, sal_uLong nNode );
224cdf0e10cSrcweir     SwHistorySetFootnote( const SwTxtFtn& );
225cdf0e10cSrcweir     virtual ~SwHistorySetFootnote();
226cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
227cdf0e10cSrcweir 
228cdf0e10cSrcweir     virtual String GetDescription() const;
229cdf0e10cSrcweir 
230cdf0e10cSrcweir };
231cdf0e10cSrcweir 
232cdf0e10cSrcweir class SwHistoryChangeFmtColl : public SwHistoryHint
233cdf0e10cSrcweir {
234cdf0e10cSrcweir     SwFmtColl * const m_pColl;
235cdf0e10cSrcweir     const sal_uLong m_nNodeIndex;
236cdf0e10cSrcweir     const sal_uInt8 m_nNodeType;
237cdf0e10cSrcweir 
238cdf0e10cSrcweir public:
239cdf0e10cSrcweir     SwHistoryChangeFmtColl( SwFmtColl* pColl, sal_uLong nNode, sal_uInt8 nNodeWhich );
240cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
241cdf0e10cSrcweir 
242cdf0e10cSrcweir };
243cdf0e10cSrcweir 
244cdf0e10cSrcweir class SwHistoryTxtFlyCnt : public SwHistoryHint
245cdf0e10cSrcweir {
246cdf0e10cSrcweir     ::std::auto_ptr<SwUndoDelLayFmt> m_pUndo;
247cdf0e10cSrcweir 
248cdf0e10cSrcweir public:
249cdf0e10cSrcweir     SwHistoryTxtFlyCnt( SwFrmFmt* const pFlyFmt );
250cdf0e10cSrcweir     virtual ~SwHistoryTxtFlyCnt();
251cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
GetUDelLFmt()252cdf0e10cSrcweir     SwUndoDelLayFmt* GetUDelLFmt() { return m_pUndo.get(); }
253cdf0e10cSrcweir 
254cdf0e10cSrcweir };
255cdf0e10cSrcweir 
256cdf0e10cSrcweir class SwHistoryBookmark : public SwHistoryHint
257cdf0e10cSrcweir {
258cdf0e10cSrcweir     public:
259cdf0e10cSrcweir         SwHistoryBookmark(const ::sw::mark::IMark& rBkmk,
260cdf0e10cSrcweir                         bool bSavePos, bool bSaveOtherPos);
261cdf0e10cSrcweir         virtual void SetInDoc(SwDoc * pDoc, bool);
262cdf0e10cSrcweir 
263cdf0e10cSrcweir         bool IsEqualBookmark(const ::sw::mark::IMark& rBkmk);
264cdf0e10cSrcweir         const ::rtl::OUString& GetName() const;
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 
267cdf0e10cSrcweir     private:
268cdf0e10cSrcweir         const ::rtl::OUString m_aName;
269cdf0e10cSrcweir         ::rtl::OUString m_aShortName;
270cdf0e10cSrcweir         KeyCode m_aKeycode;
271cdf0e10cSrcweir         const sal_uLong m_nNode;
272cdf0e10cSrcweir         const sal_uLong m_nOtherNode;
273cdf0e10cSrcweir         const xub_StrLen m_nCntnt;
274cdf0e10cSrcweir         const xub_StrLen m_nOtherCntnt;
275cdf0e10cSrcweir         const bool m_bSavePos;
276cdf0e10cSrcweir         const bool m_bSaveOtherPos;
277cdf0e10cSrcweir         const bool m_bHadOtherPos;
278cdf0e10cSrcweir         const IDocumentMarkAccess::MarkType m_eBkmkType;
279cdf0e10cSrcweir         ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndo;
280cdf0e10cSrcweir };
281cdf0e10cSrcweir 
282cdf0e10cSrcweir class SwHistorySetAttrSet : public SwHistoryHint
283cdf0e10cSrcweir {
284cdf0e10cSrcweir     SfxItemSet m_OldSet;
285cdf0e10cSrcweir     SvUShorts m_ResetArray;
286cdf0e10cSrcweir     const sal_uLong m_nNodeIndex;
287cdf0e10cSrcweir 
288cdf0e10cSrcweir public:
289cdf0e10cSrcweir     SwHistorySetAttrSet( const SfxItemSet& rSet, sal_uLong nNode,
290cdf0e10cSrcweir                          const SvUShortsSort& rSetArr );
291cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
292cdf0e10cSrcweir 
293cdf0e10cSrcweir };
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 
296cdf0e10cSrcweir class SwHistoryResetAttrSet : public SwHistoryHint
297cdf0e10cSrcweir {
298cdf0e10cSrcweir     const sal_uLong m_nNodeIndex;
299cdf0e10cSrcweir     const xub_StrLen m_nStart;
300cdf0e10cSrcweir     const xub_StrLen m_nEnd;
301cdf0e10cSrcweir     SvUShorts m_Array;
302cdf0e10cSrcweir 
303cdf0e10cSrcweir public:
304cdf0e10cSrcweir     SwHistoryResetAttrSet( const SfxItemSet& rSet, sal_uLong nNode,
305cdf0e10cSrcweir                         xub_StrLen nStt = STRING_MAXLEN,
306cdf0e10cSrcweir                         xub_StrLen nEnd = STRING_MAXLEN );
307cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
308cdf0e10cSrcweir 
GetArr() const309cdf0e10cSrcweir     const SvUShorts& GetArr() const     { return m_Array; }
GetNode() const310cdf0e10cSrcweir     sal_uLong GetNode() const               { return m_nNodeIndex; }
GetCntnt() const311cdf0e10cSrcweir     xub_StrLen GetCntnt() const         { return m_nStart; }
312cdf0e10cSrcweir 
313cdf0e10cSrcweir };
314cdf0e10cSrcweir 
315cdf0e10cSrcweir class SwHistoryChangeFlyAnchor : public SwHistoryHint
316cdf0e10cSrcweir {
317cdf0e10cSrcweir     SwFrmFmt & m_rFmt;
318cdf0e10cSrcweir     const sal_uLong m_nOldNodeIndex;
319cdf0e10cSrcweir     const xub_StrLen m_nOldContentIndex;
320cdf0e10cSrcweir 
321cdf0e10cSrcweir public:
322cdf0e10cSrcweir     SwHistoryChangeFlyAnchor( SwFrmFmt& rFmt );
323cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
324cdf0e10cSrcweir };
325cdf0e10cSrcweir 
326cdf0e10cSrcweir class SwHistoryChangeFlyChain : public SwHistoryHint
327cdf0e10cSrcweir {
328cdf0e10cSrcweir     SwFlyFrmFmt * const m_pPrevFmt;
329cdf0e10cSrcweir     SwFlyFrmFmt * const m_pNextFmt;
330cdf0e10cSrcweir     SwFlyFrmFmt * const m_pFlyFmt;
331cdf0e10cSrcweir 
332cdf0e10cSrcweir public:
333cdf0e10cSrcweir     SwHistoryChangeFlyChain( SwFlyFrmFmt& rFmt, const SwFmtChain& rAttr );
334cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
335cdf0e10cSrcweir };
336cdf0e10cSrcweir 
337cdf0e10cSrcweir // #i27615#
338cdf0e10cSrcweir class SwHistoryChangeCharFmt : public SwHistoryHint
339cdf0e10cSrcweir {
340cdf0e10cSrcweir     const SfxItemSet m_OldSet;
341cdf0e10cSrcweir     const String m_Fmt;
342cdf0e10cSrcweir 
343cdf0e10cSrcweir public:
344cdf0e10cSrcweir     SwHistoryChangeCharFmt( const SfxItemSet& rSet, const String & sFmt);
345cdf0e10cSrcweir     virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet );
346cdf0e10cSrcweir 
347cdf0e10cSrcweir };
348cdf0e10cSrcweir 
349cdf0e10cSrcweir 
350cdf0e10cSrcweir #endif
351cdf0e10cSrcweir 
352cdf0e10cSrcweir typedef SwHistoryHint* SwHistoryHintPtr;
353cdf0e10cSrcweir SV_DECL_PTRARR_DEL( SwpHstry, SwHistoryHintPtr, 0, 2 )
354cdf0e10cSrcweir 
355cdf0e10cSrcweir class SwHistory
356cdf0e10cSrcweir {
357cdf0e10cSrcweir     friend class SwDoc;         // actually only SwDoc::DelUndoObj may access
358cdf0e10cSrcweir     friend class SwUndoWriter;  // for Undo/Redo Writer
359cdf0e10cSrcweir     friend class SwRegHistory;  // for inserting History attributes
360cdf0e10cSrcweir 
361cdf0e10cSrcweir     SwpHstry m_SwpHstry;
362cdf0e10cSrcweir     sal_uInt16 m_nEndDiff;
363cdf0e10cSrcweir 
364cdf0e10cSrcweir public:
365cdf0e10cSrcweir     SwHistory( sal_uInt16 nInitSz = 0, sal_uInt16 nGrowSz = 2 );
366cdf0e10cSrcweir     ~SwHistory();
367cdf0e10cSrcweir 
368cdf0e10cSrcweir     // delete History from nStart to array end
369cdf0e10cSrcweir     void Delete( sal_uInt16 nStart = 0 );
370cdf0e10cSrcweir     // call and delete all objects between nStart and array end
371cdf0e10cSrcweir     bool Rollback( SwDoc* pDoc, sal_uInt16 nStart = 0 );
372cdf0e10cSrcweir     // call all objects between nStart and TmpEnd; store nStart as TmpEnd
373cdf0e10cSrcweir     bool TmpRollback( SwDoc* pDoc, sal_uInt16 nStart, bool ToFirst = true );
374cdf0e10cSrcweir 
375cdf0e10cSrcweir     // --> OD 2008-02-27 #refactorlists# - removed <rDoc>
376cdf0e10cSrcweir     void Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue,
377cdf0e10cSrcweir               sal_uLong nNodeIdx );
378cdf0e10cSrcweir     // <--
379cdf0e10cSrcweir     void Add( SwTxtAttr* pTxtHt, sal_uLong nNodeIdx, bool bNewAttr = true );
380cdf0e10cSrcweir     void Add( SwFmtColl*, sal_uLong nNodeIdx, sal_uInt8 nWhichNd );
381cdf0e10cSrcweir     void Add( const ::sw::mark::IMark&, bool bSavePos, bool bSaveOtherPos );
382cdf0e10cSrcweir     void Add( SwFrmFmt& rFmt );
383cdf0e10cSrcweir     void Add( SwFlyFrmFmt&, sal_uInt16& rSetPos );
384cdf0e10cSrcweir     void Add( const SwTxtFtn& );
385cdf0e10cSrcweir     void Add( const SfxItemSet & rSet, const SwCharFmt & rCharFmt); // #i27615#
386cdf0e10cSrcweir 
Count() const387cdf0e10cSrcweir     sal_uInt16 Count() const { return m_SwpHstry.Count(); }
GetTmpEnd() const388cdf0e10cSrcweir     sal_uInt16 GetTmpEnd() const { return m_SwpHstry.Count() - m_nEndDiff; }
389cdf0e10cSrcweir     sal_uInt16 SetTmpEnd( sal_uInt16 nTmpEnd );        // return previous value
operator [](sal_uInt16 nPos)390cdf0e10cSrcweir     SwHistoryHint      * operator[]( sal_uInt16 nPos ) { return m_SwpHstry[nPos]; }
operator [](sal_uInt16 nPos) const391cdf0e10cSrcweir     SwHistoryHint const* operator[]( sal_uInt16 nPos ) const
392cdf0e10cSrcweir         { return m_SwpHstry[nPos]; }
393cdf0e10cSrcweir 
394cdf0e10cSrcweir     // for SwUndoDelete::Undo/Redo
Move(sal_uInt16 nPos,SwHistory * pIns,sal_uInt16 nStart=0,sal_uInt16 nEnd=USHRT_MAX)395cdf0e10cSrcweir     void Move( sal_uInt16 nPos, SwHistory *pIns,
396cdf0e10cSrcweir                sal_uInt16 nStart = 0, sal_uInt16 nEnd = USHRT_MAX )
397cdf0e10cSrcweir     {
398cdf0e10cSrcweir         m_SwpHstry.Insert( &pIns->m_SwpHstry, nPos, nStart, nEnd );
399cdf0e10cSrcweir         pIns->m_SwpHstry.Remove( nStart, (nEnd == USHRT_MAX)
400cdf0e10cSrcweir                                             ? pIns->Count() - nStart
401cdf0e10cSrcweir                                             : nEnd );
402cdf0e10cSrcweir     }
403cdf0e10cSrcweir 
404cdf0e10cSrcweir     // helper methods for recording attribute in History
405cdf0e10cSrcweir     // used by Undo classes (Delete/Overwrite/Inserts)
406*69a74367SOliver-Rainer Wittmann     void CopyAttr(
407*69a74367SOliver-Rainer Wittmann         SwpHints* pHts,
408*69a74367SOliver-Rainer Wittmann         const sal_uLong nNodeIdx,
409*69a74367SOliver-Rainer Wittmann         const xub_StrLen nStart,
410*69a74367SOliver-Rainer Wittmann         const xub_StrLen nEnd,
411*69a74367SOliver-Rainer Wittmann         const bool bCopyFields );
412*69a74367SOliver-Rainer Wittmann 
413cdf0e10cSrcweir     void CopyFmtAttr( const SfxItemSet& rSet, sal_uLong nNodeIdx );
414cdf0e10cSrcweir };
415cdf0e10cSrcweir 
416cdf0e10cSrcweir #ifndef ROLBCK_HISTORY_ONLY
417cdf0e10cSrcweir 
418cdf0e10cSrcweir class SwRegHistory : public SwClient
419cdf0e10cSrcweir {
420cdf0e10cSrcweir private:
421cdf0e10cSrcweir     SvUShortsSort m_WhichIdSet;
422cdf0e10cSrcweir     SwHistory * const m_pHistory;
423cdf0e10cSrcweir     sal_uLong m_nNodeIndex;
424cdf0e10cSrcweir 
425cdf0e10cSrcweir     void _MakeSetWhichIds();
426cdf0e10cSrcweir 
427cdf0e10cSrcweir protected:
428cdf0e10cSrcweir     virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew );
429cdf0e10cSrcweir 
430cdf0e10cSrcweir public:
431cdf0e10cSrcweir     // --> OD 2008-02-27 #refactorlists# - removed <rDoc>
432cdf0e10cSrcweir     SwRegHistory( SwHistory* pHst );
433cdf0e10cSrcweir     // <--
434cdf0e10cSrcweir     SwRegHistory( const SwNode& rNd, SwHistory* pHst );
435cdf0e10cSrcweir     SwRegHistory( SwModify* pRegIn, const SwNode& rNd, SwHistory* pHst );
436cdf0e10cSrcweir 
437cdf0e10cSrcweir     /// @return true iff at least 1 item was inserted
438cdf0e10cSrcweir     bool InsertItems( const SfxItemSet& rSet,
439cdf0e10cSrcweir         xub_StrLen const nStart, xub_StrLen const nEnd,
440cdf0e10cSrcweir         SetAttrMode const nFlags );
441cdf0e10cSrcweir 
442cdf0e10cSrcweir     void AddHint( SwTxtAttr* pHt, const bool bNew = false );
443cdf0e10cSrcweir 
444cdf0e10cSrcweir     void RegisterInModify( SwModify* pRegIn, const SwNode& rNd );
ChangeNodeIndex(sal_uLong nNew)445cdf0e10cSrcweir     void ChangeNodeIndex( sal_uLong nNew ) { m_nNodeIndex = nNew; }
446cdf0e10cSrcweir };
447cdf0e10cSrcweir 
448cdf0e10cSrcweir #endif
449cdf0e10cSrcweir 
450cdf0e10cSrcweir 
451cdf0e10cSrcweir #endif // _ROLBCK_HXX
452cdf0e10cSrcweir 
453