xref: /AOO41X/main/forms/source/richtext/richtextmodel.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_forms.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #ifndef FORMS_SOURCE_RICHTEXT_RICHTEXTMODEL_CXX
32*cdf0e10cSrcweir #include "richtextmodel.hxx"
33*cdf0e10cSrcweir #endif
34*cdf0e10cSrcweir #include "richtextengine.hxx"
35*cdf0e10cSrcweir #include "richtextunowrapper.hxx"
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir /** === begin UNO includes === **/
38*cdf0e10cSrcweir #include <com/sun/star/awt/LineEndFormat.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/text/WritingMode2.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/style/VerticalAlignment.hpp>
41*cdf0e10cSrcweir /** === end UNO includes === **/
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
44*cdf0e10cSrcweir #include <comphelper/guarding.hxx>
45*cdf0e10cSrcweir #include <toolkit/awt/vclxdevice.hxx>
46*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
47*cdf0e10cSrcweir #include <editeng/editstat.hxx>
48*cdf0e10cSrcweir #include <vcl/outdev.hxx>
49*cdf0e10cSrcweir #include <vcl/svapp.hxx>
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir //--------------------------------------------------------------------------
52*cdf0e10cSrcweir extern "C" void SAL_CALL createRegistryInfo_ORichTextModel()
53*cdf0e10cSrcweir {
54*cdf0e10cSrcweir     static ::frm::OMultiInstanceAutoRegistration< ::frm::ORichTextModel >   aRegisterModel;
55*cdf0e10cSrcweir }
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir //........................................................................
58*cdf0e10cSrcweir namespace frm
59*cdf0e10cSrcweir {
60*cdf0e10cSrcweir //........................................................................
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir     using namespace ::com::sun::star::uno;
63*cdf0e10cSrcweir     using namespace ::com::sun::star::awt;
64*cdf0e10cSrcweir     using namespace ::com::sun::star::lang;
65*cdf0e10cSrcweir     using namespace ::com::sun::star::io;
66*cdf0e10cSrcweir     using namespace ::com::sun::star::beans;
67*cdf0e10cSrcweir     using namespace ::com::sun::star::form;
68*cdf0e10cSrcweir     using namespace ::com::sun::star::util;
69*cdf0e10cSrcweir     using namespace ::com::sun::star::style;
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir     namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir     //====================================================================
74*cdf0e10cSrcweir     //= ORichTextModel
75*cdf0e10cSrcweir     //====================================================================
76*cdf0e10cSrcweir     DBG_NAME( ORichTextModel )
77*cdf0e10cSrcweir     //--------------------------------------------------------------------
78*cdf0e10cSrcweir     ORichTextModel::ORichTextModel( const Reference< XMultiServiceFactory >& _rxFactory )
79*cdf0e10cSrcweir         :OControlModel       ( _rxFactory, ::rtl::OUString() )
80*cdf0e10cSrcweir         ,FontControlModel    ( true                          )
81*cdf0e10cSrcweir         ,m_pEngine           ( RichTextEngine::Create()      )
82*cdf0e10cSrcweir         ,m_bSettingEngineText( false                         )
83*cdf0e10cSrcweir         ,m_aModifyListeners  ( m_aMutex                      )
84*cdf0e10cSrcweir     {
85*cdf0e10cSrcweir         DBG_CTOR( ORichTextModel, NULL );
86*cdf0e10cSrcweir         m_nClassId = FormComponentType::TEXTFIELD;
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_DEFAULTCONTROL          ) >>= m_sDefaultControl;
89*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_BORDER                  ) >>= m_nBorder;
90*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_ENABLED                 ) >>= m_bEnabled;
91*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_ENABLEVISIBLE           ) >>= m_bEnableVisible;
92*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_HARDLINEBREAKS          ) >>= m_bHardLineBreaks;
93*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_HSCROLL                 ) >>= m_bHScroll;
94*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_VSCROLL                 ) >>= m_bVScroll;
95*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_READONLY                ) >>= m_bReadonly;
96*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_PRINTABLE               ) >>= m_bPrintable;
97*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_ALIGN                   ) >>= m_aAlign;
98*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_ECHO_CHAR               ) >>= m_nEchoChar;
99*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_MAXTEXTLEN              ) >>= m_nMaxTextLength;
100*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_MULTILINE               ) >>= m_bMultiLine;
101*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_RICH_TEXT               ) >>= m_bReallyActAsRichText;
102*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_HIDEINACTIVESELECTION   ) >>= m_bHideInactiveSelection;
103*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_LINEEND_FORMAT          ) >>= m_nLineEndFormat;
104*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_WRITING_MODE            ) >>= m_nTextWritingMode;
105*cdf0e10cSrcweir         getPropertyDefaultByHandle( PROPERTY_ID_CONTEXT_WRITING_MODE    ) >>= m_nContextWritingMode;
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir         implInit();
108*cdf0e10cSrcweir     }
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir     //------------------------------------------------------------------
111*cdf0e10cSrcweir     ORichTextModel::ORichTextModel( const ORichTextModel* _pOriginal, const Reference< XMultiServiceFactory >& _rxFactory )
112*cdf0e10cSrcweir         :OControlModel       ( _pOriginal, _rxFactory, sal_False )
113*cdf0e10cSrcweir         ,FontControlModel    ( _pOriginal                        )
114*cdf0e10cSrcweir         ,m_pEngine           ( NULL                              )
115*cdf0e10cSrcweir         ,m_bSettingEngineText( false                             )
116*cdf0e10cSrcweir         ,m_aModifyListeners  ( m_aMutex                          )
117*cdf0e10cSrcweir     {
118*cdf0e10cSrcweir         DBG_CTOR( ORichTextModel, NULL );
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir         m_aTabStop               = _pOriginal->m_aTabStop;
121*cdf0e10cSrcweir         m_aBackgroundColor       = _pOriginal->m_aBackgroundColor;
122*cdf0e10cSrcweir         m_aBorderColor           = _pOriginal->m_aBorderColor;
123*cdf0e10cSrcweir         m_aVerticalAlignment     = _pOriginal->m_aVerticalAlignment;
124*cdf0e10cSrcweir         m_sDefaultControl        = _pOriginal->m_sDefaultControl;
125*cdf0e10cSrcweir         m_sHelpText              = _pOriginal->m_sHelpText;
126*cdf0e10cSrcweir         m_sHelpURL               = _pOriginal->m_sHelpURL;
127*cdf0e10cSrcweir         m_nBorder                = _pOriginal->m_nBorder;
128*cdf0e10cSrcweir         m_bEnabled               = _pOriginal->m_bEnabled;
129*cdf0e10cSrcweir         m_bEnableVisible         = _pOriginal->m_bEnableVisible;
130*cdf0e10cSrcweir         m_bHardLineBreaks        = _pOriginal->m_bHardLineBreaks;
131*cdf0e10cSrcweir         m_bHScroll               = _pOriginal->m_bHScroll;
132*cdf0e10cSrcweir         m_bVScroll               = _pOriginal->m_bVScroll;
133*cdf0e10cSrcweir         m_bReadonly              = _pOriginal->m_bReadonly;
134*cdf0e10cSrcweir         m_bPrintable             = _pOriginal->m_bPrintable;
135*cdf0e10cSrcweir         m_bReallyActAsRichText   = _pOriginal->m_bReallyActAsRichText;
136*cdf0e10cSrcweir         m_bHideInactiveSelection = _pOriginal->m_bHideInactiveSelection;
137*cdf0e10cSrcweir         m_nLineEndFormat         = _pOriginal->m_nLineEndFormat;
138*cdf0e10cSrcweir         m_nTextWritingMode       = _pOriginal->m_nTextWritingMode;
139*cdf0e10cSrcweir         m_nContextWritingMode    = _pOriginal->m_nContextWritingMode;
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir         m_aAlign               = _pOriginal->m_aAlign;
142*cdf0e10cSrcweir         m_nEchoChar            = _pOriginal->m_nEchoChar;
143*cdf0e10cSrcweir         m_nMaxTextLength       = _pOriginal->m_nMaxTextLength;
144*cdf0e10cSrcweir         m_bMultiLine           = _pOriginal->m_bMultiLine;
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir         m_pEngine.reset(_pOriginal->m_pEngine->Clone());
147*cdf0e10cSrcweir         m_sLastKnownEngineText = m_pEngine->GetText();
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir         implInit();
150*cdf0e10cSrcweir     }
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir     //------------------------------------------------------------------
153*cdf0e10cSrcweir     void ORichTextModel::implInit()
154*cdf0e10cSrcweir     {
155*cdf0e10cSrcweir         OSL_ENSURE( m_pEngine.get(), "ORichTextModel::implInit: where's the engine?" );
156*cdf0e10cSrcweir         if ( m_pEngine.get() )
157*cdf0e10cSrcweir         {
158*cdf0e10cSrcweir             m_pEngine->SetModifyHdl( LINK( this, ORichTextModel, OnEngineContentModified ) );
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir             sal_uLong nEngineControlWord = m_pEngine->GetControlWord();
161*cdf0e10cSrcweir             nEngineControlWord = nEngineControlWord & ~EE_CNTRL_AUTOPAGESIZE;
162*cdf0e10cSrcweir             m_pEngine->SetControlWord( nEngineControlWord );
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir             VCLXDevice* pUnoRefDevice = new VCLXDevice;
165*cdf0e10cSrcweir             pUnoRefDevice->SetOutputDevice( m_pEngine->GetRefDevice() );
166*cdf0e10cSrcweir             m_xReferenceDevice = pUnoRefDevice;
167*cdf0e10cSrcweir         }
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir         implDoAggregation();
170*cdf0e10cSrcweir         implRegisterProperties();
171*cdf0e10cSrcweir     }
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir     //------------------------------------------------------------------
174*cdf0e10cSrcweir     void ORichTextModel::implDoAggregation()
175*cdf0e10cSrcweir     {
176*cdf0e10cSrcweir         increment( m_refCount );
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 		{
179*cdf0e10cSrcweir             m_xAggregate = new ORichTextUnoWrapper( *m_pEngine, this );
180*cdf0e10cSrcweir 			setAggregation( m_xAggregate );
181*cdf0e10cSrcweir     		doSetDelegator();
182*cdf0e10cSrcweir 		}
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 		decrement( m_refCount );
185*cdf0e10cSrcweir     }
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir     //------------------------------------------------------------------
188*cdf0e10cSrcweir     void ORichTextModel::implRegisterProperties()
189*cdf0e10cSrcweir     {
190*cdf0e10cSrcweir         REGISTER_PROP_2( DEFAULTCONTROL,        m_sDefaultControl,          BOUND, MAYBEDEFAULT );
191*cdf0e10cSrcweir         REGISTER_PROP_2( HELPTEXT,              m_sHelpText,                BOUND, MAYBEDEFAULT );
192*cdf0e10cSrcweir         REGISTER_PROP_2( HELPURL,               m_sHelpURL,                 BOUND, MAYBEDEFAULT );
193*cdf0e10cSrcweir         REGISTER_PROP_2( ENABLED,               m_bEnabled,                 BOUND, MAYBEDEFAULT );
194*cdf0e10cSrcweir         REGISTER_PROP_2( ENABLEVISIBLE,               m_bEnableVisible,                 BOUND, MAYBEDEFAULT );
195*cdf0e10cSrcweir         REGISTER_PROP_2( BORDER,                m_nBorder,                  BOUND, MAYBEDEFAULT );
196*cdf0e10cSrcweir         REGISTER_PROP_2( HARDLINEBREAKS,        m_bHardLineBreaks,          BOUND, MAYBEDEFAULT );
197*cdf0e10cSrcweir         REGISTER_PROP_2( HSCROLL,               m_bHScroll,                 BOUND, MAYBEDEFAULT );
198*cdf0e10cSrcweir         REGISTER_PROP_2( VSCROLL,               m_bVScroll,                 BOUND, MAYBEDEFAULT );
199*cdf0e10cSrcweir         REGISTER_PROP_2( READONLY,              m_bReadonly,                BOUND, MAYBEDEFAULT );
200*cdf0e10cSrcweir         REGISTER_PROP_2( PRINTABLE,             m_bPrintable,               BOUND, MAYBEDEFAULT );
201*cdf0e10cSrcweir         REGISTER_PROP_2( REFERENCE_DEVICE,      m_xReferenceDevice,         BOUND, TRANSIENT    );
202*cdf0e10cSrcweir         REGISTER_PROP_2( RICH_TEXT,             m_bReallyActAsRichText,     BOUND, MAYBEDEFAULT );
203*cdf0e10cSrcweir         REGISTER_PROP_2( HIDEINACTIVESELECTION, m_bHideInactiveSelection,   BOUND, MAYBEDEFAULT );
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir         REGISTER_VOID_PROP_2( TABSTOP,          m_aTabStop,             sal_Bool,           BOUND, MAYBEDEFAULT );
206*cdf0e10cSrcweir         REGISTER_VOID_PROP_2( BACKGROUNDCOLOR,  m_aBackgroundColor,     sal_Int32,          BOUND, MAYBEDEFAULT );
207*cdf0e10cSrcweir         REGISTER_VOID_PROP_2( BORDERCOLOR,      m_aBorderColor,         sal_Int32,          BOUND, MAYBEDEFAULT );
208*cdf0e10cSrcweir         REGISTER_VOID_PROP_2( VERTICAL_ALIGN,   m_aVerticalAlignment,   VerticalAlignment,  BOUND, MAYBEDEFAULT );
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir         // properties which exist only for compatibility with the css.swt.UnoControlEditModel,
211*cdf0e10cSrcweir         // since we replace the default implementation for this service
212*cdf0e10cSrcweir         REGISTER_PROP_2( ECHO_CHAR,             m_nEchoChar,            BOUND, MAYBEDEFAULT );
213*cdf0e10cSrcweir         REGISTER_PROP_2( MAXTEXTLEN,            m_nMaxTextLength,       BOUND, MAYBEDEFAULT );
214*cdf0e10cSrcweir         REGISTER_PROP_2( MULTILINE,             m_bMultiLine,           BOUND, MAYBEDEFAULT );
215*cdf0e10cSrcweir         REGISTER_PROP_2( TEXT,                  m_sLastKnownEngineText, BOUND, MAYBEDEFAULT );
216*cdf0e10cSrcweir         REGISTER_PROP_2( LINEEND_FORMAT,        m_nLineEndFormat,       BOUND, MAYBEDEFAULT );
217*cdf0e10cSrcweir         REGISTER_PROP_2( WRITING_MODE,          m_nTextWritingMode,     BOUND, MAYBEDEFAULT );
218*cdf0e10cSrcweir         REGISTER_PROP_3( CONTEXT_WRITING_MODE,  m_nContextWritingMode,  BOUND, MAYBEDEFAULT, TRANSIENT );
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir         REGISTER_VOID_PROP_2( ALIGN,        m_aAlign,           sal_Int16, BOUND, MAYBEDEFAULT );
221*cdf0e10cSrcweir     }
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir     //--------------------------------------------------------------------
224*cdf0e10cSrcweir     ORichTextModel::~ORichTextModel( )
225*cdf0e10cSrcweir     {
226*cdf0e10cSrcweir         if ( !OComponentHelper::rBHelper.bDisposed )
227*cdf0e10cSrcweir         {
228*cdf0e10cSrcweir             acquire();
229*cdf0e10cSrcweir             dispose();
230*cdf0e10cSrcweir         }
231*cdf0e10cSrcweir         if ( m_pEngine.get() )
232*cdf0e10cSrcweir         {
233*cdf0e10cSrcweir             SfxItemPool* pPool = m_pEngine->getPool();
234*cdf0e10cSrcweir             m_pEngine.reset();
235*cdf0e10cSrcweir             SfxItemPool::Free(pPool);
236*cdf0e10cSrcweir         }
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir         DBG_DTOR( ORichTextModel, NULL );
240*cdf0e10cSrcweir     }
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir     //------------------------------------------------------------------
243*cdf0e10cSrcweir     Any SAL_CALL ORichTextModel::queryAggregation( const Type& _rType ) throw ( RuntimeException )
244*cdf0e10cSrcweir     {
245*cdf0e10cSrcweir 	    Any aReturn = ORichTextModel_BASE::queryInterface( _rType );
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir 	    if ( !aReturn.hasValue() )
248*cdf0e10cSrcweir 		    aReturn = OControlModel::queryAggregation( _rType );
249*cdf0e10cSrcweir 
250*cdf0e10cSrcweir         return aReturn;
251*cdf0e10cSrcweir     }
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir     //------------------------------------------------------------------
254*cdf0e10cSrcweir     IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORichTextModel, OControlModel, ORichTextModel_BASE )
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir     //--------------------------------------------------------------------
257*cdf0e10cSrcweir     IMPLEMENT_SERVICE_REGISTRATION_8( ORichTextModel, OControlModel,
258*cdf0e10cSrcweir         FRM_SUN_COMPONENT_RICHTEXTCONTROL,
259*cdf0e10cSrcweir         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.text.TextRange" ) ),
260*cdf0e10cSrcweir         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.CharacterProperties" ) ),
261*cdf0e10cSrcweir         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.ParagraphProperties" ) ),
262*cdf0e10cSrcweir         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.CharacterPropertiesAsian" ) ),
263*cdf0e10cSrcweir         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.CharacterPropertiesComplex" ) ),
264*cdf0e10cSrcweir         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.ParagraphPropertiesAsian" ) ),
265*cdf0e10cSrcweir         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.ParagraphPropertiesComplex" ) )
266*cdf0e10cSrcweir     )
267*cdf0e10cSrcweir 
268*cdf0e10cSrcweir     //------------------------------------------------------------------------------
269*cdf0e10cSrcweir     IMPLEMENT_DEFAULT_CLONING( ORichTextModel )
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir     //------------------------------------------------------------------------------
272*cdf0e10cSrcweir     void SAL_CALL ORichTextModel::disposing()
273*cdf0e10cSrcweir     {
274*cdf0e10cSrcweir         m_aModifyListeners.disposeAndClear( EventObject( *this ) );
275*cdf0e10cSrcweir         OControlModel::disposing();
276*cdf0e10cSrcweir     }
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir     //------------------------------------------------------------------------------
279*cdf0e10cSrcweir     namespace
280*cdf0e10cSrcweir     {
281*cdf0e10cSrcweir         void lcl_removeProperty( Sequence< Property >& _rSeq, const ::rtl::OUString& _rPropertyName )
282*cdf0e10cSrcweir         {
283*cdf0e10cSrcweir             Property* pLoop = _rSeq.getArray();
284*cdf0e10cSrcweir             Property* pEnd = _rSeq.getArray() + _rSeq.getLength();
285*cdf0e10cSrcweir             while ( pLoop != pEnd )
286*cdf0e10cSrcweir             {
287*cdf0e10cSrcweir                 if ( pLoop->Name == _rPropertyName )
288*cdf0e10cSrcweir                 {
289*cdf0e10cSrcweir                     ::std::copy( pLoop + 1, pEnd, pLoop );
290*cdf0e10cSrcweir                     _rSeq.realloc( _rSeq.getLength() - 1 );
291*cdf0e10cSrcweir                     break;
292*cdf0e10cSrcweir                 }
293*cdf0e10cSrcweir                 ++pLoop;
294*cdf0e10cSrcweir             }
295*cdf0e10cSrcweir         }
296*cdf0e10cSrcweir     }
297*cdf0e10cSrcweir     //------------------------------------------------------------------------------
298*cdf0e10cSrcweir     void ORichTextModel::describeFixedProperties( Sequence< Property >& _rProps ) const
299*cdf0e10cSrcweir     {
300*cdf0e10cSrcweir         BEGIN_DESCRIBE_PROPERTIES( 1, OControlModel )
301*cdf0e10cSrcweir             DECL_PROP2( TABINDEX,       sal_Int16,  BOUND,    MAYBEDEFAULT );
302*cdf0e10cSrcweir         END_DESCRIBE_PROPERTIES();
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir         // properties which the OPropertyContainerHelper is responsible for
305*cdf0e10cSrcweir         Sequence< Property > aContainedProperties;
306*cdf0e10cSrcweir         describeProperties( aContainedProperties );
307*cdf0e10cSrcweir 
308*cdf0e10cSrcweir         // properties which the FontControlModel is responsible for
309*cdf0e10cSrcweir         Sequence< Property > aFontProperties;
310*cdf0e10cSrcweir         describeFontRelatedProperties( aFontProperties );
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir         _rProps = concatSequences( aContainedProperties, aFontProperties, _rProps );
313*cdf0e10cSrcweir     }
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir     //------------------------------------------------------------------------------
316*cdf0e10cSrcweir     void ORichTextModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
317*cdf0e10cSrcweir     {
318*cdf0e10cSrcweir         OControlModel::describeAggregateProperties( _rAggregateProps );
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir         // our aggregate (the SvxUnoText) declares a FontDescriptor property, as does
321*cdf0e10cSrcweir         // our FormControlFont base class. We remove it from the base class' sequence
322*cdf0e10cSrcweir         // here, and later on care for both instances being in sync
323*cdf0e10cSrcweir         lcl_removeProperty( _rAggregateProps, PROPERTY_FONT );
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir         // similar, the WritingMode property is declared in our aggregate, too, but we override
326*cdf0e10cSrcweir         // it, since the aggregate does no proper PropertyState handling.
327*cdf0e10cSrcweir         lcl_removeProperty( _rAggregateProps, PROPERTY_WRITING_MODE );
328*cdf0e10cSrcweir     }
329*cdf0e10cSrcweir 
330*cdf0e10cSrcweir     //--------------------------------------------------------------------
331*cdf0e10cSrcweir     void SAL_CALL ORichTextModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const
332*cdf0e10cSrcweir     {
333*cdf0e10cSrcweir         if ( isRegisteredProperty( _nHandle ) )
334*cdf0e10cSrcweir         {
335*cdf0e10cSrcweir             OPropertyContainerHelper::getFastPropertyValue( _rValue, _nHandle );
336*cdf0e10cSrcweir         }
337*cdf0e10cSrcweir         else if ( isFontRelatedProperty( _nHandle ) )
338*cdf0e10cSrcweir         {
339*cdf0e10cSrcweir             FontControlModel::getFastPropertyValue( _rValue, _nHandle );
340*cdf0e10cSrcweir         }
341*cdf0e10cSrcweir         else
342*cdf0e10cSrcweir         {
343*cdf0e10cSrcweir     	    OControlModel::getFastPropertyValue( _rValue, _nHandle );
344*cdf0e10cSrcweir         }
345*cdf0e10cSrcweir     }
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir     //--------------------------------------------------------------------
348*cdf0e10cSrcweir     sal_Bool SAL_CALL ORichTextModel::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue ) throw( IllegalArgumentException )
349*cdf0e10cSrcweir     {
350*cdf0e10cSrcweir         sal_Bool bModified = sal_False;
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir         if ( isRegisteredProperty( _nHandle ) )
353*cdf0e10cSrcweir         {
354*cdf0e10cSrcweir             bModified = OPropertyContainerHelper::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
355*cdf0e10cSrcweir         }
356*cdf0e10cSrcweir         else if ( isFontRelatedProperty( _nHandle ) )
357*cdf0e10cSrcweir         {
358*cdf0e10cSrcweir             bModified = FontControlModel::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
359*cdf0e10cSrcweir         }
360*cdf0e10cSrcweir         else
361*cdf0e10cSrcweir         {
362*cdf0e10cSrcweir 		    bModified = OControlModel::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
363*cdf0e10cSrcweir         }
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir         return bModified;
366*cdf0e10cSrcweir     }
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir     //--------------------------------------------------------------------
369*cdf0e10cSrcweir     void SAL_CALL ORichTextModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw ( Exception)
370*cdf0e10cSrcweir     {
371*cdf0e10cSrcweir         if ( isRegisteredProperty( _nHandle ) )
372*cdf0e10cSrcweir         {
373*cdf0e10cSrcweir             OPropertyContainerHelper::setFastPropertyValue( _nHandle, _rValue );
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir             switch ( _nHandle )
376*cdf0e10cSrcweir             {
377*cdf0e10cSrcweir             case PROPERTY_ID_REFERENCE_DEVICE:
378*cdf0e10cSrcweir             {
379*cdf0e10cSrcweir             #if OSL_DEBUG_LEVEL > 0
380*cdf0e10cSrcweir                 MapMode aOldMapMode = m_pEngine->GetRefDevice()->GetMapMode();
381*cdf0e10cSrcweir             #endif
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir                 OutputDevice* pRefDevice = VCLUnoHelper::GetOutputDevice( m_xReferenceDevice );
384*cdf0e10cSrcweir                 OSL_ENSURE( pRefDevice, "ORichTextModel::setFastPropertyValue_NoBroadcast: empty reference device?" );
385*cdf0e10cSrcweir                 m_pEngine->SetRefDevice( pRefDevice );
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir             #if OSL_DEBUG_LEVEL > 0
388*cdf0e10cSrcweir                 MapMode aNewMapMode = m_pEngine->GetRefDevice()->GetMapMode();
389*cdf0e10cSrcweir                 OSL_ENSURE( aNewMapMode.GetMapUnit() == aOldMapMode.GetMapUnit(),
390*cdf0e10cSrcweir                     "ORichTextModel::setFastPropertyValue_NoBroadcast: You should not tamper with the MapUnit of the ref device!" );
391*cdf0e10cSrcweir                 // if this assertion here is triggered, then we would need to adjust all
392*cdf0e10cSrcweir                 // items in all text portions in all paragraphs in the attributes of the EditEngine,
393*cdf0e10cSrcweir                 // as long as they are MapUnit-dependent. This holds at least for the FontSize.
394*cdf0e10cSrcweir             #endif
395*cdf0e10cSrcweir             }
396*cdf0e10cSrcweir             break;
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir             case PROPERTY_ID_TEXT:
399*cdf0e10cSrcweir             {
400*cdf0e10cSrcweir                 MutexRelease aReleaseMutex( m_aMutex );
401*cdf0e10cSrcweir                 impl_smlock_setEngineText( m_sLastKnownEngineText );
402*cdf0e10cSrcweir             }
403*cdf0e10cSrcweir             break;
404*cdf0e10cSrcweir             }   // switch ( _nHandle )
405*cdf0e10cSrcweir         }
406*cdf0e10cSrcweir         else if ( isFontRelatedProperty( _nHandle ) )
407*cdf0e10cSrcweir         {
408*cdf0e10cSrcweir             FontDescriptor aOldFont( getFont() );
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir             FontControlModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir             if ( isFontAggregateProperty( _nHandle ) )
413*cdf0e10cSrcweir 	            firePropertyChange( PROPERTY_ID_FONT, makeAny( getFont() ), makeAny( aOldFont ) );
414*cdf0e10cSrcweir         }
415*cdf0e10cSrcweir         else
416*cdf0e10cSrcweir         {
417*cdf0e10cSrcweir             switch ( _nHandle )
418*cdf0e10cSrcweir             {
419*cdf0e10cSrcweir             case PROPERTY_ID_WRITING_MODE:
420*cdf0e10cSrcweir             {
421*cdf0e10cSrcweir                 // forward to our aggregate, so the EditEngine knows about it
422*cdf0e10cSrcweir                 if ( m_xAggregateSet.is() )
423*cdf0e10cSrcweir                     m_xAggregateSet->setPropertyValue(
424*cdf0e10cSrcweir                         ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WritingMode" ) ), _rValue );
425*cdf0e10cSrcweir             }
426*cdf0e10cSrcweir             break;
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir             default:
429*cdf0e10cSrcweir     		    OControlModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
430*cdf0e10cSrcweir                 break;
431*cdf0e10cSrcweir             }
432*cdf0e10cSrcweir         }
433*cdf0e10cSrcweir     }
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir     //--------------------------------------------------------------------
436*cdf0e10cSrcweir     Any ORichTextModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const
437*cdf0e10cSrcweir     {
438*cdf0e10cSrcweir         Any aDefault;
439*cdf0e10cSrcweir 
440*cdf0e10cSrcweir 	    switch ( _nHandle )
441*cdf0e10cSrcweir 	    {
442*cdf0e10cSrcweir         case PROPERTY_ID_WRITING_MODE:
443*cdf0e10cSrcweir         case PROPERTY_ID_CONTEXT_WRITING_MODE:
444*cdf0e10cSrcweir             aDefault <<= WritingMode2::CONTEXT;
445*cdf0e10cSrcweir             break;
446*cdf0e10cSrcweir 
447*cdf0e10cSrcweir         case PROPERTY_ID_LINEEND_FORMAT:
448*cdf0e10cSrcweir             aDefault <<= (sal_Int16)LineEndFormat::LINE_FEED;
449*cdf0e10cSrcweir             break;
450*cdf0e10cSrcweir 
451*cdf0e10cSrcweir         case PROPERTY_ID_ECHO_CHAR:
452*cdf0e10cSrcweir         case PROPERTY_ID_ALIGN:
453*cdf0e10cSrcweir         case PROPERTY_ID_MAXTEXTLEN:
454*cdf0e10cSrcweir             aDefault <<= (sal_Int16)0;
455*cdf0e10cSrcweir             break;
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir         case PROPERTY_ID_TABSTOP:
458*cdf0e10cSrcweir         case PROPERTY_ID_BACKGROUNDCOLOR:
459*cdf0e10cSrcweir         case PROPERTY_ID_BORDERCOLOR:
460*cdf0e10cSrcweir         case PROPERTY_ID_VERTICAL_ALIGN:
461*cdf0e10cSrcweir             /* void */
462*cdf0e10cSrcweir             break;
463*cdf0e10cSrcweir 
464*cdf0e10cSrcweir         case PROPERTY_ID_ENABLED:
465*cdf0e10cSrcweir         case PROPERTY_ID_ENABLEVISIBLE:
466*cdf0e10cSrcweir         case PROPERTY_ID_PRINTABLE:
467*cdf0e10cSrcweir         case PROPERTY_ID_HIDEINACTIVESELECTION:
468*cdf0e10cSrcweir             aDefault <<= (sal_Bool)sal_True;
469*cdf0e10cSrcweir             break;
470*cdf0e10cSrcweir 
471*cdf0e10cSrcweir         case PROPERTY_ID_HARDLINEBREAKS:
472*cdf0e10cSrcweir         case PROPERTY_ID_HSCROLL:
473*cdf0e10cSrcweir         case PROPERTY_ID_VSCROLL:
474*cdf0e10cSrcweir         case PROPERTY_ID_READONLY:
475*cdf0e10cSrcweir         case PROPERTY_ID_MULTILINE:
476*cdf0e10cSrcweir         case PROPERTY_ID_RICH_TEXT:
477*cdf0e10cSrcweir             aDefault <<= (sal_Bool)sal_False;
478*cdf0e10cSrcweir             break;
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir         case PROPERTY_ID_DEFAULTCONTROL:
481*cdf0e10cSrcweir             aDefault <<= (::rtl::OUString)FRM_SUN_CONTROL_RICHTEXTCONTROL;
482*cdf0e10cSrcweir             break;
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir         case PROPERTY_ID_HELPTEXT:
485*cdf0e10cSrcweir         case PROPERTY_ID_HELPURL:
486*cdf0e10cSrcweir         case PROPERTY_ID_TEXT:
487*cdf0e10cSrcweir             aDefault <<= ::rtl::OUString();
488*cdf0e10cSrcweir             break;
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir         case PROPERTY_ID_BORDER:
491*cdf0e10cSrcweir             aDefault <<= (sal_Int16)1;
492*cdf0e10cSrcweir             break;
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir 		default:
495*cdf0e10cSrcweir             if ( isFontRelatedProperty( _nHandle ) )
496*cdf0e10cSrcweir                 aDefault = FontControlModel::getPropertyDefaultByHandle( _nHandle );
497*cdf0e10cSrcweir             else
498*cdf0e10cSrcweir                 aDefault = OControlModel::getPropertyDefaultByHandle( _nHandle );
499*cdf0e10cSrcweir         }
500*cdf0e10cSrcweir 
501*cdf0e10cSrcweir         return aDefault;
502*cdf0e10cSrcweir     }
503*cdf0e10cSrcweir 
504*cdf0e10cSrcweir     //--------------------------------------------------------------------
505*cdf0e10cSrcweir     void ORichTextModel::impl_smlock_setEngineText( const ::rtl::OUString& _rText )
506*cdf0e10cSrcweir     {
507*cdf0e10cSrcweir         if ( m_pEngine.get() )
508*cdf0e10cSrcweir         {
509*cdf0e10cSrcweir             ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
510*cdf0e10cSrcweir             m_bSettingEngineText = true;
511*cdf0e10cSrcweir             m_pEngine->SetText( _rText );
512*cdf0e10cSrcweir             m_bSettingEngineText = false;
513*cdf0e10cSrcweir         }
514*cdf0e10cSrcweir     }
515*cdf0e10cSrcweir 
516*cdf0e10cSrcweir     //--------------------------------------------------------------------
517*cdf0e10cSrcweir     ::rtl::OUString SAL_CALL ORichTextModel::getServiceName() throw ( RuntimeException)
518*cdf0e10cSrcweir     {
519*cdf0e10cSrcweir         return FRM_SUN_COMPONENT_RICHTEXTCONTROL;
520*cdf0e10cSrcweir     }
521*cdf0e10cSrcweir 
522*cdf0e10cSrcweir     //--------------------------------------------------------------------
523*cdf0e10cSrcweir     void SAL_CALL ORichTextModel::write(const Reference< XObjectOutputStream >& _rxOutStream) throw ( IOException, RuntimeException)
524*cdf0e10cSrcweir     {
525*cdf0e10cSrcweir         OControlModel::write( _rxOutStream );
526*cdf0e10cSrcweir         // TODO: place your code here
527*cdf0e10cSrcweir     }
528*cdf0e10cSrcweir 
529*cdf0e10cSrcweir     //--------------------------------------------------------------------
530*cdf0e10cSrcweir     void SAL_CALL ORichTextModel::read(const Reference< XObjectInputStream >& _rxInStream) throw ( IOException, RuntimeException)
531*cdf0e10cSrcweir     {
532*cdf0e10cSrcweir         OControlModel::read( _rxInStream );
533*cdf0e10cSrcweir         // TODO: place your code here
534*cdf0e10cSrcweir     }
535*cdf0e10cSrcweir 
536*cdf0e10cSrcweir     //--------------------------------------------------------------------
537*cdf0e10cSrcweir     RichTextEngine* ORichTextModel::getEditEngine( const Reference< XControlModel >& _rxModel )
538*cdf0e10cSrcweir     {
539*cdf0e10cSrcweir         RichTextEngine* pEngine = NULL;
540*cdf0e10cSrcweir 
541*cdf0e10cSrcweir         Reference< XUnoTunnel > xTunnel( _rxModel, UNO_QUERY );
542*cdf0e10cSrcweir         OSL_ENSURE( xTunnel.is(), "ORichTextModel::getEditEngine: invalid model!" );
543*cdf0e10cSrcweir         if ( xTunnel.is() )
544*cdf0e10cSrcweir         {
545*cdf0e10cSrcweir             try
546*cdf0e10cSrcweir             {
547*cdf0e10cSrcweir                 pEngine = reinterpret_cast< RichTextEngine* >( xTunnel->getSomething( getEditEngineTunnelId() ) );
548*cdf0e10cSrcweir             }
549*cdf0e10cSrcweir             catch( const Exception& )
550*cdf0e10cSrcweir             {
551*cdf0e10cSrcweir             	OSL_ENSURE( sal_False, "ORichTextModel::getEditEngine: caught an exception!" );
552*cdf0e10cSrcweir             }
553*cdf0e10cSrcweir         }
554*cdf0e10cSrcweir         return pEngine;
555*cdf0e10cSrcweir     }
556*cdf0e10cSrcweir 
557*cdf0e10cSrcweir     //--------------------------------------------------------------------
558*cdf0e10cSrcweir     Sequence< sal_Int8 > ORichTextModel::getEditEngineTunnelId()
559*cdf0e10cSrcweir     {
560*cdf0e10cSrcweir         static ::cppu::OImplementationId * pId = 0;
561*cdf0e10cSrcweir 	    if (! pId)
562*cdf0e10cSrcweir 	    {
563*cdf0e10cSrcweir             ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
564*cdf0e10cSrcweir 		    if (! pId)
565*cdf0e10cSrcweir 		    {
566*cdf0e10cSrcweir 			    static ::cppu::OImplementationId aId;
567*cdf0e10cSrcweir 			    pId = &aId;
568*cdf0e10cSrcweir 		    }
569*cdf0e10cSrcweir 	    }
570*cdf0e10cSrcweir 	    return pId->getImplementationId();
571*cdf0e10cSrcweir     }
572*cdf0e10cSrcweir 
573*cdf0e10cSrcweir     //--------------------------------------------------------------------
574*cdf0e10cSrcweir     IMPL_LINK( ORichTextModel, OnEngineContentModified, void*, /*_pNotInterestedIn*/ )
575*cdf0e10cSrcweir     {
576*cdf0e10cSrcweir         if ( !m_bSettingEngineText )
577*cdf0e10cSrcweir         {
578*cdf0e10cSrcweir             m_aModifyListeners.notifyEach( &XModifyListener::modified, EventObject( *this ) );
579*cdf0e10cSrcweir 
580*cdf0e10cSrcweir             potentialTextChange();
581*cdf0e10cSrcweir                 // is this a good idea? It may become expensive in case of larger texts,
582*cdf0e10cSrcweir                 // and this method here is called for every single changed character ...
583*cdf0e10cSrcweir                 // On the other hand, the API *requires* us to notify changes in the "Text"
584*cdf0e10cSrcweir                 // property immediately ...
585*cdf0e10cSrcweir         }
586*cdf0e10cSrcweir 
587*cdf0e10cSrcweir         return 0L;
588*cdf0e10cSrcweir     }
589*cdf0e10cSrcweir 
590*cdf0e10cSrcweir     //--------------------------------------------------------------------
591*cdf0e10cSrcweir     sal_Int64 SAL_CALL ORichTextModel::getSomething( const Sequence< sal_Int8 >& _rId ) throw (RuntimeException)
592*cdf0e10cSrcweir     {
593*cdf0e10cSrcweir         Sequence< sal_Int8 > aEditEngineAccessId( getEditEngineTunnelId() );
594*cdf0e10cSrcweir 	    if  (   ( _rId.getLength() == aEditEngineAccessId.getLength() )
595*cdf0e10cSrcweir             &&  ( 0 == rtl_compareMemory( aEditEngineAccessId.getConstArray(),  _rId.getConstArray(), _rId.getLength() ) )
596*cdf0e10cSrcweir             )
597*cdf0e10cSrcweir 		    return reinterpret_cast< sal_Int64 >( m_pEngine.get() );
598*cdf0e10cSrcweir 
599*cdf0e10cSrcweir         Reference< XUnoTunnel > xAggTunnel;
600*cdf0e10cSrcweir         if ( query_aggregation( m_xAggregate, xAggTunnel ) )
601*cdf0e10cSrcweir             return xAggTunnel->getSomething( _rId );
602*cdf0e10cSrcweir 
603*cdf0e10cSrcweir         return 0;
604*cdf0e10cSrcweir     }
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir     //--------------------------------------------------------------------
607*cdf0e10cSrcweir     void SAL_CALL ORichTextModel::addModifyListener( const Reference< XModifyListener >& _rxListener ) throw (RuntimeException)
608*cdf0e10cSrcweir     {
609*cdf0e10cSrcweir         m_aModifyListeners.addInterface( _rxListener );
610*cdf0e10cSrcweir     }
611*cdf0e10cSrcweir 
612*cdf0e10cSrcweir     //--------------------------------------------------------------------
613*cdf0e10cSrcweir     void SAL_CALL ORichTextModel::removeModifyListener( const Reference< XModifyListener >& _rxListener ) throw (RuntimeException)
614*cdf0e10cSrcweir     {
615*cdf0e10cSrcweir         m_aModifyListeners.removeInterface( _rxListener );
616*cdf0e10cSrcweir     }
617*cdf0e10cSrcweir 
618*cdf0e10cSrcweir     //--------------------------------------------------------------------
619*cdf0e10cSrcweir     void ORichTextModel::potentialTextChange( )
620*cdf0e10cSrcweir     {
621*cdf0e10cSrcweir         ::rtl::OUString sCurrentEngineText;
622*cdf0e10cSrcweir         if ( m_pEngine.get() )
623*cdf0e10cSrcweir             sCurrentEngineText = m_pEngine->GetText();
624*cdf0e10cSrcweir 
625*cdf0e10cSrcweir         if ( sCurrentEngineText != m_sLastKnownEngineText )
626*cdf0e10cSrcweir         {
627*cdf0e10cSrcweir 		    sal_Int32 nHandle = PROPERTY_ID_TEXT;
628*cdf0e10cSrcweir             Any aOldValue; aOldValue <<= m_sLastKnownEngineText;
629*cdf0e10cSrcweir             Any aNewValue; aNewValue <<= sCurrentEngineText;
630*cdf0e10cSrcweir 		    fire( &nHandle, &aNewValue, &aOldValue, 1, sal_False );
631*cdf0e10cSrcweir 
632*cdf0e10cSrcweir             m_sLastKnownEngineText = sCurrentEngineText;
633*cdf0e10cSrcweir         }
634*cdf0e10cSrcweir     }
635*cdf0e10cSrcweir 
636*cdf0e10cSrcweir //........................................................................
637*cdf0e10cSrcweir } // namespace frm
638*cdf0e10cSrcweir //........................................................................
639