[Libreoffice-commits] .: sw/qa writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Oct 18 00:07:16 PDT 2012
sw/qa/extras/rtfimport/data/dplinehollow.rtf | 7 +++++++
sw/qa/extras/rtfimport/rtfimport.cxx | 12 ++++++++++++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 8 +++++++-
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 1 +
writerfilter/source/rtftok/rtfsdrimport.cxx | 14 +++++++-------
writerfilter/source/rtftok/rtfsdrimport.hxx | 1 +
6 files changed, 35 insertions(+), 8 deletions(-)
New commits:
commit fc8f76395dce902b6599cdfc471b0074919c4fa4
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Thu Oct 18 09:09:03 2012 +0200
import RTF_DPLINEHOLLOW
Change-Id: I580bc2cb38b7fe4b42cfbd78672fc5b8d1d01398
diff --git a/sw/qa/extras/rtfimport/data/dplinehollow.rtf b/sw/qa/extras/rtfimport/data/dplinehollow.rtf
new file mode 100644
index 0000000..fdfddbf
--- /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 6e620d3..9c27818 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 a93fc31..d5fd084 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 e2a5cde..7f0988c 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 0471de6..3e74080 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 517b56b..0924124 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);
More information about the Libreoffice-commits
mailing list