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 #include "richtextimplcontrol.hxx" 31*cdf0e10cSrcweir #include "textattributelistener.hxx" 32*cdf0e10cSrcweir #include "richtextengine.hxx" 33*cdf0e10cSrcweir #include <editeng/editeng.hxx> 34*cdf0e10cSrcweir #include <editeng/editview.hxx> 35*cdf0e10cSrcweir #include <editeng/eeitem.hxx> 36*cdf0e10cSrcweir #include <editeng/editstat.hxx> 37*cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC 38*cdf0e10cSrcweir #include <svx/svxids.hrc> 39*cdf0e10cSrcweir #endif 40*cdf0e10cSrcweir #include <editeng/scripttypeitem.hxx> 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir #include <editeng/editobj.hxx> 43*cdf0e10cSrcweir #include <svl/itempool.hxx> 44*cdf0e10cSrcweir #include <svl/itemset.hxx> 45*cdf0e10cSrcweir #include <tools/mapunit.hxx> 46*cdf0e10cSrcweir #include <vcl/window.hxx> 47*cdf0e10cSrcweir #include <vcl/svapp.hxx> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #include <memory> 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir #define EMPTY_PAPER_SIZE 0x7FFFFFFF 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir //........................................................................ 54*cdf0e10cSrcweir namespace frm 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir //........................................................................ 57*cdf0e10cSrcweir //==================================================================== 58*cdf0e10cSrcweir //= RichTextControlImpl 59*cdf0e10cSrcweir //==================================================================== 60*cdf0e10cSrcweir //-------------------------------------------------------------------- 61*cdf0e10cSrcweir RichTextControlImpl::RichTextControlImpl( Control* _pAntiImpl, RichTextEngine* _pEngine, ITextAttributeListener* _pTextAttrListener, ITextSelectionListener* _pSelectionListener ) 62*cdf0e10cSrcweir :m_pAntiImpl ( _pAntiImpl ) 63*cdf0e10cSrcweir ,m_pViewport ( NULL ) 64*cdf0e10cSrcweir ,m_pHScroll ( NULL ) 65*cdf0e10cSrcweir ,m_pVScroll ( NULL ) 66*cdf0e10cSrcweir ,m_pScrollCorner ( NULL ) 67*cdf0e10cSrcweir ,m_pEngine ( _pEngine ) 68*cdf0e10cSrcweir ,m_pView ( NULL ) 69*cdf0e10cSrcweir ,m_pTextAttrListener ( _pTextAttrListener ) 70*cdf0e10cSrcweir ,m_pSelectionListener ( _pSelectionListener ) 71*cdf0e10cSrcweir ,m_bHasEverBeenShown ( false ) 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir OSL_ENSURE( m_pAntiImpl, "RichTextControlImpl::RichTextControlImpl: invalid window!" ); 74*cdf0e10cSrcweir OSL_ENSURE( m_pEngine, "RichTextControlImpl::RichTextControlImpl: invalid edit engine! This will *definately* crash!" ); 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir m_pViewport = new RichTextViewPort( m_pAntiImpl ); 77*cdf0e10cSrcweir m_pViewport->setAttributeInvalidationHandler( LINK( this, RichTextControlImpl, OnInvalidateAllAttributes ) ); 78*cdf0e10cSrcweir m_pViewport->Show(); 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir // ensure that both the window and the reference device have the same map unit 81*cdf0e10cSrcweir MapMode aRefDeviceMapMode( m_pEngine->GetRefDevice()->GetMapMode() ); 82*cdf0e10cSrcweir m_pAntiImpl->SetMapMode( aRefDeviceMapMode ); 83*cdf0e10cSrcweir m_pViewport->SetMapMode( aRefDeviceMapMode ); 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir m_pView = new EditView( m_pEngine, m_pViewport ); 86*cdf0e10cSrcweir m_pEngine->InsertView( m_pView ); 87*cdf0e10cSrcweir m_pViewport->setView( *m_pView ); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir m_pEngine->registerEngineStatusListener( this ); 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir { 92*cdf0e10cSrcweir sal_uLong nViewControlWord = m_pView->GetControlWord(); 93*cdf0e10cSrcweir nViewControlWord |= EV_CNTRL_AUTOSCROLL; 94*cdf0e10cSrcweir m_pView->SetControlWord( nViewControlWord ); 95*cdf0e10cSrcweir } 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir // ensure that it's initially scrolled to the upper left 98*cdf0e10cSrcweir m_pView->SetVisArea( Rectangle( Point( ), m_pViewport->GetOutputSize() ) ); 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir ensureScrollbars(); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir m_pAntiImpl->SetBackground( Wallpaper( m_pAntiImpl->GetSettings().GetStyleSettings().GetFieldColor() ) ); 103*cdf0e10cSrcweir } 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir //-------------------------------------------------------------------- 106*cdf0e10cSrcweir RichTextControlImpl::~RichTextControlImpl( ) 107*cdf0e10cSrcweir { 108*cdf0e10cSrcweir m_pEngine->RemoveView( m_pView ); 109*cdf0e10cSrcweir m_pEngine->revokeEngineStatusListener( this ); 110*cdf0e10cSrcweir delete m_pView; 111*cdf0e10cSrcweir delete m_pViewport; 112*cdf0e10cSrcweir delete m_pHScroll; 113*cdf0e10cSrcweir delete m_pVScroll; 114*cdf0e10cSrcweir delete m_pScrollCorner; 115*cdf0e10cSrcweir } 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir //-------------------------------------------------------------------- 118*cdf0e10cSrcweir void RichTextControlImpl::implUpdateAttribute( AttributeHandlerPool::const_iterator _pHandler ) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir if ( ( _pHandler->first == SID_ATTR_CHAR_WEIGHT ) 121*cdf0e10cSrcweir || ( _pHandler->first == SID_ATTR_CHAR_POSTURE ) 122*cdf0e10cSrcweir || ( _pHandler->first == SID_ATTR_CHAR_FONT ) 123*cdf0e10cSrcweir || ( _pHandler->first == SID_ATTR_CHAR_FONTHEIGHT ) 124*cdf0e10cSrcweir ) 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir // these are attributes whose value depends on the current script type. 127*cdf0e10cSrcweir // I.e., in real, there are *three* items in the ItemSet: One for each script 128*cdf0e10cSrcweir // type (Latin, Asian, Complex). However, if we have an observer who is interested 129*cdf0e10cSrcweir // in the state of this attribute, we have to kind of *merge* the three attributes 130*cdf0e10cSrcweir // to only one. 131*cdf0e10cSrcweir // This is usefull in case the observer is for instance a toolbox which contains only 132*cdf0e10cSrcweir // an, e.g., "bold" slot, and thus not interested in the particular script type of the 133*cdf0e10cSrcweir // current selection. 134*cdf0e10cSrcweir SvxScriptSetItem aNormalizedSet( (WhichId)_pHandler->first, *m_pView->GetAttribs().GetPool() ); 135*cdf0e10cSrcweir normalizeScriptDependentAttribute( aNormalizedSet ); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir implCheckUpdateCache( _pHandler->first, _pHandler->second->getState( aNormalizedSet.GetItemSet() ) ); 138*cdf0e10cSrcweir } 139*cdf0e10cSrcweir else 140*cdf0e10cSrcweir implCheckUpdateCache( _pHandler->first, _pHandler->second->getState( m_pView->GetAttribs() ) ); 141*cdf0e10cSrcweir } 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir //-------------------------------------------------------------------- 144*cdf0e10cSrcweir void RichTextControlImpl::updateAttribute( AttributeId _nAttribute ) 145*cdf0e10cSrcweir { 146*cdf0e10cSrcweir AttributeHandlerPool::const_iterator pHandler = m_aAttributeHandlers.find( _nAttribute ); 147*cdf0e10cSrcweir if ( pHandler != m_aAttributeHandlers.end() ) 148*cdf0e10cSrcweir implUpdateAttribute( pHandler ); 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir //-------------------------------------------------------------------- 152*cdf0e10cSrcweir void RichTextControlImpl::updateAllAttributes( ) 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir for ( AttributeHandlerPool::const_iterator pHandler = m_aAttributeHandlers.begin(); 155*cdf0e10cSrcweir pHandler != m_aAttributeHandlers.end(); 156*cdf0e10cSrcweir ++pHandler 157*cdf0e10cSrcweir ) 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir implUpdateAttribute( pHandler ); 160*cdf0e10cSrcweir } 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir // notify changes of the selection, if necessary 163*cdf0e10cSrcweir if ( m_pSelectionListener && m_pView ) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir ESelection aCurrentSelection = m_pView->GetSelection(); 166*cdf0e10cSrcweir if ( !aCurrentSelection.IsEqual( m_aLastKnownSelection ) ) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir m_aLastKnownSelection = aCurrentSelection; 169*cdf0e10cSrcweir m_pSelectionListener->onSelectionChanged( m_aLastKnownSelection ); 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir } 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir //-------------------------------------------------------------------- 175*cdf0e10cSrcweir AttributeState RichTextControlImpl::getAttributeState( AttributeId _nAttributeId ) const 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir StateCache::const_iterator aCachedStatePos = m_aLastKnownStates.find( _nAttributeId ); 178*cdf0e10cSrcweir if ( aCachedStatePos == m_aLastKnownStates.end() ) 179*cdf0e10cSrcweir { 180*cdf0e10cSrcweir OSL_ENSURE( sal_False, "RichTextControlImpl::getAttributeState: Don't ask for the state of an attribute which I never encountered!" ); 181*cdf0e10cSrcweir return AttributeState( eIndetermined ); 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir return aCachedStatePos->second; 184*cdf0e10cSrcweir } 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir //-------------------------------------------------------------------- 187*cdf0e10cSrcweir bool RichTextControlImpl::executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rAttribs, AttributeId _nAttribute, const SfxPoolItem* _pArgument, ScriptType _nForScriptType ) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir // let's see whether we have a handler for this attribute 190*cdf0e10cSrcweir AttributeHandlerPool::const_iterator aHandlerPos = m_aAttributeHandlers.find( _nAttribute ); 191*cdf0e10cSrcweir if ( aHandlerPos != m_aAttributeHandlers.end() ) 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir aHandlerPos->second->executeAttribute( _rCurrentAttribs, _rAttribs, _pArgument, _nForScriptType ); 194*cdf0e10cSrcweir return true; 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir return false; 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir //-------------------------------------------------------------------- 200*cdf0e10cSrcweir void RichTextControlImpl::enableAttributeNotification( AttributeId _nAttributeId, ITextAttributeListener* _pListener ) 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir AttributeHandlerPool::const_iterator aHandlerPos = m_aAttributeHandlers.find( _nAttributeId ); 203*cdf0e10cSrcweir if ( aHandlerPos == m_aAttributeHandlers.end() ) 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir ::rtl::Reference< IAttributeHandler > aHandler = AttributeHandlerFactory::getHandlerFor( _nAttributeId, *m_pEngine->GetEmptyItemSet().GetPool() ); 206*cdf0e10cSrcweir OSL_ENSURE( aHandler.is(), "RichTextControlImpl::enableAttributeNotification: no handler available for this attribute!" ); 207*cdf0e10cSrcweir if ( !aHandler.is() ) 208*cdf0e10cSrcweir return; 209*cdf0e10cSrcweir OSL_POSTCOND( _nAttributeId == aHandler->getAttributeId(), "RichTextControlImpl::enableAttributeNotification: suspicious handler!" ); 210*cdf0e10cSrcweir 211*cdf0e10cSrcweir aHandlerPos = m_aAttributeHandlers.insert( AttributeHandlerPool::value_type( _nAttributeId , aHandler ) ).first; 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir // remember the listener 215*cdf0e10cSrcweir if ( _pListener ) 216*cdf0e10cSrcweir m_aAttributeListeners.insert( AttributeListenerPool::value_type( _nAttributeId, _pListener ) ); 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir // update (and broadcast) the state of this attribute 219*cdf0e10cSrcweir updateAttribute( _nAttributeId ); 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir //-------------------------------------------------------------------- 223*cdf0e10cSrcweir void RichTextControlImpl::disableAttributeNotification( AttributeId _nAttributeId ) 224*cdf0e10cSrcweir { 225*cdf0e10cSrcweir // forget the handler for this attribute 226*cdf0e10cSrcweir AttributeHandlerPool::iterator aHandlerPos = m_aAttributeHandlers.find( _nAttributeId ); 227*cdf0e10cSrcweir if ( aHandlerPos != m_aAttributeHandlers.end() ) 228*cdf0e10cSrcweir m_aAttributeHandlers.erase( aHandlerPos ); 229*cdf0e10cSrcweir 230*cdf0e10cSrcweir // as well as the listener 231*cdf0e10cSrcweir AttributeListenerPool::iterator aListenerPos = m_aAttributeListeners.find( _nAttributeId ); 232*cdf0e10cSrcweir if ( aListenerPos != m_aAttributeListeners.end() ) 233*cdf0e10cSrcweir m_aAttributeListeners.erase( aListenerPos ); 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir //-------------------------------------------------------------------- 237*cdf0e10cSrcweir void RichTextControlImpl::normalizeScriptDependentAttribute( SvxScriptSetItem& _rScriptSetItem ) 238*cdf0e10cSrcweir { 239*cdf0e10cSrcweir _rScriptSetItem.GetItemSet().Put( m_pView->GetAttribs(), sal_False ); 240*cdf0e10cSrcweir const SfxPoolItem* pNormalizedItem = _rScriptSetItem.GetItemOfScript( getSelectedScriptType() ); 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir WhichId nNormalizedWhichId = _rScriptSetItem.GetItemSet().GetPool()->GetWhich( _rScriptSetItem.Which() ); 243*cdf0e10cSrcweir if ( pNormalizedItem ) 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir SfxPoolItem* pProperWhich = pNormalizedItem->Clone(); 246*cdf0e10cSrcweir pProperWhich->SetWhich( nNormalizedWhichId ); 247*cdf0e10cSrcweir _rScriptSetItem.GetItemSet().Put( *pProperWhich ); 248*cdf0e10cSrcweir DELETEZ( pProperWhich ); 249*cdf0e10cSrcweir } 250*cdf0e10cSrcweir else 251*cdf0e10cSrcweir _rScriptSetItem.GetItemSet().InvalidateItem( nNormalizedWhichId ); 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir //-------------------------------------------------------------------- 255*cdf0e10cSrcweir void RichTextControlImpl::implCheckUpdateCache( AttributeId _nAttribute, const AttributeState& _rState ) 256*cdf0e10cSrcweir { 257*cdf0e10cSrcweir StateCache::iterator aCachePos = m_aLastKnownStates.find( _nAttribute ); 258*cdf0e10cSrcweir if ( aCachePos == m_aLastKnownStates.end() ) 259*cdf0e10cSrcweir { // nothing known about this attribute, yet 260*cdf0e10cSrcweir m_aLastKnownStates.insert( StateCache::value_type( _nAttribute, _rState ) ); 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir else 263*cdf0e10cSrcweir { 264*cdf0e10cSrcweir if ( aCachePos->second == _rState ) 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir // nothing to do 267*cdf0e10cSrcweir return; 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir aCachePos->second = _rState; 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir // is there a dedicated listener for this particular attribute? 273*cdf0e10cSrcweir AttributeListenerPool::const_iterator aListenerPos = m_aAttributeListeners.find( _nAttribute ); 274*cdf0e10cSrcweir if ( aListenerPos != m_aAttributeListeners.end( ) ) 275*cdf0e10cSrcweir aListenerPos->second->onAttributeStateChanged( _nAttribute, _rState ); 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir // call our global listener, if there is one 278*cdf0e10cSrcweir if ( m_pTextAttrListener ) 279*cdf0e10cSrcweir m_pTextAttrListener->onAttributeStateChanged( _nAttribute, _rState ); 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir //-------------------------------------------------------------------- 283*cdf0e10cSrcweir ScriptType RichTextControlImpl::getSelectedScriptType() const 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir ScriptType nScript = m_pView->GetSelectedScriptType(); 286*cdf0e10cSrcweir if ( !nScript ) 287*cdf0e10cSrcweir nScript = SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguage() ); 288*cdf0e10cSrcweir return nScript; 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir //-------------------------------------------------------------------- 292*cdf0e10cSrcweir void RichTextControlImpl::EditEngineStatusChanged( const EditStatus& _rStatus ) 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir sal_uLong nStatusWord( _rStatus.GetStatusWord() ); 295*cdf0e10cSrcweir if ( ( nStatusWord & EE_STAT_TEXTWIDTHCHANGED ) 296*cdf0e10cSrcweir || ( nStatusWord & EE_STAT_TEXTHEIGHTCHANGED ) 297*cdf0e10cSrcweir ) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir if ( ( nStatusWord & EE_STAT_TEXTHEIGHTCHANGED ) && windowHasAutomaticLineBreak() ) 300*cdf0e10cSrcweir m_pEngine->SetPaperSize( Size( m_pEngine->GetPaperSize().Width(), m_pEngine->GetTextHeight() ) ); 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir updateScrollbars(); 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir bool bHScroll = 0 != ( nStatusWord & EE_STAT_HSCROLL ); 306*cdf0e10cSrcweir bool bVScroll = 0 != ( nStatusWord & EE_STAT_VSCROLL ); 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir // In case of *no* automatic line breaks, we also need to check for the *range* here. 309*cdf0e10cSrcweir // Normally, we would do this only after a EE_STAT_TEXTWIDTHCHANGED. However, due to a bug 310*cdf0e10cSrcweir // in the EditEngine (I believe so) this is not fired when the engine does not have 311*cdf0e10cSrcweir // the AutoPaperSize bits set. 312*cdf0e10cSrcweir // So in order to be properly notified, we would need the AutoPaperSize. But, with 313*cdf0e10cSrcweir // AutoPaperSize, other things do not work anymore: Either, when we set a MaxAutoPaperSize, 314*cdf0e10cSrcweir // then the view does automatic soft line breaks at the paper end - which we definately do 315*cdf0e10cSrcweir // want. Or, if we did not set a MaxAutoPaperSize, then the view does not automatically scroll 316*cdf0e10cSrcweir // anymore in horizontal direction. 317*cdf0e10cSrcweir // So this is some kind of lose-lose situation ... :( 318*cdf0e10cSrcweir if ( !windowHasAutomaticLineBreak() && bHScroll ) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir updateScrollbars(); 321*cdf0e10cSrcweir return; 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir if ( bHScroll && m_pHScroll ) 325*cdf0e10cSrcweir m_pHScroll->SetThumbPos( m_pView->GetVisArea().Left() ); 326*cdf0e10cSrcweir if ( bVScroll && m_pVScroll ) 327*cdf0e10cSrcweir m_pVScroll->SetThumbPos( m_pView->GetVisArea().Top() ); 328*cdf0e10cSrcweir } 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir //-------------------------------------------------------------------- 331*cdf0e10cSrcweir IMPL_LINK( RichTextControlImpl, OnInvalidateAllAttributes, void*, /*_pNotInterestedIn*/ ) 332*cdf0e10cSrcweir { 333*cdf0e10cSrcweir updateAllAttributes(); 334*cdf0e10cSrcweir return 0L; 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir //-------------------------------------------------------------------- 338*cdf0e10cSrcweir IMPL_LINK( RichTextControlImpl, OnHScroll, ScrollBar*, _pScrollbar ) 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir m_pView->Scroll( -_pScrollbar->GetDelta(), 0, RGCHK_PAPERSZ1 ); 341*cdf0e10cSrcweir return 0L; 342*cdf0e10cSrcweir } 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir //-------------------------------------------------------------------- 345*cdf0e10cSrcweir IMPL_LINK( RichTextControlImpl, OnVScroll, ScrollBar*, _pScrollbar ) 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir m_pView->Scroll( 0, -_pScrollbar->GetDelta(), RGCHK_PAPERSZ1 ); 348*cdf0e10cSrcweir return 0L; 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir //-------------------------------------------------------------------- 352*cdf0e10cSrcweir void RichTextControlImpl::ensureScrollbars() 353*cdf0e10cSrcweir { 354*cdf0e10cSrcweir bool bNeedVScroll = 0 != ( m_pAntiImpl->GetStyle() & WB_VSCROLL ); 355*cdf0e10cSrcweir bool bNeedHScroll = 0 != ( m_pAntiImpl->GetStyle() & WB_HSCROLL ); 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir if ( ( bNeedVScroll == hasVScrollBar() ) && ( bNeedHScroll == hasHScrollBar( ) ) ) 358*cdf0e10cSrcweir // nothing to do 359*cdf0e10cSrcweir return; 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir // create or delete the scrollbars, as necessary 362*cdf0e10cSrcweir if ( !bNeedVScroll ) 363*cdf0e10cSrcweir { 364*cdf0e10cSrcweir delete m_pVScroll; 365*cdf0e10cSrcweir m_pVScroll = NULL; 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir else 368*cdf0e10cSrcweir { 369*cdf0e10cSrcweir m_pVScroll = new ScrollBar( m_pAntiImpl, WB_VSCROLL | WB_DRAG | WB_REPEAT ); 370*cdf0e10cSrcweir m_pVScroll->SetScrollHdl ( LINK( this, RichTextControlImpl, OnVScroll ) ); 371*cdf0e10cSrcweir m_pVScroll->Show(); 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir if ( !bNeedHScroll ) 375*cdf0e10cSrcweir { 376*cdf0e10cSrcweir delete m_pHScroll; 377*cdf0e10cSrcweir m_pHScroll = NULL; 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir else 380*cdf0e10cSrcweir { 381*cdf0e10cSrcweir m_pHScroll = new ScrollBar( m_pAntiImpl, WB_HSCROLL | WB_DRAG | WB_REPEAT ); 382*cdf0e10cSrcweir m_pHScroll->SetScrollHdl ( LINK( this, RichTextControlImpl, OnHScroll ) ); 383*cdf0e10cSrcweir m_pHScroll->Show(); 384*cdf0e10cSrcweir } 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir if ( m_pHScroll && m_pVScroll ) 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir delete m_pScrollCorner; 389*cdf0e10cSrcweir m_pScrollCorner = new ScrollBarBox( m_pAntiImpl ); 390*cdf0e10cSrcweir m_pScrollCorner->Show(); 391*cdf0e10cSrcweir } 392*cdf0e10cSrcweir else 393*cdf0e10cSrcweir { 394*cdf0e10cSrcweir delete m_pScrollCorner; 395*cdf0e10cSrcweir m_pScrollCorner = NULL; 396*cdf0e10cSrcweir } 397*cdf0e10cSrcweir 398*cdf0e10cSrcweir layoutWindow(); 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir //-------------------------------------------------------------------- 402*cdf0e10cSrcweir void RichTextControlImpl::ensureLineBreakSetting() 403*cdf0e10cSrcweir { 404*cdf0e10cSrcweir if ( !windowHasAutomaticLineBreak() ) 405*cdf0e10cSrcweir m_pEngine->SetPaperSize( Size( EMPTY_PAPER_SIZE, EMPTY_PAPER_SIZE ) ); 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir layoutWindow(); 408*cdf0e10cSrcweir } 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir //-------------------------------------------------------------------- 411*cdf0e10cSrcweir void RichTextControlImpl::layoutWindow() 412*cdf0e10cSrcweir { 413*cdf0e10cSrcweir if ( !m_bHasEverBeenShown ) 414*cdf0e10cSrcweir // no need to do anything. Especially, no need to set the paper size on the 415*cdf0e10cSrcweir // EditEngine to anything .... 416*cdf0e10cSrcweir return; 417*cdf0e10cSrcweir 418*cdf0e10cSrcweir const StyleSettings& rStyleSettings = m_pAntiImpl->GetSettings().GetStyleSettings(); 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir long nScrollBarWidth = m_pVScroll ? rStyleSettings.GetScrollBarSize() : 0; 421*cdf0e10cSrcweir long nScrollBarHeight = m_pHScroll ? rStyleSettings.GetScrollBarSize() : 0; 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir if ( m_pAntiImpl->IsZoom() ) 424*cdf0e10cSrcweir { 425*cdf0e10cSrcweir nScrollBarWidth = m_pAntiImpl->CalcZoom( nScrollBarWidth ); 426*cdf0e10cSrcweir nScrollBarHeight = m_pAntiImpl->CalcZoom( nScrollBarHeight ); 427*cdf0e10cSrcweir } 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir // the overall size we can use 430*cdf0e10cSrcweir Size aPlaygroundSizePixel( m_pAntiImpl->GetOutputSizePixel() ); 431*cdf0e10cSrcweir 432*cdf0e10cSrcweir // the size of the viewport - note that the viewport does *not* occupy all the place 433*cdf0e10cSrcweir // which is left when subtracting the scrollbar width/height 434*cdf0e10cSrcweir Size aViewportPlaygroundPixel( aPlaygroundSizePixel ); 435*cdf0e10cSrcweir aViewportPlaygroundPixel.Width() = ::std::max( long( 10 ), long( aViewportPlaygroundPixel.Width() - nScrollBarWidth ) ); 436*cdf0e10cSrcweir aViewportPlaygroundPixel.Height() = ::std::max( long( 10 ), long( aViewportPlaygroundPixel.Height() - nScrollBarHeight ) ); 437*cdf0e10cSrcweir Size aViewportPlaygroundLogic( m_pViewport->PixelToLogic( aViewportPlaygroundPixel ) ); 438*cdf0e10cSrcweir 439*cdf0e10cSrcweir const long nOffset = 2; 440*cdf0e10cSrcweir Size aViewportSizePixel( aViewportPlaygroundPixel.Width() - 2 * nOffset, aViewportPlaygroundPixel.Height() - 2 * nOffset ); 441*cdf0e10cSrcweir Size aViewportSizeLogic( m_pViewport->PixelToLogic( aViewportSizePixel ) ); 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir // position the viewport 444*cdf0e10cSrcweir m_pViewport->SetPosSizePixel( Point( nOffset, nOffset ), aViewportSizePixel ); 445*cdf0e10cSrcweir // position the scrollbars 446*cdf0e10cSrcweir if ( m_pVScroll ) 447*cdf0e10cSrcweir m_pVScroll->SetPosSizePixel( Point( aViewportPlaygroundPixel.Width(), 0 ), Size( nScrollBarWidth, aViewportPlaygroundPixel.Height() ) ); 448*cdf0e10cSrcweir if ( m_pHScroll ) 449*cdf0e10cSrcweir m_pHScroll->SetPosSizePixel( Point( 0, aViewportPlaygroundPixel.Height() ), Size( aViewportPlaygroundPixel.Width(), nScrollBarHeight ) ); 450*cdf0e10cSrcweir if ( m_pScrollCorner ) 451*cdf0e10cSrcweir m_pScrollCorner->SetPosSizePixel( Point( aViewportPlaygroundPixel.Width(), aViewportPlaygroundPixel.Height() ), Size( nScrollBarWidth, nScrollBarHeight ) ); 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir // paper size 454*cdf0e10cSrcweir if ( windowHasAutomaticLineBreak() ) 455*cdf0e10cSrcweir m_pEngine->SetPaperSize( Size( aViewportSizeLogic.Width(), m_pEngine->GetTextHeight() ) ); 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir // output area of the view 458*cdf0e10cSrcweir m_pView->SetOutputArea( Rectangle( Point( ), aViewportSizeLogic ) ); 459*cdf0e10cSrcweir m_pView->SetVisArea( Rectangle( Point( ), aViewportSizeLogic ) ); 460*cdf0e10cSrcweir 461*cdf0e10cSrcweir if ( m_pVScroll ) 462*cdf0e10cSrcweir { 463*cdf0e10cSrcweir m_pVScroll->SetVisibleSize( aViewportPlaygroundLogic.Height() ); 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir // the default height of a text line .... 466*cdf0e10cSrcweir long nFontHeight = m_pEngine->GetStandardFont(0).GetSize().Height(); 467*cdf0e10cSrcweir // ... is the scroll size for the vertical scrollbar 468*cdf0e10cSrcweir m_pVScroll->SetLineSize( nFontHeight ); 469*cdf0e10cSrcweir // the viewport width, minus one line, is the page scroll size 470*cdf0e10cSrcweir m_pVScroll->SetPageSize( ::std::max( nFontHeight, aViewportPlaygroundLogic.Height() - nFontHeight ) ); 471*cdf0e10cSrcweir } 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir // the font width 474*cdf0e10cSrcweir if ( m_pHScroll ) 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir m_pHScroll->SetVisibleSize( aViewportPlaygroundLogic.Width() ); 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir long nFontWidth = m_pEngine->GetStandardFont(0).GetSize().Width(); 479*cdf0e10cSrcweir if ( !nFontWidth ) 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir m_pViewport->Push( PUSH_FONT ); 482*cdf0e10cSrcweir m_pViewport->SetFont( m_pEngine->GetStandardFont(0) ); 483*cdf0e10cSrcweir nFontWidth = m_pViewport->GetTextWidth( String( RTL_CONSTASCII_USTRINGPARAM( "x" ) ) ); 484*cdf0e10cSrcweir m_pViewport->Pop(); 485*cdf0e10cSrcweir } 486*cdf0e10cSrcweir // ... is the scroll size for the horizontal scrollbar 487*cdf0e10cSrcweir m_pHScroll->SetLineSize( 5 * nFontWidth ); 488*cdf0e10cSrcweir // the viewport height, minus one character, is the page scroll size 489*cdf0e10cSrcweir m_pHScroll->SetPageSize( ::std::max( nFontWidth, aViewportPlaygroundLogic.Width() - nFontWidth ) ); 490*cdf0e10cSrcweir } 491*cdf0e10cSrcweir 492*cdf0e10cSrcweir // update range and position of the scrollbars 493*cdf0e10cSrcweir updateScrollbars(); 494*cdf0e10cSrcweir } 495*cdf0e10cSrcweir 496*cdf0e10cSrcweir //-------------------------------------------------------------------- 497*cdf0e10cSrcweir void RichTextControlImpl::updateScrollbars() 498*cdf0e10cSrcweir { 499*cdf0e10cSrcweir if ( m_pVScroll ) 500*cdf0e10cSrcweir { 501*cdf0e10cSrcweir long nOverallTextHeight = m_pEngine->GetTextHeight(); 502*cdf0e10cSrcweir m_pVScroll->SetRange( Range( 0, nOverallTextHeight ) ); 503*cdf0e10cSrcweir m_pVScroll->SetThumbPos( m_pView->GetVisArea().Top() ); 504*cdf0e10cSrcweir } 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir if ( m_pHScroll ) 507*cdf0e10cSrcweir { 508*cdf0e10cSrcweir Size aPaperSize( m_pEngine->GetPaperSize() ); 509*cdf0e10cSrcweir long nOverallTextWidth = ( aPaperSize.Width() == EMPTY_PAPER_SIZE ) ? m_pEngine->CalcTextWidth() : aPaperSize.Width(); 510*cdf0e10cSrcweir m_pHScroll->SetRange( Range( 0, nOverallTextWidth ) ); 511*cdf0e10cSrcweir m_pHScroll->SetThumbPos( m_pView->GetVisArea().Left() ); 512*cdf0e10cSrcweir } 513*cdf0e10cSrcweir } 514*cdf0e10cSrcweir 515*cdf0e10cSrcweir //-------------------------------------------------------------------- 516*cdf0e10cSrcweir void RichTextControlImpl::notifyInitShow() 517*cdf0e10cSrcweir { 518*cdf0e10cSrcweir if ( !m_bHasEverBeenShown ) 519*cdf0e10cSrcweir { 520*cdf0e10cSrcweir m_bHasEverBeenShown = true; 521*cdf0e10cSrcweir layoutWindow(); 522*cdf0e10cSrcweir } 523*cdf0e10cSrcweir } 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir //-------------------------------------------------------------------- 526*cdf0e10cSrcweir void RichTextControlImpl::notifyStyleChanged() 527*cdf0e10cSrcweir { 528*cdf0e10cSrcweir ensureScrollbars(); 529*cdf0e10cSrcweir ensureLineBreakSetting(); 530*cdf0e10cSrcweir } 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir //-------------------------------------------------------------------- 533*cdf0e10cSrcweir void RichTextControlImpl::notifyZoomChanged() 534*cdf0e10cSrcweir { 535*cdf0e10cSrcweir const Fraction& rZoom = m_pAntiImpl->GetZoom(); 536*cdf0e10cSrcweir 537*cdf0e10cSrcweir MapMode aMapMode( m_pAntiImpl->GetMapMode() ); 538*cdf0e10cSrcweir aMapMode.SetScaleX( rZoom ); 539*cdf0e10cSrcweir aMapMode.SetScaleY( rZoom ); 540*cdf0e10cSrcweir m_pAntiImpl->SetMapMode( aMapMode ); 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir m_pViewport->SetZoom( rZoom ); 543*cdf0e10cSrcweir m_pViewport->SetMapMode( aMapMode ); 544*cdf0e10cSrcweir 545*cdf0e10cSrcweir layoutWindow(); 546*cdf0e10cSrcweir } 547*cdf0e10cSrcweir 548*cdf0e10cSrcweir //-------------------------------------------------------------------- 549*cdf0e10cSrcweir bool RichTextControlImpl::windowHasAutomaticLineBreak() 550*cdf0e10cSrcweir { 551*cdf0e10cSrcweir return ( m_pAntiImpl->GetStyle() & WB_WORDBREAK ) != 0; 552*cdf0e10cSrcweir } 553*cdf0e10cSrcweir 554*cdf0e10cSrcweir //-------------------------------------------------------------------- 555*cdf0e10cSrcweir void RichTextControlImpl::SetReadOnly( bool _bReadOnly ) 556*cdf0e10cSrcweir { 557*cdf0e10cSrcweir m_pView->SetReadOnly( _bReadOnly ); 558*cdf0e10cSrcweir } 559*cdf0e10cSrcweir 560*cdf0e10cSrcweir //-------------------------------------------------------------------- 561*cdf0e10cSrcweir bool RichTextControlImpl::IsReadOnly() const 562*cdf0e10cSrcweir { 563*cdf0e10cSrcweir return m_pView->IsReadOnly( ); 564*cdf0e10cSrcweir } 565*cdf0e10cSrcweir 566*cdf0e10cSrcweir //-------------------------------------------------------------------- 567*cdf0e10cSrcweir namespace 568*cdf0e10cSrcweir { 569*cdf0e10cSrcweir static void lcl_inflate( Rectangle& _rRect, long _nInflateX, long _nInflateY ) 570*cdf0e10cSrcweir { 571*cdf0e10cSrcweir _rRect.Left() -= _nInflateX; 572*cdf0e10cSrcweir _rRect.Right() += _nInflateX; 573*cdf0e10cSrcweir _rRect.Top() -= _nInflateY; 574*cdf0e10cSrcweir _rRect.Bottom() += _nInflateY; 575*cdf0e10cSrcweir } 576*cdf0e10cSrcweir } 577*cdf0e10cSrcweir //-------------------------------------------------------------------- 578*cdf0e10cSrcweir long RichTextControlImpl::HandleCommand( const CommandEvent& _rEvent ) 579*cdf0e10cSrcweir { 580*cdf0e10cSrcweir if ( ( _rEvent.GetCommand() == COMMAND_WHEEL ) 581*cdf0e10cSrcweir || ( _rEvent.GetCommand() == COMMAND_STARTAUTOSCROLL ) 582*cdf0e10cSrcweir || ( _rEvent.GetCommand() == COMMAND_AUTOSCROLL ) 583*cdf0e10cSrcweir ) 584*cdf0e10cSrcweir { 585*cdf0e10cSrcweir m_pAntiImpl->HandleScrollCommand( _rEvent, m_pHScroll, m_pVScroll ); 586*cdf0e10cSrcweir return 1; 587*cdf0e10cSrcweir } 588*cdf0e10cSrcweir return 0; 589*cdf0e10cSrcweir } 590*cdf0e10cSrcweir 591*cdf0e10cSrcweir //-------------------------------------------------------------------- 592*cdf0e10cSrcweir void RichTextControlImpl::Draw( OutputDevice* _pDev, const Point& _rPos, const Size& _rSize, sal_uLong /*_nFlags*/ ) 593*cdf0e10cSrcweir { 594*cdf0e10cSrcweir // need to normalize the map mode of the device - every paint operation on any device needs 595*cdf0e10cSrcweir // to use the same map mode 596*cdf0e10cSrcweir _pDev->Push( PUSH_MAPMODE | PUSH_LINECOLOR | PUSH_FILLCOLOR ); 597*cdf0e10cSrcweir 598*cdf0e10cSrcweir // enforce our "normalize map mode" on the device 599*cdf0e10cSrcweir MapMode aRefMapMode( m_pEngine->GetRefDevice()->GetMapMode() ); 600*cdf0e10cSrcweir MapMode aOriginalMapMode( _pDev->GetMapMode() ); 601*cdf0e10cSrcweir MapMode aNormalizedMapMode( aRefMapMode.GetMapUnit(), aRefMapMode.GetOrigin(), aOriginalMapMode.GetScaleX(), aOriginalMapMode.GetScaleY() ); 602*cdf0e10cSrcweir _pDev->SetMapMode( aNormalizedMapMode ); 603*cdf0e10cSrcweir 604*cdf0e10cSrcweir // translate coordinates 605*cdf0e10cSrcweir Point aPos( _rPos ); 606*cdf0e10cSrcweir Size aSize( _rSize ); 607*cdf0e10cSrcweir if ( aOriginalMapMode.GetMapUnit() == MAP_PIXEL ) 608*cdf0e10cSrcweir { 609*cdf0e10cSrcweir aPos = _pDev->PixelToLogic( _rPos, aNormalizedMapMode ); 610*cdf0e10cSrcweir aSize = _pDev->PixelToLogic( _rSize, aNormalizedMapMode ); 611*cdf0e10cSrcweir } 612*cdf0e10cSrcweir else 613*cdf0e10cSrcweir { 614*cdf0e10cSrcweir aPos = OutputDevice::LogicToLogic( _rPos, aOriginalMapMode, aNormalizedMapMode ); 615*cdf0e10cSrcweir aSize = OutputDevice::LogicToLogic( _rSize, aOriginalMapMode, aNormalizedMapMode ); 616*cdf0e10cSrcweir } 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir Rectangle aPlayground( aPos, aSize ); 619*cdf0e10cSrcweir Size aOnePixel( _pDev->PixelToLogic( Size( 1, 1 ) ) ); 620*cdf0e10cSrcweir aPlayground.Right() -= aOnePixel.Width(); 621*cdf0e10cSrcweir aPlayground.Bottom() -= aOnePixel.Height(); 622*cdf0e10cSrcweir 623*cdf0e10cSrcweir // background 624*cdf0e10cSrcweir _pDev->SetLineColor(); 625*cdf0e10cSrcweir _pDev->DrawRect( aPlayground ); 626*cdf0e10cSrcweir 627*cdf0e10cSrcweir // do we need to draw a border? 628*cdf0e10cSrcweir bool bBorder = ( m_pAntiImpl->GetStyle() & WB_BORDER ); 629*cdf0e10cSrcweir if ( bBorder ) 630*cdf0e10cSrcweir _pDev->SetLineColor( m_pAntiImpl->GetSettings().GetStyleSettings().GetMonoColor() ); 631*cdf0e10cSrcweir else 632*cdf0e10cSrcweir _pDev->SetLineColor(); 633*cdf0e10cSrcweir _pDev->SetFillColor( m_pAntiImpl->GetBackground().GetColor() ); 634*cdf0e10cSrcweir _pDev->DrawRect( aPlayground ); 635*cdf0e10cSrcweir 636*cdf0e10cSrcweir if ( bBorder ) 637*cdf0e10cSrcweir // don't draw the text over the border 638*cdf0e10cSrcweir lcl_inflate( aPlayground, -aOnePixel.Width(), -aOnePixel.Height() ); 639*cdf0e10cSrcweir 640*cdf0e10cSrcweir // leave a space of one pixel between the "surroundings" of the control 641*cdf0e10cSrcweir // and the content 642*cdf0e10cSrcweir lcl_inflate( aPlayground, -aOnePixel.Width(), -aOnePixel.Height() ); 643*cdf0e10cSrcweir lcl_inflate( aPlayground, -aOnePixel.Width(), -aOnePixel.Height() ); 644*cdf0e10cSrcweir 645*cdf0e10cSrcweir // actually draw the content 646*cdf0e10cSrcweir m_pEngine->Draw( _pDev, aPlayground, Point(), sal_True ); 647*cdf0e10cSrcweir 648*cdf0e10cSrcweir _pDev->Pop(); 649*cdf0e10cSrcweir } 650*cdf0e10cSrcweir 651*cdf0e10cSrcweir //-------------------------------------------------------------------- 652*cdf0e10cSrcweir void RichTextControlImpl::SetBackgroundColor( ) 653*cdf0e10cSrcweir { 654*cdf0e10cSrcweir SetBackgroundColor( Application::GetSettings().GetStyleSettings().GetFieldColor() ); 655*cdf0e10cSrcweir } 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir //-------------------------------------------------------------------- 658*cdf0e10cSrcweir void RichTextControlImpl::SetBackgroundColor( const Color& _rColor ) 659*cdf0e10cSrcweir { 660*cdf0e10cSrcweir Wallpaper aWallpaper( _rColor ); 661*cdf0e10cSrcweir m_pAntiImpl->SetBackground( aWallpaper ); 662*cdf0e10cSrcweir m_pViewport->SetBackground( aWallpaper ); 663*cdf0e10cSrcweir } 664*cdf0e10cSrcweir 665*cdf0e10cSrcweir //-------------------------------------------------------------------- 666*cdf0e10cSrcweir void RichTextControlImpl::SetHideInactiveSelection( bool _bHide ) 667*cdf0e10cSrcweir { 668*cdf0e10cSrcweir m_pViewport->SetHideInactiveSelection( _bHide ); 669*cdf0e10cSrcweir } 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir //-------------------------------------------------------------------- 672*cdf0e10cSrcweir bool RichTextControlImpl::GetHideInactiveSelection() const 673*cdf0e10cSrcweir { 674*cdf0e10cSrcweir return m_pViewport->GetHideInactiveSelection( ); 675*cdf0e10cSrcweir } 676*cdf0e10cSrcweir 677*cdf0e10cSrcweir //........................................................................ 678*cdf0e10cSrcweir } // namespace frm 679*cdf0e10cSrcweir //........................................................................ 680*cdf0e10cSrcweir 681