summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Driesner <cd@openoffice.org>2011-02-07 13:06:08 +0100
committerCarsten Driesner <cd@openoffice.org>2011-02-07 13:06:08 +0100
commita27e4b8ca5d84790c04a7351c4ea5ef004a0bbea (patch)
treee400e267e96a54f7c37896e7cdccca345b2616f0
parent4f65368101fde95f5bf97f114290b494a80ef051 (diff)
parent5b7dc4c9b5c1190edce19e568676270f315c31e6 (diff)
removetooltypes01: Rebase to DEV300m99
-rwxr-xr-x[-rw-r--r--]starmath/inc/dialog.hxx1
-rwxr-xr-x[-rw-r--r--]starmath/inc/document.hxx22
-rwxr-xr-x[-rw-r--r--]starmath/inc/parse.hxx76
-rwxr-xr-x[-rw-r--r--]starmath/inc/starmath.hrc5
-rw-r--r--starmath/source/cfgitem.cxx46
-rw-r--r--starmath/source/cfgitem.hxx9
-rwxr-xr-x[-rw-r--r--]starmath/source/config.cxx5
-rwxr-xr-x[-rw-r--r--]starmath/source/dialog.cxx7
-rwxr-xr-x[-rw-r--r--]starmath/source/dialog.hrc9
-rwxr-xr-x[-rw-r--r--]starmath/source/document.cxx44
-rwxr-xr-x[-rw-r--r--]starmath/source/makefile.mk22
-rwxr-xr-x[-rw-r--r--]starmath/source/mathmlexport.cxx16
-rwxr-xr-x[-rw-r--r--]starmath/source/mathmlimport.cxx63
-rwxr-xr-x[-rw-r--r--]starmath/source/mathmlimport.hxx8
-rwxr-xr-xstarmath/source/parse.cxx921
-rwxr-xr-x[-rw-r--r--]starmath/source/smmod.cxx1
-rwxr-xr-xstarmath/source/smres.src7
-rw-r--r--starmath/source/symbol.cxx17
-rwxr-xr-xstarmath/source/unomodel.cxx16
-rwxr-xr-xstarmath/source/view.cxx49
-rwxr-xr-xsw/inc/IDocumentDeviceAccess.hxx2
-rw-r--r--sw/inc/IDocumentUndoRedo.hxx260
-rw-r--r--sw/inc/IShellCursorSupplier.hxx51
-rw-r--r--sw/inc/SwRewriter.hxx6
-rw-r--r--sw/inc/SwUndoField.hxx26
-rw-r--r--sw/inc/cmdid.h3
-rw-r--r--sw/inc/crsrsh.hxx15
-rw-r--r--sw/inc/dbgoutsw.hxx2
-rw-r--r--sw/inc/doc.hxx127
-rw-r--r--sw/inc/docary.hxx7
-rw-r--r--sw/inc/editsh.hxx50
-rw-r--r--sw/inc/ndarr.hxx15
-rw-r--r--sw/inc/ndindex.hxx19
-rw-r--r--sw/inc/prtopt.hxx (renamed from sw/source/ui/inc/prtopt.hxx)0
-rw-r--r--sw/inc/shellio.hxx4
-rw-r--r--sw/inc/swdbtoolsclient.hxx2
-rw-r--r--sw/inc/swundo.hxx32
-rw-r--r--sw/inc/undobj.hxx1682
-rw-r--r--sw/inc/unoprnms.hxx3
-rw-r--r--sw/inc/viewsh.hxx3
-rw-r--r--sw/source/core/bastyp/swtypes.cxx3
-rw-r--r--sw/source/core/crsr/bookmrk.cxx18
-rw-r--r--sw/source/core/crsr/crsrsh.cxx15
-rw-r--r--sw/source/core/crsr/crstrvl.cxx11
-rw-r--r--sw/source/core/crsr/findattr.cxx17
-rw-r--r--sw/source/core/crsr/findcoll.cxx21
-rw-r--r--sw/source/core/crsr/findtxt.cxx25
-rw-r--r--sw/source/core/crsr/swcrsr.cxx14
-rw-r--r--sw/source/core/doc/dbgoutsw.cxx71
-rw-r--r--sw/source/core/doc/doc.cxx148
-rw-r--r--sw/source/core/doc/docbasic.cxx4
-rw-r--r--sw/source/core/doc/docbm.cxx1
-rw-r--r--sw/source/core/doc/doccomp.cxx55
-rw-r--r--sw/source/core/doc/doccorr.cxx4
-rw-r--r--sw/source/core/doc/docdesc.cxx36
-rw-r--r--sw/source/core/doc/docdraw.cxx39
-rw-r--r--sw/source/core/doc/docedt.cxx200
-rw-r--r--sw/source/core/doc/docfld.cxx18
-rw-r--r--sw/source/core/doc/docfly.cxx119
-rw-r--r--sw/source/core/doc/docfmt.cxx129
-rw-r--r--sw/source/core/doc/docftn.cxx22
-rw-r--r--sw/source/core/doc/docglbl.cxx5
-rw-r--r--sw/source/core/doc/docglos.cxx14
-rw-r--r--sw/source/core/doc/doclay.cxx262
-rw-r--r--sw/source/core/doc/docnew.cxx90
-rw-r--r--sw/source/core/doc/docnum.cxx122
-rw-r--r--sw/source/core/doc/docredln.cxx82
-rw-r--r--sw/source/core/doc/docruby.cxx15
-rw-r--r--sw/source/core/doc/docsort.cxx44
-rw-r--r--sw/source/core/doc/doctxm.cxx25
-rw-r--r--sw/source/core/doc/extinput.cxx18
-rw-r--r--sw/source/core/doc/poolfmt.cxx47
-rw-r--r--sw/source/core/doc/tblcpy.cxx13
-rw-r--r--sw/source/core/doc/tblrwcl.cxx3
-rw-r--r--sw/source/core/docnode/ndcopy.cxx112
-rw-r--r--sw/source/core/docnode/ndsect.cxx82
-rw-r--r--sw/source/core/docnode/ndtbl.cxx378
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx46
-rw-r--r--sw/source/core/docnode/nodes.cxx72
-rw-r--r--sw/source/core/docnode/section.cxx17
-rw-r--r--sw/source/core/docnode/swbaslnk.cxx2
-rw-r--r--sw/source/core/draw/dflyobj.cxx5
-rw-r--r--sw/source/core/draw/dview.cxx5
-rw-r--r--sw/source/core/edit/acorrect.cxx24
-rw-r--r--sw/source/core/edit/autofmt.cxx61
-rw-r--r--sw/source/core/edit/edatmisc.cxx26
-rw-r--r--sw/source/core/edit/eddel.cxx18
-rw-r--r--sw/source/core/edit/edfcol.cxx7
-rw-r--r--sw/source/core/edit/edglbldc.cxx22
-rw-r--r--sw/source/core/edit/editsh.cxx20
-rw-r--r--sw/source/core/edit/edlingu.cxx9
-rw-r--r--sw/source/core/edit/ednumber.cxx34
-rw-r--r--sw/source/core/edit/edsect.cxx9
-rw-r--r--sw/source/core/edit/edtab.cxx19
-rw-r--r--sw/source/core/edit/edtox.cxx24
-rw-r--r--sw/source/core/edit/edundo.cxx139
-rw-r--r--sw/source/core/edit/edws.cxx56
-rw-r--r--sw/source/core/fields/reffld.cxx2
-rw-r--r--sw/source/core/fields/usrfld.cxx8
-rw-r--r--sw/source/core/frmedt/fecopy.cxx10
-rw-r--r--sw/source/core/frmedt/fedesc.cxx12
-rw-r--r--sw/source/core/frmedt/fefly1.cxx22
-rw-r--r--sw/source/core/frmedt/feshview.cxx11
-rw-r--r--sw/source/core/frmedt/fetab.cxx4
-rw-r--r--sw/source/core/frmedt/tblsel.cxx15
-rw-r--r--sw/source/core/inc/SwUndoFmt.hxx (renamed from sw/inc/SwUndoFmt.hxx)33
-rw-r--r--sw/source/core/inc/SwUndoPageDesc.hxx (renamed from sw/inc/SwUndoPageDesc.hxx)25
-rw-r--r--sw/source/core/inc/SwUndoTOXChange.hxx (renamed from sw/inc/SwUndoTOXChange.hxx)14
-rw-r--r--sw/source/core/inc/UndoAttribute.hxx288
-rw-r--r--sw/source/core/inc/UndoBookmark.hxx83
-rw-r--r--sw/source/core/inc/UndoCore.hxx263
-rw-r--r--sw/source/core/inc/UndoDelete.hxx115
-rw-r--r--sw/source/core/inc/UndoDraw.hxx150
-rw-r--r--sw/source/core/inc/UndoInsert.hxx235
-rw-r--r--sw/source/core/inc/UndoManager.hxx124
-rw-r--r--sw/source/core/inc/UndoNumbering.hxx154
-rw-r--r--sw/source/core/inc/UndoOverwrite.hxx105
-rw-r--r--sw/source/core/inc/UndoRedline.hxx145
-rw-r--r--sw/source/core/inc/UndoSection.hxx82
-rw-r--r--sw/source/core/inc/UndoSort.hxx97
-rw-r--r--sw/source/core/inc/UndoSplitMove.hxx96
-rw-r--r--sw/source/core/inc/UndoTable.hxx391
-rw-r--r--sw/source/core/inc/acorrect.hxx2
-rw-r--r--sw/source/core/inc/rolbck.hxx (renamed from sw/inc/rolbck.hxx)0
-rw-r--r--sw/source/core/inc/undoflystrattr.hxx11
-rw-r--r--sw/source/core/layout/atrfrm.cxx13
-rw-r--r--sw/source/core/layout/flycnt.cxx8
-rw-r--r--sw/source/core/layout/laycache.cxx3
-rw-r--r--sw/source/core/layout/trvlfrm.cxx7
-rw-r--r--sw/source/core/swg/SwXMLTextBlocks.cxx8
-rw-r--r--sw/source/core/table/swnewtable.cxx12
-rw-r--r--sw/source/core/table/swtable.cxx3
-rw-r--r--sw/source/core/txtnode/atrflyin.cxx16
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx14
-rw-r--r--sw/source/core/txtnode/thints.cxx18
-rw-r--r--sw/source/core/txtnode/txtedt.cxx55
-rw-r--r--sw/source/core/undo/SwUndoField.cxx38
-rw-r--r--sw/source/core/undo/SwUndoFmt.cxx81
-rw-r--r--sw/source/core/undo/SwUndoPageDesc.cxx72
-rw-r--r--sw/source/core/undo/SwUndoTOXChange.cxx16
-rw-r--r--sw/source/core/undo/docundo.cxx1133
-rw-r--r--sw/source/core/undo/rolbck.cxx46
-rw-r--r--sw/source/core/undo/unattr.cxx288
-rw-r--r--sw/source/core/undo/unbkmk.cxx17
-rw-r--r--sw/source/core/undo/undel.cxx58
-rw-r--r--sw/source/core/undo/undobj.cxx275
-rw-r--r--sw/source/core/undo/undobj1.cxx155
-rw-r--r--sw/source/core/undo/undoflystrattr.cxx9
-rw-r--r--sw/source/core/undo/undraw.cxx53
-rw-r--r--sw/source/core/undo/unfmco.cxx43
-rw-r--r--sw/source/core/undo/unins.cxx290
-rw-r--r--sw/source/core/undo/unmove.cxx27
-rw-r--r--sw/source/core/undo/unnum.cxx172
-rw-r--r--sw/source/core/undo/unoutl.cxx27
-rw-r--r--sw/source/core/undo/unovwr.cxx78
-rw-r--r--sw/source/core/undo/unredln.cxx137
-rw-r--r--sw/source/core/undo/unsect.cxx62
-rw-r--r--sw/source/core/undo/unsort.cxx85
-rw-r--r--sw/source/core/undo/unspnd.cxx48
-rw-r--r--sw/source/core/undo/untbl.cxx355
-rw-r--r--sw/source/core/undo/untblk.cxx68
-rw-r--r--sw/source/core/unocore/unobkm.cxx11
-rw-r--r--sw/source/core/unocore/unocrsrhelper.cxx11
-rw-r--r--sw/source/core/unocore/unodraw.cxx9
-rw-r--r--sw/source/core/unocore/unoframe.cxx22
-rw-r--r--sw/source/core/unocore/unomap.cxx1
-rw-r--r--sw/source/core/unocore/unoobj.cxx19
-rw-r--r--sw/source/core/unocore/unoobj2.cxx13
-rw-r--r--sw/source/core/unocore/unoprnms.cxx1
-rw-r--r--sw/source/core/unocore/unosect.cxx5
-rw-r--r--sw/source/core/unocore/unostyle.cxx9
-rw-r--r--sw/source/core/unocore/unotbl.cxx12
-rw-r--r--sw/source/core/unocore/unotext.cxx48
-rw-r--r--sw/source/core/view/pagepreviewlayout.cxx3
-rw-r--r--sw/source/core/view/viewsh.cxx7
-rw-r--r--sw/source/core/view/vnew.cxx10
-rw-r--r--sw/source/core/view/vprint.cxx17
-rw-r--r--sw/source/filter/basflt/shellio.cxx34
-rw-r--r--sw/source/filter/html/htmlbas.cxx8
-rw-r--r--sw/source/filter/html/htmlcss1.cxx2
-rw-r--r--sw/source/filter/html/htmldraw.cxx6
-rw-r--r--sw/source/filter/html/htmlform.cxx4
-rw-r--r--sw/source/filter/html/htmlsect.cxx14
-rw-r--r--sw/source/filter/html/htmltab.cxx21
-rw-r--r--sw/source/filter/html/swhtml.cxx34
-rw-r--r--sw/source/filter/rtf/rtffly.cxx6
-rw-r--r--sw/source/filter/rtf/rtftbl.cxx4
-rw-r--r--sw/source/filter/rtf/swparrtf.cxx3
-rw-r--r--sw/source/filter/writer/writer.cxx6
-rw-r--r--sw/source/filter/ww1/fltshell.cxx15
-rw-r--r--sw/source/filter/ww8/ww8par.cxx8
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx2
-rw-r--r--sw/source/ui/app/apphdl.cxx30
-rw-r--r--sw/source/ui/app/appopt.cxx4
-rw-r--r--sw/source/ui/app/docsh.cxx5
-rw-r--r--sw/source/ui/app/docsh2.cxx35
-rw-r--r--sw/source/ui/app/docst.cxx25
-rw-r--r--sw/source/ui/app/docstyle.cxx20
-rw-r--r--sw/source/ui/config/optload.cxx6
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx15
-rw-r--r--sw/source/ui/dbui/swdbtoolsclient.cxx4
-rw-r--r--sw/source/ui/dialog/macassgn.cxx33
-rw-r--r--sw/source/ui/dochdl/swdtflvr.cxx14
-rw-r--r--sw/source/ui/docvw/AnnotationWin.cxx9
-rw-r--r--sw/source/ui/docvw/PostItMgr.cxx8
-rw-r--r--sw/source/ui/docvw/SidebarTxtControl.cxx1
-rw-r--r--sw/source/ui/docvw/edtwin.cxx10
-rw-r--r--sw/source/ui/envelp/mailmrge.cxx5
-rwxr-xr-xsw/source/ui/inc/annotsh.hxx3
-rw-r--r--sw/source/ui/inc/drwtxtsh.hxx3
-rw-r--r--sw/source/ui/inc/inputwin.hxx29
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx13
-rw-r--r--sw/source/ui/index/toxmgr.cxx20
-rw-r--r--sw/source/ui/lingu/olmenu.cxx3
-rw-r--r--sw/source/ui/misc/glshell.cxx14
-rw-r--r--sw/source/ui/misc/redlndlg.cxx19
-rw-r--r--sw/source/ui/ribbar/drawbase.cxx7
-rwxr-xr-xsw/source/ui/ribbar/inputwin.cxx86
-rwxr-xr-xsw/source/ui/shells/annotsh.cxx32
-rw-r--r--sw/source/ui/shells/basesh.cxx30
-rw-r--r--sw/source/ui/shells/drwbassh.cxx2
-rw-r--r--sw/source/ui/shells/drwtxtsh.cxx18
-rw-r--r--sw/source/ui/shells/grfshex.cxx15
-rwxr-xr-xsw/source/ui/shells/langhelper.cxx6
-rw-r--r--sw/source/ui/shells/textsh.cxx11
-rw-r--r--sw/source/ui/table/chartins.cxx4
-rw-r--r--sw/source/ui/uiview/srcview.cxx2
-rw-r--r--sw/source/ui/uiview/view.cxx8
-rw-r--r--sw/source/ui/uiview/view2.cxx14
-rw-r--r--sw/source/ui/uiview/viewprt.cxx6
-rw-r--r--sw/source/ui/uiview/viewsrch.cxx15
-rw-r--r--sw/source/ui/uiview/viewstat.cxx11
-rw-r--r--sw/source/ui/uno/SwXDocumentSettings.cxx6
-rw-r--r--sw/source/ui/uno/unomailmerge.cxx5
-rw-r--r--sw/source/ui/uno/unomod.cxx16
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx54
-rw-r--r--sw/source/ui/utlui/content.cxx24
-rw-r--r--sw/source/ui/wrtsh/select.cxx6
-rw-r--r--sw/source/ui/wrtsh/wrtsh1.cxx5
-rw-r--r--sw/source/ui/wrtsh/wrtsh2.cxx25
-rw-r--r--sw/source/ui/wrtsh/wrtundo.cxx53
241 files changed, 7202 insertions, 6789 deletions
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index 0d8da7ceea5a..806bfbf4e4a2 100644..100755
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -71,6 +71,7 @@ class SmPrintOptionsTabPage : public SfxTabPage
MetricField aZoom;
FixedLine aFixedLine3;
CheckBox aNoRightSpaces;
+ CheckBox aSaveOnlyUsedSymbols;
DECL_LINK(SizeButtonClickHdl, Button *);
diff --git a/starmath/inc/document.hxx b/starmath/inc/document.hxx
index 5ce1a9f8c0ce..f31a53801120 100644..100755
--- a/starmath/inc/document.hxx
+++ b/starmath/inc/document.hxx
@@ -29,19 +29,21 @@
#define SMDLL 1
-#include <sot/storage.hxx>
-#include <sot/sotref.hxx>
+#include <rtl/ustring.hxx>
+#include <sfx2/docfac.hxx>
#include <sfx2/objsh.hxx>
+#include <sot/sotref.hxx>
+#include <sot/storage.hxx>
#include <svl/lstner.hxx>
-#include <sfx2/docfac.hxx>
+#include <vcl/jobset.hxx>
#include <vcl/virdev.hxx>
+#include <set>
+
#include "format.hxx"
#include "parse.hxx"
#include "smmod.hxx"
-#include <vcl/jobset.hxx>
-
class SmNode;
class SfxMenuBarManager;
class SfxPrinter;
@@ -121,8 +123,10 @@ class SmDocShell : public SfxObjectShell, public SfxListener
nRightBorder,
nTopBorder,
nBottomBorder;
- sal_uInt16 nModifyCount;
- sal_Bool bIsFormulaArranged;
+ sal_uInt16 nModifyCount;
+ sal_Bool bIsFormulaArranged;
+
+ std::set< rtl::OUString > aUsedSymbols; // to export used symbols only when saving
@@ -200,6 +204,8 @@ public:
const SmNode * GetFormulaTree() const { return pTree; }
void SetFormulaTree(SmNode *&rTree) { pTree = rTree; }
+ const std::set< rtl::OUString > & GetUsedSymbols() const { return aUsedSymbols; }
+
String GetAccessibleText();
EditEngine & GetEditEngine();
@@ -210,7 +216,7 @@ public:
void Repaint();
- virtual SfxUndoManager *GetUndoManager ();
+ virtual ::svl::IUndoManager *GetUndoManager ();
virtual SfxItemPool& GetPool() const;
diff --git a/starmath/inc/parse.hxx b/starmath/inc/parse.hxx
index 8deb9501afce..7a0d2f4b58b9 100644..100755
--- a/starmath/inc/parse.hxx
+++ b/starmath/inc/parse.hxx
@@ -33,11 +33,16 @@
#include <tools/list.hxx>
#include <tools/string.hxx>
+#include <set>
+#include <stack>
+#include <list>
+
#include "types.hxx"
class SmNode;
class SmDocShell;
+//////////////////////////////////////////////////////////////////////
// TokenGroups
#define TGOPER 0x00000001
@@ -113,17 +118,18 @@ enum SmTokenType
struct SmToken
{
- // token text
- String aText;
- // token info
- SmTokenType eType;
+
+ String aText; // token text
+ SmTokenType eType; // token info
sal_Unicode cMathChar;
+
// parse-help info
sal_uLong nGroup;
sal_uInt16 nLevel;
+
// token position
sal_uInt16 nRow;
- xub_StrLen nCol;
+ xub_StrLen nCol;
SmToken();
};
@@ -152,6 +158,7 @@ struct SmErrorDesc
String Text;
};
+
DECLARE_STACK(SmNodeStack, SmNode *)
DECLARE_LIST(SmErrDescList, SmErrorDesc *)
@@ -170,19 +177,22 @@ enum SmConvert
class SmParser
{
- String BufferString;
- SmToken CurToken;
- SmNodeStack NodeStack;
- SmErrDescList ErrDescList;
- int CurError;
- LanguageType nLang;
- xub_StrLen BufferIndex,
- nTokenIndex;
- sal_uInt16 Row,
- ColOff;
- SmConvert eConversion;
- sal_Bool bImportSymNames,
- bExportSymNames;
+ String m_aBufferString;
+ SmToken m_aCurToken;
+ SmNodeStack m_aNodeStack;
+ SmErrDescList m_aErrDescList;
+ int m_nCurError;
+ LanguageType m_nLang;
+ xub_StrLen m_nBufferIndex,
+ m_nTokenIndex;
+ USHORT m_Row,
+ m_nColOff;
+ SmConvert m_eConversion;
+ sal_Bool m_bImportSymNames,
+ m_bExportSymNames;
+
+ // map of used symbols (used to reduce file size by exporting only actually used symbols)
+ std::set< rtl::OUString > m_aUsedSymbols;
// declare copy-constructor and assignment-operator private
SmParser(const SmParser &);
@@ -193,9 +203,9 @@ protected:
sal_Bool IsDelimiter( const String &rTxt, xub_StrLen nPos );
#endif
void NextToken();
- xub_StrLen GetTokenIndex() const { return nTokenIndex; }
+ xub_StrLen GetTokenIndex() const { return m_nTokenIndex; }
void Insert(const String &rText, sal_uInt16 nPos);
- void Replace( sal_uInt16 nPos, sal_uInt16 nLen, const String &rText );
+ void Replace( USHORT nPos, USHORT nLen, const String &rText );
inline sal_Bool TokenInGroup(sal_uLong nGroup);
@@ -231,37 +241,43 @@ protected:
void GlyphSpecial();
// end of grammar
- LanguageType GetLanguage() const { return nLang; }
- void SetLanguage( LanguageType nNewLang ) { nLang = nNewLang; }
+ LanguageType GetLanguage() const { return m_nLang; }
+ void SetLanguage( LanguageType nNewLang ) { m_nLang = nNewLang; }
void Error(SmParseError Error);
+ void ClearUsedSymbols() { m_aUsedSymbols.clear(); }
+ void AddToUsedSymbols( const String &rSymbolName ) { m_aUsedSymbols.insert( rSymbolName ); }
+
public:
SmParser();
SmNode *Parse(const String &rBuffer);
- const String & GetText() const { return BufferString; };
+ const String & GetText() const { return m_aBufferString; };
- SmConvert GetConversion() const { return eConversion; }
- void SetConversion(SmConvert eConv) { eConversion = eConv; }
+ SmConvert GetConversion() const { return m_eConversion; }
+ void SetConversion(SmConvert eConv) { m_eConversion = eConv; }
- sal_Bool IsImportSymbolNames() const { return bImportSymNames; }
- void SetImportSymbolNames(sal_Bool bVal) { bImportSymNames = bVal; }
- sal_Bool IsExportSymbolNames() const { return bExportSymNames; }
- void SetExportSymbolNames(sal_Bool bVal) { bExportSymNames = bVal; }
+ sal_Bool IsImportSymbolNames() const { return m_bImportSymNames; }
+ void SetImportSymbolNames(BOOL bVal) { m_bImportSymNames = bVal; }
+ sal_Bool IsExportSymbolNames() const { return m_bExportSymNames; }
+ void SetExportSymbolNames(BOOL bVal) { m_bExportSymNames = bVal; }
sal_uInt16 AddError(SmParseError Type, SmNode *pNode);
const SmErrorDesc * NextError();
const SmErrorDesc * PrevError();
const SmErrorDesc * GetError(sal_uInt16 i = 0xFFFF);
+
+ bool IsUsedSymbol( const String &rSymbolName ) const { return m_aUsedSymbols.find( rSymbolName ) != m_aUsedSymbols.end(); }
+ std::set< rtl::OUString > GetUsedSymbols() const { return m_aUsedSymbols; }
};
inline sal_Bool SmParser::TokenInGroup(sal_uLong nGroup)
{
- return (CurToken.nGroup & nGroup) ? sal_True : sal_False;
+ return (m_aCurToken.nGroup & nGroup) ? sal_True : sal_False;
}
diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc
index 1b919471115c..7acefec94808 100644..100755
--- a/starmath/inc/starmath.hrc
+++ b/starmath/inc/starmath.hrc
@@ -82,10 +82,9 @@
#define SID_CMDBOXWINDOW (SID_SMA_START + 122)
#define SID_TOOLBOXWINDOW (SID_SMA_START + 123)
#define SID_NO_RIGHT_SPACES (SID_SMA_START + 124)
+#define SID_SAVE_ONLY_USED_SYMBOLS (SID_SMA_START + 125)
#define SID_DUMMY (SID_SMA_START + 254)
-//#define GID_FORMEL (RID_GROUPS_OFFSET + 1)
-//#define GID_ERROR (RID_GROUPS_OFFSET + 2)
//#define RID_OPTIONSDIALOG (RID_APP_START + 1)
#define RID_FONTDIALOG (RID_APP_START + 2)
@@ -100,8 +99,6 @@
#define RID_PRINTUIOPTIONS (RID_APP_START + 11)
#define RID_MATH_TOOLBOX (RID_APP_START + 50)
-// wegen #58705# entfernt
-//#define RID_DRAW_OBJECTBAR (RID_APP_START + 51)
#define RID_DEFAULTSAVEQUERY (RID_APP_START + 102)
#define RID_WRITESYMBOLERROR (RID_APP_START + 202)
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index 155322d5ce82..8a61c74f3b42 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -111,7 +111,8 @@ static const char * aMathPropNames[] =
"Print/Frame",
"Print/Size",
"Print/ZoomFactor",
- //"Misc/NoSymbolsWarning",
+ "LoadSave/IsSaveOnlyUsedSymbols",
+ //"Misc/NoSymbolsWarning", @deprecated
"Misc/IgnoreSpacesRight",
"View/ToolboxVisible",
"View/AutoRedraw",
@@ -202,15 +203,16 @@ static Sequence< OUString > GetOtherPropertyNames()
struct SmCfgOther
{
SmPrintSize ePrintSize;
- sal_uInt16 nPrintZoomFactor;
- sal_Bool bPrintTitle;
- sal_Bool bPrintFormulaText;
- sal_Bool bPrintFrame;
- sal_Bool bIgnoreSpacesRight;
- sal_Bool bToolboxVisible;
- sal_Bool bAutoRedraw;
- sal_Bool bFormulaCursor;
- //sal_Bool bNoSymbolsWarning;
+ sal_uInt16 nPrintZoomFactor;
+ sal_Bool bPrintTitle;
+ sal_Bool bPrintFormulaText;
+ sal_Bool bPrintFrame;
+ sal_Bool bIsSaveOnlyUsedSymbols;
+ sal_Bool bIgnoreSpacesRight;
+ sal_Bool bToolboxVisible;
+ sal_Bool bAutoRedraw;
+ sal_Bool bFormulaCursor;
+ //BOOL bNoSymbolsWarning;
SmCfgOther();
};
@@ -223,7 +225,7 @@ SmCfgOther::SmCfgOther()
bPrintTitle = bPrintFormulaText =
bPrintFrame = bIgnoreSpacesRight =
bToolboxVisible = bAutoRedraw =
- bFormulaCursor = /*bNoSymbolsWarning =*/ sal_True;
+ bFormulaCursor = bIsSaveOnlyUsedSymbols = sal_True;
}
/////////////////////////////////////////////////////////////////
@@ -900,6 +902,10 @@ void SmMathConfig::LoadOther()
// Print/ZoomFactor
if (pVal->hasValue() && (*pVal >>= nTmp16))
pOther->nPrintZoomFactor = nTmp16;
+ ++pVal;
+ // LoadSave/IsSaveOnlyUsedSymbols
+ if (pVal->hasValue() && (*pVal >>= bTmp))
+ pOther->bIsSaveOnlyUsedSymbols = bTmp;
/* ++pVal;
// Misc/NoSymbolsWarning
if (pVal->hasValue() && (*pVal >>= bTmp))
@@ -951,6 +957,8 @@ void SmMathConfig::SaveOther()
*pValue++ <<= (sal_Int16) pOther->ePrintSize;
// Print/ZoomFactor
*pValue++ <<= (sal_Int16) pOther->nPrintZoomFactor;
+ // LoadSave/IsSaveOnlyUsedSymbols
+ *pValue++ <<= (sal_Bool) pOther->bIsSaveOnlyUsedSymbols;
/* // Misc/NoSymbolsWarning
*pValue++ <<= (sal_Bool) pOther->bNoSymbolsWarning;
*/
@@ -1235,6 +1243,22 @@ void SmMathConfig::SetPrintFrame( sal_Bool bVal )
}
+sal_Bool SmMathConfig::IsSaveOnlyUsedSymbols() const
+{
+ if (!pOther)
+ ((SmMathConfig *) this)->LoadOther();
+ return pOther->bIsSaveOnlyUsedSymbols;
+}
+
+
+void SmMathConfig::SetSaveOnlyUsedSymbols( BOOL bVal )
+{
+ if (!pOther)
+ LoadOther();
+ SetOtherIfNotEqual( pOther->bIsSaveOnlyUsedSymbols, bVal );
+}
+
+
sal_Bool SmMathConfig::IsIgnoreSpacesRight() const
{
if (!pOther)
diff --git a/starmath/source/cfgitem.hxx b/starmath/source/cfgitem.hxx
index bda56fa260ae..e87f75063645 100644
--- a/starmath/source/cfgitem.hxx
+++ b/starmath/source/cfgitem.hxx
@@ -196,11 +196,14 @@ public:
sal_uInt16 GetPrintZoomFactor() const;
void SetPrintZoomFactor( sal_uInt16 nVal );
- sal_Bool IsIgnoreSpacesRight() const;
+ sal_Bool IsSaveOnlyUsedSymbols() const;
+ void SetSaveOnlyUsedSymbols( sal_Bool bVal );
+
+ sal_Bool IsIgnoreSpacesRight() const;
void SetIgnoreSpacesRight( sal_Bool bVal );
- sal_Bool IsAutoRedraw() const;
+ sal_Bool IsAutoRedraw() const;
void SetAutoRedraw( sal_Bool bVal );
- sal_Bool IsShowFormulaCursor() const;
+ sal_Bool IsShowFormulaCursor() const;
void SetShowFormulaCursor( sal_Bool bVal );
};
diff --git a/starmath/source/config.cxx b/starmath/source/config.cxx
index 9ed3a94ec33b..0933677e9298 100644..100755
--- a/starmath/source/config.cxx
+++ b/starmath/source/config.cxx
@@ -101,6 +101,10 @@ void SmConfig::ItemSetToConfig(const SfxItemSet &rSet)
Broadcast(SfxSimpleHint(HINT_FORMATCHANGED));
}
}
+ if (rSet.GetItemState(SID_SAVE_ONLY_USED_SYMBOLS, TRUE, &pItem) == SFX_ITEM_SET)
+ { bVal = ((const SfxBoolItem *) pItem)->GetValue();
+ SetSaveOnlyUsedSymbols( bVal );
+ }
SaveOther();
}
@@ -120,6 +124,7 @@ void SmConfig::ConfigToItemSet(SfxItemSet &rSet) const
rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTFRAME), IsPrintFrame()));
rSet.Put(SfxBoolItem(pPool->GetWhich(SID_AUTOREDRAW), IsAutoRedraw()));
rSet.Put(SfxBoolItem(pPool->GetWhich(SID_NO_RIGHT_SPACES), IsIgnoreSpacesRight()));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_SAVE_ONLY_USED_SYMBOLS), IsSaveOnlyUsedSymbols()));
}
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 6e5b0d94c0e4..153dce3f5a03 100644..100755
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -188,8 +188,9 @@ SmPrintOptionsTabPage::SmPrintOptionsTabPage(Window *pParent, const SfxItemSet &
aSizeScaled (this, SmResId( RB_FIT_TO_PAGE )),
aSizeZoomed (this, SmResId( RB_ZOOM )),
aZoom (this, SmResId( MF_ZOOM )),
- aFixedLine3 (this, SmResId( FL_MISC_OPTIONS )),
- aNoRightSpaces (this, SmResId( CB_IGNORE_SPACING ))
+ aFixedLine3 (this, SmResId( FL_MISC_OPTIONS )),
+ aNoRightSpaces (this, SmResId( CB_IGNORE_SPACING )),
+ aSaveOnlyUsedSymbols (this, SmResId( CB_SAVE_ONLY_USED_SYMBOLS ))
{
FreeResource();
@@ -217,6 +218,7 @@ sal_Bool SmPrintOptionsTabPage::FillItemSet(SfxItemSet& rSet)
rSet.Put(SfxBoolItem(GetWhich(SID_PRINTTEXT), aText.IsChecked()));
rSet.Put(SfxBoolItem(GetWhich(SID_PRINTFRAME), aFrame.IsChecked()));
rSet.Put(SfxBoolItem(GetWhich(SID_NO_RIGHT_SPACES), aNoRightSpaces.IsChecked()));
+ rSet.Put(SfxBoolItem(GetWhich(SID_SAVE_ONLY_USED_SYMBOLS), aSaveOnlyUsedSymbols.IsChecked()));
return sal_True;
}
@@ -238,6 +240,7 @@ void SmPrintOptionsTabPage::Reset(const SfxItemSet& rSet)
aText.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_PRINTTEXT))).GetValue());
aFrame.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_PRINTFRAME))).GetValue());
aNoRightSpaces.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_NO_RIGHT_SPACES))).GetValue());
+ aSaveOnlyUsedSymbols.Check(((const SfxBoolItem &)rSet.Get(GetWhich(SID_SAVE_ONLY_USED_SYMBOLS))).GetValue());
}
diff --git a/starmath/source/dialog.hrc b/starmath/source/dialog.hrc
index 29d87ba1d287..9e3e58493ab3 100644..100755
--- a/starmath/source/dialog.hrc
+++ b/starmath/source/dialog.hrc
@@ -31,17 +31,18 @@
#define FL_PRINTOPTIONS 10
#define CB_TITLEROW 11
-#define CB_EQUATION_TEXT 12
+#define CB_EQUATION_TEXT 12
#define CB_FRAME 13
#define FL_PRINT_FORMAT 20
-#define RB_ORIGINAL_SIZE 21
-#define RB_FIT_TO_PAGE 22
+#define RB_ORIGINAL_SIZE 21
+#define RB_FIT_TO_PAGE 22
#define RB_ZOOM 23
#define MF_ZOOM 24
#define FL_MISC_OPTIONS 30
-#define CB_IGNORE_SPACING 31
+#define CB_IGNORE_SPACING 31
+#define CB_SAVE_ONLY_USED_SYMBOLS 32
#define FT_FONTS_SUBSET 110
#define LB_FONTS_SUBSET 111
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 4d42034375c5..6075b9325cf0 100644..100755
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -98,6 +98,7 @@
#include "mathmlexport.hxx"
#include <sfx2/sfxsids.hrc>
#include <svx/svxids.hrc>
+#include <tools/diagnose_ex.h>
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
@@ -260,6 +261,8 @@ void SmDocShell::Parse()
pTree = aInterpreter.Parse(aText);
nModifyCount++; //! see comment for SID_GAPHIC_SM in SmDocShell::GetState
SetFormulaArranged( sal_False );
+
+ aUsedSymbols = aInterpreter.GetUsedSymbols();
}
@@ -1006,7 +1009,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
SmFormat aNewFormat( aOldFormat );
aNewFormat.SetTextmode(!aOldFormat.IsTextmode());
- SfxUndoManager *pTmpUndoMgr = GetUndoManager();
+ ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager();
if (pTmpUndoMgr)
pTmpUndoMgr->AddUndoAction(
new SmFormatAction(this, aOldFormat, aNewFormat));
@@ -1049,7 +1052,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
SmFormat aNewFormat( aOldFormat );
pFontTypeDialog->WriteTo(aNewFormat);
- SfxUndoManager *pTmpUndoMgr = GetUndoManager();
+ ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager();
if (pTmpUndoMgr)
pTmpUndoMgr->AddUndoAction(
new SmFormatAction(this, aOldFormat, aNewFormat));
@@ -1073,7 +1076,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
pFontSizeDialog->WriteTo(aNewFormat);
- SfxUndoManager *pTmpUndoMgr = GetUndoManager();
+ ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager();
if (pTmpUndoMgr)
pTmpUndoMgr->AddUndoAction(
new SmFormatAction(this, aOldFormat, aNewFormat));
@@ -1097,7 +1100,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
pDistanceDialog->WriteTo(aNewFormat);
- SfxUndoManager *pTmpUndoMgr = GetUndoManager();
+ ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager();
if (pTmpUndoMgr)
pTmpUndoMgr->AddUndoAction(
new SmFormatAction(this, aOldFormat, aNewFormat));
@@ -1126,7 +1129,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
pAlignDialog->WriteTo( aFmt );
pp->GetConfig()->SetStandardFormat( aFmt );
- SfxUndoManager *pTmpUndoMgr = GetUndoManager();
+ ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager();
if (pTmpUndoMgr)
pTmpUndoMgr->AddUndoAction(
new SmFormatAction(this, aOldFormat, aNewFormat));
@@ -1149,7 +1152,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
case SID_UNDO:
case SID_REDO:
{
- SfxUndoManager* pTmpUndoMgr = GetUndoManager();
+ ::svl::IUndoManager* pTmpUndoMgr = GetUndoManager();
if( pTmpUndoMgr )
{
sal_uInt16 nId = rReq.GetSlot(), nCnt = 1;
@@ -1158,22 +1161,29 @@ void SmDocShell::Execute(SfxRequest& rReq)
if( pArgs && SFX_ITEM_SET == pArgs->GetItemState( nId, sal_False, &pItem ))
nCnt = ((SfxUInt16Item*)pItem)->GetValue();
- sal_Bool (SfxUndoManager:: *fnDo)( sal_uInt16 );
+ sal_Bool (::svl::IUndoManager:: *fnDo)();
sal_uInt16 nCount;
if( SID_UNDO == rReq.GetSlot() )
{
nCount = pTmpUndoMgr->GetUndoActionCount();
- fnDo = &SfxUndoManager::Undo;
+ fnDo = &::svl::IUndoManager::Undo;
}
else
{
nCount = pTmpUndoMgr->GetRedoActionCount();
- fnDo = &SfxUndoManager::Redo;
+ fnDo = &::svl::IUndoManager::Redo;
}
- for( ; nCnt && nCount; --nCnt, --nCount )
- (pTmpUndoMgr->*fnDo)( 0 );
+ try
+ {
+ for( ; nCnt && nCount; --nCnt, --nCount )
+ (pTmpUndoMgr->*fnDo)();
+ }
+ catch( const Exception& e )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
Repaint();
SfxViewFrame* pFrm = SfxViewFrame::GetFirst( this );
@@ -1256,27 +1266,27 @@ void SmDocShell::GetState(SfxItemSet &rSet)
case SID_GETUNDOSTRINGS:
case SID_GETREDOSTRINGS:
{
- SfxUndoManager* pTmpUndoMgr = GetUndoManager();
+ ::svl::IUndoManager* pTmpUndoMgr = GetUndoManager();
if( pTmpUndoMgr )
{
- UniString(SfxUndoManager:: *fnGetComment)( sal_uInt16 ) const;
+ UniString(::svl::IUndoManager:: *fnGetComment)( size_t, bool const ) const;
sal_uInt16 nCount;
if( SID_GETUNDOSTRINGS == nWh )
{
nCount = pTmpUndoMgr->GetUndoActionCount();
- fnGetComment = &SfxUndoManager::GetUndoActionComment;
+ fnGetComment = &::svl::IUndoManager::GetUndoActionComment;
}
else
{
nCount = pTmpUndoMgr->GetRedoActionCount();
- fnGetComment = &SfxUndoManager::GetRedoActionComment;
+ fnGetComment = &::svl::IUndoManager::GetRedoActionComment;
}
if( nCount )
{
String sList;
for( sal_uInt16 n = 0; n < nCount; ++n )
- ( sList += (pTmpUndoMgr->*fnGetComment)( n ) )
+ ( sList += (pTmpUndoMgr->*fnGetComment)( n, ::svl::IUndoManager::TopLevel ) )
+= '\n';
SfxStringListItem aItem( nWh );
@@ -1293,7 +1303,7 @@ void SmDocShell::GetState(SfxItemSet &rSet)
}
-SfxUndoManager *SmDocShell::GetUndoManager()
+::svl::IUndoManager *SmDocShell::GetUndoManager()
{
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmDocShell::GetUndoManager" );
diff --git a/starmath/source/makefile.mk b/starmath/source/makefile.mk
index 5900fae65b87..c9f0226c8df4 100644..100755
--- a/starmath/source/makefile.mk
+++ b/starmath/source/makefile.mk
@@ -52,31 +52,31 @@ SRC2FILES = smres.src \
SLO1FILES = \
$(SLO)$/accessibility.obj \
- $(SLO)$/edit.obj \
- $(SLO)$/eqnolefilehdr.obj \
- $(SLO)$/mathmlexport.obj \
- $(SLO)$/mathmlimport.obj \
- $(SLO)$/symbol.obj \
- $(SLO)$/types.obj \
- $(SLO)$/unodoc.obj \
$(SLO)$/action.obj \
$(SLO)$/cfgitem.obj \
$(SLO)$/config.obj \
$(SLO)$/dialog.obj \
$(SLO)$/document.obj \
+ $(SLO)$/edit.obj \
+ $(SLO)$/eqnolefilehdr.obj \
$(SLO)$/format.obj \
+ $(SLO)$/mathmlexport.obj \
+ $(SLO)$/mathmlimport.obj \
$(SLO)$/mathtype.obj \
$(SLO)$/node.obj \
$(SLO)$/parse.obj \
+ $(SLO)$/rect.obj \
$(SLO)$/register.obj \
$(SLO)$/smdll.obj \
+ $(SLO)$/smmod.obj \
+ $(SLO)$/symbol.obj \
$(SLO)$/toolbox.obj \
$(SLO)$/typemap.obj \
- $(SLO)$/smmod.obj \
+ $(SLO)$/types.obj \
+ $(SLO)$/unodoc.obj \
$(SLO)$/utility.obj \
- $(SLO)$/rect.obj \
- $(SLO)$/unomodel.obj \
- $(SLO)$/view.obj
+ $(SLO)$/view.obj \
+ $(SLO)$/unomodel.obj
SLO2FILES = \
$(SLO)$/register.obj \
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 0e4037186875..f4198010f3d8 100644..100755
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -79,6 +79,7 @@
#include <unomodel.hxx>
#include <document.hxx>
#include <utility.hxx>
+#include <config.hxx>
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
@@ -742,6 +743,9 @@ void SmXMLExport::GetConfigurationSettings( Sequence < PropertyValue > & rProps)
PropertyValue* pProps = rProps.getArray();
if (pProps)
{
+ SmConfig *pConfig = SM_MOD()->GetConfig();
+ const bool bUsedSymbolsOnly = pConfig ? pConfig->IsSaveOnlyUsedSymbols() : false;
+
const OUString sFormula ( RTL_CONSTASCII_USTRINGPARAM ( "Formula" ) );
const OUString sBasicLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "BasicLibraries" ) );
const OUString sDialogLibraries ( RTL_CONSTASCII_USTRINGPARAM ( "DialogLibraries" ) );
@@ -755,7 +759,14 @@ void SmXMLExport::GetConfigurationSettings( Sequence < PropertyValue > & rProps)
rPropName != sRuntimeUID)
{
pProps->Name = rPropName;
- pProps->Value = xProps->getPropertyValue(rPropName);
+
+ rtl::OUString aActualName( rPropName );
+
+ // handle 'save used symbols only'
+ if (bUsedSymbolsOnly && rPropName.equalsAscii("Symbols"))
+ aActualName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "UserDefinedSymbolsInUse" ) );
+
+ pProps->Value = xProps->getPropertyValue( aActualName );
}
}
}
@@ -784,7 +795,8 @@ void SmXMLExport::ExportExpression(const SmNode *pNode, int nLevel)
SvXMLElementExport *pRow=0;
sal_uLong nSize = pNode->GetNumSubNodes();
- if (nSize > 1)
+ // #i115443: nodes of type expression always need to be grouped with mrow statement
+ if (nSize > 1 || (pNode && pNode->GetType() == NEXPRESSION))
pRow = new SvXMLElementExport(*this, XML_NAMESPACE_MATH, XML_MROW, sal_True, sal_True);
//if (nSize)
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index a9b8531f144b..98b0ad5edbf3 100644..100755
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -1613,8 +1613,11 @@ public:
void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup eSubSup)
{
/*The <msub> element requires exactly 2 arguments.*/
- DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2,
- "Sub has not two arguments");
+ const bool bNodeCheck = GetSmImport().GetNodeStack().Count() - nElementCount == 2;
+ DBG_ASSERT( bNodeCheck, "Sub has not two arguments" );
+ if (!bNodeCheck)
+ return;
+
SmToken aToken;
aToken.cMathChar = '\0';
aToken.nGroup = 0;
@@ -1672,8 +1675,10 @@ void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType,
SmSubSup aSub,SmSubSup aSup)
{
/*The <msub> element requires exactly 3 arguments.*/
- DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 3,
- "SubSup has not three arguments");
+ const bool bNodeCheck = GetSmImport().GetNodeStack().Count() - nElementCount == 3;
+ DBG_ASSERT( bNodeCheck, "SubSup has not three arguments" );
+ if (!bNodeCheck)
+ return;
SmToken aToken;
aToken.cMathChar = '\0';
@@ -1721,8 +1726,10 @@ void SmXMLUnderContext_Impl::StartElement(const uno::Reference<
void SmXMLUnderContext_Impl::HandleAccent()
{
- DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2,
- "Sub has not two arguments");
+ const bool bNodeCheck = GetSmImport().GetNodeStack().Count() - nElementCount == 2;
+ DBG_ASSERT( bNodeCheck, "Sub has not two arguments" );
+ if (!bNodeCheck)
+ return;
/*Just one special case for the underline thing*/
SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
@@ -1803,8 +1810,11 @@ void SmXMLOverContext_Impl::EndElement()
void SmXMLOverContext_Impl::HandleAccent()
{
- DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2,
- "Sub has not two arguments");
+ const bool bNodeCheck = GetSmImport().GetNodeStack().Count() - nElementCount == 2;
+ DBG_ASSERT( bNodeCheck, "Sub has not two arguments" );
+ if (!bNodeCheck)
+ return;
+
SmToken aToken;
aToken.cMathChar = '\0';
aToken.nGroup = 0;
@@ -2352,6 +2362,12 @@ void SmXMLDocContext_Impl::EndElement()
void SmXMLFracContext_Impl::EndElement()
{
+ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ const bool bNodeCheck = rNodeStack.Count() - nElementCount == 2;
+ DBG_ASSERT( bNodeCheck, "Fraction (mfrac) tag is missing component" );
+ if (!bNodeCheck)
+ return;
+
SmToken aToken;
aToken.cMathChar = '\0';
aToken.nGroup = 0;
@@ -2359,23 +2375,19 @@ void SmXMLFracContext_Impl::EndElement()
aToken.eType = TOVER;
SmStructureNode *pSNode = new SmBinVerNode(aToken);
SmNode *pOper = new SmRectangleNode(aToken);
- SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
- DBG_ASSERT(rNodeStack.Count() - nElementCount == 2,
- "Fraction (mfrac) tag is missing component");
- if (rNodeStack.Count() - nElementCount == 2)
- {
- SmNode *pSecond = rNodeStack.Pop();
- SmNode *pFirst = rNodeStack.Pop();
- pSNode->SetSubNodes(pFirst,pOper,pSecond);
- rNodeStack.Push(pSNode);
- }
+ SmNode *pSecond = rNodeStack.Pop();
+ SmNode *pFirst = rNodeStack.Pop();
+ pSNode->SetSubNodes(pFirst,pOper,pSecond);
+ rNodeStack.Push(pSNode);
}
void SmXMLRootContext_Impl::EndElement()
{
/*The <mroot> element requires exactly 2 arguments.*/
- DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount == 2,
- "Root tag is missing component");
+ const bool bNodeCheck = GetSmImport().GetNodeStack().Count() - nElementCount == 2;
+ DBG_ASSERT( bNodeCheck, "Root tag is missing component" );
+ if (!bNodeCheck)
+ return;
SmToken aToken;
aToken.cMathChar = MS_SQRT; //Temporary: alert, based on StarSymbol font
@@ -2612,9 +2624,8 @@ void SmXMLMultiScriptsContext_Impl::MiddleElement()
{
bHasPrescripts=sal_True;
- DBG_ASSERT(GetSmImport().GetNodeStack().Count() - nElementCount > 0,
- "Sub has no arguments");
SmNodeStack &rNodeStack = GetSmImport().GetNodeStack();
+ DBG_ASSERT( rNodeStack.Count() - nElementCount > 0, "Sub has no arguments" );
if (rNodeStack.Count()-nElementCount > 1)
{
SmToken aToken;
@@ -3168,8 +3179,14 @@ void SmXMLImport::SetConfigurationSettings(const Sequence<PropertyValue>& aConfP
if ( xInfo->hasPropertyByName( pValues->Name ) )
xProps->setPropertyValue( pValues->Name, pValues->Value );
}
- catch( Exception& )
+ catch (beans::PropertyVetoException &e)
+ {
+ (void) e;
+ // dealing with read-only properties here. Nothing to do...
+ }
+ catch( Exception& e)
{
+ (void) e;
DBG_ERROR( "SmXMLImport::SetConfigurationSettings: Exception!" );
}
}
diff --git a/starmath/source/mathmlimport.hxx b/starmath/source/mathmlimport.hxx
index 23533b367978..fb397e87f736 100644..100755
--- a/starmath/source/mathmlimport.hxx
+++ b/starmath/source/mathmlimport.hxx
@@ -251,10 +251,10 @@ public:
const SvXMLTokenMap &GetPresTableElemTokenMap();
const SvXMLTokenMap &GetColorTokenMap();
- SmNodeStack & GetNodeStack() {return aNodeStack;}
- SmNode *GetTree() { return aNodeStack.Pop();}
- sal_Bool GetSuccess() { return bSuccess; }
- String &GetText() { return aText;}
+ SmNodeStack & GetNodeStack() { return aNodeStack; }
+ SmNode *GetTree() { return aNodeStack.Pop(); }
+ sal_Bool GetSuccess() { return bSuccess; }
+ String &GetText() { return aText; }
virtual void SetViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
virtual void SetConfigurationSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aViewProps);
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index 73e60051b538..4a85ccbaac56 100755
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -392,22 +392,22 @@ sal_Bool SmParser::IsDelimiter( const String &rTxt, xub_StrLen nPos )
void SmParser::Insert(const String &rText, sal_uInt16 nPos)
{
- BufferString.Insert(rText, nPos);
+ m_aBufferString.Insert(rText, nPos);
xub_StrLen nLen = rText.Len();
- BufferIndex = BufferIndex + nLen;
- nTokenIndex = nTokenIndex + nLen;
+ m_nBufferIndex = m_nBufferIndex + nLen;
+ m_nTokenIndex = m_nTokenIndex + nLen;
}
void SmParser::Replace( sal_uInt16 nPos, sal_uInt16 nLen, const String &rText )
{
- DBG_ASSERT( nPos + nLen <= BufferString.Len(), "argument mismatch" );
+ DBG_ASSERT( nPos + nLen <= m_aBufferString.Len(), "argument mismatch" );
- BufferString.Replace( nPos, nLen, rText );
+ m_aBufferString.Replace( nPos, nLen, rText );
sal_Int16 nChg = rText.Len() - nLen;
- BufferIndex = BufferIndex + nChg;
- nTokenIndex = nTokenIndex + nChg;
+ m_nBufferIndex = m_nBufferIndex + nChg;
+ m_nTokenIndex = m_nTokenIndex + nChg;
}
@@ -434,7 +434,7 @@ void SmParser::NextToken()
{
static const String aEmptyStr;
- xub_StrLen nBufLen = BufferString.Len();
+ xub_StrLen nBufLen = m_aBufferString.Len();
ParseResult aRes;
xub_StrLen nRealStart;
sal_Bool bCont;
@@ -444,12 +444,12 @@ void SmParser::NextToken()
{
// skip white spaces
while (UnicodeType::SPACE_SEPARATOR ==
- aCC.getType( BufferString, BufferIndex ))
- ++BufferIndex;
+ aCC.getType( m_aBufferString, m_nBufferIndex ))
+ ++m_nBufferIndex;
sal_Int32 nStartFlags = coStartFlags;
sal_Int32 nContFlags = coContFlags;
- sal_Unicode cFirstChar = BufferString.GetChar( BufferIndex );
+ sal_Unicode cFirstChar = m_aBufferString.GetChar( m_nBufferIndex );
/*
removed because of #i11752#
bNumStart = cFirstChar == '.' || ('0' <= cFirstChar && cFirstChar <= '9');
@@ -459,7 +459,7 @@ void SmParser::NextToken()
nContFlags = coNumContFlags;
}
*/
- aRes = aCC.parseAnyToken( BufferString, BufferIndex,
+ aRes = aCC.parseAnyToken( m_aBufferString, m_nBufferIndex,
nStartFlags, aEmptyStr,
nContFlags, aEmptyStr );
@@ -476,7 +476,7 @@ void SmParser::NextToken()
aCC.setLocale( aDotLoc );
aTmpRes = aCC.parsePredefinedToken(
KParseType::ASC_NUMBER,
- BufferString, BufferIndex,
+ m_aBufferString, m_nBufferIndex,
KParseTokens::ASC_DIGIT, aEmptyStr,
KParseTokens::ASC_DIGIT | KParseTokens::ASC_DOT, aEmptyStr );
aCC.setLocale( aOldLoc );
@@ -484,29 +484,29 @@ void SmParser::NextToken()
aRes.TokenType = aTmpRes.TokenType;
}
- nRealStart = BufferIndex + sal::static_int_cast< xub_StrLen >(aRes.LeadingWhiteSpace);
- BufferIndex = nRealStart;
+ nRealStart = m_nBufferIndex + sal::static_int_cast< xub_StrLen >(aRes.LeadingWhiteSpace);
+ m_nBufferIndex = nRealStart;
bCont = sal_False;
if ( aRes.TokenType == 0 &&
nRealStart < nBufLen &&
- '\n' == BufferString.GetChar( nRealStart ) )
+ '\n' == m_aBufferString.GetChar( nRealStart ) )
{
// keep data needed for tokens row and col entry up to date
- ++Row;
- BufferIndex = ColOff = nRealStart + 1;
+ ++m_Row;
+ m_nBufferIndex = m_nColOff = nRealStart + 1;
bCont = sal_True;
}
else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR)
{
- String aName( BufferString.Copy( nRealStart, 2 ));
+ String aName( m_aBufferString.Copy( nRealStart, 2 ));
if ( aName.EqualsAscii( "%%" ))
{
//SkipComment
- BufferIndex = nRealStart + 2;
- while (BufferIndex < nBufLen &&
- '\n' != BufferString.GetChar( BufferIndex ))
- ++BufferIndex;
+ m_nBufferIndex = nRealStart + 2;
+ while (m_nBufferIndex < nBufLen &&
+ '\n' != m_aBufferString.GetChar( m_nBufferIndex ))
+ ++m_nBufferIndex;
bCont = sal_True;
}
}
@@ -514,33 +514,33 @@ void SmParser::NextToken()
} while (bCont);
// set index of current token
- nTokenIndex = BufferIndex;
+ m_nTokenIndex = m_nBufferIndex;
- CurToken.nRow = Row;
- CurToken.nCol = nRealStart - ColOff + 1;
+ m_aCurToken.nRow = m_Row;
+ m_aCurToken.nCol = nRealStart - m_nColOff + 1;
sal_Bool bHandled = sal_True;
if (nRealStart >= nBufLen)
{
- CurToken.eType = TEND;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 0;
- CurToken.aText.Erase();
+ m_aCurToken.eType = TEND;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.Erase();
}
else if ((aRes.TokenType & (KParseType::ASC_NUMBER | KParseType::UNI_NUMBER))
|| (bNumStart && (aRes.TokenType & KParseType::IDENTNAME)))
{
sal_Int32 n = aRes.EndPos - nRealStart;
DBG_ASSERT( n >= 0, "length < 0" );
- CurToken.eType = TNUMBER;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText = BufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) );
+ m_aCurToken.eType = TNUMBER;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText = m_aBufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) );
#if OSL_DEBUG_LEVEL > 1
- if (!IsDelimiter( BufferString, static_cast< xub_StrLen >(aRes.EndPos) ))
+ if (!IsDelimiter( m_aBufferString, static_cast< xub_StrLen >(aRes.EndPos) ))
{
DBG_WARNING( "identifier really finished? (compatibility!)" );
}
@@ -548,59 +548,59 @@ void SmParser::NextToken()
}
else if (aRes.TokenType & KParseType::DOUBLE_QUOTE_STRING)
{
- CurToken.eType = TTEXT;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText = aRes.DequotedNameOrString;
- CurToken.nRow = Row;
- CurToken.nCol = nRealStart - ColOff + 2;
+ m_aCurToken.eType = TTEXT;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText = aRes.DequotedNameOrString;
+ m_aCurToken.nRow = m_Row;
+ m_aCurToken.nCol = nRealStart - m_nColOff + 2;
}
else if (aRes.TokenType & KParseType::IDENTNAME)
{
sal_Int32 n = aRes.EndPos - nRealStart;
DBG_ASSERT( n >= 0, "length < 0" );
- String aName( BufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) ) );
+ String aName( m_aBufferString.Copy( nRealStart, sal::static_int_cast< xub_StrLen >(n) ) );
const SmTokenTableEntry *pEntry = GetTokenTableEntry( aName );
if (pEntry)
{
- CurToken.eType = pEntry->eType;
- CurToken.cMathChar = pEntry->cMathChar;
- CurToken.nGroup = pEntry->nGroup;
- CurToken.nLevel = pEntry->nLevel;
- CurToken.aText.AssignAscii( pEntry->pIdent );
+ m_aCurToken.eType = pEntry->eType;
+ m_aCurToken.cMathChar = pEntry->cMathChar;
+ m_aCurToken.nGroup = pEntry->nGroup;
+ m_aCurToken.nLevel = pEntry->nLevel;
+ m_aCurToken.aText.AssignAscii( pEntry->pIdent );
}
else
{
- CurToken.eType = TIDENT;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText = aName;
+ m_aCurToken.eType = TIDENT;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText = aName;
#if OSL_DEBUG_LEVEL > 1
- if (!IsDelimiter( BufferString, static_cast< xub_StrLen >(aRes.EndPos) ))
+ if (!IsDelimiter( m_aBufferString, static_cast< xub_StrLen >(aRes.EndPos) ))
{
DBG_WARNING( "identifier really finished? (compatibility!)" );
}
#endif
}
}
- else if (aRes.TokenType == 0 && '_' == BufferString.GetChar( nRealStart ))
+ else if (aRes.TokenType == 0 && '_' == m_aBufferString.GetChar( nRealStart ))
{
- CurToken.eType = TRSUB;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = TGPOWER;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "_" );
+ m_aCurToken.eType = TRSUB;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = TGPOWER;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "_" );
aRes.EndPos = nRealStart + 1;
}
else if (aRes.TokenType & KParseType::BOOLEAN)
{
sal_Int32 &rnEndPos = aRes.EndPos;
- String aName( BufferString.Copy( nRealStart,
+ String aName( m_aBufferString.Copy( nRealStart,
sal::static_int_cast< xub_StrLen >(rnEndPos - nRealStart) ));
if (2 >= aName.Len())
{
@@ -609,91 +609,91 @@ void SmParser::NextToken()
{
case '<':
{
- if (BufferString.Copy( nRealStart, 2 ).
+ if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( "<<" ))
{
- CurToken.eType = TLL;
- CurToken.cMathChar = MS_LL;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "<<" );
+ m_aCurToken.eType = TLL;
+ m_aCurToken.cMathChar = MS_LL;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "<<" );
rnEndPos = nRealStart + 2;
}
- else if (BufferString.Copy( nRealStart, 2 ).
+ else if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( "<=" ))
{
- CurToken.eType = TLE;
- CurToken.cMathChar = MS_LE;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "<=" );
+ m_aCurToken.eType = TLE;
+ m_aCurToken.cMathChar = MS_LE;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "<=" );
rnEndPos = nRealStart + 2;
}
- else if (BufferString.Copy( nRealStart, 2 ).
+ else if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( "<>" ))
{
- CurToken.eType = TNEQ;
- CurToken.cMathChar = MS_NEQ;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "<>" );
+ m_aCurToken.eType = TNEQ;
+ m_aCurToken.cMathChar = MS_NEQ;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "<>" );
rnEndPos = nRealStart + 2;
}
- else if (BufferString.Copy( nRealStart, 3 ).
+ else if (m_aBufferString.Copy( nRealStart, 3 ).
EqualsAscii( "<?>" ))
{
- CurToken.eType = TPLACE;
- CurToken.cMathChar = MS_PLACE;
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "<?>" );
+ m_aCurToken.eType = TPLACE;
+ m_aCurToken.cMathChar = MS_PLACE;
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "<?>" );
rnEndPos = nRealStart + 3;
}
else
{
- CurToken.eType = TLT;
- CurToken.cMathChar = MS_LT;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "<" );
+ m_aCurToken.eType = TLT;
+ m_aCurToken.cMathChar = MS_LT;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "<" );
}
}
break;
case '>':
{
- if (BufferString.Copy( nRealStart, 2 ).
+ if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( ">=" ))
{
- CurToken.eType = TGE;
- CurToken.cMathChar = MS_GE;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( ">=" );
+ m_aCurToken.eType = TGE;
+ m_aCurToken.cMathChar = MS_GE;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( ">=" );
rnEndPos = nRealStart + 2;
}
- else if (BufferString.Copy( nRealStart, 2 ).
+ else if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( ">>" ))
{
- CurToken.eType = TGG;
- CurToken.cMathChar = MS_GG;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( ">>" );
+ m_aCurToken.eType = TGG;
+ m_aCurToken.cMathChar = MS_GG;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( ">>" );
rnEndPos = nRealStart + 2;
}
else
{
- CurToken.eType = TGT;
- CurToken.cMathChar = MS_GT;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( ">" );
+ m_aCurToken.eType = TGT;
+ m_aCurToken.cMathChar = MS_GT;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( ">" );
}
}
break;
@@ -705,7 +705,7 @@ void SmParser::NextToken()
else if (aRes.TokenType & KParseType::ONE_SINGLE_CHAR)
{
sal_Int32 &rnEndPos = aRes.EndPos;
- String aName( BufferString.Copy( nRealStart,
+ String aName( m_aBufferString.Copy( nRealStart,
sal::static_int_cast< xub_StrLen >(rnEndPos - nRealStart) ) );
if (1 == aName.Len())
@@ -718,12 +718,12 @@ void SmParser::NextToken()
//! modifies aRes.EndPos
DBG_ASSERT( rnEndPos >= nBufLen ||
- '%' != BufferString.GetChar( sal::static_int_cast< xub_StrLen >(rnEndPos) ),
+ '%' != m_aBufferString.GetChar( sal::static_int_cast< xub_StrLen >(rnEndPos) ),
"unexpected comment start" );
// get identifier of user-defined character
ParseResult aTmpRes = aCC.parseAnyToken(
- BufferString, rnEndPos,
+ m_aBufferString, rnEndPos,
KParseTokens::ANY_LETTER,
aEmptyStr,
coContFlags,
@@ -735,20 +735,20 @@ void SmParser::NextToken()
// default setting for the case that no identifier
// i.e. a valid symbol-name is following the '%'
// character
- CurToken.eType = TTEXT;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText = String();
- CurToken.nRow = sal::static_int_cast< xub_StrLen >(Row);
- CurToken.nCol = nTmpStart - ColOff;
+ m_aCurToken.eType = TTEXT;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText = String();
+ m_aCurToken.nRow = sal::static_int_cast< xub_StrLen >(m_Row);
+ m_aCurToken.nCol = nTmpStart - m_nColOff;
if (aTmpRes.TokenType & KParseType::IDENTNAME)
{
xub_StrLen n = sal::static_int_cast< xub_StrLen >(aTmpRes.EndPos - nTmpStart);
- CurToken.eType = TSPECIAL;
- CurToken.aText = BufferString.Copy( sal::static_int_cast< xub_StrLen >(nTmpStart-1), n+1 );
+ m_aCurToken.eType = TSPECIAL;
+ m_aCurToken.aText = m_aBufferString.Copy( sal::static_int_cast< xub_StrLen >(nTmpStart-1), n+1 );
DBG_ASSERT( aTmpRes.EndPos > rnEndPos,
"empty identifier" );
@@ -765,187 +765,187 @@ void SmParser::NextToken()
break;
case '[':
{
- CurToken.eType = TLBRACKET;
- CurToken.cMathChar = MS_LBRACKET;
- CurToken.nGroup = TGLBRACES;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "[" );
+ m_aCurToken.eType = TLBRACKET;
+ m_aCurToken.cMathChar = MS_LBRACKET;
+ m_aCurToken.nGroup = TGLBRACES;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "[" );
}
break;
case '\\':
{
- CurToken.eType = TESCAPE;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "\\" );
+ m_aCurToken.eType = TESCAPE;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "\\" );
}
break;
case ']':
{
- CurToken.eType = TRBRACKET;
- CurToken.cMathChar = MS_RBRACKET;
- CurToken.nGroup = TGRBRACES;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "]" );
+ m_aCurToken.eType = TRBRACKET;
+ m_aCurToken.cMathChar = MS_RBRACKET;
+ m_aCurToken.nGroup = TGRBRACES;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "]" );
}
break;
case '^':
{
- CurToken.eType = TRSUP;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = TGPOWER;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "^" );
+ m_aCurToken.eType = TRSUP;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = TGPOWER;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "^" );
}
break;
case '`':
{
- CurToken.eType = TSBLANK;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = TGBLANK;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "`" );
+ m_aCurToken.eType = TSBLANK;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = TGBLANK;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "`" );
}
break;
case '{':
{
- CurToken.eType = TLGROUP;
- CurToken.cMathChar = MS_LBRACE;
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "{" );
+ m_aCurToken.eType = TLGROUP;
+ m_aCurToken.cMathChar = MS_LBRACE;
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "{" );
}
break;
case '|':
{
- CurToken.eType = TOR;
- CurToken.cMathChar = MS_OR;
- CurToken.nGroup = TGSUM;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "|" );
+ m_aCurToken.eType = TOR;
+ m_aCurToken.cMathChar = MS_OR;
+ m_aCurToken.nGroup = TGSUM;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "|" );
}
break;
case '}':
{
- CurToken.eType = TRGROUP;
- CurToken.cMathChar = MS_RBRACE;
- CurToken.nGroup = 0;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "}" );
+ m_aCurToken.eType = TRGROUP;
+ m_aCurToken.cMathChar = MS_RBRACE;
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "}" );
}
break;
case '~':
{
- CurToken.eType = TBLANK;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = TGBLANK;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "~" );
+ m_aCurToken.eType = TBLANK;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = TGBLANK;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "~" );
}
break;
case '#':
{
- if (BufferString.Copy( nRealStart, 2 ).
+ if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( "##" ))
{
- CurToken.eType = TDPOUND;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "##" );
+ m_aCurToken.eType = TDPOUND;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "##" );
rnEndPos = nRealStart + 2;
}
else
{
- CurToken.eType = TPOUND;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "#" );
+ m_aCurToken.eType = TPOUND;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "#" );
}
}
break;
case '&':
{
- CurToken.eType = TAND;
- CurToken.cMathChar = MS_AND;
- CurToken.nGroup = TGPRODUCT;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "&" );
+ m_aCurToken.eType = TAND;
+ m_aCurToken.cMathChar = MS_AND;
+ m_aCurToken.nGroup = TGPRODUCT;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "&" );
}
break;
case '(':
{
- CurToken.eType = TLPARENT;
- CurToken.cMathChar = MS_LPARENT;
- CurToken.nGroup = TGLBRACES;
- CurToken.nLevel = 5; //! 0 to continue expression
- CurToken.aText.AssignAscii( "(" );
+ m_aCurToken.eType = TLPARENT;
+ m_aCurToken.cMathChar = MS_LPARENT;
+ m_aCurToken.nGroup = TGLBRACES;
+ m_aCurToken.nLevel = 5; //! 0 to continue expression
+ m_aCurToken.aText.AssignAscii( "(" );
}
break;
case ')':
{
- CurToken.eType = TRPARENT;
- CurToken.cMathChar = MS_RPARENT;
- CurToken.nGroup = TGRBRACES;
- CurToken.nLevel = 0; //! 0 to terminate expression
- CurToken.aText.AssignAscii( ")" );
+ m_aCurToken.eType = TRPARENT;
+ m_aCurToken.cMathChar = MS_RPARENT;
+ m_aCurToken.nGroup = TGRBRACES;
+ m_aCurToken.nLevel = 0; //! 0 to terminate expression
+ m_aCurToken.aText.AssignAscii( ")" );
}
break;
case '*':
{
- CurToken.eType = TMULTIPLY;
- CurToken.cMathChar = MS_MULTIPLY;
- CurToken.nGroup = TGPRODUCT;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "*" );
+ m_aCurToken.eType = TMULTIPLY;
+ m_aCurToken.cMathChar = MS_MULTIPLY;
+ m_aCurToken.nGroup = TGPRODUCT;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "*" );
}
break;
case '+':
{
- if (BufferString.Copy( nRealStart, 2 ).
+ if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( "+-" ))
{
- CurToken.eType = TPLUSMINUS;
- CurToken.cMathChar = MS_PLUSMINUS;
- CurToken.nGroup = TGUNOPER | TGSUM;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "+-" );
+ m_aCurToken.eType = TPLUSMINUS;
+ m_aCurToken.cMathChar = MS_PLUSMINUS;
+ m_aCurToken.nGroup = TGUNOPER | TGSUM;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "+-" );
rnEndPos = nRealStart + 2;
}
else
{
- CurToken.eType = TPLUS;
- CurToken.cMathChar = MS_PLUS;
- CurToken.nGroup = TGUNOPER | TGSUM;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "+" );
+ m_aCurToken.eType = TPLUS;
+ m_aCurToken.cMathChar = MS_PLUS;
+ m_aCurToken.nGroup = TGUNOPER | TGSUM;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "+" );
}
}
break;
case '-':
{
- if (BufferString.Copy( nRealStart, 2 ).
+ if (m_aBufferString.Copy( nRealStart, 2 ).
EqualsAscii( "-+" ))
{
- CurToken.eType = TMINUSPLUS;
- CurToken.cMathChar = MS_MINUSPLUS;
- CurToken.nGroup = TGUNOPER | TGSUM;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "-+" );
+ m_aCurToken.eType = TMINUSPLUS;
+ m_aCurToken.cMathChar = MS_MINUSPLUS;
+ m_aCurToken.nGroup = TGUNOPER | TGSUM;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "-+" );
rnEndPos = nRealStart + 2;
}
else
{
- CurToken.eType = TMINUS;
- CurToken.cMathChar = MS_MINUS;
- CurToken.nGroup = TGUNOPER | TGSUM;
- CurToken.nLevel = 5;
- CurToken.aText.AssignAscii( "-" );
+ m_aCurToken.eType = TMINUS;
+ m_aCurToken.cMathChar = MS_MINUS;
+ m_aCurToken.nGroup = TGUNOPER | TGSUM;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText.AssignAscii( "-" );
}
}
break;
@@ -954,40 +954,40 @@ void SmParser::NextToken()
// for compatibility with SO5.2
// texts like .34 ...56 ... h ...78..90
// will be treated as numbers
- CurToken.eType = TNUMBER;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
+ m_aCurToken.eType = TNUMBER;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
- xub_StrLen nTxtStart = BufferIndex;
+ xub_StrLen nTxtStart = m_nBufferIndex;
sal_Unicode cChar;
do
{
- cChar = BufferString.GetChar( ++BufferIndex );
+ cChar = m_aBufferString.GetChar( ++m_nBufferIndex );
}
while ( cChar == '.' || IsDigit( cChar ) );
- CurToken.aText = BufferString.Copy( sal::static_int_cast< xub_StrLen >(nTxtStart),
- sal::static_int_cast< xub_StrLen >(BufferIndex - nTxtStart) );
- aRes.EndPos = BufferIndex;
+ m_aCurToken.aText = m_aBufferString.Copy( sal::static_int_cast< xub_StrLen >(nTxtStart),
+ sal::static_int_cast< xub_StrLen >(m_nBufferIndex - nTxtStart) );
+ aRes.EndPos = m_nBufferIndex;
}
break;
case '/':
{
- CurToken.eType = TDIVIDEBY;
- CurToken.cMathChar = MS_SLASH;
- CurToken.nGroup = TGPRODUCT;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "/" );
+ m_aCurToken.eType = TDIVIDEBY;
+ m_aCurToken.cMathChar = MS_SLASH;
+ m_aCurToken.nGroup = TGPRODUCT;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "/" );
}
break;
case '=':
{
- CurToken.eType = TASSIGN;
- CurToken.cMathChar = MS_ASSIGN;
- CurToken.nGroup = TGRELATION;
- CurToken.nLevel = 0;
- CurToken.aText.AssignAscii( "=" );
+ m_aCurToken.eType = TASSIGN;
+ m_aCurToken.cMathChar = MS_ASSIGN;
+ m_aCurToken.nGroup = TGRELATION;
+ m_aCurToken.nLevel = 0;
+ m_aCurToken.aText.AssignAscii( "=" );
}
break;
default:
@@ -1000,17 +1000,17 @@ void SmParser::NextToken()
if (!bHandled)
{
- CurToken.eType = TCHARACTER;
- CurToken.cMathChar = '\0';
- CurToken.nGroup = 0;
- CurToken.nLevel = 5;
- CurToken.aText = BufferString.Copy( nRealStart, 1 );
+ m_aCurToken.eType = TCHARACTER;
+ m_aCurToken.cMathChar = '\0';
+ m_aCurToken.nGroup = 0;
+ m_aCurToken.nLevel = 5;
+ m_aCurToken.aText = m_aBufferString.Copy( nRealStart, 1 );
aRes.EndPos = nRealStart + 1;
}
- if (TEND != CurToken.eType)
- BufferIndex = sal::static_int_cast< xub_StrLen >(aRes.EndPos);
+ if (TEND != m_aCurToken.eType)
+ m_nBufferIndex = sal::static_int_cast< xub_StrLen >(aRes.EndPos);
}
@@ -1024,25 +1024,25 @@ void SmParser::Table()
SmNodeArray LineArray;
Line();
- while (CurToken.eType == TNEWLINE)
+ while (m_aCurToken.eType == TNEWLINE)
{
NextToken();
Line();
}
- if (CurToken.eType != TEND)
+ if (m_aCurToken.eType != TEND)
Error(PE_UNEXPECTED_CHAR);
- sal_uLong n = NodeStack.Count();
+ sal_uLong n = m_aNodeStack.Count();
LineArray.resize(n);
for (sal_uLong i = 0; i < n; i++)
- LineArray[n - (i + 1)] = NodeStack.Pop();
+ LineArray[n - (i + 1)] = m_aNodeStack.Pop();
- SmStructureNode *pSNode = new SmTableNode(CurToken);
+ SmStructureNode *pSNode = new SmTableNode(m_aCurToken);
pSNode->SetSubNodes(LineArray);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
@@ -1064,19 +1064,21 @@ void SmParser::Align()
// (the dominant one in 4.0) and erase all others (especially old
// discarded tokens) from command string.
while (TokenInGroup(TGALIGN))
- { if (TokenInGroup(TGDISCARDED) || pSNode)
- { BufferIndex = GetTokenIndex();
- BufferString.Erase(BufferIndex, CurToken.aText.Len());
+ {
+ if (TokenInGroup(TGDISCARDED) || pSNode)
+ {
+ m_nBufferIndex = GetTokenIndex();
+ m_aBufferString.Erase(m_nBufferIndex, m_aCurToken.aText.Len());
}
else
- pSNode = new SmAlignNode(CurToken);
+ pSNode = new SmAlignNode(m_aCurToken);
NextToken();
}
}
else
{
- pSNode = new SmAlignNode(CurToken);
+ pSNode = new SmAlignNode(m_aCurToken);
NextToken();
@@ -1094,8 +1096,8 @@ void SmParser::Align()
Insert('}', GetTokenIndex());
if (pSNode)
- { pSNode->SetSubNodes(NodeStack.Pop(), 0);
- NodeStack.Push(pSNode);
+ { pSNode->SetSubNodes(m_aNodeStack.Pop(), 0);
+ m_aNodeStack.Push(pSNode);
}
}
@@ -1110,37 +1112,37 @@ void SmParser::Line()
// start with single expression that may have an alignment statement
// (and go on with expressions that must not have alignment
// statements in 'while' loop below. See also 'Expression()'.)
- if (CurToken.eType != TEND && CurToken.eType != TNEWLINE)
+ if (m_aCurToken.eType != TEND && m_aCurToken.eType != TNEWLINE)
{ Align();
ExpressionArray.resize(++n);
- ExpressionArray[n - 1] = NodeStack.Pop();
+ ExpressionArray[n - 1] = m_aNodeStack.Pop();
}
- while (CurToken.eType != TEND && CurToken.eType != TNEWLINE)
+ while (m_aCurToken.eType != TEND && m_aCurToken.eType != TNEWLINE)
{ if (CONVERT_40_TO_50 != GetConversion())
Expression();
else
Align();
ExpressionArray.resize(++n);
- ExpressionArray[n - 1] = NodeStack.Pop();
+ ExpressionArray[n - 1] = m_aNodeStack.Pop();
}
- SmStructureNode *pSNode = new SmLineNode(CurToken);
+ SmStructureNode *pSNode = new SmLineNode(m_aCurToken);
pSNode->SetSubNodes(ExpressionArray);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
void SmParser::Expression()
{
sal_Bool bUseExtraSpaces = sal_True;
- SmNode *pNode = NodeStack.Pop();
+ SmNode *pNode = m_aNodeStack.Pop();
if (pNode)
{
if (pNode->GetToken().eType == TNOSPACE)
bUseExtraSpaces = sal_False;
else
- NodeStack.Push(pNode); // push the node from above again (now to be used as argument to this current 'nospace' node)
+ m_aNodeStack.Push(pNode); // push the node from above again (now to be used as argument to this current 'nospace' node)
}
sal_uInt16 n = 0;
@@ -1150,18 +1152,18 @@ void SmParser::Expression()
Relation();
RelationArray.resize(++n);
- RelationArray[n - 1] = NodeStack.Pop();
+ RelationArray[n - 1] = m_aNodeStack.Pop();
- while (CurToken.nLevel >= 4)
+ while (m_aCurToken.nLevel >= 4)
{ Relation();
RelationArray.resize(++n);
- RelationArray[n - 1] = NodeStack.Pop();
+ RelationArray[n - 1] = m_aNodeStack.Pop();
}
- SmExpressionNode *pSNode = new SmExpressionNode(CurToken);
+ SmExpressionNode *pSNode = new SmExpressionNode(m_aCurToken);
pSNode->SetSubNodes(RelationArray);
pSNode->SetUseExtraSpaces(bUseExtraSpaces);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
@@ -1170,16 +1172,16 @@ void SmParser::Relation()
Sum();
while (TokenInGroup(TGRELATION))
{
- SmStructureNode *pSNode = new SmBinHorNode(CurToken);
- SmNode *pFirst = NodeStack.Pop();
+ SmStructureNode *pSNode = new SmBinHorNode(m_aCurToken);
+ SmNode *pFirst = m_aNodeStack.Pop();
OpSubSup();
- SmNode *pSecond = NodeStack.Pop();
+ SmNode *pSecond = m_aNodeStack.Pop();
Sum();
- pSNode->SetSubNodes(pFirst, pSecond, NodeStack.Pop());
- NodeStack.Push(pSNode);
+ pSNode->SetSubNodes(pFirst, pSecond, m_aNodeStack.Pop());
+ m_aNodeStack.Push(pSNode);
}
}
@@ -1189,16 +1191,16 @@ void SmParser::Sum()
Product();
while (TokenInGroup(TGSUM))
{
- SmStructureNode *pSNode = new SmBinHorNode(CurToken);
- SmNode *pFirst = NodeStack.Pop();
+ SmStructureNode *pSNode = new SmBinHorNode(m_aCurToken);
+ SmNode *pFirst = m_aNodeStack.Pop();
OpSubSup();
- SmNode *pSecond = NodeStack.Pop();
+ SmNode *pSecond = m_aNodeStack.Pop();
Product();
- pSNode->SetSubNodes(pFirst, pSecond, NodeStack.Pop());
- NodeStack.Push(pSNode);
+ pSNode->SetSubNodes(pFirst, pSecond, m_aNodeStack.Pop());
+ m_aNodeStack.Push(pSNode);
}
}
@@ -1209,32 +1211,32 @@ void SmParser::Product()
while (TokenInGroup(TGPRODUCT))
{ SmStructureNode *pSNode;
- SmNode *pFirst = NodeStack.Pop(),
+ SmNode *pFirst = m_aNodeStack.Pop(),
*pOper;
sal_Bool bSwitchArgs = sal_False;
- SmTokenType eType = CurToken.eType;
+ SmTokenType eType = m_aCurToken.eType;
switch (eType)
{
case TOVER:
- pSNode = new SmBinVerNode(CurToken);
- pOper = new SmRectangleNode(CurToken);
+ pSNode = new SmBinVerNode(m_aCurToken);
+ pOper = new SmRectangleNode(m_aCurToken);
NextToken();
break;
case TBOPER:
- pSNode = new SmBinHorNode(CurToken);
+ pSNode = new SmBinHorNode(m_aCurToken);
NextToken();
GlyphSpecial();
- pOper = NodeStack.Pop();
+ pOper = m_aNodeStack.Pop();
break;
case TOVERBRACE :
case TUNDERBRACE :
- pSNode = new SmVerticalBraceNode(CurToken);
- pOper = new SmMathSymbolNode(CurToken);
+ pSNode = new SmVerticalBraceNode(m_aCurToken);
+ pOper = new SmMathSymbolNode(m_aCurToken);
NextToken();
break;
@@ -1242,11 +1244,11 @@ void SmParser::Product()
case TWIDEBACKSLASH:
case TWIDESLASH:
{
- SmBinDiagonalNode *pSTmp = new SmBinDiagonalNode(CurToken);
+ SmBinDiagonalNode *pSTmp = new SmBinDiagonalNode(m_aCurToken);
pSTmp->SetAscending(eType == TWIDESLASH);
pSNode = pSTmp;
- pOper = new SmPolyLineNode(CurToken);
+ pOper = new SmPolyLineNode(m_aCurToken);
NextToken();
bSwitchArgs =sal_True;
@@ -1254,20 +1256,20 @@ void SmParser::Product()
}
default:
- pSNode = new SmBinHorNode(CurToken);
+ pSNode = new SmBinHorNode(m_aCurToken);
OpSubSup();
- pOper = NodeStack.Pop();
+ pOper = m_aNodeStack.Pop();
}
Power();
if (bSwitchArgs)
//! vgl siehe SmBinDiagonalNode::Arrange
- pSNode->SetSubNodes(pFirst, NodeStack.Pop(), pOper);
+ pSNode->SetSubNodes(pFirst, m_aNodeStack.Pop(), pOper);
else
- pSNode->SetSubNodes(pFirst, pOper, NodeStack.Pop());
- NodeStack.Push(pSNode);
+ pSNode->SetSubNodes(pFirst, pOper, m_aNodeStack.Pop());
+ m_aNodeStack.Push(pSNode);
}
}
@@ -1281,8 +1283,8 @@ void SmParser::SubSup(sal_uLong nActiveGroup)
// already finish
return;
- SmSubSupNode *pNode = new SmSubSupNode(CurToken);
- //! Of course 'CurToken' is just the first sub-/supscript token.
+ SmSubSupNode *pNode = new SmSubSupNode(m_aCurToken);
+ //! Of course 'm_aCurToken' is just the first sub-/supscript token.
//! It should be of no further interest. The positions of the
//! sub-/supscripts will be identified by the corresponding subnodes
//! index in the 'aSubNodes' array (enum value from 'SmSubSup').
@@ -1292,14 +1294,14 @@ void SmParser::SubSup(sal_uLong nActiveGroup)
// initialize subnodes array
SmNodeArray aSubNodes;
aSubNodes.resize(1 + SUBSUP_NUM_ENTRIES);
- aSubNodes[0] = NodeStack.Pop();
+ aSubNodes[0] = m_aNodeStack.Pop();
for (sal_uInt16 i = 1; i < aSubNodes.size(); i++)
aSubNodes[i] = NULL;
// process all sub-/supscripts
int nIndex = 0;
while (TokenInGroup(nActiveGroup))
- { SmTokenType eType (CurToken.eType);
+ { SmTokenType eType (m_aCurToken.eType);
// skip sub-/supscript token
NextToken();
@@ -1332,18 +1334,18 @@ void SmParser::SubSup(sal_uLong nActiveGroup)
// set sub-/supscript if not already done
if (aSubNodes[nIndex] != NULL)
Error(PE_DOUBLE_SUBSUPSCRIPT);
- aSubNodes[nIndex] = NodeStack.Pop();
+ aSubNodes[nIndex] = m_aNodeStack.Pop();
}
pNode->SetSubNodes(aSubNodes);
- NodeStack.Push(pNode);
+ m_aNodeStack.Push(pNode);
}
void SmParser::OpSubSup()
{
// push operator symbol
- NodeStack.Push(new SmMathSymbolNode(CurToken));
+ m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken));
// skip operator token
NextToken();
// get sub- supscripts if any
@@ -1364,28 +1366,28 @@ void SmParser::Power()
void SmParser::Blank()
{
DBG_ASSERT(TokenInGroup(TGBLANK), "Sm : falsches Token");
- SmBlankNode *pBlankNode = new SmBlankNode(CurToken);
+ SmBlankNode *pBlankNode = new SmBlankNode(m_aCurToken);
while (TokenInGroup(TGBLANK))
{
- pBlankNode->IncreaseBy(CurToken);
+ pBlankNode->IncreaseBy(m_aCurToken);
NextToken();
}
// Blanks am Zeilenende ignorieren wenn die entsprechende Option gesetzt ist
- if ( CurToken.eType == TNEWLINE ||
- (CurToken.eType == TEND && SM_MOD()->GetConfig()->IsIgnoreSpacesRight()) )
+ if ( m_aCurToken.eType == TNEWLINE ||
+ (m_aCurToken.eType == TEND && SM_MOD()->GetConfig()->IsIgnoreSpacesRight()) )
{
pBlankNode->Clear();
}
- NodeStack.Push(pBlankNode);
+ m_aNodeStack.Push(pBlankNode);
}
void SmParser::Term()
{
- switch (CurToken.eType)
+ switch (m_aCurToken.eType)
{
case TESCAPE :
Escape();
@@ -1394,15 +1396,15 @@ void SmParser::Term()
case TNOSPACE :
case TLGROUP :
{
- bool bNoSpace = CurToken.eType == TNOSPACE;
+ bool bNoSpace = m_aCurToken.eType == TNOSPACE;
if (bNoSpace) // push 'no space' node and continue to parse expression
{
- NodeStack.Push(new SmExpressionNode(CurToken));
+ m_aNodeStack.Push(new SmExpressionNode(m_aCurToken));
NextToken();
}
- if (CurToken.eType != TLGROUP)
+ if (m_aCurToken.eType != TLGROUP)
{
- NodeStack.Pop(); // get rid of the 'no space' node pushed above
+ m_aNodeStack.Pop(); // get rid of the 'no space' node pushed above
Term();
}
else
@@ -1410,20 +1412,20 @@ void SmParser::Term()
NextToken();
// allow for empty group
- if (CurToken.eType == TRGROUP)
+ if (m_aCurToken.eType == TRGROUP)
{
if (bNoSpace) // get rid of the 'no space' node pushed above
- NodeStack.Pop();
- SmStructureNode *pSNode = new SmExpressionNode(CurToken);
+ m_aNodeStack.Pop();
+ SmStructureNode *pSNode = new SmExpressionNode(m_aCurToken);
pSNode->SetSubNodes(NULL, NULL);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
NextToken();
}
else // go as usual
{
Align();
- if (CurToken.eType != TRGROUP)
+ if (m_aCurToken.eType != TRGROUP)
Error(PE_RGROUP_EXPECTED);
else
NextToken();
@@ -1442,16 +1444,16 @@ void SmParser::Term()
break;
case TTEXT :
- NodeStack.Push(new SmTextNode(CurToken, FNT_TEXT));
+ m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_TEXT));
NextToken();
break;
case TIDENT :
case TCHARACTER :
- NodeStack.Push(new SmTextNode(CurToken, FNT_VARIABLE));
+ m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_VARIABLE));
NextToken();
break;
case TNUMBER :
- NodeStack.Push(new SmTextNode(CurToken, FNT_NUMBER));
+ m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_NUMBER));
NextToken();
break;
@@ -1488,12 +1490,12 @@ void SmParser::Term()
case TDOTSLOW :
case TDOTSUP :
case TDOTSVERT :
- NodeStack.Push(new SmMathSymbolNode(CurToken));
+ m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken));
NextToken();
break;
case TPLACE:
- NodeStack.Push(new SmPlaceNode(CurToken));
+ m_aNodeStack.Push(new SmPlaceNode(m_aCurToken));
NextToken();
break;
@@ -1539,21 +1541,21 @@ void SmParser::Term()
FontAttribut();
// check if casting in following line is ok
- DBG_ASSERT(!NodeStack.Top()->IsVisible(), "Sm : Ooops...");
+ DBG_ASSERT(!m_aNodeStack.Top()->IsVisible(), "Sm : Ooops...");
- aArray[n] = (SmStructureNode *) NodeStack.Pop();
+ aArray[n] = (SmStructureNode *) m_aNodeStack.Pop();
n++;
}
Power();
- SmNode *pFirstNode = NodeStack.Pop();
+ SmNode *pFirstNode = m_aNodeStack.Pop();
while (n > 0)
{ aArray[n - 1]->SetSubNodes(0, pFirstNode);
pFirstNode = aArray[n - 1];
n--;
}
- NodeStack.Push(pFirstNode);
+ m_aNodeStack.Push(pFirstNode);
}
else if (TokenInGroup(TGFUNCTION))
{ if (CONVERT_40_TO_50 != GetConversion())
@@ -1569,9 +1571,9 @@ void SmParser::Term()
//
Function();
- SmNode *pFunc = NodeStack.Pop();
+ SmNode *pFunc = m_aNodeStack.Pop();
- if (CurToken.eType == TLPARENT)
+ if (m_aCurToken.eType == TLPARENT)
{ Term();
}
else
@@ -1582,8 +1584,8 @@ void SmParser::Term()
Insert('}', GetTokenIndex());
SmStructureNode *pSNode = new SmExpressionNode(pFunc->GetToken());
- pSNode->SetSubNodes(pFunc, NodeStack.Pop());
- NodeStack.Push(pSNode);
+ pSNode->SetSubNodes(pFunc, m_aNodeStack.Pop());
+ m_aNodeStack.Push(pSNode);
}
}
else
@@ -1597,7 +1599,7 @@ void SmParser::Escape()
NextToken();
sal_Unicode cChar;
- switch (CurToken.eType)
+ switch (m_aCurToken.eType)
{ case TLPARENT : cChar = MS_LPARENT; break;
case TRPARENT : cChar = MS_RPARENT; break;
case TLBRACKET : cChar = MS_LBRACKET; break;
@@ -1622,8 +1624,8 @@ void SmParser::Escape()
Error(PE_UNEXPECTED_TOKEN);
}
- SmNode *pNode = new SmMathSymbolNode(CurToken);
- NodeStack.Push(pNode);
+ SmNode *pNode = new SmMathSymbolNode(m_aCurToken);
+ m_aNodeStack.Push(pNode);
NextToken();
}
@@ -1632,27 +1634,27 @@ void SmParser::Escape()
void SmParser::Operator()
{
if (TokenInGroup(TGOPER))
- { SmStructureNode *pSNode = new SmOperNode(CurToken);
+ { SmStructureNode *pSNode = new SmOperNode(m_aCurToken);
// put operator on top of stack
Oper();
if (TokenInGroup(TGLIMIT) || TokenInGroup(TGPOWER))
- SubSup(CurToken.nGroup);
- SmNode *pOperator = NodeStack.Pop();
+ SubSup(m_aCurToken.nGroup);
+ SmNode *pOperator = m_aNodeStack.Pop();
// get argument
Power();
- pSNode->SetSubNodes(pOperator, NodeStack.Pop());
- NodeStack.Push(pSNode);
+ pSNode->SetSubNodes(pOperator, m_aNodeStack.Pop());
+ m_aNodeStack.Push(pSNode);
}
}
void SmParser::Oper()
{
- SmTokenType eType (CurToken.eType);
+ SmTokenType eType (m_aCurToken.eType);
SmNode *pNode = NULL;
switch (eType)
@@ -1666,7 +1668,7 @@ void SmParser::Oper()
case TLINT :
case TLLINT :
case TLLLINT :
- pNode = new SmMathSymbolNode(CurToken);
+ pNode = new SmMathSymbolNode(m_aCurToken);
break;
case TLIM :
@@ -1683,27 +1685,27 @@ void SmParser::Oper()
break;
}
if( pLim )
- CurToken.aText.AssignAscii( pLim );
- pNode = new SmTextNode(CurToken, FNT_TEXT);
+ m_aCurToken.aText.AssignAscii( pLim );
+ pNode = new SmTextNode(m_aCurToken, FNT_TEXT);
}
break;
case TOVERBRACE :
case TUNDERBRACE :
- pNode = new SmMathSymbolNode(CurToken);
+ pNode = new SmMathSymbolNode(m_aCurToken);
break;
case TOPER :
NextToken();
- DBG_ASSERT(CurToken.eType == TSPECIAL, "Sm: falsches Token");
- pNode = new SmGlyphSpecialNode(CurToken);
+ DBG_ASSERT(m_aCurToken.eType == TSPECIAL, "Sm: falsches Token");
+ pNode = new SmGlyphSpecialNode(m_aCurToken);
break;
default :
DBG_ASSERT(0, "Sm: unbekannter Fall");
}
- NodeStack.Push(pNode);
+ m_aNodeStack.Push(pNode);
NextToken();
}
@@ -1713,9 +1715,9 @@ void SmParser::UnOper()
{
DBG_ASSERT(TokenInGroup(TGUNOPER), "Sm: falsches Token");
- SmToken aNodeToken = CurToken;
- SmTokenType eType = CurToken.eType;
- sal_Bool bIsPostfix = eType == TFACT;
+ SmToken aNodeToken = m_aCurToken;
+ SmTokenType eType = m_aCurToken.eType;
+ sal_Bool bIsPostfix = eType == TFACT;
SmStructureNode *pSNode;
SmNode *pOper = 0,
@@ -1732,13 +1734,13 @@ void SmParser::UnOper()
case TNROOT :
NextToken();
Power();
- pExtra = NodeStack.Pop();
+ pExtra = m_aNodeStack.Pop();
break;
case TUOPER :
NextToken();
GlyphSpecial();
- pOper = NodeStack.Pop();
+ pOper = m_aNodeStack.Pop();
break;
case TPLUS :
@@ -1748,7 +1750,7 @@ void SmParser::UnOper()
case TNEG :
case TFACT :
OpSubSup();
- pOper = NodeStack.Pop();
+ pOper = m_aNodeStack.Pop();
break;
default :
@@ -1757,7 +1759,7 @@ void SmParser::UnOper()
// get argument
Power();
- pArg = NodeStack.Pop();
+ pArg = m_aNodeStack.Pop();
if (eType == TABS)
{ pSNode = new SmBraceNode(aNodeToken);
@@ -1791,7 +1793,7 @@ void SmParser::UnOper()
pSNode->SetSubNodes(pOper, pArg);
}
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
@@ -1799,35 +1801,35 @@ void SmParser::Attribut()
{
DBG_ASSERT(TokenInGroup(TGATTRIBUT), "Sm: falsche Tokengruppe");
- SmStructureNode *pSNode = new SmAttributNode(CurToken);
+ SmStructureNode *pSNode = new SmAttributNode(m_aCurToken);
SmNode *pAttr;
SmScaleMode eScaleMode = SCALE_NONE;
// get appropriate node for the attribut itself
- switch (CurToken.eType)
+ switch (m_aCurToken.eType)
{ case TUNDERLINE :
case TOVERLINE :
case TOVERSTRIKE :
- pAttr = new SmRectangleNode(CurToken);
+ pAttr = new SmRectangleNode(m_aCurToken);
eScaleMode = SCALE_WIDTH;
break;
case TWIDEVEC :
case TWIDEHAT :
case TWIDETILDE :
- pAttr = new SmMathSymbolNode(CurToken);
+ pAttr = new SmMathSymbolNode(m_aCurToken);
eScaleMode = SCALE_WIDTH;
break;
default :
- pAttr = new SmMathSymbolNode(CurToken);
+ pAttr = new SmMathSymbolNode(m_aCurToken);
}
NextToken();
pSNode->SetSubNodes(pAttr, 0);
pSNode->SetScaleMode(eScaleMode);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
@@ -1835,14 +1837,14 @@ void SmParser::FontAttribut()
{
DBG_ASSERT(TokenInGroup(TGFONTATTR), "Sm: falsche Tokengruppe");
- switch (CurToken.eType)
+ switch (m_aCurToken.eType)
{
case TITALIC :
case TNITALIC :
case TBOLD :
case TNBOLD :
case TPHANTOM :
- NodeStack.Push(new SmFontNode(CurToken));
+ m_aNodeStack.Push(new SmFontNode(m_aCurToken));
NextToken();
break;
@@ -1866,7 +1868,7 @@ void SmParser::FontAttribut()
void SmParser::Color()
{
- DBG_ASSERT(CurToken.eType == TCOLOR, "Sm : Ooops...");
+ DBG_ASSERT(m_aCurToken.eType == TCOLOR, "Sm : Ooops...");
// last color rules, get that one
SmToken aToken;
@@ -1874,20 +1876,20 @@ void SmParser::Color()
{ NextToken();
if (TokenInGroup(TGCOLOR))
- { aToken = CurToken;
+ { aToken = m_aCurToken;
NextToken();
}
else
Error(PE_COLOR_EXPECTED);
- } while (CurToken.eType == TCOLOR);
+ } while (m_aCurToken.eType == TCOLOR);
- NodeStack.Push(new SmFontNode(aToken));
+ m_aNodeStack.Push(new SmFontNode(aToken));
}
void SmParser::Font()
{
- DBG_ASSERT(CurToken.eType == TFONT, "Sm : Ooops...");
+ DBG_ASSERT(m_aCurToken.eType == TFONT, "Sm : Ooops...");
// last font rules, get that one
SmToken aToken;
@@ -1895,14 +1897,14 @@ void SmParser::Font()
{ NextToken();
if (TokenInGroup(TGFONT))
- { aToken = CurToken;
+ { aToken = m_aCurToken;
NextToken();
}
else
Error(PE_FONT_EXPECTED);
- } while (CurToken.eType == TFONT);
+ } while (m_aCurToken.eType == TFONT);
- NodeStack.Push(new SmFontNode(aToken));
+ m_aNodeStack.Push(new SmFontNode(aToken));
}
@@ -1930,14 +1932,14 @@ sal_Bool lcl_IsNumber(const UniString& rText)
void SmParser::FontSize()
{
- DBG_ASSERT(CurToken.eType == TSIZE, "Sm : Ooops...");
+ DBG_ASSERT(m_aCurToken.eType == TSIZE, "Sm : Ooops...");
- sal_uInt16 Type;
- SmFontNode *pFontNode = new SmFontNode(CurToken);
+ sal_uInt16 Type;
+ SmFontNode *pFontNode = new SmFontNode(m_aCurToken);
NextToken();
- switch (CurToken.eType)
+ switch (m_aCurToken.eType)
{
case TNUMBER: Type = FNTSIZ_ABSOLUT; break;
case TPLUS: Type = FNTSIZ_PLUS; break;
@@ -1954,7 +1956,7 @@ void SmParser::FontSize()
if (Type != FNTSIZ_ABSOLUT)
{
NextToken();
- if (CurToken.eType != TNUMBER)
+ if (m_aCurToken.eType != TNUMBER)
{
delete pFontNode;
Error(PE_SIZE_EXPECTED);
@@ -1964,10 +1966,10 @@ void SmParser::FontSize()
// get number argument
Fraction aValue( 1L );
- if (lcl_IsNumber( CurToken.aText ))
+ if (lcl_IsNumber( m_aCurToken.aText ))
{
double fTmp;
- if ((fTmp = CurToken.aText.ToDouble()) != 0.0)
+ if ((fTmp = m_aCurToken.aText.ToDouble()) != 0.0)
{
aValue = fTmp;
@@ -1993,23 +1995,23 @@ void SmParser::FontSize()
NextToken();
pFontNode->SetSizeParameter(aValue, Type);
- NodeStack.Push(pFontNode);
+ m_aNodeStack.Push(pFontNode);
}
void SmParser::Brace()
{
- DBG_ASSERT(CurToken.eType == TLEFT || TokenInGroup(TGLBRACES),
+ DBG_ASSERT(m_aCurToken.eType == TLEFT || TokenInGroup(TGLBRACES),
"Sm: kein Klammer Ausdruck");
- SmStructureNode *pSNode = new SmBraceNode(CurToken);
+ SmStructureNode *pSNode = new SmBraceNode(m_aCurToken);
SmNode *pBody = 0,
*pLeft = 0,
*pRight = 0;
SmScaleMode eScaleMode = SCALE_NONE;
SmParseError eError = PE_NONE;
- if (CurToken.eType == TLEFT)
+ if (m_aCurToken.eType == TLEFT)
{ NextToken();
eScaleMode = SCALE_HEIGHT;
@@ -2017,19 +2019,19 @@ void SmParser::Brace()
// check for left bracket
if (TokenInGroup(TGLBRACES) || TokenInGroup(TGRBRACES))
{
- pLeft = new SmMathSymbolNode(CurToken);
+ pLeft = new SmMathSymbolNode(m_aCurToken);
NextToken();
Bracebody(sal_True);
- pBody = NodeStack.Pop();
+ pBody = m_aNodeStack.Pop();
- if (CurToken.eType == TRIGHT)
+ if (m_aCurToken.eType == TRIGHT)
{ NextToken();
// check for right bracket
if (TokenInGroup(TGLBRACES) || TokenInGroup(TGRBRACES))
{
- pRight = new SmMathSymbolNode(CurToken);
+ pRight = new SmMathSymbolNode(m_aCurToken);
NextToken();
}
else
@@ -2045,11 +2047,11 @@ void SmParser::Brace()
{
if (TokenInGroup(TGLBRACES))
{
- pLeft = new SmMathSymbolNode(CurToken);
+ pLeft = new SmMathSymbolNode(m_aCurToken);
NextToken();
Bracebody(sal_False);
- pBody = NodeStack.Pop();
+ pBody = m_aNodeStack.Pop();
SmTokenType eExpectedType = TUNKNOWN;
switch (pLeft->GetToken().eType)
@@ -2066,9 +2068,9 @@ void SmParser::Brace()
DBG_ASSERT(0, "Sm: unbekannter Fall");
}
- if (CurToken.eType == eExpectedType)
+ if (m_aCurToken.eType == eExpectedType)
{
- pRight = new SmMathSymbolNode(CurToken);
+ pRight = new SmMathSymbolNode(m_aCurToken);
NextToken();
}
else
@@ -2083,7 +2085,7 @@ void SmParser::Brace()
DBG_ASSERT(pRight, "Sm: NULL pointer");
pSNode->SetSubNodes(pLeft, pBody, pRight);
pSNode->SetScaleMode(eScaleMode);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
else
{ delete pSNode;
@@ -2098,7 +2100,7 @@ void SmParser::Brace()
void SmParser::Bracebody(sal_Bool bIsLeftRight)
{
- SmStructureNode *pBody = new SmBracebodyNode(CurToken);
+ SmStructureNode *pBody = new SmBracebodyNode(m_aCurToken);
SmNodeArray aNodes;
sal_uInt16 nNum = 0;
@@ -2107,28 +2109,28 @@ void SmParser::Bracebody(sal_Bool bIsLeftRight)
{
do
{
- if (CurToken.eType == TMLINE)
+ if (m_aCurToken.eType == TMLINE)
{
- NodeStack.Push(new SmMathSymbolNode(CurToken));
+ m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken));
NextToken();
nNum++;
}
- else if (CurToken.eType != TRIGHT)
+ else if (m_aCurToken.eType != TRIGHT)
{ Align();
nNum++;
- if (CurToken.eType != TMLINE && CurToken.eType != TRIGHT)
+ if (m_aCurToken.eType != TMLINE && m_aCurToken.eType != TRIGHT)
Error(PE_RIGHT_EXPECTED);
}
- } while (CurToken.eType != TEND && CurToken.eType != TRIGHT);
+ } while (m_aCurToken.eType != TEND && m_aCurToken.eType != TRIGHT);
}
else
{
do
{
- if (CurToken.eType == TMLINE)
+ if (m_aCurToken.eType == TMLINE)
{
- NodeStack.Push(new SmMathSymbolNode(CurToken));
+ m_aNodeStack.Push(new SmMathSymbolNode(m_aCurToken));
NextToken();
nNum++;
}
@@ -2136,26 +2138,26 @@ void SmParser::Bracebody(sal_Bool bIsLeftRight)
{ Align();
nNum++;
- if (CurToken.eType != TMLINE && !TokenInGroup(TGRBRACES))
+ if (m_aCurToken.eType != TMLINE && !TokenInGroup(TGRBRACES))
Error(PE_RBRACE_EXPECTED);
}
- } while (CurToken.eType != TEND && !TokenInGroup(TGRBRACES));
+ } while (m_aCurToken.eType != TEND && !TokenInGroup(TGRBRACES));
}
// build argument vector in parsing order
aNodes.resize(nNum);
for (sal_uInt16 i = 0; i < nNum; i++)
- aNodes[nNum - 1 - i] = NodeStack.Pop();
+ aNodes[nNum - 1 - i] = m_aNodeStack.Pop();
pBody->SetSubNodes(aNodes);
pBody->SetScaleMode(bIsLeftRight ? SCALE_HEIGHT : SCALE_NONE);
- NodeStack.Push(pBody);
+ m_aNodeStack.Push(pBody);
}
void SmParser::Function()
{
- switch (CurToken.eType)
+ switch (m_aCurToken.eType)
{
case TFUNC:
NextToken(); // skip "FUNC"-statement
@@ -2180,7 +2182,7 @@ void SmParser::Function()
case TLN :
case TLOG :
case TEXP :
- NodeStack.Push(new SmTextNode(CurToken, FNT_FUNCTION));
+ m_aNodeStack.Push(new SmTextNode(m_aCurToken, FNT_FUNCTION));
NextToken();
break;
@@ -2193,7 +2195,7 @@ void SmParser::Function()
void SmParser::Binom()
{
SmNodeArray ExpressionArray;
- SmStructureNode *pSNode = new SmTableNode(CurToken);
+ SmStructureNode *pSNode = new SmTableNode(m_aCurToken);
NextToken();
@@ -2203,10 +2205,10 @@ void SmParser::Binom()
ExpressionArray.resize(2);
for (int i = 0; i < 2; i++)
- ExpressionArray[2 - (i + 1)] = NodeStack.Pop();
+ ExpressionArray[2 - (i + 1)] = m_aNodeStack.Pop();
pSNode->SetSubNodes(ExpressionArray);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
@@ -2214,7 +2216,7 @@ void SmParser::Stack()
{
SmNodeArray ExpressionArray;
NextToken();
- if (CurToken.eType == TLGROUP)
+ if (m_aCurToken.eType == TLGROUP)
{
sal_uInt16 n = 0;
@@ -2224,21 +2226,21 @@ void SmParser::Stack()
Align();
n++;
}
- while (CurToken.eType == TPOUND);
+ while (m_aCurToken.eType == TPOUND);
ExpressionArray.resize(n);
for (sal_uInt16 i = 0; i < n; i++)
- ExpressionArray[n - (i + 1)] = NodeStack.Pop();
+ ExpressionArray[n - (i + 1)] = m_aNodeStack.Pop();
- if (CurToken.eType != TRGROUP)
+ if (m_aCurToken.eType != TRGROUP)
Error(PE_RGROUP_EXPECTED);
NextToken();
- SmStructureNode *pSNode = new SmTableNode(CurToken);
+ SmStructureNode *pSNode = new SmTableNode(m_aCurToken);
pSNode->SetSubNodes(ExpressionArray);
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
}
else
Error(PE_LGROUP_EXPECTED);
@@ -2250,7 +2252,7 @@ void SmParser::Matrix()
SmNodeArray ExpressionArray;
NextToken();
- if (CurToken.eType == TLGROUP)
+ if (m_aCurToken.eType == TLGROUP)
{
sal_uInt16 c = 0;
@@ -2260,11 +2262,11 @@ void SmParser::Matrix()
Align();
c++;
}
- while (CurToken.eType == TPOUND);
+ while (m_aCurToken.eType == TPOUND);
sal_uInt16 r = 1;
- while (CurToken.eType == TDPOUND)
+ while (m_aCurToken.eType == TDPOUND)
{
NextToken();
for (sal_uInt16 i = 0; i < c; i++)
@@ -2272,7 +2274,7 @@ void SmParser::Matrix()
Align();
if (i < (c - 1))
{
- if (CurToken.eType == TPOUND)
+ if (m_aCurToken.eType == TPOUND)
{
NextToken();
}
@@ -2289,17 +2291,17 @@ void SmParser::Matrix()
ExpressionArray.resize(nRC);
for (sal_uInt16 i = 0; i < (nRC); i++)
- ExpressionArray[(nRC) - (i + 1)] = NodeStack.Pop();
+ ExpressionArray[(nRC) - (i + 1)] = m_aNodeStack.Pop();
- if (CurToken.eType != TRGROUP)
+ if (m_aCurToken.eType != TRGROUP)
Error(PE_RGROUP_EXPECTED);
NextToken();
- SmMatrixNode *pMNode = new SmMatrixNode(CurToken);
+ SmMatrixNode *pMNode = new SmMatrixNode(m_aCurToken);
pMNode->SetSubNodes(ExpressionArray);
pMNode->SetRowCol(r, c);
- NodeStack.Push(pMNode);
+ m_aNodeStack.Push(pMNode);
}
else
Error(PE_LGROUP_EXPECTED);
@@ -2309,7 +2311,7 @@ void SmParser::Matrix()
void SmParser::Special()
{
sal_Bool bReplace = sal_False;
- String &rName = CurToken.aText;
+ String &rName = m_aCurToken.aText;
String aNewName;
if (CONVERT_NONE == GetConversion())
@@ -2376,28 +2378,33 @@ void SmParser::Special()
rName = aNewName;
}
- NodeStack.Push(new SmSpecialNode(CurToken));
+ // add symbol name to list of used symbols
+ const String aSymbolName( m_aCurToken.aText.Copy( 1 ) );
+ if (aSymbolName.Len() > 0 )
+ AddToUsedSymbols( aSymbolName );
+
+ m_aNodeStack.Push(new SmSpecialNode(m_aCurToken));
NextToken();
}
void SmParser::GlyphSpecial()
{
- NodeStack.Push(new SmGlyphSpecialNode(CurToken));
+ m_aNodeStack.Push(new SmGlyphSpecialNode(m_aCurToken));
NextToken();
}
void SmParser::Error(SmParseError eError)
{
- SmStructureNode *pSNode = new SmExpressionNode(CurToken);
- SmErrorNode *pErr = new SmErrorNode(eError, CurToken);
+ SmStructureNode *pSNode = new SmExpressionNode(m_aCurToken);
+ SmErrorNode *pErr = new SmErrorNode(eError, m_aCurToken);
pSNode->SetSubNodes(pErr, 0);
//! put a structure node on the stack (instead of the error node itself)
//! because sometimes such a node is expected in order to attach some
//! subnodes
- NodeStack.Push(pSNode);
+ m_aNodeStack.Push(pSNode);
AddError(eError, pSNode);
@@ -2410,34 +2417,36 @@ void SmParser::Error(SmParseError eError)
SmParser::SmParser()
{
- eConversion = CONVERT_NONE;
- bImportSymNames = bExportSymNames = sal_False;
- nLang = Application::GetSettings().GetUILanguage();
+ m_eConversion = CONVERT_NONE;
+ m_bImportSymNames = m_bExportSymNames = sal_False;
+ m_nLang = Application::GetSettings().GetUILanguage();
}
SmNode *SmParser::Parse(const String &rBuffer)
{
- BufferString = rBuffer;
- BufferString.ConvertLineEnd( LINEEND_LF );
- BufferIndex =
- nTokenIndex = 0;
- Row = 1;
- ColOff = 0;
- CurError = -1;
+ ClearUsedSymbols();
+
+ m_aBufferString = rBuffer;
+ m_aBufferString.ConvertLineEnd( LINEEND_LF );
+ m_nBufferIndex =
+ m_nTokenIndex = 0;
+ m_Row = 1;
+ m_nColOff = 0;
+ m_nCurError = -1;
- for (sal_uInt16 i = 0; i < ErrDescList.Count(); i++)
- delete ErrDescList.Remove(i);
+ for (sal_uInt16 i = 0; i < m_aErrDescList.Count(); i++)
+ delete m_aErrDescList.Remove(i);
- ErrDescList.Clear();
+ m_aErrDescList.Clear();
- NodeStack.Clear();
+ m_aNodeStack.Clear();
SetLanguage( Application::GetSettings().GetUILanguage() );
NextToken();
Table();
- return NodeStack.Pop();
+ return m_aNodeStack.Pop();
}
@@ -2471,20 +2480,20 @@ sal_uInt16 SmParser::AddError(SmParseError Type, SmNode *pNode)
}
pErrDesc->Text += SmResId(nRID);
- ErrDescList.Insert(pErrDesc);
+ m_aErrDescList.Insert(pErrDesc);
- return (sal_uInt16) ErrDescList.GetPos(pErrDesc);
+ return (sal_uInt16) m_aErrDescList.GetPos(pErrDesc);
}
const SmErrorDesc *SmParser::NextError()
{
- if (ErrDescList.Count())
- if (CurError > 0) return ErrDescList.Seek(--CurError);
+ if (m_aErrDescList.Count())
+ if (m_nCurError > 0) return m_aErrDescList.Seek(--m_nCurError);
else
{
- CurError = 0;
- return ErrDescList.Seek(CurError);
+ m_nCurError = 0;
+ return m_aErrDescList.Seek(m_nCurError);
}
else return 0;
}
@@ -2492,12 +2501,12 @@ const SmErrorDesc *SmParser::NextError()
const SmErrorDesc *SmParser::PrevError()
{
- if (ErrDescList.Count())
- if (CurError < (int) (ErrDescList.Count() - 1)) return ErrDescList.Seek(++CurError);
+ if (m_aErrDescList.Count())
+ if (m_nCurError < (int) (m_aErrDescList.Count() - 1)) return m_aErrDescList.Seek(++m_nCurError);
else
{
- CurError = (int) (ErrDescList.Count() - 1);
- return ErrDescList.Seek(CurError);
+ m_nCurError = (int) (m_aErrDescList.Count() - 1);
+ return m_aErrDescList.Seek(m_nCurError);
}
else return 0;
}
@@ -2505,9 +2514,9 @@ const SmErrorDesc *SmParser::PrevError()
const SmErrorDesc *SmParser::GetError(sal_uInt16 i)
{
- return (/*i >= 0 &&*/ i < ErrDescList.Count())
- ? ErrDescList.Seek(i)
- : ErrDescList.Seek(CurError);
+ return (/*i >= 0 &&*/ i < m_aErrDescList.Count())
+ ? m_aErrDescList.Seek(i)
+ : m_aErrDescList.Seek(m_nCurError);
}
diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx
index cd15be7eb307..0a0630151fdf 100644..100755
--- a/starmath/source/smmod.cxx
+++ b/starmath/source/smmod.cxx
@@ -352,6 +352,7 @@ SfxItemSet* SmModule::CreateItemSet( sal_uInt16 nId )
SID_PRINTTEXT, SID_PRINTTEXT,
SID_PRINTFRAME, SID_PRINTFRAME,
SID_NO_RIGHT_SPACES, SID_NO_RIGHT_SPACES,
+ SID_SAVE_ONLY_USED_SYMBOLS, SID_SAVE_ONLY_USED_SYMBOLS,
0 );
GetConfig()->ConfigToItemSet(*pRet);
diff --git a/starmath/source/smres.src b/starmath/source/smres.src
index 601472b62f5a..41edb1790198 100755
--- a/starmath/source/smres.src
+++ b/starmath/source/smres.src
@@ -1099,6 +1099,13 @@ TabPage RID_PRINTOPTIONPAGE
Size = MAP_APPFONT ( 236 , 10 ) ;
Text [ en-US ] = "Ig~nore ~~ and ` at the end of the line";
};
+ CheckBox CB_SAVE_ONLY_USED_SYMBOLS
+ {
+ TabStop = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 154 ) ;
+ Size = MAP_APPFONT ( 236 , 10 ) ;
+ Text [ en-US ] = "Embed only used symbols (smaller file size)";
+ };
};
ModalDialog RID_SYMBOLDIALOG
diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx
index 0369eb74db51..7347dbcd705f 100644
--- a/starmath/source/symbol.cxx
+++ b/starmath/source/symbol.cxx
@@ -218,14 +218,19 @@ bool SmSymbolManager::AddOrReplaceSymbol( const SmSym &rSymbol, bool bForceChang
}
else if (pFound && !bForceChange && bSymbolConflict)
{
- // TODO: but what ...
- DBG_ASSERT( 0, "symbol conflict, different symbol with same name found!" );
+ // TODO: to solve this a document owned symbol manager would be required ...
+ // But for now we have a global one to easily support availability of all
+ // symbols in all formulas. A copy of the global one would be needed here
+ // and then the new symbol has to be forcefully applied. This would keep
+ // the current formula intact but will leave the set of symbols in the
+ // global symbol manager somewhat to chance.
+ DBG_ASSERT( 0, "symbol conflict, different symbol with same name found!" );
}
- }
- DBG_ASSERT( bAdded, "failed to add symbol" );
- if (bAdded)
- m_bModified = true;
+ if (bAdded)
+ m_bModified = true;
+ DBG_ASSERT( bAdded || (pFound && !bSymbolConflict), "AddOrReplaceSymbol: unresolved symbol conflict" );
+ }
return bAdded;
}
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index 871e15b7e590..7c316144962b 100755
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -171,7 +171,11 @@ SmPrintUIOptions::SmPrintUIOptions()
//
// class SmModel
//
-#define PROPERTY_NONE 0
+
+// values from com/sun/star/beans/PropertyAttribute
+#define PROPERTY_NONE 0
+#define PROPERTY_READONLY 16
+
enum SmModelPropertyHandles
{
HANDLE_FORMULA,
@@ -233,6 +237,7 @@ enum SmModelPropertyHandles
HANDLE_PRINTER_NAME,
HANDLE_PRINTER_SETUP,
HANDLE_SYMBOLS,
+ HANDLE_USED_SYMBOLS,
HANDLE_BASIC_LIBRARIES, /* #93295# */
HANDLE_RUNTIME_UID,
// --> PB 2004-08-25 #i33095# Security Options
@@ -307,6 +312,7 @@ PropertySetInfo * lcl_createModelPropertyInfo ()
{ RTL_CONSTASCII_STRINGPARAM( "RightMargin" ), HANDLE_RIGHT_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_RIGHTSPACE },
{ RTL_CONSTASCII_STRINGPARAM( "RuntimeUID" ), HANDLE_RUNTIME_UID , &::getCppuType(static_cast< const rtl::OUString * >(0)), PropertyAttribute::READONLY, 0 },
{ RTL_CONSTASCII_STRINGPARAM( "Symbols" ), HANDLE_SYMBOLS , &::getCppuType((const Sequence < SymbolDescriptor > *)0), PROPERTY_NONE, 0 },
+ { RTL_CONSTASCII_STRINGPARAM( "UserDefinedSymbolsInUse" ), HANDLE_USED_SYMBOLS , &::getCppuType((const Sequence < SymbolDescriptor > *)0), PropertyAttribute::READONLY, 0 },
{ RTL_CONSTASCII_STRINGPARAM( "TopMargin" ), HANDLE_TOP_MARGIN , &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, DIS_TOPSPACE },
// --> PB 2004-08-25 #i33095# Security Options
{ RTL_CONSTASCII_STRINGPARAM( "LoadReadonly" ), HANDLE_LOAD_READONLY, &::getBooleanCppuType(), PROPERTY_NONE, 0 },
@@ -904,7 +910,11 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu
}
break;
case HANDLE_SYMBOLS:
+ case HANDLE_USED_SYMBOLS:
{
+ const bool bUsedSymbolsOnly = (*ppEntries)->mnHandle == HANDLE_USED_SYMBOLS;
+ const std::set< rtl::OUString > &rUsedSymbols = pDocSh->GetUsedSymbols();
+
// this is get
SmModule *pp = SM_MOD();
const SmSymbolManager &rManager = pp->GetSymbolManager();
@@ -915,7 +925,9 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu
for (size_t i = 0; i < aSymbols.size(); ++i)
{
const SmSym * pSymbol = aSymbols[ i ];
- if (pSymbol && !pSymbol->IsPredefined () )
+ const bool bIsUsedSymbol = rUsedSymbols.find( pSymbol->GetName() ) != rUsedSymbols.end();
+ if (pSymbol && !pSymbol->IsPredefined() &&
+ (!bUsedSymbolsOnly || bIsUsedSymbol))
{
aVector.push_back ( pSymbol );
nCount++;
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 2ce7c7463742..d5c92174a408 100755
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -34,6 +34,9 @@
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XFramesSupplier.hpp>
+#include <com/sun/star/container/XChild.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
@@ -652,7 +655,51 @@ void SmCmdBoxWindow::StateChanged( StateChangedType nStateChange )
IMPL_LINK( SmCmdBoxWindow, InitialFocusTimerHdl, Timer *, EMPTYARG /*pTimer*/ )
{
- aEdit.GrabFocus();
+ // We want to have the focus in the edit window once Math has been opened
+ // to allow for immediate typing.
+ // Problem: There is no proper way to do this
+ // Thus: this timer based soultion has been implemented (see GrabFocus below)
+ //
+ // Follow-up problem (#i114910): grabing the focus may bust the help system since
+ // it relies on getting the current frame which conflicts with grabbing the focus.
+ // Thus aside from the 'GrabFocus' call everything else is to get the
+ // help reliably working despite using 'GrabFocus'.
+
+ try
+ {
+ uno::Reference< frame::XDesktop > xDesktop;
+ uno::Reference< lang::XMultiServiceFactory > xSMGR( comphelper::getProcessServiceFactory() );
+ if (xSMGR.is())
+ {
+ xDesktop = uno::Reference< frame::XDesktop >(
+ xSMGR->createInstance( rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" )), uno::UNO_QUERY_THROW );
+ }
+
+ aEdit.GrabFocus();
+
+ if (xDesktop.is())
+ {
+ bool bInPlace = GetView()->GetViewFrame()->GetFrame().IsInPlace();
+ uno::Reference< frame::XFrame > xFrame( GetBindings().GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface());
+ if ( bInPlace )
+ {
+ uno::Reference< container::XChild > xModel( GetView()->GetDoc()->GetModel(), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XModel > xParent( xModel->getParent(), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XController > xParentCtrler( xParent->getCurrentController() );
+ uno::Reference< frame::XFramesSupplier > xParentFrame( xParentCtrler->getFrame(), uno::UNO_QUERY_THROW );
+ xParentFrame->setActiveFrame( xFrame );
+ }
+ else
+ {
+ uno::Reference< frame::XFramesSupplier > xFramesSupplier( xDesktop, uno::UNO_QUERY );
+ xFramesSupplier->setActiveFrame( xFrame );
+ }
+ }
+ }
+ catch (uno::Exception &)
+ {
+ DBG_ASSERT( 0, "failed to properly set initial focus to edit window" );
+ }
return 0;
}
diff --git a/sw/inc/IDocumentDeviceAccess.hxx b/sw/inc/IDocumentDeviceAccess.hxx
index 75e6d650a203..42923a2fadf4 100755
--- a/sw/inc/IDocumentDeviceAccess.hxx
+++ b/sw/inc/IDocumentDeviceAccess.hxx
@@ -129,7 +129,7 @@
@returns
the current PrintData
*/
- virtual SwPrintData* getPrintData() const = 0;
+ virtual const SwPrintData & getPrintData() const = 0;
/** Sets the PrintData
diff --git a/sw/inc/IDocumentUndoRedo.hxx b/sw/inc/IDocumentUndoRedo.hxx
index a224395429a9..0d78d3b361c9 100644
--- a/sw/inc/IDocumentUndoRedo.hxx
+++ b/sw/inc/IDocumentUndoRedo.hxx
@@ -29,59 +29,87 @@
#define IDOCUMENTUNDOREDO_HXX_INCLUDED
#include <sal/types.h>
+
#include <swundo.hxx>
-class SwUndoIter;
class SwRewriter;
-class String;
-class SwUndoIds;
class SwNodes;
class SwUndo;
+namespace sw {
+ class RepeatContext;
+}
+
-typedef sal_uInt16 SwUndoNoModifiedPosition;
/** IDocumentUndoRedo
*/
class IDocumentUndoRedo
{
public:
- /**
+
+ /** Enable/Disable Undo.
*/
- virtual void SetUndoNoResetModified() = 0;
+ virtual void DoUndo(bool const bDoUndo) = 0;
- /**
+ /** Is Undo enabled?
*/
- virtual bool IsUndoNoResetModified() const = 0;
+ virtual bool DoesUndo() const = 0;
- /** UndoHistory am Dokument pflegen
- bei Save, SaveAs, Create wird UndoHistory zurueckgesetzt ???
+ /** Enable/Disable Group Undo.
+ This determines whether successive Insert/Delete/Overwrite
+ actions are combined.
*/
- virtual void DoUndo(bool bUn) = 0;
+ virtual void DoGroupUndo(bool const bDoUndo) = 0;
- /**
+ /** Is Group Undo enabled?
*/
- virtual bool DoesUndo() const = 0;
+ virtual bool DoesGroupUndo() const = 0;
+
+ /** Enable/Disable Undo for Drawing objects.
+ */
+ virtual void DoDrawUndo(bool const bDoUndo) = 0;
- /** Zusammenfassen von Kontinuierlichen Insert/Delete/Overwrite von
- Charaktern. Default ist ::com::sun::star::sdbcx::Group-Undo.
+ /** Is Undo for Drawing objects enabled?
+ for Draw-Undo: writer wants to handle actions on Flys on its own.
+ */
+ virtual bool DoesDrawUndo() const = 0;
+
+ /** Set the position at which the document is in the "unmodified" state
+ to the current position in the Undo stack.
*/
- virtual void DoGroupUndo(bool bUn) = 0;
+ virtual void SetUndoNoModifiedPosition() = 0;
- /**
+ /** Prevent updates to the "unmodified" state position
+ via SetUndoNoResetModified().
*/
- virtual bool DoesGroupUndo() const = 0;
+ virtual void LockUndoNoModifiedPosition() = 0;
- /** macht rueckgaengig:
- 0 letzte Aktion, sonst Aktionen bis zum Start der Klammerung nUndoId
- In rUndoRange wird der restaurierte Bereich gesetzt.
+ /** Allow updates to the "unmodified" state position
+ via SetUndoNoResetModified().
*/
- virtual bool Undo( SwUndoIter& ) = 0; // -> #111827#
+ virtual void UnLockUndoNoModifiedPosition() = 0;
+
+ /** Disable (re)setting the document modified flag on Undo/Redo.
+ */
+ virtual void SetUndoNoResetModified() = 0;
+
+ /** Is setting the document modified flag on Undo/Redo disabled?
+ */
+ virtual bool IsUndoNoResetModified() const = 0;
+
+ /** Execute Undo.
+
+ @return true if executing the last Undo action was successful.
+ */
+ virtual sal_Bool Undo() = 0;
/** Opens undo block.
- @param nUndoId undo ID for the start object
+ @remark StartUndo() and EndUndo() do nothing if !DoesUndo().
+
+ @param nUndoId undo ID for the list action
@param pRewriter rewriter for comments @see SwUndo::GetComment
If the given nUndoId is equal to zero an undo object with ID
@@ -89,105 +117,167 @@ public:
@return the undo ID of the created object
*/
- virtual SwUndoId StartUndo( SwUndoId eUndoId, const SwRewriter * pRewriter) = 0;
+ virtual SwUndoId StartUndo(SwUndoId const eUndoId,
+ SwRewriter const*const pRewriter) = 0;
/**
Closes undo block.
- @param nUndoId undo ID for the closure object
- @param pRewriter rewriter for comments @see SwUndo::GetComment
+ @remark StartUndo() and EndUndo() do nothing if !DoesUndo().
- If the given nUndoId is equal to zero an undo object with ID
- UNDO_START will be generated.
+ @param nUndoId undo ID for the list action
+ @param pRewriter rewriter for comments @see SwUndo::GetComment
- If pRewriter is not equal to zero the given rewriter will be
- set for the generated closure object and the corresponding
- start object. Otherwise an existent rewriter in theIDocumentRedlineAccess
- corresponding start object will be propagated to the generated
- closure object.
+ If the given nUndoId is not UNDO_EMPTY or UNDO_END, the comment of
+ the resulting list action will be set via the nUndoId, applying the
+ given pRewriter (if not 0). Otherwise the comment of the resulting
+ list action is unchanged if it has an UndoId that is not UNDO_START
+ set by StartUndo, and in case the UndoId is UNDO_START the comment
+ of the list action defaults to the comment of the last action
+ contained in the list action.
*/
- virtual SwUndoId EndUndo( SwUndoId eUndoId, const SwRewriter * pRewriter) = 0;
+ virtual SwUndoId EndUndo(SwUndoId const eUndoId,
+ SwRewriter const*const pRewriter) = 0;
/** <- #111827#
- loescht die gesamten UndoObjecte ( fuer Methoden die am Nodes
- Array drehen ohne entsprechendes Undo !!)
+ Delete all Undo actions.
+ Of course Undo will be disabled during deletion.
*/
virtual void DelAllUndoObj() = 0;
- /** liefert die Id der letzten undofaehigen Aktion zurueck
- oder USHRT_MAX fuellt ggf. VARARR mit ::com::sun::star::sdbcx::User-UndoIds
+ /** Get Id and comment of last Undo action.
+ @param o_pStr if not 0, receives comment of last Undo action.
+ @param o_pId if not 0, receives Id of last Undo action.
+ @return true if there is a Undo action, false if none
*/
- virtual SwUndoId GetUndoIds(String* pStr, SwUndoIds *pUndoIds) const = 0;
+ virtual bool GetLastUndoInfo(::rtl::OUString *const o_pStr,
+ SwUndoId *const o_pId) const = 0;
- /**
+ /** Get comments of Undo actions.
+ @return comments of all top-level Undo actions.
*/
- virtual String GetUndoIdsStr(String* pStr, SwUndoIds *pUndoIds) const = 0;
+ virtual SwUndoComments_t GetUndoComments() const = 0;
- /** gibt es Klammerung mit der Id?
- */
- virtual bool HasUndoId(SwUndoId eId) const = 0;
+ /** Execute Redo.
- /* @@@MAINTAINABILITY-HORROR@@@
- Implementation details made public.
- die drei folgenden Methoden werden beim Undo und nur dort
- benoetigt. Sollten sonst nicht aufgerufen werden.
+ @return true if executing the first Redo action was successful.
*/
- virtual const SwNodes* GetUndoNds() const = 0;
+ virtual sal_Bool Redo() = 0;
- virtual SwUndo* RemoveLastUndo(SwUndoId eUndoId) = 0;
-
- /** 2002-05-31 dvo, #95884#: To prevent an undo array overflow when
- doing nested undos, undo may have to be disabled. Undo-intensive
- actions (like auto-format) should check this manually.
+ /** Get comment of first Redo action.
+ @param o_pStr if not 0, receives comment of first Redo action.
+ @return true if there is a Redo action, false if none
*/
- virtual bool HasTooManyUndos() const = 0;
+ virtual bool GetFirstRedoInfo(::rtl::OUString *const o_pStr) const = 0;
- /**
+ /** Get comments of Redo actions.
+ @return comments of all top-level Redo actions.
*/
- virtual bool Redo( SwUndoIter& ) = 0;
+ virtual SwUndoComments_t GetRedoComments() const = 0;
- /** liefert die Id der letzten Redofaehigen Aktion zurueck
- fuellt ggf. VARARR mit RedoIds
+ /** Repeat the last Undo action.
+ @return true if repeating the last Undo Redo action was attempted.
*/
- virtual SwUndoId GetRedoIds( String* pStr, SwUndoIds *pRedoIds) const = 0;
-
- /**
+ virtual bool Repeat(::sw::RepeatContext & rContext,
+ sal_uInt16 const nRepeatCnt) = 0;
+
+ /** Get Id and comment of last Undo action, if it is Repeat capable.
+ @param o_pStr if not 0, receives comment of last Undo action
+ if it is Repeat capable.
+ @return Id of last Undo action if it is Repeat capable,
+ or UNDO_EMPTY if there is none or it is not Repeat capable.
*/
- virtual String GetRedoIdsStr( String* pStr, SwUndoIds *pRedoIds) const = 0;
+ virtual SwUndoId GetRepeatInfo(::rtl::OUString *const o_pStr) const = 0;
- /**
+ /** Add new Undo action.
+ Takes over ownership of pUndo.
+ @remark calls ClearRedo(), except for UNDO_START/UNDO_END.
+ @remark does nothing if !DoesUndo().
*/
- virtual bool Repeat( SwUndoIter&, sal_uInt16 nRepeatCnt) = 0;
+ virtual void AppendUndo(SwUndo *const pUndo) = 0;
- /** liefert die Id der letzten Repeatfaehigen Aktion zurueck
- fuellt ggf. VARARR mit RedoIds
+ /** Delete all Redo actions.
*/
- virtual SwUndoId GetRepeatIds( String* pStr, SwUndoIds *pRedoIds) const = 0;
+ virtual void ClearRedo() = 0;
- /**
+ /* Is the given nodes array the Undo nodes array?
*/
- virtual String GetRepeatIdsStr( String* pStr, SwUndoIds *pRedoIds) const = 0;
+ virtual bool IsUndoNodes(SwNodes const& rNodes) const = 0;
- /** interne Verkuerzung fuer Insert am Ende
- */
- virtual void AppendUndo(SwUndo*) = 0;
+protected:
+ virtual ~IDocumentUndoRedo() {};
+};
- /** loescht alle UndoObjecte von nUndoPos
- bis zum Ende des Undo-Arrays
- */
- virtual void ClearRedo() = 0;
- /** Manipulates the position of the undo stack which reset the modified flag
- */
- virtual void setUndoNoModifiedPosition( SwUndoNoModifiedPosition ) = 0;
+namespace sw {
- /** Gets the position of the undo stack which reset the modified flag
- */
- virtual SwUndoNoModifiedPosition getUndoNoModifiedPosition() const = 0;
+class UndoGuard
+{
+public:
-protected:
- virtual ~IDocumentUndoRedo() {};
+ UndoGuard(IDocumentUndoRedo & rUndoRedo)
+ : m_rUndoRedo(rUndoRedo)
+ , m_bUndoWasEnabled(rUndoRedo.DoesUndo())
+ {
+ m_rUndoRedo.DoUndo(false);
+ }
+ ~UndoGuard()
+ {
+ m_rUndoRedo.DoUndo(m_bUndoWasEnabled);
+ }
+
+ bool UndoWasEnabled() const
+ {
+ return m_bUndoWasEnabled;
+ }
+
+private:
+ IDocumentUndoRedo & m_rUndoRedo;
+ bool const m_bUndoWasEnabled;
+};
+
+class GroupUndoGuard
+{
+public:
+
+ GroupUndoGuard(IDocumentUndoRedo & rUndoRedo)
+ : m_rUndoRedo(rUndoRedo)
+ , m_bGroupUndoWasEnabled(rUndoRedo.DoesGroupUndo())
+ {
+ m_rUndoRedo.DoGroupUndo(false);
+ }
+ ~GroupUndoGuard()
+ {
+ m_rUndoRedo.DoGroupUndo(m_bGroupUndoWasEnabled);
+ }
+
+private:
+ IDocumentUndoRedo & m_rUndoRedo;
+ bool const m_bGroupUndoWasEnabled;
};
+class DrawUndoGuard
+{
+public:
+
+ DrawUndoGuard(IDocumentUndoRedo & rUndoRedo)
+ : m_rUndoRedo(rUndoRedo)
+ , m_bDrawUndoWasEnabled(rUndoRedo.DoesDrawUndo())
+ {
+ m_rUndoRedo.DoDrawUndo(false);
+ }
+ ~DrawUndoGuard()
+ {
+ m_rUndoRedo.DoDrawUndo(m_bDrawUndoWasEnabled);
+ }
+
+private:
+ IDocumentUndoRedo & m_rUndoRedo;
+ bool const m_bDrawUndoWasEnabled;
+};
+
+
+} // namespace sw
+
#endif
diff --git a/sw/inc/IShellCursorSupplier.hxx b/sw/inc/IShellCursorSupplier.hxx
new file mode 100644
index 000000000000..a160f43d40dd
--- /dev/null
+++ b/sw/inc/IShellCursorSupplier.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ISHELLCURSORSUPPLIER_HXX
+#define ISHELLCURSORSUPPLIER_HXX
+
+
+class SwPaM;
+
+
+namespace sw {
+
+/** The Undo actions need to create new Shell cursors.
+ Just creating new SwPaMs in the Undo actions is not sufficient,
+ because only Shell cursors are corrected by doccorr.cxx.
+ */
+class IShellCursorSupplier
+{
+public:
+ virtual ~IShellCursorSupplier() { }
+ virtual SwPaM & CreateNewShellCursor() = 0;
+ virtual SwPaM & GetCurrentShellCursor() = 0;
+};
+
+} // namespace sw
+
+#endif // ISHELLCURSORSUPPLIER_HXX
diff --git a/sw/inc/SwRewriter.hxx b/sw/inc/SwRewriter.hxx
index 8d2b9bd04bbe..5c98db3807ab 100644
--- a/sw/inc/SwRewriter.hxx
+++ b/sw/inc/SwRewriter.hxx
@@ -31,6 +31,12 @@
#include <vector>
#include <tools/string.hxx>
+
+String const UNDO_ARG1("$1", RTL_TEXTENCODING_ASCII_US);
+String const UNDO_ARG2("$2", RTL_TEXTENCODING_ASCII_US);
+String const UNDO_ARG3("$3", RTL_TEXTENCODING_ASCII_US);
+
+
typedef std::pair<String, String> SwRewriteRule;
class SwRewriter
diff --git a/sw/inc/SwUndoField.hxx b/sw/inc/SwUndoField.hxx
index b24f867120ef..2f78cab966de 100644
--- a/sw/inc/SwUndoField.hxx
+++ b/sw/inc/SwUndoField.hxx
@@ -24,11 +24,14 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _SW_UNDO_FIELD_HXX
-#define _SW_UNDO_FIELD_HXX
+#ifndef SW_UNDO_FIELD_HXX
+#define SW_UNDO_FIELD_HXX
#include <undobj.hxx>
+#include <com/sun/star/uno/Any.h>
+
+
class SwDoc;
class SwField;
class SwMsgPoolItem;
@@ -53,16 +56,19 @@ class SwUndoFieldFromDoc : public SwUndoField
SwMsgPoolItem * pHnt;
sal_Bool bUpdate;
+ void DoImpl();
+
public:
SwUndoFieldFromDoc(const SwPosition & rPos, const SwField & aOldField,
const SwField & aNewField,
SwMsgPoolItem * pHnt, sal_Bool bUpdate,
SwUndoId nId = UNDO_FIELD );
+
virtual ~SwUndoFieldFromDoc();
- virtual void Undo(SwUndoIter & rIt);
- virtual void Redo(SwUndoIter & rIt);
- virtual void Repeat(SwUndoIter & rIt);
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
};
class SwUndoFieldFromAPI : public SwUndoField
@@ -70,6 +76,8 @@ class SwUndoFieldFromAPI : public SwUndoField
com::sun::star::uno::Any aOldVal, aNewVal;
sal_uInt16 nWhich;
+ void DoImpl();
+
public:
SwUndoFieldFromAPI(const SwPosition & rPos,
const com::sun::star::uno::Any & rOldVal,
@@ -77,9 +85,9 @@ public:
sal_uInt16 nWhich);
virtual ~SwUndoFieldFromAPI();
- virtual void Undo(SwUndoIter & rIt);
- virtual void Redo(SwUndoIter & rIt);
- virtual void Repeat(SwUndoIter & rIt);
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
};
-#endif // _SW_UNDO_FIELD_HXX
+#endif // SW_UNDO_FIELD_HXX
diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h
index ac4222ab1ce9..5e0e3c4eeddb 100644
--- a/sw/inc/cmdid.h
+++ b/sw/inc/cmdid.h
@@ -911,6 +911,9 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr
// #i972: bool items to be passed to SwFrmPage for evaluation
#define FN_OLE_IS_MATH (FN_EXTRA2 + 114)
#define FN_MATH_BASELINE_ALIGNMENT (FN_EXTRA2 + 115)
+
+#define FN_EMBEDDED_OBJECT (FN_EXTRA2 + 116)
+
/*--------------------------------------------------------------------
Bereich: Hilfe
--------------------------------------------------------------------*/
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index b0e689bea350..4ae1650e8538 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -24,14 +24,16 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _CRSRSH_HXX
-#define _CRSRSH_HXX
+#ifndef SW_CRSRSH_HXX
+#define SW_CRSRSH_HXX
#include <com/sun/star/i18n/WordType.hpp>
#include <tools/string.hxx>
#include <tools/link.hxx>
#include <tools/rtti.hxx>
+
+#include <IShellCursorSupplier.hxx>
#include "swdllapi.h"
#include <swtypes.hxx> // fuer SWPOSDOC
#include <viewsh.hxx> // fuer ViewShell
@@ -152,7 +154,10 @@ const int CRSR_POSOLD = 0x01, // Cursor bleibt an alter Doc-Position
String *ReplaceBackReferences( const com::sun::star::util::SearchOptions& rSearchOpt, SwPaM* pPam );
// die Cursor - Shell
-class SW_DLLPUBLIC SwCrsrShell : public ViewShell, public SwModify
+class SW_DLLPUBLIC SwCrsrShell
+ : public ViewShell
+ , public SwModify
+ , public ::sw::IShellCursorSupplier
{
friend class SwCallLink;
friend class SwVisCrsr;
@@ -331,6 +336,10 @@ public:
virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew);
+ // IShellCursorSupplier
+ virtual SwPaM & CreateNewShellCursor();
+ virtual SwPaM & GetCurrentShellCursor();
+
// neuen Cusror erzeugen und den alten anhaengen
SwPaM * CreateCrsr();
// loesche den aktuellen Cursor und der folgende wird zum Aktuellen
diff --git a/sw/inc/dbgoutsw.hxx b/sw/inc/dbgoutsw.hxx
index e1822bd4ace9..1a33f41f69d3 100644
--- a/sw/inc/dbgoutsw.hxx
+++ b/sw/inc/dbgoutsw.hxx
@@ -46,7 +46,6 @@ struct SwPosition;
class SwPaM;
class SwNodeNum;
class SwUndo;
-class SwUndos;
class SwRect;
class SwFrmFmt;
class SwFrmFmts;
@@ -86,7 +85,6 @@ SW_DLLPUBLIC const char * dbg_out(const SwPosition & rPos);
SW_DLLPUBLIC const char * dbg_out(const SwPaM & rPam);
SW_DLLPUBLIC const char * dbg_out(const SwNodeNum & rNum);
SW_DLLPUBLIC const char * dbg_out(const SwUndo & rUndo);
-SW_DLLPUBLIC const char * dbg_out(const SwUndos & rUndos);
SW_DLLPUBLIC const char * dbg_out(const SwRewriter & rRewriter);
SW_DLLPUBLIC const char * dbg_out(const SwNumRule & rRule);
SW_DLLPUBLIC const char * dbg_out(const SwTxtFmtColl & rFmt);
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index fc21b35345ef..ada6bbb2576d 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -24,8 +24,8 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _DOC_HXX
-#define _DOC_HXX
+#ifndef SW_DOC_HXX
+#define SW_DOC_HXX
/** SwDoc interfaces */
@@ -34,7 +34,6 @@
#include <IDocumentDeviceAccess.hxx>
#include <IDocumentMarkAccess.hxx>
#include <IDocumentRedlineAccess.hxx>
-#include <IDocumentUndoRedo.hxx>
#include <IDocumentLinksAdministration.hxx>
#include <IDocumentFieldsAccess.hxx>
#include <IDocumentContentOperations.hxx>
@@ -63,7 +62,6 @@ class SwList;
#include <vcl/timer.hxx>
#include "swdllapi.h"
#include <swtypes.hxx>
-#include <ndarr.hxx>
#include <swatrset.hxx>
#include <toxe.hxx> // enums
#include <flyenum.hxx>
@@ -154,6 +152,7 @@ class SwNewDBMgr;
class SwNoTxtNode;
class SwNodeIndex;
class SwNodeRange;
+class SwNodes;
class SwNumRule;
class SwNumRuleTbl;
class SwPageDesc;
@@ -187,10 +186,6 @@ class SwTextBlocks;
class SwTxtFmtColl;
class SwTxtFmtColls;
class SwURLStateChanged;
-class SwUndo;
-class SwUndoIds;
-class SwUndoIter;
-class SwUndos;
class SwUnoCrsr;
class SwUnoCrsrTbl;
class ViewShell;
@@ -220,12 +215,15 @@ class SwPrintData;
class SwRenderData;
class SwPageFrm;
class SwViewOption;
+class IDocumentUndoRedo;
namespace sw { namespace mark {
class MarkManager;
}}
namespace sw {
class MetaFieldManager;
+ class UndoManager;
+ class IShellCursorSupplier;
}
namespace com { namespace sun { namespace star {
@@ -261,7 +259,6 @@ class SW_DLLPUBLIC SwDoc :
public IDocumentSettingAccess,
public IDocumentDeviceAccess,
public IDocumentRedlineAccess,
- public IDocumentUndoRedo,
public IDocumentLinksAdministration,
public IDocumentFieldsAccess,
public IDocumentContentOperations,
@@ -289,9 +286,7 @@ class SW_DLLPUBLIC SwDoc :
//---------------- private Member --------------------------------
// -------------------------------------------------------------------
- // die Objecte
- SwNodes aNodes; // Inhalt des Dokumentes
- SwNodes aUndoNodes; // Inhalt fuer das Undo
+ ::boost::scoped_ptr<SwNodes> m_pNodes; /// document content (Nodes Array)
SwAttrPool* mpAttrPool; // der Attribut Pool
SwPageDescs aPageDescs; // PageDescriptoren
Link aOle2Link; // OLE 2.0-Benachrichtigung
@@ -310,6 +305,7 @@ class SW_DLLPUBLIC SwDoc :
const ::boost::scoped_ptr< ::sw::mark::MarkManager> pMarkManager;
const ::boost::scoped_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager;
+ const ::boost::scoped_ptr< ::sw::UndoManager > m_pUndoManager;
// -------------------------------------------------------------------
// die Pointer
@@ -335,8 +331,6 @@ class SW_DLLPUBLIC SwDoc :
SwRootFrm *pLayout; // Rootframe des spezifischen Layouts.
SdrModel *pDrawModel; // StarView Drawing
- SwUndos *pUndos; // Undo/Redo History
-
SwDocUpdtFld *pUpdtFlds; // Struktur zum Field-Update
SwFldTypes *pFldTypes; // Feldtypen
SwNewDBMgr *pNewDBMgr; // Pointer auf den neuen DBMgr fuer
@@ -426,11 +420,6 @@ private:
// -------------------------------------------------------------------
// sonstige
- sal_uInt16 nUndoPos; // akt. Undo-InsertPosition (fuers Redo!)
- sal_uInt16 nUndoSavePos; // Position im Undo-Array, ab der das Doc
- // nicht als modifiziert gilt
- sal_uInt16 nUndoCnt; // Anzahl von Undo Aktionen
- sal_uInt16 nUndoSttEnd; // != 0 -> innerhalb einer Klammerung
sal_uInt16 nAutoFmtRedlnCommentNo; // SeqNo fuers UI-seitige zusammenfassen
// von AutoFmt-Redlines. Wird vom SwAutoFmt
@@ -462,28 +451,25 @@ private:
// leider auch temporaer von
// SwSwgReader::InLayout(), wenn fehlerhafte
// Frames geloescht werden muessen
- bool mbUndo : 1; // sal_True: Undo eingeschaltet
- bool mbGroupUndo : 1; // sal_True: Undos werden gruppiert
- bool mbPageNums : 1; // sal_True: es gibt virtuelle Seitennummern
- bool mbLoaded : 1; // sal_True: ein geladenes Doc
- bool mbUpdateExpFld : 1; // sal_True: Expression-Felder updaten
- bool mbNewDoc : 1; // sal_True: neues Doc
- bool mbNewFldLst : 1; // sal_True: Felder-Liste neu aufbauen
- bool mbCopyIsMove : 1; // sal_True: Copy ist ein verstecktes Move
- bool mbNoDrawUndoObj : 1; // sal_True: keine DrawUndoObjecte speichern
- bool mbVisibleLinks : 1; // sal_True: Links werden sichtbar eingefuegt
- bool mbBrowseMode : 1; // sal_True: Dokument im BrowseModus anzeigen
- bool mbInReading : 1; // sal_True: Dokument wird gerade gelesen
- bool mbInXMLImport : 1; // sal_True: During xml import, attribute portion building is not necessary
- bool mbUpdateTOX : 1; // sal_True: nach Dokument laden die TOX Updaten
- bool mbInLoadAsynchron : 1; // sal_True: Dokument wird gerade asynchron geladen
- bool mbHTMLMode : 1; // sal_True: Dokument ist im HTMLMode
- bool mbInCallModified : 1; // sal_True: im Set/Reset-Modified Link
- bool mbIsGlobalDoc : 1; // sal_True: es ist ein GlobalDokument
- bool mbGlblDocSaveLinks : 1; // sal_True: im GlobalDoc. gelinkte Sect. mit speichern
- bool mbIsLabelDoc : 1; // sal_True: es ist ein Etiketten-Dokument
- bool mbIsAutoFmtRedline : 1; // sal_True: die Redlines werden vom Autoformat aufgezeichnet
- bool mbOLEPrtNotifyPending : 1; // sal_True: Printer ist geaendert und beim
+ bool mbPageNums : 1; // TRUE: es gibt virtuelle Seitennummern
+ bool mbLoaded : 1; // TRUE: ein geladenes Doc
+ bool mbUpdateExpFld : 1; // TRUE: Expression-Felder updaten
+ bool mbNewDoc : 1; // TRUE: neues Doc
+ bool mbNewFldLst : 1; // TRUE: Felder-Liste neu aufbauen
+ bool mbCopyIsMove : 1; // TRUE: Copy ist ein verstecktes Move
+ bool mbVisibleLinks : 1; // TRUE: Links werden sichtbar eingefuegt
+ bool mbBrowseMode : 1; // TRUE: Dokument im BrowseModus anzeigen
+ bool mbInReading : 1; // TRUE: Dokument wird gerade gelesen
+ bool mbInXMLImport : 1; // TRUE: During xml import, attribute portion building is not necessary
+ bool mbUpdateTOX : 1; // TRUE: nach Dokument laden die TOX Updaten
+ bool mbInLoadAsynchron : 1; // TRUE: Dokument wird gerade asynchron geladen
+ bool mbHTMLMode : 1; // TRUE: Dokument ist im HTMLMode
+ bool mbInCallModified : 1; // TRUE: im Set/Reset-Modified Link
+ bool mbIsGlobalDoc : 1; // TRUE: es ist ein GlobalDokument
+ bool mbGlblDocSaveLinks : 1; // TRUE: im GlobalDoc. gelinkte Sect. mit speichern
+ bool mbIsLabelDoc : 1; // TRUE: es ist ein Etiketten-Dokument
+ bool mbIsAutoFmtRedline : 1; // TRUE: die Redlines werden vom Autoformat aufgezeichnet
+ bool mbOLEPrtNotifyPending : 1; // TRUE: Printer ist geaendert und beim
// Erzeugen der ::com::sun::star::sdbcx::View ist eine Benachrichtigung
// der OLE-Objekte PrtOLENotify() notwendig.
bool mbAllOLENotify : 1; // True: Benachrichtigung aller Objekte ist notwendig
@@ -614,13 +600,10 @@ private:
sal_Bool mbStartIdleTimer ; // idle timer mode start/stop
static SwAutoCompleteWord *pACmpltWords; // Liste aller Worte fuers AutoComplete
- static sal_uInt16 nUndoActions; // anzahl von Undo ::com::sun::star::chaos::Action
//---------------- private Methoden ------------------------------
void checkRedlining(RedlineMode_t& _rReadlineMode);
- sal_Bool DelUndoObj( sal_uInt16 nEnde ); // loescht alle UndoObjecte vom Anfang
- // bis zum angegebenen Ende
DECL_LINK( AddDrawUndo, SdrUndoAction * );
// DrawModel
void DrawNotifyUndoHdl(); // wegen CLOOKs
@@ -735,8 +718,8 @@ public:
/* @@@MAINTAINABILITY-HORROR@@@
Implementation details made public.
*/
- SwNodes& GetNodes() { return aNodes; }
- const SwNodes& GetNodes() const { return aNodes; }
+ SwNodes & GetNodes() { return *m_pNodes; }
+ SwNodes const& GetNodes() const { return *m_pNodes; }
/** IInterface
*/
@@ -769,7 +752,7 @@ public:
virtual void setReferenceDeviceType(/*[in]*/ bool bNewVirtual,/*[in]*/ bool bNewHiRes );
virtual const JobSetup* getJobsetup() const;
virtual void setJobsetup(/*[in]*/ const JobSetup& rJobSetup );
- virtual SwPrintData* getPrintData() const;
+ virtual const SwPrintData & getPrintData() const;
virtual void setPrintData(/*[in]*/ const SwPrintData& rPrtData);
/** IDocumentMarkAccess
@@ -810,37 +793,8 @@ public:
/** IDocumentUndoRedo
*/
- virtual void SetUndoNoResetModified();
- virtual bool IsUndoNoResetModified() const;
- virtual void DoUndo(bool bUn);
- virtual bool DoesUndo() const;
- virtual void DoGroupUndo(bool bUn);
- virtual bool DoesGroupUndo() const;
- virtual bool Undo(SwUndoIter& );
- virtual SwUndoId StartUndo(SwUndoId eUndoId, const SwRewriter * pRewriter);
- virtual SwUndoId EndUndo(SwUndoId eUndoId, const SwRewriter * pRewriter);
- virtual void DelAllUndoObj();
- virtual SwUndoId GetUndoIds(String* pStr, SwUndoIds *pUndoIds) const;
- virtual String GetUndoIdsStr(String* pStr, SwUndoIds *pUndoIds) const;
- virtual bool HasUndoId(SwUndoId eId) const;
- virtual const SwNodes* GetUndoNds() const;
- virtual SwUndo* RemoveLastUndo(SwUndoId eUndoId);
- virtual bool HasTooManyUndos() const;
- virtual bool Redo(SwUndoIter&);
- virtual SwUndoId GetRedoIds(String* pStr, SwUndoIds *pRedoIds) const;
- virtual String GetRedoIdsStr(String* pStr, SwUndoIds *pRedoIds) const;
- virtual bool Repeat(SwUndoIter&, sal_uInt16 nRepeatCnt);
- virtual SwUndoId GetRepeatIds(String* pStr, SwUndoIds *pRedoIds) const;
- virtual String GetRepeatIdsStr(String* pStr, SwUndoIds *pRedoIds) const;
- virtual void AppendUndo(SwUndo*);
- virtual void ClearRedo();
- virtual void setUndoNoModifiedPosition( SwUndoNoModifiedPosition );
- virtual SwUndoNoModifiedPosition getUndoNoModifiedPosition() const;
-
-
- /** abfragen/setzen der Anzahl von wiederherstellbaren Undo-Actions */
- static sal_uInt16 GetUndoActionCount();
- static void SetUndoActionCount(sal_uInt16 nNew);
+ IDocumentUndoRedo & GetIDocumentUndoRedo();
+ IDocumentUndoRedo const& GetIDocumentUndoRedo() const;
/** IDocumentLinksAdministration
*/
@@ -1803,6 +1757,7 @@ public:
// suche ueber das Layout eine EditShell und ggfs. eine ViewShell
SwEditShell* GetEditShell( ViewShell** ppSh = 0 ) const;
+ ::sw::IShellCursorSupplier * GetIShellCursorSupplier();
// OLE 2.0-Benachrichtung
inline void SetOle2Link(const Link& rLink) {aOle2Link = rLink;}
@@ -1856,9 +1811,6 @@ public:
bool IsCopyIsMove() const { return mbCopyIsMove; }
void SetCopyIsMove( bool bFlag ) { mbCopyIsMove = bFlag; }
- // fuers Draw-Undo: Aktionen auf Flys wollen wir selbst behandeln
- bool IsNoDrawUndoObj() const { return mbNoDrawUndoObj; }
- void SetNoDrawUndoObj( bool bFlag ) { mbNoDrawUndoObj = bFlag; }
SwDrawContact* GroupSelection( SdrView& );
void UnGroupSelection( SdrView& );
sal_Bool DeleteSelection( SwDrawView& );
@@ -1898,12 +1850,11 @@ public:
inline SvNumberFormatter* GetNumberFormatter( sal_Bool bCreate = sal_True );
inline const SvNumberFormatter* GetNumberFormatter( sal_Bool bCreate = sal_True ) const;
- // loesche den nicht sichtbaren ::com::sun::star::ucb::Content aus dem Document, wie z.B.:
- // versteckte Bereiche, versteckte Absaetze
- sal_Bool RemoveInvisibleContent();
- sal_Bool HasInvisibleContent() const;
- //restore the invisible content if it's available on the undo stack
- sal_Bool RestoreInvisibleContent();
+ bool HasInvisibleContent() const;
+ /// delete invisible content, like hidden sections and paragraphs
+ bool RemoveInvisibleContent();
+ /// restore the invisible content if it's available on the undo stack
+ bool RestoreInvisibleContent();
// replace fields by text - mailmerge support
sal_Bool ConvertFieldsToText();
@@ -2138,6 +2089,8 @@ public:
#endif
::sfx2::IXmlIdRegistry& GetXmlIdRegistry();
::sw::MetaFieldManager & GetMetaFieldManager();
+ ::sw::UndoManager & GetUndoManager();
+ ::sw::UndoManager const& GetUndoManager() const;
SfxObjectShell* CreateCopy(bool bCallInitNew) const;
};
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx
index 015e8bee557a..f2318fb2ddb4 100644
--- a/sw/inc/docary.hxx
+++ b/sw/inc/docary.hxx
@@ -71,13 +71,6 @@ SV_DECL_PTRARR_DEL( SwFldTypes, SwFldTypePtr, INIT_FLDTYPES, GROW_FLDTYPES )
typedef SwTOXType* SwTOXTypePtr;
SV_DECL_PTRARR_DEL( SwTOXTypes, SwTOXTypePtr, 0, 1 )
-// Undo
-#define INIT_UNDOS 5
-#define GROW_UNDOS 5
-// Das Array der Undo-History
-typedef SwUndo* SwUndoPtr;
-SV_DECL_PTRARR_DEL( SwUndos, SwUndoPtr, INIT_UNDOS, GROW_UNDOS )
-
typedef SwSectionFmt* SwSectionFmtPtr;
SV_DECL_PTRARR_DEL(SwSectionFmts,SwSectionFmtPtr,0,4)
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 4b979416cc31..d75839f5736c 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -73,7 +73,6 @@ class SwFmtRefMark;
class SwNumRule; // Numerierung
//class SwNodeNum; // Numerierung
-class SwUndoIds; // fuer Undo
class SwTxtFmtColl;
class SwGrfNode;
class SwFlyFrmFmt;
@@ -123,6 +122,10 @@ namespace sfx2{
class LinkManager;
}
+namespace sw {
+ class UndoRedoContext;
+}
+
#define GETSELTXT_PARABRK_TO_BLANK 0
#define GETSELTXT_PARABRK_KEEP 1
#define GETSELTXT_PARABRK_TO_ONLYCR 2
@@ -533,35 +536,22 @@ public:
SwUndoId StartUndo( SwUndoId eUndoId = UNDO_EMPTY, const SwRewriter * pRewriter = 0 );
// schliesst Klammerung der nUndoId, nicht vom UI benutzt
SwUndoId EndUndo( SwUndoId eUndoId = UNDO_EMPTY, const SwRewriter * pRewriter = 0 );
- // liefert die Id der letzten undofaehigen Aktion zurueck
- // fuellt ggf. VARARR mit User-UndoIds
- SwUndoId GetUndoIds( String* pUndoStr = 0, SwUndoIds *pUndoIds = 0) const;
- String GetUndoIdsStr( String* pUndoStr = 0, SwUndoIds *pUndoIds = 0) const;
-
- // abfragen/setzen der Anzahl von wiederherstellbaren Undo-Actions
- static sal_uInt16 GetUndoActionCount();
- static void SetUndoActionCount( sal_uInt16 nNew );
-
- // Redo
- // liefert die Id der letzten Redofaehigen Aktion zurueck
- // fuellt ggf. VARARR mit RedoIds
- SwUndoId GetRedoIds( String* pRedoStr = 0, SwUndoIds *pRedoIds = 0) const;
- String GetRedoIdsStr( String* pRedoStr = 0, SwUndoIds *pRedoIds = 0) const;
-
- // Repeat
- // liefert die Id der letzten Repeatfaehigen Aktion zurueck
- // fuellt ggf. VARARR mit RedoIds
- SwUndoId GetRepeatIds( String* pRepeatStr = 0, SwUndoIds *pRedoIds = 0) const;
- String GetRepeatIdsStr( String* pRepeatStr = 0,
- SwUndoIds *pRedoIds = 0) const;
-
- // 0 letzte Aktion, sonst Aktionen bis zum Start der Klammerung nUndoId
- // mit KillPaMs, ClearMark
- sal_Bool Undo(SwUndoId nUndoId = UNDO_EMPTY, sal_uInt16 nCnt = 1 );
- // wiederholt
- sal_uInt16 Repeat( sal_uInt16 nCount );
- // wiederholt
- sal_uInt16 Redo( sal_uInt16 nCnt = 1 );
+
+ bool GetLastUndoInfo(::rtl::OUString *const o_pStr,
+ SwUndoId *const o_pId) const;
+ bool GetFirstRedoInfo(::rtl::OUString *const o_pStr) const;
+ SwUndoId GetRepeatInfo(::rtl::OUString *const o_pStr) const;
+
+ /// is it forbidden to modify cursors via API calls?
+ bool CursorsLocked() const;
+ /// set selections to those contained in the UndoRedoContext
+ /// should only be called by sw::UndoManager!
+ void HandleUndoRedoContext(::sw::UndoRedoContext & rContext);
+
+ bool Undo(sal_uInt16 const nCount = 1);
+ bool Redo(sal_uInt16 const nCount = 1);
+ bool Repeat(sal_uInt16 const nCount);
+
// fuer alle Sichten auf dieses Dokument
void StartAllAction();
void EndAllAction();
diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index 74a9bb215b37..cea112f655a0 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -30,6 +30,8 @@
#include <vector>
+#include <boost/utility.hpp>
+
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <svl/svarray.hxx>
@@ -82,7 +84,9 @@ typedef sal_Bool (*FnForEach_SwNodes)( const SwNodePtr&, void* pArgs );
SV_DECL_PTRARR_SORT( SwOutlineNodes, SwNodePtr, 0, 10 )
-class SW_DLLPUBLIC SwNodes: private BigPtrArray
+class SW_DLLPUBLIC SwNodes
+ : private BigPtrArray
+ , private ::boost::noncopyable
{
friend class SwDoc;
friend class SwNode;
@@ -141,10 +145,6 @@ public:
SwNodePtr operator[]( sal_uLong n ) const
{ return (SwNodePtr)BigPtrArray::operator[] ( n ); }
-//JP 29.09.97: impl. steht im ndindex.hxx - sollte moeglichst bald auf die
-// neue Schnittstelle angepasst werden
- inline SwNodePtr operator[]( const SwNodeIndex& rIdx ) const;
-
sal_uLong Count() const { return BigPtrArray::Count(); }
void ForEach( FnForEach_SwNodes fnForEach, void* pArgs = 0 )
{
@@ -342,11 +342,6 @@ public:
SwNode * DocumentSectionStartNode(SwNode * pNode) const;
SwNode * DocumentSectionEndNode(SwNode * pNode) const;
//<- #112139#
-private:
- // privater Constructor, weil nie kopiert werden darf !!
- SwNodes( const SwNodes & rNodes );
};
-
-
#endif
diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx
index 611c09390728..695560bf7878 100644
--- a/sw/inc/ndindex.hxx
+++ b/sw/inc/ndindex.hxx
@@ -24,14 +24,15 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _NDINDEX_HXX
-#define _NDINDEX_HXX
+#ifndef SW_NDINDEX_HXX
+#define SW_NDINDEX_HXX
#include <limits.h>
+
#include <tools/solar.h>
-#include "node.hxx"
-#include "ndarr.hxx"
+#include <node.hxx>
+
class SwNode;
class SwNodes;
@@ -239,14 +240,4 @@ inline SwNodeIndex& SwNodeIndex::operator=( sal_uLong nWert )
return *this;
}
-
-
-//JP 29.09.97: impl. steht im ndindex.hxx - sollte moeglichst bald auf die
-// neue Schnittstelle angepasst werden
-inline SwNode* SwNodes::operator[]( const SwNodeIndex& rIdx ) const
-{
- return &rIdx.GetNode();
-}
-
-
#endif
diff --git a/sw/source/ui/inc/prtopt.hxx b/sw/inc/prtopt.hxx
index 75f0520e35e8..75f0520e35e8 100644
--- a/sw/source/ui/inc/prtopt.hxx
+++ b/sw/inc/prtopt.hxx
diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index 43c2066330f7..acfb213911db 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -516,8 +516,8 @@ public:
SvPtrarr& rArr );
// lege einen neuen PaM an der Position an
- static SwPaM* NewSwPaM( SwDoc & rDoc, sal_uLong nStartIdx, sal_uLong nEndIdx,
- sal_Bool bNodesArray = sal_True );
+ static SwPaM * NewSwPaM(SwDoc & rDoc,
+ sal_uLong const nStartIdx, sal_uLong const nEndIdx);
// kopiere ggfs. eine lokale Datei ins Internet
sal_Bool CopyLocalFileToINet( String& rFileNm );
diff --git a/sw/inc/swdbtoolsclient.hxx b/sw/inc/swdbtoolsclient.hxx
index 324075d0aeb7..067e58cbcf52 100644
--- a/sw/inc/swdbtoolsclient.hxx
+++ b/sw/inc/swdbtoolsclient.hxx
@@ -64,7 +64,7 @@ public:
const ::com::sun::star::lang::Locale& _rLocale
);
- ::rtl::OUString getValue(
+ ::rtl::OUString getFormattedValue(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn,
const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& _rxFormatter,
const ::com::sun::star::lang::Locale& _rLocale,
diff --git a/sw/inc/swundo.hxx b/sw/inc/swundo.hxx
index 02212401d990..3506a7e176b9 100644
--- a/sw/inc/swundo.hxx
+++ b/sw/inc/swundo.hxx
@@ -24,10 +24,16 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _SWUNDO_HXX
-#define _SWUNDO_HXX
+#ifndef SWUNDO_HXX
+#define SWUNDO_HXX
+
+#include <vector>
+
+#include <rtl/ustring.hxx>
+
+
+typedef ::std::vector< ::rtl::OUString > SwUndoComments_t;
-#include <svl/svarray.hxx>
// die Ids fuer StdAktionen
enum SwUndoId
@@ -177,24 +183,4 @@ enum SwUndoId
};
-#define INIT_UNDOIDS 20
-#define GROW_UNDOIDS 32
-// Das Array der verwendeten Undo-Ids
-class String;
-class SwUndoIdAndName
-{
- SwUndoId eUndoId;
- String* pUndoStr;
-
-public:
- SwUndoIdAndName() : eUndoId( UNDO_EMPTY ), pUndoStr( 0 ) {}
- SwUndoIdAndName( SwUndoId nId, const String* pStr = 0 );
- ~SwUndoIdAndName();
-
- SwUndoId GetUndoId() const { return eUndoId; }
- const String* GetUndoStr() const { return pUndoStr; }
-};
-typedef SwUndoIdAndName* SwUndoIdAndNamePtr;
-SV_DECL_PTRARR_DEL( SwUndoIds, SwUndoIdAndNamePtr, INIT_UNDOIDS, GROW_UNDOIDS )
-
#endif
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
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 5fe59c9648fe..d0edd92e8e06 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -806,7 +806,8 @@ enum SwPropNameIds
// <--
/* 0738 */ UNO_NAME_META, // #i91565#
/* 0739 */ UNO_NAME_NESTED_TEXT_CONTENT, // #i109601#
-/* 0740 */ SW_PROPNAME_END
+/* 0740 */ UNO_NAME_EMBEDDED_OBJECT,
+/* 0741 */ SW_PROPNAME_END
};
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 26300f99e24d..fd1224e41d32 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -335,7 +335,8 @@ public:
/** Provides access to the document undo/redo interface
*/
- IDocumentUndoRedo* getIDocumentUndoRedoAccess();
+ IDocumentUndoRedo const& GetIDocumentUndoRedo() const;
+ IDocumentUndoRedo & GetIDocumentUndoRedo();
// --> OD 2007-11-14 #i83479#
const IDocumentListItems* getIDocumentListItemsAccess() const;
diff --git a/sw/source/core/bastyp/swtypes.cxx b/sw/source/core/bastyp/swtypes.cxx
index 1ce5e4b9cf6c..3015d8cf4b44 100644
--- a/sw/source/core/bastyp/swtypes.cxx
+++ b/sw/source/core/bastyp/swtypes.cxx
@@ -39,7 +39,8 @@
#include <frmfmt.hxx>
#include <frmtool.hxx>
#include <ndtxt.hxx>
-#include <undobj.hxx>
+#include <UndoDelete.hxx>
+#include <UndoInsert.hxx>
#include <swtable.hxx>
#include <viscrs.hxx>
#include <fntcache.hxx>
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx
index 11060352b6c3..18dc67cfc958 100644
--- a/sw/source/core/crsr/bookmrk.cxx
+++ b/sw/source/core/crsr/bookmrk.cxx
@@ -31,6 +31,7 @@
#include <bookmrk.hxx>
#include <IDocumentMarkAccess.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <doc.hxx>
#include <errhdl.hxx>
#include <ndtxt.hxx>
@@ -38,7 +39,7 @@
#include <swserv.hxx>
#include <sfx2/linkmgr.hxx>
#include <swtypes.hxx>
-#include <undobj.hxx>
+#include <UndoBookmark.hxx>
#include <unobookmark.hxx>
#include <rtl/random.h>
#include <xmloff/odffields.hxx>
@@ -79,13 +80,14 @@ namespace
{
SwPosition& rStart = pField->GetMarkStart();
SwPosition& rEnd = pField->GetMarkEnd();
- SwTxtNode const * const pStartTxtNode = io_pDoc->GetNodes()[rStart.nNode]->GetTxtNode();
- SwTxtNode const * const pEndTxtNode = io_pDoc->GetNodes()[rEnd.nNode]->GetTxtNode();
+ SwTxtNode const*const pStartTxtNode =
+ rStart.nNode.GetNode().GetTxtNode();
+ SwTxtNode const*const pEndTxtNode = rEnd.nNode.GetNode().GetTxtNode();
const sal_Unicode ch_start=pStartTxtNode->GetTxt().GetChar(rStart.nContent.GetIndex());
const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar(rEnd.nContent.GetIndex()-1);
SwPaM aStartPaM(rStart);
SwPaM aEndPaM(rEnd);
- io_pDoc->StartUndo(UNDO_UI_REPLACE, NULL);
+ io_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_UI_REPLACE, NULL);
if(ch_start != aStartMark)
{
io_pDoc->InsertString(aStartPaM, aStartMark);
@@ -94,7 +96,7 @@ namespace
{
io_pDoc->InsertString(aEndPaM, aEndMark);
}
- io_pDoc->EndUndo(UNDO_UI_REPLACE, NULL);
+ io_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_UI_REPLACE, NULL);
};
}
@@ -231,10 +233,10 @@ namespace sw { namespace mark
void Bookmark::InitDoc(SwDoc* const io_pDoc)
{
- if(io_pDoc->DoesUndo())
+ if (io_pDoc->GetIDocumentUndoRedo().DoesUndo())
{
- io_pDoc->ClearRedo();
- io_pDoc->AppendUndo(new SwUndoInsBookmark(*this));
+ io_pDoc->GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoInsBookmark(*this));
}
io_pDoc->SetModified();
}
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 4a14a924d80a..8e77c070d62d 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -174,6 +174,21 @@ sal_Bool SwCrsrShell::DestroyCrsr()
}
+SwPaM & SwCrsrShell::CreateNewShellCursor()
+{
+ if (HasSelection())
+ {
+ (void) CreateCrsr(); // n.b. returns old cursor
+ }
+ return *GetCrsr();
+}
+
+SwPaM & SwCrsrShell::GetCurrentShellCursor()
+{
+ return *GetCrsr();
+}
+
+
// gebe den aktuellen zurueck
SwPaM* SwCrsrShell::GetCrsr( sal_Bool bMakeTblCrsr ) const
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 0093010fcbba..08936c85210b 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -37,6 +37,7 @@
#include <svx/svdobj.hxx>
#include <crsrsh.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <pagefrm.hxx>
#include <cntfrm.hxx>
#include <rootfrm.hxx>
@@ -1705,7 +1706,8 @@ sal_Bool SwCrsrShell::GetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode,
SET_CURR_SHELL( this );
sal_Bool bRet = sal_False;
- if( !IsTableMode() && !HasSelection() && GetDoc()->DoesUndo() )
+ if (!IsTableMode() && !HasSelection()
+ && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
{
Point aPt( rPt );
SwPosition aPos( *pCurCrsr->GetPoint() );
@@ -1730,7 +1732,8 @@ sal_Bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode )
SET_CURR_SHELL( this );
sal_Bool bRet = sal_False;
- if( !IsTableMode() && !HasSelection() && GetDoc()->DoesUndo() )
+ if (!IsTableMode() && !HasSelection()
+ && GetDoc()->GetIDocumentUndoRedo().DoesUndo())
{
Point aPt( rPt );
SwPosition aPos( *pCurCrsr->GetPoint() );
@@ -1754,7 +1757,7 @@ sal_Bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode )
pCNd && pCNd->Len() )
nUndoId = UNDO_EMPTY;
- GetDoc()->StartUndo( nUndoId, NULL );
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( nUndoId, NULL );
SwTxtFmtColl* pNextFmt = 0;
SwTxtNode* pTNd = pCNd->GetTxtNode();
@@ -1860,7 +1863,7 @@ sal_Bool SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode )
break;
}
- GetDoc()->EndUndo( nUndoId, NULL );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( nUndoId, NULL );
EndAction();
bRet = sal_True;
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
index 5f07d6b1a190..b505134e4395 100644
--- a/sw/source/core/crsr/findattr.cxx
+++ b/sw/source/core/crsr/findattr.cxx
@@ -45,13 +45,14 @@
#include <fchrfmt.hxx>
#include <charfmt.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <swcrsr.hxx>
#include <editsh.hxx>
#include <ndtxt.hxx>
#include <pamtyp.hxx>
#include <swundo.hxx>
#include <crsskip.hxx>
-#include <undobj.hxx>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::lang;
@@ -1287,9 +1288,11 @@ sal_uLong SwCursor::Find( const SfxItemSet& rSet, sal_Bool bNoCollections,
sal_Bool bReplace = ( pSearchOpt && ( pSearchOpt->replaceString.getLength() ||
!rSet.Count() ) ) ||
(pReplSet && pReplSet->Count());
- sal_Bool bSttUndo = pDoc->DoesUndo() && bReplace;
- if( bSttUndo )
- pDoc->StartUndo( UNDO_REPLACE, NULL );
+ bool const bStartUndo = pDoc->GetIDocumentUndoRedo().DoesUndo() && bReplace;
+ if (bStartUndo)
+ {
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_REPLACE, NULL );
+ }
SwFindParaAttr aSwFindParaAttr( rSet, bNoCollections, pSearchOpt,
pReplSet, *this );
@@ -1299,8 +1302,10 @@ sal_uLong SwCursor::Find( const SfxItemSet& rSet, sal_Bool bNoCollections,
if( nRet && bReplace )
pDoc->SetModified();
- if( bSttUndo )
- pDoc->EndUndo( UNDO_REPLACE, NULL );
+ if (bStartUndo)
+ {
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_REPLACE, NULL );
+ }
return nRet;
}
diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx
index d7fdf7d4954d..a78b92b180a1 100644
--- a/sw/source/core/crsr/findcoll.cxx
+++ b/sw/source/core/crsr/findcoll.cxx
@@ -28,16 +28,15 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <tools/resid.hxx>
#include <swcrsr.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <pamtyp.hxx>
#include <swundo.hxx>
-#include <undobj.hxx>
-#ifndef _COMCORE_HRC
+#include <SwRewriter.hxx>
#include <comcore.hrc>
-#endif
-#include <tools/resid.hxx>
//------------------ Methoden der CrsrShell ---------------------------
@@ -91,15 +90,17 @@ sal_uLong SwCursor::Find( const SwTxtFmtColl& rFmtColl,
Link aLnk( pDoc->GetOle2Link() );
pDoc->SetOle2Link( Link() );
- sal_Bool bSttUndo = pDoc->DoesUndo() && pReplFmtColl;
- if( bSttUndo )
+ bool const bStartUndo =
+ pDoc->GetIDocumentUndoRedo().DoesUndo() && pReplFmtColl;
+ if (bStartUndo)
{
SwRewriter aRewriter;
aRewriter.AddRule(UNDO_ARG1, rFmtColl.GetName());
aRewriter.AddRule(UNDO_ARG2, SW_RES(STR_YIELDS));
aRewriter.AddRule(UNDO_ARG3, pReplFmtColl->GetName());
- pDoc->StartUndo( UNDO_UI_REPLACE_STYLE, &aRewriter );
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_UI_REPLACE_STYLE,
+ &aRewriter );
}
SwFindParaFmtColl aSwFindParaFmtColl( rFmtColl, pReplFmtColl, *this );
@@ -110,8 +111,10 @@ sal_uLong SwCursor::Find( const SwTxtFmtColl& rFmtColl,
if( nRet && pReplFmtColl )
pDoc->SetModified();
- if( bSttUndo )
- pDoc->EndUndo( UNDO_UI_REPLACE_STYLE, NULL );
+ if (bStartUndo)
+ {
+ pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_END, 0);
+ }
return nRet;
}
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 1f5e7b6eb9ff..6eb89eadfbff 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -27,15 +27,17 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+
#include <com/sun/star/util/SearchOptions.hpp>
#include <com/sun/star/util/SearchFlags.hpp>
-
-
#define _SVSTDARR_USHORTS
#define _SVSTDARR_ULONGS
#include <svl/svstdarr.hxx>
+
#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+
#include <txatritr.hxx>
#include <fldbas.hxx>
#include <fmtfld.hxx>
@@ -43,15 +45,16 @@
#include <txtfld.hxx>
#include <swcrsr.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <pamtyp.hxx>
#include <ndtxt.hxx>
#include <swundo.hxx>
+#include <UndoInsert.hxx>
#include <breakit.hxx>
#include <docsh.hxx>
#include <PostItMgr.hxx>
#include <viewsh.hxx>
-#include <vcl/window.hxx>
using namespace ::com::sun::star;
using namespace util;
@@ -643,9 +646,11 @@ sal_uLong SwCursor::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNot
Link aLnk( pDoc->GetOle2Link() );
pDoc->SetOle2Link( Link() );
- sal_Bool bSttUndo = pDoc->DoesUndo() && bReplace;
- if( bSttUndo )
- pDoc->StartUndo( UNDO_REPLACE, NULL );
+ bool const bStartUndo = pDoc->GetIDocumentUndoRedo().DoesUndo() && bReplace;
+ if (bStartUndo)
+ {
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_REPLACE, NULL );
+ }
sal_Bool bSearchSel = 0 != (rSearchOpt.searchFlag & SearchFlags::REG_NOT_BEGINOFLINE);
if( bSearchSel )
@@ -656,8 +661,12 @@ sal_uLong SwCursor::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNot
if( nRet && bReplace )
pDoc->SetModified();
- if( bSttUndo )
- pDoc->EndUndo( UNDO_REPLACE, NULL );
+ if (bStartUndo)
+ {
+ SwRewriter rewriter(MakeUndoReplaceRewriter(
+ nRet, rSearchOpt.searchString, rSearchOpt.replaceString));
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_REPLACE, & rewriter );
+ }
return nRet;
}
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 96211aaadf77..b7106ade751c 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -43,6 +43,7 @@
#include <swcrsr.hxx>
#include <unocrsr.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <ndtxt.hxx>
#include <section.hxx>
@@ -58,9 +59,7 @@
#include <crsskip.hxx>
#include <vcl/msgbox.hxx>
#include <mdiexp.hxx> // ...Percent()
-#ifndef _STATSTR_HRC
#include <statstr.hrc> // ResId fuer Statusleiste
-#endif
#include <redline.hxx> // SwRedline
@@ -743,7 +742,7 @@ sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr,
sal_Bool bInReadOnly, sal_Bool& bCancel )
{
SwDoc* pDoc = pCurCrsr->GetDoc();
- sal_Bool bDoesUndo = pDoc->DoesUndo();
+ bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo();
int nFndRet = 0;
sal_uLong nFound = 0;
int bSrchBkwrd = fnMove == fnMoveBackward, bEnde = sal_False;
@@ -806,14 +805,15 @@ sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr,
break;
}
- if( coSrchRplcThreshold == nFound && pDoc->DoesUndo()
+ if ((coSrchRplcThreshold == nFound)
+ && pDoc->GetIDocumentUndoRedo().DoesUndo()
&& rParas.IsReplaceMode())
{
short nRet = pCurCrsr->MaxReplaceArived();
if( RET_YES == nRet )
{
- pDoc->DelAllUndoObj();
- pDoc->DoUndo( sal_False );
+ pDoc->GetIDocumentUndoRedo().DelAllUndoObj();
+ pDoc->GetIDocumentUndoRedo().DoUndo(false);
}
else
{
@@ -858,7 +858,7 @@ sal_uLong lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr,
pFndRing = pCurCrsr->Create();
delete pPHdl;
- pDoc->DoUndo( bDoesUndo );
+ pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo);
return nFound;
}
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index bd42d09bcd24..08dab4aff359 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -42,6 +42,7 @@
#include <docary.hxx>
#include <swundo.hxx>
#include <undobj.hxx>
+#include <numrule.hxx>
#include <doc.hxx>
#include <frmfmt.hxx>
#include <fmtanchr.hxx>
@@ -808,43 +809,10 @@ String lcl_dbg_out(const SwUndo & rUndo)
{
String aStr("[ ", RTL_TEXTENCODING_ASCII_US);
- aStr += String::CreateFromInt32(rUndo.GetId());
+ aStr += String::CreateFromInt32(
+ static_cast<SfxUndoAction const&>(rUndo).GetId());
aStr += String(": ", RTL_TEXTENCODING_ASCII_US);
- switch(rUndo.GetId())
- {
- case UNDO_START:
- aStr += String(", ", RTL_TEXTENCODING_ASCII_US);
- aStr +=
- String::CreateFromInt32(dynamic_cast
- <const SwUndoStart &>(rUndo).
- GetUserId());
- aStr += String(", ", RTL_TEXTENCODING_ASCII_US);
- aStr += String::CreateFromInt32(dynamic_cast
- <const SwUndoStart &>(rUndo).
- GetEndOffset());
- aStr += String(" ", RTL_TEXTENCODING_ASCII_US);
-
- break;
-
- case UNDO_END:
- aStr += String(", ", RTL_TEXTENCODING_ASCII_US);
- aStr +=
- String::CreateFromInt32(dynamic_cast
- <const SwUndoEnd &>(rUndo).
- GetId());
- aStr += String(", ", RTL_TEXTENCODING_ASCII_US);
- aStr += String::CreateFromInt32(dynamic_cast
- <const SwUndoEnd &>(rUndo).
- GetSttOffset());
- aStr += String(" ", RTL_TEXTENCODING_ASCII_US);
-
- break;
-
- default:
- break;
- }
-
aStr += rUndo.GetComment();
aStr += String(" ]", RTL_TEXTENCODING_ASCII_US);
@@ -876,39 +844,6 @@ SW_DLLPUBLIC const char * dbg_out(SwOutlineNodes & rNodes)
return dbg_out(lcl_dbg_out(rNodes));
}
-String lcl_dbg_out(const SwUndos & rUndos)
-{
- sal_uInt16 nIndent = 0;
-
- String aStr("[\n", RTL_TEXTENCODING_ASCII_US);
-
- for (sal_uInt16 n = 0; n < rUndos.Count(); n++)
- {
- SwUndo * pUndo = rUndos[n];
-
- if (pUndo->GetId() == UNDO_END)
- nIndent--;
-
- for (sal_uInt16 nI = 0; n < nIndent; nI++)
- aStr += String(" ", RTL_TEXTENCODING_ASCII_US);
-
- aStr += lcl_dbg_out(*pUndo);
- aStr += String("\n", RTL_TEXTENCODING_ASCII_US);
-
- if (pUndo->GetId() == UNDO_START)
- nIndent++;
- }
-
- aStr += String("]\n", RTL_TEXTENCODING_ASCII_US);
-
- return aStr;
-}
-
-SW_DLLPUBLIC const char * dbg_out(const SwUndos & rUndos)
-{
- return dbg_out(lcl_dbg_out(rUndos));
-}
-
String lcl_dbg_out(const SwRewriter & rRewriter)
{
(void) rRewriter;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index a61ab3364e30..47dc02014aa7 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -27,7 +27,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+
#include <doc.hxx>
+#include <UndoManager.hxx>
#include <hintids.hxx>
#include <tools/shl.hxx>
@@ -80,7 +82,10 @@
#include <pam.hxx>
#include <ndtxt.hxx>
#include <swundo.hxx> // fuer die UndoIds
-#include <undobj.hxx>
+#include <UndoCore.hxx>
+#include <UndoInsert.hxx>
+#include <UndoSplitMove.hxx>
+#include <UndoTable.hxx>
#include <pagedesc.hxx> //DTor
#include <breakit.hxx>
#include <ndole.hxx>
@@ -112,15 +117,15 @@
#include <viewsh.hxx>
#include <shellres.hxx>
#include <txtfrm.hxx>
+#include <wdocsh.hxx> // SwWebDocShell
+#include <prtopt.hxx> // SwPrintOptions
#include <vector>
#include <map>
#include <osl/diagnose.h>
#include <osl/interlck.h>
-#ifdef FUTURE_VBA
#include <vbahelper/vbaaccesshelper.hxx>
-#endif
/* @@@MAINTAINABILITY-HORROR@@@
Probably unwanted dependency on SwDocShell
@@ -632,11 +637,23 @@ void SwDoc::setJobsetup(/*[in]*/ const JobSetup &rJobSetup )
PrtDataChanged();
}
-SwPrintData* SwDoc::getPrintData() const
+const SwPrintData & SwDoc::getPrintData() const
{
if(!pPrtData)
- ((SwDoc*)this)->pPrtData = new SwPrintData;
- return pPrtData;
+ {
+ SwDoc * pThis = const_cast< SwDoc * >(this);
+ pThis->pPrtData = new SwPrintData;
+
+ // SwPrintData should be initialized from the configuration,
+ // the respective config item is implememted by SwPrintOptions which
+ // is also derived from SwPrintData
+ const SwDocShell *pDocSh = GetDocShell();
+ DBG_ASSERT( pDocSh, "pDocSh is 0, can't determine if this is a WebDoc or not" );
+ bool bWeb = 0 != dynamic_cast< const SwWebDocShell * >(pDocSh);
+ SwPrintOptions aPrintOptions( bWeb );
+ *pThis->pPrtData = aPrintOptions;
+ }
+ return *pPrtData;
}
void SwDoc::setPrintData(/*[in]*/ const SwPrintData& rPrtData )
@@ -677,14 +694,14 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart )
}
SwUndoSplitNode* pUndo = 0;
- if ( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
+ GetIDocumentUndoRedo().ClearRedo();
// einfuegen vom Undo-Object, z.Z. nur beim TextNode
if( pNode->IsTxtNode() )
{
pUndo = new SwUndoSplitNode( this, rPos, bChkTableStart );
- AppendUndo(pUndo);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
}
@@ -791,10 +808,8 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart )
bool SwDoc::AppendTxtNode( SwPosition& rPos )
{
- /*
- * Neuen Node vor EndOfContent erzeugen.
- */
- SwTxtNode *pCurNode = GetNodes()[ rPos.nNode ]->GetTxtNode();
+ // create new node before EndOfContent
+ SwTxtNode * pCurNode = rPos.nNode.GetNode().GetTxtNode();
if( !pCurNode )
{
// dann kann ja einer angelegt werden!
@@ -808,10 +823,9 @@ bool SwDoc::AppendTxtNode( SwPosition& rPos )
rPos.nNode++;
rPos.nContent.Assign( pCurNode, 0 );
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoInsert( rPos.nNode ));
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoInsert( rPos.nNode ) );
}
if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() ))
@@ -832,9 +846,9 @@ bool SwDoc::AppendTxtNode( SwPosition& rPos )
bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr,
const enum InsertFlags nInsertMode )
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
+ GetIDocumentUndoRedo().ClearRedo(); // AppendUndo not always called!
}
const SwPosition& rPos = *rRg.GetPoint();
@@ -856,15 +870,16 @@ bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr,
SwDataChanged aTmp( rRg, 0 );
- if( !DoesUndo() || !DoesGroupUndo() )
+ if (!GetIDocumentUndoRedo().DoesUndo() ||
+ !GetIDocumentUndoRedo().DoesGroupUndo())
{
pNode->InsertText( rStr, rPos.nContent, nInsertMode );
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
SwUndoInsert * const pUndo( new SwUndoInsert(
rPos.nNode, rPos.nContent.GetIndex(), rStr.Len(), nInsertMode));
- AppendUndo(pUndo);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
}
else
@@ -875,25 +890,12 @@ bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr,
if (!(nInsertMode & IDocumentContentOperations::INS_FORCEHINTEXPAND))
// -> #111827#
{
- sal_uInt16 const nUndoSize = pUndos->Count();
- if (0 != nUndoSize)
+ SwUndo *const pLastUndo = GetUndoManager().GetLastUndo();
+ SwUndoInsert *const pUndoInsert(
+ dynamic_cast<SwUndoInsert *>(pLastUndo) );
+ if (pUndoInsert && pUndoInsert->CanGrouping(rPos))
{
- SwUndo * const pLastUndo = (*pUndos)[ nUndoSize - 1 ];
-
- switch (pLastUndo->GetId())
- {
- case UNDO_INSERT:
- case UNDO_TYPING:
- if (static_cast<SwUndoInsert*>(pLastUndo)
- ->CanGrouping( rPos ))
- {
- pUndo = static_cast<SwUndoInsert*>(pLastUndo);
- }
- break;
-
- default:
- break;
- }
+ pUndo = pUndoInsert;
}
}
// <- #111827#
@@ -905,7 +907,7 @@ bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr,
{
pUndo = new SwUndoInsert( rPos.nNode, nInsPos, 0, nInsertMode,
!rCC.isLetterNumeric( rStr, 0 ) );
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
pNode->InsertText( rStr, rPos.nContent, nInsertMode );
@@ -918,7 +920,7 @@ bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr,
{
pUndo = new SwUndoInsert( rPos.nNode, nInsPos, 1, nInsertMode,
!rCC.isLetterNumeric( rStr, i ) );
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
}
}
@@ -1339,12 +1341,14 @@ void SwDoc::CalculatePagesForPrinting(
// get PageRange value to use
OUString aPageRange;
- if (bIsPDFExport)
- {
- // ?? rOptions.getValue( C2U("Selection") );
- aPageRange = rOptions.getStringValue( "PageRange", OUString() );
- }
- else
+ // --> PL, OD #i116085# - adjusting fix for i113919
+// if (bIsPDFExport)
+// {
+// aPageRange = rOptions.getStringValue( "PageRange", OUString() );
+// }
+// else
+ if ( !bIsPDFExport )
+ // <--
{
// PageContent :
// 0 -> print all pages (default if aPageRange is empty)
@@ -1997,7 +2001,7 @@ void SwDoc::ResetModified()
// it is correct. In this case we reset the modified flag.
if ( 0 != pDocStat->nChar )
pDocStat->bModified = sal_False;
- nUndoSavePos = nUndoPos;
+ GetIDocumentUndoRedo().SetUndoNoModifiedPosition();
if( nCall && aOle2Link.IsSet() )
{
mbInCallModified = sal_True;
@@ -2016,10 +2020,9 @@ void SwDoc::ReRead( SwPaM& rPam, const String& rGrfName,
|| rPam.GetPoint()->nNode.GetIndex() == rPam.GetMark()->nNode.GetIndex() )
&& 0 != ( pGrfNd = rPam.GetPoint()->nNode.GetNode().GetGrfNode() ) )
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoReRead( rPam, *pGrfNd ) );
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoReRead(rPam, *pGrfNd));
}
// Weil nicht bekannt ist, ob sich die Grafik spiegeln laesst,
@@ -2231,10 +2234,10 @@ void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, sal_Bool
// loesche den nicht sichtbaren Content aus dem Document, wie z.B.:
// versteckte Bereiche, versteckte Absaetze
-sal_Bool SwDoc::RemoveInvisibleContent()
+bool SwDoc::RemoveInvisibleContent()
{
sal_Bool bRet = sal_False;
- StartUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL );
{
SwTxtNode* pTxtNd;
@@ -2398,13 +2401,13 @@ sal_Bool SwDoc::RemoveInvisibleContent()
if( bRet )
SetModified();
- EndUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL );
return bRet;
}
/*-- 25.08.2010 14:18:12---------------------------------------------------
-----------------------------------------------------------------------*/
-sal_Bool SwDoc::HasInvisibleContent() const
+bool SwDoc::HasInvisibleContent() const
{
sal_Bool bRet = sal_False;
@@ -2449,6 +2452,21 @@ sal_Bool SwDoc::HasInvisibleContent() const
}
return bRet;
}
+
+bool SwDoc::RestoreInvisibleContent()
+{
+ bool bRet = false;
+ SwUndoId nLastUndoId(UNDO_EMPTY);
+ if (GetIDocumentUndoRedo().GetLastUndoInfo(0, & nLastUndoId)
+ && (UNDO_UI_DELETE_INVISIBLECNTNT == nLastUndoId))
+ {
+ GetIDocumentUndoRedo().Undo();
+ GetIDocumentUndoRedo().ClearRedo();
+ bRet = true;
+ }
+ return bRet;
+}
+
/*-- 11.06.2004 08:34:04---------------------------------------------------
-----------------------------------------------------------------------*/
@@ -2456,7 +2474,7 @@ sal_Bool SwDoc::ConvertFieldsToText()
{
sal_Bool bRet = sal_False;
LockExpFlds();
- StartUndo( UNDO_UI_REPLACE, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_UI_REPLACE, NULL );
const SwFldTypes* pMyFldTypes = GetFldTypes();
sal_uInt16 nCount = pMyFldTypes->Count();
@@ -2526,7 +2544,7 @@ sal_Bool SwDoc::ConvertFieldsToText()
if( bRet )
SetModified();
- EndUndo( UNDO_UI_REPLACE, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_UI_REPLACE, NULL );
UnlockExpFlds();
return bRet;
@@ -2593,8 +2611,7 @@ bool SwDoc::EmbedAllLinks()
const ::sfx2::SvBaseLinks& rLinks = rLnkMgr.GetLinks();
if( rLinks.Count() )
{
- sal_Bool bDoesUndo = DoesUndo();
- DoUndo( sal_False );
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
::sfx2::SvBaseLink* pLnk = 0;
while( 0 != (pLnk = lcl_FindNextRemovableLink( rLinks, rLnkMgr ) ) )
@@ -2610,8 +2627,7 @@ bool SwDoc::EmbedAllLinks()
bRet = sal_True;
}
- DelAllUndoObj();
- DoUndo( bDoesUndo );
+ GetIDocumentUndoRedo().DelAllUndoObj();
SetModified();
}
return bRet;
@@ -2650,26 +2666,26 @@ void SwDoc::AppendUndoForInsertFromDB( const SwPaM& rPam, sal_Bool bIsTable )
{
SwUndoCpyTbl* pUndo = new SwUndoCpyTbl;
pUndo->SetTableSttIdx( pTblNd->GetIndex() );
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
}
else if( rPam.HasMark() )
{
SwUndoCpyDoc* pUndo = new SwUndoCpyDoc( rPam );
pUndo->SetInsertRange( rPam, sal_False );
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
}
void SwDoc::ChgTOX(SwTOXBase & rTOX, const SwTOXBase & rNew)
{
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- DelAllUndoObj();
+ GetIDocumentUndoRedo().DelAllUndoObj();
SwUndo * pUndo = new SwUndoTOXChange(&rTOX, rNew);
- AppendUndo(pUndo);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
rTOX = rNew;
diff --git a/sw/source/core/doc/docbasic.cxx b/sw/source/core/doc/docbasic.cxx
index d617b5c5ffa1..77665e55fbce 100644
--- a/sw/source/core/doc/docbasic.cxx
+++ b/sw/source/core/doc/docbasic.cxx
@@ -100,7 +100,7 @@ sal_Bool SwDoc::ExecMacro( const SvxMacro& rMacro, String* pRet, SbxArray* pArgs
aRef = pRetValue;
eErr = pDocShell->CallBasic( rMacro.GetMacName(),
rMacro.GetLibName(),
- 0, pArgs, pRet ? pRetValue : 0 );
+ pArgs, pRet ? pRetValue : 0 );
if( pRet && SbxNULL < pRetValue->GetType() &&
SbxVOID != pRetValue->GetType() )
@@ -231,7 +231,7 @@ sal_uInt16 SwDoc::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEve
if( STARBASIC == rMacro.GetScriptType() )
{
nRet += 0 == pDocShell->CallBasic( rMacro.GetMacName(),
- rMacro.GetLibName(), 0, pArgs ) ? 1 : 0;
+ rMacro.GetLibName(), pArgs ) ? 1 : 0;
}
else if( EXTENDED_STYPE == rMacro.GetScriptType() )
{
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index a7185b54ac54..50fb0e7b98f7 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -58,7 +58,6 @@
#include <swserv.hxx>
#include <swundo.hxx>
#include <tools/pstm.hxx>
-#include <undobj.hxx>
#include <unocrsr.hxx>
#include <viscrs.hxx>
#include <stdio.h>
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index cfd9646d5163..e0c550dff020 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -37,11 +37,12 @@
#include <editeng/boxitem.hxx>
#include <editeng/udlnitem.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
#include <redline.hxx>
-#include <undobj.hxx>
+#include <UndoRedline.hxx>
#include <section.hxx>
#include <tox.hxx>
#include <docsh.hxx>
@@ -1216,14 +1217,12 @@ sal_Bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine,
if( nStt != nSEnd )
{
{
- sal_Bool bUndo = pDoc->DoesUndo();
- pDoc->DoUndo( sal_False );
+ ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
SwPaM aCpyPam( rSrcNd, nStt );
aCpyPam.SetMark();
aCpyPam.GetPoint()->nContent = nSEnd;
aCpyPam.GetDoc()->CopyRange( aCpyPam, *aPam.GetPoint(),
false );
- pDoc->DoUndo( bUndo );
}
SwPaM* pTmp = new SwPaM( *aPam.GetPoint(), rpDelRing );
@@ -1494,8 +1493,11 @@ void SwCompareData::SetRedlinesToDoc( sal_Bool bUseDocInfo )
rDoc.DeleteRedline( *pTmp, false, USHRT_MAX );
- if( rDoc.DoesUndo() )
- rDoc.AppendUndo( new SwUndoCompDoc( *pTmp, sal_False ));
+ if (rDoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo(new SwUndoCompDoc( *pTmp, sal_False )) ;
+ rDoc.GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
rDoc.AppendRedline( new SwRedline( aRedlnData, *pTmp ), true );
} while( pDelRing != ( pTmp = (SwPaM*)pTmp->GetNext() ));
@@ -1560,8 +1562,11 @@ void SwCompareData::SetRedlinesToDoc( sal_Bool bUseDocInfo )
do {
if( rDoc.AppendRedline( new SwRedline( aRedlnData, *pTmp ), true) &&
- rDoc.DoesUndo() )
- rDoc.AppendUndo( new SwUndoCompDoc( *pTmp, sal_True ));
+ rDoc.GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo(new SwUndoCompDoc( *pTmp, sal_True ));
+ rDoc.GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
} while( pInsRing != ( pTmp = (SwPaM*)pTmp->GetNext() ));
}
}
@@ -1578,7 +1583,7 @@ long SwDoc::CompareDoc( const SwDoc& rDoc )
long nRet = 0;
- StartUndo(UNDO_EMPTY, NULL);
+ GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
sal_Bool bDocWasModified = IsModified();
SwDoc& rSrcDoc = (SwDoc&)rDoc;
sal_Bool bSrcModified = rSrcDoc.IsModified();
@@ -1609,14 +1614,12 @@ long SwDoc::CompareDoc( const SwDoc& rDoc )
if( !bSrcModified )
rSrcDoc.ResetModified();
- EndUndo(UNDO_EMPTY, NULL);
+ GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
return nRet;
}
-typedef void (SwDoc::*FNInsUndo)( SwUndo* );
-
class _SaveMergeRedlines : public Ring
{
const SwRedline* pSrcRedl;
@@ -1624,7 +1627,7 @@ class _SaveMergeRedlines : public Ring
public:
_SaveMergeRedlines( const SwNode& rDstNd,
const SwRedline& rSrcRedl, Ring* pRing );
- sal_uInt16 InsertRedline( FNInsUndo pFn );
+ sal_uInt16 InsertRedline();
SwRedline* GetDestRedline() { return pDestRedl; }
};
@@ -1655,7 +1658,7 @@ _SaveMergeRedlines::_SaveMergeRedlines( const SwNode& rDstNd,
}
}
-sal_uInt16 _SaveMergeRedlines::InsertRedline( FNInsUndo pFn )
+sal_uInt16 _SaveMergeRedlines::InsertRedline()
{
sal_uInt16 nIns = 0;
SwDoc* pDoc = pDestRedl->GetDoc();
@@ -1663,8 +1666,7 @@ sal_uInt16 _SaveMergeRedlines::InsertRedline( FNInsUndo pFn )
if( nsRedlineType_t::REDLINE_INSERT == pDestRedl->GetType() )
{
// der Teil wurde eingefuegt, also kopiere ihn aus dem SourceDoc
- sal_Bool bUndo = pDoc->DoesUndo();
- pDoc->DoUndo( sal_False );
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
SwNodeIndex aSaveNd( pDestRedl->GetPoint()->nNode, -1 );
xub_StrLen nSaveCnt = pDestRedl->GetPoint()->nContent.GetIndex();
@@ -1677,7 +1679,6 @@ sal_uInt16 _SaveMergeRedlines::InsertRedline( FNInsUndo pFn )
*pDestRedl->GetPoint(), false );
pDoc->SetRedlineMode_intern( eOld );
- pDoc->DoUndo( bUndo );
pDestRedl->SetMark();
aSaveNd++;
@@ -1739,13 +1740,16 @@ sal_uInt16 _SaveMergeRedlines::InsertRedline( FNInsUndo pFn )
pCpyRedl->SetMark();
*pCpyRedl->GetPoint() = *pRStt;
- SwUndoCompDoc* pUndo = pDoc->DoesUndo()
+ SwUndoCompDoc *const pUndo =
+ (pDoc->GetIDocumentUndoRedo().DoesUndo())
? new SwUndoCompDoc( *pCpyRedl ) : 0;
// now modify doc: append redline, undo (and count)
pDoc->AppendRedline( pCpyRedl, true );
if( pUndo )
- (pDoc->*pFn)( pUndo );
+ {
+ pDoc->GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
++nIns;
*pDStt = *pREnd;
@@ -1772,12 +1776,15 @@ sal_uInt16 _SaveMergeRedlines::InsertRedline( FNInsUndo pFn )
if( pDestRedl )
{
- SwUndoCompDoc* pUndo = pDoc->DoesUndo() ? new SwUndoCompDoc( *pDestRedl ) : 0;
+ SwUndoCompDoc *const pUndo = (pDoc->GetIDocumentUndoRedo().DoesUndo())
+ ? new SwUndoCompDoc( *pDestRedl ) : 0;
// now modify doc: append redline, undo (and count)
bool bRedlineAccepted = pDoc->AppendRedline( pDestRedl, true );
if( pUndo )
- (pDoc->*pFn)( pUndo );
+ {
+ pDoc->GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
++nIns;
// if AppendRedline has deleted our redline, we may not keep a
@@ -1796,7 +1803,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
long nRet = 0;
- StartUndo(UNDO_EMPTY, NULL);
+ GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
SwDoc& rSrcDoc = (SwDoc&)rDoc;
sal_Bool bSrcModified = rSrcDoc.IsModified();
@@ -1853,7 +1860,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
_SaveMergeRedlines* pTmp = pRing;
do {
- nRet += pTmp->InsertRedline( &SwDoc::AppendUndo );
+ nRet += pTmp->InsertRedline();
} while( pRing != ( pTmp = (_SaveMergeRedlines*)pTmp->GetNext() ));
while( pRing != pRing->GetNext() )
@@ -1868,7 +1875,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
- EndUndo(UNDO_EMPTY, NULL);
+ GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
return nRet;
}
diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx
index 5c0409cb1bec..3477619fba33 100644
--- a/sw/source/core/doc/doccorr.cxx
+++ b/sw/source/core/doc/doccorr.cxx
@@ -353,4 +353,8 @@ SwEditShell* SwDoc::GetEditShell( ViewShell** ppSh ) const
return 0;
}
+::sw::IShellCursorSupplier * SwDoc::GetIShellCursorSupplier()
+{
+ return GetEditShell(0);
+}
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index d7f88e671825..463e15bf6b6e 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -27,6 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+
#include <hintids.hxx>
#include <vcl/virdev.hxx>
#include <svx/svdmodel.hxx>
@@ -48,6 +49,7 @@
#include <ndole.hxx>
#include <mdiexp.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <pagefrm.hxx> //Fuer DelPageDesc
#include <rootfrm.hxx> //Fuer DelPageDesc
@@ -55,9 +57,7 @@
#include <frmtool.hxx>
#include <pagedesc.hxx>
#include <poolfmt.hxx>
-#ifndef _DOCSH_HXX
#include <docsh.hxx>
-#endif
#include <ndindex.hxx>
#include <ftnidx.hxx>
#include <fmtftn.hxx>
@@ -69,9 +69,8 @@
#include <swwait.hxx>
#include <GetMetricVal.hxx>
#include <unotools/syslocale.hxx>
-#ifndef _STATSTR_HRC
#include <statstr.hrc>
-#endif
+#include <hints.hxx>
#include <SwUndoPageDesc.hxx>
@@ -203,12 +202,12 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
SwPageDesc *pDesc = aPageDescs[i];
- sal_Bool bDoesUndo = DoesUndo();
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- AppendUndo(new SwUndoPageDesc(*pDesc, rChged, this));
- DoUndo(sal_False);
+ SwUndo *const pUndo(new SwUndoPageDesc(*pDesc, rChged, this));
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
//Als erstes wird ggf. gespiegelt.
if ( rChged.GetUseOn() == nsUseOnPage::PD_MIRROR )
@@ -247,7 +246,7 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
//Header abgleichen.
const SwFmtHeader &rHead = rChged.GetMaster().GetHeader();
- if( bDoesUndo )
+ if (undoGuard.UndoWasEnabled())
{
// #i46909# no undo if header or footer changed
// hat sich an den Nodes etwas veraendert ?
@@ -311,7 +310,7 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
//Footer abgleichen.
const SwFmtFooter &rFoot = rChged.GetMaster().GetFooter();
- if( bDoesUndo )
+ if (undoGuard.UndoWasEnabled())
{
// #i46909# no undo if header or footer changed
// hat sich an den Nodes etwas veraendert ?
@@ -426,13 +425,10 @@ void SwDoc::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
}
SetModified();
- DoUndo(bDoesUndo);
-
// #i46909# no undo if header or footer changed
if( bHeaderFooterChanged )
{
- ClearRedo();
- DelAllUndoObj();
+ GetIDocumentUndoRedo().DelAllUndoObj();
}
}
@@ -570,9 +566,10 @@ void SwDoc::DelPageDesc( sal_uInt16 i, sal_Bool bBroadcast )
SFX_STYLESHEET_ERASED);
// <- #116530#
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- AppendUndo(new SwUndoPageDescDelete(*pDel, this));
+ SwUndo *const pUndo(new SwUndoPageDescDelete(*pDel, this));
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
PreDelPageDesc(pDel); // #i7983#
@@ -629,8 +626,11 @@ sal_uInt16 SwDoc::MakePageDesc( const String &rName, const SwPageDesc *pCpy,
SFX_STYLESHEET_CREATED);
// <- #116530#
- if (DoesUndo())
- AppendUndo(new SwUndoPageDescCreate(pNew, this)); // #116530#
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ // #116530#
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoPageDescCreate(pNew, this));
+ }
SetModified();
return (aPageDescs.Count()-1);
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index e40e2a74b48b..051efd2b0948 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -27,6 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+
#include <hintids.hxx>
#include <rtl/logfile.hxx>
#include <vcl/outdev.hxx>
@@ -49,12 +50,13 @@
#include <viewimp.hxx>
#include <swhints.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docsh.hxx>
#include <rootfrm.hxx> //Damit der RootDtor gerufen wird.
#include <poolfmt.hxx>
#include <viewsh.hxx> // fuer MakeDrawView
#include <drawdoc.hxx>
-#include <undobj.hxx>
+#include <UndoDraw.hxx>
#include <swundo.hxx> // fuer die UndoIds
#include <dcontact.hxx>
#include <dview.hxx>
@@ -227,7 +229,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
SwDrawContact *pMyContact = (SwDrawContact*)GetUserCall(pObj);
const SwFmtAnchor aAnch( pMyContact->GetFmt()->GetAnchor() );
- SwUndoDrawGroup* pUndo = !DoesUndo()
+ SwUndoDrawGroup *const pUndo = (!GetIDocumentUndoRedo().DoesUndo())
? 0
: new SwUndoDrawGroup( (sal_uInt16)rMrkList.GetMarkCount() );
@@ -303,14 +305,15 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
if( pUndo )
{
pUndo->SetGroupFmt( pFmt );
- ClearRedo();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
}
else
{
- if ( DoesUndo() )
- ClearRedo();
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ }
rDrawView.GroupMarked();
ASSERT( rMrkList.GetMarkCount() == 1, "GroupMarked more or none groups." );
@@ -322,9 +325,11 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView )
void SwDoc::UnGroupSelection( SdrView& rDrawView )
{
- const int bUndo = DoesUndo();
+ bool const bUndo = GetIDocumentUndoRedo().DoesUndo();
if( bUndo )
- ClearRedo();
+ {
+ GetIDocumentUndoRedo().ClearRedo();
+ }
// OD 30.06.2003 #108784# - replace marked 'virtual' drawing objects by
// the corresponding 'master' drawing objects.
@@ -358,7 +363,7 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView )
if( bUndo )
{
pUndo = new SwUndoDrawUnGroup( (SdrObjGroup*)pObj );
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
for ( sal_uInt16 i2 = 0; i2 < pLst->GetObjCount(); ++i2 )
@@ -403,7 +408,7 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView )
if( bUndo )
{
pUndo = new SwUndoDrawUnGroupConnectToLayout();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
while ( pFmtsAndObjs[i].size() > 0 )
@@ -442,7 +447,7 @@ sal_Bool SwDoc::DeleteSelection( SwDrawView& rDrawView )
const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList();
if( rMrkList.GetMarkCount() )
{
- StartUndo(UNDO_EMPTY, NULL);
+ GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
sal_uInt16 i;
sal_Bool bDelMarked = sal_True;
@@ -483,7 +488,9 @@ sal_Bool SwDoc::DeleteSelection( SwDrawView& rDrawView )
SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
if( !pObj->GetUpGroup() )
{
- SwUndoDrawDelete* pUndo = !DoesUndo() ? 0
+ SwUndoDrawDelete *const pUndo =
+ (!GetIDocumentUndoRedo().DoesUndo())
+ ? 0
: new SwUndoDrawDelete( (sal_uInt16)rMrkList.GetMarkCount() );
//ContactObjekte vernichten, Formate sicherstellen.
@@ -516,13 +523,15 @@ sal_Bool SwDoc::DeleteSelection( SwDrawView& rDrawView )
}
if( pUndo )
- AppendUndo( pUndo );
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
}
bCallBase = sal_True;
}
SetModified();
- EndUndo(UNDO_EMPTY, NULL);
+ GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
}
return bCallBase;
@@ -625,7 +634,7 @@ void SwDoc::InitDrawModel()
//Seite.
pDrawModel = new SwDrawDocument( this );
- pDrawModel->EnableUndo( DoesUndo() );
+ pDrawModel->EnableUndo( GetIDocumentUndoRedo().DoesUndo() );
String sLayerNm;
sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Hell" ));
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 61098176ce52..6e5c259a9d04 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -48,6 +48,7 @@
#include <cntfrm.hxx> // fuers Spell
#include <crsrsh.hxx>
#include <doc.hxx>
+#include <UndoManager.hxx>
#include <docsh.hxx>
#include <docary.hxx>
#include <doctxm.hxx> // beim Move: Verzeichnisse korrigieren
@@ -63,7 +64,12 @@
#include <swtable.hxx>
#include <swundo.hxx> // fuer die UndoIds
#include <txtfrm.hxx>
-#include <undobj.hxx>
+#include <hints.hxx>
+#include <UndoSplitMove.hxx>
+#include <UndoRedline.hxx>
+#include <UndoOverwrite.hxx>
+#include <UndoInsert.hxx>
+#include <UndoDelete.hxx>
#include <breakit.hxx>
#include <hhcwrp.hxx>
#include <breakit.hxx>
@@ -773,8 +779,10 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr )
if(!pNode)
return sal_False;
- if( DoesUndo() )
- ClearRedo();
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().ClearRedo(); // AppendUndo not always called
+ }
sal_uInt16 nOldAttrCnt = pNode->GetpSwpHints()
? pNode->GetpSwpHints()->Count() : 0;
@@ -782,8 +790,6 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr )
SwIndex& rIdx = rPt.nContent;
xub_StrLen nStart = 0;
- sal_uInt16 nUndoSize = pUndos->Count();
- SwUndo * pUndo;
sal_Unicode c;
String aStr;
@@ -799,16 +805,24 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr )
lcl_SkipAttr( pNode, rIdx, nStart );
}
c = rStr.GetChar( nCnt );
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- if( DoesGroupUndo() && nUndoSize &&
- UNDO_OVERWRITE == ( pUndo = (*pUndos)[ nUndoSize-1 ])->GetId() &&
- ((SwUndoOverwrite*)pUndo)->CanGrouping( this, rPt, c ))
- ;// wenn CanGrouping() sal_True returnt, ist schon alles erledigt
- else
+ bool bMerged(false);
+ if (GetIDocumentUndoRedo().DoesGroupUndo())
+ {
+ SwUndo *const pUndo = GetUndoManager().GetLastUndo();
+ SwUndoOverwrite *const pUndoOW(
+ dynamic_cast<SwUndoOverwrite *>(pUndo) );
+ if (pUndoOW)
+ {
+ // if CanGrouping() returns true it's already merged
+ bMerged = pUndoOW->CanGrouping( this, rPt, c );
+ }
+ }
+ if (!bMerged)
{
- AppendUndo( new SwUndoOverwrite( this, rPt, c ));
- nUndoSize = pUndos->Count();
+ SwUndo *const pUndoOW( new SwUndoOverwrite(this, rPt, c) );
+ GetIDocumentUndoRedo().AppendUndo(pUndoOW);
}
}
else
@@ -841,7 +855,8 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr )
}
}
- if( !DoesUndo() && !IsIgnoreRedline() && GetRedlineTbl().Count() )
+ if (!GetIDocumentUndoRedo().DoesUndo() &&
+ !IsIgnoreRedline() && GetRedlineTbl().Count())
{
SwPaM aPam( rPt.nNode, nStart, rPt.nNode, rPt.nContent.GetIndex() );
DeleteRedline( aPam, true, USHRT_MAX );
@@ -909,15 +924,13 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
// in a particular order, and presence of bookmarks
// will change this order. Hence, we delete bookmarks
// here without undo.
- sal_Bool bDoesUndo = DoesUndo();
- DoUndo( sal_False );
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
_DelBookmarks(
pStt->nNode,
pEnd->nNode,
NULL,
&pStt->nContent,
&pEnd->nContent);
- DoUndo( bDoesUndo );
}
@@ -926,9 +939,9 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
// falls Undo eingeschaltet, erzeuge das UndoMove-Objekt
SwUndoMove * pUndoMove = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
+ GetIDocumentUndoRedo().ClearRedo();
pUndoMove = new SwUndoMove( rPaM, rPos );
pUndoMove->SetMoveRedlines( eMvFlags == DOC_MOVEREDLINES );
}
@@ -1025,7 +1038,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
rPaM.SetMark(); // um den neuen Bereich eine Sel. aufspannen
pTNd = aSavePam.GetNode()->GetTxtNode();
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
// korrigiere erstmal den Content vom SavePam
if( bNullCntnt )
@@ -1069,7 +1082,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags )
// zwischen SPoint und GetMark steht jetzt der neu eingefuegte Bereich
pUndoMove->SetDestRange( aSavePam, *rPaM.GetPoint(),
bJoin, bCorrSavePam );
- AppendUndo( pUndoMove );
+ GetIDocumentUndoRedo().AppendUndo( pUndoMove );
}
else
{
@@ -1152,11 +1165,15 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
SwFtnIdxs aTmpFntIdx;
SwUndoMove* pUndo = 0;
- if( (DOC_CREATEUNDOOBJ & eMvFlags ) && DoesUndo() )
+ if ((DOC_CREATEUNDOOBJ & eMvFlags ) && GetIDocumentUndoRedo().DoesUndo())
+ {
pUndo = new SwUndoMove( this, rRange, rPos );
+ }
else
+ {
bUpdateFtn = lcl_SaveFtn( rRange.aStart, rRange.aEnd, rPos,
GetFtnIdxs(), aTmpFntIdx );
+ }
_SaveRedlines aSaveRedl( 0, 4 );
SvPtrarr aSavRedlInsPosArr( 0, 4 );
@@ -1246,9 +1263,8 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos,
if( pUndo )
{
- ClearRedo();
pUndo->SetDestRange( aIdx, rPos, *pSaveInsPos );
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
if( pSaveInsPos )
@@ -1359,8 +1375,7 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
// falls PageBreaks geloescht / gesetzt werden, darf das
// nicht in die Undo-History aufgenommen werden !!
// (das loeschen vom Node geht auch am Undo vorbei !!!)
- sal_Bool bDoUndo = pDoc->DoesUndo();
- pDoc->DoUndo( sal_False );
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
/* PageBreaks, PageDesc, ColumnBreaks */
// Sollte an der Logik zum Kopieren der PageBreak's ...
@@ -1412,8 +1427,6 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev )
if( aBkmkArr.Count() )
::_RestoreCntntIdx( pDoc, aBkmkArr, aIdx.GetIndex() );
- pDoc->DoUndo( bDoUndo );
-
// falls der uebergebene PaM nicht im Crsr-Ring steht,
// gesondert behandeln (z.B. Aufruf aus dem Auto-Format)
if( pOldTxtNd == rPam.GetBound( sal_True ).nContent.GetIdxReg() )
@@ -1553,21 +1566,19 @@ bool SwDoc::DeleteAndJoinWithRedlineImpl( SwPaM & rPam, const bool )
ASSERT( IsRedlineOn(), "DeleteAndJoinWithRedline: redline off" );
{
- sal_uInt16 nUndoSize = 0;
SwUndoRedlineDelete* pUndo = 0;
RedlineMode_t eOld = GetRedlineMode();
checkRedlining(eOld);
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
//JP 06.01.98: MUSS noch optimiert werden!!!
SetRedlineMode(
(RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE ));
- nUndoSize = pUndos->Count();
- StartUndo(UNDO_EMPTY, NULL);
- AppendUndo( pUndo = new SwUndoRedlineDelete( rPam, UNDO_DELETE ));
+ GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
+ pUndo = new SwUndoRedlineDelete( rPam, UNDO_DELETE );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
if( *rPam.GetPoint() != *rPam.GetMark() )
AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_DELETE, rPam ), true);
@@ -1575,18 +1586,29 @@ bool SwDoc::DeleteAndJoinWithRedlineImpl( SwPaM & rPam, const bool )
if( pUndo )
{
- EndUndo(UNDO_EMPTY, NULL);
- SwUndo* pPrevUndo;
- if( nUndoSize && DoesGroupUndo() &&
- nUndoSize + 1 == pUndos->Count() &&
- UNDO_REDLINE == ( pPrevUndo = (*pUndos)[ nUndoSize-1 ])->GetId() &&
- UNDO_DELETE == ((SwUndoRedline*)pPrevUndo)->GetUserId() &&
- ((SwUndoRedlineDelete*)pPrevUndo)->CanGrouping( *pUndo ))
+ GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
+ // ??? why the hell is the AppendUndo not below the
+ // CanGrouping, so this hideous cleanup wouldn't be necessary?
+ // bah, this is redlining, probably changing this would break it...
+ if (GetIDocumentUndoRedo().DoesGroupUndo())
{
- DoUndo( sal_False );
- pUndos->DeleteAndDestroy( nUndoSize, 1 );
- --nUndoPos, --nUndoCnt;
- DoUndo( sal_True );
+ SwUndo *const pLastUndo( GetUndoManager().GetLastUndo() );
+ SwUndoRedlineDelete *const pUndoRedlineDel(
+ dynamic_cast<SwUndoRedlineDelete*>(pLastUndo) );
+ if (pUndoRedlineDel)
+ {
+ bool const bMerged = pUndoRedlineDel->CanGrouping(*pUndo);
+ if (bMerged)
+ {
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+ SwUndo const*const pDeleted =
+ GetUndoManager().RemoveLastUndo();
+ OSL_ENSURE(pDeleted == pUndo,
+ "DeleteAndJoinWithRedlineImpl: "
+ "undo removed is not undo inserted?");
+ delete pDeleted;
+ }
+ }
}
//JP 06.01.98: MUSS noch optimiert werden!!!
SetRedlineMode( eOld );
@@ -1683,17 +1705,25 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam)
}
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- sal_uInt16 nUndoSize = pUndos->Count();
- SwUndo * pUndo;
- if( DoesGroupUndo() && nUndoSize-- &&
- UNDO_DELETE == ( pUndo = (*pUndos)[ nUndoSize ])->GetId() &&
- ((SwUndoDelete*)pUndo)->CanGrouping( this, rPam ))
- ;// wenn CanGrouping() sal_True returnt, ist schon alles erledigt
- else
- AppendUndo( new SwUndoDelete( rPam ) );
+ GetIDocumentUndoRedo().ClearRedo();
+ bool bMerged(false);
+ if (GetIDocumentUndoRedo().DoesGroupUndo())
+ {
+ SwUndo *const pLastUndo( GetUndoManager().GetLastUndo() );
+ SwUndoDelete *const pUndoDelete(
+ dynamic_cast<SwUndoDelete *>(pLastUndo) );
+ if (pUndoDelete)
+ {
+ bMerged = pUndoDelete->CanGrouping( this, rPam );
+ // if CanGrouping() returns true it's already merged
+ }
+ }
+ if (!bMerged)
+ {
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoDelete( rPam ) );
+ }
SetModified();
@@ -2316,9 +2346,9 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr,
{
RedlineMode_t eOld = GetRedlineMode();
checkRedlining(eOld);
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- StartUndo(UNDO_EMPTY, NULL);
+ GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
// Bug 68584 - if any Redline will change (split!) the node
const ::sw::mark::IMark* pBkmk = getIDocumentMarkAccess()->makeMark( aDelPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK );
@@ -2398,15 +2428,19 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr,
InsertItemSet( aTmpRange, aSet, 0 );
}
- if( DoesUndo() )
- AppendUndo( new SwUndoRedlineDelete( aDelPam, UNDO_REPLACE ));
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndoRD =
+ new SwUndoRedlineDelete( aDelPam, UNDO_REPLACE );
+ GetIDocumentUndoRedo().AppendUndo(pUndoRD);
+ }
AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_DELETE, aDelPam ), true);
*rPam.GetMark() = *aDelPam.GetMark();
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
*aDelPam.GetPoint() = *rPam.GetPoint();
- EndUndo(UNDO_EMPTY, NULL);
+ GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
// Bug 68584 - if any Redline will change (split!) the node
const ::sw::mark::IMark* pBkmk = getIDocumentMarkAccess()->makeMark( aDelPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK );
@@ -2433,21 +2467,13 @@ SetRedlineMode( eOld );
DeleteRedline( aDelPam, true, USHRT_MAX );
SwUndoReplace* pUndoRpl = 0;
- if( DoesUndo() )
+ bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo();
+ if (bDoesUndo)
{
- ClearRedo();
- SwUndo* pU;
-
- if( !pUndos->Count() ||
- UNDO_REPLACE != ( pU = (*pUndos)[ pUndos->Count()-1 ])->GetId() ||
- ( pUndoRpl = (SwUndoReplace*)pU )->IsFull() )
- {
- pUndoRpl = new SwUndoReplace();
- AppendUndo( pUndoRpl );
- }
- pUndoRpl->AddEntry( aDelPam, sRepl, bRegExReplace );
- DoUndo( sal_False );
+ pUndoRpl = new SwUndoReplace(aDelPam, sRepl, bRegExReplace);
+ GetIDocumentUndoRedo().AppendUndo(pUndoRpl);
}
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
if( aDelPam.GetPoint() != pStt )
aDelPam.Exchange();
@@ -2500,8 +2526,7 @@ SetRedlineMode( eOld );
if( pUndoRpl )
{
- pUndoRpl->SetEntryEnd( rPam );
- DoUndo( sal_True );
+ pUndoRpl->SetEnd(rPam);
}
}
}
@@ -2532,8 +2557,10 @@ bool SwDoc::DelFullPara( SwPaM& rPam )
if ( nSectDiff-2 <= nNodeDiff || IsRedlineOn() ||
/* #i9185# Prevent getting the node after the end node (see below) */
- rEnd.nNode.GetIndex() + 1 == aNodes.Count() )
+ rEnd.nNode.GetIndex() + 1 == GetNodes().Count() )
+ {
return sal_False;
+ }
// harte SeitenUmbrueche am nachfolgenden Node verschieben
sal_Bool bSavePageBreak = sal_False, bSavePageDesc = sal_False;
@@ -2541,7 +2568,7 @@ bool SwDoc::DelFullPara( SwPaM& rPam )
/* #i9185# This whould lead to a segmentation fault if not catched
above. */
sal_uLong nNextNd = rEnd.nNode.GetIndex() + 1;
- SwTableNode* pTblNd = aNodes[ nNextNd ]->GetTableNode();
+ SwTableNode *const pTblNd = GetNodes()[ nNextNd ]->GetTableNode();
if( pTblNd && pNd->IsCntntNode() )
{
@@ -2570,7 +2597,7 @@ bool SwDoc::DelFullPara( SwPaM& rPam )
}
}
- sal_Bool bDoesUndo = DoesUndo();
+ bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo();
if( bDoesUndo )
{
if( !rPam.HasMark() )
@@ -2585,7 +2612,7 @@ bool SwDoc::DelFullPara( SwPaM& rPam )
pTmpNode = rPam.GetMark()->nNode.GetNode().GetCntntNode();
rPam.GetMark()->nContent.Assign( pTmpNode, 0 );
- ClearRedo();
+ GetIDocumentUndoRedo().ClearRedo();
SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() );
{
@@ -2602,7 +2629,7 @@ bool SwDoc::DelFullPara( SwPaM& rPam )
*rPam.GetPoint() = *aDelPam.GetPoint();
pUndo->SetPgBrkFlags( bSavePageBreak, bSavePageDesc );
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
else
{
@@ -2660,11 +2687,9 @@ void SwDoc::TransliterateText(
const SwPaM& rPaM,
utl::TransliterationWrapper& rTrans )
{
- SwUndoTransliterate* pUndo;
- if( DoesUndo() )
- pUndo = new SwUndoTransliterate( rPaM, rTrans );
- else
- pUndo = 0;
+ SwUndoTransliterate *const pUndo = (GetIDocumentUndoRedo().DoesUndo())
+ ? new SwUndoTransliterate( rPaM, rTrans )
+ : 0;
const SwPosition* pStt = rPaM.Start(),
* pEnd = rPaM.End();
@@ -2722,8 +2747,7 @@ void SwDoc::TransliterateText(
{
if( pUndo->HasData() )
{
- ClearRedo();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
else
delete pUndo;
diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx
index ff0de7de7dff..28d41e9e5364 100644
--- a/sw/source/core/doc/docfld.cxx
+++ b/sw/source/core/doc/docfld.cxx
@@ -43,6 +43,7 @@
#include <unotools/charclass.hxx>
#include <unotools/transliterationwrapper.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <cntfrm.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
@@ -69,9 +70,7 @@
#include <authfld.hxx>
#include <txtinet.hxx>
#include <fmtcntnt.hxx>
-#ifndef _POOLFMT_HRC
#include <poolfmt.hrc> // fuer InitFldTypes
-#endif
#include <SwUndoField.hxx>
@@ -2725,13 +2724,14 @@ bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld,
if (pDstFld->GetTyp()->Which() ==
rSrcFld.GetTyp()->Which())
{
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
SwPosition aPosition( pDstTxtFld->GetTxtNode() );
aPosition.nContent = *pDstTxtFld->GetStart();
- AppendUndo(new SwUndoFieldFromDoc(aPosition, *pDstFld, rSrcFld,
- pMsgHnt, bUpdateFlds));
+ SwUndo *const pUndo( new SwUndoFieldFromDoc(
+ aPosition, *pDstFld, rSrcFld, pMsgHnt, bUpdateFlds) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
// Das gefundene Feld wird angepasst ...
@@ -2818,8 +2818,12 @@ bool SwDoc::PutValueToField(const SwPosition & rPos,
SwField * pField = GetField(rPos);
- if (DoesUndo() && pField->QueryValue(aOldVal, nWhich))
- AppendUndo(new SwUndoFieldFromAPI(rPos, aOldVal, rVal, nWhich));
+ if (GetIDocumentUndoRedo().DoesUndo() &&
+ pField->QueryValue(aOldVal, nWhich))
+ {
+ SwUndo *const pUndo(new SwUndoFieldFromAPI(rPos, aOldVal, rVal, nWhich));
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
return pField->PutValue(rVal, nWhich);
}
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index ea79b22bb68c..2ce2d7969589 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -28,7 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
#include <hintids.hxx>
#include <svl/itemiter.hxx>
#include <svx/svdobj.hxx>
@@ -43,6 +42,7 @@
#include <ndgrf.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <ndindex.hxx>
#include <docary.hxx>
#include <fmtcntnt.hxx>
@@ -61,7 +61,8 @@
#include <swundo.hxx>
#include <swtable.hxx>
#include <crstate.hxx>
-#include <undobj.hxx>
+#include <UndoCore.hxx>
+#include <UndoAttribute.hxx>
#include <fmtcnct.hxx>
#include <dflyobj.hxx>
@@ -389,34 +390,26 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, sal_Bool bNew
return MAKEFRMS;
}
-sal_Bool SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet )
+static bool
+lcl_SetFlyFrmAttr(SwDoc & rDoc,
+ sal_Int8 (SwDoc::*pSetFlyFrmAnchor)(SwFrmFmt &, SfxItemSet &, BOOL),
+ SwFrmFmt & rFlyFmt, SfxItemSet & rSet)
{
- if( !rSet.Count() )
- return sal_False;
-
- ::std::auto_ptr<SwUndoFmtAttrHelper> pSaveUndo;
- const bool bDoesUndo = DoesUndo();
-
- if( DoesUndo() )
- {
- ClearRedo();
- pSaveUndo.reset( new SwUndoFmtAttrHelper( rFlyFmt ) );
- // --> FME 2004-10-13 #i32968#
- // Inserting columns in the frame causes MakeFrmFmt to put two
- // objects of type SwUndoFrmFmt on the undo stack. We don't want them.
- DoUndo( sal_False );
- // <--
- }
+ // #i32968# Inserting columns in the frame causes MakeFrmFmt to put two
+ // objects of type SwUndoFrmFmt on the undo stack. We don't want them.
+ ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
//Ist das Ankerattribut dabei? Falls ja ueberlassen wir die Verarbeitung
//desselben einer Spezialmethode. Sie Returnt sal_True wenn der Fly neu
//erzeugt werden muss (z.B. weil ein Wechsel des FlyTyps vorliegt).
- sal_Int8 nMakeFrms = SFX_ITEM_SET == rSet.GetItemState( RES_ANCHOR, sal_False )?
- SetFlyFrmAnchor( rFlyFmt, rSet, sal_False ) : DONTMAKEFRMS;
+ sal_Int8 const nMakeFrms =
+ (SFX_ITEM_SET == rSet.GetItemState( RES_ANCHOR, FALSE ))
+ ? (rDoc.*pSetFlyFrmAnchor)( rFlyFmt, rSet, FALSE )
+ : DONTMAKEFRMS;
const SfxPoolItem* pItem;
SfxItemIter aIter( rSet );
- SfxItemSet aTmpSet( GetAttrPool(), aFrmFmtSetRange );
+ SfxItemSet aTmpSet( rDoc.GetAttrPool(), aFrmFmtSetRange );
sal_uInt16 nWhich = aIter.GetCurItem()->Which();
do {
switch( nWhich )
@@ -426,7 +419,7 @@ sal_Bool SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet )
case RES_PAGEDESC:
case RES_CNTNT:
case RES_FOOTER:
- ASSERT( !this, ":-) Unbekanntes Attribut fuer Fly." );
+ OSL_ENSURE(false, ":-) unknown Attribute for Fly.");
// kein break;
case RES_CHAIN:
rSet.ClearItem( nWhich );
@@ -454,21 +447,36 @@ sal_Bool SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet )
if( MAKEFRMS == nMakeFrms )
rFlyFmt.MakeFrms();
- if ( pSaveUndo.get() )
+ return aTmpSet.Count() || MAKEFRMS == nMakeFrms;
+}
+
+BOOL SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet )
+{
+ if( !rSet.Count() )
+ return FALSE;
+
+ ::std::auto_ptr<SwUndoFmtAttrHelper> pSaveUndo;
+
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- // --> FME 2004-10-13 #i32968#
- DoUndo( bDoesUndo );
- // <--
+ GetIDocumentUndoRedo().ClearRedo(); // AppendUndo far below, so leave it
+ pSaveUndo.reset( new SwUndoFmtAttrHelper( rFlyFmt ) );
+ }
+
+ bool const bRet =
+ lcl_SetFlyFrmAttr(*this, &SwDoc::SetFlyFrmAnchor, rFlyFmt, rSet);
+ if ( pSaveUndo.get() )
+ {
if ( pSaveUndo->GetUndo() )
{
- AppendUndo( pSaveUndo->ReleaseUndo() );
+ GetIDocumentUndoRedo().AppendUndo( pSaveUndo->ReleaseUndo() );
}
}
SetModified();
- return aTmpSet.Count() || MAKEFRMS == nMakeFrms;
+ return bRet;
}
// --> OD 2009-07-20 #i73249#
@@ -480,13 +488,11 @@ void SwDoc::SetFlyFrmTitle( SwFlyFrmFmt& rFlyFrmFmt,
return;
}
- const bool bFormerIsNoDrawUndoObj( IsNoDrawUndoObj() );
- SetNoDrawUndoObj( true );
+ ::sw::DrawUndoGuard const drawUndoGuard(GetIDocumentUndoRedo());
- if ( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt,
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt,
UNDO_FLYFRMFMT_TITLE,
rFlyFrmFmt.GetObjTitle(),
sNewTitle ) );
@@ -494,8 +500,6 @@ void SwDoc::SetFlyFrmTitle( SwFlyFrmFmt& rFlyFrmFmt,
rFlyFrmFmt.SetObjTitle( sNewTitle, true );
- SetNoDrawUndoObj( bFormerIsNoDrawUndoObj );
-
SetModified();
}
@@ -507,13 +511,11 @@ void SwDoc::SetFlyFrmDescription( SwFlyFrmFmt& rFlyFrmFmt,
return;
}
- const bool bFormerIsNoDrawUndoObj( IsNoDrawUndoObj() );
- SetNoDrawUndoObj( true );
+ ::sw::DrawUndoGuard const drawUndoGuard(GetIDocumentUndoRedo());
- if ( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt,
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt,
UNDO_FLYFRMFMT_DESCRIPTION,
rFlyFrmFmt.GetObjDescription(),
sNewDescription ) );
@@ -521,8 +523,6 @@ void SwDoc::SetFlyFrmDescription( SwFlyFrmFmt& rFlyFrmFmt,
rFlyFrmFmt.SetObjDescription( sNewDescription, true );
- SetNoDrawUndoObj( bFormerIsNoDrawUndoObj );
-
SetModified();
}
// <--
@@ -544,17 +544,17 @@ sal_Bool SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt,
const SwFmtHoriOrient aHori( rFmt.GetHoriOrient() );
SwUndoSetFlyFmt* pUndo = 0;
- if( DoesUndo() )
+ bool const bUndo = GetIDocumentUndoRedo().DoesUndo();
+ if (bUndo)
{
- ClearRedo();
- AppendUndo( pUndo = new SwUndoSetFlyFmt( rFmt, rNewFmt ) );
- // --> FME 2004-10-13 #i32968#
- // Inserting columns in the section causes MakeFrmFmt to put two
- // objects of type SwUndoFrmFmt on the undo stack. We don't want them.
- DoUndo( sal_False );
- // <--
+ pUndo = new SwUndoSetFlyFmt( rFmt, rNewFmt );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
+ // #i32968# Inserting columns in the section causes MakeFrmFmt to put
+ // 2 objects of type SwUndoFrmFmt on the undo stack. We don't want them.
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
//Erstmal die Spalten setzen, sonst gibts nix als Aerger mit dem
//Set/Reset/Abgleich usw.
const SfxPoolItem* pItem;
@@ -621,11 +621,6 @@ sal_Bool SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt,
SetModified();
- // --> FME 2004-10-13 #i32968#
- if ( pUndo )
- DoUndo( sal_True );
- // <--
-
return bChgAnchor;
}
@@ -660,7 +655,7 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
return false;
}
- StartUndo( UNDO_INSATTR, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_INSATTR, NULL );
sal_Bool bUnmark = sal_False;
for ( sal_uInt16 i = 0; i < _rMrkList.GetMarkCount(); ++i )
@@ -891,7 +886,7 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
}
}
- EndUndo( UNDO_END, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
SetModified();
return bUnmark;
@@ -1007,7 +1002,7 @@ int SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest )
int nErr = Chainable( rSource, rDest );
if ( !nErr )
{
- StartUndo( UNDO_CHAINE, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_CHAINE, NULL );
SwFlyFrmFmt& rDestFmt = (SwFlyFrmFmt&)rDest;
@@ -1041,7 +1036,7 @@ int SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest )
}
SetAttr( aSet, rSource );
- EndUndo( UNDO_CHAINE, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_CHAINE, NULL );
}
return nErr;
}
@@ -1053,14 +1048,14 @@ void SwDoc::Unchain( SwFrmFmt &rFmt )
SwFmtChain aChain( rFmt.GetChain() );
if ( aChain.GetNext() )
{
- StartUndo( UNDO_UNCHAIN, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_UNCHAIN, NULL );
SwFrmFmt *pFollow = aChain.GetNext();
aChain.SetNext( 0 );
SetAttr( aChain, rFmt );
aChain = pFollow->GetChain();
aChain.SetPrev( 0 );
SetAttr( aChain, *pFollow );
- EndUndo( UNDO_UNCHAIN, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_UNCHAIN, NULL );
}
}
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 663cca144989..eb23ffa1bf1c 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -54,12 +54,14 @@
#include <fmtcntnt.hxx>
#include <frmatr.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <rootfrm.hxx>
#include <pagefrm.hxx>
#include <hints.hxx> // fuer SwHyphenBug (in SetDefault)
#include <ndtxt.hxx>
#include <pam.hxx>
-#include <undobj.hxx>
+#include <UndoCore.hxx>
+#include <UndoAttribute.hxx>
#include <ndgrf.hxx>
#include <pagedesc.hxx> // Fuer Sonderbehandlung in InsFrmFmt
#include <rolbck.hxx> // Undo-Attr
@@ -357,12 +359,11 @@ void SwDoc::RstTxtAttrs(const SwPaM &rRg, sal_Bool bInclRefToxMark )
{
SwHistory* pHst = 0;
SwDataChanged aTmp( rRg, 0 );
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
SwUndoResetAttr* pUndo = new SwUndoResetAttr( rRg, RES_CHRFMT );
pHst = &pUndo->GetHistory();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
ParaRstFmt aPara( pStt, pEnd, pHst );
@@ -441,9 +442,8 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
}
// <--
SwHistory* pHst = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
SwUndoResetAttr* pUndo = new SwUndoResetAttr( rRg,
static_cast<sal_uInt16>(bTxtAttr ? RES_CONDTXTFMTCOLL : RES_TXTFMTCOLL ));
if( pAttrs && pAttrs->Count() )
@@ -451,7 +451,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
pUndo->SetAttrs( *pAttrs );
}
pHst = &pUndo->GetHistory();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
const SwPosition *pStt = pPam->Start(), *pEnd = pPam->End();
@@ -1125,9 +1125,9 @@ bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt,
{
SwDataChanged aTmp( rRg, 0 );
SwUndoAttr* pUndoAttr = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
+ GetIDocumentUndoRedo().ClearRedo();
pUndoAttr = new SwUndoAttr( rRg, rHt, nFlags );
}
@@ -1135,8 +1135,10 @@ bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt,
aSet.Put( rHt );
bool bRet = lcl_InsAttr( this, rRg, aSet, nFlags, pUndoAttr );
- if( DoesUndo() )
- AppendUndo( pUndoAttr );
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndoAttr );
+ }
if( bRet )
SetModified();
@@ -1148,16 +1150,18 @@ bool SwDoc::InsertItemSet ( const SwPaM &rRg, const SfxItemSet &rSet,
{
SwDataChanged aTmp( rRg, 0 );
SwUndoAttr* pUndoAttr = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
+ GetIDocumentUndoRedo().ClearRedo();
pUndoAttr = new SwUndoAttr( rRg, rSet, nFlags );
}
bool bRet = lcl_InsAttr( this, rRg, rSet, nFlags, pUndoAttr );
- if( DoesUndo() )
- AppendUndo( pUndoAttr );
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndoAttr );
+ }
if( bRet )
SetModified();
@@ -1179,14 +1183,17 @@ void SwDoc::SetAttr( const SfxPoolItem& rAttr, SwFmt& rFmt )
// das alte in die Undo-History aufgenommen
void SwDoc::SetAttr( const SfxItemSet& rSet, SwFmt& rFmt )
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
SwUndoFmtAttrHelper aTmp( rFmt );
rFmt.SetFmtAttr( rSet );
if ( aTmp.GetUndo() )
{
- AppendUndo( aTmp.ReleaseUndo() );
+ GetIDocumentUndoRedo().AppendUndo( aTmp.ReleaseUndo() );
+ }
+ else
+ {
+ GetIDocumentUndoRedo().ClearRedo();
}
}
else
@@ -1200,16 +1207,18 @@ void SwDoc::SetAttr( const SfxItemSet& rSet, SwFmt& rFmt )
void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId,
SwFmt& rChangedFormat )
{
- SwUndo* pUndo = 0;
- if ( DoesUndo() )
- pUndo = new SwUndoFmtResetAttr( rChangedFormat, nWhichId );
+ SwUndo *const pUndo = (GetIDocumentUndoRedo().DoesUndo())
+ ? new SwUndoFmtResetAttr( rChangedFormat, nWhichId )
+ : 0;
const sal_Bool bAttrReset = rChangedFormat.ResetFmtAttr( nWhichId );
if ( bAttrReset )
{
if ( pUndo )
- AppendUndo( pUndo );
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
SetModified();
}
@@ -1326,10 +1335,9 @@ void SwDoc::SetDefault( const SfxItemSet& rSet )
if( aNew.Count() && aCallMod.GetDepends() )
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoDefaultAttr( aOld ) );
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoDefaultAttr( aOld ) );
}
const SfxPoolItem* pTmpItem;
@@ -1396,12 +1404,12 @@ void SwDoc::DelCharFmt(sal_uInt16 nFmt, sal_Bool bBroadcast)
BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_CHAR,
SFX_STYLESHEET_ERASED);
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
SwUndo * pUndo =
new SwUndoCharFmtDelete(pDel, this);
- AppendUndo(pUndo);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
pCharFmtTbl->DeleteAndDestroy(nFmt);
@@ -1438,11 +1446,11 @@ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, sal_Bool bBroadcast )
SFX_STYLE_FAMILY_FRAME,
SFX_STYLESHEET_ERASED);
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
SwUndo * pUndo = new SwUndoFrmFmtDelete(pFmt, this);
- AppendUndo(pUndo);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
pFrmFmtTbl->DeleteAndDestroy( nPos );
@@ -1491,8 +1499,13 @@ sal_uInt16 SwDoc::GetTblFrmFmtCount(sal_Bool bUsed) const
sal_uInt16 nCount = pTblFrmFmtTbl->Count();
if(bUsed)
{
+<<<<<<< local
SwAutoFmtGetDocNode aGetHt( &aNodes );
for ( sal_uInt16 i = nCount; i; )
+=======
+ SwAutoFmtGetDocNode aGetHt( &GetNodes() );
+ for ( USHORT i = nCount; i; )
+>>>>>>> other
{
if((*pTblFrmFmtTbl)[--i]->GetInfo( aGetHt ))
@@ -1509,9 +1522,14 @@ SwFrmFmt& SwDoc::GetTblFrmFmt(sal_uInt16 nFmt, sal_Bool bUsed ) const
sal_uInt16 nRemoved = 0;
if(bUsed)
{
+<<<<<<< local
SwAutoFmtGetDocNode aGetHt( &aNodes );
for ( sal_uInt16 i = 0; i <= nFmt; i++ )
+=======
+ SwAutoFmtGetDocNode aGetHt( &GetNodes() );
+ for ( USHORT i = 0; i <= nFmt; i++ )
+>>>>>>> other
{
while ( (*pTblFrmFmtTbl)[ i + nRemoved]->GetInfo( aGetHt ))
{
@@ -1548,11 +1566,11 @@ SwFrmFmt *SwDoc::MakeFrmFmt(const String &rFmtName,
BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA,
SFX_STYLESHEET_CREATED);
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
SwUndo * pUndo = new SwUndoFrmFmtCreate(pFmt, pDerivedFrom, this);
- AppendUndo(pUndo);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
}
@@ -1581,11 +1599,11 @@ SwCharFmt *SwDoc::MakeCharFmt( const String &rFmtName,
pFmt->SetAuto( sal_False );
SetModified();
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
SwUndo * pUndo = new SwUndoCharFmtCreate(pFmt, pDerivedFrom, this);
- AppendUndo(pUndo);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
if (bBroadcast)
@@ -1624,11 +1642,11 @@ SwTxtFmtColl* SwDoc::MakeTxtFmtColl( const String &rFmtName,
pFmtColl->SetAuto( sal_False );
SetModified();
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
SwUndo * pUndo = new SwUndoTxtFmtCollCreate(pFmtColl, pDerivedFrom,
this);
- AppendUndo(pUndo);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
if (bBroadcast)
@@ -1693,12 +1711,12 @@ void SwDoc::DelTxtFmtColl(sal_uInt16 nFmtColl, sal_Bool bBroadcast)
BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_PARA,
SFX_STYLESHEET_ERASED);
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
SwUndoTxtFmtCollDelete * pUndo =
new SwUndoTxtFmtCollDelete(pDel, this);
- AppendUndo(pUndo);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
// Die FmtColl austragen
@@ -1807,16 +1825,15 @@ sal_Bool SwDoc::SetTxtFmtColl( const SwPaM &rRg,
SwHistory* pHst = 0;
sal_Bool bRet = sal_True;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
// --> OD 2008-04-15 #refactorlists#
SwUndoFmtColl* pUndo = new SwUndoFmtColl( rRg, pFmt,
bReset,
bResetListAttrs );
// <--
pHst = pUndo->GetHistory();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
ParaRstFmt aPara( pStt, pEnd, pHst );
@@ -2261,8 +2278,12 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
void SwDoc::ReplaceStyles( SwDoc& rSource )
{
+<<<<<<< local
sal_Bool bIsUndo = DoesUndo();
DoUndo( sal_False );
+=======
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+>>>>>>> other
CopyFmtArr( *rSource.pCharFmtTbl, *pCharFmtTbl,
&SwDoc::_MakeCharFmt, *pDfltCharFmt );
@@ -2313,15 +2334,13 @@ void SwDoc::ReplaceStyles( SwDoc& rSource )
}
}
- if( bIsUndo )
+ if (undoGuard.UndoWasEnabled())
{
- // es wurde am Nodes-Array gedreht!
- ClearRedo();
- DelAllUndoObj();
+ // nodes array was modified!
+ GetIDocumentUndoRedo().DelAllUndoObj();
}
SetModified();
- DoUndo( bIsUndo );
}
SwFmt* SwDoc::FindFmtByName( const SvPtrarr& rFmtArr,
@@ -2343,13 +2362,12 @@ SwFmt* SwDoc::FindFmtByName( const SvPtrarr& rFmtArr,
void SwDoc::MoveLeftMargin( const SwPaM& rPam, sal_Bool bRight, sal_Bool bModulus )
{
SwHistory* pHistory = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
SwUndoMoveLeftMargin* pUndo = new SwUndoMoveLeftMargin( rPam, bRight,
bModulus );
pHistory = &pUndo->GetHistory();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
const SvxTabStopItem& rTabItem = (SvxTabStopItem&)GetDefault( RES_PARATR_TABSTOP );
@@ -2409,10 +2427,9 @@ sal_Bool SwDoc::DontExpandFmt( const SwPosition& rPos, sal_Bool bFlag )
if( pTxtNd )
{
bRet = pTxtNd->DontExpandFmt( rPos.nContent, bFlag );
- if( bRet && DoesUndo() )
+ if( bRet && GetIDocumentUndoRedo().DoesUndo() )
{
- ClearRedo();
- AppendUndo( new SwUndoDontExpandFmt( rPos ));
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoDontExpandFmt(rPos) );
}
}
return bRet;
@@ -2560,7 +2577,7 @@ void SwDoc::SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& rSet )
void SwDoc::ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet)
{
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
// copying <rSet> to <aSet>
SfxItemSet aSet(rSet);
@@ -2588,7 +2605,7 @@ void SwDoc::ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet)
SwUndo * pUndo = new SwUndoFmtAttr(aOldSet, rFmt);
- AppendUndo(pUndo);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
rFmt.SetFmtAttr(rSet);
@@ -2599,7 +2616,7 @@ void SwDoc::RenameFmt(SwFmt & rFmt, const String & sNewName,
{
SfxStyleFamily eFamily = SFX_STYLE_FAMILY_ALL;
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
SwUndo * pUndo = NULL;
@@ -2623,7 +2640,9 @@ void SwDoc::RenameFmt(SwFmt & rFmt, const String & sNewName,
}
if (pUndo)
- AppendUndo(pUndo);
+ {
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
}
rFmt.SetName(sNewName);
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index 4ee3811ec4a2..80798546d041 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -36,9 +36,11 @@
#include <pam.hxx>
#include <pagedesc.hxx>
#include <charfmt.hxx>
-#include <undobj.hxx>
+#include <UndoAttribute.hxx>
+#include <hints.hxx>
#include <rolbck.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <ndtxt.hxx>
#include <poolfmt.hxx>
#include <ftninfo.hxx>
@@ -259,10 +261,9 @@ void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo)
{
const SwFtnInfo &rOld = GetFtnInfo();
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoFootNoteInfo( rOld ) );
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoFootNoteInfo(rOld) );
}
sal_Bool bFtnPos = rInfo.ePos != rOld.ePos;
@@ -326,10 +327,10 @@ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
{
if( !(GetEndNoteInfo() == rInfo) )
{
- if( DoesUndo() )
+ if(GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoEndNoteInfo( GetEndNoteInfo() ) );
+ SwUndo *const pUndo( new SwUndoEndNoteInfo( GetEndNoteInfo() ) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
sal_Bool bNumChg = rInfo.nFtnOffset != GetEndNoteInfo().nFtnOffset;
@@ -403,9 +404,9 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr,
rFtnArr.SeekEntry( pStt->nNode, &nPos );
SwUndoChangeFootNote* pUndo = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
+ GetIDocumentUndoRedo().ClearRedo(); // AppendUndo far below, so leave it
pUndo = new SwUndoChangeFootNote( rPam, rNumStr, nNumber, bIsEndNote );
}
@@ -479,8 +480,7 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr,
{
if( pUndo )
{
- ClearRedo();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
if ( bTypeChgd )
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index 903fb8473fca..d31bc4df722a 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -43,6 +43,7 @@
#include <fmtinfmt.hxx>
#include <fmtanchr.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
@@ -181,7 +182,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath,
return sal_False;
// Undo/Redline aufjedenfall abschalten
- DoUndo( sal_False );
+ GetIDocumentUndoRedo().DoUndo(false);
SetRedlineMode_intern( (RedlineMode_t)(GetRedlineMode() & ~nsRedlineMode_t::REDLINE_ON));
String sExt( pFilter->GetSuffixes().GetToken(0, ',') );
@@ -542,7 +543,7 @@ sal_Bool SwDoc::SplitDoc( sal_uInt16 eDocType, const String& rPath, int nOutline
return sal_False;
// Undo/Redline aufjedenfall abschalten
- DoUndo( sal_False );
+ GetIDocumentUndoRedo().DoUndo(false);
SetRedlineMode_intern( (RedlineMode_t)(GetRedlineMode() & ~nsRedlineMode_t::REDLINE_ON));
String sExt( pFilter->GetSuffixes().GetToken(0, ',') );
diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx
index c95f7ddad010..610a8fb170b8 100644
--- a/sw/source/core/doc/docglos.cxx
+++ b/sw/source/core/doc/docglos.cxx
@@ -28,8 +28,13 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <shellio.hxx>
#include <pam.hxx>
#include <swundo.hxx>
@@ -38,11 +43,6 @@
#include <crsrsh.hxx>
#include <docsh.hxx>
-#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-#include <com/sun/star/document/XDocumentProperties.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/XPropertySetInfo.hpp>
-
using namespace ::com::sun::star;
@@ -160,7 +160,7 @@ sal_Bool SwDoc::InsertGlossary( SwTextBlocks& rBlock, const String& rEntry,
pCntntNd = aCpyPam.GetCntntNode();
aCpyPam.GetPoint()->nContent.Assign( pCntntNd, pCntntNd->Len() );
- StartUndo( UNDO_INSGLOSSARY, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_INSGLOSSARY, NULL );
SwPaM *_pStartCrsr = &rPaM, *__pStartCrsr = _pStartCrsr;
do {
@@ -187,7 +187,7 @@ sal_Bool SwDoc::InsertGlossary( SwTextBlocks& rBlock, const String& rEntry,
pShell->SaveTblBoxCntnt( &rInsPos );
} while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) !=
__pStartCrsr );
- EndUndo( UNDO_INSGLOSSARY, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL );
UnlockExpFlds();
if( !IsExpFldsLocked() )
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index da1b64aed389..20090fdb1a6a 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -75,6 +75,7 @@
#include <ndnotxt.hxx>
#include <ndole.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <rootfrm.hxx>
#include <pagefrm.hxx>
#include <cntfrm.hxx>
@@ -85,7 +86,7 @@
#include <dcontact.hxx>
#include <swundo.hxx>
#include <flypos.hxx>
-#include <undobj.hxx>
+#include <UndoInsert.hxx>
#include <expfld.hxx> // InsertLabel
#include <poolfmt.hxx> // PoolVorlagen-Id's
#include <docary.hxx>
@@ -197,10 +198,10 @@ SwFrmFmt *SwDoc::MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet )
if( pSet ) // noch ein paar Attribute setzen ?
pFmt->SetFmtAttr( *pSet );
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoInsLayFmt( pFmt,0,0 ));
+ GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoInsLayFmt(pFmt, 0, 0));
}
}
break;
@@ -253,7 +254,7 @@ void SwDoc::DelLayoutFmt( SwFrmFmt *pFmt )
}
const SwNodeIndex* pCntIdx = pFmt->GetCntnt().GetCntntIdx();
- if( pCntIdx && !DoesUndo() )
+ if (pCntIdx && !GetIDocumentUndoRedo().DoesUndo())
{
//Verbindung abbauen, falls es sich um ein OLE-Objekt handelt.
SwOLENode* pOLENd = GetNodes()[ pCntIdx->GetIndex()+1 ]->GetOLENode();
@@ -295,11 +296,10 @@ void SwDoc::DelLayoutFmt( SwFrmFmt *pFmt )
// erstmal sind nur Fly's Undofaehig
const sal_uInt16 nWh = pFmt->Which();
- if( DoesUndo() && (RES_FLYFRMFMT == nWh || RES_DRAWFRMFMT == nWh) )
+ if (GetIDocumentUndoRedo().DoesUndo() &&
+ (RES_FLYFRMFMT == nWh || RES_DRAWFRMFMT == nWh))
{
- // erstmal werden alle Undo - Objecte geloescht.
- ClearRedo();
- AppendUndo( new SwUndoDelLayFmt( pFmt ));
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoDelLayFmt( pFmt ));
}
else
{
@@ -494,10 +494,9 @@ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource,
}
}
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoInsLayFmt( pDest,0,0 ));
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoInsLayFmt(pDest,0,0));
}
// sorge dafuer das auch Fly's in Fly's kopiert werden
@@ -536,10 +535,9 @@ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource,
else
pDest->SetFmtAttr( rNewAnchor );
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoInsLayFmt( pDest,0,0 ));
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoInsLayFmt(pDest,0,0));
}
}
@@ -729,12 +727,12 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos,
if( GetRootFrm() )
pFmt->MakeFrms(); // ???
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
sal_uLong nNodeIdx = rAnchPos.nNode.GetIndex();
xub_StrLen nCntIdx = rAnchPos.nContent.GetIndex();
- AppendUndo( new SwUndoInsLayFmt( pFmt, nNodeIdx, nCntIdx ));
+ GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoInsLayFmt( pFmt, nNodeIdx, nCntIdx ));
}
SetModified();
@@ -803,7 +801,7 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
{
SwFmtAnchor& rAnch = (SwFmtAnchor&)rSet.Get( RES_ANCHOR );
- StartUndo( UNDO_INSLAYFMT, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_INSLAYFMT, NULL );
SwFlyFrmFmt* pFmt = MakeFlySection( rAnch.GetAnchorId(), rPam.GetPoint(),
&rSet, pParent );
@@ -871,8 +869,11 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
GetNodes().Delete( aIndex, 1 );
//JP erstmal ein Hack, solange keine Flys/Headers/Footers Undofaehig sind
-if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht.
- DelAllUndoObj();
+// werden erstmal alle Undo - Objecte geloescht.
+if( GetIDocumentUndoRedo().DoesUndo() )
+{
+ GetIDocumentUndoRedo().DelAllUndoObj();
+}
}
else
@@ -888,9 +889,10 @@ if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht.
*/
// copy all Pams and then delete all
SwPaM* pTmp = (SwPaM*)&rPam;
- sal_Bool bOldFlag = mbCopyIsMove, bOldUndo = mbUndo;
- mbCopyIsMove = sal_True;
- mbUndo = sal_False;
+ sal_Bool bOldFlag = mbCopyIsMove;
+ bool const bOldUndo = GetIDocumentUndoRedo().DoesUndo();
+ mbCopyIsMove = TRUE;
+ GetIDocumentUndoRedo().DoUndo(false);
do {
if( pTmp->HasMark() &&
*pTmp->GetPoint() != *pTmp->GetMark() )
@@ -900,7 +902,7 @@ if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht.
pTmp = static_cast<SwPaM*>(pTmp->GetNext());
} while ( &rPam != pTmp );
mbCopyIsMove = bOldFlag;
- mbUndo = bOldUndo;
+ GetIDocumentUndoRedo().DoUndo(bOldUndo);
pTmp = (SwPaM*)&rPam;
do {
@@ -917,7 +919,7 @@ if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht.
SetModified();
- EndUndo( UNDO_INSLAYFMT, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_INSLAYFMT, NULL );
return pFmt;
}
@@ -1016,10 +1018,9 @@ SwDrawFrmFmt* SwDoc::Insert( const SwPaM &rRg,
// <--
}
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoInsLayFmt( pFmt,0,0 ));
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoInsLayFmt(pFmt, 0, 0) );
}
SetModified();
@@ -1225,31 +1226,27 @@ void lcl_CpyAttr( SfxItemSet &rNewSet, const SfxItemSet &rOldSet, sal_uInt16 nWh
}
-SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, const String& rSeparator,
+static SwFlyFrmFmt *
+lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
+ SwUndoInsertLabel *const pUndo,
+ SwLabelType const eType, String const& rTxt, String const& rSeparator,
const String& rNumberingSeparator,
const sal_Bool bBefore, const sal_uInt16 nId, const sal_uLong nNdIdx,
const String& rCharacterStyle,
const sal_Bool bCpyBrd )
{
- sal_Bool bWasUndo = DoesUndo();
- SwUndoInsertLabel* pUndo = 0;
- if( bWasUndo )
- {
- ClearRedo();
- pUndo = new SwUndoInsertLabel( eType, rTxt, rSeparator, rNumberingSeparator,
- bBefore, nId, rCharacterStyle, bCpyBrd );
- DoUndo( sal_False );
- }
+ ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
sal_Bool bTable = sal_False; //Um etwas Code zu sparen.
//Erstmal das Feld bauen, weil ueber den Namen die TxtColl besorgt werden
//muss
- ASSERT( nId == USHRT_MAX || nId < GetFldTypes()->Count(), "FldType ueberindiziert." );
- SwFieldType *pType = nId != USHRT_MAX ? (*GetFldTypes())[nId] : NULL;
- ASSERT( !pType || pType->Which() == RES_SETEXPFLD, "Falsche Id fuer Label" );
+ OSL_ENSURE( nId == USHRT_MAX || nId < rDoc.GetFldTypes()->Count(),
+ "FldType index out of bounds." );
+ SwFieldType *pType = (nId != USHRT_MAX) ? (*rDoc.GetFldTypes())[nId] : NULL;
+ OSL_ENSURE(!pType || pType->Which() == RES_SETEXPFLD, "wrong Id for Label");
- SwTxtFmtColl *pColl = NULL;
+ SwTxtFmtColl * pColl = NULL;
if( pType )
{
for( sal_uInt16 i = pTxtFmtCollTbl->Count(); i; )
@@ -1264,7 +1261,9 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co
}
if( !pColl )
- pColl = GetTxtCollFromPool( RES_POOLCOLL_LABEL );
+ {
+ pColl = rDoc.GetTxtCollFromPool( RES_POOLCOLL_LABEL );
+ }
SwTxtNode *pNew = NULL;
SwFlyFrmFmt* pNewFmt = NULL;
@@ -1278,7 +1277,7 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co
//Am Anfang/Ende der Fly-Section den entsprechenden Node mit Feld
//einfuegen (Frame wird automatisch erzeugt).
{
- SwStartNode *pSttNd = GetNodes()[nNdIdx]->GetStartNode();
+ SwStartNode *pSttNd = rDoc.GetNodes()[nNdIdx]->GetStartNode();
ASSERT( pSttNd, "Kein StartNode in InsertLabel." );
sal_uLong nNode;
if( bBefore )
@@ -1298,8 +1297,8 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co
pUndo->SetNodePos( nNode );
//Node fuer Beschriftungsabsatz erzeugen.
- SwNodeIndex aIdx( GetNodes(), nNode );
- pNew = GetNodes().MakeTxtNode( aIdx, pColl );
+ SwNodeIndex aIdx( rDoc.GetNodes(), nNode );
+ pNew = rDoc.GetNodes().MakeTxtNode( aIdx, pColl );
}
break;
@@ -1311,12 +1310,12 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co
// Frames erzeugen.
//Erstmal das Format zum Fly besorgen und das Layout entkoppeln.
- SwFrmFmt *pOldFmt = GetNodes()[nNdIdx]->GetFlyFmt();
+ SwFrmFmt *pOldFmt = rDoc.GetNodes()[nNdIdx]->GetFlyFmt();
ASSERT( pOldFmt, "Format des Fly nicht gefunden." );
pOldFmt->DelFrms();
- pNewFmt = MakeFlyFrmFmt( GetUniqueFrameName(),
- GetFrmFmtFromPool( RES_POOLFRM_FRAME ));
+ pNewFmt = rDoc.MakeFlyFrmFmt( rDoc.GetUniqueFrameName(),
+ rDoc.GetFrmFmtFromPool(RES_POOLFRM_FRAME) );
/* #i6447#: Only the selected items are copied from the old
format. */
@@ -1374,8 +1373,8 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co
aFrmSize.SetHeightSizeType( ATT_MIN_SIZE );
pNewSet->Put( aFrmSize );
- SwStartNode* pSttNd = GetNodes().MakeTextSection(
- SwNodeIndex( GetNodes().GetEndOfAutotext() ),
+ SwStartNode* pSttNd = rDoc.GetNodes().MakeTextSection(
+ SwNodeIndex( rDoc.GetNodes().GetEndOfAutotext() ),
SwFlyStartNode, pColl );
pNewSet->Put( SwFmtCntnt( pSttNd ));
@@ -1454,7 +1453,7 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co
break;
default:
- ASSERT( !this, "Neuer LabelType?." );
+ OSL_ENSURE(false, "unknown LabelType?");
}
ASSERT( pNew, "No Label inserted" );
if( pNew )
@@ -1496,11 +1495,11 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co
pNew->InsertItem( aFmt, nIdx, nIdx );
if(rCharacterStyle.Len())
{
- SwCharFmt* pCharFmt = FindCharFmtByName( rCharacterStyle );
+ SwCharFmt* pCharFmt = rDoc.FindCharFmtByName(rCharacterStyle);
if( !pCharFmt )
{
const sal_uInt16 nMyId = SwStyleNameMapper::GetPoolIdFromUIName(rCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
- pCharFmt = GetCharFmtFromPool( nMyId );
+ pCharFmt = rDoc.GetCharFmtFromPool( nMyId );
}
if (pCharFmt)
{
@@ -1520,7 +1519,8 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co
}
else
{
- SwTableNode *pNd = GetNodes()[nNdIdx]->GetStartNode()->GetTableNode();
+ SwTableNode *const pNd =
+ rDoc.GetNodes()[nNdIdx]->GetStartNode()->GetTableNode();
SwTable &rTbl = pNd->GetTable();
if ( !rTbl.GetFrmFmt()->GetKeep().GetValue() )
rTbl.GetFrmFmt()->SetFmtAttr( SvxFmtKeepItem( sal_True, RES_KEEP ) );
@@ -1528,18 +1528,45 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co
pUndo->SetUndoKeep();
}
}
- SetModified();
+ rDoc.SetModified();
}
- if( pUndo )
- AppendUndo( pUndo );
+ return pNewFmt;
+}
+
+SwFlyFrmFmt *
+SwDoc::InsertLabel(
+ SwLabelType const eType, String const& rTxt, String const& rSeparator,
+ String const& rNumberingSeparator,
+ sal_Bool const bBefore, sal_uInt16 const nId, ULONG const nNdIdx,
+ String const& rCharacterStyle,
+ sal_Bool const bCpyBrd )
+{
+ SwUndoInsertLabel * pUndo(0);
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo = new SwUndoInsertLabel(
+ eType, rTxt, rSeparator, rNumberingSeparator,
+ bBefore, nId, rCharacterStyle, bCpyBrd );
+ }
+
+ SwFlyFrmFmt *const pNewFmt = lcl_InsertLabel(*this, pTxtFmtCollTbl, pUndo,
+ eType, rTxt, rSeparator, rNumberingSeparator, bBefore,
+ nId, nNdIdx, rCharacterStyle, bCpyBrd);
+
+ if (pUndo)
+ {
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
else
- DelAllUndoObj();
- DoUndo( bWasUndo );
+ {
+ GetIDocumentUndoRedo().DelAllUndoObj();
+ }
return pNewFmt;
}
+
/*************************************************************************
|*
|* SwDoc::InsertDrawLabel()
@@ -1549,41 +1576,25 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co
|*
|*************************************************************************/
-SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt,
+static SwFlyFrmFmt *
+lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
+ SwUndoInsertLabel *const pUndo, SwDrawFrmFmt *const pOldFmt,
+ String const& rTxt,
const String& rSeparator,
const String& rNumberSeparator,
const sal_uInt16 nId,
const String& rCharacterStyle,
SdrObject& rSdrObj )
{
-
- SwDrawContact* pContact = (SwDrawContact*)GetUserCall( &rSdrObj );
- ASSERT( RES_DRAWFRMFMT == pContact->GetFmt()->Which(),
- "Kein DrawFrmFmt" );
- if ( !pContact )
- return 0;
-
- SwDrawFrmFmt* pOldFmt = (SwDrawFrmFmt *)pContact->GetFmt();
- if( !pOldFmt )
- return 0;
-
- sal_Bool bWasUndo = DoesUndo();
- sal_Bool bWasNoDrawUndo = IsNoDrawUndoObj();
- SwUndoInsertLabel* pUndo = 0;
- if( bWasUndo )
- {
- ClearRedo();
- pUndo = new SwUndoInsertLabel(
- LTYPE_DRAW, rTxt, rSeparator, rNumberSeparator, sal_False, nId, rCharacterStyle, sal_False );
- DoUndo( sal_False );
- SetNoDrawUndoObj( sal_True );
- }
+ ::sw::UndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
+ ::sw::DrawUndoGuard const drawUndoGuard(rDoc.GetIDocumentUndoRedo());
// Erstmal das Feld bauen, weil ueber den Namen die TxtColl besorgt
// werden muss
- ASSERT( nId == USHRT_MAX || nId < GetFldTypes()->Count(), "FldType overflow" );
- SwFieldType *pType = nId != USHRT_MAX ? (*GetFldTypes())[nId] : 0;
- ASSERT( !pType || pType->Which() == RES_SETEXPFLD, "Wrong label id" );
+ OSL_ENSURE( nId == USHRT_MAX || nId < rDoc.GetFldTypes()->Count(),
+ "FldType index out of bounds" );
+ SwFieldType *pType = nId != USHRT_MAX ? (*rDoc.GetFldTypes())[nId] : 0;
+ OSL_ENSURE( !pType || pType->Which() == RES_SETEXPFLD, "Wrong label id" );
SwTxtFmtColl *pColl = NULL;
if( pType )
@@ -1600,7 +1611,9 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt,
}
if( !pColl )
- pColl = GetTxtCollFromPool( RES_POOLCOLL_LABEL );
+ {
+ pColl = rDoc.GetTxtCollFromPool( RES_POOLCOLL_LABEL );
+ }
SwTxtNode* pNew = NULL;
SwFlyFrmFmt* pNewFmt = NULL;
@@ -1639,8 +1652,8 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt,
// Den Rahmen ggf. in den Hintergrund schicken.
// OD 02.07.2003 #108784# - consider 'invisible' hell layer.
- if ( GetHellId() != nLayerId &&
- GetInvisibleHellId() != nLayerId )
+ if ( rDoc.GetHellId() != nLayerId &&
+ rDoc.GetInvisibleHellId() != nLayerId )
{
SvxOpaqueItem aOpaque( RES_OPAQUE );
aOpaque.SetValue( sal_True );
@@ -1669,11 +1682,12 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt,
pNewSet->Put( pOldFmt->GetULSpace() );
SwStartNode* pSttNd =
- GetNodes().MakeTextSection( SwNodeIndex( GetNodes().GetEndOfAutotext() ),
+ rDoc.GetNodes().MakeTextSection(
+ SwNodeIndex( rDoc.GetNodes().GetEndOfAutotext() ),
SwFlyStartNode, pColl );
- pNewFmt = MakeFlyFrmFmt( GetUniqueFrameName(),
- GetFrmFmtFromPool( RES_POOLFRM_FRAME ) );
+ pNewFmt = rDoc.MakeFlyFrmFmt( rDoc.GetUniqueFrameName(),
+ rDoc.GetFrmFmtFromPool( RES_POOLFRM_FRAME ) );
// JP 28.10.99: Bug 69487 - set border and shadow to default if the
// template contains any.
@@ -1712,11 +1726,15 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt,
pNewSet->ClearItem();
pNewSet->Put( SwFmtSurround( SURROUND_NONE ) );
- if( nLayerId == GetHellId() )
- rSdrObj.SetLayer( GetHeavenId() );
+ if (nLayerId == rDoc.GetHellId())
+ {
+ rSdrObj.SetLayer( rDoc.GetHeavenId() );
+ }
// OD 02.07.2003 #108784# - consider drawing objects in 'invisible' hell layer
- else if( nLayerId == GetInvisibleHellId() )
- rSdrObj.SetLayer( GetInvisibleHeavenId() );
+ else if (nLayerId == rDoc.GetInvisibleHellId())
+ {
+ rSdrObj.SetLayer( rDoc.GetInvisibleHeavenId() );
+ }
pNewSet->Put( SvxLRSpaceItem( RES_LR_SPACE ) );
pNewSet->Put( SvxULSpaceItem( RES_UL_SPACE ) );
@@ -1785,11 +1803,11 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt,
pNew->InsertItem( aFmt, nIdx, nIdx );
if ( rCharacterStyle.Len() )
{
- SwCharFmt* pCharFmt = FindCharFmtByName( rCharacterStyle );
+ SwCharFmt * pCharFmt = rDoc.FindCharFmtByName(rCharacterStyle);
if ( !pCharFmt )
{
const sal_uInt16 nMyId = SwStyleNameMapper::GetPoolIdFromUIName( rCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
- pCharFmt = GetCharFmtFromPool( nMyId );
+ pCharFmt = rDoc.GetCharFmtFromPool( nMyId );
}
if ( pCharFmt )
{
@@ -1801,18 +1819,54 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt,
}
}
- if( pUndo )
+ return pNewFmt;
+}
+
+SwFlyFrmFmt* SwDoc::InsertDrawLabel(
+ String const& rTxt,
+ String const& rSeparator,
+ String const& rNumberSeparator,
+ sal_uInt16 const nId,
+ String const& rCharacterStyle,
+ SdrObject& rSdrObj )
+{
+ SwDrawContact *const pContact =
+ static_cast<SwDrawContact*>(GetUserCall( &rSdrObj ));
+ OSL_ENSURE( RES_DRAWFRMFMT == pContact->GetFmt()->Which(),
+ "InsertDrawLabel(): not a DrawFrmFmt" );
+ if (!pContact)
+ return 0;
+
+ SwDrawFrmFmt* pOldFmt = (SwDrawFrmFmt *)pContact->GetFmt();
+ if (!pOldFmt)
+ return 0;
+
+ SwUndoInsertLabel * pUndo = 0;
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- AppendUndo( pUndo );
- SetNoDrawUndoObj( bWasNoDrawUndo );
+ GetIDocumentUndoRedo().ClearRedo();
+ pUndo = new SwUndoInsertLabel(
+ LTYPE_DRAW, rTxt, rSeparator, rNumberSeparator, sal_False,
+ nId, rCharacterStyle, sal_False );
+ }
+
+ SwFlyFrmFmt *const pNewFmt = lcl_InsertDrawLabel(
+ *this, pTxtFmtCollTbl, pUndo, pOldFmt,
+ rTxt, rSeparator, rNumberSeparator, nId, rCharacterStyle, rSdrObj);
+
+ if (pUndo)
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
else
- DelAllUndoObj();
- DoUndo( bWasUndo );
+ {
+ GetIDocumentUndoRedo().DelAllUndoObj();
+ }
return pNewFmt;
}
+
/*************************************************************************
|*
|* IDocumentTimerAccess-methods
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 1170a7f16337..cdf031aeb923 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -96,6 +96,7 @@
#include <IGrammarContact.hxx>
#include <tblsel.hxx>
#include <MarkManager.hxx>
+#include <UndoManager.hxx>
#include <unochart.hxx>
#include <cmdid.h> // fuer den dflt - Printer in SetJob
@@ -217,12 +218,14 @@ sal_Bool lcl_DelFmtIndizes( const SwFrmFmtPtr& rpFmt, void* )
* exportierte Methoden
*/
-SwDoc::SwDoc() :
- aNodes( this ),
- aUndoNodes( this ),
+SwDoc::SwDoc()
+ : m_pNodes( new SwNodes(this) )
+ ,
mpAttrPool(new SwAttrPool(this)),
pMarkManager(new ::sw::mark::MarkManager(*this)),
m_pMetaFieldManager(new ::sw::MetaFieldManager()),
+ m_pUndoManager(new ::sw::UndoManager(
+ ::std::auto_ptr<SwNodes>(new SwNodes(this)), *this, *this, *this)),
pDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ),
pEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, pDfltFrmFmt ) ),
pColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, pDfltFrmFmt ) ),
@@ -240,7 +243,6 @@ SwDoc::SwDoc() :
pDefTOXBases( new SwDefTOXBase_Impl() ),
pLayout( 0 ), // Rootframe des spezifischen Layouts.
pDrawModel( 0 ),
- pUndos( new SwUndos( 0, 20 ) ),
pUpdtFlds( new SwDocUpdtFld() ),
pFldTypes( new SwFldTypes() ),
pVirDev( 0 ),
@@ -281,10 +283,6 @@ SwDoc::SwDoc() :
mpListItemsList( new tImplSortedNodeNumList() ),
// <--
m_pXmlIdRegistry(),
- nUndoPos( 0 ),
- nUndoSavePos( 0 ),
- nUndoCnt( 0 ),
- nUndoSttEnd( 0 ),
nAutoFmtRedlnCommentNo( 0 ),
nLinkUpdMode( GLOBALSETTING ),
eFldUpdMode( AUTOUPD_GLOBALSETTING ),
@@ -309,13 +307,11 @@ SwDoc::SwDoc() :
mbGlossDoc =
mbModified =
mbDtor =
- mbUndo =
mbPageNums =
mbLoaded =
mbUpdateExpFld =
mbNewDoc =
mbCopyIsMove =
- mbNoDrawUndoObj =
mbBrowseMode =
mbInReading =
mbInXMLImport =
@@ -341,7 +337,6 @@ SwDoc::SwDoc() :
// <--
false;
- mbGroupUndo =
mbNewFldLst =
mbVisibleLinks =
mbPurgeOLE =
@@ -433,8 +428,10 @@ SwDoc::SwDoc() :
pOutlineRule->SetCountPhantoms( !get(IDocumentSettingAccess::OLD_NUMBERING) );
// <--
- new SwTxtNode( SwNodeIndex( aUndoNodes.GetEndOfContent() ), pDfltTxtFmtColl );
- new SwTxtNode( SwNodeIndex( aNodes.GetEndOfContent() ),
+ new SwTxtNode(
+ SwNodeIndex(GetUndoManager().GetUndoNodes().GetEndOfContent()),
+ pDfltTxtFmtColl );
+ new SwTxtNode( SwNodeIndex( GetNodes().GetEndOfContent() ),
GetTxtCollFromPool( RES_POOLCOLL_STANDARD ));
// den eigenen IdleTimer setzen
@@ -474,6 +471,14 @@ SwDoc::SwDoc() :
SwDoc::~SwDoc()
{
+ // nothing here should create Undo actions!
+ GetIDocumentUndoRedo().DoUndo(false);
+
+ if (pDocShell)
+ {
+ pDocShell->SetUndoManager(0);
+ }
+
// --> OD 2007-03-16 #i73788#
SwPauseThreadStarting aPauseThreadStarting;
// <--
@@ -522,8 +527,6 @@ SwDoc::~SwDoc()
delete pPgPViewPrtData;
- mbUndo = sal_False; // immer das Undo abschalten !!
- // damit die Fussnotenattribute die Fussnotennodes in Frieden lassen.
mbDtor = sal_True;
DELETEZ( pLayout );
@@ -549,13 +552,14 @@ SwDoc::~SwDoc()
// die KapitelNummern / Nummern muessen vor den Vorlage geloescht werden
// ansonsten wird noch staendig geupdatet !!!
- aNodes.pOutlineNds->Remove( sal_uInt16(0), aNodes.pOutlineNds->Count() );
- aUndoNodes.pOutlineNds->Remove( sal_uInt16(0), aUndoNodes.pOutlineNds->Count() );
+ m_pNodes->pOutlineNds->Remove(sal_uInt16(0), m_pNodes->pOutlineNds->Count());
+ SwNodes & rUndoNodes( GetUndoManager().GetUndoNodes() );
+ rUndoNodes.pOutlineNds->Remove(sal_uInt16(0), rUndoNodes.pOutlineNds->Count());
pFtnIdxs->Remove( sal_uInt16(0), pFtnIdxs->Count() );
- pUndos->DeleteAndDestroy( 0, pUndos->Count() ); //Es koennen in den Attributen noch
- //noch indizes angemeldet sein.
+ // indices could be registered in attributes
+ m_pUndoManager->DelAllUndoObj();
// in den BookMarks sind Indizies auf den Content. Diese muessen vorm
// loesche der Nodes geloescht werden.
@@ -598,8 +602,8 @@ SwDoc::~SwDoc()
// Inhaltssections loeschen
// nicht erst durch den SwNodes-DTOR, damit Formate
// keine Abhaengigen mehr haben.
- aNodes.DelNodes( SwNodeIndex( aNodes ), aNodes.Count() );
- aUndoNodes.DelNodes( SwNodeIndex( aUndoNodes ), aUndoNodes.Count() );
+ m_pNodes->DelNodes( SwNodeIndex(*m_pNodes), m_pNodes->Count() );
+ rUndoNodes.DelNodes( SwNodeIndex( rUndoNodes ), rUndoNodes.Count() );
// Formate loeschen, spaeter mal permanent machen.
@@ -691,7 +695,6 @@ SwDoc::~SwDoc()
delete pFtnIdxs;
delete pFldTypes;
delete pTOXTypes;
- delete pUndos;
delete pDocStat;
delete pEmptyPageFmt;
delete pColumnContFmt;
@@ -754,7 +757,15 @@ void SwDoc::SetDocShell( SwDocShell* pDSh )
{
if( pDocShell != pDSh )
{
+ if (pDocShell)
+ {
+ pDocShell->SetUndoManager(0);
+ }
pDocShell = pDSh;
+ if (pDocShell)
+ {
+ pDocShell->SetUndoManager(& GetUndoManager());
+ }
pLinkMgr->SetPersist( pDocShell );
//JP 27.08.98: Bug 55570 - DocShell Pointer auch am DrawModel setzen
@@ -793,9 +804,8 @@ SfxObjectShell* SwDoc::GetPersist() const
void SwDoc::ClearDoc()
{
- sal_Bool bOldUndo = mbUndo;
- DelAllUndoObj();
- mbUndo = sal_False; // immer das Undo abschalten !!
+ GetIDocumentUndoRedo().DelAllUndoObj();
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
// Undo-Benachrichtigung vom Draw abschalten
if( pDrawModel )
@@ -906,8 +916,6 @@ void SwDoc::ClearDoc()
pFirstNd->ResetAllAttr();
// delete now the dummy pagedesc
DelPageDesc( nDummyPgDsc );
-
- mbUndo = bOldUndo;
}
void SwDoc::SetPreViewPrtData( const SwPagePreViewPrtData* pNew )
@@ -1062,6 +1070,30 @@ SwDoc::GetMetaFieldManager()
return *m_pMetaFieldManager;
}
+::sw::UndoManager &
+SwDoc::GetUndoManager()
+{
+ return *m_pUndoManager;
+}
+
+::sw::UndoManager const&
+SwDoc::GetUndoManager() const
+{
+ return *m_pUndoManager;
+}
+
+IDocumentUndoRedo &
+SwDoc::GetIDocumentUndoRedo()
+{
+ return *m_pUndoManager;
+}
+
+IDocumentUndoRedo const&
+SwDoc::GetIDocumentUndoRedo() const
+{
+ return *m_pUndoManager;
+}
+
void SwDoc::InitTOXTypes()
{
ShellResource* pShellRes = ViewShell::GetShellRes();
@@ -1182,7 +1214,7 @@ void SwDoc::Paste( const SwDoc& rSource )
aCpyPam.SetMark();
aCpyPam.Move( fnMoveForward, fnGoDoc );
- this->StartUndo( UNDO_INSGLOSSARY, NULL );
+ this->GetIDocumentUndoRedo().StartUndo( UNDO_INSGLOSSARY, NULL );
this->LockExpFlds();
{
@@ -1236,7 +1268,7 @@ void SwDoc::Paste( const SwDoc& rSource )
}
}
- this->EndUndo( UNDO_INSGLOSSARY, NULL );
+ this->GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL );
UnlockExpFlds();
UpdateFlds(NULL, false);
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 32fd242999cd..5a559c022c7b 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -27,6 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+
#include <hintids.hxx>
#include <tools/date.hxx>
#include <tools/time.hxx>
@@ -35,11 +36,14 @@
#include <ftninfo.hxx>
#include <ftnidx.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
#include <doctxm.hxx> // pTOXBaseRing
#include <poolfmt.hxx>
-#include <undobj.hxx>
+#include <UndoCore.hxx>
+#include <UndoRedline.hxx>
+#include <UndoNumbering.hxx>
#include <swundo.hxx>
#include <SwUndoFmt.hxx>
#include <rolbck.hxx>
@@ -49,9 +53,7 @@
#include <txtfrm.hxx>
#include <pamtyp.hxx>
#include <redline.hxx>
-#ifndef _COMCORE_HRC
#include <comcore.hrc>
-#endif
#include <editeng/adjitem.hxx>
#include <editeng/frmdiritem.hxx>
#include <frmatr.hxx>
@@ -371,11 +373,11 @@ sal_Bool SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset )
return sal_False;
/* <-- #i13747 # */
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- StartUndo(UNDO_OUTLINE_LR, NULL);
- AppendUndo( new SwUndoOutlineLeftRight( rPam, nOffset ) );
+ GetIDocumentUndoRedo().StartUndo(UNDO_OUTLINE_LR, NULL);
+ SwUndo *const pUndoOLR( new SwUndoOutlineLeftRight( rPam, nOffset ) );
+ GetIDocumentUndoRedo().AppendUndo(pUndoOLR);
}
// 2. allen Nodes die neue Vorlage zuweisen
@@ -417,8 +419,10 @@ sal_Bool SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset )
n++;
// Undo ???
}
- if (DoesUndo())
- EndUndo(UNDO_OUTLINE_LR, NULL);
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().EndUndo(UNDO_OUTLINE_LR, NULL);
+ }
ChkCondColls();
SetModified();
@@ -436,9 +440,11 @@ sal_Bool SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset )
& rEnd = &rStt == rPam.GetPoint() ? *rPam.GetMark()
: *rPam.GetPoint();
if( !GetNodes().GetOutLineNds().Count() || !nOffset ||
- rStt.nNode.GetIndex() < aNodes.GetEndOfExtras().GetIndex() ||
- rEnd.nNode.GetIndex() < aNodes.GetEndOfExtras().GetIndex() )
+ (rStt.nNode.GetIndex() < GetNodes().GetEndOfExtras().GetIndex()) ||
+ (rEnd.nNode.GetIndex() < GetNodes().GetEndOfExtras().GetIndex()))
+ {
return sal_False;
+ }
sal_uInt16 nAktPos = 0;
SwNodeIndex aSttRg( rStt.nNode ), aEndRg( rEnd.nNode );
@@ -572,7 +578,7 @@ sal_Bool SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset )
// setze die Position auf den Dokumentanfang.
// Sollten da Bereiche oder Tabellen stehen, so werden sie nach
// hinten verschoben.
- nNewPos = Max( nNewPos, aNodes.GetEndOfExtras().GetIndex() + 2 );
+ nNewPos = Max( nNewPos, GetNodes().GetEndOfExtras().GetIndex() + 2 );
long nOffs = nNewPos - ( 0 < nOffset ? aEndRg.GetIndex() : aSttRg.GetIndex());
SwPaM aPam( aSttRg, aEndRg, 0, -1 );
@@ -976,11 +982,12 @@ void SwDoc::SetNumRule( const SwPaM& rPam,
const bool bResetIndentAttrs )
{
SwUndoInsNum * pUndo = NULL;
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- StartUndo( UNDO_INSNUM, NULL ); // Klammerung fuer die Attribute!
- AppendUndo( pUndo = new SwUndoInsNum( rPam, rRule ) );
+ // Start/End for attributes!
+ GetIDocumentUndoRedo().StartUndo( UNDO_INSNUM, NULL );
+ pUndo = new SwUndoInsNum( rPam, rRule );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
SwNumRule * pNew = FindNumRulePtr( rRule.GetName() );
@@ -1112,8 +1119,10 @@ void SwDoc::SetNumRule( const SwPaM& rPam,
}
// <--
- if (DoesUndo())
- EndUndo( UNDO_INSNUM, NULL );
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().EndUndo( UNDO_INSNUM, NULL );
+ }
SetModified();
}
@@ -1158,10 +1167,10 @@ void SwDoc::SetNumRuleStart( const SwPosition& rPos, sal_Bool bFlag )
const SwNumRule* pRule = pTxtNd->GetNumRule();
if( pRule && !bFlag != !pTxtNd->IsListRestart())
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoNumRuleStart( rPos, bFlag ));
+ SwUndo *const pUndo( new SwUndoNumRuleStart(rPos, bFlag) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
pTxtNd->SetListRestart(bFlag ? true : false);
@@ -1193,10 +1202,10 @@ void SwDoc::SetNodeNumStart( const SwPosition& rPos, sal_uInt16 nStt )
if ( !pTxtNd->HasAttrListRestartValue() ||
pTxtNd->GetAttrListRestartValue() != nStt )
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoNumRuleStart( rPos, nStt ));
+ SwUndo *const pUndo( new SwUndoNumRuleStart(rPos, nStt) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
pTxtNd->SetAttrListRestartValue( nStt );
@@ -1222,12 +1231,11 @@ sal_Bool SwDoc::DelNumRule( const String& rName, sal_Bool bBroadcast )
if( USHRT_MAX != nPos && !IsUsed( *(*pNumRuleTbl)[ nPos ] ))
{
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
SwUndo * pUndo =
new SwUndoNumruleDelete(*(*pNumRuleTbl)[nPos], this);
-
- AppendUndo(pUndo);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
if (bBroadcast)
@@ -1279,12 +1287,11 @@ void SwDoc::ChgNumRuleFmts( const SwNumRule& rRule, const String * pName )
if( pRule )
{
SwUndoInsNum* pUndo = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
pUndo = new SwUndoInsNum( *pRule, rRule );
pUndo->GetHistory();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
::lcl_ChgNumRule( *this, rRule );
@@ -1303,11 +1310,10 @@ sal_Bool SwDoc::RenameNumRule(const String & rOldName, const String & rNewName,
if (pNumRule)
{
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
SwUndo * pUndo = new SwUndoNumruleRename(rOldName, rNewName, this);
-
- AppendUndo(pUndo);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
// --> OD 2008-02-19 #refactorlists#
@@ -1390,11 +1396,12 @@ sal_Bool SwDoc::ReplaceNumRule( const SwPosition& rPos,
{
// --> OD 2008-02-19 #refactorlists#
SwUndoInsNum* pUndo = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- StartUndo( UNDO_START, NULL ); // Klammerung fuer die Attribute!
- AppendUndo( pUndo = new SwUndoInsNum( rPos, *pNewRule, rOldRule ) );
+ // Start/End for attributes!
+ GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ pUndo = new SwUndoInsNum( rPos, *pNewRule, rOldRule );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
// --> OD 2008-02-19 #refactorlists#
@@ -1477,7 +1484,7 @@ sal_Bool SwDoc::ReplaceNumRule( const SwPosition& rPos,
pTxtNd->NumRuleChgd();
}
}
- EndUndo( UNDO_END, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
SetModified();
bRet = sal_True; // #106897#
@@ -1615,10 +1622,10 @@ void SwDoc::DelNumRules( const SwPaM& rPam )
}
SwUndoDelNum* pUndo;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( pUndo = new SwUndoDelNum( rPam ) );
+ pUndo = new SwUndoDelNum( rPam );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
else
pUndo = 0;
@@ -1919,8 +1926,8 @@ const SwNumRule * SwDoc::SearchNumRule(const SwPosition & rPos,
pNode = &aIdx.GetNode();
}
- while (! (pNode == aNodes.DocumentSectionStartNode(pStartFromNode) ||
- pNode == aNodes.DocumentSectionEndNode(pStartFromNode)));
+ while (!(pNode == GetNodes().DocumentSectionStartNode(pStartFromNode) ||
+ pNode == GetNodes().DocumentSectionEndNode(pStartFromNode)));
// <--
}
@@ -2003,10 +2010,10 @@ sal_Bool SwDoc::NumUpDown( const SwPaM& rPam, sal_Bool bDown )
if( bRet )
{
/* <-- #i24560# */
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoNumUpDown( rPam, nDiff ) );
+ SwUndo *const pUndo( new SwUndoNumUpDown(rPam, nDiff) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
String sNumRule;
@@ -2233,7 +2240,7 @@ sal_Bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, sal_Bool bIsOutl
if( !pOwnRedl )
{
- StartUndo( UNDO_START, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
// zuerst das Insert, dann das Loeschen
SwPosition aInsPos( aIdx );
@@ -2308,12 +2315,13 @@ sal_Bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, sal_Bool bIsOutl
RedlineMode_t eOld = GetRedlineMode();
checkRedlining(eOld);
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
//JP 06.01.98: MUSS noch optimiert werden!!!
SetRedlineMode(
(RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE));
- AppendUndo( new SwUndoRedlineDelete( aPam, UNDO_DELETE ));
+ SwUndo *const pUndo(new SwUndoRedlineDelete(aPam, UNDO_DELETE));
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
SwRedline* pNewRedline = new SwRedline( nsRedlineType_t::REDLINE_DELETE, aPam );
@@ -2328,7 +2336,7 @@ sal_Bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, sal_Bool bIsOutl
//JP 06.01.98: MUSS noch optimiert werden!!!
SetRedlineMode( eOld );
- EndUndo( UNDO_END, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
SetModified();
return sal_True;
@@ -2351,7 +2359,7 @@ SetRedlineMode( eOld );
SwUndoMoveNum* pUndo = 0;
sal_uLong nMoved = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
pUndo = new SwUndoMoveNum( rPam, nOffset, bIsOutlMv );
nMoved = rPam.End()->nNode.GetIndex() - rPam.Start()->nNode.GetIndex() + 1;
@@ -2362,13 +2370,12 @@ SetRedlineMode( eOld );
if( pUndo )
{
- ClearRedo();
// i57907: Under circumstances (sections at the end of a chapter)
// the rPam.Start() is not moved to the new position.
// But aIdx should be at the new end position and as long as the number of moved paragraphs
// is nMoved, I know, where the new position is.
pUndo->SetStartNode( aIdx.GetIndex() - nMoved );
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
if( pOwnRedl )
@@ -2410,12 +2417,12 @@ sal_Bool SwDoc::NumOrNoNum( const SwNodeIndex& rIdx, sal_Bool bDel )
bResult = sal_True;
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
SwUndoNumOrNoNum * pUndo =
new SwUndoNumOrNoNum(rIdx, bOldNum, bNewNum);
- AppendUndo(pUndo);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
}
else if (bDel && pTxtNd->GetNumRule(sal_False) &&
@@ -2529,11 +2536,10 @@ sal_uInt16 SwDoc::MakeNumRule( const String &rName,
AddNumRule(pNew); // #i36749#
- if (DoesUndo())
+ if (GetIDocumentUndoRedo().DoesUndo())
{
SwUndo * pUndo = new SwUndoNumruleCreate(pNew, this);
-
- AppendUndo(pUndo);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
if (bBroadcast)
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index a12d2daa60b1..d18d2166dd96 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -31,20 +31,21 @@
#include <hintids.hxx>
#include <tools/shl.hxx>
-#ifndef _SFX_ITEMITER_HXX //autogen
#include <svl/itemiter.hxx>
-#endif
#include <sfx2/app.hxx>
#include <editeng/colritem.hxx>
#include <editeng/udlnitem.hxx>
#include <editeng/crsditem.hxx>
#include <swmodule.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <ndtxt.hxx>
#include <redline.hxx>
#include <swundo.hxx>
-#include <undobj.hxx>
+#include <UndoCore.hxx>
+#include <UndoRedline.hxx>
+#include <hints.hxx>
#include <pamtyp.hxx>
#include <poolfmt.hxx>
#include <viewsh.hxx>
@@ -1398,13 +1399,12 @@ bool SwDoc::DeleteRedline( const SwPaM& rRange, bool bSaveInUndo,
sal_Bool bChg = sal_False;
- if( bSaveInUndo && DoesUndo() )
+ if (bSaveInUndo && GetIDocumentUndoRedo().DoesUndo())
{
SwUndoRedline* pUndo = new SwUndoRedline( UNDO_REDLINE, rRange );
if( pUndo->GetRedlSaveCount() )
{
- ClearRedo();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
}
else
delete pUndo;
@@ -2089,13 +2089,13 @@ bool SwDoc::AcceptRedline( sal_uInt16 nPos, bool bCallDelete )
SwRedline* pTmp = (*pRedlineTbl)[ nPos ];
if( pTmp->HasMark() && pTmp->IsVisible() )
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
// #111827#
SwRewriter aRewriter;
aRewriter.AddRule(UNDO_ARG1, pTmp->GetDescr());
- StartUndo( UNDO_ACCEPT_REDLINE, &aRewriter);
+ GetIDocumentUndoRedo().StartUndo(UNDO_ACCEPT_REDLINE, &aRewriter);
}
int nLoopCnt = 2;
@@ -2103,8 +2103,11 @@ bool SwDoc::AcceptRedline( sal_uInt16 nPos, bool bCallDelete )
do {
- if( DoesUndo() )
- AppendUndo( new SwUndoAcceptRedline( *pTmp ));
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo( new SwUndoAcceptRedline(*pTmp) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
bRet |= lcl_AcceptRedline( *pRedlineTbl, nPos, bCallDelete );
@@ -2133,8 +2136,10 @@ bool SwDoc::AcceptRedline( sal_uInt16 nPos, bool bCallDelete )
SetModified();
}
- if( DoesUndo() )
- EndUndo( UNDO_ACCEPT_REDLINE, NULL );
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().EndUndo(UNDO_END, 0);
+ }
}
return bRet;
}
@@ -2152,10 +2157,10 @@ bool SwDoc::AcceptRedline( const SwPaM& rPam, bool bCallDelete )
SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() );
lcl_AdjustRedlineRange( aPam );
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- StartUndo( UNDO_ACCEPT_REDLINE, NULL );
- AppendUndo( new SwUndoAcceptRedline( aPam ));
+ GetIDocumentUndoRedo().StartUndo( UNDO_ACCEPT_REDLINE, NULL );
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoAcceptRedline( aPam ));
}
// #111827#
@@ -2166,7 +2171,7 @@ bool SwDoc::AcceptRedline( const SwPaM& rPam, bool bCallDelete )
CompressRedlines();
SetModified();
}
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
// #111827#
String aTmpStr;
@@ -2180,7 +2185,7 @@ bool SwDoc::AcceptRedline( const SwPaM& rPam, bool bCallDelete )
SwRewriter aRewriter;
aRewriter.AddRule(UNDO_ARG1, aTmpStr);
- EndUndo( UNDO_ACCEPT_REDLINE, &aRewriter );
+ GetIDocumentUndoRedo().EndUndo( UNDO_ACCEPT_REDLINE, &aRewriter );
}
return nRet != 0;
}
@@ -2197,13 +2202,13 @@ bool SwDoc::RejectRedline( sal_uInt16 nPos, bool bCallDelete )
SwRedline* pTmp = (*pRedlineTbl)[ nPos ];
if( pTmp->HasMark() && pTmp->IsVisible() )
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
// #111827#
SwRewriter aRewriter;
aRewriter.AddRule(UNDO_ARG1, pTmp->GetDescr());
- StartUndo( UNDO_REJECT_REDLINE, NULL );
+ GetIDocumentUndoRedo().StartUndo(UNDO_REJECT_REDLINE, &aRewriter);
}
int nLoopCnt = 2;
@@ -2211,8 +2216,11 @@ bool SwDoc::RejectRedline( sal_uInt16 nPos, bool bCallDelete )
do {
- if( DoesUndo() )
- AppendUndo( new SwUndoRejectRedline( *pTmp ));
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo( new SwUndoRejectRedline( *pTmp ) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
bRet |= lcl_RejectRedline( *pRedlineTbl, nPos, bCallDelete );
@@ -2241,8 +2249,10 @@ bool SwDoc::RejectRedline( sal_uInt16 nPos, bool bCallDelete )
SetModified();
}
- if( DoesUndo() )
- EndUndo( UNDO_REJECT_REDLINE, NULL );
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().EndUndo(UNDO_END, 0);
+ }
}
return bRet;
}
@@ -2260,10 +2270,10 @@ bool SwDoc::RejectRedline( const SwPaM& rPam, bool bCallDelete )
SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() );
lcl_AdjustRedlineRange( aPam );
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- StartUndo( UNDO_REJECT_REDLINE, NULL );
- AppendUndo( new SwUndoRejectRedline( aPam ));
+ GetIDocumentUndoRedo().StartUndo( UNDO_REJECT_REDLINE, NULL );
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoRejectRedline(aPam) );
}
// #111827#
@@ -2274,7 +2284,7 @@ bool SwDoc::RejectRedline( const SwPaM& rPam, bool bCallDelete )
CompressRedlines();
SetModified();
}
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
// #111827#
String aTmpStr;
@@ -2288,7 +2298,7 @@ bool SwDoc::RejectRedline( const SwPaM& rPam, bool bCallDelete )
SwRewriter aRewriter;
aRewriter.AddRule(UNDO_ARG1, aTmpStr);
- EndUndo( UNDO_REJECT_REDLINE, &aRewriter );
+ GetIDocumentUndoRedo().EndUndo( UNDO_REJECT_REDLINE, &aRewriter );
}
return nRet != 0;
@@ -3148,8 +3158,7 @@ void SwRedline::Show( sal_uInt16 nLoop )
SwDoc* pDoc = GetDoc();
RedlineMode_t eOld = pDoc->GetRedlineMode();
pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
- sal_Bool bUndo = pDoc->DoesUndo();
- pDoc->DoUndo( sal_False );
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
switch( GetType() )
{
@@ -3171,7 +3180,6 @@ void SwRedline::Show( sal_uInt16 nLoop )
break;
}
pDoc->SetRedlineMode_intern( eOld );
- pDoc->DoUndo( bUndo );
}
}
@@ -3180,8 +3188,7 @@ void SwRedline::Hide( sal_uInt16 nLoop )
SwDoc* pDoc = GetDoc();
RedlineMode_t eOld = pDoc->GetRedlineMode();
pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
- sal_Bool bUndo = pDoc->DoesUndo();
- pDoc->DoUndo( sal_False );
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
switch( GetType() )
{
@@ -3210,7 +3217,6 @@ void SwRedline::Hide( sal_uInt16 nLoop )
break;
}
pDoc->SetRedlineMode_intern( eOld );
- pDoc->DoUndo( bUndo );
}
void SwRedline::ShowOriginal( sal_uInt16 nLoop )
@@ -3220,8 +3226,7 @@ void SwRedline::ShowOriginal( sal_uInt16 nLoop )
SwRedlineData* pCur;
pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
- sal_Bool bUndo = pDoc->DoesUndo();
- pDoc->DoUndo( sal_False );
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
// bestimme den Type, ist der erste auf Stack
for( pCur = pRedlineData; pCur->pNext; )
@@ -3254,7 +3259,6 @@ void SwRedline::ShowOriginal( sal_uInt16 nLoop )
break;
}
pDoc->SetRedlineMode_intern( eOld );
- pDoc->DoUndo( bUndo );
}
@@ -3856,9 +3860,9 @@ String SwRedline::GetDescr(sal_uInt16 nPos)
bool SwDoc::IsInRedlines(const SwNode & rNode) const
{
SwPosition aPos(rNode);
- SwNode & rEndOfRedlines = aNodes.GetEndOfRedlines();
+ SwNode & rEndOfRedlines = GetNodes().GetEndOfRedlines();
SwPaM aPam(SwPosition(*rEndOfRedlines.StartOfSectionNode()),
SwPosition(rEndOfRedlines));
- return aPam.ContainsPosition(aPos) ? sal_True : sal_False;
+ return aPam.ContainsPosition(aPos) ? true : false;
}
diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx
index f19677e65c62..c8703ab6adcb 100644
--- a/sw/source/core/doc/docruby.cxx
+++ b/sw/source/core/doc/docruby.cxx
@@ -28,18 +28,16 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
#include <string.h> // fuer strchr()
-#include <hintids.hxx>
-#ifndef _COM_SUN_STAR_I18N_UNICODETYPE_HDL
#include <com/sun/star/i18n/UnicodeType.hdl>
-#endif
-#ifndef _COM_SUN_STAR_I18N_WORDTYPE_HDL
#include <com/sun/star/i18n/WordType.hdl>
-#endif
+
#include <unotools/charclass.hxx>
+
+#include <hintids.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <mvsave.hxx> // Strukturen zum Sichern beim Move/Delete
#include <ndtxt.hxx>
@@ -47,7 +45,6 @@
#include <rubylist.hxx>
#include <pam.hxx>
#include <swundo.hxx> // fuer die UndoIds
-#include <undobj.hxx>
#include <breakit.hxx>
#include <crsskip.hxx>
@@ -112,7 +109,7 @@ sal_uInt16 SwDoc::FillRubyList( const SwPaM& rPam, SwRubyList& rList,
sal_uInt16 SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
sal_uInt16 nMode )
{
- StartUndo( UNDO_SETRUBYATTR, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_SETRUBYATTR, NULL );
SvUShortsSort aDelArr;
aDelArr.Insert( RES_TXTATR_CJK_RUBY );
@@ -193,7 +190,7 @@ sal_uInt16 SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList,
} while( 30 > rList.Count() &&
(_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr );
- EndUndo( UNDO_SETRUBYATTR, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_SETRUBYATTR, NULL );
return nListEntry;
}
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index d37a8a2c8d5a..497e00b70125 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -27,6 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+
#include <hintids.hxx>
#include <rtl/math.hxx>
#include <unotools/collatorwrapper.hxx>
@@ -39,6 +40,7 @@
#include <fmtanchr.hxx>
#include <frmfmt.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <node.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
@@ -46,7 +48,9 @@
#include <swundo.hxx>
#include <sortopt.hxx>
#include <docsort.hxx>
-#include <undobj.hxx>
+#include <UndoSort.hxx>
+#include <UndoRedline.hxx>
+#include <hints.hxx>
#include <tblsel.hxx>
#include <cellatr.hxx>
#include <redline.hxx>
@@ -357,9 +361,11 @@ sal_Bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
return sal_False;
}
- sal_Bool bUndo = DoesUndo();
+ bool const bUndo = GetIDocumentUndoRedo().DoesUndo();
if( bUndo )
- StartUndo( UNDO_START, NULL );
+ {
+ GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+ }
SwPaM* pRedlPam = 0;
SwUndoRedlineSort* pRedlUndo = 0;
@@ -377,7 +383,7 @@ sal_Bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
if( bUndo )
{
pRedlUndo = new SwUndoRedlineSort( *pRedlPam,rOpt );
- DoUndo( sal_False );
+ GetIDocumentUndoRedo().DoUndo(false);
}
// erst den Bereich kopieren, dann
SwNodeIndex aEndIdx( pEnd->nNode, 1 );
@@ -430,9 +436,12 @@ sal_Bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
SwNodeRange aRg( aStart, aStart );
if( bUndo && !pRedlUndo )
- AppendUndo( pUndoSort = new SwUndoSort( rPaM, rOpt ) );
+ {
+ pUndoSort = new SwUndoSort(rPaM, rOpt);
+ GetIDocumentUndoRedo().AppendUndo(pUndoSort);
+ }
- DoUndo( sal_False );
+ GetIDocumentUndoRedo().DoUndo(false);
for ( sal_uInt16 n = 0; n < aSortArr.Count(); ++n )
{
@@ -458,7 +467,10 @@ sal_Bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
if( pRedlUndo )
{
pRedlUndo->SetSaveRange( *pRedlPam );
- AppendUndo( pRedlUndo );
+ // UGLY: temp. enable Undo
+ GetIDocumentUndoRedo().DoUndo(true);
+ GetIDocumentUndoRedo().AppendUndo( pRedlUndo );
+ GetIDocumentUndoRedo().DoUndo(false);
}
// nBeg is start of sorted range
@@ -495,9 +507,11 @@ sal_Bool SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt)
delete pRedlPam, pRedlPam = 0;
}
- DoUndo( bUndo );
+ GetIDocumentUndoRedo().DoUndo( bUndo );
if( bUndo )
- EndUndo( UNDO_END, NULL );
+ {
+ GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ }
return sal_True;
}
@@ -575,18 +589,15 @@ sal_Bool SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt)
pTblNd->DelFrms();
// ? TL_CHART2: ?
- // Redo loeschen bevor Undo
- sal_Bool bUndo = DoesUndo();
SwUndoSort* pUndoSort = 0;
- if(bUndo)
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
pUndoSort = new SwUndoSort( rBoxes[0]->GetSttIdx(),
rBoxes[rBoxes.Count()-1]->GetSttIdx(),
*pTblNd, rOpt, aFlatBox.HasItemSets() );
- AppendUndo(pUndoSort);
- DoUndo(sal_False);
+ GetIDocumentUndoRedo().AppendUndo(pUndoSort);
}
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
// SchluesselElemente einsortieren
sal_uInt16 nCount = (rOpt.eDirection == SRT_ROWS) ?
@@ -631,9 +642,6 @@ sal_Bool SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt)
aSortList.DeleteAndDestroy( 0, aSortList.Count() );
SwSortElement::Finit();
- // Undo wieder aktivieren
- DoUndo(bUndo);
-
SetModified();
return sal_True;
}
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index d0e1d3b4f158..79fcfc60049d 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -49,6 +49,7 @@
#include <frmatr.hxx>
#include <pagedesc.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <pagefrm.hxx>
#include <ndtxt.hxx>
#include <swtable.hxx>
@@ -58,7 +59,7 @@
#include <poolfmt.hxx>
#include <txtfrm.hxx>
#include <rootfrm.hxx>
-#include <undobj.hxx>
+#include <UndoAttribute.hxx>
#include <swundo.hxx>
#include <mdiexp.hxx>
#include <docary.hxx>
@@ -140,9 +141,8 @@ sal_uInt16 SwDoc::GetTOIKeys( SwTOIKeyType eTyp, SvStringsSort& rArr ) const
sal_uInt16 SwDoc::GetCurTOXMark( const SwPosition& rPos,
SwTOXMarks& rArr ) const
{
- // suche an der Position rPos nach allen SwTOXMark's
- SwTxtNode* pTxtNd = GetNodes()[ rPos.nNode ]->GetTxtNode();
- // kein TextNode oder kein HintsArray vorhanden ??
+ // search on Position rPos for all SwTOXMarks
+ SwTxtNode *const pTxtNd = rPos.nNode.GetNode().GetTxtNode();
if( !pTxtNd || !pTxtNd->GetpSwpHints() )
return 0;
@@ -188,14 +188,13 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark )
SwTxtNode& rTxtNd = const_cast<SwTxtNode&>(pTxtTOXMark->GetTxtNode());
ASSERT( rTxtNd.GetpSwpHints(), "kann nicht geloescht werden" );
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- // fuers Undo die Attribute sichern
- ClearRedo();
+ // save attributes for Undo
SwUndoResetAttr* pUndo = new SwUndoResetAttr(
SwPosition( rTxtNd, SwIndex( &rTxtNd, *pTxtTOXMark->GetStart() ) ),
RES_TXTATR_TOXMARK );
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
SwRegHistory aRHst( rTxtNd, &pUndo->GetHistory() );
rTxtNd.GetpSwpHints()->Register( &aRHst );
@@ -203,7 +202,7 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark )
rTxtNd.DeleteAttribute( const_cast<SwTxtTOXMark*>(pTxtTOXMark) );
- if ( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
if( rTxtNd.GetpSwpHints() )
rTxtNd.GetpSwpHints()->DeRegister();
@@ -364,7 +363,7 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos,
const SfxItemSet* pSet,
sal_Bool bExpand )
{
- StartUndo( UNDO_INSTOX, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_INSTOX, NULL );
String sSectNm( rTOX.GetTOXName() );
sSectNm = GetUniqueTOXBaseName( *rTOX.GetTOXType(), &sSectNm );
@@ -406,7 +405,7 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" ));
}
}
- EndUndo( UNDO_INSTOX, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_INSTOX, NULL );
return pNewSection;
}
@@ -548,7 +547,7 @@ sal_Bool SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, sal_Bool bDelNodes )
SwSectionFmt* pFmt = rTOXSect.GetFmt();
if( pFmt )
{
- StartUndo( UNDO_CLEARTOXRANGE, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_CLEARTOXRANGE, NULL );
/* Save the start node of the TOX' section. */
SwSectionNode * pMyNode = pFmt->GetSectionNode();
@@ -620,7 +619,7 @@ sal_Bool SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, sal_Bool bDelNodes )
DelSectionFmt( pFmt, bDelNodes );
- EndUndo( UNDO_CLEARTOXRANGE, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_CLEARTOXRANGE, NULL );
bRet = sal_True;
}
diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx
index f33bbbc3ece8..93d177aed548 100644
--- a/sw/source/core/doc/extinput.cxx
+++ b/sw/source/core/doc/extinput.cxx
@@ -28,19 +28,23 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <com/sun/star/i18n/ScriptType.hpp>
+
+#include <editeng/langitem.hxx>
+#include <editeng/scripttypeitem.hxx>
-#include <hintids.hxx>
#include <vcl/keycodes.hxx>
#include <vcl/cmdevt.hxx>
+
+#include <hintids.hxx>
#include <extinput.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <index.hxx>
#include <ndtxt.hxx>
#include <txtfrm.hxx>
#include <swundo.hxx>
-#include <editeng/langitem.hxx>
-#include <editeng/scripttypeitem.hxx>
-#include <com/sun/star/i18n/ScriptType.hpp>
+
using namespace ::com::sun::star;
@@ -106,12 +110,14 @@ SwExtTextInput::~SwExtTextInput()
if( bInsText )
{
rIdx = nSttCnt;
- pDoc->StartUndo( UNDO_OVERWRITE, NULL );
+ pDoc->GetIDocumentUndoRedo().StartUndo(
+ UNDO_OVERWRITE, NULL );
pDoc->Overwrite( *this, sTxt.Copy( 0,
sOverwriteText.Len() ));
pDoc->InsertString( *this,
sTxt.Copy( sOverwriteText.Len() ) );
- pDoc->EndUndo( UNDO_OVERWRITE, NULL );
+ pDoc->GetIDocumentUndoRedo().EndUndo(
+ UNDO_OVERWRITE, NULL );
}
}
else
diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx
index 74db46cbb1b1..1de8ce660fa4 100644
--- a/sw/source/core/doc/poolfmt.cxx
+++ b/sw/source/core/doc/poolfmt.cxx
@@ -27,6 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+
#include <hintids.hxx>
#include <i18npool/mslangid.hxx>
#include <unotools/localedatawrapper.hxx>
@@ -54,6 +55,7 @@
#include <editeng/scriptspaceitem.hxx>
#include <viewopt.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <fmtanchr.hxx>
#include <fmtornt.hxx>
#include <fmtsrnd.hxx>
@@ -67,9 +69,7 @@
#include <fmtcol.hxx>
#include <ndtxt.hxx>
#include <fmtline.hxx>
-#ifndef _POOLFMT_HRC
#include <poolfmt.hrc>
-#endif
#include <GetMetricVal.hxx>
#include <numrule.hxx>
@@ -1085,7 +1085,7 @@ bool SwDoc::IsPoolTxtCollUsed( sal_uInt16 nId ) const
if( !bFnd || !pNewColl->GetDepends() )
return sal_False;
- SwAutoFmtGetDocNode aGetHt( &aNodes );
+ SwAutoFmtGetDocNode aGetHt( &GetNodes() );
return !pNewColl->GetInfo( aGetHt );
}
@@ -1164,24 +1164,21 @@ SwFmt* SwDoc::GetFmtFromPool( sal_uInt16 nId )
{
sal_Bool bIsModified = IsModified();
- sal_Bool bDoesUndo = DoesUndo();
- DoUndo(sal_False);
- switch (nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
{
- case POOLGRP_CHARFMT:
- pNewFmt = _MakeCharFmt( aNm, pDeriveFmt, sal_False, sal_True );
-
- break;
- case POOLGRP_FRAMEFMT:
- pNewFmt = _MakeFrmFmt(aNm, pDeriveFmt, sal_False, sal_True );
-
- break;
- default:
- break;
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+ switch (nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) )
+ {
+ case POOLGRP_CHARFMT:
+ pNewFmt = _MakeCharFmt(aNm, pDeriveFmt, FALSE, TRUE);
+ break;
+ case POOLGRP_FRAMEFMT:
+ pNewFmt = _MakeFrmFmt(aNm, pDeriveFmt, FALSE, TRUE);
+ break;
+ default:
+ break;
+ }
}
- DoUndo(bDoesUndo);
-
if( !bIsModified )
ResetModified();
pNewFmt->SetPoolFmtId( nId );
@@ -1436,7 +1433,7 @@ bool SwDoc::IsPoolFmtUsed( sal_uInt16 nId ) const
{
// dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
// (auch indirekte fuer Format-Ableitung! )
- SwAutoFmtGetDocNode aGetHt( &aNodes );
+ SwAutoFmtGetDocNode aGetHt( &GetNodes() );
bFnd = !pNewFmt->GetInfo( aGetHt );
}
else
@@ -1486,10 +1483,10 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage )
{
sal_Bool bIsModified = IsModified();
- sal_Bool bDoesUndo = DoesUndo();
- DoUndo(sal_False);
- n = MakePageDesc( aNm, 0, bRegardLanguage );
- DoUndo(bDoesUndo);
+ {
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+ n = MakePageDesc( aNm, 0, bRegardLanguage );
+ }
pNewPgDsc = aPageDescs[ n ];
pNewPgDsc->SetPoolFmtId( nId );
@@ -2359,7 +2356,7 @@ bool SwDoc::IsPoolPageDescUsed( sal_uInt16 nId ) const
// dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
// (auch indirekte fuer Format-Ableitung! )
- SwAutoFmtGetDocNode aGetHt( &aNodes );
+ SwAutoFmtGetDocNode aGetHt( &GetNodes() );
return !pNewPgDsc->GetInfo( aGetHt );
}
@@ -2368,7 +2365,7 @@ sal_Bool SwDoc::IsUsed( const SwModify& rModify ) const
{
// dann teste mal, ob es abhaengige ContentNodes im Nodes Array gibt
// (auch indirekte fuer Format-Ableitung! )
- SwAutoFmtGetDocNode aGetHt( &aNodes );
+ SwAutoFmtGetDocNode aGetHt( &GetNodes() );
return !rModify.GetInfo( aGetHt );
}
diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
index b7e9b3105e3f..51e1d455beb5 100644
--- a/sw/source/core/doc/tblcpy.cxx
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -35,6 +35,7 @@
#include <svl/zforlist.hxx>
#include <frmfmt.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <cntfrm.hxx>
#include <pam.hxx>
#include <swtable.hxx>
@@ -47,7 +48,8 @@
#include <mvsave.hxx>
#include <docary.hxx>
#include <fmtanchr.hxx>
-#include <undobj.hxx>
+#include <hints.hxx>
+#include <UndoTable.hxx>
#include <redline.hxx>
#include <fmtfsize.hxx>
#include <list>
@@ -558,9 +560,8 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox,
if( pUndo )
pUndo->AddBoxBefore( *pDstBox, bDelCntnt );
- sal_Bool bUndo = pDoc->DoesUndo();
bool bUndoRedline = pUndo && pDoc->IsRedlineOn();
- pDoc->DoUndo( sal_False );
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
SwNodeIndex aSavePos( aInsIdx, -1 );
if( pRg.get() )
@@ -628,8 +629,8 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox,
if( pUndo )
pUndo->AddBoxAfter( *pDstBox, aInsIdx, bDelCntnt );
- // Ueberschrift
- SwTxtNode* pTxtNd = pDoc->GetNodes()[ aSavePos ]->GetTxtNode();
+ // heading
+ SwTxtNode *const pTxtNd = aSavePos.GetNode().GetTxtNode();
if( pTxtNd )
{
sal_uInt16 nPoolId = pTxtNd->GetTxtColl()->GetPoolFmtId();
@@ -685,8 +686,6 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox,
}
}
}
-
- pDoc->DoUndo( bUndo );
}
sal_Bool SwTable::InsNewTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes,
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index d36e669ee860..e4a522ce2960 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -52,7 +52,8 @@
#include <swundo.hxx>
#include <rowfrm.hxx>
#include <ddefld.hxx>
-#include <undobj.hxx>
+#include <hints.hxx>
+#include <UndoTable.hxx>
#include <cellatr.hxx>
#include <mvsave.hxx>
#include <swtblfmt.hxx>
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 658033bbb05c..b697b3b7171a 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -28,16 +28,15 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <editeng/brkitem.hxx>
#define _ZFORLIST_DECLARE_TABLE
#include <hintids.hxx>
-
-
-#include <editeng/brkitem.hxx>
#include <fmtpdsc.hxx>
#include <fmtanchr.hxx>
#include <fmtcntnt.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
#include <fldbas.hxx>
@@ -142,8 +141,7 @@ namespace
const SwDoc* pSrcDoc = rPam.GetDoc();
SwDoc* pDestDoc = rCpyPam.GetDoc();
const IDocumentMarkAccess* const pSrcMarkAccess = pSrcDoc->getIDocumentMarkAccess();
- bool bDoesUndo = pDestDoc->DoesUndo();
- pDestDoc->DoUndo(false);
+ ::sw::UndoGuard const undoGuard(pDestDoc->GetIDocumentUndoRedo());
const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End();
SwPosition* pCpyStt = rCpyPam.Start();
@@ -209,7 +207,6 @@ namespace
pNewMetadatable->RegisterAsCopyOf(*pMetadatable);
}
}
- pDestDoc->DoUndo(bDoesUndo);
}
}
@@ -647,8 +644,7 @@ void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam )
RedlineMode_t eOld = pDestDoc->GetRedlineMode();
pDestDoc->SetRedlineMode_intern( (RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
- sal_Bool bDoesUndo = pDestDoc->DoesUndo();
- pDestDoc->DoUndo( sal_False );
+ ::sw::UndoGuard const undoGuard(pDestDoc->GetIDocumentUndoRedo());
do {
pDestDoc->DeleteAndJoin( *(SwPaM*)pDelPam->GetNext() );
@@ -658,7 +654,6 @@ void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam )
} while( sal_True );
delete pDelPam;
- pDestDoc->DoUndo( bDoesUndo );
pDestDoc->SetRedlineMode_intern( eOld );
}
}
@@ -737,49 +732,50 @@ SwDoc::CopyRange( SwPaM& rPam, SwPosition& rPos, const bool bCopyAll ) const
"please tell me what you did to get here!");
pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
- sal_Bool bDoUndo = pDoc->DoesUndo();
- pDoc->DoUndo( sal_False ); // Auf jedenfall Undo abschalten
// dann kopiere den Bereich im unteren DokumentBereich,
// (mit Start/End-Nodes geklammert) und verschiebe diese
// dann an die gewuenschte Stelle.
SwUndoCpyDoc* pUndo = 0;
SwPaM aPam( rPos ); // UndoBereich sichern
- if( bDoUndo )
+ if (pDoc->GetIDocumentUndoRedo().DoesUndo())
{
- pDoc->ClearRedo();
+ pDoc->GetIDocumentUndoRedo().ClearRedo();
pUndo = new SwUndoCpyDoc( aPam );
}
- SwStartNode* pSttNd = pDoc->GetNodes().MakeEmptySection(
+ {
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
+ SwStartNode* pSttNd = pDoc->GetNodes().MakeEmptySection(
SwNodeIndex( GetNodes().GetEndOfAutotext() ));
- aPam.GetPoint()->nNode = *pSttNd->EndOfSectionNode();
- // copy without Frames
- pDoc->CopyImpl( rPam, *aPam.GetPoint(), false, bCopyAll, 0 );
-
- aPam.GetPoint()->nNode = pDoc->GetNodes().GetEndOfAutotext();
- aPam.SetMark();
- SwCntntNode* pNode = pDoc->GetNodes().GoPrevious( &aPam.GetMark()->nNode );
- pNode->MakeEndIndex( &aPam.GetMark()->nContent );
-
- aPam.GetPoint()->nNode = *aPam.GetNode()->StartOfSectionNode();
- pNode = pDoc->GetNodes().GoNext( &aPam.GetPoint()->nNode );
- pNode->MakeStartIndex( &aPam.GetPoint()->nContent );
- // move to desired position
- pDoc->MoveRange( aPam, rPos, DOC_MOVEDEFAULT );
-
- pNode = aPam.GetCntntNode();
- *aPam.GetPoint() = rPos; // Cursor umsetzen fuers Undo !
- aPam.SetMark(); // auch den Mark umsetzen !!
- aPam.DeleteMark(); // aber keinen Bereich makieren !!
- pDoc->DeleteSection( pNode ); // Bereich wieder loeschen
-
- // falls Undo eingeschaltet ist, so speicher den eingefuegten Bereich
- pDoc->DoUndo( bDoUndo );
- if( bDoUndo )
+ aPam.GetPoint()->nNode = *pSttNd->EndOfSectionNode();
+ // copy without Frames
+ pDoc->CopyImpl( rPam, *aPam.GetPoint(), false, bCopyAll, 0 );
+
+ aPam.GetPoint()->nNode = pDoc->GetNodes().GetEndOfAutotext();
+ aPam.SetMark();
+ SwCntntNode* pNode =
+ pDoc->GetNodes().GoPrevious( &aPam.GetMark()->nNode );
+ pNode->MakeEndIndex( &aPam.GetMark()->nContent );
+
+ aPam.GetPoint()->nNode = *aPam.GetNode()->StartOfSectionNode();
+ pNode = pDoc->GetNodes().GoNext( &aPam.GetPoint()->nNode );
+ pNode->MakeStartIndex( &aPam.GetPoint()->nContent );
+ // move to desired position
+ pDoc->MoveRange( aPam, rPos, DOC_MOVEDEFAULT );
+
+ pNode = aPam.GetCntntNode();
+ *aPam.GetPoint() = rPos; // Cursor umsetzen fuers Undo !
+ aPam.SetMark(); // auch den Mark umsetzen !!
+ aPam.DeleteMark(); // aber keinen Bereich makieren !!
+ pDoc->DeleteSection( pNode ); // Bereich wieder loeschen
+ }
+
+ // if Undo is enabled, store the insertion range
+ if (pDoc->GetIDocumentUndoRedo().DoesUndo())
{
pUndo->SetInsertRange( aPam );
- pDoc->AppendUndo( pUndo );
+ pDoc->GetIDocumentUndoRedo().AppendUndo(pUndo);
}
if( pRedlineRange )
@@ -889,11 +885,10 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos,
SwTblNumFmtMerge aTNFM( *this, *pDoc );
- if( pDoc->DoesUndo() )
+ if (pDoc->GetIDocumentUndoRedo().DoesUndo())
{
- pDoc->ClearRedo();
pUndo = new SwUndoCpyDoc( aCpyPam );
- pDoc->AppendUndo( pUndo );
+ pDoc->GetIDocumentUndoRedo().AppendUndo( pUndo );
}
RedlineMode_t eOld = pDoc->GetRedlineMode();
@@ -976,10 +971,10 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos,
else if( !bOneNode || bColumnSel )
{
xub_StrLen nCntntEnd = pEnd->nContent.GetIndex();
- sal_Bool bDoesUndo = pDoc->DoesUndo();
- pDoc->DoUndo( sal_False );
- pDoc->SplitNode( rPos, false );
- pDoc->DoUndo( bDoesUndo );
+ {
+ ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
+ pDoc->SplitNode( rPos, false );
+ }
if( bCanMoveBack && rPos == *aCpyPam.GetPoint() )
{
@@ -1106,10 +1101,10 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos,
// splitte den TextNode, bei dem Eingefuegt wird.
xub_StrLen nCntntEnd = pEnd->nContent.GetIndex();
- sal_Bool bDoesUndo = pDoc->DoesUndo();
- pDoc->DoUndo( sal_False );
- pDoc->SplitNode( rPos, false );
- pDoc->DoUndo( bDoesUndo );
+ {
+ ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
+ pDoc->SplitNode( rPos, false );
+ }
if( bCanMoveBack && rPos == *aCpyPam.GetPoint() )
{
@@ -1285,8 +1280,10 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos,
lcl_DeleteRedlines( rPam, aCpyPam );
// falls Undo eingeschaltet ist, so speicher den eingefuegten Bereich
- if( pDoc->DoesUndo() )
- pUndo->SetInsertRange( aCpyPam, sal_True, bStartIsTxtNode );
+ if (pDoc->GetIDocumentUndoRedo().DoesUndo())
+ {
+ pUndo->SetInsertRange( aCpyPam, TRUE, bStartIsTxtNode );
+ }
if( pCpyRange )
{
@@ -1349,11 +1346,10 @@ void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndConte
}
#endif
- // Undo abschalten
- sal_Bool bUndo = pDest->DoesUndo();
- pDest->DoUndo( sal_False );
- CopyFlyInFlyImpl( rRg, nEndContentIndex, aSavePos, bCopyFlyAtFly );
- pDest->DoUndo( bUndo );
+ {
+ ::sw::UndoGuard const undoGuard(pDest->GetIDocumentUndoRedo());
+ CopyFlyInFlyImpl( rRg, nEndContentIndex, aSavePos, bCopyFlyAtFly );
+ }
SwNodeRange aCpyRange( aSavePos, rInsPos );
@@ -1440,7 +1436,7 @@ void SwDoc::CopyFlyInFlyImpl( const SwNodeRange& rRg,
//last node information is only necessary to know for the last TextNode
SwNodeIndex aTmp( pAPos->nNode );
++aTmp;//goto next node
- while( rNodes[aTmp ]->IsEndNode() )
+ while (aTmp.GetNode().IsEndNode())
{
if( aTmp == rNodes.GetEndOfContent().GetIndex() )
{
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index d2876438dff3..d61ad4f0b763 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -38,11 +38,13 @@
#include <txtftn.hxx>
#include <fmtclds.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <rootfrm.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
#include <section.hxx>
-#include <undobj.hxx>
+#include <UndoSection.hxx>
+#include <UndoDelete.hxx>
#include <swundo.hxx>
#include <calc.hxx>
#include <swtable.hxx>
@@ -58,9 +60,7 @@
#include <node2lay.hxx>
#include <doctxm.hxx>
#include <fmtftntx.hxx>
-#ifndef _COMCORE_HRC
#include <comcore.hrc>
-#endif
// --> OD 2005-12-01 #i27138#
#include <viewsh.hxx>
#include <txtfrm.hxx>
@@ -188,12 +188,12 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
}
SwUndoInsSection* pUndoInsSect = 0;
- if( DoesUndo() )
+ bool const bUndo(GetIDocumentUndoRedo().DoesUndo());
+ if (bUndo)
{
- ClearRedo();
pUndoInsSect = new SwUndoInsSection(rRange, rNewData, pAttr, pTOXBase);
- AppendUndo( pUndoInsSect );
- DoUndo( sal_False );
+ GetIDocumentUndoRedo().AppendUndo( pUndoInsSect );
+ GetIDocumentUndoRedo().DoUndo(false);
}
SwSectionFmt* const pFmt = MakeSectionFmt( 0 );
@@ -374,7 +374,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
{
pUndoInsSect->SetSectNdPos( pNewSectNode->GetIndex() );
pUndoInsSect->SetUpdtFtnFlag( bUpdateFtn );
- DoUndo( sal_True );
+ GetIDocumentUndoRedo().DoUndo(bUndo);
}
if (rNewData.IsLinkType())
@@ -527,7 +527,7 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, sal_Bool bDelNodes )
{
sal_uInt16 nPos = pSectionFmtTbl->GetPos( pFmt );
- StartUndo(UNDO_DELSECTION, NULL);
+ GetIDocumentUndoRedo().StartUndo(UNDO_DELSECTION, NULL);
if( USHRT_MAX != nPos )
{
@@ -541,24 +541,22 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, sal_Bool bDelNodes )
const SwSectionNode* pSectNd;
- if( DoesUndo() )
+ if( GetIDocumentUndoRedo().DoesUndo() )
{
- ClearRedo();
if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() &&
0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
{
SwNodeIndex aUpdIdx( *pIdx );
- ClearRedo();
SwPaM aPaM( *pSectNd->EndOfSectionNode(), *pSectNd );
- AppendUndo( new SwUndoDelete( aPaM ));
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoDelete( aPaM ));
if( pFtnEndAtTxtEnd )
GetFtnIdxs().UpdateFtn( aUpdIdx );
SetModified();
//#126178# start/end undo have to be pairs!
- EndUndo(UNDO_DELSECTION, NULL);
+ GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL);
return ;
}
- AppendUndo( MakeUndoDelSection( *pFmt ) );
+ GetIDocumentUndoRedo().AppendUndo( MakeUndoDelSection( *pFmt ) );
}
else if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() &&
0 != (pSectNd = pIdx->GetNode().GetSectionNode() ))
@@ -569,7 +567,7 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, sal_Bool bDelNodes )
GetFtnIdxs().UpdateFtn( aUpdIdx );
SetModified();
//#126178# start/end undo have to be pairs!
- EndUndo(UNDO_DELSECTION, NULL);
+ GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL);
return ;
}
@@ -613,7 +611,7 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, sal_Bool bDelNodes )
//FEATURE::CONDCOLL
}
- EndUndo(UNDO_DELSECTION, NULL);
+ GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL);
SetModified();
}
@@ -651,23 +649,17 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData,
if( bOnlyAttrChg )
{
- const sal_Bool bDoesUndo = DoesUndo();
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( MakeUndoUpdateSection( *pFmt, true ) );
- // --> FME 2004-10-13 #i32968#
- // Inserting columns in the section causes MakeFrmFmt to put two
- // objects of type SwUndoFrmFmt on the undo stack. We don't want them.
- DoUndo( sal_False );
- // <--
+ GetIDocumentUndoRedo().AppendUndo(
+ MakeUndoUpdateSection( *pFmt, true ) );
}
+ // #i32968# Inserting columns in the section causes MakeFrmFmt
+ // to put two objects of type SwUndoFrmFmt on the undo stack.
+ // We don't want them.
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
pFmt->SetFmtAttr( *pAttr );
SetModified();
-
- // --> FME 2004-10-13 #i32968#
- DoUndo( bDoesUndo );
- // <--
}
return;
}
@@ -692,17 +684,13 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData,
}
}
- const sal_Bool bDoesUndo = DoesUndo();
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( MakeUndoUpdateSection( *pFmt, false ) );
- // --> FME 2004-10-13 #i32968#
- // Inserting columns in the section causes MakeFrmFmt to put two
- // objects of type SwUndoFrmFmt on the undo stack. We don't want them.
- DoUndo( sal_False );
- // <--
+ GetIDocumentUndoRedo().AppendUndo(MakeUndoUpdateSection(*pFmt, false));
}
+ // #i32968# Inserting columns in the section causes MakeFrmFmt to put two
+ // objects of type SwUndoFrmFmt on the undo stack. We don't want them.
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
// #56167# Der LinkFileName koennte auch nur aus Separatoren bestehen
String sCompareString = sfx2::cTokenSeperator;
@@ -770,10 +758,6 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData,
}
SetModified();
-
- // --> FME 2004-10-13 #i32968#
- DoUndo( bDoesUndo );
- // <--
}
/* -----------------19.02.99 09:31-------------------
@@ -1097,7 +1081,6 @@ SwSectionNode::~SwSectionNode()
pLast = aIter++;
}
}
- SwDoc* pDoc = GetDoc();
SwSectionFmt* pFmt = m_pSection->GetFmt();
if( pFmt )
@@ -1108,12 +1091,6 @@ SwSectionNode::~SwSectionNode()
pFmt->ResetFmtAttr( RES_CNTNT );
pFmt->UnlockModify();
}
-
- sal_Bool bUndo = pDoc->DoesUndo();
- // verhinder beim Loeschen aus der Undo/Redo-History einen rekursiven Aufruf
- if( bUndo && &pDoc->GetNodes() != &GetNodes() )
- pDoc->DoUndo( sal_False );
- pDoc->DoUndo( bUndo );
}
@@ -1142,7 +1119,7 @@ void SwSectionNode::MakeFrms(const SwNodeIndex & rIdx )
if( 0 == ( pCNd = rNds.GoPrevSection( &aIdx, sal_True, sal_False )) )
return ;
}
- pCNd = rNds[ aIdx ]->GetCntntNode();
+ pCNd = aIdx.GetNode().GetCntntNode();
pCNd->MakeFrms( (SwCntntNode&)rIdx.GetNode() );
}
else
@@ -1365,7 +1342,8 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c
: CREATE_NONE );
// falls als Server aus dem Undo kopiert wird, wieder eintragen
- if (m_pSection->IsServer() && (pDoc->GetUndoNds() == &rNds))
+ if (m_pSection->IsServer()
+ && pDoc->GetIDocumentUndoRedo().IsUndoNodes(rNds))
{
pNewSect->SetRefObject( m_pSection->GetObject() );
pDoc->GetLinkManager().InsertServer( pNewSect->GetObject() );
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 47b451a24b9c..b49695ca1f8d 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1,3 +1,4 @@
+
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -30,9 +31,6 @@
#include <com/sun/star/chart2/XChartDocument.hpp>
-#ifdef WTC
-#define private public
-#endif
#include <hintids.hxx>
#include <editeng/lrspitem.hxx>
@@ -53,6 +51,8 @@
#include <pagefrm.hxx>
#include <tabcol.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <UndoManager.hxx>
#include <cntfrm.hxx>
#include <pam.hxx>
#include <swcrsr.hxx>
@@ -64,7 +64,11 @@
#include <fldbas.hxx>
#include <poolfmt.hxx>
#include <tabfrm.hxx>
-#include <undobj.hxx>
+#include <UndoCore.hxx>
+#include <UndoRedline.hxx>
+#include <UndoDelete.hxx>
+#include <UndoTable.hxx>
+#include <hints.hxx>
#include <tblafmt.hxx>
#include <swcache.hxx>
#include <ddefld.hxx>
@@ -83,9 +87,7 @@
#include <section.hxx>
#include <frmtool.hxx>
#include <node2lay.hxx>
-#ifndef _COMCORE_HRC
#include <comcore.hrc>
-#endif
#include "docsh.hxx"
#include <tabcol.hxx>
#include <unochart.hxx>
@@ -137,7 +139,7 @@ public:
lcl_DelRedlines::lcl_DelRedlines( SwPaM & rPam) : pDoc( rPam.GetDoc() )
{
- pDoc->StartUndo(UNDO_EMPTY, NULL);
+ pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
if( !pDoc->IsIgnoreRedline() && pDoc->GetRedlineTbl().Count() )
pDoc->AcceptRedline( rPam, true );
}
@@ -390,10 +392,10 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts,
String aTblName = GetUniqueTblName();
- if( DoesUndo() )
+ if( GetIDocumentUndoRedo().DoesUndo() )
{
- ClearRedo();
- AppendUndo( new SwUndoInsTbl( rPos, nCols, nRows, static_cast<sal_uInt16>(eAdjust),
+ GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoInsTbl( rPos, nCols, nRows, static_cast<USHORT>(eAdjust),
rInsTblOpts, pTAFmt, pColArr,
aTblName));
}
@@ -692,15 +694,15 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
#endif
SwUndoTxtToTbl* pUndo = 0;
- if( DoesUndo() )
+ if( GetIDocumentUndoRedo().DoesUndo() )
{
- StartUndo( UNDO_TEXTTOTABLE, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_TEXTTOTABLE, NULL );
pUndo = new SwUndoTxtToTbl( aOriginal, rInsTblOpts, cCh,
- static_cast<sal_uInt16>(eAdjust), pTAFmt );
- AppendUndo( pUndo );
+ static_cast<USHORT>(eAdjust), pTAFmt );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
// das Splitten vom TextNode nicht in die Undohistory aufnehmen
- DoUndo( sal_False );
+ GetIDocumentUndoRedo().DoUndo( false );
}
::PaMCorrAbs( aOriginal, *pEnd );
@@ -739,7 +741,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
// Wir gehen jetzt immer ueber die Upper, um die Tabelle einzufuegen:
SwNode2Layout aNode2Layout( aRg.aStart.GetNode() );
- DoUndo( 0 != pUndo );
+ GetIDocumentUndoRedo().DoUndo( 0 != pUndo );
// dann erstelle die Box/Line/Table-Struktur
SwTableBoxFmt* pBoxFmt = MakeTableBoxFmt();
@@ -916,7 +918,9 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts,
}
if( pUndo )
- EndUndo( UNDO_TEXTTOTABLE, NULL );
+ {
+ GetIDocumentUndoRedo().EndUndo( UNDO_TEXTTOTABLE, NULL );
+ }
SetModified();
SetFieldsDirty(true, NULL, 0);
@@ -1146,15 +1150,16 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
lcl_DelRedlines aDelRedl( aOriginal );
#endif
- SwUndoTxtToTbl* pUndo = 0;
- if( DoesUndo() )
+// SwUndoTxtToTbl* pUndo = 0;
+ bool const bUndo(GetIDocumentUndoRedo().DoesUndo());
+ if (bUndo)
{
-// StartUndo( UNDO_TEXTTOTABLE );
+// GetIDocumentUndoRedo().StartUndo( UNDO_TEXTTOTABLE );
// pUndo = new SwUndoTxtToTbl( aOriginal, rInsTblOpts, cCh, eAdjust, pTAFmt );
-// AppendUndo( pUndo );
+// GetIDocumentUndoRedo().AppendUndo(pUndo);
// das Splitten vom TextNode nicht in die Undohistory aufnehmen
- DoUndo( sal_False );
+ GetIDocumentUndoRedo().DoUndo(false);
}
::PaMCorrAbs( aOriginal, *pEnd );
@@ -1193,7 +1198,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
// Wir gehen jetzt immer ueber die Upper, um die Tabelle einzufuegen:
SwNode2Layout aNode2Layout( aRg.aStart.GetNode() );
- DoUndo( 0 != pUndo );
+ GetIDocumentUndoRedo().DoUndo(bUndo);
// dann erstelle die Box/Line/Table-Struktur
SwTableBoxFmt* pBoxFmt = MakeTableBoxFmt();
@@ -1264,7 +1269,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
}
// if( pUndo )
-// EndUndo( UNDO_TEXTTOTABLE );
+// GetIDocumentUndoRedo().EndUndo( UNDO_TEXTTOTABLE );
SetModified();
SetFieldsDirty( true, NULL, 0 );
@@ -1530,9 +1535,9 @@ sal_Bool SwDoc::TableToText( const SwTableNode* pTblNd, sal_Unicode cCh )
SwNodeRange aRg( *pTblNd, 0, *pTblNd->EndOfSectionNode() );
SwUndoTblToTxt* pUndo = 0;
SwNodeRange* pUndoRg = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
+ GetIDocumentUndoRedo().ClearRedo();
pUndoRg = new SwNodeRange( aRg.aStart, -1, aRg.aEnd, +1 );
pUndo = new SwUndoTblToTxt( pTblNd->GetTable(), cCh );
}
@@ -1547,7 +1552,7 @@ sal_Bool SwDoc::TableToText( const SwTableNode* pTblNd, sal_Unicode cCh )
pUndoRg->aStart++;
pUndoRg->aEnd--;
pUndo->SetRange( *pUndoRg );
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
delete pUndoRg;
}
@@ -1659,7 +1664,7 @@ sal_Bool SwNodes::TableToText( const SwNodeRange& rRange, sal_Unicode cCh,
// ist eine Tabelle selektiert ?
SwTableNode* pTblNd;
if( rRange.aStart.GetIndex() >= rRange.aEnd.GetIndex() ||
- 0 == ( pTblNd = (*this)[ rRange.aStart ]->GetTableNode()) ||
+ 0 == ( pTblNd = rRange.aStart.GetNode().GetTableNode()) ||
&rRange.aEnd.GetNode() != pTblNd->EndOfSectionNode() )
return sal_False;
@@ -1802,34 +1807,36 @@ sal_Bool SwDoc::InsertCol( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool b
SwTableSortBoxes aTmpLst( 0, 5 );
SwUndoTblNdsChg* pUndo = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- DoUndo( sal_False );
pUndo = new SwUndoTblNdsChg( UNDO_TABLE_INSCOL, rBoxes, *pTblNd,
0, 0, nCnt, bBehind, sal_False );
aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() );
}
- SwTableFmlUpdate aMsgHnt( &rTbl );
- aMsgHnt.eFlags = TBL_BOXPTR;
- UpdateTblFlds( &aMsgHnt );
-
- sal_Bool bRet = rTbl.InsertCol( this, rBoxes, nCnt, bBehind );
- if( bRet )
+ bool bRet(false);
{
- SetModified();
- ::ClearFEShellTabCols();
- SetFieldsDirty( true, NULL, 0 );
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ SwTableFmlUpdate aMsgHnt( &rTbl );
+ aMsgHnt.eFlags = TBL_BOXPTR;
+ UpdateTblFlds( &aMsgHnt );
+
+ bRet = rTbl.InsertCol( this, rBoxes, nCnt, bBehind );
+ if (bRet)
+ {
+ SetModified();
+ ::ClearFEShellTabCols();
+ SetFieldsDirty( true, NULL, 0 );
+ }
}
if( pUndo )
{
- DoUndo( sal_True );
if( bRet )
{
- ClearRedo();
pUndo->SaveNewBoxes( *pTblNd, aTmpLst );
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
else
delete pUndo;
@@ -1867,34 +1874,36 @@ sal_Bool SwDoc::InsertRow( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, sal_Bool b
SwTableSortBoxes aTmpLst( 0, 5 );
SwUndoTblNdsChg* pUndo = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- DoUndo( sal_False );
pUndo = new SwUndoTblNdsChg( UNDO_TABLE_INSROW,rBoxes, *pTblNd,
0, 0, nCnt, bBehind, sal_False );
aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() );
}
- SwTableFmlUpdate aMsgHnt( &rTbl );
- aMsgHnt.eFlags = TBL_BOXPTR;
- UpdateTblFlds( &aMsgHnt );
-
- sal_Bool bRet = rTbl.InsertRow( this, rBoxes, nCnt, bBehind );
- if( bRet )
+ bool bRet(false);
{
- SetModified();
- ::ClearFEShellTabCols();
- SetFieldsDirty( true, NULL, 0 );
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ SwTableFmlUpdate aMsgHnt( &rTbl );
+ aMsgHnt.eFlags = TBL_BOXPTR;
+ UpdateTblFlds( &aMsgHnt );
+
+ bRet = rTbl.InsertRow( this, rBoxes, nCnt, bBehind );
+ if (bRet)
+ {
+ SetModified();
+ ::ClearFEShellTabCols();
+ SetFieldsDirty( true, NULL, 0 );
+ }
}
if( pUndo )
{
- DoUndo( sal_True );
if( bRet )
{
- ClearRedo();
pUndo->SaveNewBoxes( *pTblNd, aTmpLst );
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
else
delete pUndo;
@@ -2004,9 +2013,9 @@ sal_Bool SwDoc::DeleteRow( const SwCursor& rCursor )
// dann loesche doch die Zeilen
- StartUndo(UNDO_ROW_DELETE, NULL);
+ GetIDocumentUndoRedo().StartUndo(UNDO_ROW_DELETE, NULL);
sal_Bool bResult = DeleteRowCol( aBoxes );
- EndUndo(UNDO_ROW_DELETE, NULL);
+ GetIDocumentUndoRedo().EndUndo(UNDO_ROW_DELETE, NULL);
return bResult;
}
@@ -2030,9 +2039,9 @@ sal_Bool SwDoc::DeleteCol( const SwCursor& rCursor )
}
// dann loesche doch die Spalten
- StartUndo(UNDO_COL_DELETE, NULL);
+ GetIDocumentUndoRedo().StartUndo(UNDO_COL_DELETE, NULL);
sal_Bool bResult = DeleteRowCol( aBoxes, true );
- EndUndo(UNDO_COL_DELETE, NULL);
+ GetIDocumentUndoRedo().EndUndo(UNDO_COL_DELETE, NULL);
return bResult;
}
@@ -2107,9 +2116,9 @@ sal_Bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
// kein Fly ?? also Kopf- oder Fusszeile: dann immer einen
// TextNode ueberig lassen.
aIdx++;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
+ GetIDocumentUndoRedo().ClearRedo();
SwPaM aPaM( *pTblNd->EndOfSectionNode(), aIdx.GetNode() );
if( bNewTxtNd )
@@ -2165,7 +2174,7 @@ sal_Bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
pUndo->SetTblDelLastNd();
pUndo->SetPgBrkFlags( bSavePageBreak, bSavePageDesc );
pUndo->SetTableName(pTblNd->GetTable().GetFrmFmt()->GetName());
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
else
{
@@ -2212,39 +2221,41 @@ sal_Bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
}
SwUndoTblNdsChg* pUndo = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- DoUndo( sal_False );
pUndo = new SwUndoTblNdsChg( UNDO_TABLE_DELBOX, aSelBoxes, *pTblNd,
nMin, nMax, 0, sal_False, sal_False );
}
- SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() );
- aMsgHnt.eFlags = TBL_BOXPTR;
- UpdateTblFlds( &aMsgHnt );
-
- if( rTable.IsNewModel() )
- {
- if( bColumn )
- rTable.PrepareDeleteCol( nMin, nMax );
- rTable.FindSuperfluousRows( aSelBoxes );
- if( pUndo )
- pUndo->ReNewBoxes( aSelBoxes );
- }
- const sal_Bool bRet = rTable.DeleteSel( this, aSelBoxes, 0, pUndo, sal_True, sal_True );
- if( bRet )
+ bool bRet(false);
{
- SetModified();
- SetFieldsDirty( true, NULL, 0 );
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+
+ SwTableFmlUpdate aMsgHnt( &pTblNd->GetTable() );
+ aMsgHnt.eFlags = TBL_BOXPTR;
+ UpdateTblFlds( &aMsgHnt );
+
+ if (rTable.IsNewModel())
+ {
+ if (bColumn)
+ rTable.PrepareDeleteCol( nMin, nMax );
+ rTable.FindSuperfluousRows( aSelBoxes );
+ if (pUndo)
+ pUndo->ReNewBoxes( aSelBoxes );
+ }
+ bRet = rTable.DeleteSel( this, aSelBoxes, 0, pUndo, TRUE, TRUE );
+ if (bRet)
+ {
+ SetModified();
+ SetFieldsDirty( true, NULL, 0 );
+ }
}
if( pUndo )
{
- DoUndo( sal_True );
if( bRet )
{
- ClearRedo();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
else
delete pUndo;
@@ -2276,10 +2287,8 @@ sal_Bool SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, sal_uInt16 n
SvULongs aNdsCnts;
SwTableSortBoxes aTmpLst( 0, 5 );
SwUndoTblNdsChg* pUndo = 0;
- sal_Bool bDoUndo = DoesUndo();
- if( bDoUndo )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- DoUndo( sal_False );
pUndo = new SwUndoTblNdsChg( UNDO_TABLE_SPLIT, rBoxes, *pTblNd, 0, 0,
nCnt, bVert, bSameHeight );
@@ -2295,33 +2304,35 @@ sal_Bool SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, sal_uInt16 n
}
}
- SwTableFmlUpdate aMsgHnt( &rTbl );
- aMsgHnt.eFlags = TBL_BOXPTR;
- UpdateTblFlds( &aMsgHnt );
+ bool bRet(false);
+ {
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
- sal_Bool bRet;
- if( bVert )
- bRet = rTbl.SplitCol( this, rBoxes, nCnt );
- else
- bRet = rTbl.SplitRow( this, rBoxes, nCnt, bSameHeight );
+ SwTableFmlUpdate aMsgHnt( &rTbl );
+ aMsgHnt.eFlags = TBL_BOXPTR;
+ UpdateTblFlds( &aMsgHnt );
- if( bRet )
- {
- SetModified();
- SetFieldsDirty( true, NULL, 0 );
+ if (bVert)
+ bRet = rTbl.SplitCol( this, rBoxes, nCnt );
+ else
+ bRet = rTbl.SplitRow( this, rBoxes, nCnt, bSameHeight );
+
+ if (bRet)
+ {
+ SetModified();
+ SetFieldsDirty( true, NULL, 0 );
+ }
}
- DoUndo( bDoUndo );
if( pUndo )
{
if( bRet )
{
- ClearRedo();
if( bVert )
pUndo->SaveNewBoxes( *pTblNd, aTmpLst );
else
pUndo->SaveNewBoxes( *pTblNd, aTmpLst, rBoxes, aNdsCnts );
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
else
delete pUndo;
@@ -2350,7 +2361,7 @@ sal_uInt16 SwDoc::MergeTbl( SwPaM& rPam )
}
// --> FME 2004-10-08 #i33394#
- StartUndo( UNDO_TABLE_MERGE, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_MERGE, NULL );
// <--
#ifdef DEL_TABLE_REDLINES
@@ -2360,9 +2371,9 @@ sal_uInt16 SwDoc::MergeTbl( SwPaM& rPam )
RedlineMode_t eOld = GetRedlineMode();
SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
- SwUndoTblMerge* pUndo = 0;
- if( DoesUndo() )
- pUndo = new SwUndoTblMerge( rPam );
+ SwUndoTblMerge *const pUndo( (GetIDocumentUndoRedo().DoesUndo())
+ ? new SwUndoTblMerge( rPam )
+ : 0 );
// lasse ueber das Layout die Boxen suchen
SwSelBoxes aBoxes;
@@ -2375,13 +2386,19 @@ sal_uInt16 SwDoc::MergeTbl( SwPaM& rPam )
if( pUndo )
{
delete pUndo;
- if( UNDO_REDLINE == GetUndoIds(NULL, NULL) )
+ SwUndoId nLastUndoId(UNDO_EMPTY);
+ if (GetIDocumentUndoRedo().GetLastUndoInfo(0, & nLastUndoId)
+ && (UNDO_REDLINE == nLastUndoId))
{
- SwUndoRedline* pU = (SwUndoRedline*)RemoveLastUndo( UNDO_REDLINE );
+ // FIXME: why is this horrible cleanup necessary?
+ SwUndoRedline *const pU = dynamic_cast<SwUndoRedline*>(
+ GetUndoManager().RemoveLastUndo());
if( pU->GetRedlSaveCount() )
{
- SwUndoIter aUndoIter( &rPam, UNDO_REDLINE );
- pU->Undo( aUndoIter );
+ SwEditShell *const pEditShell(GetEditShell(0));
+ OSL_ASSERT(pEditShell);
+ ::sw::UndoRedoContext context(*this, *pEditShell);
+ static_cast<SfxUndoAction *>(pU)->UndoWithContext(context);
}
delete pU;
}
@@ -2418,7 +2435,9 @@ sal_uInt16 SwDoc::MergeTbl( SwPaM& rPam )
SetModified();
SetFieldsDirty( true, NULL, 0 );
if( pUndo )
- AppendUndo( pUndo );
+ {
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
+ }
}
else if( pUndo )
delete pUndo;
@@ -2429,7 +2448,7 @@ sal_uInt16 SwDoc::MergeTbl( SwPaM& rPam )
::ClearFEShellTabCols();
SetRedlineMode_intern( eOld );
}
- EndUndo( UNDO_TABLE_MERGE, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_TABLE_MERGE, NULL );
return nRet;
}
@@ -2929,7 +2948,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly, const SwCur
GetTabRows( aOld, 0, pBoxFrm );
- StartUndo( UNDO_TABLE_ATTR, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_ATTR, NULL );
// check for differences between aOld and rNew:
const sal_uInt16 nCount = rNew.Count();
@@ -3012,7 +3031,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly, const SwCur
}
}
- EndUndo( UNDO_TABLE_ATTR, NULL );
+ GetIDocumentUndoRedo().EndUndo( UNDO_TABLE_ATTR, NULL );
::ClearFEShellTabCols();
}
@@ -3023,10 +3042,10 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, sal_Bool bCurColOnly, const SwCur
void SwDoc::SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rOld,
const SwTableBox *pStart, sal_Bool bCurRowOnly )
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoAttrTbl( *rTab.GetTableNode(), sal_True ));
+ GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoAttrTbl( *rTab.GetTableNode(), TRUE ));
}
rTab.SetTabCols( rNew, rOld, pStart, bCurRowOnly );
::ClearFEShellTabCols();
@@ -3038,10 +3057,10 @@ void SwDoc::SetRowsToRepeat( SwTable &rTable, sal_uInt16 nSet )
if( nSet == rTable.GetRowsToRepeat() )
return;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoTblHeadline( rTable, rTable.GetRowsToRepeat() , nSet) );
+ GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoTblHeadline(rTable, rTable.GetRowsToRepeat(), nSet) );
}
SwMsgPoolItem aChg( RES_TBLHEADLINECHG );
@@ -3249,8 +3268,10 @@ sal_Bool SwDoc::SplitTable( const SwPosition& rPos, sal_uInt16 eHdlnMode,
SwTableFmlUpdate aMsgHnt( &rTbl );
SwHistory aHistory;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
aMsgHnt.pHistory = &aHistory;
+ }
{
sal_uLong nSttIdx = pNd->FindTableBoxStartNode()->GetIndex();
@@ -3287,10 +3308,11 @@ sal_Bool SwDoc::SplitTable( const SwPosition& rPos, sal_uInt16 eHdlnMode,
{
SwSaveRowSpan* pSaveRowSp = pNew->GetTable().CleanUpTopRowSpan( rTbl.GetTabLines().Count() );
SwUndoSplitTbl* pUndo = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( pUndo = new SwUndoSplitTbl( *pNew, pSaveRowSp, eHdlnMode, bCalcNewSize ));
+ pUndo = new SwUndoSplitTbl(
+ *pNew, pSaveRowSp, eHdlnMode, bCalcNewSize);
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
if( aHistory.Count() )
pUndo->SaveFormula( aHistory );
}
@@ -3612,11 +3634,10 @@ sal_Bool SwDoc::MergeTable( const SwPosition& rPos, sal_Bool bWithPrev, sal_uInt
// beide Tabellen vorhanden, also kanns losgehen
SwUndoMergeTbl* pUndo = 0;
SwHistory* pHistory = 0;
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( pUndo = new SwUndoMergeTbl( *pTblNd, *pDelTblNd,
- bWithPrev, nMode ));
+ pUndo = new SwUndoMergeTbl( *pTblNd, *pDelTblNd, bWithPrev, nMode );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
pHistory = new SwHistory;
}
@@ -3873,11 +3894,12 @@ sal_Bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt&
// Undo abschalten, Attribute werden sich vorher gemerkt
SwUndoTblAutoFmt* pUndo = 0;
- if( DoesUndo() )
+ bool const bUndo(GetIDocumentUndoRedo().DoesUndo());
+ if (bUndo)
{
- ClearRedo();
- AppendUndo( pUndo = new SwUndoTblAutoFmt( *pTblNd, rNew ) );
- DoUndo( sal_False );
+ pUndo = new SwUndoTblAutoFmt( *pTblNd, rNew );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ GetIDocumentUndoRedo().DoUndo(false);
}
_SetAFmtTabPara aPara( rNew );
@@ -3909,7 +3931,9 @@ sal_Bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt&
}
if( pUndo )
- DoUndo( sal_True );
+ {
+ GetIDocumentUndoRedo().DoUndo(bUndo);
+ }
SetModified();
SetFieldsDirty( true, NULL, 0 );
@@ -4062,6 +4086,7 @@ sal_Bool SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, sal_uInt16 eType,
aMsgHnt.eFlags = TBL_BOXPTR;
UpdateTblFlds( &aMsgHnt );
+ bool const bUndo(GetIDocumentUndoRedo().DoesUndo());
sal_Bool bRet = sal_False;
switch( eType & 0xff )
{
@@ -4072,7 +4097,7 @@ sal_Bool SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, sal_uInt16 eType,
{
bRet = pTblNd->GetTable().SetColWidth( rAktBox,
eType, nAbsDiff, nRelDiff,
- DoesUndo() ? &pUndo : 0 );
+ (bUndo) ? &pUndo : 0 );
}
break;
case nsTblChgWidthHeightType::WH_ROW_TOP:
@@ -4081,15 +4106,14 @@ sal_Bool SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, sal_uInt16 eType,
case nsTblChgWidthHeightType::WH_CELL_BOTTOM:
bRet = pTblNd->GetTable().SetRowHeight( rAktBox,
eType, nAbsDiff, nRelDiff,
- DoesUndo() ? &pUndo : 0 );
+ (bUndo) ? &pUndo : 0 );
break;
}
+ GetIDocumentUndoRedo().DoUndo(bUndo); // SetColWidth can turn it off
if( pUndo )
{
- ClearRedo();
- AppendUndo( pUndo );
- DoUndo( sal_True ); // im SetColWidth kann es abgeschaltet werden!
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
if( bRet )
@@ -4123,9 +4147,9 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, sal_Bool bCallUpdate )
bChgd = sal_False;
else
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- StartUndo( UNDO_TABLE_AUTOFMT, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_AUTOFMT, NULL );
pUndo = new SwUndoTblNumFmt( rBox );
pUndo->SetNumFmt( nFmtIdx, fNumber );
}
@@ -4198,9 +4222,9 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, sal_Bool bCallUpdate )
SFX_ITEM_SET == pBoxFmt->GetItemState( RES_BOXATR_VALUE,
sal_False, &pValueItem ))
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- StartUndo( UNDO_TABLE_AUTOFMT, NULL );
+ GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_AUTOFMT, NULL );
pUndo = new SwUndoTblNumFmt( rBox );
}
@@ -4231,8 +4255,8 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, sal_Bool bCallUpdate )
if( pUndo )
{
pUndo->SetBox( rBox );
- AppendUndo( pUndo );
- EndUndo( UNDO_END, NULL );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
const SwTableNode* pTblNd = rBox.GetSttNd()->FindTableNode();
@@ -4252,10 +4276,9 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, sal_Bool bCallUpdate )
void SwDoc::SetTblBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet )
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoTblNumFmt( rBox, &rSet ) );
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoTblNumFmt(rBox, &rSet) );
}
SwFrmFmt* pBoxFmt = rBox.ClaimFrmFmt();
@@ -4278,7 +4301,7 @@ void SwDoc::SetTblBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet )
void SwDoc::ClearBoxNumAttrs( const SwNodeIndex& rNode )
{
SwStartNode* pSttNd;
- if( 0 != ( pSttNd = GetNodes()[ rNode ]->
+ if( 0 != ( pSttNd = rNode.GetNode().
FindSttNodeByType( SwTableBoxStartNode )) &&
2 == pSttNd->EndOfSectionIndex() - pSttNd->GetIndex() )
{
@@ -4291,10 +4314,9 @@ void SwDoc::ClearBoxNumAttrs( const SwNodeIndex& rNode )
SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMULA, sal_False ) ||
SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_VALUE, sal_False ))
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoTblNumFmt( *pBox ) );
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoTblNumFmt(*pBox));
}
SwFrmFmt* pBoxFmt = pBox->ClaimFrmFmt();
@@ -4331,32 +4353,38 @@ sal_Bool SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
? pCpyTbl->GetTableNode()
: rBoxes[ 0 ]->GetSttNd()->FindTableNode();
- SwTableNode* pInsTblNd = GetNodes()[ rInsPos.nNode ]->FindTableNode();
+ SwTableNode * pInsTblNd = rInsPos.nNode.GetNode().FindTableNode();
+ bool const bUndo( GetIDocumentUndoRedo().DoesUndo() );
if( !pCpyTbl && !pInsTblNd )
{
SwUndoCpyTbl* pUndo = 0;
- if( DoesUndo() )
+ if (bUndo)
{
- ClearRedo();
+ GetIDocumentUndoRedo().ClearRedo();
pUndo = new SwUndoCpyTbl;
- DoUndo( sal_False );
}
- bRet = pSrcTblNd->GetTable().MakeCopy( this, rInsPos, rBoxes,
- sal_True, bCpyName );
+ {
+ ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
+ bRet = pSrcTblNd->GetTable().MakeCopy( this, rInsPos, rBoxes,
+ TRUE, bCpyName );
+ }
+
if( pUndo )
{
if( !bRet )
+ {
delete pUndo;
+ pUndo = 0;
+ }
else
{
pInsTblNd = GetNodes()[ rInsPos.nNode.GetIndex() - 1 ]->FindTableNode();
pUndo->SetTableSttIdx( pInsTblNd->GetIndex() );
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
- DoUndo( sal_True );
}
}
else
@@ -4368,11 +4396,11 @@ sal_Bool SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
nsRedlineMode_t::REDLINE_SHOW_DELETE));
SwUndoTblCpyTbl* pUndo = 0;
- if( DoesUndo() )
+ if (bUndo)
{
- ClearRedo();
+ GetIDocumentUndoRedo().ClearRedo();
pUndo = new SwUndoTblCpyTbl;
- DoUndo( sal_False );
+ GetIDocumentUndoRedo().DoUndo(false);
}
SwDoc* pCpyDoc = (SwDoc*)pSrcTblNd->GetDoc();
@@ -4392,8 +4420,9 @@ sal_Bool SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
if( pUndo )
{
- DoUndo( sal_True );
+ GetIDocumentUndoRedo().DoUndo(bUndo);
delete pUndo;
+ pUndo = 0;
}
return sal_False;
}
@@ -4445,11 +4474,13 @@ sal_Bool SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
{
// falls die Tabelle nicht kopiert werden konnte, das Undo-Object
// wieder loeschen
+ GetIDocumentUndoRedo().DoUndo(bUndo);
if( !bRet && pUndo->IsEmpty() )
delete pUndo;
else
- AppendUndo( pUndo );
- DoUndo( sal_True );
+ {
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
}
if( bCorrPos )
@@ -4473,8 +4504,9 @@ sal_Bool SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
sal_Bool SwDoc::_UnProtectTblCells( SwTable& rTbl )
{
sal_Bool bChgd = sal_False;
- SwUndoAttrTbl* pUndo = DoesUndo() ? new SwUndoAttrTbl( *rTbl.GetTableNode() )
- : 0;
+ SwUndoAttrTbl *const pUndo = (GetIDocumentUndoRedo().DoesUndo())
+ ? new SwUndoAttrTbl( *rTbl.GetTableNode() )
+ : 0;
SwTableSortBoxes& rSrtBox = rTbl.GetTabSortBoxes();
for( sal_uInt16 i = rSrtBox.Count(); i; )
@@ -4491,8 +4523,7 @@ sal_Bool SwDoc::_UnProtectTblCells( SwTable& rTbl )
{
if( bChgd )
{
- ClearRedo();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
else
delete pUndo;
@@ -4520,7 +4551,7 @@ sal_Bool SwDoc::UnProtectCells( const SwSelBoxes& rBoxes )
sal_Bool bChgd = sal_False;
if( rBoxes.Count() )
{
- SwUndoAttrTbl* pUndo = DoesUndo()
+ SwUndoAttrTbl *const pUndo = (GetIDocumentUndoRedo().DoesUndo())
? new SwUndoAttrTbl( *rBoxes[0]->GetSttNd()->FindTableNode() )
: 0;
@@ -4549,8 +4580,7 @@ sal_Bool SwDoc::UnProtectCells( const SwSelBoxes& rBoxes )
{
if( bChgd )
{
- ClearRedo();
- AppendUndo( pUndo );
+ GetIDocumentUndoRedo().AppendUndo( pUndo );
}
else
delete pUndo;
@@ -4561,7 +4591,7 @@ sal_Bool SwDoc::UnProtectCells( const SwSelBoxes& rBoxes )
sal_Bool SwDoc::UnProtectTbls( const SwPaM& rPam )
{
- StartUndo(UNDO_EMPTY, NULL);
+ GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
sal_Bool bChgd = sal_False, bHasSel = rPam.HasMark() ||
rPam.GetNext() != (SwPaM*)&rPam;
@@ -4595,7 +4625,7 @@ sal_Bool SwDoc::UnProtectTbls( const SwPaM& rPam )
bChgd |= _UnProtectTblCells( *pTbl );
}
- EndUndo(UNDO_EMPTY, NULL);
+ GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
if( bChgd )
SetModified();
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index 5c5bd1c77bf6..3d8b57df4101 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -29,10 +29,6 @@
#include "precompiled_sw.hxx"
-#ifdef WTC
-#define private public
-#endif
-
#include "hintids.hxx"
#include <editeng/lrspitem.hxx>
#include <editeng/boxitem.hxx>
@@ -49,7 +45,8 @@
#include <cntfrm.hxx>
#include <txtfrm.hxx>
#include <svx/svxids.hrc>
-#include "doc.hxx"
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include "pam.hxx"
#include "swcrsr.hxx"
#include "viscrs.hxx"
@@ -59,7 +56,8 @@
#include "swtblfmt.hxx"
#include "docary.hxx"
#include "ndindex.hxx"
-#include "undobj.hxx"
+#include <UndoTable.hxx>
+
using namespace ::com::sun::star;
@@ -337,10 +335,9 @@ void SwDoc::SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew )
if( aRowArr.Count() )
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoAttrTbl( *pTblNd ));
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd));
}
SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ), 255 );
@@ -398,10 +395,9 @@ void SwDoc::SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew )
if( aRowArr.Count() )
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoAttrTbl( *pTblNd ));
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd));
}
SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ), 255 );
@@ -472,10 +468,10 @@ sal_Bool SwDoc::BalanceRowHeight( const SwCursor& rCursor, sal_Bool bTstOnly )
}
SwFmtFrmSize aNew( ATT_MIN_SIZE, 0, nHeight );
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoAttrTbl( *pTblNd ));
+ GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoAttrTbl(*pTblNd));
}
SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ), 255 );
@@ -504,10 +500,9 @@ void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew
if( aRowArr.Count() )
{
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoAttrTbl( *pTblNd ));
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd));
}
SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aRowArr.Count()) ), 255 );
@@ -600,10 +595,9 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
if( aUnions.Count() )
{
SwTable& rTable = pTblNd->GetTable();
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoAttrTbl( *pTblNd ));
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTbl(*pTblNd) );
}
SvPtrarr aFmtCmp( 255, 255 );
@@ -849,10 +843,9 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
if( aUnions.Count() )
{
SwTable& rTable = pTblNd->GetTable();
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoAttrTbl( *pTblNd ));
+ GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd));
}
for( sal_uInt16 i = 0; i < aUnions.Count(); ++i )
@@ -1132,10 +1125,9 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew )
if( pTblNd && ::lcl_GetBoxSel( rCursor, aBoxes, sal_True ) )
{
SwTable& rTable = pTblNd->GetTable();
- if( DoesUndo() )
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- ClearRedo();
- AppendUndo( new SwUndoAttrTbl( *pTblNd ));
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTbl(*pTblNd) );
}
SvPtrarr aFmtCmp( Max( sal_uInt8(255), sal_uInt8(aBoxes.Count()) ), 255 );
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 0f704cd8a1cf..c0cae4c57a71 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -29,8 +29,10 @@
#include "precompiled_sw.hxx"
#include <stdlib.h>
+
#include <node.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <pam.hxx>
#include <txtfld.hxx>
#include <fmtfld.hxx>
@@ -226,9 +228,12 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
}
else
{
- int bSavePersData = GetDoc()->GetUndoNds() == &rNds;
- int bRestPersData = GetDoc()->GetUndoNds() == this;
+ bool bSavePersData(GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNds));
+ bool bRestPersData(GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this));
SwDoc* pDestDoc = rNds.GetDoc() != GetDoc() ? rNds.GetDoc() : 0;
+ OSL_ENSURE(!pDestDoc, "SwNodes::ChgNode(): "
+ "the code to handle text fields here looks broken\n"
+ "if the target is in a different document.");
if( !bRestPersData && !bSavePersData && pDestDoc )
bSavePersData = bRestPersData = sal_True;
@@ -305,8 +310,10 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz,
// Sonderbehandlung fuer die Felder!
if( pHts && pHts->Count() )
{
- int bToUndo = &pDestDoc->GetNodes() != &rNds;
- for( sal_uInt16 i = pHts->Count(); i; )
+ // this looks fishy if pDestDoc != 0
+ bool const bToUndo = !pDestDoc &&
+ GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNds);
+ for( USHORT i = pHts->Count(); i; )
{
sal_uInt16 nDelMsg = 0;
SwTxtAttr * const pAttr = pHts->GetTextHint( --i );
@@ -658,7 +665,8 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
}
}
- if( GetDoc()->GetUndoNds() == &rNodes )
+ if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(
+ rNodes))
{
SwFrmFmt* pTblFmt = pTblNd->GetTable().GetFrmFmt();
SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT,
@@ -695,8 +703,8 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
// noch den EndNode erzeugen
new SwEndNode( aIdx, *pTmp );
}
- else if( (const SwNodes*)&rNodes ==
- GetDoc()->GetUndoNds() )
+ else if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(
+ rNodes))
{
// im UndoNodes-Array spendieren wir einen
// Platzhalter
@@ -762,7 +770,7 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
case ND_SECTIONNODE:
if( !nLevel &&
- ( (const SwNodes*)&rNodes == GetDoc()->GetUndoNds() ) )
+ GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(rNodes))
{
// dann muss an der akt. InsPos ein SectionDummyNode
// eingefuegt werden
@@ -889,7 +897,7 @@ sal_Bool SwNodes::_MoveNodes( const SwNodeRange& aRange, SwNodes & rNodes,
break;
case ND_SECTIONDUMMY:
- if( (const SwNodes*)this == GetDoc()->GetUndoNds() )
+ if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this))
{
if( &rNodes == this ) // innerhalb vom UndoNodesArray
{
@@ -1461,8 +1469,7 @@ sal_uInt16 SwNodes::GetSectionLevel(const SwNodeIndex &rIdx) const {
* Keine Rekursion! - hier wird das SwNode::GetSectionLevel
* aufgerufen
*/
- return (*this)[rIdx]->GetSectionLevel();
-
+ return rIdx.GetNode().GetSectionLevel();
}
void SwNodes::GoStartOfSection(SwNodeIndex *pIdx) const
@@ -1790,8 +1797,8 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
SwNodeIndex aEndIdx( pEnd->nNode );
SwNodeIndex aSttIdx( pStt->nNode );
- SwTxtNode* const pSrcNd = (*this)[ aSttIdx ]->GetTxtNode();
- SwTxtNode* pDestNd = rNodes[ rPos.nNode ]->GetTxtNode();
+ SwTxtNode *const pSrcNd = aSttIdx.GetNode().GetTxtNode();
+ SwTxtNode * pDestNd = rPos.nNode.GetNode().GetTxtNode();
sal_Bool bSplitDestNd = sal_True;
sal_Bool bCopyCollFmt = pDestNd && !pDestNd->GetTxt().Len();
@@ -1841,10 +1848,8 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
if( rNodes.IsDocNodes() )
{
SwDoc* const pInsDoc = pDestNd->GetDoc();
- const bool bIsUndo = pInsDoc->DoesUndo();
- pInsDoc->DoUndo( false );
+ ::sw::UndoGuard const ug(pInsDoc->GetIDocumentUndoRedo());
pInsDoc->SplitNode( rPos, false );
- pInsDoc->DoUndo( bIsUndo );
}
else
{
@@ -1872,11 +1877,14 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
if( bCopyCollFmt )
{
SwDoc* const pInsDoc = pDestNd->GetDoc();
- const bool bIsUndo = pInsDoc->DoesUndo();
- pInsDoc->DoUndo( false );
+ ::sw::UndoGuard const undoGuard(pInsDoc->GetIDocumentUndoRedo());
pSrcNd->CopyCollFmt( *pDestNd );
+<<<<<<< local
pInsDoc->DoUndo( bIsUndo );
bCopyCollFmt = sal_False;
+=======
+ bCopyCollFmt = FALSE;
+>>>>>>> other
}
if( bOneNd ) // das wars schon
@@ -1911,10 +1919,8 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
if( rNodes.IsDocNodes() )
{
SwDoc* const pInsDoc = pDestNd->GetDoc();
- const bool bIsUndo = pInsDoc->DoesUndo();
- pInsDoc->DoUndo( false );
+ ::sw::UndoGuard const ug(pInsDoc->GetIDocumentUndoRedo());
pInsDoc->SplitNode( rPos, false );
- pInsDoc->DoUndo( bIsUndo );
}
else
{
@@ -1933,7 +1939,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
bSplitDestNd = sal_True;
}
- SwTxtNode* const pEndSrcNd = (*this)[ aEndIdx ]->GetTxtNode();
+ SwTxtNode* const pEndSrcNd = aEndIdx.GetNode().GetTxtNode();
if ( pEndSrcNd )
{
{
@@ -1952,7 +1958,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
}
else
{
- pDestNd = rNodes[ rPos.nNode ]->GetTxtNode();
+ pDestNd = rPos.nNode.GetNode().GetTxtNode();
}
if( pDestNd && pEnd->nContent.GetIndex() )
@@ -1966,10 +1972,8 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
if( bCopyCollFmt )
{
SwDoc* const pInsDoc = pDestNd->GetDoc();
- const bool bIsUndo = pInsDoc->DoesUndo();
- pInsDoc->DoUndo( false );
+ ::sw::UndoGuard const ug(pInsDoc->GetIDocumentUndoRedo());
pEndSrcNd->CopyCollFmt( *pDestNd );
- pInsDoc->DoUndo( bIsUndo );
}
}
}
@@ -2009,7 +2013,7 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes )
ASSERT( bSuccess, "Move() - no ContentNode here" );
(void) bSuccess;
}
- pStt->nContent.Assign( (*this)[ pStt->nNode ]->GetCntntNode(),
+ pStt->nContent.Assign( pStt->nNode.GetNode().GetCntntNode(),
pStt->nContent.GetIndex() );
// der PaM wird korrigiert, denn falls ueber Nodegrenzen verschoben
// wurde, so stehen sie in unterschielichen Nodes. Auch die Selektion
@@ -2054,7 +2058,7 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange,
SwNodeRange aRg( rRange );
// "einfache" StartNodes oder EndNodes ueberspringen
- while( ND_STARTNODE == (pAktNode = (*this)[ aRg.aStart ])->GetNodeType()
+ while( ND_STARTNODE == (pAktNode = & aRg.aStart.GetNode())->GetNodeType()
|| ( pAktNode->IsEndNode() &&
!pAktNode->pStartOfSection->IsSectionNode() ) )
aRg.aStart++;
@@ -2066,7 +2070,7 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange,
// special section nodes and then one before the first.
if (aRg.aEnd.GetNode().StartOfSectionIndex() != 0)
{
- while( (( pAktNode = (*this)[ aRg.aEnd ])->GetStartNode() &&
+ while( ((pAktNode = & aRg.aEnd.GetNode())->GetStartNode() &&
!pAktNode->IsSectionNode() ) ||
( pAktNode->IsEndNode() &&
ND_STARTNODE == pAktNode->pStartOfSection->GetNodeType()) )
@@ -2214,12 +2218,12 @@ void SwNodes::_CopyNodes( const SwNodeRange& rRange,
break;
case ND_SECTIONDUMMY:
- if( (const SwNodes*)this == GetDoc()->GetUndoNds() )
+ if (GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(*this))
{
// dann muss an der akt. InsPos auch ein SectionNode
// (Start/Ende) stehen; dann diesen ueberspringen.
// Andernfalls nicht weiter beachten.
- SwNode* pTmpNd = pDoc->GetNodes()[ aInsPos ];
+ SwNode *const pTmpNd = & aInsPos.GetNode();
if( pTmpNd->IsSectionNode() ||
pTmpNd->StartOfSectionNode()->IsSectionNode() )
aInsPos++; // ueberspringen
@@ -2294,7 +2298,8 @@ SwCntntNode* SwNodes::GoNextSection( SwNodeIndex * pIdx,
const SwNode* pNd;
while( aTmp < Count() - 1 )
{
- if( ND_SECTIONNODE == ( pNd = (*this)[aTmp])->GetNodeType() )
+ pNd = & aTmp.GetNode();
+ if (ND_SECTIONNODE == pNd->GetNodeType())
{
const SwSection& rSect = ((SwSectionNode*)pNd)->GetSection();
if( (bSkipHidden && rSect.IsHiddenFlag()) ||
@@ -2346,7 +2351,8 @@ SwCntntNode* SwNodes::GoPrevSection( SwNodeIndex * pIdx,
const SwNode* pNd;
while( aTmp > 0 )
{
- if( ND_ENDNODE == ( pNd = (*this)[aTmp])->GetNodeType() )
+ pNd = & aTmp.GetNode();
+ if (ND_ENDNODE == pNd->GetNodeType())
{
if( pNd->pStartOfSection->IsSectionNode() )
{
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index ccb6da231b07..54143770bb7c 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -28,8 +28,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
#include <stdlib.h>
+
#include <hintids.hxx>
#include <svl/intitem.hxx>
#include <svl/stritem.hxx>
@@ -46,6 +46,7 @@
#include <fmtpdsc.hxx>
#include <errhdl.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <node.hxx>
#include <pam.hxx>
#include <frmtool.hxx>
@@ -274,10 +275,8 @@ SwSection::~SwSection()
{
// Bug: 28191 - nicht ins Undo aufnehmen, sollte schon vorher
// geschehen sein!!
- sal_Bool bUndo = pDoc->DoesUndo();
- pDoc->DoUndo( sal_False );
+ ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
pDoc->DelSectionFmt( pFmt ); // und loeschen
- pDoc->DoUndo( bUndo );
}
}
if (m_RefObj.Is())
@@ -1447,8 +1446,8 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType,
// <--
// Undo immer abschalten
- sal_Bool bWasUndo = pDoc->DoesUndo();
- pDoc->DoUndo( sal_False );
+ bool const bWasUndo = pDoc->GetIDocumentUndoRedo().DoesUndo();
+ pDoc->GetIDocumentUndoRedo().DoUndo(false);
sal_Bool bWasVisibleLinks = pDoc->IsVisibleLinks();
pDoc->SetVisibleLinks( sal_False );
@@ -1685,9 +1684,9 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType,
}
- // Alle UndoActions entfernen und Undo wieder einschalten
- pDoc->DelAllUndoObj();
- pDoc->DoUndo( bWasUndo );
+ // remove all undo actions and turn undo on again
+ pDoc->GetIDocumentUndoRedo().DelAllUndoObj();
+ pDoc->GetIDocumentUndoRedo().DoUndo(bWasUndo);
pDoc->SetVisibleLinks( bWasVisibleLinks );
pDoc->UnlockExpFlds();
diff --git a/sw/source/core/docnode/swbaslnk.cxx b/sw/source/core/docnode/swbaslnk.cxx
index e2a504383e8e..4451b32c736e 100644
--- a/sw/source/core/docnode/swbaslnk.cxx
+++ b/sw/source/core/docnode/swbaslnk.cxx
@@ -354,7 +354,7 @@ sal_Bool SetGrfFlySize( const Size& rGrfSz, const Size& rFrmSz, SwGrfNode* pGrfN
SwNode *pANd;
SwTableNode *pTblNd;
if( pAPos &&
- 0 != (pANd = pDoc->GetNodes()[pAPos->nNode]) &&
+ 0 != (pANd = & pAPos->nNode.GetNode()) &&
0 != (pTblNd = pANd->FindTableNode()) )
{
const sal_Bool bLastGrf = !pTblNd->GetTable().DecGrfsThatResize();
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index 29def9485518..e8b5c378a2ec 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -43,6 +43,7 @@
#include "cntfrm.hxx"
#include "frmatr.hxx"
#include "doc.hxx"
+#include <IDocumentUndoRedo.hxx>
#include "dview.hxx"
#include "dflyobj.hxx"
#include "flyfrm.hxx"
@@ -884,7 +885,7 @@ void __EXPORT SwVirtFlyDrawObj::Move(const Size& rSiz)
{
NbcMove( rSiz );
SetChanged();
- GetFmt()->GetDoc()->SetNoDrawUndoObj( sal_True );
+ GetFmt()->GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(false);
}
@@ -893,7 +894,7 @@ void __EXPORT SwVirtFlyDrawObj::Resize(const Point& rRef,
{
NbcResize( rRef, xFact, yFact );
SetChanged();
- GetFmt()->GetDoc()->SetNoDrawUndoObj( sal_True );
+ GetFmt()->GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(false);
}
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index 38ca0fd6e96f..e7e1ae88f266 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -52,6 +52,7 @@
#include <ndole.hxx>
#include <fmtanchr.hxx>
#include "shellres.hxx"
+#include <IDocumentUndoRedo.hxx>
// #i7672#
#include <editeng/outliner.hxx>
@@ -1085,7 +1086,7 @@ void SwDrawView::DeleteMarked()
SwDoc* pDoc = Imp().GetShell()->GetDoc();
if ( pDoc->GetRootFrm() )
pDoc->GetRootFrm()->StartAllAction();
- pDoc->StartUndo(UNDO_EMPTY, NULL);
+ pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
// OD 18.06.2003 #108784# - replace marked <SwDrawVirtObj>-objects by its
// reference objects.
{
@@ -1104,7 +1105,7 @@ void SwDrawView::DeleteMarked()
FmFormView::DeleteMarked();
::FrameNotify( Imp().GetShell(), FLY_DRAG_END );
}
- pDoc->EndUndo(UNDO_EMPTY, NULL);
+ pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
if( pDoc->GetRootFrm() )
pDoc->GetRootFrm()->EndAllAction();
}
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index 9ac7ff7c64cb..dad951e3848a 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -32,9 +32,7 @@
#define _STD_VAR_ARRAYS
#include <hintids.hxx>
-#ifndef _SVX_SVXIDS_HRC
#include <svx/svxids.hrc>
-#endif
#include <editeng/langitem.hxx>
#include <fmtinfmt.hxx>
#include <txtatr.hxx>
@@ -96,17 +94,19 @@ void _PaMIntoCrsrShellRing::RemoveFromRing( SwPaM& rPam, Ring* pPrev )
SwAutoCorrDoc::SwAutoCorrDoc( SwEditShell& rEditShell, SwPaM& rPam,
sal_Unicode cIns )
- : rEditSh( rEditShell ), rCrsr( rPam ), pIdx( 0 ),
- nUndoId( UNDO_EMPTY ),
- bUndoIdInitialized( cIns ? false : true )
+ : rEditSh( rEditShell ), rCrsr( rPam ), pIdx( 0 )
+ , m_nEndUndoCounter(0)
+ , bUndoIdInitialized( cIns ? false : true )
{
}
SwAutoCorrDoc::~SwAutoCorrDoc()
{
- if( UNDO_EMPTY != nUndoId )
- rEditSh.EndUndo( nUndoId );
+ for (int i = 0; i < m_nEndUndoCounter; ++i)
+ {
+ rEditSh.EndUndo();
+ }
delete pIdx;
}
@@ -146,7 +146,10 @@ sal_Bool SwAutoCorrDoc::Insert( xub_StrLen nPos, const String& rTxt )
{
bUndoIdInitialized = true;
if( 1 == rTxt.Len() )
- rEditSh.StartUndo( nUndoId = UNDO_AUTOCORRECT );
+ {
+ rEditSh.StartUndo( UNDO_AUTOCORRECT );
+ ++m_nEndUndoCounter;
+ }
}
return sal_True;
}
@@ -215,7 +218,10 @@ sal_Bool SwAutoCorrDoc::Replace( xub_StrLen nPos, const String& rTxt )
{
bUndoIdInitialized = true;
if( 1 == rTxt.Len() )
- rEditSh.StartUndo( nUndoId = UNDO_AUTOCORRECT );
+ {
+ rEditSh.StartUndo( UNDO_AUTOCORRECT );
+ ++m_nEndUndoCounter;
+ }
}
}
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 7987106cd349..828adb14ff10 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -36,7 +36,11 @@
#include <hintids.hxx>
#include <svl/svstdarr.hxx>
+
#include <unotools/charclass.hxx>
+
+#include <vcl/msgbox.hxx>
+
#include <editeng/boxitem.hxx>
#include <editeng/lrspitem.hxx>
#include <editeng/brkitem.hxx>
@@ -46,12 +50,13 @@
#include <editeng/langitem.hxx>
#include <editeng/cscoitem.hxx>
#include <editeng/unolingu.hxx>
-
#include <editeng/acorrcfg.hxx>
+
#include <swwait.hxx>
#include <fmtpdsc.hxx>
#include <fmtanchr.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <editsh.hxx>
#include <index.hxx>
@@ -72,13 +77,8 @@
#include <frmatr.hxx>
#include <charatr.hxx>
#include <mdiexp.hxx>
-#ifndef _STATSTR_HRC
#include <statstr.hrc>
-#endif
-#ifndef _COMCORE_HRC
#include <comcore.hrc>
-#endif
-#include <vcl/msgbox.hxx>
#include <numrule.hxx>
using namespace ::com::sun::star;
@@ -2253,7 +2253,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags,
pDoc->SetRedlineMode( eRedlMode );
// save undo state (might be turned off)
- sal_Bool bUndoState = pDoc->DoesUndo();
+ bool const bUndoState = pDoc->GetIDocumentUndoRedo().DoesUndo();
// wenn mehrere Zeilen, dann erstmal nicht mit
// dem nachfolgenden Absatz zusammenfassen.
@@ -2271,51 +2271,6 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags,
eStat = READ_NEXT_PARA;
while( !bEnde )
{
- // #95884# limit redline array size to prevent overflow and to conserve
- // memory
- if( pDoc->HasTooManyUndos() )
- {
- DBG_ASSERT( bUndoState, "undo overflow without undo?" );
-
- //ask user
- short nResult = m_nActionWhileAutoformatUndoBufferOverflow; // TODO: #102007# read the last decision of the user from configuration
- if(m_bAskForCancelUndoWhileBufferOverflow) // #102007# TODO: read the last decision of the user from configuration
- {
- Window* pParent = pEditShell?pEditShell->GetWin():NULL;
- WarningBox aWarning( pParent,SW_RES(MSG_DISABLE_UNDO_QUESTION));
- aWarning.SetDefaultCheckBoxText();
- sal_uInt16 nDefaultButton = nResult==RET_YES?BUTTONID_YES:(nResult==RET_NO?BUTTONID_NO:BUTTONID_CANCEL);
- aWarning.SetFocusButton(nDefaultButton);
- nResult = aWarning.Execute();
- m_bAskForCancelUndoWhileBufferOverflow = !aWarning.GetCheckBoxState();
- m_nActionWhileAutoformatUndoBufferOverflow = nResult;
- // TODO: #102007# store m_bAskForCancelUndoWhileBufferOverflow in configuration
- // TODO: #102007# store m_nActionWhileAutoformatUndoBufferOverflow in configuration
- }
-
- DBG_ASSERT( (nResult == RET_YES) || (nResult == RET_CANCEL) || (nResult == RET_NO),
- "unexpected result" );
-
- if( nResult == RET_YES )
- {
- // turn off undo and continue
- pDoc->DoUndo( sal_False );
- pDoc->DelAllUndoObj();
- }
- else if( nResult == RET_NO )
- {
- //stop autoformatting and keep changes
- eStat = IS_ENDE;
- }
- else if( nResult == RET_CANCEL )
- {
- //cancel autoformatting and undo changes
- eStat = IS_ENDE;
-
- // TODO: #102004# undo changes
- }
- }
-
switch( eStat )
{
case READ_NEXT_PARA:
@@ -2709,7 +2664,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags,
pDoc->SetRedlineMode( eOldMode );
// restore undo (in case it has been changed)
- pDoc->DoUndo( bUndoState );
+ pDoc->GetIDocumentUndoRedo().DoUndo(bUndoState);
// Prozent-Anzeige wieder abschalten
if( !aFlags.bAFmtByInput )
diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx
index 80bc442b8960..386814eda008 100644
--- a/sw/source/core/edit/edatmisc.cxx
+++ b/sw/source/core/edit/edatmisc.cxx
@@ -28,9 +28,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
#include <editsh.hxx>
#include <doc.hxx> // fuer aNodes
+#include <IDocumentUndoRedo.hxx>
#include <pam.hxx> // fuer SwPaM
#include <edimp.hxx> // fuer MACROS
#include <swundo.hxx> // fuer die UndoIds
@@ -49,7 +49,9 @@ void SwEditShell::ResetAttr( const SvUShortsSort* pAttrs )
StartAllAction();
sal_Bool bUndoGroup = GetCrsr()->GetNext() != GetCrsr();
if( bUndoGroup )
- GetDoc()->StartUndo(UNDO_RESETATTR, NULL);
+ {
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_RESETATTR, NULL);
+ }
FOREACHPAM_START(this)
// if ( PCURCRSR->HasMark() )
@@ -57,7 +59,9 @@ void SwEditShell::ResetAttr( const SvUShortsSort* pAttrs )
FOREACHPAM_END()
if( bUndoGroup )
- GetDoc()->EndUndo(UNDO_RESETATTR, NULL);
+ {
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_RESETATTR, NULL);
+ }
CallChgLnk();
EndAllAction();
}
@@ -71,12 +75,14 @@ void SwEditShell::GCAttr()
// Sonst Probleme im MouseBut.DownHdl - Bug 35562
// StartAllAction();
FOREACHPAM_START(this)
- SwTxtNode *pTxtNode;
if ( !PCURCRSR->HasMark() )
{
- if( 0 != (pTxtNode = GetDoc()->GetNodes()[
- PCURCRSR->GetPoint()->nNode]->GetTxtNode()))
+ SwTxtNode *const pTxtNode =
+ PCURCRSR->GetPoint()->nNode.GetNode().GetTxtNode();
+ if (pTxtNode)
+ {
pTxtNode->GCAttr();
+ }
}
else
{
@@ -133,7 +139,7 @@ void SwEditShell::SetAttr( const SfxPoolItem& rHint, sal_uInt16 nFlags )
if( pCrsr->GetNext() != pCrsr ) // Ring von Cursorn
{
sal_Bool bIsTblMode = IsTableMode();
- GetDoc()->StartUndo(UNDO_INSATTR, NULL);
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL);
FOREACHPAM_START(this)
if( PCURCRSR->HasMark() && ( bIsTblMode ||
@@ -143,7 +149,7 @@ void SwEditShell::SetAttr( const SfxPoolItem& rHint, sal_uInt16 nFlags )
}
FOREACHPAM_END()
- GetDoc()->EndUndo(UNDO_INSATTR, NULL);
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL);
}
else
{
@@ -163,7 +169,7 @@ void SwEditShell::SetAttr( const SfxItemSet& rSet, sal_uInt16 nFlags )
if( pCrsr->GetNext() != pCrsr ) // Ring von Cursorn
{
sal_Bool bIsTblMode = IsTableMode();
- GetDoc()->StartUndo(UNDO_INSATTR, NULL);
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL);
FOREACHPAM_START(this)
if( PCURCRSR->HasMark() && ( bIsTblMode ||
@@ -173,7 +179,7 @@ void SwEditShell::SetAttr( const SfxItemSet& rSet, sal_uInt16 nFlags )
}
FOREACHPAM_END()
- GetDoc()->EndUndo(UNDO_INSATTR, NULL);
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL);
}
else
{
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 16de81fc64bd..9125caadf0e9 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -31,6 +31,7 @@
#include <hintids.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <editsh.hxx>
#include <cntfrm.hxx>
#include <pam.hxx>
@@ -39,7 +40,6 @@
#include <IMark.hxx>
#include <docary.hxx>
#include <SwRewriter.hxx>
-#include <undobj.hxx>
#include <globals.hrc>
#include <comcore.hrc>
@@ -68,7 +68,7 @@ void SwEditShell::DeleteSel( SwPaM& rPam, sal_Bool* pUndo )
// in Tabellen das Undo gruppieren
if( pUndo && !*pUndo )
{
- GetDoc()->StartUndo( UNDO_START, NULL );
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
*pUndo = sal_True;
}
SwPaM aDelPam( *rPam.Start() );
@@ -129,7 +129,7 @@ long SwEditShell::Delete()
SwRewriter aRewriter;
aRewriter.AddRule(UNDO_ARG1, String(SW_RES(STR_MULTISEL)));
- GetDoc()->StartUndo( UNDO_DELETE, &aRewriter );
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_DELETE, &aRewriter);
}
FOREACHPAM_START(this)
@@ -138,7 +138,9 @@ long SwEditShell::Delete()
// falls eine Undo-Klammerung, dann hier beenden
if( bUndo )
- GetDoc()->EndUndo( UNDO_DELETE, NULL );
+ {
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_END, 0);
+ }
EndAllAction();
nRet = 1;
}
@@ -207,7 +209,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
// For block selection this list is filled with the insert positions
std::list< boost::shared_ptr<SwPosition> >::iterator pNextInsert = aInsertList.begin();
- pDestShell->GetDoc()->StartUndo( UNDO_START, NULL );
+ pDestShell->GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
FOREACHPAM_START(this)
if( !pPos )
@@ -289,7 +291,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell )
#endif
// Undo-Klammerung hier beenden
- pDestShell->GetDoc()->EndUndo( UNDO_END, NULL );
+ pDestShell->GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
pDestShell->EndAllAction();
pDestShell->SaveTblBoxCntnt( pDestShell->GetCrsr()->GetPoint() );
@@ -312,7 +314,7 @@ sal_Bool SwEditShell::Replace( const String& rNewStr, sal_Bool bRegExpRplc )
if( !HasReadonlySel() )
{
StartAllAction();
- GetDoc()->StartUndo(UNDO_EMPTY, NULL);
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
FOREACHPAM_START(this)
if( PCURCRSR->HasMark() && *PCURCRSR->GetMark() != *PCURCRSR->GetPoint() )
@@ -324,7 +326,7 @@ sal_Bool SwEditShell::Replace( const String& rNewStr, sal_Bool bRegExpRplc )
FOREACHPAM_END()
// Undo-Klammerung hier beenden
- GetDoc()->EndUndo(UNDO_EMPTY, NULL);
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
EndAllAction();
}
return bRet;
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 2f491e0babf6..838abeb659bd 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -33,6 +33,7 @@
#include <editeng/brkitem.hxx>
#include <editsh.hxx>
#include <doc.hxx> // fuer SwTxtFmtColls
+#include <IDocumentUndoRedo.hxx>
#include <edimp.hxx> // fuer MACROS
#include <ndtxt.hxx>
#include <paratr.hxx>
@@ -41,7 +42,7 @@
#include <viewopt.hxx>
// <--
#include <SwRewriter.hxx>
-#include <undobj.hxx>
+#include <numrule.hxx>
#include <swundo.hxx>
/*************************************
@@ -77,7 +78,7 @@ void SwEditShell::SetTxtFmtColl( SwTxtFmtColl *pFmt,
SwRewriter aRewriter;
aRewriter.AddRule(UNDO_ARG1, pLocal->GetName());
- GetDoc()->StartUndo(UNDO_SETFMTCOLL, &aRewriter);
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_SETFMTCOLL, &aRewriter);
FOREACHPAM_START(this)
if( !PCURCRSR->HasReadonlySel(
@@ -87,7 +88,7 @@ void SwEditShell::SetTxtFmtColl( SwTxtFmtColl *pFmt,
GetDoc()->SetTxtFmtColl( *PCURCRSR, pLocal, true, bResetListAttrs );
FOREACHPAM_END()
- GetDoc()->EndUndo(UNDO_SETFMTCOLL, NULL);
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_SETFMTCOLL, &aRewriter);
EndAllAction();
}
// <--
diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx
index b39fa2724f73..d07b5b7a1e6c 100644
--- a/sw/source/core/edit/edglbldc.cxx
+++ b/sw/source/core/edit/edglbldc.cxx
@@ -28,8 +28,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <editsh.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
@@ -52,7 +52,9 @@ void SwEditShell::SetGlblDocSaveLinks( sal_Bool bFlag )
{
getIDocumentSettingAccess()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, bFlag);
if( !GetDoc()->IsModified() ) // Bug 57028
- GetDoc()->SetUndoNoResetModified();
+ {
+ GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified();
+ }
GetDoc()->SetModified();
}
@@ -163,13 +165,13 @@ sal_Bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos,
sal_Bool bEndUndo = sal_False;
SwDoc* pMyDoc = GetDoc();
- SwTxtNode* pTxtNd = pMyDoc->GetNodes()[ rPos.nNode ]->GetTxtNode();
+ SwTxtNode *const pTxtNd = rPos.nNode.GetNode().GetTxtNode();
if( pTxtNd )
rPos.nContent.Assign( pTxtNd, 0 );
else
{
bEndUndo = sal_True;
- pMyDoc->StartUndo( UNDO_START, NULL );
+ pMyDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
rPos.nNode--;
pMyDoc->AppendTxtNode( rPos );
pCrsr->SetMark();
@@ -178,7 +180,9 @@ sal_Bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos,
InsertSection( rNew );
if( bEndUndo )
- pMyDoc->EndUndo( UNDO_END, NULL );
+ {
+ pMyDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ }
EndAllAction();
return sal_True;
@@ -209,7 +213,7 @@ sal_Bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos,
else
{
bEndUndo = sal_True;
- pMyDoc->StartUndo( UNDO_START, NULL );
+ pMyDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
rPos.nNode--;
pMyDoc->AppendTxtNode( rPos );
}
@@ -217,7 +221,9 @@ sal_Bool SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos,
InsertTableOf( rTOX );
if( bEndUndo )
- pMyDoc->EndUndo( UNDO_END, NULL );
+ {
+ pMyDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
+ }
EndAllAction();
return sal_True;
@@ -365,7 +371,7 @@ sal_Bool SwEditShell::GotoGlobalDocContent( const SwGlblDocContent& rPos )
rCrsrPos.nNode = rPos.GetDocPos();
SwDoc* pMyDoc = GetDoc();
- SwCntntNode* pCNd = pMyDoc->GetNodes()[ rCrsrPos.nNode ]->GetCntntNode();
+ SwCntntNode * pCNd = rCrsrPos.nNode.GetNode().GetCntntNode();
if( !pCNd )
pCNd = pMyDoc->GetNodes().GoNext( &rCrsrPos.nNode );
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 1698e4eb45bd..6e9dbd6f32ea 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -27,6 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+
#include <hintids.hxx>
#include <tools/list.hxx>
#include <tools/urlobj.hxx>
@@ -41,6 +42,7 @@
#include <frmfmt.hxx>
#include <charfmt.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <editsh.hxx>
#include <frame.hxx>
@@ -201,7 +203,7 @@ void SwEditShell::Overwrite(const String &rStr)
long SwEditShell::SplitNode( sal_Bool bAutoFormat, sal_Bool bCheckTableStart )
{
StartAllAction();
- GetDoc()->StartUndo(UNDO_EMPTY, NULL);
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
FOREACHPAM_START(this)
// eine Tabellen Zelle wird jetzt zu einer normalen Textzelle!
@@ -209,7 +211,7 @@ long SwEditShell::SplitNode( sal_Bool bAutoFormat, sal_Bool bCheckTableStart )
GetDoc()->SplitNode( *PCURCRSR->GetPoint(), bCheckTableStart );
FOREACHPAM_END()
- GetDoc()->EndUndo(UNDO_EMPTY, NULL);
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
if( bAutoFormat )
AutoFmtBySplitNode();
@@ -227,14 +229,14 @@ sal_Bool SwEditShell::AppendTxtNode()
{
sal_Bool bRet = sal_False;
StartAllAction();
- GetDoc()->StartUndo(UNDO_EMPTY, NULL);
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
FOREACHPAM_START(this)
GetDoc()->ClearBoxNumAttrs( PCURCRSR->GetPoint()->nNode );
bRet = GetDoc()->AppendTxtNode( *PCURCRSR->GetPoint()) || bRet;
FOREACHPAM_END()
- GetDoc()->EndUndo(UNDO_EMPTY, NULL);
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
ClearTblBoxCntnt();
@@ -752,8 +754,8 @@ sal_Bool SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const String& rStr, s
if( !rFmt.GetValue().Len() || ( !rStr.Len() && !HasSelection() ) )
return sal_False;
StartAllAction();
- GetDoc()->StartUndo( UNDO_UI_INSERT_URLTXT, NULL);
- sal_Bool bInsTxt = sal_True;
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_UI_INSERT_URLTXT, NULL);
+ BOOL bInsTxt = sal_True;
if( rStr.Len() )
{
@@ -796,7 +798,7 @@ sal_Bool SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const String& rStr, s
ClearMark();
if( bInsTxt )
DontExpandFmt();
- GetDoc()->EndUndo( UNDO_UI_INSERT_URLTXT, NULL );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_UI_INSERT_URLTXT, NULL );
EndAllAction();
return sal_True;
}
@@ -1169,14 +1171,14 @@ void SwEditShell::TransliterateText( sal_uInt32 nType )
SwPaM* pCrsr = GetCrsr();
if( pCrsr->GetNext() != pCrsr )
{
- GetDoc()->StartUndo(UNDO_EMPTY, NULL);
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
FOREACHPAM_START( this )
if( PCURCRSR->HasMark() )
GetDoc()->TransliterateText( *PCURCRSR, aTrans );
FOREACHPAM_END()
- GetDoc()->EndUndo(UNDO_EMPTY, NULL);
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
}
else
GetDoc()->TransliterateText( *pCrsr, aTrans );
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index 8f0ca257b77a..dfe4e13a2b08 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -35,9 +35,7 @@
#include <unoflatpara.hxx>
-#ifndef _COMCORE_HRC
#include <comcore.hrc>
-#endif
#include <hintids.hxx>
#include <linguistic/lngprops.hxx>
#include <vcl/msgbox.hxx>
@@ -49,6 +47,7 @@
#include <charatr.hxx>
#include <editsh.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <rootfrm.hxx> // SwRootFrm
#include <pam.hxx>
#include <swundo.hxx> // fuer die UndoIds
@@ -57,9 +56,7 @@
#include <viscrs.hxx> // SwShellCrsr
#include <SwGrammarMarkUp.hxx> // SwWrongList
#include <mdiexp.hxx> // Statusanzeige
-#ifndef _STATSTR_HRC
#include <statstr.hrc> // StatLine-String
-#endif
#include <cntfrm.hxx>
#include <crsskip.hxx>
#include <splargs.hxx>
@@ -1334,7 +1331,7 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions,
// iterate over the new portions, beginning at the end to take advantage of the previously
// saved content positions
- pDoc->StartUndo( UNDO_OVERWRITE, NULL );
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_OVERWRITE, NULL );
StartAction();
SwPaM *pCrsr = GetCrsr();
@@ -1463,7 +1460,7 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions,
// set continuation position for spell/grammar checking to the end of this sentence
pSpellIter->SetCurr( new SwPosition( *pCrsr->Start() ) );
- pDoc->EndUndo( UNDO_OVERWRITE, NULL );
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_OVERWRITE, NULL );
EndAction();
}
}
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index c680173d2d72..d740090d4694 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -33,6 +33,7 @@
#include <editsh.hxx>
#include <edimp.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <ndtxt.hxx>
#include <paratr.hxx>
#include <swundo.hxx>
@@ -153,12 +154,12 @@ sal_Bool SwEditShell::NoNum()
SwPaM* pCrsr = GetCrsr();
if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ?
{
- GetDoc()->StartUndo( UNDO_START, NULL );
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
bRet = bRet && GetDoc()->NoNum( aRangeArr.SetPam( n, aPam ));
- GetDoc()->EndUndo( UNDO_END, NULL );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
else
bRet = GetDoc()->NoNum( *pCrsr );
@@ -217,14 +218,14 @@ void SwEditShell::DelNumRules()
SwPaM* pCrsr = GetCrsr();
if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ?
{
- GetDoc()->StartUndo( UNDO_START, NULL );
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
{
GetDoc()->DelNumRules( aRangeArr.SetPam( n, aPam ) );
}
- GetDoc()->EndUndo( UNDO_END, NULL );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
else
GetDoc()->DelNumRules( *pCrsr );
@@ -255,12 +256,12 @@ sal_Bool SwEditShell::NumUpDown( sal_Bool bDown )
bRet = GetDoc()->NumUpDown( *pCrsr, bDown );
else
{
- GetDoc()->StartUndo( UNDO_START, NULL );
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
bRet = bRet && GetDoc()->NumUpDown( aRangeArr.SetPam( n, aPam ), bDown );
- GetDoc()->EndUndo( UNDO_END, NULL );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
GetDoc()->SetModified();
@@ -517,13 +518,13 @@ sal_Bool SwEditShell::OutlineUpDown( short nOffset )
bRet = GetDoc()->OutlineUpDown( *pCrsr, nOffset );
else
{
- GetDoc()->StartUndo( UNDO_START, NULL );
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
bRet = bRet && GetDoc()->OutlineUpDown(
aRangeArr.SetPam( n, aPam ), nOffset );
- GetDoc()->EndUndo( UNDO_END, NULL );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
GetDoc()->SetModified();
EndAllAction();
@@ -698,10 +699,11 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
{
StartAllAction();
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
+
SwPaM* pCrsr = GetCrsr();
if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ?
{
- GetDoc()->StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
@@ -715,21 +717,17 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule,
// <--
GetDoc()->SetCounted( aPam, true );
}
- GetDoc()->EndUndo( UNDO_END, NULL );
}
else
{
- GetDoc()->StartUndo( UNDO_START, NULL );
-
// --> OD 2008-02-08 #newlistlevelattrs#
// --> OD 2008-03-17 #refactorlists#
GetDoc()->SetNumRule( *pCrsr, rRule,
bCreateNewList, sContinuedListId,
sal_True, bResetIndentAttrs );
GetDoc()->SetCounted( *pCrsr, true );
-
- GetDoc()->EndUndo( UNDO_END, NULL );
}
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
EndAllAction();
}
@@ -761,12 +759,12 @@ void SwEditShell::SetNumRuleStart( sal_Bool bFlag )
SwPaM* pCrsr = GetCrsr();
if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ?
{
- GetDoc()->StartUndo( UNDO_START, NULL );
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
GetDoc()->SetNumRuleStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), bFlag );
- GetDoc()->EndUndo( UNDO_END, NULL );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
else
GetDoc()->SetNumRuleStart( *pCrsr->GetPoint(), bFlag );
@@ -790,12 +788,12 @@ void SwEditShell::SetNodeNumStart( sal_uInt16 nStt )
SwPaM* pCrsr = GetCrsr();
if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ?
{
- GetDoc()->StartUndo( UNDO_START, NULL );
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( *pCrsr );
SwPaM aPam( *pCrsr->GetPoint() );
for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
GetDoc()->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), nStt );
- GetDoc()->EndUndo( UNDO_END, NULL );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
else
GetDoc()->SetNodeNumStart( *pCrsr->GetPoint(), nStt );
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index f66d828c25ba..898e80a95f56 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -28,9 +28,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
-#include <doc.hxx>
#include <editsh.hxx>
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <pam.hxx>
#include <docary.hxx>
#include <swundo.hxx> // fuer die UndoIds
@@ -50,7 +50,7 @@ SwEditShell::InsertSection(
if( !IsTableMode() )
{
StartAllAction();
- GetDoc()->StartUndo( UNDO_INSSECTION, NULL );
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_INSSECTION, NULL );
FOREACHPAM_START(this)
SwSection const*const pNew =
@@ -59,8 +59,7 @@ SwEditShell::InsertSection(
pRet = pNew;
FOREACHPAM_END()
- // Undo-Klammerung hier beenden
- GetDoc()->EndUndo( UNDO_INSSECTION, NULL );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_INSSECTION, NULL );
EndAllAction();
}
return pRet;
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index 3fb7da8e1198..f67442d1be4b 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -35,9 +35,7 @@
#define _SVSTDARR_ULONGS
#include <svl/svstdarr.hxx>
-#ifndef _APP_HXX //autogen
#include <vcl/svapp.hxx>
-#endif
#include <vcl/window.hxx>
#include <editeng/boxitem.hxx>
#include <swwait.hxx>
@@ -45,6 +43,7 @@
#include <frmatr.hxx>
#include <editsh.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <cntfrm.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
@@ -259,7 +258,9 @@ void SwEditShell::SetTblChgMode( TblChgMode eMode )
{
((SwTable&)pTblNd->GetTable()).SetTblChgMode( eMode );
if( !GetDoc()->IsModified() ) // Bug 57028
- GetDoc()->SetUndoNoResetModified();
+ {
+ GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified();
+ }
GetDoc()->SetModified();
}
}
@@ -331,10 +332,10 @@ void SwEditShell::SetTblBoxFormulaAttrs( const SfxItemSet& rSet )
ClearTblBoxCntnt();
StartAllAction();
- GetDoc()->StartUndo( UNDO_START, NULL );
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
for( sal_uInt16 n = 0; n < aBoxes.Count(); ++n )
GetDoc()->SetTblBoxFormulaAttrs( *aBoxes[ n ], rSet );
- GetDoc()->EndUndo( UNDO_END, NULL );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
EndAllAction();
}
@@ -407,11 +408,11 @@ sal_Bool SwEditShell::SplitTable( sal_uInt16 eMode )
if( pCrsr->GetNode()->FindTableNode() )
{
StartAllAction();
- GetDoc()->StartUndo(UNDO_EMPTY, NULL);
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
bRet = GetDoc()->SplitTable( *pCrsr->GetPoint(), eMode, sal_True );
- GetDoc()->EndUndo(UNDO_EMPTY, NULL);
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
ClearFEShellTabCols();
EndAllAction();
}
@@ -425,11 +426,11 @@ sal_Bool SwEditShell::MergeTable( sal_Bool bWithPrev, sal_uInt16 nMode )
if( pCrsr->GetNode()->FindTableNode() )
{
StartAllAction();
- GetDoc()->StartUndo(UNDO_EMPTY, NULL);
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
bRet = GetDoc()->MergeTable( *pCrsr->GetPoint(), bWithPrev, nMode );
- GetDoc()->EndUndo(UNDO_EMPTY, NULL);
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL);
ClearFEShellTabCols();
EndAllAction();
}
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index 882b5b5b7bb0..d2403bae2625 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -27,38 +27,40 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+
#include <com/sun/star/util/SearchOptions.hpp>
#include <com/sun/star/util/SearchFlags.hpp>
#include <com/sun/star/i18n/TransliterationModules.hpp>
-
#include <tools/urlobj.hxx>
-#include <svtools/txtcmp.hxx>
-#ifndef SVTOOLS_FSTATHELPER_HXX
+
#include <svl/fstathelper.hxx>
-#endif
+
+#include <svtools/txtcmp.hxx>
+
#include <sfx2/docfile.hxx>
-#include "editeng/unolingu.hxx"
+
+#include <xmloff/odffields.hxx>
+
+#include <editeng/unolingu.hxx>
+
#include <swtypes.hxx>
#include <editsh.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <pam.hxx>
#include <viewopt.hxx>
#include <ndtxt.hxx>
#include <errhdl.hxx>
#include <swundo.hxx>
-#include <undobj.hxx>
#include <txttxmrk.hxx>
#include <edimp.hxx>
#include <tox.hxx>
#include <doctxm.hxx>
#include <docary.hxx>
#include <mdiexp.hxx>
-#ifndef _STATSTR_HRC
#include <statstr.hrc>
-#endif
#include <bookmrk.hxx>
-#include <xmloff/odffields.hxx>
using namespace ::com::sun::star;
@@ -211,7 +213,7 @@ sal_Bool SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pS
::StartProgress( STR_STATSTR_TOX_UPDATE, 0, 0, pDocSh );
::SetProgressText( STR_STATSTR_TOX_UPDATE, pDocSh );
- pMyDoc->StartUndo(UNDO_TOXCHANGE, NULL);
+ pMyDoc->GetIDocumentUndoRedo().StartUndo(UNDO_TOXCHANGE, NULL);
// Verzeichnisrumpf erzeugen
pTOX->Update(pSet);
@@ -226,7 +228,7 @@ sal_Bool SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pS
// Seitennummern eintragen
pTOX->UpdatePageNum();
- pMyDoc->EndUndo(UNDO_TOXCHANGE, NULL);
+ pMyDoc->GetIDocumentUndoRedo().EndUndo(UNDO_TOXCHANGE, NULL);
::EndProgress( pDocSh );
EndAllAction();
diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx
index aa4d6c43f6a9..1e27b3b44cfb 100644
--- a/sw/source/core/edit/edundo.cxx
+++ b/sw/source/core/edit/edundo.cxx
@@ -28,18 +28,20 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
#include <svx/svdview.hxx>
+
#include <editsh.hxx>
#include <fesh.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <pam.hxx>
-#include <undobj.hxx>
+#include <UndoCore.hxx>
#include <swundo.hxx>
#include <dcontact.hxx>
#include <flyfrm.hxx>
#include <frmfmt.hxx>
#include <viewimp.hxx>
+#include <docsh.hxx>
/** helper function to select all objects in an SdrMarkList;
@@ -47,16 +49,77 @@
void lcl_SelectSdrMarkList( SwEditShell* pShell,
const SdrMarkList* pSdrMarkList );
+bool SwEditShell::CursorsLocked() const
+{
+<<<<<<< local
sal_Bool SwEditShell::Undo( SwUndoId nUndoId, sal_uInt16 nCnt )
+=======
+ return GetDoc()->GetDocShell()->GetModel()->hasControllersLocked();
+}
+
+void
+SwEditShell::HandleUndoRedoContext(::sw::UndoRedoContext & rContext)
+{
+ // do nothing if somebody has locked controllers!
+ if (CursorsLocked())
+ {
+ return;
+ }
+
+ SwFrmFmt * pSelFmt(0);
+ SdrMarkList * pMarkList(0);
+ rContext.GetSelections(pSelFmt, pMarkList);
+
+ if (pSelFmt) // select frame
+ {
+ if (RES_DRAWFRMFMT == pSelFmt->Which())
+ {
+ SdrObject* pSObj = pSelFmt->FindSdrObject();
+ static_cast<SwFEShell*>(this)->SelectObj(
+ pSObj->GetCurrentBoundRect().Center() );
+ }
+ else
+ {
+ Point aPt;
+ SwFlyFrm *const pFly =
+ static_cast<SwFlyFrmFmt*>(pSelFmt)->GetFrm(& aPt, false);
+ if (pFly)
+ {
+ static_cast<SwFEShell*>(this)->SelectFlyFrm(*pFly, true);
+ }
+ }
+ }
+ else if (pMarkList)
+ {
+ lcl_SelectSdrMarkList( this, pMarkList );
+ }
+ else if (GetCrsr()->GetNext() != GetCrsr())
+ {
+ // current cursor is the last one:
+ // go around the ring, to the first cursor
+ GoNextCrsr();
+ }
+}
+
+bool SwEditShell::Undo(USHORT const nCount)
+>>>>>>> other
{
SET_CURR_SHELL( this );
// #105332# current undo state was not saved
+<<<<<<< local
sal_Bool bRet = sal_False;
sal_Bool bSaveDoesUndo = GetDoc()->DoesUndo();
+=======
+ ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
+ BOOL bRet = FALSE;
+>>>>>>> other
+<<<<<<< local
GetDoc()->DoUndo( sal_False );
+=======
+>>>>>>> other
StartAllAction();
{
// eigentlich muesste ja nur der aktuelle Cursor berarbeitet
@@ -69,8 +132,14 @@ sal_Bool SwEditShell::Undo( SwUndoId nUndoId, sal_uInt16 nCnt )
// JP 02.04.98: Cursor merken - beim Auto-Format/-Korrektur
// soll dieser wieder an die Position
+<<<<<<< local
SwUndoId nLastUndoId = GetDoc()->GetUndoIds(NULL, NULL);
sal_Bool bRestoreCrsr = 1 == nCnt && ( UNDO_AUTOFORMAT == nLastUndoId ||
+=======
+ SwUndoId nLastUndoId(UNDO_EMPTY);
+ GetDoc()->GetIDocumentUndoRedo().GetLastUndoInfo(0, & nLastUndoId);
+ bool bRestoreCrsr = 1 == nCount && (UNDO_AUTOFORMAT == nLastUndoId ||
+>>>>>>> other
UNDO_AUTOCORRECT == nLastUndoId );
Push();
@@ -80,6 +149,7 @@ sal_Bool SwEditShell::Undo( SwUndoId nUndoId, sal_uInt16 nCnt )
RedlineMode_t eOld = GetDoc()->GetRedlineMode();
+<<<<<<< local
SwUndoIter aUndoIter( GetCrsr(), nUndoId );
while( nCnt-- )
{
@@ -100,9 +170,23 @@ sal_Bool SwEditShell::Undo( SwUndoId nUndoId, sal_uInt16 nCnt )
}
} while( sal_True );
}
+=======
+ try {
+ for (USHORT i = 0; i < nCount; ++i)
+ {
+ bRet = GetDoc()->GetIDocumentUndoRedo().Undo()
+ || bRet;
+ }
+ } catch (::com::sun::star::uno::Exception & e) {
+ OSL_TRACE("SwEditShell::Undo(): exception caught:\n %s",
+ ::rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8)
+ .getStr());
+ }
+>>>>>>> other
Pop( !bRestoreCrsr );
+<<<<<<< local
if( aUndoIter.pSelFmt ) // dann erzeuge eine Rahmen-Selection
{
if( RES_DRAWFRMFMT == aUndoIter.pSelFmt->Which() )
@@ -126,6 +210,8 @@ sal_Bool SwEditShell::Undo( SwUndoId nUndoId, sal_uInt16 nCnt )
else if( GetCrsr()->GetNext() != GetCrsr() ) // gehe nach einem
GoNextCrsr(); // Undo zur alten Undo-Position !!
+=======
+>>>>>>> other
GetDoc()->SetRedlineMode( eOld );
GetDoc()->CompressRedlines();
@@ -134,21 +220,35 @@ sal_Bool SwEditShell::Undo( SwUndoId nUndoId, sal_uInt16 nCnt )
}
EndAllAction();
+<<<<<<< local
// #105332# undo state was not restored but set to sal_False everytime
GetDoc()->DoUndo( bSaveDoesUndo );
+=======
+>>>>>>> other
return bRet;
}
+<<<<<<< local
sal_uInt16 SwEditShell::Redo( sal_uInt16 nCnt )
+=======
+bool SwEditShell::Redo(USHORT const nCount)
+>>>>>>> other
{
SET_CURR_SHELL( this );
sal_Bool bRet = sal_False;
// #105332# undo state was not saved
+<<<<<<< local
sal_Bool bSaveDoesUndo = GetDoc()->DoesUndo();
+=======
+ ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
+>>>>>>> other
+<<<<<<< local
GetDoc()->DoUndo( sal_False );
+=======
+>>>>>>> other
StartAllAction();
{
@@ -166,6 +266,7 @@ sal_uInt16 SwEditShell::Redo( sal_uInt16 nCnt )
RedlineMode_t eOld = GetDoc()->GetRedlineMode();
+<<<<<<< local
SwUndoIter aUndoIter( GetCrsr(), UNDO_EMPTY );
while( nCnt-- )
{
@@ -211,6 +312,19 @@ sal_uInt16 SwEditShell::Redo( sal_uInt16 nCnt )
}
else if( GetCrsr()->GetNext() != GetCrsr() ) // gehe nach einem
GoNextCrsr(); // Redo zur alten Undo-Position !!
+=======
+ try {
+ for (USHORT i = 0; i < nCount; ++i)
+ {
+ bRet = GetDoc()->GetIDocumentUndoRedo().Redo()
+ || bRet;
+ }
+ } catch (::com::sun::star::uno::Exception & e) {
+ OSL_TRACE("SwEditShell::Redo(): exception caught:\n %s",
+ ::rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8)
+ .getStr());
+ }
+>>>>>>> other
GetDoc()->SetRedlineMode( eOld );
GetDoc()->CompressRedlines();
@@ -221,26 +335,41 @@ sal_uInt16 SwEditShell::Redo( sal_uInt16 nCnt )
EndAllAction();
+<<<<<<< local
// #105332# undo state was not restored but set sal_False everytime
GetDoc()->DoUndo( bSaveDoesUndo );
+=======
+>>>>>>> other
return bRet;
}
+<<<<<<< local
sal_uInt16 SwEditShell::Repeat( sal_uInt16 nCount )
+=======
+bool SwEditShell::Repeat(USHORT const nCount)
+>>>>>>> other
{
SET_CURR_SHELL( this );
sal_Bool bRet = sal_False;
StartAllAction();
- SwUndoIter aUndoIter( GetCrsr(), UNDO_EMPTY );
- bRet = GetDoc()->Repeat( aUndoIter, nCount ) || bRet;
+ try {
+ ::sw::RepeatContext context(*GetDoc(), *GetCrsr());
+ bRet = GetDoc()->GetIDocumentUndoRedo().Repeat( context, nCount )
+ || bRet;
+ } catch (::com::sun::star::uno::Exception & e) {
+ OSL_TRACE("SwEditShell::Repeat(): exception caught:\n %s",
+ ::rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8)
+ .getStr());
+ }
EndAllAction();
return bRet;
}
+<<<<<<< local
// abfragen/setzen der Anzahl von wiederherstellbaren Undo-Actions
sal_uInt16 SwEditShell::GetUndoActionCount()
@@ -256,6 +385,8 @@ void SwEditShell::SetUndoActionCount( sal_uInt16 nNew )
+=======
+>>>>>>> other
void lcl_SelectSdrMarkList( SwEditShell* pShell,
const SdrMarkList* pSdrMarkList )
diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx
index 81088bcc0e56..1a681ad2cf29 100644
--- a/sw/source/core/edit/edws.cxx
+++ b/sw/source/core/edit/edws.cxx
@@ -28,12 +28,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
-
-
#include <vcl/window.hxx>
+
#include <editsh.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <pam.hxx>
#include <docary.hxx>
#include <acorrect.hxx>
@@ -59,7 +58,7 @@ SwEditShell::SwEditShell( SwEditShell& rEdSH, Window *pWindow )
SwEditShell::SwEditShell( SwDoc& rDoc, Window *pWindow, const SwViewOption *pOptions )
: SwCrsrShell( rDoc, pWindow, pOptions )
{
- GetDoc()->DoUndo(true);
+ GetDoc()->GetIDocumentUndoRedo().DoUndo(true);
}
@@ -98,7 +97,7 @@ void SwEditShell::ResetModified()
void SwEditShell::SetUndoNoResetModified()
{
GetDoc()->SetModified();
- GetDoc()->SetUndoNoResetModified();
+ GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified();
}
/******************************************************************************
@@ -261,24 +260,24 @@ void SwEditShell::InsertTOXType(const SwTOXType& rTyp)
void SwEditShell::DoUndo( sal_Bool bOn )
-{ GetDoc()->DoUndo( bOn ); }
+{ GetDoc()->GetIDocumentUndoRedo().DoUndo( bOn ); }
sal_Bool SwEditShell::DoesUndo() const
-{ return GetDoc()->DoesUndo(); }
+{ return GetDoc()->GetIDocumentUndoRedo().DoesUndo(); }
void SwEditShell::DoGroupUndo( sal_Bool bOn )
-{ GetDoc()->DoGroupUndo( bOn ); }
+{ GetDoc()->GetIDocumentUndoRedo().DoGroupUndo( bOn ); }
sal_Bool SwEditShell::DoesGroupUndo() const
-{ return GetDoc()->DoesGroupUndo(); }
+{ return GetDoc()->GetIDocumentUndoRedo().DoesGroupUndo(); }
void SwEditShell::DelAllUndoObj()
{
- GetDoc()->DelAllUndoObj();
+ GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj();
}
// Zusammenfassen von Kontinuierlichen Insert/Delete/Overwrite von
@@ -289,44 +288,25 @@ void SwEditShell::DelAllUndoObj()
SwUndoId SwEditShell::StartUndo( SwUndoId eUndoId,
const SwRewriter *pRewriter )
-{ return GetDoc()->StartUndo( eUndoId, pRewriter ); }
+{ return GetDoc()->GetIDocumentUndoRedo().StartUndo( eUndoId, pRewriter ); }
// schliesst Klammerung der nUndoId, nicht vom UI benutzt
SwUndoId SwEditShell::EndUndo(SwUndoId eUndoId,
const SwRewriter *pRewriter)
-{ return GetDoc()->EndUndo(eUndoId, pRewriter); }
-
-// liefert die Id der letzten undofaehigen Aktion zurueck
-// fuellt ggf. VARARR mit sdbcx::User-UndoIds
-
-
-SwUndoId SwEditShell::GetUndoIds(String* pStr,SwUndoIds *pUndoIds) const
-{ return GetDoc()->GetUndoIds(pStr,pUndoIds); }
-
-String SwEditShell::GetUndoIdsStr(String* pStr,SwUndoIds *pUndoIds) const
-{ return GetDoc()->GetUndoIdsStr(pStr,pUndoIds); }
-
-// liefert die Id der letzten Redofaehigen Aktion zurueck
-// fuellt ggf. VARARR mit RedoIds
-
-
-SwUndoId SwEditShell::GetRedoIds(String* pStr,SwUndoIds *pRedoIds) const
-{ return GetDoc()->GetRedoIds(pStr,pRedoIds); }
-
-String SwEditShell::GetRedoIdsStr(String* pStr,SwUndoIds *pRedoIds) const
-{ return GetDoc()->GetRedoIdsStr(pStr,pRedoIds); }
+{ return GetDoc()->GetIDocumentUndoRedo().EndUndo(eUndoId, pRewriter); }
-// liefert die Id der letzten Repeatfaehigen Aktion zurueck
-// fuellt ggf. VARARR mit RedoIds
+bool SwEditShell::GetLastUndoInfo(::rtl::OUString *const o_pStr,
+ SwUndoId *const o_pId) const
+{ return GetDoc()->GetIDocumentUndoRedo().GetLastUndoInfo(o_pStr, o_pId); }
-SwUndoId SwEditShell::GetRepeatIds(String* pStr, SwUndoIds *pRedoIds) const
-{ return GetDoc()->GetRepeatIds(pStr,pRedoIds); }
+bool SwEditShell::GetFirstRedoInfo(::rtl::OUString *const o_pStr) const
+{ return GetDoc()->GetIDocumentUndoRedo().GetFirstRedoInfo(o_pStr); }
-String SwEditShell::GetRepeatIdsStr(String* pStr, SwUndoIds *pRedoIds) const
-{ return GetDoc()->GetRepeatIdsStr(pStr,pRedoIds); }
+SwUndoId SwEditShell::GetRepeatInfo(::rtl::OUString *const o_pStr) const
+{ return GetDoc()->GetIDocumentUndoRedo().GetRepeatInfo(o_pStr); }
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index ef64ce19420c..46bdd962df09 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -863,7 +863,7 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const String& rRefMark,
const ::sw::mark::IMark* pBkmk = ppMark->get();
const SwPosition* pPos = &pBkmk->GetMarkStart();
- pTxtNd = pDoc->GetNodes()[ pPos->nNode ]->GetTxtNode();
+ pTxtNd = pPos->nNode.GetNode().GetTxtNode();
*pStt = pPos->nContent.GetIndex();
if(pEnd)
{
diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx
index bbc8719fd2f6..8ecb54472f45 100644
--- a/sw/source/core/fields/usrfld.cxx
+++ b/sw/source/core/fields/usrfld.cxx
@@ -28,16 +28,16 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
#include <svl/zforlist.hxx>
#include <svl/zformat.hxx>
-#include <svx/svdmodel.hxx>
+#include <svx/svdmodel.hxx>
#include <calbck.hxx>
#include <calc.hxx>
#include <usrfld.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <editsh.hxx>
#include <dpage.hxx>
#include <unofldmid.h>
@@ -302,7 +302,9 @@ void SwUserFieldType::SetContent( const String& rStr, sal_uInt32 nFmt )
sal_Bool bModified = GetDoc()->IsModified();
GetDoc()->SetModified();
if( !bModified ) // Bug 57028
- GetDoc()->SetUndoNoResetModified();
+ {
+ GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified();
+ }
}
}
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index e0ac3b203a56..b433c17af7ed 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -68,6 +68,7 @@
#include <txtflcnt.hxx>
#include <fesh.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <rootfrm.hxx>
#include <ndtxt.hxx>
#include <pam.hxx>
@@ -104,7 +105,7 @@ sal_Bool SwFEShell::Copy( SwDoc* pClpDoc, const String* pNewClpTxt )
{
ASSERT( pClpDoc, "kein Clipboard-Dokument" );
- pClpDoc->DoUndo( sal_False ); // immer auf sal_False !!
+ pClpDoc->GetIDocumentUndoRedo().DoUndo(false); // always false!
// steht noch Inhalt im ClpDocument, dann muss dieser geloescht werden
SwNodeIndex aSttIdx( pClpDoc->GetNodes().GetEndOfExtras(), 2 );
@@ -733,7 +734,7 @@ sal_Bool SwFEShell::Paste( SwDoc* pClpDoc, sal_Bool bIncludingPageFrames )
sal_Bool bRet = sal_True, bDelTbl = sal_True;
StartAllAction();
- GetDoc()->StartUndo( UNDO_INSGLOSSARY, NULL );
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_INSGLOSSARY, NULL );
GetDoc()->LockExpFlds();
// When the clipboard content has been created by a rectangular selection
@@ -1112,7 +1113,7 @@ sal_Bool SwFEShell::Paste( SwDoc* pClpDoc, sal_Bool bIncludingPageFrames )
FOREACHPAM_END()
}
- GetDoc()->EndUndo( UNDO_INSGLOSSARY, NULL );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL );
// wurden neue Tabellenformeln eingefuegt ?
if( pTblFldTyp->GetDepends() )
@@ -1484,7 +1485,7 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt )
if( SW_PASTESDR_INSERT == nAction )
{
- GetDoc()->SetNoDrawUndoObj( sal_True );
+ ::sw::DrawUndoGuard drawUndoGuard(GetDoc()->GetIDocumentUndoRedo());
sal_Bool bDesignMode = pView->IsDesignMode();
if( !bDesignMode )
@@ -1525,7 +1526,6 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt )
if( !bDesignMode )
pView->SetDesignMode( sal_False );
}
- GetDoc()->SetNoDrawUndoObj( sal_False );
}
EndUndo();
EndAllAction();
diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx
index e2b322212224..0c79bc4ed159 100644
--- a/sw/source/core/frmedt/fedesc.cxx
+++ b/sw/source/core/frmedt/fedesc.cxx
@@ -28,11 +28,12 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <tools/ref.hxx>
#include <hintids.hxx>
-#include <tools/ref.hxx>
#include <fesh.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <pagefrm.hxx>
#include <rootfrm.hxx>
#include <cntfrm.hxx>
@@ -42,6 +43,7 @@
#include <tabfrm.hxx>
#include <edimp.hxx>
#include <SwStyleNameMapper.hxx>
+
/*************************************************************************
|*
|* SwFEShell::GetPageDescCnt()
@@ -144,11 +146,11 @@ void SwFEShell::ChgPageDesc( sal_uInt16 i, const SwPageDesc &rChged )
SET_CURR_SHELL( this );
//Fix i64842: because Undo has a very special way to handle header/footer content
// we have to copy the page descriptor before calling ChgPageDesc.
- const sal_Bool bDoesUndo( GetDoc()->DoesUndo() );
SwPageDesc aDesc( rChged );
- GetDoc()->DoUndo( sal_False );
- GetDoc()->CopyPageDesc(rChged, aDesc);
- GetDoc()->DoUndo( bDoesUndo );
+ {
+ ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
+ GetDoc()->CopyPageDesc(rChged, aDesc);
+ }
GetDoc()->ChgPageDesc( i, aDesc );
EndAllActionAndCall();
}
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 145f0e5d93dd..13db6377c8e2 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -55,6 +55,7 @@
#include <viewimp.hxx>
#include <viscrs.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <dview.hxx>
#include <dflyobj.hxx>
#include <dcontact.hxx>
@@ -707,7 +708,7 @@ const SwFrmFmt *SwFEShell::NewFlyFrm( const SfxItemSet& rSet, sal_Bool bAnchVali
SwFlyFrmFmt *pRet;
if( bMoveCntnt )
{
- GetDoc()->StartUndo( UNDO_INSLAYFMT, NULL );
+ GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_INSLAYFMT, NULL );
SwFmtAnchor* pOldAnchor = 0;
sal_Bool bHOriChgd = sal_False, bVOriChgd = sal_False;
SwFmtVertOrient aOldV;
@@ -765,9 +766,18 @@ const SwFrmFmt *SwFEShell::NewFlyFrm( const SfxItemSet& rSet, sal_Bool bAnchVali
// das verschieben von TabelleSelektion ist noch nicht
// Undofaehig - also darf das UmAnkern auch nicht
// aufgezeichnet werden.
- sal_Bool bDoesUndo = GetDoc()->DoesUndo();
- if( bDoesUndo && UNDO_INSLAYFMT == GetDoc()->GetUndoIds(NULL, NULL) )
- GetDoc()->DoUndo( sal_False );
+ bool const bDoesUndo =
+ GetDoc()->GetIDocumentUndoRedo().DoesUndo();
+ SwUndoId nLastUndoId(UNDO_EMPTY);
+ if (bDoesUndo &&
+ GetDoc()->GetIDocumentUndoRedo().GetLastUndoInfo(0,
+ & nLastUndoId))
+ {
+ if (UNDO_INSLAYFMT == nLastUndoId)
+ {
+ GetDoc()->GetIDocumentUndoRedo().DoUndo(false);
+ }
+ }
((SfxItemSet&)rSet).Put( *pOldAnchor );
@@ -777,11 +787,11 @@ const SwFrmFmt *SwFEShell::NewFlyFrm( const SfxItemSet& rSet, sal_Bool bAnchVali
((SfxItemSet&)rSet).Put( aOldV );
GetDoc()->SetFlyFrmAttr( *pRet, (SfxItemSet&)rSet );
- GetDoc()->DoUndo( bDoesUndo );
+ GetDoc()->GetIDocumentUndoRedo().DoUndo(bDoesUndo);
}
delete pOldAnchor;
}
- GetDoc()->EndUndo( UNDO_INSLAYFMT, NULL );
+ GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_INSLAYFMT, NULL );
}
else
/* #109161# If called from a shell try to propagate an
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index eb2f5062b773..a25a9442a629 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -71,6 +71,7 @@
#include "pagefrm.hxx"
#include "sectfrm.hxx"
#include "doc.hxx"
+#include <IDocumentUndoRedo.hxx>
#include "dview.hxx"
#include "dflyobj.hxx"
#include "dcontact.hxx"
@@ -722,7 +723,7 @@ long SwFEShell::EndDrag( const Point *, sal_Bool )
pView->EndDragObj();
// JP 18.08.95: DrawUndo-Action auf FlyFrames werden nicht gespeichert
// Die Fly aendern das Flag
- GetDoc()->SetNoDrawUndoObj( sal_False );
+ GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(true);
ChgAnchor( 0, sal_True );
EndUndo( UNDO_END );
@@ -1623,7 +1624,9 @@ sal_Bool SwFEShell::EndCreate( sal_uInt16 eSdrCreateCmd )
// das Undo abschalten
ASSERT( Imp()->HasDrawView(), "EndCreate without DrawView?" );
if( !Imp()->GetDrawView()->IsGroupEntered() )
- GetDoc()->SetNoDrawUndoObj( sal_True );
+ {
+ GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(false);
+ }
sal_Bool bCreate = Imp()->GetDrawView()->EndCreateObj(
SdrCreateCmd( eSdrCreateCmd ) );
GetDoc()->SetNoDrawUndoObj( sal_False );
@@ -1852,7 +1855,7 @@ sal_Bool SwFEShell::ImpEndCreate()
//Erzeugtes Object wegwerfen, so kann der Fly am elegentesten
//ueber vorhandene SS erzeugt werden.
- GetDoc()->SetNoDrawUndoObj( sal_True ); // siehe oben
+ GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(false); // see above
// --> OD 2005-08-08 #i52858# - method name changed
SdrPage *pPg = getIDocumentDrawModelAccess()->GetOrCreateDrawModel()->GetPage( 0 );
// <--
@@ -1865,7 +1868,7 @@ sal_Bool SwFEShell::ImpEndCreate()
pPg->RecalcObjOrdNums();
SdrObject* pRemovedObject = pPg->RemoveObject( rSdrObj.GetOrdNumDirect() );
SdrObject::Free( pRemovedObject );
- GetDoc()->SetNoDrawUndoObj( sal_False );
+ GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(true);
SwFlyFrm* pFlyFrm;
if( NewFlyFrm( aSet, sal_True ) &&
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index c94602e66177..fe05bc4c4dcf 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1017,7 +1017,7 @@ sal_Bool SwFEShell::HasBoxSelection() const
pNd->EndOfSectionIndex())
{
SwNodeIndex aIdx( *pNd->EndOfSectionNode(), -1 );
- SwCntntNode* pCNd = GetDoc()->GetNodes()[ aIdx ]->GetCntntNode();
+ SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode();
if( !pCNd )
{
pCNd = GetDoc()->GetNodes().GoPrevious( &aIdx );
@@ -1309,7 +1309,7 @@ sal_Bool SwFEShell::IsAdjustCellWidthAllowed( sal_Bool bBalance ) const
if ( pCNd->GetTxt().Len() )
return sal_True;
++aIdx;
- pCNd = GetDoc()->GetNodes()[ aIdx ]->GetTxtNode();
+ pCNd = aIdx.GetNode().GetTxtNode();
}
}
}
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 3353e8d2f9ac..4006e30922e8 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -28,15 +28,17 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-#include <hintids.hxx>
#include <editeng/boxitem.hxx>
#include <editeng/protitem.hxx>
+
+#include <hintids.hxx>
#include <fmtanchr.hxx>
#include <fmtfsize.hxx>
#include <frmatr.hxx>
#include <tblsel.hxx>
#include <crsrsh.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <pam.hxx>
#include <ndtxt.hxx>
@@ -50,7 +52,7 @@
#include <rootfrm.hxx>
#include <viscrs.hxx>
#include <swtblfmt.hxx>
-#include <undobj.hxx>
+#include <UndoTable.hxx>
#include <mvsave.hxx>
// OD 26.08.2003 #i18103#
#include <sectfrm.hxx>
@@ -1449,11 +1451,16 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
SwNodeIndex aSttNdIdx( *rPt.pSelBox->GetSttNd(), 1 );
// ein Node muss in der Box erhalten bleiben (sonst wird beim
// Move die gesamte Section geloescht)
+ bool const bUndo(pDoc->GetIDocumentUndoRedo().DoesUndo());
if( pUndo )
- pDoc->DoUndo( sal_False );
+ {
+ pDoc->GetIDocumentUndoRedo().DoUndo(false);
+ }
pDoc->AppendTxtNode( *aPam.GetPoint() );
if( pUndo )
- pDoc->DoUndo( sal_True );
+ {
+ pDoc->GetIDocumentUndoRedo().DoUndo(bUndo);
+ }
SwNodeRange aRg( aSttNdIdx, aPam.GetPoint()->nNode );
rInsPosNd++;
if( pUndo )
diff --git a/sw/inc/SwUndoFmt.hxx b/sw/source/core/inc/SwUndoFmt.hxx
index 157d87d2f26d..1df5436e7ad2 100644
--- a/sw/inc/SwUndoFmt.hxx
+++ b/sw/source/core/inc/SwUndoFmt.hxx
@@ -24,11 +24,13 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _SW_UNDO_TXT_FMT_COLL_HXX
-#define _SW_UNDO_TXT_FMT_COLL_HXX
+#ifndef SW_UNDO_TXT_FMT_COLL_HXX
+#define SW_UNDO_TXT_FMT_COLL_HXX
#include <undobj.hxx>
#include <swundo.hxx>
+#include <numrule.hxx>
+
class SwDoc;
class SwTxtFmtColl;
@@ -53,8 +55,8 @@ public:
SwDoc * pDoc);
virtual ~SwUndoFmtCreate();
- virtual void Undo(SwUndoIter & rIter);
- virtual void Redo(SwUndoIter & rIter);
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
virtual SwRewriter GetRewriter() const;
@@ -77,8 +79,8 @@ public:
SwUndoFmtDelete(SwUndoId nUndoId, SwFmt * pOld, SwDoc * pDoc);
~SwUndoFmtDelete();
- virtual void Undo(SwUndoIter & rIter);
- virtual void Redo(SwUndoIter & rIter);
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
virtual SwRewriter GetRewriter() const;
@@ -100,8 +102,8 @@ public:
SwDoc * pDoc);
~SwUndoRenameFmt();
- void Undo(SwUndoIter & rIter);
- void Redo(SwUndoIter & rIter);
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
SwRewriter GetRewriter() const;
@@ -213,8 +215,8 @@ class SwUndoNumruleCreate : public SwUndo
public:
SwUndoNumruleCreate(const SwNumRule * pNew, SwDoc * pDoc);
- virtual void Undo(SwUndoIter & rIter);
- virtual void Redo(SwUndoIter & rIter);
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
SwRewriter GetRewriter() const;
};
@@ -227,8 +229,8 @@ class SwUndoNumruleDelete : public SwUndo
public:
SwUndoNumruleDelete(const SwNumRule & aRule, SwDoc * pDoc);
- virtual void Undo(SwUndoIter & rIter);
- virtual void Redo(SwUndoIter & rIter);
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
SwRewriter GetRewriter() const;
};
@@ -242,9 +244,10 @@ class SwUndoNumruleRename : public SwUndo
SwUndoNumruleRename(const String & aOldName, const String & aNewName,
SwDoc * pDoc);
- virtual void Undo(SwUndoIter & rIter);
- virtual void Redo(SwUndoIter & rIter);
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
SwRewriter GetRewriter() const;
};
-#endif // _SW_UNDO_TXT_FMT_COLL_HXX
+
+#endif // SW_UNDO_TXT_FMT_COLL_HXX
diff --git a/sw/inc/SwUndoPageDesc.hxx b/sw/source/core/inc/SwUndoPageDesc.hxx
index 84a734b57937..1de717a453d6 100644
--- a/sw/inc/SwUndoPageDesc.hxx
+++ b/sw/source/core/inc/SwUndoPageDesc.hxx
@@ -24,8 +24,8 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _SW_UNDO_PAGE_DESC_HXX
-#define _SW_UNDO_PAGE_DESC_HXX
+#ifndef SW_UNDO_PAGE_DESC_HXX
+#define SW_UNDO_PAGE_DESC_HXX
#include <undobj.hxx>
#include <pagedesc.hxx>
@@ -48,9 +48,8 @@ public:
SwDoc * pDoc);
virtual ~SwUndoPageDesc();
- virtual void Undo(SwUndoIter & rIt);
- virtual void Redo(SwUndoIter & rIt);
- virtual void Repeat(SwUndoIter & rIt);
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
virtual SwRewriter GetRewriter() const;
};
@@ -61,13 +60,15 @@ class SwUndoPageDescCreate : public SwUndo
SwPageDescExt aNew;
SwDoc * pDoc;
+ void DoImpl();
+
public:
SwUndoPageDescCreate(const SwPageDesc * pNew, SwDoc * pDoc); // #116530#
virtual ~SwUndoPageDescCreate();
- virtual void Undo(SwUndoIter & rIt);
- virtual void Redo(SwUndoIter & rIt);
- virtual void Repeat(SwUndoIter & rIt);
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
virtual SwRewriter GetRewriter() const;
};
@@ -77,13 +78,15 @@ class SwUndoPageDescDelete : public SwUndo
SwPageDescExt aOld;
SwDoc * pDoc;
+ void DoImpl();
+
public:
SwUndoPageDescDelete(const SwPageDesc & aOld, SwDoc * pDoc);
virtual ~SwUndoPageDescDelete();
- virtual void Undo(SwUndoIter & rIt);
- virtual void Redo(SwUndoIter & rIt);
- virtual void Repeat(SwUndoIter & rIt);
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
virtual SwRewriter GetRewriter() const;
};
diff --git a/sw/inc/SwUndoTOXChange.hxx b/sw/source/core/inc/SwUndoTOXChange.hxx
index 36498fec9643..5fa221b23979 100644
--- a/sw/inc/SwUndoTOXChange.hxx
+++ b/sw/source/core/inc/SwUndoTOXChange.hxx
@@ -24,8 +24,9 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#ifndef _SW_UNDO_TOX_CHANGE_HXX
-#define _SW_UNDO_TOX_CHANGE_HXX
+#ifndef SW_UNDO_TOX_CHANGE_HXX
+#define SW_UNDO_TOX_CHANGE_HXX
+
#include <undobj.hxx>
#include <tox.hxx>
@@ -34,14 +35,15 @@ class SwUndoTOXChange : public SwUndo
SwTOXBase * pTOX, aOld, aNew;
void UpdateTOXBaseSection();
+ void DoImpl();
public:
SwUndoTOXChange(SwTOXBase * pTOX, const SwTOXBase & rNew);
virtual ~SwUndoTOXChange();
- virtual void Undo(SwUndoIter & rIter);
- virtual void Redo(SwUndoIter & rIter);
- virtual void Repeat(SwUndoIter & rIter);
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
};
-#endif //_SW_UNDO_TOX_CHANGE_HXX
+#endif // SW_UNDO_TOX_CHANGE_HXX
diff --git a/sw/source/core/inc/UndoAttribute.hxx b/sw/source/core/inc/UndoAttribute.hxx
new file mode 100644
index 000000000000..975e37202982
--- /dev/null
+++ b/sw/source/core/inc/UndoAttribute.hxx
@@ -0,0 +1,288 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_UNDO_ATTRIBUTE_HXX
+#define SW_UNDO_ATTRIBUTE_HXX
+
+#include <undobj.hxx>
+
+#include <memory>
+
+#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 <swtypes.hxx>
+#include <calbck.hxx>
+
+
+class SvxTabStopItem;
+class SwFmt;
+class SwFtnInfo;
+class SwEndNoteInfo;
+
+
+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;
+ 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 UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
+
+ void SaveRedlineData( const SwPaM& rPam, BOOL bInsCntnt );
+
+ SwHistory& GetHistory() { return *m_pHistory; }
+
+};
+
+class SwUndoResetAttr : public SwUndo, private SwUndRng
+{
+ const ::std::auto_ptr<SwHistory> m_pHistory;
+ SvUShortsSort m_Ids;
+ const USHORT m_nFormatId; // Format-Id for Redo
+
+public:
+ SwUndoResetAttr( const SwPaM&, USHORT nFmtId );
+ SwUndoResetAttr( const SwPosition&, USHORT nFmtId );
+
+ virtual ~SwUndoResetAttr();
+
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
+
+ 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
+ ULONG m_nNodeIndex;
+ const USHORT 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(::sw::UndoRedoContext & rContext);
+ // <--
+ // --> 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 UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
+
+ 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 USHORT nWhichId );
+ ~SwUndoFmtResetAttr();
+
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+
+ private:
+ // format at which a certain attribute is reset.
+ SwFmt * const m_pChangedFormat;
+ // which ID of the reset attribute
+ const USHORT m_nWhichId;
+ // old attribute which has been reset - needed for undo.
+ ::std::auto_ptr<SfxPoolItem> m_pOldItem;
+};
+// <--
+
+class SwUndoDontExpandFmt : public SwUndo
+{
+ const ULONG m_nNodeIndex;
+ const xub_StrLen m_nContentIndex;
+
+public:
+ SwUndoDontExpandFmt( const SwPosition& rPos );
+
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
+};
+
+// 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 SwUndoMoveLeftMargin : public SwUndo, private SwUndRng
+{
+ const ::std::auto_ptr<SwHistory> m_pHistory;
+ const bool m_bModulus;
+
+public:
+ SwUndoMoveLeftMargin( const SwPaM&, BOOL bRight, BOOL bModulus );
+
+ virtual ~SwUndoMoveLeftMargin();
+
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
+
+ SwHistory& GetHistory() { return *m_pHistory; }
+
+};
+
+
+//--------------------------------------------------------------------
+
+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 UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+};
+
+
+//--------------------------------------------------------------------
+
+class SwUndoChangeFootNote : public SwUndo, private SwUndRng
+{
+ const ::std::auto_ptr<SwHistory> m_pHistory;
+ const String m_Text;
+ const USHORT m_nNumber;
+ const bool m_bEndNote;
+
+public:
+ SwUndoChangeFootNote( const SwPaM& rRange, const String& rTxt,
+ USHORT nNum, bool bIsEndNote );
+ virtual ~SwUndoChangeFootNote();
+
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+ virtual void RepeatImpl( ::sw::RepeatContext & );
+
+ SwHistory& GetHistory() { return *m_pHistory; }
+};
+
+class SwUndoFootNoteInfo : public SwUndo
+{
+ ::std::auto_ptr<SwFtnInfo> m_pFootNoteInfo;
+
+public:
+ SwUndoFootNoteInfo( const SwFtnInfo &rInfo );
+
+ virtual ~SwUndoFootNoteInfo();
+
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+};
+
+class SwUndoEndNoteInfo : public SwUndo
+{
+ ::std::auto_ptr<SwEndNoteInfo> m_pEndNoteInfo;
+
+public:
+ SwUndoEndNoteInfo( const SwEndNoteInfo &rInfo );
+
+ virtual ~SwUndoEndNoteInfo();
+
+ virtual void UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+};
+
+#endif // SW_UNDO_ATTRIBUTE_HXX
+
diff --git a/sw/source/core/inc/UndoBookmark.hxx b/sw/source/core/inc/UndoBookmark.hxx
new file mode 100644
index 000000000000..87d774d0c43e
--- /dev/null
+++ b/sw/source/core/inc/UndoBookmark.hxx
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_UNDO_BOOKMARK_HXX
+#define SW_UNDO_BOOKMARK_HXX
+
+#include <undobj.hxx>
+
+
+class SwHistoryBookmark;
+
+namespace sw {
+ namespace mark {
+ class IMark;
+ }
+}
+
+
+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 UndoImpl( ::sw::UndoRedoContext & );
+ virtual void RedoImpl( ::sw::UndoRedoContext & );
+};
+
+#endif // SW_UNDO_BOOKMARK_HXX
+
diff --git a/sw/source/core/inc/UndoCore.hxx b/sw/source/core/inc/UndoCore.hxx
new file mode 100644
index 000000000000..ce91ef058032
--- /dev/null
+++ b/sw/source/core/inc/UndoCore.hxx
@@ -0,0 +1,263 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SW_UNDOCORE_HXX
+#define SW_UNDOCORE_HXX
+
+#include <undobj.hxx>
+
+#include <calbck.hxx>
+
+
+class SfxItemSet;
+class SwFmtColl;
+class SwFmtAnchor;
+class SdrMarkList;
+class SwUndoDelete;
+class SwRedlineSaveData;
+
+namespace sw {
+ class UndoManager;
+ class IShellCursorSupplier;
+}
+
+
+typedef SwRedlineSaveData* SwRedlineSaveDataPtr;
+SV_DECL_PTRARR_DEL( SwRedlineSaveDatas, SwRedlineSaveDataPtr, 8, 8 )
+
+
+namespace sw {
+
+class SW_DLLPRIVATE UndoRedoContext
+ : public SfxUndoContext
+{
+public:
+ UndoRedoContext(SwDoc & rDoc, IShellCursorSupplier & rCursorSupplier)
+ : m_rDoc(rDoc)
+ , m_rCursorSupplier(rCursorSupplier)
+ , m_pSelFmt(0)
+ , m_pMarkList(0)
+ { }
+
+ SwDoc & GetDoc() const { return m_rDoc; }
+
+ IShellCursorSupplier & GetCursorSupplier() { return m_rCursorSupplier; }
+
+ void SetSelections(SwFrmFmt *const pSelFmt, SdrMarkList *const pMarkList)
+ {
+ m_pSelFmt = pSelFmt;
+ m_pMarkList = pMarkList;
+ }
+ void GetSelections(SwFrmFmt *& o_rpSelFmt, SdrMarkList *& o_rpMarkList)
+ {
+ o_rpSelFmt = m_pSelFmt;
+ o_rpMarkList = m_pMarkList;
+ }
+
+private:
+ SwDoc & m_rDoc;
+ IShellCursorSupplier & m_rCursorSupplier;
+ SwFrmFmt * m_pSelFmt;
+ SdrMarkList * m_pMarkList;
+};
+
+class SW_DLLPRIVATE RepeatContext
+ : public SfxRepeatTarget
+{
+public:
+ RepeatContext(SwDoc & rDoc, SwPaM & rPaM)
+ : m_rDoc(rDoc)
+ , m_pCurrentPaM(& rPaM)
+ , m_bDeleteRepeated(false)
+ { }
+
+ SwDoc & GetDoc() const { return m_rDoc; }
+
+ SwPaM & GetRepeatPaM()
+ {
+ return *m_pCurrentPaM;
+ }
+