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