vclxaccessiblestatusbar.cxx (c82f2877) vclxaccessiblestatusbar.cxx (15466770)
1/**************************************************************
1/**************************************************************
2 *
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
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 *
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
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.
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 *
19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_accessibility.hxx"
26#include <accessibility/standard/vclxaccessiblestatusbar.hxx>
27#include <accessibility/standard/vclxaccessiblestatusbaritem.hxx>

--- 127 unchanged lines hidden (view full) ---

155 }
156 }
157}
158
159// -----------------------------------------------------------------------------
160
161void VCLXAccessibleStatusBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
162{
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_accessibility.hxx"
26#include <accessibility/standard/vclxaccessiblestatusbar.hxx>
27#include <accessibility/standard/vclxaccessiblestatusbaritem.hxx>

--- 127 unchanged lines hidden (view full) ---

155 }
156 }
157}
158
159// -----------------------------------------------------------------------------
160
161void VCLXAccessibleStatusBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
162{
163 switch ( rVclWindowEvent.GetId() )
164 {
163 switch ( rVclWindowEvent.GetId() )
164 {
165 case VCLEVENT_STATUSBAR_ITEMADDED:
165 case VCLEVENT_STATUSBAR_ITEMADDED:
166 {
166 {
167 if ( m_pStatusBar )
168 {
167 if ( m_pStatusBar )
168 {
169 sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
169 sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
170 sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId );
171 InsertChild( nItemPos );
172 }
170 sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId );
171 InsertChild( nItemPos );
172 }
173 }
174 break;
173 }
174 break;
175 case VCLEVENT_STATUSBAR_ITEMREMOVED:
175 case VCLEVENT_STATUSBAR_ITEMREMOVED:
176 {
176 {
177 if ( m_pStatusBar )
178 {
177 if ( m_pStatusBar )
178 {
179 sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
179 sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
180 for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
181 {
182 Reference< XAccessible > xChild( getAccessibleChild( i ) );
183 if ( xChild.is() )
184 {
185 VCLXAccessibleStatusBarItem* pVCLXAccessibleStatusBarItem = static_cast< VCLXAccessibleStatusBarItem* >( xChild.get() );
186 if ( pVCLXAccessibleStatusBarItem && pVCLXAccessibleStatusBarItem->GetItemId() == nItemId )
187 {
188 RemoveChild( i );
189 break;
190 }
191 }
192 }
193 }
180 for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
181 {
182 Reference< XAccessible > xChild( getAccessibleChild( i ) );
183 if ( xChild.is() )
184 {
185 VCLXAccessibleStatusBarItem* pVCLXAccessibleStatusBarItem = static_cast< VCLXAccessibleStatusBarItem* >( xChild.get() );
186 if ( pVCLXAccessibleStatusBarItem && pVCLXAccessibleStatusBarItem->GetItemId() == nItemId )
187 {
188 RemoveChild( i );
189 break;
190 }
191 }
192 }
193 }
194 }
195 break;
194 }
195 break;
196 case VCLEVENT_STATUSBAR_ALLITEMSREMOVED:
196 case VCLEVENT_STATUSBAR_ALLITEMSREMOVED:
197 {
197 {
198 for ( sal_Int32 i = m_aAccessibleChildren.size() - 1; i >= 0; --i )
199 RemoveChild( i );
198 for ( sal_Int32 i = m_aAccessibleChildren.size() - 1; i >= 0; --i )
199 RemoveChild( i );
200 }
201 break;
200 }
201 break;
202 case VCLEVENT_STATUSBAR_SHOWITEM:
203 case VCLEVENT_STATUSBAR_HIDEITEM:
202 case VCLEVENT_STATUSBAR_SHOWITEM:
203 case VCLEVENT_STATUSBAR_HIDEITEM:
204 {
204 {
205 if ( m_pStatusBar )
206 {
205 if ( m_pStatusBar )
206 {
207 sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
207 sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
208 sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId );
209 UpdateShowing( nItemPos, rVclWindowEvent.GetId() == VCLEVENT_STATUSBAR_SHOWITEM );
210 }
208 sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId );
209 UpdateShowing( nItemPos, rVclWindowEvent.GetId() == VCLEVENT_STATUSBAR_SHOWITEM );
210 }
211 }
212 break;
211 }
212 break;
213 case VCLEVENT_STATUSBAR_SHOWALLITEMS:
214 case VCLEVENT_STATUSBAR_HIDEALLITEMS:
213 case VCLEVENT_STATUSBAR_SHOWALLITEMS:
214 case VCLEVENT_STATUSBAR_HIDEALLITEMS:
215 {
215 {
216 for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
217 UpdateShowing( i, rVclWindowEvent.GetId() == VCLEVENT_STATUSBAR_SHOWALLITEMS );
216 for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
217 UpdateShowing( i, rVclWindowEvent.GetId() == VCLEVENT_STATUSBAR_SHOWALLITEMS );
218 }
219 break;
218 }
219 break;
220 case VCLEVENT_STATUSBAR_NAMECHANGED:
220 case VCLEVENT_STATUSBAR_NAMECHANGED:
221 {
221 {
222 if ( m_pStatusBar )
223 {
222 if ( m_pStatusBar )
223 {
224 sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
224 sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
225 sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId );
225 sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId );
226 UpdateItemName( nItemPos );
226 UpdateItemName( nItemPos );
227 }
227 }
228 }
229 break;
228 }
229 break;
230 case VCLEVENT_STATUSBAR_DRAWITEM:
230 case VCLEVENT_STATUSBAR_DRAWITEM:
231 {
231 {
232 if ( m_pStatusBar )
233 {
232 if ( m_pStatusBar )
233 {
234 sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
234 sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
235 sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId );
235 sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId );
236 UpdateItemText( nItemPos );
236 UpdateItemText( nItemPos );
237 }
237 }
238 }
239 break;
238 }
239 break;
240 case VCLEVENT_OBJECT_DYING:
240 case VCLEVENT_OBJECT_DYING:
241 {
241 {
242 if ( m_pStatusBar )
243 {
244 m_pStatusBar = NULL;
245
246 // dispose all children
247 for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
248 {
249 Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
250 if ( xComponent.is() )
251 xComponent->dispose();
252 }
242 if ( m_pStatusBar )
243 {
244 m_pStatusBar = NULL;
245
246 // dispose all children
247 for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
248 {
249 Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
250 if ( xComponent.is() )
251 xComponent->dispose();
252 }
253 m_aAccessibleChildren.clear();
253 m_aAccessibleChildren.clear();
254 }
255
256 VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
254 }
255
256 VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
257 }
258 break;
257 }
258 break;
259 default:
260 VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
259 default:
260 VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
261 }
261 }
262}
263
264// -----------------------------------------------------------------------------
265// XComponent
266// -----------------------------------------------------------------------------
267
268void VCLXAccessibleStatusBar::disposing()
269{

--- 5 unchanged lines hidden (view full) ---

275
276 // dispose all children
277 for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
278 {
279 Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
280 if ( xComponent.is() )
281 xComponent->dispose();
282 }
262}
263
264// -----------------------------------------------------------------------------
265// XComponent
266// -----------------------------------------------------------------------------
267
268void VCLXAccessibleStatusBar::disposing()
269{

--- 5 unchanged lines hidden (view full) ---

275
276 // dispose all children
277 for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
278 {
279 Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
280 if ( xComponent.is() )
281 xComponent->dispose();
282 }
283 m_aAccessibleChildren.clear();
283 m_aAccessibleChildren.clear();
284 }
285}
286
287// -----------------------------------------------------------------------------
288// XServiceInfo
289// -----------------------------------------------------------------------------
290
291::rtl::OUString VCLXAccessibleStatusBar::getImplementationName() throw (RuntimeException)

--- 13 unchanged lines hidden (view full) ---

305// -----------------------------------------------------------------------------
306// XAccessibleContext
307// -----------------------------------------------------------------------------
308
309sal_Int32 VCLXAccessibleStatusBar::getAccessibleChildCount() throw (RuntimeException)
310{
311 OExternalLockGuard aGuard( this );
312
284 }
285}
286
287// -----------------------------------------------------------------------------
288// XServiceInfo
289// -----------------------------------------------------------------------------
290
291::rtl::OUString VCLXAccessibleStatusBar::getImplementationName() throw (RuntimeException)

--- 13 unchanged lines hidden (view full) ---

305// -----------------------------------------------------------------------------
306// XAccessibleContext
307// -----------------------------------------------------------------------------
308
309sal_Int32 VCLXAccessibleStatusBar::getAccessibleChildCount() throw (RuntimeException)
310{
311 OExternalLockGuard aGuard( this );
312
313 return m_aAccessibleChildren.size();
313 return m_aAccessibleChildren.size();
314}
315
316// -----------------------------------------------------------------------------
317
318Reference< XAccessible > VCLXAccessibleStatusBar::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
319{
320 OExternalLockGuard aGuard( this );
321

--- 9 unchanged lines hidden (view full) ---

331
332 xChild = new VCLXAccessibleStatusBarItem( m_pStatusBar, nItemId );
333
334 // insert into status bar item list
335 m_aAccessibleChildren[i] = xChild;
336 }
337 }
338
314}
315
316// -----------------------------------------------------------------------------
317
318Reference< XAccessible > VCLXAccessibleStatusBar::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
319{
320 OExternalLockGuard aGuard( this );
321

--- 9 unchanged lines hidden (view full) ---

331
332 xChild = new VCLXAccessibleStatusBarItem( m_pStatusBar, nItemId );
333
334 // insert into status bar item list
335 m_aAccessibleChildren[i] = xChild;
336 }
337 }
338
339 return xChild;
339 return xChild;
340}
341
342// -----------------------------------------------------------------------------
343// XAccessibleComponent
344// -----------------------------------------------------------------------------
345
346Reference< XAccessible > VCLXAccessibleStatusBar::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException)
347{

--- 15 unchanged lines hidden ---
340}
341
342// -----------------------------------------------------------------------------
343// XAccessibleComponent
344// -----------------------------------------------------------------------------
345
346Reference< XAccessible > VCLXAccessibleStatusBar::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException)
347{

--- 15 unchanged lines hidden ---