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

Miklos Vajna vmiklos at collabora.co.uk
Fri Jul 4 09:02:20 PDT 2014


 sw/qa/extras/ooxmlexport/data/bnc884615.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx  |    6 ++++++
 writerfilter/source/dmapper/DomainMapper.cxx |    2 +-
 writerfilter/source/dmapper/OLEHandler.cxx   |   10 ++++++++--
 writerfilter/source/dmapper/OLEHandler.hxx   |    4 +++-
 5 files changed, 18 insertions(+), 4 deletions(-)

New commits:
commit 15c3a08b8b1e8060f9659c7bc98480a39d1802c5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Jul 4 16:38:40 2014 +0200

    bnc#884615 VML import: import OLE objects in header with background wrapping
    
    We already do this for drawingML shapes since commit
    500343105707a9905f5198a4af6ad58fe307b7c2 (DOCX drawingML shape import:
    always set Opaque, 2013-12-04), make the VML / OLE case behave the same
    as well.
    
    Change-Id: Ic22f1f3cfd325ccbbb9bd6fe9814553683e4de55

diff --git a/sw/qa/extras/ooxmlexport/data/bnc884615.docx b/sw/qa/extras/ooxmlexport/data/bnc884615.docx
new file mode 100755
index 0000000..51ee5ca
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/bnc884615.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index 22635f4..0aa8235 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -1736,6 +1736,12 @@ DECLARE_OOXMLEXPORT_TEST(testfdo79591, "fdo79591.docx")
     assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape", "ID", "");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testBnc884615, "bnc884615.docx")
+{
+    // The problem was that the shape in the header wasn't in the background.
+    CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(1), "Opaque")));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index ea66861..98e14d7 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2217,7 +2217,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext )
         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
         if( pProperties.get( ) )
         {
-            OLEHandlerPtr pOLEHandler( new OLEHandler );
+            OLEHandlerPtr pOLEHandler( new OLEHandler(*this) );
             pProperties->resolve(*pOLEHandler);
             if ( pOLEHandler->isOLEObject( ) )
             {
diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx
index 1976a13..a07b443 100644
--- a/writerfilter/source/dmapper/OLEHandler.cxx
+++ b/writerfilter/source/dmapper/OLEHandler.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 #include <OLEHandler.hxx>
+#include <dmapper/DomainMapper.hxx>
 #include <PropertyMap.hxx>
 #include "GraphicHelpers.hxx"
 
@@ -45,11 +46,12 @@ namespace dmapper {
 using namespace ::com::sun::star;
 
 
-OLEHandler::OLEHandler() :
+OLEHandler::OLEHandler(DomainMapper& rDomainMapper) :
 LoggedProperties(dmapper_logger, "OLEHandler"),
 m_nDxaOrig(0),
 m_nDyaOrig(0),
-    m_nWrapMode(1)
+    m_nWrapMode(1),
+    m_rDomainMapper(rDomainMapper)
 {
 }
 
@@ -104,6 +106,10 @@ void OLEHandler::lcl_attribute(Id rName, Value & rVal)
 
                 try
                 {
+                    // Shapes in the header or footer should be in the background.
+                    if (m_rDomainMapper.IsInHeaderFooter())
+                        xShapeProps->setPropertyValue("Opaque", uno::makeAny(false));
+
                     m_aShapeSize = xTempShape->getSize();
                     m_aShapePosition = xTempShape->getPosition();
 
diff --git a/writerfilter/source/dmapper/OLEHandler.hxx b/writerfilter/source/dmapper/OLEHandler.hxx
index 00b4d8a..9e22fc1 100644
--- a/writerfilter/source/dmapper/OLEHandler.hxx
+++ b/writerfilter/source/dmapper/OLEHandler.hxx
@@ -40,6 +40,7 @@ namespace com{ namespace sun{ namespace star{
 namespace writerfilter {
 namespace dmapper
 {
+class DomainMapper;
 /** Handler for OLE objects
  */
 class OLEHandler : public LoggedProperties
@@ -63,6 +64,7 @@ class OLEHandler : public LoggedProperties
     ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > m_xReplacement;
 
     ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xInputStream;
+    DomainMapper& m_rDomainMapper;
 
     // Properties
     virtual void lcl_attribute(Id Name, Value & val) SAL_OVERRIDE;
@@ -73,7 +75,7 @@ class OLEHandler : public LoggedProperties
                                         const OUString& sObjectName );
 
 public:
-    OLEHandler();
+    OLEHandler(DomainMapper& rDomainMapper);
     virtual ~OLEHandler();
 
     inline ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getShape( ) { return m_xShape; };


More information about the Libreoffice-commits mailing list