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