1190118d0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3190118d0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4190118d0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5190118d0SAndrew Rist * distributed with this work for additional information 6190118d0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7190118d0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8190118d0SAndrew Rist * "License"); you may not use this file except in compliance 9190118d0SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11190118d0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13190118d0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14190118d0SAndrew Rist * software distributed under the License is distributed on an 15190118d0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16190118d0SAndrew Rist * KIND, either express or implied. See the License for the 17190118d0SAndrew Rist * specific language governing permissions and limitations 18190118d0SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20190118d0SAndrew Rist *************************************************************/ 21190118d0SAndrew Rist 22190118d0SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_editeng.hxx" 26cdf0e10cSrcweir #include <tools/debug.hxx> 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <editeng/unoedhlp.hxx> 29cdf0e10cSrcweir #include <editeng/editdata.hxx> 30cdf0e10cSrcweir #include <editeng/editeng.hxx> 31*9b8096d0SSteve Yin //IAccessibility2 Implementation 2009----- 32*9b8096d0SSteve Yin #include <svl/itemset.hxx> 33cdf0e10cSrcweir 34*9b8096d0SSteve Yin //-----IAccessibility2 Implementation 2009 35cdf0e10cSrcweir //------------------------------------------------------------------------ 36cdf0e10cSrcweir 37cdf0e10cSrcweir TYPEINIT1( SvxEditSourceHint, TextHint ); 38cdf0e10cSrcweir 39cdf0e10cSrcweir SvxEditSourceHint::SvxEditSourceHint( sal_uLong _nId ) : 40cdf0e10cSrcweir TextHint( _nId ), 41cdf0e10cSrcweir mnStart( 0 ), 42cdf0e10cSrcweir mnEnd( 0 ) 43cdf0e10cSrcweir { 44cdf0e10cSrcweir } 45cdf0e10cSrcweir 46cdf0e10cSrcweir SvxEditSourceHint::SvxEditSourceHint( sal_uLong _nId, sal_uLong nValue, sal_uLong nStart, sal_uLong nEnd ) : 47cdf0e10cSrcweir TextHint( _nId, nValue ), 48cdf0e10cSrcweir mnStart( nStart), 49cdf0e10cSrcweir mnEnd( nEnd ) 50cdf0e10cSrcweir { 51cdf0e10cSrcweir } 52cdf0e10cSrcweir 53cdf0e10cSrcweir sal_uLong SvxEditSourceHint::GetValue() const 54cdf0e10cSrcweir { 55cdf0e10cSrcweir return TextHint::GetValue(); 56cdf0e10cSrcweir } 57cdf0e10cSrcweir 58cdf0e10cSrcweir sal_uLong SvxEditSourceHint::GetStartValue() const 59cdf0e10cSrcweir { 60cdf0e10cSrcweir return mnStart; 61cdf0e10cSrcweir } 62cdf0e10cSrcweir 63cdf0e10cSrcweir sal_uLong SvxEditSourceHint::GetEndValue() const 64cdf0e10cSrcweir { 65cdf0e10cSrcweir return mnEnd; 66cdf0e10cSrcweir } 67cdf0e10cSrcweir 68cdf0e10cSrcweir void SvxEditSourceHint::SetValue( sal_uLong n ) 69cdf0e10cSrcweir { 70cdf0e10cSrcweir TextHint::SetValue( n ); 71cdf0e10cSrcweir } 72cdf0e10cSrcweir 73cdf0e10cSrcweir void SvxEditSourceHint::SetStartValue( sal_uLong n ) 74cdf0e10cSrcweir { 75cdf0e10cSrcweir mnStart = n; 76cdf0e10cSrcweir } 77cdf0e10cSrcweir 78cdf0e10cSrcweir void SvxEditSourceHint::SetEndValue( sal_uLong n ) 79cdf0e10cSrcweir { 80cdf0e10cSrcweir mnEnd = n; 81cdf0e10cSrcweir } 82*9b8096d0SSteve Yin //IAccessibility2 Implementation 2009----- 83*9b8096d0SSteve Yin TYPEINIT1( SvxEditSourceHintEndPara , SvxEditSourceHint ); 84*9b8096d0SSteve Yin //-----IAccessibility2 Implementation 2009 85cdf0e10cSrcweir //------------------------------------------------------------------------ 86cdf0e10cSrcweir 87cdf0e10cSrcweir ::std::auto_ptr<SfxHint> SvxEditSourceHelper::EENotification2Hint( EENotify* aNotify ) 88cdf0e10cSrcweir { 89cdf0e10cSrcweir if( aNotify ) 90cdf0e10cSrcweir { 91cdf0e10cSrcweir switch( aNotify->eNotificationType ) 92cdf0e10cSrcweir { 93cdf0e10cSrcweir case EE_NOTIFY_TEXTMODIFIED: 94cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_MODIFIED, aNotify->nParagraph ) ); 95cdf0e10cSrcweir 96cdf0e10cSrcweir case EE_NOTIFY_PARAGRAPHINSERTED: 97cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_PARAINSERTED, aNotify->nParagraph ) ); 98cdf0e10cSrcweir 99cdf0e10cSrcweir case EE_NOTIFY_PARAGRAPHREMOVED: 100cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_PARAREMOVED, aNotify->nParagraph ) ); 101cdf0e10cSrcweir 102cdf0e10cSrcweir case EE_NOTIFY_PARAGRAPHSMOVED: 103cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new SvxEditSourceHint( EDITSOURCE_HINT_PARASMOVED, aNotify->nParagraph, aNotify->nParam1, aNotify->nParam2 ) ); 104cdf0e10cSrcweir 105cdf0e10cSrcweir case EE_NOTIFY_TEXTHEIGHTCHANGED: 106cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_TEXTHEIGHTCHANGED, aNotify->nParagraph ) ); 107cdf0e10cSrcweir 108cdf0e10cSrcweir case EE_NOTIFY_TEXTVIEWSCROLLED: 109cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_VIEWSCROLLED ) ); 110cdf0e10cSrcweir 111cdf0e10cSrcweir case EE_NOTIFY_TEXTVIEWSELECTIONCHANGED: 112cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new SvxEditSourceHint( EDITSOURCE_HINT_SELECTIONCHANGED ) ); 113cdf0e10cSrcweir 114cdf0e10cSrcweir case EE_NOTIFY_BLOCKNOTIFICATION_START: 115cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_BLOCKNOTIFICATION_START, 0 ) ); 116cdf0e10cSrcweir 117cdf0e10cSrcweir case EE_NOTIFY_BLOCKNOTIFICATION_END: 118cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_BLOCKNOTIFICATION_END, 0 ) ); 119cdf0e10cSrcweir 120cdf0e10cSrcweir case EE_NOTIFY_INPUT_START: 121cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_INPUT_START, 0 ) ); 122cdf0e10cSrcweir 123cdf0e10cSrcweir case EE_NOTIFY_INPUT_END: 124cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_INPUT_END, 0 ) ); 125*9b8096d0SSteve Yin //IAccessibility2 Implementation 2009----- 126*9b8096d0SSteve Yin case EE_NOTIFY_TEXTVIEWSELECTIONCHANGED_ENDD_PARA: 127*9b8096d0SSteve Yin return ::std::auto_ptr<SfxHint>( new SvxEditSourceHintEndPara( EDITSOURCE_HINT_SELECTIONCHANGED ) ); 128*9b8096d0SSteve Yin //-----IAccessibility2 Implementation 2009 129cdf0e10cSrcweir default: 130cdf0e10cSrcweir DBG_ERROR( "SvxEditSourceHelper::EENotification2Hint unknown notification" ); 131cdf0e10cSrcweir break; 132cdf0e10cSrcweir } 133cdf0e10cSrcweir } 134cdf0e10cSrcweir 135cdf0e10cSrcweir return ::std::auto_ptr<SfxHint>( new SfxHint() ); 136cdf0e10cSrcweir } 137*9b8096d0SSteve Yin sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool bInCell ) 138cdf0e10cSrcweir { 139*9b8096d0SSteve Yin // IA2 CWS introduced bInCell, but also did many other changes here. 140*9b8096d0SSteve Yin // Need to verify implementation with AT (IA2 and ATK) 141*9b8096d0SSteve Yin // Old implementation at the end of the method for reference... 142*9b8096d0SSteve Yin 143*9b8096d0SSteve Yin #if 1 // IA2 CWS 144*9b8096d0SSteve Yin 145*9b8096d0SSteve Yin //added dummy attributes for the default text 146*9b8096d0SSteve Yin EECharAttribArray aCharAttribs, aTempCharAttribs; 147*9b8096d0SSteve Yin rEE.GetCharAttribs( nPara, aTempCharAttribs ); 148*9b8096d0SSteve Yin if ( aTempCharAttribs.Count() ) 149*9b8096d0SSteve Yin { 150*9b8096d0SSteve Yin sal_uInt32 nIndex2 = 0; 151*9b8096d0SSteve Yin sal_uInt32 nParaLen = rEE.GetTextLen(nPara); 152*9b8096d0SSteve Yin for ( sal_uInt16 nAttr = 0; nAttr < aTempCharAttribs.Count(); nAttr++ ) 153*9b8096d0SSteve Yin { 154*9b8096d0SSteve Yin if ( nIndex2 < aTempCharAttribs[nAttr].nStart ) 155*9b8096d0SSteve Yin { 156*9b8096d0SSteve Yin EECharAttrib aEEAttr; 157*9b8096d0SSteve Yin aEEAttr.nStart = sal_uInt16(nIndex2); 158*9b8096d0SSteve Yin aEEAttr.nEnd = aTempCharAttribs[nAttr].nStart; 159*9b8096d0SSteve Yin aCharAttribs.Insert( aEEAttr, nAttr ); 160*9b8096d0SSteve Yin } 161*9b8096d0SSteve Yin nIndex2 = aTempCharAttribs[nAttr].nEnd; 162*9b8096d0SSteve Yin aCharAttribs.Insert( aTempCharAttribs[nAttr], aCharAttribs.Count() ); 163*9b8096d0SSteve Yin } 164*9b8096d0SSteve Yin if ( nIndex2 != nParaLen ) 165*9b8096d0SSteve Yin { 166*9b8096d0SSteve Yin EECharAttrib aEEAttr; 167*9b8096d0SSteve Yin aEEAttr.nStart = sal_uInt16(nIndex2); 168*9b8096d0SSteve Yin aEEAttr.nEnd = sal_uInt16(nParaLen); 169*9b8096d0SSteve Yin aCharAttribs.Insert( aEEAttr, aCharAttribs.Count() ); 170*9b8096d0SSteve Yin } 171*9b8096d0SSteve Yin } 172*9b8096d0SSteve Yin // find closest index in front of nIndex 173*9b8096d0SSteve Yin sal_uInt16 nAttr, nCurrIndex; 174*9b8096d0SSteve Yin sal_Int32 nClosestStartIndex; 175*9b8096d0SSteve Yin sal_Int32 nClosestStartIndex_s, nClosestStartIndex_e; 176*9b8096d0SSteve Yin for( nAttr=0, nClosestStartIndex_s=0, nClosestStartIndex_e=0; nAttr<aCharAttribs.Count(); ++nAttr ) 177*9b8096d0SSteve Yin { 178*9b8096d0SSteve Yin nCurrIndex = aCharAttribs[nAttr].nStart; 179*9b8096d0SSteve Yin 180*9b8096d0SSteve Yin //if( nCurrIndex > nIndex ) 181*9b8096d0SSteve Yin // break; // aCharAttribs array is sorted in increasing order for nStart values 182*9b8096d0SSteve Yin 183*9b8096d0SSteve Yin if( nCurrIndex > nClosestStartIndex_s && 184*9b8096d0SSteve Yin nCurrIndex <= nIndex) 185*9b8096d0SSteve Yin { 186*9b8096d0SSteve Yin nClosestStartIndex_s = nCurrIndex; 187*9b8096d0SSteve Yin } 188*9b8096d0SSteve Yin nCurrIndex = aCharAttribs[nAttr].nEnd; 189*9b8096d0SSteve Yin if ( nCurrIndex > nClosestStartIndex_e && 190*9b8096d0SSteve Yin nCurrIndex < nIndex ) 191*9b8096d0SSteve Yin { 192*9b8096d0SSteve Yin nClosestStartIndex_e = nCurrIndex; 193*9b8096d0SSteve Yin } 194*9b8096d0SSteve Yin } 195*9b8096d0SSteve Yin nClosestStartIndex = nClosestStartIndex_s > nClosestStartIndex_e ? nClosestStartIndex_s : nClosestStartIndex_e; 196*9b8096d0SSteve Yin 197*9b8096d0SSteve Yin // find closest index behind of nIndex 198*9b8096d0SSteve Yin sal_Int32 nClosestEndIndex; 199*9b8096d0SSteve Yin sal_Int32 nClosestEndIndex_s, nClosestEndIndex_e; 200*9b8096d0SSteve Yin for( nAttr=0, nClosestEndIndex_s=nClosestEndIndex_e=rEE.GetTextLen(nPara); nAttr<aCharAttribs.Count(); ++nAttr ) 201*9b8096d0SSteve Yin { 202*9b8096d0SSteve Yin nCurrIndex = aCharAttribs[nAttr].nEnd; 203*9b8096d0SSteve Yin 204*9b8096d0SSteve Yin if( nCurrIndex > nIndex && 205*9b8096d0SSteve Yin nCurrIndex < nClosestEndIndex_e ) 206*9b8096d0SSteve Yin { 207*9b8096d0SSteve Yin nClosestEndIndex_e = nCurrIndex; 208*9b8096d0SSteve Yin } 209*9b8096d0SSteve Yin nCurrIndex = aCharAttribs[nAttr].nStart; 210*9b8096d0SSteve Yin if ( nCurrIndex > nIndex && 211*9b8096d0SSteve Yin nCurrIndex < nClosestEndIndex_s) 212*9b8096d0SSteve Yin { 213*9b8096d0SSteve Yin nClosestEndIndex_s = nCurrIndex; 214*9b8096d0SSteve Yin } 215*9b8096d0SSteve Yin } 216*9b8096d0SSteve Yin nClosestEndIndex = nClosestEndIndex_s < nClosestEndIndex_e ? nClosestEndIndex_s : nClosestEndIndex_e; 217*9b8096d0SSteve Yin 218*9b8096d0SSteve Yin nStartIndex = static_cast<sal_uInt16>( nClosestStartIndex ); 219*9b8096d0SSteve Yin nEndIndex = static_cast<sal_uInt16>( nClosestEndIndex ); 220*9b8096d0SSteve Yin if ( bInCell ) 221*9b8096d0SSteve Yin { 222*9b8096d0SSteve Yin EPosition aStartPos( nPara, nStartIndex ), aEndPos( nPara, nEndIndex ); 223*9b8096d0SSteve Yin sal_uInt32 nParaCount = rEE.GetParagraphCount(); 224*9b8096d0SSteve Yin sal_uInt32 nCrrntParaLen = rEE.GetTextLen(nPara); 225*9b8096d0SSteve Yin //need to find closest index in front of nIndex in the previous paragraphs 226*9b8096d0SSteve Yin if ( aStartPos.nIndex == 0 ) 227*9b8096d0SSteve Yin { 228*9b8096d0SSteve Yin SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, 0, 1, GETATTRIBS_CHARATTRIBS ); 229*9b8096d0SSteve Yin for ( sal_Int32 nParaIdx = nPara-1; nParaIdx >= 0; nParaIdx-- ) 230*9b8096d0SSteve Yin { 231*9b8096d0SSteve Yin sal_uInt32 nLen = rEE.GetTextLen( sal_uInt16(nParaIdx) ); 232*9b8096d0SSteve Yin if ( nLen ) 233*9b8096d0SSteve Yin { 234*9b8096d0SSteve Yin sal_uInt16 nStartIdx, nEndIdx; 235*9b8096d0SSteve Yin GetAttributeRun( nStartIdx, nEndIdx, rEE, sal_uInt16(nParaIdx), sal_uInt16(nLen), sal_False ); 236*9b8096d0SSteve Yin SfxItemSet aSet = rEE.GetAttribs( sal_uInt16(nParaIdx), sal_uInt16(nLen-1), sal_uInt16(nLen), GETATTRIBS_CHARATTRIBS ); 237*9b8096d0SSteve Yin if ( aSet == aCrrntSet ) 238*9b8096d0SSteve Yin { 239*9b8096d0SSteve Yin aStartPos.nPara = sal_uInt16(nParaIdx); 240*9b8096d0SSteve Yin aStartPos.nIndex = nStartIdx; 241*9b8096d0SSteve Yin if ( aStartPos.nIndex != 0 ) 242*9b8096d0SSteve Yin { 243*9b8096d0SSteve Yin break; 244*9b8096d0SSteve Yin } 245*9b8096d0SSteve Yin } 246*9b8096d0SSteve Yin } 247*9b8096d0SSteve Yin } 248*9b8096d0SSteve Yin } 249*9b8096d0SSteve Yin //need find closest index behind nIndex in the following paragrphs 250*9b8096d0SSteve Yin if ( aEndPos.nIndex == nCrrntParaLen ) 251*9b8096d0SSteve Yin { 252*9b8096d0SSteve Yin SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, sal_uInt16(nCrrntParaLen-1), sal_uInt16(nCrrntParaLen), GETATTRIBS_CHARATTRIBS ); 253*9b8096d0SSteve Yin for ( sal_uInt32 nParaIdx = nPara+1; nParaIdx < nParaCount; nParaIdx++ ) 254*9b8096d0SSteve Yin { 255*9b8096d0SSteve Yin sal_uInt32 nLen = rEE.GetTextLen( sal_uInt16(nParaIdx) ); 256*9b8096d0SSteve Yin if ( nLen ) 257*9b8096d0SSteve Yin { 258*9b8096d0SSteve Yin sal_uInt16 nStartIdx, nEndIdx; 259*9b8096d0SSteve Yin GetAttributeRun( nStartIdx, nEndIdx, rEE, sal_uInt16(nParaIdx), 0, sal_False ); 260*9b8096d0SSteve Yin SfxItemSet aSet = rEE.GetAttribs( sal_uInt16(nParaIdx), 0, 1, GETATTRIBS_CHARATTRIBS ); 261*9b8096d0SSteve Yin if ( aSet == aCrrntSet ) 262*9b8096d0SSteve Yin { 263*9b8096d0SSteve Yin aEndPos.nPara = sal_uInt16(nParaIdx); 264*9b8096d0SSteve Yin aEndPos.nIndex = nEndIdx; 265*9b8096d0SSteve Yin if ( aEndPos.nIndex != nLen ) 266*9b8096d0SSteve Yin { 267*9b8096d0SSteve Yin break; 268*9b8096d0SSteve Yin } 269*9b8096d0SSteve Yin } 270*9b8096d0SSteve Yin } 271*9b8096d0SSteve Yin } 272*9b8096d0SSteve Yin } 273*9b8096d0SSteve Yin nStartIndex = 0; 274*9b8096d0SSteve Yin if ( aStartPos.nPara > 0 ) 275*9b8096d0SSteve Yin { 276*9b8096d0SSteve Yin for ( sal_uInt16 i = 0; i < aStartPos.nPara; i++ ) 277*9b8096d0SSteve Yin { 278*9b8096d0SSteve Yin nStartIndex += rEE.GetTextLen(i)+1; 279*9b8096d0SSteve Yin } 280*9b8096d0SSteve Yin } 281*9b8096d0SSteve Yin nStartIndex += aStartPos.nIndex; 282*9b8096d0SSteve Yin nEndIndex = 0; 283*9b8096d0SSteve Yin if ( aEndPos.nPara > 0 ) 284*9b8096d0SSteve Yin { 285*9b8096d0SSteve Yin for ( sal_uInt16 i = 0; i < aEndPos.nPara; i++ ) 286*9b8096d0SSteve Yin { 287*9b8096d0SSteve Yin nEndIndex += rEE.GetTextLen(i)+1; 288*9b8096d0SSteve Yin } 289*9b8096d0SSteve Yin } 290*9b8096d0SSteve Yin nEndIndex += aEndPos.nIndex; 291*9b8096d0SSteve Yin } 292*9b8096d0SSteve Yin 293*9b8096d0SSteve Yin return sal_True; 294*9b8096d0SSteve Yin 295*9b8096d0SSteve Yin #else // old implementation 296*9b8096d0SSteve Yin 297cdf0e10cSrcweir EECharAttribArray aCharAttribs; 298cdf0e10cSrcweir 299cdf0e10cSrcweir rEE.GetCharAttribs( nPara, aCharAttribs ); 300cdf0e10cSrcweir 301cdf0e10cSrcweir // find closest index in front of nIndex 302cdf0e10cSrcweir sal_uInt16 nAttr, nCurrIndex; 303cdf0e10cSrcweir sal_Int32 nClosestStartIndex; 304cdf0e10cSrcweir for( nAttr=0, nClosestStartIndex=0; nAttr<aCharAttribs.Count(); ++nAttr ) 305cdf0e10cSrcweir { 306cdf0e10cSrcweir nCurrIndex = aCharAttribs[nAttr].nStart; 307cdf0e10cSrcweir 308cdf0e10cSrcweir if( nCurrIndex > nIndex ) 309cdf0e10cSrcweir break; // aCharAttribs array is sorted in increasing order for nStart values 310cdf0e10cSrcweir 311cdf0e10cSrcweir if( nCurrIndex > nClosestStartIndex ) 312cdf0e10cSrcweir { 313cdf0e10cSrcweir nClosestStartIndex = nCurrIndex; 314cdf0e10cSrcweir } 315cdf0e10cSrcweir } 316cdf0e10cSrcweir 317cdf0e10cSrcweir // find closest index behind of nIndex 318cdf0e10cSrcweir sal_Int32 nClosestEndIndex; 319cdf0e10cSrcweir for( nAttr=0, nClosestEndIndex=rEE.GetTextLen(nPara); nAttr<aCharAttribs.Count(); ++nAttr ) 320cdf0e10cSrcweir { 321cdf0e10cSrcweir nCurrIndex = aCharAttribs[nAttr].nEnd; 322cdf0e10cSrcweir 323cdf0e10cSrcweir if( nCurrIndex > nIndex && 324cdf0e10cSrcweir nCurrIndex < nClosestEndIndex ) 325cdf0e10cSrcweir { 326cdf0e10cSrcweir nClosestEndIndex = nCurrIndex; 327cdf0e10cSrcweir } 328cdf0e10cSrcweir } 329cdf0e10cSrcweir 330cdf0e10cSrcweir nStartIndex = static_cast<sal_uInt16>( nClosestStartIndex ); 331cdf0e10cSrcweir nEndIndex = static_cast<sal_uInt16>( nClosestEndIndex ); 332cdf0e10cSrcweir 333cdf0e10cSrcweir return sal_True; 334*9b8096d0SSteve Yin 335*9b8096d0SSteve Yin #endif 336cdf0e10cSrcweir } 337cdf0e10cSrcweir 338cdf0e10cSrcweir Point SvxEditSourceHelper::EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical ) 339cdf0e10cSrcweir { 340cdf0e10cSrcweir return bIsVertical ? Point( -rPoint.Y() + rEESize.Height(), rPoint.X() ) : rPoint; 341cdf0e10cSrcweir } 342cdf0e10cSrcweir 343cdf0e10cSrcweir Point SvxEditSourceHelper::UserSpaceToEE( const Point& rPoint, const Size& rEESize, bool bIsVertical ) 344cdf0e10cSrcweir { 345cdf0e10cSrcweir return bIsVertical ? Point( rPoint.Y(), -rPoint.X() + rEESize.Height() ) : rPoint; 346cdf0e10cSrcweir } 347cdf0e10cSrcweir 348cdf0e10cSrcweir Rectangle SvxEditSourceHelper::EEToUserSpace( const Rectangle& rRect, const Size& rEESize, bool bIsVertical ) 349cdf0e10cSrcweir { 350cdf0e10cSrcweir // #106775# Don't touch rect if not vertical 351cdf0e10cSrcweir return bIsVertical ? Rectangle( EEToUserSpace(rRect.BottomLeft(), rEESize, bIsVertical), 352cdf0e10cSrcweir EEToUserSpace(rRect.TopRight(), rEESize, bIsVertical) ) : rRect; 353cdf0e10cSrcweir } 354cdf0e10cSrcweir 355cdf0e10cSrcweir Rectangle SvxEditSourceHelper::UserSpaceToEE( const Rectangle& rRect, const Size& rEESize, bool bIsVertical ) 356cdf0e10cSrcweir { 357cdf0e10cSrcweir // #106775# Don't touch rect if not vertical 358cdf0e10cSrcweir return bIsVertical ? Rectangle( UserSpaceToEE(rRect.TopRight(), rEESize, bIsVertical), 359cdf0e10cSrcweir UserSpaceToEE(rRect.BottomLeft(), rEESize, bIsVertical) ) : rRect; 360cdf0e10cSrcweir } 361