summaryrefslogtreecommitdiff
path: root/chart2/source/controller/accessibility
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller/accessibility')
-rw-r--r--chart2/source/controller/accessibility/AccStatisticsObject.cxx81
-rw-r--r--chart2/source/controller/accessibility/AccStatisticsObject.hxx68
-rw-r--r--chart2/source/controller/accessibility/AccessibleBase.cxx1010
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartElement.cxx332
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartElement.hxx142
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartShape.cxx289
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartShape.hxx104
-rw-r--r--chart2/source/controller/accessibility/AccessibleChartView.cxx416
-rw-r--r--chart2/source/controller/accessibility/AccessibleTextHelper.cxx203
-rw-r--r--chart2/source/controller/accessibility/AccessibleViewForwarder.cxx116
-rw-r--r--chart2/source/controller/accessibility/AccessibleViewForwarder.hxx65
-rw-r--r--chart2/source/controller/accessibility/ChartElementFactory.cxx145
-rw-r--r--chart2/source/controller/accessibility/ChartElementFactory.hxx48
-rw-r--r--chart2/source/controller/accessibility/makefile.mk54
14 files changed, 3073 insertions, 0 deletions
diff --git a/chart2/source/controller/accessibility/AccStatisticsObject.cxx b/chart2/source/controller/accessibility/AccStatisticsObject.cxx
new file mode 100644
index 000000000000..9028973936e0
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccStatisticsObject.cxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_chart2.hxx"
+
+#include "AccStatisticsObject.hxx"
+#include <vcl/svapp.hxx>
+#include <svx/svditer.hxx>
+
+using ::rtl::OUString;
+
+namespace chart
+{
+
+AccStatisticsObject::AccStatisticsObject( const AccessibleElementInfo& rAccInfo )
+ : AccessibleChartElement( rAccInfo, false/*NoChildren*/, true/*AlwaysTransparent*/ )
+ //, m_eType( eType )
+ //, m_nSeriesIndex( nSeriesIndex )
+{
+// ChartModel * pModel = GetChartModel();
+// OSL_ASSERT( pModel );
+
+ // /-- solar
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+/* switch( eType )
+ {
+ case MEAN_VAL_LINE:
+ SetItemSet( pModel->GetAverageAttr( m_nSeriesIndex ));
+ break;
+ case ERROR_BARS:
+ SetItemSet( pModel->GetErrorAttr( m_nSeriesIndex ));
+ break;
+ case REGRESSION:
+ SetItemSet( pModel->GetRegressAttr( m_nSeriesIndex ));
+ break;
+ }*/
+ // \-- solar
+}
+
+AccStatisticsObject::~AccStatisticsObject()
+{
+}
+
+OUString SAL_CALL AccStatisticsObject::getAccessibleName()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return getToolTipText();
+}
+
+OUString SAL_CALL AccStatisticsObject::getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "StatisticsObject" ));
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/accessibility/AccStatisticsObject.hxx b/chart2/source/controller/accessibility/AccStatisticsObject.hxx
new file mode 100644
index 000000000000..da09342cd8b0
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccStatisticsObject.hxx
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef _CHART2_ACCSTATISTICSOBJECT_HXX
+#define _CHART2_ACCSTATISTICSOBJECT_HXX
+
+#ifndef _CHART2_ACCESSIBLE_CHART_ELEMENT_HXX_
+#include "AccessibleChartElement.hxx"
+#endif
+
+#include "ObjectIdentifier.hxx"
+
+namespace chart
+{
+
+class AccStatisticsObject : public AccessibleChartElement
+{
+public:
+ /*
+ enum StatisticsObjectType
+ {
+ MEAN_VAL_LINE = OBJECTTYPE_AVERAGEVALUE,
+ ERROR_BARS = OBJECTTYPE_ERROR,
+ REGRESSION = OBJECTTYPE_REGRESSION
+ };
+ */
+
+ AccStatisticsObject( const AccessibleElementInfo& rAccInfo );
+
+ virtual ~AccStatisticsObject();
+
+ // ________ XAccessibleContext ________
+ virtual ::rtl::OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XServiceInfo ________
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ //const StatisticsObjectType m_eType;
+ //const sal_uInt16 m_nSeriesIndex;
+};
+
+} // accessibility
+
+#endif
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx
new file mode 100644
index 000000000000..00335eab296e
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleBase.cxx
@@ -0,0 +1,1010 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_chart2.hxx"
+
+#include "AccessibleBase.hxx"
+#include "AccessibleChartShape.hxx"
+#include "ObjectHierarchy.hxx"
+#include "ObjectIdentifier.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "macros.hxx"
+
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <comphelper/serviceinfohelper.hxx>
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <rtl/ustrbuf.hxx>
+// for SolarMutex
+#include <vcl/svapp.hxx>
+#include <rtl/uuid.h>
+#include <cppuhelper/queryinterface.hxx>
+#include <svl/itemset.hxx>
+#include <editeng/unofdesc.hxx>
+#include <editeng/outliner.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/unoshape.hxx>
+#include <svx/unoprov.hxx>
+#include <vcl/unohelp.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/window.hxx>
+
+#include <algorithm>
+
+#include "ChartElementFactory.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+using ::com::sun::star::uno::UNO_QUERY;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Reference;
+using ::osl::MutexGuard;
+using ::osl::ClearableMutexGuard;
+using ::osl::ResettableMutexGuard;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Any;
+
+namespace chart
+{
+
+/** @param bMayHaveChildren is false per default
+ */
+AccessibleBase::AccessibleBase(
+ const AccessibleElementInfo & rAccInfo,
+ bool bMayHaveChildren,
+ bool bAlwaysTransparent /* default: false */ ) :
+ impl::AccessibleBase_Base( m_aMutex ),
+ m_bIsDisposed( false ),
+ m_bMayHaveChildren( bMayHaveChildren ),
+ m_bChildrenInitialized( false ),
+ m_nEventNotifierId(0),
+ m_pStateSetHelper( new ::utl::AccessibleStateSetHelper() ),
+ m_aStateSet( m_pStateSetHelper ),
+ m_aAccInfo( rAccInfo ),
+ m_bAlwaysTransparent( bAlwaysTransparent ),
+ m_bStateSetInitialized( false )
+{
+ // initialize some states
+ OSL_ASSERT( m_pStateSetHelper );
+ m_pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ m_pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ m_pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ m_pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
+ m_pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
+}
+
+AccessibleBase::~AccessibleBase()
+{
+ OSL_ASSERT( m_bIsDisposed );
+}
+
+// ________ public ________
+
+bool AccessibleBase::CheckDisposeState( bool bThrowException /* default: true */ ) const
+ throw (lang::DisposedException)
+{
+ if( bThrowException &&
+ m_bIsDisposed )
+ {
+ throw lang::DisposedException(
+ C2U("component has state DEFUNC" ),
+ static_cast< uno::XWeak * >( const_cast< AccessibleBase * >( this )));
+ }
+ return m_bIsDisposed;
+}
+
+bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId & rId )
+{
+ if( GetId() == rId )
+ {
+ // event is addressed to this object
+
+ ::com::sun::star::uno::Any aEmpty;
+ ::com::sun::star::uno::Any aSelected;
+ aSelected <<= AccessibleStateType::SELECTED;
+ switch( eEventType )
+ {
+ case OBJECT_CHANGE:
+ {
+ BroadcastAccEvent( AccessibleEventId::VISIBLE_DATA_CHANGED, aEmpty, aEmpty );
+#if OSL_DEBUG_LEVEL > 1
+ OSL_TRACE(
+ ::rtl::OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Visible data event sent by: " )) +
+ getAccessibleName(),
+ RTL_TEXTENCODING_ASCII_US ).getStr() );
+#endif
+ }
+ break;
+
+ case GOT_SELECTION:
+ {
+ AddState( AccessibleStateType::SELECTED );
+ BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aSelected, aEmpty );
+
+ AddState( AccessibleStateType::FOCUSED );
+ aSelected <<= AccessibleStateType::FOCUSED;
+ BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aSelected, aEmpty, true );
+#if OSL_DEBUG_LEVEL > 1
+ OSL_TRACE(
+ ::rtl::OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Selection acquired by: " )) +
+ getAccessibleName(),
+ RTL_TEXTENCODING_ASCII_US ).getStr() );
+#endif
+ }
+ break;
+
+ case LOST_SELECTION:
+ {
+ RemoveState( AccessibleStateType::SELECTED );
+ BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aEmpty, aSelected );
+
+ AddState( AccessibleStateType::FOCUSED );
+ aSelected <<= AccessibleStateType::FOCUSED;
+ BroadcastAccEvent( AccessibleEventId::STATE_CHANGED, aEmpty, aSelected, true );
+#if OSL_DEBUG_LEVEL > 1
+ OSL_TRACE(
+ ::rtl::OUStringToOString(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "Selection lost by: " )) +
+ getAccessibleName(),
+ RTL_TEXTENCODING_ASCII_US ).getStr() );
+#endif
+ }
+ break;
+
+ case PROPERTY_CHANGE:
+ {
+ //not implemented --> rebuild all
+ }
+ break;
+ }
+ return true;
+ }
+ else if( m_bMayHaveChildren )
+ {
+ bool bStop = false;
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+ // make local copy for notification
+ ChildListVectorType aLocalChildList( m_aChildList );
+ aGuard.clear();
+ // \--
+
+ ChildListVectorType::iterator aEndIter = aLocalChildList.end();
+ for( ChildListVectorType::iterator aIter = aLocalChildList.begin() ;
+ ( aIter != aEndIter ) && ( ! bStop ) ;
+ ++aIter )
+ {
+ // Note: at this place we must be sure to have an AccessibleBase
+ // object in the UNO reference to XAccessible !
+ bStop = (*static_cast< AccessibleBase * >
+ ( (*aIter).get() )).NotifyEvent( eEventType, rId );
+ }
+ return bStop;
+ }
+
+ return false;
+}
+
+void AccessibleBase::AddState( sal_Int16 aState )
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+ OSL_ASSERT( m_pStateSetHelper );
+ m_pStateSetHelper->AddState( aState );
+}
+
+void AccessibleBase::RemoveState( sal_Int16 aState )
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+ OSL_ASSERT( m_pStateSetHelper );
+ m_pStateSetHelper->RemoveState( aState );
+}
+
+// ________ protected ________
+
+bool AccessibleBase::UpdateChildren()
+{
+ bool bMustUpdateChildren = false;
+ {
+ // /--
+ MutexGuard aGuard( GetMutex() );
+ if( ! m_bMayHaveChildren ||
+ m_bIsDisposed )
+ return false;
+
+ bMustUpdateChildren = ( m_bMayHaveChildren &&
+ ! m_bChildrenInitialized );
+ // \--
+ }
+
+ // update unguarded
+ if( bMustUpdateChildren )
+ m_bChildrenInitialized = ImplUpdateChildren();
+
+ return m_bChildrenInitialized;
+}
+
+bool AccessibleBase::ImplUpdateChildren()
+{
+ bool bResult = false;
+
+ if( m_aAccInfo.m_spObjectHierarchy )
+ {
+ ObjectHierarchy::tChildContainer aModelChildren(
+ m_aAccInfo.m_spObjectHierarchy->getChildren( GetId() ));
+ ::std::vector< ChildOIDMap::key_type > aAccChildren;
+ aAccChildren.reserve( aModelChildren.size());
+ ::std::transform( m_aChildOIDMap.begin(), m_aChildOIDMap.end(),
+ ::std::back_inserter( aAccChildren ),
+ ::std::select1st< ChildOIDMap::value_type >());
+
+ ::std::sort( aModelChildren.begin(), aModelChildren.end());
+
+ ::std::vector< ObjectHierarchy::tOID > aChildrenToRemove, aChildrenToAdd;
+ ::std::set_difference( aModelChildren.begin(), aModelChildren.end(),
+ aAccChildren.begin(), aAccChildren.end(),
+ ::std::back_inserter( aChildrenToAdd ));
+ ::std::set_difference( aAccChildren.begin(), aAccChildren.end(),
+ aModelChildren.begin(), aModelChildren.end(),
+ ::std::back_inserter( aChildrenToRemove ));
+
+ ::std::vector< ObjectHierarchy::tOID >::const_iterator aIt( aChildrenToRemove.begin());
+ for( ; aIt != aChildrenToRemove.end(); ++aIt )
+ {
+ RemoveChildByOId( *aIt );
+ }
+
+ AccessibleElementInfo aAccInfo( GetInfo());
+ aAccInfo.m_pParent = this;
+
+ for( aIt = aChildrenToAdd.begin(); aIt != aChildrenToAdd.end(); ++aIt )
+ {
+ aAccInfo.m_aOID = *aIt;
+ if ( aIt->isAutoGeneratedObject() )
+ {
+ AddChild( ChartElementFactory::CreateChartElement( aAccInfo ) );
+ }
+ else if ( aIt->isAdditionalShape() )
+ {
+ AddChild( new AccessibleChartShape( aAccInfo, true, false ) );
+ }
+ }
+ bResult = true;
+ }
+
+ return bResult;
+}
+
+void AccessibleBase::AddChild( AccessibleBase * pChild )
+{
+ OSL_ENSURE( pChild != NULL, "Invalid Child" );
+ if( pChild )
+ {
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+
+ Reference< XAccessible > xChild( pChild );
+ m_aChildList.push_back( xChild );
+
+ m_aChildOIDMap[ pChild->GetId() ] = xChild;
+
+ // inform listeners of new child
+ if( m_bChildrenInitialized )
+ {
+ Any aEmpty, aNew;
+ aNew <<= xChild;
+
+ aGuard.clear();
+ // \-- (1st)
+ BroadcastAccEvent( AccessibleEventId::CHILD, aNew, aEmpty );
+ }
+ // \-- (2nd)
+ }
+}
+
+/** in this method we imply that the Reference< XAccessible > elements in the
+ vector are AccessibleBase objects !
+ */
+void AccessibleBase::RemoveChildByOId( const ObjectIdentifier& rOId )
+{
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+
+ ChildOIDMap::iterator aIt( m_aChildOIDMap.find( rOId ));
+ if( aIt != m_aChildOIDMap.end())
+ {
+ Reference< XAccessible > xChild( aIt->second );
+
+ // remove from map
+ m_aChildOIDMap.erase( aIt );
+
+ // search child in vector
+ ChildListVectorType::iterator aVecIter =
+ ::std::find( m_aChildList.begin(), m_aChildList.end(), xChild );
+
+ OSL_ENSURE( aVecIter != m_aChildList.end(),
+ "Inconsistent ChildMap" );
+
+ // remove child from vector
+ m_aChildList.erase( aVecIter );
+ bool bInitialized = m_bChildrenInitialized;
+
+ // call listeners unguarded
+ aGuard.clear();
+ // \-- (1st)
+
+ // inform listeners of removed child
+ if( bInitialized )
+ {
+ Any aEmpty, aOld;
+ aOld <<= xChild;
+
+ BroadcastAccEvent( AccessibleEventId::CHILD, aEmpty, aOld );
+ }
+
+ // dispose the child
+ Reference< lang::XComponent > xComp( xChild, UNO_QUERY );
+ if( xComp.is())
+ xComp->dispose();
+ }
+}
+
+awt::Point AccessibleBase::GetUpperLeftOnScreen() const
+{
+ awt::Point aResult;
+ if( m_aAccInfo.m_pParent )
+ {
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+ AccessibleBase * pParent = m_aAccInfo.m_pParent;
+ aGuard.clear();
+ // \--
+
+ if( pParent )
+ {
+ aResult = pParent->GetUpperLeftOnScreen();
+ }
+ else
+ OSL_ENSURE( false, "Default position used is probably incorrect." );
+ }
+
+ return aResult;
+}
+
+void AccessibleBase::BroadcastAccEvent(
+ sal_Int16 nId,
+ const Any & rNew,
+ const Any & rOld,
+ bool bSendGlobally ) const
+{
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+
+ if ( !m_nEventNotifierId && !bSendGlobally )
+ return;
+ // 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
+ //except SendGlobally for focus handling?
+
+ // the const cast is needed, because UNO parameters are never const
+ const AccessibleEventObject aEvent(
+ const_cast< uno::XWeak * >( static_cast< const uno::XWeak * >( this )),
+ nId, rNew, rOld );
+
+ if ( m_nEventNotifierId ) // let the notifier handle this event
+ ::comphelper::AccessibleEventNotifier::addEvent( m_nEventNotifierId, aEvent );
+
+ aGuard.clear();
+ // \--
+
+ // send event to global message queue
+ if( bSendGlobally )
+ {
+ ::vcl::unohelper::NotifyAccessibleStateEventGlobally( aEvent );
+ }
+}
+
+void AccessibleBase::KillAllChildren()
+{
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+
+ // make local copy for notification
+ ChildListVectorType aLocalChildList( m_aChildList );
+
+ // remove all children
+ m_aChildList.clear();
+ m_aChildOIDMap.clear();
+
+ aGuard.clear();
+ // \--
+
+ // call dispose for all children
+ // and notify listeners
+ Reference< lang::XComponent > xComp;
+ Any aEmpty, aOld;
+ ChildListVectorType::const_iterator aEndIter = aLocalChildList.end();
+ for( ChildListVectorType::const_iterator aIter = aLocalChildList.begin();
+ aIter != aEndIter; ++aIter )
+ {
+ aOld <<= (*aIter);
+ BroadcastAccEvent( AccessibleEventId::CHILD, aEmpty, aOld );
+
+ xComp.set( *aIter, UNO_QUERY );
+ if( xComp.is())
+ xComp->dispose();
+ }
+ m_bChildrenInitialized = false;
+}
+
+AccessibleElementInfo AccessibleBase::GetInfo() const
+{
+ return m_aAccInfo;
+}
+
+void AccessibleBase::SetInfo( const AccessibleElementInfo & rNewInfo )
+{
+ m_aAccInfo = rNewInfo;
+ if( m_bMayHaveChildren )
+ {
+ KillAllChildren();
+ }
+ BroadcastAccEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, uno::Any(), uno::Any(),
+ true /* global notification */ );
+}
+
+AccessibleUniqueId AccessibleBase::GetId() const
+{
+ return m_aAccInfo.m_aOID;
+}
+
+// ____________________________________
+// ____________________________________
+//
+// Interfaces
+// ____________________________________
+// ____________________________________
+
+// ________ (XComponent::dispose) ________
+void SAL_CALL AccessibleBase::disposing()
+{
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+ OSL_ENSURE( ! m_bIsDisposed, "dispose() called twice" );
+
+ // notify disposing to all AccessibleEvent listeners asynchron
+ if ( m_nEventNotifierId )
+ {
+ ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( m_nEventNotifierId, *this );
+ m_nEventNotifierId = 0;
+ }
+
+ // reset pointers
+ m_aAccInfo.m_pParent = NULL;
+
+ // invalidate implementation for helper, but keep UNO reference to still
+ // allow a tool to query the DEFUNC state.
+ // Note: The object will be deleted when the last reference is released
+ m_pStateSetHelper = NULL;
+
+ // attach new empty state set helper to member reference
+ ::utl::AccessibleStateSetHelper * pHelper = new ::utl::AccessibleStateSetHelper();
+ pHelper->AddState( AccessibleStateType::DEFUNC );
+ // release old helper and attach new one
+ m_aStateSet.set( pHelper );
+
+ m_bIsDisposed = true;
+
+ // call listeners unguarded
+ aGuard.clear();
+ // \--
+
+ if( m_bMayHaveChildren )
+ {
+ KillAllChildren();
+ }
+ else
+ OSL_ENSURE( m_aChildList.empty(), "Child list should be empty" );
+}
+
+// ________ XAccessible ________
+Reference< XAccessibleContext > SAL_CALL AccessibleBase::getAccessibleContext()
+ throw (RuntimeException)
+{
+ return this;
+}
+
+// ________ AccessibleBase::XAccessibleContext ________
+sal_Int32 SAL_CALL AccessibleBase::getAccessibleChildCount()
+ throw (RuntimeException)
+{
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+ if( ! m_bMayHaveChildren ||
+ m_bIsDisposed )
+ return 0;
+
+ bool bMustUpdateChildren = ( m_bMayHaveChildren &&
+ ! m_bChildrenInitialized );
+
+ aGuard.clear();
+ // \--
+
+ // update unguarded
+ if( bMustUpdateChildren )
+ UpdateChildren();
+
+ return ImplGetAccessibleChildCount();
+}
+
+sal_Int32 AccessibleBase::ImplGetAccessibleChildCount() const
+ throw (RuntimeException)
+{
+ return m_aChildList.size();
+}
+
+Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleChild( sal_Int32 i )
+ throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+ CheckDisposeState();
+ Reference< XAccessible > xResult;
+
+ // /--
+ ResettableMutexGuard aGuard( GetMutex() );
+ bool bMustUpdateChildren = ( m_bMayHaveChildren &&
+ ! m_bChildrenInitialized );
+
+ aGuard.clear();
+ // \--
+
+ if( bMustUpdateChildren )
+ UpdateChildren();
+
+ xResult.set( ImplGetAccessibleChildById( i ));
+
+ return xResult;
+ // \--
+}
+
+Reference< XAccessible > AccessibleBase::ImplGetAccessibleChildById( sal_Int32 i ) const
+ throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+ Reference< XAccessible > xResult;
+ // /--
+ MutexGuard aGuard( GetMutex());
+ if( ! m_bMayHaveChildren ||
+ i < 0 ||
+ static_cast< ChildListVectorType::size_type >( i ) >= m_aChildList.size() )
+ {
+ OUStringBuffer aBuf;
+ aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Index " ));
+ aBuf.append( i );
+ aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " is invalid for range [ 0, " ));
+ aBuf.append( static_cast< sal_Int32 >( m_aChildList.size() - 1 ) );
+ aBuf.appendAscii( RTL_CONSTASCII_STRINGPARAM( " ]" ) );
+ lang::IndexOutOfBoundsException aEx( aBuf.makeStringAndClear(),
+ const_cast< ::cppu::OWeakObject * >(
+ static_cast< const ::cppu::OWeakObject * >( this )));
+ throw aEx;
+ }
+ else
+ xResult.set( m_aChildList[ i ] );
+
+ return xResult;
+}
+
+Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleParent()
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+ Reference< XAccessible > aResult;
+ if( m_aAccInfo.m_pParent )
+ aResult.set( m_aAccInfo.m_pParent );
+
+ return aResult;
+}
+
+sal_Int32 SAL_CALL AccessibleBase::getAccessibleIndexInParent()
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+
+ if( m_aAccInfo.m_spObjectHierarchy )
+ return m_aAccInfo.m_spObjectHierarchy->getIndexInParent( GetId() );
+ return -1;
+}
+
+sal_Int16 SAL_CALL AccessibleBase::getAccessibleRole()
+ throw (RuntimeException)
+{
+ return AccessibleRole::LIST_ITEM; // #i73747# role SHAPE seems more appropriate, but is not read
+}
+
+Reference< XAccessibleRelationSet > SAL_CALL AccessibleBase::getAccessibleRelationSet()
+ throw (RuntimeException)
+{
+ Reference< XAccessibleRelationSet > aResult;
+ return aResult;
+}
+
+Reference< XAccessibleStateSet > SAL_CALL AccessibleBase::getAccessibleStateSet()
+ throw (RuntimeException)
+{
+ if( ! m_bStateSetInitialized )
+ {
+ Reference< view::XSelectionSupplier > xSelSupp( GetInfo().m_xSelectionSupplier );
+ if ( xSelSupp.is() )
+ {
+ ObjectIdentifier aOID( xSelSupp->getSelection() );
+ if ( aOID.isValid() && GetId() == aOID )
+ {
+ AddState( AccessibleStateType::SELECTED );
+ AddState( AccessibleStateType::FOCUSED );
+ }
+ }
+ m_bStateSetInitialized = true;
+ }
+
+ return m_aStateSet;
+}
+
+
+lang::Locale SAL_CALL AccessibleBase::getLocale()
+ throw (IllegalAccessibleComponentStateException, RuntimeException)
+{
+ CheckDisposeState();
+
+ return Application::GetSettings().GetLocale();
+}
+
+// ________ AccessibleBase::XAccessibleComponent ________
+sal_Bool SAL_CALL AccessibleBase::containsPoint( const awt::Point& aPoint )
+ throw (RuntimeException)
+{
+ awt::Rectangle aRect( getBounds() );
+
+ // contains() works with relative coordinates
+ aRect.X = 0;
+ aRect.Y = 0;
+
+ return ( aPoint.X >= aRect.X &&
+ aPoint.Y >= aRect.Y &&
+ aPoint.X < (aRect.X + aRect.Width) &&
+ aPoint.Y < (aRect.Y + aRect.Height) );
+}
+
+Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleAtPoint( const awt::Point& aPoint )
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+ Reference< XAccessible > aResult;
+ awt::Rectangle aRect( getBounds());
+
+ // children are positioned relative to this object, so translate bound rect
+ aRect.X = 0;
+ aRect.Y = 0;
+
+ // children must be inside the own bound rect
+ if( ( aRect.X <= aPoint.X && aPoint.X <= (aRect.X + aRect.Width) ) &&
+ ( aRect.Y <= aPoint.Y && aPoint.Y <= (aRect.Y + aRect.Height)))
+ {
+ // /--
+ ClearableMutexGuard aGuard( GetMutex() );
+ ChildListVectorType aLocalChildList( m_aChildList );
+ aGuard.clear();
+ // \--
+
+ Reference< XAccessibleComponent > aComp;
+ for( ChildListVectorType::const_iterator aIter = aLocalChildList.begin();
+ aIter != aLocalChildList.end(); ++aIter )
+ {
+ aComp.set( *aIter, UNO_QUERY );
+ if( aComp.is())
+ {
+ aRect = aComp->getBounds();
+ if( ( aRect.X <= aPoint.X && aPoint.X <= (aRect.X + aRect.Width) ) &&
+ ( aRect.Y <= aPoint.Y && aPoint.Y <= (aRect.Y + aRect.Height)))
+ {
+ aResult = (*aIter);
+ break;
+ }
+ }
+ }
+ }
+
+ return aResult;
+}
+
+awt::Rectangle SAL_CALL AccessibleBase::getBounds()
+ throw (RuntimeException)
+{
+ ExplicitValueProvider *pExplicitValueProvider(
+ ExplicitValueProvider::getExplicitValueProvider( m_aAccInfo.m_xView ));
+ if( pExplicitValueProvider )
+ {
+ Window* pWindow( VCLUnoHelper::GetWindow( m_aAccInfo.m_xWindow ));
+ awt::Rectangle aLogicRect( pExplicitValueProvider->getRectangleOfObject( m_aAccInfo.m_aOID.getObjectCID() ));
+ if( pWindow )
+ {
+ Rectangle aRect( aLogicRect.X, aLogicRect.Y,
+ aLogicRect.X + aLogicRect.Width,
+ aLogicRect.Y + aLogicRect.Height );
+ // /-- solar
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ aRect = pWindow->LogicToPixel( aRect );
+
+ // aLogicRect ist relative to the page, but we need a value relative
+ // to the parent object
+ awt::Point aParentLocOnScreen;
+ uno::Reference< XAccessibleComponent > xParent( getAccessibleParent(), uno::UNO_QUERY );
+ if( xParent.is() )
+ aParentLocOnScreen = xParent->getLocationOnScreen();
+
+ // aOffset = aParentLocOnScreen - GetUpperLeftOnScreen()
+ awt::Point aULOnScreen = GetUpperLeftOnScreen();
+ awt::Point aOffset( aParentLocOnScreen.X - aULOnScreen.X,
+ aParentLocOnScreen.Y - aULOnScreen.Y );
+
+ return awt::Rectangle( aRect.getX() - aOffset.X, aRect.getY() - aOffset.Y,
+ aRect.getWidth(), aRect.getHeight());
+ // \-- solar
+ }
+ }
+
+ return awt::Rectangle();
+}
+
+awt::Point SAL_CALL AccessibleBase::getLocation()
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+ awt::Rectangle aBBox( getBounds() );
+ return awt::Point( aBBox.X, aBBox.Y );
+}
+
+awt::Point SAL_CALL AccessibleBase::getLocationOnScreen()
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+
+ if( m_aAccInfo.m_pParent != NULL )
+ {
+ AccessibleBase * pParent = m_aAccInfo.m_pParent;
+ awt::Point aLocThisRel( getLocation());
+ awt::Point aUpperLeft;
+
+ if( pParent != NULL )
+ aUpperLeft = pParent->getLocationOnScreen();
+
+ return awt::Point( aUpperLeft.X + aLocThisRel.X,
+ aUpperLeft.Y + aLocThisRel.Y );
+ }
+ else
+ return getLocation();
+}
+
+awt::Size SAL_CALL AccessibleBase::getSize()
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+ awt::Rectangle aBBox( getBounds() );
+ return awt::Size( aBBox.Width, aBBox.Height );
+}
+
+void SAL_CALL AccessibleBase::grabFocus()
+ throw (RuntimeException)
+{
+ CheckDisposeState();
+
+ Reference< view::XSelectionSupplier > xSelSupp( GetInfo().m_xSelectionSupplier );
+ if ( xSelSupp.is() )
+ {
+ xSelSupp->select( GetId().getAny() );
+ }
+}
+
+sal_Int32 SAL_CALL AccessibleBase::getForeground()
+ throw (RuntimeException)
+{
+ return getColor( ACC_BASE_FOREGROUND );
+}
+
+sal_Int32 SAL_CALL AccessibleBase::getBackground()
+ throw (RuntimeException)
+{
+ return getColor( ACC_BASE_BACKGROUND );
+}
+
+sal_Int32 AccessibleBase::getColor( eColorType eColType )
+{
+ sal_Int32 nResult = static_cast< sal_Int32 >( Color( COL_TRANSPARENT ).GetColor());
+ if( m_bAlwaysTransparent )
+ return nResult;
+
+ ObjectIdentifier aOID( m_aAccInfo.m_aOID );
+ ObjectType eType( aOID.getObjectType() );
+ Reference< beans::XPropertySet > xObjProp;
+ OUString aObjectCID = aOID.getObjectCID();
+ if( eType == OBJECTTYPE_LEGEND_ENTRY )
+ {
+ // for colors get the data series/point properties
+ OUString aParentParticle( ObjectIdentifier::getFullParentParticle( aObjectCID ));
+ aObjectCID = ObjectIdentifier::createClassifiedIdentifierForParticle( aParentParticle );
+ }
+
+ xObjProp.set(
+ ObjectIdentifier::getObjectPropertySet(
+ aObjectCID, Reference< chart2::XChartDocument >( m_aAccInfo.m_xChartDocument )), uno::UNO_QUERY );
+ if( xObjProp.is())
+ {
+ try
+ {
+ OUString aPropName;
+ OUString aStylePropName;
+
+ switch( eType )
+ {
+ case OBJECTTYPE_LEGEND_ENTRY:
+ case OBJECTTYPE_DATA_SERIES:
+ case OBJECTTYPE_DATA_POINT:
+ if( eColType == ACC_BASE_FOREGROUND )
+ {
+ aPropName = C2U("BorderColor");
+ aStylePropName = C2U("BorderTransparency");
+ }
+ else
+ {
+ aPropName = C2U("Color");
+ aStylePropName = C2U("Transparency");
+ }
+ break;
+ default:
+ if( eColType == ACC_BASE_FOREGROUND )
+ {
+ aPropName = C2U("LineColor");
+ aStylePropName = C2U("LineTransparence");
+ }
+ else
+ {
+ aPropName = C2U("FillColor");
+ aStylePropName = C2U("FillTransparence");
+ }
+ break;
+ }
+
+ bool bTransparent = m_bAlwaysTransparent;
+ Reference< beans::XPropertySetInfo > xInfo( xObjProp->getPropertySetInfo(), uno::UNO_QUERY );
+ if( xInfo.is() &&
+ xInfo->hasPropertyByName( aStylePropName ))
+ {
+ if( eColType == ACC_BASE_FOREGROUND )
+ {
+ drawing::LineStyle aLStyle;
+ if( xObjProp->getPropertyValue( aStylePropName ) >>= aLStyle )
+ bTransparent = (aLStyle == drawing::LineStyle_NONE);
+ }
+ else
+ {
+ drawing::FillStyle aFStyle;
+ if( xObjProp->getPropertyValue( aStylePropName ) >>= aFStyle )
+ bTransparent = (aFStyle == drawing::FillStyle_NONE);
+ }
+ }
+
+ if( !bTransparent &&
+ xInfo.is() &&
+ xInfo->hasPropertyByName( aPropName ))
+ {
+ xObjProp->getPropertyValue( aPropName ) >>= nResult;
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return nResult;
+}
+
+// ________ AccessibleBase::XServiceInfo ________
+OUString SAL_CALL AccessibleBase::getImplementationName()
+ throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "AccessibleBase" ));
+}
+
+sal_Bool SAL_CALL AccessibleBase::supportsService( const OUString& ServiceName )
+ throw (RuntimeException)
+{
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+}
+
+uno::Sequence< OUString > SAL_CALL AccessibleBase::getSupportedServiceNames()
+ throw (RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aSeq( 2 );
+ ::rtl::OUString* pStr = aSeq.getArray();
+ pStr[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.Accessible" ));
+ pStr[ 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ));
+
+ return aSeq;
+}
+
+// ________ AccessibleBase::XEventListener ________
+void SAL_CALL AccessibleBase::disposing( const lang::EventObject& /*Source*/ )
+ throw (RuntimeException)
+{
+}
+
+// ________ XAccessibleEventBroadcasters ________
+void SAL_CALL AccessibleBase::addEventListener( const Reference< XAccessibleEventListener >& xListener )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( GetMutex() );
+
+ if ( xListener.is() )
+ {
+ if ( !m_nEventNotifierId )
+ m_nEventNotifierId = ::comphelper::AccessibleEventNotifier::registerClient();
+
+ ::comphelper::AccessibleEventNotifier::addEventListener( m_nEventNotifierId, xListener );
+ }
+}
+
+void SAL_CALL AccessibleBase::removeEventListener( const Reference< XAccessibleEventListener >& xListener )
+ throw (RuntimeException)
+{
+ MutexGuard aGuard( GetMutex() );
+
+ if ( xListener.is() )
+ {
+ sal_Int32 nListenerCount = ::comphelper::AccessibleEventNotifier::removeEventListener( m_nEventNotifierId, xListener );
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ ::comphelper::AccessibleEventNotifier::revokeClient( m_nEventNotifierId );
+ m_nEventNotifierId = 0;
+ }
+ }
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.cxx b/chart2/source/controller/accessibility/AccessibleChartElement.cxx
new file mode 100644
index 000000000000..2361cc62c389
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleChartElement.cxx
@@ -0,0 +1,332 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_chart2.hxx"
+
+#include "AccessibleChartElement.hxx"
+#include "CharacterProperties.hxx"
+#include "ObjectIdentifier.hxx"
+#include "ObjectNameProvider.hxx"
+#include "servicenames.hxx"
+#include "macros.hxx"
+
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/chart2/XTitle.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+
+// for SolarMutex
+#include <vcl/svapp.hxx>
+#include <rtl/ustrbuf.hxx>
+
+// #ifndef _RTL_UUID_H_
+// #include <rtl/uuid.h>
+// #endif
+// #ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
+// #include <cppuhelper/queryinterface.hxx>
+// #endif
+// #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+// #include <toolkit/helper/vclunohelper.hxx>
+// #endif
+// #ifndef _SV_WINDOW_HXX
+// #include <vcl/window.hxx>
+// #endif
+
+// #ifndef _SVX_ACCESSILE_TEXT_HELPER_HXX_
+// #include <svx/AccessibleTextHelper.hxx>
+// #endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+using ::com::sun::star::uno::UNO_QUERY;
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::osl::MutexGuard;
+using ::osl::ClearableMutexGuard;
+using ::osl::ResettableMutexGuard;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Any;
+
+namespace chart
+{
+
+AccessibleChartElement::AccessibleChartElement(
+ const AccessibleElementInfo & rAccInfo,
+ bool bMayHaveChildren,
+ bool bAlwaysTransparent /* default: false */ ) :
+ impl::AccessibleChartElement_Base( rAccInfo, bMayHaveChildren, bAlwaysTransparent ),
+ m_bHasText( false )
+{
+ AddState( AccessibleStateType::TRANSIENT );
+}
+
+AccessibleChartElement::~AccessibleChartElement()
+{
+ OSL_ASSERT( CheckDisposeState( false /* don't throw exceptions */ ) );
+}
+
+// ________ protected ________
+
+bool AccessibleChartElement::ImplUpdateChildren()
+{
+ bool bResult = false;
+ Reference< chart2::XTitle > xTitle(
+ ObjectIdentifier::getObjectPropertySet(
+ GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )),
+ uno::UNO_QUERY );
+ m_bHasText = xTitle.is();
+
+ if( m_bHasText )
+ {
+ InitTextEdit();
+ bResult = true;
+ }
+ else
+ bResult = AccessibleBase::ImplUpdateChildren();
+
+ return bResult;
+}
+
+void AccessibleChartElement::InitTextEdit()
+{
+ if( ! m_xTextHelper.is())
+ {
+ // get hard reference
+ Reference< view::XSelectionSupplier > xSelSupp( GetInfo().m_xSelectionSupplier );
+ // get factory from selection supplier (controller)
+ Reference< lang::XMultiServiceFactory > xFact( xSelSupp, uno::UNO_QUERY );
+ if( xFact.is())
+ {
+ m_xTextHelper.set(
+ xFact->createInstance( CHART_ACCESSIBLE_TEXT_SERVICE_NAME ), uno::UNO_QUERY );
+ }
+ }
+
+ if( m_xTextHelper.is())
+ try
+ {
+ Reference< lang::XInitialization > xInit( m_xTextHelper, uno::UNO_QUERY_THROW );
+ Sequence< uno::Any > aArgs( 3 );
+ aArgs[0] <<= GetInfo().m_aOID.getObjectCID();
+ aArgs[1] <<= Reference< XAccessible >( this );
+ aArgs[2] <<= Reference< awt::XWindow >( GetInfo().m_xWindow );
+ xInit->initialize( aArgs );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+// OSL_ASSERT( m_pTextHelper == 0 );
+
+// // /-- solar
+// ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+// Window* pWindow( VCLUnoHelper::GetWindow( GetInfo().m_xWindow ));
+// if( pWindow )
+// {
+// // we need ChartController::m_pDrawViewWrapper here
+// SdrView * pView = 0;
+// if( pView )
+// {
+// SdrObject * pTextObj = m_pDrawViewWrapper->getTextEditObject();
+// if( pTextObj )
+// {
+// SvxEditSource * pEditSource = new SvxEditSource( pTextObj, pView, pWindow );
+// m_pTextHelper = new ::accessibility::AccessibleTextHelper(
+// ::std::auto_ptr< SvxEditSource >( pEditSource ));
+// if( m_pTextHelper )
+// m_pTextHelper->SetEventSource( this );
+// }
+// }
+// }
+// // \-- solar
+// }
+
+// ____________________________________
+// ____________________________________
+//
+// Interfaces
+// ____________________________________
+// ____________________________________
+
+// ________ AccessibleBase::XAccessibleContext ________
+Reference< XAccessible > AccessibleChartElement::ImplGetAccessibleChildById( sal_Int32 i ) const
+ throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+ Reference< XAccessible > xResult;
+
+ if( m_bHasText )
+ {
+ xResult.set( m_xTextHelper->getAccessibleChild( i ));
+ // /-- solar
+// ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+// if( m_pTextHelper )
+// xResult.set( m_pTextHelper->GetChild( i ) );
+ // \-- solar
+ }
+ else
+ xResult.set( AccessibleBase::ImplGetAccessibleChildById( i ));
+
+ return xResult;
+}
+
+sal_Int32 AccessibleChartElement::ImplGetAccessibleChildCount() const
+ throw (RuntimeException)
+{
+ if( m_bHasText )
+ {
+ if( m_xTextHelper.is())
+ return m_xTextHelper->getAccessibleChildCount();
+ return 0;
+ }
+
+ return AccessibleBase::ImplGetAccessibleChildCount();
+}
+
+// ________ XServiceInfo ________
+OUString SAL_CALL AccessibleChartElement::getImplementationName()
+ throw (RuntimeException)
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "AccessibleChartElement" ));
+}
+
+// ________ AccessibleChartElement::XAccessibleContext (overloaded) ________
+OUString SAL_CALL AccessibleChartElement::getAccessibleName()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return ObjectNameProvider::getNameForCID(
+ GetInfo().m_aOID.getObjectCID(), GetInfo().m_xChartDocument );
+}
+
+// ________ AccessibleChartElement::XAccessibleContext (overloaded) ________
+OUString SAL_CALL AccessibleChartElement::getAccessibleDescription()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return getToolTipText();
+}
+
+// ________ AccessibleChartElement::XAccessibleExtendedComponent ________
+Reference< awt::XFont > SAL_CALL AccessibleChartElement::getFont()
+ throw (uno::RuntimeException)
+{
+ CheckDisposeState();
+
+ Reference< awt::XFont > xFont;
+ // using assignment for broken gcc 3.3
+ Reference< awt::XDevice > xDevice = Reference< awt::XDevice >(
+ Reference< awt::XWindow >( GetInfo().m_xWindow ), uno::UNO_QUERY );
+
+ if( xDevice.is())
+ {
+ Reference< beans::XMultiPropertySet > xObjProp(
+ ObjectIdentifier::getObjectPropertySet(
+ GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )), uno::UNO_QUERY );
+ awt::FontDescriptor aDescr(
+ CharacterProperties::createFontDescriptorFromPropertySet( xObjProp ));
+ xFont = xDevice->getFont( aDescr );
+ }
+
+ return xFont;
+}
+
+OUString SAL_CALL AccessibleChartElement::getTitledBorderText()
+ throw (uno::RuntimeException)
+{
+ return OUString();
+}
+
+OUString SAL_CALL AccessibleChartElement::getToolTipText()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ CheckDisposeState();
+
+ return ObjectNameProvider::getHelpText(
+ GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument ));
+}
+
+// ________ XAccessibleComponent ________
+sal_Bool SAL_CALL AccessibleChartElement::containsPoint( const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::containsPoint( aPoint );
+}
+
+Reference< XAccessible > SAL_CALL AccessibleChartElement::getAccessibleAtPoint( const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::getAccessibleAtPoint( aPoint );
+}
+
+awt::Rectangle SAL_CALL AccessibleChartElement::getBounds()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::getBounds();
+}
+
+awt::Point SAL_CALL AccessibleChartElement::getLocation()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::getLocation();
+}
+
+awt::Point SAL_CALL AccessibleChartElement::getLocationOnScreen()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::getLocationOnScreen();
+}
+
+awt::Size SAL_CALL AccessibleChartElement::getSize()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::getSize();
+}
+
+void SAL_CALL AccessibleChartElement::grabFocus()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::grabFocus();
+}
+
+sal_Int32 SAL_CALL AccessibleChartElement::getForeground()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::getForeground();
+}
+
+sal_Int32 SAL_CALL AccessibleChartElement::getBackground()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::getBackground();
+}
+
+
+} // namespace chart
diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.hxx b/chart2/source/controller/accessibility/AccessibleChartElement.hxx
new file mode 100644
index 000000000000..d74b5d9d11b9
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleChartElement.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef _CHART2_ACCESSIBLECHARTELEMENT_HXX_
+#define _CHART2_ACCESSIBLECHARTELEMENT_HXX_
+
+#include "AccessibleBase.hxx"
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+
+#include <vector>
+#include <map>
+#include <boost/shared_ptr.hpp>
+
+class SfxItemSet;
+class SdrObject;
+
+namespace chart
+{
+
+/** Base class for all Chart Accessibility objects except the root node (see AccessibleChartView)
+
+ This class contains a reference to the ChartModel, thus, components can easily access all core functionality.
+
+ Usage Instructions:
+
+ <ul>
+ <li>define the getAccessibleName() method of XAccessibleContext</li>
+ <li>set the ChartModel using SetChartModel() for the first node before
+ creating any children</li>
+ <li>overload UpdateChildren()</li>
+ </ul>
+ */
+
+namespace impl
+{
+typedef ::cppu::ImplInheritanceHelper1<
+ AccessibleBase,
+ ::com::sun::star::accessibility::XAccessibleExtendedComponent
+ > AccessibleChartElement_Base;
+}
+
+class AccessibleChartElement :
+ public impl::AccessibleChartElement_Base
+{
+public:
+ AccessibleChartElement( const AccessibleElementInfo & rAccInfo,
+ bool bMayHaveChildren,
+ bool bAlwaysTransparent = false );
+ virtual ~AccessibleChartElement();
+
+ // ________ AccessibleBase ________
+ virtual bool ImplUpdateChildren();
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ ImplGetAccessibleChildById( sal_Int32 i ) const
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 ImplGetAccessibleChildCount() const
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XAccessibleContext ________
+ virtual ::rtl::OUString SAL_CALL getAccessibleName()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XAccessibleExtendedComponent ________
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitledBorderText()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getToolTipText()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // the following interface is implemented in AccessibleBase, however it is
+ // also a (non-virtual) base class of XAccessibleExtendedComponent Thus
+ // these methods have to be overloaded and forward to AccessibleBase
+
+ // ________ XAccessibleComponent ________
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground() throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XServiceInfo ________
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ bool m_bHasText;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext >
+ m_xTextHelper;
+
+ void InitTextEdit();
+};
+
+} // namespace chart
+
+#endif
diff --git a/chart2/source/controller/accessibility/AccessibleChartShape.cxx b/chart2/source/controller/accessibility/AccessibleChartShape.cxx
new file mode 100644
index 000000000000..bbf6176641da
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleChartShape.cxx
@@ -0,0 +1,289 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_chart2.hxx"
+
+#include "AccessibleChartShape.hxx"
+#include "ObjectHierarchy.hxx"
+#include "ObjectIdentifier.hxx"
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <svx/ShapeTypeHandler.hxx>
+#include <svx/AccessibleShape.hxx>
+#include <svx/AccessibleShapeInfo.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::RuntimeException;
+
+
+namespace chart
+{
+
+AccessibleChartShape::AccessibleChartShape(
+ const AccessibleElementInfo& rAccInfo,
+ bool bMayHaveChildren, bool bAlwaysTransparent )
+ :impl::AccessibleChartShape_Base( rAccInfo, bMayHaveChildren, bAlwaysTransparent )
+ ,m_pAccShape( NULL )
+{
+ if ( rAccInfo.m_aOID.isAdditionalShape() )
+ {
+ Reference< drawing::XShape > xShape( rAccInfo.m_aOID.getAdditionalShape() );
+ Reference< XAccessible > xParent;
+ if ( rAccInfo.m_pParent )
+ {
+ xParent.set( rAccInfo.m_pParent );
+ }
+ sal_Int32 nIndex = -1;
+ if ( rAccInfo.m_spObjectHierarchy )
+ {
+ nIndex = rAccInfo.m_spObjectHierarchy->getIndexInParent( rAccInfo.m_aOID );
+ }
+ ::accessibility::AccessibleShapeInfo aShapeInfo( xShape, xParent, nIndex );
+
+ m_aShapeTreeInfo.SetSdrView( rAccInfo.m_pSdrView );
+ m_aShapeTreeInfo.SetController( NULL );
+ m_aShapeTreeInfo.SetWindow( VCLUnoHelper::GetWindow( rAccInfo.m_xWindow ) );
+ m_aShapeTreeInfo.SetViewForwarder( rAccInfo.m_pViewForwarder );
+
+ ::accessibility::ShapeTypeHandler& rShapeHandler = ::accessibility::ShapeTypeHandler::Instance();
+ m_pAccShape = rShapeHandler.CreateAccessibleObject( aShapeInfo, m_aShapeTreeInfo );
+ if ( m_pAccShape )
+ {
+ m_pAccShape->acquire();
+ m_pAccShape->Init();
+ }
+ }
+}
+
+AccessibleChartShape::~AccessibleChartShape()
+{
+ OSL_ASSERT( CheckDisposeState( false /* don't throw exceptions */ ) );
+
+ if ( m_pAccShape )
+ {
+ m_pAccShape->dispose();
+ m_pAccShape->release();
+ }
+}
+
+// ________ XServiceInfo ________
+::rtl::OUString AccessibleChartShape::getImplementationName()
+ throw (RuntimeException)
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AccessibleChartShape" ) );
+}
+
+// ________ XAccessibleContext ________
+sal_Int32 AccessibleChartShape::getAccessibleChildCount()
+ throw (RuntimeException)
+{
+ sal_Int32 nCount(0);
+ if ( m_pAccShape )
+ {
+ nCount = m_pAccShape->getAccessibleChildCount();
+ }
+ return nCount;
+}
+
+Reference< XAccessible > AccessibleChartShape::getAccessibleChild( sal_Int32 i )
+ throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+ Reference< XAccessible > xChild;
+ if ( m_pAccShape )
+ {
+ xChild = m_pAccShape->getAccessibleChild( i );
+ }
+ return xChild;
+}
+
+sal_Int16 AccessibleChartShape::getAccessibleRole()
+ throw (RuntimeException)
+{
+ sal_Int16 nRole(0);
+ if ( m_pAccShape )
+ {
+ nRole = m_pAccShape->getAccessibleRole();
+ }
+ return nRole;
+}
+
+::rtl::OUString AccessibleChartShape::getAccessibleDescription()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString aDescription;
+ if ( m_pAccShape )
+ {
+ aDescription = m_pAccShape->getAccessibleDescription();
+ }
+ return aDescription;
+}
+
+::rtl::OUString AccessibleChartShape::getAccessibleName()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString aName;
+ if ( m_pAccShape )
+ {
+ aName = m_pAccShape->getAccessibleName();
+ }
+ return aName;
+}
+
+// ________ XAccessibleComponent ________
+sal_Bool AccessibleChartShape::containsPoint( const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bReturn = sal_False;
+ if ( m_pAccShape )
+ {
+ bReturn = m_pAccShape->containsPoint( aPoint );
+ }
+ return bReturn;
+}
+
+Reference< XAccessible > AccessibleChartShape::getAccessibleAtPoint( const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ Reference< XAccessible > xResult;
+ if ( m_pAccShape )
+ {
+ xResult.set( m_pAccShape->getAccessibleAtPoint( aPoint ) );
+ }
+ return xResult;
+}
+
+awt::Rectangle AccessibleChartShape::getBounds()
+ throw (uno::RuntimeException)
+{
+ awt::Rectangle aBounds;
+ if ( m_pAccShape )
+ {
+ aBounds = m_pAccShape->getBounds();
+ }
+ return aBounds;
+}
+
+awt::Point AccessibleChartShape::getLocation()
+ throw (uno::RuntimeException)
+{
+ awt::Point aLocation;
+ if ( m_pAccShape )
+ {
+ aLocation = m_pAccShape->getLocation();
+ }
+ return aLocation;
+}
+
+awt::Point AccessibleChartShape::getLocationOnScreen()
+ throw (uno::RuntimeException)
+{
+ awt::Point aLocation;
+ if ( m_pAccShape )
+ {
+ aLocation = m_pAccShape->getLocationOnScreen();
+ }
+ return aLocation;
+}
+
+awt::Size AccessibleChartShape::getSize()
+ throw (uno::RuntimeException)
+{
+ awt::Size aSize;
+ if ( m_pAccShape )
+ {
+ aSize = m_pAccShape->getSize();
+ }
+ return aSize;
+}
+
+void AccessibleChartShape::grabFocus()
+ throw (uno::RuntimeException)
+{
+ return AccessibleBase::grabFocus();
+}
+
+sal_Int32 AccessibleChartShape::getForeground()
+ throw (uno::RuntimeException)
+{
+ sal_Int32 nColor(0);
+ if ( m_pAccShape )
+ {
+ nColor = m_pAccShape->getForeground();
+ }
+ return nColor;
+}
+
+sal_Int32 AccessibleChartShape::getBackground()
+ throw (uno::RuntimeException)
+{
+ sal_Int32 nColor(0);
+ if ( m_pAccShape )
+ {
+ nColor = m_pAccShape->getBackground();
+ }
+ return nColor;
+}
+
+// ________ XAccessibleExtendedComponent ________
+Reference< awt::XFont > AccessibleChartShape::getFont()
+ throw (uno::RuntimeException)
+{
+ Reference< awt::XFont > xFont;
+ if ( m_pAccShape )
+ {
+ xFont.set( m_pAccShape->getFont() );
+ }
+ return xFont;
+}
+
+::rtl::OUString AccessibleChartShape::getTitledBorderText()
+ throw (uno::RuntimeException)
+{
+ ::rtl::OUString aText;
+ if ( m_pAccShape )
+ {
+ aText = m_pAccShape->getTitledBorderText();
+ }
+ return aText;
+}
+
+::rtl::OUString AccessibleChartShape::getToolTipText()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString aText;
+ if ( m_pAccShape )
+ {
+ aText = m_pAccShape->getToolTipText();
+ }
+ return aText;
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/accessibility/AccessibleChartShape.hxx b/chart2/source/controller/accessibility/AccessibleChartShape.hxx
new file mode 100644
index 000000000000..a1236b697a69
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleChartShape.hxx
@@ -0,0 +1,104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef _CHART2_ACCESSIBLECHARTSHAPE_HXX_
+#define _CHART2_ACCESSIBLECHARTSHAPE_HXX_
+
+#include "AccessibleBase.hxx"
+
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <svx/AccessibleShapeTreeInfo.hxx>
+
+
+namespace accessibility
+{
+class AccessibleShape;
+}
+
+namespace chart
+{
+
+namespace impl
+{
+typedef ::cppu::ImplInheritanceHelper1<
+ AccessibleBase,
+ ::com::sun::star::accessibility::XAccessibleExtendedComponent > AccessibleChartShape_Base;
+}
+
+class AccessibleChartShape :
+ public impl::AccessibleChartShape_Base
+{
+public:
+ AccessibleChartShape( const AccessibleElementInfo& rAccInfo,
+ bool bMayHaveChildren, bool bAlwaysTransparent = false );
+ virtual ~AccessibleChartShape();
+
+ // ________ XServiceInfo ________
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XAccessibleContext ________
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 i )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XAccessibleComponent ________
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground() throw (::com::sun::star::uno::RuntimeException);
+
+ // ________ XAccessibleExtendedComponent ________
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitledBorderText()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getToolTipText()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ ::accessibility::AccessibleShape* m_pAccShape;
+ ::accessibility::AccessibleShapeTreeInfo m_aShapeTreeInfo;
+};
+
+} // namespace chart
+
+#endif
diff --git a/chart2/source/controller/accessibility/AccessibleChartView.cxx b/chart2/source/controller/accessibility/AccessibleChartView.cxx
new file mode 100644
index 000000000000..4833991ad7cc
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleChartView.cxx
@@ -0,0 +1,416 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_chart2.hxx"
+
+#include "AccessibleChartView.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "servicenames.hxx"
+#include "macros.hxx"
+#include "ObjectHierarchy.hxx"
+#include "ObjectIdentifier.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
+#include "AccessibleViewForwarder.hxx"
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+#include <tools/string.hxx>
+#include <vcl/window.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+// for SolarMutex
+#include <vcl/svapp.hxx>
+
+// header for typedef MutexGuard
+#include <osl/mutex.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::WeakReference;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+using osl::MutexGuard;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+AccessibleChartView::AccessibleChartView(
+ const Reference< uno::XComponentContext >& xContext, SdrView* pView ) :
+ impl::AccessibleChartView_Base(
+ AccessibleElementInfo(), // empty for now
+ true, // has children
+ true // always transparent
+ ),
+ m_xContext( xContext ),
+ m_pSdrView( pView ),
+ m_pViewForwarder( NULL )
+{
+ AddState( AccessibleStateType::OPAQUE );
+}
+
+AccessibleChartView::~AccessibleChartView()
+{
+ delete m_pViewForwarder;
+}
+
+
+awt::Rectangle AccessibleChartView::GetWindowPosSize() const
+{
+ Reference< awt::XWindow > xWindow( GetInfo().m_xWindow );
+ if( ! xWindow.is())
+ return awt::Rectangle();
+
+ // this should do, but it doesn't => HACK
+// return xWindow->getPosSize();
+
+ awt::Rectangle aBBox( xWindow->getPosSize() );
+
+ Window* pWindow( VCLUnoHelper::GetWindow( GetInfo().m_xWindow ));
+ if( pWindow )
+ {
+ // /-- solar
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Point aVCLPoint( pWindow->OutputToAbsoluteScreenPixel( Point( 0, 0 ) ));
+ aBBox.X = aVCLPoint.getX();
+ aBBox.Y = aVCLPoint.getY();
+ // \-- solar
+ }
+
+ return aBBox;
+}
+
+awt::Point AccessibleChartView::GetUpperLeftOnScreen() const
+{
+ awt::Point aParentPosition;
+
+ awt::Rectangle aBBox( GetWindowPosSize() );
+ aParentPosition.X = aBBox.X;
+ aParentPosition.Y = aBBox.Y;
+
+ return aParentPosition;
+}
+
+// ________ XAccessibleContext ________
+OUString SAL_CALL AccessibleChartView::getAccessibleName()
+ throw (uno::RuntimeException)
+{
+ return OUString( String( SchResId( STR_OBJECT_DIAGRAM )));
+}
+
+OUString SAL_CALL AccessibleChartView::getAccessibleDescription()
+ throw (uno::RuntimeException)
+{
+ return getAccessibleName();
+}
+
+Reference< XAccessible > SAL_CALL AccessibleChartView::getAccessibleParent()
+ throw (uno::RuntimeException)
+{
+ return Reference< XAccessible >( m_xParent );
+}
+
+sal_Int32 SAL_CALL AccessibleChartView::getAccessibleIndexInParent()
+ throw (uno::RuntimeException)
+{
+ // the document is always the only child of the window
+ return 0;
+}
+
+sal_Int16 SAL_CALL AccessibleChartView::getAccessibleRole()
+ throw (uno::RuntimeException)
+{
+ return AccessibleRole::DOCUMENT;
+}
+
+// ________ XAccessibleComponent ________
+awt::Rectangle SAL_CALL AccessibleChartView::getBounds()
+ throw (uno::RuntimeException)
+{
+ awt::Rectangle aResult( GetWindowPosSize());
+ Reference< XAccessible > xParent( m_xParent );
+ if( xParent.is())
+ {
+ Reference< XAccessibleComponent > xContext( xParent->getAccessibleContext(), uno::UNO_QUERY );
+ if( xContext.is())
+ {
+ awt::Point aParentPosition = xContext->getLocationOnScreen();
+ aResult.X -= aParentPosition.X;
+ aResult.Y -= aParentPosition.Y;
+ }
+ }
+ return aResult;
+}
+
+awt::Point SAL_CALL AccessibleChartView::getLocationOnScreen()
+ throw (uno::RuntimeException)
+{
+ awt::Rectangle aBounds( getBounds());
+ awt::Point aResult;
+ Reference< XAccessible > xParent( m_xParent );
+ if( xParent.is())
+ {
+ Reference< XAccessibleComponent > xAccComp(
+ xParent->getAccessibleContext(), uno::UNO_QUERY );
+ aResult = xAccComp->getLocationOnScreen();
+ aResult.X += aBounds.X;
+ aResult.Y += aBounds.Y;
+ }
+ return aResult;
+}
+
+//-----------------------------------------------------------------
+// lang::XInitialization
+//-----------------------------------------------------------------
+
+void SAL_CALL AccessibleChartView::initialize( const Sequence< Any >& rArguments )
+ throw (uno::Exception, uno::RuntimeException)
+{
+ //0: view::XSelectionSupplier offers notifications for selection changes and access to the selection itself
+ //1: frame::XModel representing the chart model - offers access to object data
+ //2: lang::XInterface representing the normal chart view - offers access to some extra object data
+
+ //all arguments are only valid until next initialization
+ bool bChanged = false;
+ bool bOldInvalid = false;
+ bool bNewInvalid = false;
+
+ Reference< view::XSelectionSupplier > xSelectionSupplier;
+ Reference< frame::XModel > xChartModel;
+ Reference< uno::XInterface > xChartView;
+ Reference< XAccessible > xParent;
+ Reference< awt::XWindow > xWindow;
+ {
+ MutexGuard aGuard( GetMutex());
+ xSelectionSupplier.set( m_xSelectionSupplier );
+ xChartModel.set( m_xChartModel );
+ xChartView.set( m_xChartView );
+ xParent.set( m_xParent );
+ xWindow.set( m_xWindow );
+ }
+
+ if( !xSelectionSupplier.is() || !xChartModel.is() || !xChartView.is() )
+ {
+ bOldInvalid = true;
+ }
+
+ if( rArguments.getLength() > 1 )
+ {
+ Reference< frame::XModel > xNewChartModel;
+ rArguments[1] >>= xNewChartModel;
+ if( xNewChartModel != xChartModel )
+ {
+ xChartModel = xNewChartModel;
+ bChanged = true;
+ }
+ }
+ else if( xChartModel.is() )
+ {
+ bChanged = true;
+ xChartModel = 0;
+ }
+
+ if( rArguments.getLength() > 2 )
+ {
+ Reference< uno::XInterface > xNewChartView;
+ rArguments[2] >>= xNewChartView;
+ if( xNewChartView != xChartView )
+ {
+ xChartView = xNewChartView;
+ bChanged = true;
+ }
+ }
+ else if( xChartView.is() )
+ {
+ bChanged = true;
+ xChartView = 0;
+ }
+
+ if( rArguments.getLength() > 3 )
+ {
+ Reference< XAccessible > xNewParent;
+ rArguments[3] >>= xNewParent;
+ if( xNewParent != xParent )
+ {
+ xParent = xNewParent;
+ bChanged = true;
+ }
+ }
+
+ if( rArguments.getLength() > 4 )
+ {
+ Reference< awt::XWindow > xNewWindow;
+ rArguments[4] >>= xNewWindow;
+ if( xNewWindow != xWindow )
+ {
+ xWindow.set( xNewWindow );
+ bChanged = true;
+ }
+ }
+
+ if( rArguments.getLength() > 0 && xChartModel.is() && xChartView.is() )
+ {
+ Reference< view::XSelectionSupplier > xNewSelectionSupplier;
+ rArguments[0] >>= xNewSelectionSupplier;
+ if(xSelectionSupplier!=xNewSelectionSupplier)
+ {
+ bChanged = true;
+ if(xSelectionSupplier.is())
+ xSelectionSupplier->removeSelectionChangeListener(this);
+ if(xNewSelectionSupplier.is())
+ xNewSelectionSupplier->addSelectionChangeListener(this);
+ xSelectionSupplier = xNewSelectionSupplier;
+ }
+ }
+ else if( xSelectionSupplier.is() )
+ {
+ bChanged = true;
+ xSelectionSupplier->removeSelectionChangeListener(this);
+ xSelectionSupplier = 0;
+ }
+
+ if( !xSelectionSupplier.is() || !xChartModel.is() || !xChartView.is() )
+ {
+ if(xSelectionSupplier.is())
+ xSelectionSupplier->removeSelectionChangeListener(this);
+ xSelectionSupplier = 0;
+ xChartModel.clear();
+ xChartView.clear();
+ xParent.clear();
+ xWindow.clear();
+
+ bNewInvalid = true;
+ }
+
+ {
+ MutexGuard aGuard( GetMutex());
+ m_xSelectionSupplier = WeakReference< view::XSelectionSupplier >(xSelectionSupplier);
+ m_xChartModel = WeakReference< frame::XModel >(xChartModel);
+ m_xChartView = WeakReference< uno::XInterface >(xChartView);
+ m_xParent = WeakReference< XAccessible >(xParent);
+ m_xWindow = WeakReference< awt::XWindow >(xWindow);
+ }
+
+ if( bOldInvalid && bNewInvalid )
+ bChanged = false;
+
+ if( bChanged )
+ {
+ {
+ //before notification we prepare for creation of new context
+ //the old context will be deleted after notification than
+ MutexGuard aGuard( GetMutex());
+ Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY );
+ if( xChartDoc.is())
+ m_spObjectHierarchy.reset( new ObjectHierarchy( xChartDoc, getExplicitValueProvider() ));
+ else
+ m_spObjectHierarchy.reset();
+ }
+
+ {
+ AccessibleElementInfo aAccInfo;
+ aAccInfo.m_aOID = ObjectIdentifier( C2U( "ROOT" ) );
+ aAccInfo.m_xChartDocument = uno::WeakReference< chart2::XChartDocument >(
+ uno::Reference< chart2::XChartDocument >( m_xChartModel.get(), uno::UNO_QUERY ));
+ aAccInfo.m_xSelectionSupplier = m_xSelectionSupplier;
+ aAccInfo.m_xView = m_xChartView;
+ aAccInfo.m_xWindow = m_xWindow;
+ aAccInfo.m_pParent = 0;
+ aAccInfo.m_spObjectHierarchy = m_spObjectHierarchy;
+ aAccInfo.m_pSdrView = m_pSdrView;
+ Window* pWindow = VCLUnoHelper::GetWindow( m_xWindow );
+ if ( m_pViewForwarder )
+ {
+ delete m_pViewForwarder;
+ }
+ m_pViewForwarder = new AccessibleViewForwarder( this, pWindow );
+ aAccInfo.m_pViewForwarder = m_pViewForwarder;
+ // broadcasts an INVALIDATE_ALL_CHILDREN event globally
+ SetInfo( aAccInfo );
+ }
+ }
+}
+
+ExplicitValueProvider* AccessibleChartView::getExplicitValueProvider()
+{
+ return ExplicitValueProvider::getExplicitValueProvider(m_xChartView);
+}
+
+//-------------------------------------------------------------------------
+// view::XSelectionChangeListener
+//-------------------------------------------------------------------------
+
+void SAL_CALL AccessibleChartView::selectionChanged( const lang::EventObject& /*rEvent*/ )
+ throw (uno::RuntimeException)
+{
+ Reference< view::XSelectionSupplier > xSelectionSupplier;
+ {
+ MutexGuard aGuard( GetMutex());
+ xSelectionSupplier = Reference< view::XSelectionSupplier >(m_xSelectionSupplier);
+ }
+
+ if( xSelectionSupplier.is() )
+ {
+ ObjectIdentifier aSelectedOID( xSelectionSupplier->getSelection() );
+ if ( m_aCurrentSelectionOID.isValid() )
+ {
+ NotifyEvent( LOST_SELECTION, m_aCurrentSelectionOID );
+ }
+ if( aSelectedOID.isValid() )
+ {
+ NotifyEvent( GOT_SELECTION, aSelectedOID );
+ }
+ m_aCurrentSelectionOID = aSelectedOID;
+ }
+}
+
+//-------------------------------------------------------------------------
+// lang::XComponent::dispose()
+//-------------------------------------------------------------------------
+void SAL_CALL AccessibleChartView::disposing()
+{
+ AccessibleBase::disposing();
+}
+
+//-------------------------------------------------------------------------
+// XEventListener
+//-------------------------------------------------------------------------
+void SAL_CALL AccessibleChartView::disposing( const lang::EventObject& /*Source*/ )
+ throw (uno::RuntimeException)
+{
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/accessibility/AccessibleTextHelper.cxx b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
new file mode 100644
index 000000000000..0ba078e82886
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleTextHelper.cxx
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_chart2.hxx"
+
+#include "AccessibleTextHelper.hxx"
+#include "DrawViewWrapper.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+
+#include <svx/AccessibleTextHelper.hxx>
+#include <svx/unoshtxt.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/window.hxx>
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+
+AccessibleTextHelper::AccessibleTextHelper(
+ DrawViewWrapper * pDrawViewWrapper ) :
+ impl::AccessibleTextHelper_Base( m_aMutex ),
+ m_pTextHelper( 0 ),
+ m_pDrawViewWrapper( pDrawViewWrapper )
+{}
+
+AccessibleTextHelper::~AccessibleTextHelper()
+{
+ if( m_pTextHelper )
+ delete m_pTextHelper;
+}
+
+// ____ XInitialization ____
+void SAL_CALL AccessibleTextHelper::initialize( const Sequence< uno::Any >& aArguments )
+ throw (uno::Exception,
+ uno::RuntimeException)
+{
+ OUString aCID;
+ Reference< XAccessible > xEventSource;
+ Reference< awt::XWindow > xWindow;
+
+ if( aArguments.getLength() >= 3 )
+ {
+ aArguments[0] >>= aCID;
+ aArguments[1] >>= xEventSource;
+ aArguments[2] >>= xWindow;
+ }
+ OSL_ENSURE( aCID.getLength() > 0, "Empty CID" );
+ OSL_ENSURE( xEventSource.is(), "Empty Event Source" );
+ OSL_ENSURE( xWindow.is(), "Empty Window" );
+ if( !xEventSource.is() || aCID.getLength() == 0 )
+ return;
+
+ // /-- solar
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ if( m_pTextHelper )
+ delete m_pTextHelper;
+
+ Window* pWindow( VCLUnoHelper::GetWindow( xWindow ));
+ if( pWindow )
+ {
+ SdrView * pView = m_pDrawViewWrapper;
+ if( pView )
+ {
+ SdrObject * pTextObj = m_pDrawViewWrapper->getNamedSdrObject( aCID );
+ if( pTextObj )
+ {
+ SvxEditSource * pEditSource = new SvxTextEditSource( *pTextObj, 0, *pView, *pWindow );
+ m_pTextHelper = new ::accessibility::AccessibleTextHelper(
+ ::std::auto_ptr< SvxEditSource >( pEditSource ));
+ if( m_pTextHelper )
+ m_pTextHelper->SetEventSource( xEventSource );
+ }
+ }
+ }
+
+ OSL_ENSURE( m_pTextHelper, "Couldn't create text helper" );
+ // \-- solar
+}
+
+// ____ XAccessibleContext ____
+::sal_Int32 SAL_CALL AccessibleTextHelper::getAccessibleChildCount()
+ throw (uno::RuntimeException)
+{
+ if( m_pTextHelper )
+ {
+ // /-- solar
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ return m_pTextHelper->GetChildCount();
+ // \-- solar
+ }
+ return 0;
+}
+
+Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleChild( ::sal_Int32 i )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ if( m_pTextHelper )
+ {
+ // /-- solar
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ return m_pTextHelper->GetChild( i );
+ // \-- solar
+ }
+ return Reference< XAccessible >();
+}
+
+Reference< XAccessible > SAL_CALL AccessibleTextHelper::getAccessibleParent()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return Reference< XAccessible >();
+}
+
+::sal_Int32 SAL_CALL AccessibleTextHelper::getAccessibleIndexInParent()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return -1;
+}
+
+::sal_Int16 SAL_CALL AccessibleTextHelper::getAccessibleRole()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return AccessibleRole::UNKNOWN;
+}
+
+OUString SAL_CALL AccessibleTextHelper::getAccessibleDescription()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return OUString();
+}
+
+OUString SAL_CALL AccessibleTextHelper::getAccessibleName()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return OUString();
+}
+
+Reference< XAccessibleRelationSet > SAL_CALL AccessibleTextHelper::getAccessibleRelationSet()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return Reference< XAccessibleRelationSet >();
+}
+
+Reference< XAccessibleStateSet > SAL_CALL AccessibleTextHelper::getAccessibleStateSet()
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return Reference< XAccessibleStateSet >();
+}
+
+lang::Locale SAL_CALL AccessibleTextHelper::getLocale()
+ throw (IllegalAccessibleComponentStateException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( false, "Not implemented in this helper" );
+ return lang::Locale();
+}
+
+
+
+} // namespace chart
diff --git a/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx b/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx
new file mode 100644
index 000000000000..5014198761f8
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleViewForwarder.cxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_chart2.hxx"
+
+#include "AccessibleViewForwarder.hxx"
+#include "AccessibleChartView.hxx"
+
+#include <vcl/window.hxx>
+
+using namespace ::com::sun::star;
+
+
+namespace chart
+{
+
+AccessibleViewForwarder::AccessibleViewForwarder( AccessibleChartView* pAccChartView, Window* pWindow )
+ :m_pAccChartView( pAccChartView )
+ ,m_pWindow( pWindow )
+ ,m_aMapMode( MAP_100TH_MM )
+{
+}
+
+AccessibleViewForwarder::~AccessibleViewForwarder()
+{
+}
+
+// ________ IAccessibleViewforwarder ________
+
+BOOL AccessibleViewForwarder::IsValid() const
+{
+ return sal_True;
+}
+
+Rectangle AccessibleViewForwarder::GetVisibleArea() const
+{
+ Rectangle aVisibleArea;
+ if ( m_pWindow )
+ {
+ aVisibleArea.SetPos( Point( 0, 0 ) );
+ aVisibleArea.SetSize( m_pWindow->GetOutputSizePixel() );
+ aVisibleArea = m_pWindow->PixelToLogic( aVisibleArea, m_aMapMode );
+ }
+ return aVisibleArea;
+}
+
+Point AccessibleViewForwarder::LogicToPixel( const Point& rPoint ) const
+{
+ Point aPoint;
+ if ( m_pAccChartView && m_pWindow )
+ {
+ awt::Point aLocation = m_pAccChartView->getLocationOnScreen();
+ Point aTopLeft( aLocation.X, aLocation.Y );
+ aPoint = m_pWindow->LogicToPixel( rPoint, m_aMapMode ) + aTopLeft;
+ }
+ return aPoint;
+}
+
+Size AccessibleViewForwarder::LogicToPixel( const Size& rSize ) const
+{
+ Size aSize;
+ if ( m_pWindow )
+ {
+ aSize = m_pWindow->LogicToPixel( rSize, m_aMapMode );
+ }
+ return aSize;
+}
+
+Point AccessibleViewForwarder::PixelToLogic( const Point& rPoint ) const
+{
+ Point aPoint;
+ if ( m_pAccChartView && m_pWindow )
+ {
+ awt::Point aLocation = m_pAccChartView->getLocationOnScreen();
+ Point aTopLeft( aLocation.X, aLocation.Y );
+ aPoint = m_pWindow->PixelToLogic( rPoint - aTopLeft, m_aMapMode );
+ }
+ return aPoint;
+}
+
+Size AccessibleViewForwarder::PixelToLogic( const Size& rSize ) const
+{
+ Size aSize;
+ if ( m_pWindow )
+ {
+ aSize = m_pWindow->PixelToLogic( rSize, m_aMapMode );
+ }
+ return aSize;
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx
new file mode 100644
index 000000000000..e70aa58b8df7
--- /dev/null
+++ b/chart2/source/controller/accessibility/AccessibleViewForwarder.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef _CHART2_ACCESSIBLEVIEWFORWARDER_HXX_
+#define _CHART2_ACCESSIBLEVIEWFORWARDER_HXX_
+
+#include <vcl/mapmod.hxx>
+#include <svx/IAccessibleViewForwarder.hxx>
+
+class Window;
+
+namespace chart
+{
+
+class AccessibleChartView;
+
+class AccessibleViewForwarder : public ::accessibility::IAccessibleViewForwarder
+{
+public:
+ AccessibleViewForwarder( AccessibleChartView* pAccChartView, Window* pWindow );
+ virtual ~AccessibleViewForwarder();
+
+ // ________ IAccessibleViewforwarder ________
+ virtual BOOL IsValid() const;
+ virtual Rectangle GetVisibleArea() const;
+ virtual Point LogicToPixel( const Point& rPoint ) const;
+ virtual Size LogicToPixel( const Size& rSize ) const;
+ virtual Point PixelToLogic( const Point& rPoint ) const;
+ virtual Size PixelToLogic( const Size& rSize ) const;
+
+private:
+ AccessibleViewForwarder( AccessibleViewForwarder& );
+ AccessibleViewForwarder& operator=( AccessibleViewForwarder& );
+
+ AccessibleChartView* m_pAccChartView;
+ Window* m_pWindow;
+ MapMode m_aMapMode;
+};
+
+} // namespace chart
+
+#endif
diff --git a/chart2/source/controller/accessibility/ChartElementFactory.cxx b/chart2/source/controller/accessibility/ChartElementFactory.cxx
new file mode 100644
index 000000000000..b2599fec0c74
--- /dev/null
+++ b/chart2/source/controller/accessibility/ChartElementFactory.cxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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_chart2.hxx"
+
+#include "ChartElementFactory.hxx"
+#include "ObjectIdentifier.hxx"
+#include "AccessibleChartElement.hxx"
+
+namespace chart
+{
+
+AccessibleBase* ChartElementFactory::CreateChartElement( const AccessibleElementInfo& rAccInfo )
+{
+ ObjectIdentifier aOID( rAccInfo.m_aOID );
+ ObjectType eType( aOID.getObjectType() );
+
+ switch( eType )
+ {
+ case OBJECTTYPE_DATA_POINT:
+ case OBJECTTYPE_LEGEND_ENTRY:
+ return new AccessibleChartElement( rAccInfo, false, false );
+ case OBJECTTYPE_PAGE:
+ case OBJECTTYPE_TITLE:
+ case OBJECTTYPE_LEGEND:
+ case OBJECTTYPE_DIAGRAM:
+ case OBJECTTYPE_DIAGRAM_WALL:
+ case OBJECTTYPE_DIAGRAM_FLOOR:
+ case OBJECTTYPE_AXIS:
+ case OBJECTTYPE_AXIS_UNITLABEL:
+ case OBJECTTYPE_GRID:
+ case OBJECTTYPE_SUBGRID:
+ case OBJECTTYPE_DATA_SERIES:
+ case OBJECTTYPE_DATA_LABELS:
+ case OBJECTTYPE_DATA_LABEL:
+ case OBJECTTYPE_DATA_ERRORS:
+ case OBJECTTYPE_DATA_ERRORS_X:
+ case OBJECTTYPE_DATA_ERRORS_Y:
+ case OBJECTTYPE_DATA_ERRORS_Z:
+ case OBJECTTYPE_DATA_CURVE: // e.g. a statistical method printed as line
+ case OBJECTTYPE_DATA_AVERAGE_LINE:
+ case OBJECTTYPE_DATA_STOCK_RANGE:
+ case OBJECTTYPE_DATA_STOCK_LOSS:
+ case OBJECTTYPE_DATA_STOCK_GAIN:
+ case OBJECTTYPE_DATA_CURVE_EQUATION:
+ return new AccessibleChartElement( rAccInfo, true, false );
+ case OBJECTTYPE_UNKNOWN:
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+
+ /*
+ sal_uInt16 nObjId = rId.GetObjectId();
+ switch( nObjId )
+ {
+ case CHOBJID_LEGEND:
+ return new AccLegend( pParent );
+ case AccLegendEntry::ObjectId:
+ return new AccLegendEntry( pParent, rId.GetIndex1() );
+
+ case CHOBJID_TITLE_MAIN:
+ return new AccTitle( pParent, Title::MAIN );
+ case CHOBJID_TITLE_SUB:
+ return new AccTitle( pParent, Title::SUB );
+ case CHOBJID_DIAGRAM_TITLE_X_AXIS:
+ return new AccTitle( pParent, Title::X_AXIS );
+ case CHOBJID_DIAGRAM_TITLE_Y_AXIS:
+ return new AccTitle( pParent, Title::Y_AXIS );
+ case CHOBJID_DIAGRAM_TITLE_Z_AXIS:
+ return new AccTitle( pParent, Title::Z_AXIS );
+
+ case CHOBJID_DIAGRAM:
+ return new AccDiagram( pParent );
+
+ // series
+ case CHOBJID_DIAGRAM_ROWGROUP:
+ return new AccDataSeries( pParent, rId.GetIndex1() );
+
+ // data points
+ case CHOBJID_DIAGRAM_DATA:
+ return new AccDataPoint( pParent, rId.GetIndex1(), rId.GetIndex2() );
+
+ case Axis::X_AXIS:
+ case Axis::Y_AXIS:
+ case Axis::Z_AXIS:
+ case Axis::SEC_X_AXIS:
+ case Axis::SEC_Y_AXIS:
+ return new AccAxis( pParent, static_cast< Axis::AxisType >( nObjId ) );
+
+ case Grid::X_MAJOR:
+ case Grid::Y_MAJOR:
+ case Grid::Z_MAJOR:
+ case Grid::X_MINOR:
+ case Grid::Y_MINOR:
+ case Grid::Z_MINOR:
+ return new AccGrid( pParent, static_cast< AccGrid::GridType >( nObjId ) );
+
+ case AccStatisticsObject::MEAN_VAL_LINE:
+ case AccStatisticsObject::ERROR_BARS:
+ case AccStatisticsObject::REGRESSION:
+ return new AccStatisticsObject( pParent,
+ static_cast< AccStatisticsObject::StatisticsObjectType >( nObjId ),
+ rId.GetIndex1() );
+
+ case CHOBJID_DIAGRAM_WALL:
+ return new AccWall( pParent );
+
+ case CHOBJID_DIAGRAM_FLOOR:
+ return new AccFloor( pParent );
+
+ case CHOBJID_DIAGRAM_AREA:
+ return new AccArea( pParent );
+ }
+ */
+}
+
+} // namespace chart
diff --git a/chart2/source/controller/accessibility/ChartElementFactory.hxx b/chart2/source/controller/accessibility/ChartElementFactory.hxx
new file mode 100644
index 000000000000..399ba93c1b55
--- /dev/null
+++ b/chart2/source/controller/accessibility/ChartElementFactory.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef _CHART2_ACC_ELEMENTFACTORY_HXX_
+#define _CHART2_ACC_ELEMENTFACTORY_HXX_
+
+#include "AccessibleBase.hxx"
+
+namespace chart
+{
+
+class AccessibleBase;
+
+class ChartElementFactory
+{
+public:
+ /** @return a newly created object (using the new operator) that corresponds
+ to the given unique id
+ */
+ static AccessibleBase* CreateChartElement( const AccessibleElementInfo& rAccInfo );
+};
+
+} // namespace chart
+
+#endif
diff --git a/chart2/source/controller/accessibility/makefile.mk b/chart2/source/controller/accessibility/makefile.mk
new file mode 100644
index 000000000000..44c816d90d0e
--- /dev/null
+++ b/chart2/source/controller/accessibility/makefile.mk
@@ -0,0 +1,54 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# 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.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJINC= $(PRJ)$/source
+PRJNAME= chart2
+TARGET= chcaccessibility
+
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# --- export library -------------------------------------------------
+
+#object files to build and link together to lib $(SLB)$/$(TARGET).lib
+SLOFILES= $(SLO)$/AccessibleChartView.obj \
+ $(SLO)$/ChartElementFactory.obj \
+ $(SLO)$/AccessibleBase.obj \
+ $(SLO)$/AccessibleChartElement.obj \
+ $(SLO)$/AccessibleChartShape.obj \
+ $(SLO)$/AccessibleTextHelper.obj \
+ $(SLO)$/AccessibleViewForwarder.obj
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk
+