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_GENERICCONTROLLER_HXX 25cdf0e10cSrcweir #define DBAUI_GENERICCONTROLLER_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "AsyncronousLink.hxx" 28cdf0e10cSrcweir #include "controllerframe.hxx" 29cdf0e10cSrcweir #include "dbaccessdllapi.h" 30cdf0e10cSrcweir #include "IController.hxx" 31cdf0e10cSrcweir 32cdf0e10cSrcweir /** === begin UNO includes === **/ 33cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 34cdf0e10cSrcweir #include <com/sun/star/frame/CommandGroup.hpp> 35cdf0e10cSrcweir #include <com/sun/star/frame/XController2.hpp> 36cdf0e10cSrcweir #include <com/sun/star/frame/XDispatch.hpp> 37cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchInformationProvider.hpp> 38cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> 39cdf0e10cSrcweir #include <com/sun/star/frame/XFrameActionListener.hpp> 40cdf0e10cSrcweir #include <com/sun/star/frame/XTitle.hpp> 41cdf0e10cSrcweir #include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> 42cdf0e10cSrcweir #include <com/sun/star/frame/XLayoutManager.hpp> 43cdf0e10cSrcweir #include <com/sun/star/lang/XInitialization.hpp> 44cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 45cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp> 46cdf0e10cSrcweir #include <com/sun/star/sdbc/XDataSource.hpp> 47cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 48cdf0e10cSrcweir #include <com/sun/star/util/XModifyListener.hpp> 49cdf0e10cSrcweir #include <com/sun/star/util/XURLTransformer.hpp> 50cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 51cdf0e10cSrcweir #include <com/sun/star/awt/XUserInputInterception.hpp> 52cdf0e10cSrcweir /** === end UNO includes === **/ 53cdf0e10cSrcweir 54cdf0e10cSrcweir #include <comphelper/broadcasthelper.hxx> 55cdf0e10cSrcweir #include <comphelper/sharedmutex.hxx> 56cdf0e10cSrcweir #include <comphelper/namedvaluecollection.hxx> 57cdf0e10cSrcweir #include <comphelper/stl_types.hxx> 58cdf0e10cSrcweir #include <connectivity/dbexception.hxx> 59cdf0e10cSrcweir #include <cppuhelper/compbase11.hxx> 60cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h> 61cdf0e10cSrcweir 62cdf0e10cSrcweir #include <boost/optional.hpp> 63cdf0e10cSrcweir #include <sfx2/userinputinterception.hxx> 64cdf0e10cSrcweir 65cdf0e10cSrcweir namespace dbtools 66cdf0e10cSrcweir { 67cdf0e10cSrcweir class SQLExceptionInfo; 68cdf0e10cSrcweir } 69cdf0e10cSrcweir 70cdf0e10cSrcweir class Window; 71cdf0e10cSrcweir class VCLXWindow; 72cdf0e10cSrcweir namespace dbaui 73cdf0e10cSrcweir { 74cdf0e10cSrcweir class ODataView; 75cdf0e10cSrcweir 76cdf0e10cSrcweir // ==================================================================== 77cdf0e10cSrcweir // = optional 78cdf0e10cSrcweir // ==================================================================== 79cdf0e10cSrcweir /** convenience wrapper around boost::optional, allowing typed assignments 80cdf0e10cSrcweir */ 81cdf0e10cSrcweir template < typename T > 82cdf0e10cSrcweir class optional : public ::boost::optional< T > 83cdf0e10cSrcweir { 84cdf0e10cSrcweir typedef ::boost::optional< T > base_type; 85cdf0e10cSrcweir 86cdf0e10cSrcweir public: optional()87cdf0e10cSrcweir optional ( ) : base_type( ) { } optional(T const & val)88cdf0e10cSrcweir explicit optional ( T const& val ) : base_type( val ) { } optional(optional const & rhs)89cdf0e10cSrcweir optional ( optional const& rhs ) : base_type( (base_type const&)rhs ) { } 90cdf0e10cSrcweir 91cdf0e10cSrcweir public: operator =(T const & rhs)92cdf0e10cSrcweir optional& operator= ( T const& rhs ) 93cdf0e10cSrcweir { 94cdf0e10cSrcweir base_type::reset( rhs ); 95cdf0e10cSrcweir return *this; 96cdf0e10cSrcweir } operator =(optional<T> const & rhs)97cdf0e10cSrcweir optional& operator= ( optional< T > const& rhs ) 98cdf0e10cSrcweir { 99cdf0e10cSrcweir if ( rhs.is_initialized() ) 100cdf0e10cSrcweir base_type::reset( rhs.get() ); 101cdf0e10cSrcweir else 102cdf0e10cSrcweir base_type::reset(); 103cdf0e10cSrcweir return *this; 104cdf0e10cSrcweir } 105cdf0e10cSrcweir }; 106cdf0e10cSrcweir 107cdf0e10cSrcweir template< typename T > operator >>=(const::com::sun::star::uno::Any & _any,optional<T> & _value)108cdf0e10cSrcweir inline bool SAL_CALL operator >>= ( const ::com::sun::star::uno::Any & _any, optional< T >& _value ) 109cdf0e10cSrcweir { 110cdf0e10cSrcweir _value.reset(); // de-init the optional value 111cdf0e10cSrcweir 112cdf0e10cSrcweir T directValue = T(); 113cdf0e10cSrcweir if ( _any >>= directValue ) 114cdf0e10cSrcweir _value.reset( directValue ); 115cdf0e10cSrcweir 116cdf0e10cSrcweir return !!_value; 117cdf0e10cSrcweir } 118cdf0e10cSrcweir 119cdf0e10cSrcweir // ==================================================================== 120cdf0e10cSrcweir // = FeatureState 121cdf0e10cSrcweir // ==================================================================== 122cdf0e10cSrcweir /** describes the state of a feature 123cdf0e10cSrcweir 124cdf0e10cSrcweir In opposite to the FeatureStateEvent in css.frame, this one allows for multiple states to be specified at once. 125cdf0e10cSrcweir With this, you can for instance specify that a toolbox item is checked, and has a certain title, at the same 126cdf0e10cSrcweir time. 127cdf0e10cSrcweir */ 128cdf0e10cSrcweir struct FeatureState 129cdf0e10cSrcweir { 130cdf0e10cSrcweir sal_Bool bEnabled; 131cdf0e10cSrcweir 132cdf0e10cSrcweir optional< bool > bChecked; 133cdf0e10cSrcweir optional< bool > bInvisible; 134cdf0e10cSrcweir ::com::sun::star::uno::Any aValue; 135cdf0e10cSrcweir optional< ::rtl::OUString > sTitle; 136cdf0e10cSrcweir FeatureStatedbaui::FeatureState137cdf0e10cSrcweir FeatureState() : bEnabled(sal_False) { } 138cdf0e10cSrcweir }; 139cdf0e10cSrcweir 140cdf0e10cSrcweir // ==================================================================== 141cdf0e10cSrcweir // = helper 142cdf0e10cSrcweir // ==================================================================== 143cdf0e10cSrcweir 144cdf0e10cSrcweir // .................................................................... 145cdf0e10cSrcweir struct ControllerFeature : public ::com::sun::star::frame::DispatchInformation 146cdf0e10cSrcweir { 147cdf0e10cSrcweir sal_uInt16 nFeatureId; 148cdf0e10cSrcweir }; 149cdf0e10cSrcweir 150cdf0e10cSrcweir // .................................................................... 151cdf0e10cSrcweir typedef ::std::map < ::rtl::OUString 152cdf0e10cSrcweir , ControllerFeature 153cdf0e10cSrcweir , ::std::less< ::rtl::OUString > 154cdf0e10cSrcweir > SupportedFeatures; 155cdf0e10cSrcweir 156cdf0e10cSrcweir // .................................................................... 157cdf0e10cSrcweir struct CompareFeatureById : ::std::binary_function< SupportedFeatures::value_type, sal_Int32, bool > 158cdf0e10cSrcweir { 159cdf0e10cSrcweir // ................................................................ operator ()dbaui::CompareFeatureById160cdf0e10cSrcweir inline bool operator()( const SupportedFeatures::value_type& _aType, const sal_Int32& _nId ) const 161cdf0e10cSrcweir { 162cdf0e10cSrcweir return !!( _nId == _aType.second.nFeatureId ); 163cdf0e10cSrcweir } 164cdf0e10cSrcweir }; 165cdf0e10cSrcweir 166cdf0e10cSrcweir // .................................................................... 167cdf0e10cSrcweir struct FeatureListener 168cdf0e10cSrcweir { 169cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > 170cdf0e10cSrcweir xListener; 171cdf0e10cSrcweir sal_Int32 nId; 172cdf0e10cSrcweir sal_Bool bForceBroadcast; 173cdf0e10cSrcweir }; 174cdf0e10cSrcweir 175cdf0e10cSrcweir // .................................................................... 176cdf0e10cSrcweir typedef ::std::deque< FeatureListener > FeatureListeners; 177cdf0e10cSrcweir 178cdf0e10cSrcweir // .................................................................... 179cdf0e10cSrcweir struct FindFeatureListener : ::std::binary_function< FeatureListener, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >, bool > 180cdf0e10cSrcweir { 181cdf0e10cSrcweir // ................................................................ operator ()dbaui::FindFeatureListener182cdf0e10cSrcweir inline bool operator()( const FeatureListener& lhs, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& rhs ) const 183cdf0e10cSrcweir { 184cdf0e10cSrcweir return !!( lhs.xListener == rhs ); 185cdf0e10cSrcweir } 186cdf0e10cSrcweir }; 187cdf0e10cSrcweir 188cdf0e10cSrcweir // .................................................................... 189cdf0e10cSrcweir typedef ::comphelper::SharedMutexBase OGenericUnoController_MBASE; 190cdf0e10cSrcweir 191cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper11 < ::com::sun::star::frame::XDispatch 192cdf0e10cSrcweir , ::com::sun::star::frame::XDispatchProviderInterceptor 193cdf0e10cSrcweir , ::com::sun::star::util::XModifyListener 194cdf0e10cSrcweir , ::com::sun::star::frame::XFrameActionListener 195cdf0e10cSrcweir , ::com::sun::star::lang::XInitialization 196cdf0e10cSrcweir , ::com::sun::star::lang::XServiceInfo 197cdf0e10cSrcweir , ::com::sun::star::frame::XDispatchInformationProvider 198cdf0e10cSrcweir , ::com::sun::star::frame::XController2 199cdf0e10cSrcweir , ::com::sun::star::frame::XTitle 200cdf0e10cSrcweir , ::com::sun::star::frame::XTitleChangeBroadcaster 201cdf0e10cSrcweir , ::com::sun::star::awt::XUserInputInterception 202cdf0e10cSrcweir > OGenericUnoController_Base; 203cdf0e10cSrcweir 204cdf0e10cSrcweir struct OGenericUnoController_Data; 205cdf0e10cSrcweir // ==================================================================== 206cdf0e10cSrcweir class DBACCESS_DLLPUBLIC OGenericUnoController 207cdf0e10cSrcweir :public OGenericUnoController_MBASE 208cdf0e10cSrcweir ,public OGenericUnoController_Base 209cdf0e10cSrcweir ,public IController 210cdf0e10cSrcweir { 211cdf0e10cSrcweir private: 212cdf0e10cSrcweir SupportedFeatures m_aSupportedFeatures; 213cdf0e10cSrcweir ::comphelper::NamedValueCollection 214cdf0e10cSrcweir m_aInitParameters; 215cdf0e10cSrcweir 216cdf0e10cSrcweir ::std::auto_ptr< OGenericUnoController_Data > 217cdf0e10cSrcweir m_pData; 218cdf0e10cSrcweir ODataView* m_pView; // our (VCL) "main window" 219cdf0e10cSrcweir 220cdf0e10cSrcweir #ifdef DBG_UTIL 221cdf0e10cSrcweir bool m_bDescribingSupportedFeatures; 222cdf0e10cSrcweir #endif 223cdf0e10cSrcweir 224cdf0e10cSrcweir protected: 225cdf0e10cSrcweir // ---------------------------------------------------------------- 226cdf0e10cSrcweir // attributes 227cdf0e10cSrcweir struct DispatchTarget 228cdf0e10cSrcweir { 229cdf0e10cSrcweir ::com::sun::star::util::URL aURL; 230cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xListener; 231cdf0e10cSrcweir DispatchTargetdbaui::OGenericUnoController::DispatchTarget232cdf0e10cSrcweir DispatchTarget() { } DispatchTargetdbaui::OGenericUnoController::DispatchTarget233cdf0e10cSrcweir DispatchTarget(const ::com::sun::star::util::URL& rURL, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xRef) : aURL(rURL), xListener(xRef) { } 234cdf0e10cSrcweir }; 235cdf0e10cSrcweir 236cdf0e10cSrcweir DECLARE_STL_MAP( sal_uInt16, FeatureState, ::std::less< sal_uInt16 >, StateCache ); 237cdf0e10cSrcweir DECLARE_STL_VECTOR( DispatchTarget, Dispatch); 238cdf0e10cSrcweir 239cdf0e10cSrcweir FeatureListeners m_aFeaturesToInvalidate; 240cdf0e10cSrcweir 241cdf0e10cSrcweir ::osl::Mutex m_aFeatureMutex; // locked when features are append to or remove from deque 242cdf0e10cSrcweir StateCache m_aStateCache; // save the current status of feature state 243cdf0e10cSrcweir Dispatch m_arrStatusListener; // all our listeners where we dispatch status changes 244cdf0e10cSrcweir OAsyncronousLink m_aAsyncInvalidateAll; 245cdf0e10cSrcweir OAsyncronousLink m_aAsyncCloseTask; // called when a task shoud be closed 246cdf0e10cSrcweir 247cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xUrlTransformer; // needed sometimes 248cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; 249cdf0e10cSrcweir ControllerFrame m_aCurrentFrame; 250cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xSlaveDispatcher; // for intercepting dispatches 251cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xMasterDispatcher; // dito 252cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xDatabaseContext; 253cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitle > m_xTitleHelper; 254cdf0e10cSrcweir 255cdf0e10cSrcweir sal_Bool m_bPreview; 256cdf0e10cSrcweir sal_Bool m_bReadOnly; 257cdf0e10cSrcweir 258cdf0e10cSrcweir sal_Bool m_bCurrentlyModified : 1; 259cdf0e10cSrcweir sal_Bool m_bExternalTitle : 1; 260cdf0e10cSrcweir 261cdf0e10cSrcweir 262cdf0e10cSrcweir 263cdf0e10cSrcweir // ---------------------------------------------------------------- 264cdf0e10cSrcweir // attribute access getMutex() const265cdf0e10cSrcweir ::osl::Mutex& getMutex() const { return OGenericUnoController_MBASE::getMutex(); } getBroadcastHelper()266cdf0e10cSrcweir ::cppu::OBroadcastHelper& getBroadcastHelper() { return OGenericUnoController_Base::rBHelper; } 267cdf0e10cSrcweir 268cdf0e10cSrcweir // ---------------------------------------------------------------- 269cdf0e10cSrcweir // methods 270cdf0e10cSrcweir OGenericUnoController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM ); 271cdf0e10cSrcweir const ::comphelper::NamedValueCollection& getInitParams() const272cdf0e10cSrcweir getInitParams() const { return m_aInitParameters; } 273cdf0e10cSrcweir 274cdf0e10cSrcweir 275cdf0e10cSrcweir /** open the help agent for the given help id. 276cdf0e10cSrcweir @param _nHelpId 277cdf0e10cSrcweir The help id to dispatch. 278cdf0e10cSrcweir */ 279cdf0e10cSrcweir void openHelpAgent( const rtl::OString& _sHelpId ); 280cdf0e10cSrcweir 281cdf0e10cSrcweir /** open the help agent for the given help url. 282cdf0e10cSrcweir @param _pHelpStringURL 283cdf0e10cSrcweir The help url to dispatch. 284cdf0e10cSrcweir */ 285cdf0e10cSrcweir void openHelpAgent( const rtl::OUString& _suHelpStringURL ); 286cdf0e10cSrcweir 287cdf0e10cSrcweir /** opens the given Help URL in the help agent 288cdf0e10cSrcweir 289cdf0e10cSrcweir The URL does not need to be parsed already, it is passed through 290cdf0e10cSrcweir XURLTransformer::parseStrict before it is used. 291cdf0e10cSrcweir */ 292cdf0e10cSrcweir void openHelpAgent( const ::com::sun::star::util::URL& _rURL ); 293cdf0e10cSrcweir 294cdf0e10cSrcweir // closes the task when possible 295cdf0e10cSrcweir void closeTask(); 296cdf0e10cSrcweir 297cdf0e10cSrcweir // if getMenu returns a non empty string than this will be dispatched at the frame 298cdf0e10cSrcweir virtual void loadMenu(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame); 299cdf0e10cSrcweir 300cdf0e10cSrcweir /** called when our menu has been loaded into our frame, can be used to load sub toolbars 301cdf0e10cSrcweir 302cdf0e10cSrcweir @param _xLayoutManager 303cdf0e10cSrcweir The layout manager. 304cdf0e10cSrcweir */ 305cdf0e10cSrcweir virtual void onLoadedMenu(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& _xLayoutManager); 306cdf0e10cSrcweir 307cdf0e10cSrcweir // all the features which should be handled by this class 308cdf0e10cSrcweir virtual void describeSupportedFeatures(); 309cdf0e10cSrcweir 310cdf0e10cSrcweir // 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. 311cdf0e10cSrcweir virtual FeatureState GetState(sal_uInt16 nId) const; 312cdf0e10cSrcweir // execute a feature 313cdf0e10cSrcweir virtual void Execute(sal_uInt16 nId , const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs); 314cdf0e10cSrcweir 315cdf0e10cSrcweir /** describes a feature supported by the controller 316cdf0e10cSrcweir 317cdf0e10cSrcweir Must not be called outside <member>describeSupportedFeatures</member>. 318cdf0e10cSrcweir 319cdf0e10cSrcweir @param _pAsciiCommandURL 320cdf0e10cSrcweir the URL of the feature command 321cdf0e10cSrcweir @param _nFeatureId 322cdf0e10cSrcweir the id of the feature. Later references to this feature usually happen by id, not by 323cdf0e10cSrcweir URL 324cdf0e10cSrcweir @param _nCommandGroup 325cdf0e10cSrcweir the command group of the feature. This is important for configuring the controller UI 326cdf0e10cSrcweir by the user, see also <type scope="com::sun::star::frame">CommandGroup</type>. 327cdf0e10cSrcweir */ 328cdf0e10cSrcweir void implDescribeSupportedFeature( 329cdf0e10cSrcweir const sal_Char* _pAsciiCommandURL, 330cdf0e10cSrcweir sal_uInt16 _nFeatureId, 331cdf0e10cSrcweir sal_Int16 _nCommandGroup = ::com::sun::star::frame::CommandGroup::INTERNAL 332cdf0e10cSrcweir ); 333cdf0e10cSrcweir 334cdf0e10cSrcweir /** returns <TRUE/> if the feature is supported, otherwise <FALSE/> 335cdf0e10cSrcweir @param _nId 336cdf0e10cSrcweir The ID of the feature. 337cdf0e10cSrcweir */ 338cdf0e10cSrcweir sal_Bool isFeatureSupported( sal_Int32 _nId ); 339cdf0e10cSrcweir 340cdf0e10cSrcweir // gets the URL which the given id is assigned to 341cdf0e10cSrcweir ::com::sun::star::util::URL getURLForId(sal_Int32 _nId) const; 342cdf0e10cSrcweir 343cdf0e10cSrcweir /** determines whether the given feature ID denotes a user-defined feature 344cdf0e10cSrcweir 345cdf0e10cSrcweir @see IController::registerCommandURL 346cdf0e10cSrcweir */ 347cdf0e10cSrcweir bool isUserDefinedFeature( const sal_uInt16 nFeatureId ) const; 348cdf0e10cSrcweir 349cdf0e10cSrcweir /** determines whether the given feature URL denotes a user-defined feature 350cdf0e10cSrcweir 351cdf0e10cSrcweir @see IController::registerCommandURL 352cdf0e10cSrcweir */ 353cdf0e10cSrcweir bool isUserDefinedFeature( const ::rtl::OUString& _rFeatureURL ) const; 354cdf0e10cSrcweir 355cdf0e10cSrcweir // connect to a datasource 356cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > connect( 357cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource>& _xDataSource, 358cdf0e10cSrcweir ::dbtools::SQLExceptionInfo* _pErrorInfo 359cdf0e10cSrcweir ); 360cdf0e10cSrcweir 361cdf0e10cSrcweir // connect to a datasource 362cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > connect( 363cdf0e10cSrcweir const ::rtl::OUString& _rsDataSourceName, 364cdf0e10cSrcweir const ::rtl::OUString& _rContextInformation, 365cdf0e10cSrcweir ::dbtools::SQLExceptionInfo* _pErrorInfo 366cdf0e10cSrcweir ); 367cdf0e10cSrcweir 368cdf0e10cSrcweir void startConnectionListening(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection); 369cdf0e10cSrcweir void stopConnectionListening(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection); 370cdf0e10cSrcweir 371cdf0e10cSrcweir /** return the container window of the top most frame 372cdf0e10cSrcweir @return 373cdf0e10cSrcweir The top most container window, nmay be <NULL/>. 374cdf0e10cSrcweir */ 375cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> getTopMostContainerWindow() const; 376cdf0e10cSrcweir 377cdf0e10cSrcweir // XInitialize will be called inside initialize 378cdf0e10cSrcweir virtual void impl_initialize(); 379cdf0e10cSrcweir getPrivateTitle() const380cdf0e10cSrcweir virtual ::rtl::OUString getPrivateTitle() const { return ::rtl::OUString(); } 381cdf0e10cSrcweir 382cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitle > impl_getTitleHelper_throw(); getPrivateModel() const383cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getPrivateModel() const 384cdf0e10cSrcweir { 385cdf0e10cSrcweir return ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >(); 386cdf0e10cSrcweir } 387cdf0e10cSrcweir 388cdf0e10cSrcweir virtual void startFrameListening( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame ); 389cdf0e10cSrcweir virtual void stopFrameListening( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _rxFrame ); 390cdf0e10cSrcweir 391cdf0e10cSrcweir void releaseNumberForComponent(); 392cdf0e10cSrcweir 393cdf0e10cSrcweir virtual ~OGenericUnoController(); 394cdf0e10cSrcweir 395cdf0e10cSrcweir private: 396cdf0e10cSrcweir void fillSupportedFeatures(); 397cdf0e10cSrcweir 398cdf0e10cSrcweir void InvalidateAll_Impl(); 399cdf0e10cSrcweir void InvalidateFeature_Impl(); 400cdf0e10cSrcweir 401cdf0e10cSrcweir void ImplInvalidateFeature( sal_Int32 _nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& _xListener, sal_Bool _bForceBroadcast ); 402cdf0e10cSrcweir 403cdf0e10cSrcweir sal_Bool ImplInvalidateTBItem(sal_uInt16 nId, const FeatureState& rState); 404cdf0e10cSrcweir void ImplBroadcastFeatureState(const ::rtl::OUString& _rFeature, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xListener, sal_Bool _bIgnoreCache); 405cdf0e10cSrcweir 406cdf0e10cSrcweir // link methods 407cdf0e10cSrcweir DECL_LINK(OnAsyncInvalidateAll, void*); 408cdf0e10cSrcweir DECL_LINK(OnAsyncCloseTask, void*); 409cdf0e10cSrcweir 410cdf0e10cSrcweir public: getORB() const411cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() const { return m_xServiceFactory; } getView() const412cdf0e10cSrcweir ODataView* getView() const { return m_pView; } setView(ODataView & i_rView)413cdf0e10cSrcweir void setView( ODataView& i_rView ) { m_pView = &i_rView; } clearView()414cdf0e10cSrcweir void clearView() { m_pView = NULL; } 415cdf0e10cSrcweir // shows a error box if the SQLExceptionInfo is valid 416cdf0e10cSrcweir void showError(const ::dbtools::SQLExceptionInfo& _rInfo); 417cdf0e10cSrcweir 418cdf0e10cSrcweir // if xListener is NULL the change will be forwarded to all listeners to the given ::com::sun::star::util::URL 419cdf0e10cSrcweir // if _bForceBroadcast is sal_True, the current feature state is broadcasted no matter if it is the same as the cached state 420cdf0e10cSrcweir virtual void InvalidateFeature(const ::rtl::OUString& rURLPath, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xListener = NULL, sal_Bool _bForceBroadcast = sal_False); 421cdf0e10cSrcweir // if there is an ::com::sun::star::util::URL translation for the id ('handle') the preceding InvalidateFeature is used. 422cdf0e10cSrcweir // if there is a toolbar slot with the given id it is updated (the new state is determined via GetState) 423cdf0e10cSrcweir // if _bForceBroadcast is sal_True, the current feature state is broadcasted no matter if it is the same as the cached state 424cdf0e10cSrcweir virtual void InvalidateFeature(sal_uInt16 nId, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & xListener = NULL, sal_Bool _bForceBroadcast = sal_False); 425cdf0e10cSrcweir 426cdf0e10cSrcweir /** InvalidateAll invalidates all features currently known 427cdf0e10cSrcweir */ 428cdf0e10cSrcweir virtual void InvalidateAll(); 429cdf0e10cSrcweir // late construction 430cdf0e10cSrcweir virtual sal_Bool Construct(Window* pParent); 431cdf0e10cSrcweir 432cdf0e10cSrcweir /** get the layout manager 433cdf0e10cSrcweir @param _xFrame 434cdf0e10cSrcweir The frame to ask for the layout manager. 435cdf0e10cSrcweir @return 436cdf0e10cSrcweir The layout manager of the frame, can be <NULL/> if the frame isn't initialized. 437cdf0e10cSrcweir */ 438cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > getLayoutManager(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame) const; 439cdf0e10cSrcweir 440cdf0e10cSrcweir // IController 441cdf0e10cSrcweir virtual void executeUnChecked(const ::com::sun::star::util::URL& _rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs); 442cdf0e10cSrcweir virtual void executeChecked(const ::com::sun::star::util::URL& _rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs); 443cdf0e10cSrcweir virtual void executeUnChecked(sal_uInt16 _nCommandId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs); 444cdf0e10cSrcweir virtual void executeChecked(sal_uInt16 _nCommandId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs); 445cdf0e10cSrcweir virtual sal_Bool isCommandEnabled(sal_uInt16 _nCommandId) const; 446cdf0e10cSrcweir virtual sal_Bool isCommandEnabled(const ::rtl::OUString& _rCompleteCommandURL) const; 447cdf0e10cSrcweir virtual sal_uInt16 registerCommandURL( const ::rtl::OUString& _rCompleteCommandURL ); 448cdf0e10cSrcweir virtual void notifyHiContrastChanged(); 449cdf0e10cSrcweir virtual sal_Bool isDataSourceReadOnly() const; 450cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > getXController() throw( ::com::sun::star::uno::RuntimeException ); 451cdf0e10cSrcweir virtual bool interceptUserInput( const NotifyEvent& _rEvent ); 452cdf0e10cSrcweir 453cdf0e10cSrcweir // misc 454cdf0e10cSrcweir virtual sal_Bool isCommandChecked(sal_uInt16 _nCommandId) const; 455cdf0e10cSrcweir 456cdf0e10cSrcweir // ::com::sun::star::lang::XEventListener 457cdf0e10cSrcweir virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException ); 458cdf0e10cSrcweir 459cdf0e10cSrcweir // ::com::sun::star::util::XModifyListener 460cdf0e10cSrcweir virtual void SAL_CALL modified(const ::com::sun::star::lang::EventObject& aEvent) throw( ::com::sun::star::uno::RuntimeException ); 461cdf0e10cSrcweir 462cdf0e10cSrcweir // XInterface 463cdf0e10cSrcweir virtual void SAL_CALL acquire( ) throw (); 464cdf0e10cSrcweir virtual void SAL_CALL release( ) throw (); 465cdf0e10cSrcweir 466cdf0e10cSrcweir // ::com::sun::star::frame::XController2 467cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL getComponentWindow() throw (::com::sun::star::uno::RuntimeException); 468cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getViewControllerName() throw (::com::sun::star::uno::RuntimeException); 469cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCreationArguments() throw (::com::sun::star::uno::RuntimeException); 470cdf0e10cSrcweir 471cdf0e10cSrcweir // ::com::sun::star::frame::XController 472cdf0e10cSrcweir virtual void SAL_CALL attachFrame(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > & xFrame) throw( ::com::sun::star::uno::RuntimeException ); 473cdf0e10cSrcweir virtual sal_Bool SAL_CALL attachModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel) throw( ::com::sun::star::uno::RuntimeException ); 474cdf0e10cSrcweir virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException ) = 0; 475cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL getViewData(void) throw( ::com::sun::star::uno::RuntimeException ); 476cdf0e10cSrcweir virtual void SAL_CALL restoreViewData(const ::com::sun::star::uno::Any& Data) throw( ::com::sun::star::uno::RuntimeException ); 477cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModel(void) throw( ::com::sun::star::uno::RuntimeException ); 478cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame(void) throw( ::com::sun::star::uno::RuntimeException ); 479cdf0e10cSrcweir 480cdf0e10cSrcweir // ::com::sun::star::frame::XDispatch 481cdf0e10cSrcweir virtual void SAL_CALL dispatch(const ::com::sun::star::util::URL& aURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) throw(::com::sun::star::uno::RuntimeException); 482cdf0e10cSrcweir virtual void SAL_CALL addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & aListener, const ::com::sun::star::util::URL& aURL) throw(::com::sun::star::uno::RuntimeException); 483cdf0e10cSrcweir virtual void SAL_CALL removeStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & aListener, const ::com::sun::star::util::URL& aURL) throw(::com::sun::star::uno::RuntimeException); 484cdf0e10cSrcweir 485cdf0e10cSrcweir // ::com::sun::star::frame::XDispatchProviderInterceptor 486cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider(void) throw(::com::sun::star::uno::RuntimeException); 487cdf0e10cSrcweir virtual void SAL_CALL setSlaveDispatchProvider(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > & _xNewProvider) throw(::com::sun::star::uno::RuntimeException); 488cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider(void) throw(::com::sun::star::uno::RuntimeException); 489cdf0e10cSrcweir virtual void SAL_CALL setMasterDispatchProvider(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > & _xNewProvider) throw(::com::sun::star::uno::RuntimeException); 490cdf0e10cSrcweir 491cdf0e10cSrcweir // ::com::sun::star::frame::XDispatchProvider 492cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch(const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags) throw( ::com::sun::star::uno::RuntimeException ); 493cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches(const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts) throw( ::com::sun::star::uno::RuntimeException ); 494cdf0e10cSrcweir 495cdf0e10cSrcweir // ::com::sun::star::lang::XComponent 496cdf0e10cSrcweir virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); //LLA: need solar mutex {OGenericUnoController_COMPBASE::dispose(); } 497cdf0e10cSrcweir virtual void SAL_CALL disposing(); 498cdf0e10cSrcweir virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException); 499cdf0e10cSrcweir virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw(::com::sun::star::uno::RuntimeException); 500cdf0e10cSrcweir 501cdf0e10cSrcweir // ::com::sun::star::frame::XFrameActionListener 502cdf0e10cSrcweir virtual void SAL_CALL frameAction(const ::com::sun::star::frame::FrameActionEvent& aEvent) throw( ::com::sun::star::uno::RuntimeException ); 503cdf0e10cSrcweir // lang::XInitialization 504cdf0e10cSrcweir virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 505cdf0e10cSrcweir 506cdf0e10cSrcweir // XServiceInfo 507cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException) = 0; 508cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw(::com::sun::star::uno::RuntimeException); 509cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) = 0; 510cdf0e10cSrcweir 511cdf0e10cSrcweir // XDispatchInformationProvider 512cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::sal_Int16 > SAL_CALL getSupportedCommandGroups() throw (::com::sun::star::uno::RuntimeException); 513cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( ::sal_Int16 ) throw (::com::sun::star::uno::RuntimeException); 514cdf0e10cSrcweir 515cdf0e10cSrcweir // XTitle 516cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getTitle( ) throw (::com::sun::star::uno::RuntimeException); 517cdf0e10cSrcweir virtual void SAL_CALL setTitle( const ::rtl::OUString& sTitle ) throw (::com::sun::star::uno::RuntimeException); 518cdf0e10cSrcweir 519cdf0e10cSrcweir // XTitleChangeBroadcaster 520cdf0e10cSrcweir virtual void SAL_CALL addTitleChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitleChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 521cdf0e10cSrcweir virtual void SAL_CALL removeTitleChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTitleChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 522cdf0e10cSrcweir 523cdf0e10cSrcweir // XUserInputInterception 524cdf0e10cSrcweir virtual void SAL_CALL addKeyHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); 525cdf0e10cSrcweir virtual void SAL_CALL removeKeyHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); 526cdf0e10cSrcweir virtual void SAL_CALL addMouseClickHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseClickHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); 527cdf0e10cSrcweir virtual void SAL_CALL removeMouseClickHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseClickHandler >& xHandler ) throw (::com::sun::star::uno::RuntimeException); 528cdf0e10cSrcweir 529cdf0e10cSrcweir protected: 530cdf0e10cSrcweir #ifdef WNT 531cdf0e10cSrcweir OGenericUnoController(); // never implemented 532cdf0e10cSrcweir #endif 533cdf0e10cSrcweir }; 534cdf0e10cSrcweir } 535cdf0e10cSrcweir 536cdf0e10cSrcweir #endif //DBAUI_GENERICCONTROLLER_HXX 537cdf0e10cSrcweir 538cdf0e10cSrcweir 539