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