LCOV - code coverage report
Current view: top level - libreoffice/svtools/source/control - valueacc.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 500 0.0 %
Date: 2012-12-17 Functions: 0 78 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #define _SV_VALUESET_CXX
      22             : 
      23             : #include <unotools/accessiblestatesethelper.hxx>
      24             : #include <vcl/svapp.hxx>
      25             : #include <svtools/valueset.hxx>
      26             : #include "valueimp.hxx"
      27             : #include <comphelper/servicehelper.hxx>
      28             : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
      29             : #include <com/sun/star/accessibility/AccessibleRole.hpp>
      30             : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
      31             : 
      32             : using namespace ::com::sun::star;
      33             : 
      34             : // ----------------
      35             : // - ValueSetItem -
      36             : // ----------------
      37             : 
      38           0 : ValueSetItem::ValueSetItem( ValueSet& rParent )
      39             :     : mrParent(rParent)
      40             :     , mnId(0)
      41             :     , meType(VALUESETITEM_NONE)
      42             :     , mbVisible(true)
      43             :     , mpData(NULL)
      44           0 :     , mpxAcc(NULL)
      45             : {
      46           0 : }
      47             : 
      48             : // -----------------------------------------------------------------------
      49             : 
      50           0 : ValueSetItem::~ValueSetItem()
      51             : {
      52           0 :     if( mpxAcc )
      53             :     {
      54           0 :         static_cast< ValueItemAcc* >( mpxAcc->get() )->ParentDestroyed();
      55           0 :         delete mpxAcc;
      56             :     }
      57           0 : }
      58             : 
      59             : // -----------------------------------------------------------------------
      60             : 
      61           0 : uno::Reference< accessibility::XAccessible > ValueSetItem::GetAccessible( bool bIsTransientChildrenDisabled )
      62             : {
      63           0 :     if( !mpxAcc )
      64           0 :         mpxAcc = new uno::Reference< accessibility::XAccessible >( new ValueItemAcc( this, bIsTransientChildrenDisabled ) );
      65             : 
      66           0 :     return *mpxAcc;
      67             : }
      68             : 
      69             : // ---------------
      70             : // - ValueSetAcc -
      71             : // ---------------
      72             : 
      73           0 : ValueSetAcc::ValueSetAcc( ValueSet* pParent, bool bIsTransientChildrenDisabled ) :
      74             :     ValueSetAccComponentBase (m_aMutex),
      75             :     mpParent( pParent ),
      76             :     mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled ),
      77           0 :     mbIsFocused(false)
      78             : {
      79           0 : }
      80             : 
      81             : // -----------------------------------------------------------------------------
      82             : 
      83           0 : ValueSetAcc::~ValueSetAcc()
      84             : {
      85           0 : }
      86             : 
      87             : // -----------------------------------------------------------------------
      88             : 
      89           0 : void ValueSetAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue )
      90             : {
      91           0 :     if( nEventId )
      92             :     {
      93           0 :         ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >                  aTmpListeners( mxEventListeners );
      94           0 :         ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator  aIter( aTmpListeners.begin() );
      95           0 :         accessibility::AccessibleEventObject                                                        aEvtObject;
      96             : 
      97           0 :         aEvtObject.EventId = nEventId;
      98           0 :         aEvtObject.Source = static_cast<uno::XWeak*>(this);
      99           0 :         aEvtObject.NewValue = rNewValue;
     100           0 :         aEvtObject.OldValue = rOldValue;
     101             : 
     102           0 :         while( aIter != aTmpListeners.end() )
     103             :         {
     104             :             try
     105             :             {
     106           0 :                 (*aIter)->notifyEvent( aEvtObject );
     107             :             }
     108           0 :             catch(const uno::Exception&)
     109             :             {
     110             :             }
     111             : 
     112           0 :             aIter++;
     113           0 :         }
     114             :     }
     115           0 : }
     116             : 
     117             : namespace
     118             : {
     119             :     class theValueSetAccUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theValueSetAccUnoTunnelId > {};
     120             : }
     121             : 
     122           0 : const uno::Sequence< sal_Int8 >& ValueSetAcc::getUnoTunnelId()
     123             : {
     124           0 :     return theValueSetAccUnoTunnelId::get().getSeq();
     125             : }
     126             : 
     127             : // -----------------------------------------------------------------------------
     128             : 
     129           0 : ValueSetAcc* ValueSetAcc::getImplementation( const uno::Reference< uno::XInterface >& rxData )
     130             :     throw()
     131             : {
     132             :     try
     133             :     {
     134           0 :         uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY );
     135           0 :         return( xUnoTunnel.is() ? reinterpret_cast<ValueSetAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( ValueSetAcc::getUnoTunnelId() ))) : NULL );
     136             :     }
     137           0 :     catch(const ::com::sun::star::uno::Exception&)
     138             :     {
     139           0 :         return NULL;
     140             :     }
     141             : }
     142             : 
     143             : 
     144             : // -----------------------------------------------------------------------------
     145             : 
     146           0 : void ValueSetAcc::GetFocus (void)
     147             : {
     148           0 :     mbIsFocused = true;
     149             : 
     150             :     // Boradcast the state change.
     151           0 :     ::com::sun::star::uno::Any aOldState, aNewState;
     152           0 :     aNewState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED;
     153             :     FireAccessibleEvent(
     154             :         ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED,
     155           0 :         aOldState, aNewState);
     156           0 : }
     157             : 
     158             : // -----------------------------------------------------------------------------
     159             : 
     160           0 : void ValueSetAcc::LoseFocus (void)
     161             : {
     162           0 :     mbIsFocused = false;
     163             : 
     164             :     // Boradcast the state change.
     165           0 :     ::com::sun::star::uno::Any aOldState, aNewState;
     166           0 :     aOldState <<= ::com::sun::star::accessibility::AccessibleStateType::FOCUSED;
     167             :     FireAccessibleEvent(
     168             :         ::com::sun::star::accessibility::AccessibleEventId::STATE_CHANGED,
     169           0 :         aOldState, aNewState);
     170           0 : }
     171             : 
     172             : // -----------------------------------------------------------------------------
     173             : 
     174           0 : uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueSetAcc::getAccessibleContext()
     175             :     throw (uno::RuntimeException)
     176             : {
     177           0 :     ThrowIfDisposed();
     178           0 :     return this;
     179             : }
     180             : 
     181             : // -----------------------------------------------------------------------------
     182             : 
     183           0 : sal_Int32 SAL_CALL ValueSetAcc::getAccessibleChildCount()
     184             :     throw (uno::RuntimeException)
     185             : {
     186           0 :     const SolarMutexGuard aSolarGuard;
     187           0 :     ThrowIfDisposed();
     188             : 
     189           0 :     sal_Int32 nCount = mpParent->ImplGetVisibleItemCount();
     190           0 :     if (HasNoneField())
     191           0 :         nCount += 1;
     192           0 :     return nCount;
     193             : }
     194             : 
     195             : // -----------------------------------------------------------------------------
     196             : 
     197           0 : uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleChild( sal_Int32 i )
     198             :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     199             : {
     200           0 :     ThrowIfDisposed();
     201           0 :     const SolarMutexGuard aSolarGuard;
     202           0 :     uno::Reference< accessibility::XAccessible >    xRet;
     203           0 :     ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(i));
     204             : 
     205           0 :     if( pItem )
     206           0 :         xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled );
     207             :     else
     208           0 :         throw lang::IndexOutOfBoundsException();
     209             : 
     210           0 :     return xRet;
     211             : }
     212             : 
     213             : // -----------------------------------------------------------------------------
     214             : 
     215           0 : uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleParent()
     216             :     throw (uno::RuntimeException)
     217             : {
     218           0 :     ThrowIfDisposed();
     219           0 :     const SolarMutexGuard aSolarGuard;
     220           0 :     Window*                                         pParent = mpParent->GetParent();
     221           0 :     uno::Reference< accessibility::XAccessible >    xRet;
     222             : 
     223           0 :     if( pParent )
     224           0 :         xRet = pParent->GetAccessible();
     225             : 
     226           0 :     return xRet;
     227             : }
     228             : 
     229             : // -----------------------------------------------------------------------------
     230             : 
     231           0 : sal_Int32 SAL_CALL ValueSetAcc::getAccessibleIndexInParent()
     232             :     throw (uno::RuntimeException)
     233             : {
     234           0 :     ThrowIfDisposed();
     235           0 :     const SolarMutexGuard aSolarGuard;
     236           0 :     Window*                 pParent = mpParent->GetParent();
     237           0 :     sal_Int32               nRet = 0;
     238             : 
     239           0 :     if( pParent )
     240             :     {
     241           0 :         sal_Bool bFound = sal_False;
     242             : 
     243           0 :         for( sal_uInt16 i = 0, nCount = pParent->GetChildCount(); ( i < nCount ) && !bFound; i++ )
     244             :         {
     245           0 :             if( pParent->GetChild( i ) == mpParent )
     246             :             {
     247           0 :                 nRet = i;
     248           0 :                 bFound = sal_True;
     249             :             }
     250             :         }
     251             :     }
     252             : 
     253           0 :     return nRet;
     254             : }
     255             : 
     256             : // -----------------------------------------------------------------------------
     257             : 
     258           0 : sal_Int16 SAL_CALL ValueSetAcc::getAccessibleRole()
     259             :     throw (uno::RuntimeException)
     260             : {
     261           0 :     ThrowIfDisposed();
     262             :     // #i73746# As the Java Access Bridge (v 2.0.1) uses "managesDescendants"
     263             :     // always if the role is LIST, we need a different role in this case
     264             :     return (mbIsTransientChildrenDisabled
     265             :             ? accessibility::AccessibleRole::PANEL
     266           0 :             : accessibility::AccessibleRole::LIST );
     267             : }
     268             : 
     269             : // -----------------------------------------------------------------------------
     270             : 
     271           0 : ::rtl::OUString SAL_CALL ValueSetAcc::getAccessibleDescription()
     272             :     throw (uno::RuntimeException)
     273             : {
     274           0 :     ThrowIfDisposed();
     275           0 :     const SolarMutexGuard aSolarGuard;
     276           0 :     String              aRet( RTL_CONSTASCII_USTRINGPARAM( "ValueSet" ) );
     277             : 
     278           0 :     return aRet;
     279             : }
     280             : 
     281             : // -----------------------------------------------------------------------------
     282             : 
     283           0 : ::rtl::OUString SAL_CALL ValueSetAcc::getAccessibleName()
     284             :     throw (uno::RuntimeException)
     285             : {
     286           0 :     ThrowIfDisposed();
     287           0 :     const SolarMutexGuard aSolarGuard;
     288           0 :     String              aRet;
     289             : 
     290           0 :     if ( mpParent )
     291           0 :         aRet = mpParent->GetAccessibleName();
     292             : 
     293           0 :     if ( !aRet.Len() )
     294             :     {
     295           0 :         Window* pLabel = mpParent->GetAccessibleRelationLabeledBy();
     296           0 :         if ( pLabel && pLabel != mpParent )
     297           0 :             aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() );
     298             :     }
     299             : 
     300           0 :     return aRet;
     301             : }
     302             : 
     303             : // -----------------------------------------------------------------------------
     304             : 
     305           0 : uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueSetAcc::getAccessibleRelationSet()
     306             :     throw (uno::RuntimeException)
     307             : {
     308           0 :     ThrowIfDisposed();
     309           0 :     return uno::Reference< accessibility::XAccessibleRelationSet >();
     310             : }
     311             : 
     312             : // -----------------------------------------------------------------------------
     313             : 
     314           0 : uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueSetAcc::getAccessibleStateSet()
     315             :     throw (uno::RuntimeException)
     316             : {
     317           0 :     ThrowIfDisposed();
     318           0 :     ::utl::AccessibleStateSetHelper* pStateSet = new ::utl::AccessibleStateSetHelper();
     319             : 
     320             :     // Set some states.
     321           0 :     pStateSet->AddState (accessibility::AccessibleStateType::ENABLED);
     322           0 :     pStateSet->AddState (accessibility::AccessibleStateType::SENSITIVE);
     323           0 :     pStateSet->AddState (accessibility::AccessibleStateType::SHOWING);
     324           0 :     pStateSet->AddState (accessibility::AccessibleStateType::VISIBLE);
     325           0 :     if ( !mbIsTransientChildrenDisabled )
     326           0 :         pStateSet->AddState (accessibility::AccessibleStateType::MANAGES_DESCENDANTS);
     327           0 :     pStateSet->AddState (accessibility::AccessibleStateType::FOCUSABLE);
     328           0 :     if (mbIsFocused)
     329           0 :         pStateSet->AddState (accessibility::AccessibleStateType::FOCUSED);
     330             : 
     331           0 :     return pStateSet;
     332             : }
     333             : 
     334             : // -----------------------------------------------------------------------------
     335             : 
     336           0 : lang::Locale SAL_CALL ValueSetAcc::getLocale()
     337             :     throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException)
     338             : {
     339           0 :     ThrowIfDisposed();
     340           0 :     const SolarMutexGuard aSolarGuard;
     341           0 :     const ::rtl::OUString                           aEmptyStr;
     342           0 :     uno::Reference< accessibility::XAccessible >    xParent( getAccessibleParent() );
     343           0 :     lang::Locale                                    aRet( aEmptyStr, aEmptyStr, aEmptyStr );
     344             : 
     345           0 :     if( xParent.is() )
     346             :     {
     347           0 :         uno::Reference< accessibility::XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
     348             : 
     349           0 :         if( xParentContext.is() )
     350           0 :             aRet = xParentContext->getLocale ();
     351             :     }
     352             : 
     353           0 :     return aRet;
     354             : }
     355             : 
     356             : // -----------------------------------------------------------------------------
     357             : 
     358           0 : void SAL_CALL ValueSetAcc::addAccessibleEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
     359             :     throw (uno::RuntimeException)
     360             : {
     361           0 :     ThrowIfDisposed();
     362           0 :     ::osl::MutexGuard aGuard (m_aMutex);
     363             : 
     364           0 :     if( rxListener.is() )
     365             :     {
     366           0 :            ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter = mxEventListeners.begin();
     367           0 :         sal_Bool bFound = sal_False;
     368             : 
     369           0 :         while( !bFound && ( aIter != mxEventListeners.end() ) )
     370             :         {
     371           0 :             if( *aIter == rxListener )
     372           0 :                 bFound = sal_True;
     373             :             else
     374           0 :                 ++aIter;
     375             :         }
     376             : 
     377           0 :         if (!bFound)
     378           0 :             mxEventListeners.push_back( rxListener );
     379           0 :     }
     380           0 : }
     381             : 
     382             : // -----------------------------------------------------------------------------
     383             : 
     384           0 : void SAL_CALL ValueSetAcc::removeAccessibleEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
     385             :     throw (uno::RuntimeException)
     386             : {
     387           0 :     ThrowIfDisposed();
     388           0 :     ::osl::MutexGuard aGuard (m_aMutex);
     389             : 
     390           0 :     if( rxListener.is() )
     391             :     {
     392           0 :            ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::iterator aIter = mxEventListeners.begin();
     393           0 :         sal_Bool bFound = sal_False;
     394             : 
     395           0 :         while( !bFound && ( aIter != mxEventListeners.end() ) )
     396             :         {
     397           0 :             if( *aIter == rxListener )
     398             :             {
     399           0 :                 mxEventListeners.erase( aIter );
     400           0 :                 bFound = sal_True;
     401             :             }
     402             :             else
     403           0 :                 ++aIter;
     404             :         }
     405           0 :     }
     406           0 : }
     407             : 
     408             : // -----------------------------------------------------------------------------
     409             : 
     410           0 : sal_Bool SAL_CALL ValueSetAcc::containsPoint( const awt::Point& aPoint )
     411             :     throw (uno::RuntimeException)
     412             : {
     413           0 :     ThrowIfDisposed();
     414           0 :     const awt::Rectangle    aRect( getBounds() );
     415           0 :     const Point             aSize( aRect.Width, aRect.Height );
     416           0 :     const Point             aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
     417             : 
     418           0 :     return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint );
     419             : }
     420             : 
     421             : // -----------------------------------------------------------------------------
     422             : 
     423           0 : uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getAccessibleAtPoint( const awt::Point& aPoint )
     424             :     throw (uno::RuntimeException)
     425             : {
     426           0 :     ThrowIfDisposed();
     427           0 :     const SolarMutexGuard aSolarGuard;
     428           0 :     const sal_uInt16                                    nItemId = mpParent->GetItemId( Point( aPoint.X, aPoint.Y ) );
     429           0 :     uno::Reference< accessibility::XAccessible >    xRet;
     430             : 
     431           0 :     if ( nItemId )
     432             :     {
     433           0 :         const size_t nItemPos = mpParent->GetItemPos( nItemId );
     434             : 
     435           0 :         if( VALUESET_ITEM_NONEITEM != nItemPos )
     436             :         {
     437           0 :             ValueSetItem *const pItem = mpParent->mItemList[nItemPos];
     438           0 :             xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled );
     439             :         }
     440             :     }
     441             : 
     442           0 :     return xRet;
     443             : }
     444             : 
     445             : // -----------------------------------------------------------------------------
     446             : 
     447           0 : awt::Rectangle SAL_CALL ValueSetAcc::getBounds()
     448             :     throw (uno::RuntimeException)
     449             : {
     450           0 :     ThrowIfDisposed();
     451           0 :     const SolarMutexGuard aSolarGuard;
     452           0 :     const Point         aOutPos( mpParent->GetPosPixel() );
     453           0 :     const Size          aOutSize( mpParent->GetOutputSizePixel() );
     454           0 :     awt::Rectangle      aRet;
     455             : 
     456           0 :     aRet.X = aOutPos.X();
     457           0 :     aRet.Y = aOutPos.Y();
     458           0 :     aRet.Width = aOutSize.Width();
     459           0 :     aRet.Height = aOutSize.Height();
     460             : 
     461           0 :     return aRet;
     462             : }
     463             : 
     464             : // -----------------------------------------------------------------------------
     465             : 
     466           0 : awt::Point SAL_CALL ValueSetAcc::getLocation()
     467             :     throw (uno::RuntimeException)
     468             : {
     469           0 :     ThrowIfDisposed();
     470           0 :     const awt::Rectangle    aRect( getBounds() );
     471           0 :     awt::Point              aRet;
     472             : 
     473           0 :     aRet.X = aRect.X;
     474           0 :     aRet.Y = aRect.Y;
     475             : 
     476           0 :     return aRet;
     477             : }
     478             : 
     479             : // -----------------------------------------------------------------------------
     480             : 
     481           0 : awt::Point SAL_CALL ValueSetAcc::getLocationOnScreen()
     482             :     throw (uno::RuntimeException)
     483             : {
     484           0 :     ThrowIfDisposed();
     485           0 :     const SolarMutexGuard aSolarGuard;
     486           0 :     const Point         aScreenPos( mpParent->OutputToAbsoluteScreenPixel( Point() ) );
     487           0 :     awt::Point          aRet;
     488             : 
     489           0 :     aRet.X = aScreenPos.X();
     490           0 :     aRet.Y = aScreenPos.Y();
     491             : 
     492           0 :     return aRet;
     493             : }
     494             : 
     495             : // -----------------------------------------------------------------------------
     496             : 
     497           0 : awt::Size SAL_CALL ValueSetAcc::getSize()
     498             :     throw (uno::RuntimeException)
     499             : {
     500           0 :     ThrowIfDisposed();
     501           0 :     const awt::Rectangle    aRect( getBounds() );
     502           0 :     awt::Size               aRet;
     503             : 
     504           0 :     aRet.Width = aRect.Width;
     505           0 :     aRet.Height = aRect.Height;
     506             : 
     507           0 :     return aRet;
     508             : }
     509             : 
     510             : // -----------------------------------------------------------------------------
     511             : 
     512           0 : void SAL_CALL ValueSetAcc::grabFocus()
     513             :     throw (uno::RuntimeException)
     514             : {
     515           0 :     ThrowIfDisposed();
     516           0 :     const SolarMutexGuard aSolarGuard;
     517           0 :     mpParent->GrabFocus();
     518           0 : }
     519             : 
     520             : // -----------------------------------------------------------------------------
     521             : 
     522           0 : uno::Any SAL_CALL ValueSetAcc::getAccessibleKeyBinding()
     523             :     throw (uno::RuntimeException)
     524             : {
     525           0 :     ThrowIfDisposed();
     526           0 :     return uno::Any();
     527             : }
     528             : 
     529             : // -----------------------------------------------------------------------------
     530             : 
     531           0 : sal_Int32 SAL_CALL ValueSetAcc::getForeground(  )
     532             :     throw (uno::RuntimeException)
     533             : {
     534           0 :     ThrowIfDisposed();
     535           0 :     sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor().GetColor();
     536           0 :     return static_cast<sal_Int32>(nColor);
     537             : }
     538             : 
     539             : // -----------------------------------------------------------------------------
     540             : 
     541           0 : sal_Int32 SAL_CALL ValueSetAcc::getBackground(  )
     542             :     throw (uno::RuntimeException)
     543             : {
     544           0 :     ThrowIfDisposed();
     545           0 :     sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
     546           0 :     return static_cast<sal_Int32>(nColor);
     547             : }
     548             : 
     549             : // -----------------------------------------------------------------------------
     550             : 
     551           0 : void SAL_CALL ValueSetAcc::selectAccessibleChild( sal_Int32 nChildIndex )
     552             :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     553             : {
     554           0 :     ThrowIfDisposed();
     555           0 :     const SolarMutexGuard aSolarGuard;
     556           0 :     ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex));
     557             : 
     558           0 :     if(pItem != NULL)
     559             :     {
     560           0 :         mpParent->SelectItem( pItem->mnId );
     561           0 :         mpParent->Select ();
     562             :     }
     563             :     else
     564           0 :         throw lang::IndexOutOfBoundsException();
     565           0 : }
     566             : 
     567             : // -----------------------------------------------------------------------------
     568             : 
     569           0 : sal_Bool SAL_CALL ValueSetAcc::isAccessibleChildSelected( sal_Int32 nChildIndex )
     570             :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     571             : {
     572           0 :     ThrowIfDisposed();
     573           0 :     const SolarMutexGuard aSolarGuard;
     574           0 :     ValueSetItem* pItem = getItem (sal::static_int_cast< sal_uInt16 >(nChildIndex));
     575           0 :     sal_Bool            bRet = sal_False;
     576             : 
     577           0 :     if (pItem != NULL)
     578           0 :         bRet = mpParent->IsItemSelected( pItem->mnId );
     579             :     else
     580           0 :         throw lang::IndexOutOfBoundsException();
     581             : 
     582           0 :     return bRet;
     583             : }
     584             : 
     585             : // -----------------------------------------------------------------------------
     586             : 
     587           0 : void SAL_CALL ValueSetAcc::clearAccessibleSelection()
     588             :     throw (uno::RuntimeException)
     589             : {
     590           0 :     ThrowIfDisposed();
     591           0 :     const SolarMutexGuard aSolarGuard;
     592           0 :     mpParent->SetNoSelection();
     593           0 : }
     594             : 
     595             : // -----------------------------------------------------------------------------
     596             : 
     597           0 : void SAL_CALL ValueSetAcc::selectAllAccessibleChildren()
     598             :     throw (uno::RuntimeException)
     599             : {
     600           0 :     ThrowIfDisposed();
     601             :     // unsupported due to single selection only
     602           0 : }
     603             : 
     604             : // -----------------------------------------------------------------------------
     605             : 
     606           0 : sal_Int32 SAL_CALL ValueSetAcc::getSelectedAccessibleChildCount()
     607             :     throw (uno::RuntimeException)
     608             : {
     609           0 :     ThrowIfDisposed();
     610           0 :     const SolarMutexGuard aSolarGuard;
     611           0 :     sal_Int32           nRet = 0;
     612             : 
     613           0 :     for( sal_uInt16 i = 0, nCount = getItemCount(); i < nCount; i++ )
     614             :     {
     615           0 :         ValueSetItem* pItem = getItem (i);
     616             : 
     617           0 :         if( pItem && mpParent->IsItemSelected( pItem->mnId ) )
     618           0 :             ++nRet;
     619             :     }
     620             : 
     621           0 :     return nRet;
     622             : }
     623             : 
     624             : // -----------------------------------------------------------------------------
     625             : 
     626           0 : uno::Reference< accessibility::XAccessible > SAL_CALL ValueSetAcc::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
     627             :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     628             : {
     629           0 :     ThrowIfDisposed();
     630           0 :     const SolarMutexGuard aSolarGuard;
     631           0 :     uno::Reference< accessibility::XAccessible >    xRet;
     632             : 
     633           0 :     for( sal_uInt16 i = 0, nCount = getItemCount(), nSel = 0; ( i < nCount ) && !xRet.is(); i++ )
     634             :     {
     635           0 :         ValueSetItem* pItem = getItem(i);
     636             : 
     637           0 :         if( pItem && mpParent->IsItemSelected( pItem->mnId ) && ( nSelectedChildIndex == static_cast< sal_Int32 >( nSel++ ) ) )
     638           0 :             xRet = pItem->GetAccessible( mbIsTransientChildrenDisabled );
     639             :     }
     640             : 
     641           0 :     return xRet;
     642             : }
     643             : 
     644             : // -----------------------------------------------------------------------------
     645             : 
     646           0 : void SAL_CALL ValueSetAcc::deselectAccessibleChild( sal_Int32 nChildIndex )
     647             :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     648             : {
     649           0 :     ThrowIfDisposed();
     650           0 :     const SolarMutexGuard aSolarGuard;
     651             :     // Because of the single selection we can reset the whole selection when
     652             :     // the specified child is currently selected.
     653           0 :     if (isAccessibleChildSelected(nChildIndex))
     654           0 :         mpParent->SetNoSelection();
     655           0 : }
     656             : 
     657             : // -----------------------------------------------------------------------------
     658             : 
     659           0 : sal_Int64 SAL_CALL ValueSetAcc::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw( uno::RuntimeException )
     660             : {
     661             :     sal_Int64 nRet;
     662             : 
     663           0 :     if( ( rId.getLength() == 16 ) && ( 0 == memcmp( ValueSetAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
     664           0 :         nRet = reinterpret_cast< sal_Int64 >( this );
     665             :     else
     666           0 :         nRet = 0;
     667             : 
     668           0 :     return nRet;
     669             : }
     670             : 
     671             : 
     672             : 
     673             : 
     674           0 : void SAL_CALL ValueSetAcc::disposing (void)
     675             : {
     676           0 :     ::std::vector<uno::Reference<accessibility::XAccessibleEventListener> > aListenerListCopy;
     677             : 
     678             :     {
     679             :         // Make a copy of the list and clear the original.
     680           0 :         const SolarMutexGuard aSolarGuard;
     681           0 :         ::osl::MutexGuard aGuard (m_aMutex);
     682           0 :         aListenerListCopy = mxEventListeners;
     683           0 :         mxEventListeners.clear();
     684             : 
     685             :         // Reset the pointer to the parent.  It has to be the one who has
     686             :         // disposed us because he is dying.
     687           0 :         mpParent = NULL;
     688             :     }
     689             : 
     690             :     // Inform all listeners that this objects is disposing.
     691             :     ::std::vector<uno::Reference<accessibility::XAccessibleEventListener> >::const_iterator
     692           0 :           aListenerIterator (aListenerListCopy.begin());
     693           0 :     lang::EventObject aEvent (static_cast<accessibility::XAccessible*>(this));
     694           0 :     while (aListenerIterator != aListenerListCopy.end())
     695             :     {
     696             :         try
     697             :         {
     698           0 :             (*aListenerIterator)->disposing (aEvent);
     699             :         }
     700           0 :         catch(const uno::Exception&)
     701             :         {
     702             :             // Ignore exceptions.
     703             :         }
     704             : 
     705           0 :         ++aListenerIterator;
     706           0 :     }
     707           0 : }
     708             : 
     709             : 
     710           0 : sal_uInt16 ValueSetAcc::getItemCount (void) const
     711             : {
     712           0 :     sal_uInt16 nCount = mpParent->ImplGetVisibleItemCount();
     713             :     // When the None-Item is visible then increase the number of items by
     714             :     // one.
     715           0 :     if (HasNoneField())
     716           0 :         nCount += 1;
     717           0 :     return nCount;
     718             : }
     719             : 
     720             : 
     721           0 : ValueSetItem* ValueSetAcc::getItem (sal_uInt16 nIndex) const
     722             : {
     723           0 :     ValueSetItem* pItem = NULL;
     724             : 
     725           0 :     if (HasNoneField())
     726             :     {
     727           0 :         if (nIndex == 0)
     728             :             // When present the first item is the then allways visible none field.
     729           0 :             pItem = mpParent->ImplGetItem (VALUESET_ITEM_NONEITEM);
     730             :         else
     731             :             // Shift down the index to compensate for the none field.
     732           0 :             nIndex -= 1;
     733             :     }
     734           0 :     if (pItem == NULL)
     735           0 :         pItem = mpParent->ImplGetVisibleItem (static_cast<sal_uInt16>(nIndex));
     736             : 
     737           0 :     return pItem;
     738             : }
     739             : 
     740             : 
     741             : 
     742             : 
     743           0 : void ValueSetAcc::ThrowIfDisposed (void)
     744             :     throw (::com::sun::star::lang::DisposedException)
     745             : {
     746           0 :     if (rBHelper.bDisposed || rBHelper.bInDispose)
     747             :     {
     748             :         OSL_TRACE ("Calling disposed object. Throwing exception:");
     749             :         throw lang::DisposedException (
     750             :             ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("object has been already disposed")),
     751           0 :             static_cast<uno::XWeak*>(this));
     752             :     }
     753             :     else
     754             :     {
     755             :         DBG_ASSERT (mpParent!=NULL, "ValueSetAcc not disposed but mpParent == NULL");
     756             :     }
     757           0 : }
     758             : 
     759             : 
     760             : 
     761           0 : bool ValueSetAcc::HasNoneField (void) const
     762             : {
     763             :     DBG_ASSERT (mpParent!=NULL, "ValueSetAcc::HasNoneField called with mpParent==NULL");
     764           0 :     return ((mpParent->GetStyle() & WB_NONEFIELD) != 0);
     765             : }
     766             : 
     767             : 
     768             : 
     769             : 
     770             : // ----------------
     771             : // - ValueItemAcc -
     772             : // ----------------
     773             : 
     774           0 : ValueItemAcc::ValueItemAcc( ValueSetItem* pParent, bool bIsTransientChildrenDisabled ) :
     775             :     mpParent( pParent ),
     776           0 :     mbIsTransientChildrenDisabled( bIsTransientChildrenDisabled )
     777             : {
     778           0 : }
     779             : 
     780             : // -----------------------------------------------------------------------------
     781             : 
     782           0 : ValueItemAcc::~ValueItemAcc()
     783             : {
     784           0 : }
     785             : 
     786             : // -----------------------------------------------------------------------
     787             : 
     788           0 : void ValueItemAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOldValue, const uno::Any& rNewValue )
     789             : {
     790           0 :     if( nEventId )
     791             :     {
     792           0 :         ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >                  aTmpListeners( mxEventListeners );
     793           0 :         ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator  aIter( aTmpListeners.begin() );
     794           0 :         accessibility::AccessibleEventObject                                                        aEvtObject;
     795             : 
     796           0 :         aEvtObject.EventId = nEventId;
     797           0 :         aEvtObject.Source = static_cast<uno::XWeak*>(this);
     798           0 :         aEvtObject.NewValue = rNewValue;
     799           0 :         aEvtObject.OldValue = rOldValue;
     800             : 
     801           0 :         while( aIter != aTmpListeners.end() )
     802             :         {
     803           0 :             (*aIter)->notifyEvent( aEvtObject );
     804           0 :             aIter++;
     805           0 :         }
     806             :     }
     807           0 : }
     808             : 
     809             : // -----------------------------------------------------------------------------
     810             : 
     811           0 : void ValueItemAcc::ParentDestroyed()
     812             : {
     813           0 :     const ::osl::MutexGuard aGuard( maMutex );
     814           0 :     mpParent = NULL;
     815           0 : }
     816             : 
     817             : namespace
     818             : {
     819             :     class theValueItemAccUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theValueItemAccUnoTunnelId > {};
     820             : }
     821             : 
     822           0 : const uno::Sequence< sal_Int8 >& ValueItemAcc::getUnoTunnelId()
     823             : {
     824           0 :     return theValueItemAccUnoTunnelId::get().getSeq();
     825             : }
     826             : 
     827             : // -----------------------------------------------------------------------------
     828             : 
     829           0 : ValueItemAcc* ValueItemAcc::getImplementation( const uno::Reference< uno::XInterface >& rxData )
     830             :     throw()
     831             : {
     832             :     try
     833             :     {
     834           0 :         uno::Reference< lang::XUnoTunnel > xUnoTunnel( rxData, uno::UNO_QUERY );
     835           0 :         return( xUnoTunnel.is() ? reinterpret_cast<ValueItemAcc*>(sal::static_int_cast<sal_IntPtr>(xUnoTunnel->getSomething( ValueItemAcc::getUnoTunnelId() ))) : NULL );
     836             :     }
     837           0 :     catch(const ::com::sun::star::uno::Exception&)
     838             :     {
     839           0 :         return NULL;
     840             :     }
     841             : }
     842             : 
     843             : // -----------------------------------------------------------------------------
     844             : 
     845           0 : uno::Reference< accessibility::XAccessibleContext > SAL_CALL ValueItemAcc::getAccessibleContext()
     846             :     throw (uno::RuntimeException)
     847             : {
     848           0 :     return this;
     849             : }
     850             : 
     851             : // -----------------------------------------------------------------------------
     852             : 
     853           0 : sal_Int32 SAL_CALL ValueItemAcc::getAccessibleChildCount()
     854             :     throw (uno::RuntimeException)
     855             : {
     856           0 :     return 0;
     857             : }
     858             : 
     859             : // -----------------------------------------------------------------------------
     860             : 
     861           0 : uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleChild( sal_Int32 )
     862             :     throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     863             : {
     864           0 :     throw lang::IndexOutOfBoundsException();
     865             : }
     866             : 
     867             : // -----------------------------------------------------------------------------
     868             : 
     869           0 : uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleParent()
     870             :     throw (uno::RuntimeException)
     871             : {
     872           0 :     const SolarMutexGuard aSolarGuard;
     873           0 :     uno::Reference< accessibility::XAccessible >    xRet;
     874             : 
     875           0 :     if( mpParent )
     876           0 :         xRet = mpParent->mrParent.GetAccessible();
     877             : 
     878           0 :     return xRet;
     879             : }
     880             : 
     881             : // -----------------------------------------------------------------------------
     882             : 
     883           0 : sal_Int32 SAL_CALL ValueItemAcc::getAccessibleIndexInParent()
     884             :     throw (uno::RuntimeException)
     885             : {
     886           0 :     const SolarMutexGuard aSolarGuard;
     887             :     // The index defaults to -1 to indicate the child does not belong to its
     888             :     // parent.
     889           0 :     sal_Int32 nIndexInParent = -1;
     890             : 
     891           0 :     if( mpParent )
     892             :     {
     893           0 :         bool bDone = false;
     894             : 
     895           0 :         sal_uInt16 nCount = mpParent->mrParent.ImplGetVisibleItemCount();
     896             :         ValueSetItem* pItem;
     897           0 :         for (sal_uInt16 i=0; i<nCount && !bDone; i++)
     898             :         {
     899             :             // Guard the retrieval of the i-th child with a try/catch block
     900             :             // just in case the number of children changes in the mean time.
     901             :             try
     902             :             {
     903           0 :                 pItem = mpParent->mrParent.ImplGetVisibleItem (i);
     904             :             }
     905           0 :             catch (const lang::IndexOutOfBoundsException&)
     906             :             {
     907           0 :                 pItem = NULL;
     908             :             }
     909             : 
     910             :             // Do not create an accessible object for the test.
     911           0 :             if (pItem != NULL && pItem->mpxAcc != NULL)
     912           0 :                 if (pItem->GetAccessible( mbIsTransientChildrenDisabled ).get() == this )
     913             :                 {
     914           0 :                     nIndexInParent = i;
     915           0 :                     bDone = true;
     916             :                 }
     917             :         }
     918             :     }
     919             : 
     920           0 :     return nIndexInParent;
     921             : }
     922             : 
     923             : // -----------------------------------------------------------------------------
     924             : 
     925           0 : sal_Int16 SAL_CALL ValueItemAcc::getAccessibleRole()
     926             :     throw (uno::RuntimeException)
     927             : {
     928           0 :     return accessibility::AccessibleRole::LIST_ITEM;
     929             : }
     930             : 
     931             : // -----------------------------------------------------------------------------
     932             : 
     933           0 : ::rtl::OUString SAL_CALL ValueItemAcc::getAccessibleDescription()
     934             :     throw (uno::RuntimeException)
     935             : {
     936           0 :     return ::rtl::OUString();
     937             : }
     938             : 
     939             : // -----------------------------------------------------------------------------
     940             : 
     941           0 : ::rtl::OUString SAL_CALL ValueItemAcc::getAccessibleName()
     942             :     throw (uno::RuntimeException)
     943             : {
     944           0 :     const SolarMutexGuard aSolarGuard;
     945           0 :     rtl::OUString aRet;
     946             : 
     947           0 :     if( mpParent )
     948             :     {
     949           0 :         aRet = mpParent->maText;
     950             : 
     951           0 :         if( aRet.isEmpty() )
     952             :         {
     953           0 :             rtl::OUStringBuffer aBuffer("Item ");
     954           0 :             aBuffer.append(static_cast<sal_Int32>(mpParent->mnId));
     955           0 :             aRet = aBuffer.makeStringAndClear();
     956             :         }
     957             :     }
     958             : 
     959           0 :     return aRet;
     960             : }
     961             : 
     962             : // -----------------------------------------------------------------------------
     963             : 
     964           0 : uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueItemAcc::getAccessibleRelationSet()
     965             :     throw (uno::RuntimeException)
     966             : {
     967           0 :     return uno::Reference< accessibility::XAccessibleRelationSet >();
     968             : }
     969             : 
     970             : // -----------------------------------------------------------------------------
     971             : 
     972           0 : uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueItemAcc::getAccessibleStateSet()
     973             :     throw (uno::RuntimeException)
     974             : {
     975           0 :     const SolarMutexGuard aSolarGuard;
     976           0 :     ::utl::AccessibleStateSetHelper*    pStateSet = new ::utl::AccessibleStateSetHelper;
     977             : 
     978           0 :     if( mpParent )
     979             :     {
     980           0 :         pStateSet->AddState (accessibility::AccessibleStateType::ENABLED);
     981           0 :         pStateSet->AddState (accessibility::AccessibleStateType::SENSITIVE);
     982           0 :         pStateSet->AddState (accessibility::AccessibleStateType::SHOWING);
     983           0 :         pStateSet->AddState (accessibility::AccessibleStateType::VISIBLE);
     984           0 :         if ( !mbIsTransientChildrenDisabled )
     985           0 :             pStateSet->AddState (accessibility::AccessibleStateType::TRANSIENT);
     986             : 
     987             :         // SELECTABLE
     988           0 :         pStateSet->AddState( accessibility::AccessibleStateType::SELECTABLE );
     989             :         //      pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE );
     990             : 
     991             :         // SELECTED
     992           0 :         if( mpParent->mrParent.GetSelectItemId() == mpParent->mnId )
     993             :         {
     994           0 :             pStateSet->AddState( accessibility::AccessibleStateType::SELECTED );
     995             :             //              pStateSet->AddState( accessibility::AccessibleStateType::FOCUSED );
     996             :         }
     997             :     }
     998             : 
     999           0 :     return pStateSet;
    1000             : }
    1001             : 
    1002             : // -----------------------------------------------------------------------------
    1003             : 
    1004           0 : lang::Locale SAL_CALL ValueItemAcc::getLocale()
    1005             :     throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException)
    1006             : {
    1007           0 :     const SolarMutexGuard aSolarGuard;
    1008           0 :     const ::rtl::OUString                           aEmptyStr;
    1009           0 :     uno::Reference< accessibility::XAccessible >    xParent( getAccessibleParent() );
    1010           0 :     lang::Locale                                    aRet( aEmptyStr, aEmptyStr, aEmptyStr );
    1011             : 
    1012           0 :     if( xParent.is() )
    1013             :     {
    1014           0 :         uno::Reference< accessibility::XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
    1015             : 
    1016           0 :         if( xParentContext.is() )
    1017           0 :             aRet = xParentContext->getLocale();
    1018             :     }
    1019             : 
    1020           0 :     return aRet;
    1021             : }
    1022             : 
    1023             : // -----------------------------------------------------------------------------
    1024             : 
    1025           0 : void SAL_CALL ValueItemAcc::addAccessibleEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
    1026             :     throw (uno::RuntimeException)
    1027             : {
    1028           0 :     const ::osl::MutexGuard aGuard( maMutex );
    1029             : 
    1030           0 :     if( rxListener.is() )
    1031             :     {
    1032           0 :            ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter = mxEventListeners.begin();
    1033           0 :         sal_Bool bFound = sal_False;
    1034             : 
    1035           0 :         while( !bFound && ( aIter != mxEventListeners.end() ) )
    1036             :         {
    1037           0 :             if( *aIter == rxListener )
    1038           0 :                 bFound = sal_True;
    1039             :             else
    1040           0 :                 ++aIter;
    1041             :         }
    1042             : 
    1043           0 :         if (!bFound)
    1044           0 :             mxEventListeners.push_back( rxListener );
    1045           0 :     }
    1046           0 : }
    1047             : 
    1048             : // -----------------------------------------------------------------------------
    1049             : 
    1050           0 : void SAL_CALL ValueItemAcc::removeAccessibleEventListener( const uno::Reference< accessibility::XAccessibleEventListener >& rxListener )
    1051             :     throw (uno::RuntimeException)
    1052             : {
    1053           0 :     const ::osl::MutexGuard aGuard( maMutex );
    1054             : 
    1055           0 :     if( rxListener.is() )
    1056             :     {
    1057           0 :            ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::iterator aIter = mxEventListeners.begin();
    1058           0 :         sal_Bool bFound = sal_False;
    1059             : 
    1060           0 :         while( !bFound && ( aIter != mxEventListeners.end() ) )
    1061             :         {
    1062           0 :             if( *aIter == rxListener )
    1063             :             {
    1064           0 :                 mxEventListeners.erase( aIter );
    1065           0 :                 bFound = sal_True;
    1066             :             }
    1067             :             else
    1068           0 :                 ++aIter;
    1069             :         }
    1070           0 :     }
    1071           0 : }
    1072             : 
    1073             : // -----------------------------------------------------------------------------
    1074             : 
    1075           0 : sal_Bool SAL_CALL ValueItemAcc::containsPoint( const awt::Point& aPoint )
    1076             :     throw (uno::RuntimeException)
    1077             : {
    1078           0 :     const awt::Rectangle    aRect( getBounds() );
    1079           0 :     const Point             aSize( aRect.Width, aRect.Height );
    1080           0 :     const Point             aNullPoint, aTestPoint( aPoint.X, aPoint.Y );
    1081             : 
    1082           0 :     return Rectangle( aNullPoint, aSize ).IsInside( aTestPoint );
    1083             : }
    1084             : 
    1085             : // -----------------------------------------------------------------------------
    1086             : 
    1087           0 : uno::Reference< accessibility::XAccessible > SAL_CALL ValueItemAcc::getAccessibleAtPoint( const awt::Point& )
    1088             :     throw (uno::RuntimeException)
    1089             : {
    1090           0 :     uno::Reference< accessibility::XAccessible > xRet;
    1091           0 :     return xRet;
    1092             : }
    1093             : 
    1094             : // -----------------------------------------------------------------------------
    1095             : 
    1096           0 : awt::Rectangle SAL_CALL ValueItemAcc::getBounds()
    1097             :     throw (uno::RuntimeException)
    1098             : {
    1099           0 :     const SolarMutexGuard aSolarGuard;
    1100           0 :     awt::Rectangle      aRet;
    1101             : 
    1102           0 :     if( mpParent )
    1103             :     {
    1104           0 :         Rectangle   aRect( mpParent->mrParent.GetItemRect(mpParent->mnId) );
    1105           0 :         Point       aOrigin;
    1106           0 :         Rectangle   aParentRect( aOrigin, mpParent->mrParent.GetOutputSizePixel() );
    1107             : 
    1108           0 :         aRect.Intersection( aParentRect );
    1109             : 
    1110           0 :         aRet.X = aRect.Left();
    1111           0 :         aRet.Y = aRect.Top();
    1112           0 :         aRet.Width = aRect.GetWidth();
    1113           0 :         aRet.Height = aRect.GetHeight();
    1114             :     }
    1115             : 
    1116           0 :     return aRet;
    1117             : }
    1118             : 
    1119             : // -----------------------------------------------------------------------------
    1120             : 
    1121           0 : awt::Point SAL_CALL ValueItemAcc::getLocation()
    1122             :     throw (uno::RuntimeException)
    1123             : {
    1124           0 :     const awt::Rectangle    aRect( getBounds() );
    1125           0 :     awt::Point              aRet;
    1126             : 
    1127           0 :     aRet.X = aRect.X;
    1128           0 :     aRet.Y = aRect.Y;
    1129             : 
    1130           0 :     return aRet;
    1131             : }
    1132             : 
    1133             : // -----------------------------------------------------------------------------
    1134             : 
    1135           0 : awt::Point SAL_CALL ValueItemAcc::getLocationOnScreen()
    1136             :     throw (uno::RuntimeException)
    1137             : {
    1138           0 :     const SolarMutexGuard aSolarGuard;
    1139           0 :     awt::Point          aRet;
    1140             : 
    1141           0 :     if( mpParent )
    1142             :     {
    1143           0 :         const Point aPos = mpParent->mrParent.GetItemRect(mpParent->mnId).TopLeft();
    1144           0 :         const Point aScreenPos( mpParent->mrParent.OutputToAbsoluteScreenPixel( aPos ) );
    1145             : 
    1146           0 :         aRet.X = aScreenPos.X();
    1147           0 :         aRet.Y = aScreenPos.Y();
    1148             :     }
    1149             : 
    1150           0 :     return aRet;
    1151             : }
    1152             : 
    1153             : // -----------------------------------------------------------------------------
    1154             : 
    1155           0 : awt::Size SAL_CALL ValueItemAcc::getSize()
    1156             :     throw (uno::RuntimeException)
    1157             : {
    1158           0 :     const awt::Rectangle    aRect( getBounds() );
    1159           0 :     awt::Size               aRet;
    1160             : 
    1161           0 :     aRet.Width = aRect.Width;
    1162           0 :     aRet.Height = aRect.Height;
    1163             : 
    1164           0 :     return aRet;
    1165             : }
    1166             : 
    1167             : // -----------------------------------------------------------------------------
    1168             : 
    1169           0 : void SAL_CALL ValueItemAcc::grabFocus()
    1170             :     throw (uno::RuntimeException)
    1171             : {
    1172             :     // nothing to do
    1173           0 : }
    1174             : 
    1175             : // -----------------------------------------------------------------------------
    1176             : 
    1177           0 : uno::Any SAL_CALL ValueItemAcc::getAccessibleKeyBinding()
    1178             :     throw (uno::RuntimeException)
    1179             : {
    1180           0 :     return uno::Any();
    1181             : }
    1182             : 
    1183             : // -----------------------------------------------------------------------------
    1184             : 
    1185           0 : sal_Int32 SAL_CALL ValueItemAcc::getForeground(  )
    1186             :     throw (uno::RuntimeException)
    1187             : {
    1188           0 :     sal_uInt32 nColor = Application::GetSettings().GetStyleSettings().GetWindowTextColor().GetColor();
    1189           0 :     return static_cast<sal_Int32>(nColor);
    1190             : }
    1191             : 
    1192             : // -----------------------------------------------------------------------------
    1193             : 
    1194           0 : sal_Int32 SAL_CALL ValueItemAcc::getBackground(  )
    1195             :     throw (uno::RuntimeException)
    1196             : {
    1197             :     sal_uInt32 nColor;
    1198           0 :     if (mpParent && mpParent->meType == VALUESETITEM_COLOR)
    1199           0 :         nColor = mpParent->maColor.GetColor();
    1200             :     else
    1201           0 :         nColor = Application::GetSettings().GetStyleSettings().GetWindowColor().GetColor();
    1202           0 :     return static_cast<sal_Int32>(nColor);
    1203             : }
    1204             : 
    1205             : // -----------------------------------------------------------------------------
    1206             : 
    1207           0 : sal_Int64 SAL_CALL ValueItemAcc::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw( uno::RuntimeException )
    1208             : {
    1209             :     sal_Int64 nRet;
    1210             : 
    1211           0 :     if( ( rId.getLength() == 16 ) && ( 0 == memcmp( ValueItemAcc::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) )
    1212           0 :         nRet = reinterpret_cast< sal_Int64 >( this );
    1213             :     else
    1214           0 :         nRet = 0;
    1215             : 
    1216           0 :     return nRet;
    1217             : }
    1218             : 
    1219             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10