xref: /trunk/main/dbaccess/inc/IController.hxx (revision cdf0e10c)
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_ICONTROLLER_HXX
29*cdf0e10cSrcweir #define DBAUI_ICONTROLLER_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
32*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
33*cdf0e10cSrcweir #endif
34*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
35*cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir #ifndef DBAUI_IREFERENCE_HXX
38*cdf0e10cSrcweir #include "IReference.hxx"
39*cdf0e10cSrcweir #endif
40*cdf0e10cSrcweir #include "dbaccessdllapi.h"
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir namespace com { namespace sun { namespace star {
43*cdf0e10cSrcweir     namespace util {
44*cdf0e10cSrcweir 	    struct URL;
45*cdf0e10cSrcweir     }
46*cdf0e10cSrcweir     namespace frame {
47*cdf0e10cSrcweir 	    class XController;
48*cdf0e10cSrcweir     }
49*cdf0e10cSrcweir } } }
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir class NotifyEvent;
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir namespace dbaui
54*cdf0e10cSrcweir {
55*cdf0e10cSrcweir 	// interface for controller depended calls like commands
56*cdf0e10cSrcweir 	class DBACCESS_DLLPUBLIC IController : public IReference
57*cdf0e10cSrcweir 	{
58*cdf0e10cSrcweir 	public:
59*cdf0e10cSrcweir 		/** executes the given command without checking if it is allowed
60*cdf0e10cSrcweir 			@param	_rCommand	the URL of the command
61*cdf0e10cSrcweir 		*/
62*cdf0e10cSrcweir 		virtual void executeUnChecked(const ::com::sun::star::util::URL& _rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir 		/** executes the given command only when it is allowed
65*cdf0e10cSrcweir 			@param	_rCommand
66*cdf0e10cSrcweir 				the URL of the command
67*cdf0e10cSrcweir 		*/
68*cdf0e10cSrcweir 		virtual void executeChecked(const ::com::sun::star::util::URL& _rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir 		/** executes the given command without checking if it is allowed
71*cdf0e10cSrcweir 			@param	_nCommandId
72*cdf0e10cSrcweir 				the id of the command URL
73*cdf0e10cSrcweir 		*/
74*cdf0e10cSrcweir 		virtual void executeUnChecked(sal_uInt16 _nCommandId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir 		/** executes the given command only when it is allowed
77*cdf0e10cSrcweir 			@param	_nCommandId
78*cdf0e10cSrcweir 				the id of the command URL
79*cdf0e10cSrcweir 		*/
80*cdf0e10cSrcweir 		virtual void executeChecked(sal_uInt16 _nCommandId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir 		/** checks if the given Command is enabled
84*cdf0e10cSrcweir 			@param	_nCommandId
85*cdf0e10cSrcweir 				the id of the command URL
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir 			@return
88*cdf0e10cSrcweir 				<TRUE/> if the command is allowed, otherwise <FALSE/>.
89*cdf0e10cSrcweir 		*/
90*cdf0e10cSrcweir 		virtual sal_Bool isCommandEnabled(sal_uInt16 _nCommandId) const = 0;
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 		/** checks if the given Command is enabled
93*cdf0e10cSrcweir 			@param	_rCompleteCommandURL
94*cdf0e10cSrcweir 				the URL of the command
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 			@return
97*cdf0e10cSrcweir 				<TRUE/> if the command is allowed, otherwise <FALSE/>.
98*cdf0e10cSrcweir 		*/
99*cdf0e10cSrcweir         virtual sal_Bool isCommandEnabled( const ::rtl::OUString& _rCompleteCommandURL ) const = 0;
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir         /** registers a command URL, giving it a unique name
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir             If you call this with a command URL which is supported by the controller, then
104*cdf0e10cSrcweir             you will simply get the controller's internal numeric shortcut to this command.
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir             If you call this with a command URL which is not supported by the controller, then
107*cdf0e10cSrcweir             you will get a new ID, which is unique during the lifetime of the controller.
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir             If the command URL is invalid, or the controller cannot register new commands anymore,
110*cdf0e10cSrcweir             then 0 is returned.
111*cdf0e10cSrcweir         */
112*cdf0e10cSrcweir         virtual sal_uInt16
113*cdf0e10cSrcweir                         registerCommandURL( const ::rtl::OUString& _rCompleteCommandURL ) = 0;
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 		/** notifyHiContrastChanged will be called when the hicontrast mode changed.
116*cdf0e10cSrcweir 			@param	_bHiContrast
117*cdf0e10cSrcweir 				<TRUE/> when in hicontrast mode.
118*cdf0e10cSrcweir 		*/
119*cdf0e10cSrcweir 		virtual void notifyHiContrastChanged() = 0;
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 		/** checks if the selected data source is read only
122*cdf0e10cSrcweir 			@return
123*cdf0e10cSrcweir 				<TRUE/> if read only, otherwise <FALSE/>
124*cdf0e10cSrcweir 		*/
125*cdf0e10cSrcweir 		virtual sal_Bool isDataSourceReadOnly() const = 0;
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir         /** provides access to the model of the controller
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir             This must be the same model as returned by XController::getModel, and might be <NULL/> when
130*cdf0e10cSrcweir             the controller does not have an own model.
131*cdf0e10cSrcweir         */
132*cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
133*cdf0e10cSrcweir                 getXController(void) throw( ::com::sun::star::uno::RuntimeException ) = 0;
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir         /** allows interception of user input, aka mouse clicks and key events
136*cdf0e10cSrcweir         */
137*cdf0e10cSrcweir         virtual bool interceptUserInput( const NotifyEvent& _rEvent ) = 0;
138*cdf0e10cSrcweir 	};
139*cdf0e10cSrcweir }
140*cdf0e10cSrcweir #endif // DBAUI_ICONTROLLER_HXX
141