update dev300-m57
[ooovba.git] / sw / inc / undobj.hxx
blobe5acda9b83d2b31072d04a3e0f9faaa817a686ab
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: undobj.hxx,v $
10 * $Revision: 1.44 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _UNDOBJ_HXX
31 #define _UNDOBJ_HXX
32 #include <tools/mempool.hxx>
33 #ifndef _SVSTDARR_HXX
34 #define _SVSTDARR_USHORTS
35 #define _SVSTDARR_ULONGS
36 #define _SVSTDARR_BOOLS
37 #define _SVSTDARR_BYTES
38 #define _SVSTDARR_USHORTSSORT
39 #include <svtools/svstdarr.hxx>
40 #endif
41 #include <svtools/itemset.hxx>
42 #include <com/sun/star/uno/Sequence.h>
43 #include <numrule.hxx>
44 #include <itabenum.hxx>
45 #include <format.hxx>
46 #include <SwRewriter.hxx>
47 #include <svx/svdundo.hxx> // #111827#
49 #include <swundo.hxx>
51 #include <IMark.hxx>
52 // --> OD 2006-11-01 #130889#
53 #include <vector>
54 // <--
56 #include <boost/shared_ptr.hpp>
57 #include <memory>
60 class SwUndoIter;
61 class SwHistory;
62 class SwIndex;
63 class SwPaM;
64 struct SwPosition;
65 class SwDoc;
66 class SwFmt;
67 class SwFmtColl;
68 class SwTxtFmtColl;
69 class SwTxtNode;
70 class SwTableNode;
71 class SwTable;
72 class SwTableBox;
73 struct SwSortOptions;
74 class SwFrmFmt;
75 class SwHistoryBookmark;
76 class SwSection;
77 class SwSectionFmt;
78 class SvxTabStopItem;
79 class SwDDEFieldType;
80 class Graphic;
81 class SwGrfNode;
82 class SwUndos;
83 class SwFtnInfo;
84 class SwEndNoteInfo;
85 class SwNodeIndex;
86 class SwNodeRange;
87 class SwFmtAnchor;
88 struct SwUndoGroupObjImpl;
89 class SdrMark;
90 class SdrMarkList;
91 class SdrObject;
92 class SdrObjGroup;
93 class SdrUndoAction;
94 class SwDrawFrmFmt;
95 class _SaveTable;
96 class SwTableAutoFmt;
97 class SwSelBoxes;
98 class SwTableSortBoxes;
99 class SwUndoSaveSections;
100 class SwUndoMoves;
101 class SwStartNode;
102 class _SaveFlyArr;
103 class SwTblToTxtSaves;
104 class SwRedlineData;
105 class SwRedlineSaveData;
106 class SwRedline;
107 struct SwSaveRowSpan;
109 namespace sfx2 {
110 class MetadatableUndo;
113 namespace utl {
114 class TransliterationWrapper;
117 #ifndef PRODUCT
118 class Writer;
119 class SwUndo;
120 #define OUT_UNDOBJ( name ) \
121 friend Writer& OutUndo_ ## name( Writer&, const SwUndo& );
122 #else
123 #define OUT_UNDOBJ( name )
124 #endif
127 const String UNDO_ARG1("$1", RTL_TEXTENCODING_ASCII_US);
128 const String UNDO_ARG2("$2", RTL_TEXTENCODING_ASCII_US);
129 const String UNDO_ARG3("$3", RTL_TEXTENCODING_ASCII_US);
131 typedef SwRedlineSaveData* SwRedlineSaveDataPtr;
132 SV_DECL_PTRARR_DEL( SwRedlineSaveDatas, SwRedlineSaveDataPtr, 8, 8 )
134 class SwUndo
136 SwUndoId nId;
137 USHORT nOrigRedlineMode;
139 protected:
140 bool bCacheComment;
141 mutable String * pComment;
143 void RemoveIdxFromSection( SwDoc&, ULONG nSttIdx, ULONG* pEndIdx = 0 );
144 void RemoveIdxFromRange( SwPaM& rPam, BOOL bMoveNext );
145 void RemoveIdxRel( ULONG, const SwPosition& );
147 void SetId( SwUndoId nNew ) { nId = nNew; }
149 static BOOL CanRedlineGroup( SwRedlineSaveDatas& rCurr,
150 const SwRedlineSaveDatas& rCheck,
151 BOOL bCurrIsEnd );
153 // #111827#
155 Returns the rewriter for this object.
157 @return the rewriter for this object
159 virtual SwRewriter GetRewriter() const;
160 public:
161 SwUndo( SwUndoId nI );
162 virtual ~SwUndo();
164 SwUndoId GetId() const { return nId; }
165 virtual SwUndoId GetEffectiveId() const;
166 virtual void Undo( SwUndoIter& ) = 0;
167 virtual void Redo( SwUndoIter& ) = 0;
168 virtual void Repeat( SwUndoIter& );
170 // #111827#
172 Returns textual comment for this undo object.
174 The textual comment is created from the resource string
175 corresponding to this object's ID. The rewriter of this object
176 is applied to the resource string to get the final comment.
178 @return textual comment for this undo object
180 virtual String GetComment() const;
182 // das UndoObject merkt sich, welcher Mode eingeschaltet war.
183 // In Undo/Redo/Repeat wird dann immer auf diesen zurueck geschaltet
184 USHORT GetRedlineMode() const { return nOrigRedlineMode; }
185 void SetRedlineMode( USHORT eMode ) { nOrigRedlineMode = eMode; }
187 bool IsDelBox() const;
189 // sicher und setze die RedlineDaten
190 static BOOL FillSaveData( const SwPaM& rRange, SwRedlineSaveDatas& rSData,
191 BOOL bDelRange = TRUE, BOOL bCopyNext = TRUE );
192 static BOOL FillSaveDataForFmt( const SwPaM& , SwRedlineSaveDatas& );
193 static void SetSaveData( SwDoc& rDoc, const SwRedlineSaveDatas& rSData );
194 static BOOL HasHiddenRedlines( const SwRedlineSaveDatas& rSData );
197 typedef USHORT DelCntntType;
198 namespace nsDelCntntType
200 const DelCntntType DELCNT_FTN = 0x01;
201 const DelCntntType DELCNT_FLY = 0x02;
202 const DelCntntType DELCNT_TOC = 0x04;
203 const DelCntntType DELCNT_BKM = 0x08;
204 const DelCntntType DELCNT_ALL = 0x0F;
205 const DelCntntType DELCNT_CHKNOCNTNT = 0x80;
208 // diese Klasse muss in ein Undo-Object vererbt werden, wenn dieses Inhalt
209 // fuers Redo/Undo ... speichert
210 class SwUndoSaveCntnt
212 protected:
214 SwHistory* pHistory;
216 // wird fuer das loeschen von Inhalt benoetigt. Fuer das ReDo werden
217 // Inhalte in das UndoNodesArray verschoben. Diese Methoden fuegen
218 // am Ende eines TextNodes ein Trenner fuer die Attribute. Damit werden
219 // Attribute nicht expandiert.
220 // MoveTo.. verschiebt aus dem NodesArray in das UndoNodesArray
221 // MoveFrom.. verschiebt aus dem UndoNodesArray in das NodesArray
222 void MoveToUndoNds( SwPaM& rPam,
223 SwNodeIndex* pNodeIdx = 0, SwIndex* pCntIdx = 0,
224 ULONG* pEndNdIdx = 0, xub_StrLen * pEndCntIdx = 0 );
225 void MoveFromUndoNds( SwDoc& rDoc, ULONG nNodeIdx, xub_StrLen nCntntIdx,
226 SwPosition& rInsPos,
227 ULONG* pEndNdIdx = 0, xub_StrLen * pEndCntIdx = 0 );
229 // diese beiden Methoden bewegen den SPoint vom Pam zurueck/vor. Damit
230 // kann fuer ein Undo/Redo ein Bereich aufgespannt werden. (Der
231 // SPoint liegt dann vor dem manipuliertem Bereich !!)
232 // Das Flag gibt an, ob noch vorm SPoint Inhalt steht.
233 BOOL MovePtBackward( SwPaM& rPam );
234 void MovePtForward( SwPaM& rPam, BOOL bMvBkwrd );
236 // vor dem Move ins UndoNodes-Array muss dafuer gesorgt werden, das
237 // die Inhaltstragenden Attribute aus dem Nodes-Array entfernt werden.
238 void DelCntntIndex( const SwPosition& pMark, const SwPosition& pPoint,
239 DelCntntType nDelCntntType = nsDelCntntType::DELCNT_ALL );
241 public:
242 SwUndoSaveCntnt();
243 ~SwUndoSaveCntnt();
244 OUT_UNDOBJ( SaveCntnt )
248 // sicher eine vollstaendige Section im Nodes-Array
249 class SwUndoSaveSection : private SwUndoSaveCntnt
251 SwNodeIndex *pMvStt;
252 SwRedlineSaveDatas* pRedlSaveData;
253 ULONG nMvLen; // Index ins UndoNodes-Array
254 ULONG nStartPos;
256 protected:
257 SwNodeIndex* GetMvSttIdx() const { return pMvStt; }
258 ULONG GetMvNodeCnt() const { return nMvLen; }
260 public:
261 SwUndoSaveSection();
262 ~SwUndoSaveSection();
264 void SaveSection( SwDoc* pDoc, const SwNodeIndex& rSttIdx );
265 void SaveSection( SwDoc* pDoc, const SwNodeRange& rRange );
266 void RestoreSection( SwDoc* pDoc, SwNodeIndex* pIdx, USHORT nSectType );
267 void RestoreSection( SwDoc* pDoc, const SwNodeIndex& rInsPos );
269 const SwHistory* GetHistory() const { return pHistory; }
270 SwHistory* GetHistory() { return pHistory; }
271 OUT_UNDOBJ( SaveSection )
275 // Diese Klasse speichert den Pam als USHORT's und kann diese wieder zu
276 // einem PaM zusammensetzen
277 class SwUndRng
279 public:
280 ULONG nSttNode, nEndNode;
281 xub_StrLen nSttCntnt, nEndCntnt;
283 SwUndRng();
284 SwUndRng( const SwPaM& );
286 void SetValues( const SwPaM& rPam );
287 void SetPaM( SwPaM&, BOOL bCorrToCntnt = FALSE ) const;
288 void SetPaM( SwUndoIter&, BOOL bCorrToCntnt = FALSE ) const;
292 class SwUndoStart: public SwUndo
294 // Um innerhalb von Undo zuerkennen, wann ein Start vorliegt, gibt
295 // GetId() immer die UNDO_START zurueck. Die UserId kann ueber
296 // GetUserId() erfragt werden.
297 SwUndoId nUserId;
298 // fuer die "Verpointerung" von Start- und End-Undos
299 USHORT nEndOffset;
301 SwRewriter mRewriter;
303 public:
304 SwUndoStart( SwUndoId nId );
305 virtual void Undo( SwUndoIter& );
306 virtual void Redo( SwUndoIter& );
307 virtual void Repeat( SwUndoIter& );
309 // -> #111827#
310 virtual String GetComment() const;
311 void SetRewriter(const SwRewriter & rRewriter);
312 virtual SwRewriter GetRewriter() const;
313 // <- #111827#
315 virtual SwUndoId GetEffectiveId() const;
316 SwUndoId GetUserId() const { return nUserId; }
317 // Setzen vom End-Undo-Offset geschieht im Doc::EndUndo
318 USHORT GetEndOffset() const { return nEndOffset; }
319 void SetEndOffset( USHORT n ) { nEndOffset = n; }
320 OUT_UNDOBJ( Start )
323 class SwUndoEnd: public SwUndo
325 // Um innerhalb von Undo zuerkennen, wann ein Ende vorliegt, gibt
326 // GetId() immer die UNDO_END zurueck. Die UserId kann ueber
327 // GetUserId() erfragt werden.
328 SwUndoId nUserId;
329 // fuer die "Verpointerung" von Start- und End-Undos
330 USHORT nSttOffset;
332 SwRewriter mRewriter;
334 public:
335 SwUndoEnd( SwUndoId nId );
336 virtual void Undo( SwUndoIter& );
337 virtual void Redo( SwUndoIter& );
338 virtual void Repeat( SwUndoIter& );
340 // -> #111827#
341 virtual String GetComment() const;
342 void SetRewriter(const SwRewriter & rRewriter);
343 virtual SwRewriter GetRewriter() const;
344 // <- #111827#
346 virtual SwUndoId GetEffectiveId() const;
347 SwUndoId GetUserId() const { return nUserId; }
349 // Setzen vom Start-Undo-Offset geschieht im Doc::EndUndo
350 void SetSttOffset(USHORT _nSttOffSet) { nSttOffset = _nSttOffSet; }
351 USHORT GetSttOffset() const { return nSttOffset; }
352 OUT_UNDOBJ( End )
355 class SwUndoInsert: public SwUndo, private SwUndoSaveCntnt
357 SwPosition *pPos; // Inhalt fuers Redo
358 String *pTxt, *pUndoTxt;
359 SwRedlineData* pRedlData;
360 ULONG nNode;
361 xub_StrLen nCntnt, nLen;
362 BOOL bIsWordDelim : 1;
363 BOOL bIsAppend : 1;
365 friend class SwDoc; // eigentlich nur SwDoc::Insert( String )
366 BOOL CanGrouping( sal_Unicode cIns );
367 BOOL CanGrouping( const SwPosition& rPos );
369 SwDoc * pDoc;
371 void Init(const SwNodeIndex & rNode);
372 String * GetTxtFromDoc() const;
374 public:
375 SwUndoInsert( const SwNodeIndex& rNode, xub_StrLen nCntnt, xub_StrLen nLen,
376 BOOL bWDelim = TRUE );
377 SwUndoInsert( const SwNodeIndex& rNode );
378 virtual ~SwUndoInsert();
380 virtual void Undo( SwUndoIter& );
381 virtual void Redo( SwUndoIter& );
382 virtual void Repeat( SwUndoIter& );
384 // #111827#
386 Returns rewriter for this undo object.
388 The returned rewriter has the following rule:
390 $1 -> '<inserted text>'
392 <inserted text> is shortened to a length of nUndoStringLength.
394 @return rewriter for this undo object
396 virtual SwRewriter GetRewriter() const;
398 BOOL CanGrouping( const SwPosition&, sal_Unicode cIns );
399 OUT_UNDOBJ( Insert )
401 DECL_FIXEDMEMPOOL_NEWDEL(SwUndoInsert)
405 class SwUndoDelete: public SwUndo, private SwUndRng, private SwUndoSaveCntnt
407 SwNodeIndex* pMvStt; // Position der Nodes im UndoNodes-Array
408 String *pSttStr, *pEndStr;
409 SwRedlineData* pRedlData;
410 SwRedlineSaveDatas* pRedlSaveData;
411 ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
412 ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd;
414 String sTableName;
416 ULONG nNode;
417 ULONG nNdDiff; // Differenz von Nodes vor-nach Delete
418 ULONG nSectDiff; // Diff. von Nodes vor/nach Move mit SectionNodes
419 ULONG nReplaceDummy; // Diff. to a temporary dummy object
420 USHORT nSetPos;
422 BOOL bGroup : 1; // TRUE: ist schon eine Gruppe; wird in CanGrouping() ausgwertet !!
423 BOOL bBackSp : 1; // TRUE: wenn Gruppierung und der Inhalt davor geloescht wird
424 BOOL bJoinNext: 1; // TRUE: wenn der Bereich von Oben nach unten geht
425 BOOL bTblDelLastNd : 1; // TRUE: TextNode hinter der Tabelle einf./loeschen
426 BOOL bDelFullPara : 1; // TRUE: gesamte Nodes wurden geloescht
427 BOOL bResetPgDesc : 1; // TRUE: am nachfolgenden Node das PgDsc zuruecksetzen
428 BOOL bResetPgBrk : 1; // TRUE: am nachfolgenden Node das PgBreak zuruecksetzen
429 BOOL bFromTableCopy : 1; // TRUE: called by SwUndoTblCpyTbl
431 BOOL SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
432 SwTxtNode* pSttTxtNd, SwTxtNode* pEndTxtNd );
433 public:
434 SwUndoDelete( SwPaM&, BOOL bFullPara = FALSE, BOOL bCalledByTblCpy = FALSE );
435 virtual ~SwUndoDelete();
436 virtual void Undo( SwUndoIter& );
437 virtual void Redo( SwUndoIter& );
438 virtual void Repeat( SwUndoIter& );
440 // #111827#
442 Returns rewriter for this undo object.
444 The rewriter consists of the following rule:
446 $1 -> '<deleted text>'
448 <deleted text> is shortened to nUndoStringLength characters.
450 @return rewriter for this undo object
452 virtual SwRewriter GetRewriter() const;
454 BOOL CanGrouping( SwDoc*, const SwPaM& );
456 void SetTblDelLastNd() { bTblDelLastNd = TRUE; }
458 // fuer die PageDesc/PageBreak Attribute einer Tabelle
459 void SetPgBrkFlags( BOOL bPageBreak, BOOL bPageDesc )
460 { bResetPgDesc = bPageDesc; bResetPgBrk = bPageBreak; }
462 void SetTableName(const String & rName);
464 // SwUndoTblCpyTbl needs this information:
465 long NodeDiff() const { return nSttNode - nEndNode; }
466 xub_StrLen ContentStart() const { return nSttCntnt; }
467 BOOL IsDelFullPara() const { return bDelFullPara; }
469 OUT_UNDOBJ( Delete )
471 DECL_FIXEDMEMPOOL_NEWDEL(SwUndoDelete)
475 class SwUndoOverwrite: public SwUndo, private SwUndoSaveCntnt
477 String aDelStr, aInsStr;
478 SwRedlineSaveDatas* pRedlSaveData;
479 ULONG nSttNode;
480 xub_StrLen nSttCntnt;
481 BOOL bInsChar : 1; // kein Overwrite mehr; sondern Insert
482 BOOL bGroup : 1; // TRUE: ist schon eine Gruppe; wird in
483 // CanGrouping() ausgwertet !!
484 public:
485 SwUndoOverwrite( SwDoc*, SwPosition&, sal_Unicode cIns );
486 virtual ~SwUndoOverwrite();
487 virtual void Undo( SwUndoIter& );
488 virtual void Redo( SwUndoIter& );
489 virtual void Repeat( SwUndoIter& );
491 // #111827#
493 Returns the rewriter of this undo object.
495 The rewriter contains the following rule:
497 $1 -> '<overwritten text>'
499 <overwritten text> is shortened to nUndoStringLength characters.
501 @return the rewriter of this undo object
503 virtual SwRewriter GetRewriter() const;
505 BOOL CanGrouping( SwDoc*, SwPosition&, sal_Unicode cIns );
506 OUT_UNDOBJ( Overwrite )
510 class SwUndoSplitNode: public SwUndo
512 SwHistory* pHistory;
513 SwRedlineData* pRedlData;
514 ULONG nNode;
515 xub_StrLen nCntnt;
516 BOOL bTblFlag : 1;
517 BOOL bChkTblStt : 1;
518 public:
519 SwUndoSplitNode( SwDoc* pDoc, const SwPosition& rPos, BOOL bChkTbl );
520 virtual ~SwUndoSplitNode();
521 virtual void Undo( SwUndoIter& );
522 virtual void Redo( SwUndoIter& );
523 virtual void Repeat( SwUndoIter& );
524 void SetTblFlag() { bTblFlag = TRUE; }
525 OUT_UNDOBJ( SplitNode )
529 class SwUndoMove : public SwUndo, private SwUndRng, private SwUndoSaveCntnt
531 // nDest.. - Bereich, in den verschoben wurde (nach dem Move!)
532 // nIns.. - Position, von der verschoben wurde und wieder die neue InsPos. ist
533 // nMv.. Position auf die verschoben wird (vor dem Move!) ; fuers REDO
534 ULONG nDestSttNode, nDestEndNode, nInsPosNode, nMvDestNode;
535 xub_StrLen nDestSttCntnt, nDestEndCntnt, nInsPosCntnt, nMvDestCntnt;
537 USHORT nFtnStt; // StartPos der Fussnoten in der History
539 BOOL bJoinNext : 1,
540 bJoinPrev : 1,
541 bMoveRange : 1;
543 bool bMoveRedlines; // use DOC_MOVEREDLINES when calling SwDoc::Move
545 void DelFtn( const SwPaM& );
546 public:
547 SwUndoMove( const SwPaM&, const SwPosition& );
548 SwUndoMove( SwDoc* pDoc, const SwNodeRange&, const SwNodeIndex& );
549 virtual void Undo( SwUndoIter& );
550 virtual void Redo( SwUndoIter& );
551 // setze den Destination-Bereich nach dem Verschieben.
552 void SetDestRange( const SwPaM&, const SwPosition&, BOOL, BOOL );
553 void SetDestRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd,
554 const SwNodeIndex& rInsPos );
556 BOOL IsMoveRange() const { return bMoveRange; }
557 ULONG GetEndNode() const { return nEndNode; }
558 ULONG GetDestSttNode() const { return nDestSttNode; }
559 xub_StrLen GetDestSttCntnt() const { return nDestSttCntnt; }
560 void AddTblMrgFlyHstry( SwHistory& rHstr );
562 void SetMoveRedlines( bool b ) { bMoveRedlines = b; }
564 OUT_UNDOBJ( Move )
568 class SwUndoAttr : public SwUndo, private SwUndRng
570 SfxItemSet m_AttrSet; // attributes for Redo
571 const ::std::auto_ptr<SwHistory> m_pHistory; // History for Undo
572 ::std::auto_ptr<SwRedlineData> m_pRedlineData; // Redlining
573 ::std::auto_ptr<SwRedlineSaveDatas> m_pRedlineSaveData;
574 ULONG m_nNodeIndex; // Offset: for Redlining
575 const USHORT m_nInsertFlags; // insert flags
577 void RemoveIdx( SwDoc& rDoc );
579 public:
580 SwUndoAttr( const SwPaM&, const SfxItemSet&, USHORT nFlags = 0 );
581 SwUndoAttr( const SwPaM&, const SfxPoolItem&, USHORT nFlags = 0 );
582 virtual ~SwUndoAttr();
583 virtual void Undo( SwUndoIter& );
584 virtual void Redo( SwUndoIter& );
585 virtual void Repeat( SwUndoIter& );
586 void SaveRedlineData( const SwPaM& rPam, BOOL bInsCntnt );
588 SwHistory& GetHistory() { return *m_pHistory; }
590 OUT_UNDOBJ( InsAttr )
593 class SwUndoResetAttr : public SwUndo, private SwUndRng
595 const ::std::auto_ptr<SwHistory> m_pHistory;
596 SvUShortsSort m_Ids;
597 const USHORT m_nFormatId; // Format-Id for Redo
599 public:
600 SwUndoResetAttr( const SwPaM&, USHORT nFmtId );
601 SwUndoResetAttr( const SwPosition&, USHORT nFmtId );
602 virtual ~SwUndoResetAttr();
603 virtual void Undo( SwUndoIter& );
604 virtual void Redo( SwUndoIter& );
605 virtual void Repeat( SwUndoIter& );
606 void SetAttrs( const SvUShortsSort& rArr );
608 SwHistory& GetHistory() { return *m_pHistory; }
610 OUT_UNDOBJ( ResetAttr )
613 class SwUndoFmtAttr : public SwUndo
615 friend class SwUndoDefaultAttr;
616 SwFmt * m_pFmt;
617 ::std::auto_ptr<SfxItemSet> m_pOldSet; // old attributes
618 ULONG m_nNodeIndex;
619 const USHORT m_nFmtWhich;
620 const bool m_bSaveDrawPt;
622 bool IsFmtInDoc( SwDoc* ); //is the attribute format still in the Doc?
623 void SaveFlyAnchor( bool bSaveDrawPt = false );
624 // --> OD 2004-10-26 #i35443# - Add return value, type <bool>.
625 // Return value indicates, if anchor attribute is restored.
626 // Notes: - If anchor attribute is restored, all other existing attributes
627 // are also restored.
628 // - Anchor attribute isn't restored successfully, if it contains
629 // an invalid anchor position and all other existing attributes
630 // aren't restored.
631 // This situation occurs for undo of styles.
632 bool RestoreFlyAnchor( SwUndoIter& rIter );
633 // <--
634 // --> OD 2008-02-27 #refactorlists# - removed <rAffectedItemSet>
635 void Init();
636 // <--
638 public:
639 // register at the Format and save old attributes
640 // --> OD 2008-02-27 #refactorlists# - removed <rNewSet>
641 SwUndoFmtAttr( const SfxItemSet& rOldSet,
642 SwFmt& rFmt,
643 bool bSaveDrawPt = true );
644 // <--
645 SwUndoFmtAttr( const SfxPoolItem& rItem,
646 SwFmt& rFmt,
647 bool bSaveDrawPt = true );
648 virtual ~SwUndoFmtAttr();
649 virtual void Undo( SwUndoIter& );
650 // --> OD 2004-10-26 #i35443# - <Redo(..)> calls <Undo(..)> - nothing else
651 virtual void Redo( SwUndoIter& );
652 // <--
653 virtual void Repeat( SwUndoIter& );
654 virtual SwRewriter GetRewriter() const;
656 OUT_UNDOBJ( InsFmtAttr )
658 void PutAttr( const SfxPoolItem& rItem );
659 SwFmt* GetFmt( SwDoc& rDoc ); // checks if it is still in the Doc!
662 // --> OD 2008-02-12 #newlistlevelattrs#
663 class SwUndoFmtResetAttr : public SwUndo
665 public:
666 SwUndoFmtResetAttr( SwFmt& rChangedFormat,
667 const USHORT nWhichId );
668 ~SwUndoFmtResetAttr();
670 virtual void Undo( SwUndoIter& );
671 virtual void Redo( SwUndoIter& );
673 private:
674 // format at which a certain attribute is reset.
675 SwFmt * const m_pChangedFormat;
676 // which ID of the reset attribute
677 const USHORT m_nWhichId;
678 // old attribute which has been reset - needed for undo.
679 ::std::auto_ptr<SfxPoolItem> m_pOldItem;
681 // <--
683 class SwUndoDontExpandFmt : public SwUndo
685 const ULONG m_nNodeIndex;
686 const xub_StrLen m_nContentIndex;
688 public:
689 SwUndoDontExpandFmt( const SwPosition& rPos );
690 virtual void Undo( SwUndoIter& );
691 virtual void Redo( SwUndoIter& );
692 virtual void Repeat( SwUndoIter& );
695 // helper class to receive changed attribute sets
696 class SwUndoFmtAttrHelper : public SwClient
698 ::std::auto_ptr<SwUndoFmtAttr> m_pUndo;
699 const bool m_bSaveDrawPt;
701 public:
702 SwUndoFmtAttrHelper( SwFmt& rFmt, bool bSaveDrawPt = true );
704 virtual void Modify( SfxPoolItem*, SfxPoolItem* );
706 SwUndoFmtAttr* GetUndo() const { return m_pUndo.get(); }
707 // release the undo object (so it is not deleted here), and return it
708 SwUndoFmtAttr* ReleaseUndo() { return m_pUndo.release(); }
712 class SwUndoFmtColl : public SwUndo, private SwUndRng
714 String aFmtName;
715 SwHistory* pHistory;
716 SwFmtColl* pFmtColl;
717 // --> OD 2008-04-15 #refactorlists# - for correct <ReDo(..)> and <Repeat(..)>
718 // boolean, which indicates that the attributes are reseted at the nodes
719 // before the format has been applied.
720 const bool mbReset;
721 // boolean, which indicates that the list attributes had been reseted at
722 // the nodes before the format has been applied.
723 const bool mbResetListAttrs;
724 // <--
725 public:
726 // --> OD 2008-04-15 #refactorlists#
727 // SwUndoFmtColl( const SwPaM&, SwFmtColl* );
728 SwUndoFmtColl( const SwPaM&, SwFmtColl*,
729 const bool bReset,
730 const bool bResetListAttrs );
731 // <--
732 virtual ~SwUndoFmtColl();
733 virtual void Undo( SwUndoIter& );
734 virtual void Redo( SwUndoIter& );
735 virtual void Repeat( SwUndoIter& );
737 // #111827#
739 Returns the rewriter for this undo object.
741 The rewriter contains one rule:
743 $1 -> <name of format collection>
745 <name of format collection> is the name of the format
746 collection that is applied by the action recorded by this undo
747 object.
749 @return the rewriter for this undo object
751 virtual SwRewriter GetRewriter() const;
753 SwHistory* GetHistory() { return pHistory; }
754 OUT_UNDOBJ( SetFmtColl )
758 class SwUndoMoveLeftMargin : public SwUndo, private SwUndRng
760 const ::std::auto_ptr<SwHistory> m_pHistory;
761 const bool m_bModulus;
763 public:
764 SwUndoMoveLeftMargin( const SwPaM&, BOOL bRight, BOOL bModulus );
765 virtual ~SwUndoMoveLeftMargin();
766 virtual void Undo( SwUndoIter& );
767 virtual void Redo( SwUndoIter& );
768 virtual void Repeat( SwUndoIter& );
770 SwHistory& GetHistory() { return *m_pHistory; }
772 OUT_UNDOBJ( MoveLeftMargin )
775 // Basis-Klasse fuer Insert von Dokument, Glossaries und Kopieren
776 class SwUndoInserts : public SwUndo, public SwUndRng, private SwUndoSaveCntnt
778 SwTxtFmtColl *pTxtFmtColl, *pLastNdColl;
779 SvPtrarr* pFrmFmts;
780 SwUndos* pFlyUndos;
781 SwRedlineData* pRedlData;
782 BOOL bSttWasTxtNd;
783 protected:
784 ULONG nNdDiff;
785 SwPosition *pPos; // Inhalt fuers Redo
786 USHORT nSetPos; // Start in der History-Liste
788 SwUndoInserts( SwUndoId nUndoId, const SwPaM& );
789 public:
790 virtual ~SwUndoInserts();
792 virtual void Undo( SwUndoIter& );
793 virtual void Redo( SwUndoIter& );
794 virtual void Repeat( SwUndoIter& );
795 // setze den Destination-Bereich nach dem Einlesen.
796 void SetInsertRange( const SwPaM&, BOOL bScanFlys = TRUE,
797 BOOL bSttWasTxtNd = TRUE );
798 OUT_UNDOBJ( Inserts )
801 class SwUndoInsDoc : public SwUndoInserts
803 public:
804 SwUndoInsDoc( const SwPaM& );
805 OUT_UNDOBJ( InsDoc )
808 class SwUndoCpyDoc : public SwUndoInserts
810 public:
811 SwUndoCpyDoc( const SwPaM& );
812 OUT_UNDOBJ( Copy )
815 class SwUndoInsTbl : public SwUndo
817 String sTblNm;
818 SwInsertTableOptions aInsTblOpts;
819 SwDDEFieldType* pDDEFldType;
820 SvUShorts* pColWidth;
821 SwRedlineData* pRedlData;
822 SwTableAutoFmt* pAutoFmt;
823 ULONG nSttNode;
824 USHORT nRows, nCols;
825 USHORT nAdjust;
827 public:
828 SwUndoInsTbl( const SwPosition&, USHORT nCols, USHORT nRows,
829 USHORT eAdjust, const SwInsertTableOptions& rInsTblOpts,
830 const SwTableAutoFmt* pTAFmt, const SvUShorts* pColArr,
831 const String & rName);
832 virtual ~SwUndoInsTbl();
833 virtual void Undo( SwUndoIter& );
834 virtual void Redo( SwUndoIter& );
835 virtual void Repeat( SwUndoIter& );
837 virtual SwRewriter GetRewriter() const;
839 OUT_UNDOBJ( InsTable )
842 class SwUndoTxtToTbl : public SwUndo, public SwUndRng
844 String sTblNm;
845 SwInsertTableOptions aInsTblOpts;
846 SvULongs* pDelBoxes;
847 SwTableAutoFmt* pAutoFmt;
848 SwHistory* pHistory;
849 sal_Unicode cTrenner;
850 USHORT nAdjust;
851 BOOL bSplitEnd : 1;
853 public:
854 SwUndoTxtToTbl( const SwPaM&, const SwInsertTableOptions&, sal_Unicode , USHORT,
855 const SwTableAutoFmt* pAFmt );
856 virtual ~SwUndoTxtToTbl();
858 virtual void Undo( SwUndoIter& );
859 virtual void Redo( SwUndoIter& );
860 virtual void Repeat( SwUndoIter& );
862 SwHistory& GetHistory(); // wird ggfs. angelegt
863 void AddFillBox( const SwTableBox& rBox );
864 OUT_UNDOBJ( TextToTable )
867 class SwUndoTblToTxt : public SwUndo
869 String sTblNm;
870 SwDDEFieldType* pDDEFldType;
871 _SaveTable* pTblSave;
872 SwTblToTxtSaves* pBoxSaves;
873 SwHistory* pHistory;
874 ULONG nSttNd, nEndNd;
875 USHORT nAdjust;
876 sal_Unicode cTrenner;
877 USHORT nHdlnRpt;
878 BOOL bCheckNumFmt : 1;
880 public:
881 SwUndoTblToTxt( const SwTable& rTbl, sal_Unicode cCh );
882 virtual ~SwUndoTblToTxt();
883 virtual void Undo( SwUndoIter& );
884 virtual void Redo( SwUndoIter& );
885 virtual void Repeat( SwUndoIter& );
887 void SetRange( const SwNodeRange& );
888 void AddBoxPos( SwDoc& rDoc, ULONG nNdIdx, ULONG nEndIdx,
889 xub_StrLen nCntntIdx = STRING_MAXLEN);
890 OUT_UNDOBJ( TableToText )
893 class SwUndoAttrTbl : public SwUndo
895 ULONG nSttNode;
896 _SaveTable* pSaveTbl;
897 BOOL bClearTabCol : 1;
898 public:
899 SwUndoAttrTbl( const SwTableNode& rTblNd, BOOL bClearTabCols = FALSE );
900 virtual ~SwUndoAttrTbl();
901 virtual void Undo( SwUndoIter& );
902 virtual void Redo( SwUndoIter& );
903 OUT_UNDOBJ( SetTableAttr )
906 class SwUndoTblAutoFmt : public SwUndo
908 ULONG nSttNode;
909 _SaveTable* pSaveTbl;
910 SwUndos* pUndos;
911 BOOL bSaveCntntAttr;
913 void UndoRedo( BOOL bUndo, SwUndoIter& rUndoIter );
915 public:
916 SwUndoTblAutoFmt( const SwTableNode& rTblNd, const SwTableAutoFmt& );
917 virtual ~SwUndoTblAutoFmt();
918 virtual void Undo( SwUndoIter& );
919 virtual void Redo( SwUndoIter& );
920 void SaveBoxCntnt( const SwTableBox& rBox );
921 OUT_UNDOBJ( TableAutoFmt )
924 class SwUndoTblNdsChg : public SwUndo
926 _SaveTable* pSaveTbl;
927 SvULongs aBoxes;
929 union {
930 SvULongs* pNewSttNds;
931 SwUndoSaveSections* pDelSects;
932 } Ptrs;
933 SvBools aMvBoxes; // fuers SplitRow (aufgeteilte Nodes einer Box)
934 long nMin, nMax; // for redo of delete column
935 ULONG nSttNode, nCurrBox;
936 USHORT nCount, nRelDiff, nAbsDiff, nSetColType;
937 BOOL bFlag;
938 BOOL bSameHeight; // only used for SplitRow
939 public:
940 SwUndoTblNdsChg( SwUndoId UndoId,
941 const SwSelBoxes& rBoxes,
942 const SwTableNode& rTblNd,
943 long nMn, long nMx,
944 USHORT nCnt, BOOL bFlg, BOOL bSameHeight );
946 // fuer SetColWidth
947 SwUndoTblNdsChg( SwUndoId UndoId, const SwSelBoxes& rBoxes,
948 const SwTableNode& rTblNd );
950 virtual ~SwUndoTblNdsChg();
951 virtual void Undo( SwUndoIter& );
952 virtual void Redo( SwUndoIter& );
954 void SaveNewBoxes( const SwTableNode& rTblNd, const SwTableSortBoxes& rOld );
955 void SaveNewBoxes( const SwTableNode& rTblNd, const SwTableSortBoxes& rOld,
956 const SwSelBoxes& rBoxes, const SvULongs& rNodeCnts );
957 void SaveSection( SwStartNode* pSttNd );
958 void ReNewBoxes( const SwSelBoxes& rBoxes );
961 void SetColWidthParam( ULONG nBoxIdx, USHORT nMode, USHORT nType,
962 SwTwips nAbsDif, SwTwips nRelDif )
964 nCurrBox = nBoxIdx;
965 nCount = nMode;
966 nSetColType = nType;
967 nAbsDiff = (USHORT)nAbsDif;
968 nRelDiff = (USHORT)nRelDif;
971 OUT_UNDOBJ( TblNodesChg )
974 class SwUndoTblMerge : public SwUndo, private SwUndRng
976 ULONG nTblNode;
977 _SaveTable* pSaveTbl;
978 SvULongs aBoxes, aNewSttNds;
979 SwUndoMoves* pMoves;
980 SwHistory* pHistory;
982 public:
983 SwUndoTblMerge( const SwPaM& rTblSel );
984 virtual ~SwUndoTblMerge();
985 virtual void Undo( SwUndoIter& );
986 virtual void Redo( SwUndoIter& );
988 void MoveBoxCntnt( SwDoc* pDoc, SwNodeRange& rRg, SwNodeIndex& rPos );
990 void SetSelBoxes( const SwSelBoxes& rBoxes );
992 void AddNewBox( ULONG nSttNdIdx )
993 { aNewSttNds.Insert( nSttNdIdx, aNewSttNds.Count() ); }
995 void SaveCollection( const SwTableBox& rBox );
997 OUT_UNDOBJ( TblMerge )
1001 class SwUndoTblNumFmt : public SwUndo
1003 SfxItemSet *pBoxSet;
1004 SwHistory* pHistory;
1005 String aStr, aNewFml;
1007 ULONG nFmtIdx, nNewFmtIdx;
1008 double fNum, fNewNum;
1009 ULONG nNode;
1010 ULONG nNdPos;
1012 BOOL bNewFmt : 1;
1013 BOOL bNewFml : 1;
1014 BOOL bNewValue : 1;
1016 public:
1017 SwUndoTblNumFmt( const SwTableBox& rBox, const SfxItemSet* pNewSet = 0 );
1018 virtual ~SwUndoTblNumFmt();
1019 virtual void Undo( SwUndoIter& );
1020 virtual void Redo( SwUndoIter& );
1022 void SetNumFmt( ULONG nNewNumFmtIdx, const double& rNewNumber )
1023 { nFmtIdx = nNewNumFmtIdx; fNum = rNewNumber; }
1024 void SetBox( const SwTableBox& rBox );
1025 OUT_UNDOBJ( TblNumFmt )
1028 class _UndoTblCpyTbl_Entries;
1030 class SwUndoTblCpyTbl : public SwUndo
1032 _UndoTblCpyTbl_Entries* pArr;
1033 SwUndoTblNdsChg* pInsRowUndo;
1035 //b6341295: When redlining is active, PrepareRedline has to create the redlining attributes
1036 //for the new and the old table cell content
1037 SwUndo* PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox, const SwPosition& rPos,
1038 bool& rJoin, bool bRedo );
1039 public:
1040 SwUndoTblCpyTbl();
1041 virtual ~SwUndoTblCpyTbl();
1042 virtual void Undo( SwUndoIter& );
1043 virtual void Redo( SwUndoIter& );
1045 void AddBoxBefore( const SwTableBox& rBox, BOOL bDelCntnt );
1046 void AddBoxAfter( const SwTableBox& rBox, const SwNodeIndex& rIdx, BOOL bDelCntnt );
1048 BOOL IsEmpty() const;
1049 BOOL InsertRow( SwTable& rTbl, const SwSelBoxes& rBoxes, USHORT nCnt );
1050 OUT_UNDOBJ( TblCpyTbl )
1053 class SwUndoCpyTbl : public SwUndo
1055 SwUndoDelete* pDel;
1056 ULONG nTblNode;
1057 public:
1058 SwUndoCpyTbl();
1059 virtual ~SwUndoCpyTbl();
1060 virtual void Undo( SwUndoIter& );
1061 virtual void Redo( SwUndoIter& );
1063 void SetTableSttIdx( ULONG nIdx ) { nTblNode = nIdx; }
1064 OUT_UNDOBJ( CpyTbl )
1067 class SwUndoSplitTbl : public SwUndo
1069 ULONG nTblNode, nOffset;
1070 SwSaveRowSpan* mpSaveRowSpan; // stores the row span values at the splitting row
1071 _SaveTable* pSavTbl;
1072 SwHistory* pHistory;
1073 USHORT nMode, nFmlEnd;
1074 BOOL bCalcNewSize;
1075 public:
1076 SwUndoSplitTbl( const SwTableNode& rTblNd, SwSaveRowSpan* pRowSp, USHORT nMode, BOOL bCalcNewSize );
1077 virtual ~SwUndoSplitTbl();
1078 virtual void Undo( SwUndoIter& );
1079 virtual void Redo( SwUndoIter& );
1080 virtual void Repeat( SwUndoIter& );
1082 void SetTblNodeOffset( ULONG nIdx ) { nOffset = nIdx - nTblNode; }
1083 SwHistory* GetHistory() { return pHistory; }
1084 void SaveFormula( SwHistory& rHistory );
1087 class SwUndoMergeTbl : public SwUndo
1089 String aName;
1090 ULONG nTblNode;
1091 _SaveTable* pSavTbl, *pSavHdl;
1092 SwHistory* pHistory;
1093 USHORT nMode;
1094 BOOL bWithPrev;
1095 public:
1096 SwUndoMergeTbl( const SwTableNode& rTblNd, const SwTableNode& rDelTblNd,
1097 BOOL bWithPrev, USHORT nMode );
1098 virtual ~SwUndoMergeTbl();
1099 virtual void Undo( SwUndoIter& );
1100 virtual void Redo( SwUndoIter& );
1101 virtual void Repeat( SwUndoIter& );
1103 void SaveFormula( SwHistory& rHistory );
1107 class SwUndoBookmark : public SwUndo
1109 const ::std::auto_ptr<SwHistoryBookmark> m_pHistoryBookmark;
1111 protected:
1112 SwUndoBookmark( SwUndoId nUndoId, const ::sw::mark::IMark& );
1114 void SetInDoc( SwDoc* );
1115 void ResetInDoc( SwDoc* );
1117 public:
1118 virtual ~SwUndoBookmark();
1120 // #111827#
1122 Returns the rewriter for this undo object.
1124 The rewriter contains the following rule:
1126 $1 -> <name of bookmark>
1128 <name of bookmark> is the name of the bookmark whose
1129 insertion/deletion is recorded by this undo object.
1131 @return the rewriter for this undo object
1133 virtual SwRewriter GetRewriter() const;
1137 class SwUndoDelBookmark : public SwUndoBookmark
1139 public:
1140 SwUndoDelBookmark( const ::sw::mark::IMark& );
1141 virtual void Undo( SwUndoIter& );
1142 virtual void Redo( SwUndoIter& );
1143 OUT_UNDOBJ( DelBookmark )
1146 class SwUndoInsBookmark : public SwUndoBookmark
1148 public:
1149 SwUndoInsBookmark( const ::sw::mark::IMark& );
1150 virtual void Undo( SwUndoIter& );
1151 virtual void Redo( SwUndoIter& );
1152 OUT_UNDOBJ( InsBookmark )
1156 /*--------------------------------------------------------------------
1157 Beschreibung: Undo auf Sorting
1158 --------------------------------------------------------------------*/
1160 struct SwSortUndoElement
1162 union {
1163 struct {
1164 ULONG nKenn;
1165 ULONG nSource, nTarget;
1166 } TXT;
1167 struct {
1168 String *pSource, *pTarget;
1169 } TBL;
1170 } SORT_TXT_TBL;
1172 SwSortUndoElement( const String& aS, const String& aT )
1174 SORT_TXT_TBL.TBL.pSource = new String( aS );
1175 SORT_TXT_TBL.TBL.pTarget = new String( aT );
1177 SwSortUndoElement( ULONG nS, ULONG nT )
1179 SORT_TXT_TBL.TXT.nSource = nS;
1180 SORT_TXT_TBL.TXT.nTarget = nT;
1181 SORT_TXT_TBL.TXT.nKenn = 0xffffffff;
1183 ~SwSortUndoElement();
1186 SV_DECL_PTRARR_DEL(SwSortList, SwSortUndoElement*, 10,30)
1187 SV_DECL_PTRARR(SwUndoSortList, SwNodeIndex*, 10,30)
1189 class SwUndoSort : public SwUndo, private SwUndRng
1191 SwSortOptions* pSortOpt; // die Optionen mit den Sortier-Kriterien
1192 SwSortList aSortList;
1193 SwUndoAttrTbl* pUndoTblAttr;
1194 SwRedlineData* pRedlData;
1195 ULONG nTblNd;
1197 void RemoveIdx( SwPaM& rPam );
1198 public:
1199 SwUndoSort( const SwPaM&, const SwSortOptions& );
1200 SwUndoSort( ULONG nStt, ULONG nEnd, const SwTableNode&,
1201 const SwSortOptions&, BOOL bSaveTable );
1202 virtual ~SwUndoSort();
1204 virtual void Undo( SwUndoIter& );
1205 virtual void Redo( SwUndoIter& );
1206 virtual void Repeat( SwUndoIter& );
1208 void Insert( const String& rOrgPos, const String& rNewPos );
1209 void Insert( ULONG nOrgPos, ULONG nNewPos );
1211 OUT_UNDOBJ( Sort )
1216 //--------------------------------------------------------------------
1218 class SwUndoFlyBase : public SwUndo, private SwUndoSaveSection
1220 protected:
1221 SwFrmFmt* pFrmFmt; // das gespeicherte FlyFormat
1222 ULONG nNdPgPos;
1223 xub_StrLen nCntPos; // Seite/am Absatz/im Absatz
1224 USHORT nRndId;
1225 BOOL bDelFmt; // loesche das gespeicherte Format
1227 void InsFly( SwUndoIter&, BOOL bShowSel = TRUE );
1228 void DelFly( SwDoc* );
1230 SwUndoFlyBase( SwFrmFmt* pFormat, SwUndoId nUndoId );
1232 SwNodeIndex* GetMvSttIdx() const { return SwUndoSaveSection::GetMvSttIdx(); }
1233 ULONG GetMvNodeCnt() const { return SwUndoSaveSection::GetMvNodeCnt(); }
1235 public:
1236 virtual ~SwUndoFlyBase();
1238 virtual void Undo( SwUndoIter& ) = 0;
1239 virtual void Redo( SwUndoIter& ) = 0;
1241 OUT_UNDOBJ( FlyBase )
1244 class SwUndoInsLayFmt : public SwUndoFlyBase
1246 ULONG mnCrsrSaveIndexPara; // Cursor position
1247 xub_StrLen mnCrsrSaveIndexPos; // for undo
1248 public:
1249 SwUndoInsLayFmt( SwFrmFmt* pFormat, ULONG nNodeIdx, xub_StrLen nCntIdx );
1250 ~SwUndoInsLayFmt();
1252 virtual void Undo( SwUndoIter& );
1253 virtual void Redo( SwUndoIter& );
1254 virtual void Repeat( SwUndoIter& );
1256 String GetComment() const;
1258 OUT_UNDOBJ( InsLayFmt )
1261 class SwUndoDelLayFmt : public SwUndoFlyBase
1263 BOOL bShowSelFrm;
1264 public:
1265 SwUndoDelLayFmt( SwFrmFmt* pFormat );
1267 virtual void Undo( SwUndoIter& );
1268 virtual void Redo( SwUndoIter& );
1269 void Redo(); // Schnittstelle fuers Rollback
1271 void ChgShowSel( BOOL bNew ) { bShowSelFrm = bNew; }
1273 virtual SwRewriter GetRewriter() const;
1275 OUT_UNDOBJ( DelLayFmt )
1279 class SwUndoSetFlyFmt : public SwUndo, public SwClient
1281 SwFrmFmt* pFrmFmt; // das gespeicherte FlyFormat
1282 SwFrmFmt* pOldFmt; // die alte Fly Vorlage
1283 SwFrmFmt* pNewFmt; // die neue Fly Vorlage
1284 SfxItemSet* pItemSet; // die zurueck-/ gesetzten Attribute
1285 ULONG nOldNode, nNewNode;
1286 xub_StrLen nOldCntnt, nNewCntnt;
1287 USHORT nOldAnchorTyp, nNewAnchorTyp;
1288 BOOL bAnchorChgd;
1290 void PutAttr( USHORT nWhich, const SfxPoolItem* pItem );
1291 void Modify( SfxPoolItem*, SfxPoolItem* );
1292 void GetAnchor( SwFmtAnchor& rAnhor, ULONG nNode, xub_StrLen nCntnt );
1294 public:
1295 SwUndoSetFlyFmt( SwFrmFmt& rFlyFmt, SwFrmFmt& rNewFrmFmt );
1296 virtual ~SwUndoSetFlyFmt();
1298 virtual void Undo( SwUndoIter& );
1299 virtual void Redo( SwUndoIter& );
1301 virtual SwRewriter GetRewriter() const;
1304 //--------------------------------------------------------------------
1306 class _UnReplaceData;
1307 SV_DECL_PTRARR_DEL( _UnReplaceDatas, _UnReplaceData*, 10, 25 )
1309 class SwUndoReplace : public SwUndo
1311 friend class SwDoc;
1313 BOOL bOldIterFlag; // Status vom Undo-Iter vorm 1. Aufruf
1314 USHORT nAktPos; // fuer GetUndoRange und Undo/Redo
1315 _UnReplaceDatas aArr;
1316 SwRedlineData* pRedlData;
1318 public:
1319 SwUndoReplace();
1320 virtual ~SwUndoReplace();
1321 virtual void Undo( SwUndoIter& );
1322 virtual void Redo( SwUndoIter& );
1324 // #111827#
1326 Returns the rewriter of this undo object.
1328 If this undo object represents several replacements the
1329 rewriter contains the following rules:
1331 $1 -> <number of replacements>
1332 $2 -> occurrences of
1333 $3 -> <replaced text>
1335 If this undo object represents one replacement the rewriter
1336 contains these rules:
1338 $1 -> <replaced text>
1339 $2 -> "->" (STR_YIELDS)
1340 $3 -> <replacing text>
1342 @return the rewriter of this undo object
1344 virtual SwRewriter GetRewriter() const;
1346 void AddEntry( const SwPaM& rPam, const String& rInsert, BOOL bRegExp );
1347 void SetEntryEnd( const SwPaM& rPam );
1349 BOOL IsFull() const
1350 { return ((USHRT_MAX / sizeof( void* )) - 50 ) < aArr.Count(); }
1352 OUT_UNDOBJ( Replace )
1356 //--------------------------------------------------------------------
1359 class SwUndoTblHeadline : public SwUndo
1361 ULONG nTblNd;
1362 USHORT nOldHeadline;
1363 USHORT nNewHeadline;
1364 public:
1365 SwUndoTblHeadline( const SwTable&, USHORT nOldHdl, USHORT nNewHdl );
1366 virtual void Undo( SwUndoIter& );
1367 virtual void Redo( SwUndoIter& );
1368 virtual void Repeat( SwUndoIter& );
1369 OUT_UNDOBJ( SwUndoTblHeadline )
1373 //------------ Undo von Insert-/Delete-Sections ----------------------
1375 class SwUndoInsSection : public SwUndo, private SwUndRng
1377 SwHistory* pHistory;
1378 SwSection* pSection;
1379 SwRedlineData* pRedlData;
1380 SfxItemSet* pAttr;
1381 ULONG nSectNodePos;
1382 BOOL bSplitAtStt : 1;
1383 BOOL bSplitAtEnd : 1;
1384 BOOL bUpdateFtn : 1;
1386 void Join( SwDoc& rDoc, ULONG nNode );
1388 public:
1389 SwUndoInsSection( const SwPaM&, const SwSection&,
1390 const SfxItemSet* pSet );
1391 virtual ~SwUndoInsSection();
1392 virtual void Undo( SwUndoIter& );
1393 virtual void Redo( SwUndoIter& );
1394 virtual void Repeat( SwUndoIter& );
1395 OUT_UNDOBJ( SwUndoInsSection )
1397 void SetSectNdPos( ULONG nPos ) { nSectNodePos = nPos; }
1398 void SaveSplitNode( SwTxtNode* pTxtNd, BOOL bAtStt );
1399 void SetUpdtFtnFlag( BOOL bFlag ) { bUpdateFtn = bFlag; }
1402 class SwUndoDelSection : public SwUndo
1404 ULONG nSttNd, nEndNd;
1405 SwSection* pSection;
1406 SfxItemSet* pAttr;
1407 public:
1408 SwUndoDelSection( const SwSectionFmt& );
1409 virtual ~SwUndoDelSection();
1410 virtual void Undo( SwUndoIter& );
1411 virtual void Redo( SwUndoIter& );
1412 OUT_UNDOBJ( SwUndoDelSection )
1415 class SwUndoChgSection : public SwUndo
1417 ULONG nSttNd;
1418 SwSection* pSection;
1419 SfxItemSet* pAttr;
1420 BOOL bOnlyAttrChgd;
1421 public:
1422 SwUndoChgSection( const SwSectionFmt&, BOOL bOnlyAttrChgd );
1423 virtual ~SwUndoChgSection();
1424 virtual void Undo( SwUndoIter& );
1425 virtual void Redo( SwUndoIter& );
1426 OUT_UNDOBJ( SwUndoChgSection )
1429 //------------ Undo von verschieben/stufen von Gliederung ----------------
1431 class SwUndoOutlineLeftRight : public SwUndo, private SwUndRng
1433 short nOffset;
1434 public:
1435 SwUndoOutlineLeftRight( const SwPaM& rPam, short nOffset );
1436 virtual void Undo( SwUndoIter& );
1437 virtual void Redo( SwUndoIter& );
1438 virtual void Repeat( SwUndoIter& );
1439 OUT_UNDOBJ( SwUndoOutlineLeftRight )
1442 //--------------------------------------------------------------------
1444 class SwUndoDefaultAttr : public SwUndo
1446 ::std::auto_ptr<SfxItemSet> m_pOldSet; // the old attributes
1447 ::std::auto_ptr<SvxTabStopItem> m_pTabStop;
1449 public:
1450 // registers at the format and saves old attributes
1451 SwUndoDefaultAttr( const SfxItemSet& rOldSet );
1452 virtual ~SwUndoDefaultAttr();
1453 virtual void Undo( SwUndoIter& );
1454 virtual void Redo( SwUndoIter& );
1455 OUT_UNDOBJ( DefaultAttr )
1458 //--------------------------------------------------------------------
1459 // ---------- Undo fuer Numerierung ----------------------------------
1461 class SwUndoInsNum : public SwUndo, private SwUndRng
1463 SwNumRule aNumRule;
1464 SwHistory* pHistory;
1465 ULONG nSttSet;
1466 SwNumRule* pOldNumRule;
1467 String sReplaceRule;
1468 USHORT nLRSavePos;
1469 public:
1470 SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule );
1471 SwUndoInsNum( const SwNumRule& rOldRule, const SwNumRule& rNewRule,
1472 SwUndoId nUndoId = UNDO_INSFMTATTR );
1473 SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule,
1474 const String& rReplaceRule );
1475 virtual ~SwUndoInsNum();
1476 virtual void Undo( SwUndoIter& );
1477 virtual void Redo( SwUndoIter& );
1478 virtual void Repeat( SwUndoIter& );
1479 virtual SwRewriter GetRewriter() const;
1481 SwHistory* GetHistory(); // wird ggfs. neu angelegt!
1482 void SetSttNum( ULONG nNdIdx ) { nSttSet = nNdIdx; }
1483 void SaveOldNumRule( const SwNumRule& rOld );
1485 void SetLRSpaceEndPos();
1487 OUT_UNDOBJ( InsNum )
1490 class SwUndoDelNum : public SwUndo, private SwUndRng
1492 SvULongs aNodeIdx;
1493 SvBytes aLevels;
1494 SvBools aRstLRSpaces;
1495 SwHistory* pHistory;
1496 public:
1497 SwUndoDelNum( const SwPaM& rPam );
1498 virtual ~SwUndoDelNum();
1499 virtual void Undo( SwUndoIter& );
1500 virtual void Redo( SwUndoIter& );
1501 virtual void Repeat( SwUndoIter& );
1503 void AddNode( const SwTxtNode& rNd, BOOL bResetLRSpace );
1504 SwHistory* GetHistory() { return pHistory; }
1506 OUT_UNDOBJ( DelNum )
1509 class SwUndoMoveNum : public SwUndo, private SwUndRng
1511 ULONG nNewStt;
1512 long nOffset;
1513 public:
1514 SwUndoMoveNum( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv = FALSE );
1515 virtual void Undo( SwUndoIter& );
1516 virtual void Redo( SwUndoIter& );
1517 virtual void Repeat( SwUndoIter& );
1518 void SetStartNode( ULONG nValue ) { nNewStt = nValue; }
1519 OUT_UNDOBJ( MoveNum )
1522 class SwUndoNumUpDown : public SwUndo, private SwUndRng
1524 short nOffset;
1525 public:
1526 SwUndoNumUpDown( const SwPaM& rPam, short nOffset );
1527 virtual void Undo( SwUndoIter& );
1528 virtual void Redo( SwUndoIter& );
1529 virtual void Repeat( SwUndoIter& );
1530 OUT_UNDOBJ( NumUpDown )
1533 class SwUndoNumOrNoNum : public SwUndo
1535 ULONG nIdx;
1536 BOOL mbNewNum, mbOldNum;
1538 public:
1539 SwUndoNumOrNoNum( const SwNodeIndex& rIdx, BOOL mbOldNum,
1540 BOOL mbNewNum );
1541 virtual void Undo( SwUndoIter& );
1542 virtual void Redo( SwUndoIter& );
1543 virtual void Repeat( SwUndoIter& );
1544 OUT_UNDOBJ( NumOrNoNum )
1547 class SwUndoNumRuleStart : public SwUndo
1549 ULONG nIdx;
1550 USHORT nOldStt, nNewStt;
1551 BOOL bSetSttValue : 1;
1552 BOOL bFlag : 1;
1553 public:
1554 SwUndoNumRuleStart( const SwPosition& rPos, BOOL bDelete );
1555 SwUndoNumRuleStart( const SwPosition& rPos, USHORT nStt );
1556 virtual void Undo( SwUndoIter& );
1557 virtual void Redo( SwUndoIter& );
1558 virtual void Repeat( SwUndoIter& );
1559 OUT_UNDOBJ( NumRuleStart )
1562 //--------------------------------------------------------------------
1563 // ---------- Undo fuer DrawObjecte ----------------------------------
1565 class SwSdrUndo : public SwUndo
1567 SdrUndoAction* pSdrUndo;
1568 SdrMarkList* pMarkList; // MarkList for all selected SdrObjects
1569 public:
1570 SwSdrUndo( SdrUndoAction* , const SdrMarkList* pMarkList );
1571 virtual ~SwSdrUndo();
1572 virtual void Undo( SwUndoIter& );
1573 virtual void Redo( SwUndoIter& );
1575 String GetComment() const;
1578 class SwUndoDrawGroup : public SwUndo
1580 SwUndoGroupObjImpl* pObjArr;
1581 USHORT nSize;
1582 BOOL bDelFmt;
1584 public:
1585 SwUndoDrawGroup( USHORT nCnt );
1586 virtual ~SwUndoDrawGroup();
1587 virtual void Undo( SwUndoIter& );
1588 virtual void Redo( SwUndoIter& );
1590 void AddObj( USHORT nPos, SwDrawFrmFmt*, SdrObject* );
1591 void SetGroupFmt( SwDrawFrmFmt* );
1594 // --> OD 2006-11-01 #130889#
1595 // Action "ungroup drawing object" is now splitted into three parts - see
1596 // method <SwDoc::UnGroupSelection(..)>:
1597 // - creation for <SwDrawFrmFmt> instances for the group members of the
1598 // selected group objects
1599 // - intrinsic ungroup of the selected group objects
1600 // - creation of <SwDrawContact> instances for the former group members and
1601 // connection to the Writer layout.
1602 // Thus, two undo actions (instances of <SwUndo>) are needed:
1603 // - Existing class <SwUndoDrawUnGroup> takes over the part for the formats.
1604 // - New class <SwUndoDrawUnGroupConnectToLayout> takes over the part for
1605 // contact object.
1606 class SwUndoDrawUnGroup : public SwUndo
1608 SwUndoGroupObjImpl* pObjArr;
1609 USHORT nSize;
1610 BOOL bDelFmt;
1612 public:
1613 SwUndoDrawUnGroup( SdrObjGroup* );
1614 virtual ~SwUndoDrawUnGroup();
1615 virtual void Undo( SwUndoIter& );
1616 virtual void Redo( SwUndoIter& );
1618 void AddObj( USHORT nPos, SwDrawFrmFmt* );
1621 // --> OD 2006-11-01 #130889#
1622 class SwUndoDrawUnGroupConnectToLayout : public SwUndo
1624 private:
1625 std::vector< std::pair< SwDrawFrmFmt*, SdrObject* > > aDrawFmtsAndObjs;
1627 public:
1628 SwUndoDrawUnGroupConnectToLayout();
1629 virtual ~SwUndoDrawUnGroupConnectToLayout();
1630 virtual void Undo( SwUndoIter& );
1631 virtual void Redo( SwUndoIter& );
1633 void AddFmtAndObj( SwDrawFrmFmt* pDrawFrmFmt,
1634 SdrObject* pDrawObject );
1636 // <--
1639 class SwUndoDrawDelete : public SwUndo
1641 SwUndoGroupObjImpl* pObjArr;
1642 SdrMarkList* pMarkLst; // MarkList for all selected SdrObjects
1643 USHORT nSize;
1644 BOOL bDelFmt;
1646 public:
1647 SwUndoDrawDelete( USHORT nCnt );
1648 virtual ~SwUndoDrawDelete();
1649 virtual void Undo( SwUndoIter& );
1650 virtual void Redo( SwUndoIter& );
1652 void AddObj( USHORT nPos, SwDrawFrmFmt*, const SdrMark& );
1655 //--------------------------------------------------------------------
1657 class SwUndoReRead : public SwUndo
1659 Graphic *pGrf;
1660 String *pNm, *pFltr;
1661 ULONG nPos;
1662 USHORT nMirr;
1664 void SaveGraphicData( const SwGrfNode& );
1665 void SetAndSave( SwUndoIter& );
1667 public:
1668 SwUndoReRead( const SwPaM& rPam, const SwGrfNode& pGrfNd );
1669 virtual ~SwUndoReRead();
1671 virtual void Undo( SwUndoIter& );
1672 virtual void Redo( SwUndoIter& );
1675 //--------------------------------------------------------------------
1677 class SwUndoInsertLabel : public SwUndo
1679 union {
1680 struct {
1681 // fuer NoTxtFrms
1682 SwUndoInsLayFmt* pUndoFly;
1683 SwUndoFmtAttr* pUndoAttr;
1684 } OBJECT;
1685 struct {
1686 // fuer Tabelle/TextRahmen
1687 SwUndoDelete* pUndoInsNd;
1688 ULONG nNode;
1689 } NODE;
1692 String sText;
1693 // --> PB 2005-01-06 #i39983# - the separator will be drawed with a character style
1694 String sSeparator;
1695 // <--
1696 String sNumberSeparator;
1697 String sCharacterStyle;
1698 // OD 2004-04-15 #i26791# - re-store of drawing object position no longer needed
1699 USHORT nFldId;
1700 SwLabelType eType;
1701 BYTE nLayerId; // fuer Zeichen-Objekte
1702 BOOL bBefore :1;
1703 BOOL bUndoKeep :1;
1704 BOOL bCpyBrd :1;
1706 public:
1707 SwUndoInsertLabel( const SwLabelType eTyp, const String &rText,
1708 // --> PB 2005-01-06 #i39983# - the separator will be drawed with a character style
1709 const String& rSeparator,
1710 // <--
1711 const String& rNumberSeparator, //#i61007# order of captions
1712 const BOOL bBefore, const USHORT nId,
1713 const String& rCharacterStyle,
1714 const BOOL bCpyBrd );
1715 virtual ~SwUndoInsertLabel();
1717 virtual void Undo( SwUndoIter& );
1718 virtual void Redo( SwUndoIter& );
1719 virtual void Repeat( SwUndoIter& );
1721 // #111827#
1723 Returns the rewriter of this undo object.
1725 The rewriter contains this rule:
1727 $1 -> '<text of inserted label>'
1729 <text of inserted label> is shortened to nUndoStringLength
1730 characters.
1732 @return the rewriter of this undo object
1734 virtual SwRewriter GetRewriter() const;
1736 void SetNodePos( ULONG nNd )
1737 { if( LTYPE_OBJECT != eType ) NODE.nNode = nNd; }
1739 void SetUndoKeep() { bUndoKeep = TRUE; }
1740 void SetFlys( SwFrmFmt& rOldFly, SfxItemSet& rChgSet, SwFrmFmt& rNewFly );
1741 void SetDrawObj( BYTE nLayerId );
1744 //--------------------------------------------------------------------
1746 class SwUndoChangeFootNote : public SwUndo, private SwUndRng
1748 const ::std::auto_ptr<SwHistory> m_pHistory;
1749 const String m_Text;
1750 const USHORT m_nNumber;
1751 const bool m_bEndNote;
1753 public:
1754 SwUndoChangeFootNote( const SwPaM& rRange, const String& rTxt,
1755 USHORT nNum, bool bIsEndNote );
1756 virtual ~SwUndoChangeFootNote();
1758 virtual void Undo( SwUndoIter& );
1759 virtual void Redo( SwUndoIter& );
1760 virtual void Repeat( SwUndoIter& );
1762 SwHistory& GetHistory() { return *m_pHistory; }
1765 class SwUndoFootNoteInfo : public SwUndo
1767 ::std::auto_ptr<SwFtnInfo> m_pFootNoteInfo;
1769 public:
1770 SwUndoFootNoteInfo( const SwFtnInfo &rInfo );
1771 virtual ~SwUndoFootNoteInfo();
1773 virtual void Undo( SwUndoIter& );
1774 virtual void Redo( SwUndoIter& );
1777 class SwUndoEndNoteInfo : public SwUndo
1779 ::std::auto_ptr<SwEndNoteInfo> m_pEndNoteInfo;
1781 public:
1782 SwUndoEndNoteInfo( const SwEndNoteInfo &rInfo );
1783 virtual ~SwUndoEndNoteInfo();
1785 virtual void Undo( SwUndoIter& );
1786 virtual void Redo( SwUndoIter& );
1790 //--------------------------------------------------------------------
1792 struct _UndoTransliterate_Data;
1793 class SwUndoTransliterate : public SwUndo, public SwUndRng
1795 _UndoTransliterate_Data *pData, *pLastData;
1796 sal_uInt32 nType;
1798 public:
1799 SwUndoTransliterate( const SwPaM& rPam,
1800 const utl::TransliterationWrapper& rTrans );
1801 virtual ~SwUndoTransliterate();
1803 virtual void Undo( SwUndoIter& rUndoIter );
1804 virtual void Redo( SwUndoIter& rUndoIter );
1805 virtual void Repeat( SwUndoIter& rUndoIter );
1807 void AddChanges( SwTxtNode& rTNd, xub_StrLen nStart, xub_StrLen nLen,
1808 ::com::sun::star::uno::Sequence <sal_Int32>& rOffsets );
1809 BOOL HasData() const {return 0 != pData; }
1812 //--------------------------------------------------------------------
1814 class SwUndoRedline : public SwUndo, public SwUndRng
1816 protected:
1817 SwRedlineData* pRedlData;
1818 SwRedlineSaveDatas* pRedlSaveData;
1819 SwUndoId nUserId;
1820 BOOL bHiddenRedlines;
1822 virtual void _Undo( SwUndoIter& );
1823 virtual void _Redo( SwUndoIter& );
1825 public:
1826 SwUndoRedline( SwUndoId nUserId, const SwPaM& rRange );
1827 virtual ~SwUndoRedline();
1828 virtual void Undo( SwUndoIter& );
1829 virtual void Redo( SwUndoIter& );
1831 SwUndoId GetUserId() const { return nUserId; }
1832 USHORT GetRedlSaveCount() const
1833 { return pRedlSaveData ? pRedlSaveData->Count() : 0; }
1836 class SwUndoRedlineDelete : public SwUndoRedline
1838 BOOL bCanGroup : 1;
1839 BOOL bIsDelim : 1;
1840 BOOL bIsBackspace : 1;
1842 virtual void _Undo( SwUndoIter& );
1843 virtual void _Redo( SwUndoIter& );
1845 public:
1846 SwUndoRedlineDelete( const SwPaM& rRange, SwUndoId nUserId = UNDO_EMPTY );
1848 BOOL CanGrouping( const SwUndoRedlineDelete& rPrev );
1851 class SwUndoRedlineSort : public SwUndoRedline
1853 SwSortOptions* pOpt;
1854 ULONG nSaveEndNode, nOffset;
1855 xub_StrLen nSaveEndCntnt;
1857 virtual void _Undo( SwUndoIter& );
1858 virtual void _Redo( SwUndoIter& );
1860 public:
1861 SwUndoRedlineSort( const SwPaM& rRange, const SwSortOptions& rOpt );
1862 virtual ~SwUndoRedlineSort();
1863 virtual void Repeat( SwUndoIter& );
1865 void SetSaveRange( const SwPaM& rRange );
1866 void SetOffset( const SwNodeIndex& rIdx );
1869 class SwUndoAcceptRedline : public SwUndoRedline
1871 virtual void _Redo( SwUndoIter& );
1872 public:
1873 SwUndoAcceptRedline( const SwPaM& rRange );
1874 virtual void Repeat( SwUndoIter& );
1877 class SwUndoRejectRedline : public SwUndoRedline
1879 virtual void _Redo( SwUndoIter& );
1880 public:
1881 SwUndoRejectRedline( const SwPaM& rRange );
1882 virtual void Repeat( SwUndoIter& );
1885 //--------------------------------------------------------------------
1887 class SwUndoCompDoc : public SwUndo, public SwUndRng
1889 SwRedlineData* pRedlData;
1890 SwUndoDelete* pUnDel, *pUnDel2;
1891 SwRedlineSaveDatas* pRedlSaveData;
1892 BOOL bInsert;
1893 public:
1894 SwUndoCompDoc( const SwPaM& rRg, BOOL bIns );
1895 SwUndoCompDoc( const SwRedline& rRedl );
1897 virtual ~SwUndoCompDoc();
1898 virtual void Undo( SwUndoIter& );
1899 virtual void Redo( SwUndoIter& );
1903 //--------------------------------------------------------------------
1905 // Object der als Iterator durch die Undo-Liste laeuft, bis die
1906 // letze oder die angegebene Klammerung/Id erreicht ist.
1908 class SwUndoIter
1910 friend class SwDoc; // um im SwDoc::Undo bWeiter zu stezen
1911 friend void SwUndoEnd::Undo( SwUndoIter& );
1912 friend void SwUndoStart::Undo( SwUndoIter& );
1913 friend void SwUndoEnd::Redo( SwUndoIter& );
1914 friend void SwUndoStart::Redo( SwUndoIter& );
1915 friend void SwUndoEnd::Repeat( SwUndoIter& );
1916 friend void SwUndoStart::Repeat( SwUndoIter& );
1917 friend void SwUndoReplace::Undo( SwUndoIter& );
1918 friend void SwUndoReplace::Redo( SwUndoIter& );
1920 SwUndoId nUndoId;
1921 USHORT nEndCnt;
1922 BOOL bWeiter : 1;
1923 BOOL bUpdateAttr : 1; // Setze das GCAttr an der CursorShell
1925 public:
1926 SwPaM * pAktPam; // Member fuer das Undo
1927 SwUndo* pLastUndoObj; // fuers Redo, das vorherige UndoObj.
1928 SwFrmFmt* pSelFmt; // ggfs. das Format Rahmen/Object-Selektionen
1929 SdrMarkList* pMarkList; // MarkList for all selected SdrObjects
1931 SwUndoIter( SwPaM * pPam, SwUndoId nId = UNDO_EMPTY );
1933 BOOL IsNextUndo() const { return bWeiter; }
1934 BOOL IsUpdateAttr() const { return bUpdateAttr; }
1935 void SetUpdateAttr( BOOL bNew ) { bUpdateAttr = bNew; }
1937 inline SwDoc& GetDoc() const;
1938 SwUndoId GetId() const { return nUndoId; }
1939 SwUndoId GetLastUndoId() const
1940 { return pLastUndoObj ? pLastUndoObj->GetId() : UNDO_EMPTY ; }
1941 void ClearSelections() { pSelFmt = 0; pMarkList = 0; }
1945 // -> #111827#
1946 const int nUndoStringLength = 20;
1949 Shortens a string to a maximum length.
1951 @param rStr the string to be shortened
1952 @param nLength the maximum length for rStr
1953 @param rFillStr string to replace cut out characters with
1955 If rStr has less than nLength characters it will be returned unaltered.
1957 If rStr has more than nLength characters the following algorithm
1958 generates the shortened string:
1960 frontLength = (nLength - length(rFillStr)) / 2
1961 rearLength = nLength - length(rFillStr) - frontLength
1962 shortenedString = concat(<first frontLength characters of rStr,
1963 rFillStr,
1964 <last rearLength characters of rStr>)
1966 Preconditions:
1967 - nLength - length(rFillStr) >= 2
1969 @return the shortened string
1971 String ShortenString(const String & rStr, xub_StrLen nLength, const String & rFillStr);
1972 // <- #111827#
1974 // #16487#
1976 Denotes special characters in a string.
1978 The rStr is split into parts containing special characters and
1979 parts not containing special characters. In a part containing
1980 special characters all characters are equal. These parts are
1981 maximal.
1983 @param rStr the string to denote in
1985 The resulting string is generated by concatenating the found
1986 parts. The parts without special characters are surrounded by
1987 "'". The parts containing special characters are denoted as "n x",
1988 where n is the length of the part and x is the representation of
1989 the special character (i. e. "tab(s)").
1991 @return the denoted string
1993 String DenoteSpecialCharacters(const String & rStr);
1995 #endif