1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef DBAUI_APPCONTROLLER_HXX
25 #define DBAUI_APPCONTROLLER_HXX
26 
27 #include "IApplicationController.hxx"
28 #include "AppElementType.hxx"
29 #include "callbacks.hxx"
30 #include "commontypes.hxx"
31 #include "dsntypes.hxx"
32 #include "genericcontroller.hxx"
33 #include "linkeddocuments.hxx"
34 #include "moduledbu.hxx"
35 #include "TableCopyHelper.hxx"
36 
37 /** === begin UNO includes === **/
38 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
39 #include <com/sun/star/container/XContainerListener.hpp>
40 #include <com/sun/star/sdb/application/XDatabaseDocumentUI.hpp>
41 #include <com/sun/star/util/XModifiable.hpp>
42 #include <com/sun/star/ui/XContextMenuInterception.hpp>
43 /** === end UNO includes === **/
44 
45 #include <comphelper/stl_types.hxx>
46 #include <comphelper/namedvaluecollection.hxx>
47 #include <comphelper/uno3.hxx>
48 #include <cppuhelper/implbase5.hxx>
49 #include <sot/storage.hxx>
50 #include <svtools/transfer.hxx>
51 #include <svx/dataaccessdescriptor.hxx>
52 #include <vcl/timer.hxx>
53 
54 #include <memory>
55 
56 class ListBox;
57 class SvLBoxEntry;
58 class SvTreeListBox;
59 class TransferableHelper;
60 class TransferableClipboardListener;
61 class SfxFilter;
62 
63 FORWARD_DECLARE_INTERFACE(container,XNameContainer)
64 FORWARD_DECLARE_INTERFACE(container,XContainer)
65 FORWARD_DECLARE_INTERFACE(ucb,XContent)
66 
67 //........................................................................
68 namespace dbaui
69 {
70 //........................................................................
71 
72     class SubComponentManager;
73 
74 	//====================================================================
75 	//= OApplicationController
76 	//====================================================================
77 	class OApplicationController;
78 	class OApplicationView;
79 	class OLinkedDocumentsAccess;
80 	typedef OGenericUnoController   OApplicationController_CBASE;
81     typedef ::cppu::ImplHelper5 <   ::com::sun::star::container::XContainerListener
82                                 ,   ::com::sun::star::beans::XPropertyChangeListener
83                                 ,   ::com::sun::star::sdb::application::XDatabaseDocumentUI
84                                 ,   ::com::sun::star::ui::XContextMenuInterception
85                                 ,   ::com::sun::star::view::XSelectionSupplier
86 								>	OApplicationController_Base;
87 
88     class SelectionNotifier;
89 
90 	class OApplicationController
91 			:public OApplicationController_CBASE
92 			,public OApplicationController_Base
93 			,public IApplicationController
94 	{
95 	public:
96         typedef ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer > TContainer;
97 		typedef ::std::vector< TContainer >                                                 TContainerVector;
98 
99 	private:
100 
101         OTableCopyHelper::DropDescriptor			m_aAsyncDrop;
102 
103         SharedConnection        m_xDataSourceConnection;
104         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >
105                                 m_xMetaData;
106 
107 		OModuleClient	        m_aModuleClient;
108 		TransferableDataHelper	m_aSystemClipboard;		// content of the clipboard
109 		::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
110                                 m_xDataSource;
111         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
112                                 m_xModel;
113         ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifiable >
114                                 m_xDocumentModify;
115         ::cppu::OInterfaceContainerHelper
116                                 m_aContextMenuInterceptors;
117 
118 		TContainerVector		m_aCurrentContainers;	    // the containers where we are listener on
119         ::rtl::Reference< SubComponentManager >
120                                 m_pSubComponentManager;
121         ::dbaccess::ODsnTypeCollection
122                                 m_aTypeCollection;
123         OTableCopyHelper        m_aTableCopyHelper;
124 		TransferableClipboardListener*
125 								m_pClipbordNotifier;		// notifier for changes in the clipboard
126 		sal_uLong					m_nAsyncDrop;
127         OAsyncronousLink        m_aControllerConnectedEvent;
128         OAsyncronousLink        m_aSelectContainerEvent;
129 		PreviewMode				m_ePreviewMode;				// the mode of the preview
130 		ElementType				m_eCurrentType;
131 		sal_Bool				m_bNeedToReconnect;			// true when the settings of the data source were modified and the connection is no longer up to date
132 		sal_Bool				m_bSuspended;	            // is true when the controller was already suspended
133 
134         ::std::auto_ptr< SelectionNotifier >
135                                 m_pSelectionNotifier;
136         typedef ::std::map< ElementType, ::std::vector< ::rtl::OUString > > SelectionByElementType;
137         SelectionByElementType  m_aPendingSelection;
138 
139     private:
140 
141 		OApplicationView*		getContainer() const;
142 
143 
144 		/** returns the database name
145 			@return
146 				the database name
147 		*/
148         ::rtl::OUString getDatabaseName() const;
149 
150 		/** returns the stripped database name.
151 			@return
152 				The stripped database name either the registered naem or if it is a file url the last segment.
153 		*/
154 		::rtl::OUString getStrippedDatabaseName() const;
155 
156 		/** return the element type for given container
157 			@param	_xContainer	The container where the element type has to be found
158 			@return	the element type coressponding to the given container
159 		*/
160 		ElementType getElementType(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& _xContainer) const;
161 
162 		/** opens a new frame with either the table or the query or report or form or view
163 			@param	_sName
164 				The name of the object to open
165 			@param	_eType
166 				Defines the type to open
167 			@param	_eOpenMode
168 				denotes the mode in which to open the object
169             @param _nInstigatorCommand
170                 denotes the command which instigated the action. Might be 0.
171 			@return the form or report model will only be returned, otherwise <NULL/>
172 		*/
173 		::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > openElement(
174             const ::rtl::OUString& _sName,
175             ElementType _eType,
176             ElementOpenMode _eOpenMode,
177             sal_uInt16 _nInstigatorCommand = 0
178         );
179 
180         /** opens a new sub frame with a table/query/form/report/view, passing additional arguments
181         */
182 		::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > openElementWithArguments(
183             const ::rtl::OUString& _sName,
184             ElementType _eType,
185             ElementOpenMode _eOpenMode,
186             sal_uInt16 _nInstigatorCommand,
187             const ::comphelper::NamedValueCollection& _rAdditionalArguments
188         );
189 
190 		/** opens a new frame for creation or auto pilot
191 			@param	_eType
192 				Defines the type to open
193 			@param	i_rAdditionalArguments
194 				Additional arguments to pass when creating the component
195 		*/
196         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
197             newElement(
198                 ElementType _eType,
199                 const ::comphelper::NamedValueCollection& i_rAdditionalArguments,
200                 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_rDocumentDefinition
201             );
202 
203         /** creates a new database object, using an auto pilot
204             @param _eType
205 				Defines the type of the object to create
206             @precond
207                 Our mutex must not be locked.
208             @since #i39203#
209         */
210 		void newElementWithPilot( ElementType _eType );
211 
212 		/** converts the query to a view
213 			@param	_sName
214 				The name of the query.
215 		*/
216 		void convertToView(const ::rtl::OUString& _sName);
217 
218 		/** checks if the connection for the selected data source is read only. If the connection doesn't exist, <TRUE/> will be returned.
219 			@return
220 				<TRUE/> if read only or doesn't exist, otherwise <FALSE/>
221 		*/
222 		sal_Bool isConnectionReadOnly() const;
223 
224 		/// fills the list with the selected entries.
225 		void getSelectionElementNames( ::std::vector< ::rtl::OUString>& _rNames ) const;
226 
227 		/// deletes the entries selected.
228 		void deleteEntries();
229 
230 		/// renames the selected entry in the detail page
231 		void renameEntry();
232 
233 		/** deletes queries, forms, or reports
234 			@param	_eType
235 				the type of the objects
236 			@param	_rList
237 				The names of the elements to delete
238 			@param	_bConfirm
239 				determines whether the user must confirm the deletion
240 		*/
241 		void deleteObjects(	ElementType _eType,
242 							const ::std::vector< ::rtl::OUString>& _rList,
243                             bool _bConfirm );
244 
245 		/** deletes tables.
246 			@param	_rList
247 				The list of tables.
248 		*/
249 		void deleteTables(const ::std::vector< ::rtl::OUString>& _rList);
250 
251 		/// copies the current object into clipboard
252 		TransferableHelper* copyObject();
253 
254 		/// returns the nameaccess
255 		::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getElements(ElementType _eType);
256 
257 		/** returns the document access for the specific type
258 			@param	_eType
259 				the type
260 			@return	::std::auto_ptr<OLinkedDocumentsAccess>
261 		*/
262 		::std::auto_ptr<OLinkedDocumentsAccess> getDocumentsAccess(ElementType _eType);
263 
264 		/// returns the query definitions of the active data source.
265 		::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer> getQueryDefintions() const;
266 
267 		/** pastes a special format from the system clipboard to the currently selected object types
268 			@param	_nFormatId
269 				The format to be copied.
270 		*/
271 		void pasteFormat(sal_uInt32 _nFormatId);
272 
273 		/** pastes a query, form or report into the data source
274 			@param	_eType
275 				The type of the object to paste.
276 			@param	_rPasteData
277 				The data descriptor.
278 			@param	_sParentFolder
279 				The name of the parent folder if it exists.
280 			@param	_bMove
281 				if <TRUE/> the name of the content must be inserted without any change, otherwise not.
282 			@return
283 				<TRUE/> if the paste opertions was successfull, otherwise <FALSE/>.
284 		*/
285 		sal_Bool paste( ElementType _eType,const ::svx::ODataAccessDescriptor& _rPasteData ,const String& _sParentFolder = String(),sal_Bool _bMove = sal_False);
286 
287 		/// returns the system clipboard.
getViewClipboard() const288 		const TransferableDataHelper& getViewClipboard() const { return m_aSystemClipboard; }
289 
290 		/// returns <TRUE/> if the clipboard supports a table format, otherwise <FALSE/>.
291 		sal_Bool isTableFormat() const;
292 
293 		/** fills the vector with all supported formats
294 			@param	_eType
295 				The type for which we need the formats
296 			@param	_rFormatIds
297 				The vector to be filled up.
298 		*/
299 		void getSupportedFormats(ElementType _eType,::std::vector<SotFormatStringId>& _rFormatIds) const;
300 
301 		/** adds a listener to the current name access.
302 			@param	_xCollection
303 				The collection where we want to listen on.
304 		*/
305 		void addContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _xCollection);
306 
307 		/** opens a uno dialog withthe currently selected data source as initialize argument
308 			@param	_sServiceName
309 				The serivce name of the dialog to be executed.
310 		*/
311 		void openDialog(const ::rtl::OUString& _sServiceName);
312 
313 		/** opens the administration dialog for the selected data source
314 		*/
315 		void openDataSourceAdminDialog();
316 
317 		/** opens the table filter dialog for the selected data source
318 		*/
319 		void openTableFilterDialog();
320 
321 		/** opens the DirectSQLDialog to execute hand made sql statements.
322 		*/
323 		void openDirectSQLDialog();
324 
325 		/** when the settings of the data source changed,
326 			it opens a dialog which ask to close all depending documents, then recreate the connection.
327 			The SolarMutex has to be locked before calling this.
328 		*/
329 		void askToReconnect();
330 
331 		/** remember a newly opened sub document for later access
332 		*/
333 		void onDocumentOpened(
334             const ::rtl::OUString&  _rName,
335             const sal_Int32         _nType,
336             const ElementOpenMode   _eMode,
337             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _xDocument,
338 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _xDefinition
339         );
340 
341 		/** Inserts a new object into the hierachy given be the type.
342 			@param	_eType
343 				Where to insert the new item.
344 			@param	_sParentFolder
345 				The name of the parent folder if it exists.
346 			@param	_xContent
347 				The content to insert.
348 			@param	_bMove
349 				if <TRUE/> the name of the content must be inserted without any change, otherwise not.
350 			@return
351 				<TRUE/> if the insert opertions was successfull, otherwise <FALSE/>.
352 		*/
353 		sal_Bool insertHierachyElement(	 ElementType _eType
354 									,const String& _sParentFolder
355 									,sal_Bool _bCollection = sal_True
356 									,const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>& _xContent = ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContent>()
357 									,sal_Bool _bMove = sal_False);
358 		/** checks if delete command or rename comamnd is allowed
359 			@param	_eType
360 				The element type.
361 			@param	_bDelete
362 				If <TRUE> then the delete command should be checked.
363 			@return
364 				<TRUE> if the command is allowed
365 		*/
366 		sal_Bool isRenameDeleteAllowed(ElementType _eType,sal_Bool _bDelete) const;
367 		/** all selected entries will be opened, or edited, or converted to a view
368 			@param	_nId
369 				The slot which should be executed.
370 			@param	_eOpenMode
371 				Defines the mode of opening. @see ElementOpenMode
372 		*/
373 		void doAction(sal_uInt16 _nId ,ElementOpenMode _eOpenMode);
374 
375         /** returns the currently selected table or query name.
376         *
377         * \return the name of the currently table or query. If the tables or query container is selected otherwise an empty string will be returned.
378         */
379         ::rtl::OUString getCurrentlySelectedName(sal_Int32& _rnCommandType) const;
380 
381         /** shows the preview for the given entry
382         */
383         void showPreviewFor( const ElementType _eType,const ::rtl::OUString& _sName );
384 
385         /** called we were attached to a frame
386 
387             In particular, this is called *after* the controller has been announced to the model
388             (XModel::connectController)
389         */
390         void onAttachedFrame();
391 
392         /// determines whether the given table name denotes a view which can be altered
393         bool    impl_isAlterableView_nothrow( const ::rtl::OUString& _rTableOrViewName ) const;
394 
395         /** does the macro/script migration, where macros/scripts in forms/reports are moved
396             to the database document itself.
397         */
398         void    impl_migrateScripts_nothrow();
399 
400         /** verifies the object type denotes a valid DatabaseObject, and the object name denotes an existing
401             object of this type. Throws if not.
402         */
403         void    impl_validateObjectTypeAndName_throw( const sal_Int32 _nObjectType, const ::boost::optional< ::rtl::OUString >& i_rObjectName );
404 
405 	protected:
406 		// ----------------------------------------------------------------
407 		// initalizing members
408 		/** forces usage of a connection which we do not own
409 			<p>To be used from within XInitialization::initialize only.</p>
410 		*/
411 		void					initializeConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxForeignConn );
412 
413 		// state of a feature. 'feature' may be the handle of a ::com::sun::star::util::URL somebody requested a dispatch interface for OR a toolbar slot.
414 		virtual FeatureState	GetState(sal_uInt16 nId) const;
415 		// execute a feature
416 		virtual void			Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
417 
418 		// OGenericUnoController
419         virtual void            onLoadedMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& _xLayoutManager );
420 
getPrivateModel() const421         virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getPrivateModel() const
422         {
423             return m_xModel;
424         }
425 
426 		virtual ~OApplicationController();
427 
428     public:
429 		OApplicationController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
430 
431 		DECLARE_XINTERFACE( )
432 		DECLARE_XTYPEPROVIDER( )
433 
434 		// XServiceInfo
435 		virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
436 		virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
437 		// need by registration
438 		static ::rtl::OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException );
439 		static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
440 		static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
441 				SAL_CALL Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
442 
443 		// ::com::sun::star::frame::XController
444 		virtual void SAL_CALL attachFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & xFrame) throw( ::com::sun::star::uno::RuntimeException );
445 		virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException );
446 		virtual sal_Bool SAL_CALL attachModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel) throw( ::com::sun::star::uno::RuntimeException );
447 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >  SAL_CALL getModel(void) throw( ::com::sun::star::uno::RuntimeException );
448 
449 		// ::com::sun::star::container::XContainerListener
450 		virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
451 		virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
452 		virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
453 
454 		// XPropertyChangeListener
455 		virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
456 
457         // XDatabaseDocumentUI
458         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > SAL_CALL getDataSource() throw (::com::sun::star::uno::RuntimeException);
459         virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getApplicationMainWindow() throw (::com::sun::star::uno::RuntimeException);
460         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > SAL_CALL getActiveConnection() throw (::com::sun::star::uno::RuntimeException);
461         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > > SAL_CALL getSubComponents() throw (::com::sun::star::uno::RuntimeException);
462         virtual ::sal_Bool SAL_CALL isConnected(  ) throw (::com::sun::star::uno::RuntimeException);
463         virtual void SAL_CALL connect(  ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
464         virtual ::com::sun::star::beans::Pair< ::sal_Int32, ::rtl::OUString > SAL_CALL identifySubComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& SubComponent ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
465         virtual ::sal_Bool SAL_CALL closeSubComponents(  ) throw (::com::sun::star::uno::RuntimeException);
466         virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL loadComponent( ::sal_Int32 ObjectType, const ::rtl::OUString& ObjectName, ::sal_Bool ForEditing ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
467         virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL loadComponentWithArguments( ::sal_Int32 ObjectType, const ::rtl::OUString& ObjectName, ::sal_Bool ForEditing, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
468         virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL createComponent( ::sal_Int32 ObjectType, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_DocumentDefinition ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
469         virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL createComponentWithArguments( ::sal_Int32 ObjectType, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Arguments, ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& o_DocumentDefinition ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
470 
471         // XContextMenuInterception
472         virtual void SAL_CALL registerContextMenuInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XContextMenuInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException);
473         virtual void SAL_CALL releaseContextMenuInterceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XContextMenuInterceptor >& Interceptor ) throw (::com::sun::star::uno::RuntimeException);
474 
475         // XSelectionSupplier
476         virtual ::sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& xSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
477         virtual ::com::sun::star::uno::Any SAL_CALL getSelection(  ) throw (::com::sun::star::uno::RuntimeException);
478         virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
479         virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
480 
481 		/** retrieves the current connection, creates it if necessary
482 
483             If an error occurs, then this is either stored in the location pointed to by <arg>_pErrorInfo</arg>,
484             or, if <code>_pErrorInfo</code> is <NULL/>, then the error is displayed to the user.
485 		*/
486         const SharedConnection& ensureConnection( ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL );
487 
488 		/** retrieves the current connection
489 		*/
getConnection() const490         const SharedConnection& getConnection() const { return m_xDataSourceConnection; }
491 
492         /// determines whether we're currently connected to the database
isConnected() const493         bool isConnected() const { return m_xDataSourceConnection.is(); }
494 
495         const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >&
getConnectionMetaData() const496             getConnectionMetaData() const { return m_xMetaData; }
497 
498 		/** refreshes the tables
499 		*/
500 		void refreshTables();
501 
502         // IApplicationController
503 		virtual bool onEntryDoubleClick(SvTreeListBox& _rTree);
504 		virtual sal_Bool onContainerSelect(ElementType _eType);
505 		virtual void onSelectionChanged();
506 		virtual void onCutEntry();
507 		virtual void onCopyEntry();
508 		virtual void onPasteEntry();
509 		virtual void onDeleteEntry();
510 		virtual void previewChanged( sal_Int32 _nMode);
511 		virtual void containerFound( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& _xContainer);
512 
513         // IController (base of IApplicationController)
514 		virtual void        executeUnChecked(const ::com::sun::star::util::URL& _rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
515         virtual void        executeChecked(const ::com::sun::star::util::URL& _rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
516 		virtual void        executeUnChecked(sal_uInt16 _nCommandId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
517 		virtual void        executeChecked(sal_uInt16 _nCommandId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
518 		virtual sal_Bool    isCommandEnabled(sal_uInt16 _nCommandId) const;
519         virtual sal_Bool    isCommandEnabled( const ::rtl::OUString& _rCompleteCommandURL ) const;
520         virtual sal_uInt16  registerCommandURL( const ::rtl::OUString& _rCompleteCommandURL );
521 		virtual void        notifyHiContrastChanged();
522 		virtual sal_Bool    isDataSourceReadOnly() const;
523 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
524                             getXController(void) throw( ::com::sun::star::uno::RuntimeException );
525         virtual bool        interceptUserInput( const NotifyEvent& _rEvent );
526 
527 		// IControlActionListener overridables
528 		virtual sal_Bool        requestQuickHelp( const SvLBoxEntry* _pEntry, String& _rText ) const;
529 		virtual sal_Bool		requestDrag( sal_Int8 _nAction, const Point& _rPosPixel );
530 		virtual sal_Int8		queryDrop( const AcceptDropEvent& _rEvt, const DataFlavorExVector& _rFlavors );
531 		virtual sal_Int8		executeDrop( const ExecuteDropEvent& _rEvt );
532 
533         // IContextMenuProvider (base of IApplicationController)
534         virtual PopupMenu*      getContextMenu( Control& _rControl ) const;
535         virtual IController&    getCommandController();
536         virtual ::cppu::OInterfaceContainerHelper*
537                                 getContextMenuInterceptors();
538         virtual ::com::sun::star::uno::Any
539                                 getCurrentSelection( Control& _rControl ) const;
540 
541 		DECL_LINK( OnInvalidateClipboard, void* );
542 		DECL_LINK( OnClipboardChanged, void* );
543 		DECL_LINK( OnAsyncDrop, void* );
544 		DECL_LINK( OnCreateWithPilot, void* );
545         DECL_LINK( OnSelectContainer, void* );
546         DECL_LINK( OnFirstControllerConnected, void* );
547 
548     protected:
549         using OApplicationController_CBASE::connect;
550 
551 		/** disconnects from our XConnection, and cleans up this connection
552 		*/
553 		virtual void		disconnect();
554 
555 		// late construction
556 		virtual sal_Bool	Construct(Window* pParent);
557 		virtual void		describeSupportedFeatures();
558 
559 	protected:
560 		// XEventListener
561 		virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
562 
563 		// OComponentHelper
564 		virtual void SAL_CALL disposing();
565 	};
566 
567 //........................................................................
568 }	// namespace dbaui
569 //........................................................................
570 
571 #endif // DBAUI_APPCONTROLLER_HXX
572 
573