Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <string.h>
30 : :
31 : : #include "sal/config.h"
32 : :
33 : : #include <officecfg/Office/Common.hxx>
34 : : #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
35 : : #include <osl/mutex.hxx>
36 : : #include <tools/debug.hxx>
37 : : #include <tools/urlobj.hxx>
38 : : #include <comphelper/genericpropertyset.hxx>
39 : : #include <com/sun/star/container/XNameAccess.hpp>
40 : : #include <com/sun/star/io/XInputStream.hpp>
41 : : #include <com/sun/star/document/XBinaryStreamResolver.hpp>
42 : : #include <com/sun/star/xml/sax/SAXInvalidCharacterException.hpp>
43 : : #include <com/sun/star/uri/XUriReferenceFactory.hpp>
44 : : #include <com/sun/star/uri/UriReferenceFactory.hpp>
45 : : #include <com/sun/star/util/MeasureUnit.hpp>
46 : : #include <comphelper/processfactory.hxx>
47 : : #include <xmloff/attrlist.hxx>
48 : : #include <xmloff/nmspmap.hxx>
49 : : #include <xmloff/xmluconv.hxx>
50 : : #include "xmloff/xmlnmspe.hxx"
51 : : #include <xmloff/xmltoken.hxx>
52 : : #include <xmloff/xmlexp.hxx>
53 : : #include <xmloff/xmlnumfe.hxx>
54 : : #include <xmloff/xmlmetae.hxx>
55 : : #include <xmloff/XMLSettingsExportContext.hxx>
56 : : #include <xmloff/families.hxx>
57 : : #include <xmloff/XMLEventExport.hxx>
58 : : #include "XMLStarBasicExportHandler.hxx"
59 : : #include "XMLScriptExportHandler.hxx"
60 : : #include <xmloff/SettingsExportHelper.hxx>
61 : : #include <com/sun/star/container/XIndexContainer.hpp>
62 : : #include <com/sun/star/document/XEventsSupplier.hpp>
63 : : #include <com/sun/star/document/XViewDataSupplier.hpp>
64 : : #include <xmloff/GradientStyle.hxx>
65 : : #include <xmloff/HatchStyle.hxx>
66 : : #include <xmloff/ImageStyle.hxx>
67 : : #include <TransGradientStyle.hxx>
68 : : #include <xmloff/MarkerStyle.hxx>
69 : : #include <xmloff/DashStyle.hxx>
70 : : #include <xmloff/XMLFontAutoStylePool.hxx>
71 : : #include "XMLImageMapExport.hxx"
72 : : #include "XMLBase64Export.hxx"
73 : : #include "xmloff/xmlerror.hxx"
74 : : #include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
75 : : #include <com/sun/star/beans/PropertyAttribute.hpp>
76 : : #include "xmloff/XMLFilterServiceNames.h"
77 : : #include "xmloff/XMLEmbeddedObjectExportFilter.hxx"
78 : : #include "XMLBasicExportFilter.hxx"
79 : : #include <rtl/logfile.hxx>
80 : : #include <cppuhelper/implbase1.hxx>
81 : : #include <comphelper/extract.hxx>
82 : : #include <comphelper/servicehelper.hxx>
83 : : #include "PropertySetMerger.hxx"
84 : :
85 : : #include "svl/urihelper.hxx"
86 : : #include "xmloff/xformsexport.hxx"
87 : :
88 : : #include <unotools/docinfohelper.hxx>
89 : : #include <unotools/bootstrap.hxx>
90 : : #include <unotools/configmgr.hxx>
91 : : #include <com/sun/star/document/XDocumentProperties.hpp>
92 : : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
93 : : #include <com/sun/star/embed/XEncryptionProtectedSource2.hpp>
94 : : #include <com/sun/star/rdf/XMetadatable.hpp>
95 : : #include "RDFaExportHelper.hxx"
96 : :
97 : : #include <comphelper/xmltools.hxx>
98 : :
99 : : using ::rtl::OUString;
100 : :
101 : : using namespace ::osl;
102 : : using namespace ::com::sun::star;
103 : : using namespace ::com::sun::star::uno;
104 : : using namespace ::com::sun::star::frame;
105 : : using namespace ::com::sun::star::container;
106 : : using namespace ::com::sun::star::lang;
107 : : using namespace ::com::sun::star::document;
108 : : using namespace ::com::sun::star::beans;
109 : : using namespace ::com::sun::star::xml::sax;
110 : : using namespace ::com::sun::star::io;
111 : : using namespace ::xmloff::token;
112 : :
113 : : sal_Char const sXML_1_1[] = "1.1";
114 : : sal_Char const sXML_1_2[] = "1.2";
115 : :
116 : : // #i115030#: the XSLT is not finished, and not available via HTTP
117 : : const sal_Char s_grddl_xsl[] = "http://FIXME";
118 : :
119 : : #define LOGFILE_AUTHOR "mb93740"
120 : :
121 : : #define XML_MODEL_SERVICE_WRITER "com.sun.star.text.TextDocument"
122 : : #define XML_MODEL_SERVICE_CALC "com.sun.star.sheet.SpreadsheetDocument"
123 : : #define XML_MODEL_SERVICE_DRAW "com.sun.star.drawing.DrawingDocument"
124 : : #define XML_MODEL_SERVICE_IMPRESS "com.sun.star.presentation.PresentationDocument"
125 : : #define XML_MODEL_SERVICE_MATH "com.sun.star.formula.FormulaProperties"
126 : : #define XML_MODEL_SERVICE_CHART "com.sun.star.chart.ChartDocument"
127 : :
128 : : #define XML_USEPRETTYPRINTING "UsePrettyPrinting"
129 : :
130 : : struct XMLServiceMapEntry_Impl
131 : : {
132 : : const sal_Char *sModelService;
133 : : sal_Int32 nModelServiceLen;
134 : : const sal_Char *sFilterService;
135 : : sal_Int32 nFilterServiceLen;
136 : : };
137 : :
138 : : #define SERVICE_MAP_ENTRY( app ) \
139 : : { XML_MODEL_SERVICE_##app, sizeof(XML_MODEL_SERVICE_##app)-1, \
140 : : XML_EXPORT_FILTER_##app, sizeof(XML_EXPORT_FILTER_##app)-1 }
141 : :
142 : : const XMLServiceMapEntry_Impl aServiceMap[] =
143 : : {
144 : : SERVICE_MAP_ENTRY( WRITER ),
145 : : SERVICE_MAP_ENTRY( CALC ),
146 : : SERVICE_MAP_ENTRY( IMPRESS ),// Impress supports DrawingDocument, too, so
147 : : SERVICE_MAP_ENTRY( DRAW ), // it must appear before Draw
148 : : SERVICE_MAP_ENTRY( MATH ),
149 : : SERVICE_MAP_ENTRY( CHART ),
150 : : { 0, 0, 0, 0 }
151 : : };
152 : :
153 : : //==============================================================================
154 : :
155 : : class SAL_DLLPRIVATE SettingsExportFacade : public ::xmloff::XMLSettingsExportContext
156 : : {
157 : : public:
158 : 1061 : SettingsExportFacade( SvXMLExport& i_rExport )
159 [ + - ][ + - ]: 1061 : :m_rExport( i_rExport )
160 : : {
161 : 1061 : }
162 : :
163 : 1061 : virtual ~SettingsExportFacade()
164 : 1061 : {
165 [ - + ]: 1061 : }
166 : :
167 : : virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName,
168 : : const ::rtl::OUString& i_rValue );
169 : : virtual void AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName,
170 : : enum ::xmloff::token::XMLTokenEnum i_eValue );
171 : :
172 : : virtual void StartElement( enum ::xmloff::token::XMLTokenEnum i_eName,
173 : : const sal_Bool i_bIgnoreWhitespace );
174 : : virtual void EndElement( const sal_Bool i_bIgnoreWhitespace );
175 : :
176 : : virtual void Characters( const ::rtl::OUString& i_rCharacters );
177 : :
178 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
179 : : GetServiceFactory() const;
180 : : private:
181 : : SvXMLExport& m_rExport;
182 : : ::std::stack< ::rtl::OUString > m_aElements;
183 : : };
184 : :
185 : 57460 : void SettingsExportFacade::AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, const ::rtl::OUString& i_rValue )
186 : : {
187 : 57460 : m_rExport.AddAttribute( XML_NAMESPACE_CONFIG, i_eName, i_rValue );
188 : 57460 : }
189 : :
190 : 55647 : void SettingsExportFacade::AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, enum ::xmloff::token::XMLTokenEnum i_eValue )
191 : : {
192 : 55647 : m_rExport.AddAttribute( XML_NAMESPACE_CONFIG, i_eName, i_eValue );
193 : 55647 : }
194 : :
195 : 57491 : void SettingsExportFacade::StartElement( enum ::xmloff::token::XMLTokenEnum i_eName, const sal_Bool i_bIgnoreWhitespace )
196 : : {
197 [ + - ][ + - ]: 57491 : const ::rtl::OUString sElementName( m_rExport.GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_CONFIG, GetXMLToken( i_eName ) ) );
198 [ + - ]: 57491 : m_rExport.StartElement( sElementName, i_bIgnoreWhitespace );
199 [ + - ]: 57491 : m_aElements.push( sElementName );
200 : 57491 : }
201 : :
202 : 57491 : void SettingsExportFacade::EndElement( const sal_Bool i_bIgnoreWhitespace )
203 : : {
204 [ + - ]: 57491 : const ::rtl::OUString sElementName( m_aElements.top() );
205 [ + - ]: 57491 : m_rExport.EndElement( sElementName, i_bIgnoreWhitespace );
206 [ + - ]: 57491 : m_aElements.pop();
207 : 57491 : }
208 : :
209 : 54625 : void SettingsExportFacade::Characters( const ::rtl::OUString& i_rCharacters )
210 : : {
211 : 54625 : m_rExport.GetDocHandler()->characters( i_rCharacters );
212 : 54625 : }
213 : :
214 : 1763 : Reference< XMultiServiceFactory > SettingsExportFacade::GetServiceFactory() const
215 : : {
216 : 1763 : return m_rExport.getServiceFactory();
217 : : }
218 : :
219 : : //==============================================================================
220 : :
221 : : class SvXMLExportEventListener : public cppu::WeakImplHelper1<
222 : : com::sun::star::lang::XEventListener >
223 : : {
224 : : private:
225 : : SvXMLExport* pExport;
226 : :
227 : : public:
228 : : SvXMLExportEventListener(SvXMLExport* pExport);
229 : : virtual ~SvXMLExportEventListener();
230 : :
231 : : // XEventListener
232 : : virtual void SAL_CALL disposing(const lang::EventObject& rEventObject) throw(::com::sun::star::uno::RuntimeException);
233 : : };
234 : :
235 : 2253 : SvXMLExportEventListener::SvXMLExportEventListener(SvXMLExport* pTempExport)
236 : 2253 : : pExport(pTempExport)
237 : : {
238 : 2253 : }
239 : :
240 : 2253 : SvXMLExportEventListener::~SvXMLExportEventListener()
241 : : {
242 [ - + ]: 4506 : }
243 : :
244 : : // XEventListener
245 : 46 : void SAL_CALL SvXMLExportEventListener::disposing( const lang::EventObject& )
246 : : throw(uno::RuntimeException)
247 : : {
248 [ + - ]: 46 : if (pExport)
249 : : {
250 : 46 : pExport->DisposingModel();
251 : 46 : pExport = NULL;
252 : : }
253 : 46 : }
254 : :
255 : : //==============================================================================
256 : :
257 [ + - ][ + - ]: 2305 : class SAL_DLLPRIVATE SvXMLExport_Impl
258 : : {
259 : : public:
260 : : SvXMLExport_Impl();
261 : :
262 : : ::comphelper::UnoInterfaceToUniqueIdentifierMapper maInterfaceToIdentifierMapper;
263 : : uno::Reference< uri::XUriReferenceFactory > mxUriReferenceFactory;
264 : : rtl::OUString msPackageURI;
265 : : rtl::OUString msPackageURIScheme;
266 : : // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
267 : : sal_Bool mbOutlineStyleAsNormalListStyle;
268 : : sal_Bool mbSaveBackwardCompatibleODF;
269 : :
270 : : uno::Reference< embed::XStorage > mxTargetStorage;
271 : :
272 : : SvtSaveOptions maSaveOptions;
273 : :
274 : : /// relative path of stream in package, e.g. "someobject/content.xml"
275 : : ::rtl::OUString mStreamPath;
276 : :
277 : : const uno::Reference< uno::XComponentContext > mxComponentContext;
278 : :
279 : : /// name of stream in package, e.g., "content.xml"
280 : : ::rtl::OUString mStreamName;
281 : :
282 : : /// stack of backed up namespace maps
283 : : /// long: depth at which namespace map has been backed up into the stack
284 : : ::std::stack< ::std::pair< SvXMLNamespaceMap *, long > > mNamespaceMaps;
285 : : /// counts depth (number of open elements/start tags)
286 : : long mDepth;
287 : :
288 : : ::std::auto_ptr< ::xmloff::RDFaExportHelper> mpRDFaHelper;
289 : :
290 : : sal_Bool mbExportTextNumberElement;
291 : : sal_Bool mbNullDateInitialized;
292 : :
293 : 2253 : void SetSchemeOf( const ::rtl::OUString& rOrigFileName )
294 : : {
295 : 2253 : sal_Int32 nSep = rOrigFileName.indexOf(':');
296 [ + + ]: 2253 : if( nSep != -1 )
297 : 472 : msPackageURIScheme = rOrigFileName.copy( 0, nSep );
298 : 2253 : }
299 : : };
300 : :
301 : 2305 : SvXMLExport_Impl::SvXMLExport_Impl()
302 : : // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
303 : : : mbOutlineStyleAsNormalListStyle( false )
304 : : ,mbSaveBackwardCompatibleODF( sal_True )
305 : : ,mxComponentContext( ::comphelper::getProcessComponentContext() )
306 : : ,mStreamName()
307 : : ,mNamespaceMaps()
308 : : ,mDepth(0)
309 : : ,mpRDFaHelper() // lazy
310 : : ,mbExportTextNumberElement( sal_False )
311 [ + - ][ + - ]: 2305 : ,mbNullDateInitialized( sal_False )
[ + - ][ + - ]
312 : : {
313 : : OSL_ENSURE(mxComponentContext.is(), "SvXMLExport: no ComponentContext");
314 [ # # ][ - + ]: 2305 : if (!mxComponentContext.is()) throw uno::RuntimeException();
315 : : mxUriReferenceFactory = uri::UriReferenceFactory::create(
316 [ + - ][ + - ]: 2305 : mxComponentContext );
317 : 2305 : }
318 : :
319 : : //==============================================================================
320 : :
321 : 0 : void SvXMLExport::SetDocHandler( const uno::Reference< xml::sax::XDocumentHandler > &rHandler )
322 : : {
323 : 0 : mxHandler = rHandler;
324 [ # # ]: 0 : mxExtHandler = uno::Reference<xml::sax::XExtendedDocumentHandler>( mxHandler, UNO_QUERY );
325 : 0 : }
326 : :
327 : 2305 : void SvXMLExport::_InitCtor()
328 : : {
329 : : // note: it is not necessary to add XML_NP_XML (it is declared implicitly)
330 [ + + ]: 2305 : if( (getExportFlags() & ~EXPORT_OASIS) != 0 )
331 : : {
332 : 2259 : mpNamespaceMap->Add( GetXMLToken(XML_NP_OFFICE), GetXMLToken(XML_N_OFFICE), XML_NAMESPACE_OFFICE );
333 : 2259 : mpNamespaceMap->Add( GetXMLToken(XML_NP_OOO), GetXMLToken(XML_N_OOO), XML_NAMESPACE_OOO );
334 : : }
335 [ + + ]: 2305 : if( (getExportFlags() & (EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_FONTDECLS) ) != 0 )
336 : : {
337 : 282 : mpNamespaceMap->Add( GetXMLToken(XML_NP_FO), GetXMLToken(XML_N_FO_COMPAT), XML_NAMESPACE_FO );
338 : : }
339 [ + + ]: 2305 : if( (getExportFlags() & (EXPORT_META|EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS|EXPORT_SETTINGS) ) != 0 )
340 : : {
341 : 2259 : mpNamespaceMap->Add( GetXMLToken(XML_NP_XLINK), GetXMLToken(XML_N_XLINK), XML_NAMESPACE_XLINK );
342 : : }
343 [ + + ]: 2305 : if( (getExportFlags() & EXPORT_SETTINGS) != 0 )
344 : : {
345 : 1077 : mpNamespaceMap->Add( GetXMLToken(XML_NP_CONFIG), GetXMLToken(XML_N_CONFIG), XML_NAMESPACE_CONFIG );
346 : : }
347 : :
348 [ + + ]: 2305 : if( (getExportFlags() & (EXPORT_META|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
349 : : {
350 : 1183 : mpNamespaceMap->Add( GetXMLToken(XML_NP_DC), GetXMLToken(XML_N_DC), XML_NAMESPACE_DC );
351 : 1183 : mpNamespaceMap->Add( GetXMLToken(XML_NP_META), GetXMLToken(XML_N_META), XML_NAMESPACE_META );
352 : : }
353 [ + + ]: 2305 : if( (getExportFlags() & (EXPORT_STYLES|EXPORT_MASTERSTYLES|EXPORT_AUTOSTYLES|EXPORT_CONTENT|EXPORT_FONTDECLS) ) != 0 )
354 : : {
355 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_STYLE), GetXMLToken(XML_N_STYLE), XML_NAMESPACE_STYLE );
356 : : }
357 : :
358 : : // namespaces for documents
359 [ + + ]: 2305 : if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
360 : : {
361 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_DC), GetXMLToken(XML_N_DC), XML_NAMESPACE_DC );
362 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_TEXT), GetXMLToken(XML_N_TEXT), XML_NAMESPACE_TEXT );
363 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_DRAW), GetXMLToken(XML_N_DRAW), XML_NAMESPACE_DRAW );
364 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_DR3D), GetXMLToken(XML_N_DR3D), XML_NAMESPACE_DR3D );
365 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_SVG), GetXMLToken(XML_N_SVG_COMPAT), XML_NAMESPACE_SVG );
366 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_CHART), GetXMLToken(XML_N_CHART), XML_NAMESPACE_CHART );
367 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_RPT), GetXMLToken(XML_N_RPT), XML_NAMESPACE_REPORT );
368 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_TABLE), GetXMLToken(XML_N_TABLE), XML_NAMESPACE_TABLE );
369 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_NUMBER),GetXMLToken(XML_N_NUMBER), XML_NAMESPACE_NUMBER );
370 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_OOOW), GetXMLToken(XML_N_OOOW), XML_NAMESPACE_OOOW );
371 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_OOOC), GetXMLToken(XML_N_OOOC), XML_NAMESPACE_OOOC );
372 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_OF), GetXMLToken(XML_N_OF), XML_NAMESPACE_OF );
373 : :
374 [ + - ]: 1134 : if (getDefaultVersion() > SvtSaveOptions::ODFVER_012)
375 : : {
376 : : mpNamespaceMap->Add(
377 : 1134 : GetXMLToken(XML_NP_TABLE_EXT), GetXMLToken(XML_N_TABLE_EXT), XML_NAMESPACE_TABLE_EXT);
378 : : mpNamespaceMap->Add(
379 : 1134 : GetXMLToken(XML_NP_CALC_EXT), GetXMLToken(XML_N_CALC_EXT), XML_NAMESPACE_CALC_EXT);
380 : : mpNamespaceMap->Add(
381 : 1134 : GetXMLToken(XML_NP_DRAW_EXT), GetXMLToken(XML_N_DRAW_EXT), XML_NAMESPACE_DRAW_EXT);
382 : : }
383 : : }
384 [ + + ]: 2305 : if( (getExportFlags() & (EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
385 : : {
386 : 1125 : mpNamespaceMap->Add( GetXMLToken(XML_NP_MATH), GetXMLToken(XML_N_MATH), XML_NAMESPACE_MATH );
387 : 1125 : mpNamespaceMap->Add( GetXMLToken(XML_NP_FORM), GetXMLToken(XML_N_FORM), XML_NAMESPACE_FORM );
388 : : }
389 [ + + ]: 2305 : if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT|EXPORT_SCRIPTS) ) != 0 )
390 : : {
391 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_SCRIPT), GetXMLToken(XML_N_SCRIPT), XML_NAMESPACE_SCRIPT );
392 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_DOM), GetXMLToken(XML_N_DOM), XML_NAMESPACE_DOM );
393 : : }
394 [ + + ]: 2305 : if( (getExportFlags() & EXPORT_CONTENT ) != 0 )
395 : : {
396 : 1086 : mpNamespaceMap->Add( GetXMLToken(XML_NP_XFORMS_1_0), GetXMLToken(XML_N_XFORMS_1_0), XML_NAMESPACE_XFORMS );
397 : 1086 : mpNamespaceMap->Add( GetXMLToken(XML_NP_XSD), GetXMLToken(XML_N_XSD), XML_NAMESPACE_XSD );
398 : 1086 : mpNamespaceMap->Add( GetXMLToken(XML_NP_XSI), GetXMLToken(XML_N_XSI), XML_NAMESPACE_XSI );
399 : 1086 : mpNamespaceMap->Add( GetXMLToken(XML_NP_FIELD), GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
400 : 1086 : mpNamespaceMap->Add( GetXMLToken(XML_NP_FORMX), GetXMLToken(XML_N_FORMX), XML_NAMESPACE_FORMX );
401 : : }
402 : : // RDFa: needed for content and header/footer styles
403 [ + + ]: 2305 : if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
404 : : {
405 : 1134 : mpNamespaceMap->Add( GetXMLToken(XML_NP_XHTML),
406 : 2268 : GetXMLToken(XML_N_XHTML), XML_NAMESPACE_XHTML );
407 : : }
408 : : // GRDDL: to convert RDFa and meta.xml to RDF
409 [ + + ]: 2305 : if( (getExportFlags() & (EXPORT_META|EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
410 : : {
411 : 1192 : mpNamespaceMap->Add( GetXMLToken(XML_NP_GRDDL),
412 : 2384 : GetXMLToken(XML_N_GRDDL), XML_NAMESPACE_GRDDL );
413 : : }
414 : : // CSS Text Level 3 for distributed text justification.
415 [ + + ]: 2305 : if ( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES)) != 0 )
416 : : {
417 : : mpNamespaceMap->Add(
418 : 282 : GetXMLToken(XML_NP_CSS3TEXT), GetXMLToken(XML_N_CSS3TEXT), XML_NAMESPACE_CSS3TEXT );
419 : : }
420 : :
421 [ + - ]: 2305 : mxAttrList = (xml::sax::XAttributeList*)mpAttrList;
422 : :
423 : 2305 : msGraphicObjectProtocol = OUString( "vnd.sun.star.GraphicObject:" );
424 : 2305 : msEmbeddedObjectProtocol = OUString( "vnd.sun.star.EmbeddedObject:" );
425 : :
426 [ # # ][ - + ]: 2305 : if (mxModel.is() && !mxEventListener.is())
[ - + ]
427 : : {
428 [ # # ][ # # ]: 0 : mxEventListener.set( new SvXMLExportEventListener(this));
429 : 0 : mxModel->addEventListener(mxEventListener);
430 : : }
431 : :
432 : : // Determine model type (#i51726#)
433 : 2305 : _DetermineModelType();
434 : :
435 : 2305 : mbEnableExperimentalOdfExport = getenv("ENABLE_EXPERIMENTAL_ODF_EXPORT") != NULL;
436 : :
437 : : // cl: but only if we do export to current oasis format, old openoffice format *must* always be compatible
438 [ + + ]: 2305 : if( (getExportFlags() & EXPORT_OASIS) != 0 )
439 : : {
440 : : mpImpl->mbSaveBackwardCompatibleODF =
441 : : officecfg::Office::Common::Save::Document::
442 : : SaveBackwardCompatibleODF::get(
443 : 2177 : mpImpl->mxComponentContext);
444 : : }
445 : 2305 : }
446 : :
447 : : // Shapes in Writer cannot be named via context menu (#i51726#)
448 : 4583 : void SvXMLExport::_DetermineModelType()
449 : : {
450 : 4583 : meModelType = SvtModuleOptions::E_UNKNOWN_FACTORY;
451 : :
452 [ + + ]: 4583 : if ( mxModel.is() )
453 : : {
454 : 2278 : meModelType = SvtModuleOptions::ClassifyFactoryByModel( mxModel );
455 : : }
456 : 4583 : }
457 : :
458 : 2259 : SvXMLExport::SvXMLExport(
459 : : sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/,
460 : : const uno::Reference< lang::XMultiServiceFactory >& xServiceFactory,
461 : : const enum XMLTokenEnum eClass, sal_uInt16 nExportFlags )
462 [ + - ]: 2259 : : mpImpl( new SvXMLExport_Impl ),
463 : : mxServiceFactory(xServiceFactory),
464 [ + - ]: 2259 : mpAttrList( new SvXMLAttributeList ),
465 [ + - ]: 2259 : mpNamespaceMap( new SvXMLNamespaceMap ),
466 : : mpUnitConv( new SvXMLUnitConverter(getServiceFactory(),
467 [ + - ]: 2259 : util::MeasureUnit::MM_100TH, eDefaultMeasureUnit) ),
468 : : mpNumExport(0L),
469 : : mpProgressBarHelper( NULL ),
470 : : mpEventExport( NULL ),
471 : : mpImageMapExport( NULL ),
472 : : mpXMLErrors( NULL ),
473 : : mbExtended( sal_False ),
474 : : meClass( eClass ),
475 : : mnExportFlags( nExportFlags ),
476 : : mnErrorFlags( ERROR_NO ),
477 [ + - ]: 2259 : msWS( GetXMLToken(XML_WS) ),
478 [ + - ][ + - ]: 13554 : mbSaveLinkedSections(sal_True)
[ + - ][ + - ]
479 : : {
480 : : DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
481 [ + - ]: 2259 : _InitCtor();
482 : 2259 : }
483 : :
484 : 46 : SvXMLExport::SvXMLExport(
485 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
486 : : const OUString &rFileName,
487 : : sal_Int16 const eDefaultMeasureUnit /*css::util::MeasureUnit*/,
488 : : const uno::Reference< xml::sax::XDocumentHandler > & rHandler)
489 [ + - ]: 46 : : mpImpl( new SvXMLExport_Impl ),
490 : : mxServiceFactory(xServiceFactory),
491 : : mxHandler( rHandler ),
492 : : mxExtHandler( rHandler, uno::UNO_QUERY ),
493 [ + - ]: 46 : mpAttrList( new SvXMLAttributeList ),
494 : : msOrigFileName( rFileName ),
495 [ + - ]: 46 : mpNamespaceMap( new SvXMLNamespaceMap ),
496 : : mpUnitConv( new SvXMLUnitConverter(getServiceFactory(),
497 [ + - ]: 46 : util::MeasureUnit::MM_100TH, eDefaultMeasureUnit) ),
498 : : mpNumExport(0L),
499 : : mpProgressBarHelper( NULL ),
500 : : mpEventExport( NULL ),
501 : : mpImageMapExport( NULL ),
502 : : mpXMLErrors( NULL ),
503 : : mbExtended( sal_False ),
504 : : meClass( XML_TOKEN_INVALID ),
505 : : mnExportFlags( 0 ),
506 : : mnErrorFlags( ERROR_NO ),
507 [ + - ]: 46 : msWS( GetXMLToken(XML_WS) ),
508 [ + - ][ + - ]: 276 : mbSaveLinkedSections(sal_True)
[ + - ][ + - ]
[ + - ]
509 : : {
510 : 46 : mpImpl->SetSchemeOf( msOrigFileName );
511 : : DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
512 [ + - ]: 46 : _InitCtor();
513 : :
514 [ - + ]: 46 : if (mxNumberFormatsSupplier.is())
515 [ # # ][ # # ]: 0 : mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
516 : 46 : }
517 : :
518 : 0 : SvXMLExport::SvXMLExport(
519 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
520 : : const OUString &rFileName,
521 : : const uno::Reference< xml::sax::XDocumentHandler > & rHandler,
522 : : const Reference< XModel >& rModel,
523 : : sal_Int16 const eDefaultFieldUnit)
524 [ # # ]: 0 : : mpImpl( new SvXMLExport_Impl ),
525 : : mxServiceFactory(xServiceFactory),
526 : : mxModel( rModel ),
527 : : mxHandler( rHandler ),
528 : : mxExtHandler( rHandler, uno::UNO_QUERY ),
529 : : mxNumberFormatsSupplier (rModel, uno::UNO_QUERY),
530 [ # # ]: 0 : mpAttrList( new SvXMLAttributeList ),
531 : : msOrigFileName( rFileName ),
532 [ # # ]: 0 : mpNamespaceMap( new SvXMLNamespaceMap ),
533 : : mpUnitConv( new SvXMLUnitConverter(getServiceFactory(),
534 : : util::MeasureUnit::MM_100TH,
535 [ # # ][ # # ]: 0 : SvXMLUnitConverter::GetMeasureUnit(eDefaultFieldUnit)) ),
536 : : mpNumExport(0L),
537 : : mpProgressBarHelper( NULL ),
538 : : mpEventExport( NULL ),
539 : : mpImageMapExport( NULL ),
540 : : mpXMLErrors( NULL ),
541 : : mbExtended( sal_False ),
542 : : meClass( XML_TOKEN_INVALID ),
543 : : mnExportFlags( 0 ),
544 : : mnErrorFlags( ERROR_NO ),
545 [ # # ]: 0 : msWS( GetXMLToken(XML_WS) ),
546 [ # # ][ # # ]: 0 : mbSaveLinkedSections(sal_True)
[ # # ][ # # ]
[ # # ][ # # ]
547 : : {
548 : 0 : mpImpl->SetSchemeOf( msOrigFileName );
549 : : DBG_ASSERT( mxServiceFactory.is(), "got no service manager" );
550 [ # # ]: 0 : _InitCtor();
551 : :
552 [ # # ]: 0 : if (mxNumberFormatsSupplier.is())
553 [ # # ][ # # ]: 0 : mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
554 : 0 : }
555 : :
556 [ + - ][ + - ]: 2305 : SvXMLExport::~SvXMLExport()
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
557 : : {
558 [ + + ][ + - ]: 2305 : delete mpXMLErrors;
559 [ - + ][ # # ]: 2305 : delete mpImageMapExport;
560 [ + + ][ + - ]: 2305 : delete mpEventExport;
561 [ + - ][ + - ]: 2305 : delete mpNamespaceMap;
562 [ + - ][ + - ]: 2305 : delete mpUnitConv;
563 [ + + ][ + + ]: 2305 : if (mpProgressBarHelper || mpNumExport)
564 : : {
565 [ + + ]: 537 : if (mxExportInfo.is())
566 : : {
567 [ + - ][ + - ]: 503 : uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxExportInfo->getPropertySetInfo();
568 [ + - ]: 503 : if (xPropertySetInfo.is())
569 : : {
570 [ + + ]: 503 : if (mpProgressBarHelper)
571 : : {
572 : 116 : OUString sProgressMax(XML_PROGRESSMAX);
573 : 116 : OUString sProgressCurrent(XML_PROGRESSCURRENT);
574 : 116 : OUString sRepeat(XML_PROGRESSREPEAT);
575 [ + - ][ + - ]: 232 : if (xPropertySetInfo->hasPropertyByName(sProgressMax) &&
[ + - ][ + - ]
[ + - ]
576 [ + - ][ + - ]: 116 : xPropertySetInfo->hasPropertyByName(sProgressCurrent))
577 : : {
578 : 116 : sal_Int32 nProgressMax(mpProgressBarHelper->GetReference());
579 : 116 : sal_Int32 nProgressCurrent(mpProgressBarHelper->GetValue());
580 : 116 : uno::Any aAny;
581 [ + - ]: 116 : aAny <<= nProgressMax;
582 [ + - ][ + - ]: 116 : mxExportInfo->setPropertyValue(sProgressMax, aAny);
583 [ + - ]: 116 : aAny <<= nProgressCurrent;
584 [ + - ][ + - ]: 116 : mxExportInfo->setPropertyValue(sProgressCurrent, aAny);
585 : : }
586 [ + - ][ + - ]: 116 : if (xPropertySetInfo->hasPropertyByName(sRepeat))
[ - + ]
587 [ # # ][ # # ]: 116 : mxExportInfo->setPropertyValue(sRepeat, cppu::bool2any(mpProgressBarHelper->GetRepeat()));
[ # # ]
588 : : }
589 [ + + ][ + + ]: 503 : if (mpNumExport && (mnExportFlags & (EXPORT_AUTOSTYLES | EXPORT_STYLES)))
590 : : {
591 : 242 : OUString sWrittenNumberFormats(XML_WRITTENNUMBERSTYLES);
592 [ + - ][ + + ]: 242 : if (xPropertySetInfo->hasPropertyByName(sWrittenNumberFormats))
[ + - ]
593 : : {
594 [ + - ]: 50 : uno::Sequence<sal_Int32> aWasUsed;
595 [ + - ]: 50 : mpNumExport->GetWasUsed(aWasUsed);
596 : 50 : uno::Any aAny;
597 [ + - ]: 50 : aAny <<= aWasUsed;
598 [ + - ][ + - ]: 50 : mxExportInfo->setPropertyValue(sWrittenNumberFormats, aAny);
[ + - ]
599 : 242 : }
600 : : }
601 : 503 : }
602 : : }
603 [ + + ][ + - ]: 537 : delete mpProgressBarHelper;
604 [ + + ][ + - ]: 537 : delete mpNumExport;
605 : : }
606 : :
607 [ + - ]: 2305 : xmloff::token::ResetTokens();
608 : :
609 [ + + ][ + - ]: 2305 : if (mxEventListener.is() && mxModel.is())
[ + + ]
610 [ + - ][ + - ]: 2207 : mxModel->removeEventListener(mxEventListener);
611 : :
612 [ + - ][ + - ]: 2305 : delete mpImpl;
613 [ - + ]: 2305 : }
614 : :
615 : : ///////////////////////////////////////////////////////////////////////
616 : :
617 : : // XExporter
618 : 2284 : void SAL_CALL SvXMLExport::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc )
619 : : throw(lang::IllegalArgumentException, uno::RuntimeException)
620 : : {
621 [ + - ][ + - ]: 2284 : mxModel = uno::Reference< frame::XModel >::query( xDoc );
622 [ + + ]: 2284 : if( !mxModel.is() )
623 [ + - ]: 6 : throw lang::IllegalArgumentException();
624 [ + - ][ + + ]: 2278 : if (mxModel.is() && ! mxEventListener.is())
[ + + ]
625 : : {
626 [ + - ][ + - ]: 2253 : mxEventListener.set( new SvXMLExportEventListener(this));
[ + - ]
627 [ + - ][ + - ]: 2253 : mxModel->addEventListener(mxEventListener);
628 : : }
629 : :
630 [ + + ]: 2278 : if(!mxNumberFormatsSupplier.is() )
631 : : {
632 [ + - ][ + - ]: 1921 : mxNumberFormatsSupplier = mxNumberFormatsSupplier.query( mxModel );
633 [ + - ][ + + ]: 1921 : if(mxNumberFormatsSupplier.is() && mxHandler.is())
[ + + ]
634 [ + - ][ + - ]: 141 : mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
635 : : }
636 [ + + ]: 2278 : if (mxExportInfo.is())
637 : : {
638 [ + - ][ + - ]: 2207 : uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxExportInfo->getPropertySetInfo();
639 [ + - ]: 2207 : if (xPropertySetInfo.is())
640 : : {
641 : 2207 : OUString sUsePrettyPrinting(XML_USEPRETTYPRINTING);
642 [ + - ][ + - ]: 2207 : if (xPropertySetInfo->hasPropertyByName(sUsePrettyPrinting))
[ + - ]
643 : : {
644 [ + - ][ + - ]: 2207 : uno::Any aAny = mxExportInfo->getPropertyValue(sUsePrettyPrinting);
645 [ + - ][ - + ]: 2207 : if (::cppu::any2bool(aAny))
646 : 0 : mnExportFlags |= EXPORT_PRETTY;
647 : : else
648 : 2207 : mnExportFlags &= ~EXPORT_PRETTY;
649 : : }
650 : :
651 [ + + ][ + + ]: 2207 : if (mpNumExport && (mnExportFlags & (EXPORT_AUTOSTYLES | EXPORT_STYLES)))
652 : : {
653 : 242 : OUString sWrittenNumberFormats(XML_WRITTENNUMBERSTYLES);
654 [ + - ][ + + ]: 242 : if (xPropertySetInfo->hasPropertyByName(sWrittenNumberFormats))
[ + - ]
655 : : {
656 [ + - ][ + - ]: 50 : uno::Any aAny = mxExportInfo->getPropertyValue(sWrittenNumberFormats);
657 [ + - ]: 50 : uno::Sequence<sal_Int32> aWasUsed;
658 [ + - ][ + + ]: 50 : if(aAny >>= aWasUsed)
659 [ + - ][ + - ]: 50 : mpNumExport->SetWasUsed(aWasUsed);
660 : 242 : }
661 : 2207 : }
662 : 2207 : }
663 : : }
664 : :
665 [ + + ]: 2278 : if ( mpImpl->mbSaveBackwardCompatibleODF )
666 : 105 : mnExportFlags |= EXPORT_SAVEBACKWARDCOMPATIBLE;
667 : : else
668 : 2173 : mnExportFlags &= ~EXPORT_SAVEBACKWARDCOMPATIBLE;
669 : :
670 : : // namespaces for user defined attributes
671 [ + - ]: 2278 : Reference< XMultiServiceFactory > xFactory( mxModel, UNO_QUERY );
672 [ + + ]: 2278 : if( xFactory.is() )
673 : : {
674 : : try
675 : : {
676 : : Reference < XInterface > xIfc =
677 [ + - ][ + + ]: 208 : xFactory->createInstance(OUString( "com.sun.star.xml.NamespaceMap") );
678 [ + + ]: 110 : if( xIfc.is() )
679 : : {
680 [ + - ]: 85 : Reference< XNameAccess > xNamespaceMap( xIfc, UNO_QUERY );
681 [ + - ]: 85 : if( xNamespaceMap.is() )
682 : : {
683 [ + - ][ + - ]: 85 : Sequence< OUString > aPrefixes( xNamespaceMap->getElementNames() );
684 : :
685 [ + - ]: 85 : OUString* pPrefix = aPrefixes.getArray();
686 : 85 : const sal_Int32 nCount = aPrefixes.getLength();
687 : : sal_Int32 nIndex;
688 : 85 : OUString aURL;
689 : :
690 [ - + ]: 85 : for( nIndex = 0; nIndex < nCount; ++nIndex, ++pPrefix )
691 : : {
692 [ # # ][ # # ]: 0 : if( xNamespaceMap->getByName( *pPrefix ) >>= aURL )
[ # # ]
693 [ # # ]: 0 : _GetNamespaceMap().Add( *pPrefix, aURL, XML_NAMESPACE_UNKNOWN );
694 [ + - ]: 85 : }
695 : 85 : }
696 [ - + ]: 208 : }
697 : : }
698 [ + - ]: 98 : catch(const com::sun::star::uno::Exception&)
699 : : {
700 : : }
701 : : }
702 : :
703 : : // Determine model type (#i51726#)
704 [ + - ]: 2284 : _DetermineModelType();
705 : 2278 : }
706 : :
707 : : // XInitialize
708 : 2282 : void SAL_CALL SvXMLExport::initialize( const uno::Sequence< uno::Any >& aArguments )
709 : : throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
710 : : {
711 : : // #93186# we need to queryInterface every single Any with any expected outcome. This variable hold the queryInterface results.
712 : :
713 : 2282 : const sal_Int32 nAnyCount = aArguments.getLength();
714 : 2282 : const uno::Any* pAny = aArguments.getConstArray();
715 : :
716 [ + + ]: 6961 : for( sal_Int32 nIndex = 0; nIndex < nAnyCount; nIndex++, pAny++ )
717 : : {
718 : 4679 : Reference<XInterface> xValue;
719 [ + - ]: 4679 : *pAny >>= xValue;
720 : :
721 : : // status indicator
722 [ + - ]: 4679 : uno::Reference<task::XStatusIndicator> xTmpStatus( xValue, UNO_QUERY );
723 [ - + ]: 4679 : if ( xTmpStatus.is() )
724 [ # # ]: 0 : mxStatusIndicator = xTmpStatus;
725 : :
726 : : // graphic resolver
727 : : uno::Reference<document::XGraphicObjectResolver> xTmpGraphic(
728 [ + - ]: 4679 : xValue, UNO_QUERY );
729 [ + + ]: 4679 : if ( xTmpGraphic.is() )
730 [ + - ]: 109 : mxGraphicResolver = xTmpGraphic;
731 : :
732 : : // object resolver
733 : : uno::Reference<document::XEmbeddedObjectResolver> xTmpObjectResolver(
734 [ + - ]: 4679 : xValue, UNO_QUERY );
735 [ + + ]: 4679 : if ( xTmpObjectResolver.is() )
736 [ + - ]: 82 : mxEmbeddedResolver = xTmpObjectResolver;
737 : :
738 : : // document handler
739 : : uno::Reference<xml::sax::XDocumentHandler> xTmpDocHandler(
740 [ + - ]: 4679 : xValue, UNO_QUERY );
741 [ + + ]: 4679 : if( xTmpDocHandler.is() )
742 : : {
743 [ + - ]: 2259 : mxHandler = xTmpDocHandler;
744 [ + - ]: 2259 : *pAny >>= mxExtHandler;
745 : :
746 [ - + ][ # # ]: 2259 : if (mxNumberFormatsSupplier.is() && mpNumExport == NULL)
[ - + ]
747 [ # # ][ # # ]: 0 : mpNumExport = new SvXMLNumFmtExport(*this, mxNumberFormatsSupplier);
748 : : }
749 : :
750 : : // property set to transport data across
751 : : uno::Reference<beans::XPropertySet> xTmpPropertySet(
752 [ + - ]: 4679 : xValue, UNO_QUERY );
753 [ + + ]: 4679 : if( xTmpPropertySet.is() )
754 [ + - ]: 2213 : mxExportInfo = xTmpPropertySet;
755 : 4679 : }
756 : :
757 [ + + ]: 2282 : if( mxExportInfo.is() )
758 : : {
759 : : uno::Reference< beans::XPropertySetInfo > xPropertySetInfo =
760 [ + - ][ + - ]: 2213 : mxExportInfo->getPropertySetInfo();
761 : : OUString sPropName(
762 : 2213 : "BaseURI" );
763 [ + - ][ + + ]: 2213 : if( xPropertySetInfo->hasPropertyByName(sPropName) )
[ + - ]
764 : : {
765 [ + - ][ + - ]: 2207 : uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
766 : 2207 : aAny >>= msOrigFileName;
767 : 2207 : mpImpl->msPackageURI = msOrigFileName;
768 : 2207 : mpImpl->SetSchemeOf( msOrigFileName );
769 : : }
770 : 2213 : OUString sRelPath;
771 : 2213 : sPropName = OUString( "StreamRelPath" );
772 [ + - ][ + + ]: 2213 : if( xPropertySetInfo->hasPropertyByName(sPropName) )
[ + - ]
773 : : {
774 [ + - ][ + - ]: 1859 : uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
775 : 1859 : aAny >>= sRelPath;
776 : : }
777 : 2213 : OUString sName;
778 : 2213 : sPropName = OUString( "StreamName" );
779 [ + - ][ + - ]: 2213 : if( xPropertySetInfo->hasPropertyByName(sPropName) )
[ + - ]
780 : : {
781 [ + - ][ + - ]: 2213 : uno::Any aAny = mxExportInfo->getPropertyValue(sPropName);
782 : 2213 : aAny >>= sName;
783 : : }
784 [ + + ][ + - ]: 2213 : if( !msOrigFileName.isEmpty() && !sName.isEmpty() )
[ + + ]
785 : : {
786 [ + - ]: 472 : INetURLObject aBaseURL( msOrigFileName );
787 [ - + ]: 472 : if( !sRelPath.isEmpty() )
788 [ # # ]: 0 : aBaseURL.insertName( sRelPath );
789 [ + - ]: 472 : aBaseURL.insertName( sName );
790 [ + - ][ + - ]: 472 : msOrigFileName = aBaseURL.GetMainURL(INetURLObject::DECODE_TO_IURI);
791 : : }
792 : 2213 : mpImpl->mStreamName = sName; // Note: may be empty (XSLT)
793 : :
794 : : // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
795 : : const ::rtl::OUString sOutlineStyleAsNormalListStyle(
796 : 2213 : "OutlineStyleAsNormalListStyle" );
797 [ + - ][ + + ]: 2213 : if( xPropertySetInfo->hasPropertyByName( sOutlineStyleAsNormalListStyle ) )
[ + - ]
798 : : {
799 [ + - ][ + - ]: 80 : uno::Any aAny = mxExportInfo->getPropertyValue( sOutlineStyleAsNormalListStyle );
800 : 80 : aAny >>= (mpImpl->mbOutlineStyleAsNormalListStyle);
801 : : }
802 : :
803 : 2213 : OUString sTargetStorage( "TargetStorage" );
804 [ + - ][ + + ]: 2213 : if( xPropertySetInfo->hasPropertyByName( sTargetStorage ) )
[ + - ]
805 [ + - ][ + - ]: 128 : mxExportInfo->getPropertyValue( sTargetStorage ) >>= mpImpl->mxTargetStorage;
[ + - ]
806 : :
807 : : const ::rtl::OUString sExportTextNumberElement(
808 : 2213 : "ExportTextNumberElement" );
809 [ + - ][ - + ]: 2213 : if( xPropertySetInfo->hasPropertyByName( sExportTextNumberElement ) )
[ + - ]
810 : : {
811 [ # # ][ # # ]: 0 : uno::Any aAny = mxExportInfo->getPropertyValue( sExportTextNumberElement );
812 : 0 : aAny >>= (mpImpl->mbExportTextNumberElement);
813 : 2213 : }
814 : : }
815 : :
816 : 2282 : }
817 : :
818 : : // XFilter
819 : 2217 : sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue >& aDescriptor ) throw(uno::RuntimeException)
820 : : {
821 : : RTL_LOGFILE_CONTEXT_AUTHOR( aLogContext, "xmloff", LOGFILE_AUTHOR,
822 : : "SvXMLExport::filter" );
823 : :
824 : : // check for xHandler first... should have been supplied in initialize
825 [ - + ]: 2217 : if( !mxHandler.is() )
826 : 0 : return sal_False;
827 : :
828 : : try
829 : : {
830 : : const sal_uInt32 nTest =
831 : 2217 : EXPORT_META|EXPORT_STYLES|EXPORT_CONTENT|EXPORT_SETTINGS;
832 [ + + ][ + - ]: 2217 : if( (mnExportFlags & nTest) == nTest && msOrigFileName.isEmpty() )
[ + + ]
833 : : {
834 : : // evaluate descriptor only for flat files and if a base URI
835 : : // has not been provided already
836 : 4 : const sal_Int32 nPropCount = aDescriptor.getLength();
837 : 4 : const beans::PropertyValue* pProps = aDescriptor.getConstArray();
838 : :
839 [ + + ]: 8 : for( sal_Int32 nIndex = 0; nIndex < nPropCount; nIndex++, pProps++ )
840 : : {
841 : 4 : const OUString& rPropName = pProps->Name;
842 : 4 : const Any& rValue = pProps->Value;
843 : :
844 [ - + ]: 4 : if ( rPropName == "FileName" )
845 : : {
846 [ # # ]: 0 : if( !(rValue >>= msOrigFileName ) )
847 : 0 : return sal_False;
848 : : }
849 [ + - ]: 4 : else if ( rPropName == "FilterName" )
850 : : {
851 [ - + ]: 4 : if( !(rValue >>= msFilterName ) )
852 : 0 : return sal_False;
853 : : }
854 : : }
855 : : }
856 : :
857 : : #ifdef TIMELOG
858 : : if (GetModel().is())
859 : : {
860 : : // print a trace message with the URL
861 : : rtl::OString aUrl(rtl::OUStringToOString(GetModel()->getURL(),
862 : : RTL_TEXTENCODING_ASCII_US));
863 : : RTL_LOGFILE_CONTEXT_TRACE1( aLogContext, "%s", aUrl.getStr() );
864 : :
865 : : // we also want a trace message with the document class
866 : : rtl::OString aClass(rtl::OUStringToOString(GetXMLToken(meClass),
867 : : RTL_TEXTENCODING_ASCII_US));
868 : : RTL_LOGFILE_CONTEXT_TRACE1( aLogContext, "class=\"%s\"",
869 : : aClass.getStr() );
870 : : }
871 : : #endif
872 : :
873 [ + - ]: 2217 : exportDoc( meClass );
874 : : }
875 [ # # ]: 0 : catch(const uno::Exception& e)
876 : : {
877 : : // We must catch exceptions, because according to the
878 : : // API definition export must not throw one!
879 [ # # ]: 0 : Sequence<OUString> aSeq(0);
880 : : SetError( XMLERROR_FLAG_ERROR | XMLERROR_FLAG_SEVERE | XMLERROR_API,
881 [ # # # # : 0 : aSeq, e.Message, NULL );
# # ]
882 : : }
883 : :
884 : : // return true only if no error occurred
885 : 2217 : return (GetErrorFlags() & (ERROR_DO_NOTHING|ERROR_ERROR_OCCURRED)) == 0;
886 : : }
887 : :
888 : 2 : void SAL_CALL SvXMLExport::cancel() throw(uno::RuntimeException)
889 : : {
890 : : // stop export
891 [ + - ]: 2 : Sequence<OUString> aEmptySeq;
892 [ + - ][ + - ]: 2 : SetError(XMLERROR_CANCEL|XMLERROR_FLAG_SEVERE, aEmptySeq);
893 : 2 : }
894 : :
895 : 23 : ::rtl::OUString SAL_CALL SvXMLExport::getName( )
896 : : throw (::com::sun::star::uno::RuntimeException)
897 : : {
898 : 23 : return msFilterName;
899 : : }
900 : :
901 : 0 : void SAL_CALL SvXMLExport::setName( const ::rtl::OUString& )
902 : : throw (::com::sun::star::uno::RuntimeException)
903 : : {
904 : : // do nothing, because it is not possible to set the FilterName
905 : 0 : }
906 : :
907 : :
908 : : // XServiceInfo
909 : 0 : OUString SAL_CALL SvXMLExport::getImplementationName( ) throw(uno::RuntimeException)
910 : : {
911 : 0 : OUString aStr;
912 : 0 : return aStr;
913 : : }
914 : :
915 : 0 : sal_Bool SAL_CALL SvXMLExport::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException)
916 : : {
917 : : return
918 : : rServiceName.equalsAsciiL(
919 : : "com.sun.star.document.ExportFilter",
920 : 0 : sizeof("com.sun.star.document.ExportFilter")-1 ) ||
921 : : rServiceName.equalsAsciiL(
922 : : "com.sun.star.xml.XMLExportFilter",
923 [ # # ][ # # ]: 0 : sizeof("com.sun.star.xml.XMLExportFilter")-1);
924 : : }
925 : :
926 : 0 : uno::Sequence< OUString > SAL_CALL SvXMLExport::getSupportedServiceNames( )
927 : : throw(uno::RuntimeException)
928 : : {
929 : 0 : uno::Sequence<OUString> aSeq(2);
930 [ # # ]: 0 : aSeq[0] = OUString( "com.sun.star.document.ExportFilter");
931 [ # # ]: 0 : aSeq[1] = OUString( "com.sun.star.xml.XMLExportFilter");
932 : 0 : return aSeq;
933 : : }
934 : :
935 : : ///////////////////////////////////////////////////////////////////////
936 : :
937 : : ::rtl::OUString
938 : 50 : SvXMLExport::EnsureNamespace(::rtl::OUString const & i_rNamespace,
939 : : ::rtl::OUString const & i_rPreferredPrefix)
940 : : {
941 : 50 : ::rtl::OUString sPrefix;
942 [ + - ]: 50 : sal_uInt16 nKey( _GetNamespaceMap().GetKeyByName( i_rNamespace ) );
943 [ + + ]: 50 : if( XML_NAMESPACE_UNKNOWN == nKey )
944 : : {
945 : : // There is no prefix for the namespace, so
946 : : // we have to generate one and have to add it.
947 : 34 : sPrefix = i_rPreferredPrefix;
948 [ + - ]: 34 : nKey = _GetNamespaceMap().GetKeyByPrefix( sPrefix );
949 : 34 : sal_Int32 n( 0 );
950 : 34 : ::rtl::OUStringBuffer buf;
951 [ - + ]: 34 : while( nKey != USHRT_MAX )
952 : : {
953 [ # # ]: 0 : buf.append( i_rPreferredPrefix );
954 [ # # ]: 0 : buf.append( ++n );
955 [ # # ]: 0 : sPrefix = buf.makeStringAndClear();
956 [ # # ]: 0 : nKey = _GetNamespaceMap().GetKeyByPrefix( sPrefix );
957 : : }
958 : :
959 [ + - ][ - + ]: 34 : if (mpImpl->mNamespaceMaps.empty()
[ # # ][ + - ]
960 [ # # ]: 0 : || (mpImpl->mNamespaceMaps.top().second != mpImpl->mDepth))
961 : : {
962 : : // top was created for lower depth... need a new namespace map!
963 : : mpImpl->mNamespaceMaps.push(
964 [ + - ][ + - ]: 34 : ::std::make_pair(mpNamespaceMap, mpImpl->mDepth) );
965 [ + - ][ + - ]: 34 : mpNamespaceMap = new SvXMLNamespaceMap( *mpNamespaceMap );
966 : : }
967 : :
968 : : // add the namespace to the map and as attribute
969 [ + - ]: 34 : mpNamespaceMap->Add( sPrefix, i_rNamespace );
970 [ + - ][ + - ]: 34 : buf.append( GetXMLToken(XML_XMLNS) );
971 [ + - ]: 34 : buf.append( sal_Unicode(':') );
972 [ + - ]: 34 : buf.append( sPrefix );
973 [ + - ][ + - ]: 34 : AddAttribute( buf.makeStringAndClear(), i_rNamespace );
974 : : }
975 : : else
976 : : {
977 : : // If there is a prefix for the namespace, reuse that.
978 [ + - ]: 16 : sPrefix = _GetNamespaceMap().GetPrefixByKey( nKey );
979 : : }
980 : 50 : return sPrefix;
981 : : }
982 : :
983 : : ///////////////////////////////////////////////////////////////////////
984 : :
985 : 0 : void SvXMLExport::AddAttributeASCII( sal_uInt16 nPrefixKey,
986 : : const sal_Char *pName,
987 : : const sal_Char *pValue )
988 : : {
989 : 0 : OUString sName( OUString::createFromAscii( pName ) );
990 : 0 : OUString sValue( OUString::createFromAscii( pValue ) );
991 : :
992 : : mpAttrList->AddAttribute(
993 [ # # ][ # # ]: 0 : _GetNamespaceMap().GetQNameByKey( nPrefixKey, sName ), sValue );
994 : 0 : }
995 : :
996 : 0 : void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey, const sal_Char *pName,
997 : : const OUString& rValue )
998 : : {
999 : 0 : OUString sName( OUString::createFromAscii( pName ) );
1000 : :
1001 : : mpAttrList->AddAttribute(
1002 [ # # ][ # # ]: 0 : _GetNamespaceMap().GetQNameByKey( nPrefixKey, sName ), rValue );
1003 : 0 : }
1004 : :
1005 : 257 : void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey, const OUString& rName,
1006 : : const OUString& rValue )
1007 : : {
1008 : : mpAttrList->AddAttribute(
1009 [ + - ]: 257 : _GetNamespaceMap().GetQNameByKey( nPrefixKey, rName ), rValue );
1010 : 257 : }
1011 : :
1012 : 75130 : void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey,
1013 : : enum XMLTokenEnum eName,
1014 : : const OUString& rValue )
1015 : : {
1016 : : mpAttrList->AddAttribute(
1017 : 75130 : _GetNamespaceMap().GetQNameByKey( nPrefixKey, GetXMLToken(eName) ),
1018 [ + - ]: 75130 : rValue );
1019 : 75130 : }
1020 : :
1021 : 59250 : void SvXMLExport::AddAttribute( sal_uInt16 nPrefixKey,
1022 : : enum XMLTokenEnum eName,
1023 : : enum XMLTokenEnum eValue)
1024 : : {
1025 : : mpAttrList->AddAttribute(
1026 : 59250 : _GetNamespaceMap().GetQNameByKey( nPrefixKey, GetXMLToken(eName) ),
1027 [ + - ]: 118500 : GetXMLToken(eValue) );
1028 : 59250 : }
1029 : :
1030 : 361 : void SvXMLExport::AddAttribute( const ::rtl::OUString& rQName,
1031 : : const ::rtl::OUString& rValue )
1032 : : {
1033 : : mpAttrList->AddAttribute(
1034 : : rQName,
1035 : 361 : rValue );
1036 : 361 : }
1037 : :
1038 : 0 : void SvXMLExport::AddAttribute( const ::rtl::OUString& rQName,
1039 : : enum ::xmloff::token::XMLTokenEnum eValue )
1040 : : {
1041 : : mpAttrList->AddAttribute(
1042 : : rQName,
1043 : 0 : GetXMLToken(eValue) );
1044 : 0 : }
1045 : :
1046 : 0 : void SvXMLExport::AddAttributeList( const uno::Reference< xml::sax::XAttributeList >& xAttrList )
1047 : : {
1048 [ # # ]: 0 : if( xAttrList.is())
1049 : 0 : mpAttrList->AppendAttributeList( xAttrList );
1050 : 0 : }
1051 : :
1052 : 91792 : void SvXMLExport::ClearAttrList()
1053 : : {
1054 : 91792 : mpAttrList->Clear();
1055 : 91792 : }
1056 : :
1057 : : #ifdef DBG_UTIL
1058 : : void SvXMLExport::CheckAttrList()
1059 : : {
1060 : : DBG_ASSERT( !mpAttrList->getLength(),
1061 : : "XMLExport::CheckAttrList: list is not empty" );
1062 : : }
1063 : : #endif
1064 : :
1065 : 44 : void SvXMLExport::ImplExportMeta()
1066 : : {
1067 : 44 : CheckAttrList();
1068 : :
1069 : 44 : _ExportMeta();
1070 : 44 : }
1071 : :
1072 : 1061 : void SvXMLExport::ImplExportSettings()
1073 : : {
1074 : 1061 : CheckAttrList();
1075 : :
1076 [ + - ]: 1061 : ::std::list< SettingsGroup > aSettings;
1077 : 1061 : sal_Int32 nSettingsCount = 0;
1078 : :
1079 : : // view settings
1080 [ + - ]: 1061 : uno::Sequence< beans::PropertyValue > aViewSettings;
1081 [ + - ]: 1061 : GetViewSettingsAndViews( aViewSettings );
1082 [ + - ][ + - ]: 1061 : aSettings.push_back( SettingsGroup( XML_VIEW_SETTINGS, aViewSettings ) );
[ + - ]
1083 : 1061 : nSettingsCount += aViewSettings.getLength();
1084 : :
1085 : : // configuration settings
1086 [ + - ]: 1061 : uno::Sequence<beans::PropertyValue> aConfigSettings;
1087 [ + - ]: 1061 : GetConfigurationSettings( aConfigSettings );
1088 [ + - ][ + - ]: 1061 : aSettings.push_back( SettingsGroup( XML_CONFIGURATION_SETTINGS, aConfigSettings ) );
[ + - ]
1089 : 1061 : nSettingsCount += aConfigSettings.getLength();
1090 : :
1091 : : // any document specific settings
1092 [ + - ]: 1061 : nSettingsCount += GetDocumentSpecificSettings( aSettings );
1093 : :
1094 : : {
1095 : : SvXMLElementExport aElem( *this,
1096 : : nSettingsCount != 0,
1097 : : XML_NAMESPACE_OFFICE, XML_SETTINGS,
1098 [ + - ]: 1061 : sal_True, sal_True );
1099 : :
1100 [ + - ]: 1061 : SettingsExportFacade aSettingsExportContext( *this );
1101 [ + - ]: 1061 : XMLSettingsExportHelper aSettingsExportHelper( aSettingsExportContext );
1102 : :
1103 [ + - ][ + - ]: 6366 : for ( ::std::list< SettingsGroup >::const_iterator settings = aSettings.begin();
[ + - ][ + + ]
1104 [ + - ]: 3183 : settings != aSettings.end();
1105 : : ++settings
1106 : : )
1107 : : {
1108 [ + - ][ + + ]: 2122 : if ( !settings->aSettings.getLength() )
1109 : 348 : continue;
1110 : :
1111 [ + - ][ + - ]: 1774 : OUString sSettingsName( GetXMLToken( settings->eGroupName ) );
1112 [ + - ]: 1774 : OUString sQName = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_OOO, sSettingsName );
1113 [ + - ][ + - ]: 1774 : aSettingsExportHelper.exportAllSettings( settings->aSettings, sQName );
1114 [ + - ][ + - ]: 2835 : }
1115 [ + - ][ + - ]: 1061 : }
1116 : 1061 : }
1117 : :
1118 : 46 : void SvXMLExport::ImplExportStyles( sal_Bool )
1119 : : {
1120 : 46 : CheckAttrList();
1121 : :
1122 : : {
1123 : : // <style:styles>
1124 : : SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_STYLES,
1125 [ + - ]: 46 : sal_True, sal_True );
1126 : :
1127 [ + - ][ + - ]: 46 : _ExportStyles( sal_False );
1128 : : }
1129 : :
1130 : : // transfer style names (+ families) TO other components (if appropriate)
1131 [ + + ][ + - ]: 46 : if( ( ( mnExportFlags & EXPORT_CONTENT ) == 0 ) && mxExportInfo.is() )
[ + + ]
1132 : : {
1133 [ + + ][ + - ]: 42 : static OUString sStyleNames( "StyleNames" );
1134 [ + + ][ + - ]: 42 : static OUString sStyleFamilies( "StyleFamilies" );
1135 [ + - ][ + - ]: 42 : uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxExportInfo->getPropertySetInfo();
1136 [ + - ][ + - ]: 42 : if ( xPropertySetInfo->hasPropertyByName( sStyleNames ) && xPropertySetInfo->hasPropertyByName( sStyleFamilies ) )
[ + + ][ + - ]
[ + - ][ + - ]
[ + + ]
1137 : : {
1138 [ + - ]: 33 : Sequence<sal_Int32> aStyleFamilies;
1139 [ + - ]: 33 : Sequence<OUString> aStyleNames;
1140 [ + - ][ + - ]: 33 : mxAutoStylePool->GetRegisteredNames( aStyleFamilies, aStyleNames );
1141 [ + - ][ + - ]: 33 : mxExportInfo->setPropertyValue( sStyleNames, makeAny( aStyleNames ) );
[ + - ]
1142 [ + - ]: 33 : mxExportInfo->setPropertyValue( sStyleFamilies,
1143 [ + - ][ + - ]: 33 : makeAny( aStyleFamilies ) );
[ + - ][ + - ]
1144 : 42 : }
1145 : : }
1146 : 46 : }
1147 : :
1148 : 253 : void SvXMLExport::ImplExportAutoStyles( sal_Bool )
1149 : : {
1150 : : // transfer style names (+ families) FROM other components (if appropriate)
1151 : 253 : OUString sStyleNames( "StyleNames" );
1152 : 253 : OUString sStyleFamilies( "StyleFamilies" );
1153 [ + + ][ + - ]: 971 : if( ( ( mnExportFlags & EXPORT_STYLES ) == 0 )
[ + + ]
[ + + + - ]
1154 : 216 : && mxExportInfo.is()
1155 [ + - ][ + - ]: 469 : && mxExportInfo->getPropertySetInfo()->hasPropertyByName( sStyleNames )
[ + - ][ + - ]
[ + + ][ # # ]
1156 [ + - ][ + - ]: 286 : && mxExportInfo->getPropertySetInfo()->hasPropertyByName( sStyleFamilies ) )
[ + - ][ + - ]
[ + + ][ # # ]
1157 : : {
1158 [ + - ]: 33 : Sequence<sal_Int32> aStyleFamilies;
1159 [ + - ][ + - ]: 33 : mxExportInfo->getPropertyValue( sStyleFamilies ) >>= aStyleFamilies;
[ + - ]
1160 [ + - ]: 33 : Sequence<OUString> aStyleNames;
1161 [ + - ][ + - ]: 33 : mxExportInfo->getPropertyValue( sStyleNames ) >>= aStyleNames;
[ + - ]
1162 [ + - ][ + - ]: 33 : mxAutoStylePool->RegisterNames( aStyleFamilies, aStyleNames );
[ + - ][ + - ]
1163 : : }
1164 : :
1165 : : {
1166 : : // <style:automatic-styles>
1167 : : SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE,
1168 [ + - ]: 253 : XML_AUTOMATIC_STYLES, sal_True, sal_True );
1169 : :
1170 [ + - ][ + - ]: 253 : _ExportAutoStyles();
1171 : 253 : }
1172 : 253 : }
1173 : :
1174 : 37 : void SvXMLExport::ImplExportMasterStyles( sal_Bool )
1175 : : {
1176 : : {
1177 : : // <style:master-styles>
1178 : : SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_MASTER_STYLES,
1179 [ + - ]: 37 : sal_True, sal_True );
1180 : :
1181 [ + - ][ + - ]: 37 : _ExportMasterStyles();
1182 : : }
1183 : :
1184 : 37 : }
1185 : :
1186 : 220 : void SvXMLExport::ImplExportContent()
1187 : : {
1188 : 220 : CheckAttrList();
1189 : :
1190 : 220 : CheckAttrList();
1191 : :
1192 : : {
1193 : : SvXMLElementExport aElemrnt( *this, XML_NAMESPACE_OFFICE, XML_BODY,
1194 [ + - ]: 220 : sal_True, sal_True );
1195 : : {
1196 : 220 : XMLTokenEnum eClass = meClass;
1197 [ - + ]: 220 : if( XML_TEXT_GLOBAL == eClass )
1198 : : {
1199 : : AddAttribute( XML_NAMESPACE_TEXT, XML_GLOBAL,
1200 [ # # ][ # # ]: 0 : GetXMLToken( XML_TRUE ) );
1201 : 0 : eClass = XML_TEXT;
1202 : : }
1203 [ + + ]: 220 : if ( XML_GRAPHICS == eClass )
1204 : 8 : eClass = XML_DRAWING;
1205 : : // <office:body ...>
1206 [ + - ]: 220 : SetBodyAttributes();
1207 : : SvXMLElementExport aElem( *this, meClass != XML_TOKEN_INVALID,
1208 : : XML_NAMESPACE_OFFICE, eClass,
1209 [ + - ]: 220 : sal_True, sal_True );
1210 : :
1211 [ + - ][ + - ]: 220 : _ExportContent();
1212 [ + - ]: 220 : }
1213 : : }
1214 : 220 : }
1215 : :
1216 : 195 : void SvXMLExport::SetBodyAttributes()
1217 : : {
1218 : 195 : }
1219 : :
1220 : : static void
1221 : 1359 : lcl_AddGrddl(SvXMLExport & rExport, const sal_Int32 /*nExportMode*/)
1222 : : {
1223 : : // check version >= 1.2
1224 [ - + ]: 1359 : switch (rExport.getDefaultVersion()) {
1225 : : case SvtSaveOptions::ODFVER_011: // fall thru
1226 : 1359 : case SvtSaveOptions::ODFVER_010: return;
1227 : 1359 : default: break;
1228 : : }
1229 : :
1230 : : // #i115030#: disabled
1231 : : #if 0
1232 : : if (EXPORT_SETTINGS != nExportMode) // meta, content, styles
1233 : : {
1234 : : rExport.AddAttribute( XML_NAMESPACE_GRDDL, XML_TRANSFORMATION,
1235 : : OUString(s_grddl_xsl) );
1236 : : }
1237 : : #endif
1238 : : }
1239 : :
1240 : 2263 : void SvXMLExport::addChaffWhenEncryptedStorage()
1241 : : {
1242 [ + - ]: 2263 : uno::Reference< embed::XEncryptionProtectedSource2 > xEncr(mpImpl->mxTargetStorage, uno::UNO_QUERY);
1243 : :
1244 [ + + ][ + - ]: 2263 : if (xEncr.is() && xEncr->hasEncryptionData() && mxExtHandler.is())
[ + - ][ - + ]
[ # # ][ - + ]
1245 : : {
1246 [ # # ][ # # ]: 0 : mxExtHandler->comment(rtl::OStringToOUString(comphelper::xml::makeXMLChaff(), RTL_TEXTENCODING_ASCII_US));
[ # # ][ # # ]
1247 : 2263 : }
1248 : 2263 : }
1249 : :
1250 : 1359 : sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass )
1251 : : {
1252 : 1359 : bool bOwnGraphicResolver = false;
1253 : 1359 : bool bOwnEmbeddedResolver = false;
1254 : :
1255 [ + + ][ + + ]: 1359 : if( !mxGraphicResolver.is() || !mxEmbeddedResolver.is() )
[ + + ]
1256 : : {
1257 [ + - ]: 1237 : Reference< XMultiServiceFactory > xFactory( mxModel, UNO_QUERY );
1258 [ + + ]: 1237 : if( xFactory.is() )
1259 : : {
1260 : : try
1261 : : {
1262 [ + + ]: 37 : if( !mxGraphicResolver.is() )
1263 : : {
1264 : : mxGraphicResolver = Reference< XGraphicObjectResolver >::query(
1265 [ + - ]: 10 : xFactory->createInstance(
1266 [ + - ][ + - ]: 10 : OUString( "com.sun.star.document.ExportGraphicObjectResolver")));
[ + - ]
1267 : 10 : bOwnGraphicResolver = mxGraphicResolver.is();
1268 : : }
1269 : :
1270 [ + - ]: 37 : if( !mxEmbeddedResolver.is() )
1271 : : {
1272 : : mxEmbeddedResolver = Reference< XEmbeddedObjectResolver >::query(
1273 [ + - ]: 37 : xFactory->createInstance(
1274 [ + - ][ + - ]: 37 : OUString( "com.sun.star.document.ExportEmbeddedObjectResolver")));
[ + - ][ # # ]
1275 : 37 : bOwnEmbeddedResolver = mxEmbeddedResolver.is();
1276 : : }
1277 : : }
1278 [ # # ]: 0 : catch(const com::sun::star::uno::Exception&)
1279 : : {
1280 : : }
1281 : 1237 : }
1282 : : }
1283 [ + + ]: 1359 : if( (getExportFlags() & EXPORT_OASIS) == 0 )
1284 : : {
1285 [ + - ]: 44 : Reference< lang::XMultiServiceFactory > xFactory = getServiceFactory();
1286 [ + - ]: 44 : if( xFactory.is() )
1287 : : {
1288 : : try
1289 : : {
1290 : : ::comphelper::PropertyMapEntry aInfoMap[] =
1291 : : {
1292 : : { "Class", sizeof("Class")-1, 0,
1293 [ + - ]: 44 : &::getCppuType((::rtl::OUString*)0),
1294 : : PropertyAttribute::MAYBEVOID, 0},
1295 : : { NULL, 0, 0, NULL, 0, 0 }
1296 : 88 : };
1297 : : Reference< XPropertySet > xConvPropSet(
1298 : : ::comphelper::GenericPropertySet_CreateInstance(
1299 [ + - ]: 44 : new ::comphelper::PropertySetInfo( aInfoMap ) ) );
1300 : :
1301 : 44 : Any aAny;
1302 [ + - ][ + - ]: 44 : aAny <<= GetXMLToken( eClass );
1303 [ + - ]: 44 : xConvPropSet->setPropertyValue(
1304 [ + - ]: 44 : OUString("Class"), aAny );
1305 : :
1306 : : Reference< XPropertySet > xPropSet =
1307 : 44 : mxExportInfo.is()
1308 : : ? PropertySetMerger_CreateInstance( mxExportInfo,
1309 : : xConvPropSet )
1310 [ + + ][ + + ]: 44 : : xConvPropSet;
[ + + ]
1311 : :
1312 [ + - ]: 44 : Sequence<Any> aArgs( 3 );
1313 [ + - ][ + - ]: 44 : aArgs[0] <<= mxHandler;
1314 [ + - ][ + - ]: 44 : aArgs[1] <<= xPropSet;
1315 [ + - ][ + - ]: 44 : aArgs[2] <<= mxModel;
1316 : :
1317 : : // get filter component
1318 : : Reference< xml::sax::XDocumentHandler > xTmpDocHandler(
1319 [ + - ]: 44 : xFactory->createInstanceWithArguments(
1320 : : OUString("com.sun.star.comp.Oasis2OOoTransformer"),
1321 [ + - ][ + - ]: 44 : aArgs), UNO_QUERY);
1322 : : OSL_ENSURE( xTmpDocHandler.is(),
1323 : : "can't instantiate OASIS transformer component" );
1324 [ + - ]: 44 : if( xTmpDocHandler.is() )
1325 : : {
1326 [ + - ]: 44 : mxHandler = xTmpDocHandler;
1327 [ + - ][ + - ]: 44 : mxExtHandler = uno::Reference<xml::sax::XExtendedDocumentHandler>( mxHandler, UNO_QUERY );
1328 [ + - ][ # # ]: 44 : }
1329 : : }
1330 [ # # ]: 0 : catch(const com::sun::star::uno::Exception&)
1331 : : {
1332 : : }
1333 : 44 : }
1334 : : }
1335 : :
1336 : 1359 : mxHandler->startDocument();
1337 : :
1338 : 1359 : addChaffWhenEncryptedStorage();
1339 : :
1340 : : // <office:document ...>
1341 : 1359 : CheckAttrList();
1342 : :
1343 : : // namespace attributes
1344 : : // ( The namespace decls should be first attributes in the element;
1345 : : // some faulty XML parsers (JAXP1.1) have a problem with this,
1346 : : // also it's more elegant )
1347 : 1359 : sal_uInt16 nPos = mpNamespaceMap->GetFirstKey();
1348 [ + + ]: 15331 : while( USHRT_MAX != nPos )
1349 : : {
1350 : : mpAttrList->AddAttribute( mpNamespaceMap->GetAttrNameByKey( nPos ),
1351 [ + - ]: 13972 : mpNamespaceMap->GetNameByKey( nPos ) );
1352 : 13972 : nPos = mpNamespaceMap->GetNextKey( nPos );
1353 : : }
1354 : :
1355 : :
1356 : :
1357 : : // office:version = ...
1358 [ + - ]: 1359 : if( !mbExtended )
1359 : : {
1360 : 1359 : const sal_Char* pVersion = 0;
1361 [ + - - - : 1359 : switch( getDefaultVersion() )
- - ]
1362 : : {
1363 : 1359 : case SvtSaveOptions::ODFVER_LATEST: pVersion = sXML_1_2; break;
1364 : 0 : case SvtSaveOptions::ODFVER_012_EXT_COMPAT: pVersion = sXML_1_2; break;
1365 : 0 : case SvtSaveOptions::ODFVER_012: pVersion = sXML_1_2; break;
1366 : 0 : case SvtSaveOptions::ODFVER_011: pVersion = sXML_1_1; break;
1367 : 0 : case SvtSaveOptions::ODFVER_010: break;
1368 : :
1369 : : default:
1370 : : OSL_FAIL("xmloff::SvXMLExport::exportDoc(), unexpected odf default version!");
1371 : : }
1372 : :
1373 [ + - ]: 1359 : if( pVersion )
1374 : : AddAttribute( XML_NAMESPACE_OFFICE, XML_VERSION,
1375 [ + - ]: 1359 : OUString::createFromAscii(pVersion) );
1376 : : }
1377 : :
1378 : : {
1379 : 1359 : enum XMLTokenEnum eRootService = XML_TOKEN_INVALID;
1380 : 1359 : const sal_Int32 nExportMode = mnExportFlags & (EXPORT_META|EXPORT_STYLES|EXPORT_CONTENT|EXPORT_SETTINGS);
1381 : :
1382 [ + - ]: 1359 : lcl_AddGrddl(*this, nExportMode);
1383 : :
1384 [ + + ]: 1359 : if( EXPORT_META == nExportMode )
1385 : : {
1386 : : // export only meta
1387 : 40 : eRootService = XML_DOCUMENT_META;
1388 : : }
1389 [ + + ]: 1319 : else if ( EXPORT_SETTINGS == nExportMode )
1390 : : {
1391 : : // export only settings
1392 : 1057 : eRootService = XML_DOCUMENT_SETTINGS;
1393 : : }
1394 [ + + ]: 262 : else if( EXPORT_STYLES == nExportMode )
1395 : : {
1396 : : // export only styles
1397 : 42 : eRootService = XML_DOCUMENT_STYLES;
1398 : : }
1399 [ + + ]: 220 : else if( EXPORT_CONTENT == nExportMode )
1400 : : {
1401 : : // export only content
1402 : 216 : eRootService = XML_DOCUMENT_CONTENT;
1403 : : }
1404 : : else
1405 : : {
1406 : : // the god'ol one4all element
1407 : 4 : eRootService = XML_DOCUMENT;
1408 : : // office:mimetype = ... (only for stream containing the content)
1409 [ + - ]: 4 : if( eClass != XML_TOKEN_INVALID )
1410 : : {
1411 : 4 : OUString aTmp( "application/vnd.oasis.opendocument." );
1412 [ + - ]: 4 : aTmp += GetXMLToken( eClass );
1413 [ + - ]: 4 : AddAttribute( XML_NAMESPACE_OFFICE, XML_MIMETYPE, aTmp );
1414 : : }
1415 : : }
1416 : :
1417 [ + - ]: 1359 : SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, eRootService, sal_True, sal_True );
1418 : :
1419 : : // meta information
1420 [ + + ]: 1359 : if( mnExportFlags & EXPORT_META )
1421 [ + - ]: 44 : ImplExportMeta();
1422 : :
1423 : : // settings
1424 [ + + ]: 1359 : if( mnExportFlags & EXPORT_SETTINGS )
1425 [ + - ]: 1061 : ImplExportSettings();
1426 : :
1427 : : // scripts
1428 [ + + ]: 1359 : if( mnExportFlags & EXPORT_SCRIPTS )
1429 [ + - ]: 211 : _ExportScripts();
1430 : :
1431 : : // font declerations
1432 [ + + ]: 1359 : if( mnExportFlags & EXPORT_FONTDECLS )
1433 [ + - ]: 245 : _ExportFontDecls();
1434 : :
1435 : : // styles
1436 [ + + ]: 1359 : if( mnExportFlags & EXPORT_STYLES )
1437 [ + - ]: 46 : ImplExportStyles( sal_False );
1438 : :
1439 : : // autostyles
1440 [ + + ]: 1359 : if( mnExportFlags & EXPORT_AUTOSTYLES )
1441 [ + - ]: 253 : ImplExportAutoStyles( sal_False );
1442 : :
1443 : : // masterstyles
1444 [ + + ]: 1359 : if( mnExportFlags & EXPORT_MASTERSTYLES )
1445 [ + - ]: 37 : ImplExportMasterStyles( sal_False );
1446 : :
1447 : : // contnt
1448 [ + + ]: 1359 : if( mnExportFlags & EXPORT_CONTENT )
1449 [ + - ][ + - ]: 1359 : ImplExportContent();
1450 : : }
1451 : :
1452 : :
1453 : 1359 : mxHandler->endDocument();
1454 : :
1455 [ + + ]: 1359 : if( bOwnGraphicResolver )
1456 : : {
1457 [ + - ]: 10 : Reference< XComponent > xComp( mxGraphicResolver, UNO_QUERY );
1458 [ + - ][ + - ]: 10 : xComp->dispose();
1459 : : }
1460 : :
1461 [ + + ]: 1359 : if( bOwnEmbeddedResolver )
1462 : : {
1463 [ + - ]: 10 : Reference< XComponent > xComp( mxEmbeddedResolver, UNO_QUERY );
1464 [ + - ][ + - ]: 10 : xComp->dispose();
1465 : : }
1466 : :
1467 : 1359 : return 0;
1468 : : }
1469 : :
1470 : 852 : void SvXMLExport::ResetNamespaceMap()
1471 : : {
1472 [ + - ][ + - ]: 852 : delete mpNamespaceMap; mpNamespaceMap = new SvXMLNamespaceMap;
1473 : 852 : }
1474 : :
1475 : 44 : void SvXMLExport::_ExportMeta()
1476 : : {
1477 [ + - ]: 44 : OUString generator( ::utl::DocInfoHelper::GetGeneratorString() );
1478 : : Reference< XDocumentPropertiesSupplier > xDocPropsSupplier(mxModel,
1479 [ + - ]: 44 : UNO_QUERY);
1480 [ + - ]: 44 : if (xDocPropsSupplier.is()) {
1481 : : Reference<XDocumentProperties> xDocProps(
1482 [ + - ][ + - ]: 44 : xDocPropsSupplier->getDocumentProperties());
1483 [ - + ]: 44 : if (!xDocProps.is()) throw;
1484 : : // update generator here
1485 [ + - ][ + - ]: 44 : xDocProps->setGenerator(generator);
1486 [ + - ]: 44 : SvXMLMetaExport * pMeta = new SvXMLMetaExport(*this, xDocProps);
1487 [ + - ][ + - ]: 44 : uno::Reference<xml::sax::XDocumentHandler> xMeta(pMeta);
1488 [ + - ]: 44 : pMeta->Export();
1489 : : } else {
1490 : : // office:meta
1491 : : SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_META,
1492 [ # # ]: 0 : sal_True, sal_True );
1493 : : {
1494 : : // BM: #i60323# export generator even if xInfoProp is empty (which is the
1495 : : // case for charts). The generator does not depend on xInfoProp
1496 : : SvXMLElementExport anElem( *this, XML_NAMESPACE_META, XML_GENERATOR,
1497 [ # # ]: 0 : sal_True, sal_True );
1498 [ # # ][ # # ]: 0 : Characters(generator);
1499 [ # # ]: 0 : }
1500 : 44 : }
1501 : 44 : }
1502 : :
1503 : 211 : void SvXMLExport::_ExportScripts()
1504 : : {
1505 [ + - ]: 211 : SvXMLElementExport aElement( *this, XML_NAMESPACE_OFFICE, XML_SCRIPTS, sal_True, sal_True );
1506 : :
1507 : : // export Basic macros (only for FlatXML)
1508 [ + + ]: 211 : if ( mnExportFlags & EXPORT_EMBEDDED )
1509 : : {
1510 [ + - ]: 4 : ::rtl::OUString aValue( GetNamespaceMap().GetPrefixByKey( XML_NAMESPACE_OOO ) );
1511 : 4 : aValue += ::rtl::OUString( ":Basic" );
1512 [ + - ]: 4 : AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, aValue );
1513 : :
1514 [ + - ]: 4 : SvXMLElementExport aElem( *this, XML_NAMESPACE_OFFICE, XML_SCRIPT, sal_True, sal_True );
1515 : :
1516 : : // initialize Basic
1517 [ + - ]: 4 : if ( mxModel.is() )
1518 : : {
1519 [ + - ]: 4 : Reference< beans::XPropertySet > xPSet( mxModel, UNO_QUERY );
1520 [ + - ]: 4 : if ( xPSet.is() )
1521 [ + - ][ + - ]: 4 : xPSet->getPropertyValue( ::rtl::OUString( "BasicLibraries" ) );
1522 : : }
1523 : :
1524 : 4 : Reference< document::XExporter > xExporter;
1525 [ + - ]: 4 : Reference< lang::XMultiServiceFactory > xMSF( getServiceFactory() );
1526 [ + - ]: 4 : if ( xMSF.is() )
1527 : : {
1528 [ + - ][ + - ]: 4 : Reference < XDocumentHandler > xHdl( new XMLBasicExportFilter( mxHandler ) );
[ + - ]
1529 [ + - ]: 4 : Sequence < Any > aArgs( 1 );
1530 [ + - ][ + - ]: 4 : aArgs[0] <<= xHdl;
1531 [ + - ]: 4 : xExporter.set( xMSF->createInstanceWithArguments(
1532 : 4 : OUString( "com.sun.star.document.XMLOasisBasicExporter" ), aArgs ),
1533 [ + - ][ + - ]: 4 : UNO_QUERY );
[ + - ]
1534 : : }
1535 : :
1536 : : OSL_ENSURE( xExporter.is(),
1537 : : "SvXMLExport::_ExportScripts: can't instantiate export filter component for Basic macros" );
1538 : :
1539 [ + - ]: 4 : if ( xExporter.is() )
1540 : : {
1541 [ + - ]: 4 : Reference< XComponent > xComp( mxModel, UNO_QUERY );
1542 [ + - ][ + - ]: 4 : xExporter->setSourceDocument( xComp );
1543 [ + - ]: 4 : Reference< XFilter > xFilter( xExporter, UNO_QUERY );
1544 [ + - ]: 4 : if ( xFilter.is() )
1545 : : {
1546 [ + - ]: 4 : Sequence < PropertyValue > aMediaDesc( 0 );
1547 [ + - ][ + - ]: 4 : xFilter->filter( aMediaDesc );
[ + - ]
1548 : 4 : }
1549 [ + - ]: 4 : }
1550 : : }
1551 : :
1552 : : // export document events
1553 [ + - ]: 211 : Reference< document::XEventsSupplier > xEvents( GetModel(), UNO_QUERY );
1554 [ + - ][ + - ]: 211 : GetEventExport().Export( xEvents, sal_True );
[ + - ]
1555 : 211 : }
1556 : :
1557 : 245 : void SvXMLExport::_ExportFontDecls()
1558 : : {
1559 [ + + ]: 245 : if( mxFontAutoStylePool.is() )
1560 : 226 : mxFontAutoStylePool->exportXML();
1561 : 245 : }
1562 : :
1563 : 46 : void SvXMLExport::_ExportStyles( sal_Bool )
1564 : : {
1565 [ + - ]: 46 : uno::Reference< lang::XMultiServiceFactory > xFact( GetModel(), uno::UNO_QUERY );
1566 [ + - ]: 46 : if( xFact.is())
1567 : : {
1568 : : // export (fill-)gradient-styles
1569 : : try
1570 : : {
1571 [ + - ][ + - ]: 46 : uno::Reference< container::XNameAccess > xGradient( xFact->createInstance( OUString("com.sun.star.drawing.GradientTable" ) ), uno::UNO_QUERY );
[ + - ]
1572 [ + - ]: 46 : if( xGradient.is() )
1573 : : {
1574 [ + - ]: 46 : XMLGradientStyleExport aGradientStyle( *this );
1575 : :
1576 [ + - ][ + - ]: 46 : if( xGradient->hasElements() )
[ - + ]
1577 : : {
1578 [ # # ][ # # ]: 0 : uno::Sequence< OUString > aNamesSeq ( xGradient->getElementNames() );
1579 : 0 : sal_Int32 nCount = aNamesSeq.getLength();
1580 [ # # ]: 0 : for( sal_Int32 i=0; i<nCount; i++ )
1581 : : {
1582 [ # # ]: 0 : const OUString& rStrName = aNamesSeq[ i ];
1583 : :
1584 : : try
1585 : : {
1586 [ # # ][ # # ]: 0 : uno::Any aValue = xGradient->getByName( rStrName );
1587 : :
1588 [ # # ][ # # ]: 0 : aGradientStyle.exportXML( rStrName, aValue );
1589 : : }
1590 [ # # ]: 0 : catch(const container::NoSuchElementException&)
1591 : : {
1592 : : }
1593 [ # # ]: 0 : }
1594 [ + - ]: 46 : }
1595 [ # # ]: 46 : }
1596 : : }
1597 [ # # ]: 0 : catch(const lang::ServiceNotRegisteredException&)
1598 : : {
1599 : : }
1600 : :
1601 : : // export (fill-)hatch-styles
1602 : : try
1603 : : {
1604 [ + - ][ + - ]: 46 : uno::Reference< container::XNameAccess > xHatch( xFact->createInstance( OUString("com.sun.star.drawing.HatchTable" ) ), uno::UNO_QUERY );
[ + - ]
1605 [ + - ]: 46 : if( xHatch.is() )
1606 : : {
1607 [ + - ]: 46 : XMLHatchStyleExport aHatchStyle( *this );
1608 : :
1609 [ + - ][ + - ]: 46 : if( xHatch->hasElements() )
[ - + ]
1610 : : {
1611 [ # # ][ # # ]: 0 : uno::Sequence< OUString > aNamesSeq ( xHatch->getElementNames() );
1612 : 0 : sal_Int32 nCount = aNamesSeq.getLength();
1613 [ # # ]: 0 : for( sal_Int32 i=0; i<nCount; i++ )
1614 : : {
1615 [ # # ]: 0 : const OUString& rStrName = aNamesSeq[ i ];
1616 : :
1617 : : try
1618 : : {
1619 [ # # ][ # # ]: 0 : uno::Any aValue = xHatch->getByName( rStrName );
1620 : :
1621 [ # # ][ # # ]: 0 : aHatchStyle.exportXML( rStrName, aValue );
1622 : : }
1623 [ # # ]: 0 : catch(const container::NoSuchElementException&)
1624 : : {}
1625 [ # # ]: 0 : }
1626 [ + - ]: 46 : }
1627 [ # # ]: 46 : }
1628 : : }
1629 [ # # ]: 0 : catch(const lang::ServiceNotRegisteredException&)
1630 : : {
1631 : : }
1632 : :
1633 : : // export (fill-)bitmap-styles
1634 : : try
1635 : : {
1636 [ + - ][ + - ]: 46 : uno::Reference< container::XNameAccess > xBitmap( xFact->createInstance( OUString("com.sun.star.drawing.BitmapTable" ) ), uno::UNO_QUERY );
[ + - ]
1637 [ + - ]: 46 : if( xBitmap.is() )
1638 : : {
1639 [ + - ]: 46 : XMLImageStyle aImageStyle;
1640 : :
1641 [ + - ][ + - ]: 46 : if( xBitmap->hasElements() )
[ - + ]
1642 : : {
1643 [ # # ][ # # ]: 0 : uno::Sequence< OUString > aNamesSeq ( xBitmap->getElementNames() );
1644 : 0 : sal_Int32 nCount = aNamesSeq.getLength();
1645 [ # # ]: 0 : for( sal_Int32 i=0; i<nCount; i++ )
1646 : : {
1647 [ # # ]: 0 : const OUString& rStrName = aNamesSeq[ i ];
1648 : :
1649 : : try
1650 : : {
1651 [ # # ][ # # ]: 0 : uno::Any aValue = xBitmap->getByName( rStrName );
1652 : :
1653 [ # # ][ # # ]: 0 : aImageStyle.exportXML( rStrName, aValue, *this );
1654 : : }
1655 [ # # ]: 0 : catch(const container::NoSuchElementException&)
1656 : : {
1657 : : }
1658 [ # # ]: 0 : }
1659 [ + - ]: 46 : }
1660 [ # # ]: 46 : }
1661 : : }
1662 [ # # ]: 0 : catch(const lang::ServiceNotRegisteredException&)
1663 : : {
1664 : : }
1665 : :
1666 : : // export transparency-gradient -styles
1667 : : try
1668 : : {
1669 [ + - ][ + - ]: 46 : uno::Reference< container::XNameAccess > xTransGradient( xFact->createInstance( OUString("com.sun.star.drawing.TransparencyGradientTable" ) ), uno::UNO_QUERY );
[ + - ]
1670 [ + - ]: 46 : if( xTransGradient.is() )
1671 : : {
1672 [ + - ]: 46 : XMLTransGradientStyleExport aTransGradientstyle( *this );
1673 : :
1674 [ + - ][ + - ]: 46 : if( xTransGradient->hasElements() )
[ - + ]
1675 : : {
1676 [ # # ][ # # ]: 0 : uno::Sequence< OUString > aNamesSeq ( xTransGradient->getElementNames() );
1677 : 0 : sal_Int32 nCount = aNamesSeq.getLength();
1678 [ # # ]: 0 : for( sal_Int32 i=0; i<nCount; i++ )
1679 : : {
1680 [ # # ]: 0 : const OUString& rStrName = aNamesSeq[ i ];
1681 : :
1682 : : try
1683 : : {
1684 [ # # ][ # # ]: 0 : uno::Any aValue = xTransGradient->getByName( rStrName );
1685 : :
1686 [ # # ][ # # ]: 0 : aTransGradientstyle.exportXML( rStrName, aValue );
1687 : : }
1688 [ # # ]: 0 : catch(const container::NoSuchElementException&)
1689 : : {
1690 : : }
1691 [ # # ]: 0 : }
1692 [ + - ]: 46 : }
1693 [ # # ]: 46 : }
1694 : : }
1695 [ # # ]: 0 : catch(const lang::ServiceNotRegisteredException&)
1696 : : {
1697 : : }
1698 : :
1699 : : // export marker-styles
1700 : : try
1701 : : {
1702 [ + - ][ + - ]: 46 : uno::Reference< container::XNameAccess > xMarker( xFact->createInstance( OUString("com.sun.star.drawing.MarkerTable" ) ), uno::UNO_QUERY );
[ + - ]
1703 [ + - ]: 46 : if( xMarker.is() )
1704 : : {
1705 [ + - ]: 46 : XMLMarkerStyleExport aMarkerStyle( *this );
1706 : :
1707 [ + - ][ + - ]: 46 : if( xMarker->hasElements() )
[ + + ]
1708 : : {
1709 [ + - ][ + - ]: 12 : uno::Sequence< OUString > aNamesSeq ( xMarker->getElementNames() );
1710 : 12 : sal_Int32 nCount = aNamesSeq.getLength();
1711 [ + + ]: 24 : for( sal_Int32 i=0; i<nCount; i++ )
1712 : : {
1713 [ + - ]: 12 : const OUString& rStrName = aNamesSeq[ i ];
1714 : :
1715 : : try
1716 : : {
1717 [ + - ][ + - ]: 12 : uno::Any aValue = xMarker->getByName( rStrName );
1718 : :
1719 [ + - ][ # # ]: 12 : aMarkerStyle.exportXML( rStrName, aValue );
1720 : : }
1721 [ # # ]: 0 : catch(const container::NoSuchElementException&)
1722 : : {
1723 : : }
1724 [ + - ]: 12 : }
1725 [ + - ]: 46 : }
1726 [ # # ]: 46 : }
1727 : : }
1728 [ # # ]: 0 : catch(const lang::ServiceNotRegisteredException&)
1729 : : {
1730 : : }
1731 : :
1732 : : // export dash-styles
1733 : : try
1734 : : {
1735 [ + - ][ + - ]: 46 : uno::Reference< container::XNameAccess > xDashes( xFact->createInstance( OUString("com.sun.star.drawing.DashTable" ) ), uno::UNO_QUERY );
[ + - ]
1736 [ + - ]: 46 : if( xDashes.is() )
1737 : : {
1738 [ + - ]: 46 : XMLDashStyleExport aDashStyle( *this );
1739 : :
1740 [ + - ][ + - ]: 46 : if( xDashes->hasElements() )
[ - + ]
1741 : : {
1742 [ # # ][ # # ]: 0 : uno::Sequence< OUString > aNamesSeq ( xDashes->getElementNames() );
1743 : 0 : sal_Int32 nCount = aNamesSeq.getLength();
1744 [ # # ]: 0 : for( sal_Int32 i=0; i<nCount; i++ )
1745 : : {
1746 [ # # ]: 0 : const OUString& rStrName = aNamesSeq[ i ];
1747 : :
1748 : : try
1749 : : {
1750 [ # # ][ # # ]: 0 : uno::Any aValue = xDashes->getByName( rStrName );
1751 : :
1752 [ # # ][ # # ]: 0 : aDashStyle.exportXML( rStrName, aValue );
1753 : : }
1754 [ # # ]: 0 : catch(const container::NoSuchElementException&)
1755 : : {
1756 : : }
1757 [ # # ]: 0 : }
1758 [ + - ]: 46 : }
1759 [ # # ]: 46 : }
1760 : : }
1761 [ # # ]: 0 : catch(const lang::ServiceNotRegisteredException&)
1762 : : {
1763 : : }
1764 : 46 : }
1765 : 46 : }
1766 : :
1767 : 35 : XMLTextParagraphExport* SvXMLExport::CreateTextParagraphExport()
1768 : : {
1769 [ + - ][ + - ]: 35 : return new XMLTextParagraphExport( *this, *(GetAutoStylePool().get()) );
1770 : : }
1771 : :
1772 : 57 : XMLShapeExport* SvXMLExport::CreateShapeExport()
1773 : : {
1774 [ + - ]: 57 : return new XMLShapeExport(*this);
1775 : : }
1776 : :
1777 : 57 : SvXMLAutoStylePoolP* SvXMLExport::CreateAutoStylePool()
1778 : : {
1779 [ + - ]: 57 : return new SvXMLAutoStylePoolP(*this);
1780 : : }
1781 : :
1782 : 0 : XMLPageExport* SvXMLExport::CreatePageExport()
1783 : : {
1784 [ # # ]: 0 : return new XMLPageExport( *this );
1785 : : }
1786 : :
1787 : 0 : SchXMLExportHelper* SvXMLExport::CreateChartExport()
1788 : : {
1789 [ # # ][ # # ]: 0 : return new SchXMLExportHelper(*this,*GetAutoStylePool().get());
1790 : : }
1791 : :
1792 : 184 : XMLFontAutoStylePool* SvXMLExport::CreateFontAutoStylePool()
1793 : : {
1794 [ + - ]: 184 : return new XMLFontAutoStylePool( *this );
1795 : : }
1796 : :
1797 : 43 : xmloff::OFormLayerXMLExport* SvXMLExport::CreateFormExport()
1798 : : {
1799 [ + - ]: 43 : return new xmloff::OFormLayerXMLExport(*this);
1800 : : }
1801 : :
1802 : 1061 : void SvXMLExport::GetViewSettingsAndViews(uno::Sequence<beans::PropertyValue>& rProps)
1803 : : {
1804 [ + - ]: 1061 : GetViewSettings(rProps);
1805 [ + - ]: 1061 : uno::Reference<document::XViewDataSupplier> xViewDataSupplier(GetModel(), uno::UNO_QUERY);
1806 [ + + ]: 1061 : if(xViewDataSupplier.is())
1807 : : {
1808 : 887 : uno::Reference<container::XIndexAccess> xIndexAccess;
1809 [ + - ][ + - ]: 887 : xViewDataSupplier->setViewData( xIndexAccess ); // make sure we get a newly created sequence
1810 [ + - ][ + - ]: 887 : xIndexAccess = xViewDataSupplier->getViewData();
[ + - ]
1811 : 887 : sal_Bool bAdd = sal_False;
1812 : 887 : uno::Any aAny;
1813 [ + - ][ + - ]: 887 : if(xIndexAccess.is() && xIndexAccess->hasElements() )
[ + - ][ + + ]
[ + + ]
1814 : : {
1815 [ + - ][ + - ]: 27 : sal_Int32 nCount = xIndexAccess->getCount();
1816 [ + - ]: 54 : for (sal_Int32 i = 0; i < nCount; i++)
1817 : : {
1818 [ + - ][ + - ]: 27 : aAny = xIndexAccess->getByIndex(i);
1819 [ + - ]: 27 : uno::Sequence<beans::PropertyValue> aProps;
1820 [ + - ][ + - ]: 27 : if( aAny >>= aProps )
1821 : : {
1822 [ + - ]: 27 : if( aProps.getLength() > 0 )
1823 : : {
1824 : 27 : bAdd = sal_True;
1825 : : break;
1826 : : }
1827 : : }
1828 [ + - ][ - + ]: 27 : }
1829 : : }
1830 : :
1831 [ + + ]: 887 : if( bAdd )
1832 : : {
1833 : 27 : sal_Int32 nOldLength(rProps.getLength());
1834 [ + - ]: 27 : rProps.realloc(nOldLength + 1);
1835 : 27 : beans::PropertyValue aProp;
1836 : 27 : aProp.Name = OUString("Views");
1837 [ + - ]: 27 : aProp.Value <<= xIndexAccess;
1838 [ + - ]: 27 : rProps[nOldLength] = aProp;
1839 : 887 : }
1840 : 1061 : }
1841 : 1061 : }
1842 : :
1843 : 0 : void SvXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>&)
1844 : : {
1845 : 0 : }
1846 : :
1847 : 0 : void SvXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>&)
1848 : : {
1849 : 0 : }
1850 : :
1851 : 1061 : sal_Int32 SvXMLExport::GetDocumentSpecificSettings( ::std::list< SettingsGroup >& _out_rSettings )
1852 : : {
1853 : : (void)_out_rSettings;
1854 : 1061 : return 0;
1855 : : }
1856 : :
1857 : 138 : void SvXMLExport::addDataStyle(const sal_Int32 nNumberFormat, sal_Bool /*bTimeFormat*/ )
1858 : : {
1859 [ + - ]: 138 : if(mpNumExport)
1860 : 138 : mpNumExport->SetUsed(nNumberFormat);
1861 : 138 : }
1862 : :
1863 : 178 : void SvXMLExport::exportDataStyles()
1864 : : {
1865 [ + - ]: 178 : if(mpNumExport)
1866 : 178 : mpNumExport->Export(sal_False);
1867 : 178 : }
1868 : :
1869 : 55 : void SvXMLExport::exportAutoDataStyles()
1870 : : {
1871 [ + - ]: 55 : if(mpNumExport)
1872 : 55 : mpNumExport->Export(sal_True);
1873 : :
1874 [ + + ]: 55 : if (mxFormExport.is())
1875 : 21 : mxFormExport->exportAutoControlNumberStyles();
1876 : 55 : }
1877 : :
1878 : 67 : OUString SvXMLExport::getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool /*bTimeFormat*/ ) const
1879 : : {
1880 : 67 : OUString sTemp;
1881 [ + - ]: 67 : if(mpNumExport)
1882 [ + - ]: 67 : sTemp = mpNumExport->GetStyleName(nNumberFormat);
1883 : 67 : return sTemp;
1884 : : }
1885 : :
1886 : 0 : void SvXMLExport::exportAnnotationMeta(const uno::Reference<drawing::XShape>&)
1887 : : {
1888 : 0 : }
1889 : :
1890 : 10 : sal_Int32 SvXMLExport::dataStyleForceSystemLanguage(sal_Int32 nFormat) const
1891 : : {
1892 : : return ( mpNumExport != NULL )
1893 [ + - ]: 10 : ? mpNumExport->ForceSystemLanguage( nFormat ) : nFormat;
1894 : : }
1895 : :
1896 : :
1897 : 0 : OUString SvXMLExport::AddEmbeddedGraphicObject( const OUString& rGraphicObjectURL )
1898 : : {
1899 : 0 : OUString sRet( rGraphicObjectURL );
1900 [ # # ]: 0 : if( 0 == rGraphicObjectURL.compareTo( msGraphicObjectProtocol,
[ # # # # ]
1901 : 0 : msGraphicObjectProtocol.getLength() ) &&
1902 : 0 : mxGraphicResolver.is() )
1903 : : {
1904 [ # # ]: 0 : if( (getExportFlags() & EXPORT_EMBEDDED) == 0 )
1905 [ # # ][ # # ]: 0 : sRet = mxGraphicResolver->resolveGraphicObjectURL( rGraphicObjectURL );
1906 : : else
1907 : 0 : sRet = OUString();
1908 : : }
1909 : : else
1910 [ # # ]: 0 : sRet = GetRelativeReference( sRet );
1911 : :
1912 : 0 : return sRet;
1913 : : }
1914 : :
1915 : 0 : sal_Bool SvXMLExport::AddEmbeddedGraphicObjectAsBase64( const OUString& rGraphicObjectURL )
1916 : : {
1917 : 0 : sal_Bool bRet = sal_False;
1918 : :
1919 [ # # # # : 0 : if( (getExportFlags() & EXPORT_EMBEDDED) != 0 &&
# # ][ # # ]
1920 : : 0 == rGraphicObjectURL.compareTo( msGraphicObjectProtocol,
1921 : 0 : msGraphicObjectProtocol.getLength() ) &&
1922 : 0 : mxGraphicResolver.is() )
1923 : : {
1924 [ # # ]: 0 : Reference< XBinaryStreamResolver > xStmResolver( mxGraphicResolver, UNO_QUERY );
1925 : :
1926 [ # # ]: 0 : if( xStmResolver.is() )
1927 : : {
1928 [ # # ][ # # ]: 0 : Reference< XInputStream > xIn( xStmResolver->getInputStream( rGraphicObjectURL ) );
1929 : :
1930 [ # # ]: 0 : if( xIn.is() )
1931 : : {
1932 [ # # ]: 0 : XMLBase64Export aBase64Exp( *this );
1933 [ # # ]: 0 : bRet = aBase64Exp.exportOfficeBinaryDataElement( xIn );
1934 : 0 : }
1935 : 0 : }
1936 : : }
1937 : :
1938 : 0 : return bRet;
1939 : : }
1940 : :
1941 : 0 : OUString SvXMLExport::AddEmbeddedObject( const OUString& rEmbeddedObjectURL )
1942 : : {
1943 : 0 : OUString sRet;
1944 [ # # ][ # # : 0 : if( (0 == rEmbeddedObjectURL.compareTo( msEmbeddedObjectProtocol,
# # # # ]
1945 : 0 : msEmbeddedObjectProtocol.getLength() ) ||
1946 : : 0 == rEmbeddedObjectURL.compareTo( msGraphicObjectProtocol,
1947 : 0 : msGraphicObjectProtocol.getLength() ) ) &&
1948 : 0 : mxEmbeddedResolver.is() )
1949 : : {
1950 : : sRet =
1951 [ # # ][ # # ]: 0 : mxEmbeddedResolver->resolveEmbeddedObjectURL( rEmbeddedObjectURL );
1952 : : }
1953 : : else
1954 [ # # ]: 0 : sRet = GetRelativeReference( rEmbeddedObjectURL );
1955 : :
1956 : 0 : return sRet;
1957 : : }
1958 : :
1959 : 0 : sal_Bool SvXMLExport::AddEmbeddedObjectAsBase64( const OUString& rEmbeddedObjectURL )
1960 : : {
1961 : 0 : sal_Bool bRet = sal_False;
1962 [ # # ][ # # : 0 : if( (0 == rEmbeddedObjectURL.compareTo( msEmbeddedObjectProtocol,
# # # # ]
1963 : 0 : msEmbeddedObjectProtocol.getLength() ) ||
1964 : : 0 == rEmbeddedObjectURL.compareTo( msGraphicObjectProtocol,
1965 : 0 : msGraphicObjectProtocol.getLength() ) ) &&
1966 : 0 : mxEmbeddedResolver.is() )
1967 : : {
1968 [ # # ]: 0 : Reference < XNameAccess > xNA( mxEmbeddedResolver, UNO_QUERY );
1969 [ # # ]: 0 : if( xNA.is() )
1970 : : {
1971 [ # # ][ # # ]: 0 : Any aAny = xNA->getByName( rEmbeddedObjectURL );
1972 : 0 : Reference < XInputStream > xIn;
1973 [ # # ]: 0 : aAny >>= xIn;
1974 [ # # ]: 0 : if( xIn.is() )
1975 : : {
1976 [ # # ]: 0 : XMLBase64Export aBase64Exp( *this );
1977 [ # # ]: 0 : bRet = aBase64Exp.exportOfficeBinaryDataElement( xIn );
1978 : 0 : }
1979 : 0 : }
1980 : : }
1981 : :
1982 : 0 : return bRet;
1983 : : }
1984 : :
1985 : 1399 : OUString SvXMLExport::EncodeStyleName(
1986 : : const OUString& rName,
1987 : : sal_Bool *pEncoded ) const
1988 : : {
1989 : 1399 : return GetMM100UnitConverter().encodeStyleName( rName, pEncoded );
1990 : : }
1991 : :
1992 : 619 : ProgressBarHelper* SvXMLExport::GetProgressBarHelper()
1993 : : {
1994 [ + + ]: 619 : if (!mpProgressBarHelper)
1995 : : {
1996 [ + - ]: 132 : mpProgressBarHelper = new ProgressBarHelper(mxStatusIndicator, sal_True);
1997 : :
1998 [ + + ]: 132 : if (mxExportInfo.is())
1999 : : {
2000 [ + - ][ + - ]: 116 : uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = mxExportInfo->getPropertySetInfo();
2001 [ + - ]: 116 : if (xPropertySetInfo.is())
2002 : : {
2003 : 116 : OUString sProgressRange(XML_PROGRESSRANGE);
2004 : 116 : OUString sProgressMax(XML_PROGRESSMAX);
2005 : 116 : OUString sProgressCurrent(XML_PROGRESSCURRENT);
2006 : 116 : OUString sRepeat(XML_PROGRESSREPEAT);
2007 [ + - ][ + - ]: 348 : if (xPropertySetInfo->hasPropertyByName(sProgressMax) &&
[ + - ][ + - ]
[ + - ][ + - ]
2008 [ + - ][ + - ]: 116 : xPropertySetInfo->hasPropertyByName(sProgressCurrent) &&
2009 [ + - ][ + - ]: 116 : xPropertySetInfo->hasPropertyByName(sProgressRange))
2010 : : {
2011 : 116 : uno::Any aAny;
2012 : 116 : sal_Int32 nProgressMax(0);
2013 : 116 : sal_Int32 nProgressCurrent(0);
2014 : 116 : sal_Int32 nProgressRange(0);
2015 [ + - ][ + - ]: 116 : aAny = mxExportInfo->getPropertyValue(sProgressRange);
2016 [ + + ]: 116 : if (aAny >>= nProgressRange)
2017 : 84 : mpProgressBarHelper->SetRange(nProgressRange);
2018 [ + - ][ + - ]: 116 : aAny = mxExportInfo->getPropertyValue(sProgressMax);
2019 [ + + ]: 116 : if (aAny >>= nProgressMax)
2020 : 104 : mpProgressBarHelper->SetReference(nProgressMax);
2021 [ + - ][ + - ]: 116 : aAny = mxExportInfo->getPropertyValue(sProgressCurrent);
2022 [ + + ]: 116 : if (aAny >>= nProgressCurrent)
2023 [ + - ]: 116 : mpProgressBarHelper->SetValue(nProgressCurrent);
2024 : : }
2025 [ + - ][ + - ]: 116 : if (xPropertySetInfo->hasPropertyByName(sRepeat))
[ - + ]
2026 : : {
2027 [ # # ][ # # ]: 0 : uno::Any aAny = mxExportInfo->getPropertyValue(sRepeat);
2028 [ # # ][ # # ]: 0 : if (aAny.getValueType() == getBooleanCppuType())
2029 [ # # ]: 0 : mpProgressBarHelper->SetRepeat(::cppu::any2bool(aAny));
2030 : : else {
2031 : : SAL_WARN( "xmloff.core", "why is it no boolean?" );
2032 : 0 : }
2033 : 116 : }
2034 : 116 : }
2035 : : }
2036 : : }
2037 : 619 : return mpProgressBarHelper;
2038 : : }
2039 : :
2040 : 666 : XMLEventExport& SvXMLExport::GetEventExport()
2041 : : {
2042 [ + + ]: 666 : if( NULL == mpEventExport)
2043 : : {
2044 : : // create EventExport on demand
2045 [ + - ][ + - ]: 242 : mpEventExport = new XMLEventExport(*this, NULL);
2046 : :
2047 : : // and register standard handlers + names
2048 : 242 : OUString sStarBasic("StarBasic");
2049 [ + - ][ + - ]: 242 : mpEventExport->AddHandler(sStarBasic, new XMLStarBasicExportHandler());
[ + - ]
2050 : 242 : OUString sScript("Script");
2051 [ + - ][ + - ]: 242 : mpEventExport->AddHandler(sScript, new XMLScriptExportHandler());
[ + - ]
2052 [ + - ]: 242 : mpEventExport->AddTranslationTable(aStandardEventTable);
2053 : : }
2054 : :
2055 : 666 : return *mpEventExport;
2056 : : }
2057 : :
2058 : 0 : XMLImageMapExport& SvXMLExport::GetImageMapExport()
2059 : : {
2060 : : // image map export, create on-demand
2061 [ # # ]: 0 : if( NULL == mpImageMapExport )
2062 : : {
2063 [ # # ]: 0 : mpImageMapExport = new XMLImageMapExport(*this);
2064 : : }
2065 : :
2066 : 0 : return *mpImageMapExport;
2067 : : }
2068 : :
2069 : : namespace
2070 : : {
2071 : : class theSvXMLExportUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvXMLExportUnoTunnelId> {};
2072 : : }
2073 : :
2074 : : // XUnoTunnel & co
2075 : 32 : const uno::Sequence< sal_Int8 > & SvXMLExport::getUnoTunnelId() throw()
2076 : : {
2077 : 32 : return theSvXMLExportUnoTunnelId::get().getSeq();
2078 : : }
2079 : :
2080 : 16 : SvXMLExport* SvXMLExport::getImplementation( uno::Reference< uno::XInterface > xInt ) throw()
2081 : : {
2082 [ + - ]: 16 : uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY );
2083 [ + - ]: 16 : if( xUT.is() )
2084 : : {
2085 : : return
2086 : : reinterpret_cast<SvXMLExport*>(
2087 : : sal::static_int_cast<sal_IntPtr>(
2088 [ + - ][ + - ]: 16 : xUT->getSomething( SvXMLExport::getUnoTunnelId())));
2089 : : }
2090 : : else
2091 : 16 : return NULL;
2092 : : }
2093 : :
2094 : : // XUnoTunnel
2095 : 16 : sal_Int64 SAL_CALL SvXMLExport::getSomething( const uno::Sequence< sal_Int8 >& rId )
2096 : : throw( uno::RuntimeException )
2097 : : {
2098 [ + - + - ]: 32 : if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(),
[ + - ]
2099 : 16 : rId.getConstArray(), 16 ) )
2100 : : {
2101 : 16 : return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
2102 : : }
2103 : 16 : return 0;
2104 : : }
2105 : :
2106 : 0 : sal_Bool SvXMLExport::ExportEmbeddedOwnObject( Reference< XComponent >& rComp )
2107 : : {
2108 : 0 : OUString sFilterService;
2109 : 0 : bool bIsChart = false;
2110 : :
2111 [ # # ]: 0 : Reference < lang::XServiceInfo > xServiceInfo( rComp, UNO_QUERY );
2112 [ # # ]: 0 : if( xServiceInfo.is() )
2113 : : {
2114 : 0 : const XMLServiceMapEntry_Impl *pEntry = aServiceMap;
2115 [ # # ]: 0 : while( pEntry->sModelService )
2116 : : {
2117 : : OUString sModelService( pEntry->sModelService,
2118 : : pEntry->nModelServiceLen,
2119 [ # # ]: 0 : RTL_TEXTENCODING_ASCII_US );
2120 [ # # ][ # # ]: 0 : if( xServiceInfo->supportsService( sModelService ) )
[ # # ]
2121 : : {
2122 : : sFilterService = OUString( pEntry->sFilterService,
2123 : : pEntry->nFilterServiceLen,
2124 [ # # ]: 0 : RTL_TEXTENCODING_ASCII_US );
2125 : 0 : bIsChart = sModelService == XML_MODEL_SERVICE_CHART;
2126 : : break;
2127 : : }
2128 [ # # ]: 0 : pEntry++;
2129 : 0 : }
2130 : : }
2131 : :
2132 : : OSL_ENSURE( sFilterService.getLength(), "no export filter for own object" );
2133 : :
2134 [ # # ]: 0 : if( sFilterService.isEmpty() )
2135 : 0 : return sal_False;
2136 : :
2137 : : Reference < XDocumentHandler > xHdl =
2138 [ # # ][ # # ]: 0 : new XMLEmbeddedObjectExportFilter( mxHandler );
2139 : :
2140 [ # # ]: 0 : Sequence < Any > aArgs( 1 );
2141 : : // #144135# the filters for embedded objects in flat format are always
2142 : : // instantiated as Oasis filters and transformed afterwards. Therefore, all
2143 : : // special handling that is done if the exportFlags do not contain
2144 : : // EXPORT_OASIS must be changed to properties being passed in the info
2145 : : // propertyset
2146 : :
2147 [ # # ][ # # ]: 0 : if( ! (getExportFlags() & EXPORT_OASIS) &&
[ # # ]
2148 : : bIsChart )
2149 : : {
2150 : : static ::comphelper::PropertyMapEntry aInfoMap[] =
2151 : : {
2152 [ # # ]: 0 : { RTL_CONSTASCII_STRINGPARAM("ExportTableNumberList"), 0, &::getBooleanCppuType(), PropertyAttribute::MAYBEVOID, 0},
2153 : : { NULL, 0, 0, NULL, 0, 0 }
2154 [ # # ][ # # ]: 0 : };
[ # # ]
2155 : : Reference< XPropertySet > xInfoProp(
2156 : : ::comphelper::GenericPropertySet_CreateInstance(
2157 [ # # ]: 0 : new ::comphelper::PropertySetInfo( aInfoMap )));
2158 : :
2159 [ # # ]: 0 : if( bIsChart )
2160 [ # # ][ # # ]: 0 : xInfoProp->setPropertyValue( OUString( "ExportTableNumberList"), makeAny( true ));
[ # # ]
2161 : :
2162 [ # # ]: 0 : aArgs.realloc( 2 );
2163 [ # # ][ # # ]: 0 : aArgs[1] <<= xInfoProp;
2164 : : }
2165 [ # # ][ # # ]: 0 : aArgs[0] <<= xHdl;
2166 : :
2167 : : // #110680#
2168 : : // Reference< lang::XMultiServiceFactory > xServiceFactory = comphelper::getProcessServiceFactory();
2169 [ # # ]: 0 : Reference< lang::XMultiServiceFactory > xServiceFactory = getServiceFactory();
2170 : :
2171 : : Reference< document::XExporter > xExporter(
2172 [ # # ]: 0 : xServiceFactory->createInstanceWithArguments( sFilterService, aArgs),
2173 [ # # ][ # # ]: 0 : UNO_QUERY);
2174 : : OSL_ENSURE( xExporter.is(),
2175 : : "can't instantiate export filter component for own object" );
2176 [ # # ]: 0 : if( !xExporter.is() )
2177 : 0 : return sal_False;
2178 : :
2179 [ # # ][ # # ]: 0 : xExporter->setSourceDocument( rComp );
2180 : :
2181 [ # # ]: 0 : Reference<XFilter> xFilter( xExporter, UNO_QUERY );
2182 : :
2183 [ # # ]: 0 : Sequence < PropertyValue > aMediaDesc( 0 );
2184 [ # # ][ # # ]: 0 : return xFilter->filter( aMediaDesc );
[ # # ][ # # ]
2185 : : }
2186 : :
2187 : 181 : OUString SvXMLExport::GetRelativeReference(const OUString& rValue)
2188 : : {
2189 : 181 : OUString sValue( rValue );
2190 : : // #i65474# handling of fragment URLs ("#....") is undefined
2191 : : // they are stored 'as is'
2192 : 181 : uno::Reference< uri::XUriReference > xUriRef;
2193 [ + - ][ + + ]: 181 : if(!sValue.isEmpty() && sValue.getStr()[0] != '#')
[ + + ]
2194 : : {
2195 : : try
2196 : : {
2197 [ + - ][ + - ]: 178 : xUriRef = mpImpl->mxUriReferenceFactory->parse( rValue );
[ + - ]
2198 [ + - ][ + - ]: 178 : if( xUriRef.is() && !xUriRef->isAbsolute() )
[ - + ][ - + ]
[ + - ]
2199 : : {
2200 : : //#i61943# relative URLs need special handling
2201 [ # # ]: 0 : INetURLObject aTemp( mpImpl->msPackageURI );
2202 : 0 : bool bWasAbsolute = false;
2203 [ # # ][ # # ]: 0 : sValue = aTemp.smartRel2Abs(sValue, bWasAbsolute ).GetMainURL(INetURLObject::DECODE_TO_IURI);
[ # # ][ # # ]
[ # # ]
2204 : : }
2205 : : }
2206 [ # # ]: 0 : catch(const uno::Exception&)
2207 : : {
2208 : : }
2209 : : }
2210 : 181 : OUString sRet = sValue;
2211 [ + + ]: 181 : if( xUriRef.is() )//no conversion for empty values or for fragments
2212 : : {
2213 : : //conversion for matching schemes only
2214 [ + - ][ + - ]: 178 : if( xUriRef->getScheme() == mpImpl->msPackageURIScheme )
[ + + ]
2215 : : {
2216 : : sValue = INetURLObject::GetRelURL( msOrigFileName, sValue,
2217 [ + - ]: 174 : INetURLObject::WAS_ENCODED, INetURLObject::DECODE_TO_IURI, RTL_TEXTENCODING_UTF8, INetURLObject::FSYS_DETECT);
2218 : : }
2219 : : }
2220 : 181 : return sValue;
2221 : : }
2222 : :
2223 : 70 : void SvXMLExport::StartElement(sal_uInt16 nPrefix,
2224 : : enum ::xmloff::token::XMLTokenEnum eName,
2225 : : sal_Bool bIgnWSOutside )
2226 : : {
2227 : 70 : StartElement(_GetNamespaceMap().GetQNameByKey( nPrefix,
2228 [ + - ]: 140 : GetXMLToken(eName) ), bIgnWSOutside);
2229 : 70 : }
2230 : :
2231 : 91680 : void SvXMLExport::StartElement(const OUString& rName,
2232 : : sal_Bool bIgnWSOutside )
2233 : : {
2234 [ + + ]: 91680 : if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
2235 : : {
2236 : : try
2237 : : {
2238 [ + + ][ - + ]: 91294 : if( bIgnWSOutside && ((mnExportFlags & EXPORT_PRETTY) == EXPORT_PRETTY))
2239 [ # # ][ # # ]: 0 : mxHandler->ignorableWhitespace( msWS );
2240 [ + - ][ + - ]: 91294 : mxHandler->startElement( rName, GetXAttrList() );
2241 : : }
2242 : 0 : catch (const SAXInvalidCharacterException& e)
2243 : : {
2244 [ # # ]: 0 : Sequence<OUString> aPars(1);
2245 [ # # ]: 0 : aPars[0] = rName;
2246 [ # # # # : 0 : SetError( XMLERROR_SAX|XMLERROR_FLAG_WARNING, aPars, e.Message, NULL );
# # ]
2247 : : }
2248 [ # # # ]: 0 : catch (const SAXException& e)
2249 : : {
2250 [ # # ]: 0 : Sequence<OUString> aPars(1);
2251 [ # # ]: 0 : aPars[0] = rName;
2252 : : SetError( XMLERROR_SAX|XMLERROR_FLAG_ERROR|XMLERROR_FLAG_SEVERE,
2253 [ # # # # : 0 : aPars, e.Message, NULL );
# # ]
2254 : : }
2255 : : }
2256 : 91680 : ClearAttrList();
2257 : 91680 : ++mpImpl->mDepth; // increment nesting depth counter
2258 : 91680 : }
2259 : :
2260 : 4437 : void SvXMLExport::Characters(const ::rtl::OUString& rChars)
2261 : : {
2262 [ + + ]: 4437 : if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
2263 : : {
2264 : : try
2265 : : {
2266 [ + - ][ + - ]: 4433 : mxHandler->characters(rChars);
2267 : : }
2268 : 0 : catch (const SAXInvalidCharacterException& e)
2269 : : {
2270 [ # # ]: 0 : Sequence<OUString> aPars(1);
2271 [ # # ]: 0 : aPars[0] = rChars;
2272 [ # # # # : 0 : SetError( XMLERROR_SAX|XMLERROR_FLAG_WARNING, aPars, e.Message, NULL );
# # ]
2273 : : }
2274 [ # # # ]: 0 : catch (const SAXException& e)
2275 : : {
2276 [ # # ]: 0 : Sequence<OUString> aPars(1);
2277 [ # # ]: 0 : aPars[0] = rChars;
2278 : : SetError( XMLERROR_SAX|XMLERROR_FLAG_ERROR|XMLERROR_FLAG_SEVERE,
2279 [ # # # # : 0 : aPars, e.Message, NULL );
# # ]
2280 : : }
2281 : : }
2282 : 4437 : }
2283 : :
2284 : 70 : void SvXMLExport::EndElement(sal_uInt16 nPrefix,
2285 : : enum ::xmloff::token::XMLTokenEnum eName,
2286 : : sal_Bool bIgnWSInside )
2287 : : {
2288 : 70 : EndElement(_GetNamespaceMap().GetQNameByKey( nPrefix, GetXMLToken(eName) ),
2289 [ + - ]: 70 : bIgnWSInside);
2290 : 70 : }
2291 : :
2292 : 91680 : void SvXMLExport::EndElement(const OUString& rName,
2293 : : sal_Bool bIgnWSInside )
2294 : : {
2295 : : // decrement nesting depth counter & (maybe) restore namespace map
2296 : 91680 : --mpImpl->mDepth;
2297 [ + + + - ]: 91714 : if (!mpImpl->mNamespaceMaps.empty() &&
[ + + ]
2298 : 34 : (mpImpl->mNamespaceMaps.top().second == mpImpl->mDepth))
2299 : : {
2300 [ + - ]: 34 : delete mpNamespaceMap;
2301 : 34 : mpNamespaceMap = mpImpl->mNamespaceMaps.top().first;
2302 : 34 : mpImpl->mNamespaceMaps.pop();
2303 : : }
2304 : : OSL_ENSURE(mpImpl->mNamespaceMaps.empty() ||
2305 : : (mpImpl->mNamespaceMaps.top().second < mpImpl->mDepth),
2306 : : "SvXMLExport: NamespaceMaps corrupted");
2307 : :
2308 [ + + ]: 91680 : if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
2309 : : {
2310 : : try
2311 : : {
2312 [ + + ][ - + ]: 91294 : if( bIgnWSInside && ((mnExportFlags & EXPORT_PRETTY) == EXPORT_PRETTY))
2313 [ # # ][ # # ]: 0 : mxHandler->ignorableWhitespace( msWS );
2314 [ + - ][ + - ]: 91294 : mxHandler->endElement( rName );
2315 : : }
2316 [ # # ]: 0 : catch (const SAXException& e)
2317 : : {
2318 [ # # ]: 0 : Sequence<OUString> aPars(1);
2319 [ # # ]: 0 : aPars[0] = rName;
2320 : : SetError( XMLERROR_SAX|XMLERROR_FLAG_ERROR|XMLERROR_FLAG_SEVERE,
2321 [ # # # # : 0 : aPars, e.Message, NULL );
# # ]
2322 : : }
2323 : : }
2324 : 91680 : }
2325 : :
2326 : 320 : void SvXMLExport::IgnorableWhitespace()
2327 : : {
2328 [ + - ]: 320 : if ((mnExportFlags & EXPORT_PRETTY) != EXPORT_PRETTY)
2329 : 320 : return;
2330 : :
2331 [ # # ]: 0 : if ((mnErrorFlags & ERROR_DO_NOTHING) != ERROR_DO_NOTHING)
2332 : : {
2333 : : try
2334 : : {
2335 [ # # ][ # # ]: 0 : mxHandler->ignorableWhitespace( msWS );
2336 : : }
2337 [ # # ]: 0 : catch (const SAXException& e)
2338 : : {
2339 [ # # ]: 0 : Sequence<OUString> aPars(0);
2340 : : SetError( XMLERROR_SAX|XMLERROR_FLAG_ERROR|XMLERROR_FLAG_SEVERE,
2341 [ # # # # : 0 : aPars, e.Message, NULL );
# # ]
2342 : : }
2343 : : }
2344 : : }
2345 : :
2346 : :
2347 : 2 : void SvXMLExport::SetError(
2348 : : sal_Int32 nId,
2349 : : const Sequence<OUString>& rMsgParams,
2350 : : const OUString& rExceptionMessage,
2351 : : const Reference<XLocator>& rLocator )
2352 : : {
2353 : : // allow multi-threaded access to the cancel() method
2354 [ + - ][ + - ]: 2 : static osl::Mutex aMutex;
[ + - ][ # # ]
2355 [ + - ]: 2 : osl::MutexGuard aGuard(aMutex);
2356 : :
2357 : : // maintain error flags
2358 [ - + ]: 2 : if ( ( nId & XMLERROR_FLAG_ERROR ) != 0 )
2359 : 0 : mnErrorFlags |= ERROR_ERROR_OCCURRED;
2360 [ - + ]: 2 : if ( ( nId & XMLERROR_FLAG_WARNING ) != 0 )
2361 : 0 : mnErrorFlags |= ERROR_WARNING_OCCURRED;
2362 [ + - ]: 2 : if ( ( nId & XMLERROR_FLAG_SEVERE ) != 0 )
2363 : 2 : mnErrorFlags |= ERROR_DO_NOTHING;
2364 : :
2365 : : // create error lsit on demand
2366 [ + - ]: 2 : if ( mpXMLErrors == NULL )
2367 [ + - ][ + - ]: 2 : mpXMLErrors = new XMLErrors();
2368 : :
2369 : : // save error information
2370 [ + - ][ + - ]: 2 : mpXMLErrors->AddRecord( nId, rMsgParams, rExceptionMessage, rLocator );
2371 : 2 : }
2372 : :
2373 : 2 : void SvXMLExport::SetError(
2374 : : sal_Int32 nId,
2375 : : const Sequence<OUString>& rMsgParams)
2376 : : {
2377 : 2 : OUString sEmpty;
2378 [ + - ][ + - ]: 2 : SetError( nId, rMsgParams, sEmpty, NULL );
2379 : 2 : }
2380 : :
2381 : 46 : void SvXMLExport::DisposingModel()
2382 : : {
2383 : 46 : mxModel.clear();
2384 : : // Shapes in Writer cannot be named via context menu (#i51726#)
2385 : 46 : meModelType = SvtModuleOptions::E_UNKNOWN_FACTORY;
2386 : 46 : mxEventListener.clear();
2387 : 46 : }
2388 : :
2389 : 4409 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SvXMLExport::getServiceFactory()
2390 : : {
2391 : 4409 : return mxServiceFactory;
2392 : : }
2393 : :
2394 : : uno::Reference< uno::XComponentContext >
2395 : 28 : SvXMLExport::GetComponentContext() const
2396 : : {
2397 : 28 : return mpImpl->mxComponentContext;
2398 : : }
2399 : :
2400 : 340 : ::comphelper::UnoInterfaceToUniqueIdentifierMapper& SvXMLExport::getInterfaceToIdentifierMapper()
2401 : : {
2402 : 340 : return mpImpl->maInterfaceToIdentifierMapper;
2403 : : }
2404 : :
2405 : : // Written OpenDocument file format doesn't fit to the created text document (#i69627#)
2406 : 244 : sal_Bool SvXMLExport::writeOutlineStyleAsNormalListStyle() const
2407 : : {
2408 : 244 : return mpImpl->mbOutlineStyleAsNormalListStyle;
2409 : : }
2410 : :
2411 : 12 : uno::Reference< embed::XStorage > SvXMLExport::GetTargetStorage()
2412 : : {
2413 : 12 : return mpImpl->mxTargetStorage;
2414 : : }
2415 : :
2416 : : /// returns the currently configured default version for odf export
2417 : 10136 : SvtSaveOptions::ODFDefaultVersion SvXMLExport::getDefaultVersion() const
2418 : : {
2419 [ + - ]: 10136 : if( mpImpl )
2420 : 10136 : return mpImpl->maSaveOptions.GetODFDefaultVersion();
2421 : :
2422 : : // fatal error, use current version as default
2423 : 10136 : return SvtSaveOptions::ODFVER_012;
2424 : : }
2425 : :
2426 : 112 : ::rtl::OUString SvXMLExport::GetStreamName() const
2427 : : {
2428 : 112 : return mpImpl->mStreamName;
2429 : : }
2430 : :
2431 : : void
2432 : 0 : SvXMLExport::AddAttributeIdLegacy(
2433 : : sal_uInt16 const nLegacyPrefix, ::rtl::OUString const& rValue)
2434 : : {
2435 [ # # ]: 0 : switch (getDefaultVersion()) {
2436 : : case SvtSaveOptions::ODFVER_011: // fall thru
2437 : 0 : case SvtSaveOptions::ODFVER_010: break;
2438 : : default: // ODF 1.2: xml:id
2439 : 0 : AddAttribute(XML_NAMESPACE_XML, XML_ID, rValue);
2440 : : }
2441 : : // in ODF 1.1 this was form:id, anim:id, draw:id, or text:id
2442 : : // backward compatibility: in ODF 1.2 write _both_ id attrs
2443 : 0 : AddAttribute(nLegacyPrefix, XML_ID, rValue);
2444 : : // FIXME: this function simply assumes that rValue is unique
2445 : 0 : }
2446 : :
2447 : : void
2448 : 2192 : SvXMLExport::AddAttributeXmlId(uno::Reference<uno::XInterface> const & i_xIfc)
2449 : : {
2450 : : // check version >= 1.2
2451 [ + - ][ + - ]: 2192 : switch (getDefaultVersion()) {
2452 : : case SvtSaveOptions::ODFVER_011: // fall thru
2453 : 2192 : case SvtSaveOptions::ODFVER_010: return;
2454 : 2192 : default: break;
2455 : : }
2456 : : const uno::Reference<rdf::XMetadatable> xMeta(i_xIfc,
2457 [ + - ]: 2192 : uno::UNO_QUERY);
2458 : : //FIXME not yet...
2459 [ + + ]: 2192 : if ( xMeta.is() )
2460 : : {
2461 [ + - ][ + - ]: 2145 : const beans::StringPair mdref( xMeta->getMetadataReference() );
2462 [ + + ]: 2145 : if ( !mdref.Second.isEmpty() )
2463 : : {
2464 [ + - ]: 112 : const ::rtl::OUString streamName( GetStreamName() );
2465 [ + - ]: 112 : if ( !streamName.isEmpty() )
2466 : : {
2467 [ + - ]: 112 : if ( streamName.equals(mdref.First) )
2468 : : {
2469 [ + - ]: 112 : AddAttribute( XML_NAMESPACE_XML, XML_ID, mdref.Second );
2470 : : }
2471 : : else
2472 : : {
2473 : : OSL_FAIL("SvXMLExport::AddAttributeXmlId: "
2474 : : "invalid stream name");
2475 : : }
2476 : : }
2477 : : else
2478 : : {
2479 : : // FIXME: this is ugly
2480 : : // there is no stream name (e.g. XSLT, flat-xml format)!
2481 : : // but how do we ensure uniqueness in this case?
2482 : : // a) just omit styles.xml ids -- they are unlikely anyway...
2483 : : // b) somehow find out whether we are currently exporting styles
2484 : : // or content, and prefix "s" or "c" => unique
2485 [ # # ]: 0 : if ( mdref.First == "content.xml" )
2486 : : {
2487 [ # # ]: 0 : AddAttribute( XML_NAMESPACE_XML, XML_ID, mdref.Second );
2488 : : }
2489 : : else
2490 : : {
2491 : : OSL_TRACE("SvXMLExport::AddAttributeXmlId: "
2492 : : "no stream name given: dropping styles.xml xml:id");
2493 : : }
2494 : 112 : }
2495 : 2145 : }
2496 : 2192 : }
2497 : : }
2498 : :
2499 : : void
2500 : 2140 : SvXMLExport::AddAttributesRDFa(
2501 : : uno::Reference<text::XTextContent> const & i_xTextContent)
2502 : : {
2503 : : // check version >= 1.2
2504 [ + - ][ + - ]: 2140 : switch (getDefaultVersion()) {
2505 : : case SvtSaveOptions::ODFVER_011: // fall thru
2506 : : case SvtSaveOptions::ODFVER_010: return;
2507 : 2140 : default: break;
2508 : : }
2509 : :
2510 : : const uno::Reference<rdf::XMetadatable> xMeta(
2511 [ + - ]: 2140 : i_xTextContent, uno::UNO_QUERY);
2512 [ + + ][ + - ]: 2140 : if (!xMeta.is() || xMeta->getMetadataReference().Second.isEmpty())
[ + - ][ + + ]
[ + + ][ + + ]
[ # # ]
2513 : : {
2514 : : return; // no xml:id => no RDFa
2515 : : }
2516 : :
2517 [ + + ]: 60 : if (!mpImpl->mpRDFaHelper.get())
2518 : : {
2519 [ + - ][ + - ]: 8 : mpImpl->mpRDFaHelper.reset( new ::xmloff::RDFaExportHelper(*this) );
2520 : : }
2521 [ + - ][ + + ]: 2140 : mpImpl->mpRDFaHelper->AddRDFa(xMeta);
2522 : : }
2523 : :
2524 : 244 : sal_Bool SvXMLExport::exportTextNumberElement() const
2525 : : {
2526 : 244 : return mpImpl->mbExportTextNumberElement;
2527 : : }
2528 : :
2529 : 0 : sal_Bool SvXMLExport::SetNullDateOnUnitConverter()
2530 : : {
2531 : : // if the null date has already been set, don't set it again (performance)
2532 [ # # ]: 0 : if (!mpImpl->mbNullDateInitialized)
2533 : 0 : mpImpl->mbNullDateInitialized = GetMM100UnitConverter().setNullDate(GetModel());
2534 : :
2535 : 0 : return mpImpl->mbNullDateInitialized;
2536 : : }
2537 : :
2538 : : //=============================================================================
2539 : :
2540 : 33749 : void SvXMLElementExport::StartElement( SvXMLExport& rExp,
2541 : : sal_uInt16 nPrefixKey,
2542 : : const OUString& rLName,
2543 : : sal_Bool bIWSOutside )
2544 : : {
2545 : 33749 : aName = rExp.GetNamespaceMap().GetQNameByKey(nPrefixKey, rLName);
2546 : 33749 : rExp.StartElement(aName, bIWSOutside);
2547 : 33749 : }
2548 : :
2549 : 0 : SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
2550 : : sal_uInt16 nPrefixKey,
2551 : : const sal_Char *pLName,
2552 : : sal_Bool bIWSOutside,
2553 : : sal_Bool bIWSInside ) :
2554 : : rExport( rExp ),
2555 : : bIgnWS( bIWSInside ),
2556 : 0 : bDoSomething( sal_True )
2557 : : {
2558 : 0 : OUString sLName( OUString::createFromAscii(pLName) );
2559 [ # # ]: 0 : StartElement( rExp, nPrefixKey, sLName, bIWSOutside );
2560 : 0 : }
2561 : :
2562 : 1123 : SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
2563 : : sal_uInt16 nPrefixKey,
2564 : : const OUString& rLName,
2565 : : sal_Bool bIWSOutside,
2566 : : sal_Bool bIWSInside ) :
2567 : : rExport( rExp ),
2568 : : bIgnWS( bIWSInside ),
2569 : 1123 : bDoSomething( sal_True )
2570 : : {
2571 [ + - ]: 1123 : StartElement( rExp, nPrefixKey, rLName, bIWSOutside );
2572 : 1123 : }
2573 : :
2574 : 31478 : SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
2575 : : sal_uInt16 nPrefixKey,
2576 : : enum XMLTokenEnum eLName,
2577 : : sal_Bool bIWSOutside,
2578 : : sal_Bool bIWSInside ) :
2579 : : rExport( rExp ),
2580 : : bIgnWS( bIWSInside ),
2581 : 31478 : bDoSomething( sal_True )
2582 : : {
2583 [ + - ][ + - ]: 31478 : StartElement( rExp, nPrefixKey, GetXMLToken(eLName), bIWSOutside );
2584 : 31478 : }
2585 : :
2586 : 13010 : SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
2587 : : sal_Bool bDoSth,
2588 : : sal_uInt16 nPrefixKey,
2589 : : enum XMLTokenEnum eLName,
2590 : : sal_Bool bIWSOutside,
2591 : : sal_Bool bIWSInside ) :
2592 : : rExport( rExp ),
2593 : : bIgnWS( bIWSInside ),
2594 : 13010 : bDoSomething( bDoSth )
2595 : : {
2596 [ + + ]: 13010 : if( bDoSomething )
2597 [ + - ][ + - ]: 1148 : StartElement( rExport, nPrefixKey, GetXMLToken(eLName), bIWSOutside );
2598 : 13010 : }
2599 : :
2600 : 12 : SvXMLElementExport::SvXMLElementExport( SvXMLExport& rExp,
2601 : : const OUString& rQName,
2602 : : sal_Bool bIWSOutside,
2603 : : sal_Bool bIWSInside ) :
2604 : : rExport( rExp ),
2605 : : bIgnWS( bIWSInside ),
2606 : 12 : bDoSomething( sal_True )
2607 : : {
2608 : 12 : aName = rQName;
2609 [ + - ]: 12 : rExp.StartElement( rQName, bIWSOutside );
2610 : 12 : }
2611 : :
2612 : 45623 : SvXMLElementExport::~SvXMLElementExport()
2613 : : {
2614 [ + + ]: 45623 : if( bDoSomething )
2615 : : {
2616 [ + - ]: 33761 : rExport.EndElement( aName, bIgnWS );
2617 : : }
2618 : 45623 : }
2619 : :
2620 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|