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 FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
21 #define FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
23 #include <toolkit/controls/unocontrols.hxx>
24 #include <toolkit/awt/vclxwindow.hxx>
26 #include <com/sun/star/frame/XDispatchProvider.hpp>
27 #include <comphelper/uno3.hxx>
28 #include <comphelper/implementationreference.hxx>
29 #include <cppuhelper/implbase1.hxx>
30 #include <tools/wintypes.hxx>
31 #include "rtattributes.hxx"
32 #include "attributedispatcher.hxx"
36 //.........................................................................
39 //.........................................................................
41 class ORichTextFeatureDispatcher
;
43 //==================================================================
45 //==================================================================
46 typedef ::cppu::ImplHelper1
< ::com::sun::star::frame::XDispatchProvider
47 > ORichTextControl_Base
;
48 class ORichTextControl
:public UnoEditControl
49 ,public ORichTextControl_Base
58 // XServiceInfo - static version
59 static OUString SAL_CALL
getImplementationName_Static();
60 static ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames_Static();
61 static ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> SAL_CALL
Create( const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxFactory
);
65 DECLARE_UNO3_AGG_DEFAULTS( ORichTextControl
, UnoEditControl
);
66 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation( const ::com::sun::star::uno::Type
& _rType
) throw ( ::com::sun::star::uno::RuntimeException
);
69 virtual void SAL_CALL
createPeer( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XToolkit
>& _rToolkit
, const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XWindowPeer
>& _rParent
) throw( ::com::sun::star::uno::RuntimeException
);
72 virtual OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
);
73 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
);
76 DECLARE_XTYPEPROVIDER()
79 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> SAL_CALL
queryDispatch( const ::com::sun::star::util::URL
& _rURL
, const OUString
& _rTargetFrameName
, sal_Int32 _rSearchFlags
) throw (::com::sun::star::uno::RuntimeException
);
80 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> > SAL_CALL
queryDispatches( const ::com::sun::star::uno::Sequence
< ::com::sun::star::frame::DispatchDescriptor
>& Requests
) throw (::com::sun::star::uno::RuntimeException
);
83 virtual sal_Bool
requiresNewPeer( const OUString
& _rPropertyName
) const;
86 //==================================================================
88 //==================================================================
89 typedef ::cppu::ImplHelper1
< ::com::sun::star::frame::XDispatchProvider
91 class ORichTextPeer
:public VCLXWindow
92 ,public ORichTextPeer_Base
93 ,public ITextSelectionListener
96 typedef ::comphelper::ImplementationReference
< ORichTextFeatureDispatcher
, ::com::sun::star::frame::XDispatch
> SingleAttributeDispatcher
;
97 typedef ::std::map
< SfxSlotId
, SingleAttributeDispatcher
> AttributeDispatchers
;
98 AttributeDispatchers m_aDispatchers
;
103 a new ORichTextPeer instance, which has been aquired once!
105 static ORichTextPeer
* Create(
106 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& _rxModel
,
107 Window
* _pParentWindow
,
112 DECLARE_XINTERFACE( )
119 void SAL_CALL
draw( sal_Int32 nX
, sal_Int32 nY
) throw(::com::sun::star::uno::RuntimeException
);
122 virtual void SAL_CALL
setProperty( const OUString
& _rPropertyName
, const ::com::sun::star::uno::Any
& _rValue
) throw (::com::sun::star::uno::RuntimeException
);
125 DECLARE_XTYPEPROVIDER( )
128 virtual void SAL_CALL
dispose( ) throw(::com::sun::star::uno::RuntimeException
);
131 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> SAL_CALL
queryDispatch( const ::com::sun::star::util::URL
& _rURL
, const OUString
& _rTargetFrameName
, sal_Int32 _rSearchFlags
) throw (::com::sun::star::uno::RuntimeException
);
132 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> > SAL_CALL
queryDispatches( const ::com::sun::star::uno::Sequence
< ::com::sun::star::frame::DispatchDescriptor
>& Requests
) throw (::com::sun::star::uno::RuntimeException
);
134 // ITextSelectionListener
135 virtual void onSelectionChanged( const ESelection
& _rSelection
);
138 SingleAttributeDispatcher
implCreateDispatcher( SfxSlotId _nSlotId
, const ::com::sun::star::util::URL
& _rURL
);
141 //.........................................................................
143 //.........................................................................
145 #endif // FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */