diff options
author | Ingrid Halama <iha@openoffice.org> | 2010-03-15 13:09:41 +0100 |
---|---|---|
committer | Ingrid Halama <iha@openoffice.org> | 2010-03-15 13:09:41 +0100 |
commit | 8195643ff81f7a60e46522767c6b6483713f4af1 (patch) | |
tree | 42e3e2502b344817a441aa114b404cfbf2e676ef /chart2/source/controller/accessibility | |
parent | 590a1a5225623eb922e63b02b62e711d153e9d55 (diff) | |
parent | f2cf0b3fde3d8577260c8b12e380d23a27dbae17 (diff) |
chart43: merge with DEV300_m75
Diffstat (limited to 'chart2/source/controller/accessibility')
9 files changed, 648 insertions, 62 deletions
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index cab7d3db0d62..00335eab296e 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -29,6 +29,7 @@ #include "precompiled_chart2.hxx" #include "AccessibleBase.hxx" +#include "AccessibleChartShape.hxx" #include "ObjectHierarchy.hxx" #include "ObjectIdentifier.hxx" #include "chartview/ExplicitValueProvider.hxx" @@ -269,15 +270,15 @@ bool AccessibleBase::ImplUpdateChildren() { ObjectHierarchy::tChildContainer aModelChildren( m_aAccInfo.m_spObjectHierarchy->getChildren( GetId() )); - ::std::vector< ChildCIDMap::key_type > aAccChildren; + ::std::vector< ChildOIDMap::key_type > aAccChildren; aAccChildren.reserve( aModelChildren.size()); - ::std::transform( m_aChildCIDMap.begin(), m_aChildCIDMap.end(), + ::std::transform( m_aChildOIDMap.begin(), m_aChildOIDMap.end(), ::std::back_inserter( aAccChildren ), - ::std::select1st< ChildCIDMap::value_type >()); + ::std::select1st< ChildOIDMap::value_type >()); ::std::sort( aModelChildren.begin(), aModelChildren.end()); - ::std::vector< OUString > aChildrenToRemove, aChildrenToAdd; + ::std::vector< ObjectHierarchy::tOID > aChildrenToRemove, aChildrenToAdd; ::std::set_difference( aModelChildren.begin(), aModelChildren.end(), aAccChildren.begin(), aAccChildren.end(), ::std::back_inserter( aChildrenToAdd )); @@ -285,10 +286,10 @@ bool AccessibleBase::ImplUpdateChildren() aModelChildren.begin(), aModelChildren.end(), ::std::back_inserter( aChildrenToRemove )); - ::std::vector< OUString >::const_iterator aIt( aChildrenToRemove.begin()); + ::std::vector< ObjectHierarchy::tOID >::const_iterator aIt( aChildrenToRemove.begin()); for( ; aIt != aChildrenToRemove.end(); ++aIt ) { - RemoveChildById( *aIt ); + RemoveChildByOId( *aIt ); } AccessibleElementInfo aAccInfo( GetInfo()); @@ -296,8 +297,15 @@ bool AccessibleBase::ImplUpdateChildren() for( aIt = aChildrenToAdd.begin(); aIt != aChildrenToAdd.end(); ++aIt ) { - aAccInfo.m_aCID = *aIt; - AddChild( ChartElementFactory::CreateChartElement( aAccInfo )); + aAccInfo.m_aOID = *aIt; + if ( aIt->isAutoGeneratedObject() ) + { + AddChild( ChartElementFactory::CreateChartElement( aAccInfo ) ); + } + else if ( aIt->isAdditionalShape() ) + { + AddChild( new AccessibleChartShape( aAccInfo, true, false ) ); + } } bResult = true; } @@ -316,7 +324,7 @@ void AccessibleBase::AddChild( AccessibleBase * pChild ) Reference< XAccessible > xChild( pChild ); m_aChildList.push_back( xChild ); - m_aChildCIDMap[ pChild->GetId() ] = xChild; + m_aChildOIDMap[ pChild->GetId() ] = xChild; // inform listeners of new child if( m_bChildrenInitialized ) @@ -335,18 +343,18 @@ void AccessibleBase::AddChild( AccessibleBase * pChild ) /** in this method we imply that the Reference< XAccessible > elements in the vector are AccessibleBase objects ! */ -void AccessibleBase::RemoveChildById( const ::rtl::OUString & rId ) +void AccessibleBase::RemoveChildByOId( const ObjectIdentifier& rOId ) { // /-- ClearableMutexGuard aGuard( GetMutex() ); - ChildCIDMap::iterator aIt( m_aChildCIDMap.find( rId )); - if( aIt != m_aChildCIDMap.end()) + ChildOIDMap::iterator aIt( m_aChildOIDMap.find( rOId )); + if( aIt != m_aChildOIDMap.end()) { Reference< XAccessible > xChild( aIt->second ); // remove from map - m_aChildCIDMap.erase( aIt ); + m_aChildOIDMap.erase( aIt ); // search child in vector ChildListVectorType::iterator aVecIter = @@ -444,7 +452,7 @@ void AccessibleBase::KillAllChildren() // remove all children m_aChildList.clear(); - m_aChildCIDMap.clear(); + m_aChildOIDMap.clear(); aGuard.clear(); // \-- @@ -485,7 +493,7 @@ void AccessibleBase::SetInfo( const AccessibleElementInfo & rNewInfo ) AccessibleUniqueId AccessibleBase::GetId() const { - return m_aAccInfo.m_aCID; + return m_aAccInfo.m_aOID; } // ____________________________________ @@ -662,14 +670,15 @@ Reference< XAccessibleStateSet > SAL_CALL AccessibleBase::getAccessibleStateSet( { if( ! m_bStateSetInitialized ) { - OUString aSelCID; Reference< view::XSelectionSupplier > xSelSupp( GetInfo().m_xSelectionSupplier ); - if( xSelSupp.is() && - ( xSelSupp->getSelection() >>= aSelCID ) && - GetId().equals( aSelCID ) ) + if ( xSelSupp.is() ) { - AddState( AccessibleStateType::SELECTED ); - AddState( AccessibleStateType::FOCUSED ); + ObjectIdentifier aOID( xSelSupp->getSelection() ); + if ( aOID.isValid() && GetId() == aOID ) + { + AddState( AccessibleStateType::SELECTED ); + AddState( AccessibleStateType::FOCUSED ); + } } m_bStateSetInitialized = true; } @@ -752,7 +761,7 @@ awt::Rectangle SAL_CALL AccessibleBase::getBounds() if( pExplicitValueProvider ) { Window* pWindow( VCLUnoHelper::GetWindow( m_aAccInfo.m_xWindow )); - awt::Rectangle aLogicRect( pExplicitValueProvider->getRectangleOfObject( m_aAccInfo.m_aCID )); + awt::Rectangle aLogicRect( pExplicitValueProvider->getRectangleOfObject( m_aAccInfo.m_aOID.getObjectCID() )); if( pWindow ) { Rectangle aRect( aLogicRect.X, aLogicRect.Y, @@ -825,10 +834,11 @@ void SAL_CALL AccessibleBase::grabFocus() { CheckDisposeState(); - OUString aSelCID; Reference< view::XSelectionSupplier > xSelSupp( GetInfo().m_xSelectionSupplier ); - if( xSelSupp.is()) - xSelSupp->select( uno::makeAny( GetId())); + if ( xSelSupp.is() ) + { + xSelSupp->select( GetId().getAny() ); + } } sal_Int32 SAL_CALL AccessibleBase::getForeground() @@ -849,9 +859,10 @@ sal_Int32 AccessibleBase::getColor( eColorType eColType ) if( m_bAlwaysTransparent ) return nResult; - ObjectType eType( ObjectIdentifier::getObjectType( m_aAccInfo.m_aCID )); + ObjectIdentifier aOID( m_aAccInfo.m_aOID ); + ObjectType eType( aOID.getObjectType() ); Reference< beans::XPropertySet > xObjProp; - OUString aObjectCID = m_aAccInfo.m_aCID; + OUString aObjectCID = aOID.getObjectCID(); if( eType == OBJECTTYPE_LEGEND_ENTRY ) { // for colors get the data series/point properties diff --git a/chart2/source/controller/accessibility/AccessibleChartElement.cxx b/chart2/source/controller/accessibility/AccessibleChartElement.cxx index a2c7b7aa8261..2361cc62c389 100644 --- a/chart2/source/controller/accessibility/AccessibleChartElement.cxx +++ b/chart2/source/controller/accessibility/AccessibleChartElement.cxx @@ -101,7 +101,7 @@ bool AccessibleChartElement::ImplUpdateChildren() bool bResult = false; Reference< chart2::XTitle > xTitle( ObjectIdentifier::getObjectPropertySet( - GetInfo().m_aCID, Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )), + GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )), uno::UNO_QUERY ); m_bHasText = xTitle.is(); @@ -136,7 +136,7 @@ void AccessibleChartElement::InitTextEdit() { Reference< lang::XInitialization > xInit( m_xTextHelper, uno::UNO_QUERY_THROW ); Sequence< uno::Any > aArgs( 3 ); - aArgs[0] <<= GetInfo().m_aCID; + aArgs[0] <<= GetInfo().m_aOID.getObjectCID(); aArgs[1] <<= Reference< XAccessible >( this ); aArgs[2] <<= Reference< awt::XWindow >( GetInfo().m_xWindow ); xInit->initialize( aArgs ); @@ -224,7 +224,7 @@ OUString SAL_CALL AccessibleChartElement::getAccessibleName() throw (::com::sun::star::uno::RuntimeException) { return ObjectNameProvider::getNameForCID( - GetInfo().m_aCID, GetInfo().m_xChartDocument ); + GetInfo().m_aOID.getObjectCID(), GetInfo().m_xChartDocument ); } // ________ AccessibleChartElement::XAccessibleContext (overloaded) ________ @@ -249,7 +249,7 @@ Reference< awt::XFont > SAL_CALL AccessibleChartElement::getFont() { Reference< beans::XMultiPropertySet > xObjProp( ObjectIdentifier::getObjectPropertySet( - GetInfo().m_aCID, Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )), uno::UNO_QUERY ); + GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )), uno::UNO_QUERY ); awt::FontDescriptor aDescr( CharacterProperties::createFontDescriptorFromPropertySet( xObjProp )); xFont = xDevice->getFont( aDescr ); @@ -270,7 +270,7 @@ OUString SAL_CALL AccessibleChartElement::getToolTipText() CheckDisposeState(); return ObjectNameProvider::getHelpText( - GetInfo().m_aCID, Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )); + GetInfo().m_aOID.getObjectCID(), Reference< chart2::XChartDocument >( GetInfo().m_xChartDocument )); } // ________ XAccessibleComponent ________ @@ -280,7 +280,7 @@ sal_Bool SAL_CALL AccessibleChartElement::containsPoint( const awt::Point& aPoin return AccessibleBase::containsPoint( aPoint ); } -Reference< accessibility::XAccessible > SAL_CALL AccessibleChartElement::getAccessibleAtPoint( const awt::Point& aPoint ) +Reference< XAccessible > SAL_CALL AccessibleChartElement::getAccessibleAtPoint( const awt::Point& aPoint ) throw (uno::RuntimeException) { return AccessibleBase::getAccessibleAtPoint( aPoint ); 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 index 611d75992832..4833991ad7cc 100644 --- a/chart2/source/controller/accessibility/AccessibleChartView.cxx +++ b/chart2/source/controller/accessibility/AccessibleChartView.cxx @@ -36,6 +36,7 @@ #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> @@ -66,19 +67,22 @@ namespace chart //............................................................................. AccessibleChartView::AccessibleChartView( - const Reference<uno::XComponentContext> & xContext ) : + const Reference< uno::XComponentContext >& xContext, SdrView* pView ) : impl::AccessibleChartView_Base( AccessibleElementInfo(), // empty for now true, // has children true // always transparent ), - m_xContext( xContext ) + m_xContext( xContext ), + m_pSdrView( pView ), + m_pViewForwarder( NULL ) { AddState( AccessibleStateType::OPAQUE ); } AccessibleChartView::~AccessibleChartView() { + delete m_pViewForwarder; } @@ -187,20 +191,6 @@ awt::Point SAL_CALL AccessibleChartView::getLocationOnScreen() } //----------------------------------------------------------------- -// lang::XServiceInfo -//----------------------------------------------------------------- - -APPHELPER_XSERVICEINFO_IMPL( AccessibleChartView, CHART2_ACCESSIBLE_SERVICE_IMPLEMENTATION_NAME ) - -uno::Sequence< rtl::OUString > AccessibleChartView::getSupportedServiceNames_Static() -{ - uno::Sequence< rtl::OUString > aSNS( 2 ); - aSNS.getArray()[ 0 ] = C2U("com.sun.star.accessibility.Accessible"); - aSNS.getArray()[ 1 ] = CHART2_ACCESSIBLE_SERVICE_NAME; - return aSNS; -} - -//----------------------------------------------------------------- // lang::XInitialization //----------------------------------------------------------------- @@ -350,7 +340,7 @@ void SAL_CALL AccessibleChartView::initialize( const Sequence< Any >& rArguments { AccessibleElementInfo aAccInfo; - aAccInfo.m_aCID = C2U("ROOT"); + 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; @@ -358,6 +348,14 @@ void SAL_CALL AccessibleChartView::initialize( const Sequence< Any >& rArguments 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 ); } @@ -384,16 +382,16 @@ void SAL_CALL AccessibleChartView::selectionChanged( const lang::EventObject& /* if( xSelectionSupplier.is() ) { - rtl::OUString aSelectedObjectCID; - Any aSelection = xSelectionSupplier->getSelection(); - if(aSelection>>=aSelectedObjectCID) + ObjectIdentifier aSelectedOID( xSelectionSupplier->getSelection() ); + if ( m_aCurrentSelectionOID.isValid() ) + { + NotifyEvent( LOST_SELECTION, m_aCurrentSelectionOID ); + } + if( aSelectedOID.isValid() ) { - if( m_aCurrentSelectionCID.getLength()) - NotifyEvent( LOST_SELECTION, m_aCurrentSelectionCID ); - if( aSelectedObjectCID.getLength()) - NotifyEvent( GOT_SELECTION, aSelectedObjectCID ); - m_aCurrentSelectionCID = aSelectedObjectCID; + NotifyEvent( GOT_SELECTION, aSelectedOID ); } + m_aCurrentSelectionOID = aSelectedOID; } } 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 index 43535a0d7fc5..b2599fec0c74 100644 --- a/chart2/source/controller/accessibility/ChartElementFactory.cxx +++ b/chart2/source/controller/accessibility/ChartElementFactory.cxx @@ -30,7 +30,6 @@ #include "ChartElementFactory.hxx" #include "ObjectIdentifier.hxx" - #include "AccessibleChartElement.hxx" namespace chart @@ -38,8 +37,8 @@ namespace chart AccessibleBase* ChartElementFactory::CreateChartElement( const AccessibleElementInfo& rAccInfo ) { - ObjectType eType( - ObjectIdentifier::getObjectType( rAccInfo.m_aCID )); + ObjectIdentifier aOID( rAccInfo.m_aOID ); + ObjectType eType( aOID.getObjectType() ); switch( eType ) { @@ -72,6 +71,8 @@ AccessibleBase* ChartElementFactory::CreateChartElement( const AccessibleElement return new AccessibleChartElement( rAccInfo, true, false ); case OBJECTTYPE_UNKNOWN: break; + default: + break; } return 0; diff --git a/chart2/source/controller/accessibility/makefile.mk b/chart2/source/controller/accessibility/makefile.mk index e79019ba8602..44c816d90d0e 100644 --- a/chart2/source/controller/accessibility/makefile.mk +++ b/chart2/source/controller/accessibility/makefile.mk @@ -44,7 +44,9 @@ SLOFILES= $(SLO)$/AccessibleChartView.obj \ $(SLO)$/ChartElementFactory.obj \ $(SLO)$/AccessibleBase.obj \ $(SLO)$/AccessibleChartElement.obj \ - $(SLO)$/AccessibleTextHelper.obj + $(SLO)$/AccessibleChartShape.obj \ + $(SLO)$/AccessibleTextHelper.obj \ + $(SLO)$/AccessibleViewForwarder.obj # --- Targets ----------------------------------------------------------------- |