1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: accessibility.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_starmath.hxx"
33 #include <com/sun/star/accessibility/AccessibleRole.hpp>
34 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
35 #include <com/sun/star/accessibility/AccessibleTextType.hpp>
36 #include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
37 #include <com/sun/star/accessibility/AccessibleEventObject.hpp>
38 #include <com/sun/star/awt/FocusEvent.hpp>
39 #include <com/sun/star/awt/XFocusListener.hpp>
40 #include <unotools/accessiblerelationsethelper.hxx>
43 #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
44 #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
45 #include <com/sun/star/i18n/WordType.hpp>
46 #include <unotools/accessiblestatesethelper.hxx>
47 #include <comphelper/accessibleeventnotifier.hxx>
48 #include <tools/debug.hxx>
49 #include <vcl/svapp.hxx>
50 #include <vcl/window.hxx>
51 #include <vcl/unohelp2.hxx>
52 #include <tools/gen.hxx>
53 #include <vos/mutex.hxx>
54 #include <svtools/itemset.hxx>
56 #include <svx/editobj.hxx>
57 #include <svx/editdata.hxx>
58 #include <svx/editview.hxx>
59 #include <svx/eeitem.hxx>
60 #include <svx/outliner.hxx>
61 #include <svx/unoedhlp.hxx>
64 #include "accessibility.hxx"
65 #include <applicat.hxx>
66 #include <document.hxx>
70 using namespace com::sun::star
;
71 using namespace com::sun::star::lang
;
72 using namespace com::sun::star::uno
;
73 using namespace com::sun::star::accessibility
;
75 #define A2OU(cChar) rtl::OUString::createFromAscii(cChar)
77 //////////////////////////////////////////////////////////////////////
79 static awt::Rectangle
lcl_GetBounds( Window
*pWin
)
81 // !! see VCLXAccessibleComponent::implGetBounds()
83 //! the coordinates returned are relativ to the parent window !
84 //! Thus the top-left point may be different from (0, 0) !
86 awt::Rectangle aBounds
;
89 Rectangle aRect
= pWin
->GetWindowExtentsRelative( NULL
);
90 aBounds
.X
= aRect
.Left();
91 aBounds
.Y
= aRect
.Top();
92 aBounds
.Width
= aRect
.GetWidth();
93 aBounds
.Height
= aRect
.GetHeight();
94 Window
* pParent
= pWin
->GetAccessibleParentWindow();
97 Rectangle aParentRect
= pParent
->GetWindowExtentsRelative( NULL
);
98 awt::Point
aParentScreenLoc( aParentRect
.Left(), aParentRect
.Top() );
99 aBounds
.X
-= aParentScreenLoc
.X
;
100 aBounds
.Y
-= aParentScreenLoc
.Y
;
106 static awt::Point
lcl_GetLocationOnScreen( Window
*pWin
)
108 // !! see VCLXAccessibleComponent::getLocationOnScreen()
113 Rectangle aRect
= pWin
->GetWindowExtentsRelative( NULL
);
114 aPos
.X
= aRect
.Left();
115 aPos
.Y
= aRect
.Top();
120 //////////////////////////////////////////////////////////////////////
122 SmGraphicAccessible::SmGraphicAccessible( SmGraphicWindow
*pGraphicWin
) :
123 aAccName ( String(SmResId(RID_DOCUMENTSTR
)) ),
127 DBG_ASSERT( pWin
, "SmGraphicAccessible: window missing" );
132 SmGraphicAccessible::SmGraphicAccessible( const SmGraphicAccessible
&rSmAcc
) :
133 SmGraphicAccessibleBaseClass(),
134 aAccName ( String(SmResId(RID_DOCUMENTSTR
)) ),
137 //vos::OGuard aGuard(Application::GetSolarMutex());
139 DBG_ASSERT( pWin
, "SmGraphicAccessible: window missing" );
144 SmGraphicAccessible::~SmGraphicAccessible()
147 vos::OGuard aGuard(Application::GetSolarMutex());
148 if (--aRefCount == 0)
155 SmDocShell
* SmGraphicAccessible::GetDoc_Impl()
157 SmViewShell
*pView
= pWin
? pWin
->GetView() : 0;
158 return pView
? pView
->GetDoc() : 0;
161 String
SmGraphicAccessible::GetAccessibleText_Impl()
164 SmDocShell
*pDoc
= GetDoc_Impl();
166 aTxt
= pDoc
->GetAccessibleText();
170 void SmGraphicAccessible::ClearWin()
172 pWin
= 0; // implicitly results in AccessibleStateType::DEFUNC set
176 comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId
, *this );
181 void SmGraphicAccessible::LaunchEvent(
182 const sal_Int16 nAccesibleEventId
,
183 const uno::Any
&rOldVal
,
184 const uno::Any
&rNewVal
)
186 AccessibleEventObject aEvt
;
187 aEvt
.Source
= (XAccessible
*) this;
188 aEvt
.EventId
= nAccesibleEventId
;
189 aEvt
.OldValue
= rOldVal
;
190 aEvt
.NewValue
= rNewVal
;
192 // pass event on to event-listener's
194 comphelper::AccessibleEventNotifier::addEvent( nClientId
, aEvt
);
197 uno::Reference
< XAccessibleContext
> SAL_CALL
SmGraphicAccessible::getAccessibleContext()
198 throw (RuntimeException
)
200 vos::OGuard
aGuard(Application::GetSolarMutex());
204 sal_Bool SAL_CALL
SmGraphicAccessible::containsPoint( const awt::Point
& aPoint
)
205 throw (RuntimeException
)
207 //! the arguments coordinates are relativ to the current window !
208 //! Thus the top-left point is (0, 0)
210 vos::OGuard
aGuard(Application::GetSolarMutex());
212 throw RuntimeException();
214 Size
aSz( pWin
->GetSizePixel() );
215 return aPoint
.X
>= 0 && aPoint
.Y
>= 0 &&
216 aPoint
.X
< aSz
.Width() && aPoint
.Y
< aSz
.Height();
219 uno::Reference
< XAccessible
> SAL_CALL
SmGraphicAccessible::getAccessibleAtPoint(
220 const awt::Point
& aPoint
)
221 throw (RuntimeException
)
223 vos::OGuard
aGuard(Application::GetSolarMutex());
224 XAccessible
*pRes
= 0;
225 if (containsPoint( aPoint
))
230 awt::Rectangle SAL_CALL
SmGraphicAccessible::getBounds()
231 throw (RuntimeException
)
233 vos::OGuard
aGuard(Application::GetSolarMutex());
235 throw RuntimeException();
236 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
237 "mismatch of window parent and accessible parent" );
238 return lcl_GetBounds( pWin
);
241 awt::Point SAL_CALL
SmGraphicAccessible::getLocation()
242 throw (RuntimeException
)
244 vos::OGuard
aGuard(Application::GetSolarMutex());
246 throw RuntimeException();
247 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
248 "mismatch of window parent and accessible parent" );
249 awt::Rectangle
aRect( lcl_GetBounds( pWin
) );
250 return awt::Point( aRect
.X
, aRect
.Y
);
253 awt::Point SAL_CALL
SmGraphicAccessible::getLocationOnScreen()
254 throw (RuntimeException
)
256 vos::OGuard
aGuard(Application::GetSolarMutex());
258 throw RuntimeException();
259 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
260 "mismatch of window parent and accessible parent" );
261 return lcl_GetLocationOnScreen( pWin
);
264 awt::Size SAL_CALL
SmGraphicAccessible::getSize()
265 throw (RuntimeException
)
267 vos::OGuard
aGuard(Application::GetSolarMutex());
269 throw RuntimeException();
270 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
271 "mismatch of window parent and accessible parent" );
273 Size
aSz( pWin
->GetSizePixel() );
274 #if OSL_DEBUG_LEVEL > 1
275 awt::Rectangle
aRect( lcl_GetBounds( pWin
) );
276 Size
aSz2( aRect
.Width
, aRect
.Height
);
277 DBG_ASSERT( aSz
== aSz2
, "mismatch in width" );
279 return awt::Size( aSz
.Width(), aSz
.Height() );
282 void SAL_CALL
SmGraphicAccessible::grabFocus()
283 throw (RuntimeException
)
285 vos::OGuard
aGuard(Application::GetSolarMutex());
287 throw RuntimeException();
292 sal_Int32 SAL_CALL
SmGraphicAccessible::getForeground()
293 throw (RuntimeException
)
295 vos::OGuard
aGuard(Application::GetSolarMutex());
298 throw RuntimeException();
299 return (sal_Int32
) pWin
->GetTextColor().GetColor();
302 sal_Int32 SAL_CALL
SmGraphicAccessible::getBackground()
303 throw (RuntimeException
)
305 vos::OGuard
aGuard(Application::GetSolarMutex());
308 throw RuntimeException();
309 Wallpaper
aWall( pWin
->GetDisplayBackground() );
311 if (aWall
.IsBitmap() || aWall
.IsGradient())
312 nCol
= pWin
->GetSettings().GetStyleSettings().GetWindowColor().GetColor();
314 nCol
= aWall
.GetColor().GetColor();
315 return (sal_Int32
) nCol
;
318 sal_Int32 SAL_CALL
SmGraphicAccessible::getAccessibleChildCount()
319 throw (RuntimeException
)
321 vos::OGuard
aGuard(Application::GetSolarMutex());
325 Reference
< XAccessible
> SAL_CALL
SmGraphicAccessible::getAccessibleChild(
327 throw (IndexOutOfBoundsException
, RuntimeException
)
329 vos::OGuard
aGuard(Application::GetSolarMutex());
330 throw IndexOutOfBoundsException(); // there is no child...
334 Reference
< XAccessible
> SAL_CALL
SmGraphicAccessible::getAccessibleParent()
335 throw (RuntimeException
)
337 vos::OGuard
aGuard(Application::GetSolarMutex());
339 throw RuntimeException();
341 Window
*pAccParent
= pWin
->GetAccessibleParentWindow();
342 DBG_ASSERT( pAccParent
, "accessible parent missing" );
343 return pAccParent
? pAccParent
->GetAccessible() : Reference
< XAccessible
>();
346 sal_Int32 SAL_CALL
SmGraphicAccessible::getAccessibleIndexInParent()
347 throw (RuntimeException
)
349 vos::OGuard
aGuard(Application::GetSolarMutex());
351 Window
*pAccParent
= pWin
? pWin
->GetAccessibleParentWindow() : 0;
354 USHORT nCnt
= pAccParent
->GetAccessibleChildWindowCount();
355 for (USHORT i
= 0; i
< nCnt
&& nIdx
== -1; ++i
)
356 if (pAccParent
->GetAccessibleChildWindow( i
) == pWin
)
362 sal_Int16 SAL_CALL
SmGraphicAccessible::getAccessibleRole()
363 throw (RuntimeException
)
365 vos::OGuard
aGuard(Application::GetSolarMutex());
366 return AccessibleRole::DOCUMENT
;
369 OUString SAL_CALL
SmGraphicAccessible::getAccessibleDescription()
370 throw (RuntimeException
)
372 vos::OGuard
aGuard(Application::GetSolarMutex());
373 SmDocShell
*pDoc
= GetDoc_Impl();
374 return pDoc
? OUString(pDoc
->GetText()) : OUString();
377 OUString SAL_CALL
SmGraphicAccessible::getAccessibleName()
378 throw (RuntimeException
)
380 vos::OGuard
aGuard(Application::GetSolarMutex());
384 Reference
< XAccessibleRelationSet
> SAL_CALL
SmGraphicAccessible::getAccessibleRelationSet()
385 throw (RuntimeException
)
387 vos::OGuard
aGuard(Application::GetSolarMutex());
388 Reference
< XAccessibleRelationSet
> xRelSet
= new utl::AccessibleRelationSetHelper();
389 return xRelSet
; // empty relation set
392 Reference
< XAccessibleStateSet
> SAL_CALL
SmGraphicAccessible::getAccessibleStateSet()
393 throw (RuntimeException
)
395 vos::OGuard
aGuard(Application::GetSolarMutex());
396 ::utl::AccessibleStateSetHelper
*pStateSet
=
397 new ::utl::AccessibleStateSetHelper
;
399 Reference
<XAccessibleStateSet
> xStateSet( pStateSet
);
402 pStateSet
->AddState( AccessibleStateType::DEFUNC
);
405 //pStateSet->AddState( AccessibleStateType::EDITABLE );
406 //pStateSet->AddState( AccessibleStateType::HORIZONTAL );
407 //pStateSet->AddState( AccessibleStateType::TRANSIENT );
408 pStateSet
->AddState( AccessibleStateType::ENABLED
);
409 pStateSet
->AddState( AccessibleStateType::FOCUSABLE
);
410 if (pWin
->HasFocus())
411 pStateSet
->AddState( AccessibleStateType::FOCUSED
);
412 if (pWin
->IsActive())
413 pStateSet
->AddState( AccessibleStateType::ACTIVE
);
414 if (pWin
->IsVisible())
415 pStateSet
->AddState( AccessibleStateType::SHOWING
);
416 if (pWin
->IsReallyVisible())
417 pStateSet
->AddState( AccessibleStateType::VISIBLE
);
418 if (COL_TRANSPARENT
!= pWin
->GetBackground().GetColor().GetColor())
419 pStateSet
->AddState( AccessibleStateType::OPAQUE
);
425 Locale SAL_CALL
SmGraphicAccessible::getLocale()
426 throw (IllegalAccessibleComponentStateException
, RuntimeException
)
428 vos::OGuard
aGuard(Application::GetSolarMutex());
429 // should be the document language...
430 // We use the language of the localized symbol names here.
431 return Application::GetSettings().GetUILocale();
435 void SAL_CALL
SmGraphicAccessible::addEventListener(
436 const Reference
< XAccessibleEventListener
>& xListener
)
437 throw (RuntimeException
)
441 vos::OGuard
aGuard(Application::GetSolarMutex());
445 nClientId
= comphelper::AccessibleEventNotifier::registerClient( );
446 comphelper::AccessibleEventNotifier::addEventListener( nClientId
, xListener
);
451 void SAL_CALL
SmGraphicAccessible::removeEventListener(
452 const Reference
< XAccessibleEventListener
>& xListener
)
453 throw (RuntimeException
)
457 vos::OGuard
aGuard(Application::GetSolarMutex());
458 sal_Int32 nListenerCount
= comphelper::AccessibleEventNotifier::removeEventListener( nClientId
, xListener
);
459 if ( !nListenerCount
)
461 // no listeners anymore
462 // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
463 // and at least to us not firing any events anymore, in case somebody calls
464 // NotifyAccessibleEvent, again
465 comphelper::AccessibleEventNotifier::revokeClient( nClientId
);
471 sal_Int32 SAL_CALL
SmGraphicAccessible::getCaretPosition()
472 throw (RuntimeException
)
474 vos::OGuard
aGuard(Application::GetSolarMutex());
478 sal_Bool SAL_CALL
SmGraphicAccessible::setCaretPosition( sal_Int32 nIndex
)
479 throw (IndexOutOfBoundsException
, RuntimeException
)
481 xub_StrLen nIdx
= (xub_StrLen
) nIndex
;
482 String
aTxt( GetAccessibleText_Impl() );
483 if (!(/*0 <= nIdx &&*/ nIdx
< aTxt
.Len()))
484 throw IndexOutOfBoundsException();
488 sal_Unicode SAL_CALL
SmGraphicAccessible::getCharacter( sal_Int32 nIndex
)
489 throw (IndexOutOfBoundsException
, RuntimeException
)
491 vos::OGuard
aGuard(Application::GetSolarMutex());
493 xub_StrLen nIdx
= (xub_StrLen
) nIndex
;
494 String
aTxt( GetAccessibleText_Impl() );
495 if (!(/*0 <= nIdx &&*/ nIdx
< aTxt
.Len()))
496 throw IndexOutOfBoundsException();
497 return aTxt
.GetChar( nIdx
);
500 Sequence
< beans::PropertyValue
> SAL_CALL
SmGraphicAccessible::getCharacterAttributes(
502 const uno::Sequence
< ::rtl::OUString
> & /*rRequestedAttributes*/ )
503 throw (IndexOutOfBoundsException
, RuntimeException
)
505 vos::OGuard
aGuard(Application::GetSolarMutex());
506 INT32 nLen
= GetAccessibleText_Impl().Len();
507 if (!(0 <= nIndex
&& nIndex
< nLen
))
508 throw IndexOutOfBoundsException();
509 return Sequence
< beans::PropertyValue
>();
512 awt::Rectangle SAL_CALL
SmGraphicAccessible::getCharacterBounds( sal_Int32 nIndex
)
513 throw (IndexOutOfBoundsException
, RuntimeException
)
515 vos::OGuard
aGuard(Application::GetSolarMutex());
520 throw RuntimeException();
523 // get accessible text
524 SmViewShell
*pView
= pWin
->GetView();
525 SmDocShell
*pDoc
= pView
? pView
->GetDoc() : 0;
527 throw RuntimeException();
528 String
aTxt( GetAccessibleText_Impl() );
529 if (!(0 <= nIndex
&& nIndex
<= aTxt
.Len())) // #108812# aTxt.Len() is valid
530 throw IndexOutOfBoundsException();
532 // #108812# find a reasonable rectangle for position aTxt.Len().
533 bool bWasBehindText
= (nIndex
== aTxt
.Len());
534 if (bWasBehindText
&& nIndex
)
537 const SmNode
*pTree
= pDoc
->GetFormulaTree();
538 const SmNode
*pNode
= pTree
->FindNodeWithAccessibleIndex( (xub_StrLen
) nIndex
);
539 //! pNode may be 0 if the index belongs to a char that was inserted
540 //! only for the accessible text!
543 sal_Int32 nAccIndex
= pNode
->GetAccessibleIndex();
544 DBG_ASSERT( nAccIndex
>= 0, "invalid accessible index" );
545 DBG_ASSERT( nIndex
>= nAccIndex
, "index out of range" );
548 pNode
->GetAccessibleText( aNodeText
);
549 sal_Int32 nNodeIndex
= nIndex
- nAccIndex
;
550 if (0 <= nNodeIndex
&& nNodeIndex
< aNodeText
.Len())
552 // get appropriate rectangle
553 Point
aOffset(pNode
->GetTopLeft() - pTree
->GetTopLeft());
554 Point
aTLPos (pWin
->GetFormulaDrawPos() + aOffset
);
555 // aTLPos.X() -= pNode->GetItalicLeftSpace();
556 // Size aSize (pNode->GetItalicSize());
558 Size
aSize (pNode
->GetSize());
560 sal_Int32
*pXAry
= new sal_Int32
[ aNodeText
.Len() ];
561 pWin
->SetFont( pNode
->GetFont() );
562 pWin
->GetTextArray( aNodeText
, pXAry
, 0, aNodeText
.Len() );
563 aTLPos
.X() += nNodeIndex
> 0 ? pXAry
[nNodeIndex
- 1] : 0;
564 aSize
.Width() = nNodeIndex
> 0 ? pXAry
[nNodeIndex
] - pXAry
[nNodeIndex
- 1] : pXAry
[nNodeIndex
];
567 #if OSL_DEBUG_LEVEL > 1
568 Point
aLP00( pWin
->LogicToPixel( Point(0,0)) );
569 Point
aPL00( pWin
->PixelToLogic( Point(0,0)) );
571 aTLPos
= pWin
->LogicToPixel( aTLPos
);
572 aSize
= pWin
->LogicToPixel( aSize
);
575 aRes
.Width
= aSize
.Width();
576 aRes
.Height
= aSize
.Height();
580 // #108812# take rectangle from last character and move it to the right
582 aRes
.X
+= aRes
.Width
;
588 sal_Int32 SAL_CALL
SmGraphicAccessible::getCharacterCount()
589 throw (RuntimeException
)
591 vos::OGuard
aGuard(Application::GetSolarMutex());
592 return GetAccessibleText_Impl().Len();
595 sal_Int32 SAL_CALL
SmGraphicAccessible::getIndexAtPoint( const awt::Point
& aPoint
)
596 throw (RuntimeException
)
598 vos::OGuard
aGuard(Application::GetSolarMutex());
603 const SmNode
*pTree
= pWin
->GetView()->GetDoc()->GetFormulaTree();
604 //! kann NULL sein! ZB wenn bereits beim laden des Dokuments (bevor der
605 //! Parser angeworfen wurde) ins Fenster geklickt wird.
609 // get position relativ to formula draw position
610 Point
aPos( aPoint
.X
, aPoint
.Y
);
611 aPos
= pWin
->PixelToLogic( aPos
);
612 aPos
-= pWin
->GetFormulaDrawPos();
614 // if it was inside the formula then get the appropriate node
615 const SmNode
*pNode
= 0;
616 if (pTree
->OrientedDist(aPos
) <= 0)
617 pNode
= pTree
->FindRectClosestTo(aPos
);
621 // get appropriate rectangle
622 Point
aOffset( pNode
->GetTopLeft() - pTree
->GetTopLeft() );
623 Point
aTLPos ( /*pWin->GetFormulaDrawPos() +*/ aOffset
);
624 // aTLPos.X() -= pNode->GetItalicLeftSpace();
625 // Size aSize( pNode->GetItalicSize() );
627 Size
aSize( pNode
->GetSize() );
628 #if OSL_DEBUG_LEVEL > 1
629 Point
aLP00( pWin
->LogicToPixel( Point(0,0)) );
630 Point
aPL00( pWin
->PixelToLogic( Point(0,0)) );
633 Rectangle
aRect( aTLPos
, aSize
);
634 if (aRect
.IsInside( aPos
))
636 DBG_ASSERT( pNode
->IsVisible(), "node is not a leaf" );
638 pNode
->GetAccessibleText( aTxt
);
639 DBG_ASSERT( aTxt
.Len(), "no accessible text available" );
641 long nNodeX
= pNode
->GetLeft();
643 sal_Int32
*pXAry
= new sal_Int32
[ aTxt
.Len() ];
644 pWin
->SetFont( pNode
->GetFont() );
645 pWin
->GetTextArray( aTxt
, pXAry
, 0, aTxt
.Len() );
646 for (sal_Int32 i
= 0; i
< aTxt
.Len() && nRes
== -1; ++i
)
648 if (pXAry
[i
] + nNodeX
> aPos
.X())
652 DBG_ASSERT( nRes
>= 0 && nRes
< aTxt
.Len(), "index out of range" );
653 DBG_ASSERT( pNode
->GetAccessibleIndex() >= 0,
654 "invalid accessible index" );
656 nRes
= pNode
->GetAccessibleIndex() + nRes
;
663 OUString SAL_CALL
SmGraphicAccessible::getSelectedText()
664 throw (RuntimeException
)
666 vos::OGuard
aGuard(Application::GetSolarMutex());
670 sal_Int32 SAL_CALL
SmGraphicAccessible::getSelectionStart()
671 throw (RuntimeException
)
673 vos::OGuard
aGuard(Application::GetSolarMutex());
677 sal_Int32 SAL_CALL
SmGraphicAccessible::getSelectionEnd()
678 throw (RuntimeException
)
680 vos::OGuard
aGuard(Application::GetSolarMutex());
684 sal_Bool SAL_CALL
SmGraphicAccessible::setSelection(
685 sal_Int32 nStartIndex
,
686 sal_Int32 nEndIndex
)
687 throw (IndexOutOfBoundsException
, RuntimeException
)
689 vos::OGuard
aGuard(Application::GetSolarMutex());
690 INT32 nLen
= GetAccessibleText_Impl().Len();
691 if (!(0 <= nStartIndex
&& nStartIndex
< nLen
) ||
692 !(0 <= nEndIndex
&& nEndIndex
< nLen
))
693 throw IndexOutOfBoundsException();
697 OUString SAL_CALL
SmGraphicAccessible::getText()
698 throw (RuntimeException
)
700 vos::OGuard
aGuard(Application::GetSolarMutex());
701 return GetAccessibleText_Impl();
704 OUString SAL_CALL
SmGraphicAccessible::getTextRange(
705 sal_Int32 nStartIndex
,
706 sal_Int32 nEndIndex
)
707 throw (IndexOutOfBoundsException
, RuntimeException
)
709 //!! nEndIndex may be the string length per definition of the interface !!
710 //!! text should be copied exclusive that end index though. And arguments
711 //!! may be switched.
713 vos::OGuard
aGuard(Application::GetSolarMutex());
714 String
aTxt( GetAccessibleText_Impl() );
715 xub_StrLen nStart
= (xub_StrLen
) Min(nStartIndex
, nEndIndex
);
716 xub_StrLen nEnd
= (xub_StrLen
) Max(nStartIndex
, nEndIndex
);
717 if (!(/*0 <= nStart &&*/ nStart
<= aTxt
.Len()) ||
718 !(/*0 <= nEnd &&*/ nEnd
<= aTxt
.Len()))
719 throw IndexOutOfBoundsException();
720 return aTxt
.Copy( nStart
, nEnd
- nStart
);
723 ::com::sun::star::accessibility::TextSegment SAL_CALL
SmGraphicAccessible::getTextAtIndex( sal_Int32 nIndex
, sal_Int16 aTextType
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
)
725 vos::OGuard
aGuard(Application::GetSolarMutex());
726 String
aTxt( GetAccessibleText_Impl() );
727 xub_StrLen nIdx
= (xub_StrLen
) nIndex
;
728 //!! nIndex is allowed to be the string length
729 if (!(/*0 <= nIdx &&*/ nIdx
<= aTxt
.Len()))
730 throw IndexOutOfBoundsException();
732 ::com::sun::star::accessibility::TextSegment aResult
;
733 aResult
.SegmentStart
= -1;
734 aResult
.SegmentEnd
= -1;
735 if ( (AccessibleTextType::CHARACTER
== aTextType
) && (nIdx
< aTxt
.Len()) )
737 aResult
.SegmentText
= aTxt
.Copy(nIdx
, 1);
738 aResult
.SegmentStart
= nIdx
;
739 aResult
.SegmentEnd
= nIdx
+1;
744 ::com::sun::star::accessibility::TextSegment SAL_CALL
SmGraphicAccessible::getTextBeforeIndex( sal_Int32 nIndex
, sal_Int16 aTextType
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
)
746 vos::OGuard
aGuard(Application::GetSolarMutex());
747 String
aTxt( GetAccessibleText_Impl() );
748 xub_StrLen nIdx
= (xub_StrLen
) nIndex
;
749 //!! nIndex is allowed to be the string length
750 if (!(/*0 <= nIdx &&*/ nIdx
<= aTxt
.Len()))
751 throw IndexOutOfBoundsException();
753 ::com::sun::star::accessibility::TextSegment aResult
;
754 aResult
.SegmentStart
= -1;
755 aResult
.SegmentEnd
= -1;
757 if ( (AccessibleTextType::CHARACTER
== aTextType
) && nIdx
)
759 aResult
.SegmentText
= aTxt
.Copy(nIdx
-1, 1);
760 aResult
.SegmentStart
= nIdx
-1;
761 aResult
.SegmentEnd
= nIdx
;
766 ::com::sun::star::accessibility::TextSegment SAL_CALL
SmGraphicAccessible::getTextBehindIndex( sal_Int32 nIndex
, sal_Int16 aTextType
) throw (::com::sun::star::lang::IndexOutOfBoundsException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
)
768 vos::OGuard
aGuard(Application::GetSolarMutex());
769 String
aTxt( GetAccessibleText_Impl() );
770 xub_StrLen nIdx
= (xub_StrLen
) nIndex
;
771 //!! nIndex is allowed to be the string length
772 if (!(/*0 <= nIdx &&*/ nIdx
<= aTxt
.Len()))
773 throw IndexOutOfBoundsException();
775 ::com::sun::star::accessibility::TextSegment aResult
;
776 aResult
.SegmentStart
= -1;
777 aResult
.SegmentEnd
= -1;
779 nIdx
++; // text *behind*
780 if ( (AccessibleTextType::CHARACTER
== aTextType
) && (nIdx
< aTxt
.Len()) )
782 aResult
.SegmentText
= aTxt
.Copy(nIdx
, 1);
783 aResult
.SegmentStart
= nIdx
;
784 aResult
.SegmentEnd
= nIdx
+1;
789 sal_Bool SAL_CALL
SmGraphicAccessible::copyText(
790 sal_Int32 nStartIndex
,
791 sal_Int32 nEndIndex
)
792 throw (IndexOutOfBoundsException
, RuntimeException
)
794 vos::OGuard
aGuard(Application::GetSolarMutex());
795 sal_Bool bReturn
= sal_False
;
798 throw RuntimeException();
801 Reference
< datatransfer::clipboard::XClipboard
> xClipboard
= pWin
->GetClipboard();
802 if ( xClipboard
.is() )
804 ::rtl::OUString
sText( getTextRange(nStartIndex
, nEndIndex
) );
806 ::vcl::unohelper::TextDataObject
* pDataObj
= new ::vcl::unohelper::TextDataObject( sText
);
807 const sal_uInt32 nRef
= Application::ReleaseSolarMutex();
808 xClipboard
->setContents( pDataObj
, NULL
);
810 Reference
< datatransfer::clipboard::XFlushableClipboard
> xFlushableClipboard( xClipboard
, uno::UNO_QUERY
);
811 if( xFlushableClipboard
.is() )
812 xFlushableClipboard
->flushClipboard();
814 Application::AcquireSolarMutex( nRef
);
823 OUString SAL_CALL
SmGraphicAccessible::getImplementationName()
824 throw (RuntimeException
)
826 //vos::OGuard aGuard(Application::GetSolarMutex());
827 return A2OU("SmGraphicAccessible");
830 sal_Bool SAL_CALL
SmGraphicAccessible::supportsService(
831 const OUString
& rServiceName
)
832 throw (RuntimeException
)
834 //vos::OGuard aGuard(Application::GetSolarMutex());
835 return rServiceName
== A2OU( "com::sun::star::accessibility::Accessible" ) ||
836 rServiceName
== A2OU( "com::sun::star::accessibility::AccessibleComponent" ) ||
837 rServiceName
== A2OU( "com::sun::star::accessibility::AccessibleContext" ) ||
838 rServiceName
== A2OU( "com::sun::star::accessibility::AccessibleText" );
841 Sequence
< OUString
> SAL_CALL
SmGraphicAccessible::getSupportedServiceNames()
842 throw (RuntimeException
)
844 //vos::OGuard aGuard(Application::GetSolarMutex());
845 Sequence
< OUString
> aNames(4);
846 OUString
*pNames
= aNames
.getArray();
847 pNames
[0] = A2OU( "com::sun::star::accessibility::Accessible" );
848 pNames
[1] = A2OU( "com::sun::star::accessibility::AccessibleComponent" );
849 pNames
[2] = A2OU( "com::sun::star::accessibility::AccessibleContext" );
850 pNames
[3] = A2OU( "com::sun::star::accessibility::AccessibleText" );
854 //////////////////////////////////////////////////////////////////////
856 //------------------------------------------------------------------------
858 SmEditSource::SmEditSource( SmEditWindow
* /*pWin*/, SmEditAccessible
&rAcc
) :
860 aTextFwd (rAcc
, *this),
866 SmEditSource::SmEditSource( const SmEditSource
&rSrc
) :
868 aViewFwd (rSrc
.rEditAcc
),
869 aTextFwd (rSrc
.rEditAcc
, *this),
870 aEditViewFwd(rSrc
.rEditAcc
),
871 rEditAcc (rSrc
.rEditAcc
)
873 //aBroadCaster; can be completely new
876 SmEditSource::~SmEditSource()
880 SvxEditSource
* SmEditSource::Clone() const
882 return new SmEditSource( *this );
885 SvxTextForwarder
* SmEditSource::GetTextForwarder()
890 SvxViewForwarder
* SmEditSource::GetViewForwarder()
895 SvxEditViewForwarder
* SmEditSource::GetEditViewForwarder( sal_Bool
/*bCreate*/ )
897 return &aEditViewFwd
;
900 void SmEditSource::UpdateData()
902 // would possibly only by needed if the XText inteface is implemented
903 // and its text needs to be updated.
906 SfxBroadcaster
& SmEditSource::GetBroadcaster() const
908 return ((SmEditSource
*) this)->aBroadCaster
;
911 //------------------------------------------------------------------------
913 SmViewForwarder::SmViewForwarder( SmEditAccessible
&rAcc
) :
918 SmViewForwarder::~SmViewForwarder()
922 BOOL
SmViewForwarder::IsValid() const
924 return rEditAcc
.GetEditView() != 0;
927 Rectangle
SmViewForwarder::GetVisArea() const
929 EditView
*pEditView
= rEditAcc
.GetEditView();
930 OutputDevice
* pOutDev
= pEditView
? pEditView
->GetWindow() : 0;
932 if( pOutDev
&& pEditView
)
934 Rectangle aVisArea
= pEditView
->GetVisArea();
936 // figure out map mode from edit engine
937 EditEngine
* pEditEngine
= pEditView
->GetEditEngine();
941 MapMode
aMapMode(pOutDev
->GetMapMode());
942 aVisArea
= OutputDevice::LogicToLogic( aVisArea
,
943 pEditEngine
->GetRefMapMode(),
944 aMapMode
.GetMapUnit() );
945 aMapMode
.SetOrigin(Point());
946 return pOutDev
->LogicToPixel( aVisArea
, aMapMode
);
953 Point
SmViewForwarder::LogicToPixel( const Point
& rPoint
, const MapMode
& rMapMode
) const
955 EditView
*pEditView
= rEditAcc
.GetEditView();
956 OutputDevice
* pOutDev
= pEditView
? pEditView
->GetWindow() : 0;
960 MapMode
aMapMode(pOutDev
->GetMapMode());
961 Point
aPoint( OutputDevice::LogicToLogic( rPoint
, rMapMode
,
962 aMapMode
.GetMapUnit() ) );
963 aMapMode
.SetOrigin(Point());
964 return pOutDev
->LogicToPixel( aPoint
, aMapMode
);
970 Point
SmViewForwarder::PixelToLogic( const Point
& rPoint
, const MapMode
& rMapMode
) const
972 EditView
*pEditView
= rEditAcc
.GetEditView();
973 OutputDevice
* pOutDev
= pEditView
? pEditView
->GetWindow() : 0;
977 MapMode
aMapMode(pOutDev
->GetMapMode());
978 aMapMode
.SetOrigin(Point());
979 Point
aPoint( pOutDev
->PixelToLogic( rPoint
, aMapMode
) );
980 return OutputDevice::LogicToLogic( aPoint
,
981 aMapMode
.GetMapUnit(),
989 //------------------------------------------------------------------------
991 SmTextForwarder::SmTextForwarder( SmEditAccessible
& rAcc
, SmEditSource
& rSource
) :
993 rEditSource (rSource
)
995 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
997 pEditEngine
->SetNotifyHdl( LINK(this, SmTextForwarder
, NotifyHdl
) );
1000 SmTextForwarder::~SmTextForwarder()
1002 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1004 pEditEngine
->SetNotifyHdl( Link() );
1007 IMPL_LINK(SmTextForwarder
, NotifyHdl
, EENotify
*, aNotify
)
1011 ::std::auto_ptr
< SfxHint
> aHint
= SvxEditSourceHelper::EENotification2Hint( aNotify
);
1013 rEditSource
.GetBroadcaster().Broadcast( *aHint
.get() );
1019 USHORT
SmTextForwarder::GetParagraphCount() const
1021 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1022 return pEditEngine
? pEditEngine
->GetParagraphCount() : 0;
1025 USHORT
SmTextForwarder::GetTextLen( USHORT nParagraph
) const
1027 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1028 return pEditEngine
? pEditEngine
->GetTextLen( nParagraph
) : 0;
1031 String
SmTextForwarder::GetText( const ESelection
& rSel
) const
1033 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1036 aRet
= pEditEngine
->GetText( rSel
, LINEEND_LF
);
1037 aRet
.ConvertLineEnd();
1041 SfxItemSet
SmTextForwarder::GetAttribs( const ESelection
& rSel
, BOOL bOnlyHardAttrib
) const
1043 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1044 DBG_ASSERT( pEditEngine
, "EditEngine missing" );
1045 if( rSel
.nStartPara
== rSel
.nEndPara
)
1047 sal_uInt8 nFlags
= 0;
1048 switch( bOnlyHardAttrib
)
1050 case EditEngineAttribs_All
:
1051 nFlags
= GETATTRIBS_ALL
;
1053 case EditEngineAttribs_HardAndPara
:
1054 nFlags
= GETATTRIBS_PARAATTRIBS
|GETATTRIBS_CHARATTRIBS
;
1056 case EditEngineAttribs_OnlyHard
:
1057 nFlags
= GETATTRIBS_CHARATTRIBS
;
1060 DBG_ERROR("unknown flags for SmTextForwarder::GetAttribs");
1063 return pEditEngine
->GetAttribs( rSel
.nStartPara
, rSel
.nStartPos
, rSel
.nEndPos
, nFlags
);
1067 return pEditEngine
->GetAttribs( rSel
, bOnlyHardAttrib
);
1071 SfxItemSet
SmTextForwarder::GetParaAttribs( USHORT nPara
) const
1073 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1074 DBG_ASSERT( pEditEngine
, "EditEngine missing" );
1076 SfxItemSet
aSet( pEditEngine
->GetParaAttribs( nPara
) );
1078 USHORT nWhich
= EE_PARA_START
;
1079 while( nWhich
<= EE_PARA_END
)
1081 if( aSet
.GetItemState( nWhich
, TRUE
) != SFX_ITEM_ON
)
1083 if( pEditEngine
->HasParaAttrib( nPara
, nWhich
) )
1084 aSet
.Put( pEditEngine
->GetParaAttrib( nPara
, nWhich
) );
1092 void SmTextForwarder::SetParaAttribs( USHORT nPara
, const SfxItemSet
& rSet
)
1094 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1096 pEditEngine
->SetParaAttribs( nPara
, rSet
);
1099 SfxItemPool
* SmTextForwarder::GetPool() const
1101 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1102 return pEditEngine
? pEditEngine
->GetEmptyItemSet().GetPool() : 0;
1105 void SmTextForwarder::RemoveAttribs( const ESelection
& rSelection
, sal_Bool bRemoveParaAttribs
, sal_uInt16 nWhich
)
1107 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1109 pEditEngine
->RemoveAttribs( rSelection
, bRemoveParaAttribs
, nWhich
);
1112 void SmTextForwarder::GetPortions( USHORT nPara
, SvUShorts
& rList
) const
1114 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1116 pEditEngine
->GetPortions( nPara
, rList
);
1119 void SmTextForwarder::QuickInsertText( const String
& rText
, const ESelection
& rSel
)
1121 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1123 pEditEngine
->QuickInsertText( rText
, rSel
);
1126 void SmTextForwarder::QuickInsertLineBreak( const ESelection
& rSel
)
1128 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1130 pEditEngine
->QuickInsertLineBreak( rSel
);
1133 void SmTextForwarder::QuickInsertField( const SvxFieldItem
& rFld
, const ESelection
& rSel
)
1135 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1137 pEditEngine
->QuickInsertField( rFld
, rSel
);
1140 void SmTextForwarder::QuickSetAttribs( const SfxItemSet
& rSet
, const ESelection
& rSel
)
1142 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1144 pEditEngine
->QuickSetAttribs( rSet
, rSel
);
1147 BOOL
SmTextForwarder::IsValid() const
1149 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1150 // cannot reliably query EditEngine state
1151 // while in the middle of an update
1152 return pEditEngine
? pEditEngine
->GetUpdateMode() : FALSE
;
1155 XubString
SmTextForwarder::CalcFieldValue( const SvxFieldItem
& rField
, USHORT nPara
, USHORT nPos
, Color
*& rpTxtColor
, Color
*& rpFldColor
)
1158 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1160 aTxt
= pEditEngine
->CalcFieldValue( rField
, nPara
, nPos
, rpTxtColor
, rpFldColor
);
1164 USHORT
GetSvxEditEngineItemState( EditEngine
& rEditEngine
, const ESelection
& rSel
, USHORT nWhich
)
1166 EECharAttribArray aAttribs
;
1168 const SfxPoolItem
* pLastItem
= NULL
;
1170 SfxItemState eState
= SFX_ITEM_DEFAULT
;
1172 // check all paragraphs inside the selection
1173 for( USHORT nPara
= rSel
.nStartPara
; nPara
<= rSel
.nEndPara
; nPara
++ )
1175 SfxItemState eParaState
= SFX_ITEM_DEFAULT
;
1177 // calculate start and endpos for this paragraph
1179 if( rSel
.nStartPara
== nPara
)
1180 nPos
= rSel
.nStartPos
;
1182 USHORT nEndPos
= rSel
.nEndPos
;
1183 if( rSel
.nEndPara
!= nPara
)
1184 nEndPos
= rEditEngine
.GetTextLen( nPara
);
1187 // get list of char attribs
1188 rEditEngine
.GetCharAttribs( nPara
, aAttribs
);
1190 BOOL bEmpty
= TRUE
; // we found no item inside the selektion of this paragraph
1191 BOOL bGaps
= FALSE
; // we found items but theire gaps between them
1192 USHORT nLastEnd
= nPos
;
1194 const SfxPoolItem
* pParaItem
= NULL
;
1196 for( USHORT nAttrib
= 0; nAttrib
< aAttribs
.Count(); nAttrib
++ )
1198 struct EECharAttrib aAttrib
= aAttribs
.GetObject( nAttrib
);
1199 DBG_ASSERT( aAttrib
.pAttr
, "GetCharAttribs gives corrupt data" );
1201 const sal_Bool bEmptyPortion
= aAttrib
.nStart
== aAttrib
.nEnd
;
1202 if( (!bEmptyPortion
&& (aAttrib
.nStart
>= nEndPos
)) || (bEmptyPortion
&& (aAttrib
.nStart
> nEndPos
)) )
1203 break; // break if we are already behind our selektion
1205 if( (!bEmptyPortion
&& (aAttrib
.nEnd
<= nPos
)) || (bEmptyPortion
&& (aAttrib
.nEnd
< nPos
)) )
1206 continue; // or if the attribute ends before our selektion
1208 if( aAttrib
.pAttr
->Which() != nWhich
)
1209 continue; // skip if is not the searched item
1211 // if we already found an item
1214 // ... and its different to this one than the state is dont care
1215 if( *pParaItem
!= *aAttrib
.pAttr
)
1216 return SFX_ITEM_DONTCARE
;
1220 pParaItem
= aAttrib
.pAttr
;
1226 if( !bGaps
&& aAttrib
.nStart
> nLastEnd
)
1229 nLastEnd
= aAttrib
.nEnd
;
1232 if( !bEmpty
&& !bGaps
&& nLastEnd
< ( nEndPos
- 1 ) )
1235 // since we have no portion with our item or if there were gaps
1236 if( bEmpty || bGaps )
1238 // we need to check the paragraph item
1239 const SfxItemSet& rParaSet = rEditEngine.GetParaAttribs( nPara );
1240 if( rParaSet.GetItemState( nWhich ) == SFX_ITEM_SET )
1242 eState = SFX_ITEM_SET;
1243 // get item from the paragraph
1244 const SfxPoolItem* pTempItem = rParaSet.GetItem( nWhich );
1247 if( *pParaItem != *pTempItem )
1248 return SFX_ITEM_DONTCARE;
1252 pParaItem = pTempItem;
1255 // set if theres no last item or if its the same
1256 eParaState = SFX_ITEM_SET;
1260 eParaState = SFX_ITEM_DEFAULT;
1264 // gaps and item not set in paragraph, thats a dont care
1265 return SFX_ITEM_DONTCARE;
1270 eParaState = SFX_ITEM_SET;
1274 eParaState
= SFX_ITEM_DEFAULT
;
1276 eParaState
= SFX_ITEM_DONTCARE
;
1278 eParaState
= SFX_ITEM_SET
;
1280 // if we already found an item check if we found the same
1283 if( (pParaItem
== NULL
) || (*pLastItem
!= *pParaItem
) )
1284 return SFX_ITEM_DONTCARE
;
1288 pLastItem
= pParaItem
;
1289 eState
= eParaState
;
1296 USHORT
SmTextForwarder::GetItemState( const ESelection
& rSel
, USHORT nWhich
) const
1298 USHORT nState
= SFX_ITEM_DISABLED
;
1299 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1301 nState
= GetSvxEditEngineItemState( *pEditEngine
, rSel
, nWhich
);
1305 USHORT
SmTextForwarder::GetItemState( USHORT nPara
, USHORT nWhich
) const
1307 USHORT nState
= SFX_ITEM_DISABLED
;
1308 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1311 const SfxItemSet
& rSet
= pEditEngine
->GetParaAttribs( nPara
);
1312 nState
= rSet
.GetItemState( nWhich
);
1317 LanguageType
SmTextForwarder::GetLanguage( USHORT nPara
, USHORT nIndex
) const
1319 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1320 return pEditEngine
? pEditEngine
->GetLanguage(nPara
, nIndex
) : LANGUAGE_NONE
;
1323 USHORT
SmTextForwarder::GetFieldCount( USHORT nPara
) const
1325 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1326 return pEditEngine
? pEditEngine
->GetFieldCount(nPara
) : 0;
1329 EFieldInfo
SmTextForwarder::GetFieldInfo( USHORT nPara
, USHORT nField
) const
1331 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1332 return pEditEngine
? pEditEngine
->GetFieldInfo( nPara
, nField
) : EFieldInfo();
1335 EBulletInfo
SmTextForwarder::GetBulletInfo( USHORT
/*nPara*/ ) const
1337 return EBulletInfo();
1340 Rectangle
SmTextForwarder::GetCharBounds( USHORT nPara
, USHORT nIndex
) const
1342 Rectangle
aRect(0,0,0,0);
1343 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1347 // #108900# Handle virtual position one-past-the end of the string
1348 if( nIndex
>= pEditEngine
->GetTextLen(nPara
) )
1351 aRect
= pEditEngine
->GetCharacterBounds( EPosition(nPara
, nIndex
-1) );
1353 aRect
.Move( aRect
.Right() - aRect
.Left(), 0 );
1354 aRect
.SetSize( Size(1, pEditEngine
->GetTextHeight()) );
1358 aRect
= pEditEngine
->GetCharacterBounds( EPosition(nPara
, nIndex
) );
1364 Rectangle
SmTextForwarder::GetParaBounds( USHORT nPara
) const
1366 Rectangle
aRect(0,0,0,0);
1367 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1371 const Point aPnt
= pEditEngine
->GetDocPosTopLeft( nPara
);
1372 const ULONG nWidth
= pEditEngine
->CalcTextWidth();
1373 const ULONG nHeight
= pEditEngine
->GetTextHeight( nPara
);
1374 aRect
= Rectangle( aPnt
.X(), aPnt
.Y(), aPnt
.X() + nWidth
, aPnt
.Y() + nHeight
);
1380 MapMode
SmTextForwarder::GetMapMode() const
1382 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1383 return pEditEngine
? pEditEngine
->GetRefMapMode() : MapMode( MAP_100TH_MM
);
1386 OutputDevice
* SmTextForwarder::GetRefDevice() const
1388 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1389 return pEditEngine
? pEditEngine
->GetRefDevice() : 0;
1392 sal_Bool
SmTextForwarder::GetIndexAtPoint( const Point
& rPos
, USHORT
& nPara
, USHORT
& nIndex
) const
1394 sal_Bool bRes
= sal_False
;
1395 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1398 EPosition aDocPos
= pEditEngine
->FindDocPosition( rPos
);
1399 nPara
= aDocPos
.nPara
;
1400 nIndex
= aDocPos
.nIndex
;
1406 sal_Bool
SmTextForwarder::GetWordIndices( USHORT nPara
, USHORT nIndex
, USHORT
& nStart
, USHORT
& nEnd
) const
1408 sal_Bool bRes
= sal_False
;
1409 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1412 ESelection aRes
= pEditEngine
->GetWord( ESelection(nPara
, nIndex
, nPara
, nIndex
), com::sun::star::i18n::WordType::DICTIONARY_WORD
);
1414 if( aRes
.nStartPara
== nPara
&&
1415 aRes
.nStartPara
== aRes
.nEndPara
)
1417 nStart
= aRes
.nStartPos
;
1418 nEnd
= aRes
.nEndPos
;
1427 sal_Bool
SmTextForwarder::GetAttributeRun( USHORT
& nStartIndex
, USHORT
& nEndIndex
, USHORT nPara
, USHORT nIndex
) const
1429 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1430 return pEditEngine
?
1431 SvxEditSourceHelper::GetAttributeRun( nStartIndex
, nEndIndex
, *pEditEngine
, nPara
, nIndex
)
1435 USHORT
SmTextForwarder::GetLineCount( USHORT nPara
) const
1437 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1438 return pEditEngine
? pEditEngine
->GetLineCount(nPara
) : 0;
1441 USHORT
SmTextForwarder::GetLineLen( USHORT nPara
, USHORT nLine
) const
1443 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1444 return pEditEngine
? pEditEngine
->GetLineLen(nPara
, nLine
) : 0;
1447 void SmTextForwarder::GetLineBoundaries( /*out*/USHORT
&rStart
, /*out*/USHORT
&rEnd
, USHORT nPara
, USHORT nLine
) const
1449 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1450 pEditEngine
->GetLineBoundaries(rStart
, rEnd
, nPara
, nLine
);
1453 USHORT
SmTextForwarder::GetLineNumberAtIndex( USHORT nPara
, USHORT nIndex
) const
1455 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1456 return pEditEngine
? pEditEngine
->GetLineNumberAtIndex(nPara
, nIndex
) : 0;
1459 sal_Bool
SmTextForwarder::QuickFormatDoc( BOOL
/*bFull*/ )
1461 sal_Bool bRes
= sal_False
;
1462 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1465 pEditEngine
->QuickFormatDoc();
1471 sal_Int16
SmTextForwarder::GetDepth( USHORT
/*nPara*/ ) const
1473 // math has no outliner...
1477 sal_Bool
SmTextForwarder::SetDepth( USHORT
/*nPara*/, sal_Int16 nNewDepth
)
1479 // math has no outliner...
1480 return -1 == nNewDepth
; // is it the value from 'GetDepth' ?
1483 sal_Bool
SmTextForwarder::Delete( const ESelection
& rSelection
)
1485 sal_Bool bRes
= sal_False
;
1486 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1489 pEditEngine
->QuickDelete( rSelection
);
1490 pEditEngine
->QuickFormatDoc();
1496 sal_Bool
SmTextForwarder::InsertText( const String
& rStr
, const ESelection
& rSelection
)
1498 sal_Bool bRes
= sal_False
;
1499 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1502 pEditEngine
->QuickInsertText( rStr
, rSelection
);
1503 pEditEngine
->QuickFormatDoc();
1509 const SfxItemSet
* SmTextForwarder::GetEmptyItemSetPtr()
1511 const SfxItemSet
*pItemSet
= 0;
1512 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1515 pItemSet
= &pEditEngine
->GetEmptyItemSet();
1520 void SmTextForwarder::AppendParagraph()
1522 // append an empty paragraph
1523 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1526 USHORT nParaCount
= pEditEngine
->GetParagraphCount();
1527 pEditEngine
->InsertParagraph( nParaCount
, String() );
1531 xub_StrLen
SmTextForwarder::AppendTextPortion( USHORT nPara
, const String
&rText
, const SfxItemSet
&rSet
)
1533 xub_StrLen nRes
= 0;
1534 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1535 if (pEditEngine
&& nPara
< pEditEngine
->GetParagraphCount())
1538 ESelection
aSel( nPara
, pEditEngine
->GetTextLen( nPara
) );
1539 pEditEngine
->QuickInsertText( rText
, aSel
);
1541 // set attributes for new appended text
1542 nRes
= aSel
.nEndPos
= pEditEngine
->GetTextLen( nPara
);
1543 pEditEngine
->QuickSetAttribs( rSet
, aSel
);
1548 void SmTextForwarder::CopyText(const SvxTextForwarder
& rSource
)
1551 const SmTextForwarder
* pSourceForwarder
= dynamic_cast< const SmTextForwarder
* >( &rSource
);
1552 if( !pSourceForwarder
)
1554 EditEngine
* pSourceEditEngine
= pSourceForwarder
->rEditAcc
.GetEditEngine();
1555 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1556 if (pEditEngine
&& pSourceEditEngine
)
1558 EditTextObject
* pNewTextObject
= pSourceEditEngine
->CreateTextObject();
1559 pEditEngine
->SetText( *pNewTextObject
);
1560 delete pNewTextObject
;
1564 //------------------------------------------------------------------------
1566 SmEditViewForwarder::SmEditViewForwarder( SmEditAccessible
& rAcc
) :
1571 SmEditViewForwarder::~SmEditViewForwarder()
1575 BOOL
SmEditViewForwarder::IsValid() const
1577 return rEditAcc
.GetEditView() != 0;
1580 Rectangle
SmEditViewForwarder::GetVisArea() const
1582 Rectangle
aRect(0,0,0,0);
1584 EditView
*pEditView
= rEditAcc
.GetEditView();
1585 OutputDevice
* pOutDev
= pEditView
? pEditView
->GetWindow() : 0;
1587 if( pOutDev
&& pEditView
)
1589 Rectangle aVisArea
= pEditView
->GetVisArea();
1591 // figure out map mode from edit engine
1592 EditEngine
* pEditEngine
= pEditView
->GetEditEngine();
1596 MapMode
aMapMode(pOutDev
->GetMapMode());
1597 aVisArea
= OutputDevice::LogicToLogic( aVisArea
,
1598 pEditEngine
->GetRefMapMode(),
1599 aMapMode
.GetMapUnit() );
1600 aMapMode
.SetOrigin(Point());
1601 aRect
= pOutDev
->LogicToPixel( aVisArea
, aMapMode
);
1608 Point
SmEditViewForwarder::LogicToPixel( const Point
& rPoint
, const MapMode
& rMapMode
) const
1610 EditView
*pEditView
= rEditAcc
.GetEditView();
1611 OutputDevice
* pOutDev
= pEditView
? pEditView
->GetWindow() : 0;
1615 MapMode
aMapMode(pOutDev
->GetMapMode());
1616 Point
aPoint( OutputDevice::LogicToLogic( rPoint
, rMapMode
,
1617 aMapMode
.GetMapUnit() ) );
1618 aMapMode
.SetOrigin(Point());
1619 return pOutDev
->LogicToPixel( aPoint
, aMapMode
);
1625 Point
SmEditViewForwarder::PixelToLogic( const Point
& rPoint
, const MapMode
& rMapMode
) const
1627 EditView
*pEditView
= rEditAcc
.GetEditView();
1628 OutputDevice
* pOutDev
= pEditView
? pEditView
->GetWindow() : 0;
1632 MapMode
aMapMode(pOutDev
->GetMapMode());
1633 aMapMode
.SetOrigin(Point());
1634 Point
aPoint( pOutDev
->PixelToLogic( rPoint
, aMapMode
) );
1635 return OutputDevice::LogicToLogic( aPoint
,
1636 aMapMode
.GetMapUnit(),
1643 sal_Bool
SmEditViewForwarder::GetSelection( ESelection
& rSelection
) const
1645 sal_Bool bRes
= sal_False
;
1646 EditView
*pEditView
= rEditAcc
.GetEditView();
1649 rSelection
= pEditView
->GetSelection();
1655 sal_Bool
SmEditViewForwarder::SetSelection( const ESelection
& rSelection
)
1657 sal_Bool bRes
= sal_False
;
1658 EditView
*pEditView
= rEditAcc
.GetEditView();
1661 pEditView
->SetSelection( rSelection
);
1667 sal_Bool
SmEditViewForwarder::Copy()
1669 sal_Bool bRes
= sal_False
;
1670 EditView
*pEditView
= rEditAcc
.GetEditView();
1679 sal_Bool
SmEditViewForwarder::Cut()
1681 sal_Bool bRes
= sal_False
;
1682 EditView
*pEditView
= rEditAcc
.GetEditView();
1691 sal_Bool
SmEditViewForwarder::Paste()
1693 sal_Bool bRes
= sal_False
;
1694 EditView
*pEditView
= rEditAcc
.GetEditView();
1703 //------------------------------------------------------------------------
1705 SmEditAccessible::SmEditAccessible( SmEditWindow
*pEditWin
) :
1706 aAccName ( String(SmResId(STR_CMDBOXWINDOW
)) ),
1710 DBG_ASSERT( pWin
, "SmEditAccessible: window missing" );
1715 SmEditAccessible::SmEditAccessible( const SmEditAccessible
&rSmAcc
) :
1716 SmEditAccessibleBaseClass(),
1717 aAccName ( String(SmResId(STR_CMDBOXWINDOW
)) )
1719 //vos::OGuard aGuard(Application::GetSolarMutex());
1721 DBG_ASSERT( pWin
, "SmEditAccessible: window missing" );
1725 SmEditAccessible::~SmEditAccessible()
1729 vos::OGuard aGuard(Application::GetSolarMutex());
1730 if (--aRefCount == 0)
1736 void SmEditAccessible::Init()
1738 DBG_ASSERT( pWin
, "SmEditAccessible: window missing" );
1741 EditEngine
*pEditEngine
= pWin
->GetEditEngine();
1742 EditView
*pEditView
= pWin
->GetEditView();
1743 if (pEditEngine
&& pEditView
)
1745 ::std::auto_ptr
< SvxEditSource
> pEditSource(
1746 new SmEditSource( pWin
, *this ) );
1747 pTextHelper
= new ::accessibility::AccessibleTextHelper( pEditSource
);
1748 pTextHelper
->SetEventSource( this );
1753 #ifdef TL_NOT_YET_USED
1754 SmDocShell
* SmEditAccessible::GetDoc_Impl()
1756 SmViewShell
*pView
= pWin
? pWin
->GetView() : 0;
1757 return pView
? pView
->GetDoc() : 0;
1759 #endif // TL_NOT_YET_USED
1761 void SmEditAccessible::ClearWin()
1763 // #112565# remove handler before current object gets destroyed
1764 // (avoid handler being called for already dead object)
1765 EditEngine
*pEditEngine
= GetEditEngine();
1767 pEditEngine
->SetNotifyHdl( Link() );
1769 pWin
= 0; // implicitly results in AccessibleStateType::DEFUNC set
1771 //! make TextHelper implicitly release C++ references to some core objects
1772 pTextHelper
->SetEditSource( ::std::auto_ptr
<SvxEditSource
>(NULL
) );
1773 //! make TextHelper release references
1774 //! (e.g. the one set by the 'SetEventSource' call)
1775 pTextHelper
->Dispose();
1776 delete pTextHelper
; pTextHelper
= 0;
1780 uno::Reference
< XAccessibleContext
> SAL_CALL
SmEditAccessible::getAccessibleContext( )
1781 throw (RuntimeException
)
1783 vos::OGuard
aGuard(Application::GetSolarMutex());
1787 // XAccessibleComponent
1788 sal_Bool SAL_CALL
SmEditAccessible::containsPoint( const awt::Point
& aPoint
)
1789 throw (RuntimeException
)
1791 //! the arguments coordinates are relativ to the current window !
1792 //! Thus the top left-point is (0, 0)
1794 vos::OGuard
aGuard(Application::GetSolarMutex());
1796 throw RuntimeException();
1798 Size
aSz( pWin
->GetSizePixel() );
1799 return aPoint
.X
>= 0 && aPoint
.Y
>= 0 &&
1800 aPoint
.X
< aSz
.Width() && aPoint
.Y
< aSz
.Height();
1803 uno::Reference
< XAccessible
> SAL_CALL
SmEditAccessible::getAccessibleAtPoint( const awt::Point
& aPoint
)
1804 throw (RuntimeException
)
1806 vos::OGuard
aGuard(Application::GetSolarMutex());
1808 throw RuntimeException();
1809 return pTextHelper
->GetAt( aPoint
);
1812 awt::Rectangle SAL_CALL
SmEditAccessible::getBounds( )
1813 throw (RuntimeException
)
1815 vos::OGuard
aGuard(Application::GetSolarMutex());
1817 throw RuntimeException();
1818 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
1819 "mismatch of window parent and accessible parent" );
1820 return lcl_GetBounds( pWin
);
1823 awt::Point SAL_CALL
SmEditAccessible::getLocation( )
1824 throw (RuntimeException
)
1826 vos::OGuard
aGuard(Application::GetSolarMutex());
1828 throw RuntimeException();
1829 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
1830 "mismatch of window parent and accessible parent" );
1831 awt::Rectangle
aRect( lcl_GetBounds( pWin
) );
1832 return awt::Point( aRect
.X
, aRect
.Y
);
1835 awt::Point SAL_CALL
SmEditAccessible::getLocationOnScreen( )
1836 throw (RuntimeException
)
1838 vos::OGuard
aGuard(Application::GetSolarMutex());
1840 throw RuntimeException();
1841 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
1842 "mismatch of window parent and accessible parent" );
1843 return lcl_GetLocationOnScreen( pWin
);
1846 awt::Size SAL_CALL
SmEditAccessible::getSize( )
1847 throw (RuntimeException
)
1849 vos::OGuard
aGuard(Application::GetSolarMutex());
1851 throw RuntimeException();
1852 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
1853 "mismatch of window parent and accessible parent" );
1855 Size
aSz( pWin
->GetSizePixel() );
1856 #if OSL_DEBUG_LEVEL > 1
1857 awt::Rectangle
aRect( lcl_GetBounds( pWin
) );
1858 Size
aSz2( aRect
.Width
, aRect
.Height
);
1859 DBG_ASSERT( aSz
== aSz2
, "mismatch in width" );
1861 return awt::Size( aSz
.Width(), aSz
.Height() );
1864 void SAL_CALL
SmEditAccessible::grabFocus( )
1865 throw (RuntimeException
)
1867 vos::OGuard
aGuard(Application::GetSolarMutex());
1869 throw RuntimeException();
1874 sal_Int32 SAL_CALL
SmEditAccessible::getForeground()
1875 throw (RuntimeException
)
1877 vos::OGuard
aGuard(Application::GetSolarMutex());
1880 throw RuntimeException();
1881 return (sal_Int32
) pWin
->GetTextColor().GetColor();
1884 sal_Int32 SAL_CALL
SmEditAccessible::getBackground()
1885 throw (RuntimeException
)
1887 vos::OGuard
aGuard(Application::GetSolarMutex());
1890 throw RuntimeException();
1891 Wallpaper
aWall( pWin
->GetDisplayBackground() );
1893 if (aWall
.IsBitmap() || aWall
.IsGradient())
1894 nCol
= pWin
->GetSettings().GetStyleSettings().GetWindowColor().GetColor();
1896 nCol
= aWall
.GetColor().GetColor();
1897 return (sal_Int32
) nCol
;
1900 // XAccessibleContext
1901 sal_Int32 SAL_CALL
SmEditAccessible::getAccessibleChildCount( )
1902 throw (RuntimeException
)
1904 vos::OGuard
aGuard(Application::GetSolarMutex());
1906 throw RuntimeException();
1907 return pTextHelper
->GetChildCount();
1910 uno::Reference
< XAccessible
> SAL_CALL
SmEditAccessible::getAccessibleChild( sal_Int32 i
)
1911 throw (IndexOutOfBoundsException
, RuntimeException
)
1913 vos::OGuard
aGuard(Application::GetSolarMutex());
1915 throw RuntimeException();
1916 return pTextHelper
->GetChild( i
);
1919 uno::Reference
< XAccessible
> SAL_CALL
SmEditAccessible::getAccessibleParent( )
1920 throw (RuntimeException
)
1922 vos::OGuard
aGuard(Application::GetSolarMutex());
1924 throw RuntimeException();
1926 Window
*pAccParent
= pWin
->GetAccessibleParentWindow();
1927 DBG_ASSERT( pAccParent
, "accessible parent missing" );
1928 return pAccParent
? pAccParent
->GetAccessible() : Reference
< XAccessible
>();
1931 sal_Int32 SAL_CALL
SmEditAccessible::getAccessibleIndexInParent( )
1932 throw (RuntimeException
)
1934 vos::OGuard
aGuard(Application::GetSolarMutex());
1935 sal_Int32 nIdx
= -1;
1936 Window
*pAccParent
= pWin
? pWin
->GetAccessibleParentWindow() : 0;
1939 USHORT nCnt
= pAccParent
->GetAccessibleChildWindowCount();
1940 for (USHORT i
= 0; i
< nCnt
&& nIdx
== -1; ++i
)
1941 if (pAccParent
->GetAccessibleChildWindow( i
) == pWin
)
1947 sal_Int16 SAL_CALL
SmEditAccessible::getAccessibleRole( )
1948 throw (RuntimeException
)
1950 vos::OGuard
aGuard(Application::GetSolarMutex());
1951 return AccessibleRole::PANEL
/*TEXT ?*/;
1954 rtl::OUString SAL_CALL
SmEditAccessible::getAccessibleDescription( )
1955 throw (RuntimeException
)
1957 vos::OGuard
aGuard(Application::GetSolarMutex());
1958 return OUString(); // empty as agreed with product-management
1961 rtl::OUString SAL_CALL
SmEditAccessible::getAccessibleName( )
1962 throw (RuntimeException
)
1964 vos::OGuard
aGuard(Application::GetSolarMutex());
1965 // same name as displayed by the window when not docked
1969 uno::Reference
< XAccessibleRelationSet
> SAL_CALL
SmEditAccessible::getAccessibleRelationSet( )
1970 throw (RuntimeException
)
1972 vos::OGuard
aGuard(Application::GetSolarMutex());
1973 Reference
< XAccessibleRelationSet
> xRelSet
= new utl::AccessibleRelationSetHelper();
1974 return xRelSet
; // empty relation set
1977 uno::Reference
< XAccessibleStateSet
> SAL_CALL
SmEditAccessible::getAccessibleStateSet( )
1978 throw (RuntimeException
)
1980 vos::OGuard
aGuard(Application::GetSolarMutex());
1981 ::utl::AccessibleStateSetHelper
*pStateSet
=
1982 new ::utl::AccessibleStateSetHelper
;
1984 Reference
<XAccessibleStateSet
> xStateSet( pStateSet
);
1986 if (!pWin
|| !pTextHelper
)
1987 pStateSet
->AddState( AccessibleStateType::DEFUNC
);
1990 //pStateSet->AddState( AccessibleStateType::EDITABLE );
1991 pStateSet
->AddState( AccessibleStateType::MULTI_LINE
);
1992 //pStateSet->AddState( AccessibleStateType::HORIZONTAL );
1993 //pStateSet->AddState( AccessibleStateType::TRANSIENT );
1994 pStateSet
->AddState( AccessibleStateType::ENABLED
);
1995 pStateSet
->AddState( AccessibleStateType::FOCUSABLE
);
1996 if (pWin
->HasFocus())
1997 pStateSet
->AddState( AccessibleStateType::FOCUSED
);
1998 if (pWin
->IsActive())
1999 pStateSet
->AddState( AccessibleStateType::ACTIVE
);
2000 if (pWin
->IsVisible())
2001 pStateSet
->AddState( AccessibleStateType::SHOWING
);
2002 if (pWin
->IsReallyVisible())
2003 pStateSet
->AddState( AccessibleStateType::VISIBLE
);
2004 if (COL_TRANSPARENT
!= pWin
->GetBackground().GetColor().GetColor())
2005 pStateSet
->AddState( AccessibleStateType::OPAQUE
);
2011 Locale SAL_CALL
SmEditAccessible::getLocale( )
2012 throw (IllegalAccessibleComponentStateException
, RuntimeException
)
2014 vos::OGuard
aGuard(Application::GetSolarMutex());
2015 // should be the document language...
2016 // We use the language of the localized symbol names here.
2017 return Application::GetSettings().GetUILocale();
2021 // XAccessibleEventBroadcaster
2022 void SAL_CALL
SmEditAccessible::addEventListener( const uno::Reference
< XAccessibleEventListener
>& xListener
)
2023 throw (RuntimeException
)
2025 //vos::OGuard aGuard(Application::GetSolarMutex()); if (pTextHelper) // not disposing (about to destroy view shell)
2026 pTextHelper
->AddEventListener( xListener
);
2029 void SAL_CALL
SmEditAccessible::removeEventListener( const uno::Reference
< XAccessibleEventListener
>& xListener
)
2030 throw (RuntimeException
)
2032 //vos::OGuard aGuard(Application::GetSolarMutex());
2033 if (pTextHelper
) // not disposing (about to destroy view shell)
2034 pTextHelper
->RemoveEventListener( xListener
);
2037 OUString SAL_CALL
SmEditAccessible::getImplementationName()
2038 throw (RuntimeException
)
2040 //vos::OGuard aGuard(Application::GetSolarMutex());
2041 return A2OU("SmEditAccessible");
2044 sal_Bool SAL_CALL
SmEditAccessible::supportsService(
2045 const OUString
& rServiceName
)
2046 throw (RuntimeException
)
2048 //vos::OGuard aGuard(Application::GetSolarMutex());
2049 return rServiceName
== A2OU( "com::sun::star::accessibility::Accessible" ) ||
2050 rServiceName
== A2OU( "com::sun::star::accessibility::AccessibleComponent" ) ||
2051 rServiceName
== A2OU( "com::sun::star::accessibility::AccessibleContext" );
2054 Sequence
< OUString
> SAL_CALL
SmEditAccessible::getSupportedServiceNames()
2055 throw (RuntimeException
)
2057 //vos::OGuard aGuard(Application::GetSolarMutex());
2058 Sequence
< OUString
> aNames(3);
2059 OUString
*pNames
= aNames
.getArray();
2060 pNames
[0] = A2OU( "com::sun::star::accessibility::Accessible" );
2061 pNames
[1] = A2OU( "com::sun::star::accessibility::AccessibleComponent" );
2062 pNames
[2] = A2OU( "com::sun::star::accessibility::AccessibleContext" );
2066 //////////////////////////////////////////////////////////////////////