Kaydet (Commit) 50a76af9 authored tarafından Miklos Vajna's avatar Miklos Vajna

Related: bnc#820504 RTF import: don't anchor shapes TO_PAGE

This is the RTF equivalent of f5b7acac,
which avoided TO_PAGE-anchored shapes in the VML importer.

Change-Id: I58a5cdb311ac43ddba00bc441005fb37a4899cee
üst 6b0f9034
{\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
}
...@@ -156,6 +156,7 @@ public: ...@@ -156,6 +156,7 @@ public:
void testFdo66565(); void testFdo66565();
void testFdo54900(); void testFdo54900();
void testFdo64637(); void testFdo64637();
void testN820504();
CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT) #if !defined(MACOSX) && !defined(WNT)
...@@ -296,6 +297,7 @@ void Test::run() ...@@ -296,6 +297,7 @@ void Test::run()
{"fdo66565.rtf", &Test::testFdo66565}, {"fdo66565.rtf", &Test::testFdo66565},
{"fdo54900.rtf", &Test::testFdo54900}, {"fdo54900.rtf", &Test::testFdo54900},
{"fdo64637.rtf", &Test::testFdo64637}, {"fdo64637.rtf", &Test::testFdo64637},
{"n820504.rtf", &Test::testN820504},
}; };
header(); header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
...@@ -1442,6 +1444,14 @@ void Test::testFdo64637() ...@@ -1442,6 +1444,14 @@ void Test::testFdo64637()
CPPUNIT_ASSERT_EQUAL(OUString("bbb"), getProperty<OUString>(xPropertySet, "Company")); 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_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <com/sun/star/text/VertOrientation.hpp> #include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/text/WrapTextMode.hpp> #include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/WritingMode.hpp> #include <com/sun/star/text/WritingMode.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
#include <ooxml/resourceids.hxx> // NS_ooxml namespace #include <ooxml/resourceids.hxx> // NS_ooxml namespace
#include <filter/msfilter/escherex.hxx> #include <filter/msfilter/escherex.hxx>
...@@ -650,6 +651,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose) ...@@ -650,6 +651,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
// Sets the ShadowFormat UNO property. // Sets the ShadowFormat UNO property.
oox::PropertySet(xShape).setProperties(aPropMap); oox::PropertySet(xShape).setProperties(aPropMap);
} }
xPropertySet->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AT_CHARACTER));
} }
if (m_rImport.isInBackground()) if (m_rImport.isInBackground())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment