[Libreoffice-commits] core.git: include/oox oox/source sw/qa writerfilter/source

Sourav sourav.mahajan at synerzip.com
Tue Apr 8 01:21:18 PDT 2014


 include/oox/vml/vmlshape.hxx                      |    1 +
 oox/source/vml/vmlshape.cxx                       |   14 ++++++++++++++
 oox/source/vml/vmlshapecontext.cxx                |    1 +
 sw/qa/extras/ooxmlexport/data/fdo76591.docx       |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx          |    8 ++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   17 ++++++++++++++++-
 6 files changed, 40 insertions(+), 1 deletion(-)

New commits:
commit 69eebf8735973a05c931182d2ebfe35ce25f4b1a
Author: Sourav <sourav.mahajan at synerzip.com>
Date:   Fri Apr 4 18:06:44 2014 +0530

    fdo76591:-Textbox property (order-> send behind text) is not preserved.
    
    Z-Index was not handledin LO for vml.
    I have made the changes to handle that using aGrabBag.
    
    Change-Id: I2af3b2974c8eb699bc6a7b743dc438584d6517ac
    Reviewed-on: https://gerrit.libreoffice.org/8833
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
index d38c58f..832d3be 100644
--- a/include/oox/vml/vmlshape.hxx
+++ b/include/oox/vml/vmlshape.hxx
@@ -64,6 +64,7 @@ struct OOX_DLLPUBLIC ShapeTypeModel
     OptValue< Int32Pair > moCoordPos;           ///< Top-left position of coordinate system for children scaling.
     OptValue< Int32Pair > moCoordSize;          ///< Size of coordinate system for children scaling.
     OUString     maPosition;             ///< Position type of the shape.
+    OUString     maZIndex;                ///< ZIndex of the shape
     OUString     maLeft;                 ///< X position of the shape bounding box (number with unit).
     OUString     maTop;                  ///< Y position of the shape bounding box (number with unit).
     OUString     maWidth;                ///< Width of the shape bounding box (number with unit).
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index e79c9b8..d4bdbcf 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -41,6 +41,7 @@
 #include <com/sun/star/text/XTextContent.hpp>
 #include <com/sun/star/text/XTextDocument.hpp>
 #include <com/sun/star/text/XTextFrame.hpp>
+ #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 #include <rtl/math.hxx>
 #include <rtl/ustrbuf.hxx>
@@ -322,6 +323,19 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS
                 PropertySet aShapeProp( xShape );
                 if( aShapeProp.hasProperty( PROP_Name ) )
                     aShapeProp.setProperty( PROP_Name, getShapeName() );
+                uno::Reference< lang::XServiceInfo > xSInfo( xShape, uno::UNO_QUERY_THROW );
+                if (xSInfo->supportsService("com.sun.star.text.TextFrame"))
+                {
+                    uno::Sequence<beans::PropertyValue> aGrabBag;
+                    uno::Reference<beans::XPropertySet> propertySet (xShape, uno::UNO_QUERY);
+                    propertySet->getPropertyValue("FrameInteropGrabBag") >>= 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( "FrameInteropGrabBag", uno::makeAny(aGrabBag) );
+                }
                 Reference< XControlShape > xControlShape( xShape, uno::UNO_QUERY );
                 if ( xControlShape.is() && !getTypeModel().mbVisible )
                 {
diff --git a/oox/source/vml/vmlshapecontext.cxx b/oox/source/vml/vmlshapecontext.cxx
index fdeca32..146940e 100644
--- a/oox/source/vml/vmlshapecontext.cxx
+++ b/oox/source/vml/vmlshapecontext.cxx
@@ -399,6 +399,7 @@ void ShapeTypeContext::setStyle( const OUString& rStyle )
         if( ConversionHelper::separatePair( aName, aValue, rStyle.getToken( 0, ';', nIndex ), ':' ) )
         {
                  if( aName == "position" )      mrTypeModel.maPosition = aValue;
+            else if( aName == "z-index" )        mrTypeModel.maZIndex = aValue;
             else if( aName == "left" )           mrTypeModel.maLeft = aValue;
             else if( aName == "top" )            mrTypeModel.maTop = aValue;
             else if( aName == "width" )          mrTypeModel.maWidth = aValue;
diff --git a/sw/qa/extras/ooxmlexport/data/fdo76591.docx b/sw/qa/extras/ooxmlexport/data/fdo76591.docx
new file mode 100644
index 0000000..8ca4387
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo76591.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 68ef7ebb..aa48fda 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2989,6 +2989,14 @@ DECLARE_OOXMLEXPORT_TEST(testFDO76163 , "fdo76163.docx")
     assertXPath ( pXmlDoc, "/w:document/w:body/w:p[2]/w:hyperlink/w:r[11]/w:fldChar", "fldCharType", "end" );
 }
 
+DECLARE_OOXMLEXPORT_TEST(fdo76591, "fdo76591.docx")
+{
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+    assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[3]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]", "relativeHeight", "3");
+}
+
 DECLARE_OOXMLEXPORT_TEST(test76317_2K10, "test76317_2K10.docx")
 {
     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 2177596..d6c97ed 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -59,6 +59,7 @@
 #include <com/sun/star/text/ControlCharacter.hpp>
 #include <com/sun/star/text/XTextColumns.hpp>
 #include <oox/mathml/import.hxx>
+ #include <GraphicHelpers.hxx>
 
 #ifdef DEBUG_DOMAINMAPPER
 #include <resourcemodel/QNameToString.hxx>
@@ -1735,16 +1736,30 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
             if (xSInfo->supportsService("com.sun.star.text.TextFrame"))
             {
                 // Extract the special "btLr text frame" mode, requested by oox, if needed.
+                // Extract vml ZOrder from FrameInteropGrabBag
                 uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY);
                 uno::Sequence<beans::PropertyValue> aGrabBag;
                 xShapePropertySet->getPropertyValue("FrameInteropGrabBag") >>= aGrabBag;
+                bool checkBtLrStatus = false;bool checkZOredrStatus = false;
+
                 for (int i = 0; i < aGrabBag.getLength(); ++i)
                 {
                     if (aGrabBag[i].Name == "mso-layout-flow-alt")
                     {
                         m_bFrameBtLr = aGrabBag[i].Value.get<OUString>() == "bottom-to-top";
-                        break;
+                        checkBtLrStatus = true;
                     }
+                    if (aGrabBag[i].Name == "VML-Z-ORDER")
+                    {
+                        GraphicZOrderHelper* pZOrderHelper = m_rDMapper.graphicZOrderHelper();
+                        sal_Int32 zOrder;
+                        aGrabBag[i].Value >>= zOrder;
+                        xShapePropertySet->setPropertyValue( "ZOrder", uno::makeAny(pZOrderHelper->findZOrder(zOrder)));
+                        pZOrderHelper->addItem(xShapePropertySet, zOrder);
+                        checkZOredrStatus = true;
+                    }
+                    if(checkBtLrStatus && checkZOredrStatus)
+                        break;
                 }
 
                 uno::Reference<text::XTextContent> xTextContent(xShape, uno::UNO_QUERY_THROW);


More information about the Libreoffice-commits mailing list