1*2d785d7eSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2d785d7eSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2d785d7eSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2d785d7eSAndrew Rist * distributed with this work for additional information 6*2d785d7eSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2d785d7eSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2d785d7eSAndrew Rist * "License"); you may not use this file except in compliance 9*2d785d7eSAndrew Rist * with the License. You may obtain a copy of the License at 10*2d785d7eSAndrew Rist * 11*2d785d7eSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2d785d7eSAndrew Rist * 13*2d785d7eSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2d785d7eSAndrew Rist * software distributed under the License is distributed on an 15*2d785d7eSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2d785d7eSAndrew Rist * KIND, either express or implied. See the License for the 17*2d785d7eSAndrew Rist * specific language governing permissions and limitations 18*2d785d7eSAndrew Rist * under the License. 19*2d785d7eSAndrew Rist * 20*2d785d7eSAndrew Rist *************************************************************/ 21*2d785d7eSAndrew Rist 22*2d785d7eSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX 25cdf0e10cSrcweir #define FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <toolkit/controls/unocontrols.hxx> 28cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir /** === begin UNO includes === **/ 31cdf0e10cSrcweir #include <com/sun/star/frame/XDispatchProvider.hpp> 32cdf0e10cSrcweir /** === end UNO includes === **/ 33cdf0e10cSrcweir #include <comphelper/uno3.hxx> 34cdf0e10cSrcweir #include <comphelper/implementationreference.hxx> 35cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 36cdf0e10cSrcweir #include <tools/wintypes.hxx> 37cdf0e10cSrcweir #include "rtattributes.hxx" 38cdf0e10cSrcweir #include "attributedispatcher.hxx" 39cdf0e10cSrcweir 40cdf0e10cSrcweir #include <map> 41cdf0e10cSrcweir 42cdf0e10cSrcweir //......................................................................... 43cdf0e10cSrcweir namespace frm 44cdf0e10cSrcweir { 45cdf0e10cSrcweir //......................................................................... 46cdf0e10cSrcweir 47cdf0e10cSrcweir class ORichTextFeatureDispatcher; 48cdf0e10cSrcweir class RichTextControl; 49cdf0e10cSrcweir 50cdf0e10cSrcweir //================================================================== 51cdf0e10cSrcweir // ORichTextControl 52cdf0e10cSrcweir //================================================================== 53cdf0e10cSrcweir typedef ::cppu::ImplHelper1 < ::com::sun::star::frame::XDispatchProvider 54cdf0e10cSrcweir > ORichTextControl_Base; 55cdf0e10cSrcweir class ORichTextControl :public UnoEditControl 56cdf0e10cSrcweir ,public ORichTextControl_Base 57cdf0e10cSrcweir { 58cdf0e10cSrcweir public: 59cdf0e10cSrcweir ORichTextControl( 60cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB 61cdf0e10cSrcweir ); 62cdf0e10cSrcweir 63cdf0e10cSrcweir protected: 64cdf0e10cSrcweir ~ORichTextControl(); 65cdf0e10cSrcweir 66cdf0e10cSrcweir public: 67cdf0e10cSrcweir // XServiceInfo - static version 68cdf0e10cSrcweir static ::rtl::OUString SAL_CALL getImplementationName_Static(); 69cdf0e10cSrcweir static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static(); 70cdf0e10cSrcweir 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 ); 71cdf0e10cSrcweir 72cdf0e10cSrcweir protected: 73cdf0e10cSrcweir // UNO 74cdf0e10cSrcweir DECLARE_UNO3_AGG_DEFAULTS( ORichTextControl, UnoEditControl ); 75cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw ( ::com::sun::star::uno::RuntimeException ); 76cdf0e10cSrcweir 77cdf0e10cSrcweir // XControl 78cdf0e10cSrcweir 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 ); 79cdf0e10cSrcweir 80cdf0e10cSrcweir // XServiceInfo 81cdf0e10cSrcweir virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); 82cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); 83cdf0e10cSrcweir 84cdf0e10cSrcweir // XTypeProvider 85cdf0e10cSrcweir DECLARE_XTYPEPROVIDER() 86cdf0e10cSrcweir 87cdf0e10cSrcweir // XDispatchProvider 88cdf0e10cSrcweir 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); 89cdf0e10cSrcweir 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); 90cdf0e10cSrcweir 91cdf0e10cSrcweir // UnoControl 92cdf0e10cSrcweir virtual sal_Bool requiresNewPeer( const ::rtl::OUString& _rPropertyName ) const; 93cdf0e10cSrcweir }; 94cdf0e10cSrcweir 95cdf0e10cSrcweir //================================================================== 96cdf0e10cSrcweir // ORichTextPeer 97cdf0e10cSrcweir //================================================================== 98cdf0e10cSrcweir typedef ::cppu::ImplHelper1 < ::com::sun::star::frame::XDispatchProvider 99cdf0e10cSrcweir > ORichTextPeer_Base; 100cdf0e10cSrcweir class ORichTextPeer :public VCLXWindow 101cdf0e10cSrcweir ,public ORichTextPeer_Base 102cdf0e10cSrcweir ,public ITextSelectionListener 103cdf0e10cSrcweir { 104cdf0e10cSrcweir private: 105cdf0e10cSrcweir typedef ::comphelper::ImplementationReference< ORichTextFeatureDispatcher, ::com::sun::star::frame::XDispatch > SingleAttributeDispatcher; 106cdf0e10cSrcweir typedef ::std::map< SfxSlotId, SingleAttributeDispatcher > AttributeDispatchers; 107cdf0e10cSrcweir AttributeDispatchers m_aDispatchers; 108cdf0e10cSrcweir 109cdf0e10cSrcweir public: 110cdf0e10cSrcweir /** factory method 111cdf0e10cSrcweir @return 112cdf0e10cSrcweir a new ORichTextPeer instance, which has been aquired once! 113cdf0e10cSrcweir */ 114cdf0e10cSrcweir static ORichTextPeer* Create( 115cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel, 116cdf0e10cSrcweir Window* _pParentWindow, 117cdf0e10cSrcweir WinBits _nStyle 118cdf0e10cSrcweir ); 119cdf0e10cSrcweir 120cdf0e10cSrcweir // XInterface 121cdf0e10cSrcweir DECLARE_XINTERFACE( ) 122cdf0e10cSrcweir 123cdf0e10cSrcweir protected: 124cdf0e10cSrcweir ORichTextPeer(); 125cdf0e10cSrcweir ~ORichTextPeer(); 126cdf0e10cSrcweir 127cdf0e10cSrcweir // XView 128cdf0e10cSrcweir void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException); 129cdf0e10cSrcweir 130cdf0e10cSrcweir // XVclWindowPeer 131cdf0e10cSrcweir virtual void SAL_CALL setProperty( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::uno::RuntimeException); 132cdf0e10cSrcweir 133cdf0e10cSrcweir // XTypeProvider 134cdf0e10cSrcweir DECLARE_XTYPEPROVIDER( ) 135cdf0e10cSrcweir 136cdf0e10cSrcweir // XComponent 137cdf0e10cSrcweir virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException); 138cdf0e10cSrcweir 139cdf0e10cSrcweir // XDispatchProvider 140cdf0e10cSrcweir 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); 141cdf0e10cSrcweir 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); 142cdf0e10cSrcweir 143cdf0e10cSrcweir // ITextSelectionListener 144cdf0e10cSrcweir virtual void onSelectionChanged( const ESelection& _rSelection ); 145cdf0e10cSrcweir 146cdf0e10cSrcweir private: 147cdf0e10cSrcweir SingleAttributeDispatcher implCreateDispatcher( SfxSlotId _nSlotId, const ::com::sun::star::util::URL& _rURL ); 148cdf0e10cSrcweir }; 149cdf0e10cSrcweir 150cdf0e10cSrcweir //......................................................................... 151cdf0e10cSrcweir } // namespace frm 152cdf0e10cSrcweir //......................................................................... 153cdf0e10cSrcweir 154cdf0e10cSrcweir #endif // FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX 155cdf0e10cSrcweir 156