using css::uno::Reference; using css::uno::UNO_QUERY; using css::uno::UNO_QUERY_THROW; using css::uno::UNO_SET_THROW; using css::uno::Exception; using css::uno::Sequence; using css::uno::XComponentContext; using css::embed::XStorage; using css::frame::XController; using css::sdb::application::XDatabaseDocumentUI; using css::lang::XComponent; using css::io::XStream; using css::io::TextInputStream; using css::io::XTextInputStream2; using css::util::XModifiable;
// create a sub storage for recovery data if ( i_rTargetStorage->hasByName( sRecoveryDataSubStorageName ) )
i_rTargetStorage->removeElement( sRecoveryDataSubStorageName );
Reference< XStorage > xRecoveryStorage = i_rTargetStorage->openStorageElement( sRecoveryDataSubStorageName, ElementModes::READWRITE );
// store recovery data for open sub components of the given controller(s) if ( !i_rControllers.empty() )
{
ENSURE_OR_THROW( i_rControllers.size() == 1, "can't handle more than one controller" ); // At the moment, there can be only one view to a database document. If we ever allow for more than this, // then we need a concept for sub documents opened from different controllers (i.e. two document views, // and the user opens the very same form in both views). And depending on this, we need a concept for // how those are saved to the recovery file.
// recover all sub components as indicated by the map for (autoconst& elemMapCompDescs : aMapCompDescs)
{ const SubComponentType eComponentType = elemMapCompDescs.first;
// the storage for all components of the current type
Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement(
SubComponentRecovery::getComponentsStorageName( eComponentType ), ElementModes::READ ), UNO_SET_THROW );
// loop through all components of this type for (autoconst& elem : elemMapCompDescs.second)
{ const OUString sComponentName(elem.second.sName); if ( !xComponentsStor->hasByName(elem.first) )
{
SAL_WARN( "dbaccess", "DatabaseDocumentRecovery::recoverSubDocuments: inconsistent recovery storage: storage '" <<
elem.first << "' not found in '" <<
SubComponentRecovery::getComponentsStorageName( eComponentType ) << "', but required per map file!" ); continue;
}
// the controller needs to have a connection to be able to open sub components if ( !xDocumentUI->isConnected() )
xDocumentUI->connect();
// at the moment, we only store, during session save, sub components which are modified. So, set this // recovered sub component to "modified", too.
lcl_markModified( xSubComponent );
}
xComponentsStor->dispose();
}
xRecoveryStorage->dispose();
// now that we successfully recovered, removed the "recovery" sub storage try
{
i_rDocumentStorage->removeElement( sRecoveryDataSubStorageName );
} catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION("dbaccess");
}
}
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.