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