xref: /trunk/main/dbaccess/inc/IController.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef DBAUI_ICONTROLLER_HXX
29 #define DBAUI_ICONTROLLER_HXX
30 
31 #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
32 #include <com/sun/star/beans/PropertyValue.hpp>
33 #endif
34 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
35 #include <com/sun/star/uno/Sequence.hxx>
36 #endif
37 #ifndef DBAUI_IREFERENCE_HXX
38 #include "IReference.hxx"
39 #endif
40 #include "dbaccessdllapi.h"
41 
42 namespace com { namespace sun { namespace star {
43     namespace util {
44         struct URL;
45     }
46     namespace frame {
47         class XController;
48     }
49 } } }
50 
51 class NotifyEvent;
52 
53 namespace dbaui
54 {
55     // interface for controller depended calls like commands
56     class DBACCESS_DLLPUBLIC IController : public IReference
57     {
58     public:
59         /** executes the given command without checking if it is allowed
60             @param  _rCommand   the URL of the command
61         */
62         virtual void executeUnChecked(const ::com::sun::star::util::URL& _rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
63 
64         /** executes the given command only when it is allowed
65             @param  _rCommand
66                 the URL of the command
67         */
68         virtual void executeChecked(const ::com::sun::star::util::URL& _rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
69 
70         /** executes the given command without checking if it is allowed
71             @param  _nCommandId
72                 the id of the command URL
73         */
74         virtual void executeUnChecked(sal_uInt16 _nCommandId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
75 
76         /** executes the given command only when it is allowed
77             @param  _nCommandId
78                 the id of the command URL
79         */
80         virtual void executeChecked(sal_uInt16 _nCommandId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
81 
82 
83         /** checks if the given Command is enabled
84             @param  _nCommandId
85                 the id of the command URL
86 
87             @return
88                 <TRUE/> if the command is allowed, otherwise <FALSE/>.
89         */
90         virtual sal_Bool isCommandEnabled(sal_uInt16 _nCommandId) const = 0;
91 
92         /** checks if the given Command is enabled
93             @param  _rCompleteCommandURL
94                 the URL of the command
95 
96             @return
97                 <TRUE/> if the command is allowed, otherwise <FALSE/>.
98         */
99         virtual sal_Bool isCommandEnabled( const ::rtl::OUString& _rCompleteCommandURL ) const = 0;
100 
101         /** registers a command URL, giving it a unique name
102 
103             If you call this with a command URL which is supported by the controller, then
104             you will simply get the controller's internal numeric shortcut to this command.
105 
106             If you call this with a command URL which is not supported by the controller, then
107             you will get a new ID, which is unique during the lifetime of the controller.
108 
109             If the command URL is invalid, or the controller cannot register new commands anymore,
110             then 0 is returned.
111         */
112         virtual sal_uInt16
113                         registerCommandURL( const ::rtl::OUString& _rCompleteCommandURL ) = 0;
114 
115         /** notifyHiContrastChanged will be called when the hicontrast mode changed.
116             @param  _bHiContrast
117                 <TRUE/> when in hicontrast mode.
118         */
119         virtual void notifyHiContrastChanged() = 0;
120 
121         /** checks if the selected data source is read only
122             @return
123                 <TRUE/> if read only, otherwise <FALSE/>
124         */
125         virtual sal_Bool isDataSourceReadOnly() const = 0;
126 
127         /** provides access to the model of the controller
128 
129             This must be the same model as returned by XController::getModel, and might be <NULL/> when
130             the controller does not have an own model.
131         */
132         virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
133                 getXController(void) throw( ::com::sun::star::uno::RuntimeException ) = 0;
134 
135         /** allows interception of user input, aka mouse clicks and key events
136         */
137         virtual bool interceptUserInput( const NotifyEvent& _rEvent ) = 0;
138     };
139 }
140 #endif // DBAUI_ICONTROLLER_HXX
141