[Libreoffice-commits] .: sw/qa writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 1 02:19:54 PDT 2012


 sw/qa/extras/rtfimport/data/fdo52475.rtf       |    5 +++++
 sw/qa/extras/rtfimport/rtfimport.cxx           |    9 +++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    3 +--
 3 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 91f02521b827bf51f04befd45c51736fe4072fba
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Sep 28 17:45:21 2012 +0200

    fdo#52475 fix import of RTF_CHCBPAT with value 0
    
    0 means auto, and for fdo#50539, this value was ignored. However a next
    sample shows that we should send something to the dmapper: COL_AUTO.
    
    Change-Id: I8d7d35125c9027dfb45288bbfbfa81ba4799e78d

diff --git a/sw/qa/extras/rtfimport/data/fdo52475.rtf b/sw/qa/extras/rtfimport/data/fdo52475.rtf
new file mode 100644
index 0000000..fe4a557
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo52475.rtf
@@ -0,0 +1,5 @@
+{\rtf1
+{\colortbl;\red228\green228\blue228;}
+before \chcbpat1 highlighted\chcbpat0  after
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 61813f1..997e33d 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -108,6 +108,7 @@ public:
     void testInk();
     void testFdo52389();
     void testFdo49655();
+    void testFdo52475();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -159,6 +160,7 @@ public:
     CPPUNIT_TEST(testInk);
     CPPUNIT_TEST(testFdo52389);
     CPPUNIT_TEST(testFdo49655);
+    CPPUNIT_TEST(testFdo52475);
 #endif
     CPPUNIT_TEST_SUITE_END();
 
@@ -843,6 +845,13 @@ void Test::testFdo49655()
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
 }
 
+void Test::testFdo52475()
+{
+    // The problem was that \chcbpat0 resulted in no color, instead of COL_AUTO.
+    load("fdo52475.rtf");
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 3), "CharBackColor"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 5e33654..d56307f 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2566,9 +2566,8 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
                 m_aDefaultState.aCharacterSprms.set(NS_sprm::LN_CLidBi, pIntValue);
             break;
         case RTF_CHCBPAT:
-            if (nParam)
             {
-                RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
+                RTFValue::Pointer_t pValue(new RTFValue(nParam ? getColorTable(nParam) : COL_AUTO));
                 lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, NS_sprm::LN_CShd, NS_ooxml::LN_CT_Shd_fill, pValue);
             }
             break;


More information about the Libreoffice-commits mailing list