[Libreoffice-commits] core.git: sw/qa writerfilter/source
Miklos Vajna
vmiklos at suse.cz
Tue Jun 18 08:14:02 PDT 2013
sw/qa/extras/rtfimport/data/n825305.rtf | 76 ++++++++++++++++++++++++++++
sw/qa/extras/rtfimport/rtfimport.cxx | 14 +++++
writerfilter/source/rtftok/rtfsdrimport.cxx | 9 ++-
3 files changed, 98 insertions(+), 1 deletion(-)
New commits:
commit 2af60e2eff4e952fff8cac0228b89f16ce3a436e
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
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 165a4f9..23fdf54 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -142,6 +142,7 @@ public:
void testPageBackground();
void testFdo62044();
void testPoshPosv();
+ void testN825305();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -271,6 +272,7 @@ void Test::run()
{"page-background.rtf", &Test::testPageBackground},
{"fdo62044.rtf", &Test::testFdo62044},
{"posh-posv.rtf", &Test::testPoshPosv},
+ {"n825305.rtf", &Test::testN825305},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1284,6 +1286,18 @@ void Test::testPoshPosv()
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xDraws->getByIndex(0), "FrameIsAutomaticHeight"));
}
+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), "BackColorTransparency"));
+ beans::PropertyState ePropertyState = xPropertyState->getPropertyState("BackColorTransparency");
+ // 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 36c4cb1..1b62df3 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -121,6 +121,8 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, OUStrin
sal_Int16 nHoriOrient = 0;
sal_Int16 nVertOrient = 0;
boost::optional<bool> obFitShapeToText;
+ bool bFilled = true;
+
if (aKey == "posh")
{
switch (aValue.toInt32())
@@ -163,6 +165,9 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, OUStrin
}
else if (aKey == "fFitShapeToText")
obFitShapeToText.reset(aValue.toInt32() == 1);
+ else if (aKey == "fFilled")
+ bFilled = aValue.toInt32() == 1;
+
if (nHoriOrient != 0)
xPropertySet->setPropertyValue("HoriOrient", uno::makeAny(nHoriOrient));
if (nVertOrient != 0)
@@ -172,6 +177,8 @@ void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, OUStrin
xPropertySet->setPropertyValue("SizeType", uno::makeAny(*obFitShapeToText ? text::SizeType::MIN : text::SizeType::FIX));
xPropertySet->setPropertyValue("FrameIsAutomaticHeight", uno::makeAny(*obFitShapeToText));
}
+ if (!bFilled)
+ xPropertySet->setPropertyValue("BackColorTransparency", uno::makeAny(sal_Int32(100)));
}
void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
@@ -452,7 +459,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
else if (i->first == "shadowOffsetX")
// EMUs to points
aShadowModel.moOffset.set(OUString::number(i->second.toDouble() / 12700) + "pt");
- else if (i->first == "posh" || i->first == "posv" || i->first == "fFitShapeToText")
+ else if (i->first == "posh" || i->first == "posv" || i->first == "fFitShapeToText" || i->first == "fFilled")
applyProperty(xShape, i->first, i->second);
else if (i->first == "posrelh")
{
More information about the Libreoffice-commits
mailing list