2014-04-24 04:21:14 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2013-11-25 16:15:58 +00:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2014-05-06 15:29:12 +03:00
|
|
|
#include <vclxaccessibleheaderbaritem.hxx>
|
2013-11-25 16:15:58 +00:00
|
|
|
|
|
|
|
#include <svtools/headbar.hxx>
|
|
|
|
|
|
|
|
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
|
|
|
|
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
|
|
|
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
|
2014-01-14 12:03:59 -02:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2013-11-25 16:15:58 +00:00
|
|
|
|
|
|
|
#include <unotools/accessiblestatesethelper.hxx>
|
|
|
|
#include <unotools/accessiblerelationsethelper.hxx>
|
|
|
|
#include <vcl/svapp.hxx>
|
2014-01-02 23:52:37 +01:00
|
|
|
#include <vcl/settings.hxx>
|
2013-11-25 16:15:58 +00:00
|
|
|
#include <toolkit/awt/vclxfont.hxx>
|
|
|
|
#include <toolkit/helper/externallock.hxx>
|
|
|
|
#include <toolkit/helper/convert.hxx>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::accessibility;
|
|
|
|
using namespace ::comphelper;
|
|
|
|
|
|
|
|
|
2014-02-25 20:45:41 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
// class AccessibleTabBar
|
2014-02-25 20:45:41 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
|
|
|
VCLXAccessibleHeaderBarItem::VCLXAccessibleHeaderBarItem( HeaderBar* pHeadBar, sal_Int32 _nIndexInParent )
|
|
|
|
:AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() )
|
|
|
|
,m_pHeadBar( pHeadBar )
|
|
|
|
,m_nIndexInParent(_nIndexInParent + 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() );
|
|
|
|
}
|
|
|
|
|
|
|
|
VCLXAccessibleHeaderBarItem::~VCLXAccessibleHeaderBarItem()
|
|
|
|
{
|
|
|
|
delete m_pExternalLock;
|
|
|
|
m_pExternalLock = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void VCLXAccessibleHeaderBarItem::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
|
|
|
|
{
|
|
|
|
if ( m_pHeadBar )
|
|
|
|
{
|
|
|
|
if ( m_pHeadBar->IsEnabled() )
|
|
|
|
rStateSet.AddState( AccessibleStateType::ENABLED );
|
|
|
|
|
|
|
|
if ( m_pHeadBar->IsVisible() )
|
|
|
|
{
|
|
|
|
rStateSet.AddState( AccessibleStateType::VISIBLE );
|
|
|
|
}
|
|
|
|
rStateSet.AddState( AccessibleStateType::SELECTABLE );
|
|
|
|
rStateSet.AddState( AccessibleStateType::RESIZABLE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// OCommonAccessibleComponent
|
|
|
|
awt::Rectangle VCLXAccessibleHeaderBarItem::implGetBounds() throw (RuntimeException)
|
|
|
|
{
|
|
|
|
awt::Rectangle aBounds;
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
::com::sun::star::awt::Size aSize;
|
|
|
|
|
|
|
|
if ( m_pHeadBar )
|
|
|
|
aBounds = AWTRectangle( m_pHeadBar->GetItemRect( sal_uInt16( m_nIndexInParent ) ) );
|
|
|
|
|
|
|
|
return aBounds;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
// XInterface
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
|
|
|
IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleHeaderBarItem, AccessibleExtendedComponentHelper_BASE, VCLXAccessibleHeaderBarItem_BASE )
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
// XTypeProvider
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
|
|
|
IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleHeaderBarItem, AccessibleExtendedComponentHelper_BASE, VCLXAccessibleHeaderBarItem_BASE )
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
// XComponent
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
|
|
|
void VCLXAccessibleHeaderBarItem::disposing()
|
|
|
|
{
|
|
|
|
AccessibleExtendedComponentHelper_BASE::disposing();
|
|
|
|
}
|
|
|
|
|
|
|
|
// XServiceInfo
|
2014-02-25 21:31:58 +01:00
|
|
|
OUString VCLXAccessibleHeaderBarItem::getImplementationName() throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
return OUString("com.sun.star.comp.svtools.AccessibleHeaderBarItem");
|
|
|
|
}
|
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool VCLXAccessibleHeaderBarItem::supportsService( const OUString& rServiceName ) throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
2014-01-14 12:03:59 -02:00
|
|
|
return cppu::supportsService( this, rServiceName );
|
2013-11-25 16:15:58 +00:00
|
|
|
}
|
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Sequence< OUString > VCLXAccessibleHeaderBarItem::getSupportedServiceNames() throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
Sequence< OUString > aNames(1);
|
2014-12-18 13:33:54 +01:00
|
|
|
aNames[0] = "com.sun.star.awt.AccessibleHeaderBarItem";
|
2013-11-25 16:15:58 +00:00
|
|
|
return aNames;
|
|
|
|
}
|
|
|
|
|
|
|
|
// XAccessible
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< XAccessibleContext > VCLXAccessibleHeaderBarItem::getAccessibleContext() throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
// XAccessibleContext
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Int32 VCLXAccessibleHeaderBarItem::getAccessibleChildCount() throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
if ( i < 0 || i >= getAccessibleChildCount() )
|
|
|
|
throw IndexOutOfBoundsException();
|
|
|
|
|
|
|
|
return Reference< XAccessible >();
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleParent() throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
Reference< XAccessible > xParent;
|
|
|
|
if ( m_pHeadBar )
|
|
|
|
{
|
|
|
|
xParent = m_pHeadBar->GetAccessible();
|
|
|
|
}
|
|
|
|
|
|
|
|
return xParent;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Int32 VCLXAccessibleHeaderBarItem::getAccessibleIndexInParent() throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
return m_nIndexInParent - 1;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Int16 VCLXAccessibleHeaderBarItem::getAccessibleRole() throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
return AccessibleRole::COLUMN_HEADER;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
OUString VCLXAccessibleHeaderBarItem::getAccessibleDescription() throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
OUString sDescription;
|
|
|
|
return sDescription;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
OUString VCLXAccessibleHeaderBarItem::getAccessibleName() throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
OUString sName;
|
|
|
|
if(m_pHeadBar)
|
|
|
|
sName = m_pHeadBar->GetItemText( sal_uInt16( m_nIndexInParent ) );
|
|
|
|
return sName;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< XAccessibleRelationSet > VCLXAccessibleHeaderBarItem::getAccessibleRelationSet( ) throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
|
|
|
|
Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
|
|
|
|
return xSet;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< XAccessibleStateSet > VCLXAccessibleHeaderBarItem::getAccessibleStateSet( ) throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
|
|
|
|
Reference< XAccessibleStateSet > xSet = pStateSetHelper;
|
|
|
|
|
|
|
|
if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
|
|
|
|
{
|
|
|
|
FillAccessibleStateSet( *pStateSetHelper );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
|
|
|
|
}
|
|
|
|
|
|
|
|
return xSet;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
com::sun::star::lang::Locale VCLXAccessibleHeaderBarItem::getLocale() throw (IllegalAccessibleComponentStateException, RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
return Application::GetSettings().GetLanguageTag().getLocale();
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
// XAccessibleComponent
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
return Reference< XAccessible >();
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Int32 VCLXAccessibleHeaderBarItem::getForeground() throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
sal_Int32 nColor = 0;
|
|
|
|
return nColor;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Int32 VCLXAccessibleHeaderBarItem::getBackground() throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
sal_Int32 nColor = 0;
|
|
|
|
return nColor;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
// XAccessibleExtendedComponent
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
Reference< awt::XFont > VCLXAccessibleHeaderBarItem::getFont() throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
Reference< awt::XFont > xFont;
|
|
|
|
return xFont;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
OUString VCLXAccessibleHeaderBarItem::getTitledBorderText() throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
OUString sText;
|
|
|
|
return sText;
|
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2013-11-25 16:15:58 +00:00
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
OUString VCLXAccessibleHeaderBarItem::getToolTipText() throw (RuntimeException, std::exception)
|
2013-11-25 16:15:58 +00:00
|
|
|
{
|
|
|
|
OExternalLockGuard aGuard( this );
|
|
|
|
|
|
|
|
OUString sText;
|
|
|
|
if ( m_pHeadBar )
|
|
|
|
sText = m_pHeadBar->GetQuickHelpText();
|
|
|
|
|
|
|
|
return sText;
|
|
|
|
}
|
2014-04-24 04:21:14 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|