[Libreoffice-commits] core.git: 2 commits - sw/ooxmlexport_setup.mk sw/source

Michael Stahl mstahl at redhat.com
Thu Dec 3 08:57:10 PST 2015


 sw/ooxmlexport_setup.mk                      |    6 ++++
 sw/source/filter/ww8/docxattributeoutput.cxx |   39 +++++++++++++++++----------
 2 files changed, 31 insertions(+), 14 deletions(-)

New commits:
commit 1dac99e7ea45f90bf39eb95eb7bc01f7d79093ef
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Dec 3 15:58:12 2015 +0100

    sw: fix DOCX export of embedded OOXML objects
    
    OOXML embedded objects are converted to ODF during export, which
    prevents the export from working, as it expects a stream, and ODF
    uses a storage.
    
    There is already a unit test in testEmbeddedXlsx, but it wrongly
    succeeds because the components necessary to convert from OOXML to ODF
    are missing in the test environment.
    
    Change-Id: Ib4df346e04ecfb54ec1a728535be876db921b884

diff --git a/sw/ooxmlexport_setup.mk b/sw/ooxmlexport_setup.mk
index c8cfc9f..a033701 100644
--- a/sw/ooxmlexport_setup.mk
+++ b/sw/ooxmlexport_setup.mk
@@ -33,6 +33,9 @@ define sw_ooxmlexport_components
 	dbaccess/util/dba \
 	drawinglayer/drawinglayer \
 	embeddedobj/util/embobj \
+	$(if $(filter-out WNT,$(OS)), \
+		embeddedobj/source/msole/emboleobj \
+	) \
 	filter/source/config/cache/filterconfig1 \
 	filter/source/odfflatxml/odfflatxml \
 	filter/source/xmlfilterdetect/xmlfd \
@@ -45,6 +48,9 @@ define sw_ooxmlexport_components
 	package/source/xstor/xstor \
 	package/util/package2 \
 	sax/source/expatwrap/expwrap \
+	sc/util/sc \
+	sc/util/scd \
+	sc/util/scfilt \
 	sw/util/sw \
 	sw/util/swd \
 	sw/util/msword \
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 5b56d5b..e7cdb49 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4401,22 +4401,27 @@ void DocxAttributeOutput::WriteOLE2Obj( const SdrObject* pSdrObj, SwOLENode& rOL
 
 bool DocxAttributeOutput::WriteOLEChart( const SdrObject* pSdrObj, const Size& rSize )
 {
-    uno::Reference< chart2::XChartDocument > xChartDoc;
     uno::Reference< drawing::XShape > xShape( const_cast<SdrObject*>(pSdrObj)->getUnoShape(), uno::UNO_QUERY );
-    if( xShape.is() )
-    {
-        uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
-        if( xPropSet.is() )
-            xChartDoc.set( xPropSet->getPropertyValue( "Model" ), uno::UNO_QUERY );
-    }
+    if (!xShape.is())
+        return false;
 
-    if( xChartDoc.is() )
-    {
-        m_postponedChart = pSdrObj;
-        m_postponedChartSize = rSize;
-        return true;
-    }
-    return false;
+    uno::Reference<beans::XPropertySet> const xPropSet(xShape, uno::UNO_QUERY);
+    if (!xPropSet.is())
+        return false;
+
+    OUString clsid; // why is the property of type string, not sequence<byte>?
+    xPropSet->getPropertyValue("CLSID") >>= clsid;
+    assert(!clsid.isEmpty());
+    SvGlobalName aClassID;
+    bool const isValid(aClassID.MakeId(clsid));
+    assert(isValid);
+
+    if (!SotExchange::IsChart(aClassID))
+        return false;
+
+    m_postponedChart = pSdrObj;
+    m_postponedChartSize = rSize;
+    return true;
 }
 
 /*
commit 6c569a2ed797aa7ad52f8a7dc6be3bfb3b4b452a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Dec 2 16:00:58 2015 +0100

    sw: docx export: write something more specific for embedded PDF
    
    Doesn't really change anything, but looks nicer.
    
    Change-Id: I8f2dc41adaf22e11b1c15ba619ac00b6b72892fa

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index e273094..5b56d5b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4840,6 +4840,12 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S
         sRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
         sFileExtension = "xls";
     }
+    else if (sProgID == "AcroExch.Document.11")
+    {
+        sMediaType = "application/pdf";
+        sRelationType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject";
+        sFileExtension = "pdf";
+    }
     else
     {
         sMediaType = "application/vnd.openxmlformats-officedocument.oleObject";


More information about the Libreoffice-commits mailing list