1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_starmath.hxx"
30 #include <com/sun/star/accessibility/AccessibleRole.hpp>
31 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
32 #include <com/sun/star/accessibility/AccessibleTextType.hpp>
33 #include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
34 #include <com/sun/star/accessibility/AccessibleEventObject.hpp>
35 #include <com/sun/star/awt/FocusEvent.hpp>
36 #include <com/sun/star/awt/XFocusListener.hpp>
37 #include <unotools/accessiblerelationsethelper.hxx>
40 #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
41 #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
42 #include <com/sun/star/i18n/WordType.hpp>
43 #include <unotools/accessiblestatesethelper.hxx>
44 #include <comphelper/accessibleeventnotifier.hxx>
45 #include <tools/debug.hxx>
46 #include <vcl/svapp.hxx>
47 #include <vcl/window.hxx>
48 #include <vcl/unohelp2.hxx>
49 #include <tools/gen.hxx>
50 #include <vos/mutex.hxx>
51 #include <svl/itemset.hxx>
53 #include <editeng/editobj.hxx>
54 #include <editeng/editdata.hxx>
55 #include <editeng/editview.hxx>
56 #include <editeng/eeitem.hxx>
57 #include <editeng/outliner.hxx>
58 #include <editeng/unoedhlp.hxx>
61 #include "accessibility.hxx"
62 #include <applicat.hxx>
63 #include <document.hxx>
67 using namespace com::sun::star
;
68 using namespace com::sun::star::lang
;
69 using namespace com::sun::star::uno
;
70 using namespace com::sun::star::accessibility
;
72 #define A2OU(cChar) rtl::OUString::createFromAscii(cChar)
74 //////////////////////////////////////////////////////////////////////
76 static awt::Rectangle
lcl_GetBounds( Window
*pWin
)
78 // !! see VCLXAccessibleComponent::implGetBounds()
80 //! the coordinates returned are relativ to the parent window !
81 //! Thus the top-left point may be different from (0, 0) !
83 awt::Rectangle aBounds
;
86 Rectangle aRect
= pWin
->GetWindowExtentsRelative( NULL
);
87 aBounds
.X
= aRect
.Left();
88 aBounds
.Y
= aRect
.Top();
89 aBounds
.Width
= aRect
.GetWidth();
90 aBounds
.Height
= aRect
.GetHeight();
91 Window
* pParent
= pWin
->GetAccessibleParentWindow();
94 Rectangle aParentRect
= pParent
->GetWindowExtentsRelative( NULL
);
95 awt::Point
aParentScreenLoc( aParentRect
.Left(), aParentRect
.Top() );
96 aBounds
.X
-= aParentScreenLoc
.X
;
97 aBounds
.Y
-= aParentScreenLoc
.Y
;
103 static awt::Point
lcl_GetLocationOnScreen( Window
*pWin
)
105 // !! see VCLXAccessibleComponent::getLocationOnScreen()
110 Rectangle aRect
= pWin
->GetWindowExtentsRelative( NULL
);
111 aPos
.X
= aRect
.Left();
112 aPos
.Y
= aRect
.Top();
117 //////////////////////////////////////////////////////////////////////
119 SmGraphicAccessible::SmGraphicAccessible( SmGraphicWindow
*pGraphicWin
) :
120 aAccName ( String(SmResId(RID_DOCUMENTSTR
)) ),
124 DBG_ASSERT( pWin
, "SmGraphicAccessible: window missing" );
129 SmGraphicAccessible::SmGraphicAccessible( const SmGraphicAccessible
&rSmAcc
) :
130 SmGraphicAccessibleBaseClass(),
131 aAccName ( String(SmResId(RID_DOCUMENTSTR
)) ),
134 //vos::OGuard aGuard(Application::GetSolarMutex());
136 DBG_ASSERT( pWin
, "SmGraphicAccessible: window missing" );
141 SmGraphicAccessible::~SmGraphicAccessible()
144 vos::OGuard aGuard(Application::GetSolarMutex());
145 if (--aRefCount == 0)
152 SmDocShell
* SmGraphicAccessible::GetDoc_Impl()
154 SmViewShell
*pView
= pWin
? pWin
->GetView() : 0;
155 return pView
? pView
->GetDoc() : 0;
158 String
SmGraphicAccessible::GetAccessibleText_Impl()
161 SmDocShell
*pDoc
= GetDoc_Impl();
163 aTxt
= pDoc
->GetAccessibleText();
167 void SmGraphicAccessible::ClearWin()
169 pWin
= 0; // implicitly results in AccessibleStateType::DEFUNC set
173 comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nClientId
, *this );
178 void SmGraphicAccessible::LaunchEvent(
179 const sal_Int16 nAccesibleEventId
,
180 const uno::Any
&rOldVal
,
181 const uno::Any
&rNewVal
)
183 AccessibleEventObject aEvt
;
184 aEvt
.Source
= (XAccessible
*) this;
185 aEvt
.EventId
= nAccesibleEventId
;
186 aEvt
.OldValue
= rOldVal
;
187 aEvt
.NewValue
= rNewVal
;
189 // pass event on to event-listener's
191 comphelper::AccessibleEventNotifier::addEvent( nClientId
, aEvt
);
194 uno::Reference
< XAccessibleContext
> SAL_CALL
SmGraphicAccessible::getAccessibleContext()
195 throw (RuntimeException
)
197 vos::OGuard
aGuard(Application::GetSolarMutex());
201 sal_Bool SAL_CALL
SmGraphicAccessible::containsPoint( const awt::Point
& aPoint
)
202 throw (RuntimeException
)
204 //! the arguments coordinates are relativ to the current window !
205 //! Thus the top-left point is (0, 0)
207 vos::OGuard
aGuard(Application::GetSolarMutex());
209 throw RuntimeException();
211 Size
aSz( pWin
->GetSizePixel() );
212 return aPoint
.X
>= 0 && aPoint
.Y
>= 0 &&
213 aPoint
.X
< aSz
.Width() && aPoint
.Y
< aSz
.Height();
216 uno::Reference
< XAccessible
> SAL_CALL
SmGraphicAccessible::getAccessibleAtPoint(
217 const awt::Point
& aPoint
)
218 throw (RuntimeException
)
220 vos::OGuard
aGuard(Application::GetSolarMutex());
221 XAccessible
*pRes
= 0;
222 if (containsPoint( aPoint
))
227 awt::Rectangle SAL_CALL
SmGraphicAccessible::getBounds()
228 throw (RuntimeException
)
230 vos::OGuard
aGuard(Application::GetSolarMutex());
232 throw RuntimeException();
233 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
234 "mismatch of window parent and accessible parent" );
235 return lcl_GetBounds( pWin
);
238 awt::Point SAL_CALL
SmGraphicAccessible::getLocation()
239 throw (RuntimeException
)
241 vos::OGuard
aGuard(Application::GetSolarMutex());
243 throw RuntimeException();
244 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
245 "mismatch of window parent and accessible parent" );
246 awt::Rectangle
aRect( lcl_GetBounds( pWin
) );
247 return awt::Point( aRect
.X
, aRect
.Y
);
250 awt::Point SAL_CALL
SmGraphicAccessible::getLocationOnScreen()
251 throw (RuntimeException
)
253 vos::OGuard
aGuard(Application::GetSolarMutex());
255 throw RuntimeException();
256 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
257 "mismatch of window parent and accessible parent" );
258 return lcl_GetLocationOnScreen( pWin
);
261 awt::Size SAL_CALL
SmGraphicAccessible::getSize()
262 throw (RuntimeException
)
264 vos::OGuard
aGuard(Application::GetSolarMutex());
266 throw RuntimeException();
267 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
268 "mismatch of window parent and accessible parent" );
270 Size
aSz( pWin
->GetSizePixel() );
271 #if OSL_DEBUG_LEVEL > 1
272 awt::Rectangle
aRect( lcl_GetBounds( pWin
) );
273 Size
aSz2( aRect
.Width
, aRect
.Height
);
274 DBG_ASSERT( aSz
== aSz2
, "mismatch in width" );
276 return awt::Size( aSz
.Width(), aSz
.Height() );
279 void SAL_CALL
SmGraphicAccessible::grabFocus()
280 throw (RuntimeException
)
282 vos::OGuard
aGuard(Application::GetSolarMutex());
284 throw RuntimeException();
289 sal_Int32 SAL_CALL
SmGraphicAccessible::getForeground()
290 throw (RuntimeException
)
292 vos::OGuard
aGuard(Application::GetSolarMutex());
295 throw RuntimeException();
296 return (sal_Int32
) pWin
->GetTextColor().GetColor();
299 sal_Int32 SAL_CALL
SmGraphicAccessible::getBackground()
300 throw (RuntimeException
)
302 vos::OGuard
aGuard(Application::GetSolarMutex());
305 throw RuntimeException();
306 Wallpaper
aWall( pWin
->GetDisplayBackground() );
308 if (aWall
.IsBitmap() || aWall
.IsGradient())
309 nCol
= pWin
->GetSettings().GetStyleSettings().GetWindowColor().GetColor();
311 nCol
= aWall
.GetColor().GetColor();
312 return (sal_Int32
) nCol
;
315 sal_Int32 SAL_CALL
SmGraphicAccessible::getAccessibleChildCount()
316 throw (RuntimeException
)
318 vos::OGuard
aGuard(Application::GetSolarMutex());
322 Reference
< XAccessible
> SAL_CALL
SmGraphicAccessible::getAccessibleChild(
324 throw (IndexOutOfBoundsException
, RuntimeException
)
326 vos::OGuard
aGuard(Application::GetSolarMutex());
327 throw IndexOutOfBoundsException(); // there is no child...
331 Reference
< XAccessible
> SAL_CALL
SmGraphicAccessible::getAccessibleParent()
332 throw (RuntimeException
)
334 vos::OGuard
aGuard(Application::GetSolarMutex());
336 throw RuntimeException();
338 Window
*pAccParent
= pWin
->GetAccessibleParentWindow();
339 DBG_ASSERT( pAccParent
, "accessible parent missing" );
340 return pAccParent
? pAccParent
->GetAccessible() : Reference
< XAccessible
>();
343 sal_Int32 SAL_CALL
SmGraphicAccessible::getAccessibleIndexInParent()
344 throw (RuntimeException
)
346 vos::OGuard
aGuard(Application::GetSolarMutex());
348 Window
*pAccParent
= pWin
? pWin
->GetAccessibleParentWindow() : 0;
351 sal_uInt16 nCnt
= pAccParent
->GetAccessibleChildWindowCount();
352 for (sal_uInt16 i
= 0; i
< nCnt
&& nIdx
== -1; ++i
)
353 if (pAccParent
->GetAccessibleChildWindow( i
) == pWin
)
359 sal_Int16 SAL_CALL
SmGraphicAccessible::getAccessibleRole()
360 throw (RuntimeException
)
362 vos::OGuard
aGuard(Application::GetSolarMutex());
363 return AccessibleRole::DOCUMENT
;
366 OUString SAL_CALL
SmGraphicAccessible::getAccessibleDescription()
367 throw (RuntimeException
)
369 vos::OGuard
aGuard(Application::GetSolarMutex());
370 SmDocShell
*pDoc
= GetDoc_Impl();
371 return pDoc
? OUString(pDoc
->GetText()) : OUString();
374 OUString SAL_CALL
SmGraphicAccessible::getAccessibleName()
375 throw (RuntimeException
)
377 vos::OGuard
aGuard(Application::GetSolarMutex());
381 Reference
< XAccessibleRelationSet
> SAL_CALL
SmGraphicAccessible::getAccessibleRelationSet()
382 throw (RuntimeException
)
384 vos::OGuard
aGuard(Application::GetSolarMutex());
385 Reference
< XAccessibleRelationSet
> xRelSet
= new utl::AccessibleRelationSetHelper();
386 return xRelSet
; // empty relation set
389 Reference
< XAccessibleStateSet
> SAL_CALL
SmGraphicAccessible::getAccessibleStateSet()
390 throw (RuntimeException
)
392 vos::OGuard
aGuard(Application::GetSolarMutex());
393 ::utl::AccessibleStateSetHelper
*pStateSet
=
394 new ::utl::AccessibleStateSetHelper
;
396 Reference
<XAccessibleStateSet
> xStateSet( pStateSet
);
399 pStateSet
->AddState( AccessibleStateType::DEFUNC
);
402 //pStateSet->AddState( AccessibleStateType::EDITABLE );
403 //pStateSet->AddState( AccessibleStateType::HORIZONTAL );
404 //pStateSet->AddState( AccessibleStateType::TRANSIENT );
405 pStateSet
->AddState( AccessibleStateType::ENABLED
);
406 pStateSet
->AddState( AccessibleStateType::FOCUSABLE
);
407 if (pWin
->HasFocus())
408 pStateSet
->AddState( AccessibleStateType::FOCUSED
);
409 if (pWin
->IsActive())
410 pStateSet
->AddState( AccessibleStateType::ACTIVE
);
411 if (pWin
->IsVisible())
412 pStateSet
->AddState( AccessibleStateType::SHOWING
);
413 if (pWin
->IsReallyVisible())
414 pStateSet
->AddState( AccessibleStateType::VISIBLE
);
415 if (COL_TRANSPARENT
!= pWin
->GetBackground().GetColor().GetColor())
416 pStateSet
->AddState( AccessibleStateType::OPAQUE
);
422 Locale SAL_CALL
SmGraphicAccessible::getLocale()
423 throw (IllegalAccessibleComponentStateException
, RuntimeException
)
425 vos::OGuard
aGuard(Application::GetSolarMutex());
426 // should be the document language...
427 // We use the language of the localized symbol names here.
428 return Application::GetSettings().GetUILocale();
432 void SAL_CALL
SmGraphicAccessible::addEventListener(
433 const Reference
< XAccessibleEventListener
>& xListener
)
434 throw (RuntimeException
)
438 vos::OGuard
aGuard(Application::GetSolarMutex());
442 nClientId
= comphelper::AccessibleEventNotifier::registerClient( );
443 comphelper::AccessibleEventNotifier::addEventListener( nClientId
, xListener
);
448 void SAL_CALL
SmGraphicAccessible::removeEventListener(
449 const Reference
< XAccessibleEventListener
>& xListener
)
450 throw (RuntimeException
)
454 vos::OGuard
aGuard(Application::GetSolarMutex());
455 sal_Int32 nListenerCount
= comphelper::AccessibleEventNotifier::removeEventListener( nClientId
, xListener
);
456 if ( !nListenerCount
)
458 // no listeners anymore
459 // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
460 // and at least to us not firing any events anymore, in case somebody calls
461 // NotifyAccessibleEvent, again
462 comphelper::AccessibleEventNotifier::revokeClient( nClientId
);
468 sal_Int32 SAL_CALL
SmGraphicAccessible::getCaretPosition()
469 throw (RuntimeException
)
471 vos::OGuard
aGuard(Application::GetSolarMutex());
475 sal_Bool SAL_CALL
SmGraphicAccessible::setCaretPosition( sal_Int32 nIndex
)
476 throw (IndexOutOfBoundsException
, RuntimeException
)
478 xub_StrLen nIdx
= (xub_StrLen
) nIndex
;
479 String
aTxt( GetAccessibleText_Impl() );
480 if (!(/*0 <= nIdx &&*/ nIdx
< aTxt
.Len()))
481 throw IndexOutOfBoundsException();
485 sal_Unicode SAL_CALL
SmGraphicAccessible::getCharacter( sal_Int32 nIndex
)
486 throw (IndexOutOfBoundsException
, RuntimeException
)
488 vos::OGuard
aGuard(Application::GetSolarMutex());
490 xub_StrLen nIdx
= (xub_StrLen
) nIndex
;
491 String
aTxt( GetAccessibleText_Impl() );
492 if (!(/*0 <= nIdx &&*/ nIdx
< aTxt
.Len()))
493 throw IndexOutOfBoundsException();
494 return aTxt
.GetChar( nIdx
);
497 Sequence
< beans::PropertyValue
> SAL_CALL
SmGraphicAccessible::getCharacterAttributes(
499 const uno::Sequence
< ::rtl::OUString
> & /*rRequestedAttributes*/ )
500 throw (IndexOutOfBoundsException
, RuntimeException
)
502 vos::OGuard
aGuard(Application::GetSolarMutex());
503 sal_Int32 nLen
= GetAccessibleText_Impl().Len();
504 if (!(0 <= nIndex
&& nIndex
< nLen
))
505 throw IndexOutOfBoundsException();
506 return Sequence
< beans::PropertyValue
>();
509 awt::Rectangle SAL_CALL
SmGraphicAccessible::getCharacterBounds( sal_Int32 nIndex
)
510 throw (IndexOutOfBoundsException
, RuntimeException
)
512 vos::OGuard
aGuard(Application::GetSolarMutex());
517 throw RuntimeException();
520 // get accessible text
521 SmViewShell
*pView
= pWin
->GetView();
522 SmDocShell
*pDoc
= pView
? pView
->GetDoc() : 0;
524 throw RuntimeException();
525 String
aTxt( GetAccessibleText_Impl() );
526 if (!(0 <= nIndex
&& nIndex
<= aTxt
.Len())) // #108812# aTxt.Len() is valid
527 throw IndexOutOfBoundsException();
529 // #108812# find a reasonable rectangle for position aTxt.Len().
530 bool bWasBehindText
= (nIndex
== aTxt
.Len());
531 if (bWasBehindText
&& nIndex
)
534 const SmNode
*pTree
= pDoc
->GetFormulaTree();
535 const SmNode
*pNode
= pTree
->FindNodeWithAccessibleIndex( (xub_StrLen
) nIndex
);
536 //! pNode may be 0 if the index belongs to a char that was inserted
537 //! only for the accessible text!
540 sal_Int32 nAccIndex
= pNode
->GetAccessibleIndex();
541 DBG_ASSERT( nAccIndex
>= 0, "invalid accessible index" );
542 DBG_ASSERT( nIndex
>= nAccIndex
, "index out of range" );
545 pNode
->GetAccessibleText( aNodeText
);
546 sal_Int32 nNodeIndex
= nIndex
- nAccIndex
;
547 if (0 <= nNodeIndex
&& nNodeIndex
< aNodeText
.Len())
549 // get appropriate rectangle
550 Point
aOffset(pNode
->GetTopLeft() - pTree
->GetTopLeft());
551 Point
aTLPos (pWin
->GetFormulaDrawPos() + aOffset
);
552 // aTLPos.X() -= pNode->GetItalicLeftSpace();
553 // Size aSize (pNode->GetItalicSize());
555 Size
aSize (pNode
->GetSize());
557 sal_Int32
*pXAry
= new sal_Int32
[ aNodeText
.Len() ];
558 pWin
->SetFont( pNode
->GetFont() );
559 pWin
->GetTextArray( aNodeText
, pXAry
, 0, aNodeText
.Len() );
560 aTLPos
.X() += nNodeIndex
> 0 ? pXAry
[nNodeIndex
- 1] : 0;
561 aSize
.Width() = nNodeIndex
> 0 ? pXAry
[nNodeIndex
] - pXAry
[nNodeIndex
- 1] : pXAry
[nNodeIndex
];
564 #if OSL_DEBUG_LEVEL > 1
565 Point
aLP00( pWin
->LogicToPixel( Point(0,0)) );
566 Point
aPL00( pWin
->PixelToLogic( Point(0,0)) );
568 aTLPos
= pWin
->LogicToPixel( aTLPos
);
569 aSize
= pWin
->LogicToPixel( aSize
);
572 aRes
.Width
= aSize
.Width();
573 aRes
.Height
= aSize
.Height();
577 // #108812# take rectangle from last character and move it to the right
579 aRes
.X
+= aRes
.Width
;
585 sal_Int32 SAL_CALL
SmGraphicAccessible::getCharacterCount()
586 throw (RuntimeException
)
588 vos::OGuard
aGuard(Application::GetSolarMutex());
589 return GetAccessibleText_Impl().Len();
592 sal_Int32 SAL_CALL
SmGraphicAccessible::getIndexAtPoint( const awt::Point
& aPoint
)
593 throw (RuntimeException
)
595 vos::OGuard
aGuard(Application::GetSolarMutex());
600 const SmNode
*pTree
= pWin
->GetView()->GetDoc()->GetFormulaTree();
601 //! kann NULL sein! ZB wenn bereits beim laden des Dokuments (bevor der
602 //! Parser angeworfen wurde) ins Fenster geklickt wird.
606 // get position relativ to formula draw position
607 Point
aPos( aPoint
.X
, aPoint
.Y
);
608 aPos
= pWin
->PixelToLogic( aPos
);
609 aPos
-= pWin
->GetFormulaDrawPos();
611 // if it was inside the formula then get the appropriate node
612 const SmNode
*pNode
= 0;
613 if (pTree
->OrientedDist(aPos
) <= 0)
614 pNode
= pTree
->FindRectClosestTo(aPos
);
618 // get appropriate rectangle
619 Point
aOffset( pNode
->GetTopLeft() - pTree
->GetTopLeft() );
620 Point
aTLPos ( /*pWin->GetFormulaDrawPos() +*/ aOffset
);
621 // aTLPos.X() -= pNode->GetItalicLeftSpace();
622 // Size aSize( pNode->GetItalicSize() );
624 Size
aSize( pNode
->GetSize() );
625 #if OSL_DEBUG_LEVEL > 1
626 Point
aLP00( pWin
->LogicToPixel( Point(0,0)) );
627 Point
aPL00( pWin
->PixelToLogic( Point(0,0)) );
630 Rectangle
aRect( aTLPos
, aSize
);
631 if (aRect
.IsInside( aPos
))
633 DBG_ASSERT( pNode
->IsVisible(), "node is not a leaf" );
635 pNode
->GetAccessibleText( aTxt
);
636 DBG_ASSERT( aTxt
.Len(), "no accessible text available" );
638 long nNodeX
= pNode
->GetLeft();
640 sal_Int32
*pXAry
= new sal_Int32
[ aTxt
.Len() ];
641 pWin
->SetFont( pNode
->GetFont() );
642 pWin
->GetTextArray( aTxt
, pXAry
, 0, aTxt
.Len() );
643 for (sal_Int32 i
= 0; i
< aTxt
.Len() && nRes
== -1; ++i
)
645 if (pXAry
[i
] + nNodeX
> aPos
.X())
649 DBG_ASSERT( nRes
>= 0 && nRes
< aTxt
.Len(), "index out of range" );
650 DBG_ASSERT( pNode
->GetAccessibleIndex() >= 0,
651 "invalid accessible index" );
653 nRes
= pNode
->GetAccessibleIndex() + nRes
;
660 OUString SAL_CALL
SmGraphicAccessible::getSelectedText()
661 throw (RuntimeException
)
663 vos::OGuard
aGuard(Application::GetSolarMutex());
667 sal_Int32 SAL_CALL
SmGraphicAccessible::getSelectionStart()
668 throw (RuntimeException
)
670 vos::OGuard
aGuard(Application::GetSolarMutex());
674 sal_Int32 SAL_CALL
SmGraphicAccessible::getSelectionEnd()
675 throw (RuntimeException
)
677 vos::OGuard
aGuard(Application::GetSolarMutex());
681 sal_Bool SAL_CALL
SmGraphicAccessible::setSelection(
682 sal_Int32 nStartIndex
,
683 sal_Int32 nEndIndex
)
684 throw (IndexOutOfBoundsException
, RuntimeException
)
686 vos::OGuard
aGuard(Application::GetSolarMutex());
687 sal_Int32 nLen
= GetAccessibleText_Impl().Len();
688 if (!(0 <= nStartIndex
&& nStartIndex
< nLen
) ||
689 !(0 <= nEndIndex
&& nEndIndex
< nLen
))
690 throw IndexOutOfBoundsException();
694 OUString SAL_CALL
SmGraphicAccessible::getText()
695 throw (RuntimeException
)
697 vos::OGuard
aGuard(Application::GetSolarMutex());
698 return GetAccessibleText_Impl();
701 OUString SAL_CALL
SmGraphicAccessible::getTextRange(
702 sal_Int32 nStartIndex
,
703 sal_Int32 nEndIndex
)
704 throw (IndexOutOfBoundsException
, RuntimeException
)
706 //!! nEndIndex may be the string length per definition of the interface !!
707 //!! text should be copied exclusive that end index though. And arguments
708 //!! may be switched.
710 vos::OGuard
aGuard(Application::GetSolarMutex());
711 String
aTxt( GetAccessibleText_Impl() );
712 xub_StrLen nStart
= (xub_StrLen
) Min(nStartIndex
, nEndIndex
);
713 xub_StrLen nEnd
= (xub_StrLen
) Max(nStartIndex
, nEndIndex
);
714 if (!(/*0 <= nStart &&*/ nStart
<= aTxt
.Len()) ||
715 !(/*0 <= nEnd &&*/ nEnd
<= aTxt
.Len()))
716 throw IndexOutOfBoundsException();
717 return aTxt
.Copy( nStart
, nEnd
- nStart
);
720 ::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
)
722 vos::OGuard
aGuard(Application::GetSolarMutex());
723 String
aTxt( GetAccessibleText_Impl() );
724 xub_StrLen nIdx
= (xub_StrLen
) nIndex
;
725 //!! nIndex is allowed to be the string length
726 if (!(/*0 <= nIdx &&*/ nIdx
<= aTxt
.Len()))
727 throw IndexOutOfBoundsException();
729 ::com::sun::star::accessibility::TextSegment aResult
;
730 aResult
.SegmentStart
= -1;
731 aResult
.SegmentEnd
= -1;
732 if ( (AccessibleTextType::CHARACTER
== aTextType
) && (nIdx
< aTxt
.Len()) )
734 aResult
.SegmentText
= aTxt
.Copy(nIdx
, 1);
735 aResult
.SegmentStart
= nIdx
;
736 aResult
.SegmentEnd
= nIdx
+1;
741 ::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
)
743 vos::OGuard
aGuard(Application::GetSolarMutex());
744 String
aTxt( GetAccessibleText_Impl() );
745 xub_StrLen nIdx
= (xub_StrLen
) nIndex
;
746 //!! nIndex is allowed to be the string length
747 if (!(/*0 <= nIdx &&*/ nIdx
<= aTxt
.Len()))
748 throw IndexOutOfBoundsException();
750 ::com::sun::star::accessibility::TextSegment aResult
;
751 aResult
.SegmentStart
= -1;
752 aResult
.SegmentEnd
= -1;
754 if ( (AccessibleTextType::CHARACTER
== aTextType
) && nIdx
)
756 aResult
.SegmentText
= aTxt
.Copy(nIdx
-1, 1);
757 aResult
.SegmentStart
= nIdx
-1;
758 aResult
.SegmentEnd
= nIdx
;
763 ::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
)
765 vos::OGuard
aGuard(Application::GetSolarMutex());
766 String
aTxt( GetAccessibleText_Impl() );
767 xub_StrLen nIdx
= (xub_StrLen
) nIndex
;
768 //!! nIndex is allowed to be the string length
769 if (!(/*0 <= nIdx &&*/ nIdx
<= aTxt
.Len()))
770 throw IndexOutOfBoundsException();
772 ::com::sun::star::accessibility::TextSegment aResult
;
773 aResult
.SegmentStart
= -1;
774 aResult
.SegmentEnd
= -1;
776 nIdx
++; // text *behind*
777 if ( (AccessibleTextType::CHARACTER
== aTextType
) && (nIdx
< aTxt
.Len()) )
779 aResult
.SegmentText
= aTxt
.Copy(nIdx
, 1);
780 aResult
.SegmentStart
= nIdx
;
781 aResult
.SegmentEnd
= nIdx
+1;
786 sal_Bool SAL_CALL
SmGraphicAccessible::copyText(
787 sal_Int32 nStartIndex
,
788 sal_Int32 nEndIndex
)
789 throw (IndexOutOfBoundsException
, RuntimeException
)
791 vos::OGuard
aGuard(Application::GetSolarMutex());
792 sal_Bool bReturn
= sal_False
;
795 throw RuntimeException();
798 Reference
< datatransfer::clipboard::XClipboard
> xClipboard
= pWin
->GetClipboard();
799 if ( xClipboard
.is() )
801 ::rtl::OUString
sText( getTextRange(nStartIndex
, nEndIndex
) );
803 ::vcl::unohelper::TextDataObject
* pDataObj
= new ::vcl::unohelper::TextDataObject( sText
);
804 const sal_uInt32 nRef
= Application::ReleaseSolarMutex();
805 xClipboard
->setContents( pDataObj
, NULL
);
807 Reference
< datatransfer::clipboard::XFlushableClipboard
> xFlushableClipboard( xClipboard
, uno::UNO_QUERY
);
808 if( xFlushableClipboard
.is() )
809 xFlushableClipboard
->flushClipboard();
811 Application::AcquireSolarMutex( nRef
);
820 OUString SAL_CALL
SmGraphicAccessible::getImplementationName()
821 throw (RuntimeException
)
823 //vos::OGuard aGuard(Application::GetSolarMutex());
824 return A2OU("SmGraphicAccessible");
827 sal_Bool SAL_CALL
SmGraphicAccessible::supportsService(
828 const OUString
& rServiceName
)
829 throw (RuntimeException
)
831 //vos::OGuard aGuard(Application::GetSolarMutex());
832 return rServiceName
== A2OU( "com::sun::star::accessibility::Accessible" ) ||
833 rServiceName
== A2OU( "com::sun::star::accessibility::AccessibleComponent" ) ||
834 rServiceName
== A2OU( "com::sun::star::accessibility::AccessibleContext" ) ||
835 rServiceName
== A2OU( "com::sun::star::accessibility::AccessibleText" );
838 Sequence
< OUString
> SAL_CALL
SmGraphicAccessible::getSupportedServiceNames()
839 throw (RuntimeException
)
841 //vos::OGuard aGuard(Application::GetSolarMutex());
842 Sequence
< OUString
> aNames(4);
843 OUString
*pNames
= aNames
.getArray();
844 pNames
[0] = A2OU( "com::sun::star::accessibility::Accessible" );
845 pNames
[1] = A2OU( "com::sun::star::accessibility::AccessibleComponent" );
846 pNames
[2] = A2OU( "com::sun::star::accessibility::AccessibleContext" );
847 pNames
[3] = A2OU( "com::sun::star::accessibility::AccessibleText" );
851 //////////////////////////////////////////////////////////////////////
853 //------------------------------------------------------------------------
855 SmEditSource::SmEditSource( SmEditWindow
* /*pWin*/, SmEditAccessible
&rAcc
) :
857 aTextFwd (rAcc
, *this),
863 SmEditSource::SmEditSource( const SmEditSource
&rSrc
) :
865 aViewFwd (rSrc
.rEditAcc
),
866 aTextFwd (rSrc
.rEditAcc
, *this),
867 aEditViewFwd(rSrc
.rEditAcc
),
868 rEditAcc (rSrc
.rEditAcc
)
870 //aBroadCaster; can be completely new
873 SmEditSource::~SmEditSource()
877 SvxEditSource
* SmEditSource::Clone() const
879 return new SmEditSource( *this );
882 SvxTextForwarder
* SmEditSource::GetTextForwarder()
887 SvxViewForwarder
* SmEditSource::GetViewForwarder()
892 SvxEditViewForwarder
* SmEditSource::GetEditViewForwarder( sal_Bool
/*bCreate*/ )
894 return &aEditViewFwd
;
897 void SmEditSource::UpdateData()
899 // would possibly only by needed if the XText inteface is implemented
900 // and its text needs to be updated.
903 SfxBroadcaster
& SmEditSource::GetBroadcaster() const
905 return ((SmEditSource
*) this)->aBroadCaster
;
908 //------------------------------------------------------------------------
910 SmViewForwarder::SmViewForwarder( SmEditAccessible
&rAcc
) :
915 SmViewForwarder::~SmViewForwarder()
919 sal_Bool
SmViewForwarder::IsValid() const
921 return rEditAcc
.GetEditView() != 0;
924 Rectangle
SmViewForwarder::GetVisArea() const
926 EditView
*pEditView
= rEditAcc
.GetEditView();
927 OutputDevice
* pOutDev
= pEditView
? pEditView
->GetWindow() : 0;
929 if( pOutDev
&& pEditView
)
931 Rectangle aVisArea
= pEditView
->GetVisArea();
933 // figure out map mode from edit engine
934 EditEngine
* pEditEngine
= pEditView
->GetEditEngine();
938 MapMode
aMapMode(pOutDev
->GetMapMode());
939 aVisArea
= OutputDevice::LogicToLogic( aVisArea
,
940 pEditEngine
->GetRefMapMode(),
941 aMapMode
.GetMapUnit() );
942 aMapMode
.SetOrigin(Point());
943 return pOutDev
->LogicToPixel( aVisArea
, aMapMode
);
950 Point
SmViewForwarder::LogicToPixel( const Point
& rPoint
, const MapMode
& rMapMode
) const
952 EditView
*pEditView
= rEditAcc
.GetEditView();
953 OutputDevice
* pOutDev
= pEditView
? pEditView
->GetWindow() : 0;
957 MapMode
aMapMode(pOutDev
->GetMapMode());
958 Point
aPoint( OutputDevice::LogicToLogic( rPoint
, rMapMode
,
959 aMapMode
.GetMapUnit() ) );
960 aMapMode
.SetOrigin(Point());
961 return pOutDev
->LogicToPixel( aPoint
, aMapMode
);
967 Point
SmViewForwarder::PixelToLogic( const Point
& rPoint
, const MapMode
& rMapMode
) const
969 EditView
*pEditView
= rEditAcc
.GetEditView();
970 OutputDevice
* pOutDev
= pEditView
? pEditView
->GetWindow() : 0;
974 MapMode
aMapMode(pOutDev
->GetMapMode());
975 aMapMode
.SetOrigin(Point());
976 Point
aPoint( pOutDev
->PixelToLogic( rPoint
, aMapMode
) );
977 return OutputDevice::LogicToLogic( aPoint
,
978 aMapMode
.GetMapUnit(),
986 //------------------------------------------------------------------------
988 SmTextForwarder::SmTextForwarder( SmEditAccessible
& rAcc
, SmEditSource
& rSource
) :
990 rEditSource (rSource
)
992 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
994 pEditEngine
->SetNotifyHdl( LINK(this, SmTextForwarder
, NotifyHdl
) );
997 SmTextForwarder::~SmTextForwarder()
999 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1001 pEditEngine
->SetNotifyHdl( Link() );
1004 IMPL_LINK(SmTextForwarder
, NotifyHdl
, EENotify
*, aNotify
)
1008 ::std::auto_ptr
< SfxHint
> aHint
= SvxEditSourceHelper::EENotification2Hint( aNotify
);
1010 rEditSource
.GetBroadcaster().Broadcast( *aHint
.get() );
1016 sal_uInt16
SmTextForwarder::GetParagraphCount() const
1018 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1019 return pEditEngine
? pEditEngine
->GetParagraphCount() : 0;
1022 sal_uInt16
SmTextForwarder::GetTextLen( sal_uInt16 nParagraph
) const
1024 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1025 return pEditEngine
? pEditEngine
->GetTextLen( nParagraph
) : 0;
1028 String
SmTextForwarder::GetText( const ESelection
& rSel
) const
1030 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1033 aRet
= pEditEngine
->GetText( rSel
, LINEEND_LF
);
1034 aRet
.ConvertLineEnd();
1038 SfxItemSet
SmTextForwarder::GetAttribs( const ESelection
& rSel
, sal_Bool bOnlyHardAttrib
) const
1040 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1041 DBG_ASSERT( pEditEngine
, "EditEngine missing" );
1042 if( rSel
.nStartPara
== rSel
.nEndPara
)
1044 sal_uInt8 nFlags
= 0;
1045 switch( bOnlyHardAttrib
)
1047 case EditEngineAttribs_All
:
1048 nFlags
= GETATTRIBS_ALL
;
1050 case EditEngineAttribs_HardAndPara
:
1051 nFlags
= GETATTRIBS_PARAATTRIBS
|GETATTRIBS_CHARATTRIBS
;
1053 case EditEngineAttribs_OnlyHard
:
1054 nFlags
= GETATTRIBS_CHARATTRIBS
;
1057 DBG_ERROR("unknown flags for SmTextForwarder::GetAttribs");
1060 return pEditEngine
->GetAttribs( rSel
.nStartPara
, rSel
.nStartPos
, rSel
.nEndPos
, nFlags
);
1064 return pEditEngine
->GetAttribs( rSel
, bOnlyHardAttrib
);
1068 SfxItemSet
SmTextForwarder::GetParaAttribs( sal_uInt16 nPara
) const
1070 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1071 DBG_ASSERT( pEditEngine
, "EditEngine missing" );
1073 SfxItemSet
aSet( pEditEngine
->GetParaAttribs( nPara
) );
1075 sal_uInt16 nWhich
= EE_PARA_START
;
1076 while( nWhich
<= EE_PARA_END
)
1078 if( aSet
.GetItemState( nWhich
, sal_True
) != SFX_ITEM_ON
)
1080 if( pEditEngine
->HasParaAttrib( nPara
, nWhich
) )
1081 aSet
.Put( pEditEngine
->GetParaAttrib( nPara
, nWhich
) );
1089 void SmTextForwarder::SetParaAttribs( sal_uInt16 nPara
, const SfxItemSet
& rSet
)
1091 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1093 pEditEngine
->SetParaAttribs( nPara
, rSet
);
1096 SfxItemPool
* SmTextForwarder::GetPool() const
1098 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1099 return pEditEngine
? pEditEngine
->GetEmptyItemSet().GetPool() : 0;
1102 void SmTextForwarder::RemoveAttribs( const ESelection
& rSelection
, sal_Bool bRemoveParaAttribs
, sal_uInt16 nWhich
)
1104 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1106 pEditEngine
->RemoveAttribs( rSelection
, bRemoveParaAttribs
, nWhich
);
1109 void SmTextForwarder::GetPortions( sal_uInt16 nPara
, SvUShorts
& rList
) const
1111 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1113 pEditEngine
->GetPortions( nPara
, rList
);
1116 void SmTextForwarder::QuickInsertText( const String
& rText
, const ESelection
& rSel
)
1118 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1120 pEditEngine
->QuickInsertText( rText
, rSel
);
1123 void SmTextForwarder::QuickInsertLineBreak( const ESelection
& rSel
)
1125 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1127 pEditEngine
->QuickInsertLineBreak( rSel
);
1130 void SmTextForwarder::QuickInsertField( const SvxFieldItem
& rFld
, const ESelection
& rSel
)
1132 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1134 pEditEngine
->QuickInsertField( rFld
, rSel
);
1137 void SmTextForwarder::QuickSetAttribs( const SfxItemSet
& rSet
, const ESelection
& rSel
)
1139 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1141 pEditEngine
->QuickSetAttribs( rSet
, rSel
);
1144 sal_Bool
SmTextForwarder::IsValid() const
1146 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1147 // cannot reliably query EditEngine state
1148 // while in the middle of an update
1149 return pEditEngine
? pEditEngine
->GetUpdateMode() : sal_False
;
1152 XubString
SmTextForwarder::CalcFieldValue( const SvxFieldItem
& rField
, sal_uInt16 nPara
, sal_uInt16 nPos
, Color
*& rpTxtColor
, Color
*& rpFldColor
)
1155 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1157 aTxt
= pEditEngine
->CalcFieldValue( rField
, nPara
, nPos
, rpTxtColor
, rpFldColor
);
1161 void SmTextForwarder::FieldClicked(const SvxFieldItem
&, sal_uInt16
, sal_uInt16
)
1165 sal_uInt16
GetSvxEditEngineItemState( EditEngine
& rEditEngine
, const ESelection
& rSel
, sal_uInt16 nWhich
)
1167 EECharAttribArray aAttribs
;
1169 const SfxPoolItem
* pLastItem
= NULL
;
1171 SfxItemState eState
= SFX_ITEM_DEFAULT
;
1173 // check all paragraphs inside the selection
1174 for( sal_uInt16 nPara
= rSel
.nStartPara
; nPara
<= rSel
.nEndPara
; nPara
++ )
1176 SfxItemState eParaState
= SFX_ITEM_DEFAULT
;
1178 // calculate start and endpos for this paragraph
1179 sal_uInt16 nPos
= 0;
1180 if( rSel
.nStartPara
== nPara
)
1181 nPos
= rSel
.nStartPos
;
1183 sal_uInt16 nEndPos
= rSel
.nEndPos
;
1184 if( rSel
.nEndPara
!= nPara
)
1185 nEndPos
= rEditEngine
.GetTextLen( nPara
);
1188 // get list of char attribs
1189 rEditEngine
.GetCharAttribs( nPara
, aAttribs
);
1191 sal_Bool bEmpty
= sal_True
; // we found no item inside the selektion of this paragraph
1192 sal_Bool bGaps
= sal_False
; // we found items but theire gaps between them
1193 sal_uInt16 nLastEnd
= nPos
;
1195 const SfxPoolItem
* pParaItem
= NULL
;
1197 for( sal_uInt16 nAttrib
= 0; nAttrib
< aAttribs
.Count(); nAttrib
++ )
1199 struct EECharAttrib aAttrib
= aAttribs
.GetObject( nAttrib
);
1200 DBG_ASSERT( aAttrib
.pAttr
, "GetCharAttribs gives corrupt data" );
1202 const sal_Bool bEmptyPortion
= aAttrib
.nStart
== aAttrib
.nEnd
;
1203 if( (!bEmptyPortion
&& (aAttrib
.nStart
>= nEndPos
)) || (bEmptyPortion
&& (aAttrib
.nStart
> nEndPos
)) )
1204 break; // break if we are already behind our selektion
1206 if( (!bEmptyPortion
&& (aAttrib
.nEnd
<= nPos
)) || (bEmptyPortion
&& (aAttrib
.nEnd
< nPos
)) )
1207 continue; // or if the attribute ends before our selektion
1209 if( aAttrib
.pAttr
->Which() != nWhich
)
1210 continue; // skip if is not the searched item
1212 // if we already found an item
1215 // ... and its different to this one than the state is dont care
1216 if( *pParaItem
!= *aAttrib
.pAttr
)
1217 return SFX_ITEM_DONTCARE
;
1221 pParaItem
= aAttrib
.pAttr
;
1227 if( !bGaps
&& aAttrib
.nStart
> nLastEnd
)
1230 nLastEnd
= aAttrib
.nEnd
;
1233 if( !bEmpty
&& !bGaps
&& nLastEnd
< ( nEndPos
- 1 ) )
1236 // since we have no portion with our item or if there were gaps
1237 if( bEmpty || bGaps )
1239 // we need to check the paragraph item
1240 const SfxItemSet& rParaSet = rEditEngine.GetParaAttribs( nPara );
1241 if( rParaSet.GetItemState( nWhich ) == SFX_ITEM_SET )
1243 eState = SFX_ITEM_SET;
1244 // get item from the paragraph
1245 const SfxPoolItem* pTempItem = rParaSet.GetItem( nWhich );
1248 if( *pParaItem != *pTempItem )
1249 return SFX_ITEM_DONTCARE;
1253 pParaItem = pTempItem;
1256 // set if theres no last item or if its the same
1257 eParaState = SFX_ITEM_SET;
1261 eParaState = SFX_ITEM_DEFAULT;
1265 // gaps and item not set in paragraph, thats a dont care
1266 return SFX_ITEM_DONTCARE;
1271 eParaState = SFX_ITEM_SET;
1275 eParaState
= SFX_ITEM_DEFAULT
;
1277 eParaState
= SFX_ITEM_DONTCARE
;
1279 eParaState
= SFX_ITEM_SET
;
1281 // if we already found an item check if we found the same
1284 if( (pParaItem
== NULL
) || (*pLastItem
!= *pParaItem
) )
1285 return SFX_ITEM_DONTCARE
;
1289 pLastItem
= pParaItem
;
1290 eState
= eParaState
;
1297 sal_uInt16
SmTextForwarder::GetItemState( const ESelection
& rSel
, sal_uInt16 nWhich
) const
1299 sal_uInt16 nState
= SFX_ITEM_DISABLED
;
1300 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1302 nState
= GetSvxEditEngineItemState( *pEditEngine
, rSel
, nWhich
);
1306 sal_uInt16
SmTextForwarder::GetItemState( sal_uInt16 nPara
, sal_uInt16 nWhich
) const
1308 sal_uInt16 nState
= SFX_ITEM_DISABLED
;
1309 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1312 const SfxItemSet
& rSet
= pEditEngine
->GetParaAttribs( nPara
);
1313 nState
= rSet
.GetItemState( nWhich
);
1318 LanguageType
SmTextForwarder::GetLanguage( sal_uInt16 nPara
, sal_uInt16 nIndex
) const
1320 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1321 return pEditEngine
? pEditEngine
->GetLanguage(nPara
, nIndex
) : LANGUAGE_NONE
;
1324 sal_uInt16
SmTextForwarder::GetFieldCount( sal_uInt16 nPara
) const
1326 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1327 return pEditEngine
? pEditEngine
->GetFieldCount(nPara
) : 0;
1330 EFieldInfo
SmTextForwarder::GetFieldInfo( sal_uInt16 nPara
, sal_uInt16 nField
) const
1332 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1333 return pEditEngine
? pEditEngine
->GetFieldInfo( nPara
, nField
) : EFieldInfo();
1336 EBulletInfo
SmTextForwarder::GetBulletInfo( sal_uInt16
/*nPara*/ ) const
1338 return EBulletInfo();
1341 Rectangle
SmTextForwarder::GetCharBounds( sal_uInt16 nPara
, sal_uInt16 nIndex
) const
1343 Rectangle
aRect(0,0,0,0);
1344 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1348 // #108900# Handle virtual position one-past-the end of the string
1349 if( nIndex
>= pEditEngine
->GetTextLen(nPara
) )
1352 aRect
= pEditEngine
->GetCharacterBounds( EPosition(nPara
, nIndex
-1) );
1354 aRect
.Move( aRect
.Right() - aRect
.Left(), 0 );
1355 aRect
.SetSize( Size(1, pEditEngine
->GetTextHeight()) );
1359 aRect
= pEditEngine
->GetCharacterBounds( EPosition(nPara
, nIndex
) );
1365 Rectangle
SmTextForwarder::GetParaBounds( sal_uInt16 nPara
) const
1367 Rectangle
aRect(0,0,0,0);
1368 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1372 const Point aPnt
= pEditEngine
->GetDocPosTopLeft( nPara
);
1373 const sal_uLong nWidth
= pEditEngine
->CalcTextWidth();
1374 const sal_uLong nHeight
= pEditEngine
->GetTextHeight( nPara
);
1375 aRect
= Rectangle( aPnt
.X(), aPnt
.Y(), aPnt
.X() + nWidth
, aPnt
.Y() + nHeight
);
1381 MapMode
SmTextForwarder::GetMapMode() const
1383 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1384 return pEditEngine
? pEditEngine
->GetRefMapMode() : MapMode( MAP_100TH_MM
);
1387 OutputDevice
* SmTextForwarder::GetRefDevice() const
1389 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1390 return pEditEngine
? pEditEngine
->GetRefDevice() : 0;
1393 sal_Bool
SmTextForwarder::GetIndexAtPoint( const Point
& rPos
, sal_uInt16
& nPara
, sal_uInt16
& nIndex
) const
1395 sal_Bool bRes
= sal_False
;
1396 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1399 EPosition aDocPos
= pEditEngine
->FindDocPosition( rPos
);
1400 nPara
= aDocPos
.nPara
;
1401 nIndex
= aDocPos
.nIndex
;
1407 sal_Bool
SmTextForwarder::GetWordIndices( sal_uInt16 nPara
, sal_uInt16 nIndex
, sal_uInt16
& nStart
, sal_uInt16
& nEnd
) const
1409 sal_Bool bRes
= sal_False
;
1410 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1413 ESelection aRes
= pEditEngine
->GetWord( ESelection(nPara
, nIndex
, nPara
, nIndex
), com::sun::star::i18n::WordType::DICTIONARY_WORD
);
1415 if( aRes
.nStartPara
== nPara
&&
1416 aRes
.nStartPara
== aRes
.nEndPara
)
1418 nStart
= aRes
.nStartPos
;
1419 nEnd
= aRes
.nEndPos
;
1428 sal_Bool
SmTextForwarder::GetAttributeRun( sal_uInt16
& nStartIndex
, sal_uInt16
& nEndIndex
, sal_uInt16 nPara
, sal_uInt16 nIndex
) const
1430 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1431 return pEditEngine
?
1432 SvxEditSourceHelper::GetAttributeRun( nStartIndex
, nEndIndex
, *pEditEngine
, nPara
, nIndex
)
1436 sal_uInt16
SmTextForwarder::GetLineCount( sal_uInt16 nPara
) const
1438 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1439 return pEditEngine
? pEditEngine
->GetLineCount(nPara
) : 0;
1442 sal_uInt16
SmTextForwarder::GetLineLen( sal_uInt16 nPara
, sal_uInt16 nLine
) const
1444 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1445 return pEditEngine
? pEditEngine
->GetLineLen(nPara
, nLine
) : 0;
1448 void SmTextForwarder::GetLineBoundaries( /*out*/sal_uInt16
&rStart
, /*out*/sal_uInt16
&rEnd
, sal_uInt16 nPara
, sal_uInt16 nLine
) const
1450 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1451 pEditEngine
->GetLineBoundaries(rStart
, rEnd
, nPara
, nLine
);
1454 sal_uInt16
SmTextForwarder::GetLineNumberAtIndex( sal_uInt16 nPara
, sal_uInt16 nIndex
) const
1456 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1457 return pEditEngine
? pEditEngine
->GetLineNumberAtIndex(nPara
, nIndex
) : 0;
1460 sal_Bool
SmTextForwarder::QuickFormatDoc( sal_Bool
/*bFull*/ )
1462 sal_Bool bRes
= sal_False
;
1463 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1466 pEditEngine
->QuickFormatDoc();
1472 sal_Int16
SmTextForwarder::GetDepth( sal_uInt16
/*nPara*/ ) const
1474 // math has no outliner...
1478 sal_Bool
SmTextForwarder::SetDepth( sal_uInt16
/*nPara*/, sal_Int16 nNewDepth
)
1480 // math has no outliner...
1481 return -1 == nNewDepth
; // is it the value from 'GetDepth' ?
1484 sal_Bool
SmTextForwarder::Delete( const ESelection
& rSelection
)
1486 sal_Bool bRes
= sal_False
;
1487 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1490 pEditEngine
->QuickDelete( rSelection
);
1491 pEditEngine
->QuickFormatDoc();
1497 sal_Bool
SmTextForwarder::InsertText( const String
& rStr
, const ESelection
& rSelection
)
1499 sal_Bool bRes
= sal_False
;
1500 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1503 pEditEngine
->QuickInsertText( rStr
, rSelection
);
1504 pEditEngine
->QuickFormatDoc();
1510 const SfxItemSet
* SmTextForwarder::GetEmptyItemSetPtr()
1512 const SfxItemSet
*pItemSet
= 0;
1513 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1516 pItemSet
= &pEditEngine
->GetEmptyItemSet();
1521 void SmTextForwarder::AppendParagraph()
1523 // append an empty paragraph
1524 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1527 sal_uInt16 nParaCount
= pEditEngine
->GetParagraphCount();
1528 pEditEngine
->InsertParagraph( nParaCount
, String() );
1532 xub_StrLen
SmTextForwarder::AppendTextPortion( sal_uInt16 nPara
, const String
&rText
, const SfxItemSet
&rSet
)
1534 xub_StrLen nRes
= 0;
1535 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1536 if (pEditEngine
&& nPara
< pEditEngine
->GetParagraphCount())
1539 ESelection
aSel( nPara
, pEditEngine
->GetTextLen( nPara
) );
1540 pEditEngine
->QuickInsertText( rText
, aSel
);
1542 // set attributes for new appended text
1543 nRes
= aSel
.nEndPos
= pEditEngine
->GetTextLen( nPara
);
1544 pEditEngine
->QuickSetAttribs( rSet
, aSel
);
1549 void SmTextForwarder::CopyText(const SvxTextForwarder
& rSource
)
1552 const SmTextForwarder
* pSourceForwarder
= dynamic_cast< const SmTextForwarder
* >( &rSource
);
1553 if( !pSourceForwarder
)
1555 EditEngine
* pSourceEditEngine
= pSourceForwarder
->rEditAcc
.GetEditEngine();
1556 EditEngine
*pEditEngine
= rEditAcc
.GetEditEngine();
1557 if (pEditEngine
&& pSourceEditEngine
)
1559 EditTextObject
* pNewTextObject
= pSourceEditEngine
->CreateTextObject();
1560 pEditEngine
->SetText( *pNewTextObject
);
1561 delete pNewTextObject
;
1565 //------------------------------------------------------------------------
1567 SmEditViewForwarder::SmEditViewForwarder( SmEditAccessible
& rAcc
) :
1572 SmEditViewForwarder::~SmEditViewForwarder()
1576 sal_Bool
SmEditViewForwarder::IsValid() const
1578 return rEditAcc
.GetEditView() != 0;
1581 Rectangle
SmEditViewForwarder::GetVisArea() const
1583 Rectangle
aRect(0,0,0,0);
1585 EditView
*pEditView
= rEditAcc
.GetEditView();
1586 OutputDevice
* pOutDev
= pEditView
? pEditView
->GetWindow() : 0;
1588 if( pOutDev
&& pEditView
)
1590 Rectangle aVisArea
= pEditView
->GetVisArea();
1592 // figure out map mode from edit engine
1593 EditEngine
* pEditEngine
= pEditView
->GetEditEngine();
1597 MapMode
aMapMode(pOutDev
->GetMapMode());
1598 aVisArea
= OutputDevice::LogicToLogic( aVisArea
,
1599 pEditEngine
->GetRefMapMode(),
1600 aMapMode
.GetMapUnit() );
1601 aMapMode
.SetOrigin(Point());
1602 aRect
= pOutDev
->LogicToPixel( aVisArea
, aMapMode
);
1609 Point
SmEditViewForwarder::LogicToPixel( const Point
& rPoint
, const MapMode
& rMapMode
) const
1611 EditView
*pEditView
= rEditAcc
.GetEditView();
1612 OutputDevice
* pOutDev
= pEditView
? pEditView
->GetWindow() : 0;
1616 MapMode
aMapMode(pOutDev
->GetMapMode());
1617 Point
aPoint( OutputDevice::LogicToLogic( rPoint
, rMapMode
,
1618 aMapMode
.GetMapUnit() ) );
1619 aMapMode
.SetOrigin(Point());
1620 return pOutDev
->LogicToPixel( aPoint
, aMapMode
);
1626 Point
SmEditViewForwarder::PixelToLogic( const Point
& rPoint
, const MapMode
& rMapMode
) const
1628 EditView
*pEditView
= rEditAcc
.GetEditView();
1629 OutputDevice
* pOutDev
= pEditView
? pEditView
->GetWindow() : 0;
1633 MapMode
aMapMode(pOutDev
->GetMapMode());
1634 aMapMode
.SetOrigin(Point());
1635 Point
aPoint( pOutDev
->PixelToLogic( rPoint
, aMapMode
) );
1636 return OutputDevice::LogicToLogic( aPoint
,
1637 aMapMode
.GetMapUnit(),
1644 sal_Bool
SmEditViewForwarder::GetSelection( ESelection
& rSelection
) const
1646 sal_Bool bRes
= sal_False
;
1647 EditView
*pEditView
= rEditAcc
.GetEditView();
1650 rSelection
= pEditView
->GetSelection();
1656 sal_Bool
SmEditViewForwarder::SetSelection( const ESelection
& rSelection
)
1658 sal_Bool bRes
= sal_False
;
1659 EditView
*pEditView
= rEditAcc
.GetEditView();
1662 pEditView
->SetSelection( rSelection
);
1668 sal_Bool
SmEditViewForwarder::Copy()
1670 sal_Bool bRes
= sal_False
;
1671 EditView
*pEditView
= rEditAcc
.GetEditView();
1680 sal_Bool
SmEditViewForwarder::Cut()
1682 sal_Bool bRes
= sal_False
;
1683 EditView
*pEditView
= rEditAcc
.GetEditView();
1692 sal_Bool
SmEditViewForwarder::Paste()
1694 sal_Bool bRes
= sal_False
;
1695 EditView
*pEditView
= rEditAcc
.GetEditView();
1704 //------------------------------------------------------------------------
1706 SmEditAccessible::SmEditAccessible( SmEditWindow
*pEditWin
) :
1707 aAccName ( String(SmResId(STR_CMDBOXWINDOW
)) ),
1711 DBG_ASSERT( pWin
, "SmEditAccessible: window missing" );
1716 SmEditAccessible::SmEditAccessible( const SmEditAccessible
&rSmAcc
) :
1717 SmEditAccessibleBaseClass(),
1718 aAccName ( String(SmResId(STR_CMDBOXWINDOW
)) )
1720 //vos::OGuard aGuard(Application::GetSolarMutex());
1722 DBG_ASSERT( pWin
, "SmEditAccessible: window missing" );
1726 SmEditAccessible::~SmEditAccessible()
1730 vos::OGuard aGuard(Application::GetSolarMutex());
1731 if (--aRefCount == 0)
1737 void SmEditAccessible::Init()
1739 DBG_ASSERT( pWin
, "SmEditAccessible: window missing" );
1742 EditEngine
*pEditEngine
= pWin
->GetEditEngine();
1743 EditView
*pEditView
= pWin
->GetEditView();
1744 if (pEditEngine
&& pEditView
)
1746 ::std::auto_ptr
< SvxEditSource
> pEditSource(
1747 new SmEditSource( pWin
, *this ) );
1748 pTextHelper
= new ::accessibility::AccessibleTextHelper( pEditSource
);
1749 pTextHelper
->SetEventSource( this );
1754 #ifdef TL_NOT_YET_USED
1755 SmDocShell
* SmEditAccessible::GetDoc_Impl()
1757 SmViewShell
*pView
= pWin
? pWin
->GetView() : 0;
1758 return pView
? pView
->GetDoc() : 0;
1760 #endif // TL_NOT_YET_USED
1762 void SmEditAccessible::ClearWin()
1764 // #112565# remove handler before current object gets destroyed
1765 // (avoid handler being called for already dead object)
1766 EditEngine
*pEditEngine
= GetEditEngine();
1768 pEditEngine
->SetNotifyHdl( Link() );
1770 pWin
= 0; // implicitly results in AccessibleStateType::DEFUNC set
1772 //! make TextHelper implicitly release C++ references to some core objects
1773 pTextHelper
->SetEditSource( ::std::auto_ptr
<SvxEditSource
>(NULL
) );
1774 //! make TextHelper release references
1775 //! (e.g. the one set by the 'SetEventSource' call)
1776 pTextHelper
->Dispose();
1777 delete pTextHelper
; pTextHelper
= 0;
1781 uno::Reference
< XAccessibleContext
> SAL_CALL
SmEditAccessible::getAccessibleContext( )
1782 throw (RuntimeException
)
1784 vos::OGuard
aGuard(Application::GetSolarMutex());
1788 // XAccessibleComponent
1789 sal_Bool SAL_CALL
SmEditAccessible::containsPoint( const awt::Point
& aPoint
)
1790 throw (RuntimeException
)
1792 //! the arguments coordinates are relativ to the current window !
1793 //! Thus the top left-point is (0, 0)
1795 vos::OGuard
aGuard(Application::GetSolarMutex());
1797 throw RuntimeException();
1799 Size
aSz( pWin
->GetSizePixel() );
1800 return aPoint
.X
>= 0 && aPoint
.Y
>= 0 &&
1801 aPoint
.X
< aSz
.Width() && aPoint
.Y
< aSz
.Height();
1804 uno::Reference
< XAccessible
> SAL_CALL
SmEditAccessible::getAccessibleAtPoint( const awt::Point
& aPoint
)
1805 throw (RuntimeException
)
1807 vos::OGuard
aGuard(Application::GetSolarMutex());
1809 throw RuntimeException();
1810 return pTextHelper
->GetAt( aPoint
);
1813 awt::Rectangle SAL_CALL
SmEditAccessible::getBounds( )
1814 throw (RuntimeException
)
1816 vos::OGuard
aGuard(Application::GetSolarMutex());
1818 throw RuntimeException();
1819 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
1820 "mismatch of window parent and accessible parent" );
1821 return lcl_GetBounds( pWin
);
1824 awt::Point SAL_CALL
SmEditAccessible::getLocation( )
1825 throw (RuntimeException
)
1827 vos::OGuard
aGuard(Application::GetSolarMutex());
1829 throw RuntimeException();
1830 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
1831 "mismatch of window parent and accessible parent" );
1832 awt::Rectangle
aRect( lcl_GetBounds( pWin
) );
1833 return awt::Point( aRect
.X
, aRect
.Y
);
1836 awt::Point SAL_CALL
SmEditAccessible::getLocationOnScreen( )
1837 throw (RuntimeException
)
1839 vos::OGuard
aGuard(Application::GetSolarMutex());
1841 throw RuntimeException();
1842 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
1843 "mismatch of window parent and accessible parent" );
1844 return lcl_GetLocationOnScreen( pWin
);
1847 awt::Size SAL_CALL
SmEditAccessible::getSize( )
1848 throw (RuntimeException
)
1850 vos::OGuard
aGuard(Application::GetSolarMutex());
1852 throw RuntimeException();
1853 DBG_ASSERT(pWin
->GetParent()->GetAccessible() == getAccessibleParent(),
1854 "mismatch of window parent and accessible parent" );
1856 Size
aSz( pWin
->GetSizePixel() );
1857 #if OSL_DEBUG_LEVEL > 1
1858 awt::Rectangle
aRect( lcl_GetBounds( pWin
) );
1859 Size
aSz2( aRect
.Width
, aRect
.Height
);
1860 DBG_ASSERT( aSz
== aSz2
, "mismatch in width" );
1862 return awt::Size( aSz
.Width(), aSz
.Height() );
1865 void SAL_CALL
SmEditAccessible::grabFocus( )
1866 throw (RuntimeException
)
1868 vos::OGuard
aGuard(Application::GetSolarMutex());
1870 throw RuntimeException();
1875 sal_Int32 SAL_CALL
SmEditAccessible::getForeground()
1876 throw (RuntimeException
)
1878 vos::OGuard
aGuard(Application::GetSolarMutex());
1881 throw RuntimeException();
1882 return (sal_Int32
) pWin
->GetTextColor().GetColor();
1885 sal_Int32 SAL_CALL
SmEditAccessible::getBackground()
1886 throw (RuntimeException
)
1888 vos::OGuard
aGuard(Application::GetSolarMutex());
1891 throw RuntimeException();
1892 Wallpaper
aWall( pWin
->GetDisplayBackground() );
1894 if (aWall
.IsBitmap() || aWall
.IsGradient())
1895 nCol
= pWin
->GetSettings().GetStyleSettings().GetWindowColor().GetColor();
1897 nCol
= aWall
.GetColor().GetColor();
1898 return (sal_Int32
) nCol
;
1901 // XAccessibleContext
1902 sal_Int32 SAL_CALL
SmEditAccessible::getAccessibleChildCount( )
1903 throw (RuntimeException
)
1905 vos::OGuard
aGuard(Application::GetSolarMutex());
1907 throw RuntimeException();
1908 return pTextHelper
->GetChildCount();
1911 uno::Reference
< XAccessible
> SAL_CALL
SmEditAccessible::getAccessibleChild( sal_Int32 i
)
1912 throw (IndexOutOfBoundsException
, RuntimeException
)
1914 vos::OGuard
aGuard(Application::GetSolarMutex());
1916 throw RuntimeException();
1917 return pTextHelper
->GetChild( i
);
1920 uno::Reference
< XAccessible
> SAL_CALL
SmEditAccessible::getAccessibleParent( )
1921 throw (RuntimeException
)
1923 vos::OGuard
aGuard(Application::GetSolarMutex());
1925 throw RuntimeException();
1927 Window
*pAccParent
= pWin
->GetAccessibleParentWindow();
1928 DBG_ASSERT( pAccParent
, "accessible parent missing" );
1929 return pAccParent
? pAccParent
->GetAccessible() : Reference
< XAccessible
>();
1932 sal_Int32 SAL_CALL
SmEditAccessible::getAccessibleIndexInParent( )
1933 throw (RuntimeException
)
1935 vos::OGuard
aGuard(Application::GetSolarMutex());
1936 sal_Int32 nIdx
= -1;
1937 Window
*pAccParent
= pWin
? pWin
->GetAccessibleParentWindow() : 0;
1940 sal_uInt16 nCnt
= pAccParent
->GetAccessibleChildWindowCount();
1941 for (sal_uInt16 i
= 0; i
< nCnt
&& nIdx
== -1; ++i
)
1942 if (pAccParent
->GetAccessibleChildWindow( i
) == pWin
)
1948 sal_Int16 SAL_CALL
SmEditAccessible::getAccessibleRole( )
1949 throw (RuntimeException
)
1951 vos::OGuard
aGuard(Application::GetSolarMutex());
1952 return AccessibleRole::PANEL
/*TEXT ?*/;
1955 rtl::OUString SAL_CALL
SmEditAccessible::getAccessibleDescription( )
1956 throw (RuntimeException
)
1958 vos::OGuard
aGuard(Application::GetSolarMutex());
1959 return OUString(); // empty as agreed with product-management
1962 rtl::OUString SAL_CALL
SmEditAccessible::getAccessibleName( )
1963 throw (RuntimeException
)
1965 vos::OGuard
aGuard(Application::GetSolarMutex());
1966 // same name as displayed by the window when not docked
1970 uno::Reference
< XAccessibleRelationSet
> SAL_CALL
SmEditAccessible::getAccessibleRelationSet( )
1971 throw (RuntimeException
)
1973 vos::OGuard
aGuard(Application::GetSolarMutex());
1974 Reference
< XAccessibleRelationSet
> xRelSet
= new utl::AccessibleRelationSetHelper();
1975 return xRelSet
; // empty relation set
1978 uno::Reference
< XAccessibleStateSet
> SAL_CALL
SmEditAccessible::getAccessibleStateSet( )
1979 throw (RuntimeException
)
1981 vos::OGuard
aGuard(Application::GetSolarMutex());
1982 ::utl::AccessibleStateSetHelper
*pStateSet
=
1983 new ::utl::AccessibleStateSetHelper
;
1985 Reference
<XAccessibleStateSet
> xStateSet( pStateSet
);
1987 if (!pWin
|| !pTextHelper
)
1988 pStateSet
->AddState( AccessibleStateType::DEFUNC
);
1991 //pStateSet->AddState( AccessibleStateType::EDITABLE );
1992 pStateSet
->AddState( AccessibleStateType::MULTI_LINE
);
1993 //pStateSet->AddState( AccessibleStateType::HORIZONTAL );
1994 //pStateSet->AddState( AccessibleStateType::TRANSIENT );
1995 pStateSet
->AddState( AccessibleStateType::ENABLED
);
1996 pStateSet
->AddState( AccessibleStateType::FOCUSABLE
);
1997 if (pWin
->HasFocus())
1998 pStateSet
->AddState( AccessibleStateType::FOCUSED
);
1999 if (pWin
->IsActive())
2000 pStateSet
->AddState( AccessibleStateType::ACTIVE
);
2001 if (pWin
->IsVisible())
2002 pStateSet
->AddState( AccessibleStateType::SHOWING
);
2003 if (pWin
->IsReallyVisible())
2004 pStateSet
->AddState( AccessibleStateType::VISIBLE
);
2005 if (COL_TRANSPARENT
!= pWin
->GetBackground().GetColor().GetColor())
2006 pStateSet
->AddState( AccessibleStateType::OPAQUE
);
2012 Locale SAL_CALL
SmEditAccessible::getLocale( )
2013 throw (IllegalAccessibleComponentStateException
, RuntimeException
)
2015 vos::OGuard
aGuard(Application::GetSolarMutex());
2016 // should be the document language...
2017 // We use the language of the localized symbol names here.
2018 return Application::GetSettings().GetUILocale();
2022 // XAccessibleEventBroadcaster
2023 void SAL_CALL
SmEditAccessible::addEventListener( const uno::Reference
< XAccessibleEventListener
>& xListener
)
2024 throw (RuntimeException
)
2026 //vos::OGuard aGuard(Application::GetSolarMutex()); if (pTextHelper) // not disposing (about to destroy view shell)
2027 pTextHelper
->AddEventListener( xListener
);
2030 void SAL_CALL
SmEditAccessible::removeEventListener( const uno::Reference
< XAccessibleEventListener
>& xListener
)
2031 throw (RuntimeException
)
2033 //vos::OGuard aGuard(Application::GetSolarMutex());
2034 if (pTextHelper
) // not disposing (about to destroy view shell)
2035 pTextHelper
->RemoveEventListener( xListener
);
2038 OUString SAL_CALL
SmEditAccessible::getImplementationName()
2039 throw (RuntimeException
)
2041 //vos::OGuard aGuard(Application::GetSolarMutex());
2042 return A2OU("SmEditAccessible");
2045 sal_Bool SAL_CALL
SmEditAccessible::supportsService(
2046 const OUString
& rServiceName
)
2047 throw (RuntimeException
)
2049 //vos::OGuard aGuard(Application::GetSolarMutex());
2050 return rServiceName
== A2OU( "com::sun::star::accessibility::Accessible" ) ||
2051 rServiceName
== A2OU( "com::sun::star::accessibility::AccessibleComponent" ) ||
2052 rServiceName
== A2OU( "com::sun::star::accessibility::AccessibleContext" );
2055 Sequence
< OUString
> SAL_CALL
SmEditAccessible::getSupportedServiceNames()
2056 throw (RuntimeException
)
2058 //vos::OGuard aGuard(Application::GetSolarMutex());
2059 Sequence
< OUString
> aNames(3);
2060 OUString
*pNames
= aNames
.getArray();
2061 pNames
[0] = A2OU( "com::sun::star::accessibility::Accessible" );
2062 pNames
[1] = A2OU( "com::sun::star::accessibility::AccessibleComponent" );
2063 pNames
[2] = A2OU( "com::sun::star::accessibility::AccessibleContext" );
2067 //////////////////////////////////////////////////////////////////////