[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - writerfilter/source

Michael Stahl mstahl at redhat.com
Sat Aug 2 13:38:17 PDT 2014


 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit d2dd174ac05d7c2844c5e60169128e2a02d4311b
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Aug 1 20:21:21 2014 +0200

    writerfilter: RTF import: ignore content of \upr, except for \ud
    
    The content of \upr and its nested \ud destination should be the same
    modulo text encoding, so ignore the legacy one.
    
    Change-Id: I007151e3075a9ac879a486ec3b5fb8549435dbba
    (cherry picked from commit b46956e73b6daff2578110c0395fd80150dc0b0b)
    Reviewed-on: https://gerrit.libreoffice.org/10699
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 2372a29..21708cc 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1450,7 +1450,14 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
     setNeedSect();
     checkUnicode(/*bUnicode =*/ true, /*bHex =*/ true);
     RTFSkipDestination aSkip(*this);
-    switch (nKeyword)
+    // special case \upr: ignore everything except nested \ud
+    if (DESTINATION_UPR == m_aStates.top().nDestinationState
+        && RTF_UD != nKeyword)
+    {
+        m_aStates.top().nDestinationState = DESTINATION_SKIP;
+        aSkip.setParsed(false);
+    }
+    else switch (nKeyword)
     {
     case RTF_RTF:
         break;
@@ -1845,11 +1852,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
         m_aStates.top().nDestinationState = DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE;
         break;
     case RTF_TITLE:
-        // \title inside \upr but outside \ud should be ignored.
-        if (m_aStates.top().nDestinationState != DESTINATION_UPR)
-            m_aStates.top().nDestinationState = DESTINATION_TITLE;
-        else
-            m_aStates.top().nDestinationState = DESTINATION_SKIP;
+        m_aStates.top().nDestinationState = DESTINATION_TITLE;
         break;
     case RTF_SUBJECT:
         m_aStates.top().nDestinationState = DESTINATION_SUBJECT;


More information about the Libreoffice-commits mailing list