[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - writerfilter/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 21 17:10:44 UTC 2020


 writerfilter/source/rtftok/rtfdispatchdestination.cxx |   14 +++++++++++++-
 writerfilter/source/rtftok/rtfdocumentimpl.cxx        |   10 +++++++++-
 2 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit fbc78668d4a95934fb0470ef2172aceedb806172
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Fri Sep 18 18:52:45 2020 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Sep 21 19:10:10 2020 +0200

    tdf#136445 writerfilter: RTF import: buffer annotations inside tables
    
    The problem is that one of the annotations is inside a table that
    happens to start with a covered cell (vertically merged).
    
    The table row is buffered, but the annotation is not, so it is inserted
    before any of the text of the table cells is inserted, so it ends up in
    the covered cell.
    
    The strucuture of annotations is a bit icky; to fix this, buffer both the
    \annotation destination and \atrfstart \atrfend start and end
    destinations.
    
    Change-Id: Ie955a75a2d254f8d7e965259698b688eece7cbd6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103016
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 54bd2266d6e0c8926ecaf0fbb2dbb5ee9d1a802d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103050
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
index 0afb3c1f395c..68672bde9cd9 100644
--- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
@@ -331,7 +331,19 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
             case RTF_ANNOTATION:
                 if (!m_pSuperstream)
                 {
-                    resolveSubstream(m_nGroupStartPos - 1, NS_ooxml::LN_annotation);
+                    if (!m_aStates.top().getCurrentBuffer())
+                    {
+                        resolveSubstream(m_nGroupStartPos - 1, NS_ooxml::LN_annotation);
+                    }
+                    else
+                    {
+                        RTFSprms aAttributes;
+                        aAttributes.set(Id(0), new RTFValue(m_nGroupStartPos - 1));
+                        aAttributes.set(Id(1), new RTFValue(NS_ooxml::LN_annotation));
+                        aAttributes.set(Id(2), new RTFValue(OUString()));
+                        m_aStates.top().getCurrentBuffer()->push_back(
+                            Buf_t(BUFFER_RESOLVESUBSTREAM, new RTFValue(aAttributes), nullptr));
+                    }
                     m_aStates.top().setDestination(Destination::SKIP);
                 }
                 else
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 1624b023ff34..97844308de0b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2725,7 +2725,15 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState)
                 aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd, pValue);
             writerfilter::Reference<Properties>::Pointer_t pProperties
                 = new RTFReferenceProperties(aAttributes);
-            Mapper().props(pProperties);
+            if (!m_aStates.top().getCurrentBuffer())
+            {
+                Mapper().props(pProperties);
+            }
+            else
+            {
+                auto const pValue2 = new RTFValue(aAttributes, RTFSprms());
+                bufferProperties(*m_aStates.top().getCurrentBuffer(), pValue2, nullptr);
+            }
         }
         break;
         case Destination::ANNOTATIONREFERENCE:


More information about the Libreoffice-commits mailing list