[ooo-build-commit] Branch 'ooo/OOO320' - dbaccess/qa dbaccess/source reportdesign/source

Jan Holesovsky kendy at kemper.freedesktop.org
Tue Oct 13 17:12:04 PDT 2009


 dbaccess/qa/complex/dbaccess/DatabaseDocument.java         |   76 +++----
 dbaccess/source/core/dataaccess/ModelImpl.cxx              |   13 +
 dbaccess/source/core/dataaccess/databasedocument.cxx       |   33 ++-
 dbaccess/source/core/misc/dsntypes.cxx                     |   42 +---
 dbaccess/source/filter/xml/dbloader2.cxx                   |   18 +
 dbaccess/source/inc/dsntypes.hxx                           |    2 
 dbaccess/source/ui/dlg/advancedsettings.hrc                |    2 
 dbaccess/source/ui/dlg/generalpage.cxx                     |   14 -
 dbaccess/source/ui/relationdesign/RTableConnectionData.cxx |    4 
 dbaccess/source/ui/relationdesign/RelationController.cxx   |  135 +++----------
 reportdesign/source/core/api/ReportDefinition.cxx          |   17 +
 11 files changed, 177 insertions(+), 179 deletions(-)

New commits:
commit 5b3ce114ee22ddfa21afb943bfa16b912427d2c1
Author: Oliver Bolte <obo at openoffice.org>
Date:   Tue Oct 13 11:59:43 2009 +0000

    CWS-TOOLING: integrate CWS dba32h_OOO320
    2009-10-12 12:21:44 +0200 msc  r276827 : remove warning for issue 102712 because the issue is fixed
    2009-10-05 07:14:20 +0200 oj  r276658 : #105585# add missing dependency for OOO_UI
    2009-10-02 12:50:19 +0200 fs  r276632 : #i105505#
    If a model is created, and is a revenant of a previous incarnation, then ensure it is properly initialized.
    In particular, in its ctor, set the state to "Initializing", not "Initialized", and then let the ModelImpl
    call attachResource. This ensures that the model is initialized completely, including firing the necessary
    events.
    2009-10-02 12:46:12 +0200 fs  r276631 : #i105505# always do an attachResource at the newly loaded model, even if it (internally) was not really loaded, but only a revenant of a previous incarnation of this document
    2009-10-01 13:09:07 +0200 fs  r276596 : do not rely on the name 'Standard' for the one and only form in a document
    2009-10-01 12:35:56 +0200 fs  r276589 : #i105509# don't rely on default form component names, use indexes
    2009-10-01 11:19:18 +0200 fs  r276584 : copying the fix for #i105082# into this CWS
    2009-10-01 11:13:22 +0200 fs  r276583 : improved logs
    2009-10-01 11:10:44 +0200 fs  r276581 : #i105505#
    2009-10-01 08:07:57 +0200 fs  r276575 : manual merge of trunk, to allow cwslocalize to run
    2009-09-30 22:48:30 +0200 fs  r276574 : removed that strange ONLOAD definition
    2009-09-30 12:58:18 +0200 fs  r276553 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
    2009-09-30 12:56:45 +0200 fs  r276552 : copy fix for #i105387# into this CWS, as the issue prevents us from finalizing the CWS
    2009-09-30 11:47:45 +0200 fs  r276549 : #i105235#
    2009-09-29 12:27:40 +0200 fs  r276521 : #i105367#
    2009-09-28 12:08:17 +0200 oj  r276485 : #i105371# export version in manifest.xml as well
    2009-09-28 12:07:02 +0200 oj  r276484 : #i105371# export version in manifest.xml as well
    2009-09-28 09:48:01 +0200 oj  r276481 : #i105366# init drivers when not empty
    2009-09-25 14:31:27 +0200 fs  r276466 : CWS-TOOLING: rebase CWS dba32h to trunk at 276429 (milestone: DEV300:m60)
    2009-09-24 13:52:54 +0200 fs  r276422 : #i105234# do not zoom the control when they view information is still uninitialized (happens at least in Writer when opening a form document)
    2009-09-24 11:42:03 +0200 fs  r276413 : #i105234# proper zoom handling for the nav bar
    2009-09-24 11:41:40 +0200 fs  r276412 : #i105234# setZoom: care for precision errors caused by implicit conversion float->double
    2009-09-23 12:21:22 +0200 oj  r276377 : remove dos lineends
    2009-09-23 11:44:52 +0200 oj  r276376 : #i105216# load config on demand
    2009-09-23 11:44:19 +0200 oj  r276375 : #i105216# load config on demand
    2009-09-23 11:43:35 +0200 oj  r276374 : #i105216# load config on demand
    2009-09-21 09:13:03 +0200 oj  r276307 : #i105158# use Thread support
    2009-09-18 13:06:50 +0200 fs  r276277 : #i105147#
    2009-09-18 11:48:23 +0200 oj  r276271 : #i105158# new method for thread safety
    2009-09-18 10:42:56 +0200 fs  r276266 : CWS-TOOLING: rebase CWS dba32h to trunk at 276192 (milestone: DEV300:m59)
    2009-09-18 08:30:03 +0200 oj  r276263 : #i105016# load correct ldap so
    2009-09-17 13:42:31 +0200 oj  r276240 : change count of check boxes
    2009-09-17 13:32:59 +0200 oj  r276239 : revert false to true for currency
    2009-09-17 09:14:46 +0200 oj  r276220 : #i104901# add patch for every issue
    2009-09-17 09:10:29 +0200 oj  r276219 : #i104901# add patch for every issue
    2009-09-11 13:47:49 +0200 oj  r276060 : #i104901# fix for indentity
    2009-09-11 12:14:14 +0200 fs  r276056 : #i104594# allow to render controls without an SdrPageView
    2009-09-11 11:49:31 +0200 fs  r276055 : CWS-TOOLING: rebase CWS dba32h to trunk at 276043 (milestone: DEV300:m58)
    2009-09-10 08:41:40 +0200 oj  r276021 : #i104911# export variable-set not for repeating sections

diff --git a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
index c6d4666..9e5917a 100644
--- a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
+++ b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
@@ -87,7 +87,6 @@ import java.util.logging.Logger;
 public class DatabaseDocument extends TestCase implements com.sun.star.document.XDocumentEventListener
 {
 
-    private static final String ONLOAD = "OnLoad";
     private static final String _BLANK = "_blank";
     private XComponent m_callbackFactory = null;
     private final ArrayList m_documentEvents = new ArrayList();
@@ -537,7 +536,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
         final String macroURI = "vnd.sun.star.script:EventHandlers.all.OnLoad?language=Basic&location=document";
         final XEventsSupplier eventsSupplier = (XEventsSupplier) UnoRuntime.queryInterface(XEventsSupplier.class,
                 databaseDoc);
-        eventsSupplier.getEvents().replaceByName(ONLOAD, new PropertyValue[]
+        eventsSupplier.getEvents().replaceByName("OnLoad", new PropertyValue[]
                 {
                     new PropertyValue("EventType", 0, "Script", PropertyState.DIRECT_VALUE),
                     new PropertyValue("Script", 0, macroURI, PropertyState.DIRECT_VALUE)
@@ -567,13 +566,13 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
         // here) is called before the OnLoad notification is received - since the latter happens from within
         // a Basic macro which is bound to the OnLoad event of the document.
 
-        final String context = ONLOAD;
+        final String context = "OnLoad";
         impl_startObservingEvents(context);
         databaseDoc = (XModel) UnoRuntime.queryInterface(XModel.class,
                 loader.loadComponentFromURL(documentURL, _BLANK, 0, impl_getMacroExecLoadArgs()));
         impl_stopObservingEvents(m_documentEvents, new String[]
                 {
-                    ONLOAD
+                    "OnLoad"
                 }, context);
 
         assureEquals("our provided interaction handler was not called", STATE_ON_LOAD_RECEIVED, m_loadDocState);
@@ -659,7 +658,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
         impl_stopObservingEvents(m_globalEvents,
                 new String[]
                 {
-                    "OnLoadFinished", "OnViewCreated", "OnFocus", ONLOAD
+                    "OnLoadFinished", "OnViewCreated", "OnFocus", "OnLoad"
                 }, context);
 
         // closing a document by API
@@ -679,7 +678,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
         impl_startObservingEvents("prepare for '" + context + "'");
         databaseDoc = (XModel) UnoRuntime.queryInterface(XModel.class,
                 loader.loadComponentFromURL(newURL, _BLANK, 0, impl_getDefaultLoadArgs()));
-        impl_waitForEvent(m_globalEvents, ONLOAD, 5000);
+        impl_waitForEvent(m_globalEvents, "OnLoad", 5000);
         // wait for all events to arrive - OnLoad should be the last one
 
         final XDispatchProvider dispatchProvider = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class,
@@ -716,12 +715,12 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
         impl_startObservingEvents("prepare for '" + context + "'");
         databaseDoc = (XModel) UnoRuntime.queryInterface(XModel.class,
                 loader.loadComponentFromURL(newURL, _BLANK, 0, impl_getDefaultLoadArgs()));
-        final int previousOnLoadEventPos = impl_waitForEvent(m_globalEvents, ONLOAD, 5000);
+        final int previousOnLoadEventPos = impl_waitForEvent(m_globalEvents, "OnLoad", 5000);
         // ... and another document ...
         final String otherURL = copyToTempFile(databaseDoc.getURL());
         final XModel otherDoc = (XModel) UnoRuntime.queryInterface(XModel.class,
                 loader.loadComponentFromURL(otherURL, _BLANK, 0, impl_getDefaultLoadArgs()));
-        impl_waitForEvent(m_globalEvents, ONLOAD, 5000, previousOnLoadEventPos + 1);
+        impl_waitForEvent(m_globalEvents, "OnLoad", 5000, previousOnLoadEventPos + 1);
         impl_raise(otherDoc);
 
         // ... and switch between the two
@@ -764,7 +763,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
     // --------------------------------------------------------------------------------------------------------
     private void impl_startObservingEvents(String _context)
     {
-        log.println(" " + _context);
+        log.println(" " + _context + " {");
         synchronized (m_documentEvents)
         {
             m_documentEvents.clear();
@@ -778,40 +777,47 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
     // --------------------------------------------------------------------------------------------------------
     private void impl_stopObservingEvents(ArrayList _actualEvents, String[] _expectedEvents, String _context)
     {
-        synchronized (_actualEvents)
+        try
         {
-            int actualEventCount = _actualEvents.size();
-            while (actualEventCount < _expectedEvents.length)
+            synchronized (_actualEvents)
             {
-                // well, it's possible not all events already arrived, yet - finally, some of them
-                // are notified asynchronously
-                // So, wait a few seconds.
-                try
+                int actualEventCount = _actualEvents.size();
+                while (actualEventCount < _expectedEvents.length)
                 {
-                    _actualEvents.wait(5000);
-                }
-                catch (InterruptedException ex)
-                {
-                }
+                    // well, it's possible not all events already arrived, yet - finally, some of them
+                    // are notified asynchronously
+                    // So, wait a few seconds.
+                    try
+                    {
+                        _actualEvents.wait(5000);
+                    }
+                    catch (InterruptedException ex)
+                    {
+                    }
 
-                if (actualEventCount == _actualEvents.size())
-                // the above wait was left because of the timeout, *not* because an event
-                // arrived. Okay, we won't wait any longer, this is a failure.
-                {
-                    break;
+                    if (actualEventCount == _actualEvents.size())
+                    // the above wait was left because of the timeout, *not* because an event
+                    // arrived. Okay, we won't wait any longer, this is a failure.
+                    {
+                        break;
+                    }
+                    actualEventCount = _actualEvents.size();
                 }
-                actualEventCount = _actualEvents.size();
-            }
 
-            assureEquals("wrong event count for '" + _context + "'",
-                    _expectedEvents.length, _actualEvents.size());
+                assureEquals("wrong event count for '" + _context + "'",
+                        _expectedEvents.length, _actualEvents.size());
 
-            for (int i = 0; i < _expectedEvents.length; ++i)
-            {
-                assureEquals("wrong event at positon " + (i + 1) + " for '" + _context + "'",
-                        _expectedEvents[i], _actualEvents.get(i));
+                for (int i = 0; i < _expectedEvents.length; ++i)
+                {
+                    assureEquals("wrong event at positon " + (i + 1) + " for '" + _context + "'",
+                            _expectedEvents[i], _actualEvents.get(i));
+                }
             }
         }
+        finally
+        {
+            log.println(" }");
+        }
     }
 
     // --------------------------------------------------------------------------------------------------------
@@ -867,7 +873,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
             return;
         }
 
-        if ((_Event.EventName.equals(ONLOAD)) && (m_loadDocState != STATE_NOT_STARTED))
+        if ((_Event.EventName.equals("OnLoad")) && (m_loadDocState != STATE_NOT_STARTED))
         {
             assureEquals("OnLoad event must come *after* invocation of the interaction handler / user!",
                     m_loadDocState, STATE_MACRO_EXEC_APPROVED);
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index aa7323b..022cddf 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -1006,6 +1006,8 @@ Reference< XModel > ODatabaseModelImpl::createNewModel_deliverOwnership( bool _b
     OSL_PRECOND( !xModel.is(), "ODatabaseModelImpl::createNewModel_deliverOwnership: not to be called if there already is a model!" );
     if ( !xModel.is() )
     {
+        bool bHadModelBefore = m_bDocumentInitialized;
+
         xModel = ODatabaseDocument::createDatabaseDocument( this, ODatabaseDocument::FactoryAccess() );
         m_xModel = xModel;
 
@@ -1020,6 +1022,17 @@ Reference< XModel > ODatabaseModelImpl::createNewModel_deliverOwnership( bool _b
             DBG_UNHANDLED_EXCEPTION();
         }
 
+        if ( bHadModelBefore )
+        {
+            // do an attachResources
+            // In case the document is loaded regularly, this is not necessary, as our loader will do it.
+            // However, in case that the document is implicitly created by asking the data source for the document,
+            // then nobody would call the doc's attachResource. So, we do it here, to ensure it's in a proper
+            // state, fires all events, and so on.
+            // #i105505# / 2009-10-02 / frank.schoenheit at sun.com
+            xModel->attachResource( xModel->getURL(), m_aArgs );
+        }
+
         if ( _bInitialize )
         {
             try
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 3deda07..233558d 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -192,8 +192,17 @@ ODatabaseDocument::ODatabaseDocument(const ::rtl::Reference<ODatabaseModelImpl>&
     // #i94840#
     if ( m_pImpl->hadInitializedDocument() )
     {
-        impl_setInitialized();
-        m_bAllowDocumentScripting = ( m_pImpl->determineEmbeddedMacros() != ODatabaseModelImpl::eSubDocumentMacros );
+        // Note we set our init-state to "Initializing", not "Initialized". We're created from inside the ModelImpl,
+        // which is expected to call attachResource in case there was a previous incarnation of the document,
+        // so we can properly finish our initialization then.
+        impl_setInitializing();
+
+        if ( m_pImpl->getURL().getLength() )
+        {
+            // if the previous incarnation of the DatabaseDocument already had an URL, then creating this incarnation
+            // here is effectively loading the document.
+            m_aViewMonitor.onLoadedDocument();
+        }
     }
 }
 
@@ -558,6 +567,8 @@ sal_Bool SAL_CALL ODatabaseDocument::attachResource( const ::rtl::OUString& _rUR
         // should know this before anybody actually uses the object.
         m_bAllowDocumentScripting = ( m_pImpl->determineEmbeddedMacros() != ODatabaseModelImpl::eSubDocumentMacros );
 
+        aGuard.clear();
+        // <- SYNCHRONIZED
         m_aEventNotifier.notifyDocumentEvent( "OnLoadFinished" );
     }
 
@@ -1345,6 +1356,24 @@ void ODatabaseDocument::impl_writeStorage_throw( const Reference< XStorage >& _r
     if ( aSaveOpt.IsSaveRelFSys() )
         xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("BaseURI")), uno::makeAny(_rMediaDescriptor.getOrDefault("URL",::rtl::OUString())));
 
+    ::rtl::OUString aVersion;
+    SvtSaveOptions::ODFDefaultVersion nDefVersion = aSaveOpt.GetODFDefaultVersion();
+
+    // older versions can not have this property set, it exists only starting from ODF1.2
+    if ( nDefVersion >= SvtSaveOptions::ODFVER_012 )
+        aVersion = ODFVER_012_TEXT;
+
+    if ( aVersion.getLength() )
+    {
+        try
+        {
+            xInfoSet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Version" )), uno::makeAny( aVersion ) );
+        }
+        catch( uno::Exception& )
+        {
+        }
+    }
+
     sal_Int32 nArgsLen = aDelegatorArguments.getLength();
     aDelegatorArguments.realloc(nArgsLen+1);
     aDelegatorArguments[nArgsLen++] <<= xInfoSet;
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index ad7b614..f97527a 100644
--- a/dbaccess/source/core/misc/dsntypes.cxx
+++ b/dbaccess/source/core/misc/dsntypes.cxx
@@ -41,7 +41,7 @@
 #include "core_resource.hxx"
 #include "core_resource.hrc"
 #include <comphelper/documentconstants.hxx>
-#include <connectivity/DriversConfig.hxx>
+
 //.........................................................................
 namespace dbaccess
 {
@@ -70,20 +70,20 @@ namespace dbaccess
 DBG_NAME(ODsnTypeCollection)
 //-------------------------------------------------------------------------
 ODsnTypeCollection::ODsnTypeCollection(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xFactory)
-:m_xFactory(_xFactory)
+:m_aDriverConfig(_xFactory)
+,m_xFactory(_xFactory)
 #ifdef DBG_UTIL
 ,m_nLivingIterators(0)
 #endif
 {
     DBG_CTOR(ODsnTypeCollection,NULL);
-    ::connectivity::DriversConfig aDriverConfig(m_xFactory);
-    const uno::Sequence< ::rtl::OUString > aURLs = aDriverConfig.getURLs();
+    const uno::Sequence< ::rtl::OUString > aURLs = m_aDriverConfig.getURLs();
     const ::rtl::OUString* pIter = aURLs.getConstArray();
     const ::rtl::OUString* pEnd = pIter + aURLs.getLength();
     for(;pIter != pEnd;++pIter )
     {
         m_aDsnPrefixes.push_back(*pIter);
-        m_aDsnTypesDisplayNames.push_back(aDriverConfig.getDriverTypeDisplayName(*pIter));
+        m_aDsnTypesDisplayNames.push_back(m_aDriverConfig.getDriverTypeDisplayName(*pIter));
     }
 
     DBG_ASSERT(m_aDsnTypesDisplayNames.size() == m_aDsnPrefixes.size(),
@@ -99,8 +99,7 @@ ODsnTypeCollection::~ODsnTypeCollection()
 //-------------------------------------------------------------------------
 String ODsnTypeCollection::getTypeDisplayName(const ::rtl::OUString& _sURL) const
 {
-    ::connectivity::DriversConfig aDriverConfig(m_xFactory);
-    return aDriverConfig.getDriverTypeDisplayName(_sURL);
+    return m_aDriverConfig.getDriverTypeDisplayName(_sURL);
 }
 //-------------------------------------------------------------------------
 String ODsnTypeCollection::cutPrefix(const ::rtl::OUString& _sURL) const
@@ -180,21 +179,19 @@ bool ODsnTypeCollection::isConnectionUrlRequired(const ::rtl::OUString& _sURL) c
 // -----------------------------------------------------------------------------
 String ODsnTypeCollection::getMediaType(const ::rtl::OUString& _sURL) const
 {
-    ::connectivity::DriversConfig aDriverConfig(m_xFactory);
-    const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+    const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
     return aFeatures.getOrDefault("MediaType",::rtl::OUString());
 }
 // -----------------------------------------------------------------------------
 String ODsnTypeCollection::getDatasourcePrefixFromMediaType(const ::rtl::OUString& _sMediaType,const ::rtl::OUString& _sExtension)
 {
     String sURL;
-    ::connectivity::DriversConfig aDriverConfig(m_xFactory);
-    const uno::Sequence< ::rtl::OUString > aURLs = aDriverConfig.getURLs();
+    const uno::Sequence< ::rtl::OUString > aURLs = m_aDriverConfig.getURLs();
     const ::rtl::OUString* pIter = aURLs.getConstArray();
     const ::rtl::OUString* pEnd = pIter + aURLs.getLength();
     for(;pIter != pEnd;++pIter )
     {
-        const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(*pIter);
+        const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(*pIter);
         if ( aFeatures.getOrDefault("MediaType",::rtl::OUString()) == _sMediaType )
         {
             const ::rtl::OUString sFileExtension = aFeatures.getOrDefault("Extension",::rtl::OUString());
@@ -268,51 +265,44 @@ void ODsnTypeCollection::extractHostNamePort(const ::rtl::OUString& _rDsn,String
 // -----------------------------------------------------------------------------
 String ODsnTypeCollection::getJavaDriverClass(const ::rtl::OUString& _sURL) const
 {
-    ::connectivity::DriversConfig aDriverConfig(m_xFactory);
-    const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getProperties(_sURL);
+    const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getProperties(_sURL);
     return aFeatures.getOrDefault("JavaDriverClass",::rtl::OUString());
 }
 //-------------------------------------------------------------------------
 sal_Bool ODsnTypeCollection::isFileSystemBased(const ::rtl::OUString& _sURL) const
 {
-    ::connectivity::DriversConfig aDriverConfig(m_xFactory);
-    const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+    const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
     return aFeatures.getOrDefault("FileSystemBased",sal_False);
 }
 // -----------------------------------------------------------------------------
 sal_Bool ODsnTypeCollection::supportsTableCreation(const ::rtl::OUString& _sURL) const
 {
-    ::connectivity::DriversConfig aDriverConfig(m_xFactory);
-    const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+    const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
     return aFeatures.getOrDefault("SupportsTableCreation",sal_False);
 }
 // -----------------------------------------------------------------------------
 sal_Bool ODsnTypeCollection::supportsBrowsing(const ::rtl::OUString& _sURL) const
 {
-    ::connectivity::DriversConfig aDriverConfig(m_xFactory);
-    const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+    const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
     return aFeatures.getOrDefault("SupportsBrowsing",sal_False);
 }
 // -----------------------------------------------------------------------------
 bool ODsnTypeCollection::needsJVM(const String& _sURL) const
 {
-    ::connectivity::DriversConfig aDriverConfig(m_xFactory);
-    const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+    const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
     return aFeatures.getOrDefault("UseJava",sal_False);
 }
 // -----------------------------------------------------------------------------
 Sequence<PropertyValue> ODsnTypeCollection::getDefaultDBSettings( const ::rtl::OUString& _sURL ) const
 {
-    ::connectivity::DriversConfig aDriverConfig(m_xFactory);
-    const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(_sURL);
+    const ::comphelper::NamedValueCollection& aProperties = m_aDriverConfig.getProperties(_sURL);
     return aProperties.getPropertyValues();
 }
 
 // -----------------------------------------------------------------------------
 String ODsnTypeCollection::getTypeExtension(const ::rtl::OUString& _sURL) const
 {
-    ::connectivity::DriversConfig aDriverConfig(m_xFactory);
-    const ::comphelper::NamedValueCollection& aFeatures = aDriverConfig.getMetaData(_sURL);
+    const ::comphelper::NamedValueCollection& aFeatures = m_aDriverConfig.getMetaData(_sURL);
     return aFeatures.getOrDefault("Extension",::rtl::OUString());
 }
 //-------------------------------------------------------------------------
diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx
index ecee01a..4d3aa9c 100644
--- a/dbaccess/source/filter/xml/dbloader2.cxx
+++ b/dbaccess/source/filter/xml/dbloader2.cxx
@@ -519,15 +519,25 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const ::
         return;
     }
 
-    if ( !bCreateNew && !xModel->getURL().getLength() )
+    if ( !bCreateNew )
     {
+        // We need to XLoadable::load the document if it does not yet have an URL.
+        // If it already *does* have an URL, then it was either passed in the arguments, or a previous incarnation
+        // of that model existed before (which can happen if a model is closed, but an associated DataSource is kept
+        // alive 'til loading the document again).
+        bool bNeedLoad = ( xModel->getURL().getLength() == 0 );
         try
         {
             aMediaDesc.put( "FileName", _rURL );
-            Reference< XLoadable > xLoad( xModel, UNO_QUERY_THROW );
-
             Sequence< PropertyValue > aResource( aMediaDesc.getPropertyValues() );
-            xLoad->load( aResource );
+
+            if ( bNeedLoad )
+            {
+                Reference< XLoadable > xLoad( xModel, UNO_QUERY_THROW );
+                xLoad->load( aResource );
+            }
+
+            // always attach the resource, even if the document has not been freshly loaded
             xModel->attachResource( _rURL, aResource );
         }
         catch(const Exception&)
diff --git a/dbaccess/source/inc/dsntypes.hxx b/dbaccess/source/inc/dsntypes.hxx
index 423144e..8963b67 100644
--- a/dbaccess/source/inc/dsntypes.hxx
+++ b/dbaccess/source/inc/dsntypes.hxx
@@ -37,6 +37,7 @@
 #include <comphelper/stl_types.hxx>
 #include "dbadllapi.hxx"
 #include <tools/string.hxx>
+#include <connectivity/DriversConfig.hxx>
 
 //.........................................................................
 namespace dbaccess
@@ -121,6 +122,7 @@ protected:
 
     StringVector	m_aDsnTypesDisplayNames;	/// user readable names for the datasource types
     StringVector	m_aDsnPrefixes;				/// DSN prefixes which determine the type of a datasource
+    ::connectivity::DriversConfig m_aDriverConfig;
     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
 
 #ifdef DBG_UTIL
diff --git a/dbaccess/source/ui/dlg/advancedsettings.hrc b/dbaccess/source/ui/dlg/advancedsettings.hrc
index 221aed6..2ef8ad8 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.hrc
+++ b/dbaccess/source/ui/dlg/advancedsettings.hrc
@@ -31,7 +31,7 @@
 #ifndef DBAUI_ADVANCEDSETTINGS_HRC
 #define DBAUI_ADVANCEDSETTINGS_HRC
 
-#define ADVANCED_CHECKBOX_OPTIONS    13
+#define ADVANCED_CHECKBOX_OPTIONS    14
 #define ADVANCED_LISTBOX_OPTIONS      1
 
 #define ADVANCED_PAGE_X		200
diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx
index 99b0957..48bbf77 100644
--- a/dbaccess/source/ui/dlg/generalpage.cxx
+++ b/dbaccess/source/ui/dlg/generalpage.cxx
@@ -435,17 +435,19 @@ namespace dbaui
                 // page
                 _inout_rDisplayName = String();
                 break;
-            case ::dbaccess::DST_MYSQL_NATIVE_DIRECT:
-                // do not display the Connector/OOo driver itself, it is always wrapped via the MySQL-Driver, if
-                // this driver is installed
-                if ( m_pCollection->hasDriver( "sdbc:mysql:mysqlc:" ) )
-                    _inout_rDisplayName = String();
-                break;
             default:
                 break;
             }
         }
 
+        if ( eType == ::dbaccess::DST_MYSQL_NATIVE_DIRECT )
+        {
+            // do not display the Connector/OOo driver itself, it is always wrapped via the MySQL-Driver, if
+            // this driver is installed
+            if ( m_pCollection->hasDriver( "sdbc:mysql:mysqlc:" ) )
+                _inout_rDisplayName = String();
+        }
+
         if ( eType ==  ::dbaccess::DST_EMBEDDED_HSQLDB )
             _inout_rDisplayName = String();
 
diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
index 3b79e98..162d60a 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
@@ -364,7 +364,7 @@ BOOL ORelationTableConnectionData::Update()
 
     // get the name of foreign key // search for columns
     m_aConnName = ::rtl::OUString();
-    xKey = NULL;
+xKey.clear();
     bool bDropRelation = false;
     for(sal_Int32 i=0;i<xKeys->getCount();++i)
     {
@@ -422,7 +422,7 @@ BOOL ORelationTableConnectionData::Update()
                 }                
             }
         }
-        xKey = NULL;
+    xKey.clear();
     } // for(sal_Int32 i=0;i<xKeys->getCount();++i)
     if ( bDropRelation )
     {
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index b47782b..2c1b287 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -30,133 +30,50 @@
 
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_dbaccess.hxx"
-#ifndef _DBAU_REGHELPER_HXX_
 #include "dbu_reghelper.hxx"
-#endif
-#ifndef _SFXSIDS_HRC
 #include <sfx2/sfxsids.hrc>
-#endif
-#ifndef _DBU_REL_HRC_
 #include "dbu_rel.hrc"
-#endif
-#ifndef _SV_SVAPP_HXX 
 #include <vcl/svapp.hxx>
-#endif
-#ifndef DBACCESS_UI_BROWSER_ID_HXX
 #include "browserids.hxx"		   
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_ 
 #include <comphelper/types.hxx>
-#endif
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
 #include "dbustrings.hrc"
-#endif
-#ifndef _CONNECTIVITY_DBTOOLS_HXX_
 #include <connectivity/dbtools.hxx>
-#endif
-#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
 #include <com/sun/star/frame/FrameSearchFlag.hpp>
-#endif
-#ifndef _COMPHELPER_EXTRACT_HXX_
 #include <comphelper/extract.hxx>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ 
 #include <com/sun/star/container/XChild.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_ 
 #include <com/sun/star/container/XNameContainer.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_ 
 #include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_KEYTYPE_HPP_
 #include <com/sun/star/sdbcx/KeyType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XDROP_HPP_ 
 #include <com/sun/star/sdbcx/XDrop.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XALTERTABLE_HPP_
 #include <com/sun/star/sdbcx/XAlterTable.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XAPPEND_HPP_
 #include <com/sun/star/sdbcx/XAppend.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_
 #include <com/sun/star/sdbcx/XKeysSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
 #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_
 #include <com/sun/star/sdb/SQLContext.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_SQLWARNING_HPP_
 #include <com/sun/star/sdbc/SQLWarning.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
 #include <com/sun/star/sdbc/ColumnValue.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
 #include <com/sun/star/sdbc/XRow.hpp>
-#endif
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
 #include <connectivity/dbexception.hxx>
-#endif
-#ifndef _COM_SUN_STAR_UI_DIALOGS_XEXECUTABLEDIALOG_HPP_ 
+#include <connectivity/dbmetadata.hxx>
 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
-#endif
-#ifndef _COMPHELPER_STREAMSECTION_HXX_
 #include <comphelper/streamsection.hxx>
-#endif
-#ifndef _COMPHELPER_BASIC_IO_HXX_
 #include <comphelper/basicio.hxx>
-#endif
-#ifndef _COMPHELPER_SEQSTREAM_HXX
 #include <comphelper/seqstream.hxx>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HPP_
 #include <com/sun/star/io/XActiveDataSource.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_
 #include <com/sun/star/io/XActiveDataSink.hpp>
-#endif
-#ifndef _DBAUI_SQLMESSAGE_HXX_
 #include "sqlmessage.hxx"
-#endif
-#ifndef DBAUI_RELATIONCONTROLLER_HXX
 #include "RelationController.hxx"
-#endif
-#ifndef _SV_MSGBOX_HXX 
 #include <vcl/msgbox.hxx>
-#endif
 #include "TableWindowData.hxx"
-#ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
 #include "dbustrings.hrc"
-#endif
-#ifndef DBAUI_TOOLS_HXX
 #include "UITools.hxx"
-#endif
-#ifndef DBAUI_RTABLECONNECTIONDATA_HXX
 #include "RTableConnectionData.hxx"
-#endif
-#ifndef DBAUI_RELATION_TABLEVIEW_HXX
 #include "RelationTableView.hxx"
-#endif
-#ifndef DBAUI_RELATIONDESIGNVIEW_HXX
 #include "RelationDesignView.hxx"
-#endif
-#ifndef _TOOLS_DEBUG_HXX
 #include <tools/debug.hxx>
-#endif
-#ifndef TOOLS_DIAGNOSE_EX_H
 #include <tools/diagnose_ex.h>
-#endif
-#ifndef _SV_WAITOBJ_HXX
 #include <vcl/waitobj.hxx>
-#endif
 #include <osl/thread.hxx>
 #include <vos/mutex.hxx>
 
@@ -402,12 +319,12 @@ namespace
         {
         }
 
-    protected:
-        virtual ~RelationLoader(){}
-
         /// Working method which should be overridden.
         virtual void SAL_CALL run();
         virtual void SAL_CALL onTerminated();
+    protected:
+        virtual ~RelationLoader(){}	    
+        
         void loadTableData(const Any& _aTable);
     };
 
@@ -565,9 +482,12 @@ void ORelationController::mergeData(const TTableConnectionData& _aConnectionData
             m_vTableData.push_back((*aConnDataIter)->getReferencedTable());
         }
     } // for(;aConnDataIter != aConnDataEnd;++aConnDataIter)
-    --m_nThreadEvent;
-    if ( !m_nThreadEvent )
-        Application::PostUserEvent(LINK(this, ORelationController, OnThreadFinished));
+    if ( m_nThreadEvent )
+    {
+        --m_nThreadEvent;
+        if ( !m_nThreadEvent )
+            Application::PostUserEvent(LINK(this, ORelationController, OnThreadFinished));
+    }
 }
 // -----------------------------------------------------------------------------
 IMPL_LINK( ORelationController, OnThreadFinished, void*, /*NOTINTERESTEDIN*/ )
@@ -599,24 +519,33 @@ void ORelationController::loadData()
     {
         if ( !m_xTables.is() )
             return;
+        DatabaseMetaData aMeta(getConnection());
         // this may take some time
         const Reference< XDatabaseMetaData> xMetaData = getConnection()->getMetaData();
         const Sequence< ::rtl::OUString> aNames = m_xTables->getElementNames();
         const sal_Int32 nCount = aNames.getLength();
-        const sal_Int32 nMaxElements = (nCount / MAX_THREADS) +1;
-
-        sal_Int32 nStart = 0,nEnd = ::std::min(nMaxElements,nCount);
-        while(nStart != nEnd)
+        if ( aMeta.supportsThreads() )
         {
-            ++m_nThreadEvent;
-            RelationLoader* pThread = new RelationLoader(this,xMetaData,m_xTables,aNames,nStart,nEnd);
-            pThread->createSuspended();
-            pThread->setPriority(osl_Thread_PriorityBelowNormal);
-            pThread->resume();
-            nStart = nEnd;
-            nEnd += nMaxElements;
-            nEnd = ::std::min(nEnd,nCount);
-        } // for(;pIter != pEnd;++pIter)
+            const sal_Int32 nMaxElements = (nCount / MAX_THREADS) +1;
+            sal_Int32 nStart = 0,nEnd = ::std::min(nMaxElements,nCount);
+            while(nStart != nEnd)
+            {
+                ++m_nThreadEvent;
+                RelationLoader* pThread = new RelationLoader(this,xMetaData,m_xTables,aNames,nStart,nEnd);
+                pThread->createSuspended();
+                pThread->setPriority(osl_Thread_PriorityBelowNormal);
+                pThread->resume();
+                nStart = nEnd;
+                nEnd += nMaxElements;
+                nEnd = ::std::min(nEnd,nCount);
+            } // for(;pIter != pEnd;++pIter)
+        } // if ( aMeta.supportsThreads() )
+        else
+        {
+            RelationLoader* pThread = new RelationLoader(this,xMetaData,m_xTables,aNames,0,nCount);
+            pThread->run();
+            pThread->onTerminated();
+        }
     }
     catch(SQLException& e)
     {
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index fcf7707..c262079 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -1509,6 +1509,23 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS
     } // if ( aSaveOpt.IsSaveRelFSys() )
     const ::rtl::OUString sHierarchicalDocumentName( aDescriptor.getUnpackedValueOrDefault(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("HierarchicalDocumentName")),::rtl::OUString()) );
     xInfoSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("StreamRelPath")), uno::makeAny(sHierarchicalDocumentName));
+    ::rtl::OUString aVersion;
+    SvtSaveOptions::ODFDefaultVersion nDefVersion = aSaveOpt.GetODFDefaultVersion();
+
+    // older versions can not have this property set, it exists only starting from ODF1.2
+    if ( nDefVersion >= SvtSaveOptions::ODFVER_012 )
+        aVersion = ODFVER_012_TEXT;
+
+    if ( aVersion.getLength() )
+    {
+        try
+        {
+            xInfoSet->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Version" )), uno::makeAny( aVersion ) );
+        }
+        catch( uno::Exception& )
+        {
+        }
+    }
     
     
     sal_Int32 nArgsLen = aDelegatorArguments.getLength();


More information about the ooo-build-commit mailing list