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