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 .
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"
41 class ORichTextFeatureDispatcher
;
43 typedef ::cppu::ImplHelper1
< css::frame::XDispatchProvider
44 > ORichTextControl_Base
;
45 class ORichTextControl
:public UnoEditControl
46 ,public ORichTextControl_Base
52 virtual ~ORichTextControl();
55 // XServiceInfo - static version
56 static OUString SAL_CALL
getImplementationName_Static();
57 static css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames_Static();
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
;
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
;
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
;
72 DECLARE_XTYPEPROVIDER()
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
;
79 virtual bool requiresNewPeer( const OUString
& _rPropertyName
) const override
;
82 typedef ::cppu::ImplHelper1
< css::frame::XDispatchProvider
84 class ORichTextPeer
:public VCLXWindow
85 ,public ORichTextPeer_Base
86 ,public ITextSelectionListener
89 typedef rtl::Reference
<ORichTextFeatureDispatcher
> SingleAttributeDispatcher
;
90 typedef ::std::map
< SfxSlotId
, SingleAttributeDispatcher
> AttributeDispatchers
;
91 AttributeDispatchers m_aDispatchers
;
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
,
105 DECLARE_XINTERFACE( )
109 virtual ~ORichTextPeer();
112 void SAL_CALL
draw( sal_Int32 nX
, sal_Int32 nY
) throw(css::uno::RuntimeException
, std::exception
) override
;
115 virtual void SAL_CALL
setProperty( const OUString
& _rPropertyName
, const css::uno::Any
& _rValue
)
116 throw (css::uno::RuntimeException
,
117 std::exception
) override
;
120 DECLARE_XTYPEPROVIDER( )
123 virtual void SAL_CALL
dispose( ) throw(css::uno::RuntimeException
, std::exception
) override
;
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
;
133 SingleAttributeDispatcher
implCreateDispatcher( SfxSlotId _nSlotId
, const css::util::URL
& _rURL
);
140 #endif // INCLUDED_FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */