DOCX OLE import: inherit anchor type from replacement graphic
Change-Id: Ic8b6f423acae5cc7e3799cf20e672b56a9cc8c0c
This commit is contained in:
@@ -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 \
|
||||
|
BIN
sw/qa/extras/ooxmlimport/data/ole-anchor.docx
Executable file
BIN
sw/qa/extras/ooxmlimport/data/ole-anchor.docx
Executable file
Binary file not shown.
@@ -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
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user