summaryrefslogtreecommitdiff
path: root/sw/source/core/unocore
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/unocore')
-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
12 files changed, 86 insertions, 75 deletions
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index 590ddb6e803e..7a67b7748c97 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -40,12 +40,11 @@
#include <IMark.hxx>
#include <crossrefbookmark.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <swundo.hxx>
-#ifndef _COMCORE_HRC
#include <comcore.hrc>
-#endif
-#include <undobj.hxx>
+#include <SwRewriter.hxx>
#include <docsh.hxx>
@@ -376,9 +375,11 @@ throw (uno::RuntimeException)
aRewriter.AddRule(UNDO_ARG2, SW_RES(STR_YIELDS));
aRewriter.AddRule(UNDO_ARG3, lcl_QuoteName(rName));
- m_pImpl->m_pDoc->StartUndo(UNDO_BOOKMARK_RENAME, &aRewriter);
+ m_pImpl->m_pDoc->GetIDocumentUndoRedo().StartUndo(
+ UNDO_BOOKMARK_RENAME, &aRewriter);
pMarkAccess->renameMark(m_pImpl->m_pRegisteredBookmark, rName);
- m_pImpl->m_pDoc->EndUndo(UNDO_BOOKMARK_RENAME, NULL);
+ m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(
+ UNDO_BOOKMARK_RENAME, &aRewriter);
}
OUString SAL_CALL
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index bc205397ec80..ea8f94600272 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -43,6 +43,7 @@
#include <unoframe.hxx>
#include <unocrsr.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <IDocumentRedlineAccess.hxx>
#include <fmtftn.hxx>
#include <fmtpdsc.hxx>
@@ -708,7 +709,7 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
if( rPam.GetNext() != &rPam ) // Mehrfachselektion ?
{
- pDoc->StartUndo( UNDO_START, NULL );
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( rPam );
SwPaM aPam( *rPam.GetPoint() );
for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
@@ -718,7 +719,7 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
pDoc->SetNumRule( aRangeArr.SetPam( n, aPam ), aRule, false );
// <--
}
- pDoc->EndUndo( UNDO_END, NULL );
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
else
{
@@ -805,12 +806,12 @@ void resetCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& rPa
if( rPam.GetNext() != &rPam ) // Mehrfachselektion ?
{
- pDoc->StartUndo( UNDO_START, NULL );
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( rPam );
SwPaM aPam( *rPam.GetPoint() );
for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
pDoc->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), 1 );
- pDoc->EndUndo( UNDO_END, NULL );
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
else
pDoc->SetNodeNumStart( *rPam.GetPoint(), 0 );
@@ -1008,6 +1009,8 @@ sal_Bool DocInsertStringSplitCR(
IDocumentContentOperations::INS_EMPTYEXPAND)
: IDocumentContentOperations::INS_EMPTYEXPAND;
+ // grouping done in InsertString is intended for typing, not API calls
+ ::sw::GroupUndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
OUString aTxt;
xub_StrLen nStartIdx = 0;
SwTxtNode* const pTxtNd =
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 1248245d2c55..2a2e1e497d13 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -42,6 +42,7 @@
#include <svx/svditer.hxx>
#include <swunohelper.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <fmtcntnt.hxx>
#include <fmtflcnt.hxx>
#include <txtatr.hxx>
@@ -866,7 +867,7 @@ uno::Reference< drawing::XShapeGroup > SwXDrawPage::group(const uno::Reference<
if( !bFlyInCnt )
{
UnoActionContext aContext(pDoc);
- pDoc->StartUndo( UNDO_START, NULL );
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwDrawContact* pContact = pDoc->GroupSelection( *pPage->GetDrawView() );
pDoc->ChgAnchor(
@@ -880,7 +881,7 @@ uno::Reference< drawing::XShapeGroup > SwXDrawPage::group(const uno::Reference<
uno::Reference< uno::XInterface > xInt = pPage->GetInterface( pContact->GetMaster() );
xRet = uno::Reference< drawing::XShapeGroup >(xInt, uno::UNO_QUERY);
}
- pDoc->EndUndo( UNDO_END, NULL );
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
}
pPage->RemovePageView();
@@ -903,13 +904,13 @@ void SwXDrawPage::ungroup(const uno::Reference< drawing::XShapeGroup > & xShapeG
{
pPage->PreUnGroup(xShapeGroup);
UnoActionContext aContext(pDoc);
- pDoc->StartUndo( UNDO_START, NULL );
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
pDoc->UnGroupSelection( *pPage->GetDrawView() );
pDoc->ChgAnchor( pPage->GetDrawView()->GetMarkedObjectList(),
FLY_AT_PARA/*int eAnchorId*/,
sal_True, sal_False );
- pDoc->EndUndo( UNDO_END, NULL );
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
pPage->RemovePageView();
}
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 1513d9960d96..5ee3fc45f6f4 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -45,6 +45,7 @@
#include <memory>
#include <hints.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docsh.hxx>
#include <editsh.hxx>
#include <swcli.hxx>
@@ -1656,7 +1657,8 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
}
}
else if(FN_UNO_CLSID == pEntry->nWID || FN_UNO_MODEL == pEntry->nWID||
- FN_UNO_COMPONENT == pEntry->nWID ||FN_UNO_STREAM_NAME == pEntry->nWID)
+ FN_UNO_COMPONENT == pEntry->nWID ||FN_UNO_STREAM_NAME == pEntry->nWID||
+ FN_EMBEDDED_OBJECT == pEntry->nWID)
{
SwDoc* pDoc = pFmt->GetDoc();
const SwFmtCntnt* pCnt = &pFmt->GetCntnt();
@@ -1677,7 +1679,15 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
{
uno::Reference < lang::XComponent > xComp( xIP->getComponent(), uno::UNO_QUERY );
uno::Reference < frame::XModel > xModel( xComp, uno::UNO_QUERY );
- if ( xModel.is() )
+ if ( FN_EMBEDDED_OBJECT == pEntry->nWID )
+ {
+ // ensure the
+ ASSERT( pDoc->GetDocShell(), "no doc shell => no client site" );
+ if ( pDoc->GetDocShell() )
+ pDoc->GetDocShell()->GetIPClient( svt::EmbeddedObjectRef( xIP, embed::Aspects::MSOLE_CONTENT ) );
+ aAny <<= xIP;
+ }
+ else if ( xModel.is() )
aAny <<= xModel;
else if ( FN_UNO_COMPONENT == pEntry->nWID )
aAny <<= xComp;
@@ -2311,7 +2321,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
// xIPObj->OnDocumentPrinterChanged( pDoc->getPrinter( false ) );
UnoActionContext aAction(pDoc);
- pDoc->StartUndo(UNDO_INSERT, NULL);
+ pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
if(!bSizeFound)
{
//TODO/LATER: from where do I get a ViewAspect? And how do I transport it to the OLENode?
@@ -2358,7 +2368,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
pFmt2 = pDoc->Insert(aPam, xObjRef, &aFrmSet, NULL, NULL );
ASSERT( pFmt2, "Doc->Insert(notxt) failed." );
- pDoc->EndUndo(UNDO_INSERT, NULL);
+ pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
pFmt2->Add(this);
if(sName.Len())
pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt2, sName);
@@ -2368,11 +2378,11 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
{
::rtl::OUString sStreamName;
(*pStreamName) >>= sStreamName;
- pDoc->StartUndo(UNDO_INSERT, NULL);
+ pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
SwFlyFrmFmt* pFrmFmt = 0;
pFrmFmt = pDoc->InsertOLE( aPam, sStreamName, embed::Aspects::MSOLE_CONTENT, &aFrmSet, NULL, NULL );
- pDoc->EndUndo(UNDO_INSERT, NULL);
+ pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
pFrmFmt->Add(this);
if(sName.Len())
pDoc->SetFlyName((SwFlyFrmFmt&)*pFrmFmt, sName);
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index dc797b93b782..b0ef867efe71 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -1150,6 +1150,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ SW_PROP_NMID(UNO_NAME_GRAPHIC_URL), FN_UNO_REPLACEMENT_GRAPHIC_URL, CPPU_E2T(CPPUTYPE_OUSTRING), PropertyAttribute::MAYBEVOID, 0 },
{ SW_PROP_NMID(UNO_NAME_GRAPHIC), FN_UNO_REPLACEMENT_GRAPHIC, CPPU_E2T(CPPUTYPE_REFXGRAPHIC), PropertyAttribute::MAYBEVOID, 0 },
{ SW_PROP_NMID(UNO_NAME_COMPONENT),FN_UNO_COMPONENT, CPPU_E2T(CPPUTYPE_REFCOMPONENT), PropertyAttribute::READONLY, 0},
+ { SW_PROP_NMID(UNO_NAME_EMBEDDED_OBJECT),FN_EMBEDDED_OBJECT, CPPU_E2T(CPPUTPYE_REFEMBEDDEDOBJECT), PropertyAttribute::READONLY, 0},
// { SW_PROP_NMID(UNO_NAME_ALTERNATIVE_TEXT), FN_UNO_ALTERNATIVE_TEXT,CPPU_E2T(CPPUTYPE_OUSTRING), PROPERTY_NONE , 0 },
{0,0,0,0,0,0}
};
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 5d651905728a..d09f195e4dc4 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -40,6 +40,7 @@
#include <IMark.hxx>
#include <frmfmt.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <istyleaccess.hxx>
#include <ndtxt.hxx>
#include <ndnotxt.hxx>
@@ -66,9 +67,7 @@
#include <fmtfld.hxx>
#include <fmtpdsc.hxx>
#include <pagedesc.hxx>
-#ifndef _POOLFMT_HRC
#include <poolfmt.hrc>
-#endif
#include <poolfmt.hxx>
#include <edimp.hxx>
#include <fchrfmt.hxx>
@@ -350,13 +349,13 @@ throw (lang::IllegalArgumentException)
SwTxtFmtColl *const pLocal = pStyle->GetCollection();
UnoActionContext aAction(pDoc);
- pDoc->StartUndo( UNDO_START, NULL );
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPaM *pTmpCrsr = &rPaM;
do {
pDoc->SetTxtFmtColl(*pTmpCrsr, pLocal);
pTmpCrsr = static_cast<SwPaM*>(pTmpCrsr->GetNext());
} while ( pTmpCrsr != &rPaM );
- pDoc->EndUndo( UNDO_END, NULL );
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
/* -----------------06.07.98 07:38-------------------
@@ -427,7 +426,7 @@ lcl_SetNodeNumStart(SwPaM & rCrsr, uno::Any const& rValue)
if( rCrsr.GetNext() != &rCrsr ) // Mehrfachselektion ?
{
- pDoc->StartUndo( UNDO_START, NULL );
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
SwPamRanges aRangeArr( rCrsr );
SwPaM aPam( *rCrsr.GetPoint() );
for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
@@ -436,7 +435,7 @@ lcl_SetNodeNumStart(SwPaM & rCrsr, uno::Any const& rValue)
pDoc->SetNodeNumStart(*aRangeArr.SetPam( n, aPam ).GetPoint(),
nStt );
}
- pDoc->EndUndo( UNDO_END, NULL);
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
else
{
@@ -457,7 +456,7 @@ lcl_setCharFmtSequence(SwPaM & rPam, uno::Any const& rValue)
for (sal_Int32 nStyle = 0; nStyle < aCharStyles.getLength(); nStyle++)
{
uno::Any aStyle;
- rPam.GetDoc()->StartUndo(UNDO_START, NULL);
+ rPam.GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_START, NULL);
aStyle <<= aCharStyles.getConstArray()[nStyle];
// create a local set and apply each format directly
SfxItemSet aSet(rPam.GetDoc()->GetAttrPool(),
@@ -468,7 +467,7 @@ lcl_setCharFmtSequence(SwPaM & rPam, uno::Any const& rValue)
SwUnoCursorHelper::SetCrsrAttr(rPam, aSet, (nStyle)
? nsSetAttrMode::SETATTR_DONTREPLACE
: nsSetAttrMode::SETATTR_DEFAULT);
- rPam.GetDoc()->EndUndo(UNDO_START, NULL);
+ rPam.GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_START, NULL);
}
return true;
}
@@ -931,7 +930,7 @@ void SwXTextCursor::DeleteAndInsert(const ::rtl::OUString& rText,
SwDoc* pDoc = pUnoCrsr->GetDoc();
UnoActionContext aAction(pDoc);
const xub_StrLen nTxtLen = rText.getLength();
- pDoc->StartUndo(UNDO_INSERT, NULL);
+ pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
SwCursor * pCurrent = pUnoCrsr;
do
{
@@ -953,7 +952,7 @@ void SwXTextCursor::DeleteAndInsert(const ::rtl::OUString& rText,
}
pCurrent = static_cast<SwCursor *>(pCurrent->GetNext());
} while (pCurrent != pUnoCrsr);
- pDoc->EndUndo(UNDO_INSERT, NULL);
+ pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
}
}
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 76a42284309d..3990355937d4 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -37,6 +37,7 @@
#include <bookmrk.hxx>
#include <frmfmt.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <ndtxt.hxx>
#include <ndnotxt.hxx>
#include <unocrsr.hxx>
@@ -357,7 +358,7 @@ void SwUnoCursorHelper::SetCrsrAttr(SwPaM & rPam,
UnoActionContext aAction(pDoc);
if (rPam.GetNext() != &rPam) // Ring of Cursors
{
- pDoc->StartUndo(UNDO_INSATTR, NULL);
+ pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL);
SwPaM *pCurrent = &rPam;
do
@@ -371,7 +372,7 @@ void SwUnoCursorHelper::SetCrsrAttr(SwPaM & rPam,
pCurrent= static_cast<SwPaM *>(pCurrent->GetNext());
} while (pCurrent != &rPam);
- pDoc->EndUndo(UNDO_INSATTR, NULL);
+ pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL);
}
else
{
@@ -923,7 +924,7 @@ throw (uno::RuntimeException)
if (GetPositions(aCursor))
{
UnoActionContext aAction(& m_pImpl->m_rDoc);
- m_pImpl->m_rDoc.StartUndo(UNDO_INSERT, NULL);
+ m_pImpl->m_rDoc.GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
if (aCursor.HasMark())
{
m_pImpl->m_rDoc.DeleteAndJoin(aCursor);
@@ -938,7 +939,7 @@ throw (uno::RuntimeException)
aCursor.Left(rText.getLength(), CRSR_SKIP_CHARS, sal_False, sal_False);
}
SetPositions(aCursor);
- m_pImpl->m_rDoc.EndUndo(UNDO_INSERT, NULL);
+ m_pImpl->m_rDoc.GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
}
}
@@ -1794,7 +1795,7 @@ void SwUnoCursorHelper::SetString(SwCursor & rCursor, const OUString& rString)
// Start/EndAction
SwDoc *const pDoc = rCursor.GetDoc();
UnoActionContext aAction(pDoc);
- pDoc->StartUndo(UNDO_INSERT, NULL);
+ pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
if (rCursor.HasMark())
{
pDoc->DeleteAndJoin(rCursor);
@@ -1809,7 +1810,7 @@ void SwUnoCursorHelper::SetString(SwCursor & rCursor, const OUString& rString)
SwUnoCursorHelper::SelectPam(rCursor, true);
rCursor.Left(rString.getLength(), CRSR_SKIP_CHARS, sal_False, sal_False);
}
- pDoc->EndUndo(UNDO_INSERT, NULL);
+ pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
}
/******************************************************************
diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx
index 9f2c9feeae1c..7b8e1fc8dadb 100644
--- a/sw/source/core/unocore/unoprnms.cxx
+++ b/sw/source/core/unocore/unoprnms.cxx
@@ -779,6 +779,7 @@ const SwPropNameTab aPropNameTab = {
/* 0737 UNO_NAME_DESCRIPTION */ {MAP_CHAR_LEN("Description")},
/* 0738 UNO_NAME_META */ {MAP_CHAR_LEN("InContentMetadata")},
/* 0739 UNO_NAME_NESTED_TEXT_CONTENT */ {MAP_CHAR_LEN("NestedTextContent")},
+/* 0740 UNO_NAME_EMBEDDED_OBJECT */ {MAP_CHAR_LEN("EmbeddedObject")},
};
const SwPropNameLen& SwGetPropName( sal_uInt16 nId )
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 18884219082d..f95ac3385938 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -50,6 +50,7 @@
#include <unocrsr.hxx>
#include <section.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docsh.hxx>
#include <sfx2/docfile.hxx>
#include <docary.hxx>
@@ -327,7 +328,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
//das muss jetzt sal_True liefern
::sw::XTextRangeToSwPaM(aPam, xTextRange);
UnoActionContext aCont(pDoc);
- pDoc->StartUndo( UNDO_INSSECTION, NULL );
+ pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_INSSECTION, NULL );
if (!m_pImpl->m_sName.getLength())
{
@@ -456,7 +457,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
}
// Undo-Klammerung hier beenden
- pDoc->EndUndo( UNDO_INSSECTION, NULL );
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_INSSECTION, NULL );
m_pImpl->m_pProps.reset();
m_pImpl->m_bIsDescriptor = false;
}
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 1f20fe678344..a039160d8360 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -47,6 +47,7 @@
#include <editeng/paperinf.hxx>
#include <pagedesc.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <charfmt.hxx>
#include <cmdid.h>
@@ -3397,15 +3398,13 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl(
}
if(aBaseImpl.HasItemSet())
{
- sal_Bool bDoesUndo = GetDoc()->DoesUndo();
- if( bDoesUndo )
+ ::sw::UndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
+ if (undoGuard.UndoWasEnabled())
{
// Fix i64460: as long as Undo of page styles with header/footer causes trouble...
- GetDoc()->DelAllUndoObj();
- GetDoc()->DoUndo( sal_False );
+ GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj();
}
aBaseImpl.mxNewBase->SetItemSet(aBaseImpl.GetItemSet());
- GetDoc()->DoUndo( bDoesUndo );
}
}
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 7a8d9f175267..6160f196d987 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -45,6 +45,7 @@
#include <hints.hxx>
#include <swtblfmt.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <shellres.hxx>
#include <docary.hxx>
#include <ndole.hxx>
@@ -2505,7 +2506,7 @@ void SwXTextTable::attachToRange(const uno::Reference< text::XTextRange > & xTex
{
UnoActionContext aCont( pDoc );
- pDoc->StartUndo(UNDO_EMPTY, NULL);
+ pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
const SwTable *pTable = 0;
if( 0 != aPam.Start()->nContent.GetIndex() )
{
@@ -2564,9 +2565,8 @@ void SwXTextTable::attachToRange(const uno::Reference< text::XTextRange > & xTex
bIsDescriptor = sal_False;
DELETEZ(pTableProps);
}
- pDoc->EndUndo( UNDO_END, NULL );
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
}
-
}
else
throw lang::IllegalArgumentException();
@@ -3417,7 +3417,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
SwDoc* pDoc = pFmt->GetDoc();
SwTable* pTable = SwTable::FindTable( pFmt );
SwTableLines &rLines = pTable->GetTabLines();
- pDoc->StartUndo(UNDO_START, NULL);
+ pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_START, NULL);
for(sal_uInt16 i = 0; i < rLines.Count(); i++)
{
SwTableLine* pLine = rLines.GetObject(i);
@@ -3447,7 +3447,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName,
}
}
}
- pDoc->EndUndo(UNDO_END, NULL);
+ pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_END, NULL);
}
break;
case FN_UNO_TABLE_COLUMN_SEPARATORS:
@@ -3777,7 +3777,7 @@ void SwXTextTable::setName(const OUString& rName) throw( uno::RuntimeException )
while ( 0 != (pStNd = aIdx.GetNode().GetStartNode()) )
{
aIdx++;
- SwNode *pNd = pFmt->GetDoc()->GetNodes()[aIdx];
+ SwNode *const pNd = & aIdx.GetNode();
if ( pNd->IsOLENode() &&
aOldName == ((SwOLENode*)pNd)->GetChartTblName() )
{
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 6a57be5ec67a..875d0e23235d 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -28,6 +28,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
+#include <stdlib.h>
+
+#include <memory>
+#include <iostream>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/text/ControlCharacter.hpp>
@@ -57,12 +61,12 @@
#include <unoredline.hxx>
#include <unomap.hxx>
#include <unoprnms.hxx>
-#include <undobj.hxx>
#include <unoparagraph.hxx>
#include <unocrsrhelper.hxx>
#include <docsh.hxx>
#include <docary.hxx>
#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <redline.hxx>
#include <swundo.hxx>
#include <section.hxx>
@@ -72,10 +76,7 @@
#include <crsskip.hxx>
#include <ndtxt.hxx>
-#include <memory>
-#include <stdlib.h>
-#include <iostream>
using namespace ::com::sun::star;
using ::rtl::OUString;
@@ -404,12 +405,9 @@ throw (uno::RuntimeException)
// so the text is inserted before
UnoActionContext aContext(GetDoc());
SwPaM aInsertPam(*pPam->Start());
- const sal_Bool bGroupUndo = GetDoc()->DoesGroupUndo();
- GetDoc()->DoGroupUndo(sal_False);
-
+ ::sw::GroupUndoGuard const undoGuard(GetDoc()->GetIDocumentUndoRedo());
SwUnoCursorHelper::DocInsertStringSplitCR(
*GetDoc(), aInsertPam, rString, bForceExpandHints );
- GetDoc()->DoGroupUndo(bGroupUndo);
}
}
@@ -991,7 +989,7 @@ SwXText::setString(const OUString& rString) throw (uno::RuntimeException)
throw uno::RuntimeException();
}
- GetDoc()->StartUndo(UNDO_START, NULL);
+ GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_START, NULL);
//insert an empty paragraph at the start and at the end to ensure that
//all tables and sections can be removed by the selecting text::XTextCursor
if (CURSOR_META != m_pImpl->m_eType)
@@ -1029,14 +1027,14 @@ SwXText::setString(const OUString& rString) throw (uno::RuntimeException)
const uno::Reference< text::XTextCursor > xRet = CreateCursor();
if(!xRet.is())
{
- GetDoc()->EndUndo(UNDO_END, NULL);
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_END, NULL);
uno::RuntimeException aRuntime;
aRuntime.Message = C2U(cInvalidObject);
throw aRuntime;
}
xRet->gotoEnd(sal_True);
xRet->setString(rString);
- GetDoc()->EndUndo(UNDO_END, NULL);
+ GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_END, NULL);
}
//FIXME why is CheckForOwnMember duplicated in some insert methods?
@@ -1373,7 +1371,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
bool bIllegalException = false;
bool bRuntimeException = false;
::rtl::OUString sMessage;
- m_pDoc->StartUndo(UNDO_START , NULL);
+ m_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_START , NULL);
// find end node, go backward - don't skip tables because the new
// paragraph has to be the last node
//aPam.Move( fnMoveBackward, fnGoNode );
@@ -1425,11 +1423,10 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
}
}
}
- m_pDoc->EndUndo(UNDO_END, NULL);
+ m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_END, NULL);
if (bIllegalException || bRuntimeException)
{
- SwUndoIter aUndoIter( &aPam, UNDO_EMPTY );
- m_pDoc->Undo(aUndoIter);
+ m_pDoc->GetIDocumentUndoRedo().Undo();
if (bIllegalException)
{
lang::IllegalArgumentException aEx;
@@ -1483,7 +1480,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
bool bIllegalException = false;
bool bRuntimeException = false;
::rtl::OUString sMessage;
- m_pImpl->m_pDoc->StartUndo(UNDO_INSERT, NULL);
+ m_pImpl->m_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
// SwPaM aPam(*pStartNode->EndOfSectionNode());
//aPam.Move( fnMoveBackward, fnGoNode );
@@ -1538,11 +1535,10 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
}
}
}
- m_pImpl->m_pDoc->EndUndo(UNDO_INSERT, NULL);
+ m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
if (bIllegalException || bRuntimeException)
{
- SwUndoIter aUndoIter( pCursor, UNDO_EMPTY );
- m_pImpl->m_pDoc->Undo(aUndoIter);
+ m_pImpl->m_pDoc->GetIDocumentUndoRedo().Undo();
if (bIllegalException)
{
lang::IllegalArgumentException aEx;
@@ -1584,7 +1580,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
}
uno::Reference< text::XTextRange > xRet;
- m_pImpl->m_pDoc->StartUndo(UNDO_INSERT, NULL);
+ m_pImpl->m_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
// find end node, go backward - don't skip tables because the
// new paragraph has to be the last node
SwPaM aPam(*pStartNode->EndOfSectionNode());
@@ -1619,7 +1615,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
throw uno::RuntimeException();
}
}
- m_pImpl->m_pDoc->EndUndo(UNDO_INSERT, NULL);
+ m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
return xRet;
}
@@ -1666,7 +1662,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
pEndRange->Invalidate();
}
- m_pImpl->m_pDoc->StartUndo( UNDO_START, NULL );
+ m_pImpl->m_pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
bool bIllegalException = false;
bool bRuntimeException = false;
::rtl::OUString sMessage;
@@ -1817,11 +1813,10 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
}
}
- m_pImpl->m_pDoc->EndUndo(UNDO_END, NULL);
+ m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_END, NULL);
if (bIllegalException || bRuntimeException)
{
- SwUndoIter aUndoIter( &aStartPam, UNDO_EMPTY );
- m_pImpl->m_pDoc->Undo(aUndoIter);
+ m_pImpl->m_pDoc->GetIDocumentUndoRedo().Undo();
if (bIllegalException)
{
lang::IllegalArgumentException aEx;
@@ -2301,8 +2296,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
if(bExcept)
{
- SwUndoIter aUndoIter( &aLastPaM, UNDO_EMPTY );
- m_pImpl->m_pDoc->Undo(aUndoIter);
+ m_pImpl->m_pDoc->GetIDocumentUndoRedo().Undo();
throw lang::IllegalArgumentException();
}