summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-01-26 13:19:11 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-01-26 13:19:11 +0100
commit6adaf71970a32c81ed45755a513f3cda788f2427 (patch)
treef01cbef30b52372067076e1d2a08c0abba6735f8
parent2ed62793becce9a2830a6be70fc02be1296d4ee9 (diff)
autorecovery: mav sanctioned the approach of the (now so-called) RecoveryStorage
-rw-r--r--dbaccess/source/core/dataaccess/dbdocrecovery.cxx21
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx19
2 files changed, 30 insertions, 10 deletions
diff --git a/dbaccess/source/core/dataaccess/dbdocrecovery.cxx b/dbaccess/source/core/dataaccess/dbdocrecovery.cxx
index 9770808b98e5..b2e8f0433990 100644
--- a/dbaccess/source/core/dataaccess/dbdocrecovery.cxx
+++ b/dbaccess/source/core/dataaccess/dbdocrecovery.cxx
@@ -27,6 +27,7 @@
#include "dbdocrecovery.hxx"
#include "sdbcoretools.hxx"
+#include "dbastrings.hrc"
/** === begin UNO includes === **/
#include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
@@ -48,6 +49,7 @@
#include <tools/diagnose_ex.h>
#include <hash_map>
+#include <algorithm>
//........................................................................
namespace dbaccess
@@ -626,9 +628,17 @@ namespace dbaccess
++map
)
{
+ const SubComponentType eComponentType = map->first;
+ if ( ( eComponentType != FORM ) && ( eComponentType != REPORT ) )
+ {
+ // nobody saves tables/queries/relations at the moment, so encountering those is worth an assertion
+ OSL_ENSURE( false, "DatabaseDocumentRecovery::recoverSubDocuments: only embedded objects can be recovered currently!" );
+ continue;
+ }
+
// the storage for all components of the current type
Reference< XStorage > xComponentsStor( xRecoveryStorage->openStorageElement(
- lcl_getComponentsStorageName( map->first ), ElementModes::READ ), UNO_QUERY_THROW );
+ lcl_getComponentsStorageName( eComponentType ), ElementModes::READ ), UNO_QUERY_THROW );
// loop thru all components of this type
for ( MapStringToCompDesc::const_iterator stor = map->second.begin();
@@ -636,6 +646,7 @@ namespace dbaccess
++stor
)
{
+ const ::rtl::OUString sComponentName( stor->second.sName );
if ( !xComponentsStor->hasByName( stor->first ) )
{
#if OSL_DEBUG_LEVEL > 0
@@ -643,7 +654,7 @@ namespace dbaccess
message.append( "DatabaseDocumentRecovery::recoverSubDocuments: inconsistent recovery storage: storage '" );
message.append( ::rtl::OUStringToOString( stor->first, RTL_TEXTENCODING_ASCII_US ) );
message.append( "' not found in '" );
- message.append( ::rtl::OUStringToOString( lcl_getComponentsStorageName( map->first ), RTL_TEXTENCODING_ASCII_US ) );
+ message.append( ::rtl::OUStringToOString( lcl_getComponentsStorageName( eComponentType ), RTL_TEXTENCODING_ASCII_US ) );
message.append( "', but required per map file!" );
OSL_ENSURE( false, message.makeStringAndClear() );
#endif
@@ -656,12 +667,12 @@ namespace dbaccess
// recover the single component
Reference< XStorage > xCompStor( xComponentsStor->openStorageElement( stor->first, ElementModes::READ ) );
-
::comphelper::NamedValueCollection aLoadArgs;
- aLoadArgs.put( "RecoverFromStorage", xCompStor );
+ aLoadArgs.put( "RecoveryStorage", xCompStor );
+
try
{
- Reference< XComponent > xSubComponent = xDocumentUI->loadComponentWithArguments( map->first, stor->second.sName, stor->second.bForEditing,
+ Reference< XComponent > xSubComponent = xDocumentUI->loadComponentWithArguments( eComponentType, sComponentName, stor->second.bForEditing,
aLoadArgs.getPropertyValues() );
// at the moment, we only store, during session save, sub components which are modified. So, set this
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index a62a85501bb9..ec2e1d1e11f6 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -1605,15 +1605,24 @@ sal_Bool ODocumentDefinition::objectSupportsEmbeddedScripts() const
// -----------------------------------------------------------------------------
void ODocumentDefinition::separateOpenCommandArguments( const Sequence< PropertyValue >& i_rOpenCommandArguments,
- ::comphelper::NamedValueCollection& o_rDocumentLoadArgs, ::comphelper::NamedValueCollection& /*o_rEmbeddedObjectDescriptor*/ )
+ ::comphelper::NamedValueCollection& o_rDocumentLoadArgs, ::comphelper::NamedValueCollection& o_rEmbeddedObjectDescriptor )
{
::comphelper::NamedValueCollection aOpenCommandArguments( i_rOpenCommandArguments );
- o_rDocumentLoadArgs.merge( aOpenCommandArguments, false );
- // This method is to separate OpenCommandArguments into args which belong into the EmbeddedObjectDescriptor,
- // and args which belong into the document's media descriptor.
+ const sal_Char* pObjectDescriptorArgs[] =
+ {
+ "RecoveryStorage"
+ };
+ for ( size_t i=0; i < sizeof( pObjectDescriptorArgs ) / sizeof( pObjectDescriptorArgs[0] ); ++i )
+ {
+ if ( aOpenCommandArguments.has( pObjectDescriptorArgs[i] ) )
+ {
+ o_rEmbeddedObjectDescriptor.put( pObjectDescriptorArgs[i], aOpenCommandArguments.get( pObjectDescriptorArgs[i] ) );
+ aOpenCommandArguments.remove( pObjectDescriptorArgs[i] );
+ }
+ }
- // Well, there was some intermediate state where such args really existed - at the moment, they don't.
+ o_rDocumentLoadArgs.merge( aOpenCommandArguments, false );
}
// -----------------------------------------------------------------------------