diff options
Diffstat (limited to 'sw/source/core/doc/doc.cxx')
-rw-r--r-- | sw/source/core/doc/doc.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 571a9bb75c4c..938986058a72 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -68,6 +68,8 @@ #include <pam.hxx> #include <ndtxt.hxx> #include <swundo.hxx> +#include <rolbck.hxx> +#include <UndoAttribute.hxx> #include <UndoCore.hxx> #include <UndoTable.hxx> #include <pagedesc.hxx> @@ -1114,6 +1116,28 @@ sal_uInt16 SwDoc::GetRefMarks( std::vector<OUString>* pNames ) const return nCount; } +void SwDoc::DeleteFormatRefMark(const SwFormatRefMark* pFormatRefMark) +{ + const SwTextRefMark* pTextRefMark = pFormatRefMark->GetTextRefMark(); + SwTextNode& rTextNd = const_cast<SwTextNode&>(pTextRefMark->GetTextNode()); + std::unique_ptr<SwRegHistory> aRegHistory; + if (GetIDocumentUndoRedo().DoesUndo()) + { + SwUndoResetAttr* pUndo = new SwUndoResetAttr(SwPosition(rTextNd, pTextRefMark->GetStart()), + RES_TXTATR_REFMARK); + GetIDocumentUndoRedo().AppendUndo(std::unique_ptr<SwUndo>(pUndo)); + aRegHistory.reset(new SwRegHistory(rTextNd, &pUndo->GetHistory())); + rTextNd.GetpSwpHints()->Register(aRegHistory.get()); + } + rTextNd.DeleteAttribute(const_cast<SwTextRefMark*>(pTextRefMark)); + if (GetIDocumentUndoRedo().DoesUndo()) + { + if (rTextNd.GetpSwpHints()) + rTextNd.GetpSwpHints()->DeRegister(); + } + getIDocumentState().SetModified(); +} + static bool lcl_SpellAndGrammarAgain( SwNode* pNd, void* pArgs ) { SwTextNode *pTextNode = pNd->GetTextNode(); |