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 INCLUDED_FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
21 : #define INCLUDED_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 :
54 : protected:
55 : virtual ~ORichTextControl();
56 :
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 );
62 :
63 : protected:
64 : // UNO
65 0 : 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, std::exception ) SAL_OVERRIDE;
67 :
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, std::exception ) SAL_OVERRIDE;
70 :
71 : // XServiceInfo
72 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
73 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
74 :
75 : // XTypeProvider
76 : DECLARE_XTYPEPROVIDER()
77 :
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, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
81 :
82 : // UnoControl
83 : virtual bool requiresNewPeer( const OUString& _rPropertyName ) const SAL_OVERRIDE;
84 : };
85 :
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
94 : {
95 : private:
96 : typedef ::comphelper::ImplementationReference< ORichTextFeatureDispatcher, ::com::sun::star::frame::XDispatch > SingleAttributeDispatcher;
97 : typedef ::std::map< SfxSlotId, SingleAttributeDispatcher > AttributeDispatchers;
98 : AttributeDispatchers m_aDispatchers;
99 :
100 : public:
101 : /** factory method
102 : @return
103 : a new ORichTextPeer instance, which has been aquired once!
104 : */
105 : static ORichTextPeer* Create(
106 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel,
107 : Window* _pParentWindow,
108 : WinBits _nStyle
109 : );
110 :
111 : // XInterface
112 : DECLARE_XINTERFACE( )
113 :
114 : protected:
115 : ORichTextPeer();
116 : virtual ~ORichTextPeer();
117 :
118 : // XView
119 : void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 :
121 : // XVclWindowPeer
122 : virtual void SAL_CALL setProperty( const OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue )
123 : throw (::com::sun::star::uno::RuntimeException,
124 : std::exception) SAL_OVERRIDE;
125 :
126 : // XTypeProvider
127 : DECLARE_XTYPEPROVIDER( )
128 :
129 : // XComponent
130 : virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
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 OUString& _rTargetFrameName, sal_Int32 _rSearchFlags ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
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, std::exception) SAL_OVERRIDE;
135 :
136 : // ITextSelectionListener
137 : virtual void onSelectionChanged( const ESelection& _rSelection ) SAL_OVERRIDE;
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 // INCLUDED_FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
148 :
149 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|