27#include <com/sun/star/beans/PropertyValue.hpp>
28#include <com/sun/star/embed/ElementModes.hpp>
29#include <com/sun/star/embed/InvalidStorageException.hpp>
30#include <com/sun/star/embed/UseBackupException.hpp>
31#include <com/sun/star/embed/StorageFormats.hpp>
32#include <com/sun/star/embed/StorageWrappedTargetException.hpp>
33#include <com/sun/star/packages/NoEncryptionException.hpp>
34#include <com/sun/star/packages/NoRawFormatException.hpp>
35#include <com/sun/star/packages/WrongPasswordException.hpp>
36#include <com/sun/star/io/TempFile.hpp>
37#include <com/sun/star/ucb/SimpleFileAccess.hpp>
38#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
39#include <com/sun/star/container/XEnumerationAccess.hpp>
40#include <com/sun/star/container/XNamed.hpp>
41#include <com/sun/star/util/XChangesBatch.hpp>
43#include <com/sun/star/lang/XComponent.hpp>
44#include <com/sun/star/lang/DisposedException.hpp>
45#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
46#include <com/sun/star/beans/NamedValue.hpp>
66#if OSL_DEBUG_LEVEL > 0
67#define THROW_WHERE SAL_WHERE
74 const uno::Reference< io::XStream >& xSource,
75 const uno::Reference< io::XStream >& xDest,
76 sal_Int32 nStorageType,
77 const uno::Sequence< uno::Sequence< beans::StringPair > >& aRelInfo )
79 uno::Reference< beans::XPropertySet > xSourceProps( xSource, uno::UNO_QUERY_THROW );
80 uno::Reference< beans::XPropertySet > xDestProps( xDest, uno::UNO_QUERY_THROW );
82 uno::Reference< io::XOutputStream > xDestOutStream = xDest->getOutputStream();
83 if ( !xDestOutStream.is() )
86 uno::Reference< io::XInputStream > xSourceInStream = xSource->getInputStream();
87 if ( !xSourceInStream.is() )
93 uno::Sequence<OUString>
aPropNames {
"Compressed",
"MediaType",
94 "UseCommonStoragePasswordEncryption" };
96 if ( nStorageType == embed::StorageFormats::OFOPXML )
99 uno::Reference< embed::XRelationshipAccess > xRelAccess( xDest, uno::UNO_QUERY_THROW );
100 xRelAccess->clearRelationships();
101 xRelAccess->insertRelationships( aRelInfo,
false );
105 else if ( nStorageType != embed::StorageFormats::PACKAGE )
110 for (
const auto& rPropName : std::as_const(
aPropNames) )
111 xDestProps->setPropertyValue( rPropName, xSourceProps->getPropertyValue( rPropName ) );
114static uno::Reference< io::XInputStream >
GetSeekableTempCopy(
const uno::Reference< io::XInputStream >& xInStream )
117 uno::Reference < io::XOutputStream > xTempOut = xTempFile->getOutputStream();
118 uno::Reference < io::XInputStream > xTempIn = xTempFile->getInputStream();
120 if ( !xTempOut.is() || !xTempIn.is() )
124 xTempOut->closeOutput();
131 , m_bIsRemoved(false)
132 , m_bIsInserted(bNew)
133 , m_bIsStorage(bStor)
140 const uno::Sequence< beans::PropertyValue >& xProperties,
141 uno::Reference< uno::XComponentContext >
const & xContext,
142 sal_Int32 nStorageType )
144, m_pAntiImpl( nullptr )
145, m_nStorageMode( nMode & ~embed::ElementModes::SEEKABLE )
146, m_bIsModified( ( nMode & ( embed::ElementModes::
WRITE | embed::ElementModes::TRUNCATE ) ) == ( embed::ElementModes::
WRITE | embed::ElementModes::TRUNCATE ) )
147, m_bBroadcastModified( false )
148, m_bCommited( false )
150, m_bListCreated( false )
151, m_nModifiedListenerCount( 0 )
153, m_xProperties( xProperties )
154, m_bHasCommonEncryptionData( false )
155, m_pParent( nullptr )
156, m_bControlMediaType( false )
157, m_bMTFallbackUsed( false )
158, m_bControlVersion( false )
159, m_nStorageType( nStorageType )
160, m_pRelStorElement( nullptr )
164 SAL_WARN_IF( !xInputStream.is(),
"package.xstor",
"No input stream is provided!" );
165 assert(xContext.is());
168 m_xInputStream = m_pSwitchStream->getInputStream();
170 if ( m_nStorageMode & embed::ElementModes::WRITE )
173 SAL_WARN(
"package.xstor",
"No stream for writing is provided!" );
180 const uno::Sequence< beans::PropertyValue >& xProperties,
181 uno::Reference< uno::XComponentContext >
const & xContext,
182 sal_Int32 nStorageType )
184, m_pAntiImpl( nullptr )
185, m_nStorageMode( nMode & ~embed::ElementModes::SEEKABLE )
186, m_bIsModified( ( nMode & ( embed::ElementModes::
WRITE | embed::ElementModes::TRUNCATE ) ) == ( embed::ElementModes::
WRITE | embed::ElementModes::TRUNCATE ) )
187, m_bBroadcastModified( false )
188, m_bCommited( false )
190, m_bListCreated( false )
191, m_nModifiedListenerCount( 0 )
193, m_xProperties( xProperties )
194, m_bHasCommonEncryptionData( false )
195, m_pParent( nullptr )
196, m_bControlMediaType( false )
197, m_bMTFallbackUsed( false )
198, m_bControlVersion( false )
199, m_nStorageType( nStorageType )
200, m_pRelStorElement( nullptr )
205 assert(xContext.is());
207 if ( m_nStorageMode & embed::ElementModes::WRITE )
210 m_xStream =
static_cast< io::XStream*
>( m_pSwitchStream.get() );
215 m_xInputStream = m_pSwitchStream->getInputStream();
221 uno::Reference< container::XNameContainer >
const & xPackageFolder,
222 uno::Reference< lang::XSingleServiceFactory > xPackage,
223 uno::Reference< uno::XComponentContext >
const & xContext,
224 sal_Int32 nStorageType )
226, m_pAntiImpl( nullptr )
227, m_nStorageMode( nMode & ~embed::ElementModes::SEEKABLE )
228, m_bIsModified( ( nMode & ( embed::ElementModes::
WRITE | embed::ElementModes::TRUNCATE ) ) == ( embed::ElementModes::
WRITE | embed::ElementModes::TRUNCATE ) )
229, m_bBroadcastModified( false )
230, m_bCommited( false )
232, m_bListCreated( false )
233, m_nModifiedListenerCount( 0 )
234, m_xPackageFolder( xPackageFolder )
237, m_bHasCommonEncryptionData( false )
238, m_pParent( pParent )
239, m_bControlMediaType( false )
240, m_bMTFallbackUsed( false )
241, m_bControlVersion( false )
242, m_nStorageType( nStorageType )
243, m_pRelStorElement( nullptr )
246 SAL_WARN_IF( !xPackageFolder.is(),
"package.xstor",
"No package folder!" );
247 assert(xContext.is());
253 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
261 catch (
const uno::Exception& )
271 uno::Reference< embed::XStorage > xTmp = rStorage.m_xWeakRef;
275 }
catch(
const uno::Exception& )
288 for (
auto pElement : pair.second)
304 OUString aPropertyName =
"URL";
307 if ( rProp.Name == aPropertyName )
320 uno::Reference< io::XInputStream > xInStr =
m_xStream->getInputStream();
322 xInStr->closeInput();
324 uno::Reference< io::XOutputStream > xOutStr =
m_xStream->getOutputStream();
326 xOutStr->closeOutput();
331 catch (
const uno::Exception&)
342 OSL_ENSURE( aStorage.
GetRefCount_Impl(),
"There must be a reference alive to use this method!" );
351 uno::Reference< embed::XStorage > xTmp = pStorageIter->m_xWeakRef;
352 if ( !xTmp.is() || pStorageIter->m_pPointer == &aStorage )
355 pStorageIter->m_pPointer->InternalDispose(
false );
356 }
catch(
const uno::Exception& )
372 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
391 pArguments[ 1 ] <<= beans::NamedValue(
"AllowRemoveOnInsert",
394 sal_Int32 nArgNum = 2;
397 if ( rProp.Name ==
"RepairPackage"
398 || rProp.Name ==
"ProgressHandler"
399 || rProp.Name ==
"NoFileSync" )
402 beans::NamedValue aNamedValue( rProp.Name, rProp.Value );
405 pArguments[nArgNum-1] <<= aNamedValue;
407 else if ( rProp.Name ==
"Password" )
417 beans::NamedValue aNamedValue;
418 aNamedValue.Name =
"StorageFormat";
419 aNamedValue.Value <<= OUString(
"ZipFormat" );
422 pArguments[nArgNum-1] <<= aNamedValue;
427 beans::NamedValue aNamedValue;
428 aNamedValue.Name =
"StorageFormat";
429 aNamedValue.Value <<= OUString(
"OFOPXMLFormat" );
432 pArguments[nArgNum-1] <<= aNamedValue;
440 uno::Reference< container::XHierarchicalNameAccess > xHNameAccess(
m_xPackage, uno::UNO_QUERY );
441 SAL_WARN_IF( !xHNameAccess.is(),
"package.xstor",
"The package could not be created!" );
443 if ( xHNameAccess.is() )
445 uno::Any aFolder = xHNameAccess->getByHierarchicalName(
"/");
452 throw embed::InvalidStorageException(
THROW_WHERE );
457 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
468 uno::Reference< beans::XPropertySet > xProps(
m_xPackageFolder, uno::UNO_QUERY_THROW );
472 uno::Reference< beans::XPropertySet > xPackageProps(
m_xPackage, uno::UNO_QUERY_THROW );
475 static constexpr OUStringLiteral
sMediaType(
u"MediaType");
482 xProps->getPropertyValue(
"Version" ) >>=
m_aVersion;
497 uno::Reference< io::XInputStream > xRelInfoStream
501 if ( xRelInfoStream.is() )
502 m_aRelInfo = ::comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(
508 catch (css::uno::Exception &)
519 m_aRelInfo = ::comphelper::OFOPXMLHelper::ReadRelationsInfoSequence(
526 catch(
const uno::Exception& )
535 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
543 uno::Reference< container::XEnumerationAccess > xEnumAccess(
m_xPackageFolder, uno::UNO_QUERY_THROW );
544 uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration();
550 while( xEnum->hasMoreElements() )
553 uno::Reference< container::XNamed > xNamed;
554 xEnum->nextElement() >>= xNamed;
558 SAL_WARN(
"package.xstor",
"XNamed is not supported!" );
562 OUString
aName = xNamed->getName();
565 uno::Reference< container::XNameContainer > xNameContainer( xNamed, uno::UNO_QUERY );
567 std::unique_ptr<SotElement_Impl> xNewElement(
new SotElement_Impl(
aName, xNameContainer.is(),
false));
570 if (!xNewElement->m_bIsStorage)
578 if ( (
m_nStorageMode & embed::ElementModes::TRUNCATE ) == embed::ElementModes::TRUNCATE )
581 xNewElement->m_bIsRemoved =
true;
587 catch(
const container::NoSuchElementException& )
593 if ( (
m_nStorageMode & embed::ElementModes::TRUNCATE ) == embed::ElementModes::TRUNCATE )
597 m_aRelInfo = uno::Sequence< uno::Sequence< beans::StringPair > >();
607 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
609 uno::Reference< beans::XPropertySet > xPropSet( xDest, uno::UNO_QUERY );
610 if ( !xPropSet.is() )
611 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 1 );
613 sal_Int32 nDestMode = embed::ElementModes::READ;
614 xPropSet->getPropertyValue(
"OpenMode" ) >>= nDestMode;
616 if ( !( nDestMode & embed::ElementModes::WRITE ) )
622 throw embed::InvalidStorageException(
THROW_WHERE );
625 for (
auto pElement : pair.second)
627 if ( !pElement->m_bIsRemoved )
641 bool bIsRoot =
false;
642 if ( ( xPropSet->getPropertyValue(
"IsRoot" ) >>= bIsRoot ) && bIsRoot )
646 uno::Reference< embed::XEncryptionProtectedStorage > xEncr( xDest, uno::UNO_QUERY );
651 uno::Sequence< beans::NamedValue > aAlgorithms;
652 uno::Reference< beans::XPropertySet > xPackPropSet(
m_xPackage, uno::UNO_QUERY_THROW );
655 xEncr->setEncryptionAlgorithms( aAlgorithms );
658 catch(
const packages::NoEncryptionException& )
678 uno::Reference< embed::XRelationshipAccess > xRels( xDest, uno::UNO_QUERY );
680 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 1 );
686 uno::Reference< embed::XTransactedObject > xObjToCommit( xDest, uno::UNO_QUERY );
687 if ( xObjToCommit.is() )
688 xObjToCommit->commit();
692 const uno::Reference< embed::XStorage >& xDest,
693 const OUString& aName,
696 SAL_WARN_IF( !xDest.is(),
"package.xstor",
"No destination storage!" );
699 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
701 uno::Reference< container::XNameAccess > xDestAccess( xDest, uno::UNO_QUERY_THROW );
702 if ( xDestAccess->hasByName(
aName )
704 xDest->removeElement(
aName );
708 uno::Reference< embed::XStorage > xSubDest =
709 xDest->openStorageElement(
aName,
710 embed::ElementModes::WRITE );
712 SAL_WARN_IF( !xSubDest.is(),
"package.xstor",
"No destination substorage!" );
721 pElement->
m_xStorage->CopyToStorage(xSubDest, bDirect);
737 uno::Sequence< beans::PropertyValue > aStrProps(0);
738 const uno::Sequence< beans::PropertyValue > aSrcPkgProps = pElement->
m_xStream->GetStreamProperties();
740 for (
const auto& rSrcPkgProp : aSrcPkgProps )
742 if ( rSrcPkgProp.Name ==
"MediaType" || rSrcPkgProp.Name ==
"Compressed" )
744 aStrProps.realloc( ++nNum );
745 auto pStrProps = aStrProps.getArray();
746 pStrProps[nNum-1].Name = rSrcPkgProp.Name;
747 pStrProps[nNum-1].Value = rSrcPkgProp.Value;
753 aStrProps.realloc( ++nNum );
754 auto pStrProps = aStrProps.getArray();
755 pStrProps[nNum-1].Name =
"UseCommonStoragePasswordEncryption";
756 pStrProps[nNum-1].Value <<= pElement->
m_xStream->UsesCommonEncryption_Impl();
769 uno::Reference< embed::XRelationshipAccess > xRels( xDest, uno::UNO_QUERY );
771 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 0 );
776 uno::Reference< embed::XOptimizedStorage > xOptDest( xDest, uno::UNO_QUERY_THROW );
777 uno::Reference < io::XInputStream > xInputToInsert;
779 if (pElement->
m_xStream->HasTempFile_Impl() || !pElement->
m_xStream->m_xPackageStream.is())
781 SAL_WARN_IF(!pElement->
m_xStream->m_xPackageStream.is(),
"package.xstor",
"No package stream!");
784 xInputToInsert = pElement->
m_xStream->GetTempFileAsInputStream();
791 xInputToInsert = pElement->
m_xStream->m_xPackageStream->getDataStream();
794 if ( !xInputToInsert.is() )
797 xOptDest->insertStreamElementDirect(
aName, xInputToInsert, aStrProps );
801 uno::Reference< io::XStream > xSubStr =
802 xDest->openStreamElement(
aName,
803 embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
804 SAL_WARN_IF( !xSubStr.is(),
"package.xstor",
"No destination substream!" );
806 pElement->
m_xStream->CopyInternallyTo_Impl(xSubStr);
811 SAL_WARN(
"package.xstor",
"Encryption is only supported in package storage!" );
814 else if ( pElement->
m_xStream->HasCachedEncryptionData()
815 && ( pElement->
m_xStream->IsModified() || pElement->
m_xStream->HasWriteOwner_Impl() ) )
818 bool bHasCommonEncryptionData =
false;
822 bHasCommonEncryptionData =
true;
824 catch(
const packages::NoEncryptionException& )
833 uno::Reference< io::XStream > xDestStream =
834 xDest->openStreamElement(
aName,
835 embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
837 pElement->
m_xStream->CopyInternallyTo_Impl( xDestStream );
839 uno::Reference< beans::XPropertySet > xProps( xDestStream, uno::UNO_QUERY_THROW );
840 xProps->setPropertyValue(
841 "UseCommonStoragePasswordEncryption",
847 uno::Reference< embed::XStorage2 > xDest2( xDest, uno::UNO_QUERY_THROW );
848 uno::Reference< io::XStream > xSubStr =
849 xDest2->openEncryptedStream(
aName,
850 embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE,
851 pElement->
m_xStream->GetCachedEncryptionData().getAsConstNamedValueList() );
852 SAL_WARN_IF( !xSubStr.is(),
"package.xstor",
"No destination substream!" );
854 pElement->
m_xStream->CopyInternallyTo_Impl(xSubStr, pElement->
m_xStream->GetCachedEncryptionData());
865 uno::Reference< io::XStream > xOwnStream = pElement->
m_xStream->GetStream(embed::ElementModes::READ,
867 uno::Reference< io::XStream > xDestStream =
868 xDest->openStreamElement(
aName,
869 embed::ElementModes::READWRITE | embed::ElementModes::TRUNCATE );
870 SAL_WARN_IF( !xDestStream.is(),
"package.xstor",
"No destination substream!" );
873 uno::Reference< beans::XPropertySet > xProps( xDestStream, uno::UNO_QUERY_THROW );
874 xProps->setPropertyValue(
875 "UseCommonStoragePasswordEncryption",
878 catch(
const packages::WrongPasswordException& )
886 uno::Reference< embed::XStorageRawAccess > xRawDest( xDest, uno::UNO_QUERY_THROW );
887 uno::Reference< io::XInputStream > xRawInStream = pElement->
m_xStream->GetRawInStream();
888 xRawDest->insertRawEncrStreamElement(
aName, xRawInStream );
897 return uno::Sequence< uno::Sequence< beans::StringPair > >();
904 throw io::IOException(
THROW_WHERE "Wrong relinfo stream!" );
911 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
918 embed::ElementModes::READ,
929 const uno::Reference< container::XNameContainer >& xParentPackageFolder )
931 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
934 uno::Reference< uno::XInterface > xTmp(
m_xPackageFolder, uno::UNO_QUERY_THROW );
935 xParentPackageFolder->insertByName(
aName,
uno::Any( xTmp ) );
942 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
955 throw embed::InvalidStorageException(
THROW_WHERE );
958 "Commit of readonly storage, should be detected before!" );
960 uno::Reference< container::XNameContainer > xNewPackageFolder;
969 xNewPackageFolder.set(
m_xPackage->createInstanceWithArguments(
aSeq ),
979 if (
m_nStorageType == embed::StorageFormats::OFOPXML && !pDeleted->m_bIsStorage )
984 xNewPackageFolder->removeByName( pDeleted->m_aOriginalName );
993 for (
auto it = mapIt->second.begin(); it != mapIt->second.end(); )
997 auto & pElement = *it;
998 if ( pElement->m_bIsRemoved )
1000 if (
m_nStorageType == embed::StorageFormats::OFOPXML && !pElement->m_bIsStorage )
1005 xNewPackageFolder->removeByName( pElement->m_aOriginalName );
1008 it = mapIt->second.erase(it);
1013 if (mapIt->second.empty())
1022 for (
auto pElement : pair.second)
1026 if ( !pElement->m_bIsInserted )
1033 if ( !pElement->m_bIsStorage && pElement->m_xStream
1034 && !pElement->m_xStream->IsTransacted() )
1035 pElement->m_xStream->Commit();
1039 if (pElement->m_bIsStorage && pElement->m_xStorage && pElement->m_xStorage->m_bCommited)
1046 xNewPackageFolder->removeByName( pElement->m_aOriginalName );
1048 pElement->m_xStorage->InsertIntoPackageFolder(pair.first, xNewPackageFolder);
1050 else if (!pElement->m_bIsStorage && pElement->m_xStream && pElement->m_xStream->m_bFlushed)
1057 xNewPackageFolder->removeByName( pElement->m_aOriginalName );
1059 pElement->m_xStream->InsertIntoPackageFolder(pair.first, xNewPackageFolder);
1067 xNewPackageFolder->insertByName( pair.first, aPackageElement );
1069 else if ( pair.first != pElement->m_aOriginalName )
1073 uno::Any aPackageElement = xNewPackageFolder->getByName( pElement->m_aOriginalName );
1074 xNewPackageFolder->removeByName( pElement->m_aOriginalName );
1075 xNewPackageFolder->insertByName( pair.first, aPackageElement );
1077 if (
m_nStorageType == embed::StorageFormats::OFOPXML && !pElement->m_bIsStorage )
1079 if (!pElement->m_xStream)
1082 if (!pElement->m_xStream)
1090 pElement->m_aOriginalName = pair.first;
1095 for (
auto pElement : pair.second)
1098 if ( pElement->m_bIsInserted )
1100 pElement->m_aOriginalName = pair.first;
1102 if ( pElement->m_bIsStorage )
1104 OSL_ENSURE(pElement->m_xStorage,
"An inserted storage is incomplete!");
1105 if (!pElement->m_xStorage)
1108 if (pElement->m_xStorage->m_bCommited)
1110 pElement->m_xStorage->InsertIntoPackageFolder(pair.first, xNewPackageFolder);
1112 pElement->m_bIsInserted =
false;
1117 OSL_ENSURE(pElement->m_xStream,
"An inserted stream is incomplete!");
1118 if (!pElement->m_xStream)
1121 if (!pElement->m_xStream->IsTransacted())
1122 pElement->m_xStream->Commit();
1124 if (pElement->m_xStream->m_bFlushed)
1129 pElement->m_xStream->InsertIntoPackageFolder( pair.first, xNewPackageFolder );
1131 pElement->m_bIsInserted =
false;
1140 uno::Reference< beans::XPropertySet > xProps( xNewPackageFolder, uno::UNO_QUERY_THROW );
1150 uno::Reference< util::XChangesBatch > xChangesBatch(
m_xPackage, uno::UNO_QUERY_THROW );
1153 xChangesBatch->commitChanges();
1155 catch(
const lang::WrappedTargetException& r )
1159 embed::UseBackupException aException;
1160 if ( r.TargetException >>= aException )
1183 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
1192 std::unordered_map<OUString, std::vector<SotElement_Impl*>> oldMap;
1195 for (
const auto & rPair : oldMap)
1196 for (
auto pElement : rPair.second)
1198 if ( pElement->m_bIsInserted )
1204 pElement->m_bIsRemoved =
false;
1217 pDeleted->m_bIsRemoved =
false;
1230 m_aRelInfo = uno::Sequence< uno::Sequence< beans::StringPair > >();
1237 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() ) ;
1240 throw packages::NoEncryptionException(
THROW_WHERE );
1245 throw packages::NoEncryptionException(
THROW_WHERE );
1252 throw packages::NoEncryptionException(
THROW_WHERE );
1260 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
1262 SAL_WARN_IF( rName.isEmpty(),
"package.xstor",
"Name is empty!" );
1269 for (
auto pElement : mapIt->second)
1270 if (!pElement->m_bIsRemoved)
1278 SAL_WARN_IF( !
m_xPackage.is(),
"package.xstor",
"Not possible to refer to package as to factory!" );
1280 throw embed::InvalidStorageException(
THROW_WHERE);
1283 uno::Reference< uno::XInterface > xNewElement(
m_xPackage->createInstanceWithArguments(
aSeq ) );
1285 SAL_WARN_IF( !xNewElement.is(),
"package.xstor",
"Not possible to create a new stream!" );
1286 if ( !xNewElement.is() )
1289 uno::Reference< packages::XDataSinkEncrSupport > xPackageSubStream( xNewElement, uno::UNO_QUERY_THROW );
1291 OSL_ENSURE(
m_nStorageType == embed::StorageFormats::PACKAGE || !bEncr,
"Only package storage supports encryption!" );
1293 throw packages::NoEncryptionException(
THROW_WHERE );
1309 SAL_WARN_IF( !
m_xPackage.is(),
"package.xstor",
"Not possible to refer to package as to factory!" );
1311 throw embed::InvalidStorageException(
THROW_WHERE );
1314 throw packages::NoEncryptionException(
THROW_WHERE );
1316 uno::Reference< io::XSeekable > xSeek( xInStream, uno::UNO_QUERY );
1317 uno::Reference< io::XInputStream > xInStrToInsert = xSeek.is() ? xInStream :
1321 uno::Reference< uno::XInterface > xNewElement(
m_xPackage->createInstanceWithArguments(
aSeq ) );
1323 SAL_WARN_IF( !xNewElement.is(),
"package.xstor",
"Not possible to create a new stream!" );
1324 if ( !xNewElement.is() )
1327 uno::Reference< packages::XDataSinkEncrSupport > xPackageSubStream( xNewElement, uno::UNO_QUERY_THROW );
1328 xPackageSubStream->setRawStream( xInStrToInsert );
1334 pNewElement->
m_xStream->SetToBeCommited();
1343 SAL_WARN_IF( !
m_xPackage.is(),
"package.xstor",
"Not possible to refer to package as to factory!" );
1345 throw embed::InvalidStorageException(
THROW_WHERE );
1348 uno::Reference< uno::XInterface > xNewElement(
m_xPackage->createInstanceWithArguments(
aSeq ) );
1350 SAL_WARN_IF( !xNewElement.is(),
"package.xstor",
"Not possible to create a new storage!" );
1351 if ( !xNewElement.is() )
1354 uno::Reference< container::XNameContainer > xPackageSubFolder( xNewElement, uno::UNO_QUERY_THROW );
1355 std::unique_ptr<OStorage_Impl> pResult(
1357 pResult->m_bIsModified =
true;
1375 assert(
FindElement(
aName) ==
nullptr &&
"Should not try to insert existing element");
1377 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
1383 for (
auto pElement : it->second)
1385 SAL_WARN_IF( !pElement->m_bIsRemoved,
"package.xstor",
"Try to insert an element instead of existing one!" );
1386 if ( pElement->m_bIsRemoved )
1388 SAL_WARN_IF( pElement->m_bIsInserted,
"package.xstor",
"Inserted elements must be deleted immediately!" );
1389 pDeletedElm = pElement;
1401 rVec.erase(std::remove(rVec.begin(), rVec.end(), pDeletedElm), rVec.end());
1413 SAL_WARN_IF( !pElement,
"package.xstor",
"pElement is not set!" );
1416 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
1422 uno::Reference< uno::XInterface > xTmp;
1425 throw container::NoSuchElementException(
THROW_WHERE );
1427 uno::Reference< container::XNameContainer > xPackageSubFolder( xTmp, uno::UNO_QUERY_THROW );
1434 SAL_WARN_IF( !pElement,
"package.xstor",
"pElement is not set!" );
1437 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
1444 uno::Reference< uno::XInterface > xTmp;
1447 throw container::NoSuchElementException(
THROW_WHERE );
1449 uno::Reference< packages::XDataSinkEncrSupport > xPackageSubStream( xTmp, uno::UNO_QUERY_THROW );
1457 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
1463 for (
auto pElement : pair.second)
1465 if ( !pElement->m_bIsRemoved )
1469 uno::Sequence<OUString> aElementNames(nCnt);
1470 OUString* pArray = aElementNames.getArray();
1472 for (
auto pElement : pair.second)
1474 if ( !pElement->m_bIsRemoved )
1475 *pArray++ = pair.first;
1478 return aElementNames;
1490 for (
auto it = mapIt->second.begin(); it != mapIt->second.end(); ++it)
1491 if (pElement == *it)
1496 mapIt->second.erase(std::remove(mapIt->second.begin(), mapIt->second.end(), pElement), mapIt->second.end());
1497 if (mapIt->second.empty())
1507 assert(
false &&
"not found");
1519 bool bEncryptionDataProvided,
1520 const ::comphelper::SequenceAsHashMap& aEncryptionData,
1521 uno::Reference< io::XStream >& xTargetStream )
1547 if (bEncryptionDataProvided)
1548 pElement->
m_xStream->GetCopyOfLastCommit(xTargetStream, aEncryptionData);
1550 pElement->
m_xStream->GetCopyOfLastCommit(xTargetStream);
1560 OUString aRelStreamName = OUString::Concat(aOriginalName) +
".rels";
1597 if ( !pStreamElement )
1602 SAL_WARN_IF( rName.empty(),
"package.xstor",
"The name must not be empty!" );
1615 std::u16string_view aName )
1622 OUString aRelStreamName = OUString::Concat(
aName) +
".rels";
1625 uno::Reference< io::XStream >
xStream =
m_xRelStorage->openStreamElement( aRelStreamName, embed::ElementModes::READ );
1627 return xStream->getInputStream();
1632 return uno::Reference< io::XInputStream >();
1638 OUString aRelsStorName(
"_rels");
1640 if ( !xNewPackageFolder.is() )
1655 uno::Reference<io::XStream> xRelsStream =
m_xRelStorage->openStreamElement(
1656 ".rels", embed::ElementModes::TRUNCATE | embed::ElementModes::READWRITE);
1658 uno::Reference<io::XOutputStream> xOutStream = xRelsStream->getOutputStream();
1659 if (!xOutStream.is())
1662 ::comphelper::OFOPXMLHelper::WriteRelationsInfoSequence(xOutStream,
m_aRelInfo,
1666 uno::Reference<beans::XPropertySet> xPropSet(xRelsStream, uno::UNO_QUERY_THROW);
1667 xPropSet->setPropertyValue(
1669 "application/vnd.openxmlformats-package.relationships+xml")));
1681 uno::Reference<io::XStream> xRelsStream =
m_xRelStorage->openStreamElement(
1682 ".rels", embed::ElementModes::TRUNCATE | embed::ElementModes::READWRITE);
1684 uno::Reference<io::XOutputStream> xOutputStream = xRelsStream->getOutputStream();
1685 if (!xOutputStream.is())
1693 uno::Reference<beans::XPropertySet> xPropSet(xRelsStream, uno::UNO_QUERY_THROW);
1694 xPropSet->setPropertyValue(
1696 uno::Any(OUString(
"application/vnd.openxmlformats-package.relationships+xml")));
1701 m_aRelInfo = uno::Sequence<uno::Sequence<beans::StringPair>>();
1713 uno::Reference< embed::XTransactedObject > xTrans(
m_xRelStorage, uno::UNO_QUERY_THROW );
1717 if ( xNewPackageFolder.is() && xNewPackageFolder->hasByName( aRelsStorName ) )
1718 xNewPackageFolder->removeByName( aRelsStorName );
1735 const uno::Sequence< beans::PropertyValue >& xProperties,
1736 uno::Reference< uno::XComponentContext >
const & xContext,
1737 sal_Int32 nStorageType )
1739, m_xSharedMutex(
m_pImpl->m_xMutex )
1740, m_aListenersContainer(
m_pImpl->m_xMutex->GetMutex() )
1741, m_bReadOnlyWrap( false )
1748 const uno::Sequence< beans::PropertyValue >& xProperties,
1749 uno::Reference< uno::XComponentContext >
const & xContext,
1750 sal_Int32 nStorageType )
1752, m_xSharedMutex(
m_pImpl->m_xMutex )
1753, m_aListenersContainer(
m_pImpl->m_xMutex->GetMutex() )
1754, m_bReadOnlyWrap( false )
1761, m_xSharedMutex(
m_pImpl->m_xMutex )
1762, m_aListenersContainer(
m_pImpl->m_xMutex->GetMutex() )
1763, m_bReadOnlyWrap( bReadOnlyWrap )
1768 OSL_ENSURE( (
m_pImpl->
m_nStorageMode & embed::ElementModes::WRITE ) == embed::ElementModes::WRITE ||
1770 "The wrapper can not allow writing in case implementation does not!" );
1772 if ( !bReadOnlyWrap )
1785 catch(
const uno::RuntimeException& )
1799 lang::EventObject aSource( getXWeak() );
1810 "If any subelements are open the listener must exist!" );
1822 uno::Reference< lang::XComponent > xTmp = pComp;
1825 xTmp->removeEventListener( uno::Reference< lang::XEventListener >(
1830 }
catch(
const uno::Exception& )
1871 rVec.erase(std::remove_if(rVec.begin(), rVec.end(),
1872 [&xChild](
const uno::Reference<lang::XComponent>& xTmp) {
1873 return !xTmp.is() || xTmp == xChild;
1894 lang::EventObject aSource( getXWeak() );
1904 static_cast<util::XModifyListener*
>( pIterator.
next( ) )->modified( aSource );
1926 lang::EventObject aSource( getXWeak() );
1937 OSL_ENSURE( nMessage >= 1 && nMessage <= 4,
"Wrong internal notification code is used!" );
1942 static_cast<embed::XTransactionListener*
>( pIterator.
next( ) )->preCommit( aSource );
1945 static_cast<embed::XTransactionListener*
>( pIterator.
next( ) )->commited( aSource );
1948 static_cast<embed::XTransactionListener*
>( pIterator.
next( ) )->preRevert( aSource );
1951 static_cast<embed::XTransactionListener*
>( pIterator.
next( ) )->reverted( aSource );
1961 OSL_ENSURE( !
m_bReadOnlyWrap || ( nOpenMode & embed::ElementModes::WRITE ) != embed::ElementModes::WRITE,
1962 "An element can not be opened for writing in readonly storage!" );
1969 || (( nOpenMode & embed::ElementModes::WRITE ) != embed::ElementModes::WRITE )
1970 || ( nOpenMode & embed::ElementModes::NOCREATE ) == embed::ElementModes::NOCREATE )
1972 throw io::IOException(
"Element does not exist and cannot be "
1973 "created: \"" + aStreamName +
"\"");
1984 SAL_WARN_IF( !pElement,
"package.xstor",
"In case element can not be created an exception must be thrown!" );
1997 if ( !xComponent.is() )
2015 uno::Any aReturn = ::cppu::queryInterface
2017 ,
static_cast<lang::XTypeProvider*
> (
this )
2018 ,
static_cast<embed::XStorage*
> (
this )
2019 ,
static_cast<embed::XStorage2*
> (
this )
2020 ,
static_cast<embed::XTransactedObject*
> (
this )
2021 ,
static_cast<embed::XTransactionBroadcaster*
> (
this )
2022 ,
static_cast<util::XModifiable*
> (
this )
2023 ,
static_cast<container::XNameAccess*
> (
this )
2024 ,
static_cast<container::XElementAccess*
> (
this )
2025 ,
static_cast<lang::XComponent*
> (
this )
2026 ,
static_cast<beans::XPropertySet*
> (
this )
2027 ,
static_cast<embed::XOptimizedStorage*
> (
this ) );
2032 aReturn = ::cppu::queryInterface
2034 ,
static_cast<embed::XHierarchicalStorageAccess*
> (
this )
2035 ,
static_cast<embed::XHierarchicalStorageAccess2*
> (
this ) );
2044 aReturn = ::cppu::queryInterface
2046 ,
static_cast<embed::XStorageRawAccess*
> (
this )
2047 ,
static_cast<embed::XEncryptionProtectedSource*
> (
this )
2048 ,
static_cast<embed::XEncryptionProtectedSource2*
> (
this )
2049 ,
static_cast<embed::XEncryptionProtectedStorage*
> (
this ) );
2053 aReturn = ::cppu::queryInterface
2055 ,
static_cast<embed::XStorageRawAccess*
> (
this ) );
2060 aReturn = ::cppu::queryInterface
2062 ,
static_cast<embed::XRelationshipAccess*
> (
this ) );
2068 return OWeakObject::queryInterface( rType );
2073 OWeakObject::acquire();
2078 OWeakObject::release();
2150 return lcl_ImplId.
getSeq();
2164 if ( !xDest.is() || xDest == getXWeak() )
2165 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 1 );
2170 catch(
const embed::InvalidStorageException& )
2175 catch(
const lang::IllegalArgumentException& )
2180 catch(
const embed::StorageWrappedTargetException& )
2185 catch(
const io::IOException& )
2190 catch(
const uno::RuntimeException& )
2195 catch(
const uno::Exception& )
2197 uno::Any aCaught( ::cppu::getCaughtException() );
2200 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't copy storage!",
2201 uno::Reference< io::XInputStream >(),
2207 const OUString& aStreamName, sal_Int32 nOpenMode )
2218 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
2221 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 1 );
2226 uno::Reference< io::XStream > xResult;
2230 OSL_ENSURE(pElement && pElement->
m_xStream,
"In case element can not be created an exception must be thrown!");
2232 xResult = pElement->
m_xStream->GetStream(nOpenMode,
false);
2233 SAL_WARN_IF( !xResult.is(),
"package.xstor",
"The method must throw exception instead of removing empty result!" );
2238 uno::Reference< lang::XComponent > xStreamComponent( xResult, uno::UNO_QUERY_THROW );
2242 catch(
const embed::InvalidStorageException& )
2247 catch(
const lang::IllegalArgumentException& )
2252 catch(
const packages::WrongPasswordException& )
2257 catch(
const embed::StorageWrappedTargetException& )
2262 catch(
const io::IOException& )
2267 catch(
const uno::RuntimeException& )
2272 catch(
const uno::Exception& )
2274 uno::Any aCaught( ::cppu::getCaughtException() );
2277 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't open stream element!",
2278 uno::Reference< io::XInputStream >(),
2290 const OUString& aStreamName, sal_Int32 nOpenMode,
const OUString& aPass )
2296 const OUString& aStorName, sal_Int32 nStorageMode )
2307 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
2310 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 1 );
2312 if ( ( nStorageMode & embed::ElementModes::WRITE ) &&
m_bReadOnlyWrap )
2315 if ( ( nStorageMode & embed::ElementModes::TRUNCATE )
2316 && !( nStorageMode & embed::ElementModes::WRITE ) )
2320 nStorageMode |= embed::ElementModes::READ;
2322 uno::Reference< embed::XStorage > xResult;
2330 || (( nStorageMode & embed::ElementModes::WRITE ) != embed::ElementModes::WRITE )
2331 || ( nStorageMode & embed::ElementModes::NOCREATE ) == embed::ElementModes::NOCREATE )
2348 else if ( !pElement->
m_xStorage->m_aReadOnlyWrapVector.empty()
2349 && ( nStorageMode & embed::ElementModes::WRITE ) )
2358 pElement->
m_xStorage->m_nStorageMode = nStorageMode | embed::ElementModes::READ;
2360 if ( nStorageMode & embed::ElementModes::TRUNCATE )
2362 for (
const auto & rPair : pElement->
m_xStorage->m_aChildrenMap)
2363 for (
auto pElementToDel : rPair.second)
2375 bool bReadOnlyWrap = ( ( nStorageMode & embed::ElementModes::WRITE ) != embed::ElementModes::WRITE );
2377 xResult = pResultStorage;
2379 if ( bReadOnlyWrap )
2382 pElement->
m_xStorage->SetReadOnlyWrap(*pResultStorage);
2385 uno::Reference< lang::XComponent > xStorageComponent( xResult, uno::UNO_QUERY_THROW );
2389 catch(
const embed::InvalidStorageException& )
2394 catch(
const lang::IllegalArgumentException& )
2399 catch(
const embed::StorageWrappedTargetException& )
2404 catch(
const io::IOException& )
2409 catch(
const uno::RuntimeException& )
2414 catch(
const uno::Exception& )
2416 uno::Any aCaught( ::cppu::getCaughtException() );
2419 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't open storage!",
2420 uno::Reference< io::XInputStream >(),
2438 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
2441 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 1 );
2445 uno::Reference< io::XStream > xResult;
2447 if ( !xResult.is() )
2451 catch(
const embed::InvalidStorageException& )
2456 catch(
const lang::IllegalArgumentException& )
2461 catch(
const packages::WrongPasswordException& )
2466 catch(
const io::IOException& )
2471 catch(
const embed::StorageWrappedTargetException& )
2476 catch(
const uno::RuntimeException& )
2481 catch(
const uno::Exception& )
2483 uno::Any aCaught( ::cppu::getCaughtException() );
2486 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't clone stream!",
2487 uno::Reference< io::XInputStream >(),
2493 const OUString& aStreamName,
2494 const OUString& aPass )
2500 const uno::Reference< embed::XStorage >& xTargetStorage )
2514 catch(
const embed::InvalidStorageException& )
2519 catch(
const lang::IllegalArgumentException& )
2524 catch(
const embed::StorageWrappedTargetException& )
2529 catch(
const io::IOException& )
2534 catch(
const uno::RuntimeException& )
2539 catch(
const uno::Exception& )
2541 uno::Any aCaught( ::cppu::getCaughtException() );
2544 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't copy last commit version!",
2545 uno::Reference< io::XInputStream >(),
2552 const OUString& aStorName,
2553 const uno::Reference< embed::XStorage >& xTargetStorage )
2564 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
2567 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 1 );
2591 pElement->
m_xStorage->CopyLastCommitTo(xTargetStorage);
2593 catch(
const embed::InvalidStorageException& )
2598 catch(
const lang::IllegalArgumentException& )
2603 catch(
const io::IOException& )
2608 catch(
const embed::StorageWrappedTargetException& )
2613 catch(
const uno::RuntimeException& )
2618 catch(
const uno::Exception& )
2620 uno::Any aCaught( ::cppu::getCaughtException() );
2623 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't copy last commit element version!",
2624 uno::Reference< io::XInputStream >(),
2640 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
2643 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 1 );
2651 catch(
const embed::InvalidStorageException& )
2656 catch(
const lang::IllegalArgumentException& )
2661 catch(
const container::NoSuchElementException& )
2666 catch(
const uno::RuntimeException& )
2671 catch(
const uno::Exception& )
2673 uno::Any aCaught( ::cppu::getCaughtException() );
2676 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "Can't detect whether it is a stream!",
2677 uno::Reference< io::XInputStream >(),
2682 throw container::NoSuchElementException(
THROW_WHERE );
2698 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
2701 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 1 );
2709 catch(
const embed::InvalidStorageException& )
2714 catch(
const lang::IllegalArgumentException& )
2719 catch(
const container::NoSuchElementException& )
2724 catch(
const uno::RuntimeException& )
2729 catch(
const uno::Exception& )
2731 uno::Any aCaught( ::cppu::getCaughtException() );
2734 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "can't detect whether it is a storage",
2735 uno::Reference< io::XInputStream >(),
2740 throw container::NoSuchElementException(
THROW_WHERE );
2756 if (aElementName.isEmpty()
2758 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.",
2759 uno::Reference<uno::XInterface>(), 1);
2762 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference<uno::XInterface>(),
2772 throw container::NoSuchElementException(
THROW_WHERE);
2779 catch (
const embed::InvalidStorageException&)
2784 catch (
const lang::IllegalArgumentException&)
2789 catch (
const container::NoSuchElementException&)
2794 catch (
const io::IOException&)
2799 catch (
const embed::StorageWrappedTargetException&)
2804 catch (
const uno::RuntimeException&)
2809 catch (
const uno::Exception&)
2811 uno::Any aCaught(::cppu::getCaughtException());
2814 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't remove element!",
2815 uno::Reference<io::XInputStream>(), aCaught);
2833 if (aElementName.isEmpty()
2835 || aNewName.isEmpty()
2837 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.",
2838 uno::Reference<uno::XInterface>(), 1);
2841 && (aElementName ==
"_rels" || aNewName ==
"_rels"))
2842 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference<uno::XInterface>(),
2852 throw container::ElementExistException(
THROW_WHERE);
2856 throw container::NoSuchElementException(
THROW_WHERE);
2859 auto rVec = mapIt->second;
2860 for (
auto it = rVec.begin(); it != rVec.end(); ++it)
2861 if (pElement == *it)
2863 rVec.erase(std::remove(rVec.begin(), rVec.end(), pElement), rVec.end());
2872 catch (
const embed::InvalidStorageException&)
2877 catch (
const lang::IllegalArgumentException&)
2882 catch (
const container::NoSuchElementException&)
2887 catch (
const container::ElementExistException&)
2892 catch (
const io::IOException&)
2897 catch (
const embed::StorageWrappedTargetException&)
2902 catch (
const uno::RuntimeException&)
2907 catch (
const uno::Exception&)
2909 uno::Any aCaught(::cppu::getCaughtException());
2912 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't rename element!",
2913 uno::Reference<io::XInputStream>(), aCaught);
2921 const uno::Reference< embed::XStorage >& xDest,
2922 const OUString& aNewName )
2934 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
2938 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 2 );
2940 if (
m_pImpl->
m_nStorageType == embed::StorageFormats::OFOPXML && ( aElementName ==
"_rels" || aNewName ==
"_rels" ) )
2941 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 0 );
2947 throw container::NoSuchElementException(
THROW_WHERE );
2949 uno::Reference< XNameAccess > xNameAccess( xDest, uno::UNO_QUERY_THROW );
2950 if ( xNameAccess->hasByName( aNewName ) )
2951 throw container::ElementExistException(
THROW_WHERE );
2955 catch(
const embed::InvalidStorageException& )
2960 catch(
const lang::IllegalArgumentException& )
2965 catch(
const container::NoSuchElementException& )
2970 catch(
const container::ElementExistException& )
2975 catch(
const embed::StorageWrappedTargetException& )
2980 catch(
const io::IOException& )
2985 catch(
const uno::RuntimeException& )
2990 catch(
const uno::Exception& )
2992 uno::Any aCaught( ::cppu::getCaughtException() );
2995 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't copy element!",
2996 uno::Reference< io::XInputStream >(),
3002 const uno::Reference< embed::XStorage >& xDest,
3003 const OUString& aNewName )
3014 if (aElementName.isEmpty()
3016 || aNewName.isEmpty()
3018 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.",
3019 uno::Reference<uno::XInterface>(), 1);
3021 if (!xDest.is() || xDest == getXWeak())
3022 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference<uno::XInterface>(), 2);
3025 && (aElementName ==
"_rels" || aNewName ==
"_rels"))
3026 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference<uno::XInterface>(),
3036 throw container::NoSuchElementException(
THROW_WHERE);
3038 uno::Reference<XNameAccess> xNameAccess(xDest, uno::UNO_QUERY_THROW);
3039 if (xNameAccess->hasByName(aNewName))
3040 throw container::ElementExistException(
THROW_WHERE);
3049 catch (
const embed::InvalidStorageException&)
3054 catch (
const lang::IllegalArgumentException&)
3059 catch (
const container::NoSuchElementException&)
3064 catch (
const container::ElementExistException&)
3069 catch (
const embed::StorageWrappedTargetException&)
3074 catch (
const io::IOException&)
3079 catch (
const uno::RuntimeException&)
3084 catch (
const uno::Exception&)
3086 uno::Any aCaught(::cppu::getCaughtException());
3089 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't move element!",
3090 uno::Reference<io::XInputStream>(), aCaught);
3099 const OUString& aStreamName, sal_Int32 nOpenMode,
const uno::Sequence< beans::NamedValue >& aEncryptionData )
3112 if ( !aEncryptionData.hasElements() )
3113 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 3 );
3115 uno::Reference< io::XStream > xResult;
3119 OSL_ENSURE(pElement && pElement->
m_xStream,
"In case element can not be created an exception must be thrown!");
3121 xResult = pElement->
m_xStream->GetStream(nOpenMode, aEncryptionData,
false);
3122 SAL_WARN_IF( !xResult.is(),
"package.xstor",
"The method must throw exception instead of removing empty result!" );
3127 uno::Reference< lang::XComponent > xStreamComponent( xResult, uno::UNO_QUERY_THROW );
3131 catch(
const embed::InvalidStorageException& )
3136 catch(
const lang::IllegalArgumentException& )
3141 catch(
const packages::NoEncryptionException& )
3146 catch(
const packages::WrongPasswordException& )
3151 catch(
const embed::StorageWrappedTargetException& )
3156 catch(
const io::IOException& )
3161 catch(
const uno::RuntimeException& )
3166 catch(
const uno::Exception& )
3168 uno::Any aCaught( ::cppu::getCaughtException() );
3171 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't open encrypted stream!",
3172 uno::Reference< io::XInputStream >(),
3184 const OUString& aStreamName,
3185 const uno::Sequence< beans::NamedValue >& aEncryptionData )
3195 if ( !aEncryptionData.hasElements() )
3196 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 2 );
3200 uno::Reference< io::XStream > xResult;
3202 if ( !xResult.is() )
3206 catch(
const embed::InvalidStorageException& )
3211 catch(
const lang::IllegalArgumentException& )
3216 catch(
const packages::NoEncryptionException& )
3221 catch(
const packages::WrongPasswordException& )
3226 catch(
const io::IOException& )
3231 catch(
const embed::StorageWrappedTargetException& )
3236 catch(
const uno::RuntimeException& )
3241 catch(
const uno::Exception& )
3243 uno::Any aCaught( ::cppu::getCaughtException() );
3246 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't clone encrypted stream!",
3247 uno::Reference< io::XInputStream >(),
3254 const OUString& sStreamName )
3268 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
3270 uno::Reference < io::XInputStream > xTempIn;
3275 throw container::NoSuchElementException(
THROW_WHERE );
3284 uno::Reference<io::XInputStream> xRawInStream = pElement->
m_xStream->GetPlainRawInStream();
3285 if ( !xRawInStream.is() )
3289 uno::Reference < io::XOutputStream > xTempOut = xTempFile->getOutputStream();
3290 xTempIn = xTempFile->getInputStream();
3292 if ( !xTempOut.is() || !xTempIn.is() )
3297 xTempOut->closeOutput();
3298 xTempFile->seek( 0 );
3300 catch(
const embed::InvalidStorageException& )
3305 catch(
const lang::IllegalArgumentException& )
3310 catch(
const container::NoSuchElementException& )
3315 catch(
const embed::StorageWrappedTargetException& )
3320 catch(
const io::IOException& )
3325 catch(
const uno::RuntimeException& )
3330 catch(
const uno::Exception& )
3332 uno::Any aCaught( ::cppu::getCaughtException() );
3335 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't get plain raw stream!",
3336 uno::Reference< io::XInputStream >(),
3344 const OUString& sStreamName )
3355 throw packages::NoEncryptionException(
THROW_WHERE );
3358 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
3360 uno::Reference < io::XInputStream > xTempIn;
3365 throw container::NoSuchElementException(
THROW_WHERE );
3374 if (!pElement->
m_xStream->IsEncrypted())
3375 throw packages::NoEncryptionException(
THROW_WHERE );
3377 uno::Reference< io::XInputStream > xRawInStream = pElement->
m_xStream->GetRawInStream();
3378 if ( !xRawInStream.is() )
3382 uno::Reference < io::XOutputStream > xTempOut = xTempFile;
3383 xTempIn = xTempFile;
3390 xTempFile->closeOutput();
3391 xTempFile->seek( 0 );
3394 catch(
const embed::InvalidStorageException& )
3399 catch(
const lang::IllegalArgumentException& )
3404 catch(
const packages::NoEncryptionException& )
3409 catch(
const container::NoSuchElementException& )
3414 catch(
const embed::StorageWrappedTargetException& )
3419 catch(
const io::IOException& )
3424 catch(
const uno::RuntimeException& )
3429 catch(
const uno::Exception& )
3431 uno::Any aCaught( ::cppu::getCaughtException() );
3434 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't get raw stream!",
3435 uno::Reference< io::XInputStream >(),
3443 const uno::Reference< io::XInputStream >& xInStream )
3454 throw embed::InvalidStorageException(
THROW_WHERE );
3457 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
3459 if ( !xInStream.is() )
3460 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 2 );
3469 throw container::ElementExistException(
THROW_WHERE );
3473 catch(
const embed::InvalidStorageException& )
3478 catch(
const lang::IllegalArgumentException& )
3483 catch(
const packages::NoRawFormatException& )
3488 catch(
const container::ElementExistException& )
3493 catch(
const embed::StorageWrappedTargetException& )
3498 catch(
const io::IOException& )
3503 catch(
const uno::RuntimeException& )
3508 catch(
const uno::Exception& )
3510 uno::Any aCaught( ::cppu::getCaughtException() );
3513 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't insert raw stream!",
3514 uno::Reference< io::XInputStream >(),
3522 uno::Reference< util::XModifiable > xParentModif;
3544 catch(
const io::IOException& )
3549 catch(
const embed::StorageWrappedTargetException& )
3554 catch(
const uno::RuntimeException& )
3559 catch(
const uno::Exception& )
3561 uno::Any aCaught( ::cppu::getCaughtException() );
3564 throw embed::StorageWrappedTargetException(
THROW_WHERE "Problems on commit!",
3570 if ( xParentModif.is() )
3571 xParentModif->setModified(
true );
3592 for (
auto pElement : rPair.second)
3594 bool bThrow = (pElement->m_xStorage
3595 && (pElement->m_xStorage->m_pAntiImpl
3596 || !pElement->m_xStorage->m_aReadOnlyWrapVector.empty()))
3597 || (pElement->m_xStream
3598 && (pElement->m_xStream->m_pAntiImpl
3599 || !pElement->m_xStream->m_aInputStreamsVector.empty()));
3613 catch (
const io::IOException&)
3618 catch (
const embed::StorageWrappedTargetException&)
3623 catch (
const uno::RuntimeException&)
3628 catch (
const uno::Exception&)
3630 uno::Any aCaught(::cppu::getCaughtException());
3633 throw embed::StorageWrappedTargetException(
THROW_WHERE "Problems on revert!",
3716 const uno::Reference< util::XModifyListener >& aListener )
3732 const uno::Reference< util::XModifyListener >& aListener )
3760 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
3763 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 1 );
3770 throw container::NoSuchElementException(
THROW_WHERE );
3777 catch(
const container::NoSuchElementException& )
3782 catch(
const lang::WrappedTargetException& )
3787 catch(
const uno::RuntimeException& )
3792 catch(
const uno::Exception& )
3794 uno::Any aCaught( ::cppu::getCaughtException() );
3797 throw lang::WrappedTargetException(
THROW_WHERE "Can not open storage!",
3819 catch(
const uno::RuntimeException& )
3824 catch (
const uno::Exception& )
3826 uno::Any aCaught( ::cppu::getCaughtException() );
3829 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "Can not open storage!",
3845 if (
aName.isEmpty() )
3856 catch(
const uno::RuntimeException& )
3861 catch (
const uno::Exception& )
3863 uno::Any aCaught( ::cppu::getCaughtException() );
3866 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "Can not open storage!",
3871 return ( pElement !=
nullptr );
3902 catch(
const uno::RuntimeException& )
3907 catch(
const uno::Exception& )
3909 uno::Any aCaught( ::cppu::getCaughtException() );
3912 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "Can not open storage!",
3933 catch(
const uno::RuntimeException& )
3938 catch(
const uno::Exception& )
3940 uno::Any aCaught( ::cppu::getCaughtException() );
3943 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "Can not open storage!",
3950 const uno::Reference< lang::XEventListener >& xListener )
3965 const uno::Reference< lang::XEventListener >& xListener )
4006 catch (
const uno::RuntimeException& )
4011 catch (
const uno::Exception& )
4013 uno::Any aCaught( ::cppu::getCaughtException() );
4016 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "Can not open package!",
4024 uno::Reference< beans::XPropertySet > xPackPropSet(
m_pImpl->
m_xPackage, uno::UNO_QUERY_THROW );
4028 uno::Any( uno::Sequence< beans::NamedValue >() ) );
4033 catch(
const uno::RuntimeException& )
4038 catch(
const uno::Exception& )
4060 if ( !aEncryptionData.hasElements() )
4061 throw uno::RuntimeException(
THROW_WHERE "Unexpected empty encryption data!" );
4070 catch (
const uno::RuntimeException& )
4075 catch (
const uno::Exception& )
4077 uno::Any aCaught( ::cppu::getCaughtException() );
4080 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "Can not open package!",
4085 uno::Reference< beans::XPropertySet > xPackPropSet(
m_pImpl->
m_xPackage, uno::UNO_QUERY_THROW );
4095 catch(
const uno::Exception& )
4125 if ( !aAlgorithms.hasElements() )
4126 throw uno::RuntimeException(
THROW_WHERE "Unexpected empty encryption algorithms list!" );
4135 catch (
const uno::RuntimeException& )
4140 catch (
const uno::Exception& )
4142 uno::Any aCaught( ::cppu::getCaughtException() );
4145 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "Can not open package!",
4150 uno::Reference< beans::XPropertySet > xPackPropSet(
m_pImpl->
m_xPackage, uno::UNO_QUERY_THROW );
4156 catch (
const uno::RuntimeException& )
4161 catch(
const uno::Exception& )
4163 uno::Any aCaught( ::cppu::getCaughtException() );
4166 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "Can not open package!",
4185 if ( !aProps.hasElements() )
4186 throw uno::RuntimeException(
THROW_WHERE "Unexpected empty encryption algorithms list!" );
4195 catch (
const uno::RuntimeException& aRuntimeException )
4197 SAL_INFO(
"package.xstor",
"Rethrow: " << aRuntimeException.Message);
4200 catch (
const uno::Exception& )
4202 uno::Any aCaught( ::cppu::getCaughtException() );
4205 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "Can not open package!",
4210 uno::Reference< beans::XPropertySet > xPackPropSet(
m_pImpl->
m_xPackage, uno::UNO_QUERY_THROW );
4216 catch (
const uno::RuntimeException& aRuntimeException )
4218 SAL_INFO(
"package.xstor",
"Rethrow: " << aRuntimeException.Message);
4221 catch(
const uno::Exception& )
4223 uno::Any aCaught( ::cppu::getCaughtException() );
4226 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "Can not open package!",
4245 uno::Sequence< beans::NamedValue > aResult;
4252 catch (
const uno::RuntimeException& )
4257 catch (
const uno::Exception& )
4259 uno::Any aCaught( ::cppu::getCaughtException() );
4262 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "Can not open package!",
4267 uno::Reference< beans::XPropertySet > xPackPropSet(
m_pImpl->
m_xPackage, uno::UNO_QUERY_THROW );
4272 catch (
const uno::RuntimeException& )
4277 catch(
const uno::Exception& )
4279 uno::Any aCaught( ::cppu::getCaughtException() );
4282 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "Can not open package!",
4304 return uno::Reference< beans::XPropertySetInfo >();
4326 throw beans::UnknownPropertyException( aPropertyName );
4329 if ( aPropertyName ==
"MediaType" )
4337 else if ( aPropertyName ==
"Version" )
4352 || aPropertyName ==
"URL"
4353 || aPropertyName ==
"RepairPackage"
4355 || aPropertyName ==
"IsRoot"
4357 throw beans::PropertyVetoException(
THROW_WHERE );
4359 throw beans::UnknownPropertyException( aPropertyName );
4363 if ( aPropertyName ==
"RelationsInfoStream" )
4365 uno::Reference< io::XInputStream > xInRelStream;
4366 if ( !( aValue >>= xInRelStream ) || !xInRelStream.is() )
4367 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 0 );
4369 uno::Reference< io::XSeekable > xSeek( xInRelStream, uno::UNO_QUERY );
4375 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 0 );
4384 else if ( aPropertyName ==
"RelationsInfo" )
4387 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 0 );
4394 else if ( (
m_pImpl->
m_bIsRoot && ( aPropertyName ==
"URL" || aPropertyName ==
"RepairPackage") )
4395 || aPropertyName ==
"IsRoot" )
4396 throw beans::PropertyVetoException(
THROW_WHERE );
4398 throw beans::UnknownPropertyException( aPropertyName );
4401 throw beans::UnknownPropertyException( aPropertyName );
4423 catch (
const uno::RuntimeException& )
4428 catch (
const uno::Exception& )
4430 uno::Any aCaught( ::cppu::getCaughtException() );
4433 throw lang::WrappedTargetException(
4434 "Can't read contents!",
4439 if ( aPropertyName ==
"MediaType" )
4441 else if ( aPropertyName ==
"Version" )
4446 else if ( aPropertyName ==
"IsRoot" )
4450 else if ( aPropertyName ==
"OpenMode" )
4456 if ( aPropertyName ==
"URL"
4457 || aPropertyName ==
"RepairPackage" )
4460 [&aPropertyName](
const css::beans::PropertyValue& rProp) { return rProp.Name == aPropertyName; });
4462 return pProp->Value;
4464 if ( aPropertyName ==
"URL" )
4477 uno::Reference< beans::XPropertySet > xPackPropSet(
m_pImpl->
m_xPackage, uno::UNO_QUERY_THROW );
4478 return xPackPropSet->getPropertyValue( aPropertyName );
4480 catch (
const uno::RuntimeException& )
4485 catch (
const uno::Exception& )
4487 uno::Any aCaught( ::cppu::getCaughtException() );
4490 throw lang::WrappedTargetException(
THROW_WHERE "Can not open package!",
4497 throw beans::UnknownPropertyException(aPropertyName);
4502 const uno::Reference< beans::XPropertyChangeListener >& )
4517 const uno::Reference< beans::XPropertyChangeListener >& )
4532 const uno::Reference< beans::XVetoableChangeListener >& )
4547 const uno::Reference< beans::XVetoableChangeListener >& )
4582 catch(
const container::NoSuchElementException& )
4593const beans::StringPair* lcl_findPairByName(
const uno::Sequence<beans::StringPair>& rSeq,
const OUString& rName)
4595 return std::find_if(rSeq.begin(), rSeq.end(), [&rName](
const beans::StringPair& rPair) { return rPair.First == rName; });
4614 auto pRel = lcl_findPairByName(
aSeq,
"Target");
4615 if (pRel !=
aSeq.end())
4616 return pRel->Second;
4635 auto pRel = lcl_findPairByName(
aSeq,
"Type");
4636 if (pRel !=
aSeq.end())
4637 return pRel->Second;
4657 const beans::StringPair aIDRel(
"Id", sID);
4659 auto pRel = std::find_if(
aSeq.begin(),
aSeq.end(),
4660 [&aIDRel](
const uno::Sequence<beans::StringPair>& rRel) {
4661 return std::find(rRel.begin(), rRel.end(), aIDRel) != rRel.end(); });
4662 if (pRel !=
aSeq.end())
4665 throw container::NoSuchElementException(
THROW_WHERE );
4683 std::vector< uno::Sequence< beans::StringPair > > aResult;
4684 aResult.reserve(
aSeq.getLength());
4686 std::copy_if(
aSeq.begin(),
aSeq.end(), std::back_inserter(aResult),
4687 [&
sType](
const uno::Sequence<beans::StringPair>& rRel) {
4688 auto pRel = lcl_findPairByName(rRel,
"Type");
4689 return pRel != rRel.end()
4691 && pRel->Second.equalsIgnoreAsciiCase( sType );
4710 uno::Sequence< uno::Sequence< beans::StringPair > > aRet;
4715 catch (
const io::IOException&)
4719 catch (
const uno::RuntimeException&)
4723 catch (
const uno::Exception &)
4725 uno::Any aCaught( ::cppu::getCaughtException() );
4726 throw lang::WrappedTargetRuntimeException(
THROW_WHERE "Can't getAllRelationships!",
4727 uno::Reference< uno::XInterface >(),
4747 const beans::StringPair aIDRel(
"Id", sID);
4749 uno::Sequence<beans::StringPair>* pResult =
nullptr;
4753 for ( sal_Int32 nInd = 0; nInd <
aSeq.getLength(); nInd++ )
4755 const auto& rRel =
aSeq[nInd];
4756 if (std::find(rRel.begin(), rRel.end(), aIDRel) != rRel.end())
4757 pResult = &
aSeq.getArray()[nInd];
4760 if ( pResult && !bReplace )
4761 throw container::ElementExistException(
THROW_WHERE );
4765 const sal_Int32 nIDInd =
aSeq.getLength();
4766 aSeq.realloc( nIDInd + 1 );
4767 pResult = &
aSeq.getArray()[nIDInd];
4770 std::vector<beans::StringPair> aResult;
4771 aResult.reserve(aEntry.getLength() + 1);
4773 aResult.push_back(aIDRel);
4774 std::copy_if(aEntry.begin(), aEntry.end(), std::back_inserter(aResult),
4775 [](
const beans::StringPair& rPair) { return rPair.First !=
"Id"; });
4798 const beans::StringPair aIDRel(
"Id", sID);
4799 auto pRel = std::find_if(std::cbegin(
aSeq), std::cend(
aSeq),
4800 [&aIDRel](
const uno::Sequence< beans::StringPair >& rRel) {
4801 return std::find(rRel.begin(), rRel.end(), aIDRel) != rRel.end(); });
4802 if (pRel != std::cend(
aSeq))
4804 auto nInd =
static_cast<sal_Int32
>(std::distance(std::cbegin(
aSeq), pRel));
4815 throw container::NoSuchElementException(
THROW_WHERE );
4831 OUString aIDTag(
"Id" );
4833 std::vector< uno::Sequence<beans::StringPair> > aResultVec;
4834 aResultVec.reserve(
aSeq.getLength() +
aEntries.getLength());
4836 std::copy_if(
aSeq.begin(),
aSeq.end(), std::back_inserter(aResultVec),
4837 [&aIDTag, &
aEntries, bReplace](
const uno::Sequence<beans::StringPair>& rTargetRel) {
4838 auto pTargetPair = lcl_findPairByName(rTargetRel, aIDTag);
4839 if (pTargetPair == rTargetRel.end())
4842 bool bIsSourceSame = std::any_of(aEntries.begin(), aEntries.end(),
4843 [&pTargetPair](const uno::Sequence<beans::StringPair>& rSourceEntry) {
4844 return std::find(rSourceEntry.begin(), rSourceEntry.end(), *pTargetPair) != rSourceEntry.end(); });
4846 if ( bIsSourceSame && !bReplace )
4847 throw container::ElementExistException(
THROW_WHERE );
4850 return !bIsSourceSame;
4853 std::transform(
aEntries.begin(),
aEntries.end(), std::back_inserter(aResultVec),
4854 [&aIDTag](
const uno::Sequence<beans::StringPair>& rEntry) -> uno::Sequence<beans::StringPair> {
4855 auto pPair = lcl_findPairByName(rEntry, aIDTag);
4856 if (pPair == rEntry.end())
4857 throw io::IOException( THROW_WHERE );
4859 auto aResult = comphelper::sequenceToContainer<std::vector<beans::StringPair>>(rEntry);
4860 auto nIDInd = std::distance(rEntry.begin(), pPair);
4861 std::rotate(aResult.begin(), std::next(aResult.begin(), nIDInd), std::next(aResult.begin(), nIDInd + 1));
4863 return comphelper::containerToSequence(aResult);
4867 m_pImpl->m_xNewRelInfoStream.clear();
4892 const uno::Reference< io::XInputStream >& )
4900 const OUString& aStreamName,
4901 const uno::Reference< io::XInputStream >& xInStream,
4902 const uno::Sequence< beans::PropertyValue >& aProps )
4913 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
4916 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 1 );
4926 throw container::ElementExistException(
THROW_WHERE );
4929 OSL_ENSURE(pElement && pElement->
m_xStream,
"In case element can not be created an exception must be thrown!");
4931 pElement->
m_xStream->InsertStreamDirectly(xInStream, aProps);
4933 catch(
const embed::InvalidStorageException& )
4938 catch(
const lang::IllegalArgumentException& )
4943 catch(
const container::ElementExistException& )
4948 catch(
const embed::StorageWrappedTargetException& )
4953 catch(
const io::IOException& )
4958 catch(
const uno::RuntimeException& )
4963 catch(
const uno::Exception& )
4965 uno::Any aCaught( ::cppu::getCaughtException() );
4968 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't insert stream directly!",
4969 uno::Reference< io::XInputStream >(),
4975 const OUString& aElementName,
4976 const uno::Reference< embed::XOptimizedStorage >& xDest,
4977 const OUString& aNewName )
4989 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
4991 if ( !xDest.is() || xDest == getXWeak() )
4992 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 2 );
4994 if (
m_pImpl->
m_nStorageType == embed::StorageFormats::OFOPXML && ( aElementName ==
"_rels" || aNewName ==
"_rels" ) )
4995 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 0 );
5001 throw container::NoSuchElementException(
THROW_WHERE );
5003 uno::Reference< XNameAccess > xNameAccess( xDest, uno::UNO_QUERY_THROW );
5004 if ( xNameAccess->hasByName( aNewName ) )
5005 throw container::ElementExistException(
THROW_WHERE );
5008 uno::Reference< embed::XStorage > xStorDest( xDest, uno::UNO_QUERY_THROW );
5011 catch(
const embed::InvalidStorageException& )
5016 catch(
const lang::IllegalArgumentException& )
5021 catch(
const container::NoSuchElementException& )
5026 catch(
const container::ElementExistException& )
5031 catch(
const embed::StorageWrappedTargetException& )
5036 catch(
const io::IOException& )
5041 catch(
const uno::RuntimeException& )
5046 catch(
const uno::Exception& )
5048 uno::Any aCaught( ::cppu::getCaughtException() );
5051 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't copy element directly!",
5052 uno::Reference< io::XInputStream >(),
5068 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 0 );
5077 catch(
const embed::InvalidStorageException& )
5082 catch(
const lang::IllegalArgumentException& )
5087 catch(
const embed::StorageWrappedTargetException& )
5092 catch(
const io::IOException& )
5097 catch(
const uno::RuntimeException& )
5102 catch(
const uno::Exception& )
5104 uno::Any aCaught( ::cppu::getCaughtException() );
5107 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't write and attach to stream!",
5108 uno::Reference< io::XInputStream >(),
5126 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 0 );
5131 uno::Reference < ucb::XSimpleFileAccess3 > xAccess(
5138 uno::Reference< io::XInputStream > xInputStream = xAccess->openFileRead( sURL );
5143 uno::Reference< io::XStream >
xStream = xAccess->openFileReadWrite( sURL );
5147 catch(
const embed::InvalidStorageException& )
5152 catch(
const lang::IllegalArgumentException& )
5157 catch(
const embed::StorageWrappedTargetException& )
5162 catch(
const io::IOException& )
5167 catch(
const uno::RuntimeException& )
5172 catch(
const uno::Exception& )
5174 uno::Any aCaught( ::cppu::getCaughtException() );
5177 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't attach to URL!",
5178 uno::Reference< io::XInputStream >(),
5194 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
5197 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 1 );
5203 throw container::NoSuchElementException(
THROW_WHERE );
5207 throw beans::PropertyVetoException(
THROW_WHERE );
5218 catch(
const embed::InvalidStorageException& )
5223 catch(
const lang::IllegalArgumentException& )
5228 catch(
const container::NoSuchElementException& )
5233 catch(
const beans::UnknownPropertyException& )
5238 catch(
const beans::PropertyVetoException& )
5243 catch(
const embed::StorageWrappedTargetException& )
5248 catch(
const io::IOException& )
5253 catch(
const uno::RuntimeException& )
5258 catch(
const uno::Exception& )
5260 uno::Any aCaught( ::cppu::getCaughtException() );
5263 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't get element property!",
5264 uno::Reference< io::XInputStream >(),
5280 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
5283 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 1 );
5285 if ( !xTargetStream.is() )
5286 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 2 );
5290 uno::Reference< io::XStream > xNonconstRef = xTargetStream;
5293 SAL_WARN_IF( xNonconstRef != xTargetStream,
"package.xstor",
"The provided stream reference seems not be filled in correctly!" );
5294 if ( xNonconstRef != xTargetStream )
5297 catch(
const embed::InvalidStorageException& )
5302 catch(
const lang::IllegalArgumentException& )
5307 catch(
const packages::WrongPasswordException& )
5312 catch(
const io::IOException& )
5317 catch(
const embed::StorageWrappedTargetException& )
5322 catch(
const uno::RuntimeException& )
5327 catch(
const uno::Exception& )
5329 uno::Any aCaught( ::cppu::getCaughtException() );
5332 throw embed::StorageWrappedTargetException(
THROW_WHERE "Can't copy stream data!",
5333 uno::Reference< io::XInputStream >(),
5351 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
5354 && ( nOpenMode & embed::ElementModes::WRITE ) )
5358 OSL_ENSURE( aListPath.size(),
"The result list must not be empty!" );
5360 uno::Reference< embed::XExtendedStorageStream > xResult;
5361 if ( aListPath.size() == 1 )
5369 assert(pElement && pElement->
m_xStream &&
"In case element can not be created an exception must be thrown!");
5371 xResult.set(pElement->
m_xStream->GetStream(nOpenMode,
true),
5372 uno::UNO_QUERY_THROW);
5374 catch (
const container::NoSuchElementException & )
5384 uno::Reference< embed::XStorage >(
static_cast< embed::XStorage*
>(
this ) ) );
5392 if ( !xResult.is() )
5414 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
5420 OSL_ENSURE( aListPath.size(),
"The result list must not be empty!" );
5424 uno::Reference< embed::XStorage >(
static_cast< embed::XStorage*
>(
this ) ) );
5441 throw packages::NoEncryptionException(
THROW_WHERE );
5444 throw lang::IllegalArgumentException(
THROW_WHERE "Unexpected entry name syntax.", uno::Reference< uno::XInterface >(), 1 );
5446 if ( !aEncryptionData.hasElements() )
5447 throw lang::IllegalArgumentException(
THROW_WHERE, uno::Reference< uno::XInterface >(), 3 );
5450 && ( nOpenMode & embed::ElementModes::WRITE ) )
5454 OSL_ENSURE( aListPath.size(),
"The result list must not be empty!" );
5456 uno::Reference< embed::XExtendedStorageStream > xResult;
5457 if ( aListPath.size() == 1 )
5463 OSL_ENSURE(pElement && pElement->
m_xStream,
"In case element can not be created an exception must be thrown!");
5465 xResult.set(pElement->
m_xStream->GetStream(nOpenMode, aEncryptionData,
true),
5466 uno::UNO_QUERY_THROW);
5473 uno::Reference< embed::XStorage >(
static_cast< embed::XStorage*
>(
this ) ) );
5482 if ( !xResult.is() )
Reference< XComponentContext > m_xContext
constexpr OUStringLiteral ENCRYPTION_ALGORITHMS_PROPERTY
#define IS_INCONSISTENT_PROPERTY
#define HAS_NONENCRYPTED_ENTRIES_PROPERTY
constexpr OUStringLiteral MEDIATYPE_FALLBACK_USED_PROPERTY
constexpr OUStringLiteral STORAGE_ENCRYPTION_KEYS_PROPERTY
#define HAS_ENCRYPTED_ENTRIES_PROPERTY
constexpr OUStringLiteral ENCRYPTION_GPG_PROPERTIES
constexpr OUStringLiteral sMediaType
static std::vector< OUString > GetListPathFromString(std::u16string_view aPath)
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
void ChildIsDisposed(const css::uno::Reference< css::uno::XInterface > &xChild)
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL clearRelationships() override
virtual void SAL_CALL insertRelationshipByID(const OUString &sID, const css::uno::Sequence< css::beans::StringPair > &aEntry, sal_Bool bReplace) override
virtual void SAL_CALL release() noexcept override
virtual css::uno::Type SAL_CALL getElementType() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual void SAL_CALL removeEncryption() override
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > SAL_CALL getAllRelationships() override
virtual void SAL_CALL removeElement(const OUString &aElementName) override
virtual void SAL_CALL acquire() noexcept override
virtual css::uno::Reference< css::embed::XExtendedStorageStream > SAL_CALL openEncryptedStreamElementByHierarchicalName(const OUString &sStreamName, ::sal_Int32 nOpenMode, const OUString &sPassword) override
virtual void SAL_CALL removeTransactionListener(const css::uno::Reference< css::embed::XTransactionListener > &aListener) override
SotElement_Impl * OpenStreamElement_Impl(const OUString &aStreamName, sal_Int32 nOpenMode, bool bEncr)
virtual css::uno::Reference< css::io::XStream > SAL_CALL openEncryptedStreamElement(const OUString &aStreamName, sal_Int32 nOpenMode, const OUString &aPass) override
OStorage(css::uno::Reference< css::io::XInputStream > const &xInputStream, sal_Int32 nMode, const css::uno::Sequence< css::beans::PropertyValue > &xProperties, css::uno::Reference< css::uno::XComponentContext > const &xContext, sal_Int32 nStorageType)
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual css::uno::Reference< css::embed::XExtendedStorageStream > SAL_CALL openEncryptedStreamByHierarchicalName(const OUString &sStreamName, ::sal_Int32 nOpenMode, const css::uno::Sequence< css::beans::NamedValue > &aEncryptionData) override
virtual sal_Bool SAL_CALL isStreamElement(const OUString &aElementName) override
virtual ~OStorage() override
virtual void SAL_CALL copyLastCommitTo(const css::uno::Reference< css::embed::XStorage > &xTargetStorage) override
virtual css::uno::Reference< css::embed::XStorage > SAL_CALL openStorageElement(const OUString &aStorName, sal_Int32 nStorageMode) override
virtual void SAL_CALL insertStreamElementDirect(const OUString &sStreamName, const css::uno::Reference< css::io::XInputStream > &xInStream, const css::uno::Sequence< css::beans::PropertyValue > &aProps) override
virtual void SAL_CALL insertRelationships(const css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > &aEntries, sal_Bool bReplace) override
virtual css::uno::Sequence< css::beans::NamedValue > SAL_CALL getEncryptionAlgorithms() override
virtual void SAL_CALL commit() override
void MakeLinkToSubComponent_Impl(const css::uno::Reference< css::lang::XComponent > &xComponent)
virtual css::uno::Sequence< css::beans::StringPair > SAL_CALL getRelationshipByID(const OUString &sID) override
::rtl::Reference< OChildDispListener_Impl > m_pSubElDispListener
virtual void SAL_CALL setModified(sal_Bool bModified) override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
virtual void SAL_CALL renameElement(const OUString &rEleName, const OUString &rNewName) override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
virtual sal_Bool SAL_CALL hasEncryptionData() override
virtual void SAL_CALL moveElementTo(const OUString &aElementName, const css::uno::Reference< css::embed::XStorage > &xDest, const OUString &rNewName) override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual void SAL_CALL copyStorageElementLastCommitTo(const OUString &aStorName, const css::uno::Reference< css::embed::XStorage > &xTargetStorage) override
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual css::uno::Reference< css::io::XStream > SAL_CALL cloneStreamElement(const OUString &aStreamName) override
virtual sal_Bool SAL_CALL hasElements() override
virtual css::uno::Reference< css::io::XStream > SAL_CALL openEncryptedStream(const OUString &sStreamName, ::sal_Int32 nOpenMode, const css::uno::Sequence< css::beans::NamedValue > &aEncryptionData) override
comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenersContainer
void BroadcastTransaction(sal_Int8 nMessage)
virtual void SAL_CALL attachToURL(const OUString &sURL, sal_Bool bReadOnly) override
virtual void SAL_CALL addTransactionListener(const css::uno::Reference< css::embed::XTransactionListener > &aListener) override
::std::optional< ::cppu::OTypeCollection > m_oTypeCollection
void BroadcastModifiedIfNecessary()
virtual void SAL_CALL insertRawEncrStreamElement(const OUString &aStreamName, const css::uno::Reference< css::io::XInputStream > &xInStream) override
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual css::uno::Reference< css::io::XStream > SAL_CALL cloneEncryptedStreamElement(const OUString &aStreamName, const OUString &aPass) override
virtual css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > SAL_CALL getRelationshipsByType(const OUString &sType) override
virtual void SAL_CALL setEncryptionData(const css::uno::Sequence< css::beans::NamedValue > &aEncryptionData) override
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getRawEncrStreamElement(const OUString &sStreamName) override
virtual void SAL_CALL dispose() override
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getPlainRawStreamElement(const OUString &sStreamName) override
virtual void SAL_CALL setGpgProperties(const css::uno::Sequence< css::uno::Sequence< css::beans::NamedValue > > &aCryptProps) override
virtual css::uno::Any SAL_CALL getElementPropertyValue(const OUString &sElementName, const OUString &sPropertyName) override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
virtual sal_Bool SAL_CALL hasByID(const OUString &sID) override
::std::vector< css::uno::WeakReference< css::lang::XComponent > > m_aOpenSubComponentsVector
virtual css::uno::Reference< css::embed::XExtendedStorageStream > SAL_CALL openStreamElementByHierarchicalName(const OUString &sStreamPath, ::sal_Int32 nOpenMode) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Reference< css::io::XStream > SAL_CALL openStreamElement(const OUString &aStreamName, sal_Int32 nOpenMode) override
virtual void SAL_CALL copyElementTo(const OUString &aElementName, const css::uno::Reference< css::embed::XStorage > &xDest, const OUString &aNewName) override
virtual OUString SAL_CALL getTypeByID(const OUString &sID) override
virtual void SAL_CALL revert() override
virtual css::uno::Reference< css::io::XStream > SAL_CALL cloneEncryptedStream(const OUString &sStreamName, const css::uno::Sequence< css::beans::NamedValue > &aEncryptionData) override
virtual void SAL_CALL insertRawNonEncrStreamElementDirect(const OUString &sStreamName, const css::uno::Reference< css::io::XInputStream > &xInStream) override
virtual void SAL_CALL writeAndAttachToStream(const css::uno::Reference< css::io::XStream > &xStream) override
virtual OUString SAL_CALL getTargetByID(const OUString &sID) override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual sal_Bool SAL_CALL isStorageElement(const OUString &aElementName) override
rtl::Reference< comphelper::RefCountedMutex > m_xSharedMutex
::rtl::Reference< OHierarchyHolder_Impl > m_rHierarchyHolder
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
void InternalDispose(bool bNotifyImpl)
virtual sal_Bool SAL_CALL isModified() override
virtual void SAL_CALL setEncryptionAlgorithms(const css::uno::Sequence< css::beans::NamedValue > &aAlgorithms) override
virtual void SAL_CALL copyElementDirectlyTo(const OUString &sSourceName, const css::uno::Reference< css::embed::XOptimizedStorage > &xTargetStorage, const OUString &sTargetName) override
virtual void SAL_CALL setEncryptionPassword(const OUString &aPass) override
virtual void SAL_CALL copyToStorage(const css::uno::Reference< css::embed::XStorage > &xDest) override
virtual void SAL_CALL removeStreamElementByHierarchicalName(const OUString &sElementPath) override
virtual void SAL_CALL copyStreamElementData(const OUString &sStreamName, const css::uno::Reference< css::io::XStream > &xTargetStream) override
virtual void SAL_CALL removeRelationshipByID(const OUString &sID) override
sal_Int32 GetRefCount_Impl() const
css::uno::XInterface * next()
bool hasMoreElements() const
OInterfaceContainerHelper2 * getContainer(const css::uno::Type &rKey) const
sal_Int32 removeInterface(const css::uno::Type &rKey, const css::uno::Reference< css::uno::XInterface > &rxIFace)
sal_Int32 addInterface(const css::uno::Type &rKey, const css::uno::Reference< css::uno::XInterface > &r)
void disposeAndClear(const css::lang::EventObject &rEvt)
static css::uno::Sequence< css::beans::NamedValue > CreatePackageEncryptionData(std::u16string_view aPassword)
static bool IsValidZipEntryFileName(std::u16string_view aName, bool bSlashAllowed)
static void CopyInputToOutput(const css::uno::Reference< css::io::XInputStream > &xInput, const css::uno::Reference< css::io::XOutputStream > &xOutput)
css::uno::Sequence< css::beans::NamedValue > getAsConstNamedValueList() const
const css::uno::Sequence< sal_Int8 > & getSeq() const
oslInterlockedCount m_refCount
OString exceptionToString(const css::uno::Any &caught)
#define TOOLS_WARN_EXCEPTION(area, stream)
#define TOOLS_INFO_EXCEPTION(area, stream)
uno::Reference< deployment::XPackage > m_xPackage
ScXMLEditAttributeMap::Entry const aEntries[]
Sequence< PropertyValue > aArguments
Sequence< sal_Int8 > aSeq
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
void removeElementAt(css::uno::Sequence< T > &_rSeq, sal_Int32 _nPos)
Any SAL_CALL getCaughtException()
bool PackageEncryptionDataLessOrEqual(const ::comphelper::SequenceAsHashMap &aHash1, const ::comphelper::SequenceAsHashMap &aHash2)
const PropertyStruct aPropNames[]
css::uno::Reference< css::container::XNameContainer > m_xPackageFolder
OStorage_Impl(css::uno::Reference< css::io::XInputStream > const &xInputStream, sal_Int32 nMode, const css::uno::Sequence< css::beans::PropertyValue > &xProperties, css::uno::Reference< css::uno::XComponentContext > const &xContext, sal_Int32 nStorageType)
SotElement_Impl * InsertStorage(const OUString &aName, sal_Int32 nStorageMode)
bool m_bBroadcastModified
sal_Int16 m_nRelInfoStatus
void OpenSubStream(SotElement_Impl *pElement)
SotElement_Impl * InsertStream(const OUString &aName, bool bEncr)
css::uno::Reference< css::io::XInputStream > GetRelInfoStreamForName(std::u16string_view aName)
void CopyToStorage(const css::uno::Reference< css::embed::XStorage > &xDest, bool bDirect)
css::uno::Reference< css::uno::XComponentContext > m_xContext
void CopyLastCommitTo(const css::uno::Reference< css::embed::XStorage > &xNewStor)
std::unordered_map< OUString, std::vector< SotElement_Impl * > > m_aChildrenMap
void GetStorageProperties()
SotElement_Impl * FindElement(const OUString &rName)
OStorage_Impl * m_pParent
std::vector< SotElement_Impl * > m_aDeletedVector
SotElement_Impl * m_pRelStorElement
css::uno::Sequence< css::beans::PropertyValue > m_xProperties
SotElement_Impl * InsertElement(const OUString &aName, bool bIsStorage)
css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > GetAllRelationshipsIfAny()
void InsertIntoPackageFolder(const OUString &aName, const css::uno::Reference< css::container::XNameContainer > &xParentPackageFolder)
rtl::Reference< comphelper::RefCountedMutex > m_xMutex
std::unique_ptr< OStorage_Impl > CreateNewStorageImpl(sal_Int32 nStorageMode)
rtl::Reference< SwitchablePersistenceStream > m_pSwitchStream
css::uno::Reference< css::embed::XStorage > m_xRelStorage
void RemoveStreamRelInfo(std::u16string_view aOriginalName)
void CommitStreamRelInfo(std::u16string_view rName, SotElement_Impl const *pStreamElement)
static void completeStorageStreamCopy_Impl(const css::uno::Reference< css::io::XStream > &xSource, const css::uno::Reference< css::io::XStream > &xDest, sal_Int32 nStorageType, const css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > &aRelInfo)
void ReadRelInfoIfNecessary()
void OpenSubStorage(SotElement_Impl *pElement, sal_Int32 nStorageMode)
css::uno::Reference< css::lang::XSingleServiceFactory > m_xPackage
css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > m_aRelInfo
css::uno::Reference< css::io::XStream > m_xStream
void CloneStreamElement(const OUString &aStreamName, bool bPassProvided, const ::comphelper::SequenceAsHashMap &aEncryptionData, css::uno::Reference< css::io::XStream > &xTargetStream)
::comphelper::SequenceAsHashMap m_aCommonEncryptionData
StorageHoldersType m_aReadOnlyWrapVector
static void ClearElement(SotElement_Impl *pElement)
void RemoveElement(OUString const &rName, SotElement_Impl *pElement)
::comphelper::SequenceAsHashMap GetCommonRootEncryptionData()
void SetReadOnlyWrap(OStorage &aStorage)
bool m_bHasCommonEncryptionData
oslInterlockedCount m_nModifiedListenerCount
Count of registered modification listeners.
css::uno::Sequence< OUString > GetElementNames()
void CopyStorageElement(SotElement_Impl *pElement, const css::uno::Reference< css::embed::XStorage > &xDest, const OUString &aName, bool bDirect)
css::uno::Reference< css::io::XInputStream > m_xInputStream
void CommitRelInfo(const css::uno::Reference< css::container::XNameContainer > &xNewPackageFolder)
css::uno::Reference< css::io::XInputStream > m_xNewRelInfoStream
void RemoveReadOnlyWrap(const OStorage &aStorage)
void InsertRawStream(const OUString &aName, const css::uno::Reference< css::io::XInputStream > &xInStream)
SotElement_Impl(OUString aName, bool bStor, bool bNew)
std::unique_ptr< OWriteStream_Impl, o3tl::default_delete< OWriteStream_Impl > > m_xStream
std::unique_ptr< OStorage_Impl > m_xStorage
static uno::Reference< io::XInputStream > GetSeekableTempCopy(const uno::Reference< io::XInputStream > &xInStream)
#define STOR_MESS_PREREVERT
#define STOR_MESS_COMMITTED
#define STOR_MESS_REVERTED
#define RELINFO_CHANGED_STREAM_READ
#define RELINFO_CHANGED_BROKEN
#define STOR_MESS_PRECOMMIT
#define RELINFO_CHANGED_STREAM