Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / dbaccess / inc / IController.hxx
blob9aa7963a899e504ee2d894b8e93da41500ae8baf
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef DBAUI_ICONTROLLER_HXX
21 #define DBAUI_ICONTROLLER_HXX
23 #include <com/sun/star/beans/PropertyValue.hpp>
24 #include <com/sun/star/uno/Sequence.hxx>
25 #include "IReference.hxx"
26 #include "dbaccessdllapi.h"
28 namespace com { namespace sun { namespace star {
29 namespace util {
30 struct URL;
32 namespace frame {
33 class XController;
35 } } }
37 class NotifyEvent;
39 namespace dbaui
41 // interface for controller depended calls like commands
42 class DBACCESS_DLLPUBLIC IController : public IReference
44 public:
45 /** executes the given command without checking if it is allowed
46 @param _rCommand the URL of the command
48 virtual void executeUnChecked(const ::com::sun::star::util::URL& _rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
50 /** executes the given command only when it is allowed
51 @param _rCommand
52 the URL of the command
54 virtual void executeChecked(const ::com::sun::star::util::URL& _rCommand, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
56 /** executes the given command without checking if it is allowed
57 @param _nCommandId
58 the id of the command URL
60 virtual void executeUnChecked(sal_uInt16 _nCommandId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
62 /** executes the given command only when it is allowed
63 @param _nCommandId
64 the id of the command URL
66 virtual void executeChecked(sal_uInt16 _nCommandId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs) = 0;
69 /** checks if the given Command is enabled
70 @param _nCommandId
71 the id of the command URL
73 @return
74 <TRUE/> if the command is allowed, otherwise <FALSE/>.
76 virtual sal_Bool isCommandEnabled(sal_uInt16 _nCommandId) const = 0;
78 /** checks if the given Command is enabled
79 @param _rCompleteCommandURL
80 the URL of the command
82 @return
83 <TRUE/> if the command is allowed, otherwise <FALSE/>.
85 virtual sal_Bool isCommandEnabled( const ::rtl::OUString& _rCompleteCommandURL ) const = 0;
87 /** registers a command URL, giving it a unique name
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.
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.
95 If the command URL is invalid, or the controller cannot register new commands anymore,
96 then 0 is returned.
98 virtual sal_uInt16
99 registerCommandURL( const ::rtl::OUString& _rCompleteCommandURL ) = 0;
101 /** notifyHiContrastChanged will be called when the hicontrast mode changed.
102 @param _bHiContrast
103 <TRUE/> when in hicontrast mode.
105 virtual void notifyHiContrastChanged() = 0;
107 /** checks if the selected data source is read only
108 @return
109 <TRUE/> if read only, otherwise <FALSE/>
111 virtual sal_Bool isDataSourceReadOnly() const = 0;
113 /** provides access to the model of the controller
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.
118 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
119 getXController(void) throw( ::com::sun::star::uno::RuntimeException ) = 0;
121 /** allows interception of user input, aka mouse clicks and key events
123 virtual bool interceptUserInput( const NotifyEvent& _rEvent ) = 0;
125 protected:
126 ~IController() {}
129 #endif // DBAUI_ICONTROLLER_HXX
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */