diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-10-18 09:09:03 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-10-18 09:09:03 +0200 |
commit | fc8f76395dce902b6599cdfc471b0074919c4fa4 (patch) | |
tree | 87c393d5845cf88ab1152c8eae51452c6ef43426 | |
parent | b1e93b33acd15020089029a20343caefb262766b (diff) |
import RTF_DPLINEHOLLOW
Change-Id: I580bc2cb38b7fe4b42cfbd78672fc5b8d1d01398
-rw-r--r-- | sw/qa/extras/rtfimport/data/dplinehollow.rtf | 7 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 8 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 1 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.cxx | 14 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfsdrimport.hxx | 1 |
6 files changed, 35 insertions, 8 deletions
diff --git a/sw/qa/extras/rtfimport/data/dplinehollow.rtf b/sw/qa/extras/rtfimport/data/dplinehollow.rtf new file mode 100644 index 000000000000..fdfddbf4da01 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/dplinehollow.rtf @@ -0,0 +1,7 @@ +{\rtf1\ansi\ansicpg1255\fbidis\deff0\deflang1037\deftab720 +\paperw11906\paperh16838\ltrdoc +{\*\do\dobxpage\dobypara\dodhgt8192\dptxbx\dptxbxmar0 +{\dptxbxtext\ltrpar\f8\fs50\cf1\vertalc\qc\ltrch textbox without border\par} +\dpx929\dpy340\dpxsize10556\dpysize561\dplinehollow0} +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 6e620d387af1..9c278185c9eb 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/document/XFilter.hpp> #include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> +#include <com/sun/star/drawing/LineStyle.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/graphic/GraphicType.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -117,6 +118,7 @@ public: void testCopyPastePageStyle(); void testShptxtPard(); void testDoDhgt(); + void testDplinehollow(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -173,6 +175,7 @@ public: CPPUNIT_TEST(testCopyPastePageStyle); CPPUNIT_TEST(testShptxtPard); CPPUNIT_TEST(testDoDhgt); + CPPUNIT_TEST(testDplinehollow); #endif CPPUNIT_TEST_SUITE_END(); @@ -924,6 +927,15 @@ void Test::testDoDhgt() } } +void Test::testDplinehollow() +{ + load("dplinehollow.rtf"); + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_NONE, getProperty<drawing::LineStyle>(xPropertySet, "LineStyle")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index a93fc3149f92..d5fd0848a03b 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2381,6 +2381,9 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_SHPBYPAGE: m_aStates.top().aShape.nVertOrientRelation = text::RelOrientation::PAGE_FRAME; break; + case RTF_DPLINEHOLLOW: + m_aStates.top().aDrawingObject.nFLine = 0; + break; default: SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle flag '" << lcl_RtfToString(nKeyword) << "'"); aSkip.setParsed(false); @@ -3684,6 +3687,8 @@ int RTFDocumentImpl::popState() // If there is no fill, the Word default is 100% transparency. xPropertySet->setPropertyValue("FillTransparence", uno::makeAny(sal_Int32(100))); + m_pSdrImport->resolveFLine(xPropertySet, rDrawing.nFLine); + Mapper().startShape(xShape); replayShapetext(); Mapper().endShape(); @@ -4127,7 +4132,8 @@ RTFDrawingObject::RTFDrawingObject() nFillColorG(0), nFillColorB(0), bHasFillColor(false), - nDhgt(0) + nDhgt(0), + nFLine(-1) { } diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx index e2a5cde4904e..7f0988c20263 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -273,6 +273,7 @@ namespace writerfilter { sal_uInt8 nFillColorR, nFillColorG, nFillColorB; bool bHasFillColor; sal_Int32 nDhgt; + sal_Int32 nFLine; }; /// Stores the properties of a picture. diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 0471de6e469e..3e74080ca43e 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -79,6 +79,12 @@ void RTFSdrImport::resolveDhgt(uno::Reference<beans::XPropertySet> xPropertySet, pHelper->addItem(xPropertySet, nZOrder); } +void RTFSdrImport::resolveFLine(uno::Reference<beans::XPropertySet> xPropertySet, sal_Int32 nFLine) +{ + if (nFLine == 0) + xPropertySet->setPropertyValue("LineStyle", uno::makeAny(drawing::LineStyle_NONE)); +} + void RTFSdrImport::resolve(RTFShape& rShape) { int nType = -1; @@ -147,13 +153,7 @@ void RTFSdrImport::resolve(RTFShape& rShape) } } else if (i->first == "fLine" && xPropertySet.is()) - { - if (i->second.toInt32() == 0) - { - aAny <<= drawing::LineStyle_NONE; - xPropertySet->setPropertyValue("LineStyle", aAny); - } - } + resolveFLine(xPropertySet, i->second.toInt32()); else if (i->first == "fillOpacity" && xPropertySet.is()) { int opacity = 100 - (i->second.toInt32())*100/65536; diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx index 517b56b00c6a..0924124bdb06 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.hxx +++ b/writerfilter/source/rtftok/rtfsdrimport.hxx @@ -41,6 +41,7 @@ namespace writerfilter { void resolve(RTFShape& rShape); void resolveDhgt(uno::Reference<beans::XPropertySet> xPropertySet, sal_Int32 nZOrder); + void resolveFLine(uno::Reference<beans::XPropertySet> xPropertySet, sal_Int32 nFLine); private: void createShape(rtl::OUString aService, uno::Reference<drawing::XShape>& xShape, uno::Reference<beans::XPropertySet>& xPropertySet); |