summaryrefslogtreecommitdiff
path: root/sw/inc/undobj.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/inc/undobj.hxx')
-rw-r--r--sw/inc/undobj.hxx1682
1 files changed, 49 insertions, 1633 deletions
diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index 31c34407f57d..e8d183659f29 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -28,103 +28,37 @@
#define SW_UNDOBJ_HXX
#include <vector>
-#include <memory>
#include <boost/shared_ptr.hpp>
-#include <com/sun/star/uno/Sequence.h>
+#include <svl/undo.hxx>
-#include <tools/mempool.hxx>
-#ifndef _SVSTDARR_HXX
-#define _SVSTDARR_USHORTS
-#define _SVSTDARR_ULONGS
-#define _SVSTDARR_BOOLS
-#define _SVSTDARR_BYTES
-#define _SVSTDARR_USHORTSSORT
-#include <svl/svstdarr.hxx>
-#endif
-#include <svl/itemset.hxx>
-
-#include <svx/svdundo.hxx> // #111827#
-
-#include <numrule.hxx>
-#include <itabenum.hxx>
-#include <format.hxx>
#include <SwRewriter.hxx>
#include <swundo.hxx>
-#include <IMark.hxx>
-#include <IDocumentContentOperations.hxx>
-class SwUndoIter;
class SwHistory;
class SwIndex;
class SwPaM;
struct SwPosition;
class SwDoc;
-class SwFmt;
-class SwFmtColl;
class SwTxtFmtColl;
-class SwTxtNode;
-class SwTableNode;
-class SwTable;
-class SwTableBox;
-struct SwSortOptions;
class SwFrmFmt;
-class SwHistoryBookmark;
-class SwSectionData;
-class SwSectionFmt;
-class SwTOXBase;
-class SvxTabStopItem;
-class SwDDEFieldType;
-class Graphic;
-class SwGrfNode;
-class SwUndos;
-class SwFtnInfo;
-class SwEndNoteInfo;
class SwNodeIndex;
class SwNodeRange;
-class SwFmtAnchor;
-struct SwUndoGroupObjImpl;
-class SdrMark;
-class SdrMarkList;
-class SdrObject;
-class SdrObjGroup;
-class SdrUndoAction;
-class SwDrawFrmFmt;
-class _SaveTable;
-class SwTableAutoFmt;
-class SwSelBoxes;
-class SwTableSortBoxes;
-class SwUndoSaveSections;
-class SwUndoMoves;
-class SwStartNode;
-class _SaveFlyArr;
-class SwTblToTxtSaves;
class SwRedlineData;
-class SwRedlineSaveData;
-class SwRedline;
-struct SwSaveRowSpan;
-
-namespace sfx2 {
- class MetadatableUndo;
-}
+class SwRedlineSaveDatas;
-namespace utl {
- class TransliterationWrapper;
+namespace sw {
+ class UndoRedoContext;
+ class RepeatContext;
}
-const String UNDO_ARG1("$1", RTL_TEXTENCODING_ASCII_US);
-const String UNDO_ARG2("$2", RTL_TEXTENCODING_ASCII_US);
-const String UNDO_ARG3("$3", RTL_TEXTENCODING_ASCII_US);
-
-typedef SwRedlineSaveData* SwRedlineSaveDataPtr;
-SV_DECL_PTRARR_DEL( SwRedlineSaveDatas, SwRedlineSaveDataPtr, 8, 8 )
-
class SwUndo
+ : public SfxUndoAction
{
- SwUndoId nId;
+ SwUndoId const m_nId;
sal_uInt16 nOrigRedlineMode;
protected:
@@ -135,9 +69,7 @@ protected:
void RemoveIdxFromRange( SwPaM& rPam, sal_Bool bMoveNext );
void RemoveIdxRel( sal_uLong, const SwPosition& );
- void SetId( SwUndoId nNew ) { nId = nNew; }
-
- static sal_Bool CanRedlineGroup( SwRedlineSaveDatas& rCurr,
+ static BOOL CanRedlineGroup( SwRedlineSaveDatas& rCurr,
const SwRedlineSaveDatas& rCheck,
sal_Bool bCurrIsEnd );
@@ -148,16 +80,31 @@ protected:
@return the rewriter for this object
*/
virtual SwRewriter GetRewriter() const;
+
+ // return type is USHORT because this overrides SfxUndoAction::GetId()
+ virtual sal_uInt16 GetId() const { return static_cast<sal_uInt16>(m_nId); }
+
+ // the 4 methods that derived classes have to override
+ // base implementation does nothing
+ virtual void RepeatImpl( ::sw::RepeatContext & );
+ virtual bool CanRepeatImpl( ::sw::RepeatContext & ) const;
+public: // should not be public, but ran into trouble in untbl.cxx
+ virtual void UndoImpl( ::sw::UndoRedoContext & ) = 0;
+ virtual void RedoImpl( ::sw::UndoRedoContext & ) = 0;
+
+private:
+ // SfxUndoAction
+ virtual void Undo();
+ virtual void Redo();
+ virtual void UndoWithContext(SfxUndoContext &);
+ virtual void RedoWithContext(SfxUndoContext &);
+ virtual void Repeat(SfxRepeatTarget &);
+ virtual BOOL CanRepeat(SfxRepeatTarget &) const;
+
public:
- SwUndo( SwUndoId nI );
+ SwUndo(SwUndoId const nId);
virtual ~SwUndo();
- SwUndoId GetId() const { return nId; }
- virtual SwUndoId GetEffectiveId() const;
- virtual void Undo( SwUndoIter& ) = 0;
- virtual void Redo( SwUndoIter& ) = 0;
- virtual void Repeat( SwUndoIter& );
-
// #111827#
/**
Returns textual comment for this undo object.
@@ -279,487 +226,20 @@ public:
void SetValues( const SwPaM& rPam );
void SetPaM( SwPaM&, sal_Bool bCorrToCntnt = sal_False ) const;
- void SetPaM( SwUndoIter&, sal_Bool bCorrToCntnt = sal_False ) const;
+ SwPaM & AddUndoRedoPaM(
+ ::sw::UndoRedoContext &, bool const bCorrToCntnt = false) const;
};
-class SwUndoStart: public SwUndo
-{
- // Um innerhalb von Undo zuerkennen, wann ein Start vorliegt, gibt
- // GetId() immer die UNDO_START zurueck. Die UserId kann ueber
- // GetUserId() erfragt werden.
- SwUndoId nUserId;
- // fuer die "Verpointerung" von Start- und End-Undos
- sal_uInt16 nEndOffset;
-
- SwRewriter mRewriter;
-
-public:
- SwUndoStart( SwUndoId nId );
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
- // -> #111827#
- virtual String GetComment() const;
- void SetRewriter(const SwRewriter & rRewriter);
- virtual SwRewriter GetRewriter() const;
- // <- #111827#
-
- virtual SwUndoId GetEffectiveId() const;
- SwUndoId GetUserId() const { return nUserId; }
- // Setzen vom End-Undo-Offset geschieht im Doc::EndUndo
- sal_uInt16 GetEndOffset() const { return nEndOffset; }
- void SetEndOffset( sal_uInt16 n ) { nEndOffset = n; }
-};
-
-class SwUndoEnd: public SwUndo
-{
- // Um innerhalb von Undo zuerkennen, wann ein Ende vorliegt, gibt
- // GetId() immer die UNDO_END zurueck. Die UserId kann ueber
- // GetUserId() erfragt werden.
- SwUndoId nUserId;
- // fuer die "Verpointerung" von Start- und End-Undos
- sal_uInt16 nSttOffset;
-
- SwRewriter mRewriter;
-
-public:
- SwUndoEnd( SwUndoId nId );
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- // -> #111827#
- virtual String GetComment() const;
- void SetRewriter(const SwRewriter & rRewriter);
- virtual SwRewriter GetRewriter() const;
- // <- #111827#
-
- virtual SwUndoId GetEffectiveId() const;
- SwUndoId GetUserId() const { return nUserId; }
-
- // Setzen vom Start-Undo-Offset geschieht im Doc::EndUndo
- void SetSttOffset(sal_uInt16 _nSttOffSet) { nSttOffset = _nSttOffSet; }
- sal_uInt16 GetSttOffset() const { return nSttOffset; }
-};
-
-class SwUndoInsert: public SwUndo, private SwUndoSaveCntnt
-{
- SwPosition *pPos; // Inhalt fuers Redo
- String *pTxt, *pUndoTxt;
- SwRedlineData* pRedlData;
- sal_uLong nNode;
- xub_StrLen nCntnt, nLen;
- sal_Bool bIsWordDelim : 1;
- sal_Bool bIsAppend : 1;
-
- const IDocumentContentOperations::InsertFlags m_nInsertFlags;
-
- friend class SwDoc; // eigentlich nur SwDoc::Insert( String )
- sal_Bool CanGrouping( sal_Unicode cIns );
- sal_Bool CanGrouping( const SwPosition& rPos );
-
- SwDoc * pDoc;
-
- void Init(const SwNodeIndex & rNode);
- String * GetTxtFromDoc() const;
-
-public:
- SwUndoInsert( const SwNodeIndex& rNode, xub_StrLen nCntnt, xub_StrLen nLen,
- const IDocumentContentOperations::InsertFlags nInsertFlags,
- sal_Bool bWDelim = sal_True );
- SwUndoInsert( const SwNodeIndex& rNode );
- virtual ~SwUndoInsert();
-
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- // #111827#
- /**
- Returns rewriter for this undo object.
-
- The returned rewriter has the following rule:
-
- $1 -> '<inserted text>'
-
- <inserted text> is shortened to a length of nUndoStringLength.
-
- @return rewriter for this undo object
- */
- virtual SwRewriter GetRewriter() const;
-
-
- DECL_FIXEDMEMPOOL_NEWDEL(SwUndoInsert)
-};
-
-
-class SwUndoDelete: public SwUndo, private SwUndRng, private SwUndoSaveCntnt
-{
- SwNodeIndex* pMvStt; // Position der Nodes im UndoNodes-Array
- String *pSttStr, *pEndStr;
- SwRedlineData* pRedlData;
- SwRedlineSaveDatas* pRedlSaveData;
- ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart;
- ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd;
-
- String sTableName;
-
- sal_uLong nNode;
- sal_uLong nNdDiff; // Differenz von Nodes vor-nach Delete
- sal_uLong nSectDiff; // Diff. von Nodes vor/nach Move mit SectionNodes
- sal_uLong nReplaceDummy; // Diff. to a temporary dummy object
- sal_uInt16 nSetPos;
-
- sal_Bool bGroup : 1; // sal_True: ist schon eine Gruppe; wird in CanGrouping() ausgwertet !!
- sal_Bool bBackSp : 1; // sal_True: wenn Gruppierung und der Inhalt davor geloescht wird
- sal_Bool bJoinNext: 1; // sal_True: wenn der Bereich von Oben nach unten geht
- sal_Bool bTblDelLastNd : 1; // sal_True: TextNode hinter der Tabelle einf./loeschen
- sal_Bool bDelFullPara : 1; // sal_True: gesamte Nodes wurden geloescht
- sal_Bool bResetPgDesc : 1; // sal_True: am nachfolgenden Node das PgDsc zuruecksetzen
- sal_Bool bResetPgBrk : 1; // sal_True: am nachfolgenden Node das PgBreak zuruecksetzen
- sal_Bool bFromTableCopy : 1; // sal_True: called by SwUndoTblCpyTbl
-
- sal_Bool SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd,
- SwTxtNode* pSttTxtNd, SwTxtNode* pEndTxtNd );
-public:
- SwUndoDelete( SwPaM&, sal_Bool bFullPara = sal_False, sal_Bool bCalledByTblCpy = sal_False );
- virtual ~SwUndoDelete();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- // #111827#
- /**
- Returns rewriter for this undo object.
-
- The rewriter consists of the following rule:
-
- $1 -> '<deleted text>'
-
- <deleted text> is shortened to nUndoStringLength characters.
-
- @return rewriter for this undo object
- */
- virtual SwRewriter GetRewriter() const;
-
- sal_Bool CanGrouping( SwDoc*, const SwPaM& );
-
- void SetTblDelLastNd() { bTblDelLastNd = sal_True; }
-
- // fuer die PageDesc/PageBreak Attribute einer Tabelle
- void SetPgBrkFlags( sal_Bool bPageBreak, sal_Bool bPageDesc )
- { bResetPgDesc = bPageDesc; bResetPgBrk = bPageBreak; }
-
- void SetTableName(const String & rName);
-
- // SwUndoTblCpyTbl needs this information:
- long NodeDiff() const { return nSttNode - nEndNode; }
- xub_StrLen ContentStart() const { return nSttCntnt; }
- sal_Bool IsDelFullPara() const { return bDelFullPara; }
-
- DECL_FIXEDMEMPOOL_NEWDEL(SwUndoDelete)
-};
-
-
-class SwUndoOverwrite: public SwUndo, private SwUndoSaveCntnt
-{
- String aDelStr, aInsStr;
- SwRedlineSaveDatas* pRedlSaveData;
- sal_uLong nSttNode;
- xub_StrLen nSttCntnt;
- sal_Bool bInsChar : 1; // kein Overwrite mehr; sondern Insert
- sal_Bool bGroup : 1; // sal_True: ist schon eine Gruppe; wird in
- // CanGrouping() ausgwertet !!
-public:
- SwUndoOverwrite( SwDoc*, SwPosition&, sal_Unicode cIns );
- virtual ~SwUndoOverwrite();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- // #111827#
- /**
- Returns the rewriter of this undo object.
-
- The rewriter contains the following rule:
-
- $1 -> '<overwritten text>'
-
- <overwritten text> is shortened to nUndoStringLength characters.
-
- @return the rewriter of this undo object
- */
- virtual SwRewriter GetRewriter() const;
-
- sal_Bool CanGrouping( SwDoc*, SwPosition&, sal_Unicode cIns );
-};
-
-
-class SwUndoSplitNode: public SwUndo
-{
- SwHistory* pHistory;
- SwRedlineData* pRedlData;
- sal_uLong nNode;
- xub_StrLen nCntnt;
- sal_Bool bTblFlag : 1;
- sal_Bool bChkTblStt : 1;
-public:
- SwUndoSplitNode( SwDoc* pDoc, const SwPosition& rPos, sal_Bool bChkTbl );
- virtual ~SwUndoSplitNode();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
- void SetTblFlag() { bTblFlag = sal_True; }
-};
-
-
-class SwUndoMove : public SwUndo, private SwUndRng, private SwUndoSaveCntnt
-{
- // nDest.. - Bereich, in den verschoben wurde (nach dem Move!)
- // nIns.. - Position, von der verschoben wurde und wieder die neue InsPos. ist
- // nMv.. Position auf die verschoben wird (vor dem Move!) ; fuers REDO
- sal_uLong nDestSttNode, nDestEndNode, nInsPosNode, nMvDestNode;
- xub_StrLen nDestSttCntnt, nDestEndCntnt, nInsPosCntnt, nMvDestCntnt;
-
- sal_uInt16 nFtnStt; // StartPos der Fussnoten in der History
-
- sal_Bool bJoinNext : 1,
- bJoinPrev : 1,
- bMoveRange : 1;
-
- bool bMoveRedlines; // use DOC_MOVEREDLINES when calling SwDoc::Move
-
- void DelFtn( const SwPaM& );
-public:
- SwUndoMove( const SwPaM&, const SwPosition& );
- SwUndoMove( SwDoc* pDoc, const SwNodeRange&, const SwNodeIndex& );
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- // setze den Destination-Bereich nach dem Verschieben.
- void SetDestRange( const SwPaM&, const SwPosition&, sal_Bool, sal_Bool );
- void SetDestRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd,
- const SwNodeIndex& rInsPos );
-
- sal_Bool IsMoveRange() const { return bMoveRange; }
- sal_uLong GetEndNode() const { return nEndNode; }
- sal_uLong GetDestSttNode() const { return nDestSttNode; }
- xub_StrLen GetDestSttCntnt() const { return nDestSttCntnt; }
-
- void SetMoveRedlines( bool b ) { bMoveRedlines = b; }
-
-};
-
-
-class SwUndoAttr : public SwUndo, private SwUndRng
-{
- SfxItemSet m_AttrSet; // attributes for Redo
- const ::std::auto_ptr<SwHistory> m_pHistory; // History for Undo
- ::std::auto_ptr<SwRedlineData> m_pRedlineData; // Redlining
- ::std::auto_ptr<SwRedlineSaveDatas> m_pRedlineSaveData;
- sal_uLong m_nNodeIndex; // Offset: for Redlining
- const SetAttrMode m_nInsertFlags; // insert flags
-
- void RemoveIdx( SwDoc& rDoc );
-
-public:
- SwUndoAttr( const SwPaM&, const SfxItemSet &, const SetAttrMode nFlags );
- SwUndoAttr( const SwPaM&, const SfxPoolItem&, const SetAttrMode nFlags );
- virtual ~SwUndoAttr();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
- void SaveRedlineData( const SwPaM& rPam, sal_Bool bInsCntnt );
-
- SwHistory& GetHistory() { return *m_pHistory; }
-
-};
-
-class SwUndoResetAttr : public SwUndo, private SwUndRng
-{
- const ::std::auto_ptr<SwHistory> m_pHistory;
- SvUShortsSort m_Ids;
- const sal_uInt16 m_nFormatId; // Format-Id for Redo
-
-public:
- SwUndoResetAttr( const SwPaM&, sal_uInt16 nFmtId );
- SwUndoResetAttr( const SwPosition&, sal_uInt16 nFmtId );
- virtual ~SwUndoResetAttr();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
- void SetAttrs( const SvUShortsSort& rArr );
-
- SwHistory& GetHistory() { return *m_pHistory; }
-
-};
-
-class SwUndoFmtAttr : public SwUndo
-{
- friend class SwUndoDefaultAttr;
- SwFmt * m_pFmt;
- ::std::auto_ptr<SfxItemSet> m_pOldSet; // old attributes
- sal_uLong m_nNodeIndex;
- const sal_uInt16 m_nFmtWhich;
- const bool m_bSaveDrawPt;
-
- bool IsFmtInDoc( SwDoc* ); //is the attribute format still in the Doc?
- void SaveFlyAnchor( bool bSaveDrawPt = false );
- // --> OD 2004-10-26 #i35443# - Add return value, type <bool>.
- // Return value indicates, if anchor attribute is restored.
- // Notes: - If anchor attribute is restored, all other existing attributes
- // are also restored.
- // - Anchor attribute isn't restored successfully, if it contains
- // an invalid anchor position and all other existing attributes
- // aren't restored.
- // This situation occurs for undo of styles.
- bool RestoreFlyAnchor( SwUndoIter& rIter );
- // <--
- // --> OD 2008-02-27 #refactorlists# - removed <rAffectedItemSet>
- void Init();
- // <--
-
-public:
- // register at the Format and save old attributes
- // --> OD 2008-02-27 #refactorlists# - removed <rNewSet>
- SwUndoFmtAttr( const SfxItemSet& rOldSet,
- SwFmt& rFmt,
- bool bSaveDrawPt = true );
- // <--
- SwUndoFmtAttr( const SfxPoolItem& rItem,
- SwFmt& rFmt,
- bool bSaveDrawPt = true );
- virtual ~SwUndoFmtAttr();
- virtual void Undo( SwUndoIter& );
- // --> OD 2004-10-26 #i35443# - <Redo(..)> calls <Undo(..)> - nothing else
- virtual void Redo( SwUndoIter& );
- // <--
- virtual void Repeat( SwUndoIter& );
- virtual SwRewriter GetRewriter() const;
-
- void PutAttr( const SfxPoolItem& rItem );
- SwFmt* GetFmt( SwDoc& rDoc ); // checks if it is still in the Doc!
-};
-
-// --> OD 2008-02-12 #newlistlevelattrs#
-class SwUndoFmtResetAttr : public SwUndo
-{
- public:
- SwUndoFmtResetAttr( SwFmt& rChangedFormat,
- const sal_uInt16 nWhichId );
- ~SwUndoFmtResetAttr();
-
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-
- private:
- // format at which a certain attribute is reset.
- SwFmt * const m_pChangedFormat;
- // which ID of the reset attribute
- const sal_uInt16 m_nWhichId;
- // old attribute which has been reset - needed for undo.
- ::std::auto_ptr<SfxPoolItem> m_pOldItem;
-};
-// <--
-
-class SwUndoDontExpandFmt : public SwUndo
-{
- const sal_uLong m_nNodeIndex;
- const xub_StrLen m_nContentIndex;
+class SwUndoInsLayFmt;
-public:
- SwUndoDontExpandFmt( const SwPosition& rPos );
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-};
-
-// helper class to receive changed attribute sets
-class SwUndoFmtAttrHelper : public SwClient
-{
- ::std::auto_ptr<SwUndoFmtAttr> m_pUndo;
- const bool m_bSaveDrawPt;
-
-public:
- SwUndoFmtAttrHelper( SwFmt& rFmt, bool bSaveDrawPt = true );
-
- virtual void Modify( SfxPoolItem*, SfxPoolItem* );
-
- SwUndoFmtAttr* GetUndo() const { return m_pUndo.get(); }
- // release the undo object (so it is not deleted here), and return it
- SwUndoFmtAttr* ReleaseUndo() { return m_pUndo.release(); }
-};
-
-
-class SwUndoFmtColl : public SwUndo, private SwUndRng
-{
- String aFmtName;
- SwHistory* pHistory;
- SwFmtColl* pFmtColl;
- // --> OD 2008-04-15 #refactorlists# - for correct <ReDo(..)> and <Repeat(..)>
- // boolean, which indicates that the attributes are reseted at the nodes
- // before the format has been applied.
- const bool mbReset;
- // boolean, which indicates that the list attributes had been reseted at
- // the nodes before the format has been applied.
- const bool mbResetListAttrs;
- // <--
-public:
- // --> OD 2008-04-15 #refactorlists#
-// SwUndoFmtColl( const SwPaM&, SwFmtColl* );
- SwUndoFmtColl( const SwPaM&, SwFmtColl*,
- const bool bReset,
- const bool bResetListAttrs );
- // <--
- virtual ~SwUndoFmtColl();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- // #111827#
- /**
- Returns the rewriter for this undo object.
-
- The rewriter contains one rule:
-
- $1 -> <name of format collection>
-
- <name of format collection> is the name of the format
- collection that is applied by the action recorded by this undo
- object.
-
- @return the rewriter for this undo object
- */
- virtual SwRewriter GetRewriter() const;
-
- SwHistory* GetHistory() { return pHistory; }
-
-};
-
-
-class SwUndoMoveLeftMargin : public SwUndo, private SwUndRng
-{
- const ::std::auto_ptr<SwHistory> m_pHistory;
- const bool m_bModulus;
-
-public:
- SwUndoMoveLeftMargin( const SwPaM&, sal_Bool bRight, sal_Bool bModulus );
- virtual ~SwUndoMoveLeftMargin();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- SwHistory& GetHistory() { return *m_pHistory; }
-
-};
-
-// Basis-Klasse fuer Insert von Dokument, Glossaries und Kopieren
+// base class for insertion of Document, Glossaries and Copy
class SwUndoInserts : public SwUndo, public SwUndRng, private SwUndoSaveCntnt
{
SwTxtFmtColl *pTxtFmtColl, *pLastNdColl;
SvPtrarr* pFrmFmts;
- SwUndos* pFlyUndos;
+ ::std::vector< ::boost::shared_ptr<SwUndoInsLayFmt> > m_FlyUndos;
SwRedlineData* pRedlData;
sal_Bool bSttWasTxtNd;
protected:
@@ -771,9 +251,10 @@ protected:
public:
virtual ~SwUndoInserts();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
+
// setze den Destination-Bereich nach dem Einlesen.
void SetInsertRange( const SwPaM&, sal_Bool bScanFlys = sal_True,
sal_Bool bSttWasTxtNd = sal_True );
@@ -791,384 +272,6 @@ public:
SwUndoCpyDoc( const SwPaM& );
};
-class SwUndoInsTbl : public SwUndo
-{
- String sTblNm;
- SwInsertTableOptions aInsTblOpts;
- SwDDEFieldType* pDDEFldType;
- SvUShorts* pColWidth;
- SwRedlineData* pRedlData;
- SwTableAutoFmt* pAutoFmt;
- sal_uLong nSttNode;
- sal_uInt16 nRows, nCols;
- sal_uInt16 nAdjust;
-
-public:
- SwUndoInsTbl( const SwPosition&, sal_uInt16 nCols, sal_uInt16 nRows,
- sal_uInt16 eAdjust, const SwInsertTableOptions& rInsTblOpts,
- const SwTableAutoFmt* pTAFmt, const SvUShorts* pColArr,
- const String & rName);
- virtual ~SwUndoInsTbl();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- virtual SwRewriter GetRewriter() const;
-
-};
-
-class SwUndoTxtToTbl : public SwUndo, public SwUndRng
-{
- String sTblNm;
- SwInsertTableOptions aInsTblOpts;
- SvULongs* pDelBoxes;
- SwTableAutoFmt* pAutoFmt;
- SwHistory* pHistory;
- sal_Unicode cTrenner;
- sal_uInt16 nAdjust;
- sal_Bool bSplitEnd : 1;
-
-public:
- SwUndoTxtToTbl( const SwPaM&, const SwInsertTableOptions&, sal_Unicode , sal_uInt16,
- const SwTableAutoFmt* pAFmt );
- virtual ~SwUndoTxtToTbl();
-
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- SwHistory& GetHistory(); // wird ggfs. angelegt
- void AddFillBox( const SwTableBox& rBox );
-};
-
-class SwUndoTblToTxt : public SwUndo
-{
- String sTblNm;
- SwDDEFieldType* pDDEFldType;
- _SaveTable* pTblSave;
- SwTblToTxtSaves* pBoxSaves;
- SwHistory* pHistory;
- sal_uLong nSttNd, nEndNd;
- sal_uInt16 nAdjust;
- sal_Unicode cTrenner;
- sal_uInt16 nHdlnRpt;
- sal_Bool bCheckNumFmt : 1;
-
-public:
- SwUndoTblToTxt( const SwTable& rTbl, sal_Unicode cCh );
- virtual ~SwUndoTblToTxt();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- void SetRange( const SwNodeRange& );
- void AddBoxPos( SwDoc& rDoc, sal_uLong nNdIdx, sal_uLong nEndIdx,
- xub_StrLen nCntntIdx = STRING_MAXLEN);
-};
-
-class SwUndoAttrTbl : public SwUndo
-{
- sal_uLong nSttNode;
- _SaveTable* pSaveTbl;
- sal_Bool bClearTabCol : 1;
-public:
- SwUndoAttrTbl( const SwTableNode& rTblNd, sal_Bool bClearTabCols = sal_False );
- virtual ~SwUndoAttrTbl();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-};
-
-class SwUndoTblAutoFmt : public SwUndo
-{
- sal_uLong nSttNode;
- _SaveTable* pSaveTbl;
- SwUndos* pUndos;
- sal_Bool bSaveCntntAttr;
-
- void UndoRedo( sal_Bool bUndo, SwUndoIter& rUndoIter );
-
-public:
- SwUndoTblAutoFmt( const SwTableNode& rTblNd, const SwTableAutoFmt& );
- virtual ~SwUndoTblAutoFmt();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- void SaveBoxCntnt( const SwTableBox& rBox );
-};
-
-class SwUndoTblNdsChg : public SwUndo
-{
- _SaveTable* pSaveTbl;
- SvULongs aBoxes;
-
- union {
- SvULongs* pNewSttNds;
- SwUndoSaveSections* pDelSects;
- } Ptrs;
- SvBools aMvBoxes; // fuers SplitRow (aufgeteilte Nodes einer Box)
- long nMin, nMax; // for redo of delete column
- sal_uLong nSttNode, nCurrBox;
- sal_uInt16 nCount, nRelDiff, nAbsDiff, nSetColType;
- sal_Bool bFlag;
- sal_Bool bSameHeight; // only used for SplitRow
-public:
- SwUndoTblNdsChg( SwUndoId UndoId,
- const SwSelBoxes& rBoxes,
- const SwTableNode& rTblNd,
- long nMn, long nMx,
- sal_uInt16 nCnt, sal_Bool bFlg, sal_Bool bSameHeight );
-
- // fuer SetColWidth
- SwUndoTblNdsChg( SwUndoId UndoId, const SwSelBoxes& rBoxes,
- const SwTableNode& rTblNd );
-
- virtual ~SwUndoTblNdsChg();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-
- void SaveNewBoxes( const SwTableNode& rTblNd, const SwTableSortBoxes& rOld );
- void SaveNewBoxes( const SwTableNode& rTblNd, const SwTableSortBoxes& rOld,
- const SwSelBoxes& rBoxes, const SvULongs& rNodeCnts );
- void SaveSection( SwStartNode* pSttNd );
- void ReNewBoxes( const SwSelBoxes& rBoxes );
-
-
- void SetColWidthParam( sal_uLong nBoxIdx, sal_uInt16 nMode, sal_uInt16 nType,
- SwTwips nAbsDif, SwTwips nRelDif )
- {
- nCurrBox = nBoxIdx;
- nCount = nMode;
- nSetColType = nType;
- nAbsDiff = (sal_uInt16)nAbsDif;
- nRelDiff = (sal_uInt16)nRelDif;
- }
-
-};
-
-class SwUndoTblMerge : public SwUndo, private SwUndRng
-{
- sal_uLong nTblNode;
- _SaveTable* pSaveTbl;
- SvULongs aBoxes, aNewSttNds;
- SwUndoMoves* pMoves;
- SwHistory* pHistory;
-
-public:
- SwUndoTblMerge( const SwPaM& rTblSel );
- virtual ~SwUndoTblMerge();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-
- void MoveBoxCntnt( SwDoc* pDoc, SwNodeRange& rRg, SwNodeIndex& rPos );
-
- void SetSelBoxes( const SwSelBoxes& rBoxes );
-
- void AddNewBox( sal_uLong nSttNdIdx )
- { aNewSttNds.Insert( nSttNdIdx, aNewSttNds.Count() ); }
-
- void SaveCollection( const SwTableBox& rBox );
-
-};
-
-
-class SwUndoTblNumFmt : public SwUndo
-{
- SfxItemSet *pBoxSet;
- SwHistory* pHistory;
- String aStr, aNewFml;
-
- sal_uLong nFmtIdx, nNewFmtIdx;
- double fNum, fNewNum;
- sal_uLong nNode;
- sal_uLong nNdPos;
-
- sal_Bool bNewFmt : 1;
- sal_Bool bNewFml : 1;
- sal_Bool bNewValue : 1;
-
-public:
- SwUndoTblNumFmt( const SwTableBox& rBox, const SfxItemSet* pNewSet = 0 );
- virtual ~SwUndoTblNumFmt();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-
- void SetNumFmt( sal_uLong nNewNumFmtIdx, const double& rNewNumber )
- { nFmtIdx = nNewNumFmtIdx; fNum = rNewNumber; }
- void SetBox( const SwTableBox& rBox );
-};
-
-class _UndoTblCpyTbl_Entries;
-
-class SwUndoTblCpyTbl : public SwUndo
-{
- _UndoTblCpyTbl_Entries* pArr;
- SwUndoTblNdsChg* pInsRowUndo;
-
- //b6341295: When redlining is active, PrepareRedline has to create the redlining attributes
- //for the new and the old table cell content
- SwUndo* PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox, const SwPosition& rPos,
- bool& rJoin, bool bRedo );
-public:
- SwUndoTblCpyTbl();
- virtual ~SwUndoTblCpyTbl();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-
- void AddBoxBefore( const SwTableBox& rBox, sal_Bool bDelCntnt );
- void AddBoxAfter( const SwTableBox& rBox, const SwNodeIndex& rIdx, sal_Bool bDelCntnt );
-
- sal_Bool IsEmpty() const;
- sal_Bool InsertRow( SwTable& rTbl, const SwSelBoxes& rBoxes, sal_uInt16 nCnt );
-};
-
-class SwUndoCpyTbl : public SwUndo
-{
- SwUndoDelete* pDel;
- sal_uLong nTblNode;
-public:
- SwUndoCpyTbl();
- virtual ~SwUndoCpyTbl();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-
- void SetTableSttIdx( sal_uLong nIdx ) { nTblNode = nIdx; }
-};
-
-class SwUndoSplitTbl : public SwUndo
-{
- sal_uLong nTblNode, nOffset;
- SwSaveRowSpan* mpSaveRowSpan; // stores the row span values at the splitting row
- _SaveTable* pSavTbl;
- SwHistory* pHistory;
- sal_uInt16 nMode, nFmlEnd;
- sal_Bool bCalcNewSize;
-public:
- SwUndoSplitTbl( const SwTableNode& rTblNd, SwSaveRowSpan* pRowSp, sal_uInt16 nMode, sal_Bool bCalcNewSize );
- virtual ~SwUndoSplitTbl();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- void SetTblNodeOffset( sal_uLong nIdx ) { nOffset = nIdx - nTblNode; }
- SwHistory* GetHistory() { return pHistory; }
- void SaveFormula( SwHistory& rHistory );
-};
-
-class SwUndoMergeTbl : public SwUndo
-{
- String aName;
- sal_uLong nTblNode;
- _SaveTable* pSavTbl, *pSavHdl;
- SwHistory* pHistory;
- sal_uInt16 nMode;
- sal_Bool bWithPrev;
-public:
- SwUndoMergeTbl( const SwTableNode& rTblNd, const SwTableNode& rDelTblNd,
- sal_Bool bWithPrev, sal_uInt16 nMode );
- virtual ~SwUndoMergeTbl();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- void SaveFormula( SwHistory& rHistory );
-};
-
-
-class SwUndoBookmark : public SwUndo
-{
- const ::std::auto_ptr<SwHistoryBookmark> m_pHistoryBookmark;
-
-protected:
- SwUndoBookmark( SwUndoId nUndoId, const ::sw::mark::IMark& );
-
- void SetInDoc( SwDoc* );
- void ResetInDoc( SwDoc* );
-
-public:
- virtual ~SwUndoBookmark();
-
- // #111827#
- /**
- Returns the rewriter for this undo object.
-
- The rewriter contains the following rule:
-
- $1 -> <name of bookmark>
-
- <name of bookmark> is the name of the bookmark whose
- insertion/deletion is recorded by this undo object.
-
- @return the rewriter for this undo object
- */
- virtual SwRewriter GetRewriter() const;
-};
-
-
-class SwUndoInsBookmark : public SwUndoBookmark
-{
-public:
- SwUndoInsBookmark( const ::sw::mark::IMark& );
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-};
-
-
-/*--------------------------------------------------------------------
- Beschreibung: Undo auf Sorting
- --------------------------------------------------------------------*/
-
-struct SwSortUndoElement
-{
- union {
- struct {
- sal_uLong nKenn;
- sal_uLong nSource, nTarget;
- } TXT;
- struct {
- String *pSource, *pTarget;
- } TBL;
- } SORT_TXT_TBL;
-
- SwSortUndoElement( const String& aS, const String& aT )
- {
- SORT_TXT_TBL.TBL.pSource = new String( aS );
- SORT_TXT_TBL.TBL.pTarget = new String( aT );
- }
- SwSortUndoElement( sal_uLong nS, sal_uLong nT )
- {
- SORT_TXT_TBL.TXT.nSource = nS;
- SORT_TXT_TBL.TXT.nTarget = nT;
- SORT_TXT_TBL.TXT.nKenn = 0xffffffff;
- }
- ~SwSortUndoElement();
-};
-
-SV_DECL_PTRARR_DEL(SwSortList, SwSortUndoElement*, 10,30)
-SV_DECL_PTRARR(SwUndoSortList, SwNodeIndex*, 10,30)
-
-class SwUndoSort : public SwUndo, private SwUndRng
-{
- SwSortOptions* pSortOpt; // die Optionen mit den Sortier-Kriterien
- SwSortList aSortList;
- SwUndoAttrTbl* pUndoTblAttr;
- SwRedlineData* pRedlData;
- sal_uLong nTblNd;
-
- void RemoveIdx( SwPaM& rPam );
-public:
- SwUndoSort( const SwPaM&, const SwSortOptions& );
- SwUndoSort( sal_uLong nStt, sal_uLong nEnd, const SwTableNode&,
- const SwSortOptions&, sal_Bool bSaveTable );
- virtual ~SwUndoSort();
-
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- void Insert( const String& rOrgPos, const String& rNewPos );
- void Insert( sal_uLong nOrgPos, sal_uLong nNewPos );
-
-};
-
//--------------------------------------------------------------------
@@ -1182,7 +285,7 @@ protected:
sal_uInt16 nRndId;
sal_Bool bDelFmt; // loesche das gespeicherte Format
- void InsFly( SwUndoIter&, sal_Bool bShowSel = sal_True );
+ void InsFly(::sw::UndoRedoContext & rContext, bool bShowSel = true);
void DelFly( SwDoc* );
SwUndoFlyBase( SwFrmFmt* pFormat, SwUndoId nUndoId );
@@ -1193,9 +296,6 @@ protected:
public:
virtual ~SwUndoFlyBase();
- virtual void Undo( SwUndoIter& ) = 0;
- virtual void Redo( SwUndoIter& ) = 0;
-
};
class SwUndoInsLayFmt : public SwUndoFlyBase
@@ -1204,11 +304,12 @@ class SwUndoInsLayFmt : public SwUndoFlyBase
xub_StrLen mnCrsrSaveIndexPos; // for undo
public:
SwUndoInsLayFmt( SwFrmFmt* pFormat, sal_uLong nNodeIdx, xub_StrLen nCntIdx );
- ~SwUndoInsLayFmt();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
+ virtual ~SwUndoInsLayFmt();
+
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
String GetComment() const;
@@ -1220,700 +321,15 @@ class SwUndoDelLayFmt : public SwUndoFlyBase
public:
SwUndoDelLayFmt( SwFrmFmt* pFormat );
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- void Redo(); // Schnittstelle fuers Rollback
-
- void ChgShowSel( sal_Bool bNew ) { bShowSelFrm = bNew; }
-
- virtual SwRewriter GetRewriter() const;
-
-};
-
-
-class SwUndoSetFlyFmt : public SwUndo, public SwClient
-{
- SwFrmFmt* pFrmFmt; // das gespeicherte FlyFormat
- SwFrmFmt* pOldFmt; // die alte Fly Vorlage
- SwFrmFmt* pNewFmt; // die neue Fly Vorlage
- SfxItemSet* pItemSet; // die zurueck-/ gesetzten Attribute
- sal_uLong nOldNode, nNewNode;
- xub_StrLen nOldCntnt, nNewCntnt;
- sal_uInt16 nOldAnchorTyp, nNewAnchorTyp;
- sal_Bool bAnchorChgd;
-
- void PutAttr( sal_uInt16 nWhich, const SfxPoolItem* pItem );
- void Modify( SfxPoolItem*, SfxPoolItem* );
- void GetAnchor( SwFmtAnchor& rAnhor, sal_uLong nNode, xub_StrLen nCntnt );
-
-public:
- SwUndoSetFlyFmt( SwFrmFmt& rFlyFmt, SwFrmFmt& rNewFrmFmt );
- virtual ~SwUndoSetFlyFmt();
-
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-
- virtual SwRewriter GetRewriter() const;
-};
-
-//--------------------------------------------------------------------
-
-class _UnReplaceData;
-SV_DECL_PTRARR_DEL( _UnReplaceDatas, _UnReplaceData*, 10, 25 )
-
-class SwUndoReplace : public SwUndo
-{
- friend class SwDoc;
-
- sal_Bool bOldIterFlag; // Status vom Undo-Iter vorm 1. Aufruf
- sal_uInt16 nAktPos; // fuer GetUndoRange und Undo/Redo
- _UnReplaceDatas aArr;
- SwRedlineData* pRedlData;
-
-public:
- SwUndoReplace();
- virtual ~SwUndoReplace();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-
- // #111827#
- /**
- Returns the rewriter of this undo object.
-
- If this undo object represents several replacements the
- rewriter contains the following rules:
-
- $1 -> <number of replacements>
- $2 -> occurrences of
- $3 -> <replaced text>
-
- If this undo object represents one replacement the rewriter
- contains these rules:
-
- $1 -> <replaced text>
- $2 -> "->" (STR_YIELDS)
- $3 -> <replacing text>
-
- @return the rewriter of this undo object
- */
- virtual SwRewriter GetRewriter() const;
-
- void AddEntry( const SwPaM& rPam, const String& rInsert, sal_Bool bRegExp );
- void SetEntryEnd( const SwPaM& rPam );
-
- sal_Bool IsFull() const
- { return ((USHRT_MAX / sizeof( void* )) - 50 ) < aArr.Count(); }
-
-};
-
-
-//--------------------------------------------------------------------
-
-
-class SwUndoTblHeadline : public SwUndo
-{
- sal_uLong nTblNd;
- sal_uInt16 nOldHeadline;
- sal_uInt16 nNewHeadline;
-public:
- SwUndoTblHeadline( const SwTable&, sal_uInt16 nOldHdl, sal_uInt16 nNewHdl );
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-};
-
-
-//------------ Undo von Insert-/Delete-Sections ----------------------
-
-class SwUndoInsSection : public SwUndo, private SwUndRng
-{
-private:
- const ::std::auto_ptr<SwSectionData> m_pSectionData;
- const ::std::auto_ptr<SwTOXBase> m_pTOXBase; /// set iff section is TOX
- const ::std::auto_ptr<SfxItemSet> m_pAttrSet;
- ::std::auto_ptr<SwHistory> m_pHistory;
- ::std::auto_ptr<SwRedlineData> m_pRedlData;
- sal_uLong m_nSectionNodePos;
- bool m_bSplitAtStart : 1;
- bool m_bSplitAtEnd : 1;
- bool m_bUpdateFtn : 1;
-
- void Join( SwDoc& rDoc, sal_uLong nNode );
-
-public:
- SwUndoInsSection(SwPaM const&, SwSectionData const&,
- SfxItemSet const*const pSet, SwTOXBase const*const pTOXBase);
- virtual ~SwUndoInsSection();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- void SetSectNdPos(sal_uLong const nPos) { m_nSectionNodePos = nPos; }
- void SaveSplitNode(SwTxtNode *const pTxtNd, bool const bAtStart);
- void SetUpdtFtnFlag(bool const bFlag) { m_bUpdateFtn = bFlag; }
-};
-
-SW_DLLPRIVATE SwUndo * MakeUndoDelSection(SwSectionFmt const&);
-
-SW_DLLPRIVATE SwUndo * MakeUndoUpdateSection(SwSectionFmt const&, bool const);
-
-
-//------------ Undo von verschieben/stufen von Gliederung ----------------
-
-class SwUndoOutlineLeftRight : public SwUndo, private SwUndRng
-{
- short nOffset;
-public:
- SwUndoOutlineLeftRight( const SwPaM& rPam, short nOffset );
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-};
-
-//--------------------------------------------------------------------
-
-class SwUndoDefaultAttr : public SwUndo
-{
- ::std::auto_ptr<SfxItemSet> m_pOldSet; // the old attributes
- ::std::auto_ptr<SvxTabStopItem> m_pTabStop;
-
-public:
- // registers at the format and saves old attributes
- SwUndoDefaultAttr( const SfxItemSet& rOldSet );
- virtual ~SwUndoDefaultAttr();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-};
-
-//--------------------------------------------------------------------
-// ---------- Undo fuer Numerierung ----------------------------------
-
-class SwUndoInsNum : public SwUndo, private SwUndRng
-{
- SwNumRule aNumRule;
- SwHistory* pHistory;
- sal_uLong nSttSet;
- SwNumRule* pOldNumRule;
- String sReplaceRule;
- sal_uInt16 nLRSavePos;
-public:
- SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule );
- SwUndoInsNum( const SwNumRule& rOldRule, const SwNumRule& rNewRule,
- SwUndoId nUndoId = UNDO_INSFMTATTR );
- SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule,
- const String& rReplaceRule );
- virtual ~SwUndoInsNum();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
- virtual SwRewriter GetRewriter() const;
-
- SwHistory* GetHistory(); // wird ggfs. neu angelegt!
- void SetSttNum( sal_uLong nNdIdx ) { nSttSet = nNdIdx; }
- void SaveOldNumRule( const SwNumRule& rOld );
-
- void SetLRSpaceEndPos();
-
-};
-
-class SwUndoDelNum : public SwUndo, private SwUndRng
-{
- SvULongs aNodeIdx;
- SvBytes aLevels;
- SvBools aRstLRSpaces;
- SwHistory* pHistory;
-public:
- SwUndoDelNum( const SwPaM& rPam );
- virtual ~SwUndoDelNum();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- void AddNode( const SwTxtNode& rNd, sal_Bool bResetLRSpace );
- SwHistory* GetHistory() { return pHistory; }
-
-};
-
-class SwUndoMoveNum : public SwUndo, private SwUndRng
-{
- sal_uLong nNewStt;
- long nOffset;
-public:
- SwUndoMoveNum( const SwPaM& rPam, long nOffset, sal_Bool bIsOutlMv = sal_False );
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
- void SetStartNode( sal_uLong nValue ) { nNewStt = nValue; }
-};
-
-class SwUndoNumUpDown : public SwUndo, private SwUndRng
-{
- short nOffset;
-public:
- SwUndoNumUpDown( const SwPaM& rPam, short nOffset );
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-};
-
-class SwUndoNumOrNoNum : public SwUndo
-{
- sal_uLong nIdx;
- sal_Bool mbNewNum, mbOldNum;
-
-public:
- SwUndoNumOrNoNum( const SwNodeIndex& rIdx, sal_Bool mbOldNum,
- sal_Bool mbNewNum );
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-};
-
-class SwUndoNumRuleStart : public SwUndo
-{
- sal_uLong nIdx;
- sal_uInt16 nOldStt, nNewStt;
- sal_Bool bSetSttValue : 1;
- sal_Bool bFlag : 1;
-public:
- SwUndoNumRuleStart( const SwPosition& rPos, sal_Bool bDelete );
- SwUndoNumRuleStart( const SwPosition& rPos, sal_uInt16 nStt );
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-};
-
-//--------------------------------------------------------------------
-// ---------- Undo fuer DrawObjecte ----------------------------------
-
-class SwSdrUndo : public SwUndo
-{
- SdrUndoAction* pSdrUndo;
- SdrMarkList* pMarkList; // MarkList for all selected SdrObjects
-public:
- SwSdrUndo( SdrUndoAction* , const SdrMarkList* pMarkList );
- virtual ~SwSdrUndo();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-
- String GetComment() const;
-};
-
-class SwUndoDrawGroup : public SwUndo
-{
- SwUndoGroupObjImpl* pObjArr;
- sal_uInt16 nSize;
- sal_Bool bDelFmt;
-
-public:
- SwUndoDrawGroup( sal_uInt16 nCnt );
- virtual ~SwUndoDrawGroup();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-
- void AddObj( sal_uInt16 nPos, SwDrawFrmFmt*, SdrObject* );
- void SetGroupFmt( SwDrawFrmFmt* );
-};
-
-// --> OD 2006-11-01 #130889#
-// Action "ungroup drawing object" is now splitted into three parts - see
-// method <SwDoc::UnGroupSelection(..)>:
-// - creation for <SwDrawFrmFmt> instances for the group members of the
-// selected group objects
-// - intrinsic ungroup of the selected group objects
-// - creation of <SwDrawContact> instances for the former group members and
-// connection to the Writer layout.
-// Thus, two undo actions (instances of <SwUndo>) are needed:
-// - Existing class <SwUndoDrawUnGroup> takes over the part for the formats.
-// - New class <SwUndoDrawUnGroupConnectToLayout> takes over the part for
-// contact object.
-class SwUndoDrawUnGroup : public SwUndo
-{
- SwUndoGroupObjImpl* pObjArr;
- sal_uInt16 nSize;
- sal_Bool bDelFmt;
-
-public:
- SwUndoDrawUnGroup( SdrObjGroup* );
- virtual ~SwUndoDrawUnGroup();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-
- void AddObj( sal_uInt16 nPos, SwDrawFrmFmt* );
-};
-
-// --> OD 2006-11-01 #130889#
-class SwUndoDrawUnGroupConnectToLayout : public SwUndo
-{
- private:
- std::vector< std::pair< SwDrawFrmFmt*, SdrObject* > > aDrawFmtsAndObjs;
-
- public:
- SwUndoDrawUnGroupConnectToLayout();
- virtual ~SwUndoDrawUnGroupConnectToLayout();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-
- void AddFmtAndObj( SwDrawFrmFmt* pDrawFrmFmt,
- SdrObject* pDrawObject );
-};
-// <--
-
-
-class SwUndoDrawDelete : public SwUndo
-{
- SwUndoGroupObjImpl* pObjArr;
- SdrMarkList* pMarkLst; // MarkList for all selected SdrObjects
- sal_uInt16 nSize;
- sal_Bool bDelFmt;
-
-public:
- SwUndoDrawDelete( sal_uInt16 nCnt );
- virtual ~SwUndoDrawDelete();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-
- void AddObj( sal_uInt16 nPos, SwDrawFrmFmt*, const SdrMark& );
-};
-
-//--------------------------------------------------------------------
-
-class SwUndoReRead : public SwUndo
-{
- Graphic *pGrf;
- String *pNm, *pFltr;
- sal_uLong nPos;
- sal_uInt16 nMirr;
-
- void SaveGraphicData( const SwGrfNode& );
- void SetAndSave( SwUndoIter& );
-
-public:
- SwUndoReRead( const SwPaM& rPam, const SwGrfNode& pGrfNd );
- virtual ~SwUndoReRead();
-
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-};
-
-//--------------------------------------------------------------------
-
-class SwUndoInsertLabel : public SwUndo
-{
- union {
- struct {
- // fuer NoTxtFrms
- SwUndoInsLayFmt* pUndoFly;
- SwUndoFmtAttr* pUndoAttr;
- } OBJECT;
- struct {
- // fuer Tabelle/TextRahmen
- SwUndoDelete* pUndoInsNd;
- sal_uLong nNode;
- } NODE;
- };
-
- String sText;
- // --> PB 2005-01-06 #i39983# - the separator will be drawed with a character style
- String sSeparator;
- // <--
- String sNumberSeparator;
- String sCharacterStyle;
- // OD 2004-04-15 #i26791# - re-store of drawing object position no longer needed
- sal_uInt16 nFldId;
- SwLabelType eType;
- sal_uInt8 nLayerId; // fuer Zeichen-Objekte
- sal_Bool bBefore :1;
- sal_Bool bUndoKeep :1;
- sal_Bool bCpyBrd :1;
-
-public:
- SwUndoInsertLabel( const SwLabelType eTyp, const String &rText,
- // --> PB 2005-01-06 #i39983# - the separator will be drawed with a character style
- const String& rSeparator,
- // <--
- const String& rNumberSeparator, //#i61007# order of captions
- const sal_Bool bBefore, const sal_uInt16 nId,
- const String& rCharacterStyle,
- const sal_Bool bCpyBrd );
- virtual ~SwUndoInsertLabel();
-
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
- // #111827#
- /**
- Returns the rewriter of this undo object.
-
- The rewriter contains this rule:
+ void RedoForRollback();
- $1 -> '<text of inserted label>'
-
- <text of inserted label> is shortened to nUndoStringLength
- characters.
+ void ChgShowSel( sal_Bool bNew ) { bShowSelFrm = bNew; }
- @return the rewriter of this undo object
- */
virtual SwRewriter GetRewriter() const;
- void SetNodePos( sal_uLong nNd )
- { if( LTYPE_OBJECT != eType ) NODE.nNode = nNd; }
-
- void SetUndoKeep() { bUndoKeep = sal_True; }
- void SetFlys( SwFrmFmt& rOldFly, SfxItemSet& rChgSet, SwFrmFmt& rNewFly );
- void SetDrawObj( sal_uInt8 nLayerId );
-};
-
-//--------------------------------------------------------------------
-
-class SwUndoChangeFootNote : public SwUndo, private SwUndRng
-{
- const ::std::auto_ptr<SwHistory> m_pHistory;
- const String m_Text;
- const sal_uInt16 m_nNumber;
- const bool m_bEndNote;
-
-public:
- SwUndoChangeFootNote( const SwPaM& rRange, const String& rTxt,
- sal_uInt16 nNum, bool bIsEndNote );
- virtual ~SwUndoChangeFootNote();
-
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
- virtual void Repeat( SwUndoIter& );
-
- SwHistory& GetHistory() { return *m_pHistory; }
-};
-
-class SwUndoFootNoteInfo : public SwUndo
-{
- ::std::auto_ptr<SwFtnInfo> m_pFootNoteInfo;
-
-public:
- SwUndoFootNoteInfo( const SwFtnInfo &rInfo );
- virtual ~SwUndoFootNoteInfo();
-
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-};
-
-class SwUndoEndNoteInfo : public SwUndo
-{
- ::std::auto_ptr<SwEndNoteInfo> m_pEndNoteInfo;
-
-public:
- SwUndoEndNoteInfo( const SwEndNoteInfo &rInfo );
- virtual ~SwUndoEndNoteInfo();
-
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-};
-
-
-//--------------------------------------------------------------------
-
-struct _UndoTransliterate_Data;
-class SwUndoTransliterate : public SwUndo, public SwUndRng
-{
- std::vector< _UndoTransliterate_Data * > aChanges;
- sal_uInt32 nType;
-
-public:
- SwUndoTransliterate( const SwPaM& rPam,
- const utl::TransliterationWrapper& rTrans );
- virtual ~SwUndoTransliterate();
-
- virtual void Undo( SwUndoIter& rUndoIter );
- virtual void Redo( SwUndoIter& rUndoIter );
- virtual void Repeat( SwUndoIter& rUndoIter );
-
- void AddChanges( SwTxtNode& rTNd, xub_StrLen nStart, xub_StrLen nLen,
- ::com::sun::star::uno::Sequence <sal_Int32>& rOffsets );
- sal_Bool HasData() const { return aChanges.size() > 0; }
-};
-
-//--------------------------------------------------------------------
-
-class SwUndoRedline : public SwUndo, public SwUndRng
-{
-protected:
- SwRedlineData* pRedlData;
- SwRedlineSaveDatas* pRedlSaveData;
- SwUndoId nUserId;
- sal_Bool bHiddenRedlines;
-
- virtual void _Undo( SwUndoIter& );
- virtual void _Redo( SwUndoIter& );
-
-public:
- SwUndoRedline( SwUndoId nUserId, const SwPaM& rRange );
- virtual ~SwUndoRedline();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-
- SwUndoId GetUserId() const { return nUserId; }
- sal_uInt16 GetRedlSaveCount() const
- { return pRedlSaveData ? pRedlSaveData->Count() : 0; }
-};
-
-class SwUndoRedlineDelete : public SwUndoRedline
-{
- sal_Bool bCanGroup : 1;
- sal_Bool bIsDelim : 1;
- sal_Bool bIsBackspace : 1;
-
- virtual void _Undo( SwUndoIter& );
- virtual void _Redo( SwUndoIter& );
-
-public:
- SwUndoRedlineDelete( const SwPaM& rRange, SwUndoId nUserId = UNDO_EMPTY );
-
- sal_Bool CanGrouping( const SwUndoRedlineDelete& rPrev );
-};
-
-class SwUndoRedlineSort : public SwUndoRedline
-{
- SwSortOptions* pOpt;
- sal_uLong nSaveEndNode, nOffset;
- xub_StrLen nSaveEndCntnt;
-
- virtual void _Undo( SwUndoIter& );
- virtual void _Redo( SwUndoIter& );
-
-public:
- SwUndoRedlineSort( const SwPaM& rRange, const SwSortOptions& rOpt );
- virtual ~SwUndoRedlineSort();
- virtual void Repeat( SwUndoIter& );
-
- void SetSaveRange( const SwPaM& rRange );
- void SetOffset( const SwNodeIndex& rIdx );
-};
-
-class SwUndoAcceptRedline : public SwUndoRedline
-{
- virtual void _Redo( SwUndoIter& );
-public:
- SwUndoAcceptRedline( const SwPaM& rRange );
- virtual void Repeat( SwUndoIter& );
-};
-
-class SwUndoRejectRedline : public SwUndoRedline
-{
- virtual void _Redo( SwUndoIter& );
-public:
- SwUndoRejectRedline( const SwPaM& rRange );
- virtual void Repeat( SwUndoIter& );
-};
-
-//--------------------------------------------------------------------
-
-class SwUndoCompDoc : public SwUndo, public SwUndRng
-{
- SwRedlineData* pRedlData;
- SwUndoDelete* pUnDel, *pUnDel2;
- SwRedlineSaveDatas* pRedlSaveData;
- sal_Bool bInsert;
-public:
- SwUndoCompDoc( const SwPaM& rRg, sal_Bool bIns );
- SwUndoCompDoc( const SwRedline& rRedl );
-
- virtual ~SwUndoCompDoc();
- virtual void Undo( SwUndoIter& );
- virtual void Redo( SwUndoIter& );
-};
-
-
-//--------------------------------------------------------------------
-
-// Object der als Iterator durch die Undo-Liste laeuft, bis die
-// letze oder die angegebene Klammerung/Id erreicht ist.
-
-class SwUndoIter
-{
- friend class SwDoc; // um im SwDoc::Undo bWeiter zu stezen
- friend void SwUndoEnd::Undo( SwUndoIter& );
- friend void SwUndoStart::Undo( SwUndoIter& );
- friend void SwUndoEnd::Redo( SwUndoIter& );
- friend void SwUndoStart::Redo( SwUndoIter& );
- friend void SwUndoEnd::Repeat( SwUndoIter& );
- friend void SwUndoStart::Repeat( SwUndoIter& );
- friend void SwUndoReplace::Undo( SwUndoIter& );
- friend void SwUndoReplace::Redo( SwUndoIter& );
-
- SwUndoId nUndoId;
- sal_uInt16 nEndCnt;
- sal_Bool bWeiter : 1;
- sal_Bool bUpdateAttr : 1; // Setze das GCAttr an der CursorShell
-
-public:
- SwPaM * pAktPam; // Member fuer das Undo
- SwUndo* pLastUndoObj; // fuers Redo, das vorherige UndoObj.
- SwFrmFmt* pSelFmt; // ggfs. das Format Rahmen/Object-Selektionen
- SdrMarkList* pMarkList; // MarkList for all selected SdrObjects
-
- SwUndoIter( SwPaM * pPam, SwUndoId nId = UNDO_EMPTY );
-
- sal_Bool IsNextUndo() const { return bWeiter; }
- sal_Bool IsUpdateAttr() const { return bUpdateAttr; }
- void SetUpdateAttr( sal_Bool bNew ) { bUpdateAttr = bNew; }
-
- inline SwDoc& GetDoc() const;
- SwUndoId GetId() const { return nUndoId; }
- SwUndoId GetLastUndoId() const
- { return pLastUndoObj ? pLastUndoObj->GetId() : UNDO_EMPTY ; }
- void ClearSelections() { pSelFmt = 0; pMarkList = 0; }
};
-
-// -> #111827#
-const int nUndoStringLength = 20;
-
-/**
- Shortens a string to a maximum length.
-
- @param rStr the string to be shortened
- @param nLength the maximum length for rStr
- @param rFillStr string to replace cut out characters with
-
- If rStr has less than nLength characters it will be returned unaltered.
-
- If rStr has more than nLength characters the following algorithm
- generates the shortened string:
-
- frontLength = (nLength - length(rFillStr)) / 2
- rearLength = nLength - length(rFillStr) - frontLength
- shortenedString = concat(<first frontLength characters of rStr,
- rFillStr,
- <last rearLength characters of rStr>)
-
- Preconditions:
- - nLength - length(rFillStr) >= 2
-
- @return the shortened string
- */
-String ShortenString(const String & rStr, xub_StrLen nLength, const String & rFillStr);
-// <- #111827#
-
-// #16487#
-/**
- Denotes special characters in a string.
-
- The rStr is split into parts containing special characters and
- parts not containing special characters. In a part containing
- special characters all characters are equal. These parts are
- maximal.
-
- @param rStr the string to denote in
-
- The resulting string is generated by concatenating the found
- parts. The parts without special characters are surrounded by
- "'". The parts containing special characters are denoted as "n x",
- where n is the length of the part and x is the representation of
- the special character (i. e. "tab(s)").
-
- @return the denoted string
-*/
-String DenoteSpecialCharacters(const String & rStr);
-
#endif