summaryrefslogtreecommitdiff
path: root/accessibility/source
diff options
context:
space:
mode:
authorMihaela Kedikova <misheto@openoffice.org>2009-10-30 13:21:18 +0000
committerMihaela Kedikova <misheto@openoffice.org>2009-10-30 13:21:18 +0000
commitf77062f8e05fbcbf6d51436cca2f0e9ca49a0932 (patch)
tree2c31fbfc38dceba5c796f52330034eb8222ad3ce /accessibility/source
parent9af6f6a5b1b86dd39da0ed3031d73496d23f4efd (diff)
fixes for i106470
Diffstat (limited to 'accessibility/source')
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControl.cxx391
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControlBase.cxx551
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControlHeader.cxx321
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControlHeaderCell.cxx173
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControlTable.cxx413
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControlTableBase.cxx318
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControlTableCell.cxx380
-rw-r--r--accessibility/source/extended/makefile.mk9
-rw-r--r--accessibility/source/helper/acc_factory.cxx40
9 files changed, 2595 insertions, 1 deletions
diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx
new file mode 100755
index 000000000000..d10ebee376f9
--- /dev/null
+++ b/accessibility/source/extended/AccessibleGridControl.cxx
@@ -0,0 +1,391 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleGridControl.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include "accessibility/extended/AccessibleGridControl.hxx"
+#include "accessibility/extended/AccessibleGridControlTable.hxx"
+#include "accessibility/extended/AccessibleGridControlHeader.hxx"
+#include <svtools/accessibletable.hxx>
+#include <comphelper/types.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+//#include "svtools/table/tablecontrol.hxx"
+
+// ============================================================================
+
+namespace accessibility
+{
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+using namespace ::svt;
+using namespace ::svt::table;
+
+// ============================================================================
+class AccessibleGridControl_Impl
+{
+public:
+ /// the XAccessible which created the AccessibleGridControl
+ WeakReference< XAccessible > m_aCreator;
+
+ /** The data table child. */
+ Reference<
+ ::com::sun::star::accessibility::XAccessible > m_xTable;
+ AccessibleGridControlTable* m_pTable;
+
+ /** The header bar for rows. */
+ Reference<
+ ::com::sun::star::accessibility::XAccessible > m_xRowHeaderBar;
+ AccessibleGridControlHeader* m_pRowHeaderBar;
+
+ /** The header bar for columns (first row of the table). */
+ Reference<
+ ::com::sun::star::accessibility::XAccessible > m_xColumnHeaderBar;
+ AccessibleGridControlHeader* m_pColumnHeaderBar;
+};
+
+// Ctor/Dtor/disposing --------------------------------------------------------
+
+DBG_NAME( AccessibleGridControl )
+
+AccessibleGridControl::AccessibleGridControl(
+ const Reference< XAccessible >& _rxParent, const Reference< XAccessible >& _rxCreator,
+ IAccessibleTable& _rTable )
+ : AccessibleGridControlBase( _rxParent, _rTable, TCTYPE_GRIDCONTROL )
+{
+ DBG_CTOR( AccessibleTableControl, NULL );
+ m_pImpl.reset( new AccessibleGridControl_Impl() );
+ m_pImpl->m_aCreator = _rxCreator;
+}
+// -----------------------------------------------------------------------------
+void AccessibleGridControl::setCreator( const Reference< XAccessible >& _rxCreator )
+{
+#if OSL_DEBUG_LEVEL > 0
+ Reference< XAccessible > xCreator = (Reference< XAccessible >)m_pImpl->m_aCreator;
+ DBG_ASSERT( !xCreator.is(), "accessibility/extended/AccessibleGridControl::setCreator: creator already set!" );
+#endif
+ m_pImpl->m_aCreator = _rxCreator;
+}
+
+// -----------------------------------------------------------------------------
+AccessibleGridControl::~AccessibleGridControl()
+{
+ DBG_DTOR( AccessibleGridControl, NULL );
+}
+// -----------------------------------------------------------------------------
+
+void SAL_CALL AccessibleGridControl::disposing()
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ m_pImpl->m_pTable = NULL;
+ m_pImpl->m_pColumnHeaderBar = NULL;
+ m_pImpl->m_pRowHeaderBar = NULL;
+ m_pImpl->m_aCreator = Reference< XAccessible >();
+
+ Reference< XAccessible > xTable = m_pImpl->m_xTable;
+
+ Reference< XComponent > xComp( m_pImpl->m_xTable, UNO_QUERY );
+ if ( xComp.is() )
+ {
+ xComp->dispose();
+ }
+
+ AccessibleGridControlBase::disposing();
+}
+// -----------------------------------------------------------------------------
+
+// XAccessibleContext ---------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleGridControl::getAccessibleChildCount()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return m_aTable.GetAccessibleControlCount();
+}
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount())
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild;
+ if (isAlive())
+ {
+ if(nChildIndex == 0 && m_aTable.HasColHeader())
+ {
+ if(!m_pImpl->m_xColumnHeaderBar.is()){
+ AccessibleGridControlHeader* pColHeaderBar = new AccessibleGridControlHeader(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_COLUMNHEADERBAR);
+ m_pImpl->m_xColumnHeaderBar = pColHeaderBar;
+ }
+ xChild = m_pImpl->m_xColumnHeaderBar;
+ }
+ else if(m_aTable.HasRowHeader() && (nChildIndex == 1 || nChildIndex == 0))
+ {
+ if(!m_pImpl->m_xRowHeaderBar.is()){
+ AccessibleGridControlHeader* pRowHeaderBar = new AccessibleGridControlHeader(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_ROWHEADERBAR);
+ m_pImpl->m_xRowHeaderBar = pRowHeaderBar;
+ }
+ xChild = m_pImpl->m_xRowHeaderBar;
+ }
+ else
+ {
+ AccessibleGridControlTable* pTable = new AccessibleGridControlTable(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_TABLE);
+ m_pImpl->m_xTable = pTable;
+ xChild = m_pImpl->m_xTable;
+ }
+ }
+
+ return xChild;
+}
+// -----------------------------------------------------------------------------
+
+sal_Int16 SAL_CALL AccessibleGridControl::getAccessibleRole()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return AccessibleRole::PANEL;
+}
+// -----------------------------------------------------------------------------
+
+// XAccessibleComponent -------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint )
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ Reference< XAccessible > xChild;
+ sal_Int32 nIndex = 0;
+ if( m_aTable.ConvertPointToControlIndex( nIndex, VCLPoint( rPoint ) ) )
+ xChild = m_aTable.CreateAccessibleControl( nIndex );
+ else
+ {
+ // try whether point is in one of the fixed children
+ // (table, header bars, corner control)
+ Point aPoint( VCLPoint( rPoint ) );
+ for( nIndex = 0; (nIndex < 3) && !xChild.is(); ++nIndex )
+ {
+ Reference< XAccessible > xCurrChild( implGetFixedChild( nIndex ) );
+ Reference< XAccessibleComponent >
+ xCurrChildComp( xCurrChild, uno::UNO_QUERY );
+
+ if( xCurrChildComp.is() &&
+ VCLRectangle( xCurrChildComp->getBounds() ).IsInside( aPoint ) )
+ xChild = xCurrChild;
+ }
+ }
+ return xChild;
+}
+// -----------------------------------------------------------------------------
+
+void SAL_CALL AccessibleGridControl::grabFocus()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ m_aTable.GrabFocus();
+}
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL AccessibleGridControl::getAccessibleKeyBinding()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return Any();
+}
+// -----------------------------------------------------------------------------
+
+// XServiceInfo ---------------------------------------------------------------
+
+OUString SAL_CALL AccessibleGridControl::getImplementationName()
+ throw ( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControl" ) );
+}
+// -----------------------------------------------------------------------------
+
+// internal virtual methods ---------------------------------------------------
+
+Rectangle AccessibleGridControl::implGetBoundingBox()
+{
+ Window* pParent = m_aTable.GetAccessibleParentWindow();
+ DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" );
+ return m_aTable.GetWindowExtentsRelative( pParent );
+}
+// -----------------------------------------------------------------------------
+
+Rectangle AccessibleGridControl::implGetBoundingBoxOnScreen()
+{
+ return m_aTable.GetWindowExtentsRelative( NULL );
+}
+// internal helper methods ----------------------------------------------------
+
+Reference< XAccessible > AccessibleGridControl::implGetTable()
+{
+ if( !m_pImpl->m_xTable.is() )
+ {
+ m_pImpl->m_pTable = createAccessibleTable();
+ m_pImpl->m_xTable = m_pImpl->m_pTable;
+
+ }
+ return m_pImpl->m_xTable;
+}
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible >
+AccessibleGridControl::implGetHeaderBar( AccessibleTableControlObjType eObjType )
+{
+ Reference< XAccessible > xRet;
+ Reference< XAccessible >* pxMember = NULL;
+
+ if( eObjType == TCTYPE_ROWHEADERBAR )
+ pxMember = &m_pImpl->m_xRowHeaderBar;
+ else if( eObjType == TCTYPE_COLUMNHEADERBAR )
+ pxMember = &m_pImpl->m_xColumnHeaderBar;
+
+ if( pxMember )
+ {
+ if( !pxMember->is() )
+ {
+ AccessibleGridControlHeader* pHeaderBar = new AccessibleGridControlHeader(
+ (Reference< XAccessible >)m_pImpl->m_aCreator, m_aTable, eObjType );
+
+ if ( TCTYPE_COLUMNHEADERBAR == eObjType)
+ m_pImpl->m_pColumnHeaderBar = pHeaderBar;
+ else
+ m_pImpl->m_pRowHeaderBar = pHeaderBar;
+
+ *pxMember = pHeaderBar;
+ }
+ xRet = *pxMember;
+ }
+ return xRet;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible >
+AccessibleGridControl::implGetFixedChild( sal_Int32 nChildIndex )
+{
+ Reference< XAccessible > xRet;
+ switch( nChildIndex )
+ {
+ case TCINDEX_COLUMNHEADERBAR:
+ xRet = implGetHeaderBar( TCTYPE_COLUMNHEADERBAR );
+ break;
+ case TCINDEX_ROWHEADERBAR:
+ xRet = implGetHeaderBar( TCTYPE_ROWHEADERBAR );
+ break;
+ case TCINDEX_TABLE:
+ xRet = implGetTable();
+ break;
+ }
+ return xRet;
+}
+// -----------------------------------------------------------------------------
+AccessibleGridControlTable* AccessibleGridControl::createAccessibleTable()
+{
+ Reference< XAccessible > xCreator = (Reference< XAccessible >)m_pImpl->m_aCreator;
+ DBG_ASSERT( xCreator.is(), "accessibility/extended/AccessibleGirdControl::createAccessibleTable: my creator died - how this?" );
+ return new AccessibleGridControlTable( xCreator, m_aTable, TCTYPE_TABLE );
+}
+// ============================================================================
+// = AccessibleGridControlAccess
+// ============================================================================
+DBG_NAME( AccessibleGridControlAccess )
+// -----------------------------------------------------------------------------
+AccessibleGridControlAccess::AccessibleGridControlAccess( const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable )
+ :m_xParent( _rxParent )
+ ,m_rTable( _rTable )
+ ,m_pContext( NULL )
+{
+ DBG_CTOR( AccessibleGridControlAccess, NULL );
+}
+
+// -----------------------------------------------------------------------------
+AccessibleGridControlAccess::~AccessibleGridControlAccess()
+{
+ DBG_DTOR( AccessibleGridControlAccess, NULL );
+}
+
+// -----------------------------------------------------------------------------
+void AccessibleGridControlAccess::dispose()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ m_pContext = NULL;
+ ::comphelper::disposeComponent( m_xContext );
+}
+
+// -----------------------------------------------------------------------------
+Reference< XAccessibleContext > SAL_CALL AccessibleGridControlAccess::getAccessibleContext() throw ( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ DBG_ASSERT( ( m_pContext && m_xContext.is() ) || ( !m_pContext && !m_xContext.is() ),
+ "accessibility/extended/AccessibleGridControlAccess::getAccessibleContext: inconsistency!" );
+
+ // if the context died meanwhile (we're no listener, so it won't tell us explicitily when this happens),
+ // then reset an re-create.
+ if ( m_pContext && !m_pContext->isAlive() )
+ m_xContext = m_pContext = NULL;
+
+ if ( !m_xContext.is() )
+ m_xContext = m_pContext = new AccessibleGridControl( m_xParent, this, m_rTable );
+
+ return m_xContext;
+}
+
+// -----------------------------------------------------------------------------
+bool AccessibleGridControlAccess::isContextAlive() const
+{
+ return ( NULL != m_pContext ) && m_pContext->isAlive();
+}
+
+// ============================================================================
+
+} // namespace accessibility
diff --git a/accessibility/source/extended/AccessibleGridControlBase.cxx b/accessibility/source/extended/AccessibleGridControlBase.cxx
new file mode 100755
index 000000000000..e31619507aec
--- /dev/null
+++ b/accessibility/source/extended/AccessibleGridControlBase.cxx
@@ -0,0 +1,551 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleGridControlBase.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include "accessibility/extended/AccessibleGridControlBase.hxx"
+#include <svtools/accessibletable.hxx>
+#include <rtl/uuid.h>
+//
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <unotools/accessiblerelationsethelper.hxx>
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+using namespace ::svt;
+using namespace ::svt::table;
+
+
+// ============================================================================
+
+namespace accessibility {
+
+using namespace com::sun::star::accessibility::AccessibleStateType;
+// ============================================================================
+
+// Ctor/Dtor/disposing --------------------------------------------------------
+
+DBG_NAME( AccessibleGridControlBase )
+
+AccessibleGridControlBase::AccessibleGridControlBase(
+ const Reference< XAccessible >& rxParent,
+ svt::table::IAccessibleTable& rTable,
+ AccessibleTableControlObjType eObjType ) :
+ AccessibleGridControlImplHelper( m_aMutex ),
+ m_xParent( rxParent ),
+ m_aTable( rTable),
+ m_aName( rTable.GetAccessibleObjectName( eObjType, 0, 0 ) ),
+ m_aDescription( rTable.GetAccessibleObjectDescription( eObjType ) ),
+ m_eObjType( eObjType ),
+ m_aClientId(0)
+{
+ DBG_CTOR( AccessibleGridControlBase, NULL );
+}
+
+AccessibleGridControlBase::~AccessibleGridControlBase()
+{
+ DBG_DTOR( AccessibleGridControlBase, NULL );
+
+ if( isAlive() )
+ {
+ // increment ref count to prevent double call of Dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ dispose();
+ }
+}
+
+void SAL_CALL AccessibleGridControlBase::disposing()
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ m_xParent = NULL;
+}
+
+// XAccessibleContext ---------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL AccessibleGridControlBase::getAccessibleParent()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return m_xParent;
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlBase::getAccessibleIndexInParent()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ // -1 for child not found/no parent (according to specification)
+ sal_Int32 nRet = -1;
+
+ Reference< uno::XInterface > xMeMyselfAndI( static_cast< XAccessibleContext* >( this ), uno::UNO_QUERY );
+
+ // iterate over parent's children and search for this object
+ if( m_xParent.is() )
+ {
+ Reference< XAccessibleContext >
+ xParentContext( m_xParent->getAccessibleContext() );
+ if( xParentContext.is() )
+ {
+ Reference< uno::XInterface > xChild;
+
+ sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
+ for( sal_Int32 nChild = 0; nChild < nChildCount; ++nChild )
+ {
+ xChild = xChild.query( xParentContext->getAccessibleChild( nChild ) );
+
+ if ( xMeMyselfAndI.get() == xChild.get() )
+ {
+ nRet = nChild;
+ break;
+ }
+ }
+ }
+ }
+ return nRet;
+}
+
+OUString SAL_CALL AccessibleGridControlBase::getAccessibleDescription()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return m_aDescription;
+}
+
+OUString SAL_CALL AccessibleGridControlBase::getAccessibleName()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return m_aName;
+}
+
+Reference< XAccessibleRelationSet > SAL_CALL
+AccessibleGridControlBase::getAccessibleRelationSet()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ // GridControl does not have relations.
+ return new utl::AccessibleRelationSetHelper;
+}
+
+Reference< XAccessibleStateSet > SAL_CALL
+AccessibleGridControlBase::getAccessibleStateSet()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ // don't check whether alive -> StateSet may contain DEFUNC
+ return implCreateStateSetHelper();
+}
+
+lang::Locale SAL_CALL AccessibleGridControlBase::getLocale()
+ throw ( IllegalAccessibleComponentStateException, uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ if( m_xParent.is() )
+ {
+ Reference< XAccessibleContext >
+ xParentContext( m_xParent->getAccessibleContext() );
+ if( xParentContext.is() )
+ return xParentContext->getLocale();
+ }
+ throw IllegalAccessibleComponentStateException();
+}
+
+// XAccessibleComponent -------------------------------------------------------
+
+sal_Bool SAL_CALL AccessibleGridControlBase::containsPoint( const awt::Point& rPoint )
+ throw ( uno::RuntimeException )
+{
+ return Rectangle( Point(), getBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
+}
+
+awt::Rectangle SAL_CALL AccessibleGridControlBase::getBounds()
+ throw ( uno::RuntimeException )
+{
+ return AWTRectangle( getBoundingBox() );
+}
+
+awt::Point SAL_CALL AccessibleGridControlBase::getLocation()
+ throw ( uno::RuntimeException )
+{
+ return AWTPoint( getBoundingBox().TopLeft() );
+}
+
+awt::Point SAL_CALL AccessibleGridControlBase::getLocationOnScreen()
+ throw ( uno::RuntimeException )
+{
+ return AWTPoint( getBoundingBoxOnScreen().TopLeft() );
+}
+
+awt::Size SAL_CALL AccessibleGridControlBase::getSize()
+ throw ( uno::RuntimeException )
+{
+ return AWTSize( getBoundingBox().GetSize() );
+}
+
+sal_Bool SAL_CALL AccessibleGridControlBase::isShowing()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return implIsShowing();
+}
+
+sal_Bool SAL_CALL AccessibleGridControlBase::isVisible()
+ throw ( uno::RuntimeException )
+{
+ Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet();
+ return xStateSet.is() ?
+ xStateSet->contains( AccessibleStateType::VISIBLE ) : sal_False;
+}
+
+sal_Bool SAL_CALL AccessibleGridControlBase::isFocusTraversable()
+ throw ( uno::RuntimeException )
+{
+ Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet();
+ return xStateSet.is() ?
+ xStateSet->contains( AccessibleStateType::FOCUSABLE ) : sal_False;
+}
+// XAccessibleEventBroadcaster ------------------------------------------------
+
+void SAL_CALL AccessibleGridControlBase::addEventListener(
+ const Reference< XAccessibleEventListener>& _rxListener )
+ throw ( uno::RuntimeException )
+{
+ if ( _rxListener.is() )
+ {
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ if ( !getClientId( ) )
+ setClientId( AccessibleEventNotifier::registerClient( ) );
+
+ AccessibleEventNotifier::addEventListener( getClientId( ), _rxListener );
+ }
+}
+
+void SAL_CALL AccessibleGridControlBase::removeEventListener(
+ const Reference< XAccessibleEventListener>& _rxListener )
+ throw ( uno::RuntimeException )
+{
+ if( _rxListener.is() && getClientId( ) )
+ {
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( getClientId( ), _rxListener );
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+
+ AccessibleEventNotifier::TClientId nId( getClientId( ) );
+ setClientId( 0 );
+ AccessibleEventNotifier::revokeClient( nId );
+ }
+ }
+}
+
+// XTypeProvider --------------------------------------------------------------
+
+Sequence< sal_Int8 > SAL_CALL AccessibleGridControlBase::getImplementationId()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslGlobalMutex() );
+ static Sequence< sal_Int8 > aId;
+ implCreateUuid( aId );
+ return aId;
+}
+
+// XServiceInfo ---------------------------------------------------------------
+
+sal_Bool SAL_CALL AccessibleGridControlBase::supportsService(
+ const OUString& rServiceName )
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ Sequence< OUString > aSupportedServices( getSupportedServiceNames() );
+ const OUString* pArrBegin = aSupportedServices.getConstArray();
+ const OUString* pArrEnd = pArrBegin + aSupportedServices.getLength();
+ const OUString* pString = pArrBegin;
+
+ for( ; ( pString != pArrEnd ) && ( rServiceName != *pString ); ++pString )
+ ;
+
+ return pString != pArrEnd;
+}
+
+Sequence< OUString > SAL_CALL AccessibleGridControlBase::getSupportedServiceNames()
+ throw ( uno::RuntimeException )
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) );
+ return Sequence< OUString >( &aServiceName, 1 );
+}
+// internal virtual methods ---------------------------------------------------
+
+sal_Bool AccessibleGridControlBase::implIsShowing()
+{
+ sal_Bool bShowing = sal_False;
+ if( m_xParent.is() )
+ {
+ Reference< XAccessibleComponent >
+ xParentComp( m_xParent->getAccessibleContext(), uno::UNO_QUERY );
+ if( xParentComp.is() )
+ bShowing = implGetBoundingBox().IsOver(
+ VCLRectangle( xParentComp->getBounds() ) );
+ }
+ return bShowing;
+}
+
+::utl::AccessibleStateSetHelper* AccessibleGridControlBase::implCreateStateSetHelper()
+{
+ ::utl::AccessibleStateSetHelper*
+ pStateSetHelper = new ::utl::AccessibleStateSetHelper;
+
+ if( isAlive() )
+ {
+ // SHOWING done with m_xParent
+ if( implIsShowing() )
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ // GridControl fills StateSet with states depending on object type
+ m_aTable.FillAccessibleStateSet( *pStateSetHelper, getType() );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return pStateSetHelper;
+}
+
+// internal helper methods ----------------------------------------------------
+
+sal_Bool AccessibleGridControlBase::isAlive() const
+{
+ return !rBHelper.bDisposed && !rBHelper.bInDispose && &m_aTable;
+}
+
+void AccessibleGridControlBase::ensureIsAlive() const
+ throw ( lang::DisposedException )
+{
+ if( !isAlive() )
+ throw lang::DisposedException();
+}
+
+Rectangle AccessibleGridControlBase::getBoundingBox()
+ throw ( lang::DisposedException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ Rectangle aRect = implGetBoundingBox();
+ if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() )
+ {
+ DBG_ERRORFILE( "rectangle doesn't exist" );
+ }
+ return aRect;
+}
+//
+Rectangle AccessibleGridControlBase::getBoundingBoxOnScreen()
+ throw ( lang::DisposedException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ Rectangle aRect = implGetBoundingBoxOnScreen();
+ if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() )
+ {
+ DBG_ERRORFILE( "rectangle doesn't exist" );
+ }
+ return aRect;
+}
+
+void AccessibleGridControlBase::commitEvent(
+ sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
+{
+ ::osl::ClearableMutexGuard aGuard( getOslMutex() );
+ if ( !getClientId( ) )
+ // if we don't have a client id for the notifier, then we don't have listeners, then
+ // we don't need to notify anything
+ return;
+
+ // build an event object
+ AccessibleEventObject aEvent;
+ aEvent.Source = *this;
+ aEvent.EventId = _nEventId;
+ aEvent.OldValue = _rOldValue;
+ aEvent.NewValue = _rNewValue;
+
+ // let the notifier handle this event
+
+ AccessibleEventNotifier::addEvent( getClientId( ), aEvent );
+}
+// -----------------------------------------------------------------------------
+
+void AccessibleGridControlBase::implCreateUuid( Sequence< sal_Int8 >& rId )
+{
+ if( !rId.hasElements() )
+ {
+ rId.realloc( 16 );
+ rtl_createUuid( reinterpret_cast< sal_uInt8* >( rId.getArray() ), 0, sal_True );
+ }
+}
+// -----------------------------------------------------------------------------
+sal_Int16 SAL_CALL AccessibleGridControlBase::getAccessibleRole()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ sal_Int16 nRole = AccessibleRole::UNKNOWN;
+ switch ( m_eObjType )
+ {
+ case TCTYPE_ROWHEADERCELL:
+ nRole = AccessibleRole::ROW_HEADER;
+ break;
+ case TCTYPE_COLUMNHEADERCELL:
+ nRole = AccessibleRole::COLUMN_HEADER;
+ break;
+ case TCTYPE_COLUMNHEADERBAR:
+ case TCTYPE_ROWHEADERBAR:
+ case TCTYPE_TABLE:
+ nRole = AccessibleRole::TABLE;
+ break;
+ case TCTYPE_TABLECELL:
+ nRole = AccessibleRole::TABLE_CELL;
+ break;
+ case TCTYPE_GRIDCONTROL:
+ nRole = AccessibleRole::PANEL;
+ break;
+ }
+ return nRole;
+}
+// -----------------------------------------------------------------------------
+Any SAL_CALL AccessibleGridControlBase::getAccessibleKeyBinding()
+ throw ( uno::RuntimeException )
+{
+ return Any();
+}
+// -----------------------------------------------------------------------------
+Reference<XAccessible > SAL_CALL AccessibleGridControlBase::getAccessibleAtPoint( const ::com::sun::star::awt::Point& )
+ throw ( uno::RuntimeException )
+{
+ return NULL;
+}
+//// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL AccessibleGridControlBase::getForeground( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ sal_Int32 nColor = 0;
+ Window* pInst = m_aTable.GetWindowInstance();
+ if ( pInst )
+ {
+ if ( pInst->IsControlForeground() )
+ nColor = pInst->GetControlForeground().GetColor();
+ else
+ {
+ Font aFont;
+ if ( pInst->IsControlFont() )
+ aFont = pInst->GetControlFont();
+ else
+ aFont = pInst->GetFont();
+ nColor = aFont.GetColor().GetColor();
+ }
+ }
+
+ return nColor;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL AccessibleGridControlBase::getBackground( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ sal_Int32 nColor = 0;
+ Window* pInst = m_aTable.GetWindowInstance();
+ if ( pInst )
+ {
+ if ( pInst->IsControlBackground() )
+ nColor = pInst->GetControlBackground().GetColor();
+ else
+ nColor = pInst->GetBackground().GetColor().GetColor();
+ }
+
+ return nColor;
+}
+
+//// ============================================================================
+GridControlAccessibleElement::GridControlAccessibleElement( const Reference< XAccessible >& rxParent,
+ IAccessibleTable& rTable,
+ AccessibleTableControlObjType eObjType )
+ :AccessibleGridControlBase( rxParent, rTable, eObjType )
+{
+ DBG_CTOR( GridControlAccessibleElement, NULL );
+}
+
+// XInterface -----------------------------------------------------------------
+IMPLEMENT_FORWARD_XINTERFACE2( GridControlAccessibleElement, AccessibleGridControlBase, GridControlAccessibleElement_Base)
+
+// XTypeProvider --------------------------------------------------------------
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( GridControlAccessibleElement, AccessibleGridControlBase, GridControlAccessibleElement_Base )
+
+// XAccessible ----------------------------------------------------------------
+
+Reference< XAccessibleContext > SAL_CALL GridControlAccessibleElement::getAccessibleContext() throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return this;
+}
+// ----------------------------------------------------------------------------
+GridControlAccessibleElement::~GridControlAccessibleElement( )
+{
+ DBG_DTOR( GridControlAccessibleElement, NULL );
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx
new file mode 100755
index 000000000000..e36fac54e890
--- /dev/null
+++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx
@@ -0,0 +1,321 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleGridControlHeader.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+
+
+#include "accessibility/extended/AccessibleGridControlHeader.hxx"
+#include "accessibility/extended/AccessibleGridControlHeaderCell.hxx"
+#include "accessibility/extended/AccessibleGridControlTableCell.hxx"
+#include <svtools/accessibletable.hxx>
+
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+using namespace ::svt;
+using namespace ::svt::table;
+
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+
+// Ctor/Dtor/disposing --------------------------------------------------------
+
+DBG_NAME( AccessibleGridControlHeader )
+
+AccessibleGridControlHeader::AccessibleGridControlHeader(
+ const Reference< XAccessible >& rxParent,
+ ::svt::table::IAccessibleTable& rTable,
+ ::svt::table::AccessibleTableControlObjType eObjType):
+ AccessibleGridControlTableBase( rxParent, rTable, eObjType )
+{
+ DBG_CTOR( AccessibleGridControlHeaderBar, NULL );
+
+ DBG_ASSERT( isRowBar() || isColumnBar(),
+ "accessibility/extended/AccessibleGridControlHeaderBar - invalid object type" );
+}
+
+AccessibleGridControlHeader::~AccessibleGridControlHeader()
+{
+ DBG_DTOR( AccessibleGridControlHeader, NULL );
+}
+
+// XAccessibleContext ---------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleGridControlHeader::getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount())
+ throw IndexOutOfBoundsException();
+ ensureIsAlive();
+ Reference< XAccessible > xChild;
+ if(m_eObjType == svt::table::TCTYPE_COLUMNHEADERBAR)
+ {
+ AccessibleGridControlHeaderCell* pColHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, svt::table::TCTYPE_COLUMNHEADERCELL);
+ xChild = pColHeaderCell;
+ }
+ else if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR)
+ {
+ AccessibleGridControlHeaderCell* pRowHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, svt::table::TCTYPE_ROWHEADERCELL);
+ xChild = pRowHeaderCell;
+ }
+ return xChild;
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlHeader::getAccessibleIndexInParent()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR && m_aTable.HasColHeader())
+ return 1;
+ else
+ return 0;
+}
+
+// XAccessibleComponent -------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleGridControlHeader::getAccessibleAtPoint( const awt::Point& rPoint )
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ sal_Int32 nRow = 0;
+ sal_Int32 nColumnPos = 0;
+ sal_Bool bConverted = isRowBar() ?
+ m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) :
+ m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) );
+
+ return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >();
+}
+
+void SAL_CALL AccessibleGridControlHeader::grabFocus()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ // focus on header not supported
+}
+
+Any SAL_CALL AccessibleGridControlHeader::getAccessibleKeyBinding()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return Any(); // no special key bindings for header
+}
+
+// XAccessibleTable -----------------------------------------------------------
+
+OUString SAL_CALL AccessibleGridControlHeader::getAccessibleRowDescription( sal_Int32 nRow )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidRow( nRow );
+ return OUString(); // no headers in headers
+}
+
+OUString SAL_CALL AccessibleGridControlHeader::getAccessibleColumnDescription( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidColumn( nColumn );
+ return OUString(); // no headers in headers
+}
+
+Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibleRowHeaders()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return NULL; // no headers in headers
+}
+
+Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibleColumnHeaders()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return NULL; // no headers in headers
+}
+
+Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleRows()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ Sequence< sal_Int32 > aSelSeq;
+ // row of column header bar not selectable
+ if( isRowBar() )
+ implGetSelectedRows( aSelSeq );
+ return aSelSeq;
+}
+//columns aren't selectable
+Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleColumns()
+ throw ( uno::RuntimeException )
+{
+ return NULL;
+}
+//To Do - not yet implemented
+sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleRowSelected( sal_Int32 nRow )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidRow( nRow );
+ //return isRowBar() ? implIsRowSelected( nRow ) : sal_False;
+ return sal_False;
+}
+//columns aren't selectable
+sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleColumnSelected( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ (void)nColumn;
+ return sal_False;
+}
+
+Reference< XAccessible > SAL_CALL AccessibleGridControlHeader::getAccessibleCellAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return implGetChild( nRow, implToVCLColumnPos( nColumn ) );
+}
+// TO DO - not implemented yet
+sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleSelected(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return FALSE;
+ // return isRowBar() ? implIsRowSelected( nRow ) : implIsColumnSelected( nColumn );
+}
+
+// XServiceInfo ---------------------------------------------------------------
+
+OUString SAL_CALL AccessibleGridControlHeader::getImplementationName()
+ throw ( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlHeader" ) );
+}
+
+Sequence< sal_Int8 > SAL_CALL AccessibleGridControlHeader::getImplementationId()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslGlobalMutex() );
+ static Sequence< sal_Int8 > aId;
+ implCreateUuid( aId );
+ return aId;
+}
+
+// internal virtual methods ---------------------------------------------------
+
+Rectangle AccessibleGridControlHeader::implGetBoundingBox()
+{
+ return m_aTable.calcHeaderRect(isColumnBar());
+}
+
+Rectangle AccessibleGridControlHeader::implGetBoundingBoxOnScreen()
+{
+ return m_aTable.calcHeaderRect(isColumnBar());
+}
+
+sal_Int32 AccessibleGridControlHeader::implGetRowCount() const
+{
+ return 1;
+}
+
+sal_Int32 AccessibleGridControlHeader::implGetColumnCount() const
+{
+ return 1;
+}
+
+// internal helper methods ----------------------------------------------------
+
+Reference< XAccessible > AccessibleGridControlHeader::implGetChild(
+ sal_Int32 nRow, sal_uInt32 nColumnPos )
+{
+ Reference< XAccessible > xChild;
+ if(m_eObjType == svt::table::TCTYPE_COLUMNHEADERBAR)
+ {
+ AccessibleGridControlHeaderCell* pColHeaderCell = new AccessibleGridControlHeaderCell(nColumnPos, this, m_aTable, svt::table::TCTYPE_COLUMNHEADERCELL);
+ xChild = pColHeaderCell;
+ }
+ else if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR)
+ {
+ AccessibleGridControlHeaderCell* pRowHeaderCell = new AccessibleGridControlHeaderCell(nRow, this, m_aTable, svt::table::TCTYPE_ROWHEADERCELL);
+ xChild = pRowHeaderCell;
+ }
+ return xChild;
+}
+
+void AccessibleGridControlHeader::ensureIsValidHeaderIndex( sal_Int32 nIndex )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ if( isRowBar() )
+ ensureIsValidRow( nIndex );
+ else
+ ensureIsValidColumn( nIndex );
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
diff --git a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
new file mode 100755
index 000000000000..52139a694aef
--- /dev/null
+++ b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleGridControlHeaderCell.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+
+#include "accessibility/extended/AccessibleGridControlHeaderCell.hxx"
+#include <svtools/accessibletable.hxx>
+#include "accessibility/extended/AccessibleGridControl.hxx"
+
+namespace accessibility
+{
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::uno;
+ using namespace ::svt;
+ using namespace ::svt::table;
+
+AccessibleGridControlHeaderCell::AccessibleGridControlHeaderCell(sal_Int32 _nColumnRowId,
+ const Reference< XAccessible >& rxParent,
+ IAccessibleTable& rTable,
+ AccessibleTableControlObjType eObjType)
+: AccessibleGridControlCell( rxParent, rTable, _nColumnRowId, 0, eObjType)
+, m_nColumnRowId(_nColumnRowId)
+{
+}
+/** Creates a new AccessibleStateSetHelper and fills it with states of the
+ current object.
+ @return
+ A filled AccessibleStateSetHelper.
+*/
+::utl::AccessibleStateSetHelper* AccessibleGridControlHeaderCell::implCreateStateSetHelper()
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ::utl::AccessibleStateSetHelper*
+ pStateSetHelper = new ::utl::AccessibleStateSetHelper;
+
+ if( isAlive() )
+ {
+ // SHOWING done with mxParent
+ if( implIsShowing() )
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+
+ TCSolarGuard aSolarGuard;
+ pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
+ pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
+ pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
+
+ if ( m_aTable.IsRowSelected(m_nColumnRowId) )
+ pStateSetHelper->AddState( AccessibleStateType::SELECTED );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return pStateSetHelper;
+}
+// -----------------------------------------------------------------------------
+/** @return
+ The count of visible children.
+*/
+sal_Int32 SAL_CALL AccessibleGridControlHeaderCell::getAccessibleChildCount()
+ throw ( RuntimeException )
+{
+ return 0;
+}
+// -----------------------------------------------------------------------------
+
+/** @return
+ The XAccessible interface of the specified child.
+*/
+Reference<XAccessible > SAL_CALL AccessibleGridControlHeaderCell::getAccessibleChild( sal_Int32 )
+ throw ( IndexOutOfBoundsException,RuntimeException )
+{
+ throw IndexOutOfBoundsException();
+}
+// XInterface -------------------------------------------------------------
+
+ /** Queries for a new interface. */
+ ::com::sun::star::uno::Any SAL_CALL AccessibleGridControlHeaderCell::queryInterface(
+ const ::com::sun::star::uno::Type& rType )
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ Any aRet = AccessibleGridControlCell::queryInterface(rType);
+ return aRet;
+ }
+
+ /** Aquires the object (calls acquire() on base class). */
+ void SAL_CALL AccessibleGridControlHeaderCell::acquire() throw ()
+ {
+ AccessibleGridControlCell::acquire();
+ }
+
+ /** Releases the object (calls release() on base class). */
+ void SAL_CALL AccessibleGridControlHeaderCell::release() throw ()
+ {
+ AccessibleGridControlCell::release();
+ }
+ /** @return The XAccessibleContext interface of this object. */
+ Reference< com::sun::star::accessibility::XAccessibleContext > SAL_CALL AccessibleGridControlHeaderCell::getAccessibleContext() throw ( RuntimeException )
+ {
+ ensureIsAlive();
+ return this;
+ }
+
+// -----------------------------------------------------------------------------
+
+/** Grabs the focus to the column header. */
+void SAL_CALL AccessibleGridControlHeaderCell::grabFocus()
+ throw ( ::com::sun::star::uno::RuntimeException )
+{
+}
+// -----------------------------------------------------------------------------
+/** @return
+ The name of this class.
+*/
+::rtl::OUString SAL_CALL AccessibleGridControlHeaderCell::getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException )
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlHeaderCell" ) );
+}
+// -----------------------------------------------------------------------------
+Rectangle AccessibleGridControlHeaderCell::implGetBoundingBox()
+{
+ return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle
+}
+// -----------------------------------------------------------------------------
+
+Rectangle AccessibleGridControlHeaderCell::implGetBoundingBoxOnScreen()
+{
+ return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL AccessibleGridControlHeaderCell::getAccessibleIndexInParent()
+ throw ( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ sal_Int32 nIndex = m_nColumnRowId;
+ return nIndex;
+}
+// -----------------------------------------------------------------------------
+} // namespace accessibility
+// -----------------------------------------------------------------------------
+
+
diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx b/accessibility/source/extended/AccessibleGridControlTable.cxx
new file mode 100755
index 000000000000..fd46c759711c
--- /dev/null
+++ b/accessibility/source/extended/AccessibleGridControlTable.cxx
@@ -0,0 +1,413 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleGridControlTable.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+
+
+#include "accessibility/extended/AccessibleGridControlTable.hxx"
+#include "accessibility/extended/AccessibleGridControlTableCell.hxx"
+#include <svtools/accessibletable.hxx>
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::svt;
+using namespace ::svt::table;
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+
+// Ctor/Dtor/disposing --------------------------------------------------------
+
+DBG_NAME( AccessibleGridControlTable )
+
+AccessibleGridControlTable::AccessibleGridControlTable(
+ const Reference< XAccessible >& rxParent,
+ IAccessibleTable& rTable,
+ AccessibleTableControlObjType _eType) :
+ AccessibleGridControlTableBase( rxParent, rTable, _eType )
+{
+ DBG_CTOR( AccessibleGridControlTable, NULL );
+}
+
+AccessibleGridControlTable::~AccessibleGridControlTable()
+{
+ DBG_DTOR( AccessibleGridControlTable, NULL );
+}
+
+// XAccessibleContext ---------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleGridControlTable::getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidIndex( nChildIndex );
+ return new AccessibleGridControlTableCell(this, m_aTable, nChildIndex/m_aTable.GetColumnCount(), nChildIndex%m_aTable.GetColumnCount(), TCTYPE_TABLECELL);
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlTable::getAccessibleIndexInParent()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ if(m_aTable.HasRowHeader() && m_aTable.HasColHeader())
+ return 0;
+ else if((!m_aTable.HasRowHeader() && m_aTable.HasColHeader()) || (m_aTable.HasRowHeader() && !m_aTable.HasColHeader()) )
+ return 1;
+ else
+ return 2;
+
+}
+
+// XAccessibleComponent -------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleGridControlTable::getAccessibleAtPoint( const awt::Point& rPoint )
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ Reference< XAccessible > xChild;
+ sal_Int32 nRow = 0;
+ sal_Int32 nColumnPos = 0;
+ if( m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) )
+ xChild = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumnPos, TCTYPE_TABLECELL);
+
+ return xChild;
+}
+
+void SAL_CALL AccessibleGridControlTable::grabFocus()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ m_aTable.GrabFocus();
+}
+
+Any SAL_CALL AccessibleGridControlTable::getAccessibleKeyBinding()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return Any(); // no special key bindings for data table
+}
+
+// XAccessibleTable -----------------------------------------------------------
+
+OUString SAL_CALL AccessibleGridControlTable::getAccessibleRowDescription( sal_Int32 nRow )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidRow( nRow );
+ return m_aTable.GetRowDescription( nRow );
+}
+
+OUString SAL_CALL AccessibleGridControlTable::getAccessibleColumnDescription( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidColumn( nColumn );
+ return m_aTable.GetColumnDescription( (sal_uInt16)nColumn );
+}
+
+Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessibleRowHeaders()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ if(m_aTable.HasColHeader())
+ return implGetHeaderBar( 1 );
+ else
+ return implGetHeaderBar( 0 );
+}
+
+Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessibleColumnHeaders()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return implGetHeaderBar( 0 );
+}
+
+Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleRows()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ Sequence< sal_Int32 > aSelSeq;
+ implGetSelectedRows( aSelSeq );
+ return aSelSeq;
+}
+
+//columns aren't selectable
+Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleColumns()
+ throw ( uno::RuntimeException )
+{
+// TCSolarGuard aSolarGuard;
+// ::osl::MutexGuard aGuard( getOslMutex() );
+// ensureIsAlive();
+//
+// Sequence< sal_Int32 > aSelSeq;
+// implGetSelectedColumns( aSelSeq );
+// return aSelSeq;
+ return NULL;
+}
+
+//To Do: not implemented yet
+sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleRowSelected( sal_Int32 nRow )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ //TCSolarGuard aSolarGuard;
+ //::osl::MutexGuard aGuard( getOslMutex() );
+ //ensureIsAlive();
+ //ensureIsValidRow( nRow );
+ //return implIsRowSelected( nRow );
+ return sal_False;
+}
+
+//columns aren't selectable
+sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleColumnSelected( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ /*TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidColumn( nColumn );
+ return implIsColumnSelected( nColumn );*/
+ (void) nColumn;
+ return sal_False;
+}
+
+Reference< XAccessible > SAL_CALL AccessibleGridControlTable::getAccessibleCellAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumn, TCTYPE_TABLECELL);
+}
+
+sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleSelected(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ /*TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return implIsRowSelected( nRow ) || implIsColumnSelected( nColumn );*/
+ (void) nRow;
+ (void) nColumn;
+ return sal_False;
+}
+//To Do: not implemented yet
+void SAL_CALL AccessibleGridControlTable::selectAccessibleChild( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidIndex( nChildIndex );
+ //if( isRowBar() )
+ // implSelectRow( nChildIndex, sal_True );
+ //else
+ // implSelectColumn( implToVCLColumnPos( nChildIndex ), sal_True );
+}
+//To Do - not implemented yet
+sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleChildSelected( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ // using interface methods - no mutex
+ /*return isRowBar() ?
+ isAccessibleRowSelected( nChildIndex ) :
+ isAccessibleColumnSelected( nChildIndex );*/
+ (void)nChildIndex;
+ return FALSE;
+}
+//To Do - not implemented yet
+void SAL_CALL AccessibleGridControlTable::clearAccessibleSelection()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+}
+//To Do - not implemented yet
+void SAL_CALL AccessibleGridControlTable::selectAllAccessibleChildren()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+}
+//To Do - not implemented yet
+sal_Int32 SAL_CALL AccessibleGridControlTable::getSelectedAccessibleChildCount()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ // return isRowBar() ? implGetSelectedRowCount() : implGetSelectedColumnCount();
+ return 0;
+}
+//To Do - not implemented yet
+Reference< XAccessible > SAL_CALL
+AccessibleGridControlTable::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ // method may throw lang::IndexOutOfBoundsException
+ //sal_Int32 nIndex = implGetChildIndexFromSelectedIndex( nSelectedChildIndex );
+ //return implGetChild( nIndex, implToVCLColumnPos( nIndex ) );
+ return NULL;
+}
+//To Do - not implemented yet
+void SAL_CALL AccessibleGridControlTable::deselectAccessibleChild(
+ sal_Int32 nSelectedChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ (void)nSelectedChildIndex;
+ // method may throw lang::IndexOutOfBoundsException
+ //if ( isAccessibleChildSelected(nSelectedChildIndex) )
+ //{
+ // if( isRowBar() )
+ // implSelectRow( nSelectedChildIndex, sal_False );
+ // else
+ // implSelectColumn( implToVCLColumnPos( nSelectedChildIndex ), sal_False );
+ //}
+}
+// XInterface -----------------------------------------------------------------
+
+Any SAL_CALL AccessibleGridControlTable::queryInterface( const uno::Type& rType )
+ throw ( uno::RuntimeException )
+{
+ Any aAny( AccessibleGridControlTableBase::queryInterface( rType ) );
+ return aAny.hasValue() ?
+ aAny : AccessibleGridControlTableImplHelper1::queryInterface( rType );
+}
+
+void SAL_CALL AccessibleGridControlTable::acquire() throw ()
+{
+ AccessibleGridControlTableBase::acquire();
+}
+
+void SAL_CALL AccessibleGridControlTable::release() throw ()
+{
+ AccessibleGridControlTableBase::release();
+}
+// XServiceInfo ---------------------------------------------------------------
+
+OUString SAL_CALL AccessibleGridControlTable::getImplementationName()
+ throw ( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlTable" ) );
+}
+
+// internal virtual methods ---------------------------------------------------
+
+Rectangle AccessibleGridControlTable::implGetBoundingBox()
+{
+ return m_aTable.calcTableRect();
+}
+
+Rectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen()
+{
+ return m_aTable.calcTableRect();
+}
+// internal helper methods ----------------------------------------------------
+
+Reference< XAccessible > AccessibleGridControlTable::implGetChild(
+ sal_Int32 nRow, sal_uInt16 nColumnPos )
+{
+ return NULL;
+}
+//To Do - not implemented yet
+//sal_Int32 AccessibleGridControlTable::implGetChildIndexFromSelectedIndex(
+// sal_Int32 nSelectedChildIndex )
+// throw ( lang::IndexOutOfBoundsException )
+//{
+// (void)nSelectedChildIndex;
+// return 0;
+//}
+Reference< XAccessibleTable > AccessibleGridControlTable::implGetHeaderBar(
+ sal_Int32 nChildIndex )
+ throw ( uno::RuntimeException )
+{
+ Reference< XAccessible > xRet;
+ Reference< XAccessibleContext > xContext( m_xParent, uno::UNO_QUERY );
+ if( xContext.is() )
+ {
+ try
+ {
+ xRet = xContext->getAccessibleChild( nChildIndex );
+ }
+ catch( lang::IndexOutOfBoundsException& )
+ {
+ DBG_ERROR( "implGetHeaderBar - wrong child index" );
+ }
+ // RuntimeException goes to caller
+ }
+ return Reference< XAccessibleTable >( xRet, uno::UNO_QUERY );
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
diff --git a/accessibility/source/extended/AccessibleGridControlTableBase.cxx b/accessibility/source/extended/AccessibleGridControlTableBase.cxx
new file mode 100755
index 000000000000..bc266f10f323
--- /dev/null
+++ b/accessibility/source/extended/AccessibleGridControlTableBase.cxx
@@ -0,0 +1,318 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2009 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleGridControlTableBase.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+
+
+#include "accessibility/extended/AccessibleGridControlTableBase.hxx"
+#include <svtools/accessibletable.hxx>
+#include <tools/multisel.hxx>
+#include <comphelper/sequence.hxx>
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::svt;
+using namespace ::svt::table;
+
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+
+// Ctor/Dtor/disposing --------------------------------------------------------
+
+DBG_NAME( AccessibleGridControlTableBase )
+
+AccessibleGridControlTableBase::AccessibleGridControlTableBase(
+ const Reference< XAccessible >& rxParent,
+ IAccessibleTable& rTable,
+ AccessibleTableControlObjType eObjType ) :
+ GridControlAccessibleElement( rxParent, rTable, eObjType )
+{
+ DBG_CTOR( AccessibleGridControlTableBase, NULL );
+}
+
+AccessibleGridControlTableBase::~AccessibleGridControlTableBase()
+{
+ DBG_DTOR( AccessibleGridControlTableBase, NULL );
+}
+
+// XAccessibleContext ---------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleChildCount()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ sal_Int32 nChildren = 0;
+ if(m_eObjType == TCTYPE_ROWHEADERBAR)
+ nChildren = m_aTable.GetRowCount();
+ else if(m_eObjType == TCTYPE_TABLE)
+ nChildren = m_aTable.GetRowCount()*m_aTable.GetColumnCount();
+ else if(m_eObjType == TCTYPE_COLUMNHEADERBAR)
+ nChildren = m_aTable.GetColumnCount();
+ return nChildren;
+}
+
+sal_Int16 SAL_CALL AccessibleGridControlTableBase::getAccessibleRole()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return AccessibleRole::TABLE;
+}
+
+// XAccessibleTable -----------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRowCount()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return m_aTable.GetRowCount();
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumnCount()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return m_aTable.GetColumnCount();
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRowExtentAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return 1; // merged cells not supported
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumnExtentAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return 1; // merged cells not supported
+}
+
+Reference< XAccessible > SAL_CALL AccessibleGridControlTableBase::getAccessibleCaption()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return NULL; // not supported
+}
+
+Reference< XAccessible > SAL_CALL AccessibleGridControlTableBase::getAccessibleSummary()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return NULL; // not supported
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleIndex(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return implGetChildIndex( nRow, nColumn );
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRow( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidIndex( nChildIndex );
+ return implGetRow( nChildIndex );
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumn( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidIndex( nChildIndex );
+ return implGetColumn( nChildIndex );
+}
+
+// XInterface -----------------------------------------------------------------
+
+Any SAL_CALL AccessibleGridControlTableBase::queryInterface( const uno::Type& rType )
+ throw ( uno::RuntimeException )
+{
+ Any aAny( GridControlAccessibleElement::queryInterface( rType ) );
+ return aAny.hasValue() ?
+ aAny : AccessibleGridControlTableImplHelper::queryInterface( rType );
+}
+
+void SAL_CALL AccessibleGridControlTableBase::acquire() throw ()
+{
+ GridControlAccessibleElement::acquire();
+}
+
+void SAL_CALL AccessibleGridControlTableBase::release() throw ()
+{
+ GridControlAccessibleElement::release();
+}
+
+// XTypeProvider --------------------------------------------------------------
+
+Sequence< uno::Type > SAL_CALL AccessibleGridControlTableBase::getTypes()
+ throw ( uno::RuntimeException )
+{
+ return ::comphelper::concatSequences(
+ GridControlAccessibleElement::getTypes(),
+ AccessibleGridControlTableImplHelper::getTypes() );
+}
+
+Sequence< sal_Int8 > SAL_CALL AccessibleGridControlTableBase::getImplementationId()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslGlobalMutex() );
+ static Sequence< sal_Int8 > aId;
+ implCreateUuid( aId );
+ return aId;
+}
+
+// internal helper methods ----------------------------------------------------
+
+sal_uInt16 AccessibleGridControlTableBase::implToVCLColumnPos( sal_Int32 nColumn ) const
+{
+ sal_uInt16 nVCLPos = 0;
+ if( (0 <= nColumn) && (nColumn < m_aTable.GetColumnCount()) )
+ {
+ // regard "handle column"
+ if( m_aTable.HasRowHeader() )
+ ++nColumn;
+ nVCLPos = static_cast< sal_uInt16 >( nColumn );
+ }
+ return nVCLPos;
+}
+
+sal_Int32 AccessibleGridControlTableBase::implGetChildCount() const
+{
+ return m_aTable.GetRowCount()*m_aTable.GetColumnCount();
+}
+
+sal_Int32 AccessibleGridControlTableBase::implGetRow( sal_Int32 nChildIndex ) const
+{
+ sal_Int32 nColumns = m_aTable.GetColumnCount();
+ return nColumns ? (nChildIndex / nColumns) : 0;
+}
+
+sal_Int32 AccessibleGridControlTableBase::implGetColumn( sal_Int32 nChildIndex ) const
+{
+ sal_Int32 nColumns = m_aTable.GetColumnCount();
+ return nColumns ? (nChildIndex % nColumns) : 0;
+}
+
+sal_Int32 AccessibleGridControlTableBase::implGetChildIndex(
+ sal_Int32 nRow, sal_Int32 nColumn ) const
+{
+ return nRow * m_aTable.GetColumnCount() + nColumn;
+}
+
+sal_Bool AccessibleGridControlTableBase::implIsRowSelected( sal_Int32 nRow ) const
+{
+ return m_aTable.IsRowSelected( nRow );
+}
+
+sal_Int32 AccessibleGridControlTableBase::implGetSelectedRowCount() const
+{
+ return m_aTable.GetSelectedRowCount();
+}
+
+void AccessibleGridControlTableBase::implGetSelectedRows( Sequence< sal_Int32 >& rSeq )
+{
+ rSeq = comphelper::containerToSequence(m_aTable.GetSelectedRows());
+}
+
+void AccessibleGridControlTableBase::ensureIsValidRow( sal_Int32 nRow )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ if( nRow >= m_aTable.GetRowCount() )
+ throw lang::IndexOutOfBoundsException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "row index is invalid" ) ), *this );
+}
+
+void AccessibleGridControlTableBase::ensureIsValidColumn( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ if( nColumn >= m_aTable.GetColumnCount() )
+ throw lang::IndexOutOfBoundsException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("column index is invalid") ), *this );
+}
+
+void AccessibleGridControlTableBase::ensureIsValidAddress(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ ensureIsValidRow( nRow );
+ ensureIsValidColumn( nColumn );
+}
+
+void AccessibleGridControlTableBase::ensureIsValidIndex( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ if( nChildIndex >= implGetChildCount() )
+ throw lang::IndexOutOfBoundsException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("child index is invalid") ), *this );
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx b/accessibility/source/extended/AccessibleGridControlTableCell.cxx
new file mode 100755
index 000000000000..4d00f1b86e01
--- /dev/null
+++ b/accessibility/source/extended/AccessibleGridControlTableCell.cxx
@@ -0,0 +1,380 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AccessibleGridControlTableCell.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+
+#include "accessibility/extended/AccessibleGridControlTableCell.hxx"
+#include <svtools/accessibletable.hxx>
+#include "accessibility/extended/AccessibleGridControl.hxx"
+#include <tools/gen.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+
+namespace accessibility
+{
+ namespace
+ {
+ void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException)
+ {
+ if ( _nIndex >= _sText.getLength() )
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+
+ sal_Int32 getIndex_Impl( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_uInt16 _nColumnCount )
+ {
+ return _nRow * _nColumnCount + _nColumn;
+ }
+ }
+ using namespace ::com::sun::star::lang;
+ using namespace utl;
+ using namespace comphelper;
+ using ::rtl::OUString;
+ using ::accessibility::AccessibleGridControl;
+ using namespace ::com::sun::star::uno;
+ using ::com::sun::star::accessibility::XAccessible;
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::svt;
+ using namespace ::svt::table;
+
+
+ // =============================================================================
+ // = AccessibleGridControlCell
+ // =============================================================================
+ //DBG_NAME( svt_AccessibleGridControlCell )
+ // -----------------------------------------------------------------------------
+ AccessibleGridControlCell::AccessibleGridControlCell(
+ const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable,
+ sal_Int32 _nRowPos, sal_uInt16 _nColPos, AccessibleTableControlObjType _eType )
+ :AccessibleGridControlBase( _rxParent, _rTable, _eType )
+ ,m_nRowPos( _nRowPos )
+ ,m_nColPos( _nColPos )
+ {
+ DBG_CTOR( svt_AccessibleGridControlCell, NULL );
+ // set accessible name here, because for that we need the position of the cell
+ // and so the base class isn't capable of doing this
+ sal_Int32 nPos = _nRowPos * _rTable.GetColumnCount() + _nColPos;
+ ::rtl::OUString aAccName;
+ if(_eType == TCTYPE_TABLECELL)
+ aAccName = _rTable.GetAccessibleObjectName( TCTYPE_TABLECELL, _nRowPos, _nColPos );
+ else if(_eType == TCTYPE_ROWHEADERCELL)
+ aAccName = _rTable.GetAccessibleObjectName( TCTYPE_ROWHEADERCELL, _nRowPos, 0 );
+ else if(_eType == TCTYPE_COLUMNHEADERCELL)
+ aAccName = _rTable.GetAccessibleObjectName( TCTYPE_COLUMNHEADERCELL, 0, _nRowPos );
+ implSetName( aAccName );
+ }
+
+ // -----------------------------------------------------------------------------
+ AccessibleGridControlCell::~AccessibleGridControlCell()
+ {
+ }
+
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleGridControlCell::grabFocus() throw ( RuntimeException )
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ m_aTable.GoToCell( m_nColPos, m_nRowPos );
+ }
+ //// -----------------------------------------------------------------------------
+ // implementation of a table cell
+ ::rtl::OUString AccessibleGridControlTableCell::implGetText()
+ {
+ ensureIsAlive();
+ //return mpTable->GetAccessibleCellText( getRowPos(), static_cast< USHORT >( getColumnPos() ) );
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "test" ));
+ }
+
+ ::com::sun::star::lang::Locale AccessibleGridControlTableCell::implGetLocale()
+ {
+ ensureIsAlive();
+ return m_aTable.GetAccessible()->getAccessibleContext()->getLocale();
+ }
+
+ void AccessibleGridControlTableCell::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
+ {
+ nStartIndex = 0;
+ nEndIndex = 0;
+ }
+
+ AccessibleGridControlTableCell::AccessibleGridControlTableCell(const Reference<XAccessible >& _rxParent,
+ IAccessibleTable& _rTable,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos,
+ AccessibleTableControlObjType eObjType)
+ :AccessibleGridControlCell( _rxParent, _rTable, _nRowPos, _nColPos, eObjType )
+ {
+ }
+
+ // XInterface -------------------------------------------------------------
+
+ /** Queries for a new interface. */
+ ::com::sun::star::uno::Any SAL_CALL AccessibleGridControlTableCell::queryInterface(
+ const ::com::sun::star::uno::Type& rType )
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ Any aRet = AccessibleGridControlCell::queryInterface(rType);
+ if ( !aRet.hasValue() )
+ aRet = AccessibleTextHelper_BASE::queryInterface(rType);
+ return aRet;
+ }
+
+ /** Aquires the object (calls acquire() on base class). */
+ void SAL_CALL AccessibleGridControlTableCell::acquire() throw ()
+ {
+ AccessibleGridControlCell::acquire();
+ }
+
+ /** Releases the object (calls release() on base class). */
+ void SAL_CALL AccessibleGridControlTableCell::release() throw ()
+ {
+ AccessibleGridControlCell::release();
+ }
+
+ ::com::sun::star::awt::Rectangle SAL_CALL AccessibleGridControlTableCell::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ensureIsAlive();
+ if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ ::com::sun::star::awt::Rectangle aRect;
+
+ if ( &m_aTable )
+ {
+ aRect = AWTRectangle( m_aTable.GetFieldCharacterBounds( getRowPos(), getColumnPos(), nIndex ) );
+ }
+
+ return aRect;
+ }
+
+ sal_Int32 SAL_CALL AccessibleGridControlTableCell::getIndexAtPoint( const ::com::sun::star::awt::Point& _aPoint ) throw (RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ return m_aTable.GetFieldIndexAtPoint( getRowPos(), getColumnPos(), VCLPoint( _aPoint ) );
+ }
+
+ /** @return
+ The name of this class.
+ */
+ ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlTableCell" ) );
+ }
+
+ /** @return The count of visible children. */
+ sal_Int32 SAL_CALL AccessibleGridControlTableCell::getAccessibleChildCount()
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ return 0;
+ }
+
+ /** @return The XAccessible interface of the specified child. */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ AccessibleGridControlTableCell::getAccessibleChild( sal_Int32 )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException )
+ {
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+
+ /** Creates a new AccessibleStateSetHelper and fills it with states of the
+ current object.
+ @return
+ A filled AccessibleStateSetHelper.
+ */
+ ::utl::AccessibleStateSetHelper* AccessibleGridControlTableCell::implCreateStateSetHelper()
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ::utl::AccessibleStateSetHelper* pStateSetHelper = new ::utl::AccessibleStateSetHelper;
+
+ if( isAlive() )
+ {
+ // SHOWING done with mxParent
+ if( implIsShowing() )
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+
+ m_aTable.FillAccessibleStateSetForCell( *pStateSetHelper, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return pStateSetHelper;
+ }
+
+
+ // XAccessible ------------------------------------------------------------
+
+ /** @return The XAccessibleContext interface of this object. */
+ Reference< XAccessibleContext > SAL_CALL AccessibleGridControlTableCell::getAccessibleContext() throw ( RuntimeException )
+ {
+ ensureIsAlive();
+ return this;
+ }
+
+ // XAccessibleContext -----------------------------------------------------
+
+ sal_Int32 SAL_CALL AccessibleGridControlTableCell::getAccessibleIndexInParent()
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ return ( getRowPos() * m_aTable.GetColumnCount() ) + getColumnPos();
+ }
+
+ sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return -1;
+ }
+ sal_Bool SAL_CALL AccessibleGridControlTableCell::setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+ }
+ sal_Unicode SAL_CALL AccessibleGridControlTableCell::getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getCharacter( nIndex );
+ }
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleGridControlTableCell::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ::rtl::OUString sText( implGetText() );
+
+ if ( !implIsValidIndex( nIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >();
+ }
+ sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getCharacterCount( );
+ }
+
+ ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getSelectedText( );
+ }
+ sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getSelectionStart( );
+ }
+ sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getSelectionEnd( );
+ }
+ sal_Bool SAL_CALL AccessibleGridControlTableCell::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+ }
+ ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getText( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getText( );
+ }
+ ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType);
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType);
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType);
+ }
+ sal_Bool SAL_CALL AccessibleGridControlTableCell::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ::rtl::OUString sText = implGetText();
+ checkIndex_Impl( nStartIndex, sText );
+ checkIndex_Impl( nEndIndex, sText );
+
+ //!!! don't know how to put a string into the clipboard
+ return sal_False;
+ }
+ Rectangle AccessibleGridControlTableCell::implGetBoundingBox()
+ {
+ return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle
+ }
+ // -----------------------------------------------------------------------------
+
+ Rectangle AccessibleGridControlTableCell::implGetBoundingBoxOnScreen()
+ {
+ return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle
+ }
+}
diff --git a/accessibility/source/extended/makefile.mk b/accessibility/source/extended/makefile.mk
index 701bff8f7b51..34f9158f1f02 100644
--- a/accessibility/source/extended/makefile.mk
+++ b/accessibility/source/extended/makefile.mk
@@ -64,7 +64,14 @@ SLOFILES=\
$(SLO)$/listboxaccessible.obj \
$(SLO)$/accessiblebrowseboxcell.obj \
$(SLO)$/accessibleeditbrowseboxcell.obj \
- $(SLO)$/textwindowaccessibility.obj
+ $(SLO)$/textwindowaccessibility.obj \
+ $(SLO)$/AccessibleGridControlBase.obj \
+ $(SLO)$/AccessibleGridControl.obj \
+ $(SLO)$/AccessibleGridControlTableBase.obj \
+ $(SLO)$/AccessibleGridControlHeader.obj \
+ $(SLO)$/AccessibleGridControlTableCell.obj \
+ $(SLO)$/AccessibleGridControlHeaderCell.obj \
+ $(SLO)$/AccessibleGridControlTable.obj
# --- Targets -------------------------------------------------------
diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx
index 5c8b742db53c..e01dd9d7c741 100644
--- a/accessibility/source/helper/acc_factory.cxx
+++ b/accessibility/source/helper/acc_factory.cxx
@@ -72,6 +72,8 @@
#include <accessibility/extended/accessibleeditbrowseboxcell.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/combobox.hxx>
+#include <accessibility/extended/AccessibleGridControl.hxx>
+#include <svtools/accessibletable.hxx>
#include <floatingwindowaccessible.hxx>
@@ -94,6 +96,7 @@ inline bool hasFloatingChild(Window *pWindow)
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::accessibility;
using namespace ::svt;
+ using namespace ::svt::table;
//================================================================
//= IAccessibleFactory
@@ -150,6 +153,12 @@ inline bool hasFloatingChild(Window *pWindow)
IAccessibleTableProvider& _rBrowseBox
) const;
+ virtual IAccessibleTableControl*
+ createAccessibleTableControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ IAccessibleTable& _rTable
+ ) const;
+
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
createAccessibleIconChoiceCtrl(
SvtIconChoiceCtrl& _rIconCtrl,
@@ -411,6 +420,13 @@ inline bool hasFloatingChild(Window *pWindow)
return new AccessibleBrowseBoxAccess( _rxParent, _rBrowseBox );
}
+ //--------------------------------------------------------------------
+ IAccessibleTableControl* AccessibleFactory::createAccessibleTableControl(
+ const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable ) const
+ {
+ return new AccessibleGridControlAccess( _rxParent, _rTable );
+ }
+
//--------------------------------------------------------------------
Reference< XAccessible > AccessibleFactory::createAccessibleIconChoiceCtrl(
SvtIconChoiceCtrl& _rIconCtrl, const Reference< XAccessible >& _xParent ) const
@@ -438,6 +454,30 @@ inline bool hasFloatingChild(Window *pWindow)
return new AccessibleListBox( _rListBox, _xParent );
}
+ ////--------------------------------------------------------------------
+ // Reference< XAccessible > AccessibleFactory::createAccessibleTableHeader(
+ // const Reference< XAccessible >& rxParent, IAccessibleTable& _rOwningTable, AccessibleTableControlObjType _eObjType) const
+ // {
+ // return new AccessibleGridControlHeader( rxParent, _rOwningTable, _eObjType);
+ // }
+
+ ////--------------------------------------------------------------------
+ // Reference< XAccessible > AccessibleFactory::createAccessibleTableCell(
+ // const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable,
+ // const Reference< XWindow >& _xFocusWindow, sal_Int32 _nRowId, sal_uInt16 _nColId ) const
+ // {
+ // return new AccessibleGridControlTableCell( _rxParent, _rTable, _xFocusWindow,
+ // _nRowId, _nColId);
+ // }
+ ////--------------------------------------------------------------------
+ // Reference< XAccessible > AccessibleFactory::createAccessibleTableHeaderCell(
+ // sal_Int32 _nRowId, const Reference< XAccessible >& rxParent, IAccessibleTable& _rTable,
+ // const Reference< XWindow >& _xFocusWindow, AccessibleTableControlObjType _eObjType) const
+ // {
+ // return new AccessibleGridControlHeaderCell( _nRowId, rxParent, _rTable,
+ // _xFocusWindow, _eObjType);
+ // }
+
//--------------------------------------------------------------------
Reference< XAccessible > AccessibleFactory::createAccessibleBrowseBoxHeaderBar(
const Reference< XAccessible >& rxParent, IAccessibleTableProvider& _rOwningTable,