Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / forms / source / richtext / richtextmodel.cxx
blob6ec032d2e3814694262516879dcc193e467200f5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "richtextmodel.hxx"
21 #include "richtextengine.hxx"
22 #include "richtextunowrapper.hxx"
24 #include <com/sun/star/awt/LineEndFormat.hpp>
25 #include <com/sun/star/text/WritingMode2.hpp>
26 #include <com/sun/star/style/VerticalAlignment.hpp>
28 #include <cppuhelper/typeprovider.hxx>
29 #include <comphelper/guarding.hxx>
30 #include <toolkit/awt/vclxdevice.hxx>
31 #include <toolkit/helper/vclunohelper.hxx>
32 #include <editeng/editstat.hxx>
33 #include <vcl/outdev.hxx>
34 #include <vcl/svapp.hxx>
37 namespace frm
39 using namespace ::com::sun::star::uno;
40 using namespace ::com::sun::star::awt;
41 using namespace ::com::sun::star::lang;
42 using namespace ::com::sun::star::io;
43 using namespace ::com::sun::star::beans;
44 using namespace ::com::sun::star::form;
45 using namespace ::com::sun::star::util;
46 using namespace ::com::sun::star::style;
48 namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
50 ORichTextModel::ORichTextModel( const Reference< XComponentContext >& _rxFactory )
51 :OControlModel ( _rxFactory, OUString() )
52 ,FontControlModel ( true )
53 ,m_pEngine ( RichTextEngine::Create() )
54 ,m_bSettingEngineText( false )
55 ,m_aModifyListeners ( m_aMutex )
57 m_nClassId = FormComponentType::TEXTFIELD;
59 getPropertyDefaultByHandle( PROPERTY_ID_DEFAULTCONTROL ) >>= m_sDefaultControl;
60 getPropertyDefaultByHandle( PROPERTY_ID_BORDER ) >>= m_nBorder;
61 getPropertyDefaultByHandle( PROPERTY_ID_ENABLED ) >>= m_bEnabled;
62 getPropertyDefaultByHandle( PROPERTY_ID_ENABLEVISIBLE ) >>= m_bEnableVisible;
63 getPropertyDefaultByHandle( PROPERTY_ID_HARDLINEBREAKS ) >>= m_bHardLineBreaks;
64 getPropertyDefaultByHandle( PROPERTY_ID_HSCROLL ) >>= m_bHScroll;
65 getPropertyDefaultByHandle( PROPERTY_ID_VSCROLL ) >>= m_bVScroll;
66 getPropertyDefaultByHandle( PROPERTY_ID_READONLY ) >>= m_bReadonly;
67 getPropertyDefaultByHandle( PROPERTY_ID_PRINTABLE ) >>= m_bPrintable;
68 getPropertyDefaultByHandle( PROPERTY_ID_ALIGN ) >>= m_aAlign;
69 getPropertyDefaultByHandle( PROPERTY_ID_ECHO_CHAR ) >>= m_nEchoChar;
70 getPropertyDefaultByHandle( PROPERTY_ID_MAXTEXTLEN ) >>= m_nMaxTextLength;
71 getPropertyDefaultByHandle( PROPERTY_ID_MULTILINE ) >>= m_bMultiLine;
72 getPropertyDefaultByHandle( PROPERTY_ID_RICH_TEXT ) >>= m_bReallyActAsRichText;
73 getPropertyDefaultByHandle( PROPERTY_ID_HIDEINACTIVESELECTION ) >>= m_bHideInactiveSelection;
74 getPropertyDefaultByHandle( PROPERTY_ID_LINEEND_FORMAT ) >>= m_nLineEndFormat;
75 getPropertyDefaultByHandle( PROPERTY_ID_WRITING_MODE ) >>= m_nTextWritingMode;
76 getPropertyDefaultByHandle( PROPERTY_ID_CONTEXT_WRITING_MODE ) >>= m_nContextWritingMode;
78 implInit();
82 ORichTextModel::ORichTextModel( const ORichTextModel* _pOriginal, const Reference< XComponentContext >& _rxFactory )
83 :OControlModel ( _pOriginal, _rxFactory, false )
84 ,FontControlModel ( _pOriginal )
85 ,m_bSettingEngineText( false )
86 ,m_aModifyListeners ( m_aMutex )
89 m_aTabStop = _pOriginal->m_aTabStop;
90 m_aBackgroundColor = _pOriginal->m_aBackgroundColor;
91 m_aBorderColor = _pOriginal->m_aBorderColor;
92 m_aVerticalAlignment = _pOriginal->m_aVerticalAlignment;
93 m_sDefaultControl = _pOriginal->m_sDefaultControl;
94 m_sHelpText = _pOriginal->m_sHelpText;
95 m_sHelpURL = _pOriginal->m_sHelpURL;
96 m_nBorder = _pOriginal->m_nBorder;
97 m_bEnabled = _pOriginal->m_bEnabled;
98 m_bEnableVisible = _pOriginal->m_bEnableVisible;
99 m_bHardLineBreaks = _pOriginal->m_bHardLineBreaks;
100 m_bHScroll = _pOriginal->m_bHScroll;
101 m_bVScroll = _pOriginal->m_bVScroll;
102 m_bReadonly = _pOriginal->m_bReadonly;
103 m_bPrintable = _pOriginal->m_bPrintable;
104 m_bReallyActAsRichText = _pOriginal->m_bReallyActAsRichText;
105 m_bHideInactiveSelection = _pOriginal->m_bHideInactiveSelection;
106 m_nLineEndFormat = _pOriginal->m_nLineEndFormat;
107 m_nTextWritingMode = _pOriginal->m_nTextWritingMode;
108 m_nContextWritingMode = _pOriginal->m_nContextWritingMode;
110 m_aAlign = _pOriginal->m_aAlign;
111 m_nEchoChar = _pOriginal->m_nEchoChar;
112 m_nMaxTextLength = _pOriginal->m_nMaxTextLength;
113 m_bMultiLine = _pOriginal->m_bMultiLine;
115 m_pEngine.reset(_pOriginal->m_pEngine->Clone());
116 m_sLastKnownEngineText = m_pEngine->GetText();
118 implInit();
122 void ORichTextModel::implInit()
124 OSL_ENSURE( m_pEngine.get(), "ORichTextModel::implInit: where's the engine?" );
125 if ( m_pEngine.get() )
127 m_pEngine->SetModifyHdl( LINK( this, ORichTextModel, OnEngineContentModified ) );
129 EEControlBits nEngineControlWord = m_pEngine->GetControlWord();
130 nEngineControlWord = nEngineControlWord & ~EEControlBits::AUTOPAGESIZE;
131 m_pEngine->SetControlWord( nEngineControlWord );
133 VCLXDevice* pUnoRefDevice = new VCLXDevice;
135 SolarMutexGuard g;
136 pUnoRefDevice->SetOutputDevice( m_pEngine->GetRefDevice() );
138 m_xReferenceDevice = pUnoRefDevice;
141 implDoAggregation();
142 implRegisterProperties();
146 void ORichTextModel::implDoAggregation()
148 osl_atomic_increment( &m_refCount );
151 m_xAggregate = new ORichTextUnoWrapper( *m_pEngine, this );
152 setAggregation( m_xAggregate );
153 doSetDelegator();
156 osl_atomic_decrement( &m_refCount );
160 void ORichTextModel::implRegisterProperties()
162 REGISTER_PROP_2( DEFAULTCONTROL, m_sDefaultControl, BOUND, MAYBEDEFAULT );
163 REGISTER_PROP_2( HELPTEXT, m_sHelpText, BOUND, MAYBEDEFAULT );
164 REGISTER_PROP_2( HELPURL, m_sHelpURL, BOUND, MAYBEDEFAULT );
165 REGISTER_PROP_2( ENABLED, m_bEnabled, BOUND, MAYBEDEFAULT );
166 REGISTER_PROP_2( ENABLEVISIBLE, m_bEnableVisible, BOUND, MAYBEDEFAULT );
167 REGISTER_PROP_2( BORDER, m_nBorder, BOUND, MAYBEDEFAULT );
168 REGISTER_PROP_2( HARDLINEBREAKS, m_bHardLineBreaks, BOUND, MAYBEDEFAULT );
169 REGISTER_PROP_2( HSCROLL, m_bHScroll, BOUND, MAYBEDEFAULT );
170 REGISTER_PROP_2( VSCROLL, m_bVScroll, BOUND, MAYBEDEFAULT );
171 REGISTER_PROP_2( READONLY, m_bReadonly, BOUND, MAYBEDEFAULT );
172 REGISTER_PROP_2( PRINTABLE, m_bPrintable, BOUND, MAYBEDEFAULT );
173 REGISTER_PROP_2( REFERENCE_DEVICE, m_xReferenceDevice, BOUND, TRANSIENT );
174 REGISTER_PROP_2( RICH_TEXT, m_bReallyActAsRichText, BOUND, MAYBEDEFAULT );
175 REGISTER_PROP_2( HIDEINACTIVESELECTION, m_bHideInactiveSelection, BOUND, MAYBEDEFAULT );
177 REGISTER_VOID_PROP_2( TABSTOP, m_aTabStop, sal_Bool, BOUND, MAYBEDEFAULT );
178 REGISTER_VOID_PROP_2( BACKGROUNDCOLOR, m_aBackgroundColor, sal_Int32, BOUND, MAYBEDEFAULT );
179 REGISTER_VOID_PROP_2( BORDERCOLOR, m_aBorderColor, sal_Int32, BOUND, MAYBEDEFAULT );
180 REGISTER_VOID_PROP_2( VERTICAL_ALIGN, m_aVerticalAlignment, VerticalAlignment, BOUND, MAYBEDEFAULT );
182 // properties which exist only for compatibility with the css.swt.UnoControlEditModel,
183 // since we replace the default implementation for this service
184 REGISTER_PROP_2( ECHO_CHAR, m_nEchoChar, BOUND, MAYBEDEFAULT );
185 REGISTER_PROP_2( MAXTEXTLEN, m_nMaxTextLength, BOUND, MAYBEDEFAULT );
186 REGISTER_PROP_2( MULTILINE, m_bMultiLine, BOUND, MAYBEDEFAULT );
187 REGISTER_PROP_2( TEXT, m_sLastKnownEngineText, BOUND, MAYBEDEFAULT );
188 REGISTER_PROP_2( LINEEND_FORMAT, m_nLineEndFormat, BOUND, MAYBEDEFAULT );
189 REGISTER_PROP_2( WRITING_MODE, m_nTextWritingMode, BOUND, MAYBEDEFAULT );
190 REGISTER_PROP_3( CONTEXT_WRITING_MODE, m_nContextWritingMode, BOUND, MAYBEDEFAULT, TRANSIENT );
192 REGISTER_VOID_PROP_2( ALIGN, m_aAlign, sal_Int16, BOUND, MAYBEDEFAULT );
196 ORichTextModel::~ORichTextModel( )
198 if ( !OComponentHelper::rBHelper.bDisposed )
200 acquire();
201 dispose();
203 if ( m_pEngine.get() )
205 SolarMutexGuard g;
206 SfxItemPool* pPool = m_pEngine->getPool();
207 m_pEngine.reset();
208 SfxItemPool::Free(pPool);
215 Any SAL_CALL ORichTextModel::queryAggregation( const Type& _rType ) throw ( RuntimeException, std::exception )
217 Any aReturn = ORichTextModel_BASE::queryInterface( _rType );
219 if ( !aReturn.hasValue() )
220 aReturn = OControlModel::queryAggregation( _rType );
222 return aReturn;
226 IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORichTextModel, OControlModel, ORichTextModel_BASE )
228 OUString SAL_CALL ORichTextModel::getImplementationName() throw ( RuntimeException, std::exception )
230 return OUString( "com.sun.star.comp.forms.ORichTextModel" );
233 Sequence< OUString > SAL_CALL ORichTextModel::getSupportedServiceNames() throw (RuntimeException, std::exception)
235 Sequence< OUString > aOwnNames( 8 );
236 aOwnNames[ 0 ] = FRM_SUN_COMPONENT_RICHTEXTCONTROL;
237 aOwnNames[ 1 ] = "com.sun.star.text.TextRange";
238 aOwnNames[ 2 ] = "com.sun.star.style.CharacterProperties";
239 aOwnNames[ 3 ] = "com.sun.star.style.ParagraphProperties";
240 aOwnNames[ 4 ] = "com.sun.star.style.CharacterPropertiesAsian";
241 aOwnNames[ 5 ] = "com.sun.star.style.CharacterPropertiesComplex";
242 aOwnNames[ 6 ] = "com.sun.star.style.ParagraphPropertiesAsian";
243 aOwnNames[ 7 ] = "com.sun.star.style.ParagraphPropertiesComplex";
245 return ::comphelper::combineSequences(
246 getAggregateServiceNames(),
247 ::comphelper::concatSequences(
248 OControlModel::getSupportedServiceNames_Static(),
249 aOwnNames)
253 IMPLEMENT_DEFAULT_CLONING( ORichTextModel )
256 void SAL_CALL ORichTextModel::disposing()
258 m_aModifyListeners.disposeAndClear( EventObject( *this ) );
259 OControlModel::disposing();
263 namespace
265 void lcl_removeProperty( Sequence< Property >& _rSeq, const OUString& _rPropertyName )
267 Property* pLoop = _rSeq.getArray();
268 Property* pEnd = _rSeq.getArray() + _rSeq.getLength();
269 while ( pLoop != pEnd )
271 if ( pLoop->Name == _rPropertyName )
273 ::std::copy( pLoop + 1, pEnd, pLoop );
274 _rSeq.realloc( _rSeq.getLength() - 1 );
275 break;
277 ++pLoop;
282 void ORichTextModel::describeFixedProperties( Sequence< Property >& _rProps ) const
284 BEGIN_DESCRIBE_PROPERTIES( 1, OControlModel )
285 DECL_PROP2( TABINDEX, sal_Int16, BOUND, MAYBEDEFAULT );
286 END_DESCRIBE_PROPERTIES();
288 // properties which the OPropertyContainerHelper is responsible for
289 Sequence< Property > aContainedProperties;
290 describeProperties( aContainedProperties );
292 // properties which the FontControlModel is responsible for
293 Sequence< Property > aFontProperties;
294 describeFontRelatedProperties( aFontProperties );
296 _rProps = concatSequences( aContainedProperties, aFontProperties, _rProps );
300 void ORichTextModel::describeAggregateProperties( Sequence< Property >& _rAggregateProps ) const
302 OControlModel::describeAggregateProperties( _rAggregateProps );
304 // our aggregate (the SvxUnoText) declares a FontDescriptor property, as does
305 // our FormControlFont base class. We remove it from the base class' sequence
306 // here, and later on care for both instances being in sync
307 lcl_removeProperty( _rAggregateProps, PROPERTY_FONT );
309 // similar, the WritingMode property is declared in our aggregate, too, but we override
310 // it, since the aggregate does no proper PropertyState handling.
311 lcl_removeProperty( _rAggregateProps, PROPERTY_WRITING_MODE );
315 void SAL_CALL ORichTextModel::getFastPropertyValue( Any& _rValue, sal_Int32 _nHandle ) const
317 if ( isRegisteredProperty( _nHandle ) )
319 OPropertyContainerHelper::getFastPropertyValue( _rValue, _nHandle );
321 else if ( isFontRelatedProperty( _nHandle ) )
323 FontControlModel::getFastPropertyValue( _rValue, _nHandle );
325 else
327 OControlModel::getFastPropertyValue( _rValue, _nHandle );
332 sal_Bool SAL_CALL ORichTextModel::convertFastPropertyValue( Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue ) throw( IllegalArgumentException )
334 bool bModified = false;
336 if ( isRegisteredProperty( _nHandle ) )
338 bModified = OPropertyContainerHelper::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
340 else if ( isFontRelatedProperty( _nHandle ) )
342 bModified = FontControlModel::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
344 else
346 bModified = OControlModel::convertFastPropertyValue( _rConvertedValue, _rOldValue, _nHandle, _rValue );
349 return bModified;
353 void SAL_CALL ORichTextModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw ( Exception, std::exception)
355 if ( isRegisteredProperty( _nHandle ) )
357 OPropertyContainerHelper::setFastPropertyValue( _nHandle, _rValue );
359 switch ( _nHandle )
361 case PROPERTY_ID_REFERENCE_DEVICE:
363 #if OSL_DEBUG_LEVEL > 0
364 MapMode aOldMapMode = m_pEngine->GetRefDevice()->GetMapMode();
365 #endif
367 OutputDevice* pRefDevice = VCLUnoHelper::GetOutputDevice( m_xReferenceDevice );
368 OSL_ENSURE( pRefDevice, "ORichTextModel::setFastPropertyValue_NoBroadcast: empty reference device?" );
369 m_pEngine->SetRefDevice( pRefDevice );
371 #if OSL_DEBUG_LEVEL > 0
372 MapMode aNewMapMode = m_pEngine->GetRefDevice()->GetMapMode();
373 OSL_ENSURE( aNewMapMode.GetMapUnit() == aOldMapMode.GetMapUnit(),
374 "ORichTextModel::setFastPropertyValue_NoBroadcast: You should not tamper with the MapUnit of the ref device!" );
375 // if this assertion here is triggered, then we would need to adjust all
376 // items in all text portions in all paragraphs in the attributes of the EditEngine,
377 // as long as they are MapUnit-dependent. This holds at least for the FontSize.
378 #endif
380 break;
382 case PROPERTY_ID_TEXT:
384 MutexRelease aReleaseMutex( m_aMutex );
385 impl_smlock_setEngineText( m_sLastKnownEngineText );
387 break;
388 } // switch ( _nHandle )
390 else if ( isFontRelatedProperty( _nHandle ) )
392 FontControlModel::setFastPropertyValue_NoBroadcast_impl(
393 *this, &ORichTextModel::setDependentFastPropertyValue,
394 _nHandle, _rValue);
396 else
398 switch ( _nHandle )
400 case PROPERTY_ID_WRITING_MODE:
402 // forward to our aggregate, so the EditEngine knows about it
403 if ( m_xAggregateSet.is() )
404 m_xAggregateSet->setPropertyValue( "WritingMode", _rValue );
406 break;
408 default:
409 OControlModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
410 break;
416 Any ORichTextModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const
418 Any aDefault;
420 switch ( _nHandle )
422 case PROPERTY_ID_WRITING_MODE:
423 case PROPERTY_ID_CONTEXT_WRITING_MODE:
424 aDefault <<= WritingMode2::CONTEXT;
425 break;
427 case PROPERTY_ID_LINEEND_FORMAT:
428 aDefault <<= (sal_Int16)LineEndFormat::LINE_FEED;
429 break;
431 case PROPERTY_ID_ECHO_CHAR:
432 case PROPERTY_ID_ALIGN:
433 case PROPERTY_ID_MAXTEXTLEN:
434 aDefault <<= (sal_Int16)0;
435 break;
437 case PROPERTY_ID_TABSTOP:
438 case PROPERTY_ID_BACKGROUNDCOLOR:
439 case PROPERTY_ID_BORDERCOLOR:
440 case PROPERTY_ID_VERTICAL_ALIGN:
441 /* void */
442 break;
444 case PROPERTY_ID_ENABLED:
445 case PROPERTY_ID_ENABLEVISIBLE:
446 case PROPERTY_ID_PRINTABLE:
447 case PROPERTY_ID_HIDEINACTIVESELECTION:
448 aDefault <<= true;
449 break;
451 case PROPERTY_ID_HARDLINEBREAKS:
452 case PROPERTY_ID_HSCROLL:
453 case PROPERTY_ID_VSCROLL:
454 case PROPERTY_ID_READONLY:
455 case PROPERTY_ID_MULTILINE:
456 case PROPERTY_ID_RICH_TEXT:
457 aDefault <<= false;
458 break;
460 case PROPERTY_ID_DEFAULTCONTROL:
461 aDefault <<= OUString(FRM_SUN_CONTROL_RICHTEXTCONTROL);
462 break;
464 case PROPERTY_ID_HELPTEXT:
465 case PROPERTY_ID_HELPURL:
466 case PROPERTY_ID_TEXT:
467 aDefault <<= OUString();
468 break;
470 case PROPERTY_ID_BORDER:
471 aDefault <<= (sal_Int16)1;
472 break;
474 default:
475 if ( isFontRelatedProperty( _nHandle ) )
476 aDefault = FontControlModel::getPropertyDefaultByHandle( _nHandle );
477 else
478 aDefault = OControlModel::getPropertyDefaultByHandle( _nHandle );
481 return aDefault;
485 void ORichTextModel::impl_smlock_setEngineText( const OUString& _rText )
487 if ( m_pEngine.get() )
489 SolarMutexGuard aSolarGuard;
490 m_bSettingEngineText = true;
491 m_pEngine->SetText( _rText );
492 m_bSettingEngineText = false;
497 OUString SAL_CALL ORichTextModel::getServiceName() throw ( RuntimeException, std::exception)
499 return OUString(FRM_SUN_COMPONENT_RICHTEXTCONTROL);
503 void SAL_CALL ORichTextModel::write(const Reference< XObjectOutputStream >& _rxOutStream) throw ( IOException, RuntimeException, std::exception)
505 OControlModel::write( _rxOutStream );
506 // TODO: place your code here
510 void SAL_CALL ORichTextModel::read(const Reference< XObjectInputStream >& _rxInStream) throw ( IOException, RuntimeException, std::exception)
512 OControlModel::read( _rxInStream );
513 // TODO: place your code here
517 RichTextEngine* ORichTextModel::getEditEngine( const Reference< XControlModel >& _rxModel )
519 RichTextEngine* pEngine = nullptr;
521 Reference< XUnoTunnel > xTunnel( _rxModel, UNO_QUERY );
522 OSL_ENSURE( xTunnel.is(), "ORichTextModel::getEditEngine: invalid model!" );
523 if ( xTunnel.is() )
527 pEngine = reinterpret_cast< RichTextEngine* >( xTunnel->getSomething( getEditEngineTunnelId() ) );
529 catch( const Exception& )
531 OSL_FAIL( "ORichTextModel::getEditEngine: caught an exception!" );
534 return pEngine;
538 Sequence< sal_Int8 > ORichTextModel::getEditEngineTunnelId()
540 static ::cppu::OImplementationId * pId = nullptr;
541 if (! pId)
543 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
544 if (! pId)
546 static ::cppu::OImplementationId aId;
547 pId = &aId;
550 return pId->getImplementationId();
554 IMPL_LINK_NOARG_TYPED( ORichTextModel, OnEngineContentModified, LinkParamNone*, void )
556 if ( !m_bSettingEngineText )
558 m_aModifyListeners.notifyEach( &XModifyListener::modified, EventObject( *this ) );
560 potentialTextChange();
561 // is this a good idea? It may become expensive in case of larger texts,
562 // and this method here is called for every single changed character ...
563 // On the other hand, the API *requires* us to notify changes in the "Text"
564 // property immediately ...
569 sal_Int64 SAL_CALL ORichTextModel::getSomething( const Sequence< sal_Int8 >& _rId ) throw (RuntimeException, std::exception)
571 Sequence< sal_Int8 > aEditEngineAccessId( getEditEngineTunnelId() );
572 if ( ( _rId.getLength() == aEditEngineAccessId.getLength() )
573 && ( 0 == memcmp( aEditEngineAccessId.getConstArray(), _rId.getConstArray(), _rId.getLength() ) )
575 return reinterpret_cast< sal_Int64 >( m_pEngine.get() );
577 Reference< XUnoTunnel > xAggTunnel;
578 if ( query_aggregation( m_xAggregate, xAggTunnel ) )
579 return xAggTunnel->getSomething( _rId );
581 return 0;
585 void SAL_CALL ORichTextModel::addModifyListener( const Reference< XModifyListener >& _rxListener ) throw (RuntimeException, std::exception)
587 m_aModifyListeners.addInterface( _rxListener );
591 void SAL_CALL ORichTextModel::removeModifyListener( const Reference< XModifyListener >& _rxListener ) throw (RuntimeException, std::exception)
593 m_aModifyListeners.removeInterface( _rxListener );
597 void ORichTextModel::potentialTextChange( )
599 OUString sCurrentEngineText;
600 if ( m_pEngine.get() )
601 sCurrentEngineText = m_pEngine->GetText();
603 if ( sCurrentEngineText != m_sLastKnownEngineText )
605 sal_Int32 nHandle = PROPERTY_ID_TEXT;
606 Any aOldValue; aOldValue <<= m_sLastKnownEngineText;
607 Any aNewValue; aNewValue <<= sCurrentEngineText;
608 fire( &nHandle, &aNewValue, &aOldValue, 1, false );
610 m_sLastKnownEngineText = sCurrentEngineText;
615 } // namespace frm
618 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL
619 com_sun_star_comp_forms_ORichTextModel_get_implementation(css::uno::XComponentContext* context,
620 css::uno::Sequence<css::uno::Any> const &)
622 return cppu::acquire(new frm::ORichTextModel(context));
625 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */