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 : : #ifndef FORMS_SOURCE_RICHTEXT_RICHTEXTMODEL_HXX
20 : : #define FORMS_SOURCE_RICHTEXT_RICHTEXTMODEL_HXX
21 : :
22 : : #include "FormComponent.hxx"
23 : : #include "frm_module.hxx"
24 : : #include "formcontrolfont.hxx"
25 : : #include "richtextunowrapper.hxx"
26 : : #include <comphelper/propertycontainerhelper.hxx>
27 : : #include <comphelper/listenernotification.hxx>
28 : :
29 : : #include <com/sun/star/awt/XDevice.hpp>
30 : : #include <com/sun/star/util/XModifyBroadcaster.hpp>
31 : : #include <cppuhelper/implbase3.hxx>
32 : : #include <tools/link.hxx>
33 : : #include <memory>
34 : :
35 : : class EditEngine;
36 : : //........................................................................
37 : : namespace frm
38 : : {
39 : : //........................................................................
40 : :
41 : : class RichTextEngine;
42 : : //====================================================================
43 : : //= ORichTextModel
44 : : //====================================================================
45 : : typedef ::cppu::ImplHelper3 < ::com::sun::star::awt::XControlModel
46 : : , ::com::sun::star::lang::XUnoTunnel
47 : : , ::com::sun::star::util::XModifyBroadcaster
48 : : > ORichTextModel_BASE;
49 : :
50 : : class ORichTextModel
51 : : :public OControlModel
52 : : ,public FontControlModel
53 : : ,public IEngineTextChangeListener
54 : : ,public ::comphelper::OPropertyContainerHelper
55 : : ,public ORichTextModel_BASE
56 : : {
57 : : private:
58 : : // <properties>
59 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >
60 : : m_xReferenceDevice;
61 : : ::com::sun::star::uno::Any m_aTabStop;
62 : : ::com::sun::star::uno::Any m_aBackgroundColor;
63 : : ::com::sun::star::uno::Any m_aBorderColor;
64 : : ::com::sun::star::uno::Any m_aVerticalAlignment;
65 : : ::rtl::OUString m_sDefaultControl;
66 : : ::rtl::OUString m_sHelpText;
67 : : ::rtl::OUString m_sHelpURL;
68 : : ::rtl::OUString m_sLastKnownEngineText;
69 : : sal_Int16 m_nLineEndFormat;
70 : : sal_Int16 m_nTextWritingMode;
71 : : sal_Int16 m_nContextWritingMode;
72 : : sal_Int16 m_nBorder;
73 : : sal_Bool m_bEnabled;
74 : : sal_Bool m_bEnableVisible;
75 : : sal_Bool m_bHardLineBreaks;
76 : : sal_Bool m_bHScroll;
77 : : sal_Bool m_bVScroll;
78 : : sal_Bool m_bReadonly;
79 : : sal_Bool m_bPrintable;
80 : : sal_Bool m_bReallyActAsRichText; // despite the class name, the RichTextControl later on
81 : : // will create "ordinary" text peers depending on this property
82 : : sal_Bool m_bHideInactiveSelection;
83 : : // </properties>
84 : :
85 : : // <properties_for_awt_edit_compatibility>
86 : : ::com::sun::star::uno::Any m_aAlign;
87 : : sal_Int16 m_nEchoChar;
88 : : sal_Int16 m_nMaxTextLength;
89 : : sal_Bool m_bMultiLine;
90 : : // </properties_for_awt_edit_compatibility>
91 : :
92 : : ::std::auto_ptr<RichTextEngine>
93 : : m_pEngine;
94 : : bool m_bSettingEngineText;
95 : :
96 : : ::cppu::OInterfaceContainerHelper
97 : : m_aModifyListeners;
98 : :
99 : : public:
100 : : static RichTextEngine* getEditEngine( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel );
101 : :
102 : : protected:
103 : : DECLARE_DEFAULT_LEAF_XTOR( ORichTextModel );
104 : :
105 : : // UNO
106 : 133540 : DECLARE_UNO3_AGG_DEFAULTS( ORichTextModel, OControlModel );
107 : : virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
108 : :
109 : : // XServiceInfo
110 : : DECLARE_SERVICE_REGISTRATION( ORichTextModel )
111 : :
112 : : // XPersistObject
113 : : DECLARE_XPERSISTOBJECT()
114 : :
115 : : // XTypeProvider
116 : : DECLARE_XTYPEPROVIDER()
117 : :
118 : : // XCloneable
119 : : DECLARE_XCLONEABLE();
120 : :
121 : : // XUnoTunnel
122 : : virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException);
123 : :
124 : : // XModifyBroadcaster
125 : : virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
126 : : virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
127 : :
128 : : // XPropertySet and friends
129 : : virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
130 : : virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue,
131 : : sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
132 : : throw(::com::sun::star::lang::IllegalArgumentException);
133 : : virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception);
134 : : virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const;
135 : :
136 : : // OControlModel's property handling
137 : : virtual void describeFixedProperties(
138 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
139 : : ) const;
140 : : virtual void describeAggregateProperties(
141 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
142 : : ) const;
143 : :
144 : : // prevent method hiding
145 : : using OControlModel::disposing;
146 : : using OControlModel::getFastPropertyValue;
147 : :
148 : : // OComponentHelper
149 : : virtual void SAL_CALL disposing();
150 : :
151 : : // IEngineTextChangeListener
152 : : virtual void potentialTextChange( );
153 : :
154 : : private:
155 : : void implInit();
156 : : void implDoAggregation();
157 : : void implRegisterProperties();
158 : :
159 : : /** propagates a new text to the EditEngine
160 : :
161 : : This method needs to lock the global solar mutex, so our own mutex must not
162 : : be locked when calling.
163 : :
164 : : @precond
165 : : our mutex is not locked
166 : : */
167 : : void impl_smlock_setEngineText( const ::rtl::OUString& _rText );
168 : :
169 : : DECL_LINK( OnEngineContentModified, void* );
170 : :
171 : : static ::com::sun::star::uno::Sequence< sal_Int8 > getEditEngineTunnelId();
172 : :
173 : : private:
174 : : ORichTextModel(); // never implemented
175 : : ORichTextModel( const ORichTextModel& ); // never implemented
176 : : ORichTextModel& operator=( const ORichTextModel& ); // never implemented
177 : : };
178 : :
179 : : //........................................................................
180 : : } // namespace frm
181 : : //........................................................................
182 : :
183 : : #endif // FORMS_SOURCE_RICHTEXT_RICHTEXTMODEL_HXX
184 : :
185 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|