update dev300-m58
[ooovba.git] / forms / source / richtext / richtextcontrol.hxx
blob2d2b4b3decd6a67ca1a8c4c431f1eb5d0c8c83d2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: richtextcontrol.hxx,v $
10 * $Revision: 1.5 $
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"
47 #include <map>
49 //.........................................................................
50 namespace frm
52 //.........................................................................
54 class ORichTextFeatureDispatcher;
55 class RichTextControl;
57 //==================================================================
58 // ORichTextControl
59 //==================================================================
60 typedef ::cppu::ImplHelper1 < ::com::sun::star::frame::XDispatchProvider
61 > ORichTextControl_Base;
62 class ORichTextControl :public UnoEditControl
63 ,public ORichTextControl_Base
65 private:
66 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
67 m_xORB;
69 public:
70 ORichTextControl(
71 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
74 protected:
75 ~ORichTextControl();
77 public:
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 );
83 protected:
84 // UNO
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 );
88 // XControl
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 );
91 // XServiceInfo
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);
95 // XTypeProvider
96 DECLARE_XTYPEPROVIDER()
98 // XDispatchProvider
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);
102 // UnoControl
103 virtual sal_Bool requiresNewPeer( const ::rtl::OUString& _rPropertyName ) const;
106 //==================================================================
107 // ORichTextPeer
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
115 private:
116 typedef ::comphelper::ImplementationReference< ORichTextFeatureDispatcher, ::com::sun::star::frame::XDispatch > SingleAttributeDispatcher;
117 typedef ::std::map< SfxSlotId, SingleAttributeDispatcher > AttributeDispatchers;
118 AttributeDispatchers m_aDispatchers;
120 public:
121 /** factory method
122 @return
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,
128 WinBits _nStyle
131 // XInterface
132 DECLARE_XINTERFACE( )
134 protected:
135 ORichTextPeer();
136 ~ORichTextPeer();
138 // XVclWindowPeer
139 virtual void SAL_CALL setProperty( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::uno::RuntimeException);
141 // XTypeProvider
142 DECLARE_XTYPEPROVIDER( )
144 // XComponent
145 virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
147 // XDispatchProvider
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 );
154 private:
155 SingleAttributeDispatcher implCreateDispatcher( SfxSlotId _nSlotId, const ::com::sun::star::util::URL& _rURL );
158 //.........................................................................
159 } // namespace frm
160 //.........................................................................
162 #endif // FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX