Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1652

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/52/1652/1

fdo#53487 SwUndoInsert: take care of fieldmarks when deleting field chars

The problem was that while SwUndoInsert removed the field characters, it
didn't remove the fieldmark, so after unding a comment insert, it wasn't
possible to re-insert a comment.
(cherry picked from commit ecce43877167c1cd6e24208208aed4274100c11a)

Change-Id: If42b0992be29e3336b8e9d736497e4fb09184c55
---
M sw/source/core/undo/unins.cxx
1 file changed, 21 insertions(+), 0 deletions(-)



diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index d1cef84..03cc454 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -25,6 +25,7 @@
 #include <sot/storage.hxx>
 #include <editeng/keepitem.hxx>
 #include <svx/svdobj.hxx>
+#include <xmloff/odffields.hxx>
 
 #include <docsh.hxx>
 #include <fmtcntnt.hxx>
@@ -250,6 +251,26 @@
                 RemoveIdxFromRange( aPaM, sal_False );
                 pTxt = new String( pTxtNode->GetTxt().Copy(nCntnt-nLen, nLen) );
                 pTxtNode->EraseText( aPaM.GetPoint()->nContent, nLen );
+
+                // Undo deletes fieldmarks in two step: first the end then the start position.
+                // Once the start position is deleted, make sure the fieldmark itself is deleted 
as well.
+                if (nLen == 1)
+                {
+                    IDocumentMarkAccess* const pMarkAccess = pTmpDoc->getIDocumentMarkAccess();
+                    for ( IDocumentMarkAccess::const_iterator_t i = pMarkAccess->getMarksBegin(); 
i != pMarkAccess->getMarksEnd(); ++i)
+                    {
+                        sw::mark::IMark* pMark = i->get();
+                        if (pMark->GetMarkStart() == *aPaM.GetPoint() && 
pMark->GetMarkStart().nContent == aPaM.GetPoint()->nContent)
+                        {
+                            sw::mark::IFieldmark* pFieldmark = 
dynamic_cast<sw::mark::IFieldmark*>(pMark);
+                            if (pFieldmark && pFieldmark->GetFieldname() == ODF_COMMENTRANGE)
+                            {
+                                pTmpDoc->getIDocumentMarkAccess()->deleteMark(pMark);
+                                break;
+                            }
+                        }
+                    }
+                }
             }
             else                // otherwise Graphics/OLE/Text/...
             {

-- 
To view, visit https://gerrit.libreoffice.org/1652
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If42b0992be29e3336b8e9d736497e4fb09184c55
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Miklos Vajna <vmiklos@suse.cz>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.