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