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/2817

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/17/2817/1

fdo#61909 fix import of RTF_HIGHLIGHT and of default font without RTF_PLAIN

(cherry picked from commits 60c17b2873506ed8b068b34840aecda0c1d9bd65 and
c412cba28ebc00783041bcec74978fc959cc1351)

Change-Id: Ifa7b14e88231e5053c84dfbdd9b453715df1aaa6
---
A sw/qa/extras/rtfimport/data/fdo61909.rtf
M sw/qa/extras/rtfimport/rtfimport.cxx
M writerfilter/source/rtftok/rtfdocumentimpl.cxx
3 files changed, 45 insertions(+), 1 deletion(-)



diff --git a/sw/qa/extras/rtfimport/data/fdo61909.rtf b/sw/qa/extras/rtfimport/data/fdo61909.rtf
new file mode 100644
index 0000000..e31414a
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo61909.rtf
@@ -0,0 +1,28 @@
+{\rtf1\deff0
+{\fonttbl
+{\f000 Courier New;}
+}
+{\colortbl
+\red000\green000\blue000;
+\red255\green255\blue255;
+\red255\green128\blue000;
+\red255\green255\blue255;
+\red000\green000\blue255;
+\red255\green255\blue255;
+\red128\green128\blue128;
+\red255\green255\blue255;
+\red128\green128\blue128;
+\red255\green255\blue255;
+\red128\green064\blue000;
+\red255\green255\blue255;
+\red000\green000\blue128;
+\red255\green255\blue255;
+\red000\green000\blue000;
+\red255\green255\blue255;
+\red128\green000\blue255;
+\red255\green255\blue255;
+\red000\green000\blue000;
+\red255\green255\blue255;
+}
+\highlight11 #include<iostream.h>\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 3d3cbe6..07583fc 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -141,6 +141,7 @@
     void testFdo59953();
     void testFdo59638();
     void testFdo60722();
+    void testFdo61909();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -232,6 +233,7 @@
         {"fdo59953.rtf", &Test::testFdo59953},
         {"fdo59638.rtf", &Test::testFdo59638},
         {"fdo60722.rtf", &Test::testFdo60722},
+        {"fdo61909.rtf", &Test::testFdo61909},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -1131,6 +1133,15 @@
     CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), getProperty<sal_uInt32>(xShape, "LineColor"));
 }
 
+void Test::testFdo61909()
+{
+    uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
+    // Was the Writer default font.
+    CPPUNIT_ASSERT_EQUAL(OUString("Courier New"), getProperty<OUString>(xTextRange, 
"CharFontName"));
+    // Was 0x008000.
+    CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<sal_uInt32>(xTextRange, "CharBackColor"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 401ebb7..34b779d 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -393,6 +393,11 @@
         if (!m_pSuperstream)
             Mapper().startSectionGroup();
         Mapper().startParagraphGroup();
+
+        // set the requested default font
+        RTFValue::Pointer_t pFont = m_aDefaultState.aCharacterSprms.find(NS_sprm::LN_CRgFtc0);
+        if (pFont.get())
+            dispatchValue(RTF_F, pFont->getInt());
         m_bFirstRun = false;
     }
 }
@@ -2835,7 +2840,7 @@
             break;
         case RTF_HIGHLIGHT:
             {
-                RTFValue::Pointer_t pValue(new RTFValue(nParam));
+                RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
                 m_aStates.top().aCharacterSprms.set(NS_sprm::LN_CHighlight, pValue);
             }
             break;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa7b14e88231e5053c84dfbdd9b453715df1aaa6
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.