1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: richtextcontrol.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
32 #define FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
34 #include <toolkit/controls/unocontrols.hxx>
35 #include <toolkit/awt/vclxwindow.hxx>
37 /** === begin UNO includes === **/
38 #include <com/sun/star/frame/XDispatchProvider.hpp>
39 /** === end UNO includes === **/
40 #include <comphelper/uno3.hxx>
41 #include <comphelper/implementationreference.hxx>
42 #include <cppuhelper/implbase1.hxx>
43 #include <vcl/wintypes.hxx>
44 #include "rtattributes.hxx"
45 #include "attributedispatcher.hxx"
49 //.........................................................................
52 //.........................................................................
54 class ORichTextFeatureDispatcher
;
55 class RichTextControl
;
57 //==================================================================
59 //==================================================================
60 typedef ::cppu::ImplHelper1
< ::com::sun::star::frame::XDispatchProvider
61 > ORichTextControl_Base
;
62 class ORichTextControl
:public UnoEditControl
63 ,public ORichTextControl_Base
66 ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>
71 const ::com::sun::star::uno::Reference
< ::com::sun::star::lang::XMultiServiceFactory
>& _rxORB
78 // XServiceInfo - static version
79 static ::rtl::OUString SAL_CALL
getImplementationName_Static();
80 static ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames_Static();
81 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
);
85 DECLARE_UNO3_AGG_DEFAULTS( ORichTextControl
, UnoEditControl
);
86 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation( const ::com::sun::star::uno::Type
& _rType
) throw ( ::com::sun::star::uno::RuntimeException
);
89 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
);
92 virtual ::rtl::OUString SAL_CALL
getImplementationName() throw(::com::sun::star::uno::RuntimeException
);
93 virtual ::com::sun::star::uno::Sequence
< ::rtl::OUString
> SAL_CALL
getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException
);
96 DECLARE_XTYPEPROVIDER()
99 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> SAL_CALL
queryDispatch( const ::com::sun::star::util::URL
& _rURL
, const ::rtl::OUString
& _rTargetFrameName
, sal_Int32 _rSearchFlags
) throw (::com::sun::star::uno::RuntimeException
);
100 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
);
103 virtual sal_Bool
requiresNewPeer( const ::rtl::OUString
& _rPropertyName
) const;
106 //==================================================================
108 //==================================================================
109 typedef ::cppu::ImplHelper1
< ::com::sun::star::frame::XDispatchProvider
110 > ORichTextPeer_Base
;
111 class ORichTextPeer
:public VCLXWindow
112 ,public ORichTextPeer_Base
113 ,public ITextSelectionListener
116 typedef ::comphelper::ImplementationReference
< ORichTextFeatureDispatcher
, ::com::sun::star::frame::XDispatch
> SingleAttributeDispatcher
;
117 typedef ::std::map
< SfxSlotId
, SingleAttributeDispatcher
> AttributeDispatchers
;
118 AttributeDispatchers m_aDispatchers
;
123 a new ORichTextPeer instance, which has been aquired once!
125 static ORichTextPeer
* Create(
126 const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& _rxModel
,
127 Window
* _pParentWindow
,
132 DECLARE_XINTERFACE( )
139 virtual void SAL_CALL
setProperty( const ::rtl::OUString
& _rPropertyName
, const ::com::sun::star::uno::Any
& _rValue
) throw (::com::sun::star::uno::RuntimeException
);
142 DECLARE_XTYPEPROVIDER( )
145 virtual void SAL_CALL
dispose( ) throw(::com::sun::star::uno::RuntimeException
);
148 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XDispatch
> SAL_CALL
queryDispatch( const ::com::sun::star::util::URL
& _rURL
, const ::rtl::OUString
& _rTargetFrameName
, sal_Int32 _rSearchFlags
) throw (::com::sun::star::uno::RuntimeException
);
149 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
);
151 // ITextSelectionListener
152 virtual void onSelectionChanged( const ESelection
& _rSelection
);
155 SingleAttributeDispatcher
implCreateDispatcher( SfxSlotId _nSlotId
, const ::com::sun::star::util::URL
& _rURL
);
158 //.........................................................................
160 //.........................................................................
162 #endif // FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX