LibreOffice Module ucb (master)  1
tdoc_stgelems.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 
21 /**************************************************************************
22  TODO
23  **************************************************************************
24 
25  - remove root storage access workaround
26 
27  *************************************************************************/
28 
29 #include <osl/diagnose.h>
30 #include <com/sun/star/io/IOException.hpp>
31 #include <com/sun/star/lang/DisposedException.hpp>
32 #include <com/sun/star/reflection/ProxyFactory.hpp>
33 
34 #include "tdoc_uri.hxx"
35 
36 #include "tdoc_stgelems.hxx"
37 
38 using namespace com::sun::star;
39 using namespace tdoc_ucp;
40 
41 
42 // ParentStorageHolder Implementation.
43 
44 
45 ParentStorageHolder::ParentStorageHolder(
46  const uno::Reference< embed::XStorage > & xParentStorage,
47  const OUString & rUri )
48 : m_xParentStorage( xParentStorage ),
49  m_bParentIsRootStorage( false )
50 {
51  Uri aUri( rUri );
52  if ( aUri.isDocument() )
54 }
55 
56 
57 // Storage Implementation.
58 
59 
60 Storage::Storage( const uno::Reference< uno::XComponentContext > & rxContext,
62  const OUString & rUri,
63  const uno::Reference< embed::XStorage > & xParentStorage,
64  const uno::Reference< embed::XStorage > & xStorageToWrap )
65 : ParentStorageHolder( xParentStorage, Uri( rUri ).getParentUri() ),
66  m_xFactory( xFactory ),
67  m_xWrappedStorage( xStorageToWrap ),
68  m_xWrappedTransObj( xStorageToWrap, uno::UNO_QUERY ), // optional interface
69  m_xWrappedComponent( xStorageToWrap ),
70  m_xWrappedTypeProv( xStorageToWrap, uno::UNO_QUERY ),
71  m_bIsDocumentStorage( Uri( rUri ).isDocument() )
72 {
73  OSL_ENSURE( m_xWrappedStorage.is(),
74  "Storage::Storage: No storage to wrap!" );
75 
76  OSL_ENSURE( m_xWrappedComponent.is(),
77  "Storage::Storage: No component to wrap!" );
78 
79  OSL_ENSURE( m_xWrappedTypeProv.is(),
80  "Storage::Storage: No Type Provider!" );
81 
82  // Use proxy factory service to create aggregatable proxy.
83  try
84  {
85  uno::Reference< reflection::XProxyFactory > xProxyFac =
86  reflection::ProxyFactory::create( rxContext );
87  m_xAggProxy = xProxyFac->createProxy( m_xWrappedStorage );
88  }
89  catch ( uno::Exception const & )
90  {
91  OSL_FAIL( "Storage::Storage: Caught exception!" );
92  }
93 
94  OSL_ENSURE( m_xAggProxy.is(),
95  "Storage::Storage: Wrapped storage cannot be aggregated!" );
96 
97  if ( m_xAggProxy.is() )
98  {
99  osl_atomic_increment( &m_refCount );
100  {
101  // Solaris compiler problem:
102  // Extra block to enforce destruction of temporary object created
103  // in next statement _before_ osl_atomic_decrement is
104  // called. Otherwise 'this' will destroy itself even before ctor
105  // is completed (See impl. of XInterface::release())!
106 
107  m_xAggProxy->setDelegator(
108  static_cast< cppu::OWeakObject * >( this ) );
109  }
110  osl_atomic_decrement( &m_refCount );
111  }
112 }
113 
114 
115 // virtual
117 {
118  if ( m_xAggProxy.is() )
119  m_xAggProxy->setDelegator( uno::Reference< uno::XInterface >() );
120 
121  // Never dispose a document storage. Not owner!
122  if ( !m_bIsDocumentStorage )
123  {
124  if ( m_xWrappedComponent.is() )
125  {
126  // "Auto-dispose"...
127  try
128  {
129  m_xWrappedComponent->dispose();
130  }
131  catch ( lang::DisposedException const & )
132  {
133  // might happen.
134  }
135  catch ( ... )
136  {
137  OSL_FAIL( "Storage::~Storage - Caught exception!" );
138  }
139  }
140  }
141 }
142 
143 
144 // uno::XInterface
145 
146 
147 // virtual
149 {
150  // First, try to use interfaces implemented by myself and base class(es)
151  uno::Any aRet = StorageUNOBase::queryInterface( aType );
152 
153  if ( aRet.hasValue() )
154  return aRet;
155 
156  // Try to use requested interface from aggregated storage
157  return m_xAggProxy->queryAggregation( aType );
158 }
159 
160 
161 // virtual
162 void SAL_CALL Storage::acquire()
163  throw ()
164 {
165  osl_atomic_increment( &m_refCount );
166 }
167 
168 
169 // virtual
170 void SAL_CALL Storage::release()
171  throw ()
172 {
173  //#i120738, Storage::release overrides OWeakObject::release(),
174  //need call OWeakObject::release() to release OWeakObject::m_pWeakConnectionPoint
175 
176  if ( m_refCount == 1 )
177  m_xFactory->releaseElement( this );
178 
179  //delete this;
180  OWeakObject::release();
181 }
182 
183 
184 // lang::XTypeProvider
185 
186 
187 // virtual
188 uno::Sequence< uno::Type > SAL_CALL Storage::getTypes()
189 {
190  return m_xWrappedTypeProv->getTypes();
191 }
192 
193 
194 // virtual
195 uno::Sequence< sal_Int8 > SAL_CALL Storage::getImplementationId()
196 {
197  return css::uno::Sequence<sal_Int8>();
198 }
199 
200 
201 // lang::XComponent (base of embed::XStorage)
202 
203 
204 // virtual
205 void SAL_CALL Storage::dispose()
206 {
207  m_xWrappedStorage->dispose();
208  m_xWrappedStorage.clear();
209 }
210 
211 
212 // virtual
214  const uno::Reference< lang::XEventListener >& xListener )
215 {
216  m_xWrappedStorage->addEventListener( xListener );
217 }
218 
219 // virtual
221  const uno::Reference< lang::XEventListener >& aListener )
222 {
223  m_xWrappedStorage->removeEventListener( aListener );
224 }
225 
226 
227 // container::XElementAccess (base of container::XNameAccess)
228 
229 
230 // virtual
232 {
233  return m_xWrappedStorage->getElementType();
234 }
235 
236 
237 // virtual
239 {
240  return m_xWrappedStorage->hasElements();
241 }
242 
243 
244 // container::XNameAccess (base of embed::XStorage)
245 
246 
247 // virtual
248 uno::Any SAL_CALL Storage::getByName( const OUString& aName )
249 {
250  return m_xWrappedStorage->getByName( aName );
251 }
252 
253 
254 // virtual
255 uno::Sequence< OUString > SAL_CALL Storage::getElementNames()
256 {
257  return m_xWrappedStorage->getElementNames();
258 }
259 
260 
261 // virtual
262 sal_Bool SAL_CALL Storage::hasByName( const OUString& aName )
263 {
264  return m_xWrappedStorage->hasByName( aName );
265 }
266 
267 
268 // embed::XStorage
269 
270 
271 // virtual
273  const uno::Reference< embed::XStorage >& xDest )
274 {
275  m_xWrappedStorage->copyToStorage( xDest );
276 }
277 
278 
279 // virtual
280 uno::Reference< io::XStream > SAL_CALL Storage::openStreamElement(
281  const OUString& aStreamName, sal_Int32 nOpenMode )
282 {
283  return m_xWrappedStorage->openStreamElement( aStreamName, nOpenMode );
284 }
285 
286 
287 // virtual
288 uno::Reference< io::XStream > SAL_CALL Storage::openEncryptedStreamElement(
289  const OUString& aStreamName,
290  sal_Int32 nOpenMode,
291  const OUString& aPassword )
292 {
293  return m_xWrappedStorage->openEncryptedStreamElement(
294  aStreamName, nOpenMode, aPassword );
295 }
296 
297 
298 // virtual
299 uno::Reference< embed::XStorage > SAL_CALL Storage::openStorageElement(
300  const OUString& aStorName, sal_Int32 nOpenMode )
301 {
302  return m_xWrappedStorage->openStorageElement( aStorName, nOpenMode );
303 }
304 
305 
306 // virtual
307 uno::Reference< io::XStream > SAL_CALL Storage::cloneStreamElement(
308  const OUString& aStreamName )
309 {
310  return m_xWrappedStorage->cloneStreamElement( aStreamName );
311 }
312 
313 
314 // virtual
315 uno::Reference< io::XStream > SAL_CALL Storage::cloneEncryptedStreamElement(
316  const OUString& aStreamName,
317  const OUString& aPassword )
318 {
319  return m_xWrappedStorage->cloneEncryptedStreamElement( aStreamName,
320  aPassword );
321 }
322 
323 
324 // virtual
326  const uno::Reference< embed::XStorage >& xTargetStorage )
327 {
328  m_xWrappedStorage->copyLastCommitTo( xTargetStorage );
329 }
330 
331 
332 // virtual
334  const OUString& aStorName,
335  const uno::Reference< embed::XStorage >& xTargetStorage )
336 {
337  m_xWrappedStorage->copyStorageElementLastCommitTo( aStorName, xTargetStorage );
338 }
339 
340 
341 // virtual
343  const OUString& aElementName )
344 {
345  return m_xWrappedStorage->isStreamElement( aElementName );
346 }
347 
348 
349 // virtual
351  const OUString& aElementName )
352 {
353  return m_xWrappedStorage->isStorageElement( aElementName );
354 }
355 
356 
357 // virtual
358 void SAL_CALL Storage::removeElement( const OUString& aElementName )
359 {
360  m_xWrappedStorage->removeElement( aElementName );
361 }
362 
363 
364 // virtual
365 void SAL_CALL Storage::renameElement( const OUString& aEleName,
366  const OUString& aNewName )
367 {
368  m_xWrappedStorage->renameElement( aEleName, aNewName );
369 }
370 
371 
372 // virtual
374  const OUString& aElementName,
375  const uno::Reference< embed::XStorage >& xDest,
376  const OUString& aNewName )
377 {
378  m_xWrappedStorage->copyElementTo( aElementName, xDest, aNewName );
379 }
380 
381 
382 // virtual
384  const OUString& aElementName,
385  const uno::Reference< embed::XStorage >& xDest,
386  const OUString& rNewName )
387 {
388  m_xWrappedStorage->moveElementTo( aElementName, xDest, rNewName );
389 }
390 
391 
392 // embed::XTransactedObject
393 
394 
395 // virtual
396 void SAL_CALL Storage::commit()
397 {
398  // Never commit a root storage (-> has no parent)!
399  // Would lead in writing the whole document to disk.
400 
401  uno::Reference< embed::XStorage > xParentStorage = getParentStorage();
402  if ( xParentStorage.is() )
403  {
404  OSL_ENSURE( m_xWrappedTransObj.is(), "No XTransactedObject interface!" );
405 
406  if ( m_xWrappedTransObj.is() )
407  {
408  m_xWrappedTransObj->commit();
409 
410  if ( !isParentARootStorage() )
411  {
412  uno::Reference< embed::XTransactedObject > xParentTA(
413  xParentStorage, uno::UNO_QUERY );
414  OSL_ENSURE( xParentTA.is(), "No XTransactedObject interface!" );
415 
416  if ( xParentTA.is() )
417  xParentTA->commit();
418  }
419  }
420  }
421 }
422 
423 
424 // virtual
425 void SAL_CALL Storage::revert()
426 {
427  uno::Reference< embed::XStorage > xParentStorage = getParentStorage();
428  if ( xParentStorage.is() )
429  {
430  OSL_ENSURE( m_xWrappedTransObj.is(), "No XTransactedObject interface!" );
431 
432  if ( m_xWrappedTransObj.is() )
433  {
434  m_xWrappedTransObj->revert();
435 
436  if ( !isParentARootStorage() )
437  {
438  uno::Reference< embed::XTransactedObject > xParentTA(
439  xParentStorage, uno::UNO_QUERY );
440  OSL_ENSURE( xParentTA.is(), "No XTransactedObject interface!" );
441 
442  if ( xParentTA.is() )
443  xParentTA->revert();
444  }
445  }
446  }
447 }
448 
449 
450 // OutputStream Implementation.
451 
452 
454  const uno::Reference< uno::XComponentContext > & rxContext,
455  const OUString & rUri,
456  const uno::Reference< embed::XStorage > & xParentStorage,
457  const uno::Reference< io::XOutputStream > & xStreamToWrap )
458 : ParentStorageHolder( xParentStorage, Uri( rUri ).getParentUri() ),
459  m_xWrappedStream( xStreamToWrap ),
460  m_xWrappedComponent( xStreamToWrap, uno::UNO_QUERY ),
461  m_xWrappedTypeProv( xStreamToWrap, uno::UNO_QUERY )
462 {
463  OSL_ENSURE( m_xWrappedStream.is(),
464  "OutputStream::OutputStream: No stream to wrap!" );
465 
466  OSL_ENSURE( m_xWrappedComponent.is(),
467  "OutputStream::OutputStream: No component to wrap!" );
468 
469  OSL_ENSURE( m_xWrappedTypeProv.is(),
470  "OutputStream::OutputStream: No Type Provider!" );
471 
472  // Use proxy factory service to create aggregatable proxy.
473  try
474  {
475  uno::Reference< reflection::XProxyFactory > xProxyFac =
476  reflection::ProxyFactory::create( rxContext );
477  m_xAggProxy = xProxyFac->createProxy( m_xWrappedStream );
478  }
479  catch ( uno::Exception const & )
480  {
481  OSL_FAIL( "OutputStream::OutputStream: Caught exception!" );
482  }
483 
484  OSL_ENSURE( m_xAggProxy.is(),
485  "OutputStream::OutputStream: Wrapped stream cannot be aggregated!" );
486 
487  if ( m_xAggProxy.is() )
488  {
489  osl_atomic_increment( &m_refCount );
490  {
491  // Solaris compiler problem:
492  // Extra block to enforce destruction of temporary object created
493  // in next statement _before_ osl_atomic_decrement is
494  // called. Otherwise 'this' will destroy itself even before ctor
495  // is completed (See impl. of XInterface::release())!
496 
497  m_xAggProxy->setDelegator(
498  static_cast< cppu::OWeakObject * >( this ) );
499  }
500  osl_atomic_decrement( &m_refCount );
501  }
502 }
503 
504 
505 // virtual
507 {
508  if ( m_xAggProxy.is() )
509  m_xAggProxy->setDelegator( uno::Reference< uno::XInterface >() );
510 }
511 
512 
513 // uno::XInterface
514 
515 
516 // virtual
517 uno::Any SAL_CALL OutputStream::queryInterface( const uno::Type& aType )
518 {
519  uno::Any aRet = OutputStreamUNOBase::queryInterface( aType );
520 
521  if ( aRet.hasValue() )
522  return aRet;
523 
524  if ( m_xAggProxy.is() )
525  return m_xAggProxy->queryAggregation( aType );
526  else
527  return uno::Any();
528 }
529 
530 
531 // lang::XTypeProvider
532 
533 
534 // virtual
535 uno::Sequence< uno::Type > SAL_CALL OutputStream::getTypes()
536 {
537  return m_xWrappedTypeProv->getTypes();
538 }
539 
540 
541 // virtual
542 uno::Sequence< sal_Int8 > SAL_CALL OutputStream::getImplementationId()
543 {
544  return css::uno::Sequence<sal_Int8>();
545 }
546 
547 
548 // io::XOutputStream
549 
550 
551 // virtual
552 void SAL_CALL
553 OutputStream::writeBytes( const uno::Sequence< sal_Int8 >& aData )
554 {
555  m_xWrappedStream->writeBytes( aData );
556 }
557 
558 
559 // virtual
560 void SAL_CALL
562 {
563  m_xWrappedStream->flush();
564 }
565 
566 
567 // virtual
568 void SAL_CALL
570 {
571  m_xWrappedStream->closeOutput();
572 
573  // Release parent storage.
574  // Now, that the stream is closed/disposed it is not needed any longer.
575  setParentStorage( uno::Reference< embed::XStorage >() );
576 }
577 
578 
579 // lang::XComponent
580 
581 
582 // virtual
583 void SAL_CALL
585 {
586  m_xWrappedComponent->dispose();
587 
588  // Release parent storage.
589  // Now, that the stream is closed/disposed it is not needed any longer.
590  setParentStorage( uno::Reference< embed::XStorage >() );
591 }
592 
593 
594 // virtual
595 void SAL_CALL
597  const uno::Reference< lang::XEventListener >& xListener )
598 {
599  m_xWrappedComponent->addEventListener( xListener );
600 }
601 
602 
603 // virtual
604 void SAL_CALL
606  const uno::Reference< lang::XEventListener >& aListener )
607 {
608  m_xWrappedComponent->removeEventListener( aListener );
609 }
610 
611 
612 // Stream Implementation.
613 
614 
616  const uno::Reference< uno::XComponentContext > & rxContext,
617  const OUString & rUri,
618  const uno::Reference< embed::XStorage > & xParentStorage,
619  const uno::Reference< io::XStream > & xStreamToWrap )
620 : ParentStorageHolder( xParentStorage, Uri( rUri ).getParentUri() ),
621  m_xWrappedStream( xStreamToWrap ),
622  m_xWrappedOutputStream( xStreamToWrap->getOutputStream() ), // might be empty
623  m_xWrappedTruncate( m_xWrappedOutputStream, uno::UNO_QUERY ), // might be empty
624  m_xWrappedInputStream( xStreamToWrap->getInputStream() ),
625  m_xWrappedComponent( xStreamToWrap, uno::UNO_QUERY ),
626  m_xWrappedTypeProv( xStreamToWrap, uno::UNO_QUERY )
627 {
628  OSL_ENSURE( m_xWrappedStream.is(),
629  "OutputStream::OutputStream: No stream to wrap!" );
630 
631  OSL_ENSURE( m_xWrappedComponent.is(),
632  "OutputStream::OutputStream: No component to wrap!" );
633 
634  OSL_ENSURE( m_xWrappedTypeProv.is(),
635  "OutputStream::OutputStream: No Type Provider!" );
636 
637  // Use proxy factory service to create aggregatable proxy.
638  try
639  {
640  uno::Reference< reflection::XProxyFactory > xProxyFac =
641  reflection::ProxyFactory::create( rxContext );
642  m_xAggProxy = xProxyFac->createProxy( m_xWrappedStream );
643  }
644  catch ( uno::Exception const & )
645  {
646  OSL_FAIL( "OutputStream::OutputStream: Caught exception!" );
647  }
648 
649  OSL_ENSURE( m_xAggProxy.is(),
650  "OutputStream::OutputStream: Wrapped stream cannot be aggregated!" );
651 
652  if ( m_xAggProxy.is() )
653  {
654  osl_atomic_increment( &m_refCount );
655  {
656  // Solaris compiler problem:
657  // Extra block to enforce destruction of temporary object created
658  // in next statement _before_ osl_atomic_decrement is
659  // called. Otherwise 'this' will destroy itself even before ctor
660  // is completed (See impl. of XInterface::release())!
661 
662  m_xAggProxy->setDelegator(
663  static_cast< cppu::OWeakObject * >( this ) );
664  }
665  osl_atomic_decrement( &m_refCount );
666  }
667 }
668 
669 
670 // virtual
672 {
673  if ( m_xAggProxy.is() )
674  m_xAggProxy->setDelegator( uno::Reference< uno::XInterface >() );
675 }
676 
677 
678 // uno::XInterface
679 
680 
681 // virtual
682 uno::Any SAL_CALL Stream::queryInterface( const uno::Type& aType )
683 {
684  uno::Any aRet = StreamUNOBase::queryInterface( aType );
685 
686  if ( aRet.hasValue() )
687  return aRet;
688 
689  if ( m_xAggProxy.is() )
690  return m_xAggProxy->queryAggregation( aType );
691  else
692  return uno::Any();
693 }
694 
695 
696 // lang::XTypeProvider
697 
698 
699 // virtual
700 uno::Sequence< uno::Type > SAL_CALL Stream::getTypes()
701 {
702  return m_xWrappedTypeProv->getTypes();
703 }
704 
705 
706 // virtual
707 uno::Sequence< sal_Int8 > SAL_CALL Stream::getImplementationId()
708 {
709  return css::uno::Sequence<sal_Int8>();
710 }
711 
712 
713 // io::XStream.
714 
715 
716 // virtual
717 uno::Reference< io::XInputStream > SAL_CALL Stream::getInputStream()
718 {
719  return uno::Reference< io::XInputStream >( this );
720 }
721 
722 
723 // virtual
724 uno::Reference< io::XOutputStream > SAL_CALL Stream::getOutputStream()
725 {
726  return uno::Reference< io::XOutputStream >( this );
727 }
728 
729 
730 // io::XOutputStream.
731 
732 
733 // virtual
734 void SAL_CALL Stream::writeBytes( const uno::Sequence< sal_Int8 >& aData )
735 {
736  if ( m_xWrappedOutputStream.is() )
737  {
738  m_xWrappedOutputStream->writeBytes( aData );
739  commitChanges();
740  }
741 }
742 
743 
744 // virtual
745 void SAL_CALL Stream::flush()
746 {
747  if ( m_xWrappedOutputStream.is() )
748  {
749  m_xWrappedOutputStream->flush();
750  commitChanges();
751  }
752 }
753 
754 
755 // virtual
756 void SAL_CALL Stream::closeOutput()
757 {
758  if ( m_xWrappedOutputStream.is() )
759  {
760  m_xWrappedOutputStream->closeOutput();
761  commitChanges();
762  }
763 
764  // Release parent storage.
765  // Now, that the stream is closed/disposed it is not needed any longer.
766  setParentStorage( uno::Reference< embed::XStorage >() );
767 }
768 
769 
770 // io::XTruncate.
771 
772 
773 // virtual
774 void SAL_CALL Stream::truncate()
775 {
776  if ( m_xWrappedTruncate.is() )
777  {
778  m_xWrappedTruncate->truncate();
779  commitChanges();
780  }
781 }
782 
783 
784 // io::XInputStream.
785 
786 
787 // virtual
788 sal_Int32 SAL_CALL Stream::readBytes( uno::Sequence< sal_Int8 >& aData,
789  sal_Int32 nBytesToRead )
790 {
791  return m_xWrappedInputStream->readBytes( aData, nBytesToRead );
792 }
793 
794 
795 // virtual
796 sal_Int32 SAL_CALL Stream::readSomeBytes( uno::Sequence< sal_Int8 >& aData,
797  sal_Int32 nMaxBytesToRead )
798 {
799  return m_xWrappedInputStream->readSomeBytes( aData, nMaxBytesToRead );
800 }
801 
802 
803 // virtual
804 void SAL_CALL Stream::skipBytes( sal_Int32 nBytesToSkip )
805 {
806  m_xWrappedInputStream->skipBytes( nBytesToSkip );
807 }
808 
809 
810 // virtual
811 sal_Int32 SAL_CALL Stream::available()
812 {
813  return m_xWrappedInputStream->available();
814 }
815 
816 
817 // virtual
818 void SAL_CALL Stream::closeInput()
819 {
820  m_xWrappedInputStream->closeInput();
821 }
822 
823 
824 // lang::XComponent
825 
826 
827 // virtual
828 void SAL_CALL Stream::dispose()
829 {
830  m_xWrappedComponent->dispose();
831 
832  // Release parent storage.
833  // Now, that the stream is closed/disposed it is not needed any longer.
834  setParentStorage( uno::Reference< embed::XStorage >() );
835 }
836 
837 
838 // virtual
840  const uno::Reference< lang::XEventListener >& xListener )
841 {
842  m_xWrappedComponent->addEventListener( xListener );
843 }
844 
845 
846 // virtual
848  const uno::Reference< lang::XEventListener >& aListener )
849 {
850  m_xWrappedComponent->removeEventListener( aListener );
851 }
852 
853 
854 // Non-UNO
855 
856 
858 {
859  uno::Reference< embed::XTransactedObject >
860  xParentTA( getParentStorage(), uno::UNO_QUERY );
861  OSL_ENSURE( xParentTA.is(), "No XTransactedObject interface!" );
862 
863  if ( xParentTA.is() )
864  {
865  try
866  {
867  xParentTA->commit();
868  }
869  catch ( lang::WrappedTargetException const & )
870  {
871  throw io::IOException(); // @@@
872  }
873  }
874 }
875 
876 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual void SAL_CALL removeElement(const OUString &aElementName) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
virtual void SAL_CALL copyLastCommitTo(const css::uno::Reference< css::embed::XStorage > &xTargetStorage) override
bool hasValue()
virtual void SAL_CALL flush() override
virtual void SAL_CALL dispose() override
css::uno::Reference< css::io::XOutputStream > m_xWrappedStream
const css::uno::Reference< css::embed::XStorage > & getParentStorage() const
virtual void SAL_CALL dispose() override
virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) override
OutputStream(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &rUri, const css::uno::Reference< css::embed::XStorage > &xParentStorage, const css::uno::Reference< css::io::XOutputStream > &xStreamToWrap)
virtual void SAL_CALL flush() override
virtual void SAL_CALL release() override
css::uno::Reference< css::uno::XAggregation > m_xAggProxy
virtual sal_Int32 SAL_CALL available() override
bool isDocument() const
Definition: tdoc_uri.hxx:99
virtual void SAL_CALL moveElementTo(const OUString &aElementName, const css::uno::Reference< css::embed::XStorage > &xDest, const OUString &rNewName) override
virtual css::uno::Reference< css::io::XStream > SAL_CALL openEncryptedStreamElement(const OUString &aStreamName, sal_Int32 nOpenMode, const OUString &aPassword) override
css::uno::Reference< css::io::XStream > m_xWrappedStream
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::XInputStream > SAL_CALL getInputStream() override
css::uno::Reference< css::uno::XAggregation > m_xAggProxy
virtual css::uno::Reference< css::io::XStream > SAL_CALL cloneEncryptedStreamElement(const OUString &aStreamName, const OUString &aPassword) override
virtual void SAL_CALL writeBytes(const css::uno::Sequence< sal_Int8 > &aData) override
virtual ~Stream() override
virtual void SAL_CALL dispose() override
virtual void SAL_CALL closeOutput() override
rtl::Reference< StorageElementFactory > m_xFactory
bool getOutputStream(ProgramOptions const &options, OString const &extension, std::ostream **ppOutputStream, OString &targetSourceFileName, OString &tmpSourceFileName)
virtual css::uno::Type SAL_CALL getElementType() override
virtual void SAL_CALL copyStorageElementLastCommitTo(const OUString &aStorName, const css::uno::Reference< css::embed::XStorage > &xTargetStorage) override
virtual css::uno::Reference< css::embed::XStorage > SAL_CALL openStorageElement(const OUString &aStorName, sal_Int32 nOpenMode) override
virtual ~Storage() override
virtual css::uno::Reference< css::io::XStream > SAL_CALL openStreamElement(const OUString &aStreamName, sal_Int32 nOpenMode) override
virtual void SAL_CALL acquire() override
virtual sal_Bool SAL_CALL isStorageElement(const OUString &aElementName) override
virtual void SAL_CALL writeBytes(const css::uno::Sequence< sal_Int8 > &aData) override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual sal_Int32 SAL_CALL readSomeBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nMaxBytesToRead) override
virtual sal_Bool SAL_CALL isStreamElement(const OUString &aElementName) override
bool const m_bIsDocumentStorage
virtual sal_Int32 SAL_CALL readBytes(css::uno::Sequence< sal_Int8 > &aData, sal_Int32 nBytesToRead) override
unsigned char sal_Bool
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
css::uno::Reference< css::io::XOutputStream > m_xWrappedOutputStream
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual void SAL_CALL copyElementTo(const OUString &aElementName, const css::uno::Reference< css::embed::XStorage > &xDest, const OUString &aNewName) override
css::uno::Reference< css::lang::XTypeProvider > m_xWrappedTypeProv
virtual void SAL_CALL truncate() override
virtual void SAL_CALL commit() override
virtual void SAL_CALL revert() override
css::uno::Reference< css::embed::XTransactedObject > m_xWrappedTransObj
css::uno::Reference< css::lang::XComponent > m_xWrappedComponent
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
css::uno::Reference< css::lang::XComponent > m_xWrappedComponent
virtual void SAL_CALL closeOutput() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Stream(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &rUri, const css::uno::Reference< css::embed::XStorage > &xParentStorage, const css::uno::Reference< css::io::XStream > &xStreamToWrap)
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
virtual css::uno::Reference< css::io::XOutputStream > SAL_CALL getOutputStream() override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
virtual void SAL_CALL closeInput() override
css::uno::Reference< css::io::XInputStream > m_xWrappedInputStream
css::uno::Reference< css::lang::XTypeProvider > m_xWrappedTypeProv
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
void setParentStorage(const css::uno::Reference< css::embed::XStorage > &xStg)
virtual void SAL_CALL renameElement(const OUString &aEleName, const OUString &aNewName) override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual void SAL_CALL copyToStorage(const css::uno::Reference< css::embed::XStorage > &xDest) override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
css::uno::Reference< css::lang::XTypeProvider > m_xWrappedTypeProv
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
virtual ~OutputStream() override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Storage(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const rtl::Reference< StorageElementFactory > &xFactory, const OUString &rUri, const css::uno::Reference< css::embed::XStorage > &xParentStorage, const css::uno::Reference< css::embed::XStorage > &xStorageToWrap)
css::uno::Reference< css::io::XTruncate > m_xWrappedTruncate
css::uno::Reference< css::lang::XComponent > m_xWrappedComponent
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
css::uno::Reference< css::uno::XAggregation > m_xAggProxy
css::uno::Reference< css::embed::XStorage > m_xWrappedStorage