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