xref: /AOO41X/main/dbaccess/source/ui/browser/dbloader.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "dbu_reghelper.hxx"
32*cdf0e10cSrcweir #include "dbustrings.hrc"
33*cdf0e10cSrcweir #include "UITools.hxx"
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir /** === begin UNO includes === **/
36*cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/container/XSet.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/document/XEventListener.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/frame/XController2.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/frame/XFrameLoader.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/frame/XLoadEventListener.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
47*cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
48*cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp>
49*cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp>
50*cdf0e10cSrcweir #include <com/sun/star/frame/XModule.hpp>
51*cdf0e10cSrcweir /** === end UNO includes === **/
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir #include <com/sun/star/sdbc/XDataSource.hpp>
54*cdf0e10cSrcweir #include <comphelper/namedvaluecollection.hxx>
55*cdf0e10cSrcweir #include <comphelper/componentcontext.hxx>
56*cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
57*cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx>
58*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
59*cdf0e10cSrcweir #include <tools/diagnose_ex.h>
60*cdf0e10cSrcweir #include <tools/urlobj.hxx>
61*cdf0e10cSrcweir #include <vcl/svapp.hxx>
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir using namespace ::com::sun::star;
64*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
65*cdf0e10cSrcweir using namespace ::com::sun::star::frame;
66*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
67*cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
68*cdf0e10cSrcweir using namespace ::com::sun::star::container;
69*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
70*cdf0e10cSrcweir using namespace ::com::sun::star::registry;
71*cdf0e10cSrcweir using ::com::sun::star::sdbc::XDataSource;
72*cdf0e10cSrcweir using namespace dbaui;
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir class DBContentLoader : public ::cppu::WeakImplHelper2< XFrameLoader, XServiceInfo>
75*cdf0e10cSrcweir {
76*cdf0e10cSrcweir private:
77*cdf0e10cSrcweir 	::rtl::OUString						m_aURL;
78*cdf0e10cSrcweir 	Sequence< PropertyValue>			m_aArgs;
79*cdf0e10cSrcweir 	Reference< XLoadEventListener > 	m_xListener;
80*cdf0e10cSrcweir 	Reference< XFrame > 				m_xFrame;
81*cdf0e10cSrcweir 	Reference< XMultiServiceFactory >	m_xServiceFactory;
82*cdf0e10cSrcweir public:
83*cdf0e10cSrcweir 	DBContentLoader(const Reference< XMultiServiceFactory >&);
84*cdf0e10cSrcweir 	~DBContentLoader();
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir 	// XServiceInfo
87*cdf0e10cSrcweir 	::rtl::OUString					SAL_CALL getImplementationName() throw(  );
88*cdf0e10cSrcweir 	sal_Bool 						SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw(  );
89*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > 	SAL_CALL getSupportedServiceNames(void) throw(  );
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir 	// static methods
92*cdf0e10cSrcweir 	static ::rtl::OUString 			getImplementationName_Static() throw(  )
93*cdf0e10cSrcweir 	{
94*cdf0e10cSrcweir 		return ::rtl::OUString::createFromAscii("org.openoffice.comp.dbu.DBContentLoader");
95*cdf0e10cSrcweir 	}
96*cdf0e10cSrcweir 	static Sequence< ::rtl::OUString> getSupportedServiceNames_Static(void) throw(  );
97*cdf0e10cSrcweir 	static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
98*cdf0e10cSrcweir 			SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir 	// XLoader
101*cdf0e10cSrcweir 	virtual void SAL_CALL load(	const Reference< XFrame > & _rFrame, const ::rtl::OUString& _rURL,
102*cdf0e10cSrcweir 								const Sequence< PropertyValue >& _rArgs,
103*cdf0e10cSrcweir 								const Reference< XLoadEventListener > & _rListener) throw(::com::sun::star::uno::RuntimeException);
104*cdf0e10cSrcweir 	virtual void SAL_CALL cancel(void) throw();
105*cdf0e10cSrcweir };
106*cdf0e10cSrcweir DBG_NAME(DBContentLoader)
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir DBContentLoader::DBContentLoader(const Reference< XMultiServiceFactory >& _rxFactory)
109*cdf0e10cSrcweir 	:m_xServiceFactory(_rxFactory)
110*cdf0e10cSrcweir {
111*cdf0e10cSrcweir     DBG_CTOR(DBContentLoader,NULL);
112*cdf0e10cSrcweir 
113*cdf0e10cSrcweir }
114*cdf0e10cSrcweir // -------------------------------------------------------------------------
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir DBContentLoader::~DBContentLoader()
117*cdf0e10cSrcweir {
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir     DBG_DTOR(DBContentLoader,NULL);
120*cdf0e10cSrcweir }
121*cdf0e10cSrcweir // -------------------------------------------------------------------------
122*cdf0e10cSrcweir // -------------------------------------------------------------------------
123*cdf0e10cSrcweir extern "C" void SAL_CALL createRegistryInfo_DBContentLoader()
124*cdf0e10cSrcweir {
125*cdf0e10cSrcweir 	static ::dbaui::OMultiInstanceAutoRegistration< DBContentLoader > aAutoRegistration;
126*cdf0e10cSrcweir }
127*cdf0e10cSrcweir // -------------------------------------------------------------------------
128*cdf0e10cSrcweir Reference< XInterface > SAL_CALL DBContentLoader::Create( const Reference< XMultiServiceFactory >  & rSMgr )
129*cdf0e10cSrcweir {
130*cdf0e10cSrcweir 	return *(new DBContentLoader(rSMgr));
131*cdf0e10cSrcweir }
132*cdf0e10cSrcweir // -------------------------------------------------------------------------
133*cdf0e10cSrcweir // XServiceInfo
134*cdf0e10cSrcweir ::rtl::OUString SAL_CALL DBContentLoader::getImplementationName() throw(  )
135*cdf0e10cSrcweir {
136*cdf0e10cSrcweir 	return getImplementationName_Static();
137*cdf0e10cSrcweir }
138*cdf0e10cSrcweir // -------------------------------------------------------------------------
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir // XServiceInfo
141*cdf0e10cSrcweir sal_Bool SAL_CALL DBContentLoader::supportsService(const ::rtl::OUString& ServiceName) throw(  )
142*cdf0e10cSrcweir {
143*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
144*cdf0e10cSrcweir 	const ::rtl::OUString * pBegin	= aSNL.getConstArray();
145*cdf0e10cSrcweir 	const ::rtl::OUString * pEnd	= pBegin + aSNL.getLength();
146*cdf0e10cSrcweir 	for( ; pBegin != pEnd; ++pBegin)
147*cdf0e10cSrcweir 		if( *pBegin == ServiceName )
148*cdf0e10cSrcweir 			return sal_True;
149*cdf0e10cSrcweir 	return sal_False;
150*cdf0e10cSrcweir }
151*cdf0e10cSrcweir // -------------------------------------------------------------------------
152*cdf0e10cSrcweir // XServiceInfo
153*cdf0e10cSrcweir Sequence< ::rtl::OUString > SAL_CALL DBContentLoader::getSupportedServiceNames(void) throw(  )
154*cdf0e10cSrcweir {
155*cdf0e10cSrcweir 	return getSupportedServiceNames_Static();
156*cdf0e10cSrcweir }
157*cdf0e10cSrcweir // -------------------------------------------------------------------------
158*cdf0e10cSrcweir // ORegistryServiceManager_Static
159*cdf0e10cSrcweir Sequence< ::rtl::OUString > DBContentLoader::getSupportedServiceNames_Static(void) throw(  )
160*cdf0e10cSrcweir {
161*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aSNS( 2 );
162*cdf0e10cSrcweir 	aSNS.getArray()[0] = ::rtl::OUString::createFromAscii("com.sun.star.frame.FrameLoader");
163*cdf0e10cSrcweir 	aSNS.getArray()[1] = ::rtl::OUString::createFromAscii("com.sun.star.sdb.ContentLoader");
164*cdf0e10cSrcweir 	return aSNS;
165*cdf0e10cSrcweir }
166*cdf0e10cSrcweir // -------------------------------------------------------------------------
167*cdf0e10cSrcweir extern "C" void SAL_CALL writeDBLoaderInfo(void* pRegistryKey)
168*cdf0e10cSrcweir {
169*cdf0e10cSrcweir 	Reference< XRegistryKey> xKey(reinterpret_cast< XRegistryKey*>(pRegistryKey));
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 	// register content loader for dispatch
172*cdf0e10cSrcweir 	::rtl::OUString aImpl = ::rtl::OUString::createFromAscii("/");
173*cdf0e10cSrcweir 	aImpl += DBContentLoader::getImplementationName_Static();
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir 	::rtl::OUString aImpltwo = aImpl;
176*cdf0e10cSrcweir 	aImpltwo += ::rtl::OUString::createFromAscii("/UNO/Loader");
177*cdf0e10cSrcweir 	Reference< XRegistryKey> xNewKey = xKey->createKey( aImpltwo );
178*cdf0e10cSrcweir 	aImpltwo = aImpl;
179*cdf0e10cSrcweir 	aImpltwo += ::rtl::OUString::createFromAscii("/Loader");
180*cdf0e10cSrcweir 	Reference< XRegistryKey >  xLoaderKey = xKey->createKey( aImpltwo );
181*cdf0e10cSrcweir 	xNewKey = xLoaderKey->createKey( ::rtl::OUString::createFromAscii("Pattern") );
182*cdf0e10cSrcweir 	xNewKey->setAsciiValue( ::rtl::OUString::createFromAscii(".component:DB*") );
183*cdf0e10cSrcweir }
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir // -----------------------------------------------------------------------
186*cdf0e10cSrcweir void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const ::rtl::OUString& rURL,
187*cdf0e10cSrcweir 		const Sequence< PropertyValue >& rArgs,
188*cdf0e10cSrcweir 		const Reference< XLoadEventListener > & rListener) throw(::com::sun::star::uno::RuntimeException)
189*cdf0e10cSrcweir {
190*cdf0e10cSrcweir 	m_xFrame	= rFrame;
191*cdf0e10cSrcweir 	m_xListener = rListener;
192*cdf0e10cSrcweir 	m_aURL		= rURL;
193*cdf0e10cSrcweir 	m_aArgs		= rArgs;
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir     ::comphelper::ComponentContext aContext( m_xServiceFactory );
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir     struct ServiceNameToImplName
198*cdf0e10cSrcweir     {
199*cdf0e10cSrcweir         const sal_Char*     pAsciiServiceName;
200*cdf0e10cSrcweir         const sal_Char*     pAsciiImplementationName;
201*cdf0e10cSrcweir         ServiceNameToImplName( const sal_Char* _pService, const sal_Char* _pImpl )
202*cdf0e10cSrcweir             :pAsciiServiceName( _pService )
203*cdf0e10cSrcweir             ,pAsciiImplementationName( _pImpl )
204*cdf0e10cSrcweir         {
205*cdf0e10cSrcweir         }
206*cdf0e10cSrcweir     } aImplementations[] = {
207*cdf0e10cSrcweir         ServiceNameToImplName( URL_COMPONENT_FORMGRIDVIEW,          "org.openoffice.comp.dbu.OFormGridView"        ),
208*cdf0e10cSrcweir         ServiceNameToImplName( URL_COMPONENT_DATASOURCEBROWSER,     "org.openoffice.comp.dbu.ODatasourceBrowser"   ),
209*cdf0e10cSrcweir         ServiceNameToImplName( URL_COMPONENT_QUERYDESIGN,           "org.openoffice.comp.dbu.OQueryDesign"         ),
210*cdf0e10cSrcweir         ServiceNameToImplName( URL_COMPONENT_TABLEDESIGN,           "org.openoffice.comp.dbu.OTableDesign"         ),
211*cdf0e10cSrcweir         ServiceNameToImplName( URL_COMPONENT_RELATIONDESIGN,        "org.openoffice.comp.dbu.ORelationDesign"      ),
212*cdf0e10cSrcweir         ServiceNameToImplName( URL_COMPONENT_VIEWDESIGN,            "org.openoffice.comp.dbu.OViewDesign"          )
213*cdf0e10cSrcweir     };
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir     INetURLObject aParser( rURL );
216*cdf0e10cSrcweir     Reference< XController2 > xController;
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir     const ::rtl::OUString sComponentURL( aParser.GetMainURL( INetURLObject::DECODE_TO_IURI ) );
219*cdf0e10cSrcweir     for ( size_t i=0; i < sizeof( aImplementations ) / sizeof( aImplementations[0] ); ++i )
220*cdf0e10cSrcweir     {
221*cdf0e10cSrcweir         if ( sComponentURL.equalsAscii( aImplementations[i].pAsciiServiceName ) )
222*cdf0e10cSrcweir         {
223*cdf0e10cSrcweir             aContext.createComponent( aImplementations[i].pAsciiImplementationName, xController );
224*cdf0e10cSrcweir             break;
225*cdf0e10cSrcweir         }
226*cdf0e10cSrcweir     }
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir     // if a data source browser is loaded without its tree pane, then we assume it to be a
229*cdf0e10cSrcweir     // table data view, effectively. In this case, we need to adjust the module identifier.
230*cdf0e10cSrcweir     // 2008-02-05 / i85879 / frank.schoenheit@sun.com
231*cdf0e10cSrcweir     ::comphelper::NamedValueCollection aLoadArgs( rArgs );
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir     if  ( sComponentURL == URL_COMPONENT_DATASOURCEBROWSER )
234*cdf0e10cSrcweir     {
235*cdf0e10cSrcweir         sal_Bool bDisableBrowser =  ( sal_False == aLoadArgs.getOrDefault( "ShowTreeViewButton", sal_True ) )   // compatibility name
236*cdf0e10cSrcweir                                 ||  ( sal_False == aLoadArgs.getOrDefault( (::rtl::OUString)PROPERTY_ENABLE_BROWSER, sal_True ) );
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir         if ( bDisableBrowser )
239*cdf0e10cSrcweir         {
240*cdf0e10cSrcweir             try
241*cdf0e10cSrcweir             {
242*cdf0e10cSrcweir                 Reference< XModule > xModule( xController, UNO_QUERY_THROW );
243*cdf0e10cSrcweir                 xModule->setIdentifier( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.TableDataView" ) ) );
244*cdf0e10cSrcweir             }
245*cdf0e10cSrcweir             catch( const Exception& )
246*cdf0e10cSrcweir             {
247*cdf0e10cSrcweir                 DBG_UNHANDLED_EXCEPTION();
248*cdf0e10cSrcweir             }
249*cdf0e10cSrcweir         }
250*cdf0e10cSrcweir     }
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir     if ( sComponentURL == URL_COMPONENT_REPORTDESIGN )
253*cdf0e10cSrcweir     {
254*cdf0e10cSrcweir         sal_Bool bPreview = aLoadArgs.getOrDefault( "Preview", sal_False );
255*cdf0e10cSrcweir         if ( bPreview )
256*cdf0e10cSrcweir         {   // report designs cannot be previewed
257*cdf0e10cSrcweir             if ( rListener.is() )
258*cdf0e10cSrcweir                 rListener->loadCancelled( this );
259*cdf0e10cSrcweir             return;
260*cdf0e10cSrcweir         }
261*cdf0e10cSrcweir         Reference< XModel > xReportModel( aLoadArgs.getOrDefault( "Model", Reference< XModel >() ) );
262*cdf0e10cSrcweir         if ( xReportModel.is() )
263*cdf0e10cSrcweir         {
264*cdf0e10cSrcweir             xController.set( m_xServiceFactory->createInstance(
265*cdf0e10cSrcweir                 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.ReportDesign" ) ) ), UNO_QUERY );
266*cdf0e10cSrcweir             if ( xController.is() )
267*cdf0e10cSrcweir             {
268*cdf0e10cSrcweir                 xController->attachModel( xReportModel );
269*cdf0e10cSrcweir                 xReportModel->connectController( xController.get() );
270*cdf0e10cSrcweir                 xReportModel->setCurrentController( xController.get() );
271*cdf0e10cSrcweir             }
272*cdf0e10cSrcweir         }
273*cdf0e10cSrcweir     }
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir 	sal_Bool bSuccess = xController.is();
276*cdf0e10cSrcweir     Reference< XModel > xDatabaseDocument;
277*cdf0e10cSrcweir 	if ( bSuccess )
278*cdf0e10cSrcweir 	{
279*cdf0e10cSrcweir         Reference< XDataSource > xDataSource    ( aLoadArgs.getOrDefault( "DataSource",       Reference< XDataSource >() ) );
280*cdf0e10cSrcweir         ::rtl::OUString          sDataSourceName( aLoadArgs.getOrDefault( "DataSourceName",   ::rtl::OUString()          ) );
281*cdf0e10cSrcweir         Reference< XConnection > xConnection    ( aLoadArgs.getOrDefault( "ActiveConnection", Reference< XConnection >() ) );
282*cdf0e10cSrcweir         if ( xDataSource.is() )
283*cdf0e10cSrcweir         {
284*cdf0e10cSrcweir 			xDatabaseDocument.set( getDataSourceOrModel( xDataSource ), UNO_QUERY );
285*cdf0e10cSrcweir         }
286*cdf0e10cSrcweir         else if ( sDataSourceName.getLength() )
287*cdf0e10cSrcweir         {
288*cdf0e10cSrcweir             ::dbtools::SQLExceptionInfo aError;
289*cdf0e10cSrcweir             xDataSource.set( getDataSourceByName( sDataSourceName, NULL, m_xServiceFactory, &aError ) );
290*cdf0e10cSrcweir 			xDatabaseDocument.set( getDataSourceOrModel( xDataSource ), UNO_QUERY );
291*cdf0e10cSrcweir         }
292*cdf0e10cSrcweir         else if ( xConnection.is() )
293*cdf0e10cSrcweir         {
294*cdf0e10cSrcweir             Reference< XChild > xAsChild( xConnection, UNO_QUERY );
295*cdf0e10cSrcweir             if ( xAsChild.is() )
296*cdf0e10cSrcweir             {
297*cdf0e10cSrcweir                 OSL_ENSURE( Reference< XDataSource >( xAsChild->getParent(), UNO_QUERY ).is(),
298*cdf0e10cSrcweir                     "DBContentLoader::load: a connection whose parent is no data source?" );
299*cdf0e10cSrcweir 				xDatabaseDocument.set( getDataSourceOrModel( xAsChild->getParent() ), UNO_QUERY );
300*cdf0e10cSrcweir             }
301*cdf0e10cSrcweir         }
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir         // init controller
304*cdf0e10cSrcweir 		::vos::OGuard aGuard(Application::GetSolarMutex());
305*cdf0e10cSrcweir 		try
306*cdf0e10cSrcweir 		{
307*cdf0e10cSrcweir 			Reference<XInitialization > xIni(xController,UNO_QUERY);
308*cdf0e10cSrcweir 			PropertyValue aFrame(::rtl::OUString::createFromAscii("Frame"),0,makeAny(rFrame),PropertyState_DIRECT_VALUE);
309*cdf0e10cSrcweir 			Sequence< Any > aInitArgs(m_aArgs.getLength()+1);
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir 			Any* pBegin = aInitArgs.getArray();
312*cdf0e10cSrcweir 			Any* pEnd	= pBegin + aInitArgs.getLength();
313*cdf0e10cSrcweir 			*pBegin <<= aFrame;
314*cdf0e10cSrcweir 			const PropertyValue* pIter		= m_aArgs.getConstArray();
315*cdf0e10cSrcweir 			for(++pBegin;pBegin != pEnd;++pBegin,++pIter)
316*cdf0e10cSrcweir 			{
317*cdf0e10cSrcweir 				*pBegin <<= *pIter;
318*cdf0e10cSrcweir 			}
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir 			xIni->initialize(aInitArgs);
321*cdf0e10cSrcweir 		}
322*cdf0e10cSrcweir 		catch(const Exception&)
323*cdf0e10cSrcweir 		{
324*cdf0e10cSrcweir             // Does this need to be shown to the user?
325*cdf0e10cSrcweir             bSuccess = false;
326*cdf0e10cSrcweir             try
327*cdf0e10cSrcweir             {
328*cdf0e10cSrcweir                 ::comphelper::disposeComponent( xController );
329*cdf0e10cSrcweir             }
330*cdf0e10cSrcweir             catch( const Exception& )
331*cdf0e10cSrcweir             {
332*cdf0e10cSrcweir                 DBG_UNHANDLED_EXCEPTION();
333*cdf0e10cSrcweir             }
334*cdf0e10cSrcweir 		}
335*cdf0e10cSrcweir 	}
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir 	// assign controller and frame
338*cdf0e10cSrcweir 	if ( bSuccess )
339*cdf0e10cSrcweir 	{
340*cdf0e10cSrcweir 		if ( xController.is() && rFrame.is() )
341*cdf0e10cSrcweir         {
342*cdf0e10cSrcweir             rFrame->setComponent( xController->getComponentWindow(), xController.get() );
343*cdf0e10cSrcweir             xController->attachFrame(rFrame);
344*cdf0e10cSrcweir         }
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir         if ( rListener.is() )
347*cdf0e10cSrcweir 		    rListener->loadFinished( this );
348*cdf0e10cSrcweir 	}
349*cdf0e10cSrcweir 	else
350*cdf0e10cSrcweir         if ( rListener.is() )
351*cdf0e10cSrcweir 		    rListener->loadCancelled( this );
352*cdf0e10cSrcweir }
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir // -----------------------------------------------------------------------
355*cdf0e10cSrcweir void DBContentLoader::cancel(void) throw()
356*cdf0e10cSrcweir {
357*cdf0e10cSrcweir }
358*cdf0e10cSrcweir 
359