[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sw/source

Michael Stahl mst at kemper.freedesktop.org
Tue Jan 24 07:44:27 PST 2012


 sw/source/filter/xml/xmlimp.cxx          |   30 +++++++++++++++++++++++++++++-
 sw/source/ui/uno/SwXDocumentSettings.cxx |    6 ++++++
 2 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit 17ccd3cfc9dd86e2911a0a31f6dcbba8d7e7950a
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue Jan 24 16:05:37 2012 +0100

    order database properties so that opening it in writer works (bnc#740032)
    
    http://lists.freedesktop.org/archives/libreoffice/2012-January/024380.html
    (cherry picked from commit db0f839920c38973f8448df0f74de7c4c95c832c)
    
    Signed-off-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 36643e4..ca700d0 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1189,6 +1189,13 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
 
     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-- )
     {
         if( !bIsUserSetting )
@@ -1213,7 +1220,15 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
                     }
                     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 );
                     }
                 }
@@ -1268,6 +1283,19 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
         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
     // introduce boolean, that indicates a document, written by version prior SO8.
     const bool bDocumentPriorSO8 = !bConsiderWrapOnObjPos;
diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx
index a56f584..7b4b738 100644
--- a/sw/source/ui/uno/SwXDocumentSettings.cxx
+++ b/sw/source/ui/uno/SwXDocumentSettings.cxx
@@ -470,6 +470,8 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
         case HANDLE_CURRENT_DATABASE_COMMAND:
         {
             SwDBData aData = mpDoc->GetDBData();
+            SAL_WARN_IF( aData.sDataSource.isEmpty(), "sw.uno",
+                "\"CurrentDatabaseCommand\" property possibly set before \"CurrentDatabaseDataSource\"" );
             if ( rValue >>= aData.sCommand )
                 mpDoc->ChgDBData( aData );
         }
@@ -477,6 +479,10 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
         case HANDLE_CURRENT_DATABASE_COMMAND_TYPE:
         {
             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 )
                 mpDoc->ChgDBData( aData );
         }


More information about the Libreoffice-commits mailing list