diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-07-18 10:20:32 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-07-18 17:27:09 +0100 |
commit | 165640076df65971eb01f887a3c285cd6eb61d94 (patch) | |
tree | 3272e9000a9f45e228aec631cddefd9f93013419 | |
parent | 8a9244afe9954e0f8e801a41d83e3c2084c620de (diff) |
Related: fdo#38244 include ODF_COMMENTRANGE in annotation undo/redo
make sure that insert->comment and undo/redo includes the insertion
of the dummy odfcomment from fdo#38244
Change-Id: Ib46afb194462a3bbfbe3b8e228ad04e522e64535
-rw-r--r-- | sw/source/ui/fldui/fldmgr.cxx | 9 | ||||
-rw-r--r-- | sw/source/ui/inc/wrtsh.hxx | 2 | ||||
-rw-r--r-- | sw/source/ui/wrtsh/wrtsh2.cxx | 11 |
3 files changed, 15 insertions, 7 deletions
diff --git a/sw/source/ui/fldui/fldmgr.cxx b/sw/source/ui/fldui/fldmgr.cxx index e465e9fae0af..ed483c1d6765 100644 --- a/sw/source/ui/fldui/fldmgr.cxx +++ b/sw/source/ui/fldui/fldmgr.cxx @@ -59,7 +59,6 @@ #include <svl/zforlist.hxx> #include <svl/zformat.hxx> #include <vcl/mnemonic.hxx> -#include <xmloff/odffields.hxx> #include <view.hxx> #include <wrtsh.hxx> // active window #include <doc.hxx> // active window @@ -1379,14 +1378,14 @@ sal_Bool SwFldMgr::InsertFld( const SwInsertFld_Data& rData, SwPaM *pPam ) // insert pCurShell->StartAllAction(); + SwPaM *pCommentRange = NULL; if (pPam && *pPam->GetPoint() != *pPam->GetMark() && rData.nTypeId == TYP_POSTITFLD) { - // If an annotation field is inserted, take care of the relevant fieldmark. - IDocumentMarkAccess* pMarksAccess = pCurShell->GetDoc()->getIDocumentMarkAccess(); - pMarksAccess->makeFieldBookmark(*pPam, OUString(), ODF_COMMENTRANGE); + // If an annotation field will be inserted, pass through the affected range + pCommentRange = pPam; } - pCurShell->Insert(*pFld); + pCurShell->Insert(*pFld, pCommentRange); if(bExp && bEvalExp) pCurShell->UpdateExpFlds(sal_True); diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx index 59431b4ab662..f2e1e3cb3814 100644 --- a/sw/source/ui/inc/wrtsh.hxx +++ b/sw/source/ui/inc/wrtsh.hxx @@ -296,7 +296,7 @@ typedef sal_Bool (SwWrtShell:: *FNSimpleMove)(); int IntelligentCut(int nSelectionType, sal_Bool bCut = sal_True); // edit - void Insert(SwField &); + void Insert(SwField &, SwPaM *pCommentRange = NULL); void Insert(const String &); // graphic void Insert( const String &rPath, const String &rFilter, diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx index 16196cc6b6e1..f6dda8c04003 100644 --- a/sw/source/ui/wrtsh/wrtsh2.cxx +++ b/sw/source/ui/wrtsh/wrtsh2.cxx @@ -72,7 +72,9 @@ #include <com/sun/star/document/XDocumentProperties.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> -void SwWrtShell::Insert(SwField &rFld) +#include <xmloff/odffields.hxx> + +void SwWrtShell::Insert(SwField &rFld, SwPaM *pCommentRange) { ResetCursorStack(); if(!CanInsert()) @@ -84,6 +86,13 @@ void SwWrtShell::Insert(SwField &rFld) StartUndo(UNDO_INSERT, &aRewriter); + if (pCommentRange && GetDoc()) + { + // If an annotation field is inserted, take care of the relevant fieldmark. + IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess(); + pMarksAccess->makeFieldBookmark(*pCommentRange, OUString(), ODF_COMMENTRANGE); + } + bool bDeleted = false; if( HasSelection() ) { |