summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/docbm.cxx
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-12-11 15:24:40 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2014-12-11 15:31:26 +0100
commit9338bea6e8dfab8d360fe8ab19dd5d75071bfc2a (patch)
tree182dee01d203bc6bf86e48a9c4c53d10bd8e13f7 /sw/source/core/doc/docbm.cxx
parent08ece8d8731c045aee98e3ba7446f7683bb5ab84 (diff)
Add undo operation for deleting a bookmark + unit test, related fdo#51741
Change-Id: I79d8d3c30b6b0b2cc253963fdd50019aec033e12
Diffstat (limited to 'sw/source/core/doc/docbm.cxx')
-rw-r--r--sw/source/core/doc/docbm.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index d6d3d27e4df4..9567c3ab7606 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -29,6 +29,7 @@
#include <doc.hxx>
#include <IDocumentRedlineAccess.hxx>
#include <IDocumentState.hxx>
+#include <IDocumentUndoRedo.hxx>
#include <docary.hxx>
#include <xmloff/odffields.hxx>
#include <editsh.hxx>
@@ -49,6 +50,7 @@
#include <sfx2/linkmgr.hxx>
#include <swserv.hxx>
#include <swundo.hxx>
+#include <UndoBookmark.hxx>
#include <unocrsr.hxx>
#include <viscrs.hxx>
#include <edimp.hxx>
@@ -550,12 +552,18 @@ namespace sw { namespace mark
return false;
if (::sw::mark::MarkBase* pMarkBase = dynamic_cast< ::sw::mark::MarkBase* >(io_pMark))
{
- m_aMarkNamesSet.erase(pMarkBase->GetName());
+ const OUString sOldName(pMarkBase->GetName());
+ m_aMarkNamesSet.erase(sOldName);
m_aMarkNamesSet.insert(rNewName);
pMarkBase->SetName(rNewName);
- // fdo#51741 Bookmark should mark document as modified when renamed
- if (dynamic_cast< ::sw::mark::Bookmark* >(io_pMark)) {
+ if (dynamic_cast< ::sw::mark::Bookmark* >(io_pMark))
+ {
+ if (m_pDoc->GetIDocumentUndoRedo().DoesUndo())
+ {
+ m_pDoc->GetIDocumentUndoRedo().AppendUndo(
+ new SwUndoRenameBookmark(sOldName, rNewName));
+ }
m_pDoc->getIDocumentState().SetModified();
}
}