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

Miklos Vajna vmiklos at collabora.co.uk
Fri Dec 6 08:18:28 PST 2013


 sw/qa/extras/ooxmlexport/data/fdo65295.docx   |binary
 sw/qa/extras/ooxmlimport/data/mce-nested.docx |binary
 sw/qa/extras/ooxmlimport/data/wps-only.docx   |binary
 writerfilter/source/dmapper/GraphicImport.cxx |   50 ++++++++++++++++----------
 4 files changed, 31 insertions(+), 19 deletions(-)

New commits:
commit 41acd107e78bb45ac8a6bb632ed5432d6d9deb9f
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 6 16:21:42 2013 +0100

    DOCX drawingml shape import: handle name and z-order
    
    Change-Id: Ib4e17723ba9e2bb4dae0eb86cf55513a4b68de6f

diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index fab8788..e293b0c 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -378,6 +378,33 @@ public:
         xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_VERT_ORIENT_RELATION ),
                 uno::makeAny(nVertRelation));
     }
+
+    void applyZOrder(uno::Reference<beans::XPropertySet>& xGraphicObjectProperties) const
+    {
+        PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
+        if (zOrder >= 0)
+        {
+            GraphicZOrderHelper* pZOrderHelper = rDomainMapper.graphicZOrderHelper();
+            xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_Z_ORDER), uno::makeAny(pZOrderHelper->findZOrder(zOrder)));
+            pZOrderHelper->addItem(xGraphicObjectProperties, zOrder);
+        }
+    }
+
+    void applyName(uno::Reference<beans::XPropertySet>& xGraphicObjectProperties) const
+    {
+        try
+        {
+            if( !sName.isEmpty() )
+            {
+                uno::Reference< container::XNamed > xNamed( xGraphicObjectProperties, uno::UNO_QUERY_THROW );
+                xNamed->setName( sName );
+            }
+        }
+        catch( const uno::Exception& e )
+        {
+            SAL_WARN("writerfilter", "failed. Message :" << e.Message);
+        }
+    }
 };
 
 
@@ -1045,6 +1072,8 @@ void GraphicImport::lcl_attribute(Id nName, Value & val)
                         bool bOpaque = m_pImpl->bOpaque && !m_pImpl->rDomainMapper.IsInHeaderFooter();
                         xShapeProps->setPropertyValue("Opaque", uno::makeAny(bOpaque));
                         xShapeProps->setPropertyValue("Surround", uno::makeAny(m_pImpl->nWrap));
+                        m_pImpl->applyZOrder(xShapeProps);
+                        m_pImpl->applyName(xShapeProps);
                     }
                 }
             }
@@ -1581,13 +1610,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
                 xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_BACK_COLOR ),
                     uno::makeAny( m_pImpl->nFillColor ));
 
-                if( m_pImpl->zOrder >= 0 )
-                {
-                    GraphicZOrderHelper* zOrderHelper = m_pImpl->rDomainMapper.graphicZOrderHelper();
-                    xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName( PROP_Z_ORDER ),
-                        uno::makeAny( zOrderHelper->findZOrder( m_pImpl->zOrder )));
-                    zOrderHelper->addItem( xGraphicObjectProperties, m_pImpl->zOrder );
-                }
+                m_pImpl->applyZOrder(xGraphicObjectProperties);
 
                 //there seems to be no way to detect the original size via _real_ API
                 uno::Reference< beans::XPropertySet > xGraphicProperties( xGraphic, uno::UNO_QUERY_THROW );
@@ -1635,18 +1658,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
                     xGraphicObjectProperties->setPropertyValue(rPropNameSupplier.GetName(PROP_SIZE),
                         uno::makeAny( awt::Size( m_pImpl->getXSize(), m_pImpl->getYSize() )));
                 m_pImpl->applyMargins(xGraphicObjectProperties);
-                try
-                {
-                    if( !m_pImpl->sName.isEmpty() )
-                    {
-                        uno::Reference< container::XNamed > xNamed( xGraphicObjectProperties, uno::UNO_QUERY_THROW );
-                        xNamed->setName( m_pImpl->sName );
-                    }
-                }
-                catch( const uno::Exception& e )
-                {
-                    SAL_WARN("writerfilter", "failed. Message :" << e.Message);
-                }
+                m_pImpl->applyName(xGraphicObjectProperties);
             }
         }
     }
commit 627bfee26354fe59926607138d162a3dd1c8e3f6
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 6 16:28:53 2013 +0100

    sw: remove unused zorder data from bugdocs
    
    Expecting that the shapes are on the drawpage in the same order as they
    are in the file and providing zorder info at the same time doesn't work.
    Either using names is required or the simpler way is not providing
    zorder info. Fixed earlier bugdocs not to provide zorder info, so when
    zorder will be handled, these tests will still work.
    
    Change-Id: I771b0574eba489322998c84a60d5acb94fd09189

diff --git a/sw/qa/extras/ooxmlexport/data/fdo65295.docx b/sw/qa/extras/ooxmlexport/data/fdo65295.docx
index 3cc790e..52a231a 100644
Binary files a/sw/qa/extras/ooxmlexport/data/fdo65295.docx and b/sw/qa/extras/ooxmlexport/data/fdo65295.docx differ
diff --git a/sw/qa/extras/ooxmlimport/data/mce-nested.docx b/sw/qa/extras/ooxmlimport/data/mce-nested.docx
index 6804fc2..907ac08 100644
Binary files a/sw/qa/extras/ooxmlimport/data/mce-nested.docx and b/sw/qa/extras/ooxmlimport/data/mce-nested.docx differ
diff --git a/sw/qa/extras/ooxmlimport/data/wps-only.docx b/sw/qa/extras/ooxmlimport/data/wps-only.docx
index d45aa3e..7f7b8c7 100644
Binary files a/sw/qa/extras/ooxmlimport/data/wps-only.docx and b/sw/qa/extras/ooxmlimport/data/wps-only.docx differ


More information about the Libreoffice-commits mailing list