xref: /AOO41X/main/dbaccess/source/ui/misc/databaseobjectview.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 "databaseobjectview.hxx"
32*cdf0e10cSrcweir #include "dbustrings.hrc"
33*cdf0e10cSrcweir #include "asyncmodaldialog.hxx"
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir /** === begin UNO includes === **/
36*cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/frame/XFrames.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/frame/FrameSearchFlag.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/sdb/CommandType.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/sdb/application/XTableUIProvider.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/awt/Rectangle.hpp>
45*cdf0e10cSrcweir /** === end UNO includes === **/
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir #include <comphelper/extract.hxx>
48*cdf0e10cSrcweir #include <comphelper/sequence.hxx>
49*cdf0e10cSrcweir #include <connectivity/dbtools.hxx>
50*cdf0e10cSrcweir #include <osl/diagnose.h>
51*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
52*cdf0e10cSrcweir #include <tools/diagnose_ex.h>
53*cdf0e10cSrcweir #include <vcl/window.hxx>
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir // .........................................................................
56*cdf0e10cSrcweir namespace dbaui
57*cdf0e10cSrcweir {
58*cdf0e10cSrcweir // .........................................................................
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
61*cdf0e10cSrcweir 	using namespace ::com::sun::star::sdbc;
62*cdf0e10cSrcweir 	using namespace ::com::sun::star::sdb;
63*cdf0e10cSrcweir     using namespace ::com::sun::star::sdb::application;
64*cdf0e10cSrcweir     using namespace ::com::sun::star::ui::dialogs;
65*cdf0e10cSrcweir 	using namespace ::com::sun::star::frame;
66*cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
67*cdf0e10cSrcweir 	using namespace ::com::sun::star::beans;
68*cdf0e10cSrcweir 	using namespace ::com::sun::star::awt;
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir 	//======================================================================
71*cdf0e10cSrcweir 	//= DatabaseObjectView
72*cdf0e10cSrcweir 	//======================================================================
73*cdf0e10cSrcweir 	DatabaseObjectView::DatabaseObjectView( const Reference< XMultiServiceFactory >& _rxORB,
74*cdf0e10cSrcweir             const Reference< XDatabaseDocumentUI >& _rxApplication,
75*cdf0e10cSrcweir 			const Reference< XFrame >& _rxParentFrame,
76*cdf0e10cSrcweir 			const ::rtl::OUString& _rComponentURL )
77*cdf0e10cSrcweir 		:m_xORB             ( _rxORB            )
78*cdf0e10cSrcweir 		,m_xParentFrame     ( _rxParentFrame    )
79*cdf0e10cSrcweir         ,m_xFrameLoader     (                   )
80*cdf0e10cSrcweir         ,m_xApplication     ( _rxApplication    )
81*cdf0e10cSrcweir         ,m_sComponentURL    ( _rComponentURL    )
82*cdf0e10cSrcweir 	{
83*cdf0e10cSrcweir 		OSL_ENSURE( m_xORB.is(), "DatabaseObjectView::DatabaseObjectView: invalid service factory!" );
84*cdf0e10cSrcweir         OSL_ENSURE( m_xApplication.is(), "DatabaseObjectView::DatabaseObjectView: invalid connection!" );
85*cdf0e10cSrcweir 	}
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir 	//----------------------------------------------------------------------
88*cdf0e10cSrcweir     Reference< XConnection > DatabaseObjectView::getConnection() const
89*cdf0e10cSrcweir     {
90*cdf0e10cSrcweir         Reference< XConnection > xConnection;
91*cdf0e10cSrcweir         if ( m_xApplication.is() )
92*cdf0e10cSrcweir             xConnection = m_xApplication->getActiveConnection();
93*cdf0e10cSrcweir         return xConnection;
94*cdf0e10cSrcweir     }
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 	//----------------------------------------------------------------------
97*cdf0e10cSrcweir 	Reference< XComponent > DatabaseObjectView::createNew( const Reference< XDataSource >& _xDataSource, const ::comphelper::NamedValueCollection& i_rDispatchArgs )
98*cdf0e10cSrcweir 	{
99*cdf0e10cSrcweir         return doCreateView( makeAny( _xDataSource ), ::rtl::OUString(), i_rDispatchArgs );
100*cdf0e10cSrcweir 	}
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 	//----------------------------------------------------------------------
103*cdf0e10cSrcweir 	Reference< XComponent > DatabaseObjectView::openExisting( const Any& _rDataSource, const ::rtl::OUString& _rName,
104*cdf0e10cSrcweir             const ::comphelper::NamedValueCollection& i_rDispatchArgs )
105*cdf0e10cSrcweir 	{
106*cdf0e10cSrcweir         return doCreateView( _rDataSource, _rName, i_rDispatchArgs );
107*cdf0e10cSrcweir 	}
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 	//----------------------------------------------------------------------
110*cdf0e10cSrcweir 	Reference< XComponent > DatabaseObjectView::doCreateView( const Any& _rDataSource, const ::rtl::OUString& _rObjectName,
111*cdf0e10cSrcweir         const ::comphelper::NamedValueCollection& i_rCreationArgs )
112*cdf0e10cSrcweir     {
113*cdf0e10cSrcweir         ::comphelper::NamedValueCollection aDispatchArgs;
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir         aDispatchArgs.merge( i_rCreationArgs, false );    // false => do not overwrite
116*cdf0e10cSrcweir         fillDispatchArgs( aDispatchArgs, _rDataSource, _rObjectName );
117*cdf0e10cSrcweir         aDispatchArgs.merge( i_rCreationArgs, true );    // true => do overwrite
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir         return doDispatch( aDispatchArgs );
120*cdf0e10cSrcweir     }
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir 	//----------------------------------------------------------------------
123*cdf0e10cSrcweir 	Reference< XComponent > DatabaseObjectView::doDispatch( const ::comphelper::NamedValueCollection& i_rDispatchArgs )
124*cdf0e10cSrcweir 	{
125*cdf0e10cSrcweir 		Reference< XComponent > xReturn;
126*cdf0e10cSrcweir 		if ( m_xORB.is() )
127*cdf0e10cSrcweir 		{
128*cdf0e10cSrcweir 			try
129*cdf0e10cSrcweir 			{
130*cdf0e10cSrcweir 				// if we have no externally provided frame, create one
131*cdf0e10cSrcweir 				if ( !m_xFrameLoader.is() )
132*cdf0e10cSrcweir 				{
133*cdf0e10cSrcweir 					Reference< XSingleServiceFactory > xFact(m_xORB->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.TaskCreator")), UNO_QUERY_THROW);
134*cdf0e10cSrcweir 					Sequence< Any > lArgs(2);
135*cdf0e10cSrcweir 					NamedValue      aProp;
136*cdf0e10cSrcweir                     sal_Int32       nArg = 0;
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 					aProp.Name    = ::rtl::OUString::createFromAscii("ParentFrame");
139*cdf0e10cSrcweir 					aProp.Value <<= m_xParentFrame;
140*cdf0e10cSrcweir 					lArgs[nArg++] <<= aProp;
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir 					aProp.Name    = ::rtl::OUString::createFromAscii("TopWindow");
143*cdf0e10cSrcweir 					aProp.Value <<= sal_True;
144*cdf0e10cSrcweir 					lArgs[nArg++] <<= aProp;
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir 					m_xFrameLoader.set(xFact->createInstanceWithArguments(lArgs), UNO_QUERY_THROW);
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir                     // everything we load can be considered a "top level document", so set the respective bit at the window.
149*cdf0e10cSrcweir                     // This, amongst other things, triggers that the component in this task participates in the
150*cdf0e10cSrcweir                     // "ThisComponent"-game for the global application Basic.
151*cdf0e10cSrcweir                     const Reference< XFrame > xFrame( m_xFrameLoader, UNO_QUERY_THROW );
152*cdf0e10cSrcweir                     const Reference< XWindow > xFrameWindow( xFrame->getContainerWindow(), UNO_SET_THROW );
153*cdf0e10cSrcweir                     Window* pContainerWindow = VCLUnoHelper::GetWindow( xFrameWindow );
154*cdf0e10cSrcweir                     ENSURE_OR_THROW( pContainerWindow, "no implementation access to the frame's container window!" );
155*cdf0e10cSrcweir                     pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT );
156*cdf0e10cSrcweir 				}
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 				Reference< XComponentLoader > xFrameLoader( m_xFrameLoader, UNO_QUERY_THROW );
159*cdf0e10cSrcweir 				xReturn = xFrameLoader->loadComponentFromURL(
160*cdf0e10cSrcweir 					m_sComponentURL,
161*cdf0e10cSrcweir 					::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("_self")),
162*cdf0e10cSrcweir 					0,
163*cdf0e10cSrcweir 					i_rDispatchArgs.getPropertyValues()
164*cdf0e10cSrcweir 				);
165*cdf0e10cSrcweir 			}
166*cdf0e10cSrcweir             catch( const Exception& )
167*cdf0e10cSrcweir             {
168*cdf0e10cSrcweir                 DBG_UNHANDLED_EXCEPTION();
169*cdf0e10cSrcweir             }
170*cdf0e10cSrcweir 		}
171*cdf0e10cSrcweir 		return xReturn;
172*cdf0e10cSrcweir 	}
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir 	//----------------------------------------------------------------------
175*cdf0e10cSrcweir 	void DatabaseObjectView::fillDispatchArgs(
176*cdf0e10cSrcweir 			::comphelper::NamedValueCollection& i_rDispatchArgs,
177*cdf0e10cSrcweir 			const Any& _aDataSource,
178*cdf0e10cSrcweir             const ::rtl::OUString& /* _rName */
179*cdf0e10cSrcweir 		)
180*cdf0e10cSrcweir 	{
181*cdf0e10cSrcweir 		::rtl::OUString sDataSource;
182*cdf0e10cSrcweir 		Reference<XDataSource> xDataSource;
183*cdf0e10cSrcweir 		if ( _aDataSource >>= sDataSource )
184*cdf0e10cSrcweir 		{
185*cdf0e10cSrcweir             i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_DATASOURCENAME, sDataSource );
186*cdf0e10cSrcweir 		}
187*cdf0e10cSrcweir 		else if ( _aDataSource >>= xDataSource )
188*cdf0e10cSrcweir 		{
189*cdf0e10cSrcweir             i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_DATASOURCE, xDataSource );
190*cdf0e10cSrcweir 		}
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir         i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_ACTIVE_CONNECTION, getConnection() );
193*cdf0e10cSrcweir 	}
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir 	//======================================================================
196*cdf0e10cSrcweir 	//= QueryDesigner
197*cdf0e10cSrcweir 	//======================================================================
198*cdf0e10cSrcweir 	//----------------------------------------------------------------------
199*cdf0e10cSrcweir 	QueryDesigner::QueryDesigner( const Reference< XMultiServiceFactory >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication,
200*cdf0e10cSrcweir 		const Reference< XFrame >& _rxParentFrame, bool _bCreateView )
201*cdf0e10cSrcweir         :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, _bCreateView ? URL_COMPONENT_VIEWDESIGN : URL_COMPONENT_QUERYDESIGN )
202*cdf0e10cSrcweir         ,m_nCommandType( _bCreateView ? CommandType::TABLE : CommandType::QUERY )
203*cdf0e10cSrcweir 	{
204*cdf0e10cSrcweir 	}
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir 	//----------------------------------------------------------------------
207*cdf0e10cSrcweir 	void QueryDesigner::fillDispatchArgs( ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource,
208*cdf0e10cSrcweir 		const ::rtl::OUString& _rObjectName )
209*cdf0e10cSrcweir 	{
210*cdf0e10cSrcweir 		DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rObjectName );
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir 		const bool bIncludeQueryName = 0 != _rObjectName.getLength();
213*cdf0e10cSrcweir         const bool bGraphicalDesign = i_rDispatchArgs.getOrDefault( (::rtl::OUString)PROPERTY_GRAPHICAL_DESIGN, sal_True );
214*cdf0e10cSrcweir         const bool bEditViewAsSQLCommand = ( m_nCommandType == CommandType::TABLE ) && !bGraphicalDesign;
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir         i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND_TYPE, m_nCommandType );
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir         if ( bIncludeQueryName )
219*cdf0e10cSrcweir 		{
220*cdf0e10cSrcweir             i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND, _rObjectName );
221*cdf0e10cSrcweir         }
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir         if ( bEditViewAsSQLCommand )
224*cdf0e10cSrcweir         {
225*cdf0e10cSrcweir             i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_ESCAPE_PROCESSING, sal_False );
226*cdf0e10cSrcweir         }
227*cdf0e10cSrcweir 	}
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir 	//======================================================================
230*cdf0e10cSrcweir 	//= TableDesigner
231*cdf0e10cSrcweir 	//======================================================================
232*cdf0e10cSrcweir 	//----------------------------------------------------------------------
233*cdf0e10cSrcweir 	TableDesigner::TableDesigner( const Reference< XMultiServiceFactory >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame )
234*cdf0e10cSrcweir 		:DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< ::rtl::OUString >( URL_COMPONENT_TABLEDESIGN ) )
235*cdf0e10cSrcweir 	{
236*cdf0e10cSrcweir 	}
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir 	//----------------------------------------------------------------------
239*cdf0e10cSrcweir 	void TableDesigner::fillDispatchArgs( ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource,
240*cdf0e10cSrcweir 		const ::rtl::OUString& _rObjectName )
241*cdf0e10cSrcweir 	{
242*cdf0e10cSrcweir 		DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rObjectName );
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir         if ( 0 != _rObjectName.getLength() )
245*cdf0e10cSrcweir 		{
246*cdf0e10cSrcweir             i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_CURRENTTABLE, _rObjectName );
247*cdf0e10cSrcweir 		}
248*cdf0e10cSrcweir 	}
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir 	//----------------------------------------------------------------------
251*cdf0e10cSrcweir     Reference< XComponent > TableDesigner::doCreateView( const Any& _rDataSource, const ::rtl::OUString& _rObjectName,
252*cdf0e10cSrcweir         const ::comphelper::NamedValueCollection& i_rCreationArgs )
253*cdf0e10cSrcweir     {
254*cdf0e10cSrcweir         bool bIsNewDesign = ( _rObjectName.getLength() == 0 );
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir         // let's see whether the connection can provide a dedicated table desginer
257*cdf0e10cSrcweir         Reference< XInterface > xDesigner;
258*cdf0e10cSrcweir         if ( !bIsNewDesign )
259*cdf0e10cSrcweir             xDesigner = impl_getConnectionProvidedDesigner_nothrow( _rObjectName );
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir         if ( !xDesigner.is() )
262*cdf0e10cSrcweir             return DatabaseObjectView::doCreateView( _rDataSource, _rObjectName, i_rCreationArgs );
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir         // try whether the designer is a dialog
265*cdf0e10cSrcweir         Reference< XExecutableDialog > xDialog( xDesigner, UNO_QUERY_THROW );
266*cdf0e10cSrcweir         if ( xDialog.is() )
267*cdf0e10cSrcweir         {
268*cdf0e10cSrcweir             try { AsyncDialogExecutor::executeModalDialogAsync( xDialog ); }
269*cdf0e10cSrcweir             catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
270*cdf0e10cSrcweir             return NULL;
271*cdf0e10cSrcweir         }
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir         Reference< XComponent > xDesignerComponent( xDesigner, UNO_QUERY );
274*cdf0e10cSrcweir         OSL_ENSURE( xDesignerComponent.is(), "TableDesigner::doCreateView: a designer which is no dialog and no component?" );
275*cdf0e10cSrcweir         return xDesignerComponent;
276*cdf0e10cSrcweir     }
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir 	//----------------------------------------------------------------------
279*cdf0e10cSrcweir     Reference< XInterface > TableDesigner::impl_getConnectionProvidedDesigner_nothrow( const ::rtl::OUString& _rTableName )
280*cdf0e10cSrcweir     {
281*cdf0e10cSrcweir         Reference< XInterface > xDesigner;
282*cdf0e10cSrcweir         try
283*cdf0e10cSrcweir         {
284*cdf0e10cSrcweir             Reference< XTableUIProvider > xTableUIProv( getConnection(), UNO_QUERY );
285*cdf0e10cSrcweir             if ( xTableUIProv.is() )
286*cdf0e10cSrcweir                 xDesigner = xTableUIProv->getTableEditor( getApplicationUI(), _rTableName );
287*cdf0e10cSrcweir         }
288*cdf0e10cSrcweir         catch( const Exception& )
289*cdf0e10cSrcweir         {
290*cdf0e10cSrcweir         	DBG_UNHANDLED_EXCEPTION();
291*cdf0e10cSrcweir         }
292*cdf0e10cSrcweir         return xDesigner;
293*cdf0e10cSrcweir     }
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir     //======================================================================
296*cdf0e10cSrcweir 	//= ResultSetBrowser
297*cdf0e10cSrcweir 	//======================================================================
298*cdf0e10cSrcweir 	//----------------------------------------------------------------------
299*cdf0e10cSrcweir 	ResultSetBrowser::ResultSetBrowser( const Reference< XMultiServiceFactory >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame,
300*cdf0e10cSrcweir             sal_Bool _bTable )
301*cdf0e10cSrcweir 		:DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast < ::rtl::OUString >( URL_COMPONENT_DATASOURCEBROWSER ) )
302*cdf0e10cSrcweir 		,m_bTable(_bTable)
303*cdf0e10cSrcweir 	{
304*cdf0e10cSrcweir 	}
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir 	//----------------------------------------------------------------------
307*cdf0e10cSrcweir 	void ResultSetBrowser::fillDispatchArgs( ::comphelper::NamedValueCollection& i_rDispatchArgs, const Any& _aDataSource,
308*cdf0e10cSrcweir 		const ::rtl::OUString& _rQualifiedName)
309*cdf0e10cSrcweir 	{
310*cdf0e10cSrcweir 		DatabaseObjectView::fillDispatchArgs( i_rDispatchArgs, _aDataSource, _rQualifiedName );
311*cdf0e10cSrcweir 		OSL_ENSURE( 0 != _rQualifiedName.getLength(),"A Table name must be set");
312*cdf0e10cSrcweir 		::rtl::OUString sCatalog;
313*cdf0e10cSrcweir 		::rtl::OUString sSchema;
314*cdf0e10cSrcweir 		::rtl::OUString sTable;
315*cdf0e10cSrcweir 		if ( m_bTable )
316*cdf0e10cSrcweir 			::dbtools::qualifiedNameComponents( getConnection()->getMetaData(), _rQualifiedName, sCatalog, sSchema, sTable, ::dbtools::eInDataManipulation );
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir         i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND_TYPE, (m_bTable ? CommandType::TABLE : CommandType::QUERY) );
319*cdf0e10cSrcweir         i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_COMMAND, _rQualifiedName );
320*cdf0e10cSrcweir         i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_ENABLE_BROWSER, sal_False );
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir 		if ( m_bTable )
323*cdf0e10cSrcweir 		{
324*cdf0e10cSrcweir             i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_UPDATE_CATALOGNAME, sCatalog );
325*cdf0e10cSrcweir             i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_UPDATE_SCHEMANAME, sSchema );
326*cdf0e10cSrcweir             i_rDispatchArgs.put( (::rtl::OUString)PROPERTY_UPDATE_TABLENAME, sTable );
327*cdf0e10cSrcweir 		}
328*cdf0e10cSrcweir 	}
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir 	//======================================================================
331*cdf0e10cSrcweir 	//= RelationDesigner
332*cdf0e10cSrcweir 	//======================================================================
333*cdf0e10cSrcweir 	//----------------------------------------------------------------------
334*cdf0e10cSrcweir 	RelationDesigner::RelationDesigner( const Reference< XMultiServiceFactory >& _rxORB, const Reference< XDatabaseDocumentUI >& _rxApplication, const Reference< XFrame >& _rxParentFrame )
335*cdf0e10cSrcweir         :DatabaseObjectView( _rxORB, _rxApplication, _rxParentFrame, static_cast< ::rtl::OUString >( URL_COMPONENT_RELATIONDESIGN ) )
336*cdf0e10cSrcweir 	{
337*cdf0e10cSrcweir 	}
338*cdf0e10cSrcweir // .........................................................................
339*cdf0e10cSrcweir }	// namespace dbaui
340*cdf0e10cSrcweir // .........................................................................
341*cdf0e10cSrcweir 
342