1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_accessibility.hxx" 26 27 #ifndef ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX_ 28 #include "accessibility/extended/accessibletablistbox.hxx" 29 #endif 30 #include "accessibility/extended/accessibletablistboxtable.hxx" 31 #include <svtools/svtabbx.hxx> 32 #include <comphelper/sequence.hxx> 33 34 //........................................................................ 35 namespace accessibility 36 { 37 //........................................................................ 38 39 // class TLBSolarGuard --------------------------------------------------------- 40 41 /** Acquire the solar mutex. */ 42 class TLBSolarGuard : public ::vos::OGuard 43 { 44 public: 45 inline TLBSolarGuard() : ::vos::OGuard( Application::GetSolarMutex() ) {} 46 }; 47 48 // class AccessibleTabListBox ----------------------------------------------------- 49 50 using namespace ::com::sun::star::accessibility; 51 using namespace ::com::sun::star::uno; 52 using namespace ::com::sun::star::lang; 53 using namespace ::com::sun::star; 54 55 DBG_NAME(AccessibleTabListBox) 56 57 // ----------------------------------------------------------------------------- 58 // Ctor() and Dtor() 59 // ----------------------------------------------------------------------------- 60 AccessibleTabListBox::AccessibleTabListBox( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox ) 61 :AccessibleBrowseBox( rxParent, NULL, rBox ) 62 ,m_pTabListBox( &rBox ) 63 64 { 65 DBG_CTOR( AccessibleTabListBox, NULL ); 66 67 osl_incrementInterlockedCount( &m_refCount ); 68 { 69 setCreator( this ); 70 } 71 osl_decrementInterlockedCount( &m_refCount ); 72 } 73 74 // ----------------------------------------------------------------------------- 75 AccessibleTabListBox::~AccessibleTabListBox() 76 { 77 DBG_DTOR( AccessibleTabListBox, NULL ); 78 79 if ( isAlive() ) 80 { 81 // increment ref count to prevent double call of Dtor 82 osl_incrementInterlockedCount( &m_refCount ); 83 dispose(); 84 } 85 } 86 // ----------------------------------------------------------------------------- 87 AccessibleBrowseBoxTable* AccessibleTabListBox::createAccessibleTable() 88 { 89 return new AccessibleTabListBoxTable( this, *m_pTabListBox ); 90 } 91 92 // XInterface ----------------------------------------------------------------- 93 IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base ) 94 95 // XTypeProvider -------------------------------------------------------------- 96 IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base ) 97 98 // XAccessibleContext --------------------------------------------------------- 99 100 sal_Int32 SAL_CALL AccessibleTabListBox::getAccessibleChildCount() 101 { 102 return 2; // header and table 103 } 104 105 // ----------------------------------------------------------------------------- 106 Reference< XAccessibleContext > SAL_CALL AccessibleTabListBox::getAccessibleContext() 107 { 108 return this; 109 } 110 111 // ----------------------------------------------------------------------------- 112 Reference< XAccessible > SAL_CALL 113 AccessibleTabListBox::getAccessibleChild( sal_Int32 nChildIndex ) 114 { 115 TLBSolarGuard aSolarGuard; 116 ::osl::MutexGuard aGuard( getOslMutex() ); 117 ensureIsAlive(); 118 119 if ( nChildIndex < 0 || nChildIndex > 1 ) 120 throw IndexOutOfBoundsException(); 121 122 Reference< XAccessible > xRet; 123 if (nChildIndex == 0) 124 { 125 //! so far the actual implementation object only supports column headers 126 xRet = implGetFixedChild( ::svt::BBINDEX_COLUMNHEADERBAR ); 127 } 128 else if (nChildIndex == 1) 129 xRet = implGetFixedChild( ::svt::BBINDEX_TABLE ); 130 131 if ( !xRet.is() ) 132 throw RuntimeException(); 133 134 return xRet; 135 } 136 137 //........................................................................ 138 }// namespace accessibility 139 //........................................................................ 140