summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2009-12-09 22:07:29 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2009-12-09 22:07:29 +0100
commit954c326ed80405f99dfc19f3dbdef112c9b4ea51 (patch)
treeaa85d5efa8064b108b34a2186982bb7918bf8f4d /dbaccess
parent54215626ef72aa170a27f468aae57c9b4667cb87 (diff)
parentf17e58864db1476a09cc5156e85f745a9286da63 (diff)
dba33b: merge CWS head with head resulting from pulling DEV300_m67
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/inc/documentcontroller.hxx12
-rw-r--r--dbaccess/inc/genericcontroller.hxx2
-rw-r--r--dbaccess/inc/pch/precompiled_dbaccess.hxx1
-rw-r--r--dbaccess/qa/complex/dbaccess/ApplicationController.java34
-rw-r--r--dbaccess/qa/complex/dbaccess/DatabaseDocument.java234
-rw-r--r--dbaccess/qa/complex/dbaccess/TestCase.java4
-rw-r--r--dbaccess/source/core/api/RowSet.cxx219
-rw-r--r--dbaccess/source/core/api/querydescriptor.cxx23
-rw-r--r--dbaccess/source/core/api/querydescriptor.hxx4
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.cxx336
-rw-r--r--dbaccess/source/core/dataaccess/ModelImpl.hxx18
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.cxx106
-rw-r--r--dbaccess/source/core/dataaccess/databasecontext.hxx9
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx71
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx45
-rw-r--r--dbaccess/source/core/dataaccess/datasource.hxx36
-rw-r--r--dbaccess/source/core/dataaccess/documentcontainer.cxx2
-rw-r--r--dbaccess/source/core/dataaccess/documentdefinition.cxx2
-rw-r--r--dbaccess/source/core/inc/core_resource.hrc2
-rw-r--r--dbaccess/source/core/inc/core_resource.hxx2
-rw-r--r--dbaccess/source/core/inc/sdbcoretools.hxx14
-rw-r--r--dbaccess/source/core/misc/apitools.cxx11
-rw-r--r--dbaccess/source/core/misc/dsntypes.cxx46
-rw-r--r--dbaccess/source/core/misc/sdbcoretools.cxx70
-rw-r--r--dbaccess/source/core/resource/core_resource.cxx6
-rw-r--r--dbaccess/source/core/resource/strings.src7
-rw-r--r--dbaccess/source/ext/macromigration/docinteraction.cxx12
-rw-r--r--dbaccess/source/ext/macromigration/docinteraction.hxx9
-rw-r--r--dbaccess/source/ext/macromigration/progressmixer.cxx3
-rw-r--r--dbaccess/source/filter/xml/dbloader2.cxx18
-rw-r--r--dbaccess/source/inc/dsntypes.hxx5
-rw-r--r--dbaccess/source/ui/app/AppController.hxx9
-rw-r--r--dbaccess/source/ui/app/AppControllerDnD.cxx12
-rw-r--r--dbaccess/source/ui/app/subcomponentmanager.cxx9
-rw-r--r--dbaccess/source/ui/browser/brwctrlr.cxx3
-rw-r--r--dbaccess/source/ui/browser/dbloader.cxx13
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx2
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx2
-rw-r--r--dbaccess/source/ui/control/dbtreelistbox.cxx2
-rw-r--r--dbaccess/source/ui/control/listviewitems.cxx4
-rw-r--r--dbaccess/source/ui/control/opendoccontrols.cxx14
-rw-r--r--dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx6
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.cxx10
-rw-r--r--dbaccess/source/ui/dlg/dbadminsetup.src2
-rw-r--r--dbaccess/source/ui/dlg/directsql.cxx7
-rw-r--r--dbaccess/source/ui/dlg/generalpage.cxx14
-rw-r--r--dbaccess/source/ui/dlg/indexdialog.cxx2
-rw-r--r--dbaccess/source/ui/inc/databaseobjectview.hxx12
-rw-r--r--dbaccess/source/ui/inc/dbadmin.hxx2
-rw-r--r--dbaccess/source/ui/inc/directsql.hxx3
-rw-r--r--dbaccess/source/ui/inc/dsmeta.hxx2
-rw-r--r--dbaccess/source/ui/inc/opendoccontrols.hxx2
-rw-r--r--dbaccess/source/ui/misc/ToolBoxHelper.cxx6
-rw-r--r--dbaccess/source/ui/misc/UITools.cxx2
-rw-r--r--dbaccess/source/ui/misc/databaseobjectview.cxx10
-rw-r--r--dbaccess/source/ui/misc/documentcontroller.cxx10
-rw-r--r--dbaccess/source/ui/misc/dsmeta.cxx6
-rw-r--r--dbaccess/source/ui/misc/linkeddocuments.cxx5
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx82
-rw-r--r--dbaccess/source/ui/relationdesign/RTableConnectionData.cxx4
-rw-r--r--dbaccess/source/ui/relationdesign/RelationController.cxx135
61 files changed, 773 insertions, 982 deletions
diff --git a/dbaccess/inc/documentcontroller.hxx b/dbaccess/inc/documentcontroller.hxx
index a16e4c645b06..2ca154625d90 100644
--- a/dbaccess/inc/documentcontroller.hxx
+++ b/dbaccess/inc/documentcontroller.hxx
@@ -72,18 +72,6 @@ namespace dbaui
Controller m_xController;
public:
- /** constructs the object, and connects the controller to the model
-
- @param _rxModel
- the model to which the controller should be connected
- @param _rxController
- the controller which should be connected to the model
- */
- ModelControllerConnector(
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxModel,
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >& _rxController
- );
-
/** connects the controller to the model
@param _rxModel
diff --git a/dbaccess/inc/genericcontroller.hxx b/dbaccess/inc/genericcontroller.hxx
index b4570bc1215b..8464f491ff66 100644
--- a/dbaccess/inc/genericcontroller.hxx
+++ b/dbaccess/inc/genericcontroller.hxx
@@ -531,7 +531,9 @@ namespace dbaui
virtual void SAL_CALL removeMouseClickHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseClickHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException);
protected:
+#ifdef WNT
OGenericUnoController(); // never implemented
+#endif
};
}
diff --git a/dbaccess/inc/pch/precompiled_dbaccess.hxx b/dbaccess/inc/pch/precompiled_dbaccess.hxx
index 2b7a2c5a5f6e..e9e8edf46f80 100644
--- a/dbaccess/inc/pch/precompiled_dbaccess.hxx
+++ b/dbaccess/inc/pch/precompiled_dbaccess.hxx
@@ -411,6 +411,7 @@
#include "comphelper/types.hxx"
#include "connectivity/FValue.hxx"
+#include <connectivity/DriversConfig.hxx>
#include "connectivity/dbcharset.hxx"
#include "connectivity/dbconversion.hxx"
#include "connectivity/dbexception.hxx"
diff --git a/dbaccess/qa/complex/dbaccess/ApplicationController.java b/dbaccess/qa/complex/dbaccess/ApplicationController.java
index fa7615809228..5b2dd1e0e613 100644
--- a/dbaccess/qa/complex/dbaccess/ApplicationController.java
+++ b/dbaccess/qa/complex/dbaccess/ApplicationController.java
@@ -53,7 +53,7 @@ import java.io.IOException;
/** complex test case for Base's application UI
*/
-public class ApplicationController extends complexlib.ComplexTestCase
+public class ApplicationController extends TestCase
{
private HsqlDatabase m_database;
@@ -66,22 +66,6 @@ public class ApplicationController extends complexlib.ComplexTestCase
}
// --------------------------------------------------------------------------------------------------------
- protected final XComponentContext getComponentContext()
- {
- XComponentContext context = null;
- try
- {
- final XPropertySet orbProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, getORB());
- context = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class,
- orbProps.getPropertyValue("DefaultContext"));
- }
- catch (Exception ex)
- {
- failed("could not retrieve the ComponentContext");
- }
- return context;
- }
- // --------------------------------------------------------------------------------------------------------
public String[] getTestMethodNames()
{
@@ -98,12 +82,6 @@ public class ApplicationController extends complexlib.ComplexTestCase
}
// --------------------------------------------------------------------------------------------------------
- protected final XMultiServiceFactory getORB()
- {
- return (XMultiServiceFactory) param.getMSF();
- }
-
- // --------------------------------------------------------------------------------------------------------
private void impl_closeDocument()
{
if (m_database != null)
@@ -143,15 +121,17 @@ public class ApplicationController extends complexlib.ComplexTestCase
}
// --------------------------------------------------------------------------------------------------------
- public void before() throws Exception, java.lang.Exception
+ public void before() throws java.lang.Exception
{
+ super.before();
impl_switchToDocument(null);
}
// --------------------------------------------------------------------------------------------------------
- public void after()
+ public void after() throws java.lang.Exception
{
impl_closeDocument();
+ super.after();
}
// --------------------------------------------------------------------------------------------------------
@@ -161,9 +141,7 @@ public class ApplicationController extends complexlib.ComplexTestCase
// then those changes are saved in the old document, actually
final String oldDocumentURL = m_database.getDocumentURL();
- final File documentFile = java.io.File.createTempFile(getTestObjectName(), ".odb");
- documentFile.deleteOnExit();
- final String newDocumentURL = URLHelper.getFileURLFromSystemPath(documentFile.getAbsoluteFile());
+ final String newDocumentURL = createTempFileURL();
// store the doc in a new location
final XStorable storeDoc = UnoRuntime.queryInterface( XStorable.class, m_databaseDocument );
diff --git a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
index 3b00de883319..8ce063bcdb2a 100644
--- a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
+++ b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java
@@ -64,6 +64,8 @@ import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XSingleComponentFactory;
import com.sun.star.lang.XTypeProvider;
import com.sun.star.script.provider.XScriptProviderSupplier;
+import com.sun.star.sdb.XDocumentDataSource;
+import com.sun.star.sdbc.XDataSource;
import com.sun.star.sdb.XFormDocumentsSupplier;
import com.sun.star.sdb.XOfficeDatabaseDocument;
import com.sun.star.sdb.XReportDocumentsSupplier;
@@ -87,7 +89,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();
@@ -254,6 +255,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
return new String[]
{
"testLoadable",
+ "testDocumentRevenants",
"testDocumentEvents",
"testGlobalEvents"
};
@@ -265,7 +267,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
return "DatabaseDocument";
}
- public void before()
+ // --------------------------------------------------------------------------------------------------------
+ public void before() throws java.lang.Exception
{
super.before();
@@ -293,10 +296,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
}
// --------------------------------------------------------------------------------------------------------
- public void after()
+ public void after() throws java.lang.Exception
{
- super.after();
-
try
{
// dispose our callback factory. This will automatically remove it from our service
@@ -314,6 +315,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
e.printStackTrace(System.err);
failed("failed to close the test case");
}
+
+ super.after();
}
// --------------------------------------------------------------------------------------------------------
@@ -463,6 +466,27 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
}
// --------------------------------------------------------------------------------------------------------
+ private PropertyValue[] impl_getMarkerLoadArgs()
+ {
+ return new PropertyValue[]
+ {
+ new PropertyValue( "PickListEntry", 0, false, PropertyState.DIRECT_VALUE ),
+ new PropertyValue( "TestCase_Marker", 0, "Yes", PropertyState.DIRECT_VALUE )
+ };
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ private boolean impl_hasMarker( final PropertyValue[] _args )
+ {
+ for ( int i=0; i<_args.length; ++i )
+ {
+ if ( _args[i].Name.equals( "TestCase_Marker" ) && _args[i].Value.equals( "Yes" ) )
+ return true;
+ }
+ return false;
+ }
+
+ // --------------------------------------------------------------------------------------------------------
private PropertyValue[] impl_getDefaultLoadArgs()
{
return new PropertyValue[]
@@ -506,7 +530,27 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
}
// --------------------------------------------------------------------------------------------------------
- public void testDocumentEvents() throws Exception, IOException
+ private XModel impl_loadDocument( final String _documentURL, final PropertyValue[] _loadArgs ) throws Exception
+ {
+ final XComponentLoader loader = (XComponentLoader) UnoRuntime.queryInterface( XComponentLoader.class,
+ getORB().createInstance("com.sun.star.frame.Desktop") );
+ return (XModel) UnoRuntime.queryInterface( XModel.class,
+ loader.loadComponentFromURL( _documentURL, _BLANK, 0, _loadArgs ) );
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ private void impl_storeDocument( final XModel _document ) throws Exception, IOException
+ {
+ // store the document
+ final String documentURL = FileHelper.getOOoCompatibleFileURL( _document.getURL() );
+ final XStorable storeDoc = (XStorable) UnoRuntime.queryInterface( XStorable.class,
+ _document );
+ storeDoc.store();
+
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ private XModel impl_createDocWithMacro( final String _libName, final String _moduleName, final String _code ) throws Exception, IOException
{
// create an empty document
XModel databaseDoc = impl_createEmptyEmbeddedHSQLDocument();
@@ -515,7 +559,90 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
final XEmbeddedScripts embeddedScripts = (XEmbeddedScripts) UnoRuntime.queryInterface(XEmbeddedScripts.class,
databaseDoc);
final XStorageBasedLibraryContainer basicLibs = embeddedScripts.getBasicLibraries();
- final XNameContainer newLib = basicLibs.createLibrary("EventHandlers");
+ final XNameContainer newLib = basicLibs.createLibrary( _libName );
+ newLib.insertByName( _moduleName, _code );
+
+ return databaseDoc;
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ /** tests various aspects of database document "revenants"
+ *
+ * Well, I do not really have a good term for this ... The point is, database documents are in real
+ * only *one* aspect of a more complex thing. The second aspect is a data source. Both, in some sense,
+ * just represent different views on the same thing. For a given database, there's at each time at most
+ * one data source, and at most one database document. Both have a independent life time, and are
+ * created when needed.
+ * In particular, a document can be closed (this is what happens when the last UI window displaying
+ * this document is closed), and then dies. Now when the other "view", the data source, still exists,
+ * the the underlying document data is not discarded, but kept alive (else the data source would die
+ * just because the document dies, which is not desired). If the document is loaded, again, then
+ * it is re-created, using the data of its previous "incarnation".
+ *
+ * This method here tests some of those aspects of a document which should survive the death of one
+ * instance and re-creation as a revenant.
+ */
+ public void testDocumentRevenants() throws Exception, IOException
+ {
+ // create an empty document
+ XModel databaseDoc = impl_createDocWithMacro( "Lib", "Module",
+ "Sub Hello\n" +
+ " MsgBox \"Hello\"\n" +
+ "End Sub\n"
+ );
+ impl_storeDocument( databaseDoc );
+ final String documentURL = databaseDoc.getURL();
+
+ // at this stage, the marker should not yet be present in the doc's args, else some of the below
+ // tests become meaningless
+ assure( "A newly created doc should not have the test case marker", !impl_hasMarker( databaseDoc.getArgs() ) );
+
+ // obtain the DataSource associated with the document. Keeping this alive
+ // ensures that the "impl data" of the document is kept alive, too, so when closing
+ // and re-opening it, this "impl data" must be re-used.
+ XDocumentDataSource dataSource = (XDocumentDataSource)UnoRuntime.queryInterface( XDocumentDataSource.class,
+ ((XOfficeDatabaseDocument)UnoRuntime.queryInterface(
+ XOfficeDatabaseDocument.class, databaseDoc )).getDataSource() );
+
+ // close and reload the doc
+ impl_closeDocument(databaseDoc);
+ databaseDoc = impl_loadDocument( documentURL, impl_getMarkerLoadArgs() );
+ // since we just put the marker into the load-call, it should be present at the doc
+ assure( "The test case marker got lost.", impl_hasMarker( databaseDoc.getArgs() ) );
+
+ // The basic library should have survived
+ final XEmbeddedScripts embeddedScripts = (XEmbeddedScripts) UnoRuntime.queryInterface(XEmbeddedScripts.class,
+ databaseDoc);
+ final XStorageBasedLibraryContainer basicLibs = embeddedScripts.getBasicLibraries();
+ assure( "Baisc lib did not survive reloading a closed document", basicLibs.hasByName( "Lib" ) );
+ final XNameContainer lib = (XNameContainer)UnoRuntime.queryInterface(
+ XNameContainer.class, basicLibs.getByName( "Lib" ) );
+ assure( "Basic module did not survive reloading a closed document", lib.hasByName( "Module" ) );
+
+ // now closing the doc, and obtaining it from the data source, should preserve the marker we put into the load
+ // args
+ impl_closeDocument( databaseDoc );
+ databaseDoc = (XModel)UnoRuntime.queryInterface( XModel.class, dataSource.getDatabaseDocument() );
+ assure( "The test case marker did not survive re-retrieval of the doc from the data source.",
+ impl_hasMarker( databaseDoc.getArgs() ) );
+
+ // on the other hand, closing and regurlarly re-loading the doc *without* the marker should indeed
+ // lose it
+ impl_closeDocument( databaseDoc );
+ databaseDoc = impl_loadDocument( documentURL, impl_getDefaultLoadArgs() );
+ assure( "Reloading the document kept the old args, instead of the newly supplied ones.",
+ !impl_hasMarker( databaseDoc.getArgs() ) );
+
+ // clean up
+ impl_closeDocument( databaseDoc );
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ public void testDocumentEvents() throws Exception, IOException
+ {
+ // create an empty document
+ final String libName = "EventHandlers";
+ final String moduleName = "all";
final String eventHandlerCode =
"Option Explicit\n" +
"\n" +
@@ -531,32 +658,27 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
"\n" +
" oCallback.documentEventOccured( oEvent )\n" +
"End Sub\n";
- newLib.insertByName("all", eventHandlerCode);
+ XModel databaseDoc = impl_createDocWithMacro( libName, moduleName, eventHandlerCode );
+ final String documentURL = databaseDoc.getURL();
// bind the macro to the OnLoad event
- final String macroURI = "vnd.sun.star.script:EventHandlers.all.OnLoad?language=Basic&location=document";
+ final String macroURI = "vnd.sun.star.script:" + libName + "." + moduleName + ".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)
});
// store the document, and close it
- final String documentURL = FileHelper.getOOoCompatibleFileURL(databaseDoc.getURL());
- final XStorable storeDoc = (XStorable) UnoRuntime.queryInterface(XStorable.class,
- databaseDoc);
- storeDoc.store();
- impl_closeDocument(databaseDoc);
+ impl_storeDocument( databaseDoc );
+ impl_closeDocument( databaseDoc );
// ensure the macro security configuration is "ask the user for document macro execution"
final int oldSecurityLevel = impl_setMacroSecurityLevel(1);
// load it, again
- final XComponentLoader loader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class,
- getORB().createInstance("com.sun.star.frame.Desktop"));
-
m_loadDocState = STATE_LOADING_DOC;
// expected order of states is:
// STATE_LOADING_DOC - initialized here
@@ -567,13 +689,12 @@ 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()));
+ databaseDoc = impl_loadDocument( documentURL, 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 +780,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 +800,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 +837,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 +885,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 +899,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
- {
- _actualEvents.wait(5000);
- }
- catch (InterruptedException ex)
+ int actualEventCount = _actualEvents.size();
+ while (actualEventCount < _expectedEvents.length)
{
- }
+ // 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(20000);
+ }
+ 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 +995,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/qa/complex/dbaccess/TestCase.java b/dbaccess/qa/complex/dbaccess/TestCase.java
index 8a9594a34305..e331ccc33e7c 100644
--- a/dbaccess/qa/complex/dbaccess/TestCase.java
+++ b/dbaccess/qa/complex/dbaccess/TestCase.java
@@ -69,12 +69,12 @@ public abstract class TestCase extends complexlib.ComplexTestCase
}
// --------------------------------------------------------------------------------------------------------
- public void before()
+ public void before() throws java.lang.Exception
{
}
// --------------------------------------------------------------------------------------------------------
- public void after()
+ public void after() throws java.lang.Exception
{
}
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx
index 5b71c7d8e56c..d5f9204137c1 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -36,157 +36,56 @@
#include "sdbcoretools.hxx"
#include "SingleSelectQueryComposer.hxx"
#include "module_dba.hxx"
+#include "sdbcoretools.hxx"
+#include "CRowSetColumn.hxx"
+#include "CRowSetDataColumn.hxx"
+#include "RowSetCache.hxx"
+#include "core_resource.hrc"
+#include "core_resource.hxx"
+#include "tablecontainer.hxx"
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+/** === begin UNO includes === **/
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#endif
-#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
-#endif
-#ifndef _CPPUHELPER_INTERFACECONTAINER_H_
-#include <cppuhelper/interfacecontainer.h>
-#endif
-#ifndef _CPPUHELPER_EXC_HLP_HXX_
-#include <cppuhelper/exc_hlp.hxx>
-#endif
-#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
-#include <cppuhelper/typeprovider.hxx>
-#endif
-#ifndef _COMPHELPER_SEQUENCE_HXX_
-#include <comphelper/sequence.hxx>
-#endif
-#ifndef COMPHELPER_COMPONENTCONTEXT_HXX
-#include <comphelper/componentcontext.hxx>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XCOMPLETEDCONNECTION_HPP_
-#include <com/sun/star/sdb/XCompletedConnection.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_ROWSETVETOEXCEPTION_HPP_
+#include <com/sun/star/sdb/CommandType.hpp>
+#include <com/sun/star/sdb/ErrorCondition.hpp>
+#include <com/sun/star/sdb/RowChangeAction.hpp>
#include <com/sun/star/sdb/RowSetVetoException.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_FETCHDIRECTION_HPP_
+#include <com/sun/star/sdb/XCompletedConnection.hpp>
+#include <com/sun/star/sdb/XParametersSupplier.hpp>
+#include <com/sun/star/sdb/XQueriesSupplier.hpp>
#include <com/sun/star/sdbc/FetchDirection.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_
-#include <com/sun/star/sdbcx/Privilege.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
-#include <com/sun/star/sdb/CommandType.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XDATASOURCE_HPP_
#include <com/sun/star/sdbc/XDataSource.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_
-#include <com/sun/star/sdb/XQueriesSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_ROWCHANGEACTION_HPP_
-#include <com/sun/star/sdb/RowChangeAction.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_ERRORCONDITION_HPP_
-#include <com/sun/star/sdb/ErrorCondition.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XDRIVERACCESS_HPP_
#include <com/sun/star/sdbc/XDriverAccess.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XDATADEFINITIONSUPPLIER_HPP_
-#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_
#include <com/sun/star/sdbcx/CompareBookmark.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UNO_XNAMINGSERVICE_HPP_
-#include <com/sun/star/uno/XNamingService.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_
#include <com/sun/star/sdbcx/Privilege.hpp>
-#endif
-#ifndef _CONNECTIVITY_DBTOOLS_HXX_
-#include <connectivity/dbtools.hxx>
-#endif
-#ifndef _COMPHELPER_EXTRACT_HXX_
-#include <comphelper/extract.hxx>
-#endif
-#ifndef DBACCESS_CORE_API_ROWSETCACHE_HXX
-#include "RowSetCache.hxx"
-#endif
-#if OSL_DEBUG_LEVEL > 1
-#ifndef _COM_SUN_STAR_SDBC_XDRIVERMANAGER_HPP_
-#include <com/sun/star/sdbc/XDriverManager.hpp>
-#endif
-#endif
-#ifndef _DBACORE_DATACOLUMN_HXX_
-#include "CRowSetDataColumn.hxx"
-#endif
-#ifndef DBACCESS_CORE_API_CROWSETCOLUMN_HXX
-#include "CRowSetColumn.hxx"
-#endif
-#ifndef _COMPHELPER_TYPES_HXX_
-#include <comphelper/types.hxx>
-#endif
-#ifndef _COMPHELPER_SEQSTREAM_HXX
-#include <comphelper/seqstream.hxx>
-#endif
-#ifndef _TOOLS_DEBUG_HXX
-#include <tools/debug.hxx>
-#endif
-#ifndef TOOLS_DIAGNOSE_EX_H
-#include <tools/diagnose_ex.h>
-#endif
-#ifndef _DBHELPER_DBEXCEPTION_HXX_
-#include <connectivity/dbexception.hxx>
-#endif
-#include <connectivity/BlobHelper.hxx>
-#ifndef _DBA_CORE_TABLECONTAINER_HXX_
-#include "tablecontainer.hxx"
-#endif
-#ifndef _COM_SUN_STAR_SDB_PARAMETERSREQUEST_HPP_
-#include <com/sun/star/sdb/ParametersRequest.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_PARAMETERSREQUEST_HPP_
-#include <com/sun/star/sdb/ParametersRequest.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XPARAMETERSSUPPLIER_HPP_
-#include <com/sun/star/sdb/XParametersSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
-#include <com/sun/star/container/XChild.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_
+#include <com/sun/star/sdbcx/XDataDefinitionSupplier.hpp>
+#include <com/sun/star/uno/XNamingService.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#endif
-#ifndef _COMPHELPER_INTERACTION_HXX_
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/extract.hxx>
#include <comphelper/interaction.hxx>
-#endif
-#ifndef _COMPHELPER_PROPERTY_HXX_
#include <comphelper/property.hxx>
-#endif
-#ifndef _UTL_CONFIGMGR_HXX_
-#include <unotools/configmgr.hxx>
-#endif
-#ifndef _COMPHELPER_UNO3_HXX_
+#include <comphelper/seqstream.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/types.hxx>
#include <comphelper/uno3.hxx>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_COMPAREBOOKMARK_HPP_
-#include <com/sun/star/sdbcx/CompareBookmark.hpp>
-#endif
-#ifndef _DBA_CORE_RESOURCE_HXX_
-#include "core_resource.hxx"
-#endif
-#ifndef _DBA_CORE_RESOURCE_HRC_
-#include "core_resource.hrc"
-#endif
-#ifndef _DBHELPER_DBCONVERSION_HXX_
+#include <connectivity/BlobHelper.hxx>
#include <connectivity/dbconversion.hxx>
-#endif
-#ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX
-#include <svtools/syslocale.hxx>
-#endif
-#ifndef _RTL_LOGFILE_HXX_
+#include <connectivity/dbexception.hxx>
+#include <connectivity/dbtools.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <cppuhelper/typeprovider.hxx>
#include <rtl/logfile.hxx>
-#endif
+#include <svtools/syslocale.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <unotools/configmgr.hxx>
using namespace utl;
using namespace dbaccess;
@@ -2206,37 +2105,37 @@ Reference< XConnection > ORowSet::calcConnection(const Reference< XInteractionH
if (!m_xActiveConnection.is())
{
Reference< XConnection > xNewConn;
- if (m_aDataSourceName.getLength())
+ if ( m_aDataSourceName.getLength() )
{
- // is it a file url?
- Reference< XNameAccess > xNamingContext;
- if ( m_aContext.createComponent( (::rtl::OUString)SERVICE_SDB_DATABASECONTEXT, xNamingContext ) )
- if (xNamingContext.is() )
+ Reference< XNameAccess > xDatabaseContext(
+ m_aContext.createComponent( (::rtl::OUString)SERVICE_SDB_DATABASECONTEXT ),
+ UNO_QUERY_THROW );
+ try
{
- try
- {
- if(_rxHandler.is())
- {
- Reference< XCompletedConnection> xComplConn(xNamingContext->getByName(m_aDataSourceName), UNO_QUERY);
- if(xComplConn.is())
- xNewConn = xComplConn->connectWithCompletion(_rxHandler);
- }
- else
- {
- Reference< XDataSource > xDataSource(xNamingContext->getByName(m_aDataSourceName), UNO_QUERY);
- if (xDataSource.is())
- xNewConn = xDataSource->getConnection(m_aUser, m_aPassword);
- }
- }
- catch (SQLException &e)
+ Reference< XDataSource > xDataSource( xDatabaseContext->getByName( m_aDataSourceName ), UNO_QUERY_THROW );
+
+ // try connecting with the interaction handler
+ Reference< XCompletedConnection > xComplConn( xDataSource, UNO_QUERY );
+ if ( _rxHandler.is() && xComplConn.is() )
{
- throw e;
+ xNewConn = xComplConn->connectWithCompletion( _rxHandler );
}
- catch (Exception&)
+ else
{
- throw SQLException();
+ xNewConn = xDataSource->getConnection( m_aUser, m_aPassword );
}
}
+ catch ( const SQLException& e )
+ {
+ throw;
+ }
+ catch ( const Exception& e )
+ {
+ Any aError = ::cppu::getCaughtException();
+ ::rtl::OUString sMessage = ResourceManager::loadString( RID_NO_SUCH_DATA_SOURCE,
+ "$name$", m_aDataSourceName, "$error$", extractExceptionMessage( m_aContext, aError ) );
+ ::dbtools::throwGenericSQLException( sMessage, *this );
+ }
}
setActiveConnection(xNewConn);
m_bOwnConnection = sal_True;
@@ -2260,7 +2159,7 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw()
else
{
if ( !m_xActiveConnection.is() )
- throw SQLException(DBA_RES(RID_STR_CONNECTION_INVALID),*this,SQLSTATE_GENERAL,1000,Any() );
+ throw SQLException(DBA_RES(RID_STR_CONNECTION_INVALID),*this,SQLSTATE_GENERAL,1000,Any() );
sal_Bool bCase = sal_True;
try
diff --git a/dbaccess/source/core/api/querydescriptor.cxx b/dbaccess/source/core/api/querydescriptor.cxx
index 00b3a247aed5..2dfb6714ee63 100644
--- a/dbaccess/source/core/api/querydescriptor.cxx
+++ b/dbaccess/source/core/api/querydescriptor.cxx
@@ -89,29 +89,6 @@ OQueryDescriptor::OQueryDescriptor()
}
//--------------------------------------------------------------------------
-OQueryDescriptor::OQueryDescriptor(const Reference< XPropertySet >& _rxCommandDefinition)
- :OQueryDescriptor_Base(m_aMutex,*this)
- ,ODataSettings(m_aBHelper,sal_True)
-{
- DBG_CTOR(OQueryDescriptor,NULL);
- registerProperties();
- ODataSettings::registerPropertiesFor(this);
-
- osl_incrementInterlockedCount(&m_refCount);
-
- OSL_ENSURE(_rxCommandDefinition.is(), "OQueryDescriptor_Base::OQueryDescriptor_Base : invalid source property set !");
- try
- {
- ::comphelper::copyProperties(_rxCommandDefinition,this);
- }
- catch(Exception&)
- {
- OSL_ENSURE(sal_False, "OQueryDescriptor_Base::OQueryDescriptor_Base: caught an exception!");
- }
- osl_decrementInterlockedCount(&m_refCount);
-}
-
-//--------------------------------------------------------------------------
OQueryDescriptor::OQueryDescriptor(const OQueryDescriptor_Base& _rSource)
:OQueryDescriptor_Base(_rSource,*this)
,ODataSettings(m_aBHelper,sal_True)
diff --git a/dbaccess/source/core/api/querydescriptor.hxx b/dbaccess/source/core/api/querydescriptor.hxx
index 958ef8e184aa..4d20bcc71199 100644
--- a/dbaccess/source/core/api/querydescriptor.hxx
+++ b/dbaccess/source/core/api/querydescriptor.hxx
@@ -165,10 +165,6 @@ protected:
virtual ~OQueryDescriptor();
public:
OQueryDescriptor();
- /** constructs the object with a UNO QueryDescriptor. If you use this ctor, the resulting object
- won't have any column informations (the column container will be empty)
- */
- OQueryDescriptor(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxForeignDescriptor);
OQueryDescriptor(const OQueryDescriptor_Base& _rSource);
// com::sun::star::lang::XTypeProvider
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index b6f688754129..fef47f68145a 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -143,11 +143,13 @@ class DocumentStorageAccess : public ::cppu::WeakImplHelper2< XDocumentSubStor
NamedStorages m_aExposedStorages;
ODatabaseModelImpl* m_pModelImplementation;
bool m_bPropagateCommitToRoot;
+ bool m_bDisposingSubStorages;
public:
DocumentStorageAccess( ODatabaseModelImpl& _rModelImplementation )
:m_pModelImplementation( &_rModelImplementation )
,m_bPropagateCommitToRoot( true )
+ ,m_bDisposingSubStorages( false )
{
DBG_CTOR( DocumentStorageAccess, NULL );
}
@@ -161,19 +163,8 @@ protected:
public:
void dispose();
- void suspendCommitPropagation()
- {
- DBG_ASSERT( m_bPropagateCommitToRoot, "DocumentStorageAccess:: suspendCommitPropagation: already suspended" );
- m_bPropagateCommitToRoot = false;
- }
- void resumeCommitPropagation()
- {
- DBG_ASSERT( !m_bPropagateCommitToRoot, "DocumentStorageAccess:: suspendCommitPropagation: already suspended" );
- m_bPropagateCommitToRoot = true;
- }
-
// XDocumentSubStorageSupplier
- virtual Reference< XStorage > SAL_CALL getDocumentSubStorage( const ::rtl::OUString& aStorageName, ::sal_Int32 nMode ) throw (RuntimeException);
+ virtual Reference< XStorage > SAL_CALL getDocumentSubStorage( const ::rtl::OUString& aStorageName, ::sal_Int32 _nMode ) throw (RuntimeException);
virtual Sequence< ::rtl::OUString > SAL_CALL getDocumentSubStoragesNames( ) throw (IOException, RuntimeException);
// XTransactionListener
@@ -184,6 +175,32 @@ public:
// XEventListener
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ /// disposes all storages managed by this instance
+ void disposeStorages();
+
+ /// disposes all known sub storages
+ void commitStorages() SAL_THROW(( IOException, RuntimeException ));
+
+ /// commits the dedicated "database" storage
+ bool commitEmbeddedStorage( bool _bPreventRootCommits );
+
+private:
+ /** opens the sub storage with the given name, in the given mode
+ */
+ Reference< XStorage > impl_openSubStorage_nothrow( const ::rtl::OUString& _rStorageName, sal_Int32 _nMode );
+
+ void impl_suspendCommitPropagation()
+ {
+ OSL_ENSURE( m_bPropagateCommitToRoot, "DocumentStorageAccess::impl_suspendCommitPropagation: already suspended" );
+ m_bPropagateCommitToRoot = false;
+ }
+ void impl_resumeCommitPropagation()
+ {
+ OSL_ENSURE( !m_bPropagateCommitToRoot, "DocumentStorageAccess::impl_resumeCommitPropagation: not suspended" );
+ m_bPropagateCommitToRoot = true;
+ }
+
};
//--------------------------------------------------------------------------
@@ -214,17 +231,117 @@ void DocumentStorageAccess::dispose()
}
//--------------------------------------------------------------------------
-Reference< XStorage > SAL_CALL DocumentStorageAccess::getDocumentSubStorage( const ::rtl::OUString& aStorageName, ::sal_Int32 nMode ) throw (RuntimeException)
+Reference< XStorage > DocumentStorageAccess::impl_openSubStorage_nothrow( const ::rtl::OUString& _rStorageName, sal_Int32 _nDesiredMode )
+{
+ OSL_ENSURE( _rStorageName.getLength(),"ODatabaseModelImpl::impl_openSubStorage_nothrow: Invalid storage name!" );
+
+ Reference< XStorage > xStorage;
+ try
+ {
+ Reference< XStorage > xRootStorage( m_pModelImplementation->getOrCreateRootStorage() );
+ if ( xRootStorage.is() )
+ {
+ sal_Int32 nRealMode = m_pModelImplementation->m_bDocumentReadOnly ? ElementModes::READ : _nDesiredMode;
+ if ( nRealMode == ElementModes::READ )
+ {
+ Reference< XNameAccess > xSubStorageNames( xRootStorage, UNO_QUERY );
+ if ( xSubStorageNames.is() && !xSubStorageNames->hasByName( _rStorageName ) )
+ return xStorage;
+ }
+
+ xStorage = xRootStorage->openStorageElement( _rStorageName, nRealMode );
+
+ Reference< XTransactionBroadcaster > xBroad( xStorage, UNO_QUERY );
+ if ( xBroad.is() )
+ xBroad->addTransactionListener( this );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return xStorage;
+}
+
+//--------------------------------------------------------------------------
+void DocumentStorageAccess::disposeStorages()
+{
+ m_bDisposingSubStorages = true;
+
+ NamedStorages::iterator aEnd = m_aExposedStorages.end();
+ for ( NamedStorages::iterator aIter = m_aExposedStorages.begin();
+ aIter != aEnd ;
+ ++aIter
+ )
+ {
+ try
+ {
+ ::comphelper::disposeComponent( aIter->second );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ m_aExposedStorages.clear();
+
+ m_bDisposingSubStorages = false;
+}
+
+//--------------------------------------------------------------------------
+void DocumentStorageAccess::commitStorages() SAL_THROW(( IOException, RuntimeException ))
+{
+ try
+ {
+ for ( NamedStorages::const_iterator aIter = m_aExposedStorages.begin();
+ aIter != m_aExposedStorages.end();
+ ++aIter
+ )
+ {
+ m_pModelImplementation->commitStorageIfWriteable( aIter->second );
+ }
+ }
+ catch(const WrappedTargetException&)
+ {
+ // WrappedTargetException not allowed to leave
+ throw IOException();
+ }
+}
+
+//--------------------------------------------------------------------------
+bool DocumentStorageAccess::commitEmbeddedStorage( bool _bPreventRootCommits )
+{
+ if ( _bPreventRootCommits )
+ impl_suspendCommitPropagation();
+
+ bool bSuccess = false;
+ try
+ {
+ NamedStorages::const_iterator pos = m_aExposedStorages.find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "database" ) ) );
+ if ( pos != m_aExposedStorages.end() )
+ bSuccess = m_pModelImplementation->commitStorageIfWriteable( pos->second );
+ }
+ catch( Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ if ( _bPreventRootCommits )
+ impl_resumeCommitPropagation();
+
+ return bSuccess;
+
+}
+
+//--------------------------------------------------------------------------
+Reference< XStorage > SAL_CALL DocumentStorageAccess::getDocumentSubStorage( const ::rtl::OUString& aStorageName, ::sal_Int32 _nDesiredMode ) throw (RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
NamedStorages::iterator pos = m_aExposedStorages.find( aStorageName );
if ( pos == m_aExposedStorages.end() )
{
- Reference< XStorage > xResult = m_pModelImplementation->getStorage( aStorageName, nMode );
- Reference< XTransactionBroadcaster > xBroadcaster( xResult, UNO_QUERY );
- if ( xBroadcaster.is() )
- xBroadcaster->addTransactionListener( this );
-
+ Reference< XStorage > xResult = impl_openSubStorage_nothrow( aStorageName, _nDesiredMode );
pos = m_aExposedStorages.insert( NamedStorages::value_type( aStorageName, xResult ) ).first;
}
@@ -269,8 +386,14 @@ void SAL_CALL DocumentStorageAccess::commited( const css::lang::EventObject& aEv
if ( m_pModelImplementation && m_bPropagateCommitToRoot )
{
Reference< XStorage > xStorage( aEvent.Source, UNO_QUERY );
- if ( m_pModelImplementation->isDatabaseStorage( xStorage ) )
+
+ // check if this is the dedicated "database" sub storage
+ NamedStorages::const_iterator pos = m_aExposedStorages.find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "database" ) ) );
+ if ( ( pos != m_aExposedStorages.end() )
+ && ( pos->second == xStorage )
+ )
{
+ // if so, also commit the root storage
m_pModelImplementation->commitRootStorage();
}
}
@@ -291,9 +414,10 @@ void SAL_CALL DocumentStorageAccess::reverted( const css::lang::EventObject& /*a
//--------------------------------------------------------------------------
void SAL_CALL DocumentStorageAccess::disposing( const css::lang::EventObject& Source ) throw ( RuntimeException )
{
- ODatabaseModelImpl* pImpl = m_pModelImplementation;
- if ( pImpl )
- pImpl->disposing( Source );
+ OSL_ENSURE( Reference< XStorage >( Source.Source, UNO_QUERY ).is(), "DocumentStorageAccess::disposing: No storage? What's this?" );
+
+ if ( m_bDisposingSubStorages )
+ return;
for ( NamedStorages::iterator find = m_aExposedStorages.begin();
find != m_aExposedStorages.end();
@@ -318,7 +442,6 @@ ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XMultiServiceFactory >&
,m_aMutex()
,m_aMutexFacade( m_aMutex )
,m_aContainer(4)
- ,m_aStorages()
,m_aMacroMode( *this )
,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE )
,m_pDBContext( &_rDBContext )
@@ -333,7 +456,6 @@ ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XMultiServiceFactory >&
,m_bSuppressVersionColumns(sal_True)
,m_bModified(sal_False)
,m_bDocumentReadOnly(sal_False)
- ,m_bDisposingSubStorages( sal_False )
,m_pSharedConnectionManager(NULL)
,m_nControllerLockCount(0)
{
@@ -357,7 +479,6 @@ ODatabaseModelImpl::ODatabaseModelImpl(
,m_aMutex()
,m_aMutexFacade( m_aMutex )
,m_aContainer(4)
- ,m_aStorages()
,m_aMacroMode( *this )
,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE )
,m_pDBContext( &_rDBContext )
@@ -373,7 +494,6 @@ ODatabaseModelImpl::ODatabaseModelImpl(
,m_bSuppressVersionColumns(sal_True)
,m_bModified(sal_False)
,m_bDocumentReadOnly(sal_False)
- ,m_bDisposingSubStorages( sal_False )
,m_pSharedConnectionManager(NULL)
,m_nControllerLockCount(0)
{
@@ -506,8 +626,7 @@ namespace
try
{
- Reference< XStorage > xContainerStorage( _rModel.getStorage(
- _rModel.getObjectContainerStorageName( _eType ), ElementModes::READWRITE ) );
+ Reference< XStorage > xContainerStorage( _rModel.getStorage( _eType, ElementModes::READWRITE ) );
// note the READWRITE here: If the storage already existed before, then the OpenMode will
// be ignored, anyway.
// If the storage did not yet exist, then it will be created. If the database document
@@ -589,16 +708,9 @@ void SAL_CALL ODatabaseModelImpl::disposing( const ::com::sun::star::lang::Event
if ( bStore )
commitRootStorage();
}
- else // storage
+ else
{
- if ( !m_bDisposingSubStorages )
- {
- Reference<XStorage> xStorage(Source.Source,UNO_QUERY);
- TStorages::iterator aFind = ::std::find_if(m_aStorages.begin(),m_aStorages.end(),
- ::std::compose1(::std::bind2nd(::std::equal_to<Reference<XStorage> >(),xStorage),::std::select2nd<TStorages::value_type>()));
- if ( aFind != m_aStorages.end() )
- m_aStorages.erase(aFind);
- }
+ OSL_ENSURE( false, "ODatabaseModelImpl::disposing: where does this come from?" );
}
}
//------------------------------------------------------------------------------
@@ -662,9 +774,11 @@ void ODatabaseModelImpl::dispose()
try
{
- sal_Bool bStore = commitEmbeddedStorage();
+ sal_Bool bCouldStore = commitEmbeddedStorage( true );
+ // "true" means that committing the embedded storage should not trigger committing the root
+ // storage. This is because we are going to commit the root storage ourself, anyway
disposeStorages();
- if ( bStore )
+ if ( bCouldStore )
commitRootStorage();
impl_switchToStorage_throw( NULL );
@@ -731,27 +845,9 @@ Sequence< PropertyValue > ODatabaseModelImpl::stripLoadArguments( const ::comphe
// -----------------------------------------------------------------------------
void ODatabaseModelImpl::disposeStorages() SAL_THROW(())
{
- m_bDisposingSubStorages = sal_True;
-
- TStorages::iterator aEnd = m_aStorages.end();
- for ( TStorages::iterator aIter = m_aStorages.begin();
- aIter != aEnd ;
- ++aIter
- )
- {
- try
- {
- ::comphelper::disposeComponent( aIter->second );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- m_aStorages.clear();
-
- m_bDisposingSubStorages = sal_False;
+ getDocumentStorageAccess()->disposeStorages();
}
+
// -----------------------------------------------------------------------------
Reference< XSingleServiceFactory > ODatabaseModelImpl::createStorageFactory() const
{
@@ -849,68 +945,11 @@ Reference< XDocumentSubStorageSupplier > ODatabaseModelImpl::getDocumentSubStora
{
return getDocumentStorageAccess();
}
-// -----------------------------------------------------------------------------
-Reference<XStorage> ODatabaseModelImpl::getStorage( const ::rtl::OUString& _sStorageName, sal_Int32 _nMode )
-{
- OSL_ENSURE(_sStorageName.getLength(),"ODatabaseModelImpl::getStorage: Invalid storage name!");
- Reference<XStorage> xStorage;
- TStorages::iterator aFind = m_aStorages.find(_sStorageName);
- if ( aFind == m_aStorages.end() )
- {
- try
- {
- Reference< XStorage > xMyStorage( getOrCreateRootStorage() );
- if ( xMyStorage.is() )
- {
- sal_Int32 nMode = m_bDocumentReadOnly ? ElementModes::READ : _nMode;
- if ( nMode == ElementModes::READ )
- {
- Reference< XNameAccess > xSubStorageNames( xMyStorage, UNO_QUERY );
- if ( xSubStorageNames.is() && !xSubStorageNames->hasByName( _sStorageName ) )
- return xStorage;
- }
- xStorage = xMyStorage->openStorageElement( _sStorageName, nMode );
- Reference< XTransactionBroadcaster > xBroad( xStorage, UNO_QUERY );
- if ( xBroad.is() )
- xBroad->addTransactionListener( getDocumentStorageAccess() );
- aFind = m_aStorages.insert( TStorages::value_type( _sStorageName, xStorage ) ).first;
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- if ( aFind != m_aStorages.end() )
- xStorage = aFind->second;
-
- return xStorage;
-}
// -----------------------------------------------------------------------------
-sal_Bool ODatabaseModelImpl::commitEmbeddedStorage( sal_Bool _bPreventRootCommits )
+bool ODatabaseModelImpl::commitEmbeddedStorage( bool _bPreventRootCommits )
{
- if ( _bPreventRootCommits && m_pStorageAccess )
- m_pStorageAccess->suspendCommitPropagation();
-
- sal_Bool bStore = sal_False;
- try
- {
- TStorages::iterator aFind = m_aStorages.find(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("database")));
- if ( aFind != m_aStorages.end() )
- bStore = commitStorageIfWriteable(aFind->second);
- }
- catch(Exception&)
- {
- OSL_ENSURE(0,"Exception Caught: Could not store embedded database!");
- }
-
- if ( _bPreventRootCommits && m_pStorageAccess )
- m_pStorageAccess->resumeCommitPropagation();
-
- return bStore;
-
+ return getDocumentStorageAccess()->commitEmbeddedStorage( _bPreventRootCommits );
}
// -----------------------------------------------------------------------------
@@ -1006,6 +1045,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 +1061,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@sun.com
+ xModel->attachResource( xModel->getURL(), m_aArgs );
+ }
+
if ( _bInitialize )
{
try
@@ -1059,18 +1111,13 @@ oslInterlockedCount SAL_CALL ODatabaseModelImpl::release()
// -----------------------------------------------------------------------------
void ODatabaseModelImpl::commitStorages() SAL_THROW(( IOException, RuntimeException ))
{
- try
- {
- TStorages::iterator aIter = m_aStorages.begin();
- TStorages::iterator aEnd = m_aStorages.end();
- for (; aIter != aEnd ; ++aIter)
- commitStorageIfWriteable( aIter->second );
- }
- catch(const WrappedTargetException&)
- {
- // WrappedTargetException not allowed to leave
- throw IOException();
- }
+ getDocumentStorageAccess()->commitStorages();
+}
+
+// -----------------------------------------------------------------------------
+Reference< XStorage > ODatabaseModelImpl::getStorage( const ObjectType _eType, const sal_Int32 _nDesiredMode )
+{
+ return getDocumentStorageAccess()->getDocumentSubStorage( getObjectContainerStorageName( _eType ), _nDesiredMode );
}
// -----------------------------------------------------------------------------
@@ -1160,7 +1207,7 @@ TContentPtr& ODatabaseModelImpl::getObjectContainer( ObjectType _eType )
void ODatabaseModelImpl::revokeDataSource() const
{
if ( m_pDBContext && m_sDocumentURL.getLength() )
- m_pDBContext->deregisterPrivate( m_sDocumentURL );
+ m_pDBContext->revokeDatabaseDocument( *this );
}
// -----------------------------------------------------------------------------
@@ -1310,16 +1357,10 @@ Reference< XStorage > ODatabaseModelImpl::impl_switchToStorage_throw( const Refe
void ODatabaseModelImpl::switchToURL( const ::rtl::OUString& _rDocumentLocation, const ::rtl::OUString& _rDocumentURL )
{
// register at the database context, or change registration
- if ( _rDocumentURL != m_sDocumentURL )
+ const bool bURLChanged = ( _rDocumentURL != m_sDocumentURL );
+ const ::rtl::OUString sOldURL( m_sDocumentURL );
+ if ( bURLChanged )
{
- if ( m_pDBContext )
- {
- if ( m_sDocumentURL.getLength() )
- m_pDBContext->nameChangePrivate( m_sDocumentURL, _rDocumentURL );
- else
- m_pDBContext->registerPrivate( _rDocumentURL, this );
- }
-
if ( ( m_sName == m_sDocumentURL ) // our name is our old URL
|| ( !m_sName.getLength() ) // we do not have a name, yet (i.e. are not registered at the database context)
)
@@ -1336,19 +1377,14 @@ void ODatabaseModelImpl::switchToURL( const ::rtl::OUString& _rDocumentLocation,
// remember both
m_sDocFileLocation = _rDocumentLocation.getLength() ? _rDocumentLocation : _rDocumentURL;
m_sDocumentURL = _rDocumentURL;
-}
-// -----------------------------------------------------------------------------
-bool ODatabaseModelImpl::isDatabaseStorage( const Reference< XStorage >& _rxStorage ) const
-{
- TStorages::const_iterator pos = m_aStorages.find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "database" ) ) );
- if ( ( pos != m_aStorages.end() )
- && ( pos->second == _rxStorage )
- )
+ if ( bURLChanged && m_pDBContext )
{
- return true;
+ if ( sOldURL.getLength() )
+ m_pDBContext->databaseDocumentURLChange( sOldURL, m_sDocumentURL );
+ else
+ m_pDBContext->registerDatabaseDocument( *this );
}
- return false;
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx
index dd194829bb51..4dd72cf5b319 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.hxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx
@@ -162,8 +162,6 @@ private:
//============================================================
//= ODatabaseModelImpl
//============================================================
-DECLARE_STL_USTRINGACCESS_MAP(::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >,TStorages);
-
typedef ::utl::SharedUNOComponent< ::com::sun::star::embed::XStorage > SharedStorage;
class ODatabaseContext;
@@ -201,7 +199,6 @@ private:
::comphelper::SharedMutex m_aMutex;
VosMutexFacade m_aMutexFacade;
::std::vector< TContentPtr > m_aContainer; // one for each ObjectType
- TStorages m_aStorages;
::sfx2::DocumentMacroMode m_aMacroMode;
sal_Int16 m_nImposedMacroExecMode;
@@ -261,7 +258,6 @@ public:
sal_Bool m_bSuppressVersionColumns : 1;
sal_Bool m_bModified : 1;
sal_Bool m_bDocumentReadOnly : 1;
- sal_Bool m_bDisposingSubStorages;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyAccess >
m_xSettings;
::com::sun::star::uno::Sequence< ::rtl::OUString > m_aTableFilter;
@@ -286,10 +282,9 @@ public:
call.
@return <TRUE/> if the storage could be commited, otherwise <FALSE/>
*/
- sal_Bool commitEmbeddedStorage( sal_Bool _bPreventRootCommits = sal_False );
+ bool commitEmbeddedStorage( bool _bPreventRootCommits = false );
- /** commits all storages storages which have been obtained via getStorage
- */
+ /// commits all sub storages
void commitStorages()
SAL_THROW(( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException ));
@@ -315,7 +310,10 @@ public:
inline ::rtl::OUString getURL() const { return m_sDocumentURL; }
inline ::rtl::OUString getDocFileLocation() const { return m_sDocFileLocation; }
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage> getStorage(const ::rtl::OUString& _sStorageName,sal_Int32 nMode = ::com::sun::star::embed::ElementModes::READWRITE);
+ ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ getStorage(
+ const ObjectType _eType, const sal_Int32 _nDesiredMode = ::com::sun::star::embed::ElementModes::READWRITE );
+
// helper
const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >&
getNumberFormatsSupplier();
@@ -422,10 +420,6 @@ public:
*/
TContentPtr& getObjectContainer( const ObjectType _eType );
- /** determines whether the given storage is the storage of our embedded database (named "database"), if any
- */
- bool isDatabaseStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& _rxStorage ) const;
-
/** returns the name of the storage which is used to stored objects of the given type, if applicable
*/
static ::rtl::OUString
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx
index cae64615b1de..648ae12365b4 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.cxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.cxx
@@ -340,12 +340,12 @@ Reference< XInterface > ODatabaseContext::getRegisteredObject(const rtl::OUStri
Reference< XInterface > ODatabaseContext::loadObjectFromURL(const ::rtl::OUString& _rName,const ::rtl::OUString& _sURL)
{
INetURLObject aURL( _sURL );
- if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
- throw NoSuchElementException(_rName, *this);
+ if ( aURL.GetProtocol() == INET_PROT_NOT_VALID )
+ throw NoSuchElementException( _rName, *this );
try
{
- ::ucbhelper::Content aContent(_sURL,Reference< ::com::sun::star::ucb::XCommandEnvironment >());
+ ::ucbhelper::Content aContent( _sURL, NULL );
if ( !aContent.isDocument() )
throw InteractiveIOException(
_sURL, *this, InteractionClassification_ERROR, IOErrorCode_NO_FILE
@@ -366,30 +366,23 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const ::rtl::OUStrin
SQLException aError;
aError.Message = sErrorMessage;
- throw WrappedTargetException( _sURL, Reference< XNamingService >( this ), makeAny( aError ) );
+ throw WrappedTargetException( _sURL, *this, makeAny( aError ) );
}
- throw WrappedTargetException( _sURL, Reference< XNamingService >( this ), ::cppu::getCaughtException() );
+ throw WrappedTargetException( _sURL, *this, ::cppu::getCaughtException() );
}
catch( const Exception& )
{
- throw WrappedTargetException( _sURL, Reference<XNamingService>(this), ::cppu::getCaughtException() );
+ throw WrappedTargetException( _sURL, *this, ::cppu::getCaughtException() );
}
- ::rtl::Reference< ODatabaseModelImpl > pExistent;
- ObjectCache::iterator aFind = m_aDatabaseObjects.find(_sURL);
-
- if ( aFind != m_aDatabaseObjects.end() ) // we found a object registered under the URL
- { // register it under the new name
- pExistent = aFind->second;
- m_aDatabaseObjects.insert( ObjectCache::value_type( _rName, pExistent.get() ) );
- m_aDatabaseObjects.erase( aFind );
- }
+ OSL_ENSURE( m_aDatabaseObjects.find( _sURL ) == m_aDatabaseObjects.end(),
+ "ODatabaseContext::loadObjectFromURL: not intended for already-cached objects!" );
- if ( !pExistent.get() )
+ ::rtl::Reference< ODatabaseModelImpl > pModelImpl;
{
- pExistent.set( new ODatabaseModelImpl( _rName, m_aContext.getLegacyServiceFactory(), *this ) );
+ pModelImpl.set( new ODatabaseModelImpl( _rName, m_aContext.getLegacyServiceFactory(), *this ) );
- Reference< XModel > xModel( pExistent->createNewModel_deliverOwnership( false ), UNO_SET_THROW );
+ Reference< XModel > xModel( pModelImpl->createNewModel_deliverOwnership( false ), UNO_SET_THROW );
Reference< XLoadable > xLoad( xModel, UNO_QUERY_THROW );
::comphelper::NamedValueCollection aArgs;
@@ -402,11 +395,11 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const ::rtl::OUStrin
xModel->attachResource( _sURL, aResource );
::utl::CloseableComponent aEnsureClose( xModel );
- } // if ( !pExistent.get() )
+ }
- setTransientProperties( _sURL, *pExistent );
+ setTransientProperties( _sURL, *pModelImpl );
- return pExistent->getOrCreateDataSource().get();
+ return pModelImpl->getOrCreateDataSource().get();
}
// -----------------------------------------------------------------------------
void ODatabaseContext::appendAtTerminateListener(const ODatabaseModelImpl& _rDataSourceModel)
@@ -524,6 +517,8 @@ void ODatabaseContext::storeTransientProperties( ODatabaseModelImpl& _rModelImpl
}
else if ( m_aDatabaseObjects.find( _rModelImpl.m_sName ) != m_aDatabaseObjects.end() )
{
+ OSL_ENSURE( false, "ODatabaseContext::storeTransientProperties: a database document register by name? This shouldn't happen anymore!" );
+ // all the code should have been changed so that registration is by URL only
m_aDatasourceProperties[ _rModelImpl.m_sName ] = aRememberProps.getPropertyValues();
}
else
@@ -548,11 +543,9 @@ void SAL_CALL ODatabaseContext::removeContainerListener( const Reference< XConta
//------------------------------------------------------------------------------
void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exception, RuntimeException )
{
- MutexGuard aGuard(m_aMutex);
+ ClearableMutexGuard aGuard(m_aMutex);
::connectivity::checkDisposed(DatabaseAccessContext_Base::rBHelper.bDisposed);
- Reference< XInterface > xExistent;
-
::rtl::OUString sURL = getDatabaseLocation( _rName );
revokeDatabaseLocation( _rName );
@@ -560,20 +553,20 @@ void ODatabaseContext::revokeObject(const rtl::OUString& _rName) throw( Exceptio
if ( m_aDatabaseObjects.find( _rName ) != m_aDatabaseObjects.end() )
{
+ OSL_ENSURE( false, "ODatabaseContext::revokeObject: a database document register by name? This shouldn't happen anymore!" );
+ // all the code should have been changed so that registration is by URL only
m_aDatasourceProperties[ sURL ] = m_aDatasourceProperties[ _rName ];
}
// check if URL is already loaded
- ObjectCacheIterator aExistent = m_aDatabaseObjects.find(sURL);
+ ObjectCacheIterator aExistent = m_aDatabaseObjects.find( sURL );
if ( aExistent != m_aDatabaseObjects.end() )
- m_aDatabaseObjects.erase(aExistent);
+ m_aDatabaseObjects.erase( aExistent );
// notify our container listeners
- ContainerEvent aEvent(static_cast<XContainer*>(this), makeAny(_rName), Any(), makeAny(xExistent));
- // note that xExistent may be empty, in case somebody removed the data source while it is not alive at this moment
- OInterfaceIteratorHelper aListenerLoop(m_aContainerListeners);
- while (aListenerLoop.hasMoreElements())
- static_cast<XContainerListener*>(aListenerLoop.next())->elementRemoved(aEvent);
+ ContainerEvent aEvent( *this, makeAny( _rName ), Any(), Any() );
+ aGuard.clear();
+ m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvent );
}
//------------------------------------------------------------------------------
@@ -666,9 +659,9 @@ Any ODatabaseContext::getByName(const rtl::OUString& _rName) throw( NoSuchElemen
try
{
- Reference< XInterface > xExistent = getObject(_rName);
+ Reference< XInterface > xExistent = getObject( _rName );
if ( xExistent.is() )
- return makeAny(xExistent);
+ return makeAny( xExistent );
// see whether this is an registered name
::rtl::OUString sURL;
@@ -725,36 +718,53 @@ sal_Bool ODatabaseContext::hasByName(const rtl::OUString& _rName) throw( Runtime
}
// -----------------------------------------------------------------------------
-Reference< XInterface > ODatabaseContext::getObject(const ::rtl::OUString& _rName)
+Reference< XInterface > ODatabaseContext::getObject( const ::rtl::OUString& _rURL )
{
- ObjectCacheIterator aFind = m_aDatabaseObjects.find(_rName);
+ ObjectCacheIterator aFind = m_aDatabaseObjects.find( _rURL );
Reference< XInterface > xExistent;
if ( aFind != m_aDatabaseObjects.end() )
xExistent = aFind->second->getOrCreateDataSource();
return xExistent;
}
// -----------------------------------------------------------------------------
-void ODatabaseContext::registerPrivate(const ::rtl::OUString& _sName
- ,const ::rtl::Reference<ODatabaseModelImpl>& _pModelImpl)
+void ODatabaseContext::registerDatabaseDocument( ODatabaseModelImpl& _rModelImpl )
{
- // OSL_ENSURE(m_aDatabaseObjects.find(_sName) == m_aDatabaseObjects.end(),"Name already exists!");
- if ( m_aDatabaseObjects.find(_sName) == m_aDatabaseObjects.end() )
+ ::rtl::OUString sURL( _rModelImpl.getURL() );
+#if OSL_DEBUG_LEVEL > 1
+ OSL_TRACE( "DatabaseContext: registering %s", ::rtl::OUStringToOString( sURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+#endif
+ if ( m_aDatabaseObjects.find( sURL ) == m_aDatabaseObjects.end() )
{
- m_aDatabaseObjects.insert(ObjectCache::value_type(_sName,_pModelImpl.get()));
- setTransientProperties( _sName, *_pModelImpl );
+ m_aDatabaseObjects[ sURL ] = &_rModelImpl;
+ setTransientProperties( sURL, _rModelImpl );
}
+ else
+ OSL_ENSURE( false, "ODatabaseContext::registerDatabaseDocument: already have an object registered for this URL!" );
}
// -----------------------------------------------------------------------------
-void ODatabaseContext::deregisterPrivate(const ::rtl::OUString& _sName)
+void ODatabaseContext::revokeDatabaseDocument( const ODatabaseModelImpl& _rModelImpl )
{
- m_aDatabaseObjects.erase(_sName);
+ ::rtl::OUString sURL( _rModelImpl.getURL() );
+#if OSL_DEBUG_LEVEL > 1
+ OSL_TRACE( "DatabaseContext: deregistering %s", ::rtl::OUStringToOString( sURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+#endif
+ m_aDatabaseObjects.erase( sURL );
}
// -----------------------------------------------------------------------------
-void ODatabaseContext::nameChangePrivate(const ::rtl::OUString& _sOldName, const ::rtl::OUString& _sNewName)
-{
- ObjectCache::iterator aFind = m_aDatabaseObjects.find(_sOldName);
- registerPrivate(_sNewName,aFind->second);
- m_aDatabaseObjects.erase(aFind);
+void ODatabaseContext::databaseDocumentURLChange( const ::rtl::OUString& _rOldURL, const ::rtl::OUString& _rNewURL )
+{
+#if OSL_DEBUG_LEVEL > 1
+ OSL_TRACE( "DatabaseContext: changing registration from %s to %s",
+ ::rtl::OUStringToOString( _rOldURL, RTL_TEXTENCODING_UTF8 ).getStr(),
+ ::rtl::OUStringToOString( _rNewURL, RTL_TEXTENCODING_UTF8 ).getStr() );
+#endif
+ ObjectCache::iterator oldPos = m_aDatabaseObjects.find( _rOldURL );
+ ENSURE_OR_THROW( oldPos != m_aDatabaseObjects.end(), "illegal old database document URL" );
+ ObjectCache::iterator newPos = m_aDatabaseObjects.find( _rNewURL );
+ ENSURE_OR_THROW( newPos == m_aDatabaseObjects.end(), "illegal new database document URL" );
+
+ m_aDatabaseObjects[ _rNewURL ] = oldPos->second;
+ m_aDatabaseObjects.erase( oldPos );
}
// -----------------------------------------------------------------------------
sal_Int64 SAL_CALL ODatabaseContext::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException)
diff --git a/dbaccess/source/core/dataaccess/databasecontext.hxx b/dbaccess/source/core/dataaccess/databasecontext.hxx
index 2eaf663e9796..5d05c2091fd1 100644
--- a/dbaccess/source/core/dataaccess/databasecontext.hxx
+++ b/dbaccess/source/core/dataaccess/databasecontext.hxx
@@ -97,7 +97,7 @@ private:
*/
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > loadObjectFromURL(const ::rtl::OUString& _rName,const ::rtl::OUString& _sURL);
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getObject(const ::rtl::OUString& _rName);
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getObject( const ::rtl::OUString& _rURL );
/** sets all properties which were transient at the data source. e.g. password
@param _sURL The file URL of the data source
@@ -192,10 +192,9 @@ public:
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
- void registerPrivate(const ::rtl::OUString& _sName
- ,const ::rtl::Reference<ODatabaseModelImpl>& _pModelImpl);
- void deregisterPrivate(const ::rtl::OUString& _sName);
- void nameChangePrivate(const ::rtl::OUString& _sOldName, const ::rtl::OUString& _sNewName);
+ void registerDatabaseDocument( ODatabaseModelImpl& _rModelImpl);
+ void revokeDatabaseDocument( const ODatabaseModelImpl& _rModelImpl);
+ void databaseDocumentURLChange(const ::rtl::OUString& _sOldName, const ::rtl::OUString& _sNewName);
void storeTransientProperties( ODatabaseModelImpl& _rModelImpl);
void appendAtTerminateListener(const ODatabaseModelImpl& _rDataSourceModel);
void removeFromTerminateListener(const ODatabaseModelImpl& _rDataSourceModel);
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 8c8469f065e9..88605f05e1c7 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -40,18 +40,10 @@
#include "documenteventexecutor.hxx"
#include "databasecontext.hxx"
#include "documentcontainer.hxx"
-
-#include <comphelper/documentconstants.hxx>
-#include <comphelper/namedvaluecollection.hxx>
-#include <comphelper/enumhelper.hxx>
-#include <comphelper/numberedcollection.hxx>
-#include <comphelper/genericpropertyset.hxx>
-#include <comphelper/property.hxx>
-#include <svtools/saveopt.hxx>
-
-#include <framework/titlehelper.hxx>
+#include "sdbcoretools.hxx"
/** === begin UNO includes === **/
+#include <com/sun/star/beans/Optional.hpp>
#include <com/sun/star/document/XExporter.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XImporter.hpp>
@@ -74,14 +66,17 @@
/** === end UNO includes === **/
#include <comphelper/documentconstants.hxx>
-#include <comphelper/interaction.hxx>
#include <comphelper/enumhelper.hxx>
+#include <comphelper/genericpropertyset.hxx>
+#include <comphelper/interaction.hxx>
#include <comphelper/mediadescriptor.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/numberedcollection.hxx>
+#include <comphelper/property.hxx>
#include <comphelper/storagehelper.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <framework/titlehelper.hxx>
+#include <svtools/saveopt.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <tools/errcode.hxx>
@@ -178,6 +173,7 @@ ODatabaseDocument::ODatabaseDocument(const ::rtl::Reference<ODatabaseModelImpl>&
,m_bAllowDocumentScripting( false )
{
DBG_CTOR(ODatabaseDocument,NULL);
+ OSL_TRACE( "DD: ctor: %p: %p", this, m_pImpl.get() );
osl_incrementInterlockedCount( &m_refCount );
{
@@ -195,14 +191,25 @@ 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.
+ // #i105505# / 2009-10-01 / frank.schoenheit@sun.com
+ m_aViewMonitor.onLoadedDocument();
+ }
}
}
//--------------------------------------------------------------------------
ODatabaseDocument::~ODatabaseDocument()
{
+ OSL_TRACE( "DD: dtor: %p: %p", this, m_pImpl.get() );
DBG_DTOR(ODatabaseDocument,NULL);
if ( !ODatabaseDocument_OfficeDocument::rBHelper.bInDispose && !ODatabaseDocument_OfficeDocument::rBHelper.bDisposed )
{
@@ -561,6 +568,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" );
}
@@ -807,13 +816,11 @@ void ODatabaseDocument::impl_storeAs_throw( const ::rtl::OUString& _rURL, const
throw;
}
- Exception aExcept;
- aError >>= aExcept;
-
- ::rtl::OUString sErrorMessage = ResourceManager::loadString(
+ ::rtl::OUString sErrorMessage = extractExceptionMessage( m_pImpl->m_aContext, aError );
+ sErrorMessage = ResourceManager::loadString(
RID_STR_ERROR_WHILE_SAVING,
- "$except$", aError.getValueTypeName(),
- "$message$", aExcept.Message
+ "$location$", _rURL,
+ "$message$", sErrorMessage
);
throw IOException( sErrorMessage, *this );
}
@@ -979,10 +986,11 @@ void SAL_CALL ODatabaseDocument::storeToURL( const ::rtl::OUString& _rURL, const
Exception aExcept;
aError >>= aExcept;
- ::rtl::OUString sErrorMessage = ResourceManager::loadString(
+ ::rtl::OUString sErrorMessage = extractExceptionMessage( m_pImpl->m_aContext, aError );
+ sErrorMessage = ResourceManager::loadString(
RID_STR_ERROR_WHILE_SAVING,
- "$except$", aError.getValueTypeName(),
- "$message$", aExcept.Message
+ "$location$", _rURL,
+ "$message$", sErrorMessage
);
throw IOException( sErrorMessage, *this );
}
@@ -1356,6 +1364,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;
@@ -1444,6 +1470,7 @@ void ODatabaseDocument::impl_notifyStorageChange_nolck_nothrow( const Reference<
//------------------------------------------------------------------------------
void ODatabaseDocument::disposing()
{
+ OSL_TRACE( "DD: disp: %p: %p", this, m_pImpl.get() );
if ( !m_pImpl.is() )
{
// this means that we're already disposed
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 3f33bc226aa2..e0d3f10aed8d 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -199,8 +199,6 @@ void SAL_CALL FlushNotificationAdapter::flushed( const EventObject& rEvent ) thr
//--------------------------------------------------------------------
void SAL_CALL FlushNotificationAdapter::disposing( const EventObject& Source ) throw (RuntimeException)
{
- DBG_ASSERT( Source.Source == m_aBroadcaster.get(), "FlushNotificationAdapter::disposing: where did this come from?" );
-
Reference< XFlushListener > xListener( m_aListener );
if ( xListener.is() )
xListener->disposing( Source );
@@ -561,21 +559,22 @@ extern "C" void SAL_CALL createRegistryInfo_ODatabaseSource()
//--------------------------------------------------------------------------
ODatabaseSource::ODatabaseSource(const ::rtl::Reference<ODatabaseModelImpl>& _pImpl)
:ModelDependentComponent( _pImpl )
- ,OSubComponent( getMutex(), Reference< XInterface >() )
- ,OPropertySetHelper(OComponentHelper::rBHelper)
+ ,ODatabaseSource_Base( getMutex() )
+ ,OPropertySetHelper( ODatabaseSource_Base::rBHelper )
,m_aBookmarks( *this, getMutex() )
,m_aFlushListeners( getMutex() )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::ODatabaseSource" );
// some kind of default
DBG_CTOR(ODatabaseSource,NULL);
+ OSL_TRACE( "DS: ctor: %p: %p", this, m_pImpl.get() );
}
//--------------------------------------------------------------------------
ODatabaseSource::~ODatabaseSource()
{
+ OSL_TRACE( "DS: dtor: %p: %p", this, m_pImpl.get() );
DBG_DTOR(ODatabaseSource,NULL);
- if ( !OComponentHelper::rBHelper.bInDispose && !OComponentHelper::rBHelper.bDisposed )
+ if ( !ODatabaseSource_Base::rBHelper.bInDispose && !ODatabaseSource_Base::rBHelper.bDisposed )
{
acquire();
dispose();
@@ -603,11 +602,8 @@ Sequence< Type > ODatabaseSource::getTypes() throw (RuntimeException)
::getCppuType( (const Reference< XMultiPropertySet > *)0 ));
return ::comphelper::concatSequences(
- ::comphelper::concatSequences(
- OSubComponent::getTypes(),
- aPropertyHelperTypes.getTypes()
- ),
- ODatabaseSource_Base::getTypes()
+ ODatabaseSource_Base::getTypes(),
+ aPropertyHelperTypes.getTypes()
);
}
@@ -633,39 +629,26 @@ Sequence< sal_Int8 > ODatabaseSource::getImplementationId() throw (RuntimeExcept
Any ODatabaseSource::queryInterface( const Type & rType ) throw (RuntimeException)
{
//RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::queryInterface" );
- Any aIface = OSubComponent::queryInterface( rType );
- if (!aIface.hasValue())
- {
- aIface = ODatabaseSource_Base::queryInterface( rType );
- if ( !aIface.hasValue() )
- {
- aIface = ::cppu::queryInterface(
- rType,
- static_cast< XPropertySet* >( this ),
- static_cast< XFastPropertySet* >( this ),
- static_cast< XMultiPropertySet* >( this ));
- }
- }
+ Any aIface = ODatabaseSource_Base::queryInterface( rType );
+ if ( !aIface.hasValue() )
+ aIface = ::cppu::OPropertySetHelper::queryInterface( rType );
return aIface;
}
//--------------------------------------------------------------------------
void ODatabaseSource::acquire() throw ()
{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::acquire" );
- OSubComponent::acquire();
+ ODatabaseSource_Base::acquire();
}
//--------------------------------------------------------------------------
void ODatabaseSource::release() throw ()
{
- //RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::release" );
- OSubComponent::release();
+ ODatabaseSource_Base::release();
}
// -----------------------------------------------------------------------------
void SAL_CALL ODatabaseSource::disposing( const ::com::sun::star::lang::EventObject& Source ) throw(RuntimeException)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::disposing" );
if ( m_pImpl.is() )
m_pImpl->disposing(Source);
}
@@ -719,8 +702,8 @@ sal_Bool ODatabaseSource::supportsService( const ::rtl::OUString& _rServiceName
//------------------------------------------------------------------------------
void ODatabaseSource::disposing()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::disposing" );
- OSubComponent::disposing();
+ OSL_TRACE( "DS: disp: %p, %p", this, m_pImpl.get() );
+ ODatabaseSource_Base::WeakComponentImplHelperBase::disposing();
OPropertySetHelper::disposing();
EventObject aDisposeEvent(static_cast<XWeak*>(this));
diff --git a/dbaccess/source/core/dataaccess/datasource.hxx b/dbaccess/source/core/dataaccess/datasource.hxx
index 4fa86beccfef..5e4dd7dc8ab5 100644
--- a/dbaccess/source/core/dataaccess/datasource.hxx
+++ b/dbaccess/source/core/dataaccess/datasource.hxx
@@ -70,11 +70,8 @@
#ifndef _CPPUHELPER_WEAKREF_HXX_
#include <cppuhelper/weakref.hxx>
#endif
-#ifndef _CPPUHELPER_IMPLBASE11_HXX_
-#include <cppuhelper/implbase11.hxx>
-#endif
-#ifndef _CPPUHELPER_IMPLBASE12_HXX_
-#include <cppuhelper/implbase12.hxx>
+#ifndef _CPPUHELPER_COMPBASE11_HXX_
+#include <cppuhelper/compbase11.hxx>
#endif
#ifndef _COM_SUN_STAR_EMBED_XTRANSACTIONLISTENER_HPP_
#include <com/sun/star/embed/XTransactionListener.hpp>
@@ -142,32 +139,31 @@ class OChildCommitListen_Impl;
//============================================================
//= ODatabaseSource
//============================================================
-typedef ::cppu::ImplHelper11 < ::com::sun::star::lang::XServiceInfo
- , ::com::sun::star::sdbc::XDataSource
- , ::com::sun::star::sdb::XBookmarksSupplier
- , ::com::sun::star::sdb::XQueryDefinitionsSupplier
- , ::com::sun::star::sdb::XCompletedConnection
- , ::com::sun::star::container::XContainerListener
- , ::com::sun::star::sdbc::XIsolatedConnection
- , ::com::sun::star::sdbcx::XTablesSupplier
- , ::com::sun::star::util::XFlushable
- , ::com::sun::star::util::XFlushListener
- , ::com::sun::star::sdb::XDocumentDataSource
- > ODatabaseSource_Base;
+typedef ::cppu::WeakComponentImplHelper11 < ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::sdbc::XDataSource
+ , ::com::sun::star::sdb::XBookmarksSupplier
+ , ::com::sun::star::sdb::XQueryDefinitionsSupplier
+ , ::com::sun::star::sdb::XCompletedConnection
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::sdbc::XIsolatedConnection
+ , ::com::sun::star::sdbcx::XTablesSupplier
+ , ::com::sun::star::util::XFlushable
+ , ::com::sun::star::util::XFlushListener
+ , ::com::sun::star::sdb::XDocumentDataSource
+ > ODatabaseSource_Base;
class ODatabaseSource :public ModelDependentComponent // must be first
- ,public OSubComponent
+ ,public ODatabaseSource_Base
,public ::cppu::OPropertySetHelper
,public ::comphelper::OPropertyArrayUsageHelper < ODatabaseSource >
- ,public ODatabaseSource_Base
{
friend class ODatabaseContext;
friend class OConnection;
friend class OSharedConnectionManager;
private:
-
+ using ODatabaseSource_Base::rBHelper;
OBookmarkContainer m_aBookmarks;
::cppu::OInterfaceContainerHelper m_aFlushListeners;
diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx
index 96cae44e6a3e..7334e72a1ffc 100644
--- a/dbaccess/source/core/dataaccess/documentcontainer.cxx
+++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx
@@ -710,7 +710,7 @@ void SAL_CALL ODocumentContainer::revert( ) throw (::com::sun::star::io::IOExce
Reference< XStorage> ODocumentContainer::getContainerStorage() const
{
return m_pImpl->m_pDataSource
- ? m_pImpl->m_pDataSource->getStorage( ODatabaseModelImpl::getObjectContainerStorageName( m_bFormsContainer ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) )
+ ? m_pImpl->m_pDataSource->getStorage( m_bFormsContainer ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT )
: Reference< XStorage>();
}
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index 992fc156d386..e1c12034b49a 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -2052,7 +2052,7 @@ void SAL_CALL ODocumentDefinition::rename( const ::rtl::OUString& _rNewName ) th
Reference< XStorage> ODocumentDefinition::getContainerStorage() const
{
return m_pImpl->m_pDataSource
- ? m_pImpl->m_pDataSource->getStorage( ODatabaseModelImpl::getObjectContainerStorageName( m_bForm ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT ) )
+ ? m_pImpl->m_pDataSource->getStorage( m_bForm ? ODatabaseModelImpl::E_FORM : ODatabaseModelImpl::E_REPORT )
: Reference< XStorage>();
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/core/inc/core_resource.hrc b/dbaccess/source/core/inc/core_resource.hrc
index c3fcb7541c68..2f97249b5b0c 100644
--- a/dbaccess/source/core/inc/core_resource.hrc
+++ b/dbaccess/source/core/inc/core_resource.hrc
@@ -37,7 +37,6 @@
//------------------------------------------------------------------------------
#define RID_CORE_STRINGS_START RID_DBACCESS_START
-#define RID_CORE_OTHER_START RID_DBACCESS_START
//------------------------------------------------------------------------------
//- String-IDs
@@ -89,6 +88,7 @@
#define RID_STR_NAME_NOT_FOUND ( RID_CORE_STRINGS_START + 45 )
#define RID_STR_QUERY_DOES_NOT_EXIST ( RID_CORE_STRINGS_START + 46 )
#define RID_STR_ERROR_WHILE_SAVING ( RID_CORE_STRINGS_START + 47 )
+#define RID_NO_SUCH_DATA_SOURCE ( RID_CORE_STRINGS_START + 48 )
#endif // _DBA_CORE_RESOURCE_HRC_
diff --git a/dbaccess/source/core/inc/core_resource.hxx b/dbaccess/source/core/inc/core_resource.hxx
index 8778bf0204b7..f54df29a6517 100644
--- a/dbaccess/source/core/inc/core_resource.hxx
+++ b/dbaccess/source/core/inc/core_resource.hxx
@@ -110,8 +110,6 @@ namespace dbaccess
const sal_Char* _pPlaceholderAscii2,
const ::rtl::OUString& _rReplace2
);
-
- static ResMgr* getResManager();
};
//=========================================================================
diff --git a/dbaccess/source/core/inc/sdbcoretools.hxx b/dbaccess/source/core/inc/sdbcoretools.hxx
index a7e2b9986f7e..92a163b3d24e 100644
--- a/dbaccess/source/core/inc/sdbcoretools.hxx
+++ b/dbaccess/source/core/inc/sdbcoretools.hxx
@@ -31,12 +31,13 @@
#ifndef DBACORE_SDBCORETOOLS_HXX
#define DBACORE_SDBCORETOOLS_HXX
-#ifndef _COM_SUN_STAR_UTIL_XNUMBERFORMATSSUPPLIER_HPP_
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
#include <com/sun/star/sdbc/XConnection.hpp>
-#endif
+
+namespace comphelper
+{
+ class ComponentContext;
+}
//.........................................................................
namespace dbaccess
@@ -71,6 +72,11 @@ namespace dbaccess
::com::sun::star::uno::Any& /* [out] */ _rSettingsValue
);
+ // -----------------------------------------------------------------------------
+ /** retrieves a to-be-displayed string for a given caught exception;
+ */
+ ::rtl::OUString extractExceptionMessage( const ::comphelper::ComponentContext& _rContext, const ::com::sun::star::uno::Any& _rError );
+
//.........................................................................
} // namespace dbaccess
//.........................................................................
diff --git a/dbaccess/source/core/misc/apitools.cxx b/dbaccess/source/core/misc/apitools.cxx
index 33dd640770e3..f956f26b9071 100644
--- a/dbaccess/source/core/misc/apitools.cxx
+++ b/dbaccess/source/core/misc/apitools.cxx
@@ -101,11 +101,14 @@ void OSubComponent::release() throw ( )
Reference< XInterface > x( xDelegator );
if (! x.is())
{
- if (osl_decrementInterlockedCount( &m_refCount ) == 0 && m_refCount == 0 )
+ if (osl_decrementInterlockedCount( &m_refCount ) == 0 )
{
- OSL_ENSURE( m_refCount == 0, "OSubComponent::release: why the hell is this false!" );
if (! rBHelper.bDisposed)
{
+ // *before* again incrementing our ref count, ensure that our weak connection point
+ // will not create references to us anymore (via XAdapter::queryAdapted)
+ disposeWeakConnectionPoint();
+
Reference< XInterface > xHoldAlive( *this );
// remember the parent
Reference< XInterface > xParent;
@@ -115,13 +118,13 @@ void OSubComponent::release() throw ( )
m_xParent = NULL;
}
- OSL_ENSURE( m_refCount == 1, "OSubComponent::release: invalid ref count!" );
+ OSL_ENSURE( m_refCount == 1, "OSubComponent::release: invalid ref count (before dispose)!" );
// First dispose
dispose();
// only the alive ref holds the object
- OSL_ENSURE( m_refCount == 1, "OSubComponent::release: invalid ref count!" );
+ OSL_ENSURE( m_refCount == 1, "OSubComponent::release: invalid ref count (after dispose)!" );
// release the parent in the ~
if (xParent.is())
diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx
index 48dc51e482f7..672b88c810d4 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,53 +265,40 @@ 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);
- return aFeatures.getOrDefault("Extension",::rtl::OUString());
-}
//-------------------------------------------------------------------------
bool ODsnTypeCollection::isEmbeddedDatabase( const ::rtl::OUString& _sURL ) const
{
diff --git a/dbaccess/source/core/misc/sdbcoretools.cxx b/dbaccess/source/core/misc/sdbcoretools.cxx
index 75a1cd6b36eb..48e08b7ff7e4 100644
--- a/dbaccess/source/core/misc/sdbcoretools.cxx
+++ b/dbaccess/source/core/misc/sdbcoretools.cxx
@@ -31,30 +31,24 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
-#ifndef DBACORE_SDBCORETOOLS_HXX
#include "sdbcoretools.hxx"
-#endif
-#ifndef _TOOLS_DEBUG_HXX
-#include <tools/debug.hxx>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include "dbastrings.hrc"
+
+/** === begin UNO includes === **/
#include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
#include <com/sun/star/beans/PropertyValue.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
#include <com/sun/star/container/XChild.hpp>
-#endif
-#ifndef _COM_SUN_STAR_UTIL_XMODIFIABLE_HPP_
#include <com/sun/star/util/XModifiable.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDB_XDOCUMENTDATASOURCE_HPP_
#include <com/sun/star/sdb/XDocumentDataSource.hpp>
-#endif
-#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
-#include "dbastrings.hrc"
-#endif
+#include <com/sun/star/task/XInteractionRequestStringResolver.hpp>
+/** === end UNO includes === **/
+
+#include <tools/diagnose_ex.h>
+#include <tools/debug.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/interaction.hxx>
+#include <rtl/ref.hxx>
+#include <rtl/ustrbuf.hxx>
//.........................................................................
namespace dbaccess
@@ -67,6 +61,7 @@ namespace dbaccess
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::sdb;
using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::task;
using namespace ::com::sun::star::container;
// =========================================================================
@@ -130,6 +125,45 @@ namespace dbaccess
}
// -----------------------------------------------------------------------------
+ ::rtl::OUString extractExceptionMessage( const ::comphelper::ComponentContext& _rContext, const Any& _rError )
+ {
+ ::rtl::OUString sDisplayMessage;
+
+ try
+ {
+ Reference< XInteractionRequestStringResolver > xStringResolver;
+ if ( _rContext.createComponent( "com.sun.star.task.InteractionRequestStringResolver", xStringResolver ) )
+ {
+ ::rtl::Reference< ::comphelper::OInteractionRequest > pRequest( new ::comphelper::OInteractionRequest( _rError ) );
+ ::rtl::Reference< ::comphelper::OInteractionApprove > pApprove( new ::comphelper::OInteractionApprove );
+ pRequest->addContinuation( pApprove.get() );
+ Optional< ::rtl::OUString > aMessage = xStringResolver->getStringFromInformationalRequest( pRequest.get() );
+ if ( aMessage.IsPresent )
+ sDisplayMessage = aMessage.Value;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ if ( !sDisplayMessage.getLength() )
+ {
+ Exception aExcept;
+ _rError >>= aExcept;
+
+ ::rtl::OUStringBuffer aBuffer;
+ aBuffer.append( _rError.getValueTypeName() );
+ aBuffer.appendAscii( ":\n" );
+ aBuffer.append( aExcept.Message );
+
+ sDisplayMessage = aBuffer.makeStringAndClear();
+ }
+
+ return sDisplayMessage;
+ }
+
+// -----------------------------------------------------------------------------
//.........................................................................
} // namespace dbaccess
//.........................................................................
diff --git a/dbaccess/source/core/resource/core_resource.cxx b/dbaccess/source/core/resource/core_resource.cxx
index dea6ea6b9d9d..ba605eb8ddfe 100644
--- a/dbaccess/source/core/resource/core_resource.cxx
+++ b/dbaccess/source/core/resource/core_resource.cxx
@@ -116,12 +116,6 @@ namespace dbaccess
m_pImpl = NULL;
}
}
- ResMgr* ResourceManager::getResManager()
- {
- ensureImplExists();
- return m_pImpl;
- }
-
//.........................................................................
}
//.........................................................................
diff --git a/dbaccess/source/core/resource/strings.src b/dbaccess/source/core/resource/strings.src
index 2f65a3391dff..3fc3806963a5 100644
--- a/dbaccess/source/core/resource/strings.src
+++ b/dbaccess/source/core/resource/strings.src
@@ -243,7 +243,12 @@ String RID_STR_NAME_NOT_FOUND
String RID_STR_ERROR_WHILE_SAVING
{
- Text [ en-US ] = "Could not save the document:\n\n$except$:\n$message$";
+ Text [ en-US ] = "Could not save the document to $location$:\n$message$";
+};
+
+String RID_NO_SUCH_DATA_SOURCE
+{
+ Text [ en-US ] = "Error accessing data source '$name$':\n$error$";
};
//-------------------------------------------------------------------------
diff --git a/dbaccess/source/ext/macromigration/docinteraction.cxx b/dbaccess/source/ext/macromigration/docinteraction.cxx
index 9f7ded185553..77fba3e97a04 100644
--- a/dbaccess/source/ext/macromigration/docinteraction.cxx
+++ b/dbaccess/source/ext/macromigration/docinteraction.cxx
@@ -89,18 +89,6 @@ namespace dbmm
//= InteractionHandler
//====================================================================
//--------------------------------------------------------------------
- InteractionHandler::InteractionHandler( const ::comphelper::ComponentContext& _rContext )
- :m_pData( new InteractionHandler_Data( _rContext ) )
- {
- }
-
- //--------------------------------------------------------------------
- InteractionHandler::InteractionHandler( const Reference< XInteractionHandler >& _rxHandler )
- :m_pData( new InteractionHandler_Data( _rxHandler ) )
- {
- }
-
- //--------------------------------------------------------------------
InteractionHandler::InteractionHandler( const ::comphelper::ComponentContext& _rContext, const Reference< XModel >& _rxDocument )
:m_pData( new InteractionHandler_Data( _rContext ) )
{
diff --git a/dbaccess/source/ext/macromigration/docinteraction.hxx b/dbaccess/source/ext/macromigration/docinteraction.hxx
index f24bfea7842f..9e9dd73b4651 100644
--- a/dbaccess/source/ext/macromigration/docinteraction.hxx
+++ b/dbaccess/source/ext/macromigration/docinteraction.hxx
@@ -57,15 +57,6 @@ namespace dbmm
{
public:
/** creates an interaction handler by instantiating a css.task.InteractionHandler
- component at the given component context.
- */
- InteractionHandler( const ::comphelper::ComponentContext& _rContext );
-
- /** creates an InteractionHandler instance, using the given existing UNO handler.
- */
- InteractionHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxHandler );
-
- /** creates an interaction handler by instantiating a css.task.InteractionHandler
component at the given component context, or using the given document's interaction handler,
if one is specified in the document's media descriptor.
*/
diff --git a/dbaccess/source/ext/macromigration/progressmixer.cxx b/dbaccess/source/ext/macromigration/progressmixer.cxx
index a59e1a59b7fe..b738376fb051 100644
--- a/dbaccess/source/ext/macromigration/progressmixer.cxx
+++ b/dbaccess/source/ext/macromigration/progressmixer.cxx
@@ -108,12 +108,13 @@ namespace dbmm
//--------------------------------------------------------------------
namespace
{
+#if OSL_DEBUG_LEVEL > 0
//----------------------------------------------------------------
bool lcl_isRunning( const ProgressMixer_Data& _rData )
{
return _rData.pCurrentPhase != _rData.aPhases.end();
}
-
+#endif
//----------------------------------------------------------------
void lcl_ensureInitialized( ProgressMixer_Data& _rData )
{
diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx
index fb9352018689..7310c2ca10ec 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 ec2eb177cd9b..4e9153a6a216 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
@@ -137,9 +139,6 @@ public:
/// get the datasource type display name from a DSN string
String getTypeDisplayName(const ::rtl::OUString& _sURL) const;
- /// returns the extension of the user defined type
- String getTypeExtension(const ::rtl::OUString& _sURL) const;
-
/// on a given string, cut the type prefix and return the result
String cutPrefix(const ::rtl::OUString& _sURL) const;
diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx
index 96ca58d6f428..a8c5d5a97054 100644
--- a/dbaccess/source/ui/app/AppController.hxx
+++ b/dbaccess/source/ui/app/AppController.hxx
@@ -295,15 +295,6 @@ namespace dbaui
/// returns <TRUE/> if the clipboard supports a table format, otherwise <FALSE/>.
sal_Bool isTableFormat() const;
- /** copies a table which was constructed by tags like HTML or RTF
- @param _rDesc
- The Drop descriptor
- @param _bCheck
- If set to <TRUE/> than the controller checks only if a copy is possible.
- */
- sal_Bool copyTagTable( OTableCopyHelper::DropDescriptor& _rDesc
- , sal_Bool _bCheck);
-
/** fills the vector with all supported formats
@param _eType
The type for which we need the formats
diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx
index a509986e8849..2d39783cdb87 100644
--- a/dbaccess/source/ui/app/AppControllerDnD.cxx
+++ b/dbaccess/source/ui/app/AppControllerDnD.cxx
@@ -902,18 +902,6 @@ sal_Bool OApplicationController::isTableFormat() const
return m_aTableCopyHelper.isTableFormat(getViewClipboard());
}
// -----------------------------------------------------------------------------
-sal_Bool OApplicationController::copyTagTable(OTableCopyHelper::DropDescriptor& _rDesc, sal_Bool _bCheck)
-{
- // first get the dest connection
- ::osl::MutexGuard aGuard( getMutex() );
-
- SharedConnection xConnection( ensureConnection() );
- if ( !xConnection.is() )
- return sal_False;
-
- return m_aTableCopyHelper.copyTagTable( _rDesc, _bCheck, xConnection );
-}
-// -----------------------------------------------------------------------------
IMPL_LINK( OApplicationController, OnAsyncDrop, void*, /*NOTINTERESTEDIN*/ )
{
m_nAsyncDrop = 0;
diff --git a/dbaccess/source/ui/app/subcomponentmanager.cxx b/dbaccess/source/ui/app/subcomponentmanager.cxx
index 8ef4f77f20c7..a24fe29b5974 100644
--- a/dbaccess/source/ui/app/subcomponentmanager.cxx
+++ b/dbaccess/source/ui/app/subcomponentmanager.cxx
@@ -125,8 +125,9 @@ namespace dbaui
xModel.set( _rxComponent, UNO_QUERY );
if ( xModel.is() )
{
- xController.set( xModel->getCurrentController(), UNO_SET_THROW );
- xFrame.set( xController->getFrame(), UNO_SET_THROW );
+ xController.set( xModel->getCurrentController() );
+ if ( xController.is() )
+ xFrame.set( xController->getFrame(), UNO_SET_THROW );
}
else
{
@@ -468,13 +469,15 @@ namespace dbaui
// put into map
SubComponentAccessor aKey( _rName, _nComponentType, _eOpenMode );
SubComponentDescriptor aElement( _rxComponent );
+ ENSURE_OR_THROW( aElement.xModel.is() || aElement.xController.is(), "illegal component" );
m_pData->m_aComponents.insert( SubComponentMap::value_type(
aKey, aElement
) ) ;
// add as listener
- aElement.xController->addEventListener( this );
+ if ( aElement.xController.is() )
+ aElement.xController->addEventListener( this );
if ( aElement.xModel.is() )
aElement.xModel->addEventListener( this );
diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx
index f82839664973..8db327fb8b85 100644
--- a/dbaccess/source/ui/browser/brwctrlr.cxx
+++ b/dbaccess/source/ui/browser/brwctrlr.cxx
@@ -1495,7 +1495,10 @@ void SbaXDataBrowserController::errorOccured(const ::com::sun::star::sdb::SQLErr
m_aCurrentError = aInfo;
}
else
+ {
+ m_aCurrentError = aInfo;
m_aAsyncDisplayError.Call();
+ }
}
//------------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx
index 87f924129c16..913dea5c54fe 100644
--- a/dbaccess/source/ui/browser/dbloader.cxx
+++ b/dbaccess/source/ui/browser/dbloader.cxx
@@ -324,7 +324,16 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const ::
}
catch(const Exception&)
{
- DBG_UNHANDLED_EXCEPTION();
+ // Does this need to be shown to the user?
+ bSuccess = false;
+ try
+ {
+ ::comphelper::disposeComponent( xController );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
}
}
@@ -342,7 +351,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const ::
}
else
if ( rListener.is() )
- rListener->loadCancelled( this );
+ rListener->loadCancelled( this );
}
// -----------------------------------------------------------------------
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index a24c2d4e30dc..9d81d9c47c86 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -282,6 +282,7 @@ OGenericUnoController::OGenericUnoController(const Reference< XMultiServiceFacto
}
}
+#ifdef WNT
// -----------------------------------------------------------------------------
OGenericUnoController::OGenericUnoController()
:OGenericUnoController_Base( getMutex() )
@@ -302,6 +303,7 @@ OGenericUnoController::OGenericUnoController()
// we simply abort here.
abort();
}
+#endif
// -----------------------------------------------------------------------------
OGenericUnoController::~OGenericUnoController()
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 9f3403b690c5..b2cfbe04a515 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -3467,7 +3467,7 @@ sal_Bool SbaTableQueryBrowser::isHiContrast() const
{
sal_Bool bRet = sal_False;
if ( m_pTreeView )
- bRet = m_pTreeView->getListBox().GetBackground().GetColor().IsDark();
+ bRet = m_pTreeView->getListBox().GetSettings().GetStyleSettings().GetHighContrastMode();
return bRet;
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index a11d39bdba04..b5bc5f817198 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -568,7 +568,7 @@ namespace
void lcl_insertMenuItemImages( Menu& _rMenu, IController& _rCommandController )
{
const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings();
- const BOOL bHiContrast = rSettings.GetMenuColor().IsDark();
+ const BOOL bHiContrast = rSettings.GetHighContrastMode();
uno::Reference< frame::XController > xController = _rCommandController.getXController();
uno::Reference< frame::XFrame> xFrame;
if ( xController.is() )
diff --git a/dbaccess/source/ui/control/listviewitems.cxx b/dbaccess/source/ui/control/listviewitems.cxx
index dbcdc4dc5138..8fe75d85d57f 100644
--- a/dbaccess/source/ui/control/listviewitems.cxx
+++ b/dbaccess/source/ui/control/listviewitems.cxx
@@ -45,7 +45,9 @@ namespace dbaui
//------------------------------------------------------------------------
void OBoldListboxString::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry, SvViewDataItem* _pViewData)
{
- SvLBoxString::InitViewData(pView,pEntry, _pViewData);
+ SvLBoxString::InitViewData( pView, pEntry, _pViewData );
+ if ( !m_bEmphasized )
+ return;
if (!_pViewData)
_pViewData = pView->GetViewDataItem( pEntry, this );
pView->Push(PUSH_ALL);
diff --git a/dbaccess/source/ui/control/opendoccontrols.cxx b/dbaccess/source/ui/control/opendoccontrols.cxx
index 5b089f764337..12c25ef58a87 100644
--- a/dbaccess/source/ui/control/opendoccontrols.cxx
+++ b/dbaccess/source/ui/control/opendoccontrols.cxx
@@ -210,13 +210,6 @@ namespace dbaui
//= OpenButton
//====================================================================
//--------------------------------------------------------------------
- OpenDocumentButton::OpenDocumentButton( Window* _pParent, const sal_Char* _pAsciiModuleName, WinBits _nStyle )
- :PushButton( _pParent, _nStyle )
- {
- impl_init( _pAsciiModuleName );
- }
-
- //--------------------------------------------------------------------
OpenDocumentButton::OpenDocumentButton( Window* _pParent, const sal_Char* _pAsciiModuleName, const ResId& _rResId )
:PushButton( _pParent, _rResId )
{
@@ -247,13 +240,6 @@ namespace dbaui
//= OpenDocumentListBox
//====================================================================
//--------------------------------------------------------------------
- OpenDocumentListBox::OpenDocumentListBox( Window* _pParent, const sal_Char* _pAsciiModuleName, WinBits _nStyle )
- :ListBox( _pParent, _nStyle )
- {
- impl_init( _pAsciiModuleName );
- }
-
- //--------------------------------------------------------------------
OpenDocumentListBox::OpenDocumentListBox( Window* _pParent, const sal_Char* _pAsciiModuleName, const ResId& _rResId )
:ListBox( _pParent, _rResId )
{
diff --git a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
index 2e155dfb4572..759054d4495e 100644
--- a/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
+++ b/dbaccess/source/ui/dlg/DBSetupConnectionPages.cxx
@@ -952,14 +952,8 @@ DBG_NAME(OFinalDBPageSetup)
aPos.X() = pWindows[i].first->GetPosPixel().X();
Size aSize = pWindows[i].first->GetSizePixel();
FixedText* pText = dynamic_cast<FixedText*>(pWindows[i].first);
- CheckBox* pCheck = dynamic_cast<CheckBox*>(pWindows[i].first);
- RadioButton* pRadio = dynamic_cast<RadioButton*>(pWindows[i].first);
if ( pText )
aSize = pText->CalcMinimumSize(aSize.Width());
- else if ( pRadio )
- aSize = pRadio->CalcMinimumSize(aSize.Width());
- else if ( pCheck )
- aSize = pCheck->CalcMinimumSize(aSize.Width());
pWindows[i].first->SetPosSizePixel(aPos,aSize);
aPos.Y() += aSize.Height() + pWindows[i].second;
}
diff --git a/dbaccess/source/ui/dlg/dbadmin.cxx b/dbaccess/source/ui/dlg/dbadmin.cxx
index ccb904994c23..22d055f13a36 100644
--- a/dbaccess/source/ui/dlg/dbadmin.cxx
+++ b/dbaccess/source/ui/dlg/dbadmin.cxx
@@ -121,16 +121,6 @@ void ODbAdminDialog::PageCreated(USHORT _nId, SfxTabPage& _rPage)
SfxTabDialog::PageCreated(_nId, _rPage);
}
-// -----------------------------------------------------------------------------
-void ODbAdminDialog::removeDetailPages()
-{
- // remove all current detail pages
- while (m_aCurrentDetailPages.size())
- {
- RemoveTabPage((USHORT)m_aCurrentDetailPages.top());
- m_aCurrentDetailPages.pop();
- }
-}
// -----------------------------------------------------------------------------
void ODbAdminDialog::addDetailPage(USHORT _nPageId, USHORT _nTextId, CreateTabPage _pCreateFunc)
diff --git a/dbaccess/source/ui/dlg/dbadminsetup.src b/dbaccess/source/ui/dlg/dbadminsetup.src
index 6f6020d966e9..b26f2eee2e3a 100644
--- a/dbaccess/source/ui/dlg/dbadminsetup.src
+++ b/dbaccess/source/ui/dlg/dbadminsetup.src
@@ -315,7 +315,7 @@ TabPage PAGE_DBWIZARD_FINAL
{
Pos = MAP_APPFONT (START_X , 100 ) ;
Size = MAP_APPFONT ( WIZARD_PAGE_X - START_X - 6 , 8 ) ;
- Text[ en-US ] = "~After the database file has been saved, what do you want to do?" ;
+ Text[ en-US ] = "After the database file has been saved, what do you want to do?" ;
};
CheckBox CB_OPENAFTERWARDS
diff --git a/dbaccess/source/ui/dlg/directsql.cxx b/dbaccess/source/ui/dlg/directsql.cxx
index 4f713e27f277..aa0157174e3d 100644
--- a/dbaccess/source/ui/dlg/directsql.cxx
+++ b/dbaccess/source/ui/dlg/directsql.cxx
@@ -171,13 +171,6 @@ DBG_NAME(DirectSQLDialog)
}
//--------------------------------------------------------------------
- void DirectSQLDialog::addHistoryEntry(const String& _rStatement)
- {
- CHECK_INVARIANTS("DirectSQLDialog::addHistoryEntry");
- implAddToStatementHistory(_rStatement);
- }
-
- //--------------------------------------------------------------------
sal_Int32 DirectSQLDialog::getHistorySize() const
{
CHECK_INVARIANTS("DirectSQLDialog::getHistorySize");
diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx
index 4ee69888124a..c9f145f795f5 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/dlg/indexdialog.cxx b/dbaccess/source/ui/dlg/indexdialog.cxx
index ea082491e85b..1d9dfba5623e 100644
--- a/dbaccess/source/ui/dlg/indexdialog.cxx
+++ b/dbaccess/source/ui/dlg/indexdialog.cxx
@@ -342,7 +342,7 @@ DBG_NAME(DbaIndexDialog)
//------------------------------------------------------------------
void DbaIndexDialog::fillIndexList()
{
- sal_Bool bHiContrast = GetBackground().GetColor().IsDark();
+ sal_Bool bHiContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
Image aPKeyIcon(ModuleRes( bHiContrast ? IMG_PKEYICON_SCH : IMG_PKEYICON));
// fill the list with the index names
m_aIndexes.Clear();
diff --git a/dbaccess/source/ui/inc/databaseobjectview.hxx b/dbaccess/source/ui/inc/databaseobjectview.hxx
index ed6e9a37ec55..07c77e388196 100644
--- a/dbaccess/source/ui/inc/databaseobjectview.hxx
+++ b/dbaccess/source/ui/inc/databaseobjectview.hxx
@@ -280,18 +280,6 @@ namespace dbaui
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame
);
};
- //======================================================================
- //= ReportDesigner
- //======================================================================
- class ReportDesigner : public DatabaseObjectView
- {
- public:
- ReportDesigner(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
- const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::application::XDatabaseDocumentUI >& _rxApplication,
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxParentFrame
- );
- };
// .........................................................................
} // namespace dbaui
// .........................................................................
diff --git a/dbaccess/source/ui/inc/dbadmin.hxx b/dbaccess/source/ui/inc/dbadmin.hxx
index 5c002747a1cc..86e8ef63352c 100644
--- a/dbaccess/source/ui/inc/dbadmin.hxx
+++ b/dbaccess/source/ui/inc/dbadmin.hxx
@@ -114,8 +114,6 @@ public:
protected:
// adds a new detail page and remove all the old ones
void addDetailPage(USHORT _nPageId,USHORT _nTextId,CreateTabPage pCreateFunc);
- // removes all detail pages
- void removeDetailPages();
virtual void PageCreated(USHORT _nId, SfxTabPage& _rPage);
virtual short Ok();
diff --git a/dbaccess/source/ui/inc/directsql.hxx b/dbaccess/source/ui/inc/directsql.hxx
index a6574a26f1f9..89743f92f26e 100644
--- a/dbaccess/source/ui/inc/directsql.hxx
+++ b/dbaccess/source/ui/inc/directsql.hxx
@@ -108,9 +108,6 @@ namespace dbaui
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn);
~DirectSQLDialog();
- /// add an history entry
- void addHistoryEntry(const String& _rStatement);
-
/// number of history entries
sal_Int32 getHistorySize() const;
diff --git a/dbaccess/source/ui/inc/dsmeta.hxx b/dbaccess/source/ui/inc/dsmeta.hxx
index 1052ec7c536c..78ba0db1272e 100644
--- a/dbaccess/source/ui/inc/dsmeta.hxx
+++ b/dbaccess/source/ui/inc/dsmeta.hxx
@@ -78,8 +78,6 @@ namespace dbaui
const FeatureSet& getFeatureSet() const;
/// determines whether or not the data source requires authentication
- AuthenticationMode getAuthentication() const;
-
static AuthenticationMode getAuthentication( const ::rtl::OUString& _sURL );
private:
diff --git a/dbaccess/source/ui/inc/opendoccontrols.hxx b/dbaccess/source/ui/inc/opendoccontrols.hxx
index 4333b91db0a9..d363b9a91e48 100644
--- a/dbaccess/source/ui/inc/opendoccontrols.hxx
+++ b/dbaccess/source/ui/inc/opendoccontrols.hxx
@@ -61,7 +61,6 @@ namespace dbaui
::rtl::OUString m_sModule;
public:
- OpenDocumentButton( Window* _pParent, const sal_Char* _pAsciiModuleName, WinBits _nStyle = 0 );
OpenDocumentButton( Window* _pParent, const sal_Char* _pAsciiModuleName, const ResId& _rResId );
protected:
@@ -81,7 +80,6 @@ namespace dbaui
MapIndexToStringPair m_aURLs;
public:
- OpenDocumentListBox( Window* _pParent, const sal_Char* _pAsciiModuleName, WinBits _nStyle = WB_BORDER );
OpenDocumentListBox( Window* _pParent, const sal_Char* _pAsciiModuleName, const ResId& _rResId );
String GetSelectedDocumentURL() const;
diff --git a/dbaccess/source/ui/misc/ToolBoxHelper.cxx b/dbaccess/source/ui/misc/ToolBoxHelper.cxx
index bfb5f9cf4dab..8982ae4571da 100644
--- a/dbaccess/source/ui/misc/ToolBoxHelper.cxx
+++ b/dbaccess/source/ui/misc/ToolBoxHelper.cxx
@@ -79,10 +79,10 @@ namespace dbaui
{
sal_Int16 nCurSymbolsSize = SvtMiscOptions().GetCurrentSymbolsSize();
if ( nCurSymbolsSize != m_nSymbolsSize ||
- m_bIsHiContrast != m_pToolBox->GetBackground().GetColor().IsDark() )
+ m_bIsHiContrast != m_pToolBox->GetSettings().GetStyleSettings().GetHighContrastMode() )
{
m_nSymbolsSize = nCurSymbolsSize;
- m_bIsHiContrast = m_pToolBox->GetBackground().GetColor().IsDark();
+ m_bIsHiContrast = m_pToolBox->GetSettings().GetStyleSettings().GetHighContrastMode();
m_pToolBox->SetImageList( getImageList(m_nSymbolsSize,m_bIsHiContrast) );
@@ -131,7 +131,7 @@ namespace dbaui
m_pToolBox = _pTB;
if ( m_pToolBox )
{
- // m_bIsHiContrast = m_pToolBox->GetBackground().GetColor().IsDark();
+ // m_bIsHiContrast = m_pToolBox->GetSettings().GetStyleSettings().GetHighContrastMode();
ConfigOptionsChanged(NULL);
if ( bFirstTime )
adjustToolBoxSize(m_pToolBox);
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index 8d97d4829173..73976b28ca5b 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -1332,7 +1332,7 @@ sal_Bool isHiContrast(Window* _pWindow)
else
break;
}
- return pIter && pIter->GetBackground().GetColor().IsDark();
+ return pIter && pIter->GetSettings().GetStyleSettings().GetHighContrastMode();
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/misc/databaseobjectview.cxx b/dbaccess/source/ui/misc/databaseobjectview.cxx
index 26e5b5bafd98..24debbe9bf7d 100644
--- a/dbaccess/source/ui/misc/databaseobjectview.cxx
+++ b/dbaccess/source/ui/misc/databaseobjectview.cxx
@@ -378,16 +378,6 @@ namespace dbaui
:DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< ::rtl::OUString >( URL_COMPONENT_RELATIONDESIGN ) )
{
}
- //======================================================================
- //= ReportDesigner
- //======================================================================
- //----------------------------------------------------------------------
- ReportDesigner::ReportDesigner( const Reference< XMultiServiceFactory >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication , const Reference< XFrame >& _rxParentFrame)
- :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame,static_cast< ::rtl::OUString >( URL_COMPONENT_REPORTDESIGN ) )
- {
- }
-
-
// .........................................................................
} // namespace dbaui
// .........................................................................
diff --git a/dbaccess/source/ui/misc/documentcontroller.cxx b/dbaccess/source/ui/misc/documentcontroller.cxx
index 523307d55013..62400fdf1269 100644
--- a/dbaccess/source/ui/misc/documentcontroller.cxx
+++ b/dbaccess/source/ui/misc/documentcontroller.cxx
@@ -58,16 +58,6 @@ namespace dbaui
}
//--------------------------------------------------------------------
- ModelControllerConnector::ModelControllerConnector( const Reference< XModel >& _rxModel, const Reference< XController >& _rxController )
- :m_xModel( _rxModel )
- ,m_xController( _rxController )
- {
- DBG_CTOR( ModelControllerConnector, NULL );
- DBG_ASSERT( _rxModel.is() && m_xController.is(), "ModelControllerConnector::ModelControllerConnector: invalid model or controller!" );
- impl_connect();
- }
-
- //--------------------------------------------------------------------
ModelControllerConnector::ModelControllerConnector( const ModelControllerConnector& _rSource )
{
DBG_CTOR( ModelControllerConnector, NULL );
diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx
index 6f348742afd4..7d299c7f5910 100644
--- a/dbaccess/source/ui/misc/dsmeta.cxx
+++ b/dbaccess/source/ui/misc/dsmeta.cxx
@@ -206,12 +206,6 @@ namespace dbaui
}
//--------------------------------------------------------------------
- AuthenticationMode DataSourceMetaData::getAuthentication() const
- {
- return getAuthenticationMode( m_pImpl->getType() );
- }
-
- //--------------------------------------------------------------------
AuthenticationMode DataSourceMetaData::getAuthentication( const ::rtl::OUString& _sURL )
{
return getAuthenticationMode( _sURL );
diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx
index 9d32d70e2c31..32b10a35bdb0 100644
--- a/dbaccess/source/ui/misc/linkeddocuments.cxx
+++ b/dbaccess/source/ui/misc/linkeddocuments.cxx
@@ -279,10 +279,11 @@ namespace dbaui
{
::svx::ODataAccessDescriptor aDesc;
aDesc.setDataSource(m_sDataSourceName);
- if ( _nCommandType != -1 )
+ if ( _rObjectName.getLength() && ( _nCommandType != -1 ) )
+ {
aDesc[::svx::daCommandType] <<= _nCommandType;
- if ( _rObjectName.getLength() )
aDesc[::svx::daCommand] <<= _rObjectName;
+ }
if ( m_xConnection.is() )
aDesc[::svx::daConnection] <<= m_xConnection;
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index f7f08cd63df5..6c94d9bc869c 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -330,88 +330,6 @@ namespace
return eErrorCode;
}
- //------------------------------------------------------------------------------
- ::rtl::OUString QuoteField( const OQueryDesignView* _pView,const ::rtl::OUString& rValue, sal_Int32 aType )
- {
- ::rtl::OUString rNewValue;
- switch (rValue.toChar())
- {
- case '?':
- if (rValue.getLength() != 1)
- break;
- case '\'': // ::rtl::OUString Quotierung oder Datum
- //case '#': // Datumsquotierung // jetengine
- case ':': // Parameter
- case '[': // Parameter
- return rValue;
- }
-
- Reference< XConnection> xConnection = static_cast<OQueryController&>(_pView->getController()).getConnection();
- Reference< XDatabaseMetaData > xMetaData;
- if(xConnection.is())
- xMetaData = xConnection->getMetaData();
- ::rtl::OUString aQuote;
- try
- {
- if(xMetaData.is())
- aQuote = xMetaData->getIdentifierQuoteString();
-
- switch( aType )
- {
- case DataType::DATE:
- case DataType::TIME:
- case DataType::TIMESTAMP:
- if (rValue.toChar() != '{') // nur quoten, wenn kein Access Datum
- rNewValue = ::dbtools::quoteName(aQuote,rValue);
- else
- rNewValue = rValue;
- break;
- case DataType::CHAR:
- case DataType::VARCHAR:
- case DataType::LONGVARCHAR:
- case DataType::CLOB:
- rNewValue = ::dbtools::quoteName(aQuote,rValue);
- break;
- case DataType::DECIMAL:
- case DataType::NUMERIC:
- case DataType::TINYINT:
- case DataType::SMALLINT:
- case DataType::INTEGER:
- case DataType::BIGINT:
- case DataType::REAL:
- case DataType::DOUBLE:
- case DataType::BINARY:
- case DataType::VARBINARY:
- case DataType::LONGVARBINARY:
- case DataType::BLOB:
- rNewValue = rValue;
- break;
- case DataType::BIT:
- case DataType::BOOLEAN:
- {
- if(xMetaData.is())
- {
- ::comphelper::UStringMixEqual bCase(xMetaData->supportsMixedCaseQuotedIdentifiers());
- if (bCase(rValue, String(ModuleRes(STR_QUERY_TRUE))))
- rNewValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TRUE"));
- else if (bCase(rValue, String(ModuleRes(STR_QUERY_FALSE))))
- rNewValue = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FALSE"));
- else
- rNewValue = rValue;
- }
- }
- break;
- default:
- DBG_ERROR( "QuoteField: illegal type" );
- break;
- }
- }
- catch(SQLException&)
- {
- DBG_ERROR( "QuoteField: Exception" );
- }
- return rNewValue;
- }
// -----------------------------------------------------------------------------
/** FillDragInfo fills the field description out of the table
diff --git a/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx b/dbaccess/source/ui/relationdesign/RTableConnectionData.cxx
index ad0bc1a26ea5..00478a064ced 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 14653343bd4d..3bd2aa12a8ae 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)
{