LanguageTool: don't crash if REST protocol isn't set
[LibreOffice.git] / forms / source / richtext / richtextcontrol.hxx
blob9cda83bb525737659ac5083e2725680321386f55
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 <toolkit/controls/unocontrols.hxx>
23 #include <toolkit/awt/vclxwindow.hxx>
25 #include <com/sun/star/frame/XDispatchProvider.hpp>
26 #include <comphelper/uno3.hxx>
27 #include <cppuhelper/implbase1.hxx>
28 #include <rtl/ref.hxx>
29 #include <tools/wintypes.hxx>
30 #include "rtattributes.hxx"
31 #include "textattributelistener.hxx"
33 #include <map>
36 namespace frm
39 class ORichTextFeatureDispatcher;
41 typedef ::cppu::ImplHelper1 < css::frame::XDispatchProvider
42 > ORichTextControl_Base;
43 class ORichTextControl :public UnoEditControl
44 ,public ORichTextControl_Base
46 public:
47 ORichTextControl();
49 protected:
50 virtual ~ORichTextControl() override;
52 // UNO
53 DECLARE_UNO3_AGG_DEFAULTS( ORichTextControl, UnoEditControl )
54 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override;
56 // XControl
57 virtual void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& _rToolkit, const css::uno::Reference< css::awt::XWindowPeer >& _rParent ) override;
59 // XServiceInfo
60 virtual OUString SAL_CALL getImplementationName() override;
61 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
63 // XTypeProvider
64 DECLARE_XTYPEPROVIDER()
66 // XDispatchProvider
67 virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& _rURL, const OUString& _rTargetFrameName, sal_Int32 _rSearchFlags ) override;
68 virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& Requests ) override;
70 // UnoControl
71 virtual bool requiresNewPeer( const OUString& _rPropertyName ) const override;
74 typedef ::cppu::ImplHelper1 < css::frame::XDispatchProvider
75 > ORichTextPeer_Base;
76 class ORichTextPeer final :public VCLXWindow
77 ,public ORichTextPeer_Base
78 ,public ITextSelectionListener
80 private:
81 typedef rtl::Reference<ORichTextFeatureDispatcher> SingleAttributeDispatcher;
82 typedef ::std::map< SfxSlotId, SingleAttributeDispatcher > AttributeDispatchers;
83 AttributeDispatchers m_aDispatchers;
85 public:
86 /** factory method
88 static rtl::Reference<ORichTextPeer> Create(
89 const css::uno::Reference< css::awt::XControlModel >& _rxModel,
90 vcl::Window* _pParentWindow,
91 WinBits _nStyle
94 // XInterface
95 DECLARE_XINTERFACE( )
97 private:
98 ORichTextPeer();
99 virtual ~ORichTextPeer() override;
101 // XView
102 void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) override;
104 // XVclWindowPeer
105 virtual void SAL_CALL setProperty( const OUString& _rPropertyName, const css::uno::Any& _rValue ) override;
107 // XTypeProvider
108 DECLARE_XTYPEPROVIDER( )
110 // XComponent
111 virtual void SAL_CALL dispose( ) override;
113 // XDispatchProvider
114 virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& _rURL, const OUString& _rTargetFrameName, sal_Int32 _rSearchFlags ) override;
115 virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& Requests ) override;
117 // ITextSelectionListener
118 virtual void onSelectionChanged() override;
120 private:
121 SingleAttributeDispatcher implCreateDispatcher( SfxSlotId _nSlotId, const css::util::URL& _rURL );
125 } // namespace frm
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */