1*5900e8ecSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5900e8ecSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5900e8ecSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5900e8ecSAndrew Rist * distributed with this work for additional information 6*5900e8ecSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5900e8ecSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5900e8ecSAndrew Rist * "License"); you may not use this file except in compliance 9*5900e8ecSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*5900e8ecSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*5900e8ecSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5900e8ecSAndrew Rist * software distributed under the License is distributed on an 15*5900e8ecSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5900e8ecSAndrew Rist * KIND, either express or implied. See the License for the 17*5900e8ecSAndrew Rist * specific language governing permissions and limitations 18*5900e8ecSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*5900e8ecSAndrew Rist *************************************************************/ 21*5900e8ecSAndrew Rist 22*5900e8ecSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include "precompiled_svtools.hxx" 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "toolpaneldrawerpeer.hxx" 27cdf0e10cSrcweir #include "toolpaneldrawer.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir /** === begin UNO includes === **/ 30cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleStateType.hpp> 31cdf0e10cSrcweir #include <com/sun/star/accessibility/AccessibleEventId.hpp> 32cdf0e10cSrcweir /** === end UNO includes === **/ 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include <tools/diagnose_ex.h> 35cdf0e10cSrcweir #include <toolkit/awt/vclxaccessiblecomponent.hxx> 36cdf0e10cSrcweir #include <unotools/accessiblestatesethelper.hxx> 37cdf0e10cSrcweir #include <vcl/vclevent.hxx> 38cdf0e10cSrcweir 39cdf0e10cSrcweir //...................................................................................................................... 40cdf0e10cSrcweir namespace svt 41cdf0e10cSrcweir { 42cdf0e10cSrcweir //...................................................................................................................... 43cdf0e10cSrcweir 44cdf0e10cSrcweir /** === begin UNO using === **/ 45cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 46cdf0e10cSrcweir using ::com::sun::star::uno::XInterface; 47cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY; 48cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY_THROW; 49cdf0e10cSrcweir using ::com::sun::star::uno::UNO_SET_THROW; 50cdf0e10cSrcweir using ::com::sun::star::uno::Exception; 51cdf0e10cSrcweir using ::com::sun::star::uno::RuntimeException; 52cdf0e10cSrcweir using ::com::sun::star::uno::Any; 53cdf0e10cSrcweir using ::com::sun::star::uno::makeAny; 54cdf0e10cSrcweir using ::com::sun::star::uno::Sequence; 55cdf0e10cSrcweir using ::com::sun::star::uno::Type; 56cdf0e10cSrcweir using ::com::sun::star::accessibility::XAccessibleContext; 57cdf0e10cSrcweir /** === end UNO using === **/ 58cdf0e10cSrcweir namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType; 59cdf0e10cSrcweir namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId; 60cdf0e10cSrcweir 61cdf0e10cSrcweir //================================================================================================================== 62cdf0e10cSrcweir //= ToolPanelDrawerContext 63cdf0e10cSrcweir //================================================================================================================== 64cdf0e10cSrcweir class ToolPanelDrawerContext : public VCLXAccessibleComponent 65cdf0e10cSrcweir { 66cdf0e10cSrcweir public: ToolPanelDrawerContext(VCLXWindow & i_rWindow)67cdf0e10cSrcweir ToolPanelDrawerContext( VCLXWindow& i_rWindow ) 68cdf0e10cSrcweir :VCLXAccessibleComponent( &i_rWindow ) 69cdf0e10cSrcweir { 70cdf0e10cSrcweir } 71cdf0e10cSrcweir 72cdf0e10cSrcweir virtual void ProcessWindowEvent( const VclWindowEvent& i_rVclWindowEvent ); 73cdf0e10cSrcweir virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ); 74cdf0e10cSrcweir 75cdf0e10cSrcweir protected: ~ToolPanelDrawerContext()76cdf0e10cSrcweir ~ToolPanelDrawerContext() 77cdf0e10cSrcweir { 78cdf0e10cSrcweir } 79cdf0e10cSrcweir }; 80cdf0e10cSrcweir 81cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ ProcessWindowEvent(const VclWindowEvent & i_rVclWindowEvent)82cdf0e10cSrcweir void ToolPanelDrawerContext::ProcessWindowEvent( const VclWindowEvent& i_rVclWindowEvent ) 83cdf0e10cSrcweir { 84cdf0e10cSrcweir VCLXAccessibleComponent::ProcessWindowEvent( i_rVclWindowEvent ); 85cdf0e10cSrcweir 86cdf0e10cSrcweir switch ( i_rVclWindowEvent.GetId() ) 87cdf0e10cSrcweir { 88cdf0e10cSrcweir case VCLEVENT_ITEM_EXPANDED: 89cdf0e10cSrcweir NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), makeAny( AccessibleStateType::EXPANDED ) ); 90cdf0e10cSrcweir break; 91cdf0e10cSrcweir case VCLEVENT_ITEM_COLLAPSED: 92cdf0e10cSrcweir NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, makeAny( AccessibleStateType::EXPANDED ), Any() ); 93cdf0e10cSrcweir break; 94cdf0e10cSrcweir } 95cdf0e10cSrcweir } 96cdf0e10cSrcweir 97cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ FillAccessibleStateSet(::utl::AccessibleStateSetHelper & i_rStateSet)98cdf0e10cSrcweir void ToolPanelDrawerContext::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ) 99cdf0e10cSrcweir { 100cdf0e10cSrcweir VCLXAccessibleComponent::FillAccessibleStateSet( i_rStateSet ); 101cdf0e10cSrcweir if ( !GetWindow() ) 102cdf0e10cSrcweir return; 103cdf0e10cSrcweir 104cdf0e10cSrcweir i_rStateSet.AddState( AccessibleStateType::EXPANDABLE ); 105cdf0e10cSrcweir i_rStateSet.AddState( AccessibleStateType::FOCUSABLE ); 106cdf0e10cSrcweir 107cdf0e10cSrcweir const ToolPanelDrawer* pDrawer( dynamic_cast< const ToolPanelDrawer* > ( GetWindow() ) ); 108cdf0e10cSrcweir ENSURE_OR_RETURN_VOID( pDrawer, "ToolPanelDrawerContext::FillAccessibleStateSet: illegal window!" ); 109cdf0e10cSrcweir if ( pDrawer->IsExpanded() ) 110cdf0e10cSrcweir i_rStateSet.AddState( AccessibleStateType::EXPANDED ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir if ( pDrawer->HasChildPathFocus() ) 113cdf0e10cSrcweir i_rStateSet.AddState( AccessibleStateType::FOCUSED ); 114cdf0e10cSrcweir } 115cdf0e10cSrcweir 116cdf0e10cSrcweir //================================================================================================================== 117cdf0e10cSrcweir //= ToolPanelDrawerPeer 118cdf0e10cSrcweir //================================================================================================================== 119cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ ToolPanelDrawerPeer()120cdf0e10cSrcweir ToolPanelDrawerPeer::ToolPanelDrawerPeer() 121cdf0e10cSrcweir :VCLXWindow() 122cdf0e10cSrcweir { 123cdf0e10cSrcweir } 124cdf0e10cSrcweir 125cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ ~ToolPanelDrawerPeer()126cdf0e10cSrcweir ToolPanelDrawerPeer::~ToolPanelDrawerPeer() 127cdf0e10cSrcweir { 128cdf0e10cSrcweir } 129cdf0e10cSrcweir 130cdf0e10cSrcweir //------------------------------------------------------------------------------------------------------------------ CreateAccessibleContext()131cdf0e10cSrcweir Reference< XAccessibleContext > ToolPanelDrawerPeer::CreateAccessibleContext() 132cdf0e10cSrcweir { 133cdf0e10cSrcweir ::vos::OGuard aSolarGuard( GetMutex() ); 134cdf0e10cSrcweir return new ToolPanelDrawerContext( *this ); 135cdf0e10cSrcweir } 136cdf0e10cSrcweir 137cdf0e10cSrcweir //...................................................................................................................... 138cdf0e10cSrcweir } // namespace svt 139cdf0e10cSrcweir //...................................................................................................................... 140