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 .
20 #include "thumbnailviewacc.hxx"
22 #include <comphelper/servicehelper.hxx>
23 #include <sfx2/thumbnailview.hxx>
24 #include <sfx2/thumbnailviewitem.hxx>
25 #include <unotools/accessiblestatesethelper.hxx>
26 #include <vcl/svapp.hxx>
27 #include <vcl/settings.hxx>
28 #include <sal/log.hxx>
29 #include <tools/debug.hxx>
30 #include <tools/diagnose_ex.h>
32 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
33 #include <com/sun/star/accessibility/AccessibleRole.hpp>
34 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
35 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
37 using namespace ::com::sun::star
;
39 ThumbnailViewAcc::ThumbnailViewAcc( ThumbnailView
* pParent
) :
40 ValueSetAccComponentBase (m_aMutex
),
45 ThumbnailViewAcc::~ThumbnailViewAcc()
51 class theSfxValueSetAccUnoTunnelId
: public rtl::Static
< UnoTunnelIdInit
, theSfxValueSetAccUnoTunnelId
> {};
54 const uno::Sequence
< sal_Int8
>& ThumbnailViewAcc::getUnoTunnelId()
56 return theSfxValueSetAccUnoTunnelId::get().getSeq();
59 ThumbnailViewAcc
* ThumbnailViewAcc::getImplementation( const uno::Reference
< uno::XInterface
>& rxData
)
64 return comphelper::getUnoTunnelImplementation
<ThumbnailViewAcc
>(rxData
);
66 catch(const css::uno::Exception
&)
72 uno::Reference
< accessibility::XAccessibleContext
> SAL_CALL
ThumbnailViewAcc::getAccessibleContext()
78 sal_Int32 SAL_CALL
ThumbnailViewAcc::getAccessibleChildCount()
80 const SolarMutexGuard aSolarGuard
;
83 sal_Int32 nCount
= mpParent
->ImplGetVisibleItemCount();
87 uno::Reference
< accessibility::XAccessible
> SAL_CALL
ThumbnailViewAcc::getAccessibleChild( sal_Int32 i
)
90 const SolarMutexGuard aSolarGuard
;
91 ThumbnailViewItem
* pItem
= getItem (sal::static_int_cast
< sal_uInt16
>(i
));
94 throw lang::IndexOutOfBoundsException();
96 uno::Reference
< accessibility::XAccessible
> xRet
= pItem
->GetAccessible( /*bIsTransientChildrenDisabled*/false );
100 uno::Reference
< accessibility::XAccessible
> SAL_CALL
ThumbnailViewAcc::getAccessibleParent()
103 const SolarMutexGuard aSolarGuard
;
104 return mpParent
->GetDrawingArea()->get_accessible_parent();
107 sal_Int32 SAL_CALL
ThumbnailViewAcc::getAccessibleIndexInParent()
110 const SolarMutexGuard aSolarGuard
;
112 // -1 for child not found/no parent (according to specification)
115 uno::Reference
<accessibility::XAccessible
> xParent(getAccessibleParent());
121 uno::Reference
<accessibility::XAccessibleContext
> xParentContext(xParent
->getAccessibleContext());
123 // iterate over parent's children and search for this object
124 if ( xParentContext
.is() )
126 sal_Int32 nChildCount
= xParentContext
->getAccessibleChildCount();
127 for ( sal_Int32 nChild
= 0; ( nChild
< nChildCount
) && ( -1 == nRet
); ++nChild
)
129 uno::Reference
<XAccessible
> xChild(xParentContext
->getAccessibleChild(nChild
));
130 if ( xChild
.get() == this )
135 catch (const uno::Exception
&)
137 TOOLS_WARN_EXCEPTION( "sfx", "OAccessibleContextHelper::getAccessibleIndexInParent" );
143 sal_Int16 SAL_CALL
ThumbnailViewAcc::getAccessibleRole()
146 // #i73746# As the Java Access Bridge (v 2.0.1) uses "managesDescendants"
147 // always if the role is LIST, we need a different role in this case
148 return accessibility::AccessibleRole::LIST
;
151 OUString SAL_CALL
ThumbnailViewAcc::getAccessibleDescription()
154 return "ThumbnailView";
157 OUString SAL_CALL
ThumbnailViewAcc::getAccessibleName()
160 const SolarMutexGuard aSolarGuard
;
165 aRet
= mpParent
->GetAccessibleName();
171 uno::Reference
< accessibility::XAccessibleRelationSet
> SAL_CALL
ThumbnailViewAcc::getAccessibleRelationSet()
174 return uno::Reference
< accessibility::XAccessibleRelationSet
>();
177 uno::Reference
< accessibility::XAccessibleStateSet
> SAL_CALL
ThumbnailViewAcc::getAccessibleStateSet()
180 ::utl::AccessibleStateSetHelper
* pStateSet
= new ::utl::AccessibleStateSetHelper();
183 pStateSet
->AddState (accessibility::AccessibleStateType::ENABLED
);
184 pStateSet
->AddState (accessibility::AccessibleStateType::SENSITIVE
);
185 pStateSet
->AddState (accessibility::AccessibleStateType::SHOWING
);
186 pStateSet
->AddState (accessibility::AccessibleStateType::VISIBLE
);
187 pStateSet
->AddState (accessibility::AccessibleStateType::MANAGES_DESCENDANTS
);
188 pStateSet
->AddState (accessibility::AccessibleStateType::FOCUSABLE
);
193 lang::Locale SAL_CALL
ThumbnailViewAcc::getLocale()
196 const SolarMutexGuard aSolarGuard
;
197 uno::Reference
< accessibility::XAccessible
> xParent( getAccessibleParent() );
198 lang::Locale
aRet( "", "", "" );
202 uno::Reference
< accessibility::XAccessibleContext
> xParentContext( xParent
->getAccessibleContext() );
204 if( xParentContext
.is() )
205 aRet
= xParentContext
->getLocale ();
211 void SAL_CALL
ThumbnailViewAcc::addAccessibleEventListener( const uno::Reference
< accessibility::XAccessibleEventListener
>& rxListener
)
214 ::osl::MutexGuard
aGuard (m_aMutex
);
216 if( !rxListener
.is() )
221 for (auto const& eventListener
: mxEventListeners
)
223 if( eventListener
== rxListener
)
231 mxEventListeners
.push_back( rxListener
);
234 void SAL_CALL
ThumbnailViewAcc::removeAccessibleEventListener( const uno::Reference
< accessibility::XAccessibleEventListener
>& rxListener
)
237 ::osl::MutexGuard
aGuard (m_aMutex
);
239 if( rxListener
.is() )
241 std::vector
< uno::Reference
< accessibility::XAccessibleEventListener
> >::iterator aIter
=
242 std::find(mxEventListeners
.begin(), mxEventListeners
.end(), rxListener
);
244 if (aIter
!= mxEventListeners
.end())
245 mxEventListeners
.erase( aIter
);
249 sal_Bool SAL_CALL
ThumbnailViewAcc::containsPoint( const awt::Point
& aPoint
)
252 const awt::Rectangle
aRect( getBounds() );
253 const Point
aSize( aRect
.Width
, aRect
.Height
);
254 const Point aNullPoint
, aTestPoint( aPoint
.X
, aPoint
.Y
);
256 return tools::Rectangle( aNullPoint
, aSize
).IsInside( aTestPoint
);
259 uno::Reference
< accessibility::XAccessible
> SAL_CALL
ThumbnailViewAcc::getAccessibleAtPoint( const awt::Point
& aPoint
)
262 const SolarMutexGuard aSolarGuard
;
263 const sal_uInt16 nItemId
= mpParent
->GetItemId( Point( aPoint
.X
, aPoint
.Y
) );
264 uno::Reference
< accessibility::XAccessible
> xRet
;
268 const size_t nItemPos
= mpParent
->GetItemPos( nItemId
);
270 if( THUMBNAILVIEW_ITEM_NONEITEM
!= nItemPos
)
272 ThumbnailViewItem
*const pItem
= mpParent
->mFilteredItemList
[nItemPos
];
273 xRet
= pItem
->GetAccessible( /*bIsTransientChildrenDisabled*/false );
280 awt::Rectangle SAL_CALL
ThumbnailViewAcc::getBounds()
283 const SolarMutexGuard aSolarGuard
;
285 const Size
aOutSize( mpParent
->GetOutputSizePixel() );
288 aRet
.X
= aOutPos
.X();
289 aRet
.Y
= aOutPos
.Y();
290 aRet
.Width
= aOutSize
.Width();
291 aRet
.Height
= aOutSize
.Height();
296 awt::Point SAL_CALL
ThumbnailViewAcc::getLocation()
299 const awt::Rectangle
aRect( getBounds() );
308 awt::Point SAL_CALL
ThumbnailViewAcc::getLocationOnScreen()
311 const SolarMutexGuard aSolarGuard
;
312 awt::Point
aScreenLoc(0, 0);
314 uno::Reference
<accessibility::XAccessible
> xParent(getAccessibleParent());
317 uno::Reference
<accessibility::XAccessibleContext
> xParentContext(xParent
->getAccessibleContext());
318 uno::Reference
<accessibility::XAccessibleComponent
> xParentComponent(xParentContext
, css::uno::UNO_QUERY
);
319 OSL_ENSURE( xParentComponent
.is(), "ThumbnailViewAcc::getLocationOnScreen: no parent component!" );
320 if ( xParentComponent
.is() )
322 awt::Point
aParentScreenLoc( xParentComponent
->getLocationOnScreen() );
323 awt::Point
aOwnRelativeLoc( getLocation() );
324 aScreenLoc
.X
= aParentScreenLoc
.X
+ aOwnRelativeLoc
.X
;
325 aScreenLoc
.Y
= aParentScreenLoc
.Y
+ aOwnRelativeLoc
.Y
;
332 awt::Size SAL_CALL
ThumbnailViewAcc::getSize()
335 const awt::Rectangle
aRect( getBounds() );
338 aRet
.Width
= aRect
.Width
;
339 aRet
.Height
= aRect
.Height
;
344 void SAL_CALL
ThumbnailViewAcc::grabFocus()
347 const SolarMutexGuard aSolarGuard
;
348 mpParent
->GrabFocus();
351 sal_Int32 SAL_CALL
ThumbnailViewAcc::getForeground( )
354 Color nColor
= Application::GetSettings().GetStyleSettings().GetWindowTextColor();
355 return static_cast<sal_Int32
>(nColor
);
358 sal_Int32 SAL_CALL
ThumbnailViewAcc::getBackground( )
361 Color nColor
= Application::GetSettings().GetStyleSettings().GetWindowColor();
362 return static_cast<sal_Int32
>(nColor
);
365 void SAL_CALL
ThumbnailViewAcc::selectAccessibleChild( sal_Int32 nChildIndex
)
368 const SolarMutexGuard aSolarGuard
;
369 ThumbnailViewItem
* pItem
= getItem (sal::static_int_cast
< sal_uInt16
>(nChildIndex
));
372 throw lang::IndexOutOfBoundsException();
374 mpParent
->SelectItem( pItem
->mnId
);
377 sal_Bool SAL_CALL
ThumbnailViewAcc::isAccessibleChildSelected( sal_Int32 nChildIndex
)
380 const SolarMutexGuard aSolarGuard
;
381 ThumbnailViewItem
* pItem
= getItem (sal::static_int_cast
< sal_uInt16
>(nChildIndex
));
383 if (pItem
== nullptr)
384 throw lang::IndexOutOfBoundsException();
386 return mpParent
->IsItemSelected( pItem
->mnId
);
389 void SAL_CALL
ThumbnailViewAcc::clearAccessibleSelection()
394 void SAL_CALL
ThumbnailViewAcc::selectAllAccessibleChildren()
397 // unsupported due to single selection only
400 sal_Int32 SAL_CALL
ThumbnailViewAcc::getSelectedAccessibleChildCount()
403 const SolarMutexGuard aSolarGuard
;
406 for( sal_uInt16 i
= 0, nCount
= getItemCount(); i
< nCount
; i
++ )
408 ThumbnailViewItem
* pItem
= getItem (i
);
410 if( pItem
&& mpParent
->IsItemSelected( pItem
->mnId
) )
417 uno::Reference
< accessibility::XAccessible
> SAL_CALL
ThumbnailViewAcc::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex
)
420 const SolarMutexGuard aSolarGuard
;
421 uno::Reference
< accessibility::XAccessible
> xRet
;
423 for( sal_uInt16 i
= 0, nCount
= getItemCount(), nSel
= 0; ( i
< nCount
) && !xRet
.is(); i
++ )
425 ThumbnailViewItem
* pItem
= getItem(i
);
427 if( pItem
&& mpParent
->IsItemSelected( pItem
->mnId
) && ( nSelectedChildIndex
== static_cast< sal_Int32
>( nSel
++ ) ) )
428 xRet
= pItem
->GetAccessible( /*bIsTransientChildrenDisabled*/false );
434 void SAL_CALL
ThumbnailViewAcc::deselectAccessibleChild( sal_Int32
)
437 const SolarMutexGuard aSolarGuard
;
438 // Because of the single selection we can reset the whole selection when
439 // the specified child is currently selected.
440 //FIXME TODO if (isAccessibleChildSelected(nChildIndex))
444 sal_Int64 SAL_CALL
ThumbnailViewAcc::getSomething( const uno::Sequence
< sal_Int8
>& rId
)
448 if( isUnoTunnelId
<ThumbnailViewAcc
>(rId
) )
449 nRet
= reinterpret_cast< sal_Int64
>( this );
456 void SAL_CALL
ThumbnailViewAcc::disposing()
458 ::std::vector
<uno::Reference
<accessibility::XAccessibleEventListener
> > aListenerListCopy
;
461 // Make a copy of the list and clear the original.
462 const SolarMutexGuard aSolarGuard
;
463 ::osl::MutexGuard
aGuard (m_aMutex
);
464 aListenerListCopy
= mxEventListeners
;
465 mxEventListeners
.clear();
467 // Reset the pointer to the parent. It has to be the one who has
468 // disposed us because he is dying.
472 // Inform all listeners that this objects is disposing.
473 lang::EventObject
aEvent (static_cast<accessibility::XAccessible
*>(this));
474 for (auto const& listener
: aListenerListCopy
)
478 listener
->disposing (aEvent
);
480 catch(const uno::Exception
&)
482 // Ignore exceptions.
487 sal_uInt16
ThumbnailViewAcc::getItemCount() const
489 return mpParent
->ImplGetVisibleItemCount();
492 ThumbnailViewItem
* ThumbnailViewAcc::getItem (sal_uInt16 nIndex
) const
494 return mpParent
->ImplGetVisibleItem (nIndex
);
497 void ThumbnailViewAcc::ThrowIfDisposed()
499 if (rBHelper
.bDisposed
|| rBHelper
.bInDispose
)
501 SAL_WARN("sfx", "Calling disposed object. Throwing exception:");
502 throw lang::DisposedException (
503 "object has been already disposed",
504 static_cast<uno::XWeak
*>(this));
508 DBG_ASSERT (mpParent
!=nullptr, "ValueSetAcc not disposed but mpParent == NULL");
512 ThumbnailViewItemAcc::ThumbnailViewItemAcc( ThumbnailViewItem
* pParent
, bool bIsTransientChildrenDisabled
) :
514 mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled
)
518 ThumbnailViewItemAcc::~ThumbnailViewItemAcc()
522 void ThumbnailViewItemAcc::ParentDestroyed()
524 const ::osl::MutexGuard
aGuard( maMutex
);
528 void ThumbnailViewAcc::FireAccessibleEvent( short nEventId
, const uno::Any
& rOldValue
, const uno::Any
& rNewValue
)
533 ::std::vector
< uno::Reference
< accessibility::XAccessibleEventListener
> > aTmpListeners( mxEventListeners
);
534 accessibility::AccessibleEventObject aEvtObject
;
536 aEvtObject
.EventId
= nEventId
;
537 aEvtObject
.Source
= static_cast<uno::XWeak
*>(this);
538 aEvtObject
.NewValue
= rNewValue
;
539 aEvtObject
.OldValue
= rOldValue
;
541 for (auto const& tmpListener
: aTmpListeners
)
545 tmpListener
->notifyEvent( aEvtObject
);
547 catch(const uno::Exception
&)
555 class theValueItemAccUnoTunnelId
: public rtl::Static
< UnoTunnelIdInit
, theValueItemAccUnoTunnelId
> {};
558 const uno::Sequence
< sal_Int8
>& ThumbnailViewItemAcc::getUnoTunnelId()
560 return theValueItemAccUnoTunnelId::get().getSeq();
563 ThumbnailViewItemAcc
* ThumbnailViewItemAcc::getImplementation( const uno::Reference
< uno::XInterface
>& rxData
)
568 return comphelper::getUnoTunnelImplementation
<ThumbnailViewItemAcc
>(rxData
);
570 catch(const css::uno::Exception
&)
576 void ThumbnailViewAcc::GetFocus()
578 // Broadcast the state change.
579 css::uno::Any aOldState
, aNewState
;
580 aNewState
<<= css::accessibility::AccessibleStateType::FOCUSED
;
582 css::accessibility::AccessibleEventId::STATE_CHANGED
,
583 aOldState
, aNewState
);
586 void ThumbnailViewAcc::LoseFocus()
588 // Broadcast the state change.
589 css::uno::Any aOldState
, aNewState
;
590 aOldState
<<= css::accessibility::AccessibleStateType::FOCUSED
;
592 css::accessibility::AccessibleEventId::STATE_CHANGED
,
593 aOldState
, aNewState
);
596 uno::Reference
< accessibility::XAccessibleContext
> SAL_CALL
ThumbnailViewItemAcc::getAccessibleContext()
601 sal_Int32 SAL_CALL
ThumbnailViewItemAcc::getAccessibleChildCount()
606 uno::Reference
< accessibility::XAccessible
> SAL_CALL
ThumbnailViewItemAcc::getAccessibleChild( sal_Int32
)
608 throw lang::IndexOutOfBoundsException();
611 uno::Reference
< accessibility::XAccessible
> SAL_CALL
ThumbnailViewItemAcc::getAccessibleParent()
613 const SolarMutexGuard aSolarGuard
;
614 uno::Reference
< accessibility::XAccessible
> xRet
;
617 xRet
= mpParent
->mrParent
.getAccessible();
622 sal_Int32 SAL_CALL
ThumbnailViewItemAcc::getAccessibleIndexInParent()
624 const SolarMutexGuard aSolarGuard
;
625 // The index defaults to -1 to indicate the child does not belong to its
627 sal_Int32 nIndexInParent
= -1;
633 sal_uInt16 nCount
= mpParent
->mrParent
.ImplGetVisibleItemCount();
634 ThumbnailViewItem
* pItem
;
635 for (sal_uInt16 i
=0; i
<nCount
&& !bDone
; i
++)
637 // Guard the retrieval of the i-th child with a try/catch block
638 // just in case the number of children changes in the meantime.
641 pItem
= mpParent
->mrParent
.ImplGetVisibleItem (i
);
643 catch (const lang::IndexOutOfBoundsException
&)
648 // Do not create an accessible object for the test.
649 if (pItem
!= nullptr && pItem
->mxAcc
.is())
650 if (pItem
->GetAccessible( mbIsTransientChildrenDisabled
).get() == this )
658 return nIndexInParent
;
661 sal_Int16 SAL_CALL
ThumbnailViewItemAcc::getAccessibleRole()
663 return accessibility::AccessibleRole::LIST_ITEM
;
666 OUString SAL_CALL
ThumbnailViewItemAcc::getAccessibleDescription()
671 OUString SAL_CALL
ThumbnailViewItemAcc::getAccessibleName()
673 const SolarMutexGuard aSolarGuard
;
678 aRet
= mpParent
->maTitle
;
682 aRet
= "Item " + OUString::number(static_cast<sal_Int32
>(mpParent
->mnId
));
689 uno::Reference
< accessibility::XAccessibleRelationSet
> SAL_CALL
ThumbnailViewItemAcc::getAccessibleRelationSet()
691 return uno::Reference
< accessibility::XAccessibleRelationSet
>();
694 uno::Reference
< accessibility::XAccessibleStateSet
> SAL_CALL
ThumbnailViewItemAcc::getAccessibleStateSet()
696 const SolarMutexGuard aSolarGuard
;
697 ::utl::AccessibleStateSetHelper
* pStateSet
= new ::utl::AccessibleStateSetHelper
;
701 pStateSet
->AddState (accessibility::AccessibleStateType::ENABLED
);
702 pStateSet
->AddState (accessibility::AccessibleStateType::SENSITIVE
);
703 pStateSet
->AddState (accessibility::AccessibleStateType::SHOWING
);
704 pStateSet
->AddState (accessibility::AccessibleStateType::VISIBLE
);
705 if ( !mbIsTransientChildrenDisabled
)
706 pStateSet
->AddState (accessibility::AccessibleStateType::TRANSIENT
);
709 pStateSet
->AddState( accessibility::AccessibleStateType::SELECTABLE
);
710 // pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE );
713 if( mpParent
->isSelected() )
715 pStateSet
->AddState( accessibility::AccessibleStateType::SELECTED
);
716 // pStateSet->AddState( accessibility::AccessibleStateType::FOCUSED );
723 lang::Locale SAL_CALL
ThumbnailViewItemAcc::getLocale()
725 const SolarMutexGuard aSolarGuard
;
726 uno::Reference
< accessibility::XAccessible
> xParent( getAccessibleParent() );
727 lang::Locale
aRet( "", "", "" );
731 uno::Reference
< accessibility::XAccessibleContext
> xParentContext( xParent
->getAccessibleContext() );
733 if( xParentContext
.is() )
734 aRet
= xParentContext
->getLocale();
740 void SAL_CALL
ThumbnailViewItemAcc::addAccessibleEventListener( const uno::Reference
< accessibility::XAccessibleEventListener
>& rxListener
)
742 const ::osl::MutexGuard
aGuard( maMutex
);
744 if( !rxListener
.is() )
749 for (auto const& eventListener
: mxEventListeners
)
751 if( eventListener
== rxListener
)
759 mxEventListeners
.push_back( rxListener
);
762 void SAL_CALL
ThumbnailViewItemAcc::removeAccessibleEventListener( const uno::Reference
< accessibility::XAccessibleEventListener
>& rxListener
)
764 const ::osl::MutexGuard
aGuard( maMutex
);
766 if( rxListener
.is() )
768 std::vector
< uno::Reference
< accessibility::XAccessibleEventListener
> >::iterator aIter
=
769 std::find(mxEventListeners
.begin(), mxEventListeners
.end(), rxListener
);
771 if (aIter
!= mxEventListeners
.end())
772 mxEventListeners
.erase( aIter
);
776 sal_Bool SAL_CALL
ThumbnailViewItemAcc::containsPoint( const awt::Point
& aPoint
)
778 const awt::Rectangle
aRect( getBounds() );
779 const Point
aSize( aRect
.Width
, aRect
.Height
);
780 const Point aNullPoint
, aTestPoint( aPoint
.X
, aPoint
.Y
);
782 return tools::Rectangle( aNullPoint
, aSize
).IsInside( aTestPoint
);
785 uno::Reference
< accessibility::XAccessible
> SAL_CALL
ThumbnailViewItemAcc::getAccessibleAtPoint( const awt::Point
& )
787 uno::Reference
< accessibility::XAccessible
> xRet
;
791 awt::Rectangle SAL_CALL
ThumbnailViewItemAcc::getBounds()
793 const SolarMutexGuard aSolarGuard
;
798 tools::Rectangle
aRect( mpParent
->getDrawArea() );
799 tools::Rectangle aParentRect
;
801 // get position of the accessible parent in screen coordinates
802 uno::Reference
< XAccessible
> xParent
= getAccessibleParent();
805 uno::Reference
<XAccessibleComponent
> xParentComponent(xParent
->getAccessibleContext(), uno::UNO_QUERY
);
806 if (xParentComponent
.is())
808 awt::Size aParentSize
= xParentComponent
->getSize();
809 aParentRect
= tools::Rectangle(0, 0, aParentSize
.Width
, aParentSize
.Height
);
813 aRect
.Intersection( aParentRect
);
815 aRet
.X
= aRect
.Left();
816 aRet
.Y
= aRect
.Top();
817 aRet
.Width
= aRect
.GetWidth();
818 aRet
.Height
= aRect
.GetHeight();
824 awt::Point SAL_CALL
ThumbnailViewItemAcc::getLocation()
826 const awt::Rectangle
aRect( getBounds() );
835 awt::Point SAL_CALL
ThumbnailViewItemAcc::getLocationOnScreen()
837 const SolarMutexGuard aSolarGuard
;
842 const Point aPos
= mpParent
->getDrawArea().TopLeft();
847 // get position of the accessible parent in screen coordinates
848 uno::Reference
< XAccessible
> xParent
= getAccessibleParent();
851 uno::Reference
<XAccessibleComponent
> xParentComponent(xParent
->getAccessibleContext(), uno::UNO_QUERY
);
852 if (xParentComponent
.is())
854 awt::Point aParentScreenLoc
= xParentComponent
->getLocationOnScreen();
855 aRet
.X
+= aParentScreenLoc
.X
;
856 aRet
.Y
+= aParentScreenLoc
.Y
;
864 awt::Size SAL_CALL
ThumbnailViewItemAcc::getSize()
866 const awt::Rectangle
aRect( getBounds() );
869 aRet
.Width
= aRect
.Width
;
870 aRet
.Height
= aRect
.Height
;
875 void SAL_CALL
ThumbnailViewItemAcc::grabFocus()
880 sal_Int32 SAL_CALL
ThumbnailViewItemAcc::getForeground( )
882 Color nColor
= Application::GetSettings().GetStyleSettings().GetWindowTextColor();
883 return static_cast<sal_Int32
>(nColor
);
886 sal_Int32 SAL_CALL
ThumbnailViewItemAcc::getBackground( )
888 return static_cast<sal_Int32
>(Application::GetSettings().GetStyleSettings().GetWindowColor());
891 sal_Int64 SAL_CALL
ThumbnailViewItemAcc::getSomething( const uno::Sequence
< sal_Int8
>& rId
)
895 if( isUnoTunnelId
<ThumbnailViewItemAcc
>(rId
) )
896 nRet
= reinterpret_cast< sal_Int64
>( this );
903 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */