[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa writerfilter/source
Miklos Vajna
vmiklos at suse.cz
Tue Jun 18 10:46:24 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 3400f0c0ff71c428c8d93bd0f04730e33cf4f7d5
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Jun 18 16:22:32 2013 +0200
bnc#825305 RTF import of fFilled shape property
(cherry picked from commit b08743d3c4381a77eee6e123230fb423acfbc116)
Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx
writerfilter/source/rtftok/rtfsdrimport.cxx
Change-Id: Iaa2ff9d5d1a28aec046f885acecbd1a44c734ec0
Reviewed-on: https://gerrit.libreoffice.org/4345
Reviewed-by: Noel Power <noel.power at suse.com>
Tested-by: Noel Power <noel.power at suse.com>
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 4700ecbb..0ec3fd3 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -138,6 +138,7 @@ public:
void testN818997();
void testFdo64671();
void testFdo62044();
+ void testN825305();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -265,6 +266,7 @@ void Test::run()
{"n818997.rtf", &Test::testN818997},
{"fdo64671.rtf", &Test::testFdo64671},
{"fdo62044.rtf", &Test::testFdo62044},
+ {"n825305.rtf", &Test::testN825305},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -1262,6 +1264,18 @@ void Test::testFdo62044()
CPPUNIT_ASSERT_EQUAL(10.f, getProperty<float>(xPropertySet, "CharHeight")); // Was 18, i.e. reset back to original value.
}
+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 d3bda9692..a984431f 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -120,6 +120,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
bool bPib = false;
bool bCustom = false;
bool bTextFrame = false;
+ bool bFilled = true;
uno::Reference<drawing::XShape> xShape;
uno::Reference<beans::XPropertySet> xPropertySet;
@@ -414,6 +415,8 @@ void RTFSdrImport::resolve(RTFShape& rShape)
break;
}
}
+ else if (i->first == "fFilled")
+ bFilled = i->second.toInt32() == 1;
else
SAL_INFO("writerfilter", "TODO handle shape property '" << i->first << "':'" << i->second << "'");
}
@@ -445,6 +448,8 @@ void RTFSdrImport::resolve(RTFShape& rShape)
xPropertySet->setPropertyValue("WritingMode", uno::makeAny(sal_Int16(eWritingMode)));
else
xPropertySet->setPropertyValue("TextWritingMode", uno::makeAny(eWritingMode));
+ if (!bFilled)
+ xPropertySet->setPropertyValue("BackColorTransparency", uno::makeAny(sal_Int32(100)));
}
if (nType == ESCHER_ShpInst_PictureFrame) // picture frame
More information about the Libreoffice-commits
mailing list