Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "oox/core/filterbase.hxx"
21 :
22 : #include <set>
23 : #include <com/sun/star/container/XNameAccess.hpp>
24 : #include <com/sun/star/frame/XModel.hpp>
25 : #include <com/sun/star/task/XStatusIndicator.hpp>
26 : #include <com/sun/star/task/XInteractionHandler.hpp>
27 : #include <com/sun/star/drawing/XShape.hpp>
28 : #include <comphelper/docpasswordhelper.hxx>
29 : #include <comphelper/mediadescriptor.hxx>
30 : #include <osl/mutex.hxx>
31 : #include <rtl/instance.hxx>
32 : #include <rtl/uri.hxx>
33 : #include "oox/helper/binaryinputstream.hxx"
34 : #include "oox/helper/binaryoutputstream.hxx"
35 : #include "oox/helper/graphichelper.hxx"
36 : #include "oox/helper/modelobjecthelper.hxx"
37 : #include "oox/ole/oleobjecthelper.hxx"
38 : #include "oox/ole/vbaproject.hxx"
39 :
40 : namespace oox {
41 : namespace core {
42 :
43 : // ============================================================================
44 :
45 : using namespace ::com::sun::star::beans;
46 : using namespace ::com::sun::star::frame;
47 : using namespace ::com::sun::star::graphic;
48 : using namespace ::com::sun::star::drawing;
49 : using namespace ::com::sun::star::io;
50 : using namespace ::com::sun::star::lang;
51 : using namespace ::com::sun::star::task;
52 : using namespace ::com::sun::star::uno;
53 :
54 : using ::com::sun::star::container::XNameAccess;
55 : using ::comphelper::MediaDescriptor;
56 : using ::comphelper::SequenceAsHashMap;
57 : using ::oox::ole::OleObjectHelper;
58 : using ::oox::ole::VbaProject;
59 :
60 : // ============================================================================
61 :
62 : namespace {
63 :
64 18 : struct UrlPool
65 : {
66 : ::osl::Mutex maMutex;
67 : ::std::set< OUString > maUrls;
68 : };
69 :
70 : struct StaticUrlPool : public ::rtl::Static< UrlPool, StaticUrlPool > {};
71 :
72 : // ----------------------------------------------------------------------------
73 :
74 : /** This guard prevents recursive loading/saving of the same document. */
75 : class DocumentOpenedGuard
76 : {
77 : public:
78 : explicit DocumentOpenedGuard( const OUString& rUrl );
79 : ~DocumentOpenedGuard();
80 :
81 158 : inline bool isValid() const { return mbValid; }
82 :
83 : private:
84 : DocumentOpenedGuard( const DocumentOpenedGuard& );
85 : DocumentOpenedGuard& operator=( const DocumentOpenedGuard& );
86 :
87 : OUString maUrl;
88 : bool mbValid;
89 : };
90 :
91 158 : DocumentOpenedGuard::DocumentOpenedGuard( const OUString& rUrl )
92 : {
93 158 : UrlPool& rUrlPool = StaticUrlPool::get();
94 158 : ::osl::MutexGuard aGuard( rUrlPool.maMutex );
95 158 : mbValid = rUrl.isEmpty() || (rUrlPool.maUrls.count( rUrl ) == 0);
96 158 : if( mbValid && !rUrl.isEmpty() )
97 : {
98 88 : rUrlPool.maUrls.insert( rUrl );
99 88 : maUrl = rUrl;
100 158 : }
101 158 : }
102 :
103 316 : DocumentOpenedGuard::~DocumentOpenedGuard()
104 : {
105 158 : UrlPool& rUrlPool = StaticUrlPool::get();
106 158 : ::osl::MutexGuard aGuard( rUrlPool.maMutex );
107 158 : if( !maUrl.isEmpty() )
108 88 : rUrlPool.maUrls.erase( maUrl );
109 158 : }
110 :
111 : } // namespace
112 :
113 : // ============================================================================
114 :
115 : /** Specifies whether this filter is an import or export filter. */
116 : enum FilterDirection
117 : {
118 : FILTERDIRECTION_UNKNOWN,
119 : FILTERDIRECTION_IMPORT,
120 : FILTERDIRECTION_EXPORT
121 : };
122 :
123 : // ----------------------------------------------------------------------------
124 :
125 133 : struct FilterBaseImpl
126 : {
127 : typedef ::boost::shared_ptr< GraphicHelper > GraphicHelperRef;
128 : typedef ::boost::shared_ptr< ModelObjectHelper > ModelObjHelperRef;
129 : typedef ::boost::shared_ptr< OleObjectHelper > OleObjHelperRef;
130 : typedef ::boost::shared_ptr< VbaProject > VbaProjectRef;
131 :
132 : FilterDirection meDirection;
133 : SequenceAsHashMap maArguments;
134 : SequenceAsHashMap maFilterData;
135 : MediaDescriptor maMediaDesc;
136 : OUString maFileUrl;
137 : StorageRef mxStorage;
138 : OoxmlVersion meVersion;
139 :
140 : GraphicHelperRef mxGraphicHelper; /// Graphic and graphic object handling.
141 : ModelObjHelperRef mxModelObjHelper; /// Tables to create new named drawing objects.
142 : OleObjHelperRef mxOleObjHelper; /// OLE object handling.
143 : VbaProjectRef mxVbaProject; /// VBA project manager.
144 :
145 : Reference< XComponentContext > mxComponentContext;
146 : Reference< XMultiComponentFactory > mxComponentFactory;
147 : Reference< XModel > mxModel;
148 : Reference< XMultiServiceFactory > mxModelFactory;
149 : Reference< XFrame > mxTargetFrame;
150 : Reference< XInputStream > mxInStream;
151 : Reference< XStream > mxOutStream;
152 : Reference< XStatusIndicator > mxStatusIndicator;
153 : Reference< XInteractionHandler > mxInteractionHandler;
154 : Reference< XShape > mxParentShape;
155 :
156 : explicit FilterBaseImpl( const Reference< XComponentContext >& rxContext ) throw( RuntimeException );
157 :
158 : void setDocumentModel( const Reference< XComponent >& rxComponent ) throw( IllegalArgumentException );
159 :
160 : void initializeFilter();
161 : void finalizeFilter();
162 : };
163 :
164 : // ----------------------------------------------------------------------------
165 :
166 133 : FilterBaseImpl::FilterBaseImpl( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
167 : meDirection( FILTERDIRECTION_UNKNOWN ),
168 : meVersion( ECMA_DIALECT ),
169 : mxComponentContext( rxContext, UNO_SET_THROW ),
170 133 : mxComponentFactory( rxContext->getServiceManager(), UNO_SET_THROW )
171 : {
172 133 : }
173 :
174 158 : void FilterBaseImpl::setDocumentModel( const Reference< XComponent >& rxComponent ) throw( IllegalArgumentException )
175 : {
176 : try
177 : {
178 158 : mxModel.set( rxComponent, UNO_QUERY_THROW );
179 158 : mxModelFactory.set( rxComponent, UNO_QUERY_THROW );
180 : }
181 0 : catch( Exception& )
182 : {
183 0 : throw IllegalArgumentException();
184 : }
185 158 : }
186 :
187 158 : void FilterBaseImpl::initializeFilter()
188 : {
189 : try
190 : {
191 : // lock the model controllers
192 158 : mxModel->lockControllers();
193 : }
194 0 : catch( Exception& )
195 : {
196 : }
197 158 : }
198 :
199 0 : void FilterBaseImpl::finalizeFilter()
200 : {
201 : try
202 : {
203 : // writing back the FilterData to the MediaDescriptor
204 0 : maMediaDesc["FilterData"] = makeAny(maFilterData.getAsConstPropertyValueList());
205 : // write the descriptor back to the document model (adds the passwords)
206 0 : mxModel->attachResource( maFileUrl, maMediaDesc.getAsConstPropertyValueList() );
207 : // unlock the model controllers
208 0 : mxModel->unlockControllers();
209 : }
210 0 : catch( Exception& )
211 : {
212 : }
213 0 : }
214 :
215 : // ============================================================================
216 :
217 133 : FilterBase::FilterBase( const Reference< XComponentContext >& rxContext ) throw( RuntimeException ) :
218 133 : mxImpl( new FilterBaseImpl( rxContext ) )
219 : {
220 133 : }
221 :
222 133 : FilterBase::~FilterBase()
223 : {
224 133 : }
225 :
226 84 : bool FilterBase::isImportFilter() const
227 : {
228 84 : return mxImpl->meDirection == FILTERDIRECTION_IMPORT;
229 : }
230 :
231 6 : bool FilterBase::isExportFilter() const
232 : {
233 6 : return mxImpl->meDirection == FILTERDIRECTION_EXPORT;
234 : }
235 :
236 664 : OoxmlVersion FilterBase::getVersion() const
237 : {
238 664 : return mxImpl->meVersion;
239 : }
240 :
241 633 : const Reference< XComponentContext >& FilterBase::getComponentContext() const
242 : {
243 633 : return mxImpl->mxComponentContext;
244 : }
245 :
246 399 : const Reference< XModel >& FilterBase::getModel() const
247 : {
248 399 : return mxImpl->mxModel;
249 : }
250 :
251 245 : const Reference< XMultiServiceFactory >& FilterBase::getModelFactory() const
252 : {
253 245 : return mxImpl->mxModelFactory;
254 : }
255 :
256 73 : const Reference< XFrame >& FilterBase::getTargetFrame() const
257 : {
258 73 : return mxImpl->mxTargetFrame;
259 : }
260 :
261 0 : const Reference< XShape >& FilterBase::getParentShape() const
262 : {
263 0 : return mxImpl->mxParentShape;
264 : }
265 :
266 28 : const Reference< XStatusIndicator >& FilterBase::getStatusIndicator() const
267 : {
268 28 : return mxImpl->mxStatusIndicator;
269 : }
270 :
271 42 : MediaDescriptor& FilterBase::getMediaDescriptor() const
272 : {
273 42 : return mxImpl->maMediaDesc;
274 : }
275 :
276 7 : SequenceAsHashMap& FilterBase::getFilterData() const
277 : {
278 7 : return mxImpl->maFilterData;
279 : }
280 :
281 0 : const OUString& FilterBase::getFileUrl() const
282 : {
283 0 : return mxImpl->maFileUrl;
284 : }
285 :
286 : namespace {
287 :
288 0 : inline bool lclIsDosDrive( const OUString& rUrl, sal_Int32 nPos = 0 )
289 : {
290 : return
291 0 : (rUrl.getLength() >= nPos + 3) &&
292 0 : ((('A' <= rUrl[ nPos ]) && (rUrl[ nPos ] <= 'Z')) || (('a' <= rUrl[ nPos ]) && (rUrl[ nPos ] <= 'z'))) &&
293 0 : (rUrl[ nPos + 1 ] == ':') &&
294 0 : (rUrl[ nPos + 2 ] == '/');
295 : }
296 :
297 : } // namespace
298 :
299 0 : OUString FilterBase::getAbsoluteUrl( const OUString& rUrl ) const
300 : {
301 : // handle some special cases before calling ::rtl::Uri::convertRelToAbs()
302 :
303 0 : const OUString aFileSchema = "file:";
304 0 : const OUString aFilePrefix = "file:///";
305 0 : const sal_Int32 nFilePrefixLen = aFilePrefix.getLength();
306 0 : const OUString aUncPrefix = "//";
307 :
308 : /* (1) convert all backslashes to slashes, and check that passed URL is
309 : not empty. */
310 0 : OUString aUrl = rUrl.replace( '\\', '/' );
311 0 : if( aUrl.isEmpty() )
312 0 : return aUrl;
313 :
314 : /* (2) add 'file:///' to absolute Windows paths, e.g. convert
315 : 'C:/path/file' to 'file:///c:/path/file'. */
316 0 : if( lclIsDosDrive( aUrl ) )
317 0 : return aFilePrefix + aUrl;
318 :
319 : /* (3) add 'file:' to UNC paths, e.g. convert '//server/path/file' to
320 : 'file://server/path/file'. */
321 0 : if( aUrl.match( aUncPrefix ) )
322 0 : return aFileSchema + aUrl;
323 :
324 : /* (4) remove additional slashes from UNC paths, e.g. convert
325 : 'file://///server/path/file' to 'file://server/path/file'. */
326 0 : if( (aUrl.getLength() >= nFilePrefixLen + 2) &&
327 0 : aUrl.match( aFilePrefix ) &&
328 0 : aUrl.match( aUncPrefix, nFilePrefixLen ) )
329 : {
330 0 : return aFileSchema + aUrl.copy( nFilePrefixLen );
331 : }
332 :
333 : /* (5) handle URLs relative to current drive, e.g. the URL '/path1/file1'
334 : relative to the base URL 'file:///C:/path2/file2' does not result in
335 : the expected 'file:///C:/path1/file1', but in 'file:///path1/file1'. */
336 0 : if( !aUrl.isEmpty() && (aUrl[ 0 ] == '/') &&
337 0 : mxImpl->maFileUrl.match( aFilePrefix ) &&
338 0 : lclIsDosDrive( mxImpl->maFileUrl, nFilePrefixLen ) )
339 : {
340 0 : return mxImpl->maFileUrl.copy( 0, nFilePrefixLen + 3 ) + aUrl.copy( 1 );
341 : }
342 :
343 : try
344 : {
345 0 : return ::rtl::Uri::convertRelToAbs( mxImpl->maFileUrl, aUrl );
346 : }
347 0 : catch( ::rtl::MalformedUriException& )
348 : {
349 : }
350 0 : return aUrl;
351 : }
352 :
353 235 : StorageRef FilterBase::getStorage() const
354 : {
355 235 : return mxImpl->mxStorage;
356 : }
357 :
358 392 : Reference< XInputStream > FilterBase::openInputStream( const OUString& rStreamName ) const
359 : {
360 392 : return mxImpl->mxStorage->openInputStream( rStreamName );
361 : }
362 :
363 345 : Reference< XOutputStream > FilterBase::openOutputStream( const OUString& rStreamName ) const
364 : {
365 345 : return mxImpl->mxStorage->openOutputStream( rStreamName );
366 : }
367 :
368 54 : void FilterBase::commitStorage() const
369 : {
370 54 : mxImpl->mxStorage->commit();
371 54 : }
372 :
373 : // helpers --------------------------------------------------------------------
374 :
375 1461 : GraphicHelper& FilterBase::getGraphicHelper() const
376 : {
377 1461 : if( !mxImpl->mxGraphicHelper )
378 73 : mxImpl->mxGraphicHelper.reset( implCreateGraphicHelper() );
379 1461 : return *mxImpl->mxGraphicHelper;
380 : }
381 :
382 195 : ModelObjectHelper& FilterBase::getModelObjectHelper() const
383 : {
384 195 : if( !mxImpl->mxModelObjHelper )
385 43 : mxImpl->mxModelObjHelper.reset( new ModelObjectHelper( mxImpl->mxModelFactory ) );
386 195 : return *mxImpl->mxModelObjHelper;
387 : }
388 :
389 0 : OleObjectHelper& FilterBase::getOleObjectHelper() const
390 : {
391 0 : if( !mxImpl->mxOleObjHelper )
392 0 : mxImpl->mxOleObjHelper.reset( new OleObjectHelper( mxImpl->mxModelFactory ) );
393 0 : return *mxImpl->mxOleObjHelper;
394 : }
395 :
396 0 : VbaProject& FilterBase::getVbaProject() const
397 : {
398 0 : if( !mxImpl->mxVbaProject )
399 0 : mxImpl->mxVbaProject.reset( implCreateVbaProject() );
400 0 : return *mxImpl->mxVbaProject;
401 : }
402 :
403 0 : bool FilterBase::importBinaryData( StreamDataSequence& orDataSeq, const OUString& rStreamName )
404 : {
405 : OSL_ENSURE( !rStreamName.isEmpty(), "FilterBase::importBinaryData - empty stream name" );
406 0 : if( rStreamName.isEmpty() )
407 0 : return false;
408 :
409 : // try to open the stream (this may fail - do not assert)
410 0 : BinaryXInputStream aInStrm( openInputStream( rStreamName ), true );
411 0 : if( aInStrm.isEof() )
412 0 : return false;
413 :
414 : // copy the entire stream to the passed sequence
415 0 : SequenceOutputStream aOutStrm( orDataSeq );
416 0 : aInStrm.copyToStream( aOutStrm );
417 0 : return true;
418 : }
419 :
420 : // com.sun.star.lang.XServiceInfo interface -----------------------------------
421 :
422 0 : OUString SAL_CALL FilterBase::getImplementationName() throw( RuntimeException )
423 : {
424 0 : return implGetImplementationName();
425 : }
426 :
427 0 : sal_Bool SAL_CALL FilterBase::supportsService( const OUString& rServiceName ) throw( RuntimeException )
428 : {
429 : return
430 0 : (rServiceName == "com.sun.star.document.ImportFilter" ) ||
431 0 : (rServiceName == "com.sun.star.document.ExportFilter" );
432 : }
433 :
434 0 : Sequence< OUString > SAL_CALL FilterBase::getSupportedServiceNames() throw( RuntimeException )
435 : {
436 0 : Sequence< OUString > aServiceNames( 2 );
437 0 : aServiceNames[ 0 ] = "com.sun.star.document.ImportFilter";
438 0 : aServiceNames[ 1 ] = "com.sun.star.document.ExportFilter";
439 0 : return aServiceNames;
440 : }
441 :
442 : // com.sun.star.lang.XInitialization interface --------------------------------
443 :
444 34 : void SAL_CALL FilterBase::initialize( const Sequence< Any >& rArgs ) throw( Exception, RuntimeException )
445 : {
446 34 : if( rArgs.getLength() >= 2 ) try
447 : {
448 0 : mxImpl->maArguments << rArgs[ 1 ];
449 : }
450 0 : catch( Exception& )
451 : {
452 : }
453 34 : }
454 :
455 : // com.sun.star.document.XImporter interface ----------------------------------
456 :
457 98 : void SAL_CALL FilterBase::setTargetDocument( const Reference< XComponent >& rxDocument ) throw( IllegalArgumentException, RuntimeException )
458 : {
459 98 : mxImpl->setDocumentModel( rxDocument );
460 98 : mxImpl->meDirection = FILTERDIRECTION_IMPORT;
461 98 : }
462 :
463 : // com.sun.star.document.XExporter interface ----------------------------------
464 :
465 60 : void SAL_CALL FilterBase::setSourceDocument( const Reference< XComponent >& rxDocument ) throw( IllegalArgumentException, RuntimeException )
466 : {
467 60 : mxImpl->setDocumentModel( rxDocument );
468 60 : mxImpl->meDirection = FILTERDIRECTION_EXPORT;
469 60 : }
470 :
471 : // com.sun.star.document.XFilter interface ------------------------------------
472 :
473 158 : sal_Bool SAL_CALL FilterBase::filter( const Sequence< PropertyValue >& rMediaDescSeq ) throw( RuntimeException )
474 : {
475 158 : if( !mxImpl->mxModel.is() || !mxImpl->mxModelFactory.is() || (mxImpl->meDirection == FILTERDIRECTION_UNKNOWN) )
476 0 : throw RuntimeException();
477 :
478 158 : sal_Bool bRet = sal_False;
479 158 : setMediaDescriptor( rMediaDescSeq );
480 158 : DocumentOpenedGuard aOpenedGuard( mxImpl->maFileUrl );
481 158 : if( aOpenedGuard.isValid() || mxImpl->maFileUrl.isEmpty() )
482 : {
483 158 : mxImpl->initializeFilter();
484 158 : switch( mxImpl->meDirection )
485 : {
486 : case FILTERDIRECTION_UNKNOWN:
487 0 : break;
488 : case FILTERDIRECTION_IMPORT:
489 98 : if( mxImpl->mxInStream.is() )
490 : {
491 98 : mxImpl->mxStorage = implCreateStorage( mxImpl->mxInStream );
492 98 : bRet = mxImpl->mxStorage.get() && importDocument();
493 : }
494 98 : break;
495 : case FILTERDIRECTION_EXPORT:
496 60 : if( mxImpl->mxOutStream.is() )
497 : {
498 60 : mxImpl->mxStorage = implCreateStorage( mxImpl->mxOutStream );
499 60 : bRet = mxImpl->mxStorage.get() && exportDocument();
500 : }
501 60 : break;
502 : }
503 158 : mxImpl->mxModel->unlockControllers();
504 : }
505 158 : return bRet;
506 : }
507 :
508 0 : void SAL_CALL FilterBase::cancel() throw( RuntimeException )
509 : {
510 0 : }
511 :
512 : // protected ------------------------------------------------------------------
513 :
514 0 : Reference< XInputStream > FilterBase::implGetInputStream( MediaDescriptor& rMediaDesc ) const
515 : {
516 0 : return rMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INPUTSTREAM(), Reference< XInputStream >() );
517 : }
518 :
519 60 : Reference< XStream > FilterBase::implGetOutputStream( MediaDescriptor& rMediaDesc ) const
520 : {
521 60 : return rMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_STREAMFOROUTPUT(), Reference< XStream >() );
522 : }
523 :
524 : // private --------------------------------------------------------------------
525 :
526 158 : void FilterBase::setMediaDescriptor( const Sequence< PropertyValue >& rMediaDescSeq )
527 : {
528 158 : mxImpl->maMediaDesc << rMediaDescSeq;
529 :
530 158 : switch( mxImpl->meDirection )
531 : {
532 : case FILTERDIRECTION_UNKNOWN:
533 : OSL_FAIL( "FilterBase::setMediaDescriptor - invalid filter direction" );
534 0 : break;
535 : case FILTERDIRECTION_IMPORT:
536 98 : mxImpl->maMediaDesc.addInputStream();
537 98 : mxImpl->mxInStream = implGetInputStream( mxImpl->maMediaDesc );
538 : OSL_ENSURE( mxImpl->mxInStream.is(), "FilterBase::setMediaDescriptor - missing input stream" );
539 98 : break;
540 : case FILTERDIRECTION_EXPORT:
541 60 : mxImpl->mxOutStream = implGetOutputStream( mxImpl->maMediaDesc );
542 : OSL_ENSURE( mxImpl->mxOutStream.is(), "FilterBase::setMediaDescriptor - missing output stream" );
543 60 : break;
544 : }
545 :
546 158 : mxImpl->maFileUrl = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL(), OUString() );
547 158 : mxImpl->mxTargetFrame = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_FRAME(), Reference< XFrame >() );
548 158 : mxImpl->mxStatusIndicator = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_STATUSINDICATOR(), Reference< XStatusIndicator >() );
549 158 : mxImpl->mxInteractionHandler = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER(), Reference< XInteractionHandler >() );
550 158 : mxImpl->mxParentShape = mxImpl->maMediaDesc.getUnpackedValueOrDefault( "ParentShape", mxImpl->mxParentShape );
551 158 : mxImpl->maFilterData = mxImpl->maMediaDesc.getUnpackedValueOrDefault( "FilterData", Sequence< PropertyValue >() );
552 :
553 : // Check for ISO OOXML
554 158 : OUString sFilterName = mxImpl->maMediaDesc.getUnpackedValueOrDefault( "FilterName", OUString() );
555 : try
556 : {
557 158 : Reference< XNameAccess > xFilters( Reference<XMultiServiceFactory>(getComponentContext()->getServiceManager(), UNO_QUERY_THROW)->createInstance("com.sun.star.document.FilterFactory" ), UNO_QUERY_THROW );
558 238 : Any aValues = xFilters->getByName( sFilterName );
559 160 : Sequence<PropertyValue > aPropSeq;
560 80 : aValues >>= aPropSeq;
561 160 : SequenceAsHashMap aProps( aPropSeq );
562 :
563 80 : sal_Int32 nVersion = aProps.getUnpackedValueOrDefault( "FileFormatVersion", sal_Int32( 0 ) );
564 238 : mxImpl->meVersion = OoxmlVersion( nVersion );
565 : }
566 78 : catch ( const Exception& )
567 : {
568 : // Not ISO OOXML
569 158 : }
570 158 : }
571 :
572 0 : GraphicHelper* FilterBase::implCreateGraphicHelper() const
573 : {
574 : // default: return base implementation without any special behaviour
575 0 : return new GraphicHelper( mxImpl->mxComponentContext, mxImpl->mxTargetFrame, mxImpl->mxStorage );
576 : }
577 :
578 : // ============================================================================
579 :
580 : } // namespace core
581 141 : } // namespace oox
582 :
583 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|