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