LibreOffice Module framework (master) 1
popupmenudispatcher.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 * 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#pragma once
21
22#include <com/sun/star/frame/XDispatch.hpp>
23#include <com/sun/star/frame/XDispatchProvider.hpp>
24#include <com/sun/star/util/URL.hpp>
25#include <com/sun/star/frame/DispatchDescriptor.hpp>
26#include <com/sun/star/beans/PropertyValue.hpp>
27#include <com/sun/star/frame/XStatusListener.hpp>
28#include <com/sun/star/frame/XFrameActionListener.hpp>
29#include <com/sun/star/lang/XInitialization.hpp>
30#include <com/sun/star/container/XNameAccess.hpp>
31#include <com/sun/star/uri/XUriReferenceFactory.hpp>
32#include <com/sun/star/lang/XServiceInfo.hpp>
33#include <com/sun/star/uno/XComponentContext.hpp>
34
37
38namespace framework{
39
40/*-************************************************************************************************************
41 @short helper for desktop only(!) to create new tasks on demand for dispatches
42 @descr Use this class as member only! Never use it as baseclass.
43 XInterface will be ambiguous and we hold a weakcss::uno::Reference to our OWNER - not to our SUPERCLASS!
44
45 @implements XInterface
46 XDispatch
47 XLoadEventListener
48 XFrameActionListener
49 XEventListener
50 @base OWeakObject
51
52 @devstatus ready to use
53*//*-*************************************************************************************************************/
54class PopupMenuDispatcher final : public ::cppu::WeakImplHelper<
55 css::lang::XServiceInfo,
56 css::frame::XDispatchProvider,
57 css::frame::XDispatch,
58 css::frame::XFrameActionListener,
59 css::lang::XInitialization >
60{
61
62 // public methods
63
64 public:
65
66 // constructor / destructor
67 PopupMenuDispatcher( css::uno::Reference< css::uno::XComponentContext > xContext );
68
69 /* interface XServiceInfo */
70 virtual OUString SAL_CALL getImplementationName() override;
71 virtual sal_Bool SAL_CALL supportsService( const OUString& sServiceName ) override;
72 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
73
74 // XInitialization
75 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArguments ) override;
76 // XDispatchProvider
77 virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(
78 const css::util::URL& aURL ,
79 const OUString& sTarget ,
80 sal_Int32 nFlags ) override;
81
82 virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(
83 const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor ) override;
84
85 // XDispatch
86 virtual void SAL_CALL dispatch( const css::util::URL& aURL,
87 const css::uno::Sequence< css::beans::PropertyValue >& seqProperties ) override;
88
89 virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl,
90 const css::util::URL& aURL ) override;
91
92 virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl,
93 const css::util::URL& aURL ) override;
94
95 // XFrameActionListener
96 virtual void SAL_CALL frameAction( const css::frame::FrameActionEvent& aEvent ) override;
97
98 // XEventListener
99 void SAL_CALL disposing( const css::lang::EventObject& aEvent ) override;
100
101 private:
102 virtual ~PopupMenuDispatcher() override;
103
105
106 css::uno::WeakReference< css::frame::XFrame > m_xWeakFrame;
107 css::uno::Reference< css::container::XNameAccess > m_xPopupCtrlQuery;
108 css::uno::Reference< css::uri::XUriReferenceFactory > m_xUriRefFactory;
109 css::uno::Reference< css::uno::XComponentContext > m_xContext;
112
113}; // class PopupMenuDispatcher
114
115} // namespace framework
116
117/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr OUStringLiteral sServiceName
AnyEventRef aEvent
virtual OUString SAL_CALL getImplementationName() override
PopupMenuDispatcher(css::uno::Reference< css::uno::XComponentContext > xContext)
virtual void SAL_CALL dispatch(const css::util::URL &aURL, const css::uno::Sequence< css::beans::PropertyValue > &seqProperties) override
bool m_bAlreadyDisposed
factory shared with our owner to create new services!
css::uno::WeakReference< css::frame::XFrame > m_xWeakFrame
css::uno::Reference< css::uri::XUriReferenceFactory > m_xUriRefFactory
reference to query for popup controller
void SAL_CALL disposing(const css::lang::EventObject &aEvent) override
css::uno::Reference< css::container::XNameAccess > m_xPopupCtrlQuery
css::uno::WeakReference to frame (Don't use a hard css::uno::Reference. Owner can't delete us then!...
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL &aURL, const OUString &sTarget, sal_Int32 nFlags) override
virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent &aEvent) override
bool m_bActivateListener
Protection against multiple disposing calls.
virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener > &xControl, const css::util::URL &aURL) override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &lArguments) override
virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener > &xControl, const css::util::URL &aURL) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
css::uno::Reference< css::uno::XComponentContext > m_xContext
reference to the uri reference factory
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor > &lDescriptor) override
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
URL aURL
unsigned char sal_Bool