diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-06-15 19:05:50 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-08-11 19:44:19 +0000 |
commit | b93ad36d89b16890ba213c9e5e44973591a2d65c (patch) | |
tree | 15b614bd879e6c1293ff51fea875ea2e8887c246 /sw | |
parent | 7d8ab35f1f4a069d08b57652f79870fdcfc649af (diff) |
fdo#53556 RTF import: fix visibility and text wrapping issues
This is a backport of 6 commits from master:
- the first 3 are earlier fixes on master, without them the test doc
has only 1 shape imported out of 3 (on master, this was already fine)
- the next 2 are the real fixes
- the last one is the testcase
(cherry picked from commits 9d640dc6ad0f0b58fa62b70f78478e2bc8796e69,
2fc088afdf6dcb2defbd462a9e64ba7e53ba5caf,
4ab658b56f5c6ff0082d38d8ace1924d11e30e96,
03f0cbd354646733977e4dec754c0113a5cbc3c9,
9f1f7199736e2ae07b34849ba66f61a1ef5782e8 and
aa6959ba2c4ef1b718d8249fd47faaf677b16111)
Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx
writerfilter/source/rtftok/rtfdocumentimpl.cxx
writerfilter/source/rtftok/rtfdocumentimpl.hxx
writerfilter/source/rtftok/rtfsdrimport.cxx
Change-Id: If58376aec31ab00cab19221beed73e8275a834d2
Reviewed-on: https://gerrit.libreoffice.org/5328
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/rtfimport/data/fdo53556.rtf | 49 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/data/posh-posv.rtf | 24 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 28 |
3 files changed, 101 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo53556.rtf b/sw/qa/extras/rtfimport/data/fdo53556.rtf new file mode 100644 index 000000000000..aafa11cf714e --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo53556.rtf @@ -0,0 +1,49 @@ +{\rtf1\ansi\deff0\viewkind1\paperw12240\paperh15840\marglsxn0\margrsxn0\margtsxn0\margbsxn0 +{\shp\shpbxpage\shpbypage\shpwr5\shpfhdr0\shpfblwtxt0\shpz3\shpleft1000\shpright12000\shptop1000\shpbottom1800 +{\sp +{\sn fFilled} +{\sv 0} +} +{\shpinst +{\sp +{\sn fLine} +{\sv 0} +} +{\shptxt +{\pard\cb1 \qc\sl367 \f0\fs32\b\cf2 ARL STATISTICS 2011-2012\line WORKSHEET\plain\par} +} +} +} +{\shp\shpbxpage\shpbypage\shpwr5\shpfhdr0\shpfblwtxt0\shpz18\shpleft1000\shpright4700\shptop900\shpbottom15040 +{\sp +{\sn fFilled} +{\sv 0} +} +{\shpinst +{\sp +{\sn shapeType} +{\sv 1} +} +{\sp +{\sn fLine} +{\sv 0} +} +} +} +{\shp\shpbxpage\shpbypage\shpwr5\shpfhdr0\shpfblwtxt0\shpz2\shpleft1000\shpright12000\shptop2480\shpbottom3320 +{\sp +{\sn fFilled} +{\sv 0} +} +{\shpinst +{\sp +{\sn fLine} +{\sv 0} +} +{\shptxt +{\pard\cb1 \ql\sl252 \f0\fs22\cf2 This worksheet is designed to help you plan your submission for the 2011-2012 ARL Statistics. The figures on this worksheet should be similar to those in the Summary page of your web form, except in cases where data are unavailable. If an exact figure is unavailable, use NA/UA. If the appropriate answer is zero or none, use 0.\plain\par} +} +} +} +\par +} diff --git a/sw/qa/extras/rtfimport/data/posh-posv.rtf b/sw/qa/extras/rtfimport/data/posh-posv.rtf new file mode 100644 index 000000000000..5ff1fe8e7128 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/posh-posv.rtf @@ -0,0 +1,24 @@ +{\rtf1 +{\shp +{\*\shpinst\shpleft0\shptop0\shpright3727\shpbottom2212\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1026 +{\sp +{\sn shapeType} +{\sv 202} +} +{\shptxt test} +{\sp +{\sn fFitShapeToText} +{\sv 1} +} +{\sp +{\sn posh} +{\sv 2} +} +{\sp +{\sn posv} +{\sv 2} +} +} +} +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index d432f0b22d17..0a56525d14e4 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -10,6 +10,7 @@ #include <com/sun/star/document/XImporter.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> +#include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineStyle.hpp> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/graphic/GraphicType.hpp> @@ -34,6 +35,8 @@ #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/text/WrapTextMode.hpp> +#include <com/sun/star/text/HoriOrientation.hpp> +#include <com/sun/star/text/VertOrientation.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> #include <rtl/ustring.hxx> @@ -150,6 +153,8 @@ public: void testFdo67365(); void testFdo67498(); void testFdo47440(); + void testPoshPosv(); + void testFdo53556(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -287,6 +292,8 @@ void Test::run() {"fdo67365.rtf", &Test::testFdo67365}, {"fdo67498.rtf", &Test::testFdo67498}, {"fdo47440.rtf", &Test::testFdo47440}, + {"posh-posv.rtf", &Test::testPoshPosv}, + {"fdo53556.rtf", &Test::testFdo53556}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1389,6 +1396,27 @@ void Test::testFdo47440() CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(xDraws->getByIndex(0), "VertOrientRelation")); } +void Test::testPoshPosv() +{ + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(xDraws->getByIndex(0), "HoriOrient")); + CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getProperty<sal_Int16>(xDraws->getByIndex(0), "VertOrient")); +} + +void Test::testFdo53556() +{ + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + // This was drawing::FillStyle_SOLID, which resulted in being non-transparent, hiding text which would be visible. + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xDraws->getByIndex(2), "FillStyle")); + + // This was a com.sun.star.drawing.CustomShape, which resulted in lack of word wrapping in the bugdoc. + uno::Reference<beans::XPropertySet> xShapeProperties(xDraws->getByIndex(0), uno::UNO_QUERY); + uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xShapeProperties, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), xShapeDescriptor->getShapeType()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); |