30#include <com/sun/star/io/IOException.hpp>
31#include <com/sun/star/lang/DisposedException.hpp>
32#include <com/sun/star/reflection/ProxyFactory.hpp>
47ParentStorageHolder::ParentStorageHolder(
48 uno::Reference< embed::XStorage > xParentStorage,
49 const OUString & rUri )
50: m_xParentStorage(
std::move( xParentStorage )),
51 m_bParentIsRootStorage( false )
64 const OUString & rUri,
65 const uno::Reference< embed::XStorage > & xParentStorage,
66 const uno::Reference< embed::XStorage > & xStorageToWrap )
69 m_xWrappedStorage( xStorageToWrap ),
70 m_xWrappedTransObj( xStorageToWrap,
uno::UNO_QUERY ),
71 m_xWrappedComponent( xStorageToWrap ),
73 m_bIsDocumentStorage(
Uri( rUri ).isDocument() )
76 "Storage::Storage: No storage to wrap!" );
79 "Storage::Storage: No component to wrap!" );
82 "Storage::Storage: No Type Provider!" );
87 uno::Reference< reflection::XProxyFactory > xProxyFac =
88 reflection::ProxyFactory::create( rxContext );
91 catch ( uno::Exception
const & )
97 "Storage::Storage: Wrapped storage cannot be aggregated!" );
121 m_xAggProxy->setDelegator( uno::Reference< uno::XInterface >() );
135 catch ( lang::DisposedException
const & )
153 uno::Any aRet = StorageUNOBase::queryInterface( aType );
182 OWeakObject::release();
199 return css::uno::Sequence<sal_Int8>();
216 const uno::Reference< lang::XEventListener >& xListener )
223 const uno::Reference< lang::XEventListener >& aListener )
275 const uno::Reference< embed::XStorage >& xDest )
283 const OUString& aStreamName, sal_Int32 nOpenMode )
291 const OUString& aStreamName,
293 const OUString& aPassword )
296 aStreamName, nOpenMode, aPassword );
302 const OUString& aStorName, sal_Int32 nOpenMode )
310 const OUString& aStreamName )
318 const OUString& aStreamName,
319 const OUString& aPassword )
328 const uno::Reference< embed::XStorage >& xTargetStorage )
336 const OUString& aStorName,
337 const uno::Reference< embed::XStorage >& xTargetStorage )
345 const OUString& aElementName )
353 const OUString& aElementName )
368 const OUString& aNewName )
376 const OUString& aElementName,
377 const uno::Reference< embed::XStorage >& xDest,
378 const OUString& aNewName )
386 const OUString& aElementName,
387 const uno::Reference< embed::XStorage >& xDest,
388 const OUString& rNewName )
404 if ( !xParentStorage.is() )
416 uno::Reference< embed::XTransactedObject > xParentTA(
417 xParentStorage, uno::UNO_QUERY );
418 OSL_ENSURE( xParentTA.is(),
"No XTransactedObject interface!" );
420 if ( xParentTA.is() )
430 if ( !xParentStorage.is() )
442 uno::Reference< embed::XTransactedObject > xParentTA(
443 xParentStorage, uno::UNO_QUERY );
444 OSL_ENSURE( xParentTA.is(),
"No XTransactedObject interface!" );
446 if ( xParentTA.is() )
456 const uno::Reference< uno::XComponentContext > & rxContext,
457 const OUString & rUri,
458 const uno::Reference< embed::XStorage > & xParentStorage,
459 const uno::Reference< io::XOutputStream > & xStreamToWrap )
461 m_xWrappedStream( xStreamToWrap ),
462 m_xWrappedComponent( xStreamToWrap,
uno::UNO_QUERY ),
465 OSL_ENSURE( m_xWrappedStream.is(),
466 "OutputStream::OutputStream: No stream to wrap!" );
469 "OutputStream::OutputStream: No component to wrap!" );
472 "OutputStream::OutputStream: No Type Provider!" );
477 uno::Reference< reflection::XProxyFactory > xProxyFac =
478 reflection::ProxyFactory::create( rxContext );
479 m_xAggProxy = xProxyFac->createProxy( m_xWrappedStream );
481 catch ( uno::Exception
const & )
487 "OutputStream::OutputStream: Wrapped stream cannot be aggregated!" );
492 osl_atomic_increment( &m_refCount );
503 osl_atomic_decrement( &m_refCount );
511 m_xAggProxy->setDelegator( uno::Reference< uno::XInterface >() );
521 uno::Any aRet = OutputStreamUNOBase::queryInterface( aType );
546 return css::uno::Sequence<sal_Int8>();
599 const uno::Reference< lang::XEventListener >& xListener )
608 const uno::Reference< lang::XEventListener >& aListener )
618 const uno::Reference< uno::XComponentContext > & rxContext,
620 const OUString & rUri,
621 const uno::Reference< embed::XStorage > & xParentStorage,
622 const uno::Reference< io::XStream > & xStreamToWrap )
626 m_xWrappedStream( xStreamToWrap ),
628 m_xWrappedTruncate( m_xWrappedOutputStream,
uno::UNO_QUERY ),
629 m_xWrappedInputStream( xStreamToWrap->getInputStream() ),
630 m_xWrappedComponent( xStreamToWrap,
uno::UNO_QUERY ),
634 "OutputStream::OutputStream: No stream to wrap!" );
637 "OutputStream::OutputStream: No component to wrap!" );
640 "OutputStream::OutputStream: No Type Provider!" );
645 uno::Reference< reflection::XProxyFactory > xProxyFac =
646 reflection::ProxyFactory::create( rxContext );
649 catch ( uno::Exception
const & )
655 "OutputStream::OutputStream: Wrapped stream cannot be aggregated!" );
679 m_xAggProxy->setDelegator( uno::Reference< uno::XInterface >() );
689 uno::Any aRet = StreamUNOBase::queryInterface( aType );
714 return css::uno::Sequence<sal_Int8>();
724 return uno::Reference< io::XInputStream >(
this );
731 return uno::Reference< io::XOutputStream >(
this );
794 sal_Int32 nBytesToRead )
802 sal_Int32 nMaxBytesToRead )
845 const uno::Reference< lang::XEventListener >& xListener )
853 const uno::Reference< lang::XEventListener >& aListener )
864 uno::Reference< embed::XTransactedObject >
866 OSL_ENSURE( xParentTA.is(),
"No XTransactedObject interface!" );
868 if ( xParentTA.is() )
874 catch ( lang::WrappedTargetException
const & )
876 throw io::IOException();
Reference< lang::XTypeProvider > m_xWrappedTypeProv
virtual void SAL_CALL closeOutput() override
virtual void SAL_CALL flush() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual ~OutputStream() override
OutputStream(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &rUri, const css::uno::Reference< css::embed::XStorage > &xParentStorage, const css::uno::Reference< css::io::XOutputStream > &xStreamToWrap)
css::uno::Reference< css::lang::XTypeProvider > m_xWrappedTypeProv
css::uno::Reference< css::io::XOutputStream > m_xWrappedStream
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
css::uno::Reference< css::lang::XComponent > m_xWrappedComponent
virtual void SAL_CALL writeBytes(const css::uno::Sequence< sal_Int8 > &aData) override
css::uno::Reference< css::uno::XAggregation > m_xAggProxy
virtual void SAL_CALL dispose() override
bool m_bParentIsRootStorage
bool isParentARootStorage() const
const css::uno::Reference< css::embed::XStorage > & getParentStorage() const
void setParentStorage(const css::uno::Reference< css::embed::XStorage > &xStg)
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
css::uno::Reference< css::lang::XTypeProvider > m_xWrappedTypeProv
css::uno::Reference< css::embed::XStorage > m_xWrappedStorage
css::uno::Reference< css::uno::XAggregation > m_xAggProxy
virtual void SAL_CALL removeElement(const OUString &aElementName) override
css::uno::Reference< css::lang::XComponent > m_xWrappedComponent
virtual void SAL_CALL commit() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Storage(const css::uno::Reference< css::uno::XComponentContext > &rxContext, rtl::Reference< StorageElementFactory > xFactory, const OUString &rUri, const css::uno::Reference< css::embed::XStorage > &xParentStorage, const css::uno::Reference< css::embed::XStorage > &xStorageToWrap)
virtual void SAL_CALL copyStorageElementLastCommitTo(const OUString &aStorName, const css::uno::Reference< css::embed::XStorage > &xTargetStorage) override
virtual css::uno::Reference< css::embed::XStorage > SAL_CALL openStorageElement(const OUString &aStorName, sal_Int32 nOpenMode) override
virtual css::uno::Reference< css::io::XStream > SAL_CALL cloneEncryptedStreamElement(const OUString &aStreamName, const OUString &aPassword) override
virtual css::uno::Reference< css::io::XStream > SAL_CALL openStreamElement(const OUString &aStreamName, sal_Int32 nOpenMode) override
virtual sal_Bool SAL_CALL isStreamElement(const OUString &aElementName) override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual sal_Bool SAL_CALL hasElements() override
virtual void SAL_CALL dispose() override
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL copyToStorage(const css::uno::Reference< css::embed::XStorage > &xDest) override
rtl::Reference< StorageElementFactory > m_xFactory
virtual css::uno::Type SAL_CALL getElementType() override
virtual void SAL_CALL moveElementTo(const OUString &aElementName, const css::uno::Reference< css::embed::XStorage > &xDest, const OUString &rNewName) override
virtual void SAL_CALL copyLastCommitTo(const css::uno::Reference< css::embed::XStorage > &xTargetStorage) override
virtual ~Storage() override
virtual void SAL_CALL revert() override
virtual void SAL_CALL copyElementTo(const OUString &aElementName, const css::uno::Reference< css::embed::XStorage > &xDest, const OUString &aNewName) override
virtual void SAL_CALL renameElement(const OUString &aEleName, const OUString &aNewName) override
bool m_bIsDocumentStorage
css::uno::Reference< css::embed::XTransactedObject > m_xWrappedTransObj
virtual css::uno::Reference< css::io::XStream > SAL_CALL openEncryptedStreamElement(const OUString &aStreamName, sal_Int32 nOpenMode, const OUString &aPassword) override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual css::uno::Reference< css::io::XStream > SAL_CALL cloneStreamElement(const OUString &aStreamName) override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
virtual sal_Bool SAL_CALL isStorageElement(const OUString &aElementName) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual void SAL_CALL release() noexcept override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual sal_Int32 SAL_CALL readSomeBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nMaxBytesToRead) override
virtual sal_Int32 SAL_CALL readBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nBytesToRead) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual void SAL_CALL writeBytes(const css::uno::Sequence< sal_Int8 > &aData) override
virtual void SAL_CALL dispose() override
virtual void SAL_CALL flush() override
css::uno::Reference< css::lang::XComponent > m_xWrappedComponent
css::uno::Reference< css::io::XOutputStream > m_xWrappedOutputStream
css::uno::Reference< css::io::XStream > m_xWrappedStream
virtual sal_Int32 SAL_CALL available() override
css::uno::Reference< css::uno::XAggregation > m_xAggProxy
css::uno::Reference< css::io::XInputStream > m_xWrappedInputStream
virtual void SAL_CALL closeInput() override
virtual void SAL_CALL closeOutput() override
rtl::Reference< OfficeDocumentsManager > m_docsMgr
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL getOutputStream() override
virtual void SAL_CALL truncate() override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
css::uno::Reference< css::lang::XTypeProvider > m_xWrappedTypeProv
Stream(const css::uno::Reference< css::uno::XComponentContext > &rxContext, rtl::Reference< OfficeDocumentsManager > const &docsMgr, const OUString &rUri, const css::uno::Reference< css::embed::XStorage > &xParentStorage, const css::uno::Reference< css::io::XStream > &xStreamToWrap)
css::uno::Reference< css::io::XTruncate > m_xWrappedTruncate
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getInputStream() override
virtual ~Stream() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
#define TOOLS_WARN_EXCEPTION(area, stream)
Reference< XSingleServiceFactory > xFactory
constexpr OUStringLiteral aData
bool getOutputStream(ProgramOptions const &options, OString const &extension, std::ostream **ppOutputStream, OString &targetSourceFileName, OString &tmpSourceFileName)