[PATCH] Copy fieldmark properties when copying/pasting, fdo#38374.
Jan Holesovsky
kendy at suse.cz
Fri Jul 1 07:35:39 PDT 2011
---
sw/source/core/docnode/ndcopy.cxx | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index acdb9a9..0176ada 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -186,14 +186,25 @@ namespace
// Explicitly try to get exactly the same name as in the source
// because NavigatorReminders, DdeBookmarks etc. ignore the proposed name
pDestDoc->getIDocumentMarkAccess()->renameMark(pNewMark, pMark->GetName());
+
+ // copying additional attributes for bookmarks or fieldmarks
::sw::mark::IBookmark* const pNewBookmark =
dynamic_cast< ::sw::mark::IBookmark* const >(pNewMark);
- if(pNewBookmark) /* copying additional attributes for bookmarks */
+ if(pNewBookmark)
{
const ::sw::mark::IBookmark* const pOldBookmark = dynamic_cast< const ::sw::mark::IBookmark* >(pMark);
pNewBookmark->SetKeyCode(pOldBookmark->GetKeyCode());
pNewBookmark->SetShortName(pOldBookmark->GetShortName());
}
+ ::sw::mark::IFieldmark* const pNewFieldmark =
+ dynamic_cast< ::sw::mark::IFieldmark* const >(pNewMark);
+ if(pNewFieldmark)
+ {
+ const ::sw::mark::IFieldmark* const pOldFieldmark = dynamic_cast< const ::sw::mark::IFieldmark* >(pMark);
+ pNewFieldmark->SetFieldname(pOldFieldmark->GetFieldname());
+ pNewFieldmark->SetFieldHelptext(pOldFieldmark->GetFieldHelptext());
+ }
+
::sfx2::Metadatable const*const pMetadatable(
dynamic_cast< ::sfx2::Metadatable const* >(pMark));
::sfx2::Metadatable *const pNewMetadatable(
--
1.7.5.4
--=-fLjIj5+lgK7eCVnVxtdN--
More information about the LibreOffice
mailing list