1*b0724fc6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*b0724fc6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*b0724fc6SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*b0724fc6SAndrew Rist * distributed with this work for additional information 6*b0724fc6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*b0724fc6SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*b0724fc6SAndrew Rist * "License"); you may not use this file except in compliance 9*b0724fc6SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*b0724fc6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*b0724fc6SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*b0724fc6SAndrew Rist * software distributed under the License is distributed on an 15*b0724fc6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b0724fc6SAndrew Rist * KIND, either express or implied. See the License for the 17*b0724fc6SAndrew Rist * specific language governing permissions and limitations 18*b0724fc6SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*b0724fc6SAndrew Rist *************************************************************/ 21*b0724fc6SAndrew Rist 22*b0724fc6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_toolkit.hxx" 26cdf0e10cSrcweir #include <toolkit/controls/accessiblecontrolcontext.hxx> 27cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx> 28cdf0e10cSrcweir #include <com/sun/star/awt/XControl.hpp> 29cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp> 30cdf0e10cSrcweir #include <vcl/svapp.hxx> 31cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp> 32cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleRole.hpp> 33cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx> 34cdf0e10cSrcweir #include <vcl/window.hxx> 35cdf0e10cSrcweir 36cdf0e10cSrcweir //........................................................................ 37cdf0e10cSrcweir namespace toolkit 38cdf0e10cSrcweir { 39cdf0e10cSrcweir //........................................................................ 40cdf0e10cSrcweir 41cdf0e10cSrcweir using ::comphelper::OContextEntryGuard; 42cdf0e10cSrcweir using namespace ::com::sun::star; 43cdf0e10cSrcweir using namespace ::com::sun::star::uno; 44cdf0e10cSrcweir using namespace ::com::sun::star::lang; 45cdf0e10cSrcweir using namespace ::com::sun::star::beans; 46cdf0e10cSrcweir using namespace ::com::sun::star::accessibility; 47cdf0e10cSrcweir 48cdf0e10cSrcweir //==================================================================== 49cdf0e10cSrcweir //= OAccessibleControlContext 50cdf0e10cSrcweir //==================================================================== 51cdf0e10cSrcweir //-------------------------------------------------------------------- OAccessibleControlContext()52cdf0e10cSrcweir OAccessibleControlContext::OAccessibleControlContext() 53cdf0e10cSrcweir :OAccessibleControlContext_Base( ) 54cdf0e10cSrcweir { 55cdf0e10cSrcweir // nothing to do here, we have a late ctor 56cdf0e10cSrcweir } 57cdf0e10cSrcweir 58cdf0e10cSrcweir //-------------------------------------------------------------------- ~OAccessibleControlContext()59cdf0e10cSrcweir OAccessibleControlContext::~OAccessibleControlContext() 60cdf0e10cSrcweir { 61cdf0e10cSrcweir ensureDisposed(); 62cdf0e10cSrcweir } 63cdf0e10cSrcweir 64cdf0e10cSrcweir //-------------------------------------------------------------------- IMPLEMENT_FORWARD_XINTERFACE3(OAccessibleControlContext,OAccessibleControlContext_Base,OAccessibleImplementationAccess,OAccessibleControlContext_IBase)65cdf0e10cSrcweir IMPLEMENT_FORWARD_XINTERFACE3( OAccessibleControlContext, OAccessibleControlContext_Base, OAccessibleImplementationAccess, OAccessibleControlContext_IBase ) 66cdf0e10cSrcweir IMPLEMENT_FORWARD_XTYPEPROVIDER3( OAccessibleControlContext, OAccessibleControlContext_Base, OAccessibleImplementationAccess, OAccessibleControlContext_IBase ) 67cdf0e10cSrcweir // (order matters: the first is the class name, the second is the class doing the ref counting) 68cdf0e10cSrcweir 69cdf0e10cSrcweir //-------------------------------------------------------------------- 70cdf0e10cSrcweir void OAccessibleControlContext::Init( const Reference< XAccessible >& _rxCreator ) SAL_THROW( ( Exception ) ) 71cdf0e10cSrcweir { 72cdf0e10cSrcweir OContextEntryGuard aGuard( this ); 73cdf0e10cSrcweir 74cdf0e10cSrcweir // retrieve the model of the control 75cdf0e10cSrcweir OSL_ENSURE( !m_xControlModel.is(), "OAccessibleControlContext::Init: already know a control model....!???" ); 76cdf0e10cSrcweir 77cdf0e10cSrcweir Reference< awt::XControl > xControl( _rxCreator, UNO_QUERY ); 78cdf0e10cSrcweir if ( xControl.is() ) 79cdf0e10cSrcweir m_xControlModel = m_xControlModel.query( xControl->getModel() ); 80cdf0e10cSrcweir OSL_ENSURE( m_xControlModel.is(), "OAccessibleControlContext::Init: invalid creator (no control, or control without model!" ); 81cdf0e10cSrcweir if ( !m_xControlModel.is() ) 82cdf0e10cSrcweir throw DisposedException(); // caught by the caller (the create method) 83cdf0e10cSrcweir 84cdf0e10cSrcweir // start listening at the model 85cdf0e10cSrcweir startModelListening(); 86cdf0e10cSrcweir 87cdf0e10cSrcweir // announce the XAccessible to our base class 88cdf0e10cSrcweir OAccessibleControlContext_Base::lateInit( _rxCreator ); 89cdf0e10cSrcweir } 90cdf0e10cSrcweir 91cdf0e10cSrcweir //-------------------------------------------------------------------- create(const Reference<XAccessible> & _rxCreator)92cdf0e10cSrcweir OAccessibleControlContext* OAccessibleControlContext::create( const Reference< XAccessible >& _rxCreator ) SAL_THROW( ( ) ) 93cdf0e10cSrcweir { 94cdf0e10cSrcweir OAccessibleControlContext* pNew = NULL; 95cdf0e10cSrcweir try 96cdf0e10cSrcweir { 97cdf0e10cSrcweir pNew = new OAccessibleControlContext; 98cdf0e10cSrcweir pNew->Init( _rxCreator ); 99cdf0e10cSrcweir } 100cdf0e10cSrcweir catch( const Exception& ) 101cdf0e10cSrcweir { 102cdf0e10cSrcweir OSL_ENSURE( sal_False, "OAccessibleControlContext::create: caught an exception from the late ctor!" ); 103cdf0e10cSrcweir } 104cdf0e10cSrcweir return pNew; 105cdf0e10cSrcweir } 106cdf0e10cSrcweir 107cdf0e10cSrcweir //-------------------------------------------------------------------- startModelListening()108cdf0e10cSrcweir void OAccessibleControlContext::startModelListening( ) SAL_THROW( ( Exception ) ) 109cdf0e10cSrcweir { 110cdf0e10cSrcweir Reference< XComponent > xModelComp( m_xControlModel, UNO_QUERY ); 111cdf0e10cSrcweir OSL_ENSURE( xModelComp.is(), "OAccessibleControlContext::startModelListening: invalid model!" ); 112cdf0e10cSrcweir if ( xModelComp.is() ) 113cdf0e10cSrcweir xModelComp->addEventListener( this ); 114cdf0e10cSrcweir } 115cdf0e10cSrcweir 116cdf0e10cSrcweir //-------------------------------------------------------------------- stopModelListening()117cdf0e10cSrcweir void OAccessibleControlContext::stopModelListening( ) SAL_THROW( ( Exception ) ) 118cdf0e10cSrcweir { 119cdf0e10cSrcweir Reference< XComponent > xModelComp( m_xControlModel, UNO_QUERY ); 120cdf0e10cSrcweir OSL_ENSURE( xModelComp.is(), "OAccessibleControlContext::stopModelListening: invalid model!" ); 121cdf0e10cSrcweir if ( xModelComp.is() ) 122cdf0e10cSrcweir xModelComp->removeEventListener( this ); 123cdf0e10cSrcweir } 124cdf0e10cSrcweir 125cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleChildCount()126cdf0e10cSrcweir sal_Int32 SAL_CALL OAccessibleControlContext::getAccessibleChildCount( ) throw (RuntimeException) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir // we do not have children 129cdf0e10cSrcweir return 0; 130cdf0e10cSrcweir } 131cdf0e10cSrcweir 132cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleChild(sal_Int32)133cdf0e10cSrcweir Reference< XAccessible > SAL_CALL OAccessibleControlContext::getAccessibleChild( sal_Int32 ) throw (IndexOutOfBoundsException, RuntimeException) 134cdf0e10cSrcweir { 135cdf0e10cSrcweir // we do not have children 136cdf0e10cSrcweir throw IndexOutOfBoundsException(); 137cdf0e10cSrcweir } 138cdf0e10cSrcweir 139cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleParent()140cdf0e10cSrcweir Reference< XAccessible > SAL_CALL OAccessibleControlContext::getAccessibleParent( ) throw (RuntimeException) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir OContextEntryGuard aGuard( this ); 143cdf0e10cSrcweir OSL_ENSURE( implGetForeignControlledParent().is(), "OAccessibleControlContext::getAccessibleParent: somebody forgot to set a parent!" ); 144cdf0e10cSrcweir // this parent of us is foreign controlled - somebody has to set it using the OAccessibleImplementationAccess 145cdf0e10cSrcweir // class, before integrating our instance into an AccessibleDocumentModel 146cdf0e10cSrcweir return implGetForeignControlledParent(); 147cdf0e10cSrcweir } 148cdf0e10cSrcweir 149cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleRole()150cdf0e10cSrcweir sal_Int16 SAL_CALL OAccessibleControlContext::getAccessibleRole( ) throw (RuntimeException) 151cdf0e10cSrcweir { 152cdf0e10cSrcweir return AccessibleRole::SHAPE; 153cdf0e10cSrcweir } 154cdf0e10cSrcweir 155cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleDescription()156cdf0e10cSrcweir ::rtl::OUString SAL_CALL OAccessibleControlContext::getAccessibleDescription( ) throw (RuntimeException) 157cdf0e10cSrcweir { 158cdf0e10cSrcweir OContextEntryGuard aGuard( this ); 159cdf0e10cSrcweir return getModelStringProperty( "HelpText" ); 160cdf0e10cSrcweir } 161cdf0e10cSrcweir 162cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleName()163cdf0e10cSrcweir ::rtl::OUString SAL_CALL OAccessibleControlContext::getAccessibleName( ) throw (RuntimeException) 164cdf0e10cSrcweir { 165cdf0e10cSrcweir OContextEntryGuard aGuard( this ); 166cdf0e10cSrcweir return getModelStringProperty( "Name" ); 167cdf0e10cSrcweir } 168cdf0e10cSrcweir 169cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleRelationSet()170cdf0e10cSrcweir Reference< XAccessibleRelationSet > SAL_CALL OAccessibleControlContext::getAccessibleRelationSet( ) throw (RuntimeException) 171cdf0e10cSrcweir { 172cdf0e10cSrcweir return NULL; 173cdf0e10cSrcweir } 174cdf0e10cSrcweir 175cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleStateSet()176cdf0e10cSrcweir Reference< XAccessibleStateSet > SAL_CALL OAccessibleControlContext::getAccessibleStateSet( ) throw (RuntimeException) 177cdf0e10cSrcweir { 178cdf0e10cSrcweir ::osl::MutexGuard aGuard( GetMutex() ); 179cdf0e10cSrcweir // no OContextEntryGuard here, as we do not want to throw an exception in case we're not alive anymore 180cdf0e10cSrcweir 181cdf0e10cSrcweir ::utl::AccessibleStateSetHelper* pStateSet = NULL; 182cdf0e10cSrcweir if ( isAlive() ) 183cdf0e10cSrcweir { 184cdf0e10cSrcweir // no own states, only the ones which are foreign controlled 185cdf0e10cSrcweir pStateSet = new ::utl::AccessibleStateSetHelper( implGetForeignControlledStates() ); 186cdf0e10cSrcweir } 187cdf0e10cSrcweir else 188cdf0e10cSrcweir { // only the DEFUNC state if we're already disposed 189cdf0e10cSrcweir pStateSet = new ::utl::AccessibleStateSetHelper; 190cdf0e10cSrcweir pStateSet->AddState( AccessibleStateType::DEFUNC ); 191cdf0e10cSrcweir } 192cdf0e10cSrcweir return pStateSet; 193cdf0e10cSrcweir } 194cdf0e10cSrcweir 195cdf0e10cSrcweir //-------------------------------------------------------------------- disposing(const EventObject & _rSource)196cdf0e10cSrcweir void SAL_CALL OAccessibleControlContext::disposing( const EventObject& 197cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 198cdf0e10cSrcweir _rSource 199cdf0e10cSrcweir #endif 200cdf0e10cSrcweir ) throw ( RuntimeException ) 201cdf0e10cSrcweir { 202cdf0e10cSrcweir OSL_ENSURE( Reference< XPropertySet >( _rSource.Source, UNO_QUERY ).get() == m_xControlModel.get(), 203cdf0e10cSrcweir "OAccessibleControlContext::disposing: where did this come from?" ); 204cdf0e10cSrcweir 205cdf0e10cSrcweir stopModelListening( ); 206cdf0e10cSrcweir m_xControlModel.clear(); 207cdf0e10cSrcweir m_xModelPropsInfo.clear(); 208cdf0e10cSrcweir 209cdf0e10cSrcweir OAccessibleControlContext_Base::disposing(); 210cdf0e10cSrcweir } 211cdf0e10cSrcweir 212cdf0e10cSrcweir //-------------------------------------------------------------------- getModelStringProperty(const sal_Char * _pPropertyName)213cdf0e10cSrcweir ::rtl::OUString OAccessibleControlContext::getModelStringProperty( const sal_Char* _pPropertyName ) 214cdf0e10cSrcweir { 215cdf0e10cSrcweir ::rtl::OUString sReturn; 216cdf0e10cSrcweir try 217cdf0e10cSrcweir { 218cdf0e10cSrcweir if ( !m_xModelPropsInfo.is() && m_xControlModel.is() ) 219cdf0e10cSrcweir m_xModelPropsInfo = m_xControlModel->getPropertySetInfo(); 220cdf0e10cSrcweir 221cdf0e10cSrcweir ::rtl::OUString sPropertyName( ::rtl::OUString::createFromAscii( _pPropertyName ) ); 222cdf0e10cSrcweir if ( m_xModelPropsInfo.is() && m_xModelPropsInfo->hasPropertyByName( sPropertyName ) ) 223cdf0e10cSrcweir m_xControlModel->getPropertyValue( sPropertyName ) >>= sReturn; 224cdf0e10cSrcweir } 225cdf0e10cSrcweir catch( const Exception& ) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir OSL_ENSURE( sal_False, "OAccessibleControlContext::getModelStringProperty: caught an exception!" ); 228cdf0e10cSrcweir } 229cdf0e10cSrcweir return sReturn; 230cdf0e10cSrcweir } 231cdf0e10cSrcweir 232cdf0e10cSrcweir //-------------------------------------------------------------------- implGetWindow(Reference<awt::XWindow> * _pxUNOWindow) const233cdf0e10cSrcweir Window* OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const 234cdf0e10cSrcweir { 235cdf0e10cSrcweir Reference< awt::XControl > xControl( getAccessibleCreator(), UNO_QUERY ); 236cdf0e10cSrcweir Reference< awt::XWindow > xWindow; 237cdf0e10cSrcweir if ( xControl.is() ) 238cdf0e10cSrcweir xWindow = xWindow.query( xControl->getPeer() ); 239cdf0e10cSrcweir 240cdf0e10cSrcweir Window* pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : NULL; 241cdf0e10cSrcweir 242cdf0e10cSrcweir if ( _pxUNOWindow ) 243cdf0e10cSrcweir *_pxUNOWindow = xWindow; 244cdf0e10cSrcweir return pWindow; 245cdf0e10cSrcweir } 246cdf0e10cSrcweir 247cdf0e10cSrcweir //-------------------------------------------------------------------- implGetBounds()248cdf0e10cSrcweir awt::Rectangle SAL_CALL OAccessibleControlContext::implGetBounds( ) throw (RuntimeException) 249cdf0e10cSrcweir { 250cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 251cdf0e10cSrcweir // want to do some VCL stuff here ... 252cdf0e10cSrcweir OContextEntryGuard aGuard( this ); 253cdf0e10cSrcweir 254cdf0e10cSrcweir OSL_ENSURE( sal_False, "OAccessibleControlContext::implGetBounds: performance issue: forced to calc the size myself!" ); 255cdf0e10cSrcweir // In design mode (and this is what this class is for), the surrounding shape (if any) should handle this call 256cdf0e10cSrcweir // The problem is that in design mode, our size may not be correct (in the drawing layer, controls are 257cdf0e10cSrcweir // positioned/sized for painting only), and that calculation of our position is expensive 258cdf0e10cSrcweir 259cdf0e10cSrcweir // what we know (or can obtain from somewhere): 260cdf0e10cSrcweir // * the PosSize of our peer, relative to it's parent window 261cdf0e10cSrcweir // * the parent window which the PosSize is relative to 262cdf0e10cSrcweir // * our foreign controlled accessible parent 263cdf0e10cSrcweir // from this info, we can determine the the position of our peer relative to the foreign parent 264cdf0e10cSrcweir 265cdf0e10cSrcweir // our control 266cdf0e10cSrcweir Reference< awt::XWindow > xWindow; 267cdf0e10cSrcweir Window* pVCLWindow = implGetWindow( &xWindow ); 268cdf0e10cSrcweir 269cdf0e10cSrcweir awt::Rectangle aBounds( 0, 0, 0, 0 ); 270cdf0e10cSrcweir if ( xWindow.is() ) 271cdf0e10cSrcweir { 272cdf0e10cSrcweir // ugly, but .... though the XWindow has a getPosSize, it is impossible to determine the 273cdf0e10cSrcweir // parent which this position/size is relative to. This means we must tunnel UNO and ask the 274cdf0e10cSrcweir // implementation 275cdf0e10cSrcweir Window* pVCLParent = pVCLWindow ? pVCLWindow->GetParent() : NULL; 276cdf0e10cSrcweir 277cdf0e10cSrcweir // the relative location of the window 278cdf0e10cSrcweir ::Point aWindowRelativePos( 0, 0); 279cdf0e10cSrcweir if ( pVCLWindow ) 280cdf0e10cSrcweir aWindowRelativePos = pVCLWindow->GetPosPixel(); 281cdf0e10cSrcweir 282cdf0e10cSrcweir // the screnn position of the "window parent" of the control 283cdf0e10cSrcweir ::Point aVCLParentScreenPos( 0, 0 ); 284cdf0e10cSrcweir if ( pVCLParent ) 285cdf0e10cSrcweir aVCLParentScreenPos = pVCLParent->GetPosPixel(); 286cdf0e10cSrcweir 287cdf0e10cSrcweir // the screen position of the "accessible parent" of the control 288cdf0e10cSrcweir Reference< XAccessible > xParentAcc( implGetForeignControlledParent() ); 289cdf0e10cSrcweir Reference< XAccessibleComponent > xParentAccComponent; 290cdf0e10cSrcweir if ( xParentAcc.is() ) 291cdf0e10cSrcweir xParentAccComponent = xParentAccComponent.query( xParentAcc->getAccessibleContext() ); 292cdf0e10cSrcweir awt::Point aAccParentScreenPos( 0, 0 ); 293cdf0e10cSrcweir if ( xParentAccComponent.is() ) 294cdf0e10cSrcweir aAccParentScreenPos = xParentAccComponent->getLocationOnScreen(); 295cdf0e10cSrcweir 296cdf0e10cSrcweir // now the size of the control 297cdf0e10cSrcweir aBounds = xWindow->getPosSize(); 298cdf0e10cSrcweir 299cdf0e10cSrcweir // correct the pos 300cdf0e10cSrcweir aBounds.X = aWindowRelativePos.X() + aVCLParentScreenPos.X() - aAccParentScreenPos.X; 301cdf0e10cSrcweir aBounds.Y = aWindowRelativePos.Y() + aVCLParentScreenPos.Y() - aAccParentScreenPos.Y; 302cdf0e10cSrcweir } 303cdf0e10cSrcweir 304cdf0e10cSrcweir return aBounds; 305cdf0e10cSrcweir } 306cdf0e10cSrcweir 307cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleAtPoint(const awt::Point &)308cdf0e10cSrcweir Reference< XAccessible > SAL_CALL OAccessibleControlContext::getAccessibleAtPoint( const awt::Point& /* _rPoint */ ) throw (RuntimeException) 309cdf0e10cSrcweir { 310cdf0e10cSrcweir // no children at all 311cdf0e10cSrcweir return NULL; 312cdf0e10cSrcweir } 313cdf0e10cSrcweir 314cdf0e10cSrcweir //-------------------------------------------------------------------- grabFocus()315cdf0e10cSrcweir void SAL_CALL OAccessibleControlContext::grabFocus( ) throw (RuntimeException) 316cdf0e10cSrcweir { 317cdf0e10cSrcweir OSL_ENSURE( sal_False, "OAccessibleControlContext::grabFocus: !isFocusTraversable, but grabFocus!" ); 318cdf0e10cSrcweir } 319cdf0e10cSrcweir 320cdf0e10cSrcweir //-------------------------------------------------------------------- getAccessibleKeyBinding()321cdf0e10cSrcweir Any SAL_CALL OAccessibleControlContext::getAccessibleKeyBinding( ) throw (RuntimeException) 322cdf0e10cSrcweir { 323cdf0e10cSrcweir // we do not have any key bindings to activate a UNO control in design mode 324cdf0e10cSrcweir return Any(); 325cdf0e10cSrcweir } 326cdf0e10cSrcweir 327cdf0e10cSrcweir //-------------------------------------------------------------------- getForeground()328cdf0e10cSrcweir sal_Int32 SAL_CALL OAccessibleControlContext::getForeground( ) throw (::com::sun::star::uno::RuntimeException) 329cdf0e10cSrcweir { 330cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 331cdf0e10cSrcweir // want to do some VCL stuff here ... 332cdf0e10cSrcweir OContextEntryGuard aGuard( this ); 333cdf0e10cSrcweir 334cdf0e10cSrcweir Window* pWindow = implGetWindow( ); 335cdf0e10cSrcweir sal_Int32 nColor = 0; 336cdf0e10cSrcweir if ( pWindow ) 337cdf0e10cSrcweir { 338cdf0e10cSrcweir if ( pWindow->IsControlForeground() ) 339cdf0e10cSrcweir nColor = pWindow->GetControlForeground().GetColor(); 340cdf0e10cSrcweir else 341cdf0e10cSrcweir { 342cdf0e10cSrcweir Font aFont; 343cdf0e10cSrcweir if ( pWindow->IsControlFont() ) 344cdf0e10cSrcweir aFont = pWindow->GetControlFont(); 345cdf0e10cSrcweir else 346cdf0e10cSrcweir aFont = pWindow->GetFont(); 347cdf0e10cSrcweir nColor = aFont.GetColor().GetColor(); 348cdf0e10cSrcweir } 349cdf0e10cSrcweir } 350cdf0e10cSrcweir return nColor; 351cdf0e10cSrcweir } 352cdf0e10cSrcweir 353cdf0e10cSrcweir //-------------------------------------------------------------------- getBackground()354cdf0e10cSrcweir sal_Int32 SAL_CALL OAccessibleControlContext::getBackground( ) throw (::com::sun::star::uno::RuntimeException) 355cdf0e10cSrcweir { 356cdf0e10cSrcweir ::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); 357cdf0e10cSrcweir // want to do some VCL stuff here ... 358cdf0e10cSrcweir OContextEntryGuard aGuard( this ); 359cdf0e10cSrcweir 360cdf0e10cSrcweir Window* pWindow = implGetWindow( ); 361cdf0e10cSrcweir sal_Int32 nColor = 0; 362cdf0e10cSrcweir if ( pWindow ) 363cdf0e10cSrcweir { 364cdf0e10cSrcweir if ( pWindow->IsControlBackground() ) 365cdf0e10cSrcweir nColor = pWindow->GetControlBackground().GetColor(); 366cdf0e10cSrcweir else 367cdf0e10cSrcweir nColor = pWindow->GetBackground().GetColor().GetColor(); 368cdf0e10cSrcweir } 369cdf0e10cSrcweir 370cdf0e10cSrcweir return nColor; 371cdf0e10cSrcweir } 372cdf0e10cSrcweir 373cdf0e10cSrcweir //........................................................................ 374cdf0e10cSrcweir } //namespace toolkit 375cdf0e10cSrcweir //........................................................................ 376cdf0e10cSrcweir 377