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, uno::UNO_QUERY ),
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 }
209 
210 
211 // virtual
213  const uno::Reference< lang::XEventListener >& xListener )
214 {
215  m_xWrappedStorage->addEventListener( xListener );
216 }
217 
218 // virtual
220  const uno::Reference< lang::XEventListener >& aListener )
221 {
222  m_xWrappedStorage->removeEventListener( aListener );
223 }
224 
225 
226 // container::XElementAccess (base of container::XNameAccess)
227 
228 
229 // virtual
231 {
232  return m_xWrappedStorage->getElementType();
233 }
234 
235 
236 // virtual
238 {
239  return m_xWrappedStorage->hasElements();
240 }
241 
242 
243 // container::XNameAccess (base of embed::XStorage)
244 
245 
246 // virtual
247 uno::Any SAL_CALL Storage::getByName( const OUString& aName )
248 {
249  return m_xWrappedStorage->getByName( aName );
250 }
251 
252 
253 // virtual
254 uno::Sequence< OUString > SAL_CALL Storage::getElementNames()
255 {
256  return m_xWrappedStorage->getElementNames();
257 }
258 
259 
260 // virtual
261 sal_Bool SAL_CALL Storage::hasByName( const OUString& aName )
262 {
263  return m_xWrappedStorage->hasByName( aName );
264 }
265 
266 
267 // embed::XStorage
268 
269 
270 // virtual
272  const uno::Reference< embed::XStorage >& xDest )
273 {
274  m_xWrappedStorage->copyToStorage( xDest );
275 }
276 
277 
278 // virtual
279 uno::Reference< io::XStream > SAL_CALL Storage::openStreamElement(
280  const OUString& aStreamName, sal_Int32 nOpenMode )
281 {
282  return m_xWrappedStorage->openStreamElement( aStreamName, nOpenMode );
283 }
284 
285 
286 // virtual
287 uno::Reference< io::XStream > SAL_CALL Storage::openEncryptedStreamElement(
288  const OUString& aStreamName,
289  sal_Int32 nOpenMode,
290  const OUString& aPassword )
291 {
292  return m_xWrappedStorage->openEncryptedStreamElement(
293  aStreamName, nOpenMode, aPassword );
294 }
295 
296 
297 // virtual
298 uno::Reference< embed::XStorage > SAL_CALL Storage::openStorageElement(
299  const OUString& aStorName, sal_Int32 nOpenMode )
300 {
301  return m_xWrappedStorage->openStorageElement( aStorName, nOpenMode );
302 }
303 
304 
305 // virtual
306 uno::Reference< io::XStream > SAL_CALL Storage::cloneStreamElement(
307  const OUString& aStreamName )
308 {
309  return m_xWrappedStorage->cloneStreamElement( aStreamName );
310 }
311 
312 
313 // virtual
314 uno::Reference< io::XStream > SAL_CALL Storage::cloneEncryptedStreamElement(
315  const OUString& aStreamName,
316  const OUString& aPassword )
317 {
318  return m_xWrappedStorage->cloneEncryptedStreamElement( aStreamName,
319  aPassword );
320 }
321 
322 
323 // virtual
325  const uno::Reference< embed::XStorage >& xTargetStorage )
326 {
327  m_xWrappedStorage->copyLastCommitTo( xTargetStorage );
328 }
329 
330 
331 // virtual
333  const OUString& aStorName,
334  const uno::Reference< embed::XStorage >& xTargetStorage )
335 {
336  m_xWrappedStorage->copyStorageElementLastCommitTo( aStorName, xTargetStorage );
337 }
338 
339 
340 // virtual
342  const OUString& aElementName )
343 {
344  return m_xWrappedStorage->isStreamElement( aElementName );
345 }
346 
347 
348 // virtual
350  const OUString& aElementName )
351 {
352  return m_xWrappedStorage->isStorageElement( aElementName );
353 }
354 
355 
356 // virtual
357 void SAL_CALL Storage::removeElement( const OUString& aElementName )
358 {
359  m_xWrappedStorage->removeElement( aElementName );
360 }
361 
362 
363 // virtual
364 void SAL_CALL Storage::renameElement( const OUString& aEleName,
365  const OUString& aNewName )
366 {
367  m_xWrappedStorage->renameElement( aEleName, aNewName );
368 }
369 
370 
371 // virtual
373  const OUString& aElementName,
374  const uno::Reference< embed::XStorage >& xDest,
375  const OUString& aNewName )
376 {
377  m_xWrappedStorage->copyElementTo( aElementName, xDest, aNewName );
378 }
379 
380 
381 // virtual
383  const OUString& aElementName,
384  const uno::Reference< embed::XStorage >& xDest,
385  const OUString& rNewName )
386 {
387  m_xWrappedStorage->moveElementTo( aElementName, xDest, rNewName );
388 }
389 
390 
391 // embed::XTransactedObject
392 
393 
394 // virtual
395 void SAL_CALL Storage::commit()
396 {
397  // Never commit a root storage (-> has no parent)!
398  // Would lead in writing the whole document to disk.
399 
400  uno::Reference< embed::XStorage > xParentStorage = getParentStorage();
401  if ( xParentStorage.is() )
402  {
403  OSL_ENSURE( m_xWrappedTransObj.is(), "No XTransactedObject interface!" );
404 
405  if ( m_xWrappedTransObj.is() )
406  {
407  m_xWrappedTransObj->commit();
408 
409  if ( !isParentARootStorage() )
410  {
411  uno::Reference< embed::XTransactedObject > xParentTA(
412  xParentStorage, uno::UNO_QUERY );
413  OSL_ENSURE( xParentTA.is(), "No XTransactedObject interface!" );
414 
415  if ( xParentTA.is() )
416  xParentTA->commit();
417  }
418  }
419  }
420 }
421 
422 
423 // virtual
424 void SAL_CALL Storage::revert()
425 {
426  uno::Reference< embed::XStorage > xParentStorage = getParentStorage();
427  if ( xParentStorage.is() )
428  {
429  OSL_ENSURE( m_xWrappedTransObj.is(), "No XTransactedObject interface!" );
430 
431  if ( m_xWrappedTransObj.is() )
432  {
433  m_xWrappedTransObj->revert();
434 
435  if ( !isParentARootStorage() )
436  {
437  uno::Reference< embed::XTransactedObject > xParentTA(
438  xParentStorage, uno::UNO_QUERY );
439  OSL_ENSURE( xParentTA.is(), "No XTransactedObject interface!" );
440 
441  if ( xParentTA.is() )
442  xParentTA->revert();
443  }
444  }
445  }
446 }
447 
448 
449 // OutputStream Implementation.
450 
451 
453  const uno::Reference< uno::XComponentContext > & rxContext,
454  const OUString & rUri,
455  const uno::Reference< embed::XStorage > & xParentStorage,
456  const uno::Reference< io::XOutputStream > & xStreamToWrap )
457 : ParentStorageHolder( xParentStorage, Uri( rUri ).getParentUri() ),
458  m_xWrappedStream( xStreamToWrap ),
459  m_xWrappedComponent( xStreamToWrap, uno::UNO_QUERY ),
460  m_xWrappedTypeProv( xStreamToWrap, uno::UNO_QUERY )
461 {
462  OSL_ENSURE( m_xWrappedStream.is(),
463  "OutputStream::OutputStream: No stream to wrap!" );
464 
465  OSL_ENSURE( m_xWrappedComponent.is(),
466  "OutputStream::OutputStream: No component to wrap!" );
467 
468  OSL_ENSURE( m_xWrappedTypeProv.is(),
469  "OutputStream::OutputStream: No Type Provider!" );
470 
471  // Use proxy factory service to create aggregatable proxy.
472  try
473  {
474  uno::Reference< reflection::XProxyFactory > xProxyFac =
475  reflection::ProxyFactory::create( rxContext );
476  m_xAggProxy = xProxyFac->createProxy( m_xWrappedStream );
477  }
478  catch ( uno::Exception const & )
479  {
480  OSL_FAIL( "OutputStream::OutputStream: Caught exception!" );
481  }
482 
483  OSL_ENSURE( m_xAggProxy.is(),
484  "OutputStream::OutputStream: Wrapped stream cannot be aggregated!" );
485 
486  if ( m_xAggProxy.is() )
487  {
488  osl_atomic_increment( &m_refCount );
489  {
490  // Solaris compiler problem:
491  // Extra block to enforce destruction of temporary object created
492  // in next statement _before_ osl_atomic_decrement is
493  // called. Otherwise 'this' will destroy itself even before ctor
494  // is completed (See impl. of XInterface::release())!
495 
496  m_xAggProxy->setDelegator(
497  static_cast< cppu::OWeakObject * >( this ) );
498  }
499  osl_atomic_decrement( &m_refCount );
500  }
501 }
502 
503 
504 // virtual
506 {
507  if ( m_xAggProxy.is() )
508  m_xAggProxy->setDelegator( uno::Reference< uno::XInterface >() );
509 }
510 
511 
512 // uno::XInterface
513 
514 
515 // virtual
516 uno::Any SAL_CALL OutputStream::queryInterface( const uno::Type& aType )
517 {
518  uno::Any aRet = OutputStreamUNOBase::queryInterface( aType );
519 
520  if ( aRet.hasValue() )
521  return aRet;
522 
523  if ( m_xAggProxy.is() )
524  return m_xAggProxy->queryAggregation( aType );
525  else
526  return uno::Any();
527 }
528 
529 
530 // lang::XTypeProvider
531 
532 
533 // virtual
534 uno::Sequence< uno::Type > SAL_CALL OutputStream::getTypes()
535 {
536  return m_xWrappedTypeProv->getTypes();
537 }
538 
539 
540 // virtual
541 uno::Sequence< sal_Int8 > SAL_CALL OutputStream::getImplementationId()
542 {
543  return css::uno::Sequence<sal_Int8>();
544 }
545 
546 
547 // io::XOutputStream
548 
549 
550 // virtual
551 void SAL_CALL
552 OutputStream::writeBytes( const uno::Sequence< sal_Int8 >& aData )
553 {
554  m_xWrappedStream->writeBytes( aData );
555 }
556 
557 
558 // virtual
559 void SAL_CALL
561 {
562  m_xWrappedStream->flush();
563 }
564 
565 
566 // virtual
567 void SAL_CALL
569 {
570  m_xWrappedStream->closeOutput();
571 
572  // Release parent storage.
573  // Now, that the stream is closed/disposed it is not needed any longer.
574  setParentStorage( uno::Reference< embed::XStorage >() );
575 }
576 
577 
578 // lang::XComponent
579 
580 
581 // virtual
582 void SAL_CALL
584 {
585  m_xWrappedComponent->dispose();
586 
587  // Release parent storage.
588  // Now, that the stream is closed/disposed it is not needed any longer.
589  setParentStorage( uno::Reference< embed::XStorage >() );
590 }
591 
592 
593 // virtual
594 void SAL_CALL
596  const uno::Reference< lang::XEventListener >& xListener )
597 {
598  m_xWrappedComponent->addEventListener( xListener );
599 }
600 
601 
602 // virtual
603 void SAL_CALL
605  const uno::Reference< lang::XEventListener >& aListener )
606 {
607  m_xWrappedComponent->removeEventListener( aListener );
608 }
609 
610 
611 // Stream Implementation.
612 
613 
615  const uno::Reference< uno::XComponentContext > & rxContext,
616  const OUString & rUri,
617  const uno::Reference< embed::XStorage > & xParentStorage,
618  const uno::Reference< io::XStream > & xStreamToWrap )
619 : ParentStorageHolder( xParentStorage, Uri( rUri ).getParentUri() ),
620  m_xWrappedStream( xStreamToWrap ),
621  m_xWrappedOutputStream( xStreamToWrap->getOutputStream() ), // might be empty
622  m_xWrappedTruncate( m_xWrappedOutputStream, uno::UNO_QUERY ), // might be empty
623  m_xWrappedInputStream( xStreamToWrap->getInputStream(), uno::UNO_QUERY ),
624  m_xWrappedComponent( xStreamToWrap, uno::UNO_QUERY ),
625  m_xWrappedTypeProv( xStreamToWrap, uno::UNO_QUERY )
626 {
627  OSL_ENSURE( m_xWrappedStream.is(),
628  "OutputStream::OutputStream: No stream to wrap!" );
629 
630  OSL_ENSURE( m_xWrappedComponent.is(),
631  "OutputStream::OutputStream: No component to wrap!" );
632 
633  OSL_ENSURE( m_xWrappedTypeProv.is(),
634  "OutputStream::OutputStream: No Type Provider!" );
635 
636  // Use proxy factory service to create aggregatable proxy.
637  try
638  {
639  uno::Reference< reflection::XProxyFactory > xProxyFac =
640  reflection::ProxyFactory::create( rxContext );
641  m_xAggProxy = xProxyFac->createProxy( m_xWrappedStream );
642  }
643  catch ( uno::Exception const & )
644  {
645  OSL_FAIL( "OutputStream::OutputStream: Caught exception!" );
646  }
647 
648  OSL_ENSURE( m_xAggProxy.is(),
649  "OutputStream::OutputStream: Wrapped stream cannot be aggregated!" );
650 
651  if ( m_xAggProxy.is() )
652  {
653  osl_atomic_increment( &m_refCount );
654  {
655  // Solaris compiler problem:
656  // Extra block to enforce destruction of temporary object created
657  // in next statement _before_ osl_atomic_decrement is
658  // called. Otherwise 'this' will destroy itself even before ctor
659  // is completed (See impl. of XInterface::release())!
660 
661  m_xAggProxy->setDelegator(
662  static_cast< cppu::OWeakObject * >( this ) );
663  }
664  osl_atomic_decrement( &m_refCount );
665  }
666 }
667 
668 
669 // virtual
671 {
672  if ( m_xAggProxy.is() )
673  m_xAggProxy->setDelegator( uno::Reference< uno::XInterface >() );
674 }
675 
676 
677 // uno::XInterface
678 
679 
680 // virtual
681 uno::Any SAL_CALL Stream::queryInterface( const uno::Type& aType )
682 {
683  uno::Any aRet = StreamUNOBase::queryInterface( aType );
684 
685  if ( aRet.hasValue() )
686  return aRet;
687 
688  if ( m_xAggProxy.is() )
689  return m_xAggProxy->queryAggregation( aType );
690  else
691  return uno::Any();
692 }
693 
694 
695 // lang::XTypeProvider
696 
697 
698 // virtual
699 uno::Sequence< uno::Type > SAL_CALL Stream::getTypes()
700 {
701  return m_xWrappedTypeProv->getTypes();
702 }
703 
704 
705 // virtual
706 uno::Sequence< sal_Int8 > SAL_CALL Stream::getImplementationId()
707 {
708  return css::uno::Sequence<sal_Int8>();
709 }
710 
711 
712 // io::XStream.
713 
714 
715 // virtual
716 uno::Reference< io::XInputStream > SAL_CALL Stream::getInputStream()
717 {
718  return uno::Reference< io::XInputStream >( this );
719 }
720 
721 
722 // virtual
723 uno::Reference< io::XOutputStream > SAL_CALL Stream::getOutputStream()
724 {
725  return uno::Reference< io::XOutputStream >( this );
726 }
727 
728 
729 // io::XOutputStream.
730 
731 
732 // virtual
733 void SAL_CALL Stream::writeBytes( const uno::Sequence< sal_Int8 >& aData )
734 {
735  if ( m_xWrappedOutputStream.is() )
736  {
737  m_xWrappedOutputStream->writeBytes( aData );
738  commitChanges();
739  }
740 }
741 
742 
743 // virtual
744 void SAL_CALL Stream::flush()
745 {
746  if ( m_xWrappedOutputStream.is() )
747  {
748  m_xWrappedOutputStream->flush();
749  commitChanges();
750  }
751 }
752 
753 
754 // virtual
755 void SAL_CALL Stream::closeOutput()
756 {
757  if ( m_xWrappedOutputStream.is() )
758  {
759  m_xWrappedOutputStream->closeOutput();
760  commitChanges();
761  }
762 
763  // Release parent storage.
764  // Now, that the stream is closed/disposed it is not needed any longer.
765  setParentStorage( uno::Reference< embed::XStorage >() );
766 }
767 
768 
769 // io::XTruncate.
770 
771 
772 // virtual
773 void SAL_CALL Stream::truncate()
774 {
775  if ( m_xWrappedTruncate.is() )
776  {
777  m_xWrappedTruncate->truncate();
778  commitChanges();
779  }
780 }
781 
782 
783 // io::XInputStream.
784 
785 
786 // virtual
787 sal_Int32 SAL_CALL Stream::readBytes( uno::Sequence< sal_Int8 >& aData,
788  sal_Int32 nBytesToRead )
789 {
790  return m_xWrappedInputStream->readBytes( aData, nBytesToRead );
791 }
792 
793 
794 // virtual
795 sal_Int32 SAL_CALL Stream::readSomeBytes( uno::Sequence< sal_Int8 >& aData,
796  sal_Int32 nMaxBytesToRead )
797 {
798  return m_xWrappedInputStream->readSomeBytes( aData, nMaxBytesToRead );
799 }
800 
801 
802 // virtual
803 void SAL_CALL Stream::skipBytes( sal_Int32 nBytesToSkip )
804 {
805  m_xWrappedInputStream->skipBytes( nBytesToSkip );
806 }
807 
808 
809 // virtual
810 sal_Int32 SAL_CALL Stream::available()
811 {
812  return m_xWrappedInputStream->available();
813 }
814 
815 
816 // virtual
817 void SAL_CALL Stream::closeInput()
818 {
819  m_xWrappedInputStream->closeInput();
820 }
821 
822 
823 // lang::XComponent
824 
825 
826 // virtual
827 void SAL_CALL Stream::dispose()
828 {
829  m_xWrappedComponent->dispose();
830 
831  // Release parent storage.
832  // Now, that the stream is closed/disposed it is not needed any longer.
833  setParentStorage( uno::Reference< embed::XStorage >() );
834 }
835 
836 
837 // virtual
839  const uno::Reference< lang::XEventListener >& xListener )
840 {
841  m_xWrappedComponent->addEventListener( xListener );
842 }
843 
844 
845 // virtual
847  const uno::Reference< lang::XEventListener >& aListener )
848 {
849  m_xWrappedComponent->removeEventListener( aListener );
850 }
851 
852 
853 // Non-UNO
854 
855 
857 {
858  uno::Reference< embed::XTransactedObject >
859  xParentTA( getParentStorage(), uno::UNO_QUERY );
860  OSL_ENSURE( xParentTA.is(), "No XTransactedObject interface!" );
861 
862  if ( xParentTA.is() )
863  {
864  try
865  {
866  xParentTA->commit();
867  }
868  catch ( lang::WrappedTargetException const & )
869  {
870  throw io::IOException(); // @@@
871  }
872  }
873 }
874 
875 /* 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