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