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