Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
21 : : #define FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
22 : :
23 : : #include <toolkit/controls/unocontrols.hxx>
24 : : #include <toolkit/awt/vclxwindow.hxx>
25 : :
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"
33 : :
34 : : #include <map>
35 : :
36 : : //.........................................................................
37 : : namespace frm
38 : : {
39 : : //.........................................................................
40 : :
41 : : class ORichTextFeatureDispatcher;
42 : :
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
50 : : {
51 : : public:
52 : : ORichTextControl(
53 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
54 : : );
55 : :
56 : : protected:
57 : : ~ORichTextControl();
58 : :
59 : : public:
60 : : // XServiceInfo - static version
61 : : static ::rtl::OUString SAL_CALL getImplementationName_Static();
62 : : static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static();
63 : : 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 );
64 : :
65 : : protected:
66 : : // UNO
67 : 28846 : DECLARE_UNO3_AGG_DEFAULTS( ORichTextControl, UnoEditControl );
68 : : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw ( ::com::sun::star::uno::RuntimeException );
69 : :
70 : : // XControl
71 : : 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 : :
73 : : // XServiceInfo
74 : : virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
75 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
76 : :
77 : : // XTypeProvider
78 : : DECLARE_XTYPEPROVIDER()
79 : :
80 : : // XDispatchProvider
81 : : 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);
82 : : 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 : :
84 : : // UnoControl
85 : : virtual sal_Bool requiresNewPeer( const ::rtl::OUString& _rPropertyName ) const;
86 : : };
87 : :
88 : : //==================================================================
89 : : // ORichTextPeer
90 : : //==================================================================
91 : : typedef ::cppu::ImplHelper1 < ::com::sun::star::frame::XDispatchProvider
92 : : > ORichTextPeer_Base;
93 : : class ORichTextPeer :public VCLXWindow
94 : : ,public ORichTextPeer_Base
95 : : ,public ITextSelectionListener
96 : : {
97 : : private:
98 : : typedef ::comphelper::ImplementationReference< ORichTextFeatureDispatcher, ::com::sun::star::frame::XDispatch > SingleAttributeDispatcher;
99 : : typedef ::std::map< SfxSlotId, SingleAttributeDispatcher > AttributeDispatchers;
100 : : AttributeDispatchers m_aDispatchers;
101 : :
102 : : public:
103 : : /** factory method
104 : : @return
105 : : a new ORichTextPeer instance, which has been aquired once!
106 : : */
107 : : static ORichTextPeer* Create(
108 : : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel,
109 : : Window* _pParentWindow,
110 : : WinBits _nStyle
111 : : );
112 : :
113 : : // XInterface
114 : : DECLARE_XINTERFACE( )
115 : :
116 : : protected:
117 : : ORichTextPeer();
118 : : ~ORichTextPeer();
119 : :
120 : : // XView
121 : : void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
122 : :
123 : : // XVclWindowPeer
124 : : virtual void SAL_CALL setProperty( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::uno::RuntimeException);
125 : :
126 : : // XTypeProvider
127 : : DECLARE_XTYPEPROVIDER( )
128 : :
129 : : // XComponent
130 : : virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
131 : :
132 : : // XDispatchProvider
133 : : 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);
134 : : 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);
135 : :
136 : : // ITextSelectionListener
137 : : virtual void onSelectionChanged( const ESelection& _rSelection );
138 : :
139 : : private:
140 : : SingleAttributeDispatcher implCreateDispatcher( SfxSlotId _nSlotId, const ::com::sun::star::util::URL& _rURL );
141 : : };
142 : :
143 : : //.........................................................................
144 : : } // namespace frm
145 : : //.........................................................................
146 : :
147 : : #endif // FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
148 : :
149 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|