[Libreoffice] [REVIEW] Fix losing changes in a table in writer
Hi, https://bugs.freedesktop.org/show_bug.cgi?id=38374 In the document attached to the bug, when you copy the described table, do edits there, and save it as .doc, the changes are lost. These are in fact 2 bugs, but I fixed the more serious one. One is that when you copy/paste a fieldmark, the essential attributes are not preserved; later, when saving, the fieldmark is of unknown type, and ignored. We should save even the unknown fieldmarks I think, but here I fixed the root cause - that the attributes are not copied. Patch attached, please sign-off, and push to libreoffice-3-4. Thank you, Kendy From f1eaef6ec0f701cf3dfb223fdbc97c3eb17d1f9c Mon Sep 17 00:00:00 2001 From: Jan Holesovsky ke...@suse.cz Date: Fri, 1 Jul 2011 16:35:39 +0200 Subject: [PATCH] Copy fieldmark properties when copying/pasting, fdo#38374. --- 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 ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] [REVIEW] Fix losing changes in a table in writer
Hi Kendy, On Fri, 2011-07-01 at 16:43 +0200, Jan Holesovsky wrote: In the document attached to the bug, when you copy the described table, do edits there, and save it as .doc, the changes are lost. These are in fact 2 bugs, but I fixed the more serious one. One is that when you copy/paste a fieldmark, the essential attributes are not preserved; later, when saving, the fieldmark is of unknown type, and ignored. We should save even the unknown fieldmarks I think, but here I fixed the root cause - that the attributes are not copied. The patch is ok to me, but for completeness we should copy the GetParameters map too. Could you please review my changes for this? Patch attached, please sign-off, and push to libreoffice-3-4. I pushed it... but forgot to sign it off. -- Cédric Bosdonnat LibreOffice hacker http://documentfoundation.org OOo Eclipse Integration developer http://cedric.bosdonnat.free.fr From 01fb7a1648a74d3171c30b57fb4e185d92187160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= cedric.bosdonnat@free.fr Date: Fri, 1 Jul 2011 18:23:07 +0200 Subject: [PATCH] copied the IFieldMark::GetParameters too --- sw/source/core/docnode/ndcopy.cxx |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index 0176ada..6272576 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -203,6 +203,14 @@ namespace const ::sw::mark::IFieldmark* const pOldFieldmark = dynamic_cast const ::sw::mark::IFieldmark* (pMark); pNewFieldmark-SetFieldname(pOldFieldmark-GetFieldname()); pNewFieldmark-SetFieldHelptext(pOldFieldmark-GetFieldHelptext()); +::sw::mark::IFieldmark::parameter_map_t* pNewParams = pNewFieldmark-GetParameters(); +const ::sw::mark::IFieldmark::parameter_map_t* pOldParams = pOldFieldmark-GetParameters(); +::sw::mark::IFieldmark::parameter_map_t::const_iterator pIt = pOldParams-begin(); +while ( pIt != pOldParams-end() ) +{ +pNewParams-insert( *pIt ); +pIt++; +} } ::sfx2::Metadatable const*const pMetadatable( -- 1.7.3.4 ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] [REVIEW] Fix losing changes in a table in writer
Hi Cedric, On 2011-07-01 at 18:26 +0200, Cedric Bosdonnat wrote: The patch is ok to me, but for completeness we should copy the GetParameters map too. Could you please review my changes for this? Looks good to me - but to be safe, what about to push this one to master only? This is not needed to fix the initial bug... Thank you a lot, Kendy ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice