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