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