summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/CppunitTest_sw_ooxmlimport.mk1
-rwxr-xr-xsw/qa/extras/ooxmlimport/data/ole-anchor.docxbin0 -> 12393 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx6
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx10
4 files changed, 14 insertions, 3 deletions
diff --git a/sw/CppunitTest_sw_ooxmlimport.mk b/sw/CppunitTest_sw_ooxmlimport.mk
index d72f93e930e5..1171001294a3 100644
--- a/sw/CppunitTest_sw_ooxmlimport.mk
+++ b/sw/CppunitTest_sw_ooxmlimport.mk
@@ -51,6 +51,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_ooxmlimport,\
basic/util/sb \
chart2/source/controller/chartcontroller \
chart2/source/chartcore \
+ canvas/source/factory/canvasfactory \
comphelper/util/comphelp \
configmgr/source/configmgr \
drawinglayer/drawinglayer \
diff --git a/sw/qa/extras/ooxmlimport/data/ole-anchor.docx b/sw/qa/extras/ooxmlimport/data/ole-anchor.docx
new file mode 100755
index 000000000000..11df2393bb9e
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/ole-anchor.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index f264f0c92dcf..3c7c473b4dc2 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1783,6 +1783,12 @@ DECLARE_OOXMLIMPORT_TEST(testGroupshapeRelsize, "groupshape-relsize.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(9142730)), getShape(1)->getSize().Height);
}
+DECLARE_OOXMLIMPORT_TEST(testOleAnchor, "ole-anchor.docx")
+{
+ // This was AS_CHARACTER, even if the VML style explicitly contains "position:absolute".
+ CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
+}
+
DECLARE_OOXMLIMPORT_TEST(testDMLGroupShapeCapitalization, "dml-groupshape-capitalization.docx")
{
// Capitalization inside a group shape was not imported
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index b60c2a80a0f4..9e290e63ddac 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1231,9 +1231,13 @@ void DomainMapper_Impl::appendOLE( const OUString& rStreamName, OLEHandlerPtr pO
uno::Reference< graphic::XGraphic > xGraphic = pOLEHandler->getReplacement();
xOLEProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_GRAPHIC ),
uno::makeAny(xGraphic));
- // mimic the treatment of graphics here.. it seems anchoring as character
- // gives a better ( visually ) result
- xOLEProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_ANCHOR_TYPE ), uno::makeAny( text::TextContentAnchorType_AS_CHARACTER ) );
+ uno::Reference<beans::XPropertySet> xReplacementProperties(pOLEHandler->getShape(), uno::UNO_QUERY);
+ if (xReplacementProperties.is())
+ xOLEProperties->setPropertyValue("AnchorType", xReplacementProperties->getPropertyValue("AnchorType"));
+ else
+ // mimic the treatment of graphics here.. it seems anchoring as character
+ // gives a better ( visually ) result
+ xOLEProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_ANCHOR_TYPE ), uno::makeAny( text::TextContentAnchorType_AS_CHARACTER ) );
// remove ( if valid ) associated shape ( used for graphic replacement )
m_aAnchoredStack.top( ).bToRemove = true;
RemoveLastParagraph();