LibreOffice Module oox (master) 1
filterbase.cxx
Go to the documentation of this file.
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 <sal/config.h>
21
22#include <com/sun/star/container/XNameAccess.hpp>
23#include <com/sun/star/drawing/XShape.hpp>
24#include <com/sun/star/frame/XModel.hpp>
25#include <com/sun/star/io/XStream.hpp>
26#include <com/sun/star/lang/XMultiServiceFactory.hpp>
27#include <com/sun/star/task/XInteractionHandler.hpp>
28#include <com/sun/star/task/XStatusIndicator.hpp>
29#include <com/sun/star/uno/XComponentContext.hpp>
35#include <osl/diagnose.h>
36#include <rtl/uri.hxx>
37#include <memory>
38#include <mutex>
39#include <set>
40
48
49namespace oox::core {
50
51using namespace ::com::sun::star::beans;
52using namespace ::com::sun::star::frame;
53using namespace ::com::sun::star::graphic;
54using namespace ::com::sun::star::drawing;
55using namespace ::com::sun::star::io;
56using namespace ::com::sun::star::lang;
57using namespace ::com::sun::star::task;
58using namespace ::com::sun::star::uno;
59
60using ::com::sun::star::container::XNameAccess;
62using ::comphelper::SequenceAsHashMap;
63using ::oox::ole::OleObjectHelper;
64using ::oox::ole::VbaProject;
65
66namespace {
67
68struct UrlPool
69{
70 std::mutex maMutex;
71 ::std::set< OUString > maUrls;
72};
73
74UrlPool& StaticUrlPool()
75{
76 static UrlPool SINGLETON;
77 return SINGLETON;
78}
79
81class DocumentOpenedGuard
82{
83public:
84 explicit DocumentOpenedGuard( const OUString& rUrl );
85 ~DocumentOpenedGuard();
86 DocumentOpenedGuard(const DocumentOpenedGuard&) = delete;
87 DocumentOpenedGuard& operator=(const DocumentOpenedGuard&) = delete;
88
89 bool isValid() const { return mbValid; }
90
91private:
92 OUString maUrl;
93 bool mbValid;
94};
95
96DocumentOpenedGuard::DocumentOpenedGuard( const OUString& rUrl )
97{
98 UrlPool& rUrlPool = StaticUrlPool();
99 std::scoped_lock aGuard( rUrlPool.maMutex );
100 mbValid = rUrl.isEmpty() || (rUrlPool.maUrls.count( rUrl ) == 0);
101 if( mbValid && !rUrl.isEmpty() )
102 {
103 rUrlPool.maUrls.insert( rUrl );
104 maUrl = rUrl;
105 }
106}
107
108DocumentOpenedGuard::~DocumentOpenedGuard()
109{
110 UrlPool& rUrlPool = StaticUrlPool();
111 std::scoped_lock aGuard( rUrlPool.maMutex );
112 if( !maUrl.isEmpty() )
113 rUrlPool.maUrls.erase( maUrl );
114}
115
117enum FilterDirection
118{
119 FILTERDIRECTION_UNKNOWN,
120 FILTERDIRECTION_IMPORT,
121 FILTERDIRECTION_EXPORT
122};
123
124} // namespace
125
127{
128 typedef std::shared_ptr< GraphicHelper > GraphicHelperRef;
129 typedef std::shared_ptr< ModelObjectHelper > ModelObjHelperRef;
130 typedef std::shared_ptr< OleObjectHelper > OleObjHelperRef;
131 typedef std::shared_ptr< VbaProject > VbaProjectRef;
132
133 FilterDirection meDirection;
134 SequenceAsHashMap maArguments;
135 SequenceAsHashMap maFilterData;
137 OUString maFileUrl;
140
143 std::map<css::uno::Reference<css::lang::XMultiServiceFactory>, ModelObjHelperRef>
147
148 Reference< XComponentContext > mxComponentContext;
149 Reference< XModel > mxModel;
150 Reference< XMultiServiceFactory > mxModelFactory;
151 Reference< XFrame > mxTargetFrame;
152 Reference< XInputStream > mxInStream;
153 Reference< XStream > mxOutStream;
154 Reference< XStatusIndicator > mxStatusIndicator;
155 Reference< XInteractionHandler > mxInteractionHandler;
156 Reference< XShape > mxParentShape;
157
159
161
163 explicit FilterBaseImpl( const Reference< XComponentContext >& rxContext );
164
166 void setDocumentModel( const Reference< XComponent >& rxComponent );
167};
168
169FilterBaseImpl::FilterBaseImpl( const Reference< XComponentContext >& rxContext ) :
170 meDirection( FILTERDIRECTION_UNKNOWN ),
171 meVersion( ECMA_DIALECT ),
172 mxComponentContext( rxContext, UNO_SET_THROW ),
173 mbExportVBA(false),
174 mbExportTemplate(false)
175{
176}
177
178void FilterBaseImpl::setDocumentModel( const Reference< XComponent >& rxComponent )
179{
180 try
181 {
182 mxModel.set( rxComponent, UNO_QUERY_THROW );
183 mxModelFactory.set( rxComponent, UNO_QUERY_THROW );
184 }
185 catch( Exception& )
186 {
187 throw IllegalArgumentException();
188 }
189}
190
191FilterBase::FilterBase( const Reference< XComponentContext >& rxContext ) :
192 mxImpl( new FilterBaseImpl( rxContext ) )
193{
194}
195
197{
198}
199
201{
202 return mxImpl->meDirection == FILTERDIRECTION_IMPORT;
203}
204
206{
207 return mxImpl->meDirection == FILTERDIRECTION_EXPORT;
208}
209
211{
212 return mxImpl->meVersion;
213}
214
215const Reference< XComponentContext >& FilterBase::getComponentContext() const
216{
217 return mxImpl->mxComponentContext;
218}
219
220const Reference< XModel >& FilterBase::getModel() const
221{
222 return mxImpl->mxModel;
223}
224
225const Reference< XMultiServiceFactory >& FilterBase::getModelFactory() const
226{
227 return mxImpl->mxModelFactory;
228}
229
230const Reference< XFrame >& FilterBase::getTargetFrame() const
231{
232 return mxImpl->mxTargetFrame;
233}
234
235const Reference< XStatusIndicator >& FilterBase::getStatusIndicator() const
236{
237 return mxImpl->mxStatusIndicator;
238}
239
241{
242 return mxImpl->maMediaDesc;
243}
244
245SequenceAsHashMap& FilterBase::getFilterData() const
246{
247 return mxImpl->maFilterData;
248}
249
250const OUString& FilterBase::getFileUrl() const
251{
252 return mxImpl->maFileUrl;
253}
254
255namespace {
256
257bool lclIsDosDrive( std::u16string_view rUrl, size_t nPos = 0 )
258{
259 return
260 (rUrl.size() >= nPos + 3) &&
261 ((('A' <= rUrl[ nPos ]) && (rUrl[ nPos ] <= 'Z')) || (('a' <= rUrl[ nPos ]) && (rUrl[ nPos ] <= 'z'))) &&
262 (rUrl[ nPos + 1 ] == ':') &&
263 (rUrl[ nPos + 2 ] == '/');
264}
265
266} // namespace
267
268OUString FilterBase::getAbsoluteUrl( const OUString& rUrl ) const
269{
270 // handle some special cases before calling ::rtl::Uri::convertRelToAbs()
271
272 static const OUStringLiteral aFileSchema = u"file:";
273 static const OUStringLiteral aFilePrefix = u"file:///";
274 const sal_Int32 nFilePrefixLen = aFilePrefix.getLength();
275 static const OUStringLiteral aUncPrefix = u"//";
276
277 /* (1) convert all backslashes to slashes, and check that passed URL is
278 not empty. */
279 OUString aUrl = rUrl.replace( '\\', '/' );
280 if( aUrl.isEmpty() )
281 return aUrl;
282
283 /* (2) add 'file:///' to absolute Windows paths, e.g. convert
284 'C:/path/file' to 'file:///c:/path/file'. */
285 if( lclIsDosDrive( aUrl ) )
286 return aFilePrefix + aUrl;
287
288 /* (3) add 'file:' to UNC paths, e.g. convert '//server/path/file' to
289 'file://server/path/file'. */
290 if( aUrl.match( aUncPrefix ) )
291 return aFileSchema + aUrl;
292
293 /* (4) remove additional slashes from UNC paths, e.g. convert
294 'file://///server/path/file' to 'file://server/path/file'. */
295 if( (aUrl.getLength() >= nFilePrefixLen + 2) &&
296 aUrl.match( aFilePrefix ) &&
297 aUrl.match( aUncPrefix, nFilePrefixLen ) )
298 {
299 return aFileSchema + aUrl.subView( nFilePrefixLen );
300 }
301
302 /* (5) handle URLs relative to current drive, e.g. the URL '/path1/file1'
303 relative to the base URL 'file:///C:/path2/file2' does not result in
304 the expected 'file:///C:/path1/file1', but in 'file:///path1/file1'. */
305 if( aUrl.startsWith("/") &&
306 mxImpl->maFileUrl.match( aFilePrefix ) &&
307 lclIsDosDrive( mxImpl->maFileUrl, nFilePrefixLen ) )
308 {
309 return OUString::Concat(mxImpl->maFileUrl.subView( 0, nFilePrefixLen + 3 )) + aUrl.subView( 1 );
310 }
311
312 try
313 {
314 return ::rtl::Uri::convertRelToAbs( mxImpl->maFileUrl, aUrl );
315 }
316 catch( ::rtl::MalformedUriException& )
317 {
318 }
319 return aUrl;
320}
321
323{
324 return mxImpl->mxStorage;
325}
326
327Reference< XInputStream > FilterBase::openInputStream( const OUString& rStreamName ) const
328{
329 if (!mxImpl->mxStorage)
330 throw RuntimeException();
331 return mxImpl->mxStorage->openInputStream( rStreamName );
332}
333
334Reference< XOutputStream > FilterBase::openOutputStream( const OUString& rStreamName ) const
335{
336 return mxImpl->mxStorage->openOutputStream( rStreamName );
337}
338
340{
341 mxImpl->mxStorage->commit();
342}
343
344// helpers
345
347{
348 if( !mxImpl->mxGraphicHelper )
349 mxImpl->mxGraphicHelper.reset( implCreateGraphicHelper() );
350 return *mxImpl->mxGraphicHelper;
351}
352
354{
355 if( !mxImpl->mxModelObjHelper )
356 mxImpl->mxModelObjHelper = std::make_shared<ModelObjectHelper>( mxImpl->mxModelFactory );
357 return *mxImpl->mxModelObjHelper;
358}
359
361 const css::uno::Reference<css::lang::XMultiServiceFactory>& xFactory) const
362{
363 if (!mxImpl->mxModelObjHelpers.count(xFactory))
364 mxImpl->mxModelObjHelpers[xFactory] = std::make_shared<ModelObjectHelper>(xFactory);
365 return *mxImpl->mxModelObjHelpers[xFactory];
366}
367
368OleObjectHelper& FilterBase::getOleObjectHelper() const
369{
370 if( !mxImpl->mxOleObjHelper )
371 mxImpl->mxOleObjHelper = std::make_shared<OleObjectHelper>(mxImpl->mxModelFactory, mxImpl->mxModel);
372 return *mxImpl->mxOleObjHelper;
373}
374
375VbaProject& FilterBase::getVbaProject() const
376{
377 if( !mxImpl->mxVbaProject )
378 mxImpl->mxVbaProject.reset( implCreateVbaProject() );
379 return *mxImpl->mxVbaProject;
380}
381
382bool FilterBase::importBinaryData( StreamDataSequence & orDataSeq, const OUString& rStreamName )
383{
384 OSL_ENSURE( !rStreamName.isEmpty(), "FilterBase::importBinaryData - empty stream name" );
385 if( rStreamName.isEmpty() )
386 return false;
387
388 // try to open the stream (this may fail - do not assert)
389 BinaryXInputStream aInStrm( openInputStream( rStreamName ), true );
390 if( aInStrm.isEof() )
391 return false;
392
393 // copy the entire stream to the passed sequence
394 SequenceOutputStream aOutStrm( orDataSeq );
395 aInStrm.copyToStream( aOutStrm );
396 return true;
397}
398
399// com.sun.star.lang.XServiceInfo interface
400
401sal_Bool SAL_CALL FilterBase::supportsService( const OUString& rServiceName )
402{
403 return cppu::supportsService(this, rServiceName);
404}
405
406Sequence< OUString > SAL_CALL FilterBase::getSupportedServiceNames()
407{
408 return { "com.sun.star.document.ImportFilter", "com.sun.star.document.ExportFilter" };
409}
410
411// com.sun.star.lang.XInitialization interface
412
413void SAL_CALL FilterBase::initialize( const Sequence< Any >& rArgs )
414{
415 if( rArgs.getLength() >= 2 ) try
416 {
417 mxImpl->maArguments << rArgs[ 1 ];
418 }
419 catch( Exception& )
420 {
421 }
422
423 if (!rArgs.hasElements())
424 return;
425
426 Sequence<css::beans::PropertyValue> aSeq;
427 rArgs[0] >>= aSeq;
428 for (const auto& rVal : std::as_const(aSeq))
429 {
430 if (rVal.Name == "UserData")
431 {
432 css::uno::Sequence<OUString> aUserDataSeq;
433 rVal.Value >>= aUserDataSeq;
434 if (comphelper::findValue(aUserDataSeq, "macro-enabled") != -1)
435 mxImpl->mbExportVBA = true;
436 }
437 else if (rVal.Name == "Flags")
438 {
439 sal_Int32 nFlags(0);
440 rVal.Value >>= nFlags;
441 mxImpl->mbExportTemplate = bool(static_cast<SfxFilterFlags>(nFlags) & SfxFilterFlags::TEMPLATE);
442 }
443 }
444}
445
446// com.sun.star.document.XImporter interface
447
448void SAL_CALL FilterBase::setTargetDocument( const Reference< XComponent >& rxDocument )
449{
450 mxImpl->setDocumentModel( rxDocument );
451 mxImpl->meDirection = FILTERDIRECTION_IMPORT;
452}
453
454// com.sun.star.document.XExporter interface
455
456void SAL_CALL FilterBase::setSourceDocument( const Reference< XComponent >& rxDocument )
457{
458 mxImpl->setDocumentModel( rxDocument );
459 mxImpl->meDirection = FILTERDIRECTION_EXPORT;
460}
461
462// com.sun.star.document.XFilter interface
463
464sal_Bool SAL_CALL FilterBase::filter( const Sequence< PropertyValue >& rMediaDescSeq )
465{
466 if( !mxImpl->mxModel.is() || !mxImpl->mxModelFactory.is() || (mxImpl->meDirection == FILTERDIRECTION_UNKNOWN) )
467 throw RuntimeException();
468
469 bool bRet = false;
470 setMediaDescriptor( rMediaDescSeq );
471 DocumentOpenedGuard aOpenedGuard( mxImpl->maFileUrl );
472 if( aOpenedGuard.isValid() || mxImpl->maFileUrl.isEmpty() )
473 {
474 Reference<XModel> xTempModel = mxImpl->mxModel;
475 xTempModel->lockControllers();
476 comphelper::ScopeGuard const lockControllersGuard([xTempModel]() {
477 xTempModel->unlockControllers();
478 });
479
480 switch( mxImpl->meDirection )
481 {
482 case FILTERDIRECTION_UNKNOWN:
483 break;
484 case FILTERDIRECTION_IMPORT:
485 if( mxImpl->mxInStream.is() )
486 {
487 mxImpl->mxStorage = implCreateStorage( mxImpl->mxInStream );
488 bRet = mxImpl->mxStorage && importDocument();
489 }
490 break;
491 case FILTERDIRECTION_EXPORT:
492 if( mxImpl->mxOutStream.is() )
493 {
494 mxImpl->mxStorage = implCreateStorage( mxImpl->mxOutStream );
495 bRet = mxImpl->mxStorage && exportDocument() && implFinalizeExport( getMediaDescriptor() );
496 }
497 break;
498 }
499 }
500 return bRet;
501}
502
503void SAL_CALL FilterBase::cancel()
504{
505}
506
507// protected
508
509Reference< XInputStream > FilterBase::implGetInputStream( MediaDescriptor& rMediaDesc ) const
510{
511 return rMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INPUTSTREAM, Reference< XInputStream >() );
512}
513
514Reference< XStream > FilterBase::implGetOutputStream( MediaDescriptor& rMediaDesc ) const
515{
516 return rMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_STREAMFOROUTPUT, Reference< XStream >() );
517}
518
520{
521 return true;
522}
523
524Reference< XStream > const & FilterBase::getMainDocumentStream( ) const
525{
526 return mxImpl->mxOutStream;
527}
528
529// private
530
531void FilterBase::setMediaDescriptor( const Sequence< PropertyValue >& rMediaDescSeq )
532{
533 mxImpl->maMediaDesc << rMediaDescSeq;
534
535 switch( mxImpl->meDirection )
536 {
537 case FILTERDIRECTION_UNKNOWN:
538 OSL_FAIL( "FilterBase::setMediaDescriptor - invalid filter direction" );
539 break;
540 case FILTERDIRECTION_IMPORT:
541 mxImpl->maMediaDesc.addInputStream();
542 mxImpl->mxInStream = implGetInputStream( mxImpl->maMediaDesc );
543 OSL_ENSURE( mxImpl->mxInStream.is(), "FilterBase::setMediaDescriptor - missing input stream" );
544 break;
545 case FILTERDIRECTION_EXPORT:
546 mxImpl->mxOutStream = implGetOutputStream( mxImpl->maMediaDesc );
547 OSL_ENSURE( mxImpl->mxOutStream.is(), "FilterBase::setMediaDescriptor - missing output stream" );
548 break;
549 }
550
551 mxImpl->maFileUrl = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL, OUString() );
552 mxImpl->mxTargetFrame = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_FRAME, Reference< XFrame >() );
553 mxImpl->mxStatusIndicator = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_STATUSINDICATOR, Reference< XStatusIndicator >() );
554 mxImpl->mxInteractionHandler = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER, Reference< XInteractionHandler >() );
555 mxImpl->mxParentShape = mxImpl->maMediaDesc.getUnpackedValueOrDefault( "ParentShape", mxImpl->mxParentShape );
556 mxImpl->maFilterData = mxImpl->maMediaDesc.getUnpackedValueOrDefault( "FilterData", Sequence< PropertyValue >() );
557
558 // Check for ISO OOXML
559 OUString sFilterName = mxImpl->maMediaDesc.getUnpackedValueOrDefault( "FilterName", OUString() );
560 try
561 {
562 Reference<XMultiServiceFactory> xFactory(getComponentContext()->getServiceManager(), UNO_QUERY_THROW);
563 Reference<XNameAccess> xFilters(xFactory->createInstance("com.sun.star.document.FilterFactory" ), UNO_QUERY_THROW );
564 Any aValues = xFilters->getByName( sFilterName );
565 Sequence<PropertyValue > aPropSeq;
566 aValues >>= aPropSeq;
567 SequenceAsHashMap aProps( aPropSeq );
568
569 sal_Int32 nVersion = aProps.getUnpackedValueOrDefault( "FileFormatVersion", sal_Int32( 0 ) );
570 mxImpl->meVersion = OoxmlVersion( nVersion );
571 }
572 catch ( const Exception& )
573 {
574 // Not ISO OOXML
575 }
576}
577
579{
580 // default: return base implementation without any special behaviour
581 return new GraphicHelper( mxImpl->mxComponentContext, mxImpl->mxTargetFrame, mxImpl->mxStorage );
582}
583
585{
586 return mxImpl->mbExportVBA;
587}
588
590{
591 return mxImpl->mbExportTemplate;
592}
593
594} // namespace oox::core
595
596/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
void copyToStream(BinaryOutputStream &rOutStrm)
Copies bytes from the current position to the passed output stream.
bool isEof() const
Returns true, if the stream position is invalid (EOF).
Wraps a UNO input stream and provides convenient access functions.
Provides helper functions for colors, device measurement conversion, graphics, and graphic objects ha...
Contains tables for named drawing objects for a document model.
Wraps a StreamDataSequence and provides convenient access functions.
::comphelper::SequenceAsHashMap & getFilterData() const
Returns the FilterData.
Definition: filterbase.cxx:245
bool importBinaryData(StreamDataSequence &orDataSeq, const OUString &rStreamName)
Imports the raw binary data from the specified stream.
Definition: filterbase.cxx:382
const OUString & getFileUrl() const
Returns the URL of the imported or exported file.
Definition: filterbase.cxx:250
bool isExportFilter() const
Returns true, if filter is an export filter.
Definition: filterbase.cxx:205
void setMediaDescriptor(const css::uno::Sequence< css::beans::PropertyValue > &rMediaDescSeq)
Definition: filterbase.cxx:531
utl::MediaDescriptor & getMediaDescriptor() const
Returns the media descriptor.
Definition: filterbase.cxx:240
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: filterbase.cxx:406
OUString getAbsoluteUrl(const OUString &rUrl) const
Returns an absolute URL for the passed relative or absolute URL.
Definition: filterbase.cxx:268
bool exportVBA() const
Definition: filterbase.cxx:584
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArgs) override
Receives user defined arguments.
Definition: filterbase.cxx:413
virtual bool importDocument()=0
Derived classes implement import of the entire document.
virtual ~FilterBase() override
Definition: filterbase.cxx:196
virtual bool exportDocument()=0
Derived classes implement export of the entire document.
virtual void SAL_CALL setTargetDocument(const css::uno::Reference< css::lang::XComponent > &rxDocument) override
Definition: filterbase.cxx:448
const css::uno::Reference< css::frame::XModel > & getModel() const
Returns the document model (always existing).
Definition: filterbase.cxx:220
bool isImportFilter() const
Returns true, if filter is an import filter.
Definition: filterbase.cxx:200
::oox::ole::VbaProject & getVbaProject() const
Returns the VBA project manager.
Definition: filterbase.cxx:375
OoxmlVersion getVersion() const
Definition: filterbase.cxx:210
void commitStorage() const
Commits changes to base storage (and substorages)
Definition: filterbase.cxx:339
const css::uno::Reference< css::lang::XMultiServiceFactory > & getModelFactory() const
Returns the service factory provided by the document model (always existing).
Definition: filterbase.cxx:225
const css::uno::Reference< css::task::XStatusIndicator > & getStatusIndicator() const
Returns the status indicator (may be null).
Definition: filterbase.cxx:235
std::unique_ptr< FilterBaseImpl > mxImpl
Definition: filterbase.hxx:267
css::uno::Reference< css::io::XInputStream > openInputStream(const OUString &rStreamName) const
Opens and returns the specified input stream from the base storage.
Definition: filterbase.cxx:327
virtual css::uno::Reference< css::io::XStream > implGetOutputStream(utl::MediaDescriptor &rMediaDesc) const
Definition: filterbase.cxx:514
::oox::ole::OleObjectHelper & getOleObjectHelper() const
Returns a helper for the handling of OLE objects.
Definition: filterbase.cxx:368
bool isExportTemplate() const
Definition: filterbase.cxx:589
GraphicHelper & getGraphicHelper() const
Returns a helper for the handling of graphics and graphic objects.
Definition: filterbase.cxx:346
ModelObjectHelper & getModelObjectHelperForModel(const css::uno::Reference< css::lang::XMultiServiceFactory > &xFactory) const
Definition: filterbase.cxx:360
ModelObjectHelper & getModelObjectHelper() const
Returns a helper with containers for various named drawing objects for the imported document.
Definition: filterbase.cxx:353
virtual ::oox::ole::VbaProject * implCreateVbaProject() const =0
Derived classes create a VBA project manager object.
virtual GraphicHelper * implCreateGraphicHelper() const
Derived classes may create a specialized graphic helper, e.g.
Definition: filterbase.cxx:578
virtual sal_Bool SAL_CALL filter(const css::uno::Sequence< css::beans::PropertyValue > &rMediaDescSeq) override
Definition: filterbase.cxx:464
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: filterbase.cxx:401
const css::uno::Reference< css::uno::XComponentContext > & getComponentContext() const
Returns the component context passed in the filter constructor (always existing).
Definition: filterbase.cxx:215
FilterBase(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
Definition: filterbase.cxx:191
virtual bool implFinalizeExport(utl::MediaDescriptor &rMediaDescriptor)
Definition: filterbase.cxx:519
css::uno::Reference< css::io::XStream > const & getMainDocumentStream() const
Definition: filterbase.cxx:524
css::uno::Reference< css::io::XOutputStream > openOutputStream(const OUString &rStreamName) const
Opens and returns the specified output stream from the base storage.
Definition: filterbase.cxx:334
virtual void SAL_CALL cancel() override
Definition: filterbase.cxx:503
StorageRef const & getStorage() const
Returns the base storage of the imported/exported file.
Definition: filterbase.cxx:322
virtual StorageRef implCreateStorage(const css::uno::Reference< css::io::XInputStream > &rxInStream) const =0
const css::uno::Reference< css::frame::XFrame > & getTargetFrame() const
Returns the frame that will contain the document model (may be null).
Definition: filterbase.cxx:230
virtual css::uno::Reference< css::io::XInputStream > implGetInputStream(utl::MediaDescriptor &rMediaDesc) const
Definition: filterbase.cxx:509
virtual void SAL_CALL setSourceDocument(const css::uno::Reference< css::lang::XComponent > &rxDocument) override
Definition: filterbase.cxx:456
static constexpr OUStringLiteral PROP_INPUTSTREAM
static constexpr OUStringLiteral PROP_URL
static constexpr OUStringLiteral PROP_STREAMFOROUTPUT
static constexpr OUStringLiteral PROP_STATUSINDICATOR
static constexpr OUStringLiteral PROP_FRAME
static constexpr OUStringLiteral PROP_INTERACTIONHANDLER
SfxFilterFlags
float u
sal_Int16 nVersion
Reference< XSingleServiceFactory > xFactory
std::mutex maMutex
Definition: filterbase.cxx:70
::std::set< OUString > maUrls
Definition: filterbase.cxx:71
OUString maUrl
Definition: filterbase.cxx:92
bool mbValid
Definition: filterbase.cxx:93
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
@ Exception
sal_Int32 findValue(const css::uno::Sequence< T1 > &_rList, const T2 &_rValue)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::shared_ptr< StorageBase > StorageRef
Definition: storagebase.hxx:42
css::uno::Sequence< sal_Int8 > StreamDataSequence
FilterDirection meDirection
Definition: filterbase.cxx:133
Reference< XMultiServiceFactory > mxModelFactory
Definition: filterbase.cxx:150
MediaDescriptor maMediaDesc
Definition: filterbase.cxx:136
std::shared_ptr< VbaProject > VbaProjectRef
Definition: filterbase.cxx:131
ModelObjHelperRef mxModelObjHelper
Graphic and graphic object handling.
Definition: filterbase.cxx:142
std::shared_ptr< ModelObjectHelper > ModelObjHelperRef
Definition: filterbase.cxx:129
Reference< XFrame > mxTargetFrame
Definition: filterbase.cxx:151
std::shared_ptr< OleObjectHelper > OleObjHelperRef
Definition: filterbase.cxx:130
Reference< XInputStream > mxInStream
Definition: filterbase.cxx:152
OleObjHelperRef mxOleObjHelper
Definition: filterbase.cxx:145
FilterBaseImpl(const Reference< XComponentContext > &rxContext)
Definition: filterbase.cxx:169
SequenceAsHashMap maArguments
Definition: filterbase.cxx:134
Reference< XStream > mxOutStream
Definition: filterbase.cxx:153
VbaProjectRef mxVbaProject
OLE object handling.
Definition: filterbase.cxx:146
Reference< XComponentContext > mxComponentContext
VBA project manager.
Definition: filterbase.cxx:148
std::map< css::uno::Reference< css::lang::XMultiServiceFactory >, ModelObjHelperRef > mxModelObjHelpers
Tables to create new named drawing objects.
Definition: filterbase.cxx:144
Reference< XInteractionHandler > mxInteractionHandler
Definition: filterbase.cxx:155
void setDocumentModel(const Reference< XComponent > &rxComponent)
Definition: filterbase.cxx:178
GraphicHelperRef mxGraphicHelper
Definition: filterbase.cxx:141
Reference< XShape > mxParentShape
Definition: filterbase.cxx:156
std::shared_ptr< GraphicHelper > GraphicHelperRef
Definition: filterbase.cxx:128
Reference< XModel > mxModel
Definition: filterbase.cxx:149
SequenceAsHashMap maFilterData
Definition: filterbase.cxx:135
Reference< XStatusIndicator > mxStatusIndicator
Definition: filterbase.cxx:154
unsigned char sal_Bool