LibreOffice Module package (master) 1
xstorage.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_PACKAGE_SOURCE_XSTOR_XSTORAGE_HXX
21#define INCLUDED_PACKAGE_SOURCE_XSTOR_XSTORAGE_HXX
22
23#include <com/sun/star/uno/Sequence.hxx>
24#include <com/sun/star/embed/XStorage2.hpp>
25#include <com/sun/star/embed/XOptimizedStorage.hpp>
26#include <com/sun/star/embed/XHierarchicalStorageAccess2.hpp>
27#include <com/sun/star/embed/XStorageRawAccess.hpp>
28#include <com/sun/star/embed/XTransactedObject.hpp>
29#include <com/sun/star/embed/XTransactionBroadcaster.hpp>
30#include <com/sun/star/embed/XEncryptionProtectedStorage.hpp>
31#include <com/sun/star/embed/XRelationshipAccess.hpp>
32#include <com/sun/star/util/XModifiable.hpp>
33#include <com/sun/star/container/XNameContainer.hpp>
34#include <com/sun/star/beans/XPropertySet.hpp>
35#include <com/sun/star/beans/PropertyValue.hpp>
36#include <com/sun/star/beans/StringPair.hpp>
37#include <com/sun/star/io/XStream.hpp>
38#include <com/sun/star/lang/XSingleServiceFactory.hpp>
39#include <com/sun/star/lang/XTypeProvider.hpp>
40#include <com/sun/star/lang/XComponent.hpp>
41
43#include <cppuhelper/weak.hxx>
48#include <o3tl/deleter.hxx>
49#include <rtl/ref.hxx>
50
51#include "ohierarchyholder.hxx"
52#include "disposelistener.hxx"
53
54#include <vector>
55#include <memory>
56#include <optional>
57#include <string_view>
58
59namespace com::sun::star::uno {
60 class XComponentContext;
61}
62
63#define RELINFO_NO_INIT 1
64#define RELINFO_READ 2
65#define RELINFO_CHANGED 3
66#define RELINFO_CHANGED_STREAM 4
67#define RELINFO_CHANGED_STREAM_READ 5
68#define RELINFO_BROKEN 6
69#define RELINFO_CHANGED_BROKEN 7
70
71#define STOR_MESS_PRECOMMIT 1
72#define STOR_MESS_COMMITTED 2
73#define STOR_MESS_PREREVERT 3
74#define STOR_MESS_REVERTED 4
75
76// a common implementation for an entry
77
78struct OStorage_Impl;
80
82{
87
88 std::unique_ptr<OStorage_Impl> m_xStorage;
89 std::unique_ptr<OWriteStream_Impl, o3tl::default_delete<OWriteStream_Impl>> m_xStream;
90
91public:
92 SotElement_Impl(OUString aName, bool bStor, bool bNew);
93};
94
95// Main storage implementation
96
97class OStorage;
98
100{
102 css::uno::WeakReference< css::embed::XStorage > m_xWeakRef;
103
104 explicit inline StorageHolder_Impl( OStorage* pStorage );
105};
106
109{
110 typedef std::vector<StorageHolder_Impl> StorageHoldersType;
111
113
114 OStorage* m_pAntiImpl; // only valid if external references exists
115 StorageHoldersType m_aReadOnlyWrapVector; // only valid if readonly external reference exists
116
117 sal_Int32 m_nStorageMode; // open mode ( read/write/trunc/nocreate )
118 bool m_bIsModified; // only modified elements will be sent to the original content
119 bool m_bBroadcastModified; // will be set if notification is required
120
121 bool m_bCommited; // sending the streams is coordinated by the root storage of the package
122
123 bool m_bIsRoot; // marks this storage as root storages that manages all commits and reverts
125
127 oslInterlockedCount m_nModifiedListenerCount;
129 {
130 return m_nModifiedListenerCount > 0 && m_pAntiImpl != nullptr;
131 }
132
133 std::unordered_map<OUString, std::vector<SotElement_Impl*>> m_aChildrenMap;
134 std::vector< SotElement_Impl* > m_aDeletedVector;
135
136 css::uno::Reference< css::container::XNameContainer > m_xPackageFolder;
137
138 css::uno::Reference< css::lang::XSingleServiceFactory > m_xPackage;
139 css::uno::Reference< css::uno::XComponentContext > m_xContext;
140
141 // valid only for root storage
142 css::uno::Reference< css::io::XInputStream > m_xInputStream; // ??? may be stored in properties
143 css::uno::Reference< css::io::XStream > m_xStream; // ??? may be stored in properties
144 css::uno::Sequence< css::beans::PropertyValue > m_xProperties;
147
148 // must be empty in case of root storage
150
152 OUString m_aMediaType;
154
156 OUString m_aVersion;
157
159
160 sal_Int32 m_nStorageType; // the mode in which the storage is used
161
162 // the _rels substorage that is handled in a special way in embed::StorageFormats::OFOPXML
164 css::uno::Reference< css::embed::XStorage > m_xRelStorage;
165 css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > m_aRelInfo;
166 css::uno::Reference< css::io::XInputStream > m_xNewRelInfoStream;
168
169 // Constructors
170 OStorage_Impl( css::uno::Reference< css::io::XInputStream > const & xInputStream,
171 sal_Int32 nMode,
172 const css::uno::Sequence< css::beans::PropertyValue >& xProperties,
173 css::uno::Reference< css::uno::XComponentContext > const & xContext,
174 sal_Int32 nStorageType );
175
176 OStorage_Impl( css::uno::Reference< css::io::XStream > const & xStream,
177 sal_Int32 nMode,
178 const css::uno::Sequence< css::beans::PropertyValue >& xProperties,
179 css::uno::Reference< css::uno::XComponentContext > const & xContext,
180 sal_Int32 nStorageType );
181
182 // constructor for a substorage
184 sal_Int32 nMode,
185 css::uno::Reference< css::container::XNameContainer > const & xPackageFolder,
186 css::uno::Reference< css::lang::XSingleServiceFactory > xPackage,
187 css::uno::Reference< css::uno::XComponentContext > const & xContext,
188 sal_Int32 nStorageType );
189
191
192 void SetReadOnlyWrap( OStorage& aStorage );
193 void RemoveReadOnlyWrap( const OStorage& aStorage );
194
195 void OpenOwnPackage();
196 void ReadContents();
198
199 bool HasChildren();
201
202 css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > GetAllRelationshipsIfAny();
203 void CopyLastCommitTo( const css::uno::Reference< css::embed::XStorage >& xNewStor );
204
206 const OUString& aName,
207 const css::uno::Reference< css::container::XNameContainer >& xParentPackageFolder );
208
209 void Commit();
210 void Revert();
211
214
215 void CopyToStorage( const css::uno::Reference< css::embed::XStorage >& xDest,
216 bool bDirect );
217 void CopyStorageElement( SotElement_Impl* pElement,
218 const css::uno::Reference< css::embed::XStorage >& xDest,
219 const OUString& aName,
220 bool bDirect );
221
222 SotElement_Impl* FindElement( const OUString& rName );
223
224 SotElement_Impl* InsertStream( const OUString& aName, bool bEncr );
225 void InsertRawStream( const OUString& aName, const css::uno::Reference< css::io::XInputStream >& xInStream );
226
227 std::unique_ptr<OStorage_Impl> CreateNewStorageImpl( sal_Int32 nStorageMode );
228 SotElement_Impl* InsertStorage( const OUString& aName, sal_Int32 nStorageMode );
229 SotElement_Impl* InsertElement( const OUString& aName, bool bIsStorage );
230
231 void OpenSubStorage( SotElement_Impl* pElement, sal_Int32 nStorageMode );
232 void OpenSubStream( SotElement_Impl* pElement );
233
234 css::uno::Sequence< OUString > GetElementNames();
235
236 void RemoveElement( OUString const & rName, SotElement_Impl* pElement );
237 static void ClearElement( SotElement_Impl* pElement );
238
248 const OUString& aStreamName,
249 bool bPassProvided,
250 const ::comphelper::SequenceAsHashMap& aEncryptionData,
251 css::uno::Reference< css::io::XStream >& xTargetStream );
252
253 void RemoveStreamRelInfo( std::u16string_view aOriginalName );
254 void CreateRelStorage();
255 void CommitStreamRelInfo( std::u16string_view rName, SotElement_Impl const * pStreamElement );
256 css::uno::Reference< css::io::XInputStream > GetRelInfoStreamForName(
257 std::u16string_view aName );
258 void CommitRelInfo( const css::uno::Reference< css::container::XNameContainer >& xNewPackageFolder );
259
261 const css::uno::Reference< css::io::XStream >& xSource,
262 const css::uno::Reference< css::io::XStream >& xDest,
263 sal_Int32 nStorageType,
264 const css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > >& aRelInfo );
265
266};
267
268class OStorage final : public css::lang::XTypeProvider
269 , public css::embed::XStorage2
270 , public css::embed::XStorageRawAccess
271 , public css::embed::XTransactedObject
272 , public css::embed::XTransactionBroadcaster
273 , public css::util::XModifiable
274 , public css::embed::XEncryptionProtectedStorage
275 , public css::beans::XPropertySet
276 , public css::embed::XOptimizedStorage
277 , public css::embed::XRelationshipAccess
278 , public css::embed::XHierarchicalStorageAccess2
279 , public ::cppu::OWeakObject
280{
284 ::std::optional< ::cppu::OTypeCollection> m_oTypeCollection;
287 ::std::vector< css::uno::WeakReference< css::lang::XComponent > > m_aOpenSubComponentsVector;
289
290 SotElement_Impl* OpenStreamElement_Impl( const OUString& aStreamName, sal_Int32 nOpenMode, bool bEncr );
291
293
294 void BroadcastTransaction( sal_Int8 nMessage );
295
297 const css::uno::Reference< css::lang::XComponent >& xComponent );
298
299public:
300
301 OStorage( css::uno::Reference< css::io::XInputStream > const & xInputStream,
302 sal_Int32 nMode,
303 const css::uno::Sequence< css::beans::PropertyValue >& xProperties,
304 css::uno::Reference< css::uno::XComponentContext > const & xContext,
305 sal_Int32 nStorageType );
306
307 OStorage( css::uno::Reference< css::io::XStream > const & xStream,
308 sal_Int32 nMode,
309 const css::uno::Sequence< css::beans::PropertyValue >& xProperties,
310 css::uno::Reference< css::uno::XComponentContext > const & xContext,
311 sal_Int32 nStorageType );
312
313 OStorage( OStorage_Impl* pImpl, bool bReadOnlyWrap );
314
315 virtual ~OStorage() override;
316
317 void InternalDispose( bool bNotifyImpl );
318
319 void ChildIsDisposed( const css::uno::Reference< css::uno::XInterface >& xChild );
320
321 sal_Int32 GetRefCount_Impl() const { return m_refCount; }
322
323 // XInterface
324
325 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override;
326
327 virtual void SAL_CALL acquire() noexcept override;
328
329 virtual void SAL_CALL release() noexcept override;
330
331 // XTypeProvider
332
333 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override;
334
335 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
336
337 // XStorage
338
339 virtual void SAL_CALL copyToStorage( const css::uno::Reference< css::embed::XStorage >& xDest ) override;
340
341 virtual css::uno::Reference< css::io::XStream > SAL_CALL openStreamElement(
342 const OUString& aStreamName, sal_Int32 nOpenMode ) override;
343
344 virtual css::uno::Reference< css::io::XStream > SAL_CALL openEncryptedStreamElement(
345 const OUString& aStreamName, sal_Int32 nOpenMode, const OUString& aPass ) override;
346
347 virtual css::uno::Reference< css::embed::XStorage > SAL_CALL openStorageElement(
348 const OUString& aStorName, sal_Int32 nStorageMode ) override;
349
350 virtual css::uno::Reference< css::io::XStream > SAL_CALL cloneStreamElement(
351 const OUString& aStreamName ) override;
352
353 virtual css::uno::Reference< css::io::XStream > SAL_CALL cloneEncryptedStreamElement(
354 const OUString& aStreamName, const OUString& aPass ) override;
355
356 virtual void SAL_CALL copyLastCommitTo(
357 const css::uno::Reference< css::embed::XStorage >& xTargetStorage ) override;
358
359 virtual void SAL_CALL copyStorageElementLastCommitTo(
360 const OUString& aStorName,
361 const css::uno::Reference< css::embed::XStorage >& xTargetStorage ) override;
362
363 virtual sal_Bool SAL_CALL isStreamElement( const OUString& aElementName ) override;
364
365 virtual sal_Bool SAL_CALL isStorageElement( const OUString& aElementName ) override;
366
367 virtual void SAL_CALL removeElement( const OUString& aElementName ) override;
368
369 virtual void SAL_CALL renameElement( const OUString& rEleName, const OUString& rNewName ) override;
370
371 virtual void SAL_CALL copyElementTo( const OUString& aElementName,
372 const css::uno::Reference< css::embed::XStorage >& xDest,
373 const OUString& aNewName ) override;
374
375 virtual void SAL_CALL moveElementTo( const OUString& aElementName,
376 const css::uno::Reference< css::embed::XStorage >& xDest,
377 const OUString& rNewName ) override;
378
379 // XStorage2
380
381 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;
382
383 virtual css::uno::Reference< css::io::XStream > SAL_CALL cloneEncryptedStream( const OUString& sStreamName, const css::uno::Sequence< css::beans::NamedValue >& aEncryptionData ) override;
384
385 // XStorageRawAccess
386
387 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getPlainRawStreamElement(
388 const OUString& sStreamName ) override;
389
390 virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getRawEncrStreamElement(
391 const OUString& sStreamName ) override;
392
393 virtual void SAL_CALL insertRawEncrStreamElement( const OUString& aStreamName,
394 const css::uno::Reference< css::io::XInputStream >& xInStream ) override;
395
396 // XTransactedObject
397 virtual void SAL_CALL commit() override;
398
399 virtual void SAL_CALL revert() override;
400
401 // XTransactionBroadcaster
402 virtual void SAL_CALL addTransactionListener(
403 const css::uno::Reference< css::embed::XTransactionListener >& aListener ) override;
404
405 virtual void SAL_CALL removeTransactionListener(
406 const css::uno::Reference< css::embed::XTransactionListener >& aListener ) override;
407
408 // XModifiable
409
410 virtual sal_Bool SAL_CALL isModified() override;
411
412 virtual void SAL_CALL setModified( sal_Bool bModified ) override;
413
414 virtual void SAL_CALL addModifyListener(
415 const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
416
417 virtual void SAL_CALL removeModifyListener(
418 const css::uno::Reference< css::util::XModifyListener >& aListener ) override;
419
420 // XNameAccess
421
422 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
423
424 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
425
426 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
427
428 virtual css::uno::Type SAL_CALL getElementType() override;
429
430 virtual sal_Bool SAL_CALL hasElements() override;
431
432 // XComponent
433
434 virtual void SAL_CALL dispose() override;
435
436 virtual void SAL_CALL addEventListener(
437 const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
438
439 virtual void SAL_CALL removeEventListener(
440 const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
441
442 // XEncryptionProtectedSource
443
444 virtual void SAL_CALL setEncryptionPassword( const OUString& aPass ) override;
445
446 virtual void SAL_CALL removeEncryption() override;
447
448 // XEncryptionProtectedSource2
449
450 virtual void SAL_CALL setEncryptionData(
451 const css::uno::Sequence< css::beans::NamedValue >& aEncryptionData ) override;
452
453 virtual sal_Bool SAL_CALL hasEncryptionData() override;
454
455 // XEncryptionProtectedStorage
456
457 virtual void SAL_CALL setEncryptionAlgorithms( const css::uno::Sequence< css::beans::NamedValue >& aAlgorithms ) override;
458 virtual void SAL_CALL setGpgProperties( const css::uno::Sequence< css::uno::Sequence< css::beans::NamedValue > >& aCryptProps ) override;
459
460 virtual css::uno::Sequence< css::beans::NamedValue > SAL_CALL getEncryptionAlgorithms() override;
461
462 // XPropertySet
463
464 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override;
465
466 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
467
468 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
469
470 virtual void SAL_CALL addPropertyChangeListener(
471 const OUString& aPropertyName,
472 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
473
474 virtual void SAL_CALL removePropertyChangeListener(
475 const OUString& aPropertyName,
476 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
477
478 virtual void SAL_CALL addVetoableChangeListener(
479 const OUString& PropertyName,
480 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
481
482 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
483
484 // XOptimizedStorage
485 virtual void SAL_CALL insertRawNonEncrStreamElementDirect( const OUString& sStreamName, const css::uno::Reference< css::io::XInputStream >& xInStream ) override;
486
487 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;
488
489 virtual void SAL_CALL copyElementDirectlyTo( const OUString& sSourceName, const css::uno::Reference< css::embed::XOptimizedStorage >& xTargetStorage, const OUString& sTargetName ) override;
490
491 virtual void SAL_CALL writeAndAttachToStream( const css::uno::Reference< css::io::XStream >& xStream ) override;
492
493 virtual void SAL_CALL attachToURL( const OUString& sURL, sal_Bool bReadOnly ) override;
494
495 virtual css::uno::Any SAL_CALL getElementPropertyValue( const OUString& sElementName, const OUString& sPropertyName ) override;
496
497 virtual void SAL_CALL copyStreamElementData( const OUString& sStreamName, const css::uno::Reference< css::io::XStream >& xTargetStream ) override;
498
499 // XRelationshipAccess
500 virtual sal_Bool SAL_CALL hasByID( const OUString& sID ) override;
501
502 virtual OUString SAL_CALL getTargetByID( const OUString& sID ) override;
503
504 virtual OUString SAL_CALL getTypeByID( const OUString& sID ) override;
505
506 virtual css::uno::Sequence< css::beans::StringPair > SAL_CALL getRelationshipByID( const OUString& sID ) override;
507
508 virtual css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > SAL_CALL getRelationshipsByType( const OUString& sType ) override;
509
510 virtual css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > SAL_CALL getAllRelationships( ) override;
511
512 virtual void SAL_CALL insertRelationshipByID( const OUString& sID, const css::uno::Sequence< css::beans::StringPair >& aEntry, sal_Bool bReplace ) override;
513
514 virtual void SAL_CALL removeRelationshipByID( const OUString& sID ) override;
515
516 virtual void SAL_CALL insertRelationships( const css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > >& aEntries, sal_Bool bReplace ) override;
517
518 virtual void SAL_CALL clearRelationships( ) override;
519
520 // XHierarchicalStorageAccess
521 virtual css::uno::Reference< css::embed::XExtendedStorageStream > SAL_CALL openStreamElementByHierarchicalName( const OUString& sStreamPath, ::sal_Int32 nOpenMode ) override;
522
523 virtual css::uno::Reference< css::embed::XExtendedStorageStream > SAL_CALL openEncryptedStreamElementByHierarchicalName( const OUString& sStreamName, ::sal_Int32 nOpenMode, const OUString& sPassword ) override;
524
525 virtual void SAL_CALL removeStreamElementByHierarchicalName( const OUString& sElementPath ) override;
526
527 // XHierarchicalStorageAccess2
528 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;
529};
530
532: m_pPointer( pStorage )
533, m_xWeakRef( css::uno::Reference< css::embed::XStorage >( pStorage ) )
534{
535}
536
537#endif
538
539/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: xstorage.cxx:4530
void ChildIsDisposed(const css::uno::Reference< css::uno::XInterface > &xChild)
Definition: xstorage.cxx:1863
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: xstorage.cxx:4293
OStorage_Impl * m_pImpl
Definition: xstorage.hxx:281
virtual void SAL_CALL clearRelationships() override
Definition: xstorage.cxx:4871
virtual void SAL_CALL insertRelationshipByID(const OUString &sID, const css::uno::Sequence< css::beans::StringPair > &aEntry, sal_Bool bReplace) override
Definition: xstorage.cxx:4734
virtual void SAL_CALL release() noexcept override
Definition: xstorage.cxx:2076
virtual css::uno::Type SAL_CALL getElementType() override
Definition: xstorage.cxx:3874
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: xstorage.cxx:2082
virtual void SAL_CALL removeEncryption() override
Definition: xstorage.cxx:3986
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
Definition: xstorage.cxx:3731
virtual css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > SAL_CALL getAllRelationships() override
Definition: xstorage.cxx:4697
virtual void SAL_CALL removeElement(const OUString &aElementName) override
Definition: xstorage.cxx:2745
virtual void SAL_CALL acquire() noexcept override
Definition: xstorage.cxx:2071
virtual css::uno::Reference< css::embed::XExtendedStorageStream > SAL_CALL openEncryptedStreamElementByHierarchicalName(const OUString &sStreamName, ::sal_Int32 nOpenMode, const OUString &sPassword) override
Definition: xstorage.cxx:5398
virtual void SAL_CALL removeTransactionListener(const css::uno::Reference< css::embed::XTransactionListener > &aListener) override
Definition: xstorage.cxx:3658
SotElement_Impl * OpenStreamElement_Impl(const OUString &aStreamName, sal_Int32 nOpenMode, bool bEncr)
Definition: xstorage.cxx:1957
virtual css::uno::Reference< css::io::XStream > SAL_CALL openEncryptedStreamElement(const OUString &aStreamName, sal_Int32 nOpenMode, const OUString &aPass) override
Definition: xstorage.cxx:2289
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
Definition: xstorage.cxx:2147
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
Definition: xstorage.cxx:5430
virtual sal_Bool SAL_CALL isStreamElement(const OUString &aElementName) override
Definition: xstorage.cxx:2629
virtual ~OStorage() override
Definition: xstorage.cxx:1776
virtual void SAL_CALL copyLastCommitTo(const css::uno::Reference< css::embed::XStorage > &xTargetStorage) override
Definition: xstorage.cxx:2499
virtual css::uno::Reference< css::embed::XStorage > SAL_CALL openStorageElement(const OUString &aStorName, sal_Int32 nStorageMode) override
Definition: xstorage.cxx:2295
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
Definition: xstorage.cxx:4899
virtual void SAL_CALL insertRelationships(const css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > &aEntries, sal_Bool bReplace) override
Definition: xstorage.cxx:4818
virtual css::uno::Sequence< css::beans::NamedValue > SAL_CALL getEncryptionAlgorithms() override
Definition: xstorage.cxx:4232
virtual void SAL_CALL commit() override
Definition: xstorage.cxx:3520
void MakeLinkToSubComponent_Impl(const css::uno::Reference< css::lang::XComponent > &xComponent)
Definition: xstorage.cxx:1995
OStorage(css::uno::Reference< css::io::XStream > const &xStream, 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< css::beans::StringPair > SAL_CALL getRelationshipByID(const OUString &sID) override
Definition: xstorage.cxx:4642
::rtl::Reference< OChildDispListener_Impl > m_pSubElDispListener
Definition: xstorage.hxx:286
virtual void SAL_CALL setModified(sal_Bool bModified) override
Definition: xstorage.cxx:3690
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: xstorage.cxx:3949
virtual void SAL_CALL renameElement(const OUString &rEleName, const OUString &rNewName) override
Definition: xstorage.cxx:2822
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: xstorage.cxx:3805
virtual sal_Bool SAL_CALL hasEncryptionData() override
Definition: xstorage.cxx:4103
virtual void SAL_CALL moveElementTo(const OUString &aElementName, const css::uno::Reference< css::embed::XStorage > &xDest, const OUString &rNewName) override
Definition: xstorage.cxx:3001
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: xstorage.cxx:3749
virtual void SAL_CALL copyStorageElementLastCommitTo(const OUString &aStorName, const css::uno::Reference< css::embed::XStorage > &xTargetStorage) override
Definition: xstorage.cxx:2551
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
Definition: xstorage.cxx:4515
virtual css::uno::Reference< css::io::XStream > SAL_CALL cloneStreamElement(const OUString &aStreamName) override
Definition: xstorage.cxx:2427
virtual sal_Bool SAL_CALL hasElements() override
Definition: xstorage.cxx:3888
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
Definition: xstorage.cxx:3098
comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenersContainer
Definition: xstorage.hxx:283
void BroadcastTransaction(sal_Int8 nMessage)
Definition: xstorage.cxx:1909
virtual void SAL_CALL attachToURL(const OUString &sURL, sal_Bool bReadOnly) override
Definition: xstorage.cxx:5114
virtual void SAL_CALL addTransactionListener(const css::uno::Reference< css::embed::XTransactionListener > &aListener) override
Definition: xstorage.cxx:3644
::std::optional< ::cppu::OTypeCollection > m_oTypeCollection
Definition: xstorage.hxx:284
void BroadcastModifiedIfNecessary()
Definition: xstorage.cxx:1878
virtual void SAL_CALL insertRawEncrStreamElement(const OUString &aStreamName, const css::uno::Reference< css::io::XInputStream > &xInStream) override
Definition: xstorage.cxx:3442
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &aListener) override
Definition: xstorage.cxx:3715
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: xstorage.cxx:4307
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: xstorage.cxx:4406
virtual css::uno::Reference< css::io::XStream > SAL_CALL cloneEncryptedStreamElement(const OUString &aStreamName, const OUString &aPass) override
Definition: xstorage.cxx:2492
virtual css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > SAL_CALL getRelationshipsByType(const OUString &sType) override
Definition: xstorage.cxx:4668
virtual void SAL_CALL setEncryptionData(const css::uno::Sequence< css::beans::NamedValue > &aEncryptionData) override
Definition: xstorage.cxx:4047
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
Definition: xstorage.cxx:4545
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getRawEncrStreamElement(const OUString &sStreamName) override
Definition: xstorage.cxx:3343
virtual void SAL_CALL dispose() override
Definition: xstorage.cxx:3919
virtual css::uno::Reference< css::io::XInputStream > SAL_CALL getPlainRawStreamElement(const OUString &sStreamName) override
Definition: xstorage.cxx:3253
virtual void SAL_CALL setGpgProperties(const css::uno::Sequence< css::uno::Sequence< css::beans::NamedValue > > &aCryptProps) override
Definition: xstorage.cxx:4172
virtual css::uno::Any SAL_CALL getElementPropertyValue(const OUString &sElementName, const OUString &sPropertyName) override
Definition: xstorage.cxx:5183
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: xstorage.cxx:3964
virtual sal_Bool SAL_CALL hasByID(const OUString &sID) override
Definition: xstorage.cxx:4564
::std::vector< css::uno::WeakReference< css::lang::XComponent > > m_aOpenSubComponentsVector
Definition: xstorage.hxx:287
bool m_bReadOnlyWrap
Definition: xstorage.hxx:285
virtual css::uno::Reference< css::embed::XExtendedStorageStream > SAL_CALL openStreamElementByHierarchicalName(const OUString &sStreamPath, ::sal_Int32 nOpenMode) override
Definition: xstorage.cxx:5340
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: xstorage.cxx:2012
virtual css::uno::Reference< css::io::XStream > SAL_CALL openStreamElement(const OUString &aStreamName, sal_Int32 nOpenMode) override
Definition: xstorage.cxx:2206
virtual void SAL_CALL copyElementTo(const OUString &aElementName, const css::uno::Reference< css::embed::XStorage > &xDest, const OUString &aNewName) override
Definition: xstorage.cxx:2920
virtual OUString SAL_CALL getTypeByID(const OUString &sID) override
Definition: xstorage.cxx:4621
virtual void SAL_CALL revert() override
Definition: xstorage.cxx:3576
virtual css::uno::Reference< css::io::XStream > SAL_CALL cloneEncryptedStream(const OUString &sStreamName, const css::uno::Sequence< css::beans::NamedValue > &aEncryptionData) override
Definition: xstorage.cxx:3183
virtual void SAL_CALL insertRawNonEncrStreamElementDirect(const OUString &sStreamName, const css::uno::Reference< css::io::XInputStream > &xInStream) override
Definition: xstorage.cxx:4890
virtual void SAL_CALL writeAndAttachToStream(const css::uno::Reference< css::io::XStream > &xStream) override
Definition: xstorage.cxx:5057
virtual OUString SAL_CALL getTargetByID(const OUString &sID) override
Definition: xstorage.cxx:4600
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: xstorage.cxx:4500
virtual sal_Bool SAL_CALL isStorageElement(const OUString &aElementName) override
Definition: xstorage.cxx:2687
rtl::Reference< comphelper::RefCountedMutex > m_xSharedMutex
Definition: xstorage.hxx:282
::rtl::Reference< OHierarchyHolder_Impl > m_rHierarchyHolder
Definition: xstorage.hxx:288
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: xstorage.cxx:3835
void InternalDispose(bool bNotifyImpl)
Definition: xstorage.cxx:1792
virtual sal_Bool SAL_CALL isModified() override
Definition: xstorage.cxx:3677
virtual void SAL_CALL setEncryptionAlgorithms(const css::uno::Sequence< css::beans::NamedValue > &aAlgorithms) override
Definition: xstorage.cxx:4112
virtual void SAL_CALL copyElementDirectlyTo(const OUString &sSourceName, const css::uno::Reference< css::embed::XOptimizedStorage > &xTargetStorage, const OUString &sTargetName) override
Definition: xstorage.cxx:4974
virtual void SAL_CALL setEncryptionPassword(const OUString &aPass) override
Definition: xstorage.cxx:3981
virtual void SAL_CALL copyToStorage(const css::uno::Reference< css::embed::XStorage > &xDest) override
Definition: xstorage.cxx:2154
virtual void SAL_CALL removeStreamElementByHierarchicalName(const OUString &sElementPath) override
Definition: xstorage.cxx:5403
virtual void SAL_CALL copyStreamElementData(const OUString &sStreamName, const css::uno::Reference< css::io::XStream > &xTargetStream) override
Definition: xstorage.cxx:5269
virtual void SAL_CALL removeRelationshipByID(const OUString &sID) override
Definition: xstorage.cxx:4784
sal_Int32 GetRefCount_Impl() const
Definition: xstorage.hxx:321
oslInterlockedCount m_refCount
Type
OStorage_Impl(css::uno::Reference< css::io::XStream > const &xStream, sal_Int32 nMode, const css::uno::Sequence< css::beans::PropertyValue > &xProperties, css::uno::Reference< css::uno::XComponentContext > const &xContext, sal_Int32 nStorageType)
bool m_bCommited
Definition: xstorage.hxx:121
css::uno::Reference< css::container::XNameContainer > m_xPackageFolder
Definition: xstorage.hxx:136
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)
void Commit()
Definition: xstorage.cxx:940
std::vector< StorageHolder_Impl > StorageHoldersType
Definition: xstorage.hxx:110
SotElement_Impl * InsertStorage(const OUString &aName, sal_Int32 nStorageMode)
Definition: xstorage.cxx:1362
bool m_bBroadcastModified
Definition: xstorage.hxx:119
sal_Int16 m_nRelInfoStatus
Definition: xstorage.hxx:167
void OpenSubStream(SotElement_Impl *pElement)
Definition: xstorage.cxx:1432
SotElement_Impl * InsertStream(const OUString &aName, bool bEncr)
Definition: xstorage.cxx:1276
css::uno::Reference< css::io::XInputStream > GetRelInfoStreamForName(std::u16string_view aName)
Definition: xstorage.cxx:1614
void CopyToStorage(const css::uno::Reference< css::embed::XStorage > &xDest, bool bDirect)
Definition: xstorage.cxx:605
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: xstorage.hxx:139
void CopyLastCommitTo(const css::uno::Reference< css::embed::XStorage > &xNewStor)
Definition: xstorage.cxx:909
std::unordered_map< OUString, std::vector< SotElement_Impl * > > m_aChildrenMap
Definition: xstorage.hxx:133
bool m_bMTFallbackUsed
Definition: xstorage.hxx:153
bool HasChildren()
Definition: xstorage.cxx:455
sal_Int32 m_nStorageMode
Definition: xstorage.hxx:117
void GetStorageProperties()
Definition: xstorage.cxx:463
SotElement_Impl * FindElement(const OUString &rName)
Definition: xstorage.cxx:1258
OUString m_aVersion
Definition: xstorage.hxx:156
OStorage_Impl * m_pParent
Definition: xstorage.hxx:149
bool HasModifiedListener() const
Definition: xstorage.hxx:128
std::vector< SotElement_Impl * > m_aDeletedVector
Definition: xstorage.hxx:134
SotElement_Impl * m_pRelStorElement
Definition: xstorage.hxx:163
bool m_bControlMediaType
Definition: xstorage.hxx:151
css::uno::Sequence< css::beans::PropertyValue > m_xProperties
Definition: xstorage.hxx:144
SotElement_Impl * InsertElement(const OUString &aName, bool bIsStorage)
Definition: xstorage.cxx:1373
bool m_bListCreated
Definition: xstorage.hxx:124
css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > GetAllRelationshipsIfAny()
Definition: xstorage.cxx:894
bool m_bIsModified
Definition: xstorage.hxx:118
void InsertIntoPackageFolder(const OUString &aName, const css::uno::Reference< css::container::XNameContainer > &xParentPackageFolder)
Definition: xstorage.cxx:928
rtl::Reference< comphelper::RefCountedMutex > m_xMutex
Definition: xstorage.hxx:112
std::unique_ptr< OStorage_Impl > CreateNewStorageImpl(sal_Int32 nStorageMode)
Definition: xstorage.cxx:1341
bool m_bControlVersion
Definition: xstorage.hxx:155
void OpenOwnPackage()
Definition: xstorage.cxx:368
void ReadContents()
Definition: xstorage.cxx:533
rtl::Reference< SwitchablePersistenceStream > m_pSwitchStream
Definition: xstorage.hxx:158
css::uno::Reference< css::embed::XStorage > m_xRelStorage
Definition: xstorage.hxx:164
void RemoveStreamRelInfo(std::u16string_view aOriginalName)
Definition: xstorage.cxx:1553
void CommitStreamRelInfo(std::u16string_view rName, SotElement_Impl const *pStreamElement)
Definition: xstorage.cxx:1592
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)
Definition: xstorage.cxx:73
void ReadRelInfoIfNecessary()
Definition: xstorage.cxx:489
void OpenSubStorage(SotElement_Impl *pElement, sal_Int32 nStorageMode)
Definition: xstorage.cxx:1411
css::uno::Reference< css::lang::XSingleServiceFactory > m_xPackage
Definition: xstorage.hxx:138
css::uno::Sequence< css::uno::Sequence< css::beans::StringPair > > m_aRelInfo
Definition: xstorage.hxx:165
css::uno::Reference< css::io::XStream > m_xStream
Definition: xstorage.hxx:143
void CloneStreamElement(const OUString &aStreamName, bool bPassProvided, const ::comphelper::SequenceAsHashMap &aEncryptionData, css::uno::Reference< css::io::XStream > &xTargetStream)
Definition: xstorage.cxx:1518
::comphelper::SequenceAsHashMap m_aCommonEncryptionData
Definition: xstorage.hxx:146
StorageHoldersType m_aReadOnlyWrapVector
Definition: xstorage.hxx:115
static void ClearElement(SotElement_Impl *pElement)
Definition: xstorage.cxx:1512
OUString m_aMediaType
Definition: xstorage.hxx:152
void RemoveElement(OUString const &rName, SotElement_Impl *pElement)
Definition: xstorage.cxx:1481
sal_Int32 m_nStorageType
Definition: xstorage.hxx:160
::comphelper::SequenceAsHashMap GetCommonRootEncryptionData()
Definition: xstorage.cxx:1235
void SetReadOnlyWrap(OStorage &aStorage)
Definition: xstorage.cxx:339
bool m_bHasCommonEncryptionData
Definition: xstorage.hxx:145
oslInterlockedCount m_nModifiedListenerCount
Count of registered modification listeners.
Definition: xstorage.hxx:127
css::uno::Sequence< OUString > GetElementNames()
Definition: xstorage.cxx:1455
void CopyStorageElement(SotElement_Impl *pElement, const css::uno::Reference< css::embed::XStorage > &xDest, const OUString &aName, bool bDirect)
Definition: xstorage.cxx:691
css::uno::Reference< css::io::XInputStream > m_xInputStream
Definition: xstorage.hxx:142
void CommitRelInfo(const css::uno::Reference< css::container::XNameContainer > &xNewPackageFolder)
Definition: xstorage.cxx:1635
OStorage * m_pAntiImpl
Definition: xstorage.hxx:114
void CreateRelStorage()
Definition: xstorage.cxx:1567
css::uno::Reference< css::io::XInputStream > m_xNewRelInfoStream
Definition: xstorage.hxx:166
void RemoveReadOnlyWrap(const OStorage &aStorage)
Definition: xstorage.cxx:346
OStorage_Impl(OStorage_Impl *pParent, sal_Int32 nMode, css::uno::Reference< css::container::XNameContainer > const &xPackageFolder, css::uno::Reference< css::lang::XSingleServiceFactory > xPackage, css::uno::Reference< css::uno::XComponentContext > const &xContext, sal_Int32 nStorageType)
void InsertRawStream(const OUString &aName, const css::uno::Reference< css::io::XInputStream > &xInStream)
Definition: xstorage.cxx:1306
SotElement_Impl(OUString aName, bool bStor, bool bNew)
Definition: xstorage.cxx:129
bool m_bIsInserted
Definition: xstorage.hxx:85
std::unique_ptr< OWriteStream_Impl, o3tl::default_delete< OWriteStream_Impl > > m_xStream
Definition: xstorage.hxx:89
std::unique_ptr< OStorage_Impl > m_xStorage
Definition: xstorage.hxx:88
OUString m_aOriginalName
Definition: xstorage.hxx:83
OStorage * m_pPointer
Definition: xstorage.hxx:101
StorageHolder_Impl(OStorage *pStorage)
Definition: xstorage.hxx:531
css::uno::WeakReference< css::embed::XStorage > m_xWeakRef
Definition: xstorage.hxx:102
unsigned char sal_Bool
signed char sal_Int8