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/lang/XMultiServiceFactory.hpp>
27 : #include <com/sun/star/frame/XDispatchProvider.hpp>
28 : #include <comphelper/uno3.hxx>
29 : #include <cppuhelper/implbase1.hxx>
30 : #include <rtl/ref.hxx>
31 : #include <tools/wintypes.hxx>
32 : #include "rtattributes.hxx"
33 : #include "attributedispatcher.hxx"
34 :
35 : #include <map>
36 :
37 :
38 : namespace frm
39 : {
40 :
41 : class ORichTextFeatureDispatcher;
42 :
43 : typedef ::cppu::ImplHelper1 < ::com::sun::star::frame::XDispatchProvider
44 : > ORichTextControl_Base;
45 : class ORichTextControl :public UnoEditControl
46 : ,public ORichTextControl_Base
47 : {
48 : public:
49 : ORichTextControl();
50 :
51 : protected:
52 : virtual ~ORichTextControl();
53 :
54 : public:
55 : // XServiceInfo - static version
56 : static OUString SAL_CALL getImplementationName_Static();
57 : static ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_Static();
58 :
59 : protected:
60 : // UNO
61 19883 : DECLARE_UNO3_AGG_DEFAULTS( ORichTextControl, UnoEditControl )
62 : 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;
63 :
64 : // XControl
65 : 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;
66 :
67 : // XServiceInfo
68 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
69 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
70 :
71 : // XTypeProvider
72 : DECLARE_XTYPEPROVIDER()
73 :
74 : // XDispatchProvider
75 : 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;
76 : 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;
77 :
78 : // UnoControl
79 : virtual bool requiresNewPeer( const OUString& _rPropertyName ) const SAL_OVERRIDE;
80 : };
81 :
82 : typedef ::cppu::ImplHelper1 < ::com::sun::star::frame::XDispatchProvider
83 : > ORichTextPeer_Base;
84 : class ORichTextPeer :public VCLXWindow
85 : ,public ORichTextPeer_Base
86 : ,public ITextSelectionListener
87 : {
88 : private:
89 : typedef rtl::Reference<ORichTextFeatureDispatcher> SingleAttributeDispatcher;
90 : typedef ::std::map< SfxSlotId, SingleAttributeDispatcher > AttributeDispatchers;
91 : AttributeDispatchers m_aDispatchers;
92 :
93 : public:
94 : /** factory method
95 : @return
96 : a new ORichTextPeer instance, which has been acquired once!
97 : */
98 : static ORichTextPeer* Create(
99 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel,
100 : vcl::Window* _pParentWindow,
101 : WinBits _nStyle
102 : );
103 :
104 : // XInterface
105 : DECLARE_XINTERFACE( )
106 :
107 : protected:
108 : ORichTextPeer();
109 : virtual ~ORichTextPeer();
110 :
111 : // XView
112 : void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
113 :
114 : // XVclWindowPeer
115 : virtual void SAL_CALL setProperty( const OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue )
116 : throw (::com::sun::star::uno::RuntimeException,
117 : std::exception) SAL_OVERRIDE;
118 :
119 : // XTypeProvider
120 : DECLARE_XTYPEPROVIDER( )
121 :
122 : // XComponent
123 : virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 :
125 : // XDispatchProvider
126 : 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;
127 : 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;
128 :
129 : // ITextSelectionListener
130 : virtual void onSelectionChanged( const ESelection& _rSelection ) SAL_OVERRIDE;
131 :
132 : private:
133 : SingleAttributeDispatcher implCreateDispatcher( SfxSlotId _nSlotId, const ::com::sun::star::util::URL& _rURL );
134 : };
135 :
136 :
137 : } // namespace frm
138 :
139 :
140 : #endif // INCLUDED_FORMS_SOURCE_RICHTEXT_RICHTEXTCONTROL_HXX
141 :
142 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|