sw/qa/extras/rtfimport/data/n820504.rtf | 37 ++++++++++++++++++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 10 +++++++ writerfilter/source/rtftok/rtfsdrimport.cxx | 2 + 3 files changed, 49 insertions(+)
New commits: commit 50a76af9d1b6cc1b02c856c2e06bc18d849ec2d3 Author: Miklos Vajna <vmik...@suse.cz> Date: Thu Jul 25 18:12:51 2013 +0200 Related: bnc#820504 RTF import: don't anchor shapes TO_PAGE This is the RTF equivalent of f5b7acac624f07fa95835b6054b8d295901bb1dd, which avoided TO_PAGE-anchored shapes in the VML importer. Change-Id: I58a5cdb311ac43ddba00bc441005fb37a4899cee diff --git a/sw/qa/extras/rtfimport/data/n820504.rtf b/sw/qa/extras/rtfimport/data/n820504.rtf new file mode 100644 index 0000000..6d2d88e --- /dev/null +++ b/sw/qa/extras/rtfimport/data/n820504.rtf @@ -0,0 +1,37 @@ +{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff31507\deff0\stshfdbch0\stshfloch31506\stshfhich31506\stshfbi31506\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0 +{\shp +{\*\shpinst\shpleft1295\shptop-212\shpright2090\shpbottom598\shpfhdr0\shpbxcolumn\shpbxignore\shpbypara\shpbyignore\shpwr3\shpwrk0\shpfblwtxt0\shpz0\shplid1027 +{\sp +{\sn shapeType} +{\sv 2} +} +{\sp +{\sn fFlipH} +{\sv 0} +} +{\sp +{\sn fFlipV} +{\sv 0} +} +{\sp +{\sn rotation} +{\sv 2949120} +} +{\sp +{\sn fRecolorFillAsPicture} +{\sv 0} +} +{\sp +{\sn fUseShapeAnchor} +{\sv 0} +} +{\sp +{\sn lidRegroup} +{\sv 1} +} +} +{\shprslt +} +} +\par +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 93489d7..a25564d 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -156,6 +156,7 @@ public: void testFdo66565(); void testFdo54900(); void testFdo64637(); + void testN820504(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -296,6 +297,7 @@ void Test::run() {"fdo66565.rtf", &Test::testFdo66565}, {"fdo54900.rtf", &Test::testFdo54900}, {"fdo64637.rtf", &Test::testFdo64637}, + {"n820504.rtf", &Test::testN820504}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1442,6 +1444,14 @@ void Test::testFdo64637() CPPUNIT_ASSERT_EQUAL(OUString("bbb"), getProperty<OUString>(xPropertySet, "Company")); } +void Test::testN820504() +{ + // The shape was anchored at-page instead of at-character (that's incorrect as Word only supports at-character and as-character). + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(xDraws->getByIndex(0), "AnchorType")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx index 78c34d9..3286c9d 100644 --- a/writerfilter/source/rtftok/rtfsdrimport.cxx +++ b/writerfilter/source/rtftok/rtfsdrimport.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/text/VertOrientation.hpp> #include <com/sun/star/text/WrapTextMode.hpp> #include <com/sun/star/text/WritingMode.hpp> +#include <com/sun/star/text/TextContentAnchorType.hpp> #include <ooxml/resourceids.hxx> // NS_ooxml namespace #include <filter/msfilter/escherex.hxx> @@ -650,6 +651,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose) // Sets the ShadowFormat UNO property. oox::PropertySet(xShape).setProperties(aPropMap); } + xPropertySet->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AT_CHARACTER)); } if (m_rImport.isInBackground()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits