1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sdxmlwrp.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
33 #include <rtl/logfile.hxx>
34 #include <com/sun/star/container/XChild.hpp>
35 #include <com/sun/star/beans/XPropertySetInfo.hpp>
36 #include <com/sun/star/embed/ElementModes.hpp>
37 #include <com/sun/star/xml/sax/SAXParseException.hdl>
38 #include <comphelper/processfactory.hxx>
39 #include <sfx2/docfile.hxx>
40 #include <sfx2/docfilt.hxx>
41 #include <tools/urlobj.hxx>
42 #include "drawdoc.hxx"
43 #include <unotools/streamwrap.hxx>
44 #include <svx/xmlgrhlp.hxx>
46 #include "../../ui/inc/DrawDocShell.hxx"
48 #include "sdxmlwrp.hxx"
50 #include <svx/xmleohlp.hxx>
51 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
52 #include <com/sun/star/document/XFilter.hpp>
53 #include <com/sun/star/document/XImporter.hpp>
54 #include <com/sun/star/document/XExporter.hpp>
55 #include <com/sun/star/lang/XServiceInfo.hpp>
56 #include <com/sun/star/document/XGraphicObjectResolver.hpp>
57 #include <com/sun/star/beans/PropertyAttribute.hpp>
58 #include <com/sun/star/container/XNameAccess.hpp>
59 #include <com/sun/star/packages/zip/ZipIOException.hpp>
61 #include <com/sun/star/xml/sax/XErrorHandler.hpp>
62 #include <com/sun/star/xml/sax/XEntityResolver.hpp>
63 #include <com/sun/star/xml/sax/InputSource.hpp>
64 #include <com/sun/star/xml/sax/XDTDHandler.hpp>
65 #include <com/sun/star/xml/sax/XParser.hpp>
66 #include <com/sun/star/io/XActiveDataSource.hpp>
67 #include <com/sun/star/io/XActiveDataControl.hpp>
68 #include <comphelper/genericpropertyset.hxx>
69 #include <comphelper/propertysetinfo.hxx>
70 #include <svtools/saveopt.hxx>
72 // #80365# include necessary for XML progress bar at load time
73 #include <svtools/itemset.hxx>
74 #include <svtools/stritem.hxx>
75 #include <svtools/sfxecode.hxx>
77 #include "sderror.hxx"
78 #include "sdresid.hxx"
81 #include <sfx2/frame.hxx>
84 using namespace com::sun::star
;
85 using namespace com::sun::star::uno
;
86 using namespace com::sun::star::lang
;
87 using namespace com::sun::star::document
;
88 using namespace comphelper
;
90 #define SD_XML_READERROR 1234
92 extern void TransformOOo2xDocument( SdDrawDocument
* pDocument
);
94 //////////////////////////////////////////////////////////////////////////////
97 #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
98 #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x ))
100 #define SEQTYPE(x) &(x)
104 #define MAP_LEN(x) x, sizeof(x) - 1
106 #define XML_STRING(i, x) sal_Char __READONLY_DATA i[sizeof(x)] = x
108 XML_STRING( sXML_metaStreamName
, "meta.xml");
109 XML_STRING( sXML_styleStreamName
, "styles.xml" );
110 XML_STRING( sXML_contentStreamName
, "content.xml" );
111 XML_STRING( sXML_oldContentStreamName
, "Content.xml" );
112 XML_STRING( sXML_settingsStreamName
, "settings.xml" );
114 XML_STRING( sXML_export_impress_oasis_service
, "com.sun.star.comp.Impress.XMLOasisExporter" );
115 XML_STRING( sXML_export_impress_meta_oasis_service
, "com.sun.star.comp.Impress.XMLOasisMetaExporter" );
116 XML_STRING( sXML_export_impress_styles_oasis_service
, "com.sun.star.comp.Impress.XMLOasisStylesExporter" );
117 XML_STRING( sXML_export_impress_content_oasis_service
, "com.sun.star.comp.Impress.XMLOasisContentExporter" );
118 XML_STRING( sXML_export_impress_settings_oasis_service
, "com.sun.star.comp.Impress.XMLOasisSettingsExporter" );
120 XML_STRING( sXML_export_draw_oasis_service
, "com.sun.star.comp.Draw.XMLOasisExporter" );
121 XML_STRING( sXML_export_draw_meta_oasis_service
, "com.sun.star.comp.Draw.XMLOasisMetaExporter" );
122 XML_STRING( sXML_export_draw_styles_oasis_service
, "com.sun.star.comp.Draw.XMLOasisStylesExporter" );
123 XML_STRING( sXML_export_draw_content_oasis_service
, "com.sun.star.comp.Draw.XMLOasisContentExporter" );
124 XML_STRING( sXML_export_draw_settings_oasis_service
, "com.sun.star.comp.Draw.XMLOasisSettingsExporter" );
126 XML_STRING( sXML_import_impress_oasis_service
, "com.sun.star.comp.Impress.XMLOasisImporter" );
127 XML_STRING( sXML_import_impress_meta_oasis_service
, "com.sun.star.comp.Impress.XMLOasisMetaImporter" );
128 XML_STRING( sXML_import_impress_styles_oasis_service
, "com.sun.star.comp.Impress.XMLOasisStylesImporter" );
129 XML_STRING( sXML_import_impress_content_oasis_service
, "com.sun.star.comp.Impress.XMLOasisContentImporter" );
130 XML_STRING( sXML_import_impress_settings_oasis_service
, "com.sun.star.comp.Impress.XMLOasisSettingsImporter" );
132 XML_STRING( sXML_import_draw_oasis_service
, "com.sun.star.comp.Draw.XMLOasisImporter" );
133 XML_STRING( sXML_import_draw_meta_oasis_service
, "com.sun.star.comp.Draw.XMLOasisMetaImporter" );
134 XML_STRING( sXML_import_draw_styles_oasis_service
, "com.sun.star.comp.Draw.XMLOasisStylesImporter" );
135 XML_STRING( sXML_import_draw_content_oasis_service
, "com.sun.star.comp.Draw.XMLOasisContentImporter" );
136 XML_STRING( sXML_import_draw_settings_oasis_service
, "com.sun.star.comp.Draw.XMLOasisSettingsImporter" );
139 XML_STRING( sXML_export_impress_ooo_service
, "com.sun.star.comp.Impress.XMLExporter" );
140 XML_STRING( sXML_export_impress_meta_ooo_service
, "com.sun.star.comp.Impress.XMLMetaExporter" );
141 XML_STRING( sXML_export_impress_styles_ooo_service
, "com.sun.star.comp.Impress.XMLStylesExporter" );
142 XML_STRING( sXML_export_impress_content_ooo_service
, "com.sun.star.comp.Impress.XMLContentExporter" );
143 XML_STRING( sXML_export_impress_settings_ooo_service
, "com.sun.star.comp.Impress.XMLSettingsExporter" );
145 XML_STRING( sXML_export_draw_ooo_service
, "com.sun.star.comp.Draw.XMLExporter" );
146 XML_STRING( sXML_export_draw_meta_ooo_service
, "com.sun.star.comp.Draw.XMLMetaExporter" );
147 XML_STRING( sXML_export_draw_styles_ooo_service
, "com.sun.star.comp.Draw.XMLStylesExporter" );
148 XML_STRING( sXML_export_draw_content_ooo_service
, "com.sun.star.comp.Draw.XMLContentExporter" );
149 XML_STRING( sXML_export_draw_settings_ooo_service
, "com.sun.star.comp.Draw.XMLSettingsExporter" );
151 XML_STRING( sXML_import_impress_ooo_service
, "com.sun.star.comp.Impress.XMLImporter" );
152 XML_STRING( sXML_import_impress_meta_ooo_service
, "com.sun.star.comp.Impress.XMLMetaImporter" );
153 XML_STRING( sXML_import_impress_styles_ooo_service
, "com.sun.star.comp.Impress.XMLStylesImporter" );
154 XML_STRING( sXML_import_impress_content_ooo_service
, "com.sun.star.comp.Impress.XMLContentImporter" );
155 XML_STRING( sXML_import_impress_settings_ooo_service
, "com.sun.star.comp.Impress.XMLSettingsImporter" );
157 XML_STRING( sXML_import_draw_ooo_service
, "com.sun.star.comp.Draw.XMLImporter" );
158 XML_STRING( sXML_import_draw_meta_ooo_service
, "com.sun.star.comp.Draw.XMLMetaImporter" );
159 XML_STRING( sXML_import_draw_styles_ooo_service
, "com.sun.star.comp.Draw.XMLStylesImporter" );
160 XML_STRING( sXML_import_draw_content_ooo_service
, "com.sun.star.comp.Draw.XMLContentImporter" );
161 XML_STRING( sXML_import_draw_settings_ooo_service
, "com.sun.star.comp.Draw.XMLSettingsImporter" );
163 struct XML_SERVICEMAP
165 const sal_Char
* mpService
;
166 const sal_Char
* mpStream
;
172 const sal_Char
* mpAll
;
173 const sal_Char
* mpMeta
;
174 const sal_Char
* mpStyles
;
175 const sal_Char
* mpContent
;
176 const sal_Char
* mpSettings
;
179 XML_SERVICES
* getServices( bool bImport
, bool bDraw
, ULONG nStoreVer
)
181 static XML_SERVICES gServices
[] =
183 { sXML_export_impress_oasis_service
, sXML_export_impress_meta_oasis_service
, sXML_export_impress_styles_oasis_service
, sXML_export_impress_content_oasis_service
, sXML_export_impress_settings_oasis_service
},
184 { sXML_export_draw_oasis_service
, sXML_export_draw_meta_oasis_service
, sXML_export_draw_styles_oasis_service
, sXML_export_draw_content_oasis_service
, sXML_export_draw_settings_oasis_service
},
185 { sXML_import_impress_oasis_service
, sXML_import_impress_meta_oasis_service
, sXML_import_impress_styles_oasis_service
, sXML_import_impress_content_oasis_service
, sXML_import_impress_settings_oasis_service
},
186 { sXML_import_draw_oasis_service
, sXML_import_draw_meta_oasis_service
, sXML_import_draw_styles_oasis_service
, sXML_import_draw_content_oasis_service
, sXML_import_draw_settings_oasis_service
},
188 { sXML_export_impress_ooo_service
, sXML_export_impress_meta_ooo_service
, sXML_export_impress_styles_ooo_service
, sXML_export_impress_content_ooo_service
, sXML_export_impress_settings_ooo_service
},
189 { sXML_export_draw_ooo_service
, sXML_export_draw_meta_ooo_service
, sXML_export_draw_styles_ooo_service
, sXML_export_draw_content_ooo_service
, sXML_export_draw_settings_ooo_service
},
190 { sXML_import_impress_ooo_service
, sXML_import_impress_meta_ooo_service
, sXML_import_impress_styles_ooo_service
, sXML_import_impress_content_ooo_service
, sXML_import_impress_settings_ooo_service
},
191 { sXML_import_draw_ooo_service
, sXML_import_draw_meta_ooo_service
, sXML_import_draw_styles_ooo_service
, sXML_import_draw_content_ooo_service
, sXML_import_draw_settings_ooo_service
},
194 return &gServices
[ (bImport
? 2 : 0) + ((nStoreVer
== SOFFICE_FILEFORMAT_60
) ? 4 : 0) + (bDraw
? 1 : 0 ) ];
202 SdXMLFilter::SdXMLFilter( SfxMedium
& rMedium
, ::sd::DrawDocShell
& rDocShell
, sal_Bool bShowProgress
, SdXMLFilterMode eFilterMode
, ULONG nStoreVer
) :
203 SdFilter( rMedium
, rDocShell
, bShowProgress
), meFilterMode( eFilterMode
), mnStoreVer( nStoreVer
)
207 SdXMLFilter::~SdXMLFilter(void)
211 sal_Int32
ReadThroughComponent(
212 Reference
<io::XInputStream
> xInputStream
,
213 Reference
<XComponent
> xModelComponent
,
214 const String
& rStreamName
,
215 Reference
<lang::XMultiServiceFactory
> & rFactory
,
216 const sal_Char
* pFilterName
,
217 Sequence
<Any
> rFilterArguments
,
218 const OUString
& rName
,
219 sal_Bool bMustBeSuccessfull
,
220 sal_Bool bEncrypted
)
222 DBG_ASSERT(xInputStream
.is(), "input stream missing");
223 DBG_ASSERT(xModelComponent
.is(), "document missing");
224 DBG_ASSERT(rFactory
.is(), "factory missing");
225 DBG_ASSERT(NULL
!= pFilterName
,"I need a service name for the component!");
227 RTL_LOGFILE_CONTEXT( aLog
, "ReadThroughComponent" );
229 // prepare ParserInputSrouce
230 xml::sax::InputSource aParserInput
;
231 aParserInput
.sSystemId
= rName
;
232 aParserInput
.aInputStream
= xInputStream
;
235 Reference
< xml::sax::XParser
> xParser(
236 rFactory
->createInstance(
237 OUString::createFromAscii("com.sun.star.xml.sax.Parser") ),
239 DBG_ASSERT( xParser
.is(), "Can't create parser" );
241 return SD_XML_READERROR
;
242 RTL_LOGFILE_CONTEXT_TRACE( aLog
, "parser created" );
245 Reference
< xml::sax::XDocumentHandler
> xFilter(
246 rFactory
->createInstanceWithArguments(
247 OUString::createFromAscii(pFilterName
), rFilterArguments
),
249 DBG_ASSERT( xFilter
.is(), "Can't instantiate filter component." );
251 return SD_XML_READERROR
;
252 RTL_LOGFILE_CONTEXT_TRACE1( aLog
, "%s created", pFilterName
);
254 // connect parser and filter
255 xParser
->setDocumentHandler( xFilter
);
257 // connect model and filter
258 Reference
< XImporter
> xImporter( xFilter
, UNO_QUERY
);
259 xImporter
->setTargetDocument( xModelComponent
);
260 // finally, parser the stream
261 RTL_LOGFILE_CONTEXT_TRACE( aLog
, "parsing stream" );
264 xParser
->parseStream( aParserInput
);
266 catch( xml::sax::SAXParseException
& r
)
268 // sax parser sends wrapped exceptions,
269 // try to find the original one
270 xml::sax::SAXException aSaxEx
= *(xml::sax::SAXException
*)(&r
);
271 sal_Bool bTryChild
= sal_True
;
275 xml::sax::SAXException aTmp
;
276 if ( aSaxEx
.WrappedException
>>= aTmp
)
279 bTryChild
= sal_False
;
282 packages::zip::ZipIOException aBrokenPackage
;
283 if ( aSaxEx
.WrappedException
>>= aBrokenPackage
)
284 return ERRCODE_IO_BROKENPACKAGE
;
287 return ERRCODE_SFX_WRONGPASSWORD
;
289 #if OSL_DEBUG_LEVEL > 1
290 ByteString
aError( "SAX parse exception catched while importing:\n" );
291 aError
+= ByteString( String( r
.Message
), RTL_TEXTENCODING_ASCII_US
);
292 DBG_ERROR( aError
.GetBuffer() );
295 String
sErr( String::CreateFromInt32( r
.LineNumber
));
297 sErr
+= String::CreateFromInt32( r
.ColumnNumber
);
299 if( rStreamName
.Len() )
301 return *new TwoStringErrorInfo(
302 (bMustBeSuccessfull
? ERR_FORMAT_FILE_ROWCOL
303 : WARN_FORMAT_FILE_ROWCOL
),
305 ERRCODE_BUTTON_OK
| ERRCODE_MSG_ERROR
);
309 DBG_ASSERT( bMustBeSuccessfull
, "Warnings are not supported" );
310 return *new StringErrorInfo( ERR_FORMAT_ROWCOL
, sErr
,
311 ERRCODE_BUTTON_OK
| ERRCODE_MSG_ERROR
);
314 catch( xml::sax::SAXException
& r
)
316 packages::zip::ZipIOException aBrokenPackage
;
317 if ( r
.WrappedException
>>= aBrokenPackage
)
318 return ERRCODE_IO_BROKENPACKAGE
;
321 return ERRCODE_SFX_WRONGPASSWORD
;
323 #if OSL_DEBUG_LEVEL > 1
324 ByteString
aError( "SAX exception catched while importing:\n" );
325 aError
+= ByteString( String( r
.Message
), RTL_TEXTENCODING_ASCII_US
);
326 DBG_ERROR( aError
.GetBuffer() );
328 return SD_XML_READERROR
;
330 catch( packages::zip::ZipIOException
& r
)
333 #if OSL_DEBUG_LEVEL > 1
334 ByteString
aError( "Zip exception catched while importing:\n" );
335 aError
+= ByteString( String( r
.Message
), RTL_TEXTENCODING_ASCII_US
);
336 DBG_ERROR( aError
.GetBuffer() );
338 return ERRCODE_IO_BROKENPACKAGE
;
340 catch( io::IOException
& r
)
343 #if OSL_DEBUG_LEVEL > 1
344 ByteString
aError( "IO exception catched while importing:\n" );
345 aError
+= ByteString( String( r
.Message
), RTL_TEXTENCODING_ASCII_US
);
346 DBG_ERROR( aError
.GetBuffer() );
348 return SD_XML_READERROR
;
350 catch( uno::Exception
& r
)
353 #if OSL_DEBUG_LEVEL > 1
354 ByteString
aError( "uno exception catched while importing:\n" );
355 aError
+= ByteString( String( r
.Message
), RTL_TEXTENCODING_ASCII_US
);
356 DBG_ERROR( aError
.GetBuffer() );
358 return SD_XML_READERROR
;
365 sal_Int32
ReadThroughComponent(
366 const uno::Reference
< embed::XStorage
>& xStorage
,
367 Reference
<XComponent
> xModelComponent
,
368 const sal_Char
* pStreamName
,
369 const sal_Char
* pCompatibilityStreamName
,
370 Reference
<lang::XMultiServiceFactory
> & rFactory
,
371 const sal_Char
* pFilterName
,
372 Sequence
<Any
> rFilterArguments
,
373 const OUString
& rName
,
374 sal_Bool bMustBeSuccessfull
)
376 DBG_ASSERT(xStorage
.is(), "Need storage!");
377 DBG_ASSERT(NULL
!= pStreamName
, "Please, please, give me a name!");
379 // open stream (and set parser input)
380 OUString sStreamName
= OUString::createFromAscii(pStreamName
);
381 sal_Bool bContainsStream
= sal_False
;
384 bContainsStream
= xStorage
->isStreamElement(sStreamName
);
386 catch( container::NoSuchElementException
& )
390 if (!bContainsStream
)
392 // stream name not found! Then try the compatibility name.
393 // if no stream can be opened, return immediatly with OK signal
395 // do we even have an alternative name?
396 if ( NULL
== pCompatibilityStreamName
)
399 // if so, does the stream exist?
400 sStreamName
= OUString::createFromAscii(pCompatibilityStreamName
);
403 bContainsStream
= xStorage
->isStreamElement(sStreamName
);
405 catch( container::NoSuchElementException
& )
409 if (! bContainsStream
)
414 uno::Reference
< beans::XPropertySet
> xInfoSet
;
415 if( rFilterArguments
.getLength() > 0 )
416 rFilterArguments
.getConstArray()[0] >>= xInfoSet
;
417 DBG_ASSERT( xInfoSet
.is(), "missing property set" );
420 OUString
sPropName( RTL_CONSTASCII_USTRINGPARAM("StreamName") );
421 xInfoSet
->setPropertyValue( sPropName
, makeAny( sStreamName
) );
427 Reference
<io::XStream
> xStream
=
428 xStorage
->openStreamElement( sStreamName
, embed::ElementModes::READ
);
429 Reference
<beans::XPropertySet
> xProps( xStream
, uno::UNO_QUERY
);
430 if ( !xStream
.is() || ! xProps
.is() )
431 return SD_XML_READERROR
;
433 Any aAny
= xProps
->getPropertyValue(
434 OUString( RTL_CONSTASCII_USTRINGPARAM("Encrypted") ) );
436 sal_Bool bEncrypted
= aAny
.getValueType() == ::getBooleanCppuType() &&
437 *(sal_Bool
*)aAny
.getValue();
439 Reference
<io::XInputStream
> xInputStream
= xStream
->getInputStream();
441 // read from the stream
442 return ReadThroughComponent(
443 xInputStream
, xModelComponent
, sStreamName
, rFactory
,
444 pFilterName
, rFilterArguments
,
445 rName
, bMustBeSuccessfull
, bEncrypted
);
447 catch ( packages::WrongPasswordException
& )
449 return ERRCODE_SFX_WRONGPASSWORD
;
451 catch( packages::zip::ZipIOException
& )
453 return ERRCODE_IO_BROKENPACKAGE
;
455 catch ( uno::Exception
& )
458 return SD_XML_READERROR
;
461 // -----------------------------------------------------------------------------
463 sal_Bool
SdXMLFilter::Import( ErrCode
& nError
)
465 RTL_LOGFILE_CONTEXT_AUTHOR ( aLog
, "sd", "cl93746", "SdXMLFilter::Import" );
467 ByteString
aFile( mrMedium
.GetName(), RTL_TEXTENCODING_ASCII_US
);
468 RTL_LOGFILE_CONTEXT_TRACE1( aLog
, "importing %s", aFile
.GetBuffer() );
473 // Get service factory
474 Reference
< lang::XMultiServiceFactory
> xServiceFactory
=
475 comphelper::getProcessServiceFactory();
476 DBG_ASSERT( xServiceFactory
.is(),
477 "XMLReader::Read: got no service manager" );
478 if( !xServiceFactory
.is() )
481 // -------------------------------------
483 SdDrawDocument
* pDoc
= mrDocShell
.GetDoc();
484 pDoc
->EnableUndo(false);
485 pDoc
->NewOrLoadCompleted( NEW_DOC
);
486 pDoc
->CreateFirstPages();
487 pDoc
->StopWorkStartupDelay();
489 // -------------------------------------
491 mxModel
->lockControllers();
493 // -------------------------------------
495 /** property map for export info set */
496 PropertyMapEntry aImportInfoMap
[] =
498 // #80365# necessary properties for XML progress bar at load time
499 { MAP_LEN( "ProgressRange" ), 0, &::getCppuType((const sal_Int32
*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0},
500 { MAP_LEN( "ProgressMax" ), 0, &::getCppuType((const sal_Int32
*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0},
501 { MAP_LEN( "ProgressCurrent" ), 0, &::getCppuType((const sal_Int32
*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0},
502 { MAP_LEN( "Preview" ), 0, &::getCppuType((const sal_Bool
*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0},
503 { MAP_LEN( "PageLayouts" ), 0, SEQTYPE(::getCppuType((const uno::Reference
< container::XNameAccess
>*)0)), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0},
504 { MAP_LEN( "PrivateData" ), 0,
505 &::getCppuType( (Reference
<XInterface
> *)0 ),
506 ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0 },
507 { MAP_LEN( "BaseURI" ), 0,
508 &::getCppuType( (OUString
*)0 ),
509 ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0 },
510 { MAP_LEN( "StreamRelPath" ), 0,
511 &::getCppuType( (OUString
*)0 ),
512 ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0 },
513 { MAP_LEN( "StreamName" ), 0,
514 &::getCppuType( (OUString
*)0 ),
515 ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0 },
516 { MAP_LEN( "BuildId" ), 0,
517 &::getCppuType( (OUString
*)0 ),
518 ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0 },
519 { NULL
, 0, 0, NULL
, 0, 0 }
522 uno::Reference
< beans::XPropertySet
> xInfoSet( GenericPropertySet_CreateInstance( new PropertySetInfo( aImportInfoMap
) ) );
523 xInfoSet
->setPropertyValue( OUString::createFromAscii( "Preview" ), uno::makeAny( mrDocShell
.GetDoc()->IsStarDrawPreviewMode() ) );
525 // ---- get BuildId from parent container if available
527 uno::Reference
< container::XChild
> xChild( mxModel
, uno::UNO_QUERY
);
530 uno::Reference
< beans::XPropertySet
> xParentSet( xChild
->getParent(), uno::UNO_QUERY
);
531 if( xParentSet
.is() )
533 uno::Reference
< beans::XPropertySetInfo
> xPropSetInfo( xParentSet
->getPropertySetInfo() );
534 OUString
sPropName( RTL_CONSTASCII_USTRINGPARAM("BuildId" ) );
535 if( xPropSetInfo
.is() && xPropSetInfo
->hasPropertyByName(sPropName
) )
537 xInfoSet
->setPropertyValue( sPropName
, xParentSet
->getPropertyValue(sPropName
) );
542 // -------------------------------------
544 Reference
< io::XActiveDataSource
> xSource
;
545 Reference
< XInterface
> xPipe
;
546 Reference
< document::XGraphicObjectResolver
> xGraphicResolver
;
547 SvXMLGraphicHelper
*pGraphicHelper
= 0;
548 Reference
< document::XEmbeddedObjectResolver
> xObjectResolver
;
549 SvXMLEmbeddedObjectHelper
*pObjectHelper
= 0;
551 Reference
< lang::XComponent
> xModelComp( mxModel
, uno::UNO_QUERY
);
553 // -------------------------------------
555 // #80365# try to get an XStatusIndicator from the Medium
558 SfxItemSet
* pSet
= mrMedium
.GetItemSet();
561 const SfxUnoAnyItem
* pItem
= static_cast<const SfxUnoAnyItem
*>(
562 pSet
->GetItem(SID_PROGRESS_STATUSBAR_CONTROL
) );
565 pItem
->GetValue() >>= mxStatusIndicator
;
569 if(mxStatusIndicator
.is())
571 sal_Int32
nProgressRange(1000000);
572 sal_Int32
nProgressCurrent(0);
573 OUString aMsg
= String( SdResId( STR_LOAD_DOC
) );
574 mxStatusIndicator
->start(aMsg
, nProgressRange
);
578 aProgRange
<<= nProgressRange
;
579 xInfoSet
->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ProgressRange")), aProgRange
);
581 // set ProgressCurrent
582 uno::Any aProgCurrent
;
583 aProgCurrent
<<= nProgressCurrent
;
584 xInfoSet
->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ProgressCurrent")), aProgCurrent
);
588 // -------------------------------------
589 // get the input stream (storage or stream)
590 // -------------------------------------
592 SvStorageStreamRef xDocStream
;
593 Reference
<io::XInputStream
> xInputStream
;
594 uno::Reference
< embed::XStorage
> xStorage
= mrMedium
.GetStorage();
597 nRet
= SD_XML_READERROR
;
601 pGraphicHelper
= SvXMLGraphicHelper::Create( xStorage
,
602 GRAPHICHELPER_MODE_READ
,
604 xGraphicResolver
= pGraphicHelper
;
605 pObjectHelper
= SvXMLEmbeddedObjectHelper::Create(
606 xStorage
, *pDoc
->GetPersist(),
607 EMBEDDEDOBJECTHELPER_MODE_READ
,
609 xObjectResolver
= pObjectHelper
;
613 const OUString
sBaseURI( RTL_CONSTASCII_USTRINGPARAM("BaseURI") );
614 xInfoSet
->setPropertyValue( sBaseURI
, makeAny( mrMedium
.GetBaseURL() ) );
616 if( 0 == nRet
&& SFX_CREATE_MODE_EMBEDDED
== mrDocShell
.GetCreateMode() )
619 if ( mrMedium
.GetItemSet() )
621 const SfxStringItem
* pDocHierarchItem
= static_cast<const SfxStringItem
*>(
622 mrMedium
.GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME
) );
623 if ( pDocHierarchItem
)
624 aName
= pDocHierarchItem
->GetValue();
627 aName
= ::rtl::OUString::createFromAscii( "dummyObjectName" );
629 if( aName
.getLength() )
631 const OUString
sStreamRelPath(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath"));
632 xInfoSet
->setPropertyValue( sStreamRelPath
, Any( aName
) );
636 // -------------------------------------
641 // prepare filter arguments
642 Sequence
<Any
> aFilterArgs( 4 );
643 Any
*pArgs
= aFilterArgs
.getArray();
644 *pArgs
++ <<= xInfoSet
;
645 *pArgs
++ <<= xGraphicResolver
;
646 *pArgs
++ <<= xObjectResolver
;
647 *pArgs
++ <<= mxStatusIndicator
;
649 Sequence
<Any
> aEmptyArgs( 2 );
650 pArgs
= aEmptyArgs
.getArray();
651 *pArgs
++ <<= xInfoSet
;
652 *pArgs
++ <<= mxStatusIndicator
;
654 const OUString
aName( mrMedium
.GetName() );
656 XML_SERVICES
* pServices
= getServices( true, IsDraw(), mnStoreVer
);
658 sal_uInt32 nWarn
= 0;
659 sal_uInt32 nWarn2
= 0;
660 // read storage streams
661 if( meFilterMode
!= SDXMLMODE_Organizer
)
663 nWarn
= ReadThroughComponent(
664 xStorage
, xModelComp
, "meta.xml", "Meta.xml", xServiceFactory
,
666 aEmptyArgs
, aName
, sal_False
);
668 nWarn2
= ReadThroughComponent(
669 xStorage
, xModelComp
, "settings.xml", NULL
, xServiceFactory
,
670 pServices
->mpSettings
,
671 aFilterArgs
, aName
, sal_False
);
674 nRet
= ReadThroughComponent(
675 xStorage
, xModelComp
, "styles.xml", NULL
, xServiceFactory
,
677 aFilterArgs
, aName
, sal_True
);
679 if( !nRet
&& (meFilterMode
!= SDXMLMODE_Organizer
) )
680 nRet
= ReadThroughComponent(
681 xStorage
, xModelComp
, "content.xml", "Content.xml", xServiceFactory
,
682 pServices
->mpContent
,
683 aFilterArgs
, aName
, sal_True
);
694 // -------------------------------------
696 SvXMLGraphicHelper::Destroy( pGraphicHelper
);
697 xGraphicResolver
= 0;
699 SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper
);
702 if( mxStatusIndicator
.is() )
703 mxStatusIndicator
->end();
706 mxModel
->unlockControllers();
709 pDoc
->UpdateAllLinks();
714 // case ERRCODE_SFX_WRONGPASSWORD: break;
715 case SD_XML_READERROR
: break;
716 case ERRCODE_IO_BROKENPACKAGE
:
719 nError
= ERRCODE_IO_BROKENPACKAGE
;
722 // fall through intented
725 // TODO/LATER: this is completely wrong! Filter code should never call ErrorHandler directly!
726 ErrorHandler::HandleError( nRet
);
727 if( IsWarning( nRet
) )
733 // clear unused named items from item pool
735 uno::Reference
< lang::XMultiServiceFactory
> xModelFactory( mxModel
, uno::UNO_QUERY
);
736 if( xModelFactory
.is() )
740 const OUString
aName( RTL_CONSTASCII_USTRINGPARAM( "~clear~" ) );
741 uno::Reference
< container::XNameContainer
> xGradient( xModelFactory
->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable") ) ), uno::UNO_QUERY
);
743 xGradient
->removeByName( aName
);
745 uno::Reference
< container::XNameContainer
> xHatch( xModelFactory
->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.HatchTable") ) ), uno::UNO_QUERY
);
747 xHatch
->removeByName( aName
);
749 uno::Reference
< container::XNameContainer
> xBitmap( xModelFactory
->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.BitmapTable") ) ), uno::UNO_QUERY
);
751 xBitmap
->removeByName( aName
);
753 uno::Reference
< container::XNameContainer
> xTransGradient( xModelFactory
->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TransparencyGradientTable") ) ), uno::UNO_QUERY
);
754 if( xTransGradient
.is() )
755 xTransGradient
->removeByName( aName
);
757 uno::Reference
< container::XNameContainer
> xMarker( xModelFactory
->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MarkerTable") ) ), uno::UNO_QUERY
);
759 xMarker
->removeByName( aName
);
761 uno::Reference
< container::XNameContainer
> xDashes( xModelFactory
->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable") ) ), uno::UNO_QUERY
);
763 xDashes
->removeByName( aName
);
767 DBG_ERROR("sd::SdXMLFilter::Import(), exception during clearing of unused named items");
771 // set BuildId on XModel for later OLE object loading
774 uno::Reference
< beans::XPropertySet
> xModelSet( mxModel
, uno::UNO_QUERY
);
777 uno::Reference
< beans::XPropertySetInfo
> xModelSetInfo( xModelSet
->getPropertySetInfo() );
778 const OUString
sPropName( RTL_CONSTASCII_USTRINGPARAM("BuildId" ) );
781 xInfoSet
->getPropertyValue(sPropName
) >>= sBuildId
;
783 if( xModelSetInfo
.is() && xModelSetInfo
->hasPropertyByName(sPropName
) )
785 xModelSet
->setPropertyValue( sPropName
, Any( sBuildId
) );
788 bool bTransform
= false;
792 if( sBuildId
.getLength() )
794 sal_Int32 nIndex
= sBuildId
.indexOf('$');
797 sal_Int32 nUPD
= sBuildId
.copy( 0, nIndex
).toInt32();
801 sal_Int32 nBuildId
= sBuildId
.copy( nIndex
+1 ).toInt32();
802 if( (nBuildId
> 0) && (nBuildId
< 9316) )
803 bTransform
= true; // treat OOo 3.0 beta1 as OOo 2.x
805 else if( (nUPD
== 680) || ( nUPD
>= 640 && nUPD
<= 645 ) )
811 // check for binary formats
812 const SfxFilter
* pFilter
= mrMedium
.GetFilter();
815 const String
& rTypeName
= pFilter
->GetRealTypeName();
817 if( (rTypeName
.CompareToAscii( RTL_CONSTASCII_STRINGPARAM("impress_StarImpress" ) ) == 0) ||
818 (rTypeName
.CompareToAscii( RTL_CONSTASCII_STRINGPARAM("draw_StarDraw" ) ) == 0) )
827 TransformOOo2xDocument( pDoc
);
831 pDoc
->EnableUndo(true);
832 mrDocShell
.ClearUndoBuffer();
836 // -----------------------------------------------------------------------------
838 sal_Bool
SdXMLFilter::Export()
841 RTL_LOGFILE_CONTEXT_AUTHOR ( aLog
, "sd", "cl93746", "SdXMLFilter::Export" );
842 ByteString
aFile( mrMedium
.GetName(), RTL_TEXTENCODING_ASCII_US
);
843 RTL_LOGFILE_CONTEXT_TRACE1( aLog
, "exporting %s", aFile
.GetBuffer() );
846 SvXMLEmbeddedObjectHelper
* pObjectHelper
= NULL
;
847 SvXMLGraphicHelper
* pGraphicHelper
= NULL
;
848 sal_Bool bDocRet
= FALSE
;
852 DBG_ERROR("Got NO Model in XMLExport");
856 sal_Bool bLocked
= mxModel
->hasControllersLocked();
860 mxModel
->lockControllers();
862 uno::Reference
< lang::XServiceInfo
> xServiceInfo( mxModel
, uno::UNO_QUERY
);
864 if( !xServiceInfo
.is() || !xServiceInfo
->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GenericDrawingDocument" ) ) ) )
866 DBG_ERROR( "Model is no DrawingDocument in XMLExport" );
870 uno::Reference
< lang::XMultiServiceFactory
> xServiceFactory( ::comphelper::getProcessServiceFactory() );
872 if( !xServiceFactory
.is() )
874 DBG_ERROR( "got no service manager" );
878 uno::Reference
< uno::XInterface
> xWriter( xServiceFactory
->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" ) ) ) );
882 DBG_ERROR( "com.sun.star.xml.sax.Writer service missing" );
885 uno::Reference
<xml::sax::XDocumentHandler
> xHandler( xWriter
, uno::UNO_QUERY
);
887 /** property map for export info set */
888 PropertyMapEntry aExportInfoMap
[] =
891 { MAP_LEN( "ProgressRange" ), 0, &::getCppuType((const sal_Int32
*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0},
892 { MAP_LEN( "ProgressMax" ), 0, &::getCppuType((const sal_Int32
*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0},
893 { MAP_LEN( "ProgressCurrent" ), 0, &::getCppuType((const sal_Int32
*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0},
894 { MAP_LEN( "UsePrettyPrinting"),0, &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0},
895 { MAP_LEN( "GenerousListLevels"),0, &::getBooleanCppuType(), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0},
897 { MAP_LEN( "PageLayoutNames" ), 0, SEQTYPE(::getCppuType((const OUString
*)0)), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0},
898 { MAP_LEN( "BaseURI" ), 0,
899 &::getCppuType( (OUString
*)0 ),
900 ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0 },
901 { MAP_LEN( "StreamRelPath" ), 0,
902 &::getCppuType( (OUString
*)0 ),
903 ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0 },
904 { MAP_LEN( "StreamName" ), 0,
905 &::getCppuType( (OUString
*)0 ),
906 ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0 },
907 { MAP_LEN( "StyleNames" ), 0,
908 &::getCppuType( (Sequence
<OUString
>*)0 ),
909 ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0 },
910 { MAP_LEN( "StyleFamilies" ), 0,
911 &::getCppuType( (Sequence
<sal_Int32
>*)0 ),
912 ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0 },
913 { MAP_LEN( "TargetStorage" ), 0, &embed::XStorage::static_type(),
914 ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
, 0 },
916 { NULL
, 0, 0, NULL
, 0, 0 }
919 uno::Reference
< beans::XPropertySet
> xInfoSet( GenericPropertySet_CreateInstance( new PropertySetInfo( aExportInfoMap
) ) );
922 SvtSaveOptions aSaveOpt
;
923 OUString
sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting"));
924 sal_Bool
bUsePrettyPrinting( aSaveOpt
.IsPrettyPrinting() );
925 xInfoSet
->setPropertyValue( sUsePrettyPrinting
, makeAny( bUsePrettyPrinting
) );
927 OUString
sGenerousListLevels(RTL_CONSTASCII_USTRINGPARAM("GenerousListLevels"));
928 xInfoSet
->setPropertyValue( sGenerousListLevels
, makeAny( true ) );
930 const uno::Reference
< embed::XStorage
>& xStorage
= mrMedium
.GetOutputStorage();
933 OUString
sPropName( RTL_CONSTASCII_USTRINGPARAM("BaseURI") );
934 xInfoSet
->setPropertyValue( sPropName
, makeAny( mrMedium
.GetBaseURL( true ) ) );
936 OUString
sTargetStorage( RTL_CONSTASCII_USTRINGPARAM("TargetStorage") );
937 xInfoSet
->setPropertyValue( sTargetStorage
, Any( xStorage
) );
939 if( SFX_CREATE_MODE_EMBEDDED
== mrDocShell
.GetCreateMode() )
942 if ( mrMedium
.GetItemSet() )
944 const SfxStringItem
* pDocHierarchItem
= static_cast<const SfxStringItem
*>(
945 mrMedium
.GetItemSet()->GetItem(SID_DOC_HIERARCHICALNAME
) );
946 if ( pDocHierarchItem
)
947 aName
= pDocHierarchItem
->GetValue();
950 if( aName
.getLength() )
952 sPropName
= OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath"));
953 xInfoSet
->setPropertyValue( sPropName
, makeAny( aName
) );
957 // initialize descriptor
958 uno::Sequence
< beans::PropertyValue
> aDescriptor( 1 );
959 beans::PropertyValue
* pProps
= aDescriptor
.getArray();
961 pProps
[0].Name
= OUString( RTL_CONSTASCII_USTRINGPARAM( "FileName" ) );
962 pProps
[0].Value
<<= OUString( mrMedium
.GetName() );
965 uno::Reference
< document::XEmbeddedObjectResolver
> xObjectResolver
;
966 uno::Reference
< document::XGraphicObjectResolver
> xGrfResolver
;
968 // create helper for graphic and ole export if we have a storage
971 pObjectHelper
= SvXMLEmbeddedObjectHelper::Create( xStorage
, *mrDocShell
.GetDoc()->GetPersist(), EMBEDDEDOBJECTHELPER_MODE_WRITE
, sal_False
);
972 xObjectResolver
= pObjectHelper
;
974 pGraphicHelper
= SvXMLGraphicHelper::Create( xStorage
, GRAPHICHELPER_MODE_WRITE
, FALSE
);
975 xGrfResolver
= pGraphicHelper
;
981 CreateStatusIndicator();
982 if(mxStatusIndicator
.is())
984 sal_Int32
nProgressRange(1000000);
985 sal_Int32
nProgressCurrent(0);
986 OUString aMsg
= String( SdResId( STR_SAVE_DOC
) );
987 mxStatusIndicator
->start(aMsg
, nProgressRange
);
991 aProgRange
<<= nProgressRange
;
992 xInfoSet
->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ProgressRange")), aProgRange
);
994 // set ProgressCurrent
995 uno::Any aProgCurrent
;
996 aProgCurrent
<<= nProgressCurrent
;
997 xInfoSet
->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ProgressCurrent")), aProgCurrent
);
1001 uno::Reference
< lang::XComponent
> xComponent( mxModel
, uno::UNO_QUERY
);
1003 XML_SERVICES
* pServiceNames
= getServices( false, IsDraw(), mnStoreVer
);
1005 XML_SERVICEMAP aServices
[5]; sal_uInt16 i
= 0;
1006 aServices
[i
].mpService
= pServiceNames
->mpStyles
;
1007 aServices
[i
].mpStream
= sXML_styleStreamName
;
1008 aServices
[i
++].mbPlain
= sal_False
;
1010 aServices
[i
].mpService
= pServiceNames
->mpContent
;
1011 aServices
[i
].mpStream
= sXML_contentStreamName
;
1012 aServices
[i
++].mbPlain
= sal_False
;
1014 aServices
[i
].mpService
= pServiceNames
->mpSettings
;
1015 aServices
[i
].mpStream
= sXML_settingsStreamName
;
1016 aServices
[i
++].mbPlain
= sal_False
;
1018 if( mrDocShell
.GetCreateMode() != SFX_CREATE_MODE_EMBEDDED
)
1020 aServices
[i
].mpService
= pServiceNames
->mpMeta
;
1021 aServices
[i
].mpStream
= sXML_metaStreamName
;
1022 aServices
[i
++].mbPlain
= sal_True
;
1025 aServices
[i
].mpService
= NULL
;
1026 aServices
[i
].mpStream
= NULL
;
1028 XML_SERVICEMAP
* pServices
= aServices
;
1033 RTL_LOGFILE_CONTEXT_TRACE1( aLog
, "exporting substream %s", pServices
->mpStream
);
1035 uno::Reference
<io::XOutputStream
> xDocOut
;
1038 const OUString
sDocName( OUString::createFromAscii( pServices
->mpStream
) );
1039 uno::Reference
<io::XStream
> xStream
=
1040 xStorage
->openStreamElement( sDocName
,
1041 embed::ElementModes::READWRITE
| embed::ElementModes::TRUNCATE
);
1043 DBG_ASSERT(xStream
.is(), "Can't create output stream in package!");
1047 xDocOut
= xStream
->getOutputStream();
1048 Reference
<beans::XPropertySet
> xProps( xStream
, uno::UNO_QUERY
);
1049 if( !xDocOut
.is() || !xProps
.is() )
1052 uno::Any aAny
; aAny
<<= OUString( RTL_CONSTASCII_USTRINGPARAM("text/xml") );
1053 xProps
->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), aAny
);
1055 OUString
aUseCommonPassPropName( RTL_CONSTASCII_USTRINGPARAM("UseCommonStoragePasswordEncryption") );
1056 if( pServices
->mbPlain
)
1057 xProps
->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Compressed") ), uno::makeAny( (sal_Bool
) sal_False
) );
1058 // if the document is encrypted even the plain streams should be encrypted
1059 xProps
->setPropertyValue( aUseCommonPassPropName
, uno::makeAny( (sal_Bool
)sal_True
) );
1061 const OUString
sStreamName( RTL_CONSTASCII_USTRINGPARAM("StreamName") );
1062 xInfoSet
->setPropertyValue( sStreamName
, Any( sDocName
) );
1065 uno::Reference
< io::XActiveDataSource
> xDocSrc( xWriter
, uno::UNO_QUERY
);
1066 xDocSrc
->setOutputStream( xDocOut
);
1068 uno::Sequence
< uno::Any
> aArgs( 2 + ( mxStatusIndicator
.is() ? 1 : 0 ) + ( xGrfResolver
.is() ? 1 : 0 ) + ( xObjectResolver
.is() ? 1 : 0 ) );
1069 uno::Any
* pArgs
= aArgs
.getArray();
1070 *pArgs
++ <<= xInfoSet
;
1071 if( xGrfResolver
.is() ) *pArgs
++ <<= xGrfResolver
;
1072 if( xObjectResolver
.is() ) *pArgs
++ <<= xObjectResolver
;
1073 if( mxStatusIndicator
.is() ) *pArgs
++ <<= mxStatusIndicator
;
1075 *pArgs
<<= xHandler
;
1077 uno::Reference
< document::XFilter
> xFilter( xServiceFactory
->createInstanceWithArguments( OUString::createFromAscii( pServices
->mpService
), aArgs
), uno::UNO_QUERY
);
1080 uno::Reference
< document::XExporter
> xExporter( xFilter
, uno::UNO_QUERY
);
1081 if( xExporter
.is() )
1083 xExporter
->setSourceDocument( xComponent
);
1084 // outputstream will be closed by SAX parser
1085 bDocRet
= xFilter
->filter( aDescriptor
);
1091 while( bDocRet
&& pServices
->mpService
);
1096 if(mxStatusIndicator
.is())
1097 mxStatusIndicator
->end();
1101 catch(uno::Exception e
)
1103 #if OSL_DEBUG_LEVEL > 1
1104 ByteString
aError( "uno Exception caught while exporting:\n" );
1105 aError
+= ByteString( String( e
.Message
), RTL_TEXTENCODING_ASCII_US
);
1106 DBG_ERROR( aError
.GetBuffer() );
1108 bDocRet
= sal_False
;
1111 mxModel
->unlockControllers();
1113 if( pGraphicHelper
)
1114 SvXMLGraphicHelper::Destroy( pGraphicHelper
);
1117 SvXMLEmbeddedObjectHelper::Destroy( pObjectHelper
);