LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / forms / source / richtext / featuredispatcher.hxx
blobfeba00d5bfb21273946a8e434dc18c353324fac2
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/XDispatch.hpp>
23 #include <com/sun/star/lang/DisposedException.hpp>
24 #include <comphelper/interfacecontainer2.hxx>
25 #include <cppuhelper/implbase.hxx>
26 #include <cppuhelper/basemutex.hxx>
28 class EditView;
30 namespace frm
33 typedef ::cppu::WeakImplHelper < css::frame::XDispatch
34 > ORichTextFeatureDispatcher_Base;
36 class ORichTextFeatureDispatcher :public ::cppu::BaseMutex
37 ,public ORichTextFeatureDispatcher_Base
39 private:
40 css::util::URL m_aFeatureURL;
41 ::comphelper::OInterfaceContainerHelper2 m_aStatusListeners;
42 EditView* m_pEditView;
43 bool m_bDisposed;
45 protected:
46 EditView* getEditView() { return m_pEditView; }
47 const EditView* getEditView() const { return m_pEditView; }
49 protected:
50 const css::util::URL& getFeatureURL() const { return m_aFeatureURL; }
51 ::comphelper::OInterfaceContainerHelper2& getStatusListeners() { return m_aStatusListeners; }
52 bool isDisposed() const { return m_bDisposed; }
53 void checkDisposed() const { if ( isDisposed() ) throw css::lang::DisposedException(); }
55 protected:
56 ORichTextFeatureDispatcher( EditView& _rView, const css::util::URL& _rURL );
57 virtual ~ORichTextFeatureDispatcher( ) override;
59 public:
60 /// clean up resources associated with this instance
61 void dispose();
63 // invalidate the feature, re-retrieve it's state, and broadcast changes, if necessary
64 void invalidate();
66 protected:
67 // overridables
68 virtual void disposing( ::osl::ClearableMutexGuard& _rClearBeforeNotify );
69 virtual void invalidateFeatureState_Broadcast();
71 // to be overridden, and filled with the info special do your derived class
72 virtual css::frame::FeatureStateEvent
73 buildStatusEvent() const;
75 static void doNotify(
76 const css::uno::Reference< css::frame::XStatusListener >& _rxListener,
77 const css::frame::FeatureStateEvent& _rEvent
80 // XDispatch
81 virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& _rxControl, const css::util::URL& _rURL ) override;
82 virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& _rxControl, const css::util::URL& _rURL ) override;
86 } // namespace frm
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */