[Libreoffice-commits] core.git: Branch 'distro/suse/suse-4.0' - sw/qa writerfilter/source

Miklos Vajna vmiklos at suse.cz
Wed Jun 19 01:25:39 PDT 2013


 sw/qa/extras/rtfimport/data/n825305.rtf     |   76 ++++++++++++++++++++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx        |   14 +++++
 writerfilter/source/rtftok/rtfsdrimport.cxx |    5 +
 3 files changed, 95 insertions(+)

New commits:
commit 073fadca38eba2960c89db07713c0d0d430e2874
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jun 18 16:22:32 2013 +0200

    bnc#825305 RTF import of fFilled shape property
    
    Change-Id: Iaa2ff9d5d1a28aec046f885acecbd1a44c734ec0
    (cherry picked from commit 2af60e2eff4e952fff8cac0228b89f16ce3a436e)
    
    Conflicts:
    	sw/qa/extras/rtfimport/rtfimport.cxx
    	writerfilter/source/rtftok/rtfsdrimport.cxx

diff --git a/sw/qa/extras/rtfimport/data/n825305.rtf b/sw/qa/extras/rtfimport/data/n825305.rtf
new file mode 100755
index 0000000..72a6b52
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/n825305.rtf
@@ -0,0 +1,76 @@
+{\rtf 
+\viewkind1\margl360\margr360
+\margt360\margb360\paperw12240\paperh15840\pard
+{\shp 
+{\*\shpinst\shpleft555\shpright1185\shptop5715\shpbottom5970\shpbxpage
+\shpbypage\shpwr3\shpz1 
+{\sp 
+{\sn shapeType}
+{\sv 1}
+}
+{\sp 
+{\sn fLine}
+{\sv 1}
+}
+{\sp
+ 
+{\sn lineWidth}
+{\sv 0}
+}
+{\sp 
+{\sn lineColor}
+{\sv 10485760}
+}
+{\sp 
+{\sn lineDashing
+}
+{\sv 0}
+}
+{\sp 
+{\sn fFilled}
+{\sv 1}
+}
+{\sp 
+{\sn fillColor}
+{\sv 10485760}
+}
+}
+}
+{\shp 
+{\*\shpinst\shpleft780\shpright1425\shptop5790\shpbottom6030\shpbxpage
+\shpbypage\shpwr3\shpz2 
+{\sp 
+{\sn shapeType}
+{\sv 202}
+}
+{\sp 
+{\sn dxTextLeft}
+{\sv 
+0}
+}
+{\sp 
+{\sn dxTextRight}
+{\sv 0}
+}
+{\sp 
+{\sn dyTextTop}
+{\sv 0}
+}
+{\sp 
+{\sn 
+dyTextBottom}
+{\sv 0}
+}
+{\sp 
+{\sn fLine}
+{\sv 0}
+}
+{\shptxt\plain\pard\f29\fs20 Ln #
+\par}
+{\sp 
+{\sn fFilled}
+{\sv 0}
+}
+}
+}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 3a41731..c87ba3e 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -149,6 +149,7 @@ public:
     void testFdo63023();
     void testN818997();
     void testFdo64671();
+    void testN825305();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -268,6 +269,7 @@ void Test::run()
         {"fdo63023.rtf", &Test::testFdo63023},
         {"n818997.rtf", &Test::testN818997},
         {"fdo64671.rtf", &Test::testFdo64671},
+        {"n825305.rtf", &Test::testN825305},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -1230,6 +1232,18 @@ void Test::testFdo64671()
     getRun(getParagraph(1), 1, OUString("\xC5\xBD", 2, RTL_TEXTENCODING_UTF8));
 }
 
+void Test::testN825305()
+{
+    // The problem was that the textbox wasn't transparent, due to unimplemented fFilled == 0.
+    uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+    uno::Reference<beans::XPropertyState> xPropertyState(xDraws->getByIndex(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(xDraws->getByIndex(1), "FillTransparence"));
+    beans::PropertyState ePropertyState = xPropertyState->getPropertyState("FillTransparence");
+    // Was beans::PropertyState_DEFAULT_VALUE.
+    CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, ePropertyState);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 864a8bd..3bb7af9 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -104,6 +104,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
     uno::Any aLineColor = uno::makeAny(COL_BLACK);
     // Default line width is 0.75 pt (26 mm100) in Word, 0 in Writer.
     uno::Any aLineWidth = uno::makeAny(sal_Int32(26));
+    bool bFilled = true;
 
     for (std::vector< std::pair<rtl::OUString, rtl::OUString> >::iterator i = rShape.aProperties.begin();
             i != rShape.aProperties.end(); ++i)
@@ -288,6 +289,8 @@ void RTFSdrImport::resolve(RTFShape& rShape)
             aViewBox.Height = i->second.toInt32();
         else if ( i->first == "dhgt" )
             resolveDhgt(xPropertySet, i->second.toInt32());
+        else if (i->first == "fFilled")
+            bFilled = i->second.toInt32() == 1;
         else
             SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle shape property '" <<
                     OUStringToOString( i->first, RTL_TEXTENCODING_UTF8 ).getStr() << "':'" <<
@@ -357,6 +360,8 @@ void RTFSdrImport::resolve(RTFShape& rShape)
             xPropertySet->setPropertyValue("VertOrientRelation", uno::makeAny(rShape.nVertOrientRelation));
         if (rShape.nWrap != -1)
             xPropertySet->setPropertyValue("Surround", uno::makeAny(text::WrapTextMode(rShape.nWrap)));
+        if (!bFilled)
+            xPropertySet->setPropertyValue("FillTransparence", uno::makeAny(sal_Int32(100)));
     }
 
     // Send it to dmapper


More information about the Libreoffice-commits mailing list