merge the formfield patch from ooo-build
[ooovba.git] / forms / source / richtext / richtextmodel.hxx
blobb6629aea2305958eee865562ff38e93d8786cf58
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: richtextmodel.hxx,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef FORMS_SOURCE_RICHTEXT_RICHTEXTMODEL_HXX
31 #define FORMS_SOURCE_RICHTEXT_RICHTEXTMODEL_HXX
33 #include "FormComponent.hxx"
34 #include "frm_module.hxx"
35 #include "formcontrolfont.hxx"
36 #include "richtextunowrapper.hxx"
37 #include <comphelper/propertycontainerhelper.hxx>
38 #include <comphelper/listenernotification.hxx>
40 /** === begin UNO includes === **/
41 #include <com/sun/star/awt/XDevice.hpp>
42 #include <com/sun/star/util/XModifyBroadcaster.hpp>
43 /** === end UNO includes === **/
44 #include <cppuhelper/implbase3.hxx>
45 #include <tools/link.hxx>
46 #include <memory>
48 class EditEngine;
49 //........................................................................
50 namespace frm
52 //........................................................................
54 class RichTextEngine;
55 //====================================================================
56 //= ORichTextModel
57 //====================================================================
58 typedef ::cppu::ImplHelper3 < ::com::sun::star::awt::XControlModel
59 , ::com::sun::star::lang::XUnoTunnel
60 , ::com::sun::star::util::XModifyBroadcaster
61 > ORichTextModel_BASE;
63 class ORichTextModel
64 :public OControlModel
65 ,public FontControlModel
66 ,public IEngineTextChangeListener
67 ,public ::comphelper::OPropertyContainerHelper
68 ,public ORichTextModel_BASE
70 private:
71 // <properties>
72 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >
73 m_xReferenceDevice;
74 ::com::sun::star::uno::Any m_aTabStop;
75 ::com::sun::star::uno::Any m_aBackgroundColor;
76 ::com::sun::star::uno::Any m_aBorderColor;
77 ::rtl::OUString m_sDefaultControl;
78 ::rtl::OUString m_sHelpText;
79 ::rtl::OUString m_sHelpURL;
80 ::rtl::OUString m_sLastKnownEngineText;
81 sal_Int16 m_nLineEndFormat;
82 sal_Int16 m_nTextWritingMode;
83 sal_Int16 m_nContextWritingMode;
84 sal_Int16 m_nBorder;
85 sal_Bool m_bEnabled;
86 sal_Bool m_bEnableVisible;
87 sal_Bool m_bHardLineBreaks;
88 sal_Bool m_bHScroll;
89 sal_Bool m_bVScroll;
90 sal_Bool m_bReadonly;
91 sal_Bool m_bPrintable;
92 sal_Bool m_bReallyActAsRichText; // despite the class name, the RichTextControl later on
93 // will create "ordinary" text peers depending on this property
94 sal_Bool m_bHideInactiveSelection;
95 // </properties>
97 // <properties_for_awt_edit_compatibility>
98 ::com::sun::star::uno::Any m_aAlign;
99 sal_Int16 m_nEchoChar;
100 sal_Int16 m_nMaxTextLength;
101 sal_Bool m_bMultiLine;
102 // </properties_for_awt_edit_compatibility>
104 ::std::auto_ptr<RichTextEngine>
105 m_pEngine;
106 bool m_bSettingEngineText;
108 ::cppu::OInterfaceContainerHelper
109 m_aModifyListeners;
111 public:
112 static RichTextEngine* getEditEngine( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel );
114 protected:
115 DECLARE_DEFAULT_LEAF_XTOR( ORichTextModel );
117 // UNO
118 DECLARE_UNO3_AGG_DEFAULTS( ONavigationBarModel, OControlModel );
119 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
121 // XServiceInfo
122 DECLARE_SERVICE_REGISTRATION( ORichTextModel )
124 // XPersistObject
125 DECLARE_XPERSISTOBJECT()
127 // XTypeProvider
128 DECLARE_XTYPEPROVIDER()
130 // XCloneable
131 DECLARE_XCLONEABLE();
133 // XUnoTunnel
134 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException);
136 // XModifyBroadcaster
137 virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
138 virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
140 // XPropertySet and friends
141 virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
142 virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue,
143 sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
144 throw(::com::sun::star::lang::IllegalArgumentException);
145 virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception);
146 virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const;
148 // OControlModel's property handling
149 virtual void describeFixedProperties(
150 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps
151 ) const;
152 virtual void describeAggregateProperties(
153 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
154 ) const;
156 // prevent method hiding
157 using OControlModel::disposing;
158 using OControlModel::getFastPropertyValue;
160 // OComponentHelper
161 virtual void SAL_CALL disposing();
163 // IEngineTextChangeListener
164 virtual void potentialTextChange( );
166 private:
167 void implInit();
168 void implDoAggregation();
169 void implRegisterProperties();
171 /** propagates a new text to the EditEngine
173 This method needs to lock the global solar mutex, so our own mutex must not
174 be locked when calling.
176 @precond
177 our mutex is not locked
179 void impl_smlock_setEngineText( const ::rtl::OUString& _rText );
181 DECL_LINK( OnEngineContentModified, void* );
183 static ::com::sun::star::uno::Sequence< sal_Int8 > getEditEngineTunnelId();
185 private:
186 ORichTextModel(); // never implemented
187 ORichTextModel( const ORichTextModel& ); // never implemented
188 ORichTextModel& operator=( const ORichTextModel& ); // never implemented
191 //........................................................................
192 } // namespace frm
193 //........................................................................
195 #endif // FORMS_SOURCE_RICHTEXT_RICHTEXTMODEL_HXX