/[packages]/updates/5/libreoffice/current/SOURCES/0005-sw-fix-DOCX-export-of-embedded-OOXML-objects.patch
ViewVC logotype

Contents of /updates/5/libreoffice/current/SOURCES/0005-sw-fix-DOCX-export-of-embedded-OOXML-objects.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 913941 - (show annotations) (download)
Thu Dec 24 08:07:30 2015 UTC (8 years, 3 months ago) by tv
File size: 5246 byte(s)
- new bugfix release
- sync patches with FC
1 From 346957555f9918df4b6b899dbf3effdcc5bad45c Mon Sep 17 00:00:00 2001
2 From: Michael Stahl <mstahl@redhat.com>
3 Date: Thu, 3 Dec 2015 15:58:12 +0100
4 Subject: [PATCH 5/9] sw: fix DOCX export of embedded OOXML objects
5
6 OOXML embedded objects are converted to ODF during export, which
7 prevents the export from working, as it expects a stream, and ODF
8 uses a storage.
9
10 There is already a unit test in testEmbeddedXlsx, but it wrongly
11 succeeds because the components necessary to convert from OOXML to ODF
12 are missing in the test environment.
13
14 (cherry picked from commit 1dac99e7ea45f90bf39eb95eb7bc01f7d79093ef)
15 (cherry picked from commit 290cac714b09cd0eccb02caa03452e35b87ebaae)
16
17 sw: un-break DOCX formula export
18
19 (regression from 1dac99e7ea45f90bf39eb95eb7bc01f7d79093ef)
20
21 (cherry picked from commit 3b63d2b9371baa5f526d0fcd41043ec76abb0d50)
22
23 Reviewed-on: https://gerrit.libreoffice.org/20469
24 Tested-by: Jenkins <ci@libreoffice.org>
25 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
26 (cherry picked from commit 7689b7b7011e6712ad4b47875927c0a6b9322319)
27
28 Change-Id: Ib4df346e04ecfb54ec1a728535be876db921b884
29 ---
30 sw/ooxmlexport_setup.mk | 6 +++++
31 sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 3 +++
32 sw/source/filter/ww8/docxattributeoutput.cxx | 38 ++++++++++++++++++----------
33 3 files changed, 33 insertions(+), 14 deletions(-)
34
35 diff --git a/sw/ooxmlexport_setup.mk b/sw/ooxmlexport_setup.mk
36 index 5a0cc3b..bd4518d 100644
37 --- a/sw/ooxmlexport_setup.mk
38 +++ b/sw/ooxmlexport_setup.mk
39 @@ -32,6 +32,9 @@ define sw_ooxmlexport_components
40 configmgr/source/configmgr \
41 drawinglayer/drawinglayer \
42 embeddedobj/util/embobj \
43 + $(if $(filter-out WNT,$(OS)), \
44 + embeddedobj/source/msole/emboleobj \
45 + ) \
46 filter/source/config/cache/filterconfig1 \
47 filter/source/odfflatxml/odfflatxml \
48 filter/source/xmlfilterdetect/xmlfd \
49 @@ -44,6 +47,9 @@ define sw_ooxmlexport_components
50 package/source/xstor/xstor \
51 package/util/package2 \
52 sax/source/expatwrap/expwrap \
53 + sc/util/sc \
54 + sc/util/scd \
55 + sc/util/scfilt \
56 sw/util/sw \
57 sw/util/swd \
58 sw/util/msword \
59 diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
60 index 7b0edaf..1dbeaed 100644
61 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
62 +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
63 @@ -1039,6 +1039,9 @@ DECLARE_OOXMLEXPORT_TEST(testFileOpenInputOutputError,"floatingtbl_with_formula.
64 if (!pXmlDoc)
65 return;
66 assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pStyle", "val", "Normal");
67 +
68 + // let's also assert that the formula was exported properly
69 + assertXPathContent(pXmlDoc, "//wps:txbx/w:txbxContent/w:tbl/w:tr/w:tc[2]/w:p/m:oMath/m:sSubSup/m:e/m:r/m:t", OUString::fromUtf8("\xcf\x83"));
70 }
71
72 #endif
73 diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
74 index 290ac6f..a7dd8e7 100644
75 --- a/sw/source/filter/ww8/docxattributeoutput.cxx
76 +++ b/sw/source/filter/ww8/docxattributeoutput.cxx
77 @@ -125,6 +125,7 @@
78 #include <com/sun/star/chart2/XChartDocument.hpp>
79 #include <com/sun/star/drawing/ShadingPattern.hpp>
80 #include <com/sun/star/text/GraphicCrop.hpp>
81 +#include <com/sun/star/embed/EmbedStates.hpp>
82
83 #include <algorithm>
84
85 @@ -4294,22 +4295,27 @@ void DocxAttributeOutput::WriteOLE2Obj( const SdrObject* pSdrObj, SwOLENode& rOL
86
87 bool DocxAttributeOutput::WriteOLEChart( const SdrObject* pSdrObj, const Size& rSize )
88 {
89 - uno::Reference< chart2::XChartDocument > xChartDoc;
90 uno::Reference< drawing::XShape > xShape( ((SdrObject*)pSdrObj)->getUnoShape(), uno::UNO_QUERY );
91 - if( xShape.is() )
92 - {
93 - uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY );
94 - if( xPropSet.is() )
95 - xChartDoc.set( xPropSet->getPropertyValue( "Model" ), uno::UNO_QUERY );
96 - }
97 + if (!xShape.is())
98 + return false;
99
100 - if( xChartDoc.is() )
101 - {
102 - m_postponedChart = pSdrObj;
103 - m_postponedChartSize = rSize;
104 - return true;
105 - }
106 - return false;
107 + uno::Reference<beans::XPropertySet> const xPropSet(xShape, uno::UNO_QUERY);
108 + if (!xPropSet.is())
109 + return false;
110 +
111 + OUString clsid; // why is the property of type string, not sequence<byte>?
112 + xPropSet->getPropertyValue("CLSID") >>= clsid;
113 + SAL_WARN_IF(clsid.isEmpty(), "sw.ww8", "OLE without CLSID?");
114 + SvGlobalName aClassID;
115 + bool const isValid(aClassID.MakeId(clsid));
116 + SAL_WARN_IF(!isValid, "sw.ww8", "OLE with invalid CLSID?");
117 +
118 + if (!SotExchange::IsChart(aClassID))
119 + return false;
120 +
121 + m_postponedChart = pSdrObj;
122 + m_postponedChartSize = rSize;
123 + return true;
124 }
125
126 /*
127 @@ -4412,6 +4418,10 @@ void DocxAttributeOutput::WritePostponedMath()
128 if( m_postponedMath == NULL )
129 return;
130 uno::Reference < embed::XEmbeddedObject > xObj(const_cast<SwOLENode*>(m_postponedMath)->GetOLEObj().GetOleRef());
131 + if (embed::EmbedStates::LOADED == xObj->getCurrentState())
132 + { // must be running so there is a Component
133 + xObj->changeState(embed::EmbedStates::RUNNING);
134 + }
135 uno::Reference< uno::XInterface > xInterface( xObj->getComponent(), uno::UNO_QUERY );
136 if (!xInterface.is())
137 {
138 --
139 2.5.0
140

  ViewVC Help
Powered by ViewVC 1.1.30