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