1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
22 #include <com/sun/star/accessibility/AccessibleRole.hpp>
23 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
25 #include <unotools/accessiblestatesethelper.hxx>
27 #include <vcl/svapp.hxx>
28 #include <vcl/settings.hxx>
30 #include <svtools/toolbarmenu.hxx>
32 #include "toolbarmenuimp.hxx"
35 using namespace ::com::sun::star
;
36 using namespace ::com::sun::star::uno
;
37 using namespace ::com::sun::star::lang
;
38 using namespace ::com::sun::star::accessibility
;
46 ToolbarMenuAcc::ToolbarMenuAcc( ToolbarMenu_Impl
& rParent
)
47 : ToolbarMenuAccComponentBase(m_aMutex
)
48 , mpParent( &rParent
)
51 mpParent
->mrMenu
.AddEventListener( LINK( this, ToolbarMenuAcc
, WindowEventListener
) );
56 ToolbarMenuAcc::~ToolbarMenuAcc()
59 mpParent
->mrMenu
.RemoveEventListener( LINK( this, ToolbarMenuAcc
, WindowEventListener
) );
64 IMPL_LINK( ToolbarMenuAcc
, WindowEventListener
, VclSimpleEvent
*, pEvent
)
66 DBG_ASSERT( pEvent
&& pEvent
->ISA( VclWindowEvent
), "Unknown WindowEvent!" );
68 /* Ignore VCLEVENT_WINDOW_ENDPOPUPMODE, because the UNO accessibility wrapper
69 * might have been destroyed by the previous VCLEventListener (if no AT tool
70 * is running), e.g. sub-toolbars in impress.
72 if ( mpParent
&& pEvent
&& pEvent
->ISA( VclWindowEvent
) && (pEvent
->GetId() != VCLEVENT_WINDOW_ENDPOPUPMODE
) )
74 DBG_ASSERT( static_cast<VclWindowEvent
*>(pEvent
)->GetWindow(), "Window???" );
75 if( !static_cast<VclWindowEvent
*>(pEvent
)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent
->GetId() == VCLEVENT_OBJECT_DYING
) )
77 ProcessWindowEvent( *static_cast<VclWindowEvent
*>(pEvent
) );
85 void ToolbarMenuAcc::ProcessWindowEvent( const VclWindowEvent
& rVclWindowEvent
)
87 switch ( rVclWindowEvent
.GetId() )
89 case VCLEVENT_OBJECT_DYING
:
91 mpParent
->mrMenu
.RemoveEventListener( LINK( this, ToolbarMenuAcc
, WindowEventListener
) );
96 case VCLEVENT_WINDOW_GETFOCUS
:
100 mpParent
->notifyHighlightedEntry();
105 case VCLEVENT_WINDOW_LOSEFOCUS
:
122 void ToolbarMenuAcc::FireAccessibleEvent( short nEventId
, const Any
& rOldValue
, const Any
& rNewValue
)
126 EventListenerVector
aTmpListeners( mxEventListeners
);
127 AccessibleEventObject aEvtObject
;
129 aEvtObject
.EventId
= nEventId
;
130 aEvtObject
.Source
= static_cast<XWeak
*>(this);
131 aEvtObject
.NewValue
= rNewValue
;
132 aEvtObject
.OldValue
= rOldValue
;
134 for (EventListenerVector::const_iterator
aIter( aTmpListeners
.begin() ), aEnd( aTmpListeners
.end() );
135 aIter
!= aEnd
; ++aIter
)
139 (*aIter
)->notifyEvent( aEvtObject
);
150 Reference
< XAccessibleContext
> SAL_CALL
ToolbarMenuAcc::getAccessibleContext() throw (RuntimeException
, std::exception
)
158 sal_Int32 SAL_CALL
ToolbarMenuAcc::getAccessibleChildCount() throw (RuntimeException
, std::exception
)
160 const SolarMutexGuard aSolarGuard
;
163 return mpParent
->getAccessibleChildCount();
168 Reference
< XAccessible
> SAL_CALL
ToolbarMenuAcc::getAccessibleChild( sal_Int32 i
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
170 const SolarMutexGuard aSolarGuard
;
173 return mpParent
->getAccessibleChild(i
);
178 Reference
< XAccessible
> SAL_CALL
ToolbarMenuAcc::getAccessibleParent() throw (RuntimeException
, std::exception
)
181 const SolarMutexGuard aSolarGuard
;
183 Reference
< XAccessible
> xRet
;
185 vcl::Window
* pParent
= mpParent
->mrMenu
.GetParent();
187 xRet
= pParent
->GetAccessible();
194 sal_Int32 SAL_CALL
ToolbarMenuAcc::getAccessibleIndexInParent() throw (RuntimeException
, std::exception
)
196 const SolarMutexGuard aSolarGuard
;
199 vcl::Window
* pParent
= mpParent
->mrMenu
.GetParent();
202 for( sal_uInt16 i
= 0, nCount
= pParent
->GetChildCount(); i
< nCount
; i
++ )
204 if( pParent
->GetChild( i
) == &mpParent
->mrMenu
)
214 sal_Int16 SAL_CALL
ToolbarMenuAcc::getAccessibleRole() throw (RuntimeException
, std::exception
)
217 return AccessibleRole::LIST
;
222 OUString SAL_CALL
ToolbarMenuAcc::getAccessibleDescription() throw (RuntimeException
, std::exception
)
225 return OUString( "ToolbarMenu" );
230 OUString SAL_CALL
ToolbarMenuAcc::getAccessibleName() throw (RuntimeException
, std::exception
)
233 const SolarMutexGuard aSolarGuard
;
237 aRet
= mpParent
->mrMenu
.GetAccessibleName();
241 vcl::Window
* pLabel
= mpParent
->mrMenu
.GetAccessibleRelationLabeledBy();
242 if( pLabel
&& pLabel
!= &mpParent
->mrMenu
)
243 aRet
= OutputDevice::GetNonMnemonicString( pLabel
->GetText() );
251 Reference
< XAccessibleRelationSet
> SAL_CALL
ToolbarMenuAcc::getAccessibleRelationSet() throw (RuntimeException
, std::exception
)
254 return Reference
< XAccessibleRelationSet
>();
259 Reference
< XAccessibleStateSet
> SAL_CALL
ToolbarMenuAcc::getAccessibleStateSet() throw (RuntimeException
, std::exception
)
262 ::utl::AccessibleStateSetHelper
* pStateSet
= new ::utl::AccessibleStateSetHelper();
265 pStateSet
->AddState (AccessibleStateType::ENABLED
);
266 pStateSet
->AddState (AccessibleStateType::SENSITIVE
);
267 pStateSet
->AddState (AccessibleStateType::SHOWING
);
268 pStateSet
->AddState (AccessibleStateType::VISIBLE
);
269 pStateSet
->AddState (AccessibleStateType::MANAGES_DESCENDANTS
);
270 pStateSet
->AddState (AccessibleStateType::FOCUSABLE
);
272 pStateSet
->AddState (AccessibleStateType::FOCUSED
);
279 Locale SAL_CALL
ToolbarMenuAcc::getLocale() throw (IllegalAccessibleComponentStateException
, RuntimeException
, std::exception
)
282 const SolarMutexGuard aSolarGuard
;
283 const OUString aEmptyStr
;
284 Reference
< XAccessible
> xParent( getAccessibleParent() );
285 Locale
aRet( aEmptyStr
, aEmptyStr
, aEmptyStr
);
289 Reference
< XAccessibleContext
> xParentContext( xParent
->getAccessibleContext() );
291 if( xParentContext
.is() )
292 aRet
= xParentContext
->getLocale ();
300 void SAL_CALL
ToolbarMenuAcc::addAccessibleEventListener( const Reference
< XAccessibleEventListener
>& rxListener
) throw (RuntimeException
, std::exception
)
303 ::osl::MutexGuard
aGuard(m_aMutex
);
305 if( rxListener
.is() )
307 EventListenerVector::const_iterator aIter
= mxEventListeners
.begin();
310 while( !bFound
&& ( aIter
!= mxEventListeners
.end() ) )
312 if( *aIter
== rxListener
)
319 mxEventListeners
.push_back( rxListener
);
325 void SAL_CALL
ToolbarMenuAcc::removeAccessibleEventListener( const Reference
< XAccessibleEventListener
>& rxListener
) throw (RuntimeException
, std::exception
)
328 ::osl::MutexGuard
aGuard(m_aMutex
);
330 if( rxListener
.is() )
332 EventListenerVector::iterator aIter
= std::find(mxEventListeners
.begin(), mxEventListeners
.end(), rxListener
);
333 if (aIter
!= mxEventListeners
.end())
334 mxEventListeners
.erase(aIter
);
340 sal_Bool SAL_CALL
ToolbarMenuAcc::containsPoint( const awt::Point
& aPoint
) throw (RuntimeException
, std::exception
)
343 const awt::Rectangle
aRect( getBounds() );
344 const Point
aSize( aRect
.Width
, aRect
.Height
);
345 const Point aNullPoint
, aTestPoint( aPoint
.X
, aPoint
.Y
);
347 return Rectangle( aNullPoint
, aSize
).IsInside( aTestPoint
);
352 Reference
< XAccessible
> SAL_CALL
ToolbarMenuAcc::getAccessibleAtPoint( const awt::Point
& aPoint
) throw (RuntimeException
, std::exception
)
354 const SolarMutexGuard aSolarGuard
;
357 Reference
< XAccessible
> xRet
;
359 const Point
aVclPoint( aPoint
.X
, aPoint
.Y
);
361 const int nEntryCount
= mpParent
->maEntryVector
.size();
362 for( int nEntry
= 0; (nEntry
< nEntryCount
) && !xRet
.is(); nEntry
++ )
364 ToolbarMenuEntry
* pEntry
= mpParent
->maEntryVector
[nEntry
];
365 if( pEntry
&& pEntry
->maRect
.IsInside( aVclPoint
) )
367 if( pEntry
->mpControl
)
369 awt::Point
aChildPoint( aPoint
.X
- pEntry
->maRect
.Left(), aPoint
.Y
- pEntry
->maRect
.Top() );
370 Reference
< XAccessibleComponent
> xComp( pEntry
->GetAccessible(true), UNO_QUERY_THROW
);
371 xRet
= xComp
->getAccessibleAtPoint(aChildPoint
);
375 xRet
= Reference
< XAccessible
>( pEntry
->GetAccessible(true), UNO_QUERY
);
384 awt::Rectangle SAL_CALL
ToolbarMenuAcc::getBounds() throw (RuntimeException
, std::exception
)
387 const SolarMutexGuard aSolarGuard
;
388 const Point
aOutPos( mpParent
->mrMenu
.GetPosPixel() );
389 const Size
aOutSize( mpParent
->mrMenu
.GetOutputSizePixel() );
392 aRet
.X
= aOutPos
.X();
393 aRet
.Y
= aOutPos
.Y();
394 aRet
.Width
= aOutSize
.Width();
395 aRet
.Height
= aOutSize
.Height();
402 awt::Point SAL_CALL
ToolbarMenuAcc::getLocation() throw (RuntimeException
, std::exception
)
405 const SolarMutexGuard aSolarGuard
;
406 const Point
aOutPos( mpParent
->mrMenu
.GetPosPixel() );
407 return awt::Point( aOutPos
.X(), aOutPos
.Y() );
412 awt::Point SAL_CALL
ToolbarMenuAcc::getLocationOnScreen() throw (RuntimeException
, std::exception
)
415 const SolarMutexGuard aSolarGuard
;
416 const Point
aScreenPos( mpParent
->mrMenu
.OutputToAbsoluteScreenPixel( Point() ) );
417 return awt::Point( aScreenPos
.X(), aScreenPos
.Y() );
422 awt::Size SAL_CALL
ToolbarMenuAcc::getSize() throw (RuntimeException
, std::exception
)
425 const SolarMutexGuard aSolarGuard
;
426 const Size
aOutSize( mpParent
->mrMenu
.GetOutputSizePixel() );
427 return awt::Size( aOutSize
.Width(), aOutSize
.Height() );
430 void SAL_CALL
ToolbarMenuAcc::grabFocus() throw (RuntimeException
, std::exception
)
433 const SolarMutexGuard aSolarGuard
;
434 mpParent
->mrMenu
.GrabFocus();
437 sal_Int32 SAL_CALL
ToolbarMenuAcc::getForeground() throw (RuntimeException
, std::exception
)
440 sal_uInt32 nColor
= Application::GetSettings().GetStyleSettings().GetMenuTextColor().GetColor();
441 return static_cast<sal_Int32
>(nColor
);
444 sal_Int32 SAL_CALL
ToolbarMenuAcc::getBackground() throw (RuntimeException
, std::exception
)
447 sal_uInt32 nColor
= Application::GetSettings().GetStyleSettings().GetMenuColor().GetColor();
448 return static_cast<sal_Int32
>(nColor
);
451 void SAL_CALL
ToolbarMenuAcc::selectAccessibleChild( sal_Int32 nChildIndex
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
453 const SolarMutexGuard aSolarGuard
;
456 mpParent
->selectAccessibleChild( nChildIndex
);
459 sal_Bool SAL_CALL
ToolbarMenuAcc::isAccessibleChildSelected( sal_Int32 nChildIndex
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
461 const SolarMutexGuard aSolarGuard
;
463 return mpParent
->isAccessibleChildSelected( nChildIndex
);
468 void SAL_CALL
ToolbarMenuAcc::clearAccessibleSelection() throw (RuntimeException
, std::exception
)
470 const SolarMutexGuard aSolarGuard
;
472 mpParent
->clearAccessibleSelection();
477 void SAL_CALL
ToolbarMenuAcc::selectAllAccessibleChildren() throw (RuntimeException
, std::exception
)
480 // unsupported due to single selection only
485 sal_Int32 SAL_CALL
ToolbarMenuAcc::getSelectedAccessibleChildCount() throw (RuntimeException
, std::exception
)
487 const SolarMutexGuard aSolarGuard
;
490 return mpParent
->mnHighlightedEntry
!= -1 ? 1 : 0;
495 Reference
< XAccessible
> SAL_CALL
ToolbarMenuAcc::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
498 const SolarMutexGuard aSolarGuard
;
500 if( (mpParent
->mnHighlightedEntry
!= -1) && (nSelectedChildIndex
== 0) )
502 ToolbarMenuEntry
* pEntry
= mpParent
->maEntryVector
[ mpParent
->mnHighlightedEntry
];
505 if( pEntry
->mpControl
)
507 Reference
< XAccessibleSelection
> xSel( pEntry
->GetAccessible(true), UNO_QUERY_THROW
);
508 return xSel
->getSelectedAccessibleChild(0);
511 return Reference
< XAccessible
>( pEntry
->GetAccessible(true), UNO_QUERY
);
515 throw IndexOutOfBoundsException();
520 void SAL_CALL
ToolbarMenuAcc::deselectAccessibleChild( sal_Int32 nChildIndex
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
523 const SolarMutexGuard aSolarGuard
;
524 // Because of the single selection we can reset the whole selection when
525 // the specified child is currently selected.
526 if (isAccessibleChildSelected(nChildIndex
))
527 mpParent
->clearAccessibleSelection();
532 void SAL_CALL
ToolbarMenuAcc::disposing()
534 EventListenerVector aListenerListCopy
;
537 // Make a copy of the list and clear the original.
538 const SolarMutexGuard aSolarGuard
;
539 ::osl::MutexGuard
aGuard (m_aMutex
);
540 aListenerListCopy
= mxEventListeners
;
541 mxEventListeners
.clear();
543 // Reset the pointer to the parent. It has to be the one who has
544 // disposed us because he is dying.
548 // Inform all listeners that this objects is disposing.
549 EventListenerVector::const_iterator
aListenerIterator (aListenerListCopy
.begin());
550 EventObject
aEvent (static_cast<XAccessible
*>(this));
551 while(aListenerIterator
!= aListenerListCopy
.end())
555 (*aListenerIterator
)->disposing (aEvent
);
559 // Ignore exceptions.
566 void ToolbarMenuAcc::ThrowIfDisposed() throw (DisposedException
)
568 if(rBHelper
.bDisposed
|| rBHelper
.bInDispose
|| !mpParent
)
570 throw DisposedException ("object has been already disposed", static_cast<XWeak
*>(this));
575 // - ToolbarMenuEntryAcc -
578 ToolbarMenuEntryAcc::ToolbarMenuEntryAcc( ToolbarMenuEntry
* pParent
)
579 : ToolbarMenuEntryAccBase( m_aMutex
)
580 , mpParent( pParent
)
586 ToolbarMenuEntryAcc::~ToolbarMenuEntryAcc()
592 void SAL_CALL
ToolbarMenuEntryAcc::disposing()
594 EventListenerVector aListenerListCopy
;
597 // Make a copy of the list and clear the original.
598 const SolarMutexGuard aSolarGuard
;
599 ::osl::MutexGuard
aGuard (m_aMutex
);
600 aListenerListCopy
= mxEventListeners
;
601 mxEventListeners
.clear();
603 // Reset the pointer to the parent. It has to be the one who has
604 // disposed us because he is dying.
608 // Inform all listeners that this objects is disposing.
609 EventListenerVector::const_iterator
aListenerIterator (aListenerListCopy
.begin());
610 EventObject
aEvent (static_cast<XAccessible
*>(this));
611 while(aListenerIterator
!= aListenerListCopy
.end())
615 (*aListenerIterator
)->disposing (aEvent
);
619 // Ignore exceptions.
627 Reference
< XAccessibleContext
> SAL_CALL
ToolbarMenuEntryAcc::getAccessibleContext() throw (RuntimeException
, std::exception
)
634 sal_Int32 SAL_CALL
ToolbarMenuEntryAcc::getAccessibleChildCount() throw (RuntimeException
, std::exception
)
641 Reference
< XAccessible
> SAL_CALL
ToolbarMenuEntryAcc::getAccessibleChild( sal_Int32
) throw (IndexOutOfBoundsException
, RuntimeException
, std::exception
)
643 throw IndexOutOfBoundsException();
648 Reference
< XAccessible
> SAL_CALL
ToolbarMenuEntryAcc::getAccessibleParent() throw (RuntimeException
, std::exception
)
650 const SolarMutexGuard aSolarGuard
;
651 Reference
< XAccessible
> xRet
;
654 xRet
= mpParent
->mrMenu
.GetAccessible();
661 sal_Int32 SAL_CALL
ToolbarMenuEntryAcc::getAccessibleIndexInParent() throw (RuntimeException
, std::exception
)
663 const SolarMutexGuard aSolarGuard
;
664 // The index defaults to -1 to indicate the child does not belong to its
666 sal_Int32 nIndexInParent
= -1;
670 Reference
< XAccessibleContext
> xParent( mpParent
->mrMenu
.GetAccessible(), UNO_QUERY
);
674 Reference
< XAccessible
> xThis( this );
676 const sal_Int32 nCount
= xParent
->getAccessibleChildCount();
677 for( sal_Int32 nIndex
= 0; nIndex
< nCount
; nIndex
++ )
679 if( xParent
->getAccessibleChild(nIndex
) == xThis
)
681 nIndexInParent
= nIndex
;
688 return nIndexInParent
;
693 sal_Int16 SAL_CALL
ToolbarMenuEntryAcc::getAccessibleRole() throw (RuntimeException
, std::exception
)
695 return AccessibleRole::LIST_ITEM
;
700 OUString SAL_CALL
ToolbarMenuEntryAcc::getAccessibleDescription() throw (RuntimeException
, std::exception
)
707 OUString SAL_CALL
ToolbarMenuEntryAcc::getAccessibleName() throw (RuntimeException
, std::exception
)
709 const SolarMutexGuard aSolarGuard
;
714 aRet
= mpParent
->maText
;
719 aRet
+= OUString::number( mpParent
->mnEntryId
);
728 Reference
< XAccessibleRelationSet
> SAL_CALL
ToolbarMenuEntryAcc::getAccessibleRelationSet() throw (RuntimeException
, std::exception
)
730 return Reference
< XAccessibleRelationSet
>();
735 Reference
< XAccessibleStateSet
> SAL_CALL
ToolbarMenuEntryAcc::getAccessibleStateSet() throw (RuntimeException
, std::exception
)
737 const SolarMutexGuard aSolarGuard
;
738 ::utl::AccessibleStateSetHelper
* pStateSet
= new ::utl::AccessibleStateSetHelper
;
742 pStateSet
->AddState (AccessibleStateType::ENABLED
);
743 pStateSet
->AddState (AccessibleStateType::SENSITIVE
);
744 pStateSet
->AddState (AccessibleStateType::SHOWING
);
745 pStateSet
->AddState (AccessibleStateType::VISIBLE
);
746 pStateSet
->AddState (AccessibleStateType::TRANSIENT
);
747 if( mpParent
->mnEntryId
!= TITLE_ID
)
749 pStateSet
->AddState( AccessibleStateType::SELECTABLE
);
752 if( mpParent
->mrMenu
.getHighlightedEntryId() == mpParent
->mnEntryId
)
753 pStateSet
->AddState( AccessibleStateType::SELECTED
);
762 Locale SAL_CALL
ToolbarMenuEntryAcc::getLocale() throw (IllegalAccessibleComponentStateException
, RuntimeException
, std::exception
)
764 const OUString aEmptyStr
;
765 Locale
aRet( aEmptyStr
, aEmptyStr
, aEmptyStr
);
767 Reference
< XAccessible
> xParent( getAccessibleParent() );
770 Reference
< XAccessibleContext
> xParentContext( xParent
->getAccessibleContext() );
772 if( xParentContext
.is() )
773 aRet
= xParentContext
->getLocale();
781 void SAL_CALL
ToolbarMenuEntryAcc::addAccessibleEventListener( const Reference
< XAccessibleEventListener
>& rxListener
) throw (RuntimeException
, std::exception
)
783 const ::osl::MutexGuard
aGuard( maMutex
);
785 if( rxListener
.is() )
787 for (EventListenerVector::const_iterator
aIter( mxEventListeners
.begin() ), aEnd( mxEventListeners
.end() );
788 aIter
!= aEnd
; ++aIter
)
790 if( *aIter
== rxListener
)
793 // listener not found so add it
794 mxEventListeners
.push_back( rxListener
);
800 void SAL_CALL
ToolbarMenuEntryAcc::removeAccessibleEventListener( const Reference
< XAccessibleEventListener
>& rxListener
) throw (RuntimeException
, std::exception
)
802 const ::osl::MutexGuard
aGuard( maMutex
);
804 if( rxListener
.is() )
806 EventListenerVector::iterator aIter
= std::find(mxEventListeners
.begin(), mxEventListeners
.end(), rxListener
);
807 if (aIter
!= mxEventListeners
.end())
808 mxEventListeners
.erase(aIter
);
814 sal_Bool SAL_CALL
ToolbarMenuEntryAcc::containsPoint( const awt::Point
& aPoint
) throw (RuntimeException
, std::exception
)
816 const awt::Rectangle
aRect( getBounds() );
817 const Point
aSize( aRect
.Width
, aRect
.Height
);
818 const Point aNullPoint
, aTestPoint( aPoint
.X
, aPoint
.Y
);
820 return Rectangle( aNullPoint
, aSize
).IsInside( aTestPoint
);
825 Reference
< XAccessible
> SAL_CALL
ToolbarMenuEntryAcc::getAccessibleAtPoint( const awt::Point
& ) throw (RuntimeException
, std::exception
)
827 Reference
< XAccessible
> xRet
;
833 awt::Rectangle SAL_CALL
ToolbarMenuEntryAcc::getBounds() throw (RuntimeException
, std::exception
)
835 const SolarMutexGuard aSolarGuard
;
840 Rectangle
aRect( mpParent
->maRect
);
842 Rectangle
aParentRect( aOrigin
, mpParent
->mrMenu
.GetOutputSizePixel() );
844 aRect
.Intersection( aParentRect
);
846 aRet
.X
= aRect
.Left();
847 aRet
.Y
= aRect
.Top();
848 aRet
.Width
= aRect
.GetWidth();
849 aRet
.Height
= aRect
.GetHeight();
857 awt::Point SAL_CALL
ToolbarMenuEntryAcc::getLocation() throw (RuntimeException
, std::exception
)
859 const awt::Rectangle
aRect( getBounds() );
860 return awt::Point( aRect
.X
, aRect
.Y
);
865 awt::Point SAL_CALL
ToolbarMenuEntryAcc::getLocationOnScreen() throw (RuntimeException
, std::exception
)
867 const SolarMutexGuard aSolarGuard
;
872 const Point
aScreenPos( mpParent
->mrMenu
.OutputToAbsoluteScreenPixel( mpParent
->maRect
.TopLeft() ) );
874 aRet
.X
= aScreenPos
.X();
875 aRet
.Y
= aScreenPos
.Y();
883 awt::Size SAL_CALL
ToolbarMenuEntryAcc::getSize() throw (RuntimeException
, std::exception
)
885 const awt::Rectangle
aRect( getBounds() );
888 aRet
.Width
= aRect
.Width
;
889 aRet
.Height
= aRect
.Height
;
894 void SAL_CALL
ToolbarMenuEntryAcc::grabFocus() throw (RuntimeException
, std::exception
)
899 sal_Int32 SAL_CALL
ToolbarMenuEntryAcc::getForeground( ) throw (RuntimeException
, std::exception
)
901 return static_cast<sal_Int32
>(Application::GetSettings().GetStyleSettings().GetMenuTextColor().GetColor());
904 sal_Int32 SAL_CALL
ToolbarMenuEntryAcc::getBackground( ) throw (RuntimeException
, std::exception
)
906 return static_cast<sal_Int32
>(Application::GetSettings().GetStyleSettings().GetMenuColor().GetColor());
911 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */