1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_editeng.hxx" 26 27 //------------------------------------------------------------------------ 28 // 29 // Global header 30 // 31 //------------------------------------------------------------------------ 32 33 #include <limits.h> 34 #include <vector> 35 #include <algorithm> 36 #include <vos/mutex.hxx> 37 #include <vcl/window.hxx> 38 #include <vcl/svapp.hxx> 39 #include <editeng/flditem.hxx> 40 #include <com/sun/star/uno/Any.hxx> 41 #include <com/sun/star/uno/Reference.hxx> 42 #include <com/sun/star/awt/Point.hpp> 43 #include <com/sun/star/awt/Rectangle.hpp> 44 #include <com/sun/star/lang/DisposedException.hpp> 45 #include <com/sun/star/accessibility/AccessibleRole.hpp> 46 #include <com/sun/star/accessibility/AccessibleTextType.hpp> 47 #include <com/sun/star/accessibility/AccessibleStateType.hpp> 48 #include <com/sun/star/accessibility/AccessibleEventId.hpp> 49 #include <comphelper/accessibleeventnotifier.hxx> 50 #include <comphelper/sequenceashashmap.hxx> 51 #include <unotools/accessiblestatesethelper.hxx> 52 #include <unotools/accessiblerelationsethelper.hxx> 53 #include <com/sun/star/accessibility/AccessibleRelationType.hpp> 54 #include <vcl/unohelp.hxx> 55 #include <editeng/editeng.hxx> 56 #include <editeng/unoprnms.hxx> 57 #include <editeng/unoipset.hxx> 58 #include <editeng/outliner.hxx> 59 #include <svl/intitem.hxx> 60 61 //------------------------------------------------------------------------ 62 // 63 // Project-local header 64 // 65 //------------------------------------------------------------------------ 66 67 #include <com/sun/star/beans/PropertyState.hpp> 68 69 //!!!#include <svx/unoshape.hxx> 70 //!!!#include <svx/dialmgr.hxx> 71 //!!!#include "accessibility.hrc" 72 73 #include <editeng/unolingu.hxx> 74 #include <editeng/unopracc.hxx> 75 #include "editeng/AccessibleEditableTextPara.hxx" 76 #include "AccessibleHyperlink.hxx" 77 78 #include <svtools/colorcfg.hxx> 79 //IAccessibility2 Implementation 2009----- 80 #ifndef _ACCESSIBLEHYPERLINK_HXX 81 #include <Accessiblehyperlink.hxx> 82 #endif 83 #include <algorithm> 84 using namespace std; 85 //-----IAccessibility2 Implementation 2009 86 #include <editeng/numitem.hxx> 87 #include <sfx2/viewfrm.hxx> 88 #include <sfx2/viewsh.hxx> 89 90 using namespace ::com::sun::star; 91 using namespace ::com::sun::star::beans; 92 using namespace ::com::sun::star::accessibility; 93 94 95 //------------------------------------------------------------------------ 96 // 97 // AccessibleEditableTextPara implementation 98 // 99 //------------------------------------------------------------------------ 100 101 namespace accessibility 102 { 103 //IAccessibility2 Implementation 2009----- 104 //Window* GetCurrentEditorWnd(); 105 //-----IAccessibility2 Implementation 2009 106 107 const SvxItemPropertySet* ImplGetSvxCharAndParaPropertiesSet() 108 { 109 // PropertyMap for character and paragraph properties 110 static const SfxItemPropertyMapEntry aPropMap[] = 111 { 112 SVX_UNOEDIT_OUTLINER_PROPERTIES, 113 SVX_UNOEDIT_CHAR_PROPERTIES, 114 SVX_UNOEDIT_PARA_PROPERTIES, 115 SVX_UNOEDIT_NUMBERING_PROPERTIE, 116 {MAP_CHAR_LEN("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0}, 117 {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0}, 118 {0,0,0,0,0,0} 119 }; 120 static SvxItemPropertySet aPropSet( aPropMap, EditEngine::GetGlobalItemPool() ); 121 return &aPropSet; 122 } 123 124 125 DBG_NAME( AccessibleEditableTextPara ) 126 127 // --> OD 2006-01-11 #i27138# - add parameter <_pParaManager> 128 AccessibleEditableTextPara::AccessibleEditableTextPara( 129 const uno::Reference< XAccessible >& rParent, 130 const AccessibleParaManager* _pParaManager ) 131 : AccessibleTextParaInterfaceBase( m_aMutex ), 132 mnParagraphIndex( 0 ), 133 mnIndexInParent( 0 ), 134 mpEditSource( NULL ), 135 maEEOffset( 0, 0 ), 136 mxParent( rParent ), 137 // well, that's strictly (UNO) exception safe, though not 138 // really robust. We rely on the fact that this member is 139 // constructed last, and that the constructor body catches 140 // exceptions, thus no chance for exceptions once the Id is 141 // fetched. Nevertheless, normally should employ RAII here... 142 mnNotifierClientId(::comphelper::AccessibleEventNotifier::registerClient()), 143 // --> OD 2006-01-11 #i27138# 144 mpParaManager( _pParaManager ) 145 // <-- 146 { 147 #ifdef DBG_UTIL 148 DBG_CTOR( AccessibleEditableTextPara, NULL ); 149 OSL_TRACE( "AccessibleEditableTextPara received ID: %d\n", mnNotifierClientId ); 150 #endif 151 152 try 153 { 154 // Create the state set. 155 ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper (); 156 mxStateSet = pStateSet; 157 158 // these are always on 159 pStateSet->AddState( AccessibleStateType::MULTI_LINE ); 160 pStateSet->AddState( AccessibleStateType::FOCUSABLE ); 161 pStateSet->AddState( AccessibleStateType::VISIBLE ); 162 pStateSet->AddState( AccessibleStateType::SHOWING ); 163 pStateSet->AddState( AccessibleStateType::ENABLED ); 164 pStateSet->AddState( AccessibleStateType::SENSITIVE ); 165 } 166 catch( const uno::Exception& ) {} 167 } 168 169 AccessibleEditableTextPara::~AccessibleEditableTextPara() 170 { 171 DBG_DTOR( AccessibleEditableTextPara, NULL ); 172 173 // sign off from event notifier 174 if( getNotifierClientId() != -1 ) 175 { 176 try 177 { 178 ::comphelper::AccessibleEventNotifier::revokeClient( getNotifierClientId() ); 179 #ifdef DBG_UTIL 180 OSL_TRACE( "AccessibleEditableTextPara revoked ID: %d\n", mnNotifierClientId ); 181 #endif 182 } 183 catch( const uno::Exception& ) {} 184 } 185 } 186 187 ::rtl::OUString AccessibleEditableTextPara::implGetText() 188 { 189 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 190 191 return GetTextRange( 0, GetTextLen() ); 192 } 193 194 ::com::sun::star::lang::Locale AccessibleEditableTextPara::implGetLocale() 195 { 196 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 197 198 lang::Locale aLocale; 199 200 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 201 "AccessibleEditableTextPara::getLocale: paragraph index value overflow"); 202 203 // return locale of first character in the paragraph 204 return SvxLanguageToLocale(aLocale, GetTextForwarder().GetLanguage( static_cast< sal_uInt16 >( GetParagraphIndex() ), 0 )); 205 } 206 207 void AccessibleEditableTextPara::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) 208 { 209 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 210 211 sal_uInt16 nStart, nEnd; 212 213 if( GetSelection( nStart, nEnd ) ) 214 { 215 nStartIndex = nStart; 216 nEndIndex = nEnd; 217 } 218 else 219 { 220 // #102234# No exception, just set to 'invalid' 221 nStartIndex = -1; 222 nEndIndex = -1; 223 } 224 } 225 226 void AccessibleEditableTextPara::implGetParagraphBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 /*nIndex*/ ) 227 { 228 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 229 DBG_WARNING( "AccessibleEditableTextPara::implGetParagraphBoundary: only a base implementation, ignoring the index" ); 230 231 rBoundary.startPos = 0; 232 //IAccessibility2 Implementation 2009----- 233 //rBoundary.endPos = GetTextLen(); 234 ::rtl::OUString sText( implGetText() ); 235 sal_Int32 nLength = sText.getLength(); 236 rBoundary.endPos = nLength; 237 //-----IAccessibility2 Implementation 2009 238 } 239 240 void AccessibleEditableTextPara::implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex ) 241 { 242 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 243 244 SvxTextForwarder& rCacheTF = GetTextForwarder(); 245 const sal_Int32 nParaIndex = GetParagraphIndex(); 246 247 DBG_ASSERT(nParaIndex >= 0 && nParaIndex <= USHRT_MAX, 248 "AccessibleEditableTextPara::implGetLineBoundary: paragraph index value overflow"); 249 250 const sal_Int32 nTextLen = rCacheTF.GetTextLen( static_cast< sal_uInt16 >( nParaIndex ) ); 251 252 CheckPosition(nIndex); 253 254 rBoundary.startPos = rBoundary.endPos = -1; 255 256 const sal_uInt16 nLineCount=rCacheTF.GetLineCount( static_cast< sal_uInt16 >( nParaIndex ) ); 257 258 if( nIndex == nTextLen ) 259 { 260 // #i17014# Special-casing one-behind-the-end character 261 if( nLineCount <= 1 ) 262 rBoundary.startPos = 0; 263 else 264 rBoundary.startPos = nTextLen - rCacheTF.GetLineLen( static_cast< sal_uInt16 >( nParaIndex ), 265 nLineCount-1 ); 266 267 rBoundary.endPos = nTextLen; 268 } 269 else 270 { 271 // normal line search 272 sal_uInt16 nLine; 273 sal_Int32 nCurIndex; 274 for( nLine=0, nCurIndex=0; nLine<nLineCount; ++nLine ) 275 { 276 nCurIndex += rCacheTF.GetLineLen( static_cast< sal_uInt16 >( nParaIndex ), nLine); 277 278 if( nCurIndex > nIndex ) 279 { 280 rBoundary.startPos = nCurIndex - rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine); 281 rBoundary.endPos = nCurIndex; 282 break; 283 } 284 } 285 } 286 } 287 288 int AccessibleEditableTextPara::getNotifierClientId() const 289 { 290 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 291 292 return mnNotifierClientId; 293 } 294 295 void AccessibleEditableTextPara::SetIndexInParent( sal_Int32 nIndex ) 296 { 297 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 298 299 mnIndexInParent = nIndex; 300 } 301 302 sal_Int32 AccessibleEditableTextPara::GetIndexInParent() const 303 { 304 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 305 306 return mnIndexInParent; 307 } 308 309 void AccessibleEditableTextPara::SetParagraphIndex( sal_Int32 nIndex ) 310 { 311 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 312 313 sal_Int32 nOldIndex = mnParagraphIndex; 314 315 mnParagraphIndex = nIndex; 316 317 WeakBullet::HardRefType aChild( maImageBullet.get() ); 318 if( aChild.is() ) 319 aChild->SetParagraphIndex(mnParagraphIndex); 320 321 try 322 { 323 if( nOldIndex != nIndex ) 324 { 325 uno::Any aOldDesc; 326 uno::Any aOldName; 327 328 try 329 { 330 aOldDesc <<= getAccessibleDescription(); 331 aOldName <<= getAccessibleName(); 332 } 333 catch( const uno::Exception& ) {} // optional behaviour 334 // index and therefore description changed 335 FireEvent( AccessibleEventId::DESCRIPTION_CHANGED, uno::makeAny( getAccessibleDescription() ), aOldDesc ); 336 FireEvent( AccessibleEventId::NAME_CHANGED, uno::makeAny( getAccessibleName() ), aOldName ); 337 } 338 } 339 catch( const uno::Exception& ) {} // optional behaviour 340 } 341 342 sal_Int32 AccessibleEditableTextPara::GetParagraphIndex() const SAL_THROW((uno::RuntimeException)) 343 { 344 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 345 346 return mnParagraphIndex; 347 } 348 349 void AccessibleEditableTextPara::Dispose() 350 { 351 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 352 353 int nClientId( getNotifierClientId() ); 354 355 // #108212# drop all references before notifying dispose 356 mxParent = NULL; 357 mnNotifierClientId = -1; 358 mpEditSource = NULL; 359 360 // notify listeners 361 if( nClientId != -1 ) 362 { 363 try 364 { 365 uno::Reference < XAccessibleContext > xThis = getAccessibleContext(); 366 367 // #106234# Delegate to EventNotifier 368 ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId, xThis ); 369 #ifdef DBG_UTIL 370 OSL_TRACE( "Disposed ID: %d\n", nClientId ); 371 #endif 372 } 373 catch( const uno::Exception& ) {} 374 } 375 } 376 377 void AccessibleEditableTextPara::SetEditSource( SvxEditSourceAdapter* pEditSource ) 378 { 379 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 380 381 WeakBullet::HardRefType aChild( maImageBullet.get() ); 382 if( aChild.is() ) 383 aChild->SetEditSource(pEditSource); 384 385 if( !pEditSource ) 386 { 387 // going defunc 388 UnSetState( AccessibleStateType::SHOWING ); 389 UnSetState( AccessibleStateType::VISIBLE ); 390 SetState( AccessibleStateType::INVALID ); 391 SetState( AccessibleStateType::DEFUNC ); 392 393 Dispose(); 394 } 395 //IAccessibility2 Implementation 2009----- 396 mpEditSource = pEditSource; 397 //-----IAccessibility2 Implementation 2009 398 // #108900# Init last text content 399 try 400 { 401 TextChanged(); 402 } 403 catch( const uno::RuntimeException& ) {} 404 } 405 406 ESelection AccessibleEditableTextPara::MakeSelection( sal_Int32 nStartEEIndex, sal_Int32 nEndEEIndex ) 407 { 408 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 409 410 // check overflow 411 DBG_ASSERT(nStartEEIndex >= 0 && nStartEEIndex <= USHRT_MAX && 412 nEndEEIndex >= 0 && nEndEEIndex <= USHRT_MAX && 413 GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 414 "AccessibleEditableTextPara::MakeSelection: index value overflow"); 415 416 sal_uInt16 nParaIndex = static_cast< sal_uInt16 >( GetParagraphIndex() ); 417 return ESelection( nParaIndex, static_cast< sal_uInt16 >( nStartEEIndex ), 418 nParaIndex, static_cast< sal_uInt16 >( nEndEEIndex ) ); 419 } 420 421 ESelection AccessibleEditableTextPara::MakeSelection( sal_Int32 nEEIndex ) 422 { 423 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 424 425 return MakeSelection( nEEIndex, nEEIndex+1 ); 426 } 427 428 ESelection AccessibleEditableTextPara::MakeCursor( sal_Int32 nEEIndex ) 429 { 430 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 431 432 return MakeSelection( nEEIndex, nEEIndex ); 433 } 434 435 void AccessibleEditableTextPara::CheckIndex( sal_Int32 nIndex ) SAL_THROW((lang::IndexOutOfBoundsException, uno::RuntimeException)) 436 { 437 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 438 439 if( nIndex < 0 || nIndex >= getCharacterCount() ) 440 throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleEditableTextPara: character index out of bounds")), 441 uno::Reference< uno::XInterface > 442 ( static_cast< ::cppu::OWeakObject* > (this) ) ); // disambiguate hierarchy 443 } 444 445 void AccessibleEditableTextPara::CheckPosition( sal_Int32 nIndex ) SAL_THROW((lang::IndexOutOfBoundsException, uno::RuntimeException)) 446 { 447 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 448 449 if( nIndex < 0 || nIndex > getCharacterCount() ) 450 throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleEditableTextPara: character position out of bounds")), 451 uno::Reference< uno::XInterface > 452 ( static_cast< ::cppu::OWeakObject* > (this) ) ); // disambiguate hierarchy 453 } 454 455 void AccessibleEditableTextPara::CheckRange( sal_Int32 nStart, sal_Int32 nEnd ) SAL_THROW((lang::IndexOutOfBoundsException, uno::RuntimeException)) 456 { 457 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 458 459 CheckPosition( nStart ); 460 CheckPosition( nEnd ); 461 } 462 463 sal_Bool AccessibleEditableTextPara::GetSelection( sal_uInt16& nStartPos, sal_uInt16& nEndPos ) SAL_THROW((uno::RuntimeException)) 464 { 465 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 466 467 ESelection aSelection; 468 sal_uInt16 nPara = static_cast< sal_uInt16 > ( GetParagraphIndex() ); 469 if( !GetEditViewForwarder().GetSelection( aSelection ) ) 470 return sal_False; 471 472 if( aSelection.nStartPara < aSelection.nEndPara ) 473 { 474 if( aSelection.nStartPara > nPara || 475 aSelection.nEndPara < nPara ) 476 return sal_False; 477 478 if( nPara == aSelection.nStartPara ) 479 nStartPos = aSelection.nStartPos; 480 else 481 nStartPos = 0; 482 483 if( nPara == aSelection.nEndPara ) 484 nEndPos = aSelection.nEndPos; 485 else 486 nEndPos = GetTextLen(); 487 } 488 else 489 { 490 if( aSelection.nStartPara < nPara || 491 aSelection.nEndPara > nPara ) 492 return sal_False; 493 494 if( nPara == aSelection.nStartPara ) 495 nStartPos = aSelection.nStartPos; 496 else 497 nStartPos = GetTextLen(); 498 499 if( nPara == aSelection.nEndPara ) 500 nEndPos = aSelection.nEndPos; 501 else 502 nEndPos = 0; 503 } 504 505 return sal_True; 506 } 507 508 String AccessibleEditableTextPara::GetText( sal_Int32 nIndex ) SAL_THROW((uno::RuntimeException)) 509 { 510 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 511 512 return GetTextForwarder().GetText( MakeSelection(nIndex) ); 513 } 514 515 String AccessibleEditableTextPara::GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) SAL_THROW((uno::RuntimeException)) 516 { 517 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 518 519 return GetTextForwarder().GetText( MakeSelection(nStartIndex, nEndIndex) ); 520 } 521 522 sal_uInt16 AccessibleEditableTextPara::GetTextLen() const SAL_THROW((uno::RuntimeException)) 523 { 524 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 525 526 return GetTextForwarder().GetTextLen( static_cast< sal_uInt16 >( GetParagraphIndex() ) ); 527 } 528 529 sal_Bool AccessibleEditableTextPara::IsVisible() const 530 { 531 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 532 533 return mpEditSource ? sal_True : sal_False ; 534 } 535 536 uno::Reference< XAccessibleText > AccessibleEditableTextPara::GetParaInterface( sal_Int32 nIndex ) 537 { 538 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 539 540 uno::Reference< XAccessible > xParent = getAccessibleParent(); 541 if( xParent.is() ) 542 { 543 uno::Reference< XAccessibleContext > xParentContext = xParent->getAccessibleContext(); 544 if( xParentContext.is() ) 545 { 546 uno::Reference< XAccessible > xPara = xParentContext->getAccessibleChild( nIndex ); 547 if( xPara.is() ) 548 { 549 return uno::Reference< XAccessibleText > ( xPara, uno::UNO_QUERY ); 550 } 551 } 552 } 553 554 return uno::Reference< XAccessibleText >(); 555 } 556 557 SvxEditSourceAdapter& AccessibleEditableTextPara::GetEditSource() const SAL_THROW((uno::RuntimeException)) 558 { 559 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 560 561 if( mpEditSource ) 562 return *mpEditSource; 563 else 564 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No edit source, object is defunct")), 565 uno::Reference< uno::XInterface > 566 ( static_cast< ::cppu::OWeakObject* > 567 ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy 568 } 569 570 SvxAccessibleTextAdapter& AccessibleEditableTextPara::GetTextForwarder() const SAL_THROW((uno::RuntimeException)) 571 { 572 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 573 574 SvxEditSourceAdapter& rEditSource = GetEditSource(); 575 SvxAccessibleTextAdapter* pTextForwarder = rEditSource.GetTextForwarderAdapter(); 576 577 if( !pTextForwarder ) 578 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch text forwarder, object is defunct")), 579 uno::Reference< uno::XInterface > 580 ( static_cast< ::cppu::OWeakObject* > 581 ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy 582 583 if( pTextForwarder->IsValid() ) 584 return *pTextForwarder; 585 else 586 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Text forwarder is invalid, object is defunct")), 587 uno::Reference< uno::XInterface > 588 ( static_cast< ::cppu::OWeakObject* > 589 ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy 590 } 591 592 SvxViewForwarder& AccessibleEditableTextPara::GetViewForwarder() const SAL_THROW((uno::RuntimeException)) 593 { 594 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 595 596 SvxEditSource& rEditSource = GetEditSource(); 597 SvxViewForwarder* pViewForwarder = rEditSource.GetViewForwarder(); 598 599 if( !pViewForwarder ) 600 { 601 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch view forwarder, object is defunct")), 602 uno::Reference< uno::XInterface > 603 ( static_cast< ::cppu::OWeakObject* > 604 ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy 605 } 606 607 if( pViewForwarder->IsValid() ) 608 return *pViewForwarder; 609 else 610 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("View forwarder is invalid, object is defunct")), 611 uno::Reference< uno::XInterface > 612 ( static_cast< ::cppu::OWeakObject* > 613 ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy 614 } 615 616 SvxAccessibleTextEditViewAdapter& AccessibleEditableTextPara::GetEditViewForwarder( sal_Bool bCreate ) const SAL_THROW((uno::RuntimeException)) 617 { 618 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 619 620 SvxEditSourceAdapter& rEditSource = GetEditSource(); 621 SvxAccessibleTextEditViewAdapter* pTextEditViewForwarder = rEditSource.GetEditViewForwarderAdapter( bCreate ); 622 623 if( !pTextEditViewForwarder ) 624 { 625 if( bCreate ) 626 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unable to fetch view forwarder, object is defunct")), 627 uno::Reference< uno::XInterface > 628 ( static_cast< ::cppu::OWeakObject* > 629 ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy 630 else 631 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No view forwarder, object not in edit mode")), 632 uno::Reference< uno::XInterface > 633 ( static_cast< ::cppu::OWeakObject* > 634 ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy 635 } 636 637 if( pTextEditViewForwarder->IsValid() ) 638 return *pTextEditViewForwarder; 639 else 640 { 641 if( bCreate ) 642 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("View forwarder is invalid, object is defunct")), 643 uno::Reference< uno::XInterface > 644 ( static_cast< ::cppu::OWeakObject* > 645 ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy 646 else 647 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("View forwarder is invalid, object not in edit mode")), 648 uno::Reference< uno::XInterface > 649 ( static_cast< ::cppu::OWeakObject* > 650 ( const_cast< AccessibleEditableTextPara* > (this) ) ) ); // disambiguate hierarchy 651 } 652 } 653 654 sal_Bool AccessibleEditableTextPara::HaveEditView() const 655 { 656 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 657 658 SvxEditSource& rEditSource = GetEditSource(); 659 SvxEditViewForwarder* pViewForwarder = rEditSource.GetEditViewForwarder(); 660 661 if( !pViewForwarder ) 662 return sal_False; 663 664 if( !pViewForwarder->IsValid() ) 665 return sal_False; 666 667 return sal_True; 668 } 669 670 sal_Bool AccessibleEditableTextPara::HaveChildren() 671 { 672 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 673 674 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 675 "AccessibleEditableTextPara::HaveChildren: paragraph index value overflow"); 676 677 return GetTextForwarder().HaveImageBullet( static_cast< sal_uInt16 >(GetParagraphIndex()) ); 678 } 679 680 sal_Bool AccessibleEditableTextPara::IsActive() const SAL_THROW((uno::RuntimeException)) 681 { 682 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 683 684 SvxEditSource& rEditSource = GetEditSource(); 685 SvxEditViewForwarder* pViewForwarder = rEditSource.GetEditViewForwarder(); 686 687 if( !pViewForwarder ) 688 return sal_False; 689 690 if( pViewForwarder->IsValid() ) 691 return sal_False; 692 else 693 return sal_True; 694 } 695 696 Rectangle AccessibleEditableTextPara::LogicToPixel( const Rectangle& rRect, const MapMode& rMapMode, SvxViewForwarder& rForwarder ) 697 { 698 // convert to screen coordinates 699 return Rectangle( rForwarder.LogicToPixel( rRect.TopLeft(), rMapMode ), 700 rForwarder.LogicToPixel( rRect.BottomRight(), rMapMode ) ); 701 } 702 703 const Point& AccessibleEditableTextPara::GetEEOffset() const 704 { 705 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 706 707 return maEEOffset; 708 } 709 710 void AccessibleEditableTextPara::SetEEOffset( const Point& rOffset ) 711 { 712 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 713 714 WeakBullet::HardRefType aChild( maImageBullet.get() ); 715 if( aChild.is() ) 716 aChild->SetEEOffset(rOffset); 717 718 maEEOffset = rOffset; 719 } 720 721 void AccessibleEditableTextPara::FireEvent(const sal_Int16 nEventId, const uno::Any& rNewValue, const uno::Any& rOldValue) const 722 { 723 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 724 725 uno::Reference < XAccessibleContext > xThis( const_cast< AccessibleEditableTextPara* > (this)->getAccessibleContext() ); 726 727 AccessibleEventObject aEvent(xThis, nEventId, rNewValue, rOldValue); 728 729 // #102261# Call global queue for focus events 730 if( nEventId == AccessibleEventId::STATE_CHANGED ) 731 vcl::unohelper::NotifyAccessibleStateEventGlobally( aEvent ); 732 733 // #106234# Delegate to EventNotifier 734 if( getNotifierClientId() != -1 ) 735 ::comphelper::AccessibleEventNotifier::addEvent( getNotifierClientId(), 736 aEvent ); 737 } 738 739 void AccessibleEditableTextPara::GotPropertyEvent( const uno::Any& rNewValue, const sal_Int16 nEventId ) const 740 { 741 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 742 743 FireEvent( nEventId, rNewValue ); 744 } 745 746 void AccessibleEditableTextPara::LostPropertyEvent( const uno::Any& rOldValue, const sal_Int16 nEventId ) const 747 { 748 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 749 750 FireEvent( nEventId, uno::Any(), rOldValue ); 751 } 752 753 bool AccessibleEditableTextPara::HasState( const sal_Int16 nStateId ) 754 { 755 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 756 757 ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); 758 if( pStateSet != NULL ) 759 return pStateSet->contains(nStateId) ? true : false; 760 761 return false; 762 } 763 764 void AccessibleEditableTextPara::SetState( const sal_Int16 nStateId ) 765 { 766 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 767 768 ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); 769 if( pStateSet != NULL && 770 !pStateSet->contains(nStateId) ) 771 { 772 pStateSet->AddState( nStateId ); 773 //IAccessibility2 Implementation 2009----- 774 // MT: Removed method IsShapeParaFocusable which was introduced with IA2 - basically it was only about figuring out wether or not the window has the focus, should be solved differently 775 // if(IsShapeParaFocusable()) 776 GotPropertyEvent( uno::makeAny( nStateId ), AccessibleEventId::STATE_CHANGED ); 777 //-----IAccessibility2 Implementation 2009 778 } 779 } 780 781 void AccessibleEditableTextPara::UnSetState( const sal_Int16 nStateId ) 782 { 783 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 784 785 ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); 786 if( pStateSet != NULL && 787 pStateSet->contains(nStateId) ) 788 { 789 pStateSet->RemoveState( nStateId ); 790 LostPropertyEvent( uno::makeAny( nStateId ), AccessibleEventId::STATE_CHANGED ); 791 } 792 } 793 794 void AccessibleEditableTextPara::TextChanged() 795 { 796 ::rtl::OUString aCurrentString( OCommonAccessibleText::getText() ); 797 uno::Any aDeleted; 798 uno::Any aInserted; 799 if( OCommonAccessibleText::implInitTextChangedEvent( maLastTextString, aCurrentString, 800 aDeleted, aInserted) ) 801 { 802 FireEvent( AccessibleEventId::TEXT_CHANGED, aInserted, aDeleted ); 803 maLastTextString = aCurrentString; 804 } 805 } 806 807 sal_Bool AccessibleEditableTextPara::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nIndex ) 808 { 809 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 810 811 DBG_ASSERT(nIndex >= 0 && nIndex <= USHRT_MAX, 812 "AccessibleEditableTextPara::GetAttributeRun: index value overflow"); 813 814 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 815 "AccessibleEditableTextPara::getLocale: paragraph index value overflow"); 816 817 return GetTextForwarder().GetAttributeRun( nStartIndex, 818 nEndIndex, 819 static_cast< sal_uInt16 >(GetParagraphIndex()), 820 static_cast< sal_uInt16 >(nIndex) ); 821 } 822 823 uno::Any SAL_CALL AccessibleEditableTextPara::queryInterface (const uno::Type & rType) throw (uno::RuntimeException) 824 { 825 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 826 827 uno::Any aRet; 828 829 // must provide XAccesibleText by hand, since it comes publicly inherited by XAccessibleEditableText 830 if ( rType == ::getCppuType((uno::Reference< XAccessibleText > *)0) ) 831 { 832 //IAccessibility2 Implementation 2009----- 833 // uno::Reference< XAccessibleText > aAccText = this; 834 uno::Reference< XAccessibleText > aAccText = static_cast< XAccessibleEditableText * >(this); 835 //-----IAccessibility2 Implementation 2009 836 aRet <<= aAccText; 837 } 838 else if ( rType == ::getCppuType((uno::Reference< XAccessibleEditableText > *)0) ) 839 { 840 uno::Reference< XAccessibleEditableText > aAccEditText = this; 841 aRet <<= aAccEditText; 842 } 843 //IAccessibility2 Implementation 2009----- 844 else if ( rType == ::getCppuType((uno::Reference< XAccessibleHypertext > *)0) ) 845 { 846 uno::Reference< XAccessibleHypertext > aAccHyperText = this; 847 aRet <<= aAccHyperText; 848 } 849 //-----IAccessibility2 Implementation 2009 850 else 851 { 852 aRet = AccessibleTextParaInterfaceBase::queryInterface(rType); 853 } 854 855 return aRet; 856 } 857 858 // XAccessible 859 uno::Reference< XAccessibleContext > SAL_CALL AccessibleEditableTextPara::getAccessibleContext() throw (uno::RuntimeException) 860 { 861 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 862 863 // We implement the XAccessibleContext interface in the same object 864 return uno::Reference< XAccessibleContext > ( this ); 865 } 866 867 // XAccessibleContext 868 sal_Int32 SAL_CALL AccessibleEditableTextPara::getAccessibleChildCount() throw (uno::RuntimeException) 869 { 870 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 871 872 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 873 874 return HaveChildren() ? 1 : 0; 875 } 876 877 uno::Reference< XAccessible > SAL_CALL AccessibleEditableTextPara::getAccessibleChild( sal_Int32 i ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 878 { 879 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 880 881 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 882 883 if( !HaveChildren() ) 884 throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("No childs available")), 885 uno::Reference< uno::XInterface > 886 ( static_cast< ::cppu::OWeakObject* > (this) ) ); // static_cast: disambiguate hierarchy 887 888 if( i != 0 ) 889 throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid child index")), 890 uno::Reference< uno::XInterface > 891 ( static_cast< ::cppu::OWeakObject* > (this) ) ); // static_cast: disambiguate hierarchy 892 893 WeakBullet::HardRefType aChild( maImageBullet.get() ); 894 895 if( !aChild.is() ) 896 { 897 // there is no hard reference available, create object then 898 AccessibleImageBullet* pChild = new AccessibleImageBullet( uno::Reference< XAccessible >( this ) ); 899 uno::Reference< XAccessible > xChild( static_cast< ::cppu::OWeakObject* > (pChild), uno::UNO_QUERY ); 900 901 if( !xChild.is() ) 902 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Child creation failed")), 903 uno::Reference< uno::XInterface > 904 ( static_cast< ::cppu::OWeakObject* > (this) ) ); 905 906 aChild = WeakBullet::HardRefType( xChild, pChild ); 907 908 aChild->SetEditSource( &GetEditSource() ); 909 aChild->SetParagraphIndex( GetParagraphIndex() ); 910 aChild->SetIndexInParent( i ); 911 912 maImageBullet = aChild; 913 } 914 915 return aChild.getRef(); 916 } 917 918 uno::Reference< XAccessible > SAL_CALL AccessibleEditableTextPara::getAccessibleParent() throw (uno::RuntimeException) 919 { 920 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 921 922 #ifdef DBG_UTIL 923 if( !mxParent.is() ) 924 DBG_TRACE( "AccessibleEditableTextPara::getAccessibleParent: no frontend set, did somebody forgot to call AccessibleTextHelper::SetEventSource()?"); 925 #endif 926 927 return mxParent; 928 } 929 930 sal_Int32 SAL_CALL AccessibleEditableTextPara::getAccessibleIndexInParent() throw (uno::RuntimeException) 931 { 932 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 933 934 return mnIndexInParent; 935 } 936 937 sal_Int16 SAL_CALL AccessibleEditableTextPara::getAccessibleRole() throw (uno::RuntimeException) 938 { 939 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 940 941 return AccessibleRole::PARAGRAPH; 942 } 943 944 ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getAccessibleDescription() throw (uno::RuntimeException) 945 { 946 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 947 948 // ::vos::OGuard aGuard( Application::GetSolarMutex() ); 949 950 return ::rtl::OUString(); 951 } 952 953 ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getAccessibleName() throw (uno::RuntimeException) 954 { 955 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 956 957 // ::vos::OGuard aGuard( Application::GetSolarMutex() ); 958 959 return ::rtl::OUString(); 960 } 961 962 uno::Reference< XAccessibleRelationSet > SAL_CALL AccessibleEditableTextPara::getAccessibleRelationSet() throw (uno::RuntimeException) 963 { 964 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 965 966 // --> OD 2006-01-11 #i27138# - provide relations CONTENT_FLOWS_FROM 967 // and CONTENT_FLOWS_TO 968 if ( mpParaManager ) 969 { 970 utl::AccessibleRelationSetHelper* pAccRelSetHelper = 971 new utl::AccessibleRelationSetHelper(); 972 sal_Int32 nMyParaIndex( GetParagraphIndex() ); 973 // relation CONTENT_FLOWS_FROM 974 if ( nMyParaIndex > 0 && 975 mpParaManager->IsReferencable( nMyParaIndex - 1 ) ) 976 { 977 uno::Sequence<uno::Reference<XInterface> > aSequence(1); 978 aSequence[0] = 979 mpParaManager->GetChild( nMyParaIndex - 1 ).first.get().getRef(); 980 AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_FROM, 981 aSequence ); 982 pAccRelSetHelper->AddRelation( aAccRel ); 983 } 984 985 // relation CONTENT_FLOWS_TO 986 if ( (nMyParaIndex + 1) < (sal_Int32)mpParaManager->GetNum() && 987 mpParaManager->IsReferencable( nMyParaIndex + 1 ) ) 988 { 989 uno::Sequence<uno::Reference<XInterface> > aSequence(1); 990 aSequence[0] = 991 mpParaManager->GetChild( nMyParaIndex + 1 ).first.get().getRef(); 992 AccessibleRelation aAccRel( AccessibleRelationType::CONTENT_FLOWS_TO, 993 aSequence ); 994 pAccRelSetHelper->AddRelation( aAccRel ); 995 } 996 997 return pAccRelSetHelper; 998 } 999 else 1000 { 1001 // no relations, therefore empty 1002 return uno::Reference< XAccessibleRelationSet >(); 1003 } 1004 // <-- 1005 } 1006 1007 uno::Reference< XAccessibleStateSet > SAL_CALL AccessibleEditableTextPara::getAccessibleStateSet() throw (uno::RuntimeException) 1008 { 1009 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1010 1011 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1012 1013 // Create a copy of the state set and return it. 1014 ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); 1015 1016 if( !pStateSet ) 1017 return uno::Reference<XAccessibleStateSet>(); 1018 //IAccessibility2 Implementation 2009----- 1019 uno::Reference<XAccessibleStateSet> xParentStates; 1020 if (getAccessibleParent().is()) 1021 { 1022 uno::Reference<XAccessibleContext> xParentContext = getAccessibleParent()->getAccessibleContext(); 1023 xParentStates = xParentContext->getAccessibleStateSet(); 1024 } 1025 if (xParentStates.is() && xParentStates->contains(AccessibleStateType::EDITABLE) ) 1026 { 1027 pStateSet->AddState(AccessibleStateType::EDITABLE); 1028 } 1029 //-----IAccessibility2 Implementation 2009 1030 return uno::Reference<XAccessibleStateSet>( new ::utl::AccessibleStateSetHelper (*pStateSet) ); 1031 } 1032 1033 lang::Locale SAL_CALL AccessibleEditableTextPara::getLocale() throw (IllegalAccessibleComponentStateException, uno::RuntimeException) 1034 { 1035 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1036 1037 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1038 1039 return implGetLocale(); 1040 } 1041 1042 void SAL_CALL AccessibleEditableTextPara::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException) 1043 { 1044 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1045 1046 if( getNotifierClientId() != -1 ) 1047 ::comphelper::AccessibleEventNotifier::addEventListener( getNotifierClientId(), xListener ); 1048 } 1049 1050 void SAL_CALL AccessibleEditableTextPara::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException) 1051 { 1052 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1053 1054 if( getNotifierClientId() != -1 ) 1055 ::comphelper::AccessibleEventNotifier::removeEventListener( getNotifierClientId(), xListener ); 1056 } 1057 1058 // XAccessibleComponent 1059 sal_Bool SAL_CALL AccessibleEditableTextPara::containsPoint( const awt::Point& aTmpPoint ) throw (uno::RuntimeException) 1060 { 1061 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1062 1063 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1064 1065 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 1066 "AccessibleEditableTextPara::contains: index value overflow"); 1067 1068 awt::Rectangle aTmpRect = getBounds(); 1069 Rectangle aRect( Point(aTmpRect.X, aTmpRect.Y), Size(aTmpRect.Width, aTmpRect.Height) ); 1070 Point aPoint( aTmpPoint.X, aTmpPoint.Y ); 1071 1072 return aRect.IsInside( aPoint ); 1073 } 1074 1075 uno::Reference< XAccessible > SAL_CALL AccessibleEditableTextPara::getAccessibleAtPoint( const awt::Point& _aPoint ) throw (uno::RuntimeException) 1076 { 1077 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1078 1079 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1080 1081 if( HaveChildren() ) 1082 { 1083 // #103862# No longer need to make given position relative 1084 Point aPoint( _aPoint.X, _aPoint.Y ); 1085 1086 // respect EditEngine offset to surrounding shape/cell 1087 aPoint -= GetEEOffset(); 1088 1089 // convert to EditEngine coordinate system 1090 SvxTextForwarder& rCacheTF = GetTextForwarder(); 1091 Point aLogPoint( GetViewForwarder().PixelToLogic( aPoint, rCacheTF.GetMapMode() ) ); 1092 1093 EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 > (GetParagraphIndex()) ); 1094 1095 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && 1096 aBulletInfo.bVisible && 1097 aBulletInfo.nType == SVX_NUM_BITMAP ) 1098 { 1099 Rectangle aRect = aBulletInfo.aBounds; 1100 1101 if( aRect.IsInside( aLogPoint ) ) 1102 return getAccessibleChild(0); 1103 } 1104 } 1105 1106 // no children at all, or none at given position 1107 return uno::Reference< XAccessible >(); 1108 } 1109 1110 awt::Rectangle SAL_CALL AccessibleEditableTextPara::getBounds() throw (uno::RuntimeException) 1111 { 1112 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1113 1114 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1115 1116 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 1117 "AccessibleEditableTextPara::getBounds: index value overflow"); 1118 1119 SvxTextForwarder& rCacheTF = GetTextForwarder(); 1120 Rectangle aRect = rCacheTF.GetParaBounds( static_cast< sal_uInt16 >( GetParagraphIndex() ) ); 1121 1122 // convert to screen coordinates 1123 Rectangle aScreenRect = AccessibleEditableTextPara::LogicToPixel( aRect, 1124 rCacheTF.GetMapMode(), 1125 GetViewForwarder() ); 1126 1127 // offset from shape/cell 1128 Point aOffset = GetEEOffset(); 1129 1130 return awt::Rectangle( aScreenRect.Left() + aOffset.X(), 1131 aScreenRect.Top() + aOffset.Y(), 1132 aScreenRect.GetSize().Width(), 1133 aScreenRect.GetSize().Height() ); 1134 } 1135 1136 awt::Point SAL_CALL AccessibleEditableTextPara::getLocation( ) throw (uno::RuntimeException) 1137 { 1138 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1139 1140 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1141 1142 awt::Rectangle aRect = getBounds(); 1143 1144 return awt::Point( aRect.X, aRect.Y ); 1145 } 1146 1147 awt::Point SAL_CALL AccessibleEditableTextPara::getLocationOnScreen( ) throw (uno::RuntimeException) 1148 { 1149 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1150 1151 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1152 1153 // relate us to parent 1154 uno::Reference< XAccessible > xParent = getAccessibleParent(); 1155 if( xParent.is() ) 1156 { 1157 uno::Reference< XAccessibleComponent > xParentComponent( xParent, uno::UNO_QUERY ); 1158 if( xParentComponent.is() ) 1159 { 1160 awt::Point aRefPoint = xParentComponent->getLocationOnScreen(); 1161 awt::Point aPoint = getLocation(); 1162 aPoint.X += aRefPoint.X; 1163 aPoint.Y += aRefPoint.Y; 1164 1165 return aPoint; 1166 } 1167 // --> OD 2009-12-16 #i88070# 1168 // fallback to parent's <XAccessibleContext> instance 1169 else 1170 { 1171 uno::Reference< XAccessibleContext > xParentContext = xParent->getAccessibleContext(); 1172 if ( xParentContext.is() ) 1173 { 1174 uno::Reference< XAccessibleComponent > xParentContextComponent( xParentContext, uno::UNO_QUERY ); 1175 if( xParentContextComponent.is() ) 1176 { 1177 awt::Point aRefPoint = xParentContextComponent->getLocationOnScreen(); 1178 awt::Point aPoint = getLocation(); 1179 aPoint.X += aRefPoint.X; 1180 aPoint.Y += aRefPoint.Y; 1181 1182 return aPoint; 1183 } 1184 } 1185 } 1186 // <-- 1187 } 1188 1189 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot access parent")), 1190 uno::Reference< uno::XInterface > 1191 ( static_cast< XAccessible* > (this) ) ); // disambiguate hierarchy 1192 } 1193 1194 awt::Size SAL_CALL AccessibleEditableTextPara::getSize( ) throw (uno::RuntimeException) 1195 { 1196 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1197 1198 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1199 1200 awt::Rectangle aRect = getBounds(); 1201 1202 return awt::Size( aRect.Width, aRect.Height ); 1203 } 1204 1205 void SAL_CALL AccessibleEditableTextPara::grabFocus( ) throw (uno::RuntimeException) 1206 { 1207 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1208 1209 // set cursor to this paragraph 1210 setSelection(0,0); 1211 } 1212 1213 sal_Int32 SAL_CALL AccessibleEditableTextPara::getForeground( ) throw (::com::sun::star::uno::RuntimeException) 1214 { 1215 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1216 1217 // #104444# Added to XAccessibleComponent interface 1218 svtools::ColorConfig aColorConfig; 1219 sal_uInt32 nColor = aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor; 1220 return static_cast<sal_Int32>(nColor); 1221 } 1222 1223 sal_Int32 SAL_CALL AccessibleEditableTextPara::getBackground( ) throw (::com::sun::star::uno::RuntimeException) 1224 { 1225 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1226 1227 // #104444# Added to XAccessibleComponent interface 1228 Color aColor( Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor() ); 1229 1230 // the background is transparent 1231 aColor.SetTransparency( 0xFF); 1232 1233 return static_cast<sal_Int32>( aColor.GetColor() ); 1234 } 1235 1236 // XAccessibleText 1237 sal_Int32 SAL_CALL AccessibleEditableTextPara::getCaretPosition() throw (uno::RuntimeException) 1238 { 1239 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1240 1241 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1242 1243 if( !HaveEditView() ) 1244 return -1; 1245 1246 ESelection aSelection; 1247 if( GetEditViewForwarder().GetSelection( aSelection ) && 1248 GetParagraphIndex() == aSelection.nEndPara ) 1249 { 1250 // caret is always nEndPara,nEndPos 1251 //IAccessibility2 Implementation 2009----- 1252 EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); 1253 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && 1254 aBulletInfo.bVisible && 1255 aBulletInfo.nType != SVX_NUM_BITMAP ) 1256 { 1257 sal_Int32 nBulletLen = aBulletInfo.aText.Len(); 1258 if( aSelection.nEndPos - nBulletLen >= 0 ) 1259 return aSelection.nEndPos - nBulletLen; 1260 } 1261 //-----IAccessibility2 Implementation 2009 1262 return aSelection.nEndPos; 1263 } 1264 1265 // not within this paragraph 1266 return -1; 1267 } 1268 1269 sal_Bool SAL_CALL AccessibleEditableTextPara::setCaretPosition( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 1270 { 1271 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1272 1273 return setSelection(nIndex, nIndex); 1274 } 1275 1276 sal_Unicode SAL_CALL AccessibleEditableTextPara::getCharacter( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 1277 { 1278 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1279 1280 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1281 1282 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 1283 "AccessibleEditableTextPara::getCharacter: index value overflow"); 1284 1285 return OCommonAccessibleText::getCharacter( nIndex ); 1286 } 1287 //IAccessibility2 Implementation 2009----- 1288 static uno::Sequence< ::rtl::OUString > getAttributeNames() 1289 { 1290 static uno::Sequence< ::rtl::OUString >* pNames = NULL; 1291 1292 if( pNames == NULL ) 1293 { 1294 uno::Sequence< ::rtl::OUString >* pSeq = new uno::Sequence< ::rtl::OUString >( 21 ); 1295 ::rtl::OUString* pStrings = pSeq->getArray(); 1296 sal_Int32 i = 0; 1297 #define STR(x) pStrings[i++] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x)) 1298 //STR("CharBackColor"); 1299 STR("CharColor"); 1300 STR("CharContoured"); 1301 STR("CharEmphasis"); 1302 STR("CharEscapement"); 1303 STR("CharFontName"); 1304 STR("CharHeight"); 1305 STR("CharPosture"); 1306 STR("CharShadowed"); 1307 STR("CharStrikeout"); 1308 STR("CharUnderline"); 1309 STR("CharUnderlineColor"); 1310 STR("CharWeight"); 1311 STR("NumberingLevel"); 1312 STR("NumberingRules"); 1313 STR("ParaAdjust"); 1314 STR("ParaBottomMargin"); 1315 STR("ParaFirstLineIndent"); 1316 STR("ParaLeftMargin"); 1317 STR("ParaLineSpacing"); 1318 STR("ParaRightMargin"); 1319 STR("ParaTabStops"); 1320 #undef STR 1321 DBG_ASSERT( i == pSeq->getLength(), "Please adjust length" ); 1322 if( i != pSeq->getLength() ) 1323 pSeq->realloc( i ); 1324 pNames = pSeq; 1325 } 1326 return *pNames; 1327 } 1328 //-----IAccessibility2 Implementation 2009 1329 struct IndexCompare 1330 { 1331 const PropertyValue* pValues; 1332 IndexCompare( const PropertyValue* pVals ) : pValues(pVals) {} 1333 bool operator() ( const sal_Int32& a, const sal_Int32& b ) const 1334 { 1335 return (pValues[a].Name < pValues[b].Name) ? true : false; 1336 } 1337 }; 1338 1339 String AccessibleEditableTextPara::GetFieldTypeNameAtIndex(sal_Int32 nIndex) 1340 { 1341 String strFldType; 1342 SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); 1343 //For field object info 1344 sal_Int32 nParaIndex = GetParagraphIndex(); 1345 sal_Int32 nAllFieldLen = 0; 1346 sal_Int32 nField = rCacheTF.GetFieldCount(sal_uInt16(nParaIndex)), nFoundFieldIndex = -1; 1347 EFieldInfo ree; 1348 sal_Int32 reeBegin, reeEnd; 1349 sal_Int32 nFieldType = -1; 1350 for(sal_uInt16 j = 0; j < nField; j++) 1351 { 1352 ree = rCacheTF.GetFieldInfo(sal_uInt16(nParaIndex), j); 1353 reeBegin = ree.aPosition.nIndex + nAllFieldLen; 1354 reeEnd = reeBegin + ree.aCurrentText.Len(); 1355 nAllFieldLen += (ree.aCurrentText.Len() - 1); 1356 if( reeBegin > nIndex ) 1357 { 1358 break; 1359 } 1360 if( nIndex >= reeBegin && nIndex < reeEnd ) 1361 { 1362 nFoundFieldIndex = j; 1363 break; 1364 } 1365 } 1366 if( nFoundFieldIndex >= 0 ) 1367 { 1368 // So we get a field, check its type now. 1369 nFieldType = ree.pFieldItem->GetField()->GetClassId() ; 1370 } 1371 switch(nFieldType) 1372 { 1373 case SVX_DATEFIELD: 1374 { 1375 const SvxDateField* pDateField = static_cast< const SvxDateField* >(ree.pFieldItem->GetField()); 1376 if (pDateField) 1377 { 1378 if (pDateField->GetType() == SVXDATETYPE_FIX) 1379 strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("date (fixed)")); 1380 else if (pDateField->GetType() == SVXDATETYPE_VAR) 1381 strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("date (variable)")); 1382 } 1383 } 1384 break; 1385 case SVX_PAGEFIELD: 1386 strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("page-number")); 1387 break; 1388 //Sym2_8508, support the sheet name & pages fields 1389 case SVX_PAGESFIELD: 1390 strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("page-count")); 1391 break; 1392 case SVX_TABLEFIELD: 1393 strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sheet-name")); 1394 break; 1395 //End of Sym2_8508 1396 case SVX_TIMEFIELD: 1397 strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("time")); 1398 break; 1399 case SVX_EXT_TIMEFIELD: 1400 { 1401 const SvxExtTimeField* pTimeField = static_cast< const SvxExtTimeField* >(ree.pFieldItem->GetField()); 1402 if (pTimeField) 1403 { 1404 if (pTimeField->GetType() == SVXTIMETYPE_FIX) 1405 strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("time (fixed)")); 1406 else if (pTimeField->GetType() == SVXTIMETYPE_VAR) 1407 strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("time (variable)")); 1408 } 1409 } 1410 break; 1411 case SVX_AUTHORFIELD: 1412 strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("author")); 1413 break; 1414 case SVX_EXT_FILEFIELD: 1415 case SVX_FILEFIELD: 1416 strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file name")); 1417 default: 1418 break; 1419 } 1420 return strFldType; 1421 } 1422 1423 uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleEditableTextPara::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rRequestedAttributes ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 1424 { 1425 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1426 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1427 1428 //IAccessibility2 Implementation 2009----- 1429 //Skip the bullet range to ingnore the bullet text 1430 SvxTextForwarder& rCacheTF = GetTextForwarder(); 1431 EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); 1432 if (aBulletInfo.bVisible) 1433 nIndex += aBulletInfo.aText.Len(); 1434 if (nIndex != 0 && nIndex >= getCharacterCount()) 1435 nIndex = getCharacterCount()-1; 1436 // 1437 if (nIndex != 0) 1438 CheckIndex(nIndex); // may throw IndexOutOfBoundsException 1439 1440 // refactored by Steve Yin 1441 bool bSupplementalMode = false; 1442 uno::Sequence< ::rtl::OUString > aPropertyNames = rRequestedAttributes; 1443 if (aPropertyNames.getLength() == 0) 1444 { 1445 bSupplementalMode = true; 1446 aPropertyNames = getAttributeNames(); 1447 } 1448 // get default attribues... 1449 ::comphelper::SequenceAsHashMap aPropHashMap( getDefaultAttributes( aPropertyNames ) ); 1450 1451 // ... and override them with the direct attributes from the specific position 1452 uno::Sequence< beans::PropertyValue > aRunAttribs( getRunAttributes( nIndex, aPropertyNames ) ); 1453 //-----IAccessibility2 Implementation 2009 1454 sal_Int32 nRunAttribs = aRunAttribs.getLength(); 1455 const beans::PropertyValue *pRunAttrib = aRunAttribs.getConstArray(); 1456 for (sal_Int32 k = 0; k < nRunAttribs; ++k) 1457 { 1458 const beans::PropertyValue &rRunAttrib = pRunAttrib[k]; 1459 aPropHashMap[ rRunAttrib.Name ] = rRunAttrib.Value; //!! should not only be the value !! 1460 } 1461 #ifdef TL_DEBUG 1462 { 1463 uno::Sequence< rtl::OUString > aNames(1); 1464 aNames.getArray()[0] = rtl::OUString::createFromAscii("CharHeight"); 1465 const rtl::OUString *pNames = aNames.getConstArray(); 1466 const uno::Sequence< beans::PropertyValue > aAttribs( getRunAttributes( nIndex, aNames ) ); 1467 const beans::PropertyValue *pAttribs = aAttribs.getConstArray(); 1468 double d1 = -1.0; 1469 float f1 = -1.0; 1470 if (aAttribs.getLength()) 1471 { 1472 uno::Any aAny( pAttribs[0].Value ); 1473 aAny >>= d1; 1474 aAny >>= f1; 1475 } 1476 int i = 3; 1477 } 1478 #endif 1479 1480 // get resulting sequence 1481 uno::Sequence< beans::PropertyValue > aRes; 1482 aPropHashMap >> aRes; 1483 1484 // since SequenceAsHashMap ignores property handles and property state 1485 // we have to restore the property state here (property handles are 1486 // of no use to the accessibility API). 1487 sal_Int32 nRes = aRes.getLength(); 1488 beans::PropertyValue *pRes = aRes.getArray(); 1489 for (sal_Int32 i = 0; i < nRes; ++i) 1490 { 1491 beans::PropertyValue &rRes = pRes[i]; 1492 sal_Bool bIsDirectVal = sal_False; 1493 for (sal_Int32 k = 0; k < nRunAttribs && !bIsDirectVal; ++k) 1494 { 1495 if (rRes.Name == pRunAttrib[k].Name) 1496 bIsDirectVal = sal_True; 1497 } 1498 rRes.Handle = -1; 1499 rRes.State = bIsDirectVal ? PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE; 1500 } 1501 //IAccessibility2 Implementation 2009----- 1502 if( bSupplementalMode ) 1503 { 1504 _correctValues( nIndex, aRes ); 1505 // NumberingPrefix 1506 nRes = aRes.getLength(); 1507 aRes.realloc( nRes + 1 ); 1508 pRes = aRes.getArray(); 1509 beans::PropertyValue &rRes = pRes[nRes]; 1510 rRes.Name = rtl::OUString::createFromAscii("NumberingPrefix"); 1511 ::rtl::OUString numStr; 1512 if (aBulletInfo.nType != SVX_NUM_CHAR_SPECIAL && aBulletInfo.nType != SVX_NUM_BITMAP) 1513 numStr = (::rtl::OUString)aBulletInfo.aText; 1514 rRes.Value <<= numStr; 1515 rRes.Handle = -1; 1516 rRes.State = PropertyState_DIRECT_VALUE; 1517 //-----IAccessibility2 Implementation 2009 1518 //For field object. 1519 String strFieldType = GetFieldTypeNameAtIndex(nIndex); 1520 if (strFieldType.Len() > 0) 1521 { 1522 nRes = aRes.getLength(); 1523 aRes.realloc( nRes + 1 ); 1524 pRes = aRes.getArray(); 1525 beans::PropertyValue &rResField = pRes[nRes]; 1526 beans::PropertyValue aFieldType; 1527 rResField.Name = rtl::OUString::createFromAscii("FieldType"); 1528 rResField.Value <<= rtl::OUString(strFieldType.ToLowerAscii()); 1529 rResField.Handle = -1; 1530 rResField.State = PropertyState_DIRECT_VALUE; 1531 } 1532 //sort property values 1533 // build sorted index array 1534 sal_Int32 nLength = aRes.getLength(); 1535 const beans::PropertyValue* pPairs = aRes.getConstArray(); 1536 sal_Int32* pIndices = new sal_Int32[nLength]; 1537 sal_Int32 i = 0; 1538 for( i = 0; i < nLength; i++ ) 1539 pIndices[i] = i; 1540 sort( &pIndices[0], &pIndices[nLength], IndexCompare(pPairs) ); 1541 // create sorted sequences accoring to index array 1542 uno::Sequence<beans::PropertyValue> aNewValues( nLength ); 1543 beans::PropertyValue* pNewValues = aNewValues.getArray(); 1544 for( i = 0; i < nLength; i++ ) 1545 { 1546 pNewValues[i] = pPairs[pIndices[i]]; 1547 } 1548 delete[] pIndices; 1549 // 1550 return aNewValues; 1551 } 1552 return aRes; 1553 } 1554 1555 awt::Rectangle SAL_CALL AccessibleEditableTextPara::getCharacterBounds( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 1556 { 1557 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1558 1559 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1560 1561 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 1562 "AccessibleEditableTextPara::getCharacterBounds: index value overflow"); 1563 1564 // #108900# Have position semantics now for nIndex, as 1565 // one-past-the-end values are legal, too. 1566 CheckPosition( nIndex ); 1567 1568 SvxTextForwarder& rCacheTF = GetTextForwarder(); 1569 Rectangle aRect = rCacheTF.GetCharBounds( static_cast< sal_uInt16 >( GetParagraphIndex() ), static_cast< sal_uInt16 >( nIndex ) ); 1570 1571 // convert to screen 1572 Rectangle aScreenRect = AccessibleEditableTextPara::LogicToPixel( aRect, 1573 rCacheTF.GetMapMode(), 1574 GetViewForwarder() ); 1575 // #109864# offset from parent (paragraph), but in screen 1576 // coordinates. This makes sure the internal text offset in 1577 // the outline view forwarder gets cancelled out here 1578 awt::Rectangle aParaRect( getBounds() ); 1579 aScreenRect.Move( -aParaRect.X, -aParaRect.Y ); 1580 1581 // offset from shape/cell 1582 Point aOffset = GetEEOffset(); 1583 1584 return awt::Rectangle( aScreenRect.Left() + aOffset.X(), 1585 aScreenRect.Top() + aOffset.Y(), 1586 aScreenRect.GetSize().Width(), 1587 aScreenRect.GetSize().Height() ); 1588 } 1589 1590 sal_Int32 SAL_CALL AccessibleEditableTextPara::getCharacterCount() throw (uno::RuntimeException) 1591 { 1592 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1593 1594 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1595 1596 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 1597 "AccessibleEditableTextPara::getCharacterCount: index value overflow"); 1598 1599 return OCommonAccessibleText::getCharacterCount(); 1600 } 1601 1602 sal_Int32 SAL_CALL AccessibleEditableTextPara::getIndexAtPoint( const awt::Point& rPoint ) throw (uno::RuntimeException) 1603 { 1604 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1605 1606 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1607 //IAccessibility2 Implementation 2009----- 1608 if ((rPoint.X <= 0) && (rPoint.Y <= 0)) 1609 return 0; 1610 //-----IAccessibility2 Implementation 2009 1611 sal_uInt16 nPara, nIndex; 1612 1613 // offset from surrounding cell/shape 1614 Point aOffset( GetEEOffset() ); 1615 Point aPoint( rPoint.X - aOffset.X(), rPoint.Y - aOffset.Y() ); 1616 1617 // convert to logical coordinates 1618 SvxTextForwarder& rCacheTF = GetTextForwarder(); 1619 Point aLogPoint( GetViewForwarder().PixelToLogic( aPoint, rCacheTF.GetMapMode() ) ); 1620 1621 // re-offset to parent (paragraph) 1622 Rectangle aParaRect = rCacheTF.GetParaBounds( static_cast< sal_uInt16 >( GetParagraphIndex() ) ); 1623 aLogPoint.Move( aParaRect.Left(), aParaRect.Top() ); 1624 1625 if( rCacheTF.GetIndexAtPoint( aLogPoint, nPara, nIndex ) && 1626 GetParagraphIndex() == nPara ) 1627 { 1628 // #102259# Double-check if we're _really_ on the given character 1629 try 1630 { 1631 awt::Rectangle aRect1( getCharacterBounds(nIndex) ); 1632 Rectangle aRect2( aRect1.X, aRect1.Y, 1633 aRect1.Width + aRect1.X, aRect1.Height + aRect1.Y ); 1634 if( aRect2.IsInside( Point( rPoint.X, rPoint.Y ) ) ) 1635 return nIndex; 1636 else 1637 return -1; 1638 } 1639 catch( const lang::IndexOutOfBoundsException& ) 1640 { 1641 // #103927# Don't throw for invalid nIndex values 1642 return -1; 1643 } 1644 } 1645 else 1646 { 1647 // not within our paragraph 1648 return -1; 1649 } 1650 } 1651 1652 ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getSelectedText() throw (uno::RuntimeException) 1653 { 1654 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1655 1656 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1657 1658 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 1659 "AccessibleEditableTextPara::getSelectedText: index value overflow"); 1660 1661 if( !HaveEditView() ) 1662 return ::rtl::OUString(); 1663 1664 return OCommonAccessibleText::getSelectedText(); 1665 } 1666 1667 sal_Int32 SAL_CALL AccessibleEditableTextPara::getSelectionStart() throw (uno::RuntimeException) 1668 { 1669 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1670 1671 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1672 1673 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 1674 "AccessibleEditableTextPara::getSelectionStart: index value overflow"); 1675 1676 if( !HaveEditView() ) 1677 return -1; 1678 1679 return OCommonAccessibleText::getSelectionStart(); 1680 } 1681 1682 sal_Int32 SAL_CALL AccessibleEditableTextPara::getSelectionEnd() throw (uno::RuntimeException) 1683 { 1684 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1685 1686 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1687 1688 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 1689 "AccessibleEditableTextPara::getSelectionEnd: index value overflow"); 1690 1691 if( !HaveEditView() ) 1692 return -1; 1693 1694 return OCommonAccessibleText::getSelectionEnd(); 1695 } 1696 1697 sal_Bool SAL_CALL AccessibleEditableTextPara::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 1698 { 1699 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1700 1701 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1702 1703 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 1704 "AccessibleEditableTextPara::setSelection: paragraph index value overflow"); 1705 1706 CheckRange(nStartIndex, nEndIndex); 1707 1708 try 1709 { 1710 SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( sal_True ); 1711 return rCacheVF.SetSelection( MakeSelection(nStartIndex, nEndIndex) ); 1712 } 1713 catch( const uno::RuntimeException& ) 1714 { 1715 return sal_False; 1716 } 1717 } 1718 1719 ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getText() throw (uno::RuntimeException) 1720 { 1721 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1722 1723 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1724 1725 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 1726 "AccessibleEditableTextPara::getText: paragraph index value overflow"); 1727 1728 return OCommonAccessibleText::getText(); 1729 } 1730 1731 ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 1732 { 1733 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 1734 1735 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1736 1737 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 1738 "AccessibleEditableTextPara::getTextRange: paragraph index value overflow"); 1739 1740 return OCommonAccessibleText::getTextRange(nStartIndex, nEndIndex); 1741 } 1742 //IAccessibility2 Implementation 2009----- 1743 void AccessibleEditableTextPara::_correctValues( const sal_Int32 nIndex, 1744 uno::Sequence< PropertyValue >& rValues) 1745 { 1746 SvxTextForwarder& rCacheTF = GetTextForwarder(); 1747 sal_Int32 nRes = rValues.getLength(); 1748 beans::PropertyValue *pRes = rValues.getArray(); 1749 for (sal_Int32 i = 0; i < nRes; ++i) 1750 { 1751 beans::PropertyValue &rRes = pRes[i]; 1752 // Char color 1753 if (rRes.Name.compareTo(::rtl::OUString::createFromAscii("CharColor"))==0) 1754 { 1755 uno::Any &anyChar = rRes.Value; 1756 sal_uInt32 crChar = (sal_uInt32)(anyChar.pReserved); 1757 if (COL_AUTO == crChar ) 1758 { 1759 uno::Reference< ::com::sun::star::accessibility::XAccessibleComponent > xComponent; 1760 if (mxParent.is()) 1761 { 1762 xComponent.set(mxParent,uno::UNO_QUERY); 1763 } 1764 else 1765 { 1766 xComponent.set(m_xAccInfo,uno::UNO_QUERY); 1767 } 1768 if (xComponent.is()) 1769 { 1770 uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > xContext(xComponent,uno::UNO_QUERY); 1771 if (xContext->getAccessibleRole() == AccessibleRole::SHAPE 1772 || xContext->getAccessibleRole() == AccessibleRole::TABLE_CELL) 1773 { 1774 anyChar <<= COL_BLACK; 1775 } 1776 else 1777 { 1778 Color cr(xComponent->getBackground()); 1779 crChar = cr.IsDark() ? COL_WHITE : COL_BLACK; 1780 anyChar <<= crChar; 1781 } 1782 } 1783 } 1784 continue; 1785 } 1786 // Underline 1787 if(rRes.Name.compareTo(::rtl::OUString::createFromAscii("CharUnderline"))==0) 1788 { 1789 /* 1790 // MT: Implement XAccessibleTextMarkup, mark with TextMarkupType::SPELLCHECK. This way done in SW. 1791 if (IsCurrentEditorEnableAutoSpell( mxParent )) 1792 { 1793 try 1794 { 1795 SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( sal_False ); 1796 sal_Bool bWrong = rCacheVF.IsWrongSpelledWordAtPos( GetParagraphIndex(), nIndex ); 1797 if ( bWrong ) 1798 { 1799 uno::Any &anyUnderLine = pRes[9].Value; 1800 // MT IA2: Not needed? sal_uInt16 crUnderLine = (sal_uInt16)(anyUnderLine.pReserved); 1801 anyUnderLine <<= (sal_uInt16)UNDERLINE_WAVE; 1802 } 1803 } 1804 catch( const uno::RuntimeException& ) 1805 { 1806 } 1807 } 1808 */ 1809 continue; 1810 } 1811 // Underline color && Mis-spell 1812 if(rRes.Name.compareTo(::rtl::OUString::createFromAscii("CharUnderlineColor"))==0) 1813 { 1814 uno::Any &anyCharUnderLine = rRes.Value; 1815 sal_uInt32 crCharUnderLine = (sal_uInt32)(anyCharUnderLine.pReserved); 1816 if (COL_AUTO == crCharUnderLine ) 1817 { 1818 uno::Reference< ::com::sun::star::accessibility::XAccessibleComponent > xComponent; 1819 if (mxParent.is()) 1820 { 1821 xComponent.set(mxParent,uno::UNO_QUERY); 1822 } 1823 else 1824 { 1825 xComponent.set(m_xAccInfo,uno::UNO_QUERY); 1826 } 1827 if (xComponent.is()) 1828 { 1829 uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > xContext(xComponent,uno::UNO_QUERY); 1830 if (xContext->getAccessibleRole() == AccessibleRole::SHAPE 1831 || xContext->getAccessibleRole() == AccessibleRole::TABLE_CELL) 1832 { 1833 anyCharUnderLine <<= COL_BLACK; 1834 } 1835 else 1836 { 1837 Color cr(xComponent->getBackground()); 1838 crCharUnderLine = cr.IsDark() ? COL_WHITE : COL_BLACK; 1839 anyCharUnderLine <<= crCharUnderLine; 1840 } 1841 } 1842 } 1843 // MT: Implement XAccessibleTextMarkup, mark with TextMarkupType::SPELLCHECK. This way done in SW. 1844 /* 1845 if (IsCurrentEditorEnableAutoSpell( mxParent )) 1846 { 1847 try 1848 { 1849 SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( sal_False ); 1850 sal_Bool bWrong = rCacheVF.IsWrongSpelledWordAtPos( GetParagraphIndex(), nIndex ); 1851 if ( bWrong ) 1852 { 1853 uno::Any &anyUnderLineColor = rRes.Value; 1854 // MT IA2: Not needed? sal_uInt16 crUnderLineColor = (sal_uInt16)(anyUnderLineColor.pReserved); 1855 anyUnderLineColor <<= COL_LIGHTRED; 1856 } 1857 } 1858 catch( const uno::RuntimeException& ) 1859 { 1860 } 1861 } 1862 */ 1863 continue; 1864 } 1865 // NumberingLevel 1866 if(rRes.Name.compareTo(::rtl::OUString::createFromAscii("NumberingLevel"))==0) 1867 { 1868 const SvxNumBulletItem& rNumBullet = ( SvxNumBulletItem& )rCacheTF.GetParaAttribs(static_cast< sal_uInt16 >(GetParagraphIndex())).Get(EE_PARA_NUMBULLET); 1869 if(rNumBullet.GetNumRule()->GetLevelCount()==0) 1870 { 1871 rRes.Value <<= (sal_Int16)-1; 1872 rRes.Handle = -1; 1873 rRes.State = PropertyState_DIRECT_VALUE; 1874 } 1875 else 1876 { 1877 // SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), 1878 // ImplGetSvxCharAndParaPropertiesMap() ); 1879 // MT IA2 TODO: Check if this is the correct replacement for ImplGetSvxCharAndParaPropertiesMap 1880 SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), ImplGetSvxTextPortionSvxPropertySet() ); 1881 1882 aPropSet.SetSelection( MakeSelection( 0, GetTextLen() ) ); 1883 rRes.Value = aPropSet._getPropertyValue( rRes.Name, mnParagraphIndex ); 1884 rRes.State = aPropSet._getPropertyState( rRes.Name, mnParagraphIndex ); 1885 rRes.Handle = -1; 1886 } 1887 continue; 1888 } 1889 // NumberingRules 1890 if(rRes.Name.compareTo(::rtl::OUString::createFromAscii("NumberingRules"))==0) 1891 { 1892 SfxItemSet aAttribs = rCacheTF.GetParaAttribs( static_cast< sal_uInt16 >(GetParagraphIndex()) ); 1893 sal_Bool bVis = ((const SfxUInt16Item&)aAttribs.Get( EE_PARA_BULLETSTATE )).GetValue() ? sal_True : sal_False; 1894 if(bVis) 1895 { 1896 rRes.Value <<= (sal_Int16)-1; 1897 rRes.Handle = -1; 1898 rRes.State = PropertyState_DIRECT_VALUE; 1899 } 1900 else 1901 { 1902 // MT IA2 TODO: Check if this is the correct replacement for ImplGetSvxCharAndParaPropertiesMap 1903 SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), ImplGetSvxTextPortionSvxPropertySet() ); 1904 aPropSet.SetSelection( MakeSelection( 0, GetTextLen() ) ); 1905 rRes.Value = aPropSet._getPropertyValue( rRes.Name, mnParagraphIndex ); 1906 rRes.State = aPropSet._getPropertyState( rRes.Name, mnParagraphIndex ); 1907 rRes.Handle = -1; 1908 } 1909 continue; 1910 } 1911 } 1912 } 1913 sal_Int32 AccessibleEditableTextPara::SkipField(sal_Int32 nIndex, sal_Bool bForward) 1914 { 1915 sal_Int32 nParaIndex = GetParagraphIndex(); 1916 SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); 1917 sal_Int32 nAllFieldLen = 0; 1918 sal_Int32 nField = rCacheTF.GetFieldCount(sal_uInt16(nParaIndex)), nFoundFieldIndex = -1; 1919 EFieldInfo ree; 1920 sal_Int32 reeBegin=0, reeEnd=0; 1921 for(sal_uInt16 j = 0; j < nField; j++) 1922 { 1923 ree = rCacheTF.GetFieldInfo(sal_uInt16(nParaIndex), j); 1924 reeBegin = ree.aPosition.nIndex + nAllFieldLen; 1925 reeEnd = reeBegin + ree.aCurrentText.Len(); 1926 nAllFieldLen += (ree.aCurrentText.Len() - 1); 1927 if( reeBegin > nIndex ) 1928 { 1929 break; 1930 } 1931 if( nIndex >= reeBegin && nIndex < reeEnd ) 1932 { 1933 if(ree.pFieldItem->GetField()->GetClassId() != SVX_URLFIELD) 1934 { 1935 nFoundFieldIndex = j; 1936 break; 1937 } 1938 } 1939 } 1940 if( nFoundFieldIndex >= 0 ) 1941 { 1942 if( bForward ) 1943 return reeEnd - 1; 1944 else 1945 return reeBegin; 1946 } 1947 return nIndex; 1948 } 1949 sal_Bool AccessibleEditableTextPara::ExtendByField( ::com::sun::star::accessibility::TextSegment& Segment ) 1950 { 1951 sal_Int32 nParaIndex = GetParagraphIndex(); 1952 SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); 1953 sal_Int32 nAllFieldLen = 0; 1954 sal_Int32 nField = rCacheTF.GetFieldCount(sal_uInt16(nParaIndex)), nFoundFieldIndex = -1; 1955 EFieldInfo ree; 1956 sal_Int32 reeBegin=0, reeEnd=0; 1957 for(sal_uInt16 j = 0; j < nField; j++) 1958 { 1959 ree = rCacheTF.GetFieldInfo(sal_uInt16(nParaIndex), j); 1960 reeBegin = ree.aPosition.nIndex + nAllFieldLen; 1961 reeEnd = reeBegin + ree.aCurrentText.Len(); 1962 nAllFieldLen += (ree.aCurrentText.Len() - 1); 1963 if( reeBegin > Segment.SegmentEnd ) 1964 { 1965 break; 1966 } 1967 if( (Segment.SegmentEnd > reeBegin && Segment.SegmentEnd <= reeEnd) || 1968 (Segment.SegmentStart >= reeBegin && Segment.SegmentStart < reeEnd) ) 1969 { 1970 if(ree.pFieldItem->GetField()->GetClassId() != SVX_URLFIELD) 1971 { 1972 nFoundFieldIndex = j; 1973 break; 1974 } 1975 } 1976 } 1977 sal_Bool bExtend = sal_False; 1978 if( nFoundFieldIndex >= 0 ) 1979 { 1980 if( Segment.SegmentEnd < reeEnd ) 1981 { 1982 Segment.SegmentEnd = reeEnd; 1983 bExtend = sal_True; 1984 } 1985 if( Segment.SegmentStart > reeBegin ) 1986 { 1987 Segment.SegmentStart = reeBegin; 1988 bExtend = sal_True; 1989 } 1990 if( bExtend ) 1991 { 1992 //Modified by yanjun for sym2_7393 1993 //If there is a bullet before the field, should add the bullet length into the segment. 1994 EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo(sal_uInt16(nParaIndex)); 1995 int nBulletLen = aBulletInfo.aText.Len(); 1996 if (nBulletLen > 0) 1997 { 1998 Segment.SegmentEnd += nBulletLen; 1999 if (nFoundFieldIndex > 0) 2000 Segment.SegmentStart += nBulletLen; 2001 Segment.SegmentText = GetTextRange(Segment.SegmentStart, Segment.SegmentEnd); 2002 //After get the correct field name, should restore the offset value which don't contain the bullet. 2003 Segment.SegmentEnd -= nBulletLen; 2004 if (nFoundFieldIndex > 0) 2005 Segment.SegmentStart -= nBulletLen; 2006 } 2007 else 2008 Segment.SegmentText = GetTextRange(Segment.SegmentStart, Segment.SegmentEnd); 2009 //End 2010 } 2011 } 2012 return bExtend; 2013 } 2014 //-----IAccessibility2 Implementation 2009 2015 ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) 2016 { 2017 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 2018 2019 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2020 2021 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 2022 "AccessibleEditableTextPara::getTextAtIndex: paragraph index value overflow"); 2023 2024 ::com::sun::star::accessibility::TextSegment aResult; 2025 aResult.SegmentStart = -1; 2026 aResult.SegmentEnd = -1; 2027 2028 switch( aTextType ) 2029 { 2030 //IAccessibility2 Implementation 2009----- 2031 case AccessibleTextType::CHARACTER: 2032 case AccessibleTextType::WORD: 2033 { 2034 aResult = OCommonAccessibleText::getTextAtIndex( nIndex, aTextType ); 2035 ExtendByField( aResult ); 2036 break; 2037 } 2038 //-----IAccessibility2 Implementation 2009 2039 // Not yet handled by OCommonAccessibleText. Missing 2040 // implGetAttributeRunBoundary() method there 2041 case AccessibleTextType::ATTRIBUTE_RUN: 2042 { 2043 const sal_Int32 nTextLen = GetTextForwarder().GetTextLen( static_cast< sal_uInt16 >( GetParagraphIndex() ) ); 2044 2045 if( nIndex == nTextLen ) 2046 { 2047 // #i17014# Special-casing one-behind-the-end character 2048 aResult.SegmentStart = aResult.SegmentEnd = nTextLen; 2049 } 2050 else 2051 { 2052 sal_uInt16 nStartIndex, nEndIndex; 2053 //For the bullet paragraph, the bullet string is ingnored for IAText::attributes() function. 2054 SvxTextForwarder& rCacheTF = GetTextForwarder(); 2055 // MT IA2: Not used? sal_Int32 nBulletLen = 0; 2056 EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); 2057 if (aBulletInfo.bVisible) 2058 nIndex += aBulletInfo.aText.Len(); 2059 if (nIndex != 0 && nIndex >= getCharacterCount()) 2060 nIndex = getCharacterCount()-1; 2061 CheckPosition(nIndex); 2062 if( GetAttributeRun(nStartIndex, nEndIndex, nIndex) ) 2063 { 2064 aResult.SegmentText = GetTextRange(nStartIndex, nEndIndex); 2065 if (aBulletInfo.bVisible) 2066 { 2067 nStartIndex -= aBulletInfo.aText.Len(); 2068 nEndIndex -= aBulletInfo.aText.Len(); 2069 } 2070 aResult.SegmentStart = nStartIndex; 2071 aResult.SegmentEnd = nEndIndex; 2072 } 2073 } 2074 break; 2075 } 2076 //IAccessibility2 Implementation 2009----- 2077 case AccessibleTextType::LINE: 2078 { 2079 SvxTextForwarder& rCacheTF = GetTextForwarder(); 2080 sal_Int32 nParaIndex = GetParagraphIndex(); 2081 // MT IA2: Not needed? sal_Int32 nTextLen = rCacheTF.GetTextLen( static_cast< sal_uInt16 >( nParaIndex ) ); 2082 CheckPosition(nIndex); 2083 if (nIndex != 0 && nIndex == getCharacterCount()) 2084 --nIndex; 2085 sal_uInt16 nLine, nLineCount=rCacheTF.GetLineCount( static_cast< sal_uInt16 >( nParaIndex ) ); 2086 sal_Int32 nCurIndex; 2087 //the problem is that rCacheTF.GetLineLen() will include the bullet length. But for the bullet line, 2088 //the text value doesn't contain the bullet characters. all of the bullet and numbering info are exposed 2089 //by the IAText::attributes(). So here must do special support for bullet line. 2090 sal_Int32 nBulletLen = 0; 2091 for( nLine=0, nCurIndex=0; nLine<nLineCount; ++nLine ) 2092 { 2093 if (nLine == 0) 2094 { 2095 EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(nParaIndex) ); 2096 if (aBulletInfo.bVisible) 2097 { 2098 //in bullet or numbering; 2099 nBulletLen = aBulletInfo.aText.Len(); 2100 } 2101 } 2102 //nCurIndex += rCacheTF.GetLineLen( static_cast< sal_uInt16 >( nParaIndex ), nLine); 2103 sal_Int32 nLineLen = rCacheTF.GetLineLen( static_cast< sal_uInt16 >( nParaIndex ), nLine); 2104 if (nLine == 0) 2105 nCurIndex += nLineLen - nBulletLen; 2106 else 2107 nCurIndex += nLineLen; 2108 if( nCurIndex > nIndex ) 2109 { 2110 if (nLine ==0) 2111 { 2112 //aResult.SegmentStart = nCurIndex - rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine); 2113 aResult.SegmentStart = 0; 2114 aResult.SegmentEnd = nCurIndex; 2115 //aResult.SegmentText = GetTextRange( aResult.SegmentStart, aResult.SegmentEnd ); 2116 aResult.SegmentText = GetTextRange( aResult.SegmentStart, aResult.SegmentEnd + nBulletLen); 2117 break; 2118 } 2119 else 2120 { 2121 //aResult.SegmentStart = nCurIndex - rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine); 2122 aResult.SegmentStart = nCurIndex - nLineLen; 2123 aResult.SegmentEnd = nCurIndex; 2124 //aResult.SegmentText = GetTextRange( aResult.SegmentStart, aResult.SegmentEnd ); 2125 aResult.SegmentText = GetTextRange( aResult.SegmentStart + nBulletLen, aResult.SegmentEnd + nBulletLen); 2126 break; 2127 } 2128 } 2129 } 2130 break; 2131 } 2132 //-----IAccessibility2 Implementation 2009 2133 default: 2134 aResult = OCommonAccessibleText::getTextAtIndex( nIndex, aTextType ); 2135 break; 2136 } /* end of switch( aTextType ) */ 2137 2138 return aResult; 2139 } 2140 2141 ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) 2142 { 2143 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 2144 2145 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2146 2147 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 2148 "AccessibleEditableTextPara::getTextBeforeIndex: paragraph index value overflow"); 2149 2150 ::com::sun::star::accessibility::TextSegment aResult; 2151 aResult.SegmentStart = -1; 2152 aResult.SegmentEnd = -1; 2153 //IAccessibility2 Implementation 2009----- 2154 i18n::Boundary aBoundary; 2155 //-----IAccessibility2 Implementation 2009 2156 switch( aTextType ) 2157 { 2158 // Not yet handled by OCommonAccessibleText. Missing 2159 // implGetAttributeRunBoundary() method there 2160 case AccessibleTextType::ATTRIBUTE_RUN: 2161 { 2162 const sal_Int32 nTextLen = GetTextForwarder().GetTextLen( static_cast< sal_uInt16 >( GetParagraphIndex() ) ); 2163 sal_uInt16 nStartIndex, nEndIndex; 2164 2165 if( nIndex == nTextLen ) 2166 { 2167 // #i17014# Special-casing one-behind-the-end character 2168 if( nIndex > 0 && 2169 GetAttributeRun(nStartIndex, nEndIndex, nIndex-1) ) 2170 { 2171 aResult.SegmentText = GetTextRange(nStartIndex, nEndIndex); 2172 aResult.SegmentStart = nStartIndex; 2173 aResult.SegmentEnd = nEndIndex; 2174 } 2175 } 2176 else 2177 { 2178 if( GetAttributeRun(nStartIndex, nEndIndex, nIndex) ) 2179 { 2180 // already at the left border? If not, query 2181 // one index further left 2182 if( nStartIndex > 0 && 2183 GetAttributeRun(nStartIndex, nEndIndex, nStartIndex-1) ) 2184 { 2185 aResult.SegmentText = GetTextRange(nStartIndex, nEndIndex); 2186 aResult.SegmentStart = nStartIndex; 2187 aResult.SegmentEnd = nEndIndex; 2188 } 2189 } 2190 } 2191 break; 2192 } 2193 //IAccessibility2 Implementation 2009----- 2194 case AccessibleTextType::LINE: 2195 { 2196 SvxTextForwarder& rCacheTF = GetTextForwarder(); 2197 sal_Int32 nParaIndex = GetParagraphIndex(); 2198 // MT IA2 not needed? sal_Int32 nTextLen = rCacheTF.GetTextLen( static_cast< sal_uInt16 >( nParaIndex ) ); 2199 2200 CheckPosition(nIndex); 2201 2202 sal_uInt16 nLine, nLineCount=rCacheTF.GetLineCount( static_cast< sal_uInt16 >( nParaIndex ) ); 2203 //the problem is that rCacheTF.GetLineLen() will include the bullet length. But for the bullet line, 2204 //the text value doesn't contain the bullet characters. all of the bullet and numbering info are exposed 2205 //by the IAText::attributes(). So here must do special support for bullet line. 2206 sal_Int32 nCurIndex=0, nLastIndex=0, nCurLineLen=0; 2207 sal_Int32 nLastLineLen = 0, nBulletLen = 0;; 2208 // get the line before the line the index points into 2209 for( nLine=0, nCurIndex=0, nLastIndex=0; nLine<nLineCount; ++nLine ) 2210 { 2211 nLastIndex = nCurIndex; 2212 if (nLine == 0) 2213 { 2214 EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(nParaIndex) ); 2215 if (aBulletInfo.bVisible) 2216 { 2217 //in bullet or numbering; 2218 nBulletLen = aBulletInfo.aText.Len(); 2219 } 2220 } 2221 if (nLine == 1) 2222 nLastLineLen = nCurLineLen - nBulletLen; 2223 else 2224 nLastLineLen = nCurLineLen; 2225 nCurLineLen = rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine); 2226 //nCurIndex += nCurLineLen; 2227 if (nLine == 0) 2228 nCurIndex += nCurLineLen - nBulletLen; 2229 else 2230 nCurIndex += nCurLineLen; 2231 2232 //if( nCurIndex > nIndex && 2233 //nLastIndex > nCurLineLen ) 2234 if (nCurIndex > nIndex) 2235 { 2236 if (nLine == 0) 2237 { 2238 break; 2239 } 2240 else if (nLine == 1) 2241 { 2242 aResult.SegmentStart = 0; 2243 aResult.SegmentEnd = static_cast< sal_uInt16 >( nLastIndex ); 2244 aResult.SegmentText = GetTextRange( aResult.SegmentStart, aResult.SegmentEnd + nBulletLen); 2245 break; 2246 } 2247 else 2248 { 2249 //aResult.SegmentStart = nLastIndex - nCurLineLen; 2250 aResult.SegmentStart = nLastIndex - nLastLineLen; 2251 aResult.SegmentEnd = static_cast< sal_uInt16 >( nLastIndex ); 2252 aResult.SegmentText = GetTextRange( aResult.SegmentStart + nBulletLen, aResult.SegmentEnd + nBulletLen); 2253 break; 2254 } 2255 } 2256 } 2257 2258 break; 2259 } 2260 case AccessibleTextType::WORD: 2261 { 2262 nIndex = SkipField( nIndex, sal_False); 2263 ::rtl::OUString sText( implGetText() ); 2264 sal_Int32 nLength = sText.getLength(); 2265 2266 // get word at index 2267 implGetWordBoundary( aBoundary, nIndex ); 2268 2269 2270 //sal_Int32 curWordStart = aBoundary.startPos; 2271 //sal_Int32 preWordStart = curWordStart; 2272 sal_Int32 curWordStart , preWordStart; 2273 if( aBoundary.startPos == -1 || aBoundary.startPos > nIndex) 2274 curWordStart = preWordStart = nIndex; 2275 else 2276 curWordStart = preWordStart = aBoundary.startPos; 2277 2278 // get previous word 2279 2280 sal_Bool bWord = sal_False; 2281 2282 //while ( preWordStart > 0 && aBoundary.startPos == curWordStart) 2283 while ( (preWordStart >= 0 && !bWord ) || ( aBoundary.endPos > curWordStart ) ) 2284 { 2285 preWordStart--; 2286 bWord = implGetWordBoundary( aBoundary, preWordStart ); 2287 } 2288 if ( bWord && implIsValidBoundary( aBoundary, nLength ) ) 2289 { 2290 aResult.SegmentText = sText.copy( aBoundary.startPos, aBoundary.endPos - aBoundary.startPos ); 2291 aResult.SegmentStart = aBoundary.startPos; 2292 aResult.SegmentEnd = aBoundary.endPos; 2293 ExtendByField( aResult ); 2294 } 2295 } 2296 break; 2297 case AccessibleTextType::CHARACTER: 2298 { 2299 nIndex = SkipField( nIndex, sal_False); 2300 aResult = OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType ); 2301 ExtendByField( aResult ); 2302 break; 2303 } 2304 //-----IAccessibility2 Implementation 2009 2305 default: 2306 aResult = OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType ); 2307 break; 2308 } /* end of switch( aTextType ) */ 2309 2310 return aResult; 2311 } 2312 2313 ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) 2314 { 2315 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 2316 2317 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2318 2319 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 2320 "AccessibleEditableTextPara::getTextBehindIndex: paragraph index value overflow"); 2321 2322 ::com::sun::star::accessibility::TextSegment aResult; 2323 aResult.SegmentStart = -1; 2324 aResult.SegmentEnd = -1; 2325 //IAccessibility2 Implementation 2009----- 2326 i18n::Boundary aBoundary; 2327 //-----IAccessibility2 Implementation 2009 2328 switch( aTextType ) 2329 { 2330 case AccessibleTextType::ATTRIBUTE_RUN: 2331 { 2332 sal_uInt16 nStartIndex, nEndIndex; 2333 2334 if( GetAttributeRun(nStartIndex, nEndIndex, nIndex) ) 2335 { 2336 // already at the right border? 2337 if( nEndIndex < GetTextLen() ) 2338 { 2339 if( GetAttributeRun(nStartIndex, nEndIndex, nEndIndex) ) 2340 { 2341 aResult.SegmentText = GetTextRange(nStartIndex, nEndIndex); 2342 aResult.SegmentStart = nStartIndex; 2343 aResult.SegmentEnd = nEndIndex; 2344 } 2345 } 2346 } 2347 break; 2348 } 2349 2350 //IAccessibility2 Implementation 2009----- 2351 case AccessibleTextType::LINE: 2352 { 2353 SvxTextForwarder& rCacheTF = GetTextForwarder(); 2354 sal_Int32 nParaIndex = GetParagraphIndex(); 2355 // MT IA2 not needed? sal_Int32 nTextLen = rCacheTF.GetTextLen( static_cast< sal_uInt16 >( nParaIndex ) ); 2356 2357 CheckPosition(nIndex); 2358 2359 sal_uInt16 nLine, nLineCount=rCacheTF.GetLineCount( static_cast< sal_uInt16 >( nParaIndex ) ); 2360 sal_Int32 nCurIndex; 2361 //the problem is that rCacheTF.GetLineLen() will include the bullet length. But for the bullet line, 2362 //the text value doesn't contain the bullet characters. all of the bullet and numbering info are exposed 2363 //by the IAText::attributes(). So here must do special support for bullet line. 2364 sal_Int32 nBulletLen = 0; 2365 // get the line after the line the index points into 2366 for( nLine=0, nCurIndex=0; nLine<nLineCount; ++nLine ) 2367 { 2368 if (nLine == 0) 2369 { 2370 EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(nParaIndex) ); 2371 if (aBulletInfo.bVisible) 2372 { 2373 //in bullet or numbering; 2374 nBulletLen = aBulletInfo.aText.Len(); 2375 } 2376 } 2377 //nCurIndex += rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine); 2378 sal_Int32 nLineLen = rCacheTF.GetLineLen( static_cast< sal_uInt16 >( nParaIndex ), nLine); 2379 2380 if (nLine == 0) 2381 nCurIndex += nLineLen - nBulletLen; 2382 else 2383 nCurIndex += nLineLen; 2384 2385 if( nCurIndex > nIndex && 2386 nLine < nLineCount-1 ) 2387 { 2388 aResult.SegmentStart = nCurIndex; 2389 aResult.SegmentEnd = nCurIndex + rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine+1); 2390 aResult.SegmentText = GetTextRange( aResult.SegmentStart + nBulletLen, aResult.SegmentEnd + nBulletLen); 2391 break; 2392 } 2393 } 2394 2395 break; 2396 } 2397 case AccessibleTextType::WORD: 2398 { 2399 nIndex = SkipField( nIndex, sal_True); 2400 ::rtl::OUString sText( implGetText() ); 2401 sal_Int32 nLength = sText.getLength(); 2402 2403 // get word at index 2404 sal_Bool bWord = implGetWordBoundary( aBoundary, nIndex ); 2405 2406 // real current world 2407 sal_Int32 nextWord = nIndex; 2408 //if( nIndex >= aBoundary.startPos && nIndex <= aBoundary.endPos ) 2409 if( nIndex <= aBoundary.endPos ) 2410 { 2411 nextWord = aBoundary.endPos; 2412 if( sText.getStr()[nextWord] == sal_Unicode(' ') ) nextWord++; 2413 bWord = implGetWordBoundary( aBoundary, nextWord ); 2414 } 2415 2416 if ( bWord && implIsValidBoundary( aBoundary, nLength ) ) 2417 { 2418 aResult.SegmentText = sText.copy( aBoundary.startPos, aBoundary.endPos - aBoundary.startPos ); 2419 aResult.SegmentStart = aBoundary.startPos; 2420 aResult.SegmentEnd = aBoundary.endPos; 2421 2422 // If the end position of aBoundary is inside a field, extend the result to the end of the field 2423 2424 ExtendByField( aResult ); 2425 } 2426 } 2427 break; 2428 2429 case AccessibleTextType::CHARACTER: 2430 { 2431 nIndex = SkipField( nIndex, sal_True); 2432 aResult = OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType ); 2433 ExtendByField( aResult ); 2434 break; 2435 } 2436 //-----IAccessibility2 Implementation 2009 2437 default: 2438 aResult = OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType ); 2439 break; 2440 } /* end of switch( aTextType ) */ 2441 2442 return aResult; 2443 } 2444 2445 sal_Bool SAL_CALL AccessibleEditableTextPara::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 2446 { 2447 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 2448 2449 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2450 2451 try 2452 { 2453 SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( sal_True ); 2454 #if OSL_DEBUG_LEVEL > 0 2455 SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs 2456 (void)rCacheTF; 2457 #else 2458 GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs 2459 #endif 2460 2461 sal_Bool aRetVal; 2462 2463 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 2464 "AccessibleEditableTextPara::copyText: index value overflow"); 2465 2466 CheckRange(nStartIndex, nEndIndex); 2467 2468 //Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet 2469 sal_Int32 nBulletLen = 0; 2470 EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); 2471 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) 2472 nBulletLen = aBulletInfo.aText.Len(); 2473 // save current selection 2474 ESelection aOldSelection; 2475 2476 rCacheVF.GetSelection( aOldSelection ); 2477 //rCacheVF.SetSelection( MakeSelection(nStartIndex, nEndIndex) ); 2478 rCacheVF.SetSelection( MakeSelection(nStartIndex + nBulletLen, nEndIndex + nBulletLen) ); 2479 aRetVal = rCacheVF.Copy(); 2480 rCacheVF.SetSelection( aOldSelection ); // restore 2481 2482 return aRetVal; 2483 } 2484 catch( const uno::RuntimeException& ) 2485 { 2486 return sal_False; 2487 } 2488 } 2489 2490 // XAccessibleEditableText 2491 sal_Bool SAL_CALL AccessibleEditableTextPara::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 2492 { 2493 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 2494 2495 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2496 2497 try 2498 { 2499 SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( sal_True ); 2500 SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs 2501 2502 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 2503 "AccessibleEditableTextPara::cutText: index value overflow"); 2504 2505 CheckRange(nStartIndex, nEndIndex); 2506 2507 // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet 2508 sal_Int32 nBulletLen = 0; 2509 EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); 2510 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) 2511 nBulletLen = aBulletInfo.aText.Len(); 2512 ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen); 2513 //if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) ) 2514 if( !rCacheTF.IsEditable( aSelection ) ) 2515 return sal_False; // non-editable area selected 2516 2517 // don't save selection, might become invalid after cut! 2518 //rCacheVF.SetSelection( MakeSelection(nStartIndex, nEndIndex) ); 2519 rCacheVF.SetSelection( aSelection ); 2520 2521 return rCacheVF.Cut(); 2522 } 2523 catch( const uno::RuntimeException& ) 2524 { 2525 return sal_False; 2526 } 2527 } 2528 2529 sal_Bool SAL_CALL AccessibleEditableTextPara::pasteText( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 2530 { 2531 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 2532 2533 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2534 2535 try 2536 { 2537 SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( sal_True ); 2538 SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs 2539 2540 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 2541 "AccessibleEditableTextPara::pasteText: index value overflow"); 2542 2543 CheckPosition(nIndex); 2544 2545 // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet 2546 sal_Int32 nBulletLen = 0; 2547 EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); 2548 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) 2549 nBulletLen = aBulletInfo.aText.Len(); 2550 //if( !rCacheTF.IsEditable( MakeSelection(nIndex) ) ) 2551 if( !rCacheTF.IsEditable( MakeSelection(nIndex + nBulletLen) ) ) 2552 return sal_False; // non-editable area selected 2553 2554 // #104400# set empty selection (=> cursor) to given index 2555 //rCacheVF.SetSelection( MakeCursor(nIndex) ); 2556 rCacheVF.SetSelection( MakeCursor(nIndex + nBulletLen) ); 2557 2558 return rCacheVF.Paste(); 2559 } 2560 catch( const uno::RuntimeException& ) 2561 { 2562 return sal_False; 2563 } 2564 } 2565 2566 sal_Bool SAL_CALL AccessibleEditableTextPara::deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 2567 { 2568 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 2569 2570 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2571 2572 try 2573 { 2574 // #102710# Request edit view when doing changes 2575 // AccessibleEmptyEditSource relies on this behaviour 2576 GetEditViewForwarder( sal_True ); 2577 SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs 2578 2579 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 2580 "AccessibleEditableTextPara::deleteText: index value overflow"); 2581 2582 CheckRange(nStartIndex, nEndIndex); 2583 2584 // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet 2585 sal_Int32 nBulletLen = 0; 2586 EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); 2587 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) 2588 nBulletLen = aBulletInfo.aText.Len(); 2589 ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen); 2590 2591 //if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) ) 2592 if( !rCacheTF.IsEditable( aSelection ) ) 2593 return sal_False; // non-editable area selected 2594 2595 //sal_Bool bRet = rCacheTF.Delete( MakeSelection(nStartIndex, nEndIndex) ); 2596 sal_Bool bRet = rCacheTF.Delete( aSelection ); 2597 2598 GetEditSource().UpdateData(); 2599 2600 return bRet; 2601 } 2602 catch( const uno::RuntimeException& ) 2603 { 2604 return sal_False; 2605 } 2606 } 2607 2608 sal_Bool SAL_CALL AccessibleEditableTextPara::insertText( const ::rtl::OUString& sText, sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 2609 { 2610 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 2611 2612 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2613 2614 try 2615 { 2616 // #102710# Request edit view when doing changes 2617 // AccessibleEmptyEditSource relies on this behaviour 2618 GetEditViewForwarder( sal_True ); 2619 SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs 2620 2621 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 2622 "AccessibleEditableTextPara::insertText: index value overflow"); 2623 2624 CheckPosition(nIndex); 2625 2626 // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet 2627 sal_Int32 nBulletLen = 0; 2628 EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); 2629 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) 2630 nBulletLen = aBulletInfo.aText.Len(); 2631 2632 //if( !rCacheTF.IsEditable( MakeSelection(nIndex) ) ) 2633 if( !rCacheTF.IsEditable( MakeSelection(nIndex + nBulletLen) ) ) 2634 return sal_False; // non-editable area selected 2635 2636 // #104400# insert given text at empty selection (=> cursor) 2637 //sal_Bool bRet = rCacheTF.InsertText( sText, MakeCursor(nIndex) ); 2638 sal_Bool bRet = rCacheTF.InsertText( sText, MakeCursor(nIndex + nBulletLen) ); 2639 2640 rCacheTF.QuickFormatDoc(); 2641 GetEditSource().UpdateData(); 2642 2643 return bRet; 2644 } 2645 catch( const uno::RuntimeException& ) 2646 { 2647 return sal_False; 2648 } 2649 } 2650 2651 sal_Bool SAL_CALL AccessibleEditableTextPara::replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::rtl::OUString& sReplacement ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 2652 { 2653 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 2654 2655 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2656 2657 try 2658 { 2659 // #102710# Request edit view when doing changes 2660 // AccessibleEmptyEditSource relies on this behaviour 2661 GetEditViewForwarder( sal_True ); 2662 SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs 2663 2664 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 2665 "AccessibleEditableTextPara::replaceText: index value overflow"); 2666 2667 CheckRange(nStartIndex, nEndIndex); 2668 2669 // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet 2670 sal_Int32 nBulletLen = 0; 2671 EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) ); 2672 if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible ) 2673 nBulletLen = aBulletInfo.aText.Len(); 2674 ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen); 2675 2676 //if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) ) 2677 if( !rCacheTF.IsEditable( aSelection ) ) 2678 return sal_False; // non-editable area selected 2679 2680 // insert given text into given range => replace 2681 //sal_Bool bRet = rCacheTF.InsertText( sReplacement, MakeSelection(nStartIndex, nEndIndex) ); 2682 sal_Bool bRet = rCacheTF.InsertText( sReplacement, aSelection ); 2683 2684 rCacheTF.QuickFormatDoc(); 2685 GetEditSource().UpdateData(); 2686 2687 return bRet; 2688 } 2689 catch( const uno::RuntimeException& ) 2690 { 2691 return sal_False; 2692 } 2693 } 2694 2695 sal_Bool SAL_CALL AccessibleEditableTextPara::setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const uno::Sequence< beans::PropertyValue >& aAttributeSet ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 2696 { 2697 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 2698 2699 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2700 2701 try 2702 { 2703 // #102710# Request edit view when doing changes 2704 // AccessibleEmptyEditSource relies on this behaviour 2705 GetEditViewForwarder( sal_True ); 2706 SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs 2707 sal_uInt16 nPara = static_cast< sal_uInt16 >( GetParagraphIndex() ); 2708 2709 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 2710 "AccessibleEditableTextPara::setAttributes: index value overflow"); 2711 2712 CheckRange(nStartIndex, nEndIndex); 2713 2714 if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) ) 2715 return sal_False; // non-editable area selected 2716 2717 // do the indices span the whole paragraph? Then use the outliner map 2718 // TODO: hold it as a member? 2719 SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), 2720 0 == nStartIndex && 2721 rCacheTF.GetTextLen(nPara) == nEndIndex ? 2722 ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() : 2723 ImplGetSvxTextPortionSvxPropertySet() ); 2724 2725 aPropSet.SetSelection( MakeSelection(nStartIndex, nEndIndex) ); 2726 2727 // convert from PropertyValue to Any 2728 sal_Int32 i, nLength( aAttributeSet.getLength() ); 2729 const beans::PropertyValue* pPropArray = aAttributeSet.getConstArray(); 2730 for(i=0; i<nLength; ++i) 2731 { 2732 try 2733 { 2734 aPropSet.setPropertyValue(pPropArray->Name, pPropArray->Value); 2735 } 2736 catch( const uno::Exception& ) 2737 { 2738 DBG_ERROR("AccessibleEditableTextPara::setAttributes exception in setPropertyValue"); 2739 } 2740 2741 ++pPropArray; 2742 } 2743 2744 rCacheTF.QuickFormatDoc(); 2745 GetEditSource().UpdateData(); 2746 2747 return sal_True; 2748 } 2749 catch( const uno::RuntimeException& ) 2750 { 2751 return sal_False; 2752 } 2753 } 2754 2755 sal_Bool SAL_CALL AccessibleEditableTextPara::setText( const ::rtl::OUString& sText ) throw (uno::RuntimeException) 2756 { 2757 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 2758 2759 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2760 2761 return replaceText(0, getCharacterCount(), sText); 2762 } 2763 2764 // XAccessibleTextAttributes 2765 uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleEditableTextPara::getDefaultAttributes( 2766 const uno::Sequence< ::rtl::OUString >& rRequestedAttributes ) 2767 throw (uno::RuntimeException) 2768 { 2769 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 2770 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2771 2772 #if OSL_DEBUG_LEVEL > 0 2773 SvxAccessibleTextAdapter& rCacheTF = 2774 #endif 2775 GetTextForwarder(); 2776 2777 #if OSL_DEBUG_LEVEL > 0 2778 (void)rCacheTF; 2779 #endif 2780 2781 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 2782 "AccessibleEditableTextPara::getCharacterAttributes: index value overflow"); 2783 2784 // get XPropertySetInfo for paragraph attributes and 2785 // character attributes that span all the paragraphs text. 2786 SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), 2787 ImplGetSvxCharAndParaPropertiesSet() ); 2788 aPropSet.SetSelection( MakeSelection( 0, GetTextLen() ) ); 2789 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = aPropSet.getPropertySetInfo(); 2790 if (!xPropSetInfo.is()) 2791 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot query XPropertySetInfo")), 2792 uno::Reference< uno::XInterface > 2793 ( static_cast< XAccessible* > (this) ) ); // disambiguate hierarchy 2794 2795 // build sequence of available properties to check 2796 sal_Int32 nLenReqAttr = rRequestedAttributes.getLength(); 2797 uno::Sequence< beans::Property > aProperties; 2798 if (nLenReqAttr) 2799 { 2800 const rtl::OUString *pRequestedAttributes = rRequestedAttributes.getConstArray(); 2801 2802 aProperties.realloc( nLenReqAttr ); 2803 beans::Property *pProperties = aProperties.getArray(); 2804 sal_Int32 nCurLen = 0; 2805 for (sal_Int32 i = 0; i < nLenReqAttr; ++i) 2806 { 2807 beans::Property aProp; 2808 try 2809 { 2810 aProp = xPropSetInfo->getPropertyByName( pRequestedAttributes[i] ); 2811 } 2812 catch (beans::UnknownPropertyException &) 2813 { 2814 continue; 2815 } 2816 pProperties[ nCurLen++ ] = aProp; 2817 } 2818 aProperties.realloc( nCurLen ); 2819 } 2820 else 2821 aProperties = xPropSetInfo->getProperties(); 2822 2823 sal_Int32 nLength = aProperties.getLength(); 2824 const beans::Property *pProperties = aProperties.getConstArray(); 2825 2826 // build resulting sequence 2827 uno::Sequence< beans::PropertyValue > aOutSequence( nLength ); 2828 beans::PropertyValue* pOutSequence = aOutSequence.getArray(); 2829 sal_Int32 nOutLen = 0; 2830 for (sal_Int32 i = 0; i < nLength; ++i) 2831 { 2832 // calling implementation functions: 2833 // _getPropertyState and _getPropertyValue (see below) to provide 2834 // the proper paragraph number when retrieving paragraph attributes 2835 PropertyState eState = aPropSet._getPropertyState( pProperties->Name, mnParagraphIndex ); 2836 if ( eState == PropertyState_AMBIGUOUS_VALUE ) 2837 { 2838 OSL_ENSURE( false, "ambiguous property value encountered" ); 2839 } 2840 2841 //if (eState == PropertyState_DIRECT_VALUE) 2842 // per definition all paragraph properties and all character 2843 // properties spanning the whole paragraph should be returned 2844 // and declared as default value 2845 { 2846 pOutSequence->Name = pProperties->Name; 2847 pOutSequence->Handle = pProperties->Handle; 2848 pOutSequence->Value = aPropSet._getPropertyValue( pProperties->Name, mnParagraphIndex ); 2849 pOutSequence->State = PropertyState_DEFAULT_VALUE; 2850 2851 ++pOutSequence; 2852 ++nOutLen; 2853 } 2854 ++pProperties; 2855 } 2856 aOutSequence.realloc( nOutLen ); 2857 2858 return aOutSequence; 2859 } 2860 2861 2862 uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleEditableTextPara::getRunAttributes( 2863 sal_Int32 nIndex, 2864 const uno::Sequence< ::rtl::OUString >& rRequestedAttributes ) 2865 throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 2866 { 2867 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 2868 2869 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2870 2871 #if OSL_DEBUG_LEVEL > 0 2872 SvxAccessibleTextAdapter& rCacheTF = 2873 #endif 2874 GetTextForwarder(); 2875 2876 #if OSL_DEBUG_LEVEL > 0 2877 (void)rCacheTF; 2878 #endif 2879 2880 DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX, 2881 "AccessibleEditableTextPara::getCharacterAttributes: index value overflow"); 2882 2883 if( getCharacterCount() > 0 ) 2884 CheckIndex(nIndex); 2885 else 2886 CheckPosition(nIndex); 2887 2888 SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), 2889 ImplGetSvxCharAndParaPropertiesSet() ); 2890 aPropSet.SetSelection( MakeSelection( nIndex ) ); 2891 uno::Reference< beans::XPropertySetInfo > xPropSetInfo = aPropSet.getPropertySetInfo(); 2892 if (!xPropSetInfo.is()) 2893 throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Cannot query XPropertySetInfo")), 2894 uno::Reference< uno::XInterface > 2895 ( static_cast< XAccessible* > (this) ) ); // disambiguate hierarchy 2896 2897 // build sequence of available properties to check 2898 sal_Int32 nLenReqAttr = rRequestedAttributes.getLength(); 2899 uno::Sequence< beans::Property > aProperties; 2900 if (nLenReqAttr) 2901 { 2902 const rtl::OUString *pRequestedAttributes = rRequestedAttributes.getConstArray(); 2903 2904 aProperties.realloc( nLenReqAttr ); 2905 beans::Property *pProperties = aProperties.getArray(); 2906 sal_Int32 nCurLen = 0; 2907 for (sal_Int32 i = 0; i < nLenReqAttr; ++i) 2908 { 2909 beans::Property aProp; 2910 try 2911 { 2912 aProp = xPropSetInfo->getPropertyByName( pRequestedAttributes[i] ); 2913 } 2914 catch (beans::UnknownPropertyException &) 2915 { 2916 continue; 2917 } 2918 pProperties[ nCurLen++ ] = aProp; 2919 } 2920 aProperties.realloc( nCurLen ); 2921 } 2922 else 2923 aProperties = xPropSetInfo->getProperties(); 2924 2925 sal_Int32 nLength = aProperties.getLength(); 2926 const beans::Property *pProperties = aProperties.getConstArray(); 2927 2928 // build resulting sequence 2929 uno::Sequence< beans::PropertyValue > aOutSequence( nLength ); 2930 beans::PropertyValue* pOutSequence = aOutSequence.getArray(); 2931 sal_Int32 nOutLen = 0; 2932 for (sal_Int32 i = 0; i < nLength; ++i) 2933 { 2934 // calling 'regular' functions that will operate on the selection 2935 PropertyState eState = aPropSet.getPropertyState( pProperties->Name ); 2936 if (eState == PropertyState_DIRECT_VALUE) 2937 { 2938 pOutSequence->Name = pProperties->Name; 2939 pOutSequence->Handle = pProperties->Handle; 2940 pOutSequence->Value = aPropSet.getPropertyValue( pProperties->Name ); 2941 pOutSequence->State = eState; 2942 2943 ++pOutSequence; 2944 ++nOutLen; 2945 } 2946 ++pProperties; 2947 } 2948 aOutSequence.realloc( nOutLen ); 2949 2950 return aOutSequence; 2951 } 2952 2953 // XAccessibleHypertext 2954 ::sal_Int32 SAL_CALL AccessibleEditableTextPara::getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException) 2955 { 2956 SvxAccessibleTextAdapter& rT = GetTextForwarder(); 2957 const sal_Int32 nPara = GetParagraphIndex(); 2958 2959 sal_uInt16 nHyperLinks = 0; 2960 sal_uInt16 nFields = rT.GetFieldCount( nPara ); 2961 for ( sal_uInt16 n = 0; n < nFields; n++ ) 2962 { 2963 EFieldInfo aField = rT.GetFieldInfo( nPara, n ); 2964 if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) 2965 nHyperLinks++; 2966 } 2967 return nHyperLinks; 2968 } 2969 2970 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL AccessibleEditableTextPara::getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 2971 { 2972 ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > xRef; 2973 2974 SvxAccessibleTextAdapter& rT = GetTextForwarder(); 2975 const sal_Int32 nPara = GetParagraphIndex(); 2976 2977 sal_uInt16 nHyperLink = 0; 2978 sal_uInt16 nFields = rT.GetFieldCount( nPara ); 2979 for ( sal_uInt16 n = 0; n < nFields; n++ ) 2980 { 2981 EFieldInfo aField = rT.GetFieldInfo( nPara, n ); 2982 if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) 2983 { 2984 if ( nHyperLink == nLinkIndex ) 2985 { 2986 sal_uInt16 nEEStart = aField.aPosition.nIndex; 2987 2988 // Translate EE Index to accessible index 2989 sal_uInt16 nStart = rT.CalcEditEngineIndex( nPara, nEEStart ); 2990 sal_uInt16 nEnd = nStart + aField.aCurrentText.Len(); 2991 xRef = new AccessibleHyperlink( rT, new SvxFieldItem( *aField.pFieldItem ), nPara, nEEStart, nStart, nEnd, aField.aCurrentText ); 2992 break; 2993 } 2994 nHyperLink++; 2995 } 2996 } 2997 2998 return xRef; 2999 } 3000 3001 ::sal_Int32 SAL_CALL AccessibleEditableTextPara::getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 3002 { 3003 const sal_Int32 nPara = GetParagraphIndex(); 3004 SvxAccessibleTextAdapter& rT = GetTextForwarder(); 3005 3006 // SvxAccessibleTextIndex aIndex; 3007 // aIndex.SetIndex(nPara, nCharIndex, rT); 3008 // const sal_uInt16 nEEIndex = aIndex.GetEEIndex(); 3009 3010 const sal_uInt16 nEEIndex = rT.CalcEditEngineIndex( nPara, nCharIndex ); 3011 sal_Int32 nHLIndex = 0; 3012 sal_uInt16 nHyperLink = 0; 3013 sal_uInt16 nFields = rT.GetFieldCount( nPara ); 3014 for ( sal_uInt16 n = 0; n < nFields; n++ ) 3015 { 3016 EFieldInfo aField = rT.GetFieldInfo( nPara, n ); 3017 if ( aField.pFieldItem->GetField()->ISA( SvxURLField ) ) 3018 { 3019 if ( aField.aPosition.nIndex == nEEIndex ) 3020 { 3021 nHLIndex = nHyperLink; 3022 break; 3023 } 3024 nHyperLink++; 3025 } 3026 } 3027 3028 return nHLIndex; 3029 } 3030 3031 // XAccessibleMultiLineText 3032 sal_Int32 SAL_CALL AccessibleEditableTextPara::getLineNumberAtIndex( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 3033 { 3034 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 3035 3036 sal_Int32 nRes = -1; 3037 sal_Int32 nPara = GetParagraphIndex(); 3038 3039 SvxTextForwarder &rCacheTF = GetTextForwarder(); 3040 const bool bValidPara = 0 <= nPara && nPara < rCacheTF.GetParagraphCount(); 3041 DBG_ASSERT( bValidPara, "getLineNumberAtIndex: current paragraph index out of range" ); 3042 if (bValidPara) 3043 { 3044 // we explicitly allow for the index to point at the character right behind the text 3045 if (0 <= nIndex && nIndex <= rCacheTF.GetTextLen( static_cast< sal_uInt16 >(nPara) )) 3046 nRes = rCacheTF.GetLineNumberAtIndex( static_cast< sal_uInt16 >(nPara), static_cast< sal_uInt16 >(nIndex) ); 3047 else 3048 throw lang::IndexOutOfBoundsException(); 3049 } 3050 return nRes; 3051 } 3052 3053 // XAccessibleMultiLineText 3054 ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextAtLineNumber( sal_Int32 nLineNo ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 3055 { 3056 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 3057 3058 ::com::sun::star::accessibility::TextSegment aResult; 3059 sal_Int32 nPara = GetParagraphIndex(); 3060 SvxTextForwarder &rCacheTF = GetTextForwarder(); 3061 const bool bValidPara = 0 <= nPara && nPara < rCacheTF.GetParagraphCount(); 3062 DBG_ASSERT( bValidPara, "getTextAtLineNumber: current paragraph index out of range" ); 3063 if (bValidPara) 3064 { 3065 if (0 <= nLineNo && nLineNo < rCacheTF.GetLineCount( static_cast< sal_uInt16 >(nPara) )) 3066 { 3067 sal_uInt16 nStart = 0, nEnd = 0; 3068 rCacheTF.GetLineBoundaries( nStart, nEnd, static_cast< sal_uInt16 >(nPara), static_cast< sal_uInt16 >(nLineNo) ); 3069 if (nStart != 0xFFFF && nEnd != 0xFFFF) 3070 { 3071 try 3072 { 3073 aResult.SegmentText = getTextRange( nStart, nEnd ); 3074 aResult.SegmentStart = nStart; 3075 aResult.SegmentEnd = nEnd; 3076 } 3077 catch (lang::IndexOutOfBoundsException) 3078 { 3079 // this is not the exception that should be raised in this function ... 3080 DBG_ASSERT( 0, "unexpected exception" ); 3081 } 3082 } 3083 } 3084 else 3085 throw lang::IndexOutOfBoundsException(); 3086 } 3087 return aResult; 3088 } 3089 3090 // XAccessibleMultiLineText 3091 ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextAtLineWithCaret( ) throw (uno::RuntimeException) 3092 { 3093 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 3094 3095 ::com::sun::star::accessibility::TextSegment aResult; 3096 try 3097 { 3098 aResult = getTextAtLineNumber( getNumberOfLineWithCaret() ); 3099 } 3100 catch (lang::IndexOutOfBoundsException &) 3101 { 3102 // this one needs to be catched since this interface does not allow for it. 3103 } 3104 return aResult; 3105 } 3106 3107 // XAccessibleMultiLineText 3108 sal_Int32 SAL_CALL AccessibleEditableTextPara::getNumberOfLineWithCaret( ) throw (uno::RuntimeException) 3109 { 3110 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 3111 3112 sal_Int32 nRes = -1; 3113 try 3114 { 3115 nRes = getLineNumberAtIndex( getCaretPosition() ); 3116 } 3117 catch (lang::IndexOutOfBoundsException &) 3118 { 3119 // this one needs to be catched since this interface does not allow for it. 3120 } 3121 return nRes; 3122 } 3123 3124 3125 // XServiceInfo 3126 ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getImplementationName (void) throw (uno::RuntimeException) 3127 { 3128 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 3129 3130 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("AccessibleEditableTextPara")); 3131 } 3132 3133 sal_Bool SAL_CALL AccessibleEditableTextPara::supportsService (const ::rtl::OUString& sServiceName) throw (uno::RuntimeException) 3134 { 3135 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 3136 3137 // Iterate over all supported service names and return true if on of them 3138 // matches the given name. 3139 uno::Sequence< ::rtl::OUString> aSupportedServices ( 3140 getSupportedServiceNames ()); 3141 for (int i=0; i<aSupportedServices.getLength(); i++) 3142 if (sServiceName == aSupportedServices[i]) 3143 return sal_True; 3144 return sal_False; 3145 } 3146 3147 uno::Sequence< ::rtl::OUString> SAL_CALL AccessibleEditableTextPara::getSupportedServiceNames (void) throw (uno::RuntimeException) 3148 { 3149 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 3150 3151 const ::rtl::OUString sServiceName( getServiceName() ); 3152 return uno::Sequence< ::rtl::OUString > (&sServiceName, 1); 3153 } 3154 3155 // XServiceName 3156 ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getServiceName (void) throw (uno::RuntimeException) 3157 { 3158 DBG_CHKTHIS( AccessibleEditableTextPara, NULL ); 3159 3160 // #105185# Using correct service now 3161 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.AccessibleParagraphView")); 3162 } 3163 3164 } // end of namespace accessibility 3165 3166 //------------------------------------------------------------------------ 3167