Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / forms / source / richtext / richtextcontrol.hxx
blob5bda91b38949600d727ab79c38812db7ae5c351d
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 #ifndef INCLUDED_FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
21 #define INCLUDED_FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
23 #include <toolkit/controls/unocontrols.hxx>
24 #include <toolkit/awt/vclxwindow.hxx>
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 #include <com/sun/star/frame/XDispatchProvider.hpp>
28 #include <comphelper/uno3.hxx>
29 #include <cppuhelper/implbase1.hxx>
30 #include <rtl/ref.hxx>
31 #include <tools/wintypes.hxx>
32 #include "rtattributes.hxx"
33 #include "attributedispatcher.hxx"
35 #include <map>
38 namespace frm
41 class ORichTextFeatureDispatcher;
43 typedef ::cppu::ImplHelper1 < css::frame::XDispatchProvider
44 > ORichTextControl_Base;
45 class ORichTextControl :public UnoEditControl
46 ,public ORichTextControl_Base
48 public:
49 ORichTextControl();
51 protected:
52 virtual ~ORichTextControl();
54 public:
55 // XServiceInfo - static version
56 static OUString SAL_CALL getImplementationName_Static();
57 static css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_Static();
59 protected:
60 // UNO
61 DECLARE_UNO3_AGG_DEFAULTS( ORichTextControl, UnoEditControl )
62 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) throw ( css::uno::RuntimeException, std::exception ) override;
64 // XControl
65 virtual void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& _rToolkit, const css::uno::Reference< css::awt::XWindowPeer >& _rParent ) throw( css::uno::RuntimeException, std::exception ) override;
67 // XServiceInfo
68 virtual OUString SAL_CALL getImplementationName() throw(css::uno::RuntimeException, std::exception) override;
69 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(css::uno::RuntimeException, std::exception) override;
71 // XTypeProvider
72 DECLARE_XTYPEPROVIDER()
74 // XDispatchProvider
75 virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& _rURL, const OUString& _rTargetFrameName, sal_Int32 _rSearchFlags ) throw (css::uno::RuntimeException, std::exception) override;
76 virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& Requests ) throw (css::uno::RuntimeException, std::exception) override;
78 // UnoControl
79 virtual bool requiresNewPeer( const OUString& _rPropertyName ) const override;
82 typedef ::cppu::ImplHelper1 < css::frame::XDispatchProvider
83 > ORichTextPeer_Base;
84 class ORichTextPeer :public VCLXWindow
85 ,public ORichTextPeer_Base
86 ,public ITextSelectionListener
88 private:
89 typedef rtl::Reference<ORichTextFeatureDispatcher> SingleAttributeDispatcher;
90 typedef ::std::map< SfxSlotId, SingleAttributeDispatcher > AttributeDispatchers;
91 AttributeDispatchers m_aDispatchers;
93 public:
94 /** factory method
95 @return
96 a new ORichTextPeer instance, which has been acquired once!
98 static ORichTextPeer* Create(
99 const css::uno::Reference< css::awt::XControlModel >& _rxModel,
100 vcl::Window* _pParentWindow,
101 WinBits _nStyle
104 // XInterface
105 DECLARE_XINTERFACE( )
107 protected:
108 ORichTextPeer();
109 virtual ~ORichTextPeer();
111 // XView
112 void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(css::uno::RuntimeException, std::exception) override;
114 // XVclWindowPeer
115 virtual void SAL_CALL setProperty( const OUString& _rPropertyName, const css::uno::Any& _rValue )
116 throw (css::uno::RuntimeException,
117 std::exception) override;
119 // XTypeProvider
120 DECLARE_XTYPEPROVIDER( )
122 // XComponent
123 virtual void SAL_CALL dispose( ) throw(css::uno::RuntimeException, std::exception) override;
125 // XDispatchProvider
126 virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& _rURL, const OUString& _rTargetFrameName, sal_Int32 _rSearchFlags ) throw (css::uno::RuntimeException, std::exception) override;
127 virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& Requests ) throw (css::uno::RuntimeException, std::exception) override;
129 // ITextSelectionListener
130 virtual void onSelectionChanged( const ESelection& _rSelection ) override;
132 private:
133 SingleAttributeDispatcher implCreateDispatcher( SfxSlotId _nSlotId, const css::util::URL& _rURL );
137 } // namespace frm
140 #endif // INCLUDED_FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */