LCOV - code coverage report
Current view: top level - libreoffice/accessibility/source/standard - vclxaccessibletabpage.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 290 0.0 %
Date: 2012-12-17 Functions: 0 49 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10