diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2007-06-27 14:30:48 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2007-06-27 14:30:48 +0000 |
commit | 74c4343dbb18afc41922ca818cfa4dc81eee33c7 (patch) | |
tree | c1932ecd732b3949455c26da93419ac9ddf21e35 /accessibility | |
parent | cbb97af2e63ab9d3f8dd2031b32e8568f0c0188b (diff) |
INTEGRATION: CWS a11ysep (1.1.2); FILE ADDED
2007/02/28 07:26:16 fs 1.1.2.5: #i10000#
2006/10/05 19:33:54 fs 1.1.2.4: #i10000# post-resync
2006/10/04 19:58:01 fs 1.1.2.3: MANUAL RESYNC m130->m185:
file was changed in MWS, but has been moved herein in CWS
2005/09/28 11:36:24 fs 1.1.2.2: manual resync (files have been moved herein from another location): licence change
2005/03/07 08:29:14 fs 1.1.2.1: #i44293# moved implementations herein from svtools module
Diffstat (limited to 'accessibility')
-rw-r--r-- | accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx | 188 |
1 files changed, 188 insertions, 0 deletions
diff --git a/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx new file mode 100644 index 000000000000..05a54f8d8c94 --- /dev/null +++ b/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx @@ -0,0 +1,188 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AccessibleBrowseBoxCheckBoxCell.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: hr $ $Date: 2007-06-27 15:30:48 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_accessibility.hxx" + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXCHECKBOXCELL_HXX +#include <accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx> +#endif +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_ +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#endif + +#ifndef _SVTOOLS_ACCESSIBLETABLEPROVIDER_HXX +#include <svtools/accessibletableprovider.hxx> +#endif + +namespace accessibility +{ + using namespace com::sun::star::accessibility; + using namespace com::sun::star::uno; + using namespace com::sun::star::accessibility::AccessibleEventId; + using namespace ::svt; + + AccessibleCheckBoxCell::AccessibleCheckBoxCell(const Reference<XAccessible >& _rxParent, + IAccessibleTableProvider& _rBrowseBox, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos + ,const TriState& _eState, + sal_Bool _bEnabled, + sal_Bool _bIsTriState) + :AccessibleBrowseBoxCell(_rxParent, _rBrowseBox, _xFocusWindow, _nRowPos, _nColPos, BBTYPE_CHECKBOXCELL) + ,m_eState(_eState) + ,m_bEnabled(_bEnabled) + ,m_bIsTriState(_bIsTriState) + { + } + // ----------------------------------------------------------------------------- + IMPLEMENT_FORWARD_XINTERFACE2( AccessibleCheckBoxCell, AccessibleBrowseBoxCell, AccessibleCheckBoxCell_BASE ) + // ----------------------------------------------------------------------------- + IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleCheckBoxCell, AccessibleBrowseBoxCell, AccessibleCheckBoxCell_BASE ) + //-------------------------------------------------------------------- + Reference< XAccessibleContext > SAL_CALL AccessibleCheckBoxCell::getAccessibleContext( ) throw (RuntimeException) + { + ensureIsAlive(); + return this; + } + // ----------------------------------------------------------------------------- + ::utl::AccessibleStateSetHelper* AccessibleCheckBoxCell::implCreateStateSetHelper() + { + ::utl::AccessibleStateSetHelper* pStateSetHelper = + AccessibleBrowseBoxCell::implCreateStateSetHelper(); + if( isAlive() ) + { + mpBrowseBox->FillAccessibleStateSetForCell( + *pStateSetHelper, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) ); + if ( m_eState == STATE_CHECK ) + pStateSetHelper->AddState( AccessibleStateType::CHECKED ); + } + return pStateSetHelper; + } + // ----------------------------------------------------------------------------- + // ----------------------------------------------------------------------------- + // XAccessibleValue + // ----------------------------------------------------------------------------- + + Any SAL_CALL AccessibleCheckBoxCell::getCurrentValue( ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( getOslMutex() ); + + sal_Int32 nValue = 0; + switch( m_eState ) + { + case STATE_NOCHECK: + nValue = 0; + break; + case STATE_CHECK: + nValue = 1; + break; + case STATE_DONTKNOW: + nValue = 2; + break; + } + return makeAny(nValue); + } + + // ----------------------------------------------------------------------------- + + sal_Bool SAL_CALL AccessibleCheckBoxCell::setCurrentValue( const Any& ) throw (RuntimeException) + { + return sal_False; + } + + // ----------------------------------------------------------------------------- + + Any SAL_CALL AccessibleCheckBoxCell::getMaximumValue( ) throw (RuntimeException) + { + ::osl::MutexGuard aGuard( getOslMutex() ); + + Any aValue; + + if ( m_bIsTriState ) + aValue <<= (sal_Int32) 2; + else + aValue <<= (sal_Int32) 1; + + return aValue; + } + + // ----------------------------------------------------------------------------- + + Any SAL_CALL AccessibleCheckBoxCell::getMinimumValue( ) throw (RuntimeException) + { + Any aValue; + aValue <<= (sal_Int32) 0; + + return aValue; + } + // ----------------------------------------------------------------------------- + // XAccessibleContext + sal_Int32 SAL_CALL AccessibleCheckBoxCell::getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException) + { + return 0; + } + // ----------------------------------------------------------------------------- + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL AccessibleCheckBoxCell::getAccessibleChild( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) + { + throw ::com::sun::star::lang::IndexOutOfBoundsException(); + } + // ----------------------------------------------------------------------------- + ::rtl::OUString SAL_CALL AccessibleCheckBoxCell::getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ) + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.TableCheckBoxCell" ) ); + } + // ----------------------------------------------------------------------------- + sal_Int32 SAL_CALL AccessibleCheckBoxCell::getAccessibleIndexInParent() + throw ( ::com::sun::star::uno::RuntimeException ) + { + ::osl::MutexGuard aGuard( getOslMutex() ); + + return ( getRowPos() * mpBrowseBox->GetColumnCount() ) + getColumnPos(); + } + // ----------------------------------------------------------------------------- + void AccessibleCheckBoxCell::SetChecked( sal_Bool _bChecked ) + { + m_eState = _bChecked ? STATE_CHECK : STATE_NOCHECK; + Any aOldValue, aNewValue; + if ( _bChecked ) + aNewValue <<= AccessibleStateType::CHECKED; + else + aOldValue <<= AccessibleStateType::CHECKED; + commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue ); + } +} + |