sw/qa/extras/rtfimport/data/fdo58076-2.rtf | 24 ++++++++++++++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 10 ++++++++++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 15 +++++++++++++++ 3 files changed, 49 insertions(+)
New commits: commit 878c6f7cb4b7495de90581e8513d46053b8a38e9 Author: Miklos Vajna <[email protected]> Date: Tue Feb 5 18:16:12 2013 +0100 fdo#58076 import RTF_SHPLEFT/TOP of ESCHER_ShpInst_PictureFrame Change-Id: Ia655743710778ea7d48a9b2221f22f55a4ccce32 diff --git a/sw/qa/extras/rtfimport/data/fdo58076-2.rtf b/sw/qa/extras/rtfimport/data/fdo58076-2.rtf new file mode 100644 index 0000000..c918953 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/fdo58076-2.rtf @@ -0,0 +1,24 @@ +{\rtf1 +{\shp +{\*\shpinst\shpleft8345\shptop64\shpright9943\shpbottom1804 +{\sp +{\sn shapeType} +{\sv 75} +} +{\sp +{\sn pib} +{\sv +{\pict\picscalex100\picscaley100\piccropl0\piccropr0\piccropt0\piccropb0 +\picw2815\pich3073\picwgoal1596\pichgoal1742\pngblip\bliptag-949277018 +{\*\blipuid c76b2ea6c6392b9e41780fd0403d0bcd} +89504e470d0a1a0a0000000d4948445200000010000000100802000000909168360000015049444154789c9592c14a02511486bf99714ccb322d7521140541cb +6a11448b164150fb8a363d41f4083d40cba0655044d0a637a837682fd1a6a2488b10b23475bcb77b671c491dc1cee23077e67cf7fcff39139252f29f08b59e3e +1dae8b4c45998ff501a82e070f5cbd3366733acb5c6fa609fc0872651236df0deeca7d002a6cc33d1b941a146ab49ca937e37610e0c590c5c92b67f926a07243 +b293613f8b1108a8a84aadb01575c9799edd0c895010a0ae71048e77b99b6a92e53861a387a48a6033c5d208c297a43ca8a3697601d217b010632dd9a9f34be0 +9968021698bea4c76ab72f5dd0d6216c3211e1bec2a0c5e59bce9303baa770c7bd38aca7d729692bcd4d512b53bb3b7cc2f45dd604ab098e67b499366025ce5e +96a317fd2162e2d76bbbb725bdcd80b12a603aca4581e7aade97e14ec2916ca719ed96e4c54692f5241f755de7019641eacfaff10b469261dc6a800dd30000000049454e44ae426082} +} +} +} +} +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index c321ba6..bf19018 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -140,6 +140,7 @@ public: void testFdo48440(); void testFdo58646(); void testFdo59419(); + void testFdo58076_2(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -251,6 +252,7 @@ void Test::run() {"fdo48440.rtf", &Test::testFdo48440}, {"fdo58646.rtf", &Test::testFdo58646}, {"fdo59419.rtf", &Test::testFdo59419}, + {"fdo58076-2.rtf", &Test::testFdo58076_2}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -1088,6 +1090,14 @@ void Test::testFdo59419() CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount()); } +void Test::testFdo58076_2() +{ + // Position of the picture wasn't correct. + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(8345)), getProperty<sal_Int32>(xDraws->getByIndex(0), "HoriOrientPosition")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 9e2ce72..607d955 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -64,6 +64,7 @@ #include <ooxml/OOXMLFastTokens.hxx> // ooxml namespace #include <oox/token/namespaces.hxx> // oox namespace #include <oox/token/tokens.hxx> +#include <dmapper/GraphicHelpers.hxx> #include <rtfsdrimport.hxx> #include <rtftokenizer.hxx> @@ -73,6 +74,7 @@ #include <rtffly.hxx> #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) +#define MM100_TO_EMU(MM100) (MM100 * 360) #define M_TOKEN(token) OOX_TOKEN(officeMath, token) #define OPEN_M_TOKEN( rtftok, ooxtok ) \ case RTF_M##rtftok: \ @@ -808,6 +810,19 @@ int RTFDocumentImpl::resolvePict(bool bInline) aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_extent, pExtentValue); if (aAnchorWrapAttributes.size()) aAnchorSprms.set(NS_ooxml::LN_EG_WrapType_wrapSquare, pAnchorWrapValue); + + // See OOXMLFastContextHandler::positionOffset(), we can't just put values in an RTFValue. + if (m_aStates.top().aShape.nLeft > 0) + { + writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::number(MM100_TO_EMU(m_aStates.top().aShape.nLeft)), false); + aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionH, RTFValue::Pointer_t(new RTFValue(RTFSprms()))); + } + if (m_aStates.top().aShape.nTop > 0) + { + writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::number(MM100_TO_EMU(m_aStates.top().aShape.nTop)), true); + aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionV, RTFValue::Pointer_t(new RTFValue(RTFSprms()))); + } + aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_docPr, pDocprValue); aAnchorSprms.set(NS_ooxml::LN_graphic_graphic, pGraphicValue); // anchor sprm _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
