summaryrefslogtreecommitdiff
path: root/dbaccess/source/ui/browser/dbloader.cxx
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2004-08-02 14:32:39 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2004-08-02 14:32:39 +0000
commitafedbe9768b2df98581c7dc92069709ed31ad349 (patch)
treeaacf142b86cbd5ab19578f85d1173dfd79c061ae /dbaccess/source/ui/browser/dbloader.cxx
parent782cc4cc61ee71f8e5968c6a761738b9f64b11b5 (diff)
INTEGRATION: CWS insight01 (1.17.104); FILE MERGED
2004/07/14 10:22:23 oj 1.17.104.6: #i30603# corret frame loading 2004/07/14 07:34:37 oj 1.17.104.5: don't use setComponent(NULL,NULL) when an error occurs 2004/07/02 10:04:43 oj 1.17.104.4: #i30226# add controller, model behavior 2003/11/05 11:41:02 oj 1.17.104.3: #111075# ongoing work 2003/09/18 05:58:03 oj 1.17.104.2: #111075# ongoing work 2003/07/29 12:23:17 oj 1.17.104.1: #111075# insight changes
Diffstat (limited to 'dbaccess/source/ui/browser/dbloader.cxx')
-rw-r--r--dbaccess/source/ui/browser/dbloader.cxx109
1 files changed, 76 insertions, 33 deletions
diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx
index eb7fed3fdd19..a727fa8cd5c5 100644
--- a/dbaccess/source/ui/browser/dbloader.cxx
+++ b/dbaccess/source/ui/browser/dbloader.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dbloader.cxx,v $
*
- * $Revision: 1.17 $
+ * $Revision: 1.18 $
*
- * last change: $Author: rt $ $Date: 2002-12-03 10:45:02 $
+ * last change: $Author: hr $ $Date: 2004-08-02 15:32:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -95,6 +95,9 @@
#ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
#include <com/sun/star/container/XSet.hpp>
#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
#include <com/sun/star/registry/XRegistryKey.hpp>
#endif
@@ -243,56 +246,96 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const ::
// schon geaendert haben (zum Beispiel durch Umbenennen)
Reference< XController > xController;
sal_Bool bSuccess = sal_True;
- if(aParser.GetMainURL(INetURLObject::DECODE_TO_IURI).EqualsAscii(".component:DB/FormGridView"))
- xController = Reference< XController >(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.OFormGridView")),UNO_QUERY);
- else if(aParser.GetMainURL(INetURLObject::DECODE_TO_IURI).EqualsAscii(".component:DB/DataSourceBrowser"))// construct the control
- xController = Reference< XController >(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.ODatasourceBrowser")),UNO_QUERY);
- else if(aParser.GetMainURL(INetURLObject::DECODE_TO_IURI) == String(URL_COMPONENT_QUERYDESIGN))// construct the control
- xController = Reference< XController >(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.OQueryDesign")),UNO_QUERY);
- else if(aParser.GetMainURL(INetURLObject::DECODE_TO_IURI) == String(URL_COMPONENT_TABLEDESIGN))// construct the control
- xController = Reference< XController >(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.OTableDesign")),UNO_QUERY);
- else if(aParser.GetMainURL(INetURLObject::DECODE_TO_IURI) == String(URL_COMPONENT_RELATIONDESIGN))// construct the control
- xController = Reference< XController >(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.ORelationDesign")),UNO_QUERY);
+ sal_Bool bAttachModel = sal_False;
+ if(aParser.GetMainURL(INetURLObject::DECODE_TO_IURI) == String(URL_COMPONENT_FORMGRIDVIEW) )
+ xController.set(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.OFormGridView")),UNO_QUERY);
+ else if(aParser.GetMainURL(INetURLObject::DECODE_TO_IURI) == String(URL_COMPONENT_DATASOURCEBROWSER) )// construct the control
+ xController.set(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.ODatasourceBrowser")),UNO_QUERY);
+ else if ( bAttachModel = (aParser.GetMainURL(INetURLObject::DECODE_TO_IURI) == String(URL_COMPONENT_QUERYDESIGN)) )// construct the control
+ xController.set(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.OQueryDesign")),UNO_QUERY);
+ else if ( bAttachModel = (aParser.GetMainURL(INetURLObject::DECODE_TO_IURI) == String(URL_COMPONENT_TABLEDESIGN)) ) // construct the control
+ xController.set(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.OTableDesign")),UNO_QUERY);
+ else if ( bAttachModel = (aParser.GetMainURL(INetURLObject::DECODE_TO_IURI) == String(URL_COMPONENT_RELATIONDESIGN)) )// construct the control
+ xController.set(m_xServiceFactory->createInstance(::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.ORelationDesign")),UNO_QUERY);
else
OSL_ENSURE(0,"wrong dispatch url!");
- ::vos::OGuard aGuard(Application::GetSolarMutex());
-
if(bSuccess = xController.is())
{
- // and initialize
- try
+ if ( bAttachModel )
{
- Reference<XInitialization > xIni(xController,UNO_QUERY);
- PropertyValue aFrame(::rtl::OUString::createFromAscii("Frame"),0,makeAny(rFrame),PropertyState_DIRECT_VALUE);
- Sequence< Any > aArgs(m_aArgs.getLength()+1);
+ Reference<XModel> xModel;
+ PropertyValue aValue;
+ const PropertyValue* pIter = m_aArgs.getConstArray();
+ const PropertyValue* pEnd = pIter + m_aArgs.getLength();
- Any* pBegin = aArgs.getArray();
- Any* pEnd = pBegin + aArgs.getLength();
- *pBegin <<= aFrame;
- const PropertyValue* pIter = m_aArgs.getConstArray();
- const PropertyValue* pIterEnd = pIter + m_aArgs.getLength();
- for(++pBegin;pBegin != pEnd;++pBegin,++pIter)
+ for(;pIter != pEnd;++pIter)
{
- *pBegin <<= *pIter;
+ if(0 == pIter->Name.compareToAscii(PROPERTY_DATASOURCE))
+ {
+ xModel.set(pIter->Value,UNO_QUERY);
+ break;
+ }
+ else if(0 == pIter->Name.compareToAscii(PROPERTY_DATASOURCENAME))
+ {
+ ::rtl::OUString sDataSource;
+ pIter->Value >>= sDataSource;
+ Reference< XNameAccess > xDatabaseContext(m_xServiceFactory->createInstance(SERVICE_SDB_DATABASECONTEXT), UNO_QUERY);
+ try
+ {
+ xModel.set(xDatabaseContext->getByName(sDataSource),UNO_QUERY);
+ }
+ catch(Exception)
+ {
+ }
+ break;
+ }
+ }
+ if ( bSuccess = ( xModel.is() && xModel->getURL().getLength() != 0) )
+ {
+ xController->attachModel(xModel);
+ xModel->connectController( xController );
+ xModel->setCurrentController(xController);
}
-
- xIni->initialize(aArgs);
}
- catch(Exception&)
+ if ( bSuccess )
{
- bSuccess = sal_False;
+ ::vos::OGuard aGuard(Application::GetSolarMutex());
+ // and initialize
+ try
+ {
+ Reference<XInitialization > xIni(xController,UNO_QUERY);
+ PropertyValue aFrame(::rtl::OUString::createFromAscii("Frame"),0,makeAny(rFrame),PropertyState_DIRECT_VALUE);
+ Sequence< Any > aArgs(m_aArgs.getLength()+1);
+
+ Any* pBegin = aArgs.getArray();
+ Any* pEnd = pBegin + aArgs.getLength();
+ *pBegin <<= aFrame;
+ const PropertyValue* pIter = m_aArgs.getConstArray();
+ const PropertyValue* pIterEnd = pIter + m_aArgs.getLength();
+ for(++pBegin;pBegin != pEnd;++pBegin,++pIter)
+ {
+ *pBegin <<= *pIter;
+ }
+
+ xIni->initialize(aArgs);
+ }
+ catch(Exception&)
+ {
+ bSuccess = sal_False;
+ }
}
}
if (bSuccess && rListener.is())
+ {
+ if ( xController.is() && rFrame.is() )
+ xController->attachFrame(rFrame);
rListener->loadFinished(this);
+ }
else if (!bSuccess && rListener.is())
- {
- rFrame->setComponent(NULL, NULL);
rListener->loadCancelled(this);
- }
}
// -----------------------------------------------------------------------