cid#1607171 Data race condition
[LibreOffice.git] / framework / inc / dispatch / startmoduledispatcher.hxx
blobc575004d49ed73e17ce4243c25298234ce06f5c4
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 #pragma once
22 #include <com/sun/star/frame/XStatusListener.hpp>
23 #include <com/sun/star/frame/XNotifyingDispatch.hpp>
24 #include <com/sun/star/frame/XDispatchInformationProvider.hpp>
25 #include <com/sun/star/util/URL.hpp>
26 #include <com/sun/star/frame/XDispatchResultListener.hpp>
27 #include <com/sun/star/uno/XComponentContext.hpp>
29 #include <cppuhelper/implbase.hxx>
31 namespace framework{
33 /**
34 @short helper to handle all URLs related to the StartModule
36 class StartModuleDispatcher final : public ::cppu::WeakImplHelper<
37 css::frame::XNotifyingDispatch, // => XDispatch
38 css::frame::XDispatchInformationProvider >
41 // member
43 private:
45 /** @short reference to a uno service manager,
46 which can be used to create own needed
47 uno resources. */
48 css::uno::Reference< css::uno::XComponentContext > m_xContext;
50 // native interface
52 public:
54 /** @short connect a new StartModuleDispatcher instance to its "owner frame".
56 @descr Such "owner frame" is used as context for all related operations.
58 @param xContext
59 a UNO service manager, which is needed to create UNO resource
60 internally.
62 @param xFrame
63 the frame where the corresponding dispatch was started.
65 StartModuleDispatcher(css::uno::Reference< css::uno::XComponentContext > xContext);
67 /** @short does nothing real. */
68 virtual ~StartModuleDispatcher() override;
70 // uno interface
72 public:
74 // XNotifyingDispatch
75 virtual void SAL_CALL dispatchWithNotification( const css::util::URL& aURL ,
76 const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
77 const css::uno::Reference< css::frame::XDispatchResultListener >& xListener ) override;
79 // XDispatch
80 virtual void SAL_CALL dispatch ( const css::util::URL& aURL ,
81 const css::uno::Sequence< css::beans::PropertyValue >& lArguments) override;
82 virtual void SAL_CALL addStatusListener ( const css::uno::Reference< css::frame::XStatusListener >& xListener ,
83 const css::util::URL& aURL ) override;
84 virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xListener ,
85 const css::util::URL& aURL ) override;
87 // XDispatchInformationProvider
88 virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups ( ) override;
89 virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation( sal_Int16 nCommandGroup ) override;
91 // internal helper
93 private:
95 /** @short check if StartModule can be shown.
97 bool implts_isBackingModePossible();
99 /** @short open the special BackingComponent (now StartModule)
101 void implts_establishBackingMode();
103 /** @short notify a DispatchResultListener.
105 @descr We check the listener reference before we use it.
106 So this method can be called every time!
108 @parama xListener
109 the listener, which should be notified.
110 Can be null!
112 @param nState
113 directly used as css::frame::DispatchResultState value.
115 @param aResult
116 not used yet really ...
118 void implts_notifyResultListener(const css::uno::Reference< css::frame::XDispatchResultListener >& xListener,
119 sal_Int16 nState ,
120 const css::uno::Any& aResult );
122 }; // class StartModuleDispatcher
124 } // namespace framework
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */