[Libreoffice-commits] .: writerfilter/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Thu Jan 19 16:37:53 PST 2012


 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 370fc96b92e59d35c2eb2e14fd77eb14bfc72fd4
Author: Miklos Vajna <vmiklos at frugalware.org>
Date:   Fri Jan 20 01:36:25 2012 +0100

    Fix RTF import of dotted and word underline
    
    The problem was that these are flags, not toggles.

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index b2e2f7d..0a1fafb 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1450,6 +1450,21 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
     checkUnicode();
     RTFSkipDestination aSkip(*this);
     int nParam = -1;
+    int nSprm = -1;
+
+    // Map all underline flags to a single sprm.
+    switch (nKeyword)
+    {
+        case RTF_ULD: nSprm = 4; break;
+        case RTF_ULW: nSprm = 2; break;
+        default: break;
+    }
+    if (nSprm >= 0)
+    {
+        RTFValue::Pointer_t pValue(new RTFValue(nSprm));
+        m_aStates.top().aCharacterSprms->push_back(make_pair(NS_sprm::LN_CKul, pValue));
+        return 0;
+    }
 
     // Indentation
     switch (nKeyword)
@@ -2565,11 +2580,10 @@ int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam
     int nSprm = -1;
     RTFValue::Pointer_t pBoolValue(new RTFValue(!bParam || nParam != 0));
 
-    // Map all underline keywords to a single sprm.
+    // Map all underline toggles to a single sprm.
     switch (nKeyword)
     {
         case RTF_UL: nSprm = 1; break;
-        case RTF_ULD: nSprm = 4; break;
         case RTF_ULDASH: nSprm = 7; break;
         case RTF_ULDASHD: nSprm = 9; break;
         case RTF_ULDASHDD: nSprm = 10; break;
@@ -2583,7 +2597,6 @@ int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam
         case RTF_ULTHDASHDD: nSprm = 26; break;
         case RTF_ULTHLDASH: nSprm = 55; break;
         case RTF_ULULDBWAVE: nSprm = 43; break;
-        case RTF_ULW: nSprm = 2; break;
         case RTF_ULWAVE: nSprm = 11; break;
         default: break;
     }


More information about the Libreoffice-commits mailing list