fdo#77219 Image property Z-index [behindDoc] not preserved after RT

Problem description:
For the images who has the "Text wrapping" property set as Behind Text
 is not preserved after saving the file in DOCX format using LO.

Reviewed on:
	https://gerrit.libreoffice.org/9065

Change-Id: Ic8555103909c0f1ed1cb58fba4dc2ef2f84cc9dd
This commit is contained in:
Ravindra Vidhate 2014-04-16 15:32:43 +05:30 committed by Miklos Vajna
parent 7bda5f04a6
commit 2496eaa5c4
5 changed files with 48 additions and 7 deletions

View File

@ -336,6 +336,20 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS
aGrabBag[length].Value = uno::makeAny( maTypeModel.maZIndex.toInt32() );
propertySet->setPropertyValue( "FrameInteropGrabBag", uno::makeAny(aGrabBag) );
}
else
{
if( maTypeModel.maZIndex.toInt32() )
{
uno::Sequence<beans::PropertyValue> aGrabBag;
uno::Reference<beans::XPropertySet> propertySet (xShape, uno::UNO_QUERY);
propertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
sal_Int32 length = aGrabBag.getLength();
aGrabBag.realloc( length+1 );
aGrabBag[length].Name = "VML-Z-ORDER";
aGrabBag[length].Value = uno::makeAny( maTypeModel.maZIndex.toInt32() );
propertySet->setPropertyValue( "InteropGrabBag", uno::makeAny(aGrabBag) );
}
}
Reference< XControlShape > xControlShape( xShape, uno::UNO_QUERY );
if ( xControlShape.is() && !getTypeModel().mbVisible )
{

Binary file not shown.

View File

@ -3121,6 +3121,14 @@ DECLARE_OOXMLEXPORT_TEST(test76734_2K7, "test76734_2K7.docx")
assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]", "Requires", "wps");
}
DECLARE_OOXMLEXPORT_TEST(test77219, "test77219.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[6]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]", "behindDoc", "1");
}
DECLARE_OOXMLEXPORT_TEST(testFDO76597, "fdo76597.docx")
{
// check XML

View File

@ -743,7 +743,7 @@ DECLARE_OOXMLIMPORT_TEST(testN779627, "n779627.docx")
* Another problem tested with this document is that the roundrect is
* centered vertically and horizontally.
*/
uno::Reference<beans::XPropertySet> xShapeProperties( getShape(4), uno::UNO_QUERY );
uno::Reference<beans::XPropertySet> xShapeProperties( getShape(1), uno::UNO_QUERY );
uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xShapeProperties, uno::UNO_QUERY);
// If this goes wrong, probably the index of the shape is changed and the test should be adjusted.
CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.RectangleShape"), xShapeDescriptor->getShapeType());

View File

@ -1742,11 +1742,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
#endif
text::TextContentAnchorType nAnchorType(text::TextContentAnchorType_AT_PARAGRAPH);
xProps->getPropertyValue(rPropNameSupplier.GetName( PROP_ANCHOR_TYPE )) >>= nAnchorType;
if (!m_bInHeaderFooterImport)
xProps->setPropertyValue(
rPropNameSupplier.GetName( PROP_OPAQUE ),
uno::makeAny( true ) );
bool checkZOredrStatus = false;
if (xSInfo->supportsService("com.sun.star.text.TextFrame"))
{
// Extract the special "btLr text frame" mode, requested by oox, if needed.
@ -1754,7 +1750,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aGrabBag;
xShapePropertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag;
bool checkBtLrStatus = false;bool checkZOredrStatus = false;
bool checkBtLrStatus = false;
for (int i = 0; i < aGrabBag.getLength(); ++i)
{
@ -1793,6 +1789,29 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
if( pos != paragraphContext->end())
xProps->setPropertyValue( rPropNameSupplier.GetName( PROP_BOTTOM_MARGIN ), (*pos).second.getValue() );
}
else
{
uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aGrabBag;
xShapePropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
for (int i = 0; i < aGrabBag.getLength(); ++i)
{
if (aGrabBag[i].Name == "VML-Z-ORDER")
{
GraphicZOrderHelper* pZOrderHelper = m_rDMapper.graphicZOrderHelper();
sal_Int32 zOrder(0);
aGrabBag[i].Value >>= zOrder;
xShapePropertySet->setPropertyValue( "ZOrder", uno::makeAny(pZOrderHelper->findZOrder(zOrder)));
pZOrderHelper->addItem(xShapePropertySet, zOrder);
xShapePropertySet->setPropertyValue(rPropNameSupplier.GetName( PROP_OPAQUE ), uno::makeAny( false ) );
checkZOredrStatus = true;
}
}
}
if (!m_bInHeaderFooterImport && !checkZOredrStatus)
xProps->setPropertyValue(
rPropNameSupplier.GetName( PROP_OPAQUE ),
uno::makeAny( true ) );
}
}
catch ( const uno::Exception& e )