summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavindra Vidhate <ravindra.vidhate@synerzip.com>2014-04-16 15:32:43 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-04-17 10:10:37 +0200
commit2496eaa5c4535b88b44e4ac034aae6af0c08de0e (patch)
treead85d6763a1dabf1316de727c223db49dddfd11c
parent7bda5f04a693c7943bc4201c11e73ca45bead661 (diff)
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
-rw-r--r--oox/source/vml/vmlshape.cxx14
-rw-r--r--sw/qa/extras/ooxmlexport/data/test77219.docxbin0 -> 82015 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx8
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx2
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx31
5 files changed, 48 insertions, 7 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index d4bdbcfb1ea9..6167a19e4208 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -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 )
{
diff --git a/sw/qa/extras/ooxmlexport/data/test77219.docx b/sw/qa/extras/ooxmlexport/data/test77219.docx
new file mode 100644
index 000000000000..29aca1bebbd3
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/test77219.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 1e4067e8ab9f..e7f57e6988cf 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -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
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 6e3388b2209b..f727d6f0af86 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -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());
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 51810b34ad86..3a6dfef31389 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -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 )