Uri aUri( rUri ); if ( aUri.isRoot() )
{ throw lang::IllegalArgumentException(
u"Root never has a storage!"_ustr,
uno::Reference< uno::XInterface >(),
sal_Int16( 1 ) );
}
StorageMap::iterator aIt ( m_aMap.begin() );
StorageMap::iterator aEnd( m_aMap.end() );
while ( aIt != aEnd )
{ if ( (*aIt).first.first == aUriKey )
{ // URI matches. Now, check open mode. bool bMatch = true; switch ( eMode )
{ case READ: // No need to check; storage is at least readable.
bMatch = true; break;
case READ_WRITE_NOCREATE: case READ_WRITE_CREATE: // If found storage is writable, it can be used. // If not, a new one must be created.
bMatch = (*aIt).first.second; break;
}
if ( bMatch ) break;
}
++aIt;
}
if ( aIt == aEnd )
{
uno::Reference< embed::XStorage > xParentStorage;
// documents never have a parent storage. if ( !aUri.isDocument() )
{
xParentStorage = queryParentStorage( aUriKey, eMode );
if ( !xParentStorage.is() )
{ // requested to create new storage, but failed?
OSL_ENSURE( eMode != READ_WRITE_CREATE, "Unable to create parent storage!" ); return xParentStorage;
}
}
if ( !xStorage.is() )
{ // requested to create new storage, but failed?
OSL_ENSURE( eMode != READ_WRITE_CREATE, "Unable to create storage!" ); return xStorage;
}
if ( !xStorage.is() )
{ // requested to create new storage, but failed?
OSL_ENSURE( eMode != READ_WRITE_CREATE, "Unable to create storage!" ); return xStorage;
}
// Each stream must have a parent storage. if ( !xParentStorage.is() )
{
OSL_FAIL( "StorageElementFactory::createOutputStream - " "Unable to create parent storage!" ); return uno::Reference< io::XOutputStream >();
}
if ( !xStream.is() )
{
OSL_FAIL( "StorageElementFactory::createOutputStream - " "Unable to create stream!" ); return uno::Reference< io::XOutputStream >();
}
// Note: We need a wrapper to hold a reference to the parent storage to // ensure that nobody else owns it at the moment we want to commit // our changes. (There can be only one writable instance at a time // and even no writable instance if there is already another // read-only instance!) return uno::Reference< io::XOutputStream >( new OutputStream( m_xContext, rUri, xParentStorage, xStream->getOutputStream() ) );
}
// Each stream must have a parent storage. if ( !xParentStorage.is() )
{
OSL_FAIL( "StorageElementFactory::createStream - " "Unable to create parent storage!" ); return uno::Reference< io::XStream >();
}
sal_Int32 nOpenMode = 0; if ( aPropValue >>= nOpenMode )
{ switch ( eMode )
{ case READ: if ( !( nOpenMode & embed::ElementModes::READ ) )
{ // document opened, but not readable. throw embed::InvalidStorageException(
u"Storage is open, but not readable!"_ustr );
} // storage okay break;
case READ_WRITE_NOCREATE: case READ_WRITE_CREATE: if ( !( nOpenMode & embed::ElementModes::WRITE ) )
{ // document opened, but not writable. throw embed::InvalidStorageException(
u"Storage is open, but not writable!"_ustr );
} // storage okay break;
}
} else
{
OSL_FAIL( "Bug! Value of property OpenMode has wrong type!" );
throw uno::RuntimeException(
u"Bug! Value of property OpenMode has wrong type!"_ustr );
}
} catch ( beans::UnknownPropertyException const & )
{
css::uno::Any anyEx = cppu::getCaughtException();
OSL_FAIL( "Property OpenMode not supported!" );
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.2Bemerkung:
(vorverarbeitet am 2026-10-02)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.