Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <accessibility/standard/vclxaccessibletabpage.hxx>
30 : : #include <toolkit/helper/externallock.hxx>
31 : : #include <toolkit/helper/convert.hxx>
32 : : #include <accessibility/helper/characterattributeshelper.hxx>
33 : :
34 : : #include <com/sun/star/accessibility/AccessibleEventId.hpp>
35 : : #include <com/sun/star/accessibility/AccessibleRole.hpp>
36 : : #include <com/sun/star/accessibility/AccessibleStateType.hpp>
37 : : #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
38 : : #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
39 : :
40 : : #include <unotools/accessiblestatesethelper.hxx>
41 : : #include <unotools/accessiblerelationsethelper.hxx>
42 : : #include <vcl/svapp.hxx>
43 : : #include <vcl/unohelp2.hxx>
44 : : #include <vcl/tabctrl.hxx>
45 : : #include <vcl/tabpage.hxx>
46 : :
47 : : #include <memory>
48 : :
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::beans;
54 : : using namespace ::com::sun::star;
55 : : using namespace ::comphelper;
56 : :
57 : :
58 : : // -----------------------------------------------------------------------------
59 : : // class VCLXAccessibleTabPage
60 : : // -----------------------------------------------------------------------------
61 : :
62 : 0 : VCLXAccessibleTabPage::VCLXAccessibleTabPage( TabControl* pTabControl, sal_uInt16 nPageId )
63 : 0 : :AccessibleTextHelper_BASE( new VCLExternalSolarLock() )
64 : : ,m_pTabControl( pTabControl )
65 [ # # ]: 0 : ,m_nPageId( nPageId )
66 : : {
67 [ # # ]: 0 : m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() );
68 [ # # ]: 0 : m_bFocused = IsFocused();
69 [ # # ]: 0 : m_bSelected = IsSelected();
70 [ # # ]: 0 : m_sPageText = GetPageText();
71 : 0 : }
72 : :
73 : : // -----------------------------------------------------------------------------
74 : :
75 : 0 : VCLXAccessibleTabPage::~VCLXAccessibleTabPage()
76 : : {
77 [ # # ][ # # ]: 0 : delete m_pExternalLock;
78 : 0 : m_pExternalLock = NULL;
79 [ # # ]: 0 : }
80 : :
81 : : // -----------------------------------------------------------------------------
82 : :
83 : 0 : bool VCLXAccessibleTabPage::IsFocused()
84 : : {
85 : 0 : bool bFocused = false;
86 : :
87 [ # # ][ # # ]: 0 : if ( m_pTabControl && m_pTabControl->HasFocus() && m_pTabControl->GetCurPageId() == m_nPageId )
[ # # ][ # # ]
88 : 0 : bFocused = true;
89 : :
90 : 0 : return bFocused;
91 : : }
92 : :
93 : : // -----------------------------------------------------------------------------
94 : :
95 : 0 : bool VCLXAccessibleTabPage::IsSelected()
96 : : {
97 : 0 : bool bSelected = false;
98 : :
99 [ # # ][ # # ]: 0 : if ( m_pTabControl && m_pTabControl->GetCurPageId() == m_nPageId )
[ # # ]
100 : 0 : bSelected = true;
101 : :
102 : 0 : return bSelected;
103 : : }
104 : :
105 : : // -----------------------------------------------------------------------------
106 : :
107 : 0 : void VCLXAccessibleTabPage::SetFocused( bool bFocused )
108 : : {
109 [ # # ]: 0 : if ( m_bFocused != bFocused )
110 : : {
111 : 0 : Any aOldValue, aNewValue;
112 [ # # ]: 0 : if ( m_bFocused )
113 [ # # ]: 0 : aOldValue <<= AccessibleStateType::FOCUSED;
114 : : else
115 [ # # ]: 0 : aNewValue <<= AccessibleStateType::FOCUSED;
116 : 0 : m_bFocused = bFocused;
117 [ # # ]: 0 : NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
118 : : }
119 : 0 : }
120 : :
121 : : // -----------------------------------------------------------------------------
122 : :
123 : 0 : void VCLXAccessibleTabPage::SetSelected( bool bSelected )
124 : : {
125 [ # # ]: 0 : if ( m_bSelected != bSelected )
126 : : {
127 : 0 : Any aOldValue, aNewValue;
128 [ # # ]: 0 : if ( m_bSelected )
129 [ # # ]: 0 : aOldValue <<= AccessibleStateType::SELECTED;
130 : : else
131 [ # # ]: 0 : aNewValue <<= AccessibleStateType::SELECTED;
132 : 0 : m_bSelected = bSelected;
133 [ # # ]: 0 : NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
134 : : }
135 : 0 : }
136 : :
137 : : // -----------------------------------------------------------------------------
138 : :
139 : 0 : void VCLXAccessibleTabPage::SetPageText( const ::rtl::OUString& sPageText )
140 : : {
141 : 0 : Any aOldValue, aNewValue;
142 [ # # ][ # # ]: 0 : if ( OCommonAccessibleText::implInitTextChangedEvent( m_sPageText, sPageText, aOldValue, aNewValue ) )
143 : : {
144 : 0 : Any aOldName, aNewName;
145 [ # # ]: 0 : aOldName <<= m_sPageText;
146 [ # # ]: 0 : aNewName <<= sPageText;
147 : 0 : m_sPageText = sPageText;
148 [ # # ]: 0 : NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldName, aNewName );
149 [ # # ]: 0 : NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue );
150 : 0 : }
151 : 0 : }
152 : :
153 : : // -----------------------------------------------------------------------------
154 : :
155 : 0 : ::rtl::OUString VCLXAccessibleTabPage::GetPageText()
156 : : {
157 : 0 : ::rtl::OUString sText;
158 [ # # ]: 0 : if ( m_pTabControl )
159 [ # # ][ # # ]: 0 : sText = OutputDevice::GetNonMnemonicString( m_pTabControl->GetPageText( m_nPageId ) );
[ # # ][ # # ]
[ # # ]
160 : :
161 : 0 : return sText;
162 : : }
163 : :
164 : : // -----------------------------------------------------------------------------
165 : :
166 : 0 : void VCLXAccessibleTabPage::Update( bool bNew )
167 : : {
168 [ # # ]: 0 : if ( m_pTabControl )
169 : : {
170 : 0 : TabPage* pTabPage = m_pTabControl->GetTabPage( m_nPageId );
171 [ # # ]: 0 : if ( pTabPage )
172 : : {
173 [ # # ]: 0 : Reference< XAccessible > xChild( pTabPage->GetAccessible( bNew ) );
174 [ # # ]: 0 : if ( xChild.is() )
175 : : {
176 : 0 : Any aOldValue, aNewValue;
177 [ # # ]: 0 : if ( bNew )
178 [ # # ]: 0 : aNewValue <<= xChild;
179 : : else
180 [ # # ]: 0 : aOldValue <<= xChild;
181 [ # # ]: 0 : NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
182 : 0 : }
183 : : }
184 : : }
185 : 0 : }
186 : :
187 : : // -----------------------------------------------------------------------------
188 : :
189 : 0 : void VCLXAccessibleTabPage::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
190 : : {
191 : 0 : rStateSet.AddState( AccessibleStateType::ENABLED );
192 : 0 : rStateSet.AddState( AccessibleStateType::SENSITIVE );
193 : :
194 : 0 : rStateSet.AddState( AccessibleStateType::FOCUSABLE );
195 : :
196 [ # # ]: 0 : if ( IsFocused() )
197 : 0 : rStateSet.AddState( AccessibleStateType::FOCUSED );
198 : :
199 : 0 : rStateSet.AddState( AccessibleStateType::VISIBLE );
200 : :
201 : 0 : rStateSet.AddState( AccessibleStateType::SHOWING );
202 : :
203 : 0 : rStateSet.AddState( AccessibleStateType::SELECTABLE );
204 : :
205 [ # # ]: 0 : if ( IsSelected() )
206 : 0 : rStateSet.AddState( AccessibleStateType::SELECTED );
207 : 0 : }
208 : :
209 : : // -----------------------------------------------------------------------------
210 : : // OCommonAccessibleComponent
211 : : // -----------------------------------------------------------------------------
212 : :
213 : 0 : awt::Rectangle VCLXAccessibleTabPage::implGetBounds() throw (RuntimeException)
214 : : {
215 : 0 : awt::Rectangle aBounds( 0, 0, 0, 0 );
216 : :
217 [ # # ]: 0 : if ( m_pTabControl )
218 [ # # ]: 0 : aBounds = AWTRectangle( m_pTabControl->GetTabBounds( m_nPageId ) );
219 : :
220 : 0 : return aBounds;
221 : : }
222 : :
223 : : // -----------------------------------------------------------------------------
224 : : // OCommonAccessibleText
225 : : // -----------------------------------------------------------------------------
226 : :
227 : 0 : ::rtl::OUString VCLXAccessibleTabPage::implGetText()
228 : : {
229 : 0 : return GetPageText();
230 : : }
231 : :
232 : : // -----------------------------------------------------------------------------
233 : :
234 : 0 : lang::Locale VCLXAccessibleTabPage::implGetLocale()
235 : : {
236 : 0 : return Application::GetSettings().GetLocale();
237 : : }
238 : :
239 : : // -----------------------------------------------------------------------------
240 : :
241 : 0 : void VCLXAccessibleTabPage::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
242 : : {
243 : 0 : nStartIndex = 0;
244 : 0 : nEndIndex = 0;
245 : 0 : }
246 : :
247 : : // -----------------------------------------------------------------------------
248 : : // XInterface
249 : : // -----------------------------------------------------------------------------
250 : :
251 [ # # ][ # # ]: 0 : IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleTabPage, AccessibleTextHelper_BASE, VCLXAccessibleTabPage_BASE )
252 : :
253 : : // -----------------------------------------------------------------------------
254 : : // XTypeProvider
255 : : // -----------------------------------------------------------------------------
256 : :
257 [ # # ][ # # ]: 0 : IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleTabPage, AccessibleTextHelper_BASE, VCLXAccessibleTabPage_BASE )
[ # # ]
258 : :
259 : : // -----------------------------------------------------------------------------
260 : : // XComponent
261 : : // -----------------------------------------------------------------------------
262 : :
263 : 0 : void VCLXAccessibleTabPage::disposing()
264 : : {
265 : 0 : AccessibleTextHelper_BASE::disposing();
266 : :
267 : 0 : m_pTabControl = NULL;
268 : 0 : m_sPageText = ::rtl::OUString();
269 : 0 : }
270 : :
271 : : // -----------------------------------------------------------------------------
272 : : // XServiceInfo
273 : : // -----------------------------------------------------------------------------
274 : :
275 : 0 : ::rtl::OUString VCLXAccessibleTabPage::getImplementationName() throw (RuntimeException)
276 : : {
277 : 0 : return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.AccessibleTabPage" ));
278 : : }
279 : :
280 : : // -----------------------------------------------------------------------------
281 : :
282 : 0 : sal_Bool VCLXAccessibleTabPage::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
283 : : {
284 [ # # ]: 0 : Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
285 : 0 : const ::rtl::OUString* pNames = aNames.getConstArray();
286 : 0 : const ::rtl::OUString* pEnd = pNames + aNames.getLength();
287 [ # # ][ # # ]: 0 : for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
[ # # ]
288 : : ;
289 : :
290 [ # # ]: 0 : return pNames != pEnd;
291 : : }
292 : :
293 : : // -----------------------------------------------------------------------------
294 : :
295 : 0 : Sequence< ::rtl::OUString > VCLXAccessibleTabPage::getSupportedServiceNames() throw (RuntimeException)
296 : : {
297 : 0 : Sequence< ::rtl::OUString > aNames(1);
298 [ # # ][ # # ]: 0 : aNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.AccessibleTabPage" ));
299 : 0 : return aNames;
300 : : }
301 : :
302 : : // -----------------------------------------------------------------------------
303 : : // XAccessible
304 : : // -----------------------------------------------------------------------------
305 : :
306 : 0 : Reference< XAccessibleContext > VCLXAccessibleTabPage::getAccessibleContext( ) throw (RuntimeException)
307 : : {
308 [ # # ]: 0 : OExternalLockGuard aGuard( this );
309 : :
310 [ # # ][ # # ]: 0 : return this;
311 : : }
312 : :
313 : : // -----------------------------------------------------------------------------
314 : : // XAccessibleContext
315 : : // -----------------------------------------------------------------------------
316 : :
317 : 0 : sal_Int32 VCLXAccessibleTabPage::getAccessibleChildCount() throw (RuntimeException)
318 : : {
319 [ # # ]: 0 : OExternalLockGuard aGuard( this );
320 : :
321 : 0 : sal_Int32 nCount = 0;
322 [ # # ]: 0 : if ( m_pTabControl )
323 : : {
324 [ # # ]: 0 : TabPage* pTabPage = m_pTabControl->GetTabPage( m_nPageId );
325 [ # # ][ # # ]: 0 : if ( pTabPage && pTabPage->IsVisible() )
[ # # ][ # # ]
326 : 0 : nCount = 1;
327 : : }
328 : :
329 [ # # ]: 0 : return nCount;
330 : : }
331 : :
332 : : // -----------------------------------------------------------------------------
333 : :
334 : 0 : Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
335 : : {
336 [ # # ]: 0 : OExternalLockGuard aGuard( this );
337 : :
338 [ # # ][ # # ]: 0 : if ( i < 0 || i >= getAccessibleChildCount() )
[ # # ][ # # ]
339 [ # # ]: 0 : throw IndexOutOfBoundsException();
340 : :
341 : 0 : Reference< XAccessible > xChild;
342 [ # # ]: 0 : if ( m_pTabControl )
343 : : {
344 [ # # ]: 0 : TabPage* pTabPage = m_pTabControl->GetTabPage( m_nPageId );
345 [ # # ][ # # ]: 0 : if ( pTabPage && pTabPage->IsVisible() )
[ # # ][ # # ]
346 [ # # ][ # # ]: 0 : xChild = pTabPage->GetAccessible();
347 : : }
348 : :
349 [ # # ]: 0 : return xChild;
350 : : }
351 : :
352 : : // -----------------------------------------------------------------------------
353 : :
354 : 0 : Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleParent( ) throw (RuntimeException)
355 : : {
356 [ # # ]: 0 : OExternalLockGuard aGuard( this );
357 : :
358 : 0 : Reference< XAccessible > xParent;
359 [ # # ]: 0 : if ( m_pTabControl )
360 [ # # ][ # # ]: 0 : xParent = m_pTabControl->GetAccessible();
361 : :
362 [ # # ]: 0 : return xParent;
363 : : }
364 : :
365 : : // -----------------------------------------------------------------------------
366 : :
367 : 0 : sal_Int32 VCLXAccessibleTabPage::getAccessibleIndexInParent( ) throw (RuntimeException)
368 : : {
369 [ # # ]: 0 : OExternalLockGuard aGuard( this );
370 : :
371 : 0 : sal_Int32 nIndexInParent = -1;
372 [ # # ]: 0 : if ( m_pTabControl )
373 [ # # ]: 0 : nIndexInParent = m_pTabControl->GetPagePos( m_nPageId );
374 : :
375 [ # # ]: 0 : return nIndexInParent;
376 : : }
377 : :
378 : : // -----------------------------------------------------------------------------
379 : :
380 : 0 : sal_Int16 VCLXAccessibleTabPage::getAccessibleRole( ) throw (RuntimeException)
381 : : {
382 [ # # ]: 0 : OExternalLockGuard aGuard( this );
383 : :
384 [ # # ]: 0 : return AccessibleRole::PAGE_TAB;
385 : : }
386 : :
387 : : // -----------------------------------------------------------------------------
388 : :
389 : 0 : ::rtl::OUString VCLXAccessibleTabPage::getAccessibleDescription( ) throw (RuntimeException)
390 : : {
391 [ # # ]: 0 : OExternalLockGuard aGuard( this );
392 : :
393 : 0 : ::rtl::OUString sDescription;
394 [ # # ]: 0 : if ( m_pTabControl )
395 [ # # ][ # # ]: 0 : sDescription = m_pTabControl->GetHelpText( m_nPageId );
396 : :
397 [ # # ]: 0 : return sDescription;
398 : : }
399 : :
400 : : // -----------------------------------------------------------------------------
401 : :
402 : 0 : ::rtl::OUString VCLXAccessibleTabPage::getAccessibleName( ) throw (RuntimeException)
403 : : {
404 [ # # ]: 0 : OExternalLockGuard aGuard( this );
405 : :
406 [ # # ][ # # ]: 0 : return GetPageText();
407 : : }
408 : :
409 : : // -----------------------------------------------------------------------------
410 : :
411 : 0 : Reference< XAccessibleRelationSet > VCLXAccessibleTabPage::getAccessibleRelationSet( ) throw (RuntimeException)
412 : : {
413 [ # # ]: 0 : OExternalLockGuard aGuard( this );
414 : :
415 [ # # ]: 0 : utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
416 [ # # ][ # # ]: 0 : Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
417 [ # # ]: 0 : return xSet;
418 : : }
419 : :
420 : : // -----------------------------------------------------------------------------
421 : :
422 : 0 : Reference< XAccessibleStateSet > VCLXAccessibleTabPage::getAccessibleStateSet( ) throw (RuntimeException)
423 : : {
424 [ # # ]: 0 : OExternalLockGuard aGuard( this );
425 : :
426 [ # # ]: 0 : utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
427 [ # # ][ # # ]: 0 : Reference< XAccessibleStateSet > xSet = pStateSetHelper;
428 : :
429 [ # # ][ # # ]: 0 : if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
430 : : {
431 [ # # ]: 0 : FillAccessibleStateSet( *pStateSetHelper );
432 : : }
433 : : else
434 : : {
435 [ # # ]: 0 : pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
436 : : }
437 : :
438 [ # # ]: 0 : return xSet;
439 : : }
440 : :
441 : : // -----------------------------------------------------------------------------
442 : :
443 : 0 : Locale VCLXAccessibleTabPage::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException)
444 : : {
445 [ # # ]: 0 : OExternalLockGuard aGuard( this );
446 : :
447 [ # # ][ # # ]: 0 : return Application::GetSettings().GetLocale();
[ # # ]
448 : : }
449 : :
450 : : // -----------------------------------------------------------------------------
451 : : // XAccessibleComponent
452 : : // -----------------------------------------------------------------------------
453 : :
454 : 0 : Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException)
455 : : {
456 [ # # ]: 0 : OExternalLockGuard aGuard( this );
457 : :
458 : 0 : Reference< XAccessible > xChild;
459 [ # # ][ # # ]: 0 : for ( sal_uInt32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
460 : : {
461 [ # # ]: 0 : Reference< XAccessible > xAcc = getAccessibleChild( i );
462 [ # # ]: 0 : if ( xAcc.is() )
463 : : {
464 [ # # ][ # # ]: 0 : Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY );
[ # # ]
465 [ # # ]: 0 : if ( xComp.is() )
466 : : {
467 [ # # ][ # # ]: 0 : Rectangle aRect = VCLRectangle( xComp->getBounds() );
[ # # ]
468 : 0 : Point aPos = VCLPoint( rPoint );
469 [ # # ][ # # ]: 0 : if ( aRect.IsInside( aPos ) )
470 : : {
471 [ # # ]: 0 : xChild = xAcc;
472 : : break;
473 : : }
474 [ # # ]: 0 : }
475 : : }
476 [ # # ]: 0 : }
477 : :
478 [ # # ]: 0 : return xChild;
479 : : }
480 : :
481 : : // -----------------------------------------------------------------------------
482 : :
483 : 0 : void VCLXAccessibleTabPage::grabFocus( ) throw (RuntimeException)
484 : : {
485 [ # # ]: 0 : OExternalLockGuard aGuard( this );
486 : :
487 [ # # ]: 0 : if ( m_pTabControl )
488 : : {
489 [ # # ]: 0 : m_pTabControl->SelectTabPage( m_nPageId );
490 [ # # ]: 0 : m_pTabControl->GrabFocus();
491 [ # # ]: 0 : }
492 : 0 : }
493 : :
494 : : // -----------------------------------------------------------------------------
495 : :
496 : 0 : sal_Int32 VCLXAccessibleTabPage::getForeground( ) throw (RuntimeException)
497 : : {
498 [ # # ]: 0 : OExternalLockGuard aGuard( this );
499 : :
500 : 0 : sal_Int32 nColor = 0;
501 [ # # ]: 0 : Reference< XAccessible > xParent = getAccessibleParent();
502 [ # # ]: 0 : if ( xParent.is() )
503 : : {
504 [ # # ][ # # ]: 0 : Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
[ # # ]
505 [ # # ]: 0 : if ( xParentComp.is() )
506 [ # # ][ # # ]: 0 : nColor = xParentComp->getForeground();
507 : : }
508 : :
509 [ # # ]: 0 : return nColor;
510 : : }
511 : :
512 : : // -----------------------------------------------------------------------------
513 : :
514 : 0 : sal_Int32 VCLXAccessibleTabPage::getBackground( ) throw (RuntimeException)
515 : : {
516 [ # # ]: 0 : OExternalLockGuard aGuard( this );
517 : :
518 : 0 : sal_Int32 nColor = 0;
519 [ # # ]: 0 : Reference< XAccessible > xParent = getAccessibleParent();
520 [ # # ]: 0 : if ( xParent.is() )
521 : : {
522 [ # # ][ # # ]: 0 : Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
[ # # ]
523 [ # # ]: 0 : if ( xParentComp.is() )
524 [ # # ][ # # ]: 0 : nColor = xParentComp->getBackground();
525 : : }
526 : :
527 [ # # ]: 0 : return nColor;
528 : : }
529 : :
530 : : // -----------------------------------------------------------------------------
531 : : // XAccessibleExtendedComponent
532 : : // -----------------------------------------------------------------------------
533 : :
534 : 0 : Reference< awt::XFont > VCLXAccessibleTabPage::getFont( ) throw (RuntimeException)
535 : : {
536 [ # # ]: 0 : OExternalLockGuard aGuard( this );
537 : :
538 : 0 : Reference< awt::XFont > xFont;
539 [ # # ]: 0 : Reference< XAccessible > xParent = getAccessibleParent();
540 [ # # ]: 0 : if ( xParent.is() )
541 : : {
542 [ # # ][ # # ]: 0 : Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
[ # # ]
543 [ # # ]: 0 : if ( xParentComp.is() )
544 [ # # ][ # # ]: 0 : xFont = xParentComp->getFont();
[ # # ]
545 : : }
546 : :
547 [ # # ]: 0 : return xFont;
548 : : }
549 : :
550 : : // -----------------------------------------------------------------------------
551 : :
552 : 0 : ::rtl::OUString VCLXAccessibleTabPage::getTitledBorderText( ) throw (RuntimeException)
553 : : {
554 [ # # ]: 0 : OExternalLockGuard aGuard( this );
555 : :
556 [ # # ]: 0 : return ::rtl::OUString();
557 : : }
558 : :
559 : : // -----------------------------------------------------------------------------
560 : :
561 : 0 : ::rtl::OUString VCLXAccessibleTabPage::getToolTipText( ) throw (RuntimeException)
562 : : {
563 [ # # ]: 0 : OExternalLockGuard aGuard( this );
564 : :
565 [ # # ]: 0 : return ::rtl::OUString();
566 : : }
567 : :
568 : : // -----------------------------------------------------------------------------
569 : : // XAccessibleText
570 : : // -----------------------------------------------------------------------------
571 : :
572 : 0 : sal_Int32 VCLXAccessibleTabPage::getCaretPosition() throw (RuntimeException)
573 : : {
574 [ # # ]: 0 : OExternalLockGuard aGuard( this );
575 : :
576 [ # # ]: 0 : return -1;
577 : : }
578 : :
579 : : // -----------------------------------------------------------------------------
580 : :
581 : 0 : sal_Bool VCLXAccessibleTabPage::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
582 : : {
583 [ # # ]: 0 : OExternalLockGuard aGuard( this );
584 : :
585 [ # # ][ # # ]: 0 : if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
[ # # ]
586 [ # # ]: 0 : throw IndexOutOfBoundsException();
587 : :
588 [ # # ]: 0 : return sal_False;
589 : : }
590 : :
591 : : // -----------------------------------------------------------------------------
592 : :
593 : 0 : Sequence< PropertyValue > VCLXAccessibleTabPage::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException)
594 : : {
595 [ # # ]: 0 : OExternalLockGuard aGuard( this );
596 : :
597 [ # # ]: 0 : Sequence< PropertyValue > aValues;
598 [ # # ]: 0 : ::rtl::OUString sText( implGetText() );
599 : :
600 [ # # ][ # # ]: 0 : if ( !implIsValidIndex( nIndex, sText.getLength() ) )
601 [ # # ]: 0 : throw IndexOutOfBoundsException();
602 : :
603 [ # # ]: 0 : if ( m_pTabControl )
604 : : {
605 [ # # ]: 0 : Font aFont = m_pTabControl->GetFont();
606 [ # # ]: 0 : sal_Int32 nBackColor = getBackground();
607 [ # # ]: 0 : sal_Int32 nColor = getForeground();
608 [ # # ][ # # ]: 0 : ::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
609 [ # # ][ # # ]: 0 : aValues = pHelper->GetCharacterAttributes( aRequestedAttributes );
[ # # ][ # # ]
[ # # ]
610 : : }
611 : :
612 [ # # ]: 0 : return aValues;
613 : : }
614 : :
615 : : // -----------------------------------------------------------------------------
616 : :
617 : 0 : awt::Rectangle VCLXAccessibleTabPage::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
618 : : {
619 [ # # ]: 0 : OExternalLockGuard aGuard( this );
620 : :
621 [ # # ][ # # ]: 0 : if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
[ # # ]
622 [ # # ]: 0 : throw IndexOutOfBoundsException();
623 : :
624 : 0 : awt::Rectangle aBounds( 0, 0, 0, 0 );
625 [ # # ]: 0 : if ( m_pTabControl )
626 : : {
627 [ # # ]: 0 : Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId );
628 [ # # ]: 0 : Rectangle aCharRect = m_pTabControl->GetCharacterBounds( m_nPageId, nIndex );
629 [ # # ]: 0 : aCharRect.Move( -aPageRect.Left(), -aPageRect.Top() );
630 [ # # ]: 0 : aBounds = AWTRectangle( aCharRect );
631 : : }
632 : :
633 [ # # ]: 0 : return aBounds;
634 : : }
635 : :
636 : : // -----------------------------------------------------------------------------
637 : :
638 : 0 : sal_Int32 VCLXAccessibleTabPage::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
639 : : {
640 [ # # ]: 0 : OExternalLockGuard aGuard( this );
641 : :
642 : 0 : sal_Int32 nIndex = -1;
643 [ # # ]: 0 : if ( m_pTabControl )
644 : : {
645 : 0 : sal_uInt16 nPageId = 0;
646 [ # # ]: 0 : Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId );
647 : 0 : Point aPnt( VCLPoint( aPoint ) );
648 : 0 : aPnt += aPageRect.TopLeft();
649 [ # # ]: 0 : sal_Int32 nI = m_pTabControl->GetIndexForPoint( aPnt, nPageId );
650 [ # # ][ # # ]: 0 : if ( nI != -1 && m_nPageId == nPageId )
651 : 0 : nIndex = nI;
652 : : }
653 : :
654 [ # # ]: 0 : return nIndex;
655 : : }
656 : :
657 : : // -----------------------------------------------------------------------------
658 : :
659 : 0 : sal_Bool VCLXAccessibleTabPage::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
660 : : {
661 [ # # ]: 0 : OExternalLockGuard aGuard( this );
662 : :
663 [ # # ][ # # ]: 0 : if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
[ # # ]
664 [ # # ]: 0 : throw IndexOutOfBoundsException();
665 : :
666 [ # # ]: 0 : return sal_False;
667 : : }
668 : :
669 : : // -----------------------------------------------------------------------------
670 : :
671 : 0 : sal_Bool VCLXAccessibleTabPage::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
672 : : {
673 [ # # ]: 0 : OExternalLockGuard aGuard( this );
674 : :
675 : 0 : sal_Bool bReturn = sal_False;
676 : :
677 [ # # ]: 0 : if ( m_pTabControl )
678 : : {
679 [ # # ]: 0 : Reference< datatransfer::clipboard::XClipboard > xClipboard = m_pTabControl->GetClipboard();
680 [ # # ]: 0 : if ( xClipboard.is() )
681 : : {
682 [ # # ]: 0 : ::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) );
683 : :
684 [ # # ][ # # ]: 0 : ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
[ # # ]
685 [ # # ]: 0 : const sal_uInt32 nRef = Application::ReleaseSolarMutex();
686 [ # # ][ # # ]: 0 : xClipboard->setContents( pDataObj, NULL );
[ # # ][ # # ]
687 : :
688 [ # # ]: 0 : Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
689 [ # # ]: 0 : if( xFlushableClipboard.is() )
690 [ # # ][ # # ]: 0 : xFlushableClipboard->flushClipboard();
691 : :
692 [ # # ]: 0 : Application::AcquireSolarMutex( nRef );
693 : :
694 : 0 : bReturn = sal_True;
695 : 0 : }
696 : : }
697 : :
698 [ # # ]: 0 : return bReturn;
699 : : }
700 : :
701 : : // -----------------------------------------------------------------------------
702 : :
703 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|