Kaydet (Commit) db0f8399 authored tarafından Luboš Luňák's avatar Luboš Luňák

order database properties so that opening it in writer works (bnc#740032)

http://lists.freedesktop.org/archives/libreoffice/2012-January/024380.html
üst 74a356c3
...@@ -1188,6 +1188,13 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC ...@@ -1188,6 +1188,13 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) ); OUString sRedlineProtectionKey( RTL_CONSTASCII_USTRINGPARAM( "RedlineProtectionKey" ) );
const PropertyValue* currentDatabaseDataSource = NULL;
const PropertyValue* currentDatabaseCommand = NULL;
const PropertyValue* currentDatabaseCommandType = NULL;
OUString currentDatabaseDataSourceKey( RTL_CONSTASCII_USTRINGPARAM( "CurrentDatabaseDataSource" ));
OUString currentDatabaseCommandKey( RTL_CONSTASCII_USTRINGPARAM( "CurrentDatabaseCommand" ));
OUString currentDatabaseCommandTypeKey( RTL_CONSTASCII_USTRINGPARAM( "CurrentDatabaseCommandType" ));
while( nCount-- ) while( nCount-- )
{ {
if( !bIsUserSetting ) if( !bIsUserSetting )
...@@ -1212,7 +1219,15 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC ...@@ -1212,7 +1219,15 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
} }
else else
{ {
xProps->setPropertyValue( pValues->Name, // HACK: Setting these out of order does not work.
if( pValues->Name.equals( currentDatabaseDataSourceKey ))
currentDatabaseDataSource = pValues;
else if( pValues->Name.equals( currentDatabaseCommandKey ))
currentDatabaseCommand = pValues;
else if( pValues->Name.equals( currentDatabaseCommandTypeKey ))
currentDatabaseCommandType = pValues;
else
xProps->setPropertyValue( pValues->Name,
pValues->Value ); pValues->Value );
} }
} }
...@@ -1267,6 +1282,19 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC ...@@ -1267,6 +1282,19 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
pValues++; pValues++;
} }
try
{
if( currentDatabaseDataSource != NULL )
xProps->setPropertyValue( currentDatabaseDataSource->Name, currentDatabaseDataSource->Value );
if( currentDatabaseCommand != NULL )
xProps->setPropertyValue( currentDatabaseCommand->Name, currentDatabaseCommand->Value );
if( currentDatabaseCommandType != NULL )
xProps->setPropertyValue( currentDatabaseCommandType->Name, currentDatabaseCommandType->Value );
} catch( Exception& )
{
OSL_FAIL( "SwXMLImport::SetConfigurationSettings: Exception!" );
}
// finally, treat the non-default cases // finally, treat the non-default cases
// introduce boolean, that indicates a document, written by version prior SO8. // introduce boolean, that indicates a document, written by version prior SO8.
const bool bDocumentPriorSO8 = !bConsiderWrapOnObjPos; const bool bDocumentPriorSO8 = !bConsiderWrapOnObjPos;
......
...@@ -474,6 +474,8 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf ...@@ -474,6 +474,8 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
case HANDLE_CURRENT_DATABASE_COMMAND: case HANDLE_CURRENT_DATABASE_COMMAND:
{ {
SwDBData aData = mpDoc->GetDBData(); SwDBData aData = mpDoc->GetDBData();
SAL_WARN_IF( aData.sDataSource.isEmpty(), "sw.uno",
"\"CurrentDatabaseCommand\" property possibly set before \"CurrentDatabaseDataSource\"" );
if ( rValue >>= aData.sCommand ) if ( rValue >>= aData.sCommand )
mpDoc->ChgDBData( aData ); mpDoc->ChgDBData( aData );
} }
...@@ -481,6 +483,10 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf ...@@ -481,6 +483,10 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
case HANDLE_CURRENT_DATABASE_COMMAND_TYPE: case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
{ {
SwDBData aData = mpDoc->GetDBData(); SwDBData aData = mpDoc->GetDBData();
SAL_WARN_IF( aData.sDataSource.isEmpty(), "sw.uno",
"\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseDataSource\"" );
SAL_WARN_IF( aData.sCommand.isEmpty(), "sw.uno",
"\"CurrentDatabaseCommandType\" property possibly set before \"CurrentDatabaseCommand\"" );
if ( rValue >>= aData.nCommandType ) if ( rValue >>= aData.nCommandType )
mpDoc->ChgDBData( aData ); mpDoc->ChgDBData( aData );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment