xref: /trunk/main/dbaccess/inc/IController.hxx (revision 2e2212a7)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef DBAUI_ICONTROLLER_HXX
25 #define DBAUI_ICONTROLLER_HXX
26 
27 #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
28 #include <com/sun/star/beans/PropertyValue.hpp>
29 #endif
30 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
31 #include <com/sun/star/uno/Sequence.hxx>
32 #endif
33 #ifndef DBAUI_IREFERENCE_HXX
34 #include "IReference.hxx"
35 #endif
36 #include "dbaccessdllapi.h"
37 
38 namespace com { namespace sun { namespace star {
39     namespace util {
40 	    struct URL;
41     }
42     namespace frame {
43 	    class XController;
44     }
45 } } }
46 
47 class NotifyEvent;
48 
49 namespace dbaui
50 {
51 	// interface for controller depended calls like commands
52 	class DBACCESS_DLLPUBLIC IController : public IReference
53 	{
54 	public:
55 		/** executes the given command without checking if it is allowed
56 			@param	_rCommand	the URL of the command
57 		*/
58 		virtual void executeUnChecked(const ::com::sun::star::util::URL& _rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
59 
60 		/** executes the given command only when it is allowed
61 			@param	_rCommand
62 				the URL of the command
63 		*/
64 		virtual void executeChecked(const ::com::sun::star::util::URL& _rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
65 
66 		/** executes the given command without checking if it is allowed
67 			@param	_nCommandId
68 				the id of the command URL
69 		*/
70 		virtual void executeUnChecked(sal_uInt16 _nCommandId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
71 
72 		/** executes the given command only when it is allowed
73 			@param	_nCommandId
74 				the id of the command URL
75 		*/
76 		virtual void executeChecked(sal_uInt16 _nCommandId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
77 
78 
79 		/** checks if the given Command is enabled
80 			@param	_nCommandId
81 				the id of the command URL
82 
83 			@return
84 				<TRUE/> if the command is allowed, otherwise <FALSE/>.
85 		*/
86 		virtual sal_Bool isCommandEnabled(sal_uInt16 _nCommandId) const = 0;
87 
88 		/** checks if the given Command is enabled
89 			@param	_rCompleteCommandURL
90 				the URL of the command
91 
92 			@return
93 				<TRUE/> if the command is allowed, otherwise <FALSE/>.
94 		*/
95         virtual sal_Bool isCommandEnabled( const ::rtl::OUString& _rCompleteCommandURL ) const = 0;
96 
97         /** registers a command URL, giving it a unique name
98 
99             If you call this with a command URL which is supported by the controller, then
100             you will simply get the controller's internal numeric shortcut to this command.
101 
102             If you call this with a command URL which is not supported by the controller, then
103             you will get a new ID, which is unique during the lifetime of the controller.
104 
105             If the command URL is invalid, or the controller cannot register new commands anymore,
106             then 0 is returned.
107         */
108         virtual sal_uInt16
109                         registerCommandURL( const ::rtl::OUString& _rCompleteCommandURL ) = 0;
110 
111 		/** notifyHiContrastChanged will be called when the hicontrast mode changed.
112 			@param	_bHiContrast
113 				<TRUE/> when in hicontrast mode.
114 		*/
115 		virtual void notifyHiContrastChanged() = 0;
116 
117 		/** checks if the selected data source is read only
118 			@return
119 				<TRUE/> if read only, otherwise <FALSE/>
120 		*/
121 		virtual sal_Bool isDataSourceReadOnly() const = 0;
122 
123         /** provides access to the model of the controller
124 
125             This must be the same model as returned by XController::getModel, and might be <NULL/> when
126             the controller does not have an own model.
127         */
128 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
129                 getXController(void) throw( ::com::sun::star::uno::RuntimeException ) = 0;
130 
131         /** allows interception of user input, aka mouse clicks and key events
132         */
133         virtual bool interceptUserInput( const NotifyEvent& _rEvent ) = 0;
134 	};
135 }
136 #endif // DBAUI_ICONTROLLER_HXX
137