21#include <com/sun/star/embed/StorageFormats.hpp>
22#include <com/sun/star/io/IOException.hpp>
23#include <com/sun/star/lang/DisposedException.hpp>
26#include <osl/diagnose.h>
35 uno::Reference < io::XInputStream > xStream,
36 const uno::Sequence< beans::PropertyValue >& aProps,
37 sal_Int32 nStorageType )
41, m_aProperties( aProps )
43, m_nStorageType( nStorageType )
45 OSL_ENSURE(
m_pImpl->m_xMutex.is(),
"No mutex is provided!" );
47 throw uno::RuntimeException();
53 const uno::Sequence< beans::PropertyValue >& aProps,
54 sal_Int32 nStorageType )
58, m_aProperties( aProps )
60, m_nStorageType( nStorageType )
67 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
79 uno::Any aReturn = ::cppu::queryInterface
81 ,
static_cast<io::XInputStream*
> (
this )
82 ,
static_cast<io::XStream*
> (
this )
83 ,
static_cast<lang::XComponent*
> (
this )
84 ,
static_cast<beans::XPropertySet*
> (
this )
85 ,
static_cast<embed::XExtendedStorageStream*
> (
this ) );
92 aReturn = ::cppu::queryInterface
94 ,
static_cast<embed::XRelationshipAccess*
> (
this ) );
100 return OWeakObject::queryInterface( rType );
105 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
108 SAL_INFO(
"package.xstor",
"Disposed!");
109 throw lang::DisposedException();
117 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
120 SAL_INFO(
"package.xstor",
"Disposed!");
121 throw lang::DisposedException();
130 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
133 SAL_INFO(
"package.xstor",
"Disposed!");
134 throw lang::DisposedException();
143 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
146 SAL_INFO(
"package.xstor",
"Disposed!");
147 throw lang::DisposedException();
161 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
164 SAL_INFO(
"package.xstor",
"Disposed!");
165 throw lang::DisposedException();
173 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
176 SAL_INFO(
"package.xstor",
"Disposed!");
177 throw lang::DisposedException();
180 return uno::Reference< io::XOutputStream >();
186 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
192 lang::EventObject aSource( getXWeak() );
201 catch( uno::Exception& )
210 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
216 lang::EventObject aSource( getXWeak() );
233 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
236 SAL_INFO(
"package.xstor",
"Disposed!");
237 throw lang::DisposedException();
248 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
251 SAL_INFO(
"package.xstor",
"Disposed!");
252 throw lang::DisposedException();
261 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
265 SAL_INFO(
"package.xstor",
"Disposed!");
266 throw lang::DisposedException();
270 throw uno::RuntimeException();
277 catch( container::NoSuchElementException& )
286const beans::StringPair* lcl_findPairByName(
const uno::Sequence<beans::StringPair>& rSeq,
const OUString& rName)
288 return std::find_if(rSeq.begin(), rSeq.end(),
289 [&rName](
const beans::StringPair& rPair) { return rPair.First == rName; });
296 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
300 SAL_INFO(
"package.xstor",
"Disposed!");
301 throw lang::DisposedException();
305 throw uno::RuntimeException();
308 auto pRel = lcl_findPairByName(
aSeq,
"Target");
309 if (pRel !=
aSeq.end())
317 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
321 SAL_INFO(
"package.xstor",
"Disposed!");
322 throw lang::DisposedException();
326 throw uno::RuntimeException();
329 auto pRel = lcl_findPairByName(
aSeq,
"Type");
330 if (pRel !=
aSeq.end())
338 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
342 SAL_INFO(
"package.xstor",
"Disposed!");
343 throw lang::DisposedException();
347 throw uno::RuntimeException();
351 const beans::StringPair aIDRel(
"Id", sID);
352 auto pRel = std::find_if(
aSeq.begin(),
aSeq.end(),
353 [&aIDRel](
const uno::Sequence<beans::StringPair>& rRel){
354 return std::find(rRel.begin(), rRel.end(), aIDRel) != rRel.end(); });
355 if (pRel !=
aSeq.end())
358 throw container::NoSuchElementException();
363 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
367 SAL_INFO(
"package.xstor",
"Disposed!");
368 throw lang::DisposedException();
372 throw uno::RuntimeException();
376 const beans::StringPair aTypeRel(
"Type",
sType);
377 std::vector< uno::Sequence<beans::StringPair> > aResult;
378 aResult.reserve(
aSeq.getLength());
380 std::copy_if(
aSeq.begin(),
aSeq.end(), std::back_inserter(aResult),
381 [&aTypeRel](
const uno::Sequence<beans::StringPair>& rRel) {
382 return std::find(rRel.begin(), rRel.end(), aTypeRel) != rRel.end(); });
389 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
393 SAL_INFO(
"package.xstor",
"Disposed!");
394 throw lang::DisposedException();
398 throw uno::RuntimeException();
402 [](
const beans::PropertyValue& rProp) {
return rProp.Name ==
"RelationsInfo"; });
405 uno::Sequence< uno::Sequence< beans::StringPair > > aResult;
406 if (pProp->Value >>= aResult)
410 throw io::IOException(
"relations info could not be read");
415 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
419 SAL_INFO(
"package.xstor",
"Disposed!");
420 throw lang::DisposedException();
424 throw uno::RuntimeException();
426 throw io::IOException();
431 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
435 SAL_INFO(
"package.xstor",
"Disposed!");
436 throw lang::DisposedException();
440 throw uno::RuntimeException();
442 throw io::IOException();
447 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
451 SAL_INFO(
"package.xstor",
"Disposed!");
452 throw lang::DisposedException();
456 throw uno::RuntimeException();
458 throw io::IOException();
463 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
467 SAL_INFO(
"package.xstor",
"Disposed!");
468 throw lang::DisposedException();
472 throw uno::RuntimeException();
474 throw io::IOException();
479 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
483 SAL_INFO(
"package.xstor",
"Disposed!");
484 throw lang::DisposedException();
488 return uno::Reference< beans::XPropertySetInfo >();
493 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
497 SAL_INFO(
"package.xstor",
"Disposed!");
498 throw lang::DisposedException();
503 [&aPropertyName](
const beans::PropertyValue& rProp) {
return rProp.Name == aPropertyName; }))
504 throw beans::PropertyVetoException();
506 throw beans::UnknownPropertyException(aPropertyName);
511 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
515 SAL_INFO(
"package.xstor",
"Disposed!");
516 throw lang::DisposedException();
519 OUString aPropertyName;
520 if ( aProp ==
"IsEncrypted" )
521 aPropertyName =
"Encrypted";
523 aPropertyName = aProp;
525 if ( aPropertyName ==
"RelationsInfo" )
526 throw beans::UnknownPropertyException(aPropertyName);
530 [&aPropertyName](
const beans::PropertyValue& rProp) {
return rProp.Name == aPropertyName; });
534 throw beans::UnknownPropertyException(aPropertyName);
539 const uno::Reference< beans::XPropertyChangeListener >& )
541 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
545 SAL_INFO(
"package.xstor",
"Disposed!");
546 throw lang::DisposedException();
554 const uno::Reference< beans::XPropertyChangeListener >& )
556 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
560 SAL_INFO(
"package.xstor",
"Disposed!");
561 throw lang::DisposedException();
569 const uno::Reference< beans::XVetoableChangeListener >& )
571 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
575 SAL_INFO(
"package.xstor",
"Disposed!");
576 throw lang::DisposedException();
584 const uno::Reference< beans::XVetoableChangeListener >& )
586 ::osl::MutexGuard aGuard(
m_xMutex->GetMutex() );
590 SAL_INFO(
"package.xstor",
"Disposed!");
591 throw lang::DisposedException();
Sequence< sal_Int8 > aSeq
#define SAL_INFO(area, stream)
constexpr OUStringLiteral aData
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
void InputStreamDisposed(OInputCompStream *pStream)
Reference< XStream > m_xStream