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 <functional> 37 #include <boost/bind.hpp> 38 #include <vos/mutex.hxx> 39 #include <vcl/window.hxx> 40 #include <vcl/svapp.hxx> 41 #include <comphelper/sequenceasvector.hxx> 42 #include <com/sun/star/uno/Any.hxx> 43 #include <com/sun/star/uno/Reference.hxx> 44 #include <com/sun/star/awt/Point.hpp> 45 #include <com/sun/star/awt/Rectangle.hpp> 46 #include <com/sun/star/accessibility/AccessibleTextType.hpp> 47 48 //------------------------------------------------------------------------ 49 // 50 // Project-local header 51 // 52 //------------------------------------------------------------------------ 53 54 #include <editeng/editdata.hxx> 55 #include <editeng/unopracc.hxx> 56 #include "editeng/unoedprx.hxx" 57 #include <editeng/AccessibleStaticTextBase.hxx> 58 #include "editeng/AccessibleEditableTextPara.hxx" 59 60 61 using namespace ::com::sun::star; 62 using namespace ::com::sun::star::accessibility; 63 64 /* TODO: 65 ===== 66 67 - separate adapter functionality from AccessibleStaticText class 68 69 - refactor common loops into templates, using mem_fun 70 71 */ 72 73 namespace accessibility 74 { 75 typedef ::comphelper::SequenceAsVector< beans::PropertyValue > PropertyValueVector; 76 77 class PropertyValueEqualFunctor 78 { 79 public: 80 typedef beans::PropertyValue first_argument_type; 81 typedef beans::PropertyValue second_argument_type; 82 typedef bool result_type; PropertyValueEqualFunctor()83 PropertyValueEqualFunctor() 84 {} operator ()(const beans::PropertyValue & lhs,const beans::PropertyValue & rhs) const85 bool operator() ( const beans::PropertyValue& lhs, const beans::PropertyValue& rhs ) const 86 { 87 return ( lhs.Name == rhs.Name && lhs.Value == rhs.Value ); 88 } 89 }; 90 sal_Unicode cNewLine(0x0a); 91 //------------------------------------------------------------------------ 92 // 93 // Static Helper 94 // 95 //------------------------------------------------------------------------ MakeSelection(sal_Int32 nStartPara,sal_Int32 nStartIndex,sal_Int32 nEndPara,sal_Int32 nEndIndex)96 ESelection MakeSelection( sal_Int32 nStartPara, sal_Int32 nStartIndex, 97 sal_Int32 nEndPara, sal_Int32 nEndIndex ) 98 { 99 DBG_ASSERT(nStartPara >= 0 && nStartPara <= USHRT_MAX && 100 nStartIndex >= 0 && nStartIndex <= USHRT_MAX && 101 nEndPara >= 0 && nEndPara <= USHRT_MAX && 102 nEndIndex >= 0 && nEndIndex <= USHRT_MAX , 103 "AccessibleStaticTextBase_Impl::MakeSelection: index value overflow"); 104 105 return ESelection( nStartPara, static_cast< sal_uInt16 >(nStartIndex), 106 nEndPara, static_cast< sal_uInt16 >(nEndIndex) ); 107 } 108 109 //------------------------------------------------------------------------ 110 // 111 // AccessibleStaticTextBase_Impl declaration 112 // 113 //------------------------------------------------------------------------ 114 115 DBG_NAME( AccessibleStaticTextBase_Impl ); 116 117 /** AccessibleStaticTextBase_Impl 118 119 This class implements the AccessibleStaticTextBase 120 functionality, mainly by forwarding the calls to an aggregated 121 AccessibleEditableTextPara. As this is a therefore non-trivial 122 adapter, factoring out the common functionality from 123 AccessibleEditableTextPara might be a profitable future task. 124 */ 125 class AccessibleStaticTextBase_Impl 126 { 127 friend class AccessibleStaticTextBase; 128 public: 129 130 // receive pointer to our frontend class and view window 131 AccessibleStaticTextBase_Impl(); 132 ~AccessibleStaticTextBase_Impl(); 133 GetEditSource() const134 SvxEditSourceAdapter& GetEditSource() const 135 { 136 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 137 138 return maEditSource; 139 } 140 void SetEditSource( ::std::unique_ptr< SvxEditSource > pEditSource ); 141 SetEventSource(const uno::Reference<XAccessible> & rInterface)142 void SetEventSource( const uno::Reference< XAccessible >& rInterface ) 143 { 144 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 145 146 mxThis = rInterface; 147 } GetEventSource() const148 uno::Reference< XAccessible > GetEventSource() const 149 { 150 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 151 152 return mxThis; 153 } 154 155 void SetOffset( const Point& ); GetOffset() const156 Point GetOffset() const 157 { 158 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 159 160 ::osl::MutexGuard aGuard( maMutex ); Point aPoint( maOffset ); 161 return aPoint; 162 } 163 164 void UpdateChildren(); 165 void Dispose(); 166 167 #ifdef DBG_UTIL 168 void CheckInvariants() const; 169 #endif 170 171 AccessibleEditableTextPara& GetParagraph( sal_Int32 nPara ) const; 172 sal_Int32 GetParagraphCount() const; 173 sal_Int32 GetParagraphIndex() const; 174 sal_Int32 GetLineCount( sal_Int32 nParagraph ) const; 175 Index2Internal(sal_Int32 nFlatIndex) const176 EPosition Index2Internal( sal_Int32 nFlatIndex ) const 177 { 178 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 179 180 return ImpCalcInternal( nFlatIndex, false ); 181 } 182 Range2Internal(sal_Int32 nFlatIndex) const183 EPosition Range2Internal( sal_Int32 nFlatIndex ) const 184 { 185 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 186 187 return ImpCalcInternal( nFlatIndex, true ); 188 } 189 190 sal_Int32 Internal2Index( EPosition nEEIndex ) const; 191 192 void CorrectTextSegment( TextSegment& aTextSegment, 193 int nPara ) const; 194 195 sal_Bool SetSelection( sal_Int32 nStartPara, sal_Int32 nStartIndex, 196 sal_Int32 nEndPara, sal_Int32 nEndIndex ); 197 sal_Bool CopyText( sal_Int32 nStartPara, sal_Int32 nStartIndex, 198 sal_Int32 nEndPara, sal_Int32 nEndIndex ); 199 200 Rectangle GetParagraphBoundingBox() const; 201 sal_Bool RemoveLineBreakCount( sal_Int32& rIndex ); 202 203 private: 204 205 EPosition ImpCalcInternal( sal_Int32 nFlatIndex, bool bExclusive ) const; 206 207 // our frontend class (the one implementing the actual 208 // interface). That's not necessarily the one containing the impl 209 // pointer 210 uno::Reference< XAccessible > mxThis; 211 212 // implements our functionality, we're just an adapter (guarded by solar mutex) 213 mutable AccessibleEditableTextPara* mpTextParagraph; 214 215 uno::Reference< XAccessible > mxParagraph; 216 217 // a wrapper for the text forwarders (guarded by solar mutex) 218 mutable SvxEditSourceAdapter maEditSource; 219 220 // guard for maOffset 221 mutable ::osl::Mutex maMutex; 222 223 /// our current offset to the containing shape/cell (guarded by maMutex) 224 Point maOffset; 225 226 }; 227 228 //------------------------------------------------------------------------ 229 // 230 // AccessibleStaticTextBase_Impl implementation 231 // 232 //------------------------------------------------------------------------ 233 AccessibleStaticTextBase_Impl()234 AccessibleStaticTextBase_Impl::AccessibleStaticTextBase_Impl() : 235 mxThis( NULL ), 236 mpTextParagraph( new AccessibleEditableTextPara(NULL) ), 237 mxParagraph( mpTextParagraph ), 238 maEditSource(), 239 maMutex(), 240 maOffset(0,0) 241 { 242 DBG_CTOR( AccessibleStaticTextBase_Impl, NULL ); 243 244 // TODO: this is still somewhat of a hack, all the more since 245 // now the maTextParagraph has an empty parent reference set 246 } 247 ~AccessibleStaticTextBase_Impl()248 AccessibleStaticTextBase_Impl::~AccessibleStaticTextBase_Impl() 249 { 250 DBG_DTOR( AccessibleStaticTextBase_Impl, NULL ); 251 } 252 SetEditSource(::std::unique_ptr<SvxEditSource> pEditSource)253 void AccessibleStaticTextBase_Impl::SetEditSource( ::std::unique_ptr< SvxEditSource > pEditSource ) 254 { 255 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 256 257 maEditSource.SetEditSource( std::move(pEditSource) ); 258 if( mpTextParagraph ) 259 mpTextParagraph->SetEditSource( &maEditSource ); 260 } 261 SetOffset(const Point & rPoint)262 void AccessibleStaticTextBase_Impl::SetOffset( const Point& rPoint ) 263 { 264 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 265 266 // guard against non-atomic access to maOffset data structure 267 { 268 ::osl::MutexGuard aGuard( maMutex ); 269 maOffset = rPoint; 270 } 271 272 if( mpTextParagraph ) 273 mpTextParagraph->SetEEOffset( rPoint ); 274 275 // in all cases, check visibility afterwards. 276 UpdateChildren(); 277 } 278 UpdateChildren()279 void AccessibleStaticTextBase_Impl::UpdateChildren() 280 { 281 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 282 283 // currently no children 284 } 285 Dispose()286 void AccessibleStaticTextBase_Impl::Dispose() 287 { 288 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 289 290 // we're the owner of the paragraph, so destroy it, too 291 if( mpTextParagraph ) 292 mpTextParagraph->Dispose(); 293 294 // drop references 295 mxParagraph = NULL; 296 mxThis = NULL; 297 mpTextParagraph = NULL; 298 } 299 300 #ifdef DBG_UTIL CheckInvariants() const301 void AccessibleStaticTextBase_Impl::CheckInvariants() const 302 { 303 // TODO 304 } 305 #endif 306 GetParagraph(sal_Int32 nPara) const307 AccessibleEditableTextPara& AccessibleStaticTextBase_Impl::GetParagraph( sal_Int32 nPara ) const 308 { 309 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 310 311 if( !mpTextParagraph ) 312 throw lang::DisposedException ( 313 ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")), mxThis ); 314 315 // TODO: Have a different method on AccessibleEditableTextPara 316 // that does not care about state changes 317 mpTextParagraph->SetParagraphIndex( nPara ); 318 319 return *mpTextParagraph; 320 } 321 GetParagraphCount() const322 sal_Int32 AccessibleStaticTextBase_Impl::GetParagraphCount() const 323 { 324 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 325 326 if( !mpTextParagraph ) 327 return 0; 328 else 329 return mpTextParagraph->GetTextForwarder().GetParagraphCount(); 330 } 331 GetParagraphIndex() const332 sal_Int32 AccessibleStaticTextBase_Impl::GetParagraphIndex() const 333 { 334 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 335 336 sal_Int32 nIndex = -1; 337 if( mpTextParagraph ) 338 nIndex = mpTextParagraph->GetParagraphIndex(); 339 return nIndex; 340 } 341 GetLineCount(sal_Int32 nParagraph) const342 sal_Int32 AccessibleStaticTextBase_Impl::GetLineCount( sal_Int32 nParagraph ) const 343 { 344 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 345 346 sal_Int32 nIndex = 0; 347 if( mpTextParagraph ) 348 nIndex = mpTextParagraph->GetTextForwarder().GetLineCount( nParagraph ); 349 return nIndex; 350 } 351 Internal2Index(EPosition nEEIndex) const352 sal_Int32 AccessibleStaticTextBase_Impl::Internal2Index( EPosition nEEIndex ) const 353 { 354 sal_Int32 aRes(0); 355 int i; 356 for(i=0; i<nEEIndex.nPara; ++i) 357 aRes += GetParagraph(i).getCharacterCount(); 358 359 return aRes + nEEIndex.nIndex; 360 } 361 CorrectTextSegment(TextSegment & aTextSegment,int nPara) const362 void AccessibleStaticTextBase_Impl::CorrectTextSegment( TextSegment& aTextSegment, 363 int nPara ) const 364 { 365 // Keep 'invalid' values at the TextSegment 366 if( aTextSegment.SegmentStart != -1 && 367 aTextSegment.SegmentEnd != -1 ) 368 { 369 // #112814# Correct TextSegment by paragraph offset 370 sal_Int32 nOffset(0); 371 int i; 372 for(i=0; i<nPara; ++i) 373 nOffset += GetParagraph(i).getCharacterCount(); 374 375 aTextSegment.SegmentStart += nOffset; 376 aTextSegment.SegmentEnd += nOffset; 377 } 378 } 379 ImpCalcInternal(sal_Int32 nFlatIndex,bool bExclusive) const380 EPosition AccessibleStaticTextBase_Impl::ImpCalcInternal( sal_Int32 nFlatIndex, bool bExclusive ) const 381 { 382 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 383 384 if( nFlatIndex < 0 ) 385 throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleStaticTextBase_Impl::Index2Internal: character index out of bounds")), 386 mxThis); 387 // gratuitously accepting larger indices here, AccessibleEditableTextPara will throw eventually 388 389 sal_Int32 nCurrPara, nCurrIndex, nParas, nCurrCount; 390 for( nCurrPara=0, nParas=GetParagraphCount(), nCurrCount=0, nCurrIndex=0; nCurrPara<nParas; ++nCurrPara ) 391 { 392 nCurrCount = GetParagraph( nCurrPara ).getCharacterCount(); 393 nCurrIndex += nCurrCount; 394 if( nCurrIndex >= nFlatIndex ) 395 { 396 // check overflow 397 DBG_ASSERT(nCurrPara >= 0 && nCurrPara <= USHRT_MAX && 398 nFlatIndex - nCurrIndex + nCurrCount >= 0 && nFlatIndex - nCurrIndex + nCurrCount <= USHRT_MAX , 399 "AccessibleStaticTextBase_Impl::Index2Internal: index value overflow"); 400 401 return EPosition( nCurrPara, static_cast< sal_uInt16 >(nFlatIndex - nCurrIndex + nCurrCount) ); 402 } 403 } 404 405 // #102170# Allow one-past the end for ranges 406 if( bExclusive && nCurrIndex == nFlatIndex ) 407 { 408 // check overflow 409 DBG_ASSERT(nCurrPara >= 0 && nCurrPara <= USHRT_MAX && 410 nFlatIndex - nCurrIndex + nCurrCount >= 0 && nFlatIndex - nCurrIndex + nCurrCount <= USHRT_MAX , 411 "AccessibleStaticTextBase_Impl::Index2Internal: index value overflow"); 412 413 return EPosition( nCurrPara-1, static_cast< sal_uInt16 >(nFlatIndex - nCurrIndex + nCurrCount) ); 414 } 415 416 // not found? Out of bounds 417 throw lang::IndexOutOfBoundsException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("AccessibleStaticTextBase_Impl::Index2Internal: character index out of bounds")), 418 mxThis); 419 } 420 SetSelection(sal_Int32 nStartPara,sal_Int32 nStartIndex,sal_Int32 nEndPara,sal_Int32 nEndIndex)421 sal_Bool AccessibleStaticTextBase_Impl::SetSelection( sal_Int32 nStartPara, sal_Int32 nStartIndex, 422 sal_Int32 nEndPara, sal_Int32 nEndIndex ) 423 { 424 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 425 426 if( !mpTextParagraph ) 427 return sal_False; 428 429 try 430 { 431 SvxEditViewForwarder& rCacheVF = mpTextParagraph->GetEditViewForwarder( sal_True ); 432 return rCacheVF.SetSelection( MakeSelection(nStartPara, nStartIndex, nEndPara, nEndIndex) ); 433 } 434 catch( const uno::RuntimeException& ) 435 { 436 return sal_False; 437 } 438 } 439 CopyText(sal_Int32 nStartPara,sal_Int32 nStartIndex,sal_Int32 nEndPara,sal_Int32 nEndIndex)440 sal_Bool AccessibleStaticTextBase_Impl::CopyText( sal_Int32 nStartPara, sal_Int32 nStartIndex, 441 sal_Int32 nEndPara, sal_Int32 nEndIndex ) 442 { 443 DBG_CHKTHIS( AccessibleStaticTextBase_Impl, NULL ); 444 445 if( !mpTextParagraph ) 446 return sal_False; 447 448 try 449 { 450 SvxEditViewForwarder& rCacheVF = mpTextParagraph->GetEditViewForwarder( sal_True ); 451 mpTextParagraph->GetTextForwarder(); // MUST be after GetEditViewForwarder(), see method docs 452 sal_Bool aRetVal; 453 454 // save current selection 455 ESelection aOldSelection; 456 457 rCacheVF.GetSelection( aOldSelection ); 458 rCacheVF.SetSelection( MakeSelection(nStartPara, nStartIndex, nEndPara, nEndIndex) ); 459 aRetVal = rCacheVF.Copy(); 460 rCacheVF.SetSelection( aOldSelection ); // restore 461 462 return aRetVal; 463 } 464 catch( const uno::RuntimeException& ) 465 { 466 return sal_False; 467 } 468 } 469 GetParagraphBoundingBox() const470 Rectangle AccessibleStaticTextBase_Impl::GetParagraphBoundingBox() const 471 { 472 Rectangle aRect; 473 if( mpTextParagraph ) 474 { 475 awt::Rectangle aAwtRect = mpTextParagraph->getBounds(); 476 aRect = Rectangle( Point( aAwtRect.X, aAwtRect.Y ), Size( aAwtRect.Width, aAwtRect.Height ) ); 477 } 478 else 479 { 480 aRect.SetEmpty(); 481 } 482 return aRect; 483 } 484 //the input argument is the index(including "\n" ) in the string. 485 //the function will calculate the actual index(not including "\n") in the string. 486 //and return true if the index is just at a "\n" RemoveLineBreakCount(sal_Int32 & rIndex)487 sal_Bool AccessibleStaticTextBase_Impl::RemoveLineBreakCount( sal_Int32& rIndex ) 488 { 489 // get the total char number inside the cell. 490 sal_Int32 i, nCount, nParas; 491 for( i=0, nCount=0, nParas=GetParagraphCount(); i<nParas; ++i ) 492 nCount += GetParagraph(i).getCharacterCount(); 493 nCount = nCount + (nParas-1); 494 if( nCount == 0 && rIndex == 0) return sal_False; 495 496 497 sal_Int32 nCurrPara, nCurrCount; 498 sal_Int32 nLineBreakPos = 0, nLineBreakCount = 0; 499 sal_Int32 nParaCount = GetParagraphCount(); 500 for ( nCurrCount = 0, nCurrPara = 0; nCurrPara < nParaCount; nCurrPara++ ) 501 { 502 nCurrCount += GetParagraph( nCurrPara ).getCharacterCount(); 503 nLineBreakPos = nCurrCount++; 504 if ( rIndex == nLineBreakPos ) 505 { 506 rIndex -= (++nLineBreakCount);//(++nLineBreakCount); 507 if ( rIndex < 0) 508 { 509 rIndex = 0; 510 } 511 //if the index is at the last position of the last paragraph 512 //there is no "\n" , so we should increase rIndex by 1 and return false. 513 if ( (nCurrPara+1) == nParaCount ) 514 { 515 rIndex++; 516 return sal_False; 517 } 518 else 519 { 520 return sal_True; 521 } 522 } 523 else if ( rIndex < nLineBreakPos ) 524 { 525 rIndex -= nLineBreakCount; 526 return sal_False; 527 } 528 else 529 { 530 nLineBreakCount++; 531 } 532 } 533 return sal_False; 534 } 535 //------------------------------------------------------------------------ 536 // 537 // AccessibleStaticTextBase implementation 538 // 539 //------------------------------------------------------------------------ 540 AccessibleStaticTextBase(::std::unique_ptr<SvxEditSource> pEditSource)541 AccessibleStaticTextBase::AccessibleStaticTextBase( ::std::unique_ptr< SvxEditSource > pEditSource ) : 542 mpImpl( new AccessibleStaticTextBase_Impl() ) 543 { 544 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 545 546 SetEditSource( std::move(pEditSource) ); 547 } 548 ~AccessibleStaticTextBase()549 AccessibleStaticTextBase::~AccessibleStaticTextBase() 550 { 551 } 552 GetEditSource() const553 const SvxEditSource& AccessibleStaticTextBase::GetEditSource() const 554 { 555 #ifdef DBG_UTIL 556 mpImpl->CheckInvariants(); 557 558 const SvxEditSource& aEditSource = mpImpl->GetEditSource(); 559 560 mpImpl->CheckInvariants(); 561 562 return aEditSource; 563 #else 564 return mpImpl->GetEditSource(); 565 #endif 566 } 567 SetEditSource(::std::unique_ptr<SvxEditSource> pEditSource)568 void AccessibleStaticTextBase::SetEditSource( ::std::unique_ptr< SvxEditSource > pEditSource ) 569 { 570 #ifdef DBG_UTIL 571 // precondition: solar mutex locked 572 DBG_TESTSOLARMUTEX(); 573 574 mpImpl->CheckInvariants(); 575 576 mpImpl->SetEditSource( pEditSource ); 577 578 mpImpl->CheckInvariants(); 579 #else 580 mpImpl->SetEditSource( std::move(pEditSource) ); 581 #endif 582 } 583 SetEventSource(const uno::Reference<XAccessible> & rInterface)584 void AccessibleStaticTextBase::SetEventSource( const uno::Reference< XAccessible >& rInterface ) 585 { 586 #ifdef DBG_UTIL 587 mpImpl->CheckInvariants(); 588 #endif 589 590 mpImpl->SetEventSource( rInterface ); 591 592 #ifdef DBG_UTIL 593 mpImpl->CheckInvariants(); 594 #endif 595 } 596 GetEventSource() const597 uno::Reference< XAccessible > AccessibleStaticTextBase::GetEventSource() const 598 { 599 #ifdef DBG_UTIL 600 mpImpl->CheckInvariants(); 601 602 uno::Reference< XAccessible > xRet( mpImpl->GetEventSource() ); 603 604 mpImpl->CheckInvariants(); 605 606 return xRet; 607 #else 608 return mpImpl->GetEventSource(); 609 #endif 610 } 611 SetOffset(const Point & rPoint)612 void AccessibleStaticTextBase::SetOffset( const Point& rPoint ) 613 { 614 #ifdef DBG_UTIL 615 // precondition: solar mutex locked 616 DBG_TESTSOLARMUTEX(); 617 618 mpImpl->CheckInvariants(); 619 620 mpImpl->SetOffset( rPoint ); 621 622 mpImpl->CheckInvariants(); 623 #else 624 mpImpl->SetOffset( rPoint ); 625 #endif 626 } 627 GetOffset() const628 Point AccessibleStaticTextBase::GetOffset() const 629 { 630 #ifdef DBG_UTIL 631 mpImpl->CheckInvariants(); 632 633 Point aPoint( mpImpl->GetOffset() ); 634 635 mpImpl->CheckInvariants(); 636 637 return aPoint; 638 #else 639 return mpImpl->GetOffset(); 640 #endif 641 } 642 UpdateChildren()643 void AccessibleStaticTextBase::UpdateChildren() 644 { 645 #ifdef DBG_UTIL 646 // precondition: solar mutex locked 647 DBG_TESTSOLARMUTEX(); 648 649 mpImpl->CheckInvariants(); 650 651 mpImpl->UpdateChildren(); 652 653 mpImpl->CheckInvariants(); 654 #else 655 mpImpl->UpdateChildren(); 656 #endif 657 } 658 Dispose()659 void AccessibleStaticTextBase::Dispose() 660 { 661 #ifdef DBG_UTIL 662 mpImpl->CheckInvariants(); 663 #endif 664 665 mpImpl->Dispose(); 666 667 #ifdef DBG_UTIL 668 mpImpl->CheckInvariants(); 669 #endif 670 } 671 672 // XAccessibleContext getAccessibleChildCount()673 sal_Int32 SAL_CALL AccessibleStaticTextBase::getAccessibleChildCount() 674 { 675 // no children at all 676 return 0; 677 } 678 getAccessibleChild(sal_Int32)679 uno::Reference< XAccessible > SAL_CALL AccessibleStaticTextBase::getAccessibleChild( sal_Int32 /*i*/ ) 680 { 681 // no children at all 682 return uno::Reference< XAccessible >(); 683 } 684 getAccessibleAtPoint(const awt::Point &)685 uno::Reference< XAccessible > SAL_CALL AccessibleStaticTextBase::getAccessibleAtPoint( const awt::Point& /*_aPoint*/ ) 686 { 687 // no children at all 688 return uno::Reference< XAccessible >(); 689 } 690 691 // XAccessibleText getCaretPosition()692 sal_Int32 SAL_CALL AccessibleStaticTextBase::getCaretPosition() 693 { 694 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 695 696 sal_Int32 i, nPos, nParas; 697 for( i=0, nPos=-1, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i ) 698 { 699 if( (nPos=mpImpl->GetParagraph(i).getCaretPosition()) != -1 ) 700 return nPos; 701 } 702 703 return nPos; 704 } 705 setCaretPosition(sal_Int32 nIndex)706 sal_Bool SAL_CALL AccessibleStaticTextBase::setCaretPosition( sal_Int32 nIndex ) 707 { 708 return setSelection(nIndex, nIndex); 709 } 710 getCharacter(sal_Int32 nIndex)711 sal_Unicode SAL_CALL AccessibleStaticTextBase::getCharacter( sal_Int32 nIndex ) 712 { 713 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 714 715 EPosition aPos( mpImpl->Index2Internal(nIndex) ); 716 717 return mpImpl->GetParagraph( aPos.nPara ).getCharacter( aPos.nIndex ); 718 } 719 getCharacterAttributes(sal_Int32 nIndex,const::com::sun::star::uno::Sequence<::rtl::OUString> & aRequestedAttributes)720 uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleStaticTextBase::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) 721 { 722 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 723 //get the actual index without "\n" 724 mpImpl->RemoveLineBreakCount( nIndex ); 725 726 EPosition aPos( mpImpl->Index2Internal(nIndex) ); 727 728 return mpImpl->GetParagraph( aPos.nPara ).getCharacterAttributes( aPos.nIndex, aRequestedAttributes ); 729 } 730 getCharacterBounds(sal_Int32 nIndex)731 awt::Rectangle SAL_CALL AccessibleStaticTextBase::getCharacterBounds( sal_Int32 nIndex ) 732 { 733 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 734 735 // #108900# Allow ranges for nIndex, as one-past-the-end 736 // values are now legal, too. 737 EPosition aPos( mpImpl->Range2Internal(nIndex) ); 738 739 // #i70916# Text in spread sheet cells return the wrong extents 740 AccessibleEditableTextPara& rPara = mpImpl->GetParagraph( aPos.nPara ); 741 awt::Rectangle aParaBounds( rPara.getBounds() ); 742 awt::Rectangle aBounds( rPara.getCharacterBounds( aPos.nIndex ) ); 743 aBounds.X += aParaBounds.X; 744 aBounds.Y += aParaBounds.Y; 745 746 return aBounds; 747 } 748 getCharacterCount()749 sal_Int32 SAL_CALL AccessibleStaticTextBase::getCharacterCount() 750 { 751 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 752 753 sal_Int32 i, nCount, nParas; 754 for( i=0, nCount=0, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i ) 755 nCount += mpImpl->GetParagraph(i).getCharacterCount(); 756 //count on the number of "\n" which equals number of paragraphs decrease 1. 757 nCount = nCount + (nParas-1); 758 return nCount; 759 } 760 getIndexAtPoint(const awt::Point & rPoint)761 sal_Int32 SAL_CALL AccessibleStaticTextBase::getIndexAtPoint( const awt::Point& rPoint ) 762 { 763 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 764 765 const sal_Int32 nParas( mpImpl->GetParagraphCount() ); 766 sal_Int32 nIndex; 767 int i; 768 for( i=0; i<nParas; ++i ) 769 { 770 // TODO: maybe exploit the fact that paragraphs are 771 // ordered vertically for early exit 772 773 // #i70916# Text in spread sheet cells return the wrong extents 774 AccessibleEditableTextPara& rPara = mpImpl->GetParagraph( i ); 775 awt::Rectangle aParaBounds( rPara.getBounds() ); 776 awt::Point aPoint( rPoint ); 777 aPoint.X -= aParaBounds.X; 778 aPoint.Y -= aParaBounds.Y; 779 780 // #112814# Use correct index offset 781 if ( ( nIndex = rPara.getIndexAtPoint( aPoint ) ) != -1 ) 782 return mpImpl->Internal2Index( EPosition(i, 783 sal::static_int_cast<sal_uInt16>(nIndex)) ); 784 } 785 786 return -1; 787 } 788 getSelectedText()789 ::rtl::OUString SAL_CALL AccessibleStaticTextBase::getSelectedText() 790 { 791 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 792 793 sal_Int32 nStart( getSelectionStart() ); 794 sal_Int32 nEnd( getSelectionEnd() ); 795 796 // #104481# Return the empty string for 'no selection' 797 if( nStart < 0 || nEnd < 0 ) 798 return ::rtl::OUString(); 799 800 return getTextRange( nStart, nEnd ); 801 } 802 getSelectionStart()803 sal_Int32 SAL_CALL AccessibleStaticTextBase::getSelectionStart() 804 { 805 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 806 807 sal_Int32 i, nPos, nParas; 808 for( i=0, nPos=-1, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i ) 809 { 810 if( (nPos=mpImpl->GetParagraph(i).getSelectionStart()) != -1 ) 811 return nPos; 812 } 813 814 return nPos; 815 } 816 getSelectionEnd()817 sal_Int32 SAL_CALL AccessibleStaticTextBase::getSelectionEnd() 818 { 819 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 820 821 sal_Int32 i, nPos, nParas; 822 for( i=0, nPos=-1, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i ) 823 { 824 if( (nPos=mpImpl->GetParagraph(i).getSelectionEnd()) != -1 ) 825 return nPos; 826 } 827 828 return nPos; 829 } 830 setSelection(sal_Int32 nStartIndex,sal_Int32 nEndIndex)831 sal_Bool SAL_CALL AccessibleStaticTextBase::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) 832 { 833 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 834 835 EPosition aStartIndex( mpImpl->Range2Internal(nStartIndex) ); 836 EPosition aEndIndex( mpImpl->Range2Internal(nEndIndex) ); 837 838 return mpImpl->SetSelection( aStartIndex.nPara, aStartIndex.nIndex, 839 aEndIndex.nPara, aEndIndex.nIndex ); 840 } 841 getText()842 ::rtl::OUString SAL_CALL AccessibleStaticTextBase::getText() 843 { 844 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 845 846 sal_Int32 i, nParas; 847 ::rtl::OUString aRes; 848 for( i=0, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i ) 849 aRes += mpImpl->GetParagraph(i).getText(); 850 851 return aRes; 852 } 853 getTextRange(sal_Int32 nStartIndex,sal_Int32 nEndIndex)854 ::rtl::OUString SAL_CALL AccessibleStaticTextBase::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) 855 { 856 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 857 858 if( nStartIndex > nEndIndex ) 859 ::std::swap(nStartIndex, nEndIndex); 860 //if startindex equals endindex we will get nothing. So return an empty string directly. 861 if ( nStartIndex == nEndIndex ) 862 { 863 ::rtl::OUString sEmptyStr; 864 return sEmptyStr; 865 } 866 sal_Bool bStart = mpImpl->RemoveLineBreakCount( nStartIndex ); 867 //if the start index is just at a "\n", we need to begin from the next char 868 if ( bStart ) 869 { 870 nStartIndex++; 871 } 872 //we need to find out whether the previous position of the current endindex is at "\n" or not 873 //if yes we need to mark it and add "\n" at the end of the result 874 sal_Int32 nTemp = nEndIndex - 1; 875 sal_Bool bEnd = mpImpl->RemoveLineBreakCount( nTemp ); 876 sal_Bool bTemp = mpImpl->RemoveLineBreakCount( nEndIndex ); 877 //if the below condition is true it indicates an empty paragraph with just a "\n" 878 //so we need to set one "\n" flag to avoid duplication. 879 if ( bStart && bEnd && ( nStartIndex == nEndIndex) ) 880 { 881 bEnd = sal_False; 882 } 883 //if the current endindex is at a "\n", we need to increase endindex by 1 to make sure 884 //the char before "\n" is included. Because string returned by this function will not include 885 //the char at the endindex. 886 if ( bTemp ) 887 { 888 nEndIndex++; 889 } 890 ::rtl::OUString aRes; 891 EPosition aStartIndex( mpImpl->Range2Internal(nStartIndex) ); 892 EPosition aEndIndex( mpImpl->Range2Internal(nEndIndex) ); 893 894 // #102170# Special case: start and end paragraph are identical 895 if( aStartIndex.nPara == aEndIndex.nPara ) 896 { 897 //we don't return the string directly now for that we have to do some further process for "\n" 898 aRes = mpImpl->GetParagraph( aStartIndex.nPara ).getTextRange( aStartIndex.nIndex, aEndIndex.nIndex ); 899 } 900 else 901 { 902 sal_Int32 i( aStartIndex.nPara ); 903 aRes = mpImpl->GetParagraph(i).getTextRange( aStartIndex.nIndex, 904 mpImpl->GetParagraph(i).getCharacterCount()/*-1*/); 905 ++i; 906 907 // paragraphs inbetween are fully included 908 for( ; i<aEndIndex.nPara; ++i ) 909 { 910 aRes += rtl::OUString(cNewLine); 911 aRes += mpImpl->GetParagraph(i).getText(); 912 } 913 914 if( i<=aEndIndex.nPara ) 915 { 916 //if the below condition is mathed it means the endindex is at mid of the last paragraph 917 //we need to add a "\n" before we add the last part of the string. 918 if ( !bEnd && aEndIndex.nIndex ) 919 { 920 aRes += rtl::OUString(cNewLine); 921 } 922 aRes += mpImpl->GetParagraph(i).getTextRange( 0, aEndIndex.nIndex ); 923 } 924 //return aRes; 925 } 926 //According to the flag we marked before, we have to add "\n" at the beginning 927 //or at the end of the result string. 928 if ( bStart ) 929 { 930 aRes = rtl::OUString(cNewLine) + aRes; 931 } 932 if ( bEnd ) 933 { 934 aRes += rtl::OUString(cNewLine); 935 } 936 return aRes; 937 } 938 getTextAtIndex(sal_Int32 nIndex,sal_Int16 aTextType)939 ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleStaticTextBase::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) 940 { 941 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 942 943 sal_Bool bLineBreak = mpImpl->RemoveLineBreakCount( nIndex ); 944 EPosition aPos( mpImpl->Range2Internal(nIndex) ); 945 946 ::com::sun::star::accessibility::TextSegment aResult; 947 948 if( AccessibleTextType::PARAGRAPH == aTextType ) 949 { 950 // #106393# Special casing one behind last paragraph is 951 // not necessary, since then, we return the content and 952 // boundary of that last paragraph. Range2Internal is 953 // tolerant against that, and returns the last paragraph 954 // in aPos.nPara. 955 956 // retrieve full text of the paragraph 957 aResult.SegmentText = mpImpl->GetParagraph( aPos.nPara ).getText(); 958 959 // #112814# Adapt the start index with the paragraph offset 960 aResult.SegmentStart = mpImpl->Internal2Index( EPosition( aPos.nPara, 0 ) ); 961 aResult.SegmentEnd = aResult.SegmentStart + aResult.SegmentText.getLength(); 962 } 963 else if ( AccessibleTextType::ATTRIBUTE_RUN == aTextType ) 964 { 965 SvxAccessibleTextAdapter& rTextForwarder = mpImpl->GetParagraph( aPos.nIndex ).GetTextForwarder(); 966 sal_uInt16 nStartIndex, nEndIndex; 967 if ( rTextForwarder.GetAttributeRun( nStartIndex, nEndIndex, aPos.nPara, aPos.nIndex, sal_True ) ) 968 { 969 aResult.SegmentText = getTextRange( nStartIndex, nEndIndex ); 970 aResult.SegmentStart = nStartIndex; 971 aResult.SegmentEnd = nEndIndex; 972 } 973 } 974 else 975 { 976 // No special handling required, forward to wrapped class 977 aResult = mpImpl->GetParagraph( aPos.nPara ).getTextAtIndex( aPos.nIndex, aTextType ); 978 979 // #112814# Adapt the start index with the paragraph offset 980 mpImpl->CorrectTextSegment( aResult, aPos.nPara ); 981 if ( bLineBreak ) 982 { 983 aResult.SegmentText = rtl::OUString(cNewLine); 984 } 985 } 986 987 return aResult; 988 } 989 getTextBeforeIndex(sal_Int32 nIndex,sal_Int16 aTextType)990 ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleStaticTextBase::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) 991 { 992 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 993 sal_Int32 nOldIdx = nIndex; 994 sal_Bool bLineBreak = mpImpl->RemoveLineBreakCount( nIndex ); 995 EPosition aPos( mpImpl->Range2Internal(nIndex) ); 996 997 ::com::sun::star::accessibility::TextSegment aResult; 998 999 if( AccessibleTextType::PARAGRAPH == aTextType ) 1000 { 1001 if( aPos.nIndex == mpImpl->GetParagraph( aPos.nPara ).getCharacterCount() ) 1002 { 1003 // #103589# Special casing one behind the last paragraph 1004 aResult.SegmentText = mpImpl->GetParagraph( aPos.nPara ).getText(); 1005 1006 // #112814# Adapt the start index with the paragraph offset 1007 aResult.SegmentStart = mpImpl->Internal2Index( EPosition( aPos.nPara, 0 ) ); 1008 } 1009 else if( aPos.nPara > 0 ) 1010 { 1011 aResult.SegmentText = mpImpl->GetParagraph( aPos.nPara - 1 ).getText(); 1012 1013 // #112814# Adapt the start index with the paragraph offset 1014 aResult.SegmentStart = mpImpl->Internal2Index( EPosition( aPos.nPara - 1, 0 ) ); 1015 } 1016 1017 aResult.SegmentEnd = aResult.SegmentStart + aResult.SegmentText.getLength(); 1018 } 1019 else 1020 { 1021 // No special handling required, forward to wrapped class 1022 aResult = mpImpl->GetParagraph( aPos.nPara ).getTextBeforeIndex( aPos.nIndex, aTextType ); 1023 1024 // #112814# Adapt the start index with the paragraph offset 1025 mpImpl->CorrectTextSegment( aResult, aPos.nPara ); 1026 if ( bLineBreak && (nOldIdx-1) >= 0) 1027 { 1028 aResult = getTextAtIndex( nOldIdx-1, aTextType ); 1029 } 1030 } 1031 1032 return aResult; 1033 } 1034 getTextBehindIndex(sal_Int32 nIndex,sal_Int16 aTextType)1035 ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleStaticTextBase::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) 1036 { 1037 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1038 sal_Int32 nTemp = nIndex+1; 1039 sal_Bool bLineBreak = mpImpl->RemoveLineBreakCount( nTemp ); 1040 mpImpl->RemoveLineBreakCount( nIndex ); 1041 EPosition aPos( mpImpl->Range2Internal(nIndex) ); 1042 1043 ::com::sun::star::accessibility::TextSegment aResult; 1044 1045 if( AccessibleTextType::PARAGRAPH == aTextType ) 1046 { 1047 // Special casing one behind the last paragraph is not 1048 // necessary, this case is invalid here for 1049 // getTextBehindIndex 1050 if( aPos.nPara + 1 < mpImpl->GetParagraphCount() ) 1051 { 1052 aResult.SegmentText = mpImpl->GetParagraph( aPos.nPara + 1 ).getText(); 1053 1054 // #112814# Adapt the start index with the paragraph offset 1055 aResult.SegmentStart = mpImpl->Internal2Index( EPosition( aPos.nPara + 1, 0 ) ); 1056 aResult.SegmentEnd = aResult.SegmentStart + aResult.SegmentText.getLength(); 1057 } 1058 } 1059 else 1060 { 1061 // No special handling required, forward to wrapped class 1062 aResult = mpImpl->GetParagraph( aPos.nPara ).getTextBehindIndex( aPos.nIndex, aTextType ); 1063 1064 // #112814# Adapt the start index with the paragraph offset 1065 mpImpl->CorrectTextSegment( aResult, aPos.nPara ); 1066 if ( bLineBreak ) 1067 { 1068 aResult.SegmentText = rtl::OUString(cNewLine) + aResult.SegmentText; 1069 } 1070 } 1071 1072 return aResult; 1073 } 1074 copyText(sal_Int32 nStartIndex,sal_Int32 nEndIndex)1075 sal_Bool SAL_CALL AccessibleStaticTextBase::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) 1076 { 1077 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1078 1079 if( nStartIndex > nEndIndex ) 1080 ::std::swap(nStartIndex, nEndIndex); 1081 1082 EPosition aStartIndex( mpImpl->Range2Internal(nStartIndex) ); 1083 EPosition aEndIndex( mpImpl->Range2Internal(nEndIndex) ); 1084 1085 return mpImpl->CopyText( aStartIndex.nPara, aStartIndex.nIndex, 1086 aEndIndex.nPara, aEndIndex.nIndex ); 1087 } 1088 1089 // XAccessibleTextAttributes getDefaultAttributes(const uno::Sequence<::rtl::OUString> & RequestedAttributes)1090 uno::Sequence< beans::PropertyValue > AccessibleStaticTextBase::getDefaultAttributes( const uno::Sequence< ::rtl::OUString >& RequestedAttributes ) 1091 { 1092 // get the intersection of the default attributes of all paragraphs 1093 1094 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1095 1096 PropertyValueVector aDefAttrVec( mpImpl->GetParagraph( 0 ).getDefaultAttributes( RequestedAttributes ) ); 1097 1098 const sal_Int32 nParaCount = mpImpl->GetParagraphCount(); 1099 for ( sal_Int32 nPara = 1; nPara < nParaCount; ++nPara ) 1100 { 1101 uno::Sequence< beans::PropertyValue > aSeq = mpImpl->GetParagraph( nPara ).getDefaultAttributes( RequestedAttributes ); 1102 PropertyValueVector aIntersectionVec; 1103 1104 PropertyValueVector::const_iterator aEnd = aDefAttrVec.end(); 1105 for ( PropertyValueVector::const_iterator aItr = aDefAttrVec.begin(); aItr != aEnd; ++aItr ) 1106 { 1107 const beans::PropertyValue* pItr = aSeq.getConstArray(); 1108 const beans::PropertyValue* pEnd = pItr + aSeq.getLength(); 1109 const beans::PropertyValue* pFind = ::std::find_if( pItr, pEnd, ::std::bind( PropertyValueEqualFunctor(), ::std::placeholders::_1, boost::cref( *aItr ) ) ); 1110 if ( pFind != pEnd ) 1111 { 1112 aIntersectionVec.push_back( *pFind ); 1113 } 1114 } 1115 1116 aDefAttrVec.swap( aIntersectionVec ); 1117 1118 if ( aDefAttrVec.empty() ) 1119 { 1120 break; 1121 } 1122 } 1123 1124 return aDefAttrVec.getAsConstList(); 1125 } 1126 getRunAttributes(sal_Int32 nIndex,const uno::Sequence<::rtl::OUString> & RequestedAttributes)1127 uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleStaticTextBase::getRunAttributes( sal_Int32 nIndex, const uno::Sequence< ::rtl::OUString >& RequestedAttributes ) 1128 { 1129 // get those default attributes of the paragraph, which are not part 1130 // of the intersection of all paragraphs and add them to the run attributes 1131 1132 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1133 1134 EPosition aPos( mpImpl->Index2Internal( nIndex ) ); 1135 AccessibleEditableTextPara& rPara = mpImpl->GetParagraph( aPos.nPara ); 1136 uno::Sequence< beans::PropertyValue > aDefAttrSeq = rPara.getDefaultAttributes( RequestedAttributes ); 1137 uno::Sequence< beans::PropertyValue > aRunAttrSeq = rPara.getRunAttributes( aPos.nIndex, RequestedAttributes ); 1138 uno::Sequence< beans::PropertyValue > aIntersectionSeq = getDefaultAttributes( RequestedAttributes ); 1139 PropertyValueVector aDiffVec; 1140 1141 const beans::PropertyValue* pDefAttr = aDefAttrSeq.getConstArray(); 1142 const sal_Int32 nLength = aDefAttrSeq.getLength(); 1143 for ( sal_Int32 i = 0; i < nLength; ++i ) 1144 { 1145 const beans::PropertyValue* pItr = aIntersectionSeq.getConstArray(); 1146 const beans::PropertyValue* pEnd = pItr + aIntersectionSeq.getLength(); 1147 const beans::PropertyValue* pFind = ::std::find_if( pItr, pEnd, ::std::bind( PropertyValueEqualFunctor(), ::std::placeholders::_1, boost::cref( pDefAttr[i] ) ) ); 1148 if ( pFind == pEnd && pDefAttr[i].Handle != 0) 1149 { 1150 aDiffVec.push_back( pDefAttr[i] ); 1151 } 1152 } 1153 1154 return ::comphelper::concatSequences( aRunAttrSeq, aDiffVec.getAsConstList() ); 1155 } 1156 GetParagraphBoundingBox() const1157 Rectangle AccessibleStaticTextBase::GetParagraphBoundingBox() const 1158 { 1159 return mpImpl->GetParagraphBoundingBox(); 1160 } 1161 GetParagraphIndex() const1162 sal_Int32 AccessibleStaticTextBase::GetParagraphIndex() const 1163 { 1164 return mpImpl->GetParagraphIndex(); 1165 } 1166 GetParagraphCount() const1167 sal_Int32 AccessibleStaticTextBase::GetParagraphCount() const 1168 { 1169 return mpImpl->GetParagraphCount(); 1170 } 1171 GetLineCount(sal_Int32 nParagraph) const1172 sal_Int32 AccessibleStaticTextBase::GetLineCount( sal_Int32 nParagraph ) const 1173 { 1174 return mpImpl->GetLineCount( nParagraph ); 1175 } 1176 1177 } // end of namespace accessibility 1178 1179 //------------------------------------------------------------------------ 1180