1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
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 <vcl/wintypes.hxx>
30 #include "rtattributes.hxx"
31 #include "textattributelistener.hxx"
39 class ORichTextFeatureDispatcher
;
41 typedef ::cppu::ImplHelper1
< css::frame::XDispatchProvider
42 > ORichTextControl_Base
;
43 class ORichTextControl
:public UnoEditControl
44 ,public ORichTextControl_Base
50 virtual ~ORichTextControl() override
;
53 DECLARE_UNO3_AGG_DEFAULTS( ORichTextControl
, UnoEditControl
)
54 virtual css::uno::Any SAL_CALL
queryAggregation( const css::uno::Type
& _rType
) override
;
57 virtual void SAL_CALL
createPeer( const css::uno::Reference
< css::awt::XToolkit
>& _rToolkit
, const css::uno::Reference
< css::awt::XWindowPeer
>& _rParent
) override
;
60 virtual OUString SAL_CALL
getImplementationName() override
;
61 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
64 DECLARE_XTYPEPROVIDER()
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
;
71 virtual bool requiresNewPeer( const OUString
& _rPropertyName
) const override
;
74 typedef ::cppu::ImplHelper1
< css::frame::XDispatchProvider
76 class ORichTextPeer final
:public VCLXWindow
77 ,public ORichTextPeer_Base
78 ,public ITextSelectionListener
81 typedef rtl::Reference
<ORichTextFeatureDispatcher
> SingleAttributeDispatcher
;
82 typedef ::std::map
< SfxSlotId
, SingleAttributeDispatcher
> AttributeDispatchers
;
83 AttributeDispatchers m_aDispatchers
;
88 static rtl::Reference
<ORichTextPeer
> Create(
89 const css::uno::Reference
< css::awt::XControlModel
>& _rxModel
,
90 vcl::Window
* _pParentWindow
,
99 virtual ~ORichTextPeer() override
;
102 void SAL_CALL
draw( sal_Int32 nX
, sal_Int32 nY
) override
;
105 virtual void SAL_CALL
setProperty( const OUString
& _rPropertyName
, const css::uno::Any
& _rValue
) override
;
108 DECLARE_XTYPEPROVIDER( )
111 virtual void SAL_CALL
dispose( ) override
;
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
;
121 SingleAttributeDispatcher
implCreateDispatcher( SfxSlotId _nSlotId
, const css::util::URL
& _rURL
);
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */