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