Kaydet (Commit) 2a35f5c7 authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX OLE import: inherit anchor type from replacement graphic

Change-Id: Ic8b6f423acae5cc7e3799cf20e672b56a9cc8c0c
üst ff02109b
...@@ -51,6 +51,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_ooxmlimport,\ ...@@ -51,6 +51,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_ooxmlimport,\
basic/util/sb \ basic/util/sb \
chart2/source/controller/chartcontroller \ chart2/source/controller/chartcontroller \
chart2/source/chartcore \ chart2/source/chartcore \
canvas/source/factory/canvasfactory \
comphelper/util/comphelp \ comphelper/util/comphelp \
configmgr/source/configmgr \ configmgr/source/configmgr \
drawinglayer/drawinglayer \ drawinglayer/drawinglayer \
......
...@@ -1783,6 +1783,12 @@ DECLARE_OOXMLIMPORT_TEST(testGroupshapeRelsize, "groupshape-relsize.docx") ...@@ -1783,6 +1783,12 @@ DECLARE_OOXMLIMPORT_TEST(testGroupshapeRelsize, "groupshape-relsize.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(9142730)), getShape(1)->getSize().Height); 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") DECLARE_OOXMLIMPORT_TEST(testDMLGroupShapeCapitalization, "dml-groupshape-capitalization.docx")
{ {
// Capitalization inside a group shape was not imported // Capitalization inside a group shape was not imported
......
...@@ -1231,9 +1231,13 @@ void DomainMapper_Impl::appendOLE( const OUString& rStreamName, OLEHandlerPtr pO ...@@ -1231,9 +1231,13 @@ void DomainMapper_Impl::appendOLE( const OUString& rStreamName, OLEHandlerPtr pO
uno::Reference< graphic::XGraphic > xGraphic = pOLEHandler->getReplacement(); uno::Reference< graphic::XGraphic > xGraphic = pOLEHandler->getReplacement();
xOLEProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_GRAPHIC ), xOLEProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_GRAPHIC ),
uno::makeAny(xGraphic)); uno::makeAny(xGraphic));
// mimic the treatment of graphics here.. it seems anchoring as character uno::Reference<beans::XPropertySet> xReplacementProperties(pOLEHandler->getShape(), uno::UNO_QUERY);
// gives a better ( visually ) result if (xReplacementProperties.is())
xOLEProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_ANCHOR_TYPE ), uno::makeAny( text::TextContentAnchorType_AS_CHARACTER ) ); 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 ) // remove ( if valid ) associated shape ( used for graphic replacement )
m_aAnchoredStack.top( ).bToRemove = true; m_aAnchoredStack.top( ).bToRemove = true;
RemoveLastParagraph(); RemoveLastParagraph();
......
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