Files
libreoffice/accessibility/source/extended/accessibleiconchoicectrl.cxx
Michael Meeks e8b97a52c9 Merge remote-tracking branch 'origin/feature/vclptr'
Resolve several thousand lines of conflicts.

Conflicts:
	accessibility/source/extended/accessiblelistbox.cxx
	accessibility/source/standard/vclxaccessiblecombobox.cxx
	accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
	accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
	accessibility/source/standard/vclxaccessiblelistbox.cxx
	accessibility/source/standard/vclxaccessibletextfield.cxx
	basctl/source/basicide/basidesh.cxx
	cui/source/inc/chardlg.hxx
	cui/source/tabpages/tpbitmap.cxx
	dbaccess/source/ui/dlg/UserAdmin.cxx
	dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
	extensions/source/propctrlr/propertyeditor.hxx
	extensions/source/scanner/sanedlg.cxx
	filter/source/pdf/impdialog.cxx
	include/sfx2/mgetempl.hxx
	include/sfx2/sidebar/SidebarToolBox.hxx
	include/sfx2/viewsh.hxx
	include/svtools/brwbox.hxx
	include/svtools/filectrl.hxx
	include/svtools/scrwin.hxx
	include/svx/dlgctrl.hxx
	include/svx/sidebar/Popup.hxx
	include/svx/sidebar/PopupContainer.hxx
	include/svx/sidebar/PopupControl.hxx
	include/svx/sidebar/SidebarDialControl.hxx
	include/svx/sidebar/ValueSetWithTextControl.hxx
	sc/source/ui/condformat/condformatdlgentry.cxx
	sc/source/ui/navipi/navipi.cxx
	sc/source/ui/sidebar/CellBorderStyleControl.hxx
	sd/source/ui/animations/CustomAnimationDialog.cxx
	sd/source/ui/inc/DrawViewShell.hxx
	sd/source/ui/inc/Ruler.hxx
	sd/source/ui/inc/SlideSorter.hxx
	sd/source/ui/inc/ViewTabBar.hxx
	sd/source/ui/inc/Window.hxx
	sd/source/ui/inc/morphdlg.hxx
	sd/source/ui/inc/sdpreslt.hxx
	sd/source/ui/sidebar/CurrentMasterPagesSelector.hxx
	sd/source/ui/sidebar/LayoutMenu.hxx
	sd/source/ui/sidebar/MasterPagesSelector.hxx
	sd/source/ui/sidebar/NavigatorWrapper.hxx
	sd/source/ui/sidebar/PanelBase.hxx
	sd/source/ui/sidebar/RecentMasterPagesSelector.cxx
	sd/source/ui/sidebar/RecentMasterPagesSelector.hxx
	sd/source/ui/slideshow/showwindow.hxx
	sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
	sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
	sd/source/ui/view/ViewShellBase.cxx
	sd/source/ui/view/drviewsa.cxx
	sfx2/source/appl/fileobj.hxx
	sfx2/source/appl/opengrf.cxx
	sfx2/source/control/thumbnailviewacc.hxx
	sfx2/source/dialog/securitypage.cxx
	sfx2/source/dialog/templdlg.cxx
	sfx2/source/doc/docinsert.cxx
	sfx2/source/doc/guisaveas.cxx
	sfx2/source/inc/alienwarn.hxx
	sfx2/source/sidebar/Deck.cxx
	sfx2/source/sidebar/Deck.hxx
	sfx2/source/sidebar/DeckTitleBar.cxx
	sfx2/source/sidebar/DeckTitleBar.hxx
	sfx2/source/sidebar/MenuButton.cxx
	sfx2/source/sidebar/MenuButton.hxx
	sfx2/source/sidebar/Panel.cxx
	sfx2/source/sidebar/Panel.hxx
	sfx2/source/sidebar/PanelTitleBar.hxx
	sfx2/source/sidebar/SidebarDockingWindow.hxx
	sfx2/source/sidebar/SidebarToolBox.cxx
	sfx2/source/sidebar/TabBar.hxx
	sfx2/source/sidebar/TabItem.cxx
	sfx2/source/sidebar/TabItem.hxx
	sfx2/source/sidebar/TitleBar.hxx
	sfx2/source/toolbox/imgmgr.cxx
	starmath/inc/edit.hxx
	starmath/inc/smmod.hxx
	starmath/qa/cppunit/test_starmath.cxx
	starmath/source/edit.cxx
	starmath/source/smmod.cxx
	svtools/source/brwbox/brwbox1.cxx
	svtools/source/brwbox/datwin.hxx
	svtools/source/contnr/fileview.cxx
	svtools/source/contnr/simptabl.cxx
	svtools/source/control/filectrl.cxx
	svtools/source/control/valueimp.hxx
	svx/inc/GalleryControl.hxx
	svx/source/dialog/dlgctrl.cxx
	svx/source/dialog/swframeexample.cxx
	svx/source/fmcomp/fmgridif.cxx
	svx/source/gallery2/GalleryControl.cxx
	svx/source/sidebar/EmptyPanel.hxx
	svx/source/sidebar/area/AreaPropertyPanel.hxx
	svx/source/sidebar/area/AreaTransparencyGradientControl.hxx
	svx/source/sidebar/graphic/GraphicPropertyPanel.hxx
	svx/source/sidebar/insert/InsertPropertyPanel.cxx
	svx/source/sidebar/insert/InsertPropertyPanel.hxx
	svx/source/sidebar/line/LinePropertyPanel.hxx
	svx/source/sidebar/line/LineWidthControl.cxx
	svx/source/sidebar/line/LineWidthControl.hxx
	svx/source/sidebar/line/LineWidthValueSet.hxx
	svx/source/sidebar/paragraph/ParaPropertyPanel.hxx
	svx/source/sidebar/possize/SidebarDialControl.cxx
	svx/source/sidebar/text/TextCharacterSpacingPopup.hxx
	svx/source/sidebar/text/TextPropertyPanel.hxx
	svx/source/sidebar/tools/PopupContainer.cxx
	svx/source/sidebar/tools/PopupControl.cxx
	svx/source/sidebar/tools/ValueSetWithTextControl.cxx
	svx/source/svdraw/svdfmtf.hxx
	svx/source/svdraw/svdibrow.cxx
	svx/source/tbxctrls/colrctrl.cxx
	svx/source/tbxctrls/tbcontrl.cxx
	sw/source/ui/dbui/mmaddressblockpage.cxx
	sw/source/ui/dialog/uiregionsw.cxx
	sw/source/ui/index/cnttab.cxx
	sw/source/uibase/inc/drpcps.hxx
	sw/source/uibase/sidebar/PageColumnControl.hxx
	sw/source/uibase/sidebar/PageMarginControl.hxx
	sw/source/uibase/sidebar/PageOrientationControl.hxx
	sw/source/uibase/sidebar/PagePropertyPanel.hxx
	sw/source/uibase/sidebar/PageSizeControl.hxx
	sw/source/uibase/uiview/view2.cxx
	sw/source/uibase/utlui/navipi.cxx
	vcl/inc/svdata.hxx
	vcl/source/control/combobox.cxx
	vcl/source/control/lstbox.cxx
	vcl/source/window/dockwin.cxx
	vcl/source/window/winproc.cxx

Change-Id: I056cf3026ff17d65cca0b6e6588bda4a88fa8d95
2015-04-28 15:08:48 +01:00

379 lines
14 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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 .
*/
#include "accessibility/extended/accessibleiconchoicectrl.hxx"
#include "accessibility/extended/accessibleiconchoicectrlentry.hxx"
#include <svtools/ivctrl.hxx>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <unotools/accessiblestatesethelper.hxx>
#include <vcl/svapp.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/typeprovider.hxx>
namespace accessibility
{
// class AccessibleIconChoiceCtrl ----------------------------------------------
using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star;
// Ctor() and Dtor()
AccessibleIconChoiceCtrl::AccessibleIconChoiceCtrl( SvtIconChoiceCtrl& _rIconCtrl, const Reference< XAccessible >& _xParent ) :
VCLXAccessibleComponent( _rIconCtrl.GetWindowPeer() ),
m_xParent ( _xParent )
{
}
AccessibleIconChoiceCtrl::~AccessibleIconChoiceCtrl()
{
}
IMPLEMENT_FORWARD_XINTERFACE2(AccessibleIconChoiceCtrl, VCLXAccessibleComponent, AccessibleIconChoiceCtrl_BASE)
IMPLEMENT_FORWARD_XTYPEPROVIDER2(AccessibleIconChoiceCtrl, VCLXAccessibleComponent, AccessibleIconChoiceCtrl_BASE)
void AccessibleIconChoiceCtrl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
{
if ( isAlive() )
{
switch ( rVclWindowEvent.GetId() )
{
case VCLEVENT_LISTBOX_SELECT :
{
// First send an event that tells the listeners of a
// modified selection. The active descendant event is
// send after that so that the receiving AT has time to
// read the text or name of the active child.
// NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
if ( getCtrl() && getCtrl()->HasFocus() )
{
SvxIconChoiceCtrlEntry* pEntry = static_cast< SvxIconChoiceCtrlEntry* >( rVclWindowEvent.GetData() );
if ( pEntry )
{
sal_uLong nPos = getCtrl()->GetEntryListPos( pEntry );
Reference< XAccessible > xChild = new AccessibleIconChoiceCtrlEntry( *getCtrl(), nPos, this );
uno::Any aOldValue, aNewValue;
aNewValue <<= xChild;
NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, aOldValue, aNewValue );
}
}
break;
}
case VCLEVENT_WINDOW_GETFOCUS :
{
SvtIconChoiceCtrl* pCtrl = getCtrl();
if ( pCtrl && pCtrl->HasFocus() )
{
SvxIconChoiceCtrlEntry* pEntry = static_cast< SvxIconChoiceCtrlEntry* >( rVclWindowEvent.GetData() );
if ( pEntry == NULL )
{
sal_uLong nPos=0;
pEntry = getCtrl()->GetSelectedEntry ( nPos );
}
if ( pEntry )
{
sal_uLong nPos = pCtrl->GetEntryListPos( pEntry );
Reference< XAccessible > xChild = new AccessibleIconChoiceCtrlEntry( *pCtrl, nPos, this );
uno::Any aOldValue, aNewValue;
aNewValue <<= xChild;
NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, aOldValue, aNewValue );
}
}
break;
}
default:
VCLXAccessibleComponent::ProcessWindowChildEvent (rVclWindowEvent);
}
}
}
// XComponent
void SAL_CALL AccessibleIconChoiceCtrl::disposing()
{
::osl::MutexGuard aGuard( m_aMutex );
m_xParent = NULL;
}
// XServiceInfo
OUString SAL_CALL AccessibleIconChoiceCtrl::getImplementationName() throw (RuntimeException, std::exception)
{
return getImplementationName_Static();
}
Sequence< OUString > SAL_CALL AccessibleIconChoiceCtrl::getSupportedServiceNames() throw (RuntimeException, std::exception)
{
return getSupportedServiceNames_Static();
}
sal_Bool SAL_CALL AccessibleIconChoiceCtrl::supportsService( const OUString& _rServiceName ) throw (RuntimeException, std::exception)
{
return cppu::supportsService(this, _rServiceName);
}
// XServiceInfo - static methods
Sequence< OUString > AccessibleIconChoiceCtrl::getSupportedServiceNames_Static() throw (RuntimeException)
{
Sequence< OUString > aSupported(3);
aSupported[0] = "com.sun.star.accessibility.AccessibleContext";
aSupported[1] = "com.sun.star.accessibility.AccessibleComponent";
aSupported[2] = "com.sun.star.awt.AccessibleIconChoiceControl";
return aSupported;
}
OUString AccessibleIconChoiceCtrl::getImplementationName_Static() throw (RuntimeException)
{
return OUString( "com.sun.star.comp.svtools.AccessibleIconChoiceControl" );
}
// XAccessible
Reference< XAccessibleContext > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleContext( ) throw (RuntimeException, std::exception)
{
ensureAlive();
return this;
}
// XAccessibleContext
sal_Int32 SAL_CALL AccessibleIconChoiceCtrl::getAccessibleChildCount( ) throw (RuntimeException, std::exception)
{
::comphelper::OExternalLockGuard aGuard( this );
ensureAlive();
return getCtrl()->GetEntryCount();
}
Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleChild( sal_Int32 i ) throw (RuntimeException, IndexOutOfBoundsException, std::exception)
{
::comphelper::OExternalLockGuard aGuard( this );
ensureAlive();
SvtIconChoiceCtrl* pCtrl = getCtrl();
SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry(i);
if ( !pEntry )
throw RuntimeException();
return new AccessibleIconChoiceCtrlEntry( *pCtrl, i, this );
}
Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleParent( ) throw (RuntimeException, std::exception)
{
::osl::MutexGuard aGuard( m_aMutex );
ensureAlive();
return m_xParent;
}
sal_Int16 SAL_CALL AccessibleIconChoiceCtrl::getAccessibleRole( ) throw (RuntimeException, std::exception)
{
//return AccessibleRole::TREE;
return AccessibleRole::LIST;
}
OUString SAL_CALL AccessibleIconChoiceCtrl::getAccessibleDescription( ) throw (RuntimeException, std::exception)
{
::comphelper::OExternalLockGuard aGuard( this );
ensureAlive();
return getCtrl()->GetAccessibleDescription();
}
OUString SAL_CALL AccessibleIconChoiceCtrl::getAccessibleName( ) throw (RuntimeException, std::exception)
{
::comphelper::OExternalLockGuard aGuard( this );
ensureAlive();
OUString sName = getCtrl()->GetAccessibleName();
if ( sName.isEmpty() )
sName = "IconChoiceControl";
return sName;
}
// XAccessibleSelection
void SAL_CALL AccessibleIconChoiceCtrl::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
{
::comphelper::OExternalLockGuard aGuard( this );
ensureAlive();
SvtIconChoiceCtrl* pCtrl = getCtrl();
SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( nChildIndex );
if ( !pEntry )
throw IndexOutOfBoundsException();
pCtrl->SetCursor( pEntry );
}
sal_Bool SAL_CALL AccessibleIconChoiceCtrl::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
{
::comphelper::OExternalLockGuard aGuard( this );
ensureAlive();
SvtIconChoiceCtrl* pCtrl = getCtrl();
SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( nChildIndex );
if ( !pEntry )
throw IndexOutOfBoundsException();
return ( pCtrl->GetCursor() == pEntry );
}
void SAL_CALL AccessibleIconChoiceCtrl::clearAccessibleSelection( ) throw (RuntimeException, std::exception)
{
::comphelper::OExternalLockGuard aGuard( this );
ensureAlive();
getCtrl()->SetNoSelection();
}
void SAL_CALL AccessibleIconChoiceCtrl::selectAllAccessibleChildren( ) throw (RuntimeException, std::exception)
{
::comphelper::OExternalLockGuard aGuard( this );
ensureAlive();
SvtIconChoiceCtrl* pCtrl = getCtrl();
sal_Int32 nCount = pCtrl->GetEntryCount();
for ( sal_Int32 i = 0; i < nCount; ++i )
{
SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( i );
if ( pCtrl->GetCursor() != pEntry )
pCtrl->SetCursor( pEntry );
}
}
sal_Int32 SAL_CALL AccessibleIconChoiceCtrl::getSelectedAccessibleChildCount( ) throw (RuntimeException, std::exception)
{
::comphelper::OExternalLockGuard aGuard( this );
ensureAlive();
sal_Int32 nSelCount = 0;
SvtIconChoiceCtrl* pCtrl = getCtrl();
sal_Int32 nCount = pCtrl->GetEntryCount();
for ( sal_Int32 i = 0; i < nCount; ++i )
{
SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( i );
if ( pCtrl->GetCursor() == pEntry )
++nSelCount;
}
return nSelCount;
}
Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
{
::comphelper::OExternalLockGuard aGuard( this );
ensureAlive();
if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
throw IndexOutOfBoundsException();
Reference< XAccessible > xChild;
sal_Int32 nSelCount = 0;
SvtIconChoiceCtrl* pCtrl = getCtrl();
sal_Int32 nCount = pCtrl->GetEntryCount();
for ( sal_Int32 i = 0; i < nCount; ++i )
{
SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( i );
if ( pCtrl->GetCursor() == pEntry )
++nSelCount;
if ( nSelCount == ( nSelectedChildIndex + 1 ) )
{
xChild = new AccessibleIconChoiceCtrlEntry( *pCtrl, i, this );
break;
}
}
return xChild;
}
void SAL_CALL AccessibleIconChoiceCtrl::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException, std::exception)
{
::comphelper::OExternalLockGuard aGuard( this );
ensureAlive();
if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getAccessibleChildCount() )
throw IndexOutOfBoundsException();
Reference< XAccessible > xChild;
sal_Int32 nSelCount = 0;
SvtIconChoiceCtrl* pCtrl = getCtrl();
sal_Int32 nCount = pCtrl->GetEntryCount();
bool bFound = false;
for ( sal_Int32 i = 0; i < nCount; ++i )
{
SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( i );
if ( pEntry->IsSelected() )
{
++nSelCount;
if ( i == nSelectedChildIndex )
bFound = true;
}
}
// if only one entry is selected and its index is chosen to deselect -> no selection anymore
if ( 1 == nSelCount && bFound )
pCtrl->SetNoSelection();
}
void AccessibleIconChoiceCtrl::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
{
VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
if ( isAlive() )
{
rStateSet.AddState( AccessibleStateType::FOCUSABLE );
rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
rStateSet.AddState( AccessibleStateType::SELECTABLE );
}
}
VclPtr< SvtIconChoiceCtrl > AccessibleIconChoiceCtrl::getCtrl()
{
return GetAs<SvtIconChoiceCtrl >();
}
}// namespace accessibility
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */