bump product version to 4.1.6.2
[LibreOffice.git] / forms / source / richtext / richtextcontrol.hxx
blob5dd61be825d0f6831855ead94de3849255d97a28
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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"
34 #include <map>
36 //.........................................................................
37 namespace frm
39 //.........................................................................
41 class ORichTextFeatureDispatcher;
43 //==================================================================
44 // ORichTextControl
45 //==================================================================
46 typedef ::cppu::ImplHelper1 < ::com::sun::star::frame::XDispatchProvider
47 > ORichTextControl_Base;
48 class ORichTextControl :public UnoEditControl
49 ,public ORichTextControl_Base
51 public:
52 ORichTextControl();
54 protected:
55 ~ORichTextControl();
57 public:
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 );
63 protected:
64 // UNO
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 );
68 // XControl
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 );
71 // XServiceInfo
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);
75 // XTypeProvider
76 DECLARE_XTYPEPROVIDER()
78 // XDispatchProvider
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);
82 // UnoControl
83 virtual sal_Bool requiresNewPeer( const OUString& _rPropertyName ) const;
86 //==================================================================
87 // ORichTextPeer
88 //==================================================================
89 typedef ::cppu::ImplHelper1 < ::com::sun::star::frame::XDispatchProvider
90 > ORichTextPeer_Base;
91 class ORichTextPeer :public VCLXWindow
92 ,public ORichTextPeer_Base
93 ,public ITextSelectionListener
95 private:
96 typedef ::comphelper::ImplementationReference< ORichTextFeatureDispatcher, ::com::sun::star::frame::XDispatch > SingleAttributeDispatcher;
97 typedef ::std::map< SfxSlotId, SingleAttributeDispatcher > AttributeDispatchers;
98 AttributeDispatchers m_aDispatchers;
100 public:
101 /** factory method
102 @return
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,
108 WinBits _nStyle
111 // XInterface
112 DECLARE_XINTERFACE( )
114 protected:
115 ORichTextPeer();
116 ~ORichTextPeer();
118 // XView
119 void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
121 // XVclWindowPeer
122 virtual void SAL_CALL setProperty( const OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::uno::RuntimeException);
124 // XTypeProvider
125 DECLARE_XTYPEPROVIDER( )
127 // XComponent
128 virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
130 // XDispatchProvider
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 );
137 private:
138 SingleAttributeDispatcher implCreateDispatcher( SfxSlotId _nSlotId, const ::com::sun::star::util::URL& _rURL );
141 //.........................................................................
142 } // namespace frm
143 //.........................................................................
145 #endif // FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */