LibreOffice Module framework (master) 1
dispatchdisabler.hxx
Go to the documentation of this file.
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#pragma once
10
11#include <set>
12
14
15#include <com/sun/star/lang/XServiceInfo.hpp>
16#include <com/sun/star/lang/XInitialization.hpp>
17#include <com/sun/star/uno/XComponentContext.hpp>
18#include <com/sun/star/container/XNameContainer.hpp>
19#include <com/sun/star/frame/XDispatch.hpp>
20#include <com/sun/star/frame/XInterceptorInfo.hpp>
21#include <com/sun/star/frame/XDispatchProvider.hpp>
22#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
23
24namespace framework {
25
34class DispatchDisabler final : public ::cppu::WeakImplHelper<
35 css::lang::XInitialization,
36 css::container::XNameContainer,
37 css::frame::XDispatchProviderInterceptor,
38 css::frame::XInterceptorInfo,
39 css::lang::XServiceInfo >
40{
41 std::set<OUString> maDisabledURLs;
42 css::uno::Reference< css::frame::XDispatchProvider > mxSlave;
43 css::uno::Reference< css::frame::XDispatchProvider > mxMaster;
44public:
45 DispatchDisabler(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
46
47 // XInitialization
48 virtual void SAL_CALL initialize( const ::css::uno::Sequence< ::css::uno::Any >& aArguments ) override;
49
50 // XDispatchProvider
51 virtual ::css::uno::Reference< ::css::frame::XDispatch > SAL_CALL
52 queryDispatch( const ::css::util::URL& URL,
53 const OUString& TargetFrameName,
54 ::sal_Int32 SearchFlags ) override;
55 virtual ::css::uno::Sequence< ::css::uno::Reference< ::css::frame::XDispatch > > SAL_CALL
56 queryDispatches( const ::css::uno::Sequence< ::css::frame::DispatchDescriptor >& Requests ) override;
57
58 // XDispatchProviderInterceptor
59 virtual ::css::uno::Reference< ::css::frame::XDispatchProvider > SAL_CALL
60 getSlaveDispatchProvider() override;
61 virtual void SAL_CALL
62 setSlaveDispatchProvider( const ::css::uno::Reference< ::css::frame::XDispatchProvider >& NewDispatchProvider ) override;
63 virtual ::css::uno::Reference< ::css::frame::XDispatchProvider > SAL_CALL
65 virtual void SAL_CALL
66 setMasterDispatchProvider( const ::css::uno::Reference< ::css::frame::XDispatchProvider >& NewSupplier ) override;
67
68 // XInterceptorInfo
69 virtual ::css::uno::Sequence< OUString > SAL_CALL
70 getInterceptedURLs() override;
71
72 // XElementAccess
73 virtual ::css::uno::Type SAL_CALL getElementType() override;
74 virtual ::sal_Bool SAL_CALL hasElements() override;
75
76 // XNameAccess
77 virtual ::css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
78 virtual ::css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
79 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
80
81 // XNameReplace
82 virtual void SAL_CALL replaceByName( const OUString& aName, const ::css::uno::Any& aElement ) override;
83
84 // XNameContainer
85 virtual void SAL_CALL insertByName( const OUString& aName, const ::css::uno::Any& aElement ) override;
86 virtual void SAL_CALL removeByName( const OUString& Name ) override;
87
88 /* interface XServiceInfo */
89 virtual OUString SAL_CALL getImplementationName() override;
90 virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override;
91 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
92};
93
94} // namespace framework
95
96/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Implementation of a service to make it easy to disable a whole suite of UNO commands in a batch - and...
css::uno::Reference< css::frame::XDispatchProvider > mxMaster
virtual void SAL_CALL initialize(const ::css::uno::Sequence< ::css::uno::Any > &aArguments) override
virtual ::css::uno::Sequence< OUString > SAL_CALL getElementNames() override
virtual ::css::uno::Reference< ::css::frame::XDispatch > SAL_CALL queryDispatch(const ::css::util::URL &URL, const OUString &TargetFrameName, ::sal_Int32 SearchFlags) override
virtual ::css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual ::css::uno::Sequence< OUString > SAL_CALL getInterceptedURLs() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
virtual void SAL_CALL insertByName(const OUString &aName, const ::css::uno::Any &aElement) override
virtual void SAL_CALL removeByName(const OUString &Name) override
std::set< OUString > maDisabledURLs
virtual ::css::uno::Reference< ::css::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider() override
virtual void SAL_CALL setSlaveDispatchProvider(const ::css::uno::Reference< ::css::frame::XDispatchProvider > &NewDispatchProvider) override
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
virtual void SAL_CALL replaceByName(const OUString &aName, const ::css::uno::Any &aElement) override
DispatchDisabler(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual OUString SAL_CALL getImplementationName() override
virtual ::sal_Bool SAL_CALL hasElements() override
css::uno::Reference< css::frame::XDispatchProvider > mxSlave
virtual ::css::uno::Reference< ::css::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider() override
virtual ::css::uno::Type SAL_CALL getElementType() override
virtual ::css::uno::Sequence< ::css::uno::Reference< ::css::frame::XDispatch > > SAL_CALL queryDispatches(const ::css::uno::Sequence< ::css::frame::DispatchDescriptor > &Requests) override
virtual void SAL_CALL setMasterDispatchProvider(const ::css::uno::Reference< ::css::frame::XDispatchProvider > &NewSupplier) override
unsigned char sal_Bool