diff options
author | Steve Yin <steve_y@apache.org> | 2013-11-14 08:18:05 +0000 |
---|---|---|
committer | Steve Yin <steve_y@apache.org> | 2013-11-14 08:18:05 +0000 |
commit | a5c4ddcf8ed5344d9bceeffd7431cd6895a407ca (patch) | |
tree | 7e830be2c7fae1c81a868f196aa940696efeeb37 /svx/source | |
parent | a2afc19e04f8bb3089cbfef34960ad8f0a3b99bf (diff) |
Integrate branch of IAccessible2
Notes
Notes:
merged as: c2405f80af8b61fa9b9088420afdb79584adf7c0
Diffstat (limited to 'svx/source')
36 files changed, 4978 insertions, 173 deletions
diff --git a/svx/source/accessibility/AccessibleControlShape.cxx b/svx/source/accessibility/AccessibleControlShape.cxx index 34344b33c202..9eaae1818545 100644 --- a/svx/source/accessibility/AccessibleControlShape.cxx +++ b/svx/source/accessibility/AccessibleControlShape.cxx @@ -44,7 +44,23 @@ #include <svx/svdpagv.hxx> #include "svx/svdstr.hrc" #include <algorithm> - +//IAccessibility2 Implementation 2009----- +#ifndef _COMPHELPER_PROPERTY_HXX_ +#include <comphelper/property.hxx> +#endif +#ifndef _COMPHELPER_TYPES_HXX_ +#include <comphelper/types.hxx> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_ +#include <com/sun/star/container/XChild.hpp> +#endif +#ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_ +#include <unotools/accessiblerelationsethelper.hxx> +#endif +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_ +#include <com/sun/star/accessibility/AccessibleRelationType.hpp> +#endif +//-----IAccessibility2 Implementation 2009 using namespace ::comphelper; using namespace ::accessibility; using namespace ::com::sun::star::accessibility; @@ -78,6 +94,14 @@ namespace static ::rtl::OUString s_sLabelPropertyLabel( RTL_CONSTASCII_USTRINGPARAM( "Label" ) ); return s_sLabelPropertyLabel; } + //IAccessibility2 Implementation 2009----- + //................................................................ + const ::rtl::OUString& lcl_getLabelControlPropertyName( ) + { + static ::rtl::OUString s_sLabelControlPropertyLabel( RTL_CONSTASCII_USTRINGPARAM( "LabelControl" ) ); + return s_sLabelControlPropertyLabel; + } + //-----IAccessibility2 Implementation 2009 //................................................................ // return the property which should be used as AccessibleName const ::rtl::OUString& lcl_getPreferredAccNameProperty( const Reference< XPropertySetInfo >& _rxPSI ) @@ -636,23 +660,57 @@ Reference< XAccessible > SAL_CALL AccessibleControlShape::getAccessibleChild( sa Reference< XAccessibleRelationSet > SAL_CALL AccessibleControlShape::getAccessibleRelationSet( ) throw (RuntimeException) { // TODO - return AccessibleShape::getAccessibleRelationSet( ); + // return AccessibleShape::getAccessibleRelationSet( ); + //IAccessibility2 Implementation 2009----- + utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; + ensureControlModelAccess(); + AccessibleControlShape* pCtlAccShape = GetLabeledByControlShape(); + if(pCtlAccShape) + { + Reference < XAccessible > xAcc (pCtlAccShape->getAccessibleContext(), UNO_QUERY); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > aSequence(1); + aSequence[0] = xAcc; + if( getAccessibleRole() == AccessibleRole::RADIO_BUTTON ) + { + pRelationSetHelper->AddRelation( AccessibleRelation( AccessibleRelationType::MEMBER_OF, aSequence ) ); + } + else + { + pRelationSetHelper->AddRelation( AccessibleRelation( AccessibleRelationType::LABELED_BY, aSequence ) ); + } + } + Reference< XAccessibleRelationSet > xSet = pRelationSetHelper; + return xSet; + //-----IAccessibility2 Implementation 2009 } //-------------------------------------------------------------------- ::rtl::OUString AccessibleControlShape::CreateAccessibleName (void) throw (RuntimeException) { ensureControlModelAccess(); - - // check if we can obtain the "Name" resp. "Label" property from the model - const ::rtl::OUString& rAccNameProperty = lcl_getPreferredAccNameProperty( m_xModelPropsMeta ); - - ::rtl::OUString sName( getControlModelStringProperty( rAccNameProperty ) ); - if ( !sName.getLength() ) - { // no -> use the default - sName = AccessibleShape::CreateAccessibleName(); + //IAccessibility2 Implementation 2009----- + ::rtl::OUString sName; + if ( getAccessibleRole() != AccessibleRole::SHAPE + && getAccessibleRole() != AccessibleRole::RADIO_BUTTON ) + { + AccessibleControlShape* pCtlAccShape = GetLabeledByControlShape(); + if(pCtlAccShape) + { + sName = pCtlAccShape->CreateAccessibleName(); + } } - + if(sName.getLength() == 0) + { + // check if we can obtain the "Name" resp. "Label" property from the model + const ::rtl::OUString& rAccNameProperty = lcl_getPreferredAccNameProperty( m_xModelPropsMeta ); + sName = getControlModelStringProperty( rAccNameProperty ); + if ( !sName.getLength() ) + { // no -> use the default + sName = AccessibleShape::CreateAccessibleName(); + } + } + //-----IAccessibility2 Implementation 2009 // now that somebody first asked us for our name, ensure that we are listening to name changes on the model m_bListeningForName = ensureListeningState( m_bListeningForName, sal_True, lcl_getPreferredAccNameProperty( m_xModelPropsMeta ) ); @@ -914,3 +972,25 @@ void SAL_CALL AccessibleControlShape::elementReplaced( const ::com::sun::star::c { // not interested in } +//IAccessibility2 Implementation 2009----- +AccessibleControlShape* SAL_CALL AccessibleControlShape::GetLabeledByControlShape( ) +{ + if(m_xControlModel.is()) + { + const ::rtl::OUString& rAccLabelControlProperty = lcl_getLabelControlPropertyName(); + Any sCtlLabelBy; + // get the "label by" property value of the control + if (::comphelper::hasProperty(rAccLabelControlProperty, m_xControlModel)) + { + m_xControlModel->getPropertyValue( rAccLabelControlProperty ) >>= sCtlLabelBy; + if( sCtlLabelBy.hasValue() ) + { + Reference< XPropertySet > xAsSet (sCtlLabelBy, UNO_QUERY); + AccessibleControlShape* pCtlAccShape = mpParent->GetAccControlShapeFromModel(xAsSet.get()); + return pCtlAccShape; + } + } + } + return NULL; +} +//-----IAccessibility2 Implementation 2009 diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx index be4ca3d31e7e..6e3fe7b4cc0e 100644 --- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx +++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx @@ -153,7 +153,7 @@ namespace accessibility OutputDevice* GetRefDevice() const { return NULL; } sal_Bool GetIndexAtPoint( const Point&, sal_uInt16&, sal_uInt16& ) const { return sal_False; } sal_Bool GetWordIndices( sal_uInt16, sal_uInt16, sal_uInt16&, sal_uInt16& ) const { return sal_False; } - sal_Bool GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_uInt16, sal_uInt16 ) const { return sal_False; } + sal_Bool GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_uInt16, sal_uInt16, sal_Bool) const { return sal_False; } sal_uInt16 GetLineCount( sal_uInt16 nPara ) const { return nPara == 0 ? 1 : 0; } sal_uInt16 GetLineLen( sal_uInt16, sal_uInt16 ) const { return 0; } void GetLineBoundaries( /*out*/sal_uInt16 & rStart, /*out*/sal_uInt16 & rEnd, sal_uInt16 /*nParagraph*/, sal_uInt16 /*nLine*/ ) const { rStart = rEnd = 0; } diff --git a/svx/source/accessibility/AccessibleFrameSelector.cxx b/svx/source/accessibility/AccessibleFrameSelector.cxx index a7572be358ad..13fd7f98be23 100644 --- a/svx/source/accessibility/AccessibleFrameSelector.cxx +++ b/svx/source/accessibility/AccessibleFrameSelector.cxx @@ -190,7 +190,10 @@ sal_Int32 AccFrameSelector::getAccessibleIndexInParent( ) sal_Int16 AccFrameSelector::getAccessibleRole( ) throw (RuntimeException) { - return AccessibleRole::OPTION_PANE; + // return AccessibleRole::OPTION_PANE; + //IAccessibility2 Implementation 2009----- + return meBorder == FRAMEBORDER_NONE ? AccessibleRole::OPTION_PANE : AccessibleRole::CHECK_BOX; + //-----IAccessibility2 Implementation 2009 } // ---------------------------------------------------------------------------- @@ -222,19 +225,43 @@ Reference< XAccessibleRelationSet > AccFrameSelector::getAccessibleRelationSet( IsValid(); utl::AccessibleRelationSetHelper* pHelper; Reference< XAccessibleRelationSet > xRet = pHelper = new utl::AccessibleRelationSetHelper; + //if(meBorder == FRAMEBORDER_NONE) + //{ + // //add the label relation + // Window* pPrev = mpFrameSel->GetWindow( WINDOW_PREV ); + // if(pPrev && WINDOW_FIXEDTEXT == pPrev->GetType()) + // { + // AccessibleRelation aLabelRelation; + // aLabelRelation.RelationType = AccessibleRelationType::LABELED_BY; + // aLabelRelation.TargetSet.realloc(1); + // aLabelRelation.TargetSet.getArray()[0] = pPrev->GetAccessible(); + // pHelper->AddRelation(aLabelRelation); + // } + //} + //IAccessibility2 Implementation 2009----- if(meBorder == FRAMEBORDER_NONE) { //add the label relation - Window* pPrev = mpFrameSel->GetWindow( WINDOW_PREV ); - if(pPrev && WINDOW_FIXEDTEXT == pPrev->GetType()) + Window *pLabeledBy = mpFrameSel->GetAccessibleRelationLabeledBy(); + if ( pLabeledBy && pLabeledBy != mpFrameSel ) { AccessibleRelation aLabelRelation; aLabelRelation.RelationType = AccessibleRelationType::LABELED_BY; aLabelRelation.TargetSet.realloc(1); - aLabelRelation.TargetSet.getArray()[0] = pPrev->GetAccessible(); + aLabelRelation.TargetSet.getArray()[0] = pLabeledBy->GetAccessible(); pHelper->AddRelation(aLabelRelation); } + Window* pMemberOf = mpFrameSel->GetAccessibleRelationMemberOf(); + if ( pMemberOf && pMemberOf != mpFrameSel ) + { + AccessibleRelation aMemberOfRelation; + aMemberOfRelation.RelationType = AccessibleRelationType::MEMBER_OF; + aMemberOfRelation.TargetSet.realloc(1); + aMemberOfRelation.TargetSet.getArray()[0] = pMemberOf->GetAccessible(); + pHelper->AddRelation(aMemberOfRelation); + } } + //-----IAccessibility2 Implementation 2009 return xRet; } @@ -721,6 +748,10 @@ void AccFrameSelector::NotifyAccessibleEvent( const sal_Int16 _nEventId, void AccFrameSelector::Invalidate() { + if ( mpFrameSel ) + { + mpFrameSel->RemoveEventListener( LINK( this, AccFrameSelector, WindowEventListener ) ); + } mpFrameSel = 0; EventObject aEvent; Reference < XAccessibleContext > xThis( this ); diff --git a/svx/source/accessibility/AccessibleGraphicShape.cxx b/svx/source/accessibility/AccessibleGraphicShape.cxx index 2e0d3fb79ce2..d6f0c9900cb2 100644 --- a/svx/source/accessibility/AccessibleGraphicShape.cxx +++ b/svx/source/accessibility/AccessibleGraphicShape.cxx @@ -29,6 +29,8 @@ #include <svx/ShapeTypeHandler.hxx> #include <svx/SvxShapeTypes.hxx> +#include <svx/svdobj.hxx> +#include <svx/svdmodel.hxx> using namespace ::accessibility; using namespace ::rtl; @@ -59,6 +61,10 @@ AccessibleGraphicShape::~AccessibleGraphicShape (void) ::rtl::OUString SAL_CALL AccessibleGraphicShape::getAccessibleImageDescription (void) throw (::com::sun::star::uno::RuntimeException) { +//IAccessibility2 Implementation 2009----- + if(m_pShape) + return m_pShape->GetTitle(); +//-----IAccessibility2 Implementation 2009 return AccessibleShape::getAccessibleDescription (); } @@ -204,5 +210,30 @@ uno::Sequence<uno::Type> SAL_CALL AccessibleGraphicShape::CreateAccessibleDescription (void) throw (::com::sun::star::uno::RuntimeException) { - return CreateAccessibleName (); +//IAccessibility2 Implementation 2009----- + //Solution: Don't use the same information for accessible name and accessible description. + //return CreateAccessibleName (); + ::rtl::OUString sDesc; + if(m_pShape) + sDesc = m_pShape->GetTitle(); + if(sDesc.getLength() > 0) + return sDesc; + return CreateAccessibleBaseName(); +//-----IAccessibility2 Implementation 2009 } +//IAccessibility2 Implementation 2009----- +// Return this object's role. +sal_Int16 SAL_CALL AccessibleGraphicShape::getAccessibleRole (void) + throw (::com::sun::star::uno::RuntimeException) +{ + sal_Int16 nAccessibleRole = AccessibleRole::SHAPE; + if( m_pShape->GetModel()->GetImageMapForObject(m_pShape) != NULL ) + return AccessibleRole::IMAGE_MAP; + else + //return AccessibleRole::SHAPE; + return AccessibleShape::getAccessibleRole(); + return nAccessibleRole; +} +//-----IAccessibility2 Implementation 2009 + + diff --git a/svx/source/accessibility/AccessibleOLEShape.cxx b/svx/source/accessibility/AccessibleOLEShape.cxx index 213fd68a79ae..18cd5bc30949 100644 --- a/svx/source/accessibility/AccessibleOLEShape.cxx +++ b/svx/source/accessibility/AccessibleOLEShape.cxx @@ -29,7 +29,9 @@ #include <svx/ShapeTypeHandler.hxx> #include <svx/SvxShapeTypes.hxx> - +//IAccessibility2 Implementation 2009----- +#include <svx/svdoole2.hxx> +//-----IAccessibility2 Implementation 2009 using namespace accessibility; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -179,8 +181,24 @@ uno::Sequence<uno::Type> SAL_CALL return aTypeList; } - - +//IAccessibility2 Implementation 2009----- +//===== XAccessibleExtendedAttributes ======================================================== +uno::Any SAL_CALL AccessibleOLEShape::getExtendedAttributes() + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) +{ + uno::Any strRet; + ::rtl::OUString style; + if( m_pShape ) + { + //style = ::rtl::OUString::createFromAscii("style="); + style = ::rtl::OUString::createFromAscii("style:"); + style += ((SdrOle2Obj*)m_pShape)->GetStyleString(); + } + style += ::rtl::OUString::createFromAscii(";"); + strRet <<= style; + return strRet; +} +//-----IAccessibility2 Implementation 2009 /// Set this object's name if is different to the current name. diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index c103a5f70f9f..cd48af734d34 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -31,6 +31,11 @@ #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLE_ROLE_HPP_ #include <com/sun/star/accessibility/AccessibleRole.hpp> #endif +//IAccessibility2 Implementation 2009----- +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLETEXTTYPE_HPP_ +#include <com/sun/star/accessibility/AccessibleTextType.hpp> +#endif +//-----IAccessibility2 Implementation 2009 #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLE_STATE_TYPE_HPP_ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #endif @@ -61,12 +66,28 @@ #include <unotools/accessiblestatesethelper.hxx> #include <svx/svdview.hxx> #include "AccessibleEmptyEditSource.hxx" - +//IAccessibility2 Implementation 2009----- +#include <svx/svdpage.hxx> +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_ +#include <com/sun/star/accessibility/AccessibleRelationType.hpp> +#endif +#ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_ +#include <unotools/accessiblerelationsethelper.hxx> +#endif +//-----IAccessibility2 Implementation 2009 using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; +//IAccessibility2 Implementation 2009----- +using ::com::sun::star::lang::IndexOutOfBoundsException; +using ::com::sun::star::uno::RuntimeException; +//-----IAccessibility2 Implementation 2009 using ::com::sun::star::uno::Reference; using ::rtl::OUString; +//IAccessibility2 Implementation 2009----- +#include <algorithm> +// #include <Accessiblehyperlink.hxx> +//-----IAccessibility2 Implementation 2009 namespace accessibility { namespace { @@ -107,7 +128,9 @@ OUString GetOptionalProperty ( AccessibleShape::AccessibleShape ( const AccessibleShapeInfo& rShapeInfo, const AccessibleShapeTreeInfo& rShapeTreeInfo) - : AccessibleContextBase (rShapeInfo.mxParent,AccessibleRole::LIST_ITEM), + //IAccessibility2 Implementation 2009----- + : AccessibleContextBase (rShapeInfo.mxParent,AccessibleRole::SHAPE), + //-----IAccessibility2 Implementation 2009 mpChildrenManager(NULL), mxShape (rShapeInfo.mxShape), maShapeTreeInfo (rShapeTreeInfo), @@ -119,10 +142,26 @@ AccessibleShape::AccessibleShape ( m_pShape = GetSdrObjectFromXShape(mxShape); UpdateNameAndDescription(); } - - - - +//IAccessibility2 Implementation 2009----- +AccessibleShape::AccessibleShape ( + const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape>& rxShape, + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible>& rxParent, + const AccessibleShapeTreeInfo& rShapeTreeInfo, + sal_Int32 nIndex) + : AccessibleContextBase (rxParent,AccessibleRole::SHAPE), + mpChildrenManager(NULL), + mxShape (rxShape), + maShapeTreeInfo (rShapeTreeInfo), + mnIndex (nIndex), + m_nIndexInParent(-1), + mpText (NULL), + mpParent (NULL) +{ + m_pShape = GetSdrObjectFromXShape(mxShape); +} +//-----IAccessibility2 Implementation 2009 AccessibleShape::~AccessibleShape (void) { if (mpChildrenManager != NULL) @@ -258,10 +297,13 @@ void AccessibleShape::UpdateStates (void) else pStateSet->RemoveState (AccessibleStateType::SELECTED); } +//IAccessibility2 Implementation 2009----- + ::rtl::OUString AccessibleShape::GetStyle() + { + return ShapeTypeHandler::CreateAccessibleBaseName( mxShape ); + } - - - +//-----IAccessibility2 Implementation 2009 bool AccessibleShape::operator== (const AccessibleShape& rShape) { return this==&rShape; @@ -323,10 +365,28 @@ sal_Bool AccessibleShape::GetState (sal_Int16 aState) else return AccessibleContextBase::GetState (aState); } +//IAccessibility2 Implementation 2009----- +// Solution: OverWrite the parent's getAccessibleName method +::rtl::OUString SAL_CALL AccessibleShape::getAccessibleName (void) + throw (::com::sun::star::uno::RuntimeException) +{ + ThrowIfDisposed (); + if( m_pShape && m_pShape->GetTitle().Len() > 0) + return CreateAccessibleName() + ::rtl::OUString(' ') + m_pShape->GetTitle(); + else + return CreateAccessibleName(); +} - - - +::rtl::OUString SAL_CALL AccessibleShape::getAccessibleDescription (void) + throw (::com::sun::star::uno::RuntimeException) +{ + ThrowIfDisposed (); + if( m_pShape && m_pShape->GetDescription().Len() > 0) + return m_pShape->GetDescription() ; + else + return OUString( RTL_CONSTASCII_USTRINGPARAM( " " )); +} +//-----IAccessibility2 Implementation 2009 //===== XAccessibleContext ================================================== /** The children of this shape come from two sources: The children from @@ -386,8 +446,45 @@ uno::Reference<XAccessible> SAL_CALL return xChild; } - - +//IAccessibility2 Implementation 2009----- +uno::Reference<XAccessibleRelationSet> SAL_CALL + AccessibleShape::getAccessibleRelationSet (void) + throw (::com::sun::star::uno::RuntimeException) +{ + ::osl::MutexGuard aGuard (maMutex); + ::utl::AccessibleRelationSetHelper* pRelationSet = + new utl::AccessibleRelationSetHelper; + SdrObject* pCaptionSdr = const_cast < SdrObject* > ( m_pShape->GetCaptionObj() ) ; + if(pCaptionSdr!=NULL) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); + uno::Reference<drawing::XShape> xCaptionShape ( pCaptionSdr->getUnoShape(),uno::UNO_QUERY); + if(xCaptionShape.is()) + { + aSequence[0] = mpParent->GetAccessibleCaption(xCaptionShape); + pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::DESCRIBED_BY, aSequence ) ); + } + } + else + { + //this mxshape is the captioned shape, only for sw + if(mpParent->GetAccessibleCaption(mxShape).get()) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); + aSequence[0] = mpParent->GetAccessibleCaption(mxShape); + pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::DESCRIBED_BY, aSequence ) ); + } + } + if (pRelationSet != NULL) + { + return uno::Reference<XAccessibleRelationSet> ( + new ::utl::AccessibleRelationSetHelper (*pRelationSet)); + } + else + return uno::Reference<XAccessibleRelationSet>(NULL); + return uno::Reference<XAccessibleRelationSet>(); +} +//-----IAccessibility2 Implementation 2009 /** Return a copy of the state set. Possible states are: @@ -404,8 +501,41 @@ uno::Reference<XAccessibleStateSet> SAL_CALL if (rBHelper.bDisposed || mpText == NULL) // Return a minimal state set that only contains the DEFUNC state. + //IAccessibility2 Implementation 2009----- + //xStateSet = AccessibleContextBase::getAccessibleStateSet (); + { xStateSet = AccessibleContextBase::getAccessibleStateSet (); - else + ::utl::AccessibleStateSetHelper* pStateSet = + static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); + ::com::sun::star::uno::Reference<XAccessible> xTempAcc = getAccessibleParent(); + if( xTempAcc.is() ) + { + ::com::sun::star::uno::Reference<XAccessibleContext> + xTempAccContext = xTempAcc->getAccessibleContext(); + if( xTempAccContext.is() ) + { + ::com::sun::star::uno::Reference<XAccessibleStateSet> rState = + xTempAccContext->getAccessibleStateSet(); + if( rState.is() ) { + com::sun::star::uno::Sequence<short> pStates = rState->getStates(); + int count = pStates.getLength(); + for( int iIndex = 0;iIndex < count;iIndex++ ) + { + if( pStates[iIndex] == AccessibleStateType::EDITABLE ) + { + pStateSet->AddState (AccessibleStateType::EDITABLE); + pStateSet->AddState (AccessibleStateType::RESIZABLE); + pStateSet->AddState (AccessibleStateType::MOVEABLE); + break; + } + } + } + } + } + xStateSet = Reference<XAccessibleStateSet>( + new ::utl::AccessibleStateSetHelper (*pStateSet)); + //-----IAccessibility2 Implementation 2009 + }else { ::utl::AccessibleStateSetHelper* pStateSet = static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get()); @@ -420,14 +550,43 @@ uno::Reference<XAccessibleStateSet> SAL_CALL else pStateSet->RemoveState (AccessibleStateType::FOCUSED); } - + //IAccessibility2 Implementation 2009----- + //Solution:Just when the document is not read-only,set states EDITABLE,RESIZABLE,MOVEABLE + ::com::sun::star::uno::Reference<XAccessible> xTempAcc = getAccessibleParent(); + if( xTempAcc.is() ) + { + ::com::sun::star::uno::Reference<XAccessibleContext> + xTempAccContext = xTempAcc->getAccessibleContext(); + if( xTempAccContext.is() ) + { + ::com::sun::star::uno::Reference<XAccessibleStateSet> rState = + xTempAccContext->getAccessibleStateSet(); + if( rState.is() ) { + com::sun::star::uno::Sequence<short> pStates = rState->getStates(); + int count = pStates.getLength(); + for( int iIndex = 0;iIndex < count;iIndex++ ) + { + if( pStates[iIndex] == AccessibleStateType::EDITABLE ) + { + pStateSet->AddState (AccessibleStateType::EDITABLE); + pStateSet->AddState (AccessibleStateType::RESIZABLE); + pStateSet->AddState (AccessibleStateType::MOVEABLE); + break; + } + } + } + } + } + //-----IAccessibility2 Implementation 2009 // Create a copy of the state set that may be modified by the // caller without affecting the current state set. xStateSet = Reference<XAccessibleStateSet>( new ::utl::AccessibleStateSetHelper (*pStateSet)); } } - +//IAccessibility2 Implementation 2009----- + UpdateDocumentAllSelState(xStateSet); +//-----IAccessibility2 Implementation 2009 return xStateSet; } @@ -705,6 +864,22 @@ sal_Int32 SAL_CALL AccessibleShape::getBackground (void) uno::Any aColor; aColor = aSet->getPropertyValue (OUString::createFromAscii ("FillColor")); aColor >>= nColor; + //IAccessibility2 Implementation 2009----- + aColor = aSet->getPropertyValue (OUString::createFromAscii ("FillTransparence")); + short nTrans=0; + aColor >>= nTrans; + Color crBk(nColor); + if (nTrans == 0 ) + { + crBk.SetTransparency(0xff); + } + else + { + nTrans = short(256 - nTrans / 100. * 256); + crBk.SetTransparency(sal_uInt8(nTrans)); + } + nColor = crBk.GetColor(); + //-----IAccessibility2 Implementation 2009 } } catch (::com::sun::star::beans::UnknownPropertyException) @@ -763,9 +938,18 @@ com::sun::star::uno::Any SAL_CALL aReturn = ::cppu::queryInterface (rType, static_cast<XAccessibleComponent*>(this), static_cast<XAccessibleExtendedComponent*>(this), + //IAccessibility2 Implementation 2009----- + static_cast< ::com::sun::star::accessibility::XAccessibleSelection* >(this), + + static_cast< ::com::sun::star::accessibility::XAccessibleExtendedAttributes* >(this), + //-----IAccessibility2 Implementation 2009 static_cast<lang::XEventListener*>(this), static_cast<document::XEventListener*>(this), - static_cast<lang::XUnoTunnel*>(this) + static_cast<lang::XUnoTunnel*>(this), + //IAccessibility2 Implementation 2009----- + static_cast<XAccessibleGroupPosition*>(this), + static_cast<XAccessibleHypertext*>(this) + //-----IAccessibility2 Implementation 2009 ); return aReturn; } @@ -789,10 +973,127 @@ void SAL_CALL { AccessibleContextBase::release (); } +//IAccessibility2 Implementation 2009----- +// +//===== XAccessibleSelection ============================================ +// + +//-------------------------------------------------------------------------------- +void SAL_CALL AccessibleShape::selectAccessibleChild( sal_Int32 ) +throw ( IndexOutOfBoundsException, RuntimeException ) +{ +} +//---------------------------------------------------------------------------------- +sal_Bool SAL_CALL AccessibleShape::isAccessibleChildSelected( sal_Int32 nChildIndex ) +throw ( IndexOutOfBoundsException, + RuntimeException ) +{ + uno::Reference<XAccessible> xAcc = getAccessibleChild( nChildIndex ); + uno::Reference<XAccessibleContext> xContext; + if( xAcc.is() ) + { + xContext = xAcc->getAccessibleContext(); + } + if( xContext.is() ) + { + if( xContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) + { + uno::Reference< ::com::sun::star::accessibility::XAccessibleText > + xText(xAcc, uno::UNO_QUERY); + if( xText.is() ) + { + if( xText->getSelectionStart() >= 0 ) return sal_True; + } + } + else if( xContext->getAccessibleRole() == AccessibleRole::SHAPE ) + { + Reference< XAccessibleStateSet > pRState = xContext->getAccessibleStateSet(); + if( !pRState.is() ) + return sal_False; + uno::Sequence<short> pStates = pRState->getStates(); + int nCount = pStates.getLength(); + for( int i = 0; i < nCount; i++ ) + { + if(pStates[i] == AccessibleStateType::SELECTED) + return sal_True; + } + return sal_False; + } + } + return sal_False; +} + +//--------------------------------------------------------------------- +void SAL_CALL AccessibleShape::clearAccessibleSelection( ) +throw ( RuntimeException ) +{ +} + +//------------------------------------------------------------------------- +void SAL_CALL AccessibleShape::selectAllAccessibleChildren( ) +throw ( RuntimeException ) +{ +} + +//---------------------------------------------------------------------------- +sal_Int32 SAL_CALL AccessibleShape::getSelectedAccessibleChildCount() +throw ( RuntimeException ) +{ + sal_Int32 nCount = 0; + sal_Int32 TotalCount = getAccessibleChildCount(); + for( sal_Int32 i = 0; i < TotalCount; i++ ) + if( isAccessibleChildSelected(i) ) nCount++; + + return nCount; +} + +//-------------------------------------------------------------------------------------- +Reference<XAccessible> SAL_CALL AccessibleShape::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) +throw ( IndexOutOfBoundsException, RuntimeException) +{ + if ( nSelectedChildIndex > getSelectedAccessibleChildCount() ) + throw IndexOutOfBoundsException(); + sal_Int32 i1, i2; + for( i1 = 0, i2 = 0; i1 < getAccessibleChildCount(); i1++ ) + if( isAccessibleChildSelected(i1) ) + { + if( i2 == nSelectedChildIndex ) + return getAccessibleChild( i1 ); + i2++; + } + return Reference<XAccessible>(); +} + +//---------------------------------------------------------------------------------- +void SAL_CALL AccessibleShape::deselectAccessibleChild( sal_Int32 ) + throw ( IndexOutOfBoundsException, + RuntimeException ) +{ + +} + +//===== XAccessibleExtendedAttributes ======================================================== +uno::Any SAL_CALL AccessibleShape::getExtendedAttributes() + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) +{ + uno::Any strRet; + ::rtl::OUString style; + if( getAccessibleRole() != AccessibleRole::SHAPE ) return strRet; + if( m_pShape ) + { + //style = ::rtl::OUString::createFromAscii("style="); + style = ::rtl::OUString::createFromAscii("style:"); + style += GetStyle(); + } + style += ::rtl::OUString::createFromAscii(";"); + strRet <<= style; + return strRet; +} +//-----IAccessibility2 Implementation 2009 //===== XServiceInfo ======================================================== ::rtl::OUString SAL_CALL @@ -917,6 +1218,11 @@ void SAL_CALL { if (rEventObject.EventName.equals (sShapeModified)) { + //Need to update text children when receiving ShapeModified hint when exiting edit mode for text box + if (mpText) + mpText->UpdateChildren(); + + // Some property of a shape has been modified. Send an event // that indicates a change of the visible data to all listeners. CommitChange ( @@ -1021,47 +1327,103 @@ void AccessibleShape::ViewForwarderChanged (ChangeType aChangeType, AccessibleShape::CreateAccessibleName (void) throw (::com::sun::star::uno::RuntimeException) { - OUString sName (CreateAccessibleBaseName()); + //OUString sName (CreateAccessibleBaseName()); +//IAccessibility2 Implementation 2009----- + OUString sName; + sName = GetFullAccessibleName(this); + return sName; +} +::rtl::OUString + AccessibleShape::GetFullAccessibleName (AccessibleShape *shape) + throw (::com::sun::star::uno::RuntimeException) +{ + OUString sName (shape->CreateAccessibleBaseName()); // Append the shape's index to the name to disambiguate between shapes // of the same type. If such an index where not given to the // constructor then use the z-order instead. If even that does not exist // we throw an exception. - long nIndex = mnIndex; - if (nIndex == -1) + //long nIndex = mnIndex; + //if (nIndex == -1) + //{ + // try + // { + // uno::Reference<beans::XPropertySet> xSet (mxShape, uno::UNO_QUERY); + // if (xSet.is()) + // { + // uno::Any aZOrder (xSet->getPropertyValue (::rtl::OUString::createFromAscii ("ZOrder"))); + // aZOrder >>= nIndex; + + // // Add one to be not zero based. + // nIndex += 1; + // } + // } + // catch (beans::UnknownPropertyException) + // { + // // We throw our own exception that is a bit more informative. + // throw uno::RuntimeException (::rtl::OUString ( + // RTL_CONSTASCII_USTRINGPARAM("AccessibleShape has invalid index and no ZOrder property")), + // static_cast<uno::XWeak*>(this)); + // } + + //} + + //// Put a space between name and index because of Gnopernicus othewise + //// spells the name. + //sName += OUString (RTL_CONSTASCII_USTRINGPARAM(" ")) + OUString::valueOf (nIndex); + + //return sName; + + XubString nameStr; + if(shape->m_pShape) + nameStr = shape->m_pShape->GetName(); + if(nameStr.Len() == 0) { - try + sName += OUString( RTL_CONSTASCII_USTRINGPARAM( " " )); + } + else + { + sName = nameStr; + } + /* + sal_Int32 nChildCount = shape->getAccessibleChildCount(); + if(nChildCount > 0) + { + for (sal_Int32 i=0; i<nChildCount; ++i) { - uno::Reference<beans::XPropertySet> xSet (mxShape, uno::UNO_QUERY); - if (xSet.is()) + Reference<XAccessible> xChild (shape->getAccessibleChild (i)); + if (xChild.is()) { - uno::Any aZOrder (xSet->getPropertyValue (::rtl::OUString::createFromAscii ("ZOrder"))); - aZOrder >>= nIndex; - - // Add one to be not zero based. - nIndex += 1; + uno::Reference <XAccessibleContext> xChildContext(xChild->getAccessibleContext()); + if (xChildContext->getAccessibleRole() == AccessibleRole::PARAGRAPH) + { + uno::Reference<XAccessibleText> xText = uno::Reference<XAccessibleText> ( xChild, uno::UNO_QUERY ); + sName += OUString( RTL_CONSTASCII_USTRINGPARAM( " " )) + xText->getText(); + } + else if (xChildContext->getAccessibleRole() == AccessibleRole::SHAPE) + { + sName += OUString( RTL_CONSTASCII_USTRINGPARAM( " " )) + GetFullAccessibleName(static_cast< AccessibleShape*>( xChild.get())); + } } } - catch (beans::UnknownPropertyException) - { - // We throw our own exception that is a bit more informative. - throw uno::RuntimeException (::rtl::OUString ( - RTL_CONSTASCII_USTRINGPARAM("AccessibleShape has invalid index and no ZOrder property")), - static_cast<uno::XWeak*>(this)); - } - + } + */ + //Solution:If the new produced name if not the same with last,notify name changed + // Event + if( aAccName != sName && aAccName.getLength() != 0 ) + { + uno::Any aOldValue, aNewValue; + aOldValue <<= aAccName; + aNewValue <<= sName; + CommitChange( + AccessibleEventId::NAME_CHANGED, + aNewValue, + aOldValue); } - - // Put a space between name and index because of Gnopernicus othewise - // spells the name. - sName += OUString (RTL_CONSTASCII_USTRINGPARAM(" ")) + OUString::valueOf (nIndex); - + aAccName = sName; return sName; } - - - - +//-----IAccessibility2 Implementation 2009 ::rtl::OUString AccessibleShape::CreateAccessibleDescription (void) throw (::com::sun::star::uno::RuntimeException) @@ -1233,8 +1595,250 @@ void AccessibleShape::UpdateNameAndDescription (void) { } } +//IAccessibility2 Implementation 2009----- +// Return this object's role. +sal_Int16 SAL_CALL AccessibleShape::getAccessibleRole (void) + throw (::com::sun::star::uno::RuntimeException) +{ + sal_Int16 nAccessibleRole = AccessibleRole::SHAPE ; + switch (ShapeTypeHandler::Instance().GetTypeId (mxShape)) + { + case DRAWING_GRAPHIC_OBJECT: + nAccessibleRole = AccessibleRole::GRAPHIC ; break; + case DRAWING_OLE: + nAccessibleRole = AccessibleRole::EMBEDDED_OBJECT ; break; + + default: + nAccessibleRole = AccessibleContextBase::getAccessibleRole(); + break; + } + + return nAccessibleRole; +} +void AccessibleShape::UpdateDocumentAllSelState(Reference<XAccessibleStateSet> &xStateSet) +{ + if (mpParent && mpParent->IsDocumentSelAll()) + { + ::utl::AccessibleStateSetHelper* pStateSet = + static_cast< ::utl::AccessibleStateSetHelper*>(xStateSet.get()); + pStateSet->AddState (AccessibleStateType::SELECTED); + + //uno::Any NewValue; + //NewValue <<= AccessibleStateType::SELECTED; + + //CommitChange(AccessibleEventId::STATE_CHANGED,NewValue,uno::Any()); + } +} +//sort the drawing objects from up to down, from left to right +struct XShapePosCompareHelper +{ + bool operator() ( const uno::Reference<drawing::XShape>& xshape1, + const uno::Reference<drawing::XShape>& xshape2 ) const + { + SdrObject* pObj1 = GetSdrObjectFromXShape(xshape1); + SdrObject* pObj2 = GetSdrObjectFromXShape(xshape2); + if(pObj1 && pObj2) + return pObj1->GetOrdNum() < pObj2->GetOrdNum(); + else + return 0; + } +}; +//end of group position + +//===== XAccessibleGroupPosition ========================================= +uno::Sequence< sal_Int32 > SAL_CALL +AccessibleShape::getGroupPosition( const uno::Any& ) +throw (uno::RuntimeException) +{ + // we will return the: + // [0] group level + // [1] similar items counts in the group + // [2] the position of the object in the group + uno::Sequence< sal_Int32 > aRet( 3 ); + aRet[0] = 0; + aRet[1] = 0; + aRet[2] = 0; + + ::com::sun::star::uno::Reference<XAccessible> xParent = getAccessibleParent(); + if (!xParent.is()) + { + return aRet; + } + SdrObject *pObj = GetSdrObjectFromXShape(mxShape); + + + if(pObj == NULL ) + { + return aRet; + } + + // Compute object's group level. + sal_Int32 nGroupLevel = 0; + SdrObject * pUper = pObj->GetUpGroup(); + while( pUper ) + { + ++nGroupLevel; + pUper = pUper->GetUpGroup(); + } + + ::com::sun::star::uno::Reference<XAccessibleContext> xParentContext = xParent->getAccessibleContext(); + if( xParentContext->getAccessibleRole() == AccessibleRole::DOCUMENT)//Document + { + Reference< XAccessibleGroupPosition > xGroupPosition( xParent,uno::UNO_QUERY ); + if ( xGroupPosition.is() ) + { + aRet = xGroupPosition->getGroupPosition( uno::makeAny( getAccessibleContext() ) ); + } + return aRet; + } + if (xParentContext->getAccessibleRole() != AccessibleRole::SHAPE) + { + return aRet; + } + + SdrObjList *pGrpList = NULL; + if( pObj->GetUpGroup() ) + pGrpList = pObj->GetUpGroup()->GetSubList(); + else + return aRet; + + std::vector< uno::Reference<drawing::XShape> > vXShapes; + if (pGrpList) + { + const sal_Int32 nObj = pGrpList->GetObjCount(); + for(sal_Int32 i = 0 ; i < nObj ; ++i) + { + SdrObject *pSubObj = pGrpList->GetObj(i); + //IAccessibility2 Implementation 2009----- + if (pSubObj && + xParentContext->getAccessibleChild(i)->getAccessibleContext()->getAccessibleRole() != AccessibleRole::GROUP_BOX) + //-----IAccessibility2 Implementation 2009 + { + vXShapes.push_back( GetXShapeForSdrObject(pSubObj) ); + } + } + } + + std::sort( vXShapes.begin(), vXShapes.end(), XShapePosCompareHelper() ); + + //get the the index of the selected object in the group + std::vector< uno::Reference<drawing::XShape> >::iterator aIter; + //we start counting position from 1 + sal_Int32 nPos = 1; + for ( aIter = vXShapes.begin(); aIter != vXShapes.end(); aIter++, nPos++ ) + { + if ( (*aIter).get() == mxShape.get() ) + { + sal_Int32* pArray = aRet.getArray(); + pArray[0] = nGroupLevel; + pArray[1] = vXShapes.size(); + pArray[2] = nPos; + break; + } + } + + return aRet; +} + +::rtl::OUString AccessibleShape::getObjectLink( const uno::Any& ) + throw (uno::RuntimeException) +{ + ::rtl::OUString aRet; + + SdrObject *pObj = GetSdrObjectFromXShape(mxShape); + if(pObj == NULL ) + { + return aRet; + } + if (maShapeTreeInfo.GetDocumentWindow().is()) + { + Reference< XAccessibleGroupPosition > xGroupPosition( maShapeTreeInfo.GetDocumentWindow(), uno::UNO_QUERY ); + if (xGroupPosition.is()) + { + aRet = xGroupPosition->getObjectLink( uno::makeAny( getAccessibleContext() ) ); + } + } + return aRet; +} + +//===== XAccesibleHypertext ================================================== +sal_Int32 SAL_CALL AccessibleShape::getHyperLinkCount() + throw (::com::sun::star::uno::RuntimeException) +{ + // MT: Introduced with IA2 CWS, but SvxAccessibleHyperlink was redundant to svx::AccessibleHyperlink which we introduced meanwhile. + // Code need to be adapted.... + return 0; + + /* + SvxAccessibleHyperlink* pLink = new SvxAccessibleHyperlink(m_pShape,this); + if (pLink->IsValidHyperlink()) + return 1; + else + return 0; + */ +} +uno::Reference< XAccessibleHyperlink > SAL_CALL + AccessibleShape::getHyperLink( sal_Int32 ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) +{ + uno::Reference< XAccessibleHyperlink > xRet; + // MT: Introduced with IA2 CWS, but SvxAccessibleHyperlink was redundant to svx::AccessibleHyperlink which we introduced meanwhile. + // Code need to be adapted.... + /* + SvxAccessibleHyperlink* pLink = new SvxAccessibleHyperlink(m_pShape,this); + if (pLink->IsValidHyperlink()) + xRet = pLink; + if( !xRet.is() ) + throw ::com::sun::star::lang::IndexOutOfBoundsException(); + */ + return xRet; +} +sal_Int32 SAL_CALL AccessibleShape::getHyperLinkIndex( sal_Int32 ) +throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) +{ + sal_Int32 nRet = 0; + return nRet; +} +//===== XAccesibleText ================================================== +sal_Int32 SAL_CALL AccessibleShape::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException){return 0;} +sal_Bool SAL_CALL AccessibleShape::setCaretPosition( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return 0;} +sal_Unicode SAL_CALL AccessibleShape::getCharacter( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return 0;} +::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleShape::getCharacterAttributes( sal_Int32, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) +{ + uno::Sequence< ::com::sun::star::beans::PropertyValue > aValues(0); + return aValues; +} +::com::sun::star::awt::Rectangle SAL_CALL AccessibleShape::getCharacterBounds( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) +{ + return com::sun::star::awt::Rectangle(0, 0, 0, 0 ); +} +sal_Int32 SAL_CALL AccessibleShape::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException){return 0;} +sal_Int32 SAL_CALL AccessibleShape::getIndexAtPoint( const ::com::sun::star::awt::Point& ) throw (::com::sun::star::uno::RuntimeException){return 0;} +::rtl::OUString SAL_CALL AccessibleShape::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException){return OUString();} +sal_Int32 SAL_CALL AccessibleShape::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException){return 0;} +sal_Int32 SAL_CALL AccessibleShape::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException){return 0;} +sal_Bool SAL_CALL AccessibleShape::setSelection( sal_Int32, sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return sal_True;} +::rtl::OUString SAL_CALL AccessibleShape::getText( ) throw (::com::sun::star::uno::RuntimeException){return OUString();} +::rtl::OUString SAL_CALL AccessibleShape::getTextRange( sal_Int32, sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return OUString();} +::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleShape::getTextAtIndex( sal_Int32, sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::accessibility::TextSegment aResult; + return aResult; +} +::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleShape::getTextBeforeIndex( sal_Int32, sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::accessibility::TextSegment aResult; + return aResult; +} +::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleShape::getTextBehindIndex( sal_Int32, sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::accessibility::TextSegment aResult; + return aResult; +} +sal_Bool SAL_CALL AccessibleShape::copyText( sal_Int32, sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return sal_True;} +//-----IAccessibility2 Implementation 2009 } // end of namespace accessibility diff --git a/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx b/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx new file mode 100644 index 000000000000..4a8430dd4921 --- /dev/null +++ b/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx @@ -0,0 +1,120 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#include <svx/AccessibleSvxFindReplaceDialog.hxx> + + +#ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_ +#include "toolkit/awt/vclxwindow.hxx" +#endif + +#ifndef _SVX_SRCHDLG_HXX +#include <svx/srchdlg.hxx> +#endif + +#ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_ +#include <unotools/accessiblerelationsethelper.hxx> +#endif + +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_ +#include <com/sun/star/accessibility/AccessibleRelationType.hpp> +#endif + +#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEGETACCFLOWTO_HPP_ +#include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp> +#endif + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +VCLXAccessibleSvxFindReplaceDialog::VCLXAccessibleSvxFindReplaceDialog(VCLXWindow* pVCLXindow) + :VCLXAccessibleComponent( pVCLXindow ) +{ + +} + +VCLXAccessibleSvxFindReplaceDialog::~VCLXAccessibleSvxFindReplaceDialog() +{ +} + +void VCLXAccessibleSvxFindReplaceDialog::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet ) +{ + VCLXAccessibleComponent::FillAccessibleRelationSet( rRelationSet ); + Window* pDlg = GetWindow(); + if ( pDlg ) + { + SvxSearchDialog* pSrchDlg = static_cast<SvxSearchDialog*>( pDlg ); + Window* pDocWin = pSrchDlg->GetDocWin(); + if ( !pDocWin ) + { + return; + } + Reference < accessibility::XAccessible > xDocAcc = pDocWin->GetAccessible(); + if ( !xDocAcc.is() ) + { + return; + } + Reference< accessibility::XAccessibleGetAccFlowTo > xGetAccFlowTo( xDocAcc, UNO_QUERY ); + if ( !xGetAccFlowTo.is() ) + { + return; + } + Any aAny; + aAny <<= ( pSrchDlg->GetSrchFlag() ); + + const sal_Int32 FORFINDREPLACEFLOWTO = 2; + uno::Sequence<uno::Any> aAnySeq = xGetAccFlowTo->get_AccFlowTo( aAny, FORFINDREPLACEFLOWTO ); + + sal_Int32 nLen = aAnySeq.getLength(); + if ( nLen ) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence( nLen ); + for ( sal_Int32 i = 0; i < nLen; i++ ) + { + uno::Reference < accessibility::XAccessible > xAcc; + aAnySeq[i] >>= xAcc; + aSequence[i] = xAcc; + } + rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::CONTENT_FLOWS_TO, aSequence ) ); + } + } +} +// ----------------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------------- + +::rtl::OUString VCLXAccessibleSvxFindReplaceDialog::getImplementationName() throw (RuntimeException) +{ + return ::rtl::OUString::createFromAscii( "VCLXAccessibleSvxFindReplaceDialog" ); +} + +// ----------------------------------------------------------------------------- + +Sequence< ::rtl::OUString > VCLXAccessibleSvxFindReplaceDialog::getSupportedServiceNames() throw (RuntimeException) +{ + Sequence< ::rtl::OUString > aNames(1); + aNames[0] = ::rtl::OUString::createFromAscii( "VCLXAccessibleSvxFindReplaceDialog" ); + return aNames; +} diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index 18d24e83758c..67b930407e29 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -50,7 +50,15 @@ #include <unotools/accessiblestatesethelper.hxx> #include <vcl/unohelp.hxx> #include <vcl/svapp.hxx> +//IAccessibility2 Implementation 2009----- +//add TEXT_SELECTION_CHANGED event +#ifndef _TEXTDATA_HXX +#include <svtools/textdata.hxx> +#endif +#include <sfx2/viewfrm.hxx> +#include <sfx2/viewsh.hxx> +//-----IAccessibility2 Implementation 2009 //------------------------------------------------------------------------ // // Project-local header @@ -68,6 +76,10 @@ #include "editeng/AccessibleEditableTextPara.hxx" #include <svx/svdmodel.hxx> #include <svx/svdpntv.hxx> +//IAccessibility2 Implementation 2009----- +#include "../table/cell.hxx" +#include "../table/accessiblecell.hxx" +//-----IAccessibility2 Implementation 2009 #include <editeng/editdata.hxx> #include <editeng/editeng.hxx> #include <editeng/editview.hxx> @@ -77,6 +89,22 @@ using namespace ::com::sun::star::accessibility; namespace accessibility { +//IAccessibility2 Implementation 2009----- + Window* GetCurrentEditorWnd() + { + Window* pWin = NULL; + SfxViewFrame* pFrame = SfxViewFrame::Current(); + if (pFrame) + { + const SfxViewShell * pViewShell = pFrame->GetViewShell(); + if(pViewShell) + { + pWin = pViewShell->GetWindow(); + } + } + return pWin; + } +//-----IAccessibility2 Implementation 2009 //------------------------------------------------------------------------ // @@ -484,12 +512,38 @@ namespace accessibility { if( bHaveFocus ) { - GotPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED ); + //IAccessibility2 Implementation 2009----- + if( mxFrontEnd.is() ) + { + AccessibleCell* pAccessibleCell = dynamic_cast< AccessibleCell* > ( mxFrontEnd.get() ); + if ( !pAccessibleCell ) + GotPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED ); + else // the focus event on cell should be fired on table directly + { + AccessibleTableShape* pAccTable = pAccessibleCell->GetParentTable(); + if (pAccTable) + pAccTable->SetStateDirectly(AccessibleStateType::FOCUSED); + } + } + //-----IAccessibility2 Implementation 2009 DBG_TRACE("AccessibleTextHelper_Impl::SetShapeFocus(): Parent object received focus" ); } else { - LostPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED ); + // The focus state should be reset directly on table. + //LostPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED ); + if( mxFrontEnd.is() ) + { + AccessibleCell* pAccessibleCell = dynamic_cast< AccessibleCell* > ( mxFrontEnd.get() ); + if ( !pAccessibleCell ) + LostPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED ); + else + { + AccessibleTableShape* pAccTable = pAccessibleCell->GetParentTable(); + if (pAccTable) + pAccTable->ResetStateDirectly(AccessibleStateType::FOCUSED); + } + } DBG_TRACE("AccessibleTextHelper_Impl::SetShapeFocus(): Parent object lost focus" ); } } @@ -543,6 +597,18 @@ namespace accessibility if( !pViewForwarder ) return sal_False; + //IAccessibility2 Implementation 2009----- + if( mxFrontEnd.is() ) + { + AccessibleCell* pAccessibleCell = dynamic_cast< AccessibleCell* > ( mxFrontEnd.get() ); + if ( pAccessibleCell ) + { + sdr::table::CellRef xCell = pAccessibleCell->getCellRef(); + if ( xCell.is() ) + return xCell->IsTextEditActive(); + } + } + //-----IAccessibility2 Implementation 2009 if( pViewForwarder->IsValid() ) return sal_True; else @@ -861,9 +927,12 @@ namespace accessibility // convert to screen coordinates aParaBB = ::accessibility::AccessibleEditableTextPara::LogicToPixel( aTmpBB, rCacheTF.GetMapMode(), rCacheVF ); - + //IAccessibility2 Implementation 2009----- + /* if( aParaBB.IsOver( aViewArea ) ) { + */ + //-----IAccessibility2 Implementation 2009 // at least partially visible if( bFirstChild ) { @@ -884,6 +953,8 @@ namespace accessibility mxFrontEnd, GetEditSource(), nCurrPara ).first ), AccessibleEventId::CHILD ); } + //IAccessibility2 Implementation 2009----- + /* } else { @@ -897,7 +968,8 @@ namespace accessibility // clear reference maParaManager.Release( nCurrPara ); } - } + }*/ + //-----IAccessibility2 Implementation 2009 } } catch( const uno::Exception& ) @@ -1376,6 +1448,12 @@ namespace accessibility { case HINT_BEGEDIT: { + //IAccessibility2 Implementation 2009----- + if(!IsActive()) + { + break; + } +//-----IAccessibility2 Implementation 2009 // change children state maParaManager.SetActive(); diff --git a/svx/source/accessibility/ChildrenManager.cxx b/svx/source/accessibility/ChildrenManager.cxx index 2022b9105dbb..3705d89c34f7 100644 --- a/svx/source/accessibility/ChildrenManager.cxx +++ b/svx/source/accessibility/ChildrenManager.cxx @@ -86,7 +86,22 @@ long ChildrenManager::GetChildCount (void) const throw () return mpImpl->GetChild (nIndex); } +//IAccessibility2 Implementation 2009----- +Reference<XAccessible> ChildrenManager::GetChild (const Reference<drawing::XShape>& xShape) + throw (::com::sun::star::uno::RuntimeException) +{ + OSL_ASSERT (mpImpl != NULL); + return mpImpl->GetChild (xShape); +} +::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape> ChildrenManager::GetChildShape(long nIndex) + throw (::com::sun::star::uno::RuntimeException) +{ + OSL_ASSERT (mpImpl != NULL); + return mpImpl->GetChildShape(nIndex); +} +//-----IAccessibility2 Implementation 2009 void ChildrenManager::Update (bool bCreateNewObjectsOnDemand) diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx index 92b457e4219f..832b1d2e9dbf 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.cxx +++ b/svx/source/accessibility/ChildrenManagerImpl.cxx @@ -37,7 +37,18 @@ #include <rtl/ustring.hxx> #include <tools/debug.hxx> +//IAccessibility2 Implementation 2009----- +#ifndef _SVX_ACCESSIBILITY_SVX_SHAPE_TYPES_HXX +#include <svx/SvxShapeTypes.hxx> +#endif +#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ +#include <toolkit/unohlp.hxx> +#endif +#ifndef _SV_WINDOW_HXX +#include <vcl/window.hxx> +#endif +//-----IAccessibility2 Implementation 2009 using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; using ::com::sun::star::uno::Reference; @@ -117,7 +128,21 @@ long ChildrenManagerImpl::GetChildCount (void) const throw () } - +//IAccessibility2 Implementation 2009----- +::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape> ChildrenManagerImpl::GetChildShape(long nIndex) + throw (::com::sun::star::uno::RuntimeException) +{ + uno::Reference<XAccessible> xAcc = GetChild(nIndex); + ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end(); + for (I = maVisibleChildren.begin(); I != aEnd; ++I) + { + if (I->mxAccessibleShape == xAcc) + return I->mxShape; + } + return uno::Reference< drawing::XShape > (); +} +//-----IAccessibility2 Implementation 2009 /** Return the requested accessible child object. Create it if it is not yet in the cache. @@ -871,9 +896,36 @@ sal_Bool ChildrenManagerImpl::ReplaceChild ( return bResult; } - - - +//IAccessibility2 Implementation 2009----- +// Add the impl method for IAccessibleParent interface +AccessibleControlShape * ChildrenManagerImpl::GetAccControlShapeFromModel(::com::sun::star::beans::XPropertySet* pSet) throw (::com::sun::star::uno::RuntimeException) +{ + sal_Int32 count = GetChildCount(); + for (sal_Int32 index=0;index<count;index++) + { + AccessibleShape* pAccShape = maVisibleChildren[index].GetAccessibleShape(); + if (pAccShape && ::accessibility::ShapeTypeHandler::Instance().GetTypeId (pAccShape->GetXShape()) == DRAWING_CONTROL) + { + ::accessibility::AccessibleControlShape *pCtlAccShape = static_cast < ::accessibility::AccessibleControlShape* >(pAccShape); + if (pCtlAccShape && pCtlAccShape->GetControlModel() == pSet) + return pCtlAccShape; + } + } + return NULL; +} +uno::Reference<XAccessible> + ChildrenManagerImpl::GetAccessibleCaption (const uno::Reference<drawing::XShape>& xShape) + throw (uno::RuntimeException) +{ + ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end(); + for (I = maVisibleChildren.begin(); I != aEnd; ++I) + { + if ( I->mxShape.get() == xShape.get() ) + return I->mxAccessibleShape; + } + return uno::Reference<XAccessible> (); +} +//-----IAccessibility2 Implementation 2009 /** Update the <const>SELECTED</const> and the <const>FOCUSED</const> state of all visible children. Maybe this should be changed to all children. @@ -906,13 +958,30 @@ void ChildrenManagerImpl::UpdateSelection (void) // Remember the current and new focused shape. AccessibleShape* pCurrentlyFocusedShape = NULL; AccessibleShape* pNewFocusedShape = NULL; - +//IAccessibility2 Implementation 2009----- + typedef std::pair< AccessibleShape* , sal_Bool > PAIR_SHAPE;//sal_Bool Selected,UnSelected. + typedef std::vector< PAIR_SHAPE > VEC_SHAPE; + VEC_SHAPE vecSelect; + int nAddSelect=0; + int nRemoveSelect=0; + sal_Bool bHasSelectedShape=sal_False; +//-----IAccessibility2 Implementation 2009 ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end(); for (I=maVisibleChildren.begin(); I != aEnd; ++I) { AccessibleShape* pAccessibleShape = I->GetAccessibleShape(); if (I->mxAccessibleShape.is() && I->mxShape.is() && pAccessibleShape!=NULL) { + //IAccessibility2 Implementation 2009----- + short nRole = pAccessibleShape->getAccessibleRole(); + bool bDrawShape = ( + nRole == AccessibleRole::GRAPHIC || + nRole == AccessibleRole::EMBEDDED_OBJECT || + nRole == AccessibleRole::SHAPE || + nRole == AccessibleRole::IMAGE_MAP || + nRole == AccessibleRole::TABLE_CELL || + nRole == AccessibleRole::TABLE ); +//-----IAccessibility2 Implementation 2009 bool bShapeIsSelected = false; // Look up the shape in the (single or multi-) selection. @@ -939,16 +1008,42 @@ void ChildrenManagerImpl::UpdateSelection (void) // Set or reset the SELECTED state. if (bShapeIsSelected) - pAccessibleShape->SetState (AccessibleStateType::SELECTED); + //IAccessibility2 Implementation 2009----- + //pAccessibleShape->SetState (AccessibleStateType::SELECTED); + { + if (pAccessibleShape->SetState (AccessibleStateType::SELECTED)) + { + if (bDrawShape) + { + vecSelect.push_back(std::make_pair(pAccessibleShape,sal_True)); + ++nAddSelect; + } + } + else + {//Selected not change,has selected shape before + bHasSelectedShape=sal_True; + } + } else - pAccessibleShape->ResetState (AccessibleStateType::SELECTED); - + //pAccessibleShape->ResetState (AccessibleStateType::SELECTED); + { + if(pAccessibleShape->ResetState (AccessibleStateType::SELECTED)) + { + if(bDrawShape) + { + vecSelect.push_back(std::make_pair(pAccessibleShape,sal_False)); + ++nRemoveSelect; + } + } + } +//-----IAccessibility2 Implementation 2009 // Does the shape have the current selection? if (pAccessibleShape->GetState (AccessibleStateType::FOCUSED)) pCurrentlyFocusedShape = pAccessibleShape; } } - +//IAccessibility2 Implementation 2009----- + /* // Check if the frame we are in is currently active. If not then make // sure to not send a FOCUSED state change. if (xController.is()) @@ -958,15 +1053,73 @@ void ChildrenManagerImpl::UpdateSelection (void) if ( ! xFrame->isActive()) pNewFocusedShape = NULL; } - + */ + Window *pParentWidow = maShapeTreeInfo.GetWindow(); + bool bShapeActive= false; + // For table cell, the table's parent must be checked to make sure it has focus. + Window *pPWindow = pParentWidow->GetParent(); + if (pParentWidow && ( pParentWidow->HasFocus() || (pPWindow && pPWindow->HasFocus()))) + { + bShapeActive =true; + } +//-----IAccessibility2 Implementation 2009 // Move focus from current to newly focused shape. if (pCurrentlyFocusedShape != pNewFocusedShape) { if (pCurrentlyFocusedShape != NULL) pCurrentlyFocusedShape->ResetState (AccessibleStateType::FOCUSED); - if (pNewFocusedShape != NULL) + //IAccessibility2 Implementation 2009----- + //if (pNewFocusedShape != NULL) + //-----IAccessibility2 Implementation 2009 + if (pNewFocusedShape != NULL && bShapeActive) pNewFocusedShape->SetState (AccessibleStateType::FOCUSED); } +//IAccessibility2 Implementation 2009----- + + if (nAddSelect >= 10 )//fire selection within + { + mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_WITHIN,uno::Any(),uno::Any()); + nAddSelect =0 ;//not fire selection event + } + //VEC_SHAPE::iterator vi = vecSelect.begin(); + //for (; vi != vecSelect.end() ;++vi) + VEC_SHAPE::reverse_iterator vi = vecSelect.rbegin(); + for (; vi != vecSelect.rend() ;++vi) + + { + PAIR_SHAPE &pairShape= *vi; + Reference< XAccessible > xShape(pairShape.first); + uno::Any anyShape; + anyShape <<= xShape; + + if (pairShape.second)//Selection add + { + if (bHasSelectedShape) + { + if ( nAddSelect > 0 ) + { + mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD,anyShape,uno::Any()); + } + } + else + { + //if has not selected shape ,first selected shape is fire selection event; + if (nAddSelect > 0 ) + { + mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED,anyShape,uno::Any()); + } + if (nAddSelect > 1 )//check other selected shape fire selection add event + { + bHasSelectedShape=sal_True; + } + } + } + else //selection remove + { + mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE,anyShape,uno::Any()); + } + } +//-----IAccessibility2 Implementation 2009 // Remember whether there is a shape that now has the focus. mpFocusedShape = pNewFocusedShape; diff --git a/svx/source/accessibility/ChildrenManagerImpl.hxx b/svx/source/accessibility/ChildrenManagerImpl.hxx index 0d7a08cd213b..20f5a70bbe00 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.hxx +++ b/svx/source/accessibility/ChildrenManagerImpl.hxx @@ -126,6 +126,11 @@ public: */ long GetChildCount (void) const throw (); +//IAccessibility2 Implementation 2009----- + ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape> GetChildShape(long nIndex) + throw (::com::sun::star::uno::RuntimeException); +//-----IAccessibility2 Implementation 2009 /** Return the requested accessible child or throw and IndexOutOfBoundsException if the given index is invalid. @param nIndex @@ -298,8 +303,17 @@ public: const long _nIndex, const AccessibleShapeTreeInfo& _rShapeTreeInfo ) throw (::com::sun::star::uno::RuntimeException); - - + //IAccessibility2 Implementation 2009----- + // Add the impl method for IAccessibleParent interface + virtual AccessibleControlShape* GetAccControlShapeFromModel + (::com::sun::star::beans::XPropertySet* pSet) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible> + GetAccessibleCaption (const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape>& xShape) + throw (::com::sun::star::uno::RuntimeException); + //-----IAccessibility2 Implementation 2009 protected: /** This list holds the descriptors of all currently visible shapes and associated accessible object. diff --git a/svx/source/accessibility/ShapeTypeHandler.cxx b/svx/source/accessibility/ShapeTypeHandler.cxx index e5ade1648f7c..cab1fee1774a 100644 --- a/svx/source/accessibility/ShapeTypeHandler.cxx +++ b/svx/source/accessibility/ShapeTypeHandler.cxx @@ -31,8 +31,14 @@ #include <vos/mutex.hxx> #include <vcl/svapp.hxx> #include <svx/dialmgr.hxx> -#include "svx/svdstr.hrc" +//IAccessibility2 Implementation 2009----- +#include <svx/unoshape.hxx> +#include <svx/svdoashp.hxx> +#include "svx/unoapi.hxx" +//-----IAccessibility2 Implementation 2009 + +#include "svx/svdstr.hrc" using namespace ::rtl; using namespace ::com::sun::star; @@ -309,6 +315,37 @@ long ShapeTypeHandler::GetSlotId (const uno::Reference<drawing::XShape>& rxShape case DRAWING_RECTANGLE: nResourceId = STR_ObjNameSingulRECT; break; + //IAccessibility2 Implementation 2009----- + case DRAWING_CUSTOM: + { + nResourceId = STR_ObjNameSingulCUSTOMSHAPE; + + SvxShape* pShape = SvxShape::getImplementation( rxShape ); + if (pShape) + { + SdrObject *pSdrObj = pShape->GetSdrObject(); + if (pSdrObj) + { + String aTmp; + pSdrObj->TakeObjNameSingul( aTmp ); + + if(pSdrObj->ISA(SdrObjCustomShape)) + { + SdrObjCustomShape* pCustomShape = (SdrObjCustomShape*)pSdrObj; + if(pCustomShape) + if (pCustomShape->IsTextPath()) + nResourceId = STR_ObjNameSingulFONTWORK; + else + { + nResourceId = -1; + sName = pCustomShape->GetCustomShapeName(); + } + } + } + } + break; + } + //-----IAccessibility2 Implementation 2009 case DRAWING_TEXT: nResourceId = STR_ObjNameSingulTEXT; break; diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx index df148894c21e..96d23b5017b2 100644 --- a/svx/source/accessibility/charmapacc.cxx +++ b/svx/source/accessibility/charmapacc.cxx @@ -166,7 +166,8 @@ Reference< XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleParent( // ----------------------------------------------------------------------------- ::com::sun::star::awt::Rectangle SAL_CALL SvxShowCharSetVirtualAcc::implGetBounds( ) throw (RuntimeException) { - const Point aOutPos( mpParent->GetPosPixel() ); +//IAccessibility2 Implementation 2009----- +/* const Point aOutPos( mpParent->GetPosPixel() ); Size aOutSize( mpParent->GetOutputSizePixel() ); if ( mpParent->getScrollBar()->IsVisible() ) { @@ -183,6 +184,24 @@ Reference< XAccessible > SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleParent( aRet.Height = aOutSize.Height(); return aRet; +*/ + ::com::sun::star::awt::Rectangle aBounds ( 0, 0, 0, 0 ); + Window* pWindow = mpParent; + if ( pWindow ) + { + Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL ); + aBounds = AWTRectangle( aRect ); + Window* pParent = pWindow->GetAccessibleParentWindow(); + if ( pParent ) + { + Rectangle aParentRect = pParent->GetWindowExtentsRelative( NULL ); + ::com::sun::star::awt::Point aParentScreenLoc = AWTPoint( aParentRect.TopLeft() ); + aBounds.X -= aParentScreenLoc.X; + aBounds.Y -= aParentScreenLoc.Y; + } + } + return aBounds; + //-----IAccessibility2 Implementation 2009 } // ----------------------------------------------------------------------------- sal_Int16 SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleRole( ) throw (RuntimeException) @@ -346,13 +365,15 @@ void SvxShowCharSetAcc::implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bS // ----------------------------------------------------------------------------- ::com::sun::star::awt::Rectangle SAL_CALL SvxShowCharSetAcc::implGetBounds( ) throw (RuntimeException) { - const Point aOutPos( m_pParent->getCharSetControl()->GetPosPixel() ); +//IAccessibility2 Implementation 2009----- + const Point aOutPos;//( m_pParent->getCharSetControl()->GetPosPixel() ); Size aOutSize( m_pParent->getCharSetControl()->GetOutputSizePixel()); if ( m_pParent->getCharSetControl()->getScrollBar()->IsVisible() ) { const Size aScrollBar = m_pParent->getCharSetControl()->getScrollBar()->GetOutputSizePixel(); aOutSize.Width() -= aScrollBar.Width(); - aOutSize.Height() -= aScrollBar.Height(); + //aOutSize.Height() -= aScrollBar.Height(); + //-----IAccessibility2 Implementation 2009 } awt::Rectangle aRet; @@ -694,7 +715,10 @@ uno::Reference< accessibility::XAccessible > SAL_CALL SvxShowCharSetItemAcc::get sal_Int16 SAL_CALL SvxShowCharSetItemAcc::getAccessibleRole() throw (uno::RuntimeException) { - return accessibility::AccessibleRole::LABEL; + //return accessibility::AccessibleRole::LABEL; +//IAccessibility2 Implementation 2009----- + return accessibility::AccessibleRole::TABLE_CELL; +//-----IAccessibility2 Implementation 2009 } // ----------------------------------------------------------------------------- @@ -709,14 +733,30 @@ sal_Int16 SAL_CALL SvxShowCharSetItemAcc::getAccessibleRole() sal_Unicode c = mpParent->maText.GetChar(0); char buf[16] = "0x0000"; sal_Unicode c_Shifted = c; +//IAccessibility2 Implementation 2009----- +/* for( int i = 0; i < 4; ++i ) { char h = (char)(c_Shifted & 0x0F); buf[5-i] = (h > 9) ? (h - 10 + 'A') : (h + '0'); c_Shifted >>= 4; } +*/ + int tmp_len = 4; + if(c_Shifted>0xFFFF) tmp_len = 8; + for( int i = 0; i < tmp_len; ++i ) + { + char h = c_Shifted & 0x0F; + //buf[9-i] = (h > 9) ? (h - 10 + 'A') : (h + '0'); + buf[tmp_len+1-i] = (h > 9) ? (h - 10 + 'A') : (h + '0'); + c_Shifted >>= 4; + } +//-----IAccessibility2 Implementation 2009 if( c < 256 ) snprintf( buf+6, 10, " (%d)", c ); + //IAccessibility2 Implementation 2009----- + sDescription.AppendAscii(" "); + //-----IAccessibility2 Implementation 2009 sDescription.AppendAscii(buf); return sDescription; @@ -762,9 +802,15 @@ uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL SvxShowCharSetItem if( mpParent ) { - // SELECTABLE - pStateSet->AddState( accessibility::AccessibleStateType::SELECTABLE ); - pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE ); + //IAccessibility2 Implementation 2009----- + if(mpParent->mrParent.IsEnabled()) + { + pStateSet->AddState( accessibility::AccessibleStateType::ENABLED ); + // SELECTABLE + pStateSet->AddState( accessibility::AccessibleStateType::SELECTABLE ); + pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE ); + } + //-----IAccessibility2 Implementation 2009 // SELECTED if( mpParent->mrParent.GetSelectIndexId() == mpParent->mnId ) @@ -773,7 +819,12 @@ uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL SvxShowCharSetItem pStateSet->AddState( accessibility::AccessibleStateType::FOCUSED ); } if ( mpParent->mnId >= mpParent->mrParent.FirstInView() && mpParent->mnId <= mpParent->mrParent.LastInView() ) + //IAccessibility2 Implementation 2009----- + { pStateSet->AddState( AccessibleStateType::VISIBLE ); + pStateSet->AddState( AccessibleStateType::SHOWING ); + } + //-----IAccessibility2 Implementation 2009 pStateSet->AddState( AccessibleStateType::TRANSIENT ); } diff --git a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx new file mode 100644 index 000000000000..f80c488f5ffb --- /dev/null +++ b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx @@ -0,0 +1,1281 @@ +/************************************************************** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + *************************************************************/ + + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_svx.hxx" + +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_ +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#endif +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_ +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#endif +#ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX_ +#include <unotools/accessiblestatesethelper.hxx> +#endif +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_ +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_ +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#endif + +#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_ +#include <com/sun/star/awt/XWindow.hpp> +#endif + +#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_ +#include <cppuhelper/typeprovider.hxx> +#endif + +#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ +#include <toolkit/helper/vclunohelper.hxx> +#endif +#ifndef _TOOLKIT_HELPER_CONVERT_HXX_ +#include <toolkit/helper/convert.hxx> +#endif + +#ifndef _SV_SVAPP_HXX +#include <vcl/svapp.hxx> +#endif + +#ifndef _OSL_MUTEX_HXX_ +#include <osl/mutex.hxx> +#endif +#ifndef _RTL_UUID_H_ +#include <rtl/uuid.h> +#endif +#ifndef _TOOLS_DEBUG_HXX +#include <tools/debug.hxx> +#endif +#ifndef _SV_GEN_HXX +#include <tools/gen.hxx> +#endif + +#include <svx/dialogs.hrc> +#include "accessibility.hrc" +#include <svx/dlgctrl.hxx> + +#ifndef _SVX_DIALMGR_HXX +#include <svx/dialmgr.hxx> +#endif +#ifndef COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER +#include <comphelper/accessibleeventnotifier.hxx> +#endif + +#include <unotools/accessiblerelationsethelper.hxx> + +#ifndef _SVXPIXELACCESSIBLECONTEXT_HXX +#include "svxpixelctlaccessiblecontext.hxx" +#endif +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_ +#include <com/sun/star/accessibility/AccessibleRelationType.hpp> +#endif +using namespace ::cppu; +using namespace ::osl; +using namespace ::rtl; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::accessibility; + +SvxPixelCtlAccessible::SvxPixelCtlAccessible( SvxPixelCtl& rControl) : + SvxPixelCtlAccessible_BASE(m_aMutex), + pPixelCtl(&rControl), + mnClientId(0) +{ + //FreeResource(); +} + +SvxPixelCtlAccessible::~SvxPixelCtlAccessible() +{ +// DBG_DTOR( SvxPixelCtlAccessible, NULL ); + + if( IsAlive() ) + { + osl_incrementInterlockedCount( &m_refCount ); + dispose(); // set mpRepr = NULL & release all childs + } +} +/*-- 04.02.2002 14:11:55--------------------------------------------------- + + -----------------------------------------------------------------------*/ +uno::Reference< XAccessibleContext > SvxPixelCtlAccessible::getAccessibleContext( ) + throw (uno::RuntimeException) +{ + return this; +} + +sal_Int32 SvxPixelCtlAccessible::getAccessibleChildCount( ) throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + if(pPixelCtl) + { + return pPixelCtl->GetSquares(); + } + else + return 0; +} +/*-- 04.02.2002 14:11:56--------------------------------------------------- + + -----------------------------------------------------------------------*/ +uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleChild( sal_Int32 i ) + throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + if ( i < 0 || i >= getAccessibleChildCount()) + throw lang::IndexOutOfBoundsException(); + uno::Reference <XAccessible> xAcc; + if(pPixelCtl) + { + return CreateChild(i, pPixelCtl->IndexToPoint(i)); + } + else + return xAcc; + /* + throw lang::IndexOutOfBoundsException ( + ::rtl::OUString::createFromAscii ("no child with index " + i), + NULL); + */ +} + + + +uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleParent( ) + throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + uno::Reference< XAccessible > xRet; + if(pPixelCtl) + xRet = pPixelCtl->GetParent()->GetAccessible( sal_True ); + return xRet; +} + +sal_Int32 SvxPixelCtlAccessible::getAccessibleIndexInParent( ) + throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + sal_uInt16 nIdx = 0; + if(pPixelCtl) + { + Window* pTabPage = pPixelCtl->GetParent(); + sal_uInt16 nChildren = pTabPage->GetChildCount(); + for(nIdx = 0; nIdx < nChildren; nIdx++) + if(pTabPage->GetChild( nIdx ) == pPixelCtl) + break; + } + return nIdx; +} +/*-- 04.02.2002 14:11:57--------------------------------------------------- + + -----------------------------------------------------------------------*/ +sal_Int16 SvxPixelCtlAccessible::getAccessibleRole( ) throw (uno::RuntimeException) +{ + return AccessibleRole::LIST; +} + +::rtl::OUString SvxPixelCtlAccessible::getAccessibleDescription( ) + throw (uno::RuntimeException) +{ + + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + if(pPixelCtl) + return pPixelCtl->GetAccessibleDescription(); + else + return String(); + +} + +::rtl::OUString SvxPixelCtlAccessible::getAccessibleName( ) + throw (uno::RuntimeException) +{ + + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + if(pPixelCtl) + return pPixelCtl->GetAccessibleName(); + else + return String(); + +} + +uno::Reference< XAccessibleRelationSet > SvxPixelCtlAccessible::getAccessibleRelationSet( ) + throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + Window* pWindow = (Window*)pPixelCtl; + utl::AccessibleRelationSetHelper* rRelationSet = new utl::AccessibleRelationSetHelper; + uno::Reference< accessibility::XAccessibleRelationSet > rSet = rRelationSet; + if ( pWindow ) + { + Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy(); + if ( pLabeledBy && pLabeledBy != pWindow ) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); + aSequence[0] = pLabeledBy->GetAccessible(); + rRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) ); + } + + Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf(); + if ( pMemberOf && pMemberOf != pWindow ) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); + aSequence[0] = pMemberOf->GetAccessible(); + rRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) ); + } + return rSet; + } + + return new utl::AccessibleRelationSetHelper; +} + + +uno::Reference< XAccessibleStateSet > SvxPixelCtlAccessible::getAccessibleStateSet( ) + throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; + uno::Reference< XAccessibleStateSet > xRet = pStateSetHelper; + + if(!pPixelCtl) + pStateSetHelper->AddState(AccessibleStateType::DEFUNC); + else + { + const sal_Int16 aStandardStates[] = + { + AccessibleStateType::FOCUSABLE, + AccessibleStateType::SELECTABLE, + AccessibleStateType::SHOWING, + AccessibleStateType::VISIBLE, + AccessibleStateType::OPAQUE, + 0}; + + sal_Int16 nState = 0; + while(aStandardStates[nState]) + { + pStateSetHelper->AddState(aStandardStates[nState++]); + } + if(pPixelCtl->IsEnabled()) + pStateSetHelper->AddState(AccessibleStateType::ENABLED); + if(pPixelCtl->HasFocus()) + pStateSetHelper->AddState(AccessibleStateType::FOCUSED); + pStateSetHelper->AddState(AccessibleStateType::MANAGES_DESCENDANTS); + } + return xRet; +} + + +com::sun::star::lang::Locale SvxPixelCtlAccessible::getLocale( ) + throw (IllegalAccessibleComponentStateException, uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if( getAccessibleParent().is() ) + { + uno::Reference< XAccessibleContext > xParentContext( getAccessibleParent()->getAccessibleContext() ); + if( xParentContext.is() ) + return xParentContext->getLocale(); + } + + // No locale and no parent. Therefore throw exception to indicate this + // cluelessness. + throw IllegalAccessibleComponentStateException(); +} + + +sal_Bool SvxPixelCtlAccessible::containsPoint( const awt::Point& aPt ) + throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + Point aPoint(aPt.X, aPt.Y); + if(pPixelCtl) + return (aPoint.X() >= 0) + && (aPoint.X() < pPixelCtl->GetSizePixel().getWidth()) + && (aPoint.Y() >= 0) + && (aPoint.Y() < pPixelCtl->GetSizePixel().getHeight()); + else + return sal_False; +} +uno::Reference<XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleAtPoint ( + const awt::Point& aPoint) + throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ensureIsAlive(); + uno::Reference <XAccessible> xAcc; + + Point childPoint; + childPoint.X() = aPoint.X; + childPoint.Y() = aPoint.Y; + + if(pPixelCtl) + { + Point pt= pPixelCtl->PixelToLogic(childPoint); + long nIndex = pPixelCtl->PointToIndex(pt); + return CreateChild(nIndex,pPixelCtl->IndexToPoint(nIndex)); + } + else + return xAcc; + +} + +awt::Rectangle SvxPixelCtlAccessible::getBounds( ) throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + Size aSz; + Point aPos(0,0); + awt::Rectangle aRet; + if(pPixelCtl) + { + aSz = pPixelCtl->GetSizePixel(); + aPos = pPixelCtl->GetPosPixel(); + aRet.X = aPos.X(); + aRet.Y = aPos.Y(); + aRet.Width = aSz.Width(); + aRet.Height = aSz.Height(); + } + return aRet; +} + +awt::Point SvxPixelCtlAccessible::getLocation( ) throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + Point aPos; + aPos = pPixelCtl->GetPosPixel(); + awt::Point aRet(aPos.X(), aPos.Y()); + return aRet; +} + +awt::Point SvxPixelCtlAccessible::getLocationOnScreen( ) throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + Rectangle rect; + rect = pPixelCtl->GetWindowExtentsRelative(NULL); + awt::Point aRet(rect.Left(),rect.Top() ); + return aRet; +} + +awt::Size SvxPixelCtlAccessible::getSize( ) throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + Size aSz; + aSz = pPixelCtl->GetSizePixel(); + awt::Size aRet(aSz.Width(),aSz.Height()); + return aRet; +} +void SvxPixelCtlAccessible::grabFocus( ) throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + if(pPixelCtl) + pPixelCtl->GrabFocus(); +} + +sal_Int32 SvxPixelCtlAccessible::getForeground( ) + throw (::com::sun::star::uno::RuntimeException) +{ + uno::Any aRet; + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + return pPixelCtl->GetControlForeground().GetColor(); +} + +sal_Int32 SvxPixelCtlAccessible::getBackground( ) + throw (::com::sun::star::uno::RuntimeException) +{ + uno::Any aRet; + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + return pPixelCtl->GetControlBackground().GetColor(); +} + +::rtl::OUString SvxPixelCtlAccessible::getImplementationName( ) throw (uno::RuntimeException) +{ + return rtl::OUString::createFromAscii("SvxPixelCtlAccessible"); +} +/*-- 04.02.2002 14:12:05--------------------------------------------------- + + -----------------------------------------------------------------------*/ +const sal_Char sAccessible[] = "Accessible"; +const sal_Char sAccessibleContext[] = "AccessibleContext"; +const sal_Char sAccessibleComponent[] = "AccessibleComponent"; +//const sal_Char sAccessibleTable[] = "AccessibleTable"; + +sal_Bool SvxPixelCtlAccessible::supportsService( const ::rtl::OUString& rServiceName ) + throw (uno::RuntimeException) +{ + return rServiceName.equalsAsciiL( sAccessible , sizeof(sAccessible )-1 ) || + rServiceName.equalsAsciiL( sAccessibleContext , sizeof(sAccessibleContext )-1 ) || + rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 );// || +// rServiceName.equalsAsciiL( sAccessibleTable, sizeof(sAccessibleTable)-1 ); +} +/*-- 04.02.2002 14:12:05--------------------------------------------------- + + -----------------------------------------------------------------------*/ +uno::Sequence< ::rtl::OUString > SvxPixelCtlAccessible::getSupportedServiceNames( ) + throw (uno::RuntimeException) +{ + uno::Sequence< OUString > aRet(2); + OUString* pArray = aRet.getArray(); + pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessible ) ); + pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleContext ) ); + pArray[2] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleComponent) ); +// pArray[3] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleTable) ); + return aRet; +} + +// ----------------------------------------------------------------------------- +// XAccessibleSelection +// ----------------------------------------------------------------------------- +void SAL_CALL SvxPixelCtlAccessible::selectAccessibleChild( sal_Int32 nChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + IsValid(); + + if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) + throw lang::IndexOutOfBoundsException(); + + long nIndex = pPixelCtl->ShowPosition(pPixelCtl->IndexToPoint(nChildIndex)); + NotifyChild(nIndex,sal_True,sal_False); +} +// ----------------------------------------------------------------------------- +sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + IsValid(); + + return pPixelCtl->GetFoucsPosIndex() == nChildIndex; +} +// ----------------------------------------------------------------------------- +void SAL_CALL SvxPixelCtlAccessible::clearAccessibleSelection( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + IsValid(); + +} +// ----------------------------------------------------------------------------- +void SAL_CALL SvxPixelCtlAccessible::selectAllAccessibleChildren( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + IsValid(); + +} +// ----------------------------------------------------------------------------- +sal_Int32 SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleChildCount( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + IsValid(); + + return 1; +} +// ----------------------------------------------------------------------------- +uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + IsValid(); + + if ( nSelectedChildIndex >= 1) + throw lang::IndexOutOfBoundsException(); + + uno::Reference< XAccessible > xChild; + if(pPixelCtl) + { + if(m_xCurChild.is()) + { + xChild = m_xCurChild; + } + } + return xChild; +} +// ----------------------------------------------------------------------------- +void SAL_CALL SvxPixelCtlAccessible::deselectAccessibleChild( sal_Int32 ) throw (lang::IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + IsValid(); + + +} + +// Added by lq +void SvxPixelCtlAccessible::ensureIsAlive() const + throw ( lang::DisposedException ) +{ + if( !IsAlive() ) + throw lang::DisposedException(); +} + +void SvxPixelCtlAccessible::ensureIsValidRow( sal_Int32 nRow ) + throw ( lang::IndexOutOfBoundsException ) +{ + if( nRow >= pPixelCtl->GetHeight() || nRow <0) + throw lang::IndexOutOfBoundsException( + OUString( RTL_CONSTASCII_USTRINGPARAM( "row index is invalid" ) ), *this ); +} + +void SvxPixelCtlAccessible::ensureIsValidColumn( sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException ) +{ + if( nColumn >= pPixelCtl->GetWidth() || nColumn <0 ) + throw lang::IndexOutOfBoundsException( + OUString( RTL_CONSTASCII_USTRINGPARAM("column index is invalid") ), *this ); +} + +void SvxPixelCtlAccessible::ensureIsValidAddress( + sal_Int32 nRow, sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException ) +{ + ensureIsValidRow( nRow ); + ensureIsValidColumn( nColumn ); +} + +void SvxPixelCtlAccessible::ensureIsValidIndex( sal_Int32 nChildIndex ) + throw ( lang::IndexOutOfBoundsException ) +{ + if( nChildIndex >= pPixelCtl->GetSquares()) + throw lang::IndexOutOfBoundsException( + OUString( RTL_CONSTASCII_USTRINGPARAM("child index is invalid") ), *this ); +} + +// XAccessibleTable ----------------------------------------------------------- +/* +sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleRowCount() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ensureIsAlive(); + return pPixelCtl->GetLineCount(); +} + +sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnCount() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ensureIsAlive(); + return pPixelCtl->GetLineCount(); +} + +sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleRowExtentAt( + sal_Int32 nRow, sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ensureIsAlive(); + return 1; // merged cells not supported +} + +sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnExtentAt( + sal_Int32 nRow, sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ensureIsAlive(); + return 1; // merged cells not supported +} + +uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleCaption() + throw ( uno::RuntimeException ) +{ + uno::Reference< XAccessible > xAccessble; + ensureIsAlive(); + return xAccessble; // not supported +} + +uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleSummary() + throw ( uno::RuntimeException ) +{ + uno::Reference< XAccessible > xAccessble; + ensureIsAlive(); + return xAccessble; // not supported +} + +sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleIndex( + sal_Int32 nRow, sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ensureIsAlive(); + ensureIsValidAddress(nRow,nColumn); + return nRow + nColumn * pPixelCtl->GetLineCount() ; +} + +sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleRow( sal_Int32 nChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ensureIsAlive(); + ensureIsValidIndex( nChildIndex ); + return nChildIndex/pPixelCtl->GetLineCount(); +} + +sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleColumn( sal_Int32 nChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ensureIsAlive(); + ensureIsValidIndex( nChildIndex ); + return nChildIndex%pPixelCtl->GetLineCount(); +} + +::rtl::OUString SAL_CALL SvxPixelCtlAccessible::getAccessibleRowDescription( sal_Int32 nRow ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ensureIsAlive(); + ensureIsValidRow( nRow ); + return ::rtl::OUString::createFromAscii (""); +} + +::rtl::OUString SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnDescription( sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ensureIsAlive(); + ensureIsValidColumn( nColumn ); + return ::rtl::OUString::createFromAscii (""); +} + +uno::Reference< XAccessibleTable > SAL_CALL SvxPixelCtlAccessible::getAccessibleRowHeaders() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + uno::Reference< XAccessibleTable > xAccessble; + ensureIsAlive(); + return xAccessble; +} + +uno::Reference< XAccessibleTable > SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnHeaders() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + uno::Reference< XAccessibleTable > xAccessble; + ensureIsAlive(); + return xAccessble; +} + +Sequence< sal_Int32 > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleRows() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + Sequence< sal_Int32 > accRows; + ensureIsAlive(); + + return accRows; +} + +Sequence< sal_Int32 > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleColumns() + throw ( uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + Sequence< sal_Int32 > accColumns; + ensureIsAlive(); + + return accColumns; +} + +sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleRowSelected( sal_Int32 nRow ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ensureIsAlive(); + ensureIsValidRow( nRow ); + return sal_False; +} + +sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleColumnSelected( sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ensureIsAlive(); + ensureIsValidColumn( nColumn ); + return sal_False; +} + +uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleCellAt( + sal_Int32 nRow, sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ensureIsAlive(); + ensureIsValidAddress( nRow, nColumn ); + return getAccessibleChild(nRow*pPixelCtl->GetLineCount()+nColumn); +} + +sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleSelected( + sal_Int32 nRow, sal_Int32 nColumn ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + ensureIsAlive(); + ensureIsValidAddress( nRow, nColumn ); + return isAccessibleChildSelected(nRow*pPixelCtl->GetLineCount()+nColumn); +} +// Added by lq end +*/ + +//XAccessibleEventBroadcaster +void SAL_CALL SvxPixelCtlAccessible::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw( RuntimeException ) +{ + if (xListener.is()) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (!mnClientId) + mnClientId = comphelper::AccessibleEventNotifier::registerClient( ); + comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener ); + } +} + +void SAL_CALL SvxPixelCtlAccessible::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) + throw( RuntimeException ) +{ + if (xListener.is()) + { + ::osl::MutexGuard aGuard( m_aMutex ); + + sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ); + if ( !nListenerCount ) + { + comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); + mnClientId = 0; + } + } +} +void SvxPixelCtlAccessible::CommitChange( const AccessibleEventObject& rEvent ) +{ + if (mnClientId) + comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent ); +} + +//Solution:Add the event handling method +void SvxPixelCtlAccessible::FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew) +{ + const uno::Reference< XInterface > xSource( *this ); + CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) ); +} + +void SAL_CALL SvxPixelCtlAccessible::disposing() +{ + if( !rBHelper.bDisposed ) + { + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( mnClientId ) + { + comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); + mnClientId = 0; + } + } + //mxParent = uno::Reference< XAccessible >(); + + } +} +void SvxPixelCtlAccessible::Invalidate() +{ + pPixelCtl = 0; +} +void SvxPixelCtlAccessible::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException ) +{ + if( IsNotAlive() ) + throw lang::DisposedException(); +} +void SvxPixelCtlAccessible::IsValid() throw (uno::RuntimeException) +{ + if(!pPixelCtl) + throw uno::RuntimeException(); +} + + +void SvxPixelCtlAccessible::NotifyChild(long nIndex,sal_Bool bSelect ,sal_Bool bCheck) +{ + DBG_ASSERT( !(!bSelect && !bCheck),"" );//non is false + + SvxPixelCtlAccessibleChild *pChild= NULL; + + if (m_xCurChild.is()) + { + pChild= static_cast<SvxPixelCtlAccessibleChild*>(m_xCurChild.get()); + DBG_ASSERT(pChild,"Child Must be Valid"); + if (pChild->getAccessibleIndexInParent() == nIndex ) + { + if (bSelect) + { + pChild->SelectChild(sal_True); + } + if (bCheck) + { + pChild->ChangePixelColorOrBG(sal_Bool(pPixelCtl->GetBitmapPixel(sal_uInt16(nIndex)))); + pChild->CheckChild(); + } + return ; + } + } + uno::Reference <XAccessible> xNewChild =CreateChild(nIndex, pPixelCtl->IndexToPoint(nIndex)); + SvxPixelCtlAccessibleChild *pNewChild= static_cast<SvxPixelCtlAccessibleChild*>(xNewChild.get()); + DBG_ASSERT(pNewChild,"Child Must be Valid"); + + Any aNewValue,aOldValue; + aNewValue<<= xNewChild; + FireAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, + aOldValue, + aNewValue ); + + if (bSelect) + { + if (pChild) + { + pChild->SelectChild(sal_False); + } + pNewChild->SelectChild(sal_True); + } + if (bCheck) + { + pNewChild->CheckChild(); + } + m_xCurChild= xNewChild; + + +} + +uno::Reference<XAccessible> SvxPixelCtlAccessible::CreateChild (long nIndex,Point mPoint) +{ + long nX = mPoint.X(); + long nY = mPoint.Y(); + if( Application::GetSettings().GetLayoutRTL()) + { + nX = (sal_uInt16) pPixelCtl->GetWidth() - 1 - nX; + } + + sal_Bool bPixelColorOrBG= sal_Bool(pPixelCtl->GetBitmapPixel(sal_uInt16(nIndex))); + Size size(pPixelCtl->GetWidth() / pPixelCtl->GetLineCount(),pPixelCtl->GetHeight() / pPixelCtl->GetLineCount()); + uno::Reference<XAccessible> xChild; + xChild = new SvxPixelCtlAccessibleChild(pPixelCtl, + bPixelColorOrBG, + Point(nX,nY), + Rectangle(mPoint,size), + this, + nIndex); + + return xChild; +} + + +void SvxPixelCtlAccessible::LoseFocus() +{ + m_xCurChild = uno::Reference< XAccessible >() ; +} + +void SvxPixelCtlAccessibleChild::CheckChild() +{ + Any aChecked; + aChecked <<= AccessibleStateType::CHECKED; + + if (m_bPixelColorOrBG)//Current Child State + { + FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, + Any(), + aChecked); + } + else + { + FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, + aChecked, + Any() ); + } +} + +void SvxPixelCtlAccessibleChild::SelectChild( sal_Bool bSelect) +{ + Any aSelected; + aSelected <<= AccessibleStateType::SELECTED; + + if (bSelect) + { + FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, + Any(), + aSelected); + } + else + { + FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, + aSelected, + Any()); + } +} +void SvxPixelCtlAccessibleChild::FireAccessibleEvent ( + short nEventId, + const ::com::sun::star::uno::Any& rOld, + const ::com::sun::star::uno::Any& rNew) +{ + const uno::Reference< XInterface > xSource( *this ); + CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) ); +} + + + +DBG_NAME( SvxPixelCtlAccessibleChild ) + + +SvxPixelCtlAccessibleChild::SvxPixelCtlAccessibleChild( + SvxPixelCtl* rWindow, + sal_Bool bPixelColorOrBG, + const Point &aPoint, + const Rectangle& rBoundingBox, + const uno::Reference<XAccessible>& rxParent, + long nIndexInParent ) : + SvxPixelCtlAccessibleChild_BASE( m_aMutex ), + mrParentWindow( rWindow ), + mxParent(rxParent), + m_bPixelColorOrBG(bPixelColorOrBG), + maPoint(aPoint), + mpBoundingBox( new Rectangle( rBoundingBox ) ), + mnIndexInParent( nIndexInParent ), + mnClientId( 0 ) +{ + DBG_CTOR( SvxPixelCtlAccessibleChild, NULL ); +} + + +SvxPixelCtlAccessibleChild::~SvxPixelCtlAccessibleChild() +{ + DBG_DTOR( SvxPixelCtlAccessibleChild, NULL ); + + if( IsAlive() ) + { + osl_incrementInterlockedCount( &m_refCount ); + dispose(); // set mpRepr = NULL & release all childs + } +} + +//===== XAccessible ========================================================= + +uno::Reference< XAccessibleContext> SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleContext( void ) throw( RuntimeException ) +{ + return this; +} + +//===== XAccessibleComponent ================================================ + +sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::containsPoint( const awt::Point& rPoint ) throw( RuntimeException ) +{ + // no guard -> done in getBounds() +// return GetBoundingBox().IsInside( VCLPoint( rPoint ) ); + return Rectangle( Point( 0, 0 ), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) ); +} + +uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleAtPoint( const awt::Point& ) throw( RuntimeException ) +{ + return uno::Reference< XAccessible >(); +} + +awt::Rectangle SAL_CALL SvxPixelCtlAccessibleChild::getBounds() throw( RuntimeException ) +{ + // no guard -> done in getBoundingBox() + //Modified by lq, 09/26 + //return AWTRectangle( GetBoundingBox() ); + awt::Rectangle rect = AWTRectangle( GetBoundingBox() ); + rect.X = rect.X + mrParentWindow->GetClientWindowExtentsRelative(NULL).Left()-mrParentWindow->GetWindowExtentsRelative(NULL).Left(); + rect.Y = rect.Y + mrParentWindow->GetClientWindowExtentsRelative(NULL).Top()-mrParentWindow->GetWindowExtentsRelative(NULL).Top(); + return rect; + // End +} + +awt::Point SAL_CALL SvxPixelCtlAccessibleChild::getLocation() throw( RuntimeException ) +{ + // no guard -> done in getBoundingBox() + return AWTPoint( GetBoundingBox().TopLeft() ); +} + +awt::Point SAL_CALL SvxPixelCtlAccessibleChild::getLocationOnScreen() throw( RuntimeException ) +{ + // no guard -> done in getBoundingBoxOnScreen() + return AWTPoint( GetBoundingBoxOnScreen().TopLeft() ); +} + +awt::Size SAL_CALL SvxPixelCtlAccessibleChild::getSize() throw( RuntimeException ) +{ + // no guard -> done in getBoundingBox() + return AWTSize( GetBoundingBox().GetSize() ); +} + +void SAL_CALL SvxPixelCtlAccessibleChild::grabFocus() throw( RuntimeException ) +{ +} + +sal_Int32 SvxPixelCtlAccessibleChild::getForeground( ) + throw (::com::sun::star::uno::RuntimeException) +{ + //::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + ThrowExceptionIfNotAlive(); + return mrParentWindow->GetControlForeground().GetColor(); +} +sal_Int32 SvxPixelCtlAccessibleChild::getBackground( ) + throw (::com::sun::star::uno::RuntimeException) +{ + //::vos::OGuard aSolarGuard( Application::GetSolarMutex() ); + ::osl::MutexGuard aGuard( m_aMutex ); + + ThrowExceptionIfNotAlive(); + return mrParentWindow->GetControlBackground().GetColor(); +} + +//===== XAccessibleContext ================================================== + +sal_Int32 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleChildCount( void ) throw( RuntimeException ) +{ + return 0; +} + +uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleChild( sal_Int32 ) throw ( RuntimeException ) +{ + throw lang::IndexOutOfBoundsException(); +} + +uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleParent( void ) throw( RuntimeException ) +{ + return mxParent; +} + +sal_Int32 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleIndexInParent( void ) throw( RuntimeException ) +{ + return mnIndexInParent; +} + +sal_Int16 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleRole( void ) throw( RuntimeException ) +{ + return AccessibleRole::CHECK_BOX; +} + +OUString SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleDescription( void ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + return GetName(); +} + +OUString SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleName( void ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + return GetName(); +} + +/** Return empty uno::Reference to indicate that the relation set is not + supported. +*/ +uno::Reference<XAccessibleRelationSet> SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleRelationSet( void ) throw( RuntimeException ) +{ + return uno::Reference< XAccessibleRelationSet >(); +} + +uno::Reference< XAccessibleStateSet > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleStateSet( void ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; + + if( IsAlive() ) + { + + pStateSetHelper->AddState( AccessibleStateType::TRANSIENT ); + pStateSetHelper->AddState( AccessibleStateType::ENABLED ); + pStateSetHelper->AddState( AccessibleStateType::OPAQUE ); + pStateSetHelper->AddState( AccessibleStateType::SELECTABLE ); + pStateSetHelper->AddState( AccessibleStateType::SHOWING ); + pStateSetHelper->AddState( AccessibleStateType::VISIBLE ); + + if (mrParentWindow ) + { + long nIndex = mrParentWindow->GetFoucsPosIndex(); + if ( nIndex == mnIndexInParent) + { + pStateSetHelper->AddState( AccessibleStateType::SELECTED ); + } + //IAccessibility2 Implementation 2009----- + if (mrParentWindow->GetBitmapPixel(sal_uInt16(mnIndexInParent))) + //-----IAccessibility2 Implementation 2009 + { + pStateSetHelper->AddState( AccessibleStateType::CHECKED ); + } + } + } + else + pStateSetHelper->AddState( AccessibleStateType::DEFUNC ); + + return pStateSetHelper; +} + +lang::Locale SAL_CALL SvxPixelCtlAccessibleChild::getLocale( void ) throw( IllegalAccessibleComponentStateException, RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + if( mxParent.is() ) + { + uno::Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() ); + if( xParentContext.is() ) + return xParentContext->getLocale(); + } + + // No locale and no parent. Therefore throw exception to indicate this + // cluelessness. + throw IllegalAccessibleComponentStateException(); +} + +void SAL_CALL SvxPixelCtlAccessibleChild::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) + throw( RuntimeException ) +{ + if (xListener.is()) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if (!mnClientId) + mnClientId = comphelper::AccessibleEventNotifier::registerClient( ); + comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener ); + } +} + + + + +void SAL_CALL SvxPixelCtlAccessibleChild::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) + throw( RuntimeException ) +{ + if (xListener.is()) + { + ::osl::MutexGuard aGuard( m_aMutex ); + + sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ); + if ( !nListenerCount ) + { + // no listeners anymore + // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), + // and at least to us not firing any events anymore, in case somebody calls + // NotifyAccessibleEvent, again + comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); + mnClientId = 0; + } + } +} + + +//===== XServiceInfo ======================================================== + +OUString SAL_CALL SvxPixelCtlAccessibleChild::getImplementationName( void ) throw( RuntimeException ) +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxPixelCtlAccessibleChild" ) ); +} + +sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::supportsService( const OUString& rServiceName ) throw( RuntimeException ) +{ + return rServiceName.equalsAsciiL( sAccessible , sizeof(sAccessible )-1 ) || + rServiceName.equalsAsciiL( sAccessibleContext , sizeof(sAccessibleContext )-1 ) || + rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 ); + +} + +Sequence< OUString > SAL_CALL SvxPixelCtlAccessibleChild::getSupportedServiceNames( void ) throw( RuntimeException ) +{ + uno::Sequence< OUString > aRet(3); + OUString* pArray = aRet.getArray(); + pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessible ) ); + pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleContext ) ); + pArray[2] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleComponent) ); + return aRet; +} + +//===== internal ============================================================ + +void SvxPixelCtlAccessibleChild::CommitChange( const AccessibleEventObject& rEvent ) +{ + if (mnClientId) + comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent ); +} + +void SAL_CALL SvxPixelCtlAccessibleChild::disposing() +{ + if( !rBHelper.bDisposed ) + { + ::osl::MutexGuard aGuard( m_aMutex ); + + // Send a disposing to all listeners. + if ( mnClientId ) + { + comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); + mnClientId = 0; + } + + mxParent = uno::Reference< XAccessible >(); + + delete mpBoundingBox; + } +} + +void SvxPixelCtlAccessibleChild::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException ) +{ + if( IsNotAlive() ) + throw lang::DisposedException(); +} + +Rectangle SvxPixelCtlAccessibleChild::GetBoundingBoxOnScreen( void ) throw( RuntimeException ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + // no ThrowExceptionIfNotAlive() because its done in GetBoundingBox() + Rectangle aRect( GetBoundingBox() ); + + return Rectangle( mrParentWindow->OutputToAbsoluteScreenPixel( aRect.TopLeft() ), aRect.GetSize() ); +} + +Rectangle SvxPixelCtlAccessibleChild::GetBoundingBox( void ) throw( RuntimeException ) +{ + // no guard neccessary, because no one changes mpBoundingBox after creating it + ThrowExceptionIfNotAlive(); + + return *mpBoundingBox; +} + +::rtl::OUString SvxPixelCtlAccessibleChild::GetName() +{ + sal_Int32 nXIndex = mnIndexInParent % mrParentWindow->GetLineCount(); + sal_Int32 nYIndex = mnIndexInParent / mrParentWindow->GetLineCount(); + + OUString str; + str += OUString::createFromAscii("("); + str += OUString::valueOf(nXIndex); + str += OUString::createFromAscii(","); + str += OUString::valueOf(nYIndex); +// str += OUString::createFromAscii(","); +// str += OUString::valueOf(m_bPixelColorOrBG); + str += OUString::createFromAscii(")"); + return str; +} diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx index 587fcec8e30c..a1f1a3002866 100644 --- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx +++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx @@ -46,7 +46,14 @@ #include <svx/dlgctrl.hxx> #include <svx/dialmgr.hxx> #include <comphelper/accessibleeventnotifier.hxx> - +//IAccessibility2 Implementation 2009----- +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_ +#include <com/sun/star/accessibility/AccessibleRelationType.hpp> +#endif +#ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_ +#include <unotools/accessiblerelationsethelper.hxx> +#endif +//-----IAccessibility2 Implementation 2009 using namespace ::cppu; using namespace ::osl; @@ -54,6 +61,9 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::accessibility; +//IAccessibility2 Implementation 2009----- +using namespace ::com::sun::star::lang; +//-----IAccessibility2 Implementation 2009 #define MAX_NUM_OF_CHILDS 9 #define NOCHILDSELECTED -1 @@ -354,13 +364,19 @@ sal_Int32 SAL_CALL SvxRectCtlAccessibleContext::getAccessibleIndexInParent( void sal_Int16 SAL_CALL SvxRectCtlAccessibleContext::getAccessibleRole( void ) throw( RuntimeException ) { +//IAccessibility2 Implementation 2009----- + //return AccessibleRole::GROUP_BOX; return AccessibleRole::PANEL; +//-----IAccessibility2 Implementation 2009 } ::rtl::OUString SAL_CALL SvxRectCtlAccessibleContext::getAccessibleDescription( void ) throw( RuntimeException ) { ::osl::MutexGuard aGuard( m_aMutex ); - return msDescription; + //IAccessibility2 Implementation 2009----- + //return msDescription; + return msDescription +::rtl::OUString::createFromAscii(" Please use arrow key to selection."); + //-----IAccessibility2 Implementation 2009 } ::rtl::OUString SAL_CALL SvxRectCtlAccessibleContext::getAccessibleName( void ) throw( RuntimeException ) @@ -374,9 +390,40 @@ sal_Int16 SAL_CALL SvxRectCtlAccessibleContext::getAccessibleRole( void ) throw( */ Reference< XAccessibleRelationSet > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleRelationSet( void ) throw( RuntimeException ) { - return Reference< XAccessibleRelationSet >(); +//IAccessibility2 Implementation 2009----- + //return Reference< XAccessibleRelationSet >(); + utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; + uno::Reference< accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper; + Window* pWindow = mpRepr; + if ( pWindow ) + { + // Window *pLabeledBy = pWindow->GetAccRelationLabeledBy(); + Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy(); + if ( pLabeledBy && pLabeledBy != pWindow ) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); + aSequence[0] = pLabeledBy->GetAccessible(); + pRelationSetHelper->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) ); + } + Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf(); + if ( pMemberOf && pMemberOf != pWindow ) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); + aSequence[0] = pMemberOf->GetAccessible(); + pRelationSetHelper->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) ); + } + } + return xSet; + //-----IAccessibility2 Implementation 2009 } - +//IAccessibility2 Implementation 2009----- +//Solution:Add the event handling method +void SvxRectCtlAccessibleContext::FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew) +{ + const Reference< XInterface > xSource( *this ); + CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) ); +} +//-----IAccessibility2 Implementation 2009 Reference< XAccessibleStateSet > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleStateSet( void ) throw( RuntimeException ) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -384,8 +431,10 @@ Reference< XAccessibleStateSet > SAL_CALL SvxRectCtlAccessibleContext::getAccess if( IsAlive() ) { - // pStateSetHelper->AddState( AccessibleStateType::ENABLED ); +//IAccessibility2 Implementation 2009----- + pStateSetHelper->AddState( AccessibleStateType::ENABLED ); // pStateSetHelper->AddState( AccessibleStateType::SENSITIVE ); +//-----IAccessibility2 Implementation 2009 pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE ); if( mpRepr->HasFocus() ) pStateSetHelper->AddState( AccessibleStateType::FOCUSED ); @@ -634,8 +683,38 @@ void SvxRectCtlAccessibleContext::checkChildIndexOnSelection( long nIndex ) thro // in our case only for the first (0) _selected_ child this is a valid request throw lang::IndexOutOfBoundsException(); } - -void SvxRectCtlAccessibleContext::selectChild( long nNew ) +// IAccessibility2 implementation 2009. ------ +void SvxRectCtlAccessibleContext::FireChildFocus( RECT_POINT eButton ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + long nNew = PointToIndex( eButton, mbAngleMode ); + long nNumOfChilds = getAccessibleChildCount(); + if( nNew < nNumOfChilds ) + { + // select new child + SvxRectCtlChildAccessibleContext* pChild; + mnSelectedChild = nNew; + if( nNew != NOCHILDSELECTED ) + { + pChild = mpChilds[ nNew ]; + if( pChild ) + { + pChild->FireFocusEvent(); + } + } + else + { + const Reference< XInterface > xSource( *this ); + Any aOld; + Any aNew; + aNew <<= AccessibleStateType::FOCUSED; + CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) ); + } + } + else + mnSelectedChild = NOCHILDSELECTED; +} +void SvxRectCtlAccessibleContext::selectChild( long nNew, sal_Bool bFireFocus ) { ::osl::MutexGuard aGuard( m_aMutex ); if( nNew != mnSelectedChild ) @@ -648,7 +727,7 @@ void SvxRectCtlAccessibleContext::selectChild( long nNew ) { // deselect old selected child if one is selected pChild = mpChilds[ mnSelectedChild ]; if( pChild ) - pChild->setStateChecked( sal_False ); + pChild->setStateChecked( sal_False, bFireFocus ); } // select new child @@ -658,7 +737,7 @@ void SvxRectCtlAccessibleContext::selectChild( long nNew ) { pChild = mpChilds[ nNew ]; if( pChild ) - pChild->setStateChecked( sal_True ); + pChild->setStateChecked( sal_True, bFireFocus ); } } else @@ -666,12 +745,12 @@ void SvxRectCtlAccessibleContext::selectChild( long nNew ) } } -void SvxRectCtlAccessibleContext::selectChild( RECT_POINT eButton ) +void SvxRectCtlAccessibleContext::selectChild( RECT_POINT eButton , sal_Bool bFireFocus) { // no guard -> is done in next selectChild - selectChild( PointToIndex( eButton, mbAngleMode ) ); + selectChild( PointToIndex( eButton, mbAngleMode ) , bFireFocus); } - +// ------ IAccessibility2 implementation 2009. void SvxRectCtlAccessibleContext::setName( const ::rtl::OUString& rName ) { Any aPreVal, aPostVal; @@ -976,7 +1055,20 @@ sal_Int16 SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleRole( void ) t */ Reference<XAccessibleRelationSet> SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleRelationSet( void ) throw( RuntimeException ) { - return Reference< XAccessibleRelationSet >(); + //return Reference< XAccessibleRelationSet >(); + //IAccessibility2 Implementation 2009----- + utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; + uno::Reference< accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper; + if( mxParent.is() ) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); + aSequence[0] = mxParent; + pRelationSetHelper->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) ); + + } + + return xSet; + //-----IAccessibility2 Implementation 2009 } Reference< XAccessibleStateSet > SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleStateSet( void ) throw( RuntimeException ) @@ -1085,6 +1177,59 @@ Any SAL_CALL SvxRectCtlChildAccessibleContext::getMinimumValue() throw( RuntimeE return aRet; } +//IAccessibility2 Implementation 2009----- +// ----------------------------------------------------------------------------- +// XAccessibleAction +// ----------------------------------------------------------------------------- + +sal_Int32 SvxRectCtlChildAccessibleContext::getAccessibleActionCount( ) throw (RuntimeException) +{ + ::osl::MutexGuard aGuard( maMutex ); + + return 1; +} + +// ----------------------------------------------------------------------------- + +sal_Bool SvxRectCtlChildAccessibleContext::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard( maMutex ); + + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) + throw IndexOutOfBoundsException(); + + Reference<XAccessibleSelection> xSelection( mxParent, UNO_QUERY); + + xSelection->selectAccessibleChild(mnIndexInParent); + + return sal_True; +} + +// ----------------------------------------------------------------------------- + +::rtl::OUString SvxRectCtlChildAccessibleContext::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard( maMutex ); + + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) + throw IndexOutOfBoundsException(); + return ::rtl::OUString::createFromAscii("select"); +} + +// ----------------------------------------------------------------------------- + +Reference< XAccessibleKeyBinding > SvxRectCtlChildAccessibleContext::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + ::osl::MutexGuard aGuard( maMutex ); + + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) + throw IndexOutOfBoundsException(); + + return Reference< XAccessibleKeyBinding >(); +} + +//-----IAccessibility2 Implementation 2009 + //===== XServiceInfo ======================================================== ::rtl::OUString SAL_CALL SvxRectCtlChildAccessibleContext::getImplementationName( void ) throw( RuntimeException ) @@ -1181,8 +1326,8 @@ Rectangle SvxRectCtlChildAccessibleContext::GetBoundingBox( void ) throw( Runtim return *mpBoundingBox; } - -void SvxRectCtlChildAccessibleContext::setStateChecked( sal_Bool bChecked ) +// IAccessibility2 implementation 2009. ------ +void SvxRectCtlChildAccessibleContext::setStateChecked( sal_Bool bChecked, sal_Bool bFireFocus ) { if( mbIsChecked != bChecked ) { @@ -1193,10 +1338,24 @@ void SvxRectCtlChildAccessibleContext::setStateChecked( sal_Bool bChecked ) Any aOld; Any aNew; Any& rMod = bChecked? aNew : aOld; - + if( bFireFocus ) + { + //Solution: Send the STATE_CHANGED(Focused) event to accessible + rMod <<= AccessibleStateType::FOCUSED; + CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) ); + } rMod <<= AccessibleStateType::CHECKED; CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) ); } } +void SvxRectCtlChildAccessibleContext::FireFocusEvent() +{ + const Reference< XInterface > xSource( *this ); + Any aOld; + Any aNew; + aNew <<= AccessibleStateType::FOCUSED; + CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) ); +} +// ------ IAccessibility2 implementation 2009. diff --git a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx index 2c4c9d7e6571..b03a0b28bddd 100644 --- a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx @@ -19,15 +19,19 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_svx.hxx" #include "svx/EnhancedCustomShapeTypeNames.hxx" #include <osl/mutex.hxx> #include <hash_map> -#include "rtl/string.hxx" +struct TCheck +{ + bool operator()( const char* s1, const char* s2 ) const + { + return strcmp( s1, s2 ) == 0; + } +}; typedef std::hash_map< const char*, MSO_SPT, rtl::CStringHash, rtl::CStringEqual> TypeNameHashMap; static TypeNameHashMap* pHashMap = NULL; static ::osl::Mutex& getHashMapMutex() @@ -310,3 +314,250 @@ rtl::OUString EnhancedCustomShapeTypeNames::Get( const MSO_SPT eShapeType ) ? rtl::OUString::createFromAscii( pNameTypeTableArray[ eShapeType ].pS ) : rtl::OUString(); } +//IAccessibility2 Implementation 2009----- +typedef std::hash_map< const char*, const char*, std::hash<const char*>, TCheck> TypeACCNameHashMap; +static TypeACCNameHashMap* pACCHashMap = NULL; +struct ACCNameTypeTable +{ + const char* pS; + const char* pE; +}; +static const ACCNameTypeTable pACCNameTypeTableArray[] = +{ + { "non-primitive", "Non Primitive Shape" }, + { "rectangle", "Rectangle" }, + { "round-rectangle", "Rounded Rectangle" }, + { "ellipse", "Ellipse" }, + { "diamond", "Diamond" }, + { "isosceles-triangle", "Triangle" }, + { "right-triangle", "Right Triangle" }, + { "parallelogram", "Parallelogram" }, + { "trapezoid", "Trapezoid" }, + { "hexagon", "Hexagon" }, + { "octagon", "Octagon" }, + { "cross", "Cross" }, + { "star5", "5-Point Star" }, + { "right-arrow", "Right Arrow" }, + //{ "mso-spt14", mso_sptThickArrow }, + { "pentagon-right", "Pentagon" }, + { "cube", "Cube" }, + { "mso-spt21", "Doorplate" }, + /*{ "mso-spt17", mso_sptBalloon }, + { "mso-spt18", mso_sptSeal }, + { "mso-spt19", mso_sptArc }, + { "mso-spt20", mso_sptLine }, + { "mso-spt21", mso_sptPlaque }, + { "can", mso_sptCan },*/ + { "ring", "Ring" }, + /*{ "mso-spt24", mso_sptTextSimple }, + { "mso-spt25", mso_sptTextOctagon }, + { "mso-spt26", mso_sptTextHexagon }, + { "mso-spt27", mso_sptTextCurve }, + { "mso-spt28", mso_sptTextWave }, + { "mso-spt29", mso_sptTextRing }, + { "mso-spt30", mso_sptTextOnCurve }, + { "mso-spt31", mso_sptTextOnRing }, + { "mso-spt32", mso_sptStraightConnector1 }, + { "mso-spt33", mso_sptBentConnector2 }, + { "mso-spt34", mso_sptBentConnector3 }, + { "mso-spt35", mso_sptBentConnector4 }, + { "mso-spt36", mso_sptBentConnector5 }, + { "mso-spt37", mso_sptCurvedConnector2 }, + { "mso-spt38", mso_sptCurvedConnector3 }, + { "mso-spt39", mso_sptCurvedConnector4 }, + { "mso-spt40", mso_sptCurvedConnector5 }, + { "mso-spt41", mso_sptCallout1 }, + { "mso-spt42", mso_sptCallout2 }, + { "mso-spt43", mso_sptCallout3 }, + { "mso-spt44", mso_sptAccentCallout1 }, + { "mso-spt45", mso_sptAccentCallout2 }, + { "mso-spt46", mso_sptAccentCallout3 },*/ + { "line-callout-1", "Line Callout 1" }, + { "line-callout-2", "Line Callout 2" }, + /*{ "mso-spt49", mso_sptBorderCallout3 }, + { "mso-spt50", mso_sptAccentBorderCallout1 }, + { "mso-spt51", mso_sptAccentBorderCallout2 }, + { "mso-spt52", mso_sptAccentBorderCallout3 }, + { "mso-spt53", mso_sptRibbon }, + { "mso-spt54", mso_sptRibbon2 },*/ + { "chevron", "Chevron" }, + { "pentagon", "Regular Pentagon" }, + { "forbidden", "'No' Symbol" }, + { "star8", "8-Point Star" }, + /*{ "mso-spt59", mso_sptSeal16 }, + { "mso-spt60", mso_sptSeal32 },*/ + { "rectangular-callout", "Rectangular Callout" }, + { "round-rectangular-callout", "Rounded Rectangular Callout" }, + { "round-callout", "Round Callout" }, + //{ "mso-spt64", mso_sptWave }, + { "paper", "Folded Corner" }, + { "left-arrow", "Left Arrow" }, + { "down-arrow", "Down Arrow" }, + { "up-arrow", "Up Arrow" }, + { "left-right-arrow", "Left and Right Arrow" }, + { "up-down-arrow", "Up and Down Arrow" }, + //{ "mso-spt71", mso_sptIrregularSeal1 }, + { "bang", "Explosion" }, + { "lightning", "Lighting Bolt" }, + { "heart", "Heart" }, + //{ "mso-spt75", mso_sptPictureFrame }, + { "quad-arrow", "4-Way Arrow" }, + { "left-arrow-callout", "Left Arrow Callout" }, + { "right-arrow-callout", "Right Arrow Callout" }, + { "up-arrow-callout", "Up Arrow Callout" }, + { "down-arrow-callout", "Down Arrow Callout" }, + { "left-right-arrow-callout", "Left and Right Arrow Callout" }, + { "up-down-arrow-callout", "Up and Down Arrow Callout" }, + { "quad-arrow-callout", "4-Way Arrow Callout" }, + { "quad-bevel", "Square Bevel" }, + { "left-bracket", "Left Bracket" }, + { "right-bracket", "Right Bracket" }, + { "left-brace", "Left Brace" }, + { "right-brace", "Right Brace" }, + { "mso-spt89", "Up and Left Arrow" }, + //{ "mso-spt90", mso_sptBentUpArrow }, + //{ "mso-spt91", mso_sptBentArrow }, + { "star24", "24-Point Star" }, + { "striped-right-arrow", "Striped Right Arrow" }, + { "notched-right-arrow", "Notched Right Arrow" }, + { "block-arc", "Block Arc" }, + { "smiley", "Smile Face" }, + { "vertical-scroll", "Vertical Scroll" }, + { "horizontal-scroll", "Horizontal Scroll" }, + { "circular-arrow", "Circular Arrow" }, + { "mso-spt100", "Notched Circular Arrow" }, + /* + { "mso-spt101", mso_sptUturnArrow }, + { "mso-spt102", mso_sptCurvedRightArrow }, + { "mso-spt103", mso_sptCurvedLeftArrow }, + { "mso-spt104", mso_sptCurvedUpArrow }, + { "mso-spt105", mso_sptCurvedDownArrow },*/ + { "cloud-callout", "Cloud Callout" }, + /*{ "mso-spt107", mso_sptEllipseRibbon }, + { "mso-spt108", mso_sptEllipseRibbon2 },*/ + { "flowchart-process", "Flowchart:Process" }, + { "flowchart-decision", "Flowchart:Decision" }, + { "flowchart-data", "Flowchart:Data" }, + { "flowchart-predefined-process", "Flowchart:Predefined Process" }, + { "flowchart-internal-storage", "Flowchart:Internal Storage" }, + { "flowchart-document", "Flowchart:Document" }, + { "flowchart-multidocument", "Flowchart:Multidocument" }, + { "flowchart-terminator", "Flowchart:Terminator" }, + { "flowchart-preparation", "Flowchart:Preparation" }, + { "flowchart-manual-input", "Flowchart:Manual Input" }, + { "flowchart-manual-operation", "Flowchart:Manual Operation" }, + { "flowchart-connector", "Flowchart:Connector" }, + { "flowchart-card", "Flowchart:Card" }, + { "flowchart-punched-tape", "Flowchart:Punched Tape" }, + { "flowchart-summing-junction", "Flowchart:Summing Junction" }, + { "flowchart-or", "Flowchart:Or" }, + { "flowchart-collate", "Flowchart:Collate" }, + { "flowchart-sort", "Flowchart:Sort" }, + { "flowchart-extract", "Flowchart:Extract" }, + { "flowchart-merge", "Flowchart:Merge" }, + //{ "mso-spt129", mso_sptFlowChartOfflineStorage }, + { "flowchart-stored-data", "Flowchart:Stored Data" }, + { "flowchart-sequential-access", "drawingbar.fc.25=Flowchart:Sequential Access" }, + { "flowchart-magnetic-disk", "Flowchart:Magnetic Disk" }, + { "flowchart-direct-access-storage", "Flowchart:Direct Access Storage" }, + { "flowchart-display", "Flowchart:Display" }, + { "flowchart-delay", "Flowchart:Delay" }, + /*{ "fontwork-plain-text", mso_sptTextPlainText }, + { "fontwork-stop", mso_sptTextStop }, + { "fontwork-triangle-up", mso_sptTextTriangle }, + { "fontwork-triangle-down", mso_sptTextTriangleInverted }, + { "fontwork-chevron-up", mso_sptTextChevron }, + { "fontwork-chevron-down", mso_sptTextChevronInverted }, + { "mso-spt142", mso_sptTextRingInside }, + { "mso-spt143", mso_sptTextRingOutside }, + { "fontwork-arch-up-curve", mso_sptTextArchUpCurve }, + { "fontwork-arch-down-curve", mso_sptTextArchDownCurve }, + { "fontwork-circle-curve", mso_sptTextCircleCurve }, + { "fontwork-open-circle-curve", mso_sptTextButtonCurve }, + { "fontwork-arch-up-pour", mso_sptTextArchUpPour }, + { "fontwork-arch-down-pour", mso_sptTextArchDownPour }, + { "fontwork-circle-pour", mso_sptTextCirclePour }, + { "fontwork-open-circle-pour", mso_sptTextButtonPour }, + { "fontwork-curve-up", mso_sptTextCurveUp }, + { "fontwork-curve-down", mso_sptTextCurveDown }, + { "fontwork-fade-up-and-right", mso_sptTextCascadeUp }, + { "fontwork-fade-up-and-left", mso_sptTextCascadeDown }, + { "fontwork-wave", mso_sptTextWave1 }, + { "mso-spt157", mso_sptTextWave2 }, + { "mso-spt158", mso_sptTextWave3 }, + { "mso-spt159", mso_sptTextWave4 }, + { "fontwork-inflate", mso_sptTextInflate }, + { "mso-spt161", mso_sptTextDeflate }, + { "mso-spt162", mso_sptTextInflateBottom }, + { "mso-spt163", mso_sptTextDeflateBottom }, + { "mso-spt164", mso_sptTextInflateTop }, + { "mso-spt165", mso_sptTextDeflateTop }, + { "mso-spt166", mso_sptTextDeflateInflate }, + { "mso-spt167", mso_sptTextDeflateInflateDeflate }, + { "fontwork-fade-right", mso_sptTextFadeRight }, + { "fontwork-fade-left", mso_sptTextFadeLeft }, + { "fontwork-fade-up", mso_sptTextFadeUp }, + { "fontwork-fade-down", mso_sptTextFadeDown }, + { "fontwork-slant-up", mso_sptTextSlantUp }, + { "fontwork-slant-down", mso_sptTextSlantDown }, + { "mso-spt174", mso_sptTextCanUp }, + { "mso-spt175", mso_sptTextCanDown },*/ + { "flowchart-alternate-process", "Flowchart:Alternate Process " }, + { "flowchart-off-page-connector", "Flowchart:Off-page Connector" }, + /*{ "mso-spt178", mso_sptCallout90 }, + { "mso-spt179", mso_sptAccentCallout90 }, + { "mso-spt180", mso_sptBorderCallout90 },*/ + { "line-callout-3", "Line Callout 3" }, + //{ "mso-spt182", mso_sptLeftRightUpArrow }, + { "sun", "Sun" }, + { "moon", "Moon" }, + { "bracket-pair", "Double Bracket" }, + { "brace-pair", "Double Brace" }, + { "star4", "4-Point Star" }, + /*{ "mso-spt188", mso_sptDoubleWave }, + { "mso-spt189", mso_sptActionButtonBlank }, + { "mso-spt190", mso_sptActionButtonHome }, + { "mso-spt191", mso_sptActionButtonHelp }, + { "mso-spt192", mso_sptActionButtonInformation }, + { "mso-spt193", mso_sptActionButtonForwardNext }, + { "mso-spt194", mso_sptActionButtonBackPrevious }, + { "mso-spt195", mso_sptActionButtonEnd }, + { "mso-spt196", mso_sptActionButtonBeginning }, + { "mso-spt197", mso_sptActionButtonReturn }, + { "mso-spt198", mso_sptActionButtonDocument }, + { "mso-spt199", mso_sptActionButtonSound }, + { "mso-spt200", mso_sptActionButtonMovie }, + { "mso-spt201", mso_sptHostControl }, + { "mso-spt202", mso_sptTextBox },*/ + { "frame", "Frame" }, + { "col-60da8460", "Octagon Bevel" }, + { "col-502ad400", "Diamond Bevel" } +}; +rtl::OUString EnhancedCustomShapeTypeNames::GetAccName( const rtl::OUString& rShapeType ) +{ + if ( !pACCHashMap ) + { // init hash map + ::osl::MutexGuard aGuard( getHashMapMutex() ); + if ( !pACCHashMap ) + { + TypeACCNameHashMap* pH = new TypeACCNameHashMap; + const ACCNameTypeTable* pPtr = pACCNameTypeTableArray; + const ACCNameTypeTable* pEnd = pPtr + ( sizeof( pACCNameTypeTableArray ) / sizeof( ACCNameTypeTable ) ); + for ( ; pPtr < pEnd; pPtr++ ) + (*pH)[ pPtr->pS ] = pPtr->pE; + pACCHashMap = pH; + } + } + rtl::OUString sRetValue; + int i, nLen = rShapeType.getLength(); + char* pBuf = new char[ nLen + 1 ]; + for ( i = 0; i < nLen; i++ ) + pBuf[ i ] = (char)rShapeType[ i ]; + pBuf[ i ] = 0; + TypeACCNameHashMap::iterator aHashIter( pACCHashMap->find( pBuf ) ); + delete[] pBuf; + if ( aHashIter != pACCHashMap->end() ) + sRetValue = rtl::OUString::createFromAscii( (*aHashIter).second ); + return sRetValue; +} +//-----IAccessibility2 Implementation 2009 diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index 82008b7d803a..9d2a402bc728 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -137,6 +137,9 @@ void MaskSet::Select() void MaskSet::GetFocus() { + //IAccessibility2 Implementation 2009----- + ValueSet::GetFocus(); + //-----IAccessibility2 Implementation 2009 SelectItem( 1 ); pSvxBmpMask->onSelect( this ); } @@ -327,10 +330,13 @@ IMPL_LINK( MaskData, CbxTransHdl, CheckBox*, pCbx ) IMPL_LINK( MaskData, FocusLbHdl, ColorLB*, pLb ) { - pMask->pQSet1->SelectItem( pLb == &( pMask->aLbColor1 ) ? 1 : 0 ); - pMask->pQSet2->SelectItem( pLb == &( pMask->aLbColor2 ) ? 1 : 0 ); - pMask->pQSet3->SelectItem( pLb == &( pMask->aLbColor3 ) ? 1 : 0 ); - pMask->pQSet4->SelectItem( pLb == &( pMask->aLbColor4 ) ? 1 : 0 ); + //IAccessibility2 Implementation 2009----- + // MT: bFireFox as API parameter is ugly, find better solution???? + pMask->pQSet1->SelectItem( pLb == &( pMask->aLbColor1 ) ? 1 : 0 /* , false */ ); + pMask->pQSet2->SelectItem( pLb == &( pMask->aLbColor2 ) ? 1 : 0 /* , false */ ); + pMask->pQSet3->SelectItem( pLb == &( pMask->aLbColor3 ) ? 1 : 0 /* , false */ ); + pMask->pQSet4->SelectItem( pLb == &( pMask->aLbColor4 ) ? 1 : 0 /* , false */ ); + //-----IAccessibility2 Implementation 2009 return 0; } @@ -477,35 +483,57 @@ SvxBmpMask::SvxBmpMask( SfxBindings *pBindinx, pQSet1->SetColCount( 1 ); pQSet1->SetLineCount( 1 ); // pQSet1->SetExtraSpacing( 1 ); - pQSet1->InsertItem( 1, aPipetteColor ); + //-----IAccessibility2 Implementation 2009 + String sColorPalette (BMP_RESID( RID_SVXDLG_BMPMASK_STR_PALETTE)); + String sColorPaletteN; + sColorPaletteN = sColorPalette; + sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1")); + //pQSet1->InsertItem( 1, aPipetteColor ); + pQSet1->InsertItem( 1, aPipetteColor, sColorPaletteN); + //IAccessibility2 Implementation 2009----- pQSet1->SelectItem( 1 ); pQSet2->SetStyle( pQSet2->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER ); pQSet2->SetColCount( 1 ); pQSet2->SetLineCount( 1 ); // pQSet2->SetExtraSpacing( 1 ); - pQSet2->InsertItem( 1, aPipetteColor ); + //IAccessibility2 Implementation 2009----- + sColorPaletteN = sColorPalette; + sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2")); + //pQSet2->InsertItem( 1, aPipetteColor ); + pQSet2->InsertItem( 1, aPipetteColor, sColorPaletteN); + //-----IAccessibility2 Implementation 2009 pQSet2->SelectItem( 0 ); pQSet3->SetStyle( pQSet3->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER ); pQSet3->SetColCount( 1 ); pQSet3->SetLineCount( 1 ); // pQSet3->SetExtraSpacing( 1 ); - pQSet3->InsertItem( 1, aPipetteColor ); + //IAccessibility2 Implementation 2009----- + sColorPaletteN = sColorPalette; + sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3")); + pQSet3->InsertItem( 1, aPipetteColor, sColorPaletteN); + //pQSet3->InsertItem( 1, aPipetteColor ); + //-----IAccessibility2 Implementation 2009 pQSet3->SelectItem( 0 ); pQSet4->SetStyle( pQSet4->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER ); pQSet4->SetColCount( 1 ); pQSet4->SetLineCount( 1 ); // pQSet4->SetExtraSpacing( 1 ); - pQSet4->InsertItem( 1, aPipetteColor ); + //IAccessibility2 Implementation 2009----- + sColorPaletteN = sColorPalette; + sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 4")); + pQSet4->InsertItem( 1, aPipetteColor, sColorPaletteN); + //pQSet4->InsertItem( 1, aPipetteColor ); + //-----IAccessibility2 Implementation 2009 pQSet4->SelectItem( 0 ); pQSet1->Show(); pQSet2->Show(); pQSet3->Show(); pQSet4->Show(); - + //IAccessibility2 Implementation 2009----- aCbx1.SetAccessibleRelationMemberOf( &aGrpQ ); pQSet1->SetAccessibleRelationMemberOf( &aGrpQ ); aSp1.SetAccessibleRelationMemberOf( &aGrpQ ); @@ -541,6 +569,7 @@ SvxBmpMask::SvxBmpMask( SfxBindings *pBindinx, aLbColorTrans.SetAccessibleRelationLabeledBy( &aCbxTrans ); aLbColorTrans.SetAccessibleRelationMemberOf( &aGrpQ ); aCbxTrans.SetAccessibleRelationMemberOf( &aGrpQ ); + //-----IAccessibility2 Implementation 2009 } //------------------------------------------------------------------------- @@ -1271,4 +1300,51 @@ void SvxBmpMask::SetAccessibleNames (void) sSourceColorN = sSourceColor; sSourceColorN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 4")); aCbx4.SetAccessibleName (sSourceColorN); + //IAccessibility2 Implementation 2009----- + // set the accessible name for valueset + String sColorPalette (BMP_RESID( RID_SVXDLG_BMPMASK_STR_PALETTE)); + String sColorPaletteN; + sColorPaletteN = sColorPalette; + sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1")); + pQSet1->SetText (sColorPaletteN); + sColorPaletteN = sColorPalette; + sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2")); + pQSet2->SetText (sColorPaletteN); + sColorPaletteN = sColorPalette; + sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3")); + pQSet3->SetText (sColorPaletteN); + sColorPaletteN = sColorPalette; + sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 4")); + pQSet4->SetText (sColorPaletteN); + // set the accessible for replace with spin boxes. + String sTolerance(BMP_RESID( RID_SVXDLG_BMPMASK_STR_TOLERANCE)); + String sToleranceN; + sToleranceN = sTolerance; + sToleranceN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1")); + aSp1.SetAccessibleName (sToleranceN); + sToleranceN = sTolerance; + sToleranceN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2")); + aSp2.SetAccessibleName (sToleranceN); + sToleranceN = sTolerance; + sToleranceN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3")); + aSp3.SetAccessibleName (sToleranceN); + sToleranceN = sTolerance; + sToleranceN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 4")); + aSp4.SetAccessibleName (sToleranceN); + // set the accessible for replace with combo boxes. + String sReplaceWith(BMP_RESID( RID_SVXDLG_BMPMASK_STR_REPLACEWITH)); + String sReplaceWithN; + sReplaceWithN = sReplaceWith; + sReplaceWithN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1")); + aLbColor1.SetAccessibleName (sReplaceWithN); + sReplaceWithN = sReplaceWith; + sReplaceWithN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2")); + aLbColor2.SetAccessibleName (sReplaceWithN); + sReplaceWithN = sReplaceWith; + sReplaceWithN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3")); + aLbColor3.SetAccessibleName (sReplaceWithN); + sReplaceWithN = sReplaceWith; + sReplaceWithN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 4")); + aLbColor4.SetAccessibleName (sReplaceWithN); + //-----IAccessibility2 Implementation 2009 } diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index e6cf4a183309..1177717e431b 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -136,7 +136,8 @@ void SvxShowCharSet::MouseButtonDown( const MouseEvent& rMEvt ) CaptureMouse(); int nIndex = PixelToMapIndex( rMEvt.GetPosPixel() ); - SelectIndex( nIndex ); + // Fire the focus event + SelectIndex( nIndex , sal_True); } if ( !(rMEvt.GetClicks() % 2) ) @@ -177,7 +178,8 @@ void SvxShowCharSet::MouseMove( const MouseEvent& rMEvt ) aPos.Y() = aSize.Height()-5; int nIndex = PixelToMapIndex( aPos ); - SelectIndex( nIndex ); + // Fire the focus event. + SelectIndex( nIndex , sal_True ); } } @@ -585,12 +587,18 @@ void SvxShowCharSet::SelectIndex( int nNewIndex, sal_Bool bFocus ) if( m_pAccessible ) { ::svx::SvxShowCharSetItem* pItem = ImplGetItem(nSelectedIndex); - m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set + // Don't fire the focus event. + if ( bFocus ) + m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set + else + m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set OSL_ENSURE(pItem->m_pItem,"No accessible created!"); Any aOldAny, aNewAny; aNewAny <<= AccessibleStateType::FOCUSED; - pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny ); + // Don't fire the focus event. + if ( bFocus ) + pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny ); aNewAny <<= AccessibleStateType::SELECTED; pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny ); diff --git a/svx/source/dialog/ctredlin.cxx b/svx/source/dialog/ctredlin.cxx index c0cb3b9081c1..192c13d40182 100644 --- a/svx/source/dialog/ctredlin.cxx +++ b/svx/source/dialog/ctredlin.cxx @@ -1345,6 +1345,29 @@ void SvxTPFilter::Disable( bool bChild) Enable( false, bChild ); } +//IAccessibility2 Implementation 2009----- +void SvxTPFilter::SetAccessibleRelationMemberOf( Window* pWin ) +{ + aCbDate.SetAccessibleRelationMemberOf(pWin); + aLbDate.SetAccessibleRelationMemberOf(pWin); + aDfDate.SetAccessibleRelationMemberOf(pWin); + aTfDate.SetAccessibleRelationMemberOf(pWin); + aIbClock.SetAccessibleRelationMemberOf(pWin); + aFtDate2.SetAccessibleRelationMemberOf(pWin); + aDfDate2.SetAccessibleRelationMemberOf(pWin); + aTfDate2.SetAccessibleRelationMemberOf(pWin); + aIbClock2.SetAccessibleRelationMemberOf(pWin); + aCbAuthor.SetAccessibleRelationMemberOf(pWin); + aLbAuthor.SetAccessibleRelationMemberOf(pWin); + aCbRange.SetAccessibleRelationMemberOf(pWin); + aEdRange.SetAccessibleRelationMemberOf(pWin); + aBtnRange.SetAccessibleRelationMemberOf(pWin); + aLbAction.SetAccessibleRelationMemberOf(pWin); + aCbComment.SetAccessibleRelationMemberOf(pWin); + aEdComment.SetAccessibleRelationMemberOf(pWin); +} +//-----IAccessibility2 Implementation 2009 + IMPL_LINK( SvxTPFilter, ModifyDate, void*,pTF) { diff --git a/svx/source/dialog/ctredlin.src b/svx/source/dialog/ctredlin.src index 5ee35db905b1..86e5d3d8bd4f 100644 --- a/svx/source/dialog/ctredlin.src +++ b/svx/source/dialog/ctredlin.src @@ -277,6 +277,10 @@ TabPage SID_REDLIN_FILTER_PAGE { Text [ en-US ] = "End Time" ; }; + String STR_TREE + { + Text [ en-US ] = "Changes" ; + }; /*-----IAccessibility2 Implementation 2009*/ }; TabPage SID_REDLIN_VIEW_PAGE @@ -354,10 +358,6 @@ TabPage SID_REDLIN_VIEW_PAGE { Text [ en-US ] = "Comment" ; }; - String STR_TREE - { - Text [ en-US ] = "Changes" ; - }; }; diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index cbc1b70a53bd..7cec4c3b8f3e 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -37,6 +37,18 @@ #include <vcl/region.hxx> #include <vcl/gradient.hxx> #include <vcl/hatch.hxx> +// IAccessibility2 implementation 2009. ------ +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTOBJECT_HPP_ +#include <com/sun/star/accessibility/AccessibleEventObject.hpp> +#endif +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_ +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#endif +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_ +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#endif +#include "svxpixelctlaccessiblecontext.hxx" +// ------ IAccessibility2 implementation 2009. #include <svtools/colorcfg.hxx> #include <svxrectctaccessiblecontext.hxx> #include <com/sun/star/lang/XUnoTunnel.hpp> @@ -563,6 +575,15 @@ Point SvxRectCtl::SetActualRPWithoutInvalidate( RECT_POINT eNewRP ) void SvxRectCtl::GetFocus() { SetFocusRect(); + // IAccessibility2 implementation 2009. ------ + //Solution: Send the accessible focused event + Control::GetFocus(); + // Send accessibility event. + if(pAccContext) + { + pAccContext->FireChildFocus(GetActualRP()); + } + // ------ IAccessibility2 implementation 2009. } @@ -656,9 +677,10 @@ RECT_POINT SvxRectCtl::GetActualRP() const |* Gibt den aktuell ausgewaehlten RECT_POINT zur�ck |* \************************************************************************/ - -void SvxRectCtl::SetActualRP( RECT_POINT eNewRP ) +// IAccessibility2 implementation 2009. ------ +void SvxRectCtl::SetActualRP( RECT_POINT eNewRP /* MT: , sal_Bool bFireFocus */ ) { + // MT: bFireFox as API parameter is ugly... Point aPtLast( SetActualRPWithoutInvalidate( eNewRP ) ); Invalidate( Rectangle( aPtLast - Point( nRadius, nRadius ), aPtLast + Point( nRadius, nRadius ) ) ); @@ -666,9 +688,9 @@ void SvxRectCtl::SetActualRP( RECT_POINT eNewRP ) // notify accessibility object about change if( pAccContext ) - pAccContext->selectChild( eNewRP ); + pAccContext->selectChild( eNewRP /* MT, bFireFocus */ ); } - +// ------ IAccessibility2 implementation 2009. void SvxRectCtl::SetState( CTL_STATE nState ) { m_nState = nState; @@ -863,11 +885,74 @@ void SvxAngleCtl::Paint( const Rectangle& ) |* Control zum Editieren von Bitmaps |* \************************************************************************/ +// IAccessibility2 implementation 2009. ------ + +::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SvxPixelCtl::CreateAccessible() +{ + if(!m_xAccess.is()) + { + m_xAccess = m_pAccess = new SvxPixelCtlAccessible(*this); + } + return m_xAccess; +} + +//Logic Pixel +long SvxPixelCtl::PointToIndex(const Point &aPt) const +{ + sal_uInt16 nX, nY; + + nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() ); + nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() ); + + return nX + nY * nLines ; +} +Point SvxPixelCtl::IndexToPoint(long nIndex) const +{ + DBG_ASSERT(nIndex >= 0 && nIndex < nSquares ," Check Index"); + + sal_uInt16 nXIndex = nIndex % nLines ; + sal_uInt16 nYIndex = sal_uInt16(nIndex / nLines) ; + + Point aPtTl; + aPtTl.Y() = aRectSize.Height() * nYIndex / nLines + 1; + aPtTl.X() = aRectSize.Width() * nXIndex / nLines + 1; + + return aPtTl; +} +long SvxPixelCtl::GetFoucsPosIndex() const +{ + return aFocusPosition.getX() + aFocusPosition.getY() * nLines ; +} +long SvxPixelCtl::ShowPosition( const Point &pt) +{ + Point aPt = PixelToLogic( pt ); + + sal_uInt16 nX, nY; + nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() ); + nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() ); + + ChangePixel( nX + nY * nLines ); + + //Solution:Set new focus position and repaint + //Invalidate( Rectangle( aPtTl, aPtBr ) ); + aFocusPosition.setX(nX); + aFocusPosition.setY(nY); + Invalidate(Rectangle(Point(0,0),aRectSize)); + + if( WINDOW_TABPAGE == GetParent()->GetType() ) + ( (SvxTabPage*) GetParent() )->PointChanged( this, RP_MM ); // RectPoint ist dummy + + return GetFoucsPosIndex(); +} +// ------ IAccessibility2 implementation 2009. SvxPixelCtl::SvxPixelCtl( Window* pParent, const ResId& rResId, sal_uInt16 nNumber ) : Control ( pParent, rResId ), nLines ( nNumber ), bPaintable ( sal_True ) + // IAccessibility2 implementation 2009. ------ + //Solution:Initialize it's value to Point(0,0) + ,aFocusPosition(0,0) { // SetMapMode( MAP_100TH_MM ); aRectSize = GetOutputSize(); @@ -879,6 +964,8 @@ SvxPixelCtl::SvxPixelCtl( Window* pParent, const ResId& rResId, sal_uInt16 nNumb nSquares = nLines * nLines; pPixel = new sal_uInt16[ nSquares ]; rtl_zeroMemory(pPixel, nSquares * sizeof(sal_uInt16)); + // IAccessibility2 implementation 2009. ------ + m_pAccess=NULL; } /************************************************************************* @@ -914,24 +1001,37 @@ void SvxPixelCtl::ChangePixel( sal_uInt16 nPixel ) void SvxPixelCtl::MouseButtonDown( const MouseEvent& rMEvt ) { - Point aPt = PixelToLogic( rMEvt.GetPosPixel() ); - Point aPtTl, aPtBr; - sal_uInt16 nX, nY; + // IAccessibility2 implementation 2009. ------ + //Point aPt = PixelToLogic( rMEvt.GetPosPixel() ); + //Point aPtTl, aPtBr; + //sal_uInt16 nX, nY; - nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() ); - nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() ); + //nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() ); + //nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() ); - ChangePixel( nX + nY * nLines ); + //ChangePixel( nX + nY * nLines ); - aPtTl.X() = aRectSize.Width() * nX / nLines + 1; - aPtBr.X() = aRectSize.Width() * (nX + 1) / nLines - 1; - aPtTl.Y() = aRectSize.Height() * nY / nLines + 1; - aPtBr.Y() = aRectSize.Height() * (nY + 1) / nLines - 1; + //aPtTl.X() = aRectSize.Width() * nX / nLines + 1; + //aPtBr.X() = aRectSize.Width() * (nX + 1) / nLines - 1; + //aPtTl.Y() = aRectSize.Height() * nY / nLines + 1; + //aPtBr.Y() = aRectSize.Height() * (nY + 1) / nLines - 1; - Invalidate( Rectangle( aPtTl, aPtBr ) ); + //Invalidate( Rectangle( aPtTl, aPtBr ) ); - if( WINDOW_TABPAGE == GetParent()->GetType() ) - ( (SvxTabPage*) GetParent() )->PointChanged( this, RP_MM ); // RectPoint ist dummy + //if( WINDOW_TABPAGE == GetParent()->GetType() ) + // ( (SvxTabPage*) GetParent() )->PointChanged( this, RP_MM ); // RectPoint ist dummy + //Solution:Grab focus when click in window + if( !HasFocus() ) + { + GrabFocus(); + } + long nIndex = ShowPosition(rMEvt.GetPosPixel()); + + if(m_pAccess) + { + m_pAccess->NotifyChild(nIndex,sal_True,sal_True); + } + // ------ IAccessibility2 implementation 2009. } /************************************************************************* @@ -982,6 +1082,13 @@ void SvxPixelCtl::Paint( const Rectangle& ) DrawRect( Rectangle( aPtTl, aPtBr ) ); } } + // IAccessibility2 implementation 2009. ------ + //Solution:Draw visual focus when has focus + if( HasFocus() ) + { + ShowFocus(implCalFocusRect(aFocusPosition)); + } + // ------ IAccessibility2 implementation 2009. } // bPaintable else { @@ -991,6 +1098,130 @@ void SvxPixelCtl::Paint( const Rectangle& ) DrawLine( Point( 0, aRectSize.Height() ), Point( aRectSize.Width(), 0 ) ); } } +// IAccessibility2 implementation 2009. ------ +//Solution:Caculate visual focus rectangle via focus position +Rectangle SvxPixelCtl::implCalFocusRect( const Point& aPosition ) +{ + long nLeft,nTop,nRight,nBottom; + long i,j; + i = aPosition.Y(); + j = aPosition.X(); + nLeft = aRectSize.Width() * j / nLines + 1; + nRight = aRectSize.Width() * (j + 1) / nLines - 1; + nTop = aRectSize.Height() * i / nLines + 1; + nBottom = aRectSize.Height() * (i + 1) / nLines - 1; + return Rectangle(nLeft,nTop,nRight,nBottom); +} + +//Solution:Keyboard fucntion +void SvxPixelCtl::KeyInput( const KeyEvent& rKEvt ) +{ + KeyCode aKeyCode = rKEvt.GetKeyCode(); + sal_uInt16 nCode = aKeyCode.GetCode(); + sal_Bool bIsMod = aKeyCode.IsShift() || aKeyCode.IsMod1() || aKeyCode.IsMod2(); + + if( !bIsMod ) + { + Point pRepaintPoint( aRectSize.Width() *( aFocusPosition.getX() - 1)/ nLines - 1, + aRectSize.Height() *( aFocusPosition.getY() - 1)/ nLines -1 + ); + Size mRepaintSize( aRectSize.Width() *3/ nLines + 2,aRectSize.Height() *3/ nLines + 2); + Rectangle mRepaintRect( pRepaintPoint, mRepaintSize ); + sal_Bool bFocusPosChanged=sal_False; + switch(nCode) + { + case KEY_LEFT: + if((aFocusPosition.getX() >= 1)) + { + aFocusPosition.setX( aFocusPosition.getX() - 1 ); + Invalidate(mRepaintRect); + bFocusPosChanged=sal_True; + } + break; + case KEY_RIGHT: + if( aFocusPosition.getX() < (nLines - 1) ) + { + aFocusPosition.setX( aFocusPosition.getX() + 1 ); + Invalidate(mRepaintRect); + bFocusPosChanged=sal_True; + } + break; + case KEY_UP: + if((aFocusPosition.getY() >= 1)) + { + aFocusPosition.setY( aFocusPosition.getY() - 1 ); + Invalidate(mRepaintRect); + bFocusPosChanged=sal_True; + } + break; + case KEY_DOWN: + if( aFocusPosition.getY() < ( nLines - 1 ) ) + { + aFocusPosition.setY( aFocusPosition.getY() + 1 ); + Invalidate(mRepaintRect); + bFocusPosChanged=sal_True; + } + break; + case KEY_SPACE: + ChangePixel( sal_uInt16(aFocusPosition.getX() + aFocusPosition.getY() * nLines) ); + Invalidate( implCalFocusRect(aFocusPosition) ); + break; + default: + Control::KeyInput( rKEvt ); + return; + } + if(m_xAccess.is()) + { + long nIndex = GetFoucsPosIndex(); + switch(nCode) + { + case KEY_LEFT: + case KEY_RIGHT: + case KEY_UP: + case KEY_DOWN: + if (bFocusPosChanged) + { + m_pAccess->NotifyChild(nIndex,sal_False,sal_False); + } + break; + case KEY_SPACE: + m_pAccess->NotifyChild(nIndex,sal_False,sal_True); + break; + default: + break; + } + } + } + else + { + Control::KeyInput( rKEvt ); + } +} + +//Draw focus when get focus +void SvxPixelCtl::GetFocus() +{ + Invalidate(implCalFocusRect(aFocusPosition)); + + if(m_pAccess) + { + m_pAccess->NotifyChild(GetFoucsPosIndex(),sal_True,sal_False); + } + + Control::GetFocus(); +} + +//Hide focus when lose focus +void SvxPixelCtl::LoseFocus() +{ + HideFocus(); + if (m_pAccess) + { + m_pAccess->LoseFocus(); + } + Control::LoseFocus(); +} +// ------ IAccessibility2 implementation 2009. /************************************************************************* |* diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx index df14d7c7c539..50ab5de161f7 100644 --- a/svx/source/dialog/frmsel.cxx +++ b/svx/source/dialog/frmsel.cxx @@ -30,6 +30,12 @@ #include "frmselimpl.hxx" #include "AccessibleFrameSelector.hxx" #include <svx/dialmgr.hxx> +//IAccessibility2 Implementation 2009----- +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HDL_ +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#endif +//-----IAccessibility2 Implementation 2009 #ifndef _SVX_DIALOGS_HRC #include <svx/dialogs.hrc> @@ -43,8 +49,11 @@ namespace svx { using ::com::sun::star::uno::Reference; +//IAccessibility2 Implementation 2009----- +using ::com::sun::star::uno::Any; using ::com::sun::star::accessibility::XAccessible; - +using namespace ::com::sun::star::accessibility; +//-----IAccessibility2 Implementation 2009 // ============================================================================ // global functions from framebordertype.hxx @@ -696,10 +705,24 @@ void FrameSelectorImpl::DoInvalidate( bool bFullRepaint ) void FrameSelectorImpl::SetBorderState( FrameBorder& rBorder, FrameBorderState eState ) { DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::SetBorderState - access to disabled border" ); + //IAccessibility2 Implementation 2009----- + Any aOld; + Any aNew; + Any& rMod = eState == FRAMESTATE_SHOW ? aNew : aOld; + rMod <<= AccessibleStateType::CHECKED; + Reference< XAccessible > xRet; + size_t nVecIdx = static_cast< size_t >( rBorder.GetType() ); + if( GetBorder(rBorder.GetType()).IsEnabled() && (1 <= nVecIdx) && (nVecIdx <= maChildVec.size()) ) + xRet = mxChildVec[ --nVecIdx ]; + a11y::AccFrameSelector* pFrameSelector = static_cast<a11y::AccFrameSelector*>(xRet.get()); + if( eState == FRAMESTATE_SHOW ) SetBorderCoreStyle( rBorder, &maCurrStyle ); else rBorder.SetState( eState ); + if (pFrameSelector) + pFrameSelector->NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOld, aNew ); + //-----IAccessibility2 Implementation 2009 DoInvalidate( true ); } @@ -914,9 +937,23 @@ bool FrameSelector::IsBorderSelected( FrameBorderType eBorder ) const return mxImpl->GetBorder( eBorder ).IsSelected(); } -void FrameSelector::SelectBorder( FrameBorderType eBorder, bool bSelect ) +void FrameSelector::SelectBorder( FrameBorderType eBorder, bool bSelect /*, bool bFocus */ ) { mxImpl->SelectBorder( mxImpl->GetBorderAccess( eBorder ), bSelect ); + //IAccessibility2 Implementation 2009----- + // MT: bFireFox as API parameter is ugly... + // if (bFocus) + { + Reference< XAccessible > xRet = GetChildAccessible(eBorder); + a11y::AccFrameSelector* pFrameSelector = static_cast<a11y::AccFrameSelector*>(xRet.get()); + if (pFrameSelector) + { + Any aOldValue, aNewValue; + aNewValue <<= AccessibleStateType::FOCUSED; + pFrameSelector->NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue ); + } + } + //-----IAccessibility2 Implementation 2009 } bool FrameSelector::IsAnyBorderSelected() const @@ -1063,7 +1100,10 @@ void FrameSelector::MouseButtonDown( const MouseEvent& rMEvt ) if( !(*aIt)->IsSelected() ) { bNewSelected = true; - mxImpl->SelectBorder( **aIt, true ); + //IAccessibility2 Implementation 2009----- + //mxImpl->SelectBorder( **aIt, true ); + SelectBorder((**aIt).GetType(), true); + //-----IAccessibility2 Implementation 2009 } } else @@ -1160,6 +1200,31 @@ void FrameSelector::GetFocus() mxImpl->DoInvalidate( false ); if( mxImpl->mxAccess.is() ) mxImpl->mpAccess->NotifyFocusListeners( sal_True ); + //IAccessibility2 Implementation 2009----- + if (IsAnyBorderSelected()) + { + FrameBorderType borderType = FRAMEBORDER_NONE; + if (mxImpl->maLeft.IsSelected()) + borderType = FRAMEBORDER_LEFT; + else if (mxImpl->maRight.IsSelected()) + borderType = FRAMEBORDER_RIGHT; + else if (mxImpl->maTop.IsSelected()) + borderType = FRAMEBORDER_TOP; + else if (mxImpl->maBottom.IsSelected()) + borderType = FRAMEBORDER_BOTTOM; + else if (mxImpl->maHor.IsSelected()) + borderType = FRAMEBORDER_HOR; + else if (mxImpl->maVer.IsSelected()) + borderType = FRAMEBORDER_VER; + else if (mxImpl->maTLBR.IsSelected()) + borderType = FRAMEBORDER_TLBR; + else if (mxImpl->maBLTR.IsSelected()) + borderType = FRAMEBORDER_BLTR; + SelectBorder(borderType); + } + for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt ) + mxImpl->SetBorderState( **aIt, FRAMESTATE_SHOW ); + //-----IAccessibility2 Implementation 2009 Control::GetFocus(); } diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx index 1cfbfedb3216..a68b2def5c8c 100644 --- a/svx/source/dialog/srchdlg.cxx +++ b/svx/source/dialog/srchdlg.cxx @@ -70,6 +70,14 @@ #include <tools/resary.hxx> #include <svx/svxdlg.hxx> //CHINA001 +//IAccessibility2 Impplementaton 2009----- +#ifndef _ACCESSIBLESVXFINDREPLACEDIALOG_HXX_ +#include <svx/AccessibleSvxFindReplaceDialog.hxx> +#endif +using namespace com::sun::star::uno; +using namespace com::sun::star::accessibility; +//-----IAccessibility2 Impplementaton 2009 + #include <sfx2/layout-pre.hxx> using namespace com::sun::star::i18n; @@ -293,6 +301,8 @@ void SearchAttrItemList::Remove( sal_uInt16 nPos, sal_uInt16 nLen ) #undef INI_LIST #define INI_LIST() \ + mpDocWin (NULL), \ + mbSuccess (sal_False), \ aSearchText ( this, SVX_RES( FT_SEARCH ) ), \ aSearchLB ( this, SVX_RES( ED_SEARCH ) ), \ aSearchTmplLB ( this, SVX_RES( LB_SEARCH ) ), \ @@ -2506,6 +2516,23 @@ void SvxSearchDialog::SaveToModule_Impl() rBindings.GetDispatcher()->Execute( SID_SEARCH_ITEM, SFX_CALLMODE_SLOT, ppArgs ); } +//IAccessible2 Implementation 2009----- +::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > + SvxSearchDialog::GetComponentInterface( sal_Bool bCreate ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer + (Window::GetComponentInterface(false)); + if ( !xPeer.is() && bCreate ) + { + ::com::sun::star::awt::XWindowPeer* mxPeer = new VCLXSvxFindReplaceDialog(this); + SetComponentInterface(mxPeer); + return mxPeer; + } + else + return xPeer; +} +//-----IAccessible2 Implementation 2009 + // class SvxSearchDialogWrapper ------------------------------------------ SFX_IMPL_CHILDWINDOW(SvxSearchDialogWrapper, SID_SEARCH_DLG); diff --git a/svx/source/inc/AccessibleFrameSelector.hxx b/svx/source/inc/AccessibleFrameSelector.hxx index 8faf364cb7d0..4be644c39a0a 100644 --- a/svx/source/inc/AccessibleFrameSelector.hxx +++ b/svx/source/inc/AccessibleFrameSelector.hxx @@ -108,16 +108,13 @@ public: void Invalidate(); void NotifyFocusListeners(sal_Bool bGetFocus); + void NotifyAccessibleEvent( const sal_Int16 _nEventId, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Any& _rNewValue ); protected: DECL_LINK( WindowEventListener, VclSimpleEvent* ); virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); - void NotifyAccessibleEvent( const sal_Int16 _nEventId, - const ::com::sun::star::uno::Any& _rOldValue, - const ::com::sun::star::uno::Any& _rNewValue ); - private: void IsValid() throw (::com::sun::star::uno::RuntimeException); diff --git a/svx/source/inc/svxpixelctlaccessiblecontext.hxx b/svx/source/inc/svxpixelctlaccessiblecontext.hxx new file mode 100644 index 000000000000..095865fd2b8a --- /dev/null +++ b/svx/source/inc/svxpixelctlaccessiblecontext.hxx @@ -0,0 +1,431 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright IBM Corporation 2010. + * 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 _SVXPIXELACCESSIBLECONTEXT_HXX +#define _SVXPIXELACCESSIBLECONTEXT_HXX + +#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_ +#include <com/sun/star/accessibility/XAccessible.hpp> +#endif +#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECOMPONENT_HPP_ +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#endif +#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECONTEXT_HPP_ +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#endif +#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEEVENTBROADCASTER_HPP_ +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#endif +#ifndef _COM_SUN_STAR_ACCESSIBILITY_ILLEGALACCESSIBLECOMPONENTSTATEEXCEPTION_HPP_ +#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp> +#endif +#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLESELECTION_HPP_ +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#endif +#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEVALUE_HPP_ +#include <com/sun/star/accessibility/XAccessibleValue.hpp> +#endif + +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_ +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_ +#include <com/sun/star/uno/Reference.hxx> +#endif +#ifndef _CPPUHELPER_WEAK_HXX_ +#include <cppuhelper/weak.hxx> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_ +#include <com/sun/star/lang/XServiceName.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_INDEXOUTOFBOUNDSEXCEPTION_HPP_ +#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ +#include <com/sun/star/lang/DisposedException.hpp> +#endif +#ifndef _VOS_MUTEX_HXX_ +#include <vos/mutex.hxx> +#endif +#ifndef _CPPUHELPER_INTERFACECONTAINER_H_ +#include <cppuhelper/interfacecontainer.h> +#endif +#ifndef _CPPUHELPER_COMPBASE6_HXX_ +#include <cppuhelper/compbase6.hxx> +#endif +#ifndef _CPPUHELPER_COMPBASE7_HXX_ +#include <cppuhelper/compbase7.hxx> +#endif +#ifndef _CPPUHELPER_COMPBASE5_HXX_ +#include <cppuhelper/compbase5.hxx> +#endif +#ifndef _COMPHELPER_BROADCASTHELPER_HXX_ +#include <comphelper/broadcasthelper.hxx> +#endif +#ifndef _CPPUHELPER_IMPLBASE6_HXX_ +#include <cppuhelper/implbase6.hxx> +#endif +#include <comphelper/servicehelper.hxx> + +//#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLETABLE_HPP_ +//#include <com/sun/star/accessibility/XAccessibleTable.hpp> +//#endif + +#ifndef _SVX_RECTENUM_HXX //autogen +#include <rectenum.hxx> +#endif + + +#include <tools/gen.hxx> + + +namespace com { namespace sun { namespace star { namespace awt { + struct Point; + struct Rectangle; + struct Size; + class XFocusListener; +} } } }; +class SvxPixelCtl; + + +typedef ::cppu::WeakAggComponentImplHelper5< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleComponent, + ::com::sun::star::accessibility::XAccessibleContext, + ::com::sun::star::accessibility::XAccessibleEventBroadcaster, + ::com::sun::star::lang::XServiceInfo > + SvxPixelCtlAccessibleChild_BASE; + +class SvxPixelCtlAccessibleChild : + public ::comphelper::OBaseMutex, + public SvxPixelCtlAccessibleChild_BASE +{ + SvxPixelCtl* mrParentWindow; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent; + void IsValid() throw (::com::sun::star::uno::RuntimeException); + sal_Bool m_bPixelColorOrBG;//Pixel Color Or BackGround Color + Point maPoint; + Rectangle* mpBoundingBox; + /// index of child in parent + long mnIndexInParent; + /// Mutex guarding this object. + ::osl::Mutex m_aMutex; +public: + SvxPixelCtlAccessibleChild( + SvxPixelCtl* rWindow, + sal_Bool bPixelColorOrBG, + const Point& aPoint, + const Rectangle& rBounds, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xParent, + long nIndexInParent ); + ~SvxPixelCtlAccessibleChild(); + + //XAccessible + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) 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::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::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); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::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 sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + + //XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + + //Methods for XAccessibleEventBroadcaster + sal_uInt32 mnClientId; + + virtual void SAL_CALL + addEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) + throw( com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + removeEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) + throw( com::sun::star::uno::RuntimeException ); + void CommitChange( const com::sun::star::accessibility::AccessibleEventObject& rEvent ); + + //Solution: Add the event handling method + void FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew); + virtual void SAL_CALL disposing(); + + virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException ); + + virtual Rectangle GetBoundingBox( void ) throw( ::com::sun::star::uno::RuntimeException ); + + /// @returns true if it's disposed or in disposing + inline sal_Bool IsAlive( void ) const; + /// @returns true if it's not disposed and no in disposing + inline sal_Bool IsNotAlive( void ) const; + /// throws the exception DisposedException if it's not alive + void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException ); + + + void CheckChild(); + void SelectChild( sal_Bool bSelect); + void ChangePixelColorOrBG(sal_Bool bPixelColorOrBG){ m_bPixelColorOrBG = bPixelColorOrBG ;} + ::rtl::OUString GetName(); +}; + + +typedef ::cppu::WeakAggComponentImplHelper6< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleComponent, + ::com::sun::star::accessibility::XAccessibleContext, + ::com::sun::star::accessibility::XAccessibleEventBroadcaster, + ::com::sun::star::accessibility::XAccessibleSelection, +// ::com::sun::star::accessibility::XAccessibleTable, + ::com::sun::star::lang::XServiceInfo > + SvxPixelCtlAccessible_BASE; + +class SvxPixelCtlAccessible : + public ::comphelper::OBaseMutex, + public SvxPixelCtlAccessible_BASE +{ + SvxPixelCtl* pPixelCtl; + void IsValid() throw (::com::sun::star::uno::RuntimeException); + +public: + SvxPixelCtlAccessible(SvxPixelCtl& rWindow); + ~SvxPixelCtlAccessible(); + + void ensureIsAlive() const throw ( ::com::sun::star::lang::DisposedException ); + + //XAccessible + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) 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::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::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); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::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 sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + //XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); + // XAccessibleSelection + void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); + void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); + sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + +/* + // XAccessibleTable ------------------------------------------------------- + /-** @return The number of used rows in the table (0 = empty table). *-/ + virtual sal_Int32 SAL_CALL getAccessibleRowCount() throw ( ::com::sun::star::uno::RuntimeException ); + /-** @return The number of used columns in the table (0 = empty table). *-/ + virtual sal_Int32 SAL_CALL getAccessibleColumnCount() throw ( ::com::sun::star::uno::RuntimeException ); + /-** @return The row extent of the specified cell (always 1). *-/ + virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + /-** @return The column extent of the specified cell (always 1). *-/ + virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + /-** @return The caption cell of the table (not supported). *-/ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleCaption() throw ( ::com::sun::star::uno::RuntimeException ); + /-** @return The summary object of the table (not supported). *-/ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleSummary() throw ( ::com::sun::star::uno::RuntimeException ); + /-** @return The child index of the specified cell. *-/ + virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException ); + /-** @return The row index of the specified child cell. *-/ + virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException ); + /-** @return The column index of the specified child cell. *-/ + virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException ); + /-** @return The description text of the specified row. *-/ + virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException ); + /-** @return The description text of the specified column. *-/ + virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException ); + /-** @return The XAccessibleTable interface of the row header bar. *-/ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL + getAccessibleRowHeaders() throw ( ::com::sun::star::uno::RuntimeException ); + /-** @return The XAccessibleTable interface of the column header bar. *-/ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL + getAccessibleColumnHeaders() throw ( ::com::sun::star::uno::RuntimeException ); + /-** @return An index list of completely selected rows. *-/ + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL + getSelectedAccessibleRows() throw ( ::com::sun::star::uno::RuntimeException ); + /-** @return An index list of completely selected columns. *-/ + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL + getSelectedAccessibleColumns() throw ( ::com::sun::star::uno::RuntimeException ); + /-** @return <TRUE/>, if the specified row is completely selected. *-/ + virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException ); + /-** @return <TRUE/>, if the specified column is completely selected. *-/ + virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException ); + /-** @return The XAccessible interface of the cell object at the specified cell position. *-/ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + /-** @return <TRUE/>, if the specified cell is selected. *-/ + virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException ); + +*/ + //Methods for XAccessibleEventBroadcaster + sal_uInt32 mnClientId; + + virtual void SAL_CALL + addEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) + throw( com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL + removeEventListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) + throw( com::sun::star::uno::RuntimeException ); + void CommitChange( const com::sun::star::accessibility::AccessibleEventObject& rEvent ); + //Solution: Add the event handling method + void FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew); + virtual void SAL_CALL disposing(); + + /// select child + void SelectChild( Point pos ); + void SelectChild( long nIndex); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreateChild (long nIndex, Point mPoint); + + + void LoseFocus(); + + void Invalidate(); + /// @returns true if it's disposed or in disposing + inline sal_Bool IsAlive( void ) const; + /// @returns true if it's not disposed and no in disposing + inline sal_Bool IsNotAlive( void ) const; + /// throws the exception DisposedException if it's not alive + void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException ); + +protected: + /** @attention This method requires locked mutex's and a living object. + @throws <type>IndexOutOfBoundsException</type> + If the specified row index is invalid. */ + void ensureIsValidRow( sal_Int32 nRow ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); + /** @attention This method requires locked mutex's and a living object. + @throws <type>IndexOutOfBoundsException</type> + If the specified column index is invalid. */ + void ensureIsValidColumn( sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); + /** @attention This method requires locked mutex's and a living object. + @throws <type>IndexOutOfBoundsException</type> + If the specified cell address is invalid. */ + void ensureIsValidAddress( sal_Int32 nRow, sal_Int32 nColumn ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); + /** @attention This method requires locked mutex's and a living object. + @throws <type>IndexOutOfBoundsException</type> + If the specified child index is invalid. */ + void ensureIsValidIndex( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); + + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> m_xCurChild; +public: + void NotifyChild(long nIndex,sal_Bool bSelect ,sal_Bool bCheck); +}; + +inline sal_Bool SvxPixelCtlAccessible::IsAlive( void ) const +{ + return !rBHelper.bDisposed && !rBHelper.bInDispose; +} + +inline sal_Bool SvxPixelCtlAccessible::IsNotAlive( void ) const +{ + return rBHelper.bDisposed || rBHelper.bInDispose; +} + +inline sal_Bool SvxPixelCtlAccessibleChild::IsAlive( void ) const +{ + return !rBHelper.bDisposed && !rBHelper.bInDispose; +} + +inline sal_Bool SvxPixelCtlAccessibleChild::IsNotAlive( void ) const +{ + return rBHelper.bDisposed || rBHelper.bInDispose; +} + + +#endif diff --git a/svx/source/inc/svxrectctaccessiblecontext.hxx b/svx/source/inc/svxrectctaccessiblecontext.hxx index cda407c58e4c..e96ab781a4dc 100644 --- a/svx/source/inc/svxrectctaccessiblecontext.hxx +++ b/svx/source/inc/svxrectctaccessiblecontext.hxx @@ -43,9 +43,14 @@ #include <vos/mutex.hxx> #include <cppuhelper/interfacecontainer.h> #include <cppuhelper/compbase6.hxx> -//#ifndef _CPPUHELPER_COMPBASE7_HXX_ -//#include <cppuhelper/compbase7.hxx> -//#endif +//IAccessibility2 Implementation 2009----- +#ifndef _CPPUHELPER_COMPBASE7_HXX_ +#include <cppuhelper/compbase7.hxx> +#endif +#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_ACTION_HPP_ +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#endif +//-----IAccessibility2 Implementation 2009 #include <comphelper/broadcasthelper.hxx> #include <cppuhelper/implbase6.hxx> #include <comphelper/servicehelper.hxx> @@ -250,7 +255,10 @@ protected: @param nIndexOfChild Index of the new child which should be selected. */ - void selectChild( long nIndexOfChild ); + // IAccessibility2 implementation 2009. ------ + //void selectChild( long nIndexOfChild ); + void selectChild( long nIndexOfChild, sal_Bool bFireFocus = sal_True); + // ------ IAccessibility2 implementation 2009. public: /** Selects a new child by point. @@ -261,8 +269,13 @@ public: @param eButton Button which belongs to the child which should be selected. */ - void selectChild( RECT_POINT ePoint ); - + //void selectChild( RECT_POINT ePoint ); + // IAccessibility2 implementation 2009. ------ + void selectChild( RECT_POINT ePoint, sal_Bool bFireFocus = sal_True ); + void FireChildFocus( RECT_POINT eButton ); + //Solution: Add the event handling method + void FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew); + // ------ IAccessibility2 implementation 2009. /// Sets the name void setName( const ::rtl::OUString& rName ); @@ -332,15 +345,17 @@ inline sal_Bool SvxRectCtlAccessibleContext::IsNotAlive( void ) const return rBHelper.bDisposed || rBHelper.bInDispose; } - -typedef ::cppu::WeakAggComponentImplHelper6< +//IAccessibility2 Implementation 2009----- +typedef ::cppu::WeakAggComponentImplHelper7< ::com::sun::star::accessibility::XAccessible, ::com::sun::star::accessibility::XAccessibleComponent, ::com::sun::star::accessibility::XAccessibleContext, ::com::sun::star::accessibility::XAccessibleEventBroadcaster, ::com::sun::star::accessibility::XAccessibleValue, + ::com::sun::star::accessibility::XAccessibleAction, ::com::sun::star::lang::XServiceInfo > SvxRectCtlChildAccessibleContext_Base; +//-----IAccessibility2 Implementation 2009 class SvxRectCtlChildAccessibleContext : public SvxRectCtlChildAccessibleContext_Base @@ -472,6 +487,13 @@ public: virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue() throw( ::com::sun::star::uno::RuntimeException ); +//IAccessibility2 Implementation 2009----- + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); +//-----IAccessibility2 Implementation 2009 //===== XServiceInfo ==================================================== virtual ::rtl::OUString SAL_CALL @@ -492,8 +514,11 @@ public: //===== internal ========================================================== /// Sets the checked status - void setStateChecked( sal_Bool bChecked ); - + //void setStateChecked( sal_Bool bChecked ); + // IAccessibility2 implementation 2009. ------ + void setStateChecked( sal_Bool bChecked, sal_Bool bFireFocus = sal_True); + void FireFocusEvent(); + // ------ IAccessibility2 implementation 2009. protected: virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException ); diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx index 75a345112917..ff52b1fcd58d 100755 --- a/svx/source/sidebar/nbdtmg.cxx +++ b/svx/source/sidebar/nbdtmg.cxx @@ -301,7 +301,7 @@ void NBOTypeMgrBase::StoreMapUnit_impl() { { eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE)); } else { - //Sym3_2508 sd use different sid for numbering rule + //sd use different sid for numbering rule eState = pSet->GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem); if(eState == SFX_ITEM_SET) { diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 7c6904e229f1..13ad95472836 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -3538,4 +3538,21 @@ void SdrObjCustomShape::InvalidateRenderGeometry() mpLastShadowGeometry = 0L; } +//IAccessibility2 Implementation 2009----- +::rtl::OUString SdrObjCustomShape::GetCustomShapeName() +{ + rtl::OUString sShapeName; + rtl::OUString aEngine( ( (SdrCustomShapeEngineItem&)( *this ).GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE ) ).GetValue() ); + if ( !aEngine.getLength() || aEngine.equalsAscii( "com.sun.star.drawing.EnhancedCustomShapeEngine" ) ) + { + rtl::OUString sShapeType; + const rtl::OUString sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) ); + SdrCustomShapeGeometryItem& rGeometryItem( (SdrCustomShapeGeometryItem&)( *this ).GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + Any* pAny = rGeometryItem.GetPropertyValueByName( sType ); + if ( pAny && ( *pAny >>= sShapeType ) ) + sShapeName = EnhancedCustomShapeTypeNames::GetAccName( sShapeType ); + } + return sShapeName; +} +//-----IAccessibility2 Implementation 2009 // eof diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 499445c99ced..1fad8b6f9684 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -3185,6 +3185,12 @@ bool SdrObject::HasText() const return false; } +//IAccessibility2 Implementation 2009----- +const SdrObject* SdrObject::GetCaptionObj() const +{ + return pCaptionObj; +} +//-----IAccessibility2 Implementation 2009 //////////////////////////////////////////////////////////////////////////////////////////////////// // // @@@@ @@@@@ @@@@@@ @@@@@ @@@@ @@@@ @@@@@@ @@@@ @@@@@ @@ @@ diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 2a6a7df2d7b2..e27baa596f69 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -844,7 +844,19 @@ void SdrOle2Obj::Init() } // ----------------------------------------------------------------------------- +//IAccessibility2 Implementation 2009----- +String SdrOle2Obj::GetStyleString() +{ + String strStyle; + if( xObjRef.is() && xObjRef.IsChart() ) + { + strStyle = xObjRef.GetChartType(); + } + return strStyle; +} +// ----------------------------------------------------------------------------- +//-----IAccessibility2 Implementation 2009 SdrOle2Obj::~SdrOle2Obj() { DBG_DTOR( SdrOle2Obj,NULL); diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx index 6fbb084e03c6..19cfff054f35 100644 --- a/svx/source/table/accessiblecell.cxx +++ b/svx/source/table/accessiblecell.cxx @@ -60,6 +60,8 @@ AccessibleCell::AccessibleCell( const ::com::sun::star::uno::Reference< ::com::s , mpText( NULL ) , mxCell( rCell ) { + //Init the pAccTable var + pAccTable = dynamic_cast <AccessibleTableShape *> (rxParent.get()); } // -------------------------------------------------------------------- @@ -242,7 +244,41 @@ Reference<XAccessibleStateSet> SAL_CALL AccessibleCell::getAccessibleStateSet (v else pStateSet->RemoveState (AccessibleStateType::FOCUSED); } + // Set the invisible state for merged cell + if (mxCell.is() && mxCell->isMerged()) + pStateSet->RemoveState(AccessibleStateType::VISIBLE); + else + pStateSet->AddState(AccessibleStateType::VISIBLE); + + //IAccessibility2 Implementation 2009----- + //Solution:Just when the parent table is not read-only,set states EDITABLE,RESIZABLE,MOVEABLE + ::com::sun::star::uno::Reference<XAccessible> xTempAcc = getAccessibleParent(); + if( xTempAcc.is() ) + { + ::com::sun::star::uno::Reference<XAccessibleContext> + xTempAccContext = xTempAcc->getAccessibleContext(); + if( xTempAccContext.is() ) + { + ::com::sun::star::uno::Reference<XAccessibleStateSet> rState = + xTempAccContext->getAccessibleStateSet(); + if( rState.is() ) { + com::sun::star::uno::Sequence<short> pStates = rState->getStates(); + int count = pStates.getLength(); + for( int iIndex = 0;iIndex < count;iIndex++ ) + { + if( pStates[iIndex] == AccessibleStateType::EDITABLE ) + { + pStateSet->AddState (AccessibleStateType::EDITABLE); + pStateSet->AddState (AccessibleStateType::RESIZABLE); + pStateSet->AddState (AccessibleStateType::MOVEABLE); + break; + } + } + } + } + } + //-----IAccessibility2 Implementation 2009 // Create a copy of the state set that may be modified by the // caller without affecting the current state set. xStateSet = Reference<XAccessibleStateSet>(new ::utl::AccessibleStateSetHelper (*pStateSet)); @@ -566,6 +602,75 @@ sal_Int32 SAL_CALL AccessibleCell::getAccessibleIndexInParent (void) throw (Runt return mnIndexInParent; } +//IAccessibility2 Implementation 2009----- +sdr::table::CellRef AccessibleCell::getCellRef() +{ + return mxCell; +} +::rtl::OUString AccessibleCell::getCellName( sal_Int32 nCol, sal_Int32 nRow ) +{ + rtl::OUStringBuffer aBuf; + + if (nCol < 26*26) + { + if (nCol < 26) + aBuf.append( static_cast<sal_Unicode>( 'A' + + static_cast<sal_uInt16>(nCol))); + else + { + aBuf.append( static_cast<sal_Unicode>( 'A' + + (static_cast<sal_uInt16>(nCol) / 26) - 1)); + aBuf.append( static_cast<sal_Unicode>( 'A' + + (static_cast<sal_uInt16>(nCol) % 26))); + } + } + else + { + String aStr; + while (nCol >= 26) + { + sal_Int32 nC = nCol % 26; + aStr += static_cast<sal_Unicode>( 'A' + + static_cast<sal_uInt16>(nC)); + nCol = nCol - nC; + nCol = nCol / 26 - 1; + } + aStr += static_cast<sal_Unicode>( 'A' + + static_cast<sal_uInt16>(nCol)); + aStr.Reverse(); + aBuf.append( aStr); + } + aBuf.append( OUString::valueOf(nRow+1) ); + return aBuf.makeStringAndClear(); +} +::rtl::OUString SAL_CALL AccessibleCell::getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException) +{ + ThrowIfDisposed (); + ::vos::OGuard aSolarGuard (::Application::GetSolarMutex()); + + if( pAccTable ) + try + { + sal_Int32 nRow = 0, nCol = 0; + pAccTable->getColumnAndRow(mnIndexInParent, nCol, nRow); + return getCellName( nCol, nRow ); + } + catch( Exception& ) + { + } + + return AccessibleCellBase::getAccessibleName(); +} +void AccessibleCell::UpdateChildren() +{ + if (mpText) + mpText->UpdateChildren(); +} +//-----IAccessibility2 Implementation 2009 + +/* MT: Above getAccessibleName was introduced with IA2 CWS, while below was introduce in 3.3 meanwhile. Check which one is correct +If this is correct, we also don't need sdr::table::CellRef getCellRef(), UpdateChildren(), getCellName( sal_Int32 nCol, sal_Int32 nRow ) above + ::rtl::OUString SAL_CALL AccessibleCell::getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException) { ThrowIfDisposed (); @@ -576,5 +681,6 @@ sal_Int32 SAL_CALL AccessibleCell::getAccessibleIndexInParent (void) throw (Runt return AccessibleCellBase::getAccessibleName(); } +*/ } // end of namespace accessibility diff --git a/svx/source/table/accessiblecell.hxx b/svx/source/table/accessiblecell.hxx index 3c545239b671..7bf00e25a9e1 100644 --- a/svx/source/table/accessiblecell.hxx +++ b/svx/source/table/accessiblecell.hxx @@ -43,6 +43,8 @@ #include <boost/noncopyable.hpp> +#include <svx/AccessibleTableShape.hxx> + class SdrObject; @@ -80,6 +82,9 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet(void) throw(::com::sun::star::uno::RuntimeException); virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(void) throw(::com::sun::star::uno::RuntimeException); virtual ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException); + sdr::table::CellRef getCellRef(); + void UpdateChildren(); + ::rtl::OUString getCellName( sal_Int32 nCol, sal_Int32 nRow ); // XAccessibleComponent virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint) throw (::com::sun::star::uno::RuntimeException); @@ -119,6 +124,8 @@ public: */ inline void setIndexInParent(sal_Int32 _nIndex) { mnIndexInParent = _nIndex; } + //Get the parent table + AccessibleTableShape* GetParentTable() { return pAccTable; } protected: /// Bundle of information passed to all shapes in a document tree. AccessibleShapeTreeInfo maShapeTreeInfo; @@ -134,6 +141,8 @@ protected: /// This method is called from the component helper base class while disposing. virtual void SAL_CALL disposing (void); + AccessibleTableShape *pAccTable; + private: explicit AccessibleCell(void); // not implemented explicit AccessibleCell(const AccessibleCell&); // not implemented diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx index f144186ec6c0..857e2d37aeeb 100644 --- a/svx/source/table/accessibletableshape.cxx +++ b/svx/source/table/accessibletableshape.cxx @@ -40,6 +40,11 @@ #include <algorithm> #include <cppuhelper/implbase1.hxx> +//IAccessibility2 Implementation 2009----- +#include <svx/svdotable.hxx> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +//-----IAccessibility2 Implementation 2009 using ::rtl::OUString; @@ -94,12 +99,21 @@ public: Reference< XTable > mxTable; AccessibleCellMap maChildMap; Reference< XAccessible> mxAccessible; + //IAccessibility2 Implementation 2009----- + sal_Int32 mRowCount, mColCount; + //get the cached AccessibleCell from XCell + Reference< AccessibleCell > getAccessibleCell (Reference< XCell > xCell); + //-----IAccessibility2 Implementation 2009 }; //----------------------------------------------------------------------------- AccessibleTableShapeImpl::AccessibleTableShapeImpl( AccessibleShapeTreeInfo& rShapeTreeInfo ) : mrShapeTreeInfo( rShapeTreeInfo ) +//IAccessibility2 Implementation 2009----- +, mRowCount(0) +, mColCount(0) +//-----IAccessibility2 Implementation 2009 { } @@ -114,6 +128,14 @@ void AccessibleTableShapeImpl::init( const Reference< XAccessible>& xAccessible, { Reference< XModifyListener > xListener( this ); mxTable->addModifyListener( xListener ); + //IAccessibility2 Implementation 2009----- + //register the listener with table model + Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(xTable, UNO_QUERY); + Reference< ::com::sun::star::view::XSelectionChangeListener > xSelListener( xAccessible, UNO_QUERY ); + if (xSelSupplier.is()) + xSelSupplier->addSelectionChangeListener(xSelListener); + mRowCount = mxTable->getRowCount(); + mColCount = mxTable->getColumnCount(); } } @@ -123,6 +145,12 @@ void AccessibleTableShapeImpl::dispose() { if( mxTable.is() ) { + //IAccessibility2 Implementation 2009-----, remove all the cell's acc object in table's dispose. + for( AccessibleCellMap::iterator iter( maChildMap.begin() ); iter != maChildMap.end(); iter++ ) + { + (*iter).second->dispose(); + } + //-----IAccessibility2 Implementation 2009 Reference< XModifyListener > xListener( this ); mxTable->removeModifyListener( xListener ); mxTable.clear(); @@ -131,7 +159,21 @@ void AccessibleTableShapeImpl::dispose() } //----------------------------------------------------------------------------- +//IAccessibility2 Implementation 2009-----, get the cached AccessibleCell from XCell +Reference< AccessibleCell > AccessibleTableShapeImpl::getAccessibleCell (Reference< XCell > xCell) +{ + AccessibleCellMap::iterator iter( maChildMap.find( xCell ) ); + if( iter != maChildMap.end() ) + { + Reference< AccessibleCell > xChild( (*iter).second.get() ); + return xChild; + } + return Reference< AccessibleCell >(); +} + +//----------------------------------------------------------------------------- +//-----IAccessibility2 Implementation 2009 Reference< XAccessible > AccessibleTableShapeImpl::getAccessibleChild( sal_Int32 nChildIndex ) throw(IndexOutOfBoundsException) { sal_Int32 nColumn = 0, nRow = 0; @@ -151,6 +193,9 @@ Reference< XAccessible > AccessibleTableShapeImpl::getAccessibleChild( sal_Int32 rtl::Reference< AccessibleCell > xAccessibleCell( new AccessibleCell( mxAccessible, xCellRef, nChildIndex, mrShapeTreeInfo ) ); + //IAccessibility2 Implementation 2009----- + xAccessibleCell->Init(); + //-----IAccessibility2 Implementation 2009 maChildMap[xCell] = xAccessibleCell; xAccessibleCell->Init(); @@ -197,6 +242,15 @@ void SAL_CALL AccessibleTableShapeImpl::modified( const EventObject& /*aEvent*/ const sal_Int32 nRowCount = mxTable->getRowCount(); const sal_Int32 nColCount = mxTable->getColumnCount(); + //IAccessibility2 Implementation 2009----- + sal_Bool bRowOrColumnChanged = sal_False; + if (mRowCount != nRowCount || mColCount != nColCount ) + { + bRowOrColumnChanged = sal_True; + mRowCount = nRowCount; + mColCount = nColCount; + } + //-----IAccessibility2 Implementation 2009 sal_Int32 nChildIndex = 0; for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow ) @@ -210,12 +264,49 @@ void SAL_CALL AccessibleTableShapeImpl::modified( const EventObject& /*aEvent*/ { rtl::Reference< AccessibleCell > xAccessibleCell( (*iter).second ); xAccessibleCell->setIndexInParent( nChildIndex ); - xAccessibleCell->CommitChange(AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), Any()); + //IAccessibility2 Implementation 2009-----, the children may need to updated + //xAccessibleCell->CommitChange(AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), Any()); + xAccessibleCell->UpdateChildren(); + // If row or column count is changed, there is split or merge, so all cell's acc name should be updated + if (bRowOrColumnChanged) + { + xAccessibleCell->SetAccessibleName(xAccessibleCell->getAccessibleName(), AccessibleContextBase::ManuallySet); + } + // For merged cell, add invisible & disabled state. + Reference< XMergeableCell > xMergedCell( mxTable->getCellByPosition( nCol, nRow ), UNO_QUERY ); + if (xMergedCell.is() && xMergedCell->isMerged()) + { + xAccessibleCell->ResetState(AccessibleStateType::VISIBLE); + xAccessibleCell->ResetState(AccessibleStateType::ENABLED); + // IA2 CWS. MT: OFFSCREEN == !SHOWING, should stay consistent + // xAccessibleCell->SetState(AccessibleStateType::OFFSCREEN); + xAccessibleCell->ResetState(AccessibleStateType::SHOWING); + } + else + { + xAccessibleCell->SetState(AccessibleStateType::VISIBLE); + xAccessibleCell->SetState(AccessibleStateType::ENABLED); + // IA2 CWS. MT: OFFSCREEN == !SHOWING, should stay consistent + // xAccessibleCell->ResetState(AccessibleStateType::OFFSCREEN); + xAccessibleCell->SetState(AccessibleStateType::SHOWING); + } + //-----IAccessibility2 Implementation 2009 // move still existing cell from temporary child map to our child map maChildMap[xCell] = xAccessibleCell; aTempChildMap.erase( iter ); } + //IAccessibility2 Implementation 2009-----, need to add the new added cell on demand + else + { + CellRef xCellRef( dynamic_cast< Cell* >( xCell.get() ) ); + + rtl::Reference< AccessibleCell > xAccessibleCell( new AccessibleCell( mxAccessible, xCellRef, nChildIndex, mrShapeTreeInfo ) ); + + xAccessibleCell->Init(); + maChildMap[xCell] = xAccessibleCell; + } + //-----IAccessibility2 Implementation 2009 ++nChildIndex; } @@ -228,6 +319,10 @@ void SAL_CALL AccessibleTableShapeImpl::modified( const EventObject& /*aEvent*/ { (*iter).second->dispose(); } + //IAccessibility2 Implementation 2009-----, notify bridge to update the acc cache. + AccessibleTableShape *pAccTable = dynamic_cast <AccessibleTableShape *> (mxAccessible.get()); + pAccTable->CommitChange(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any()); + //-----IAccessibility2 Implementation 2009 } catch( Exception& ) { @@ -264,7 +359,7 @@ void AccessibleTableShape::Init() { try { - + mnPreviousSelectionCount = 0; Reference< XPropertySet > xSet( mxShape, UNO_QUERY_THROW ); Reference< XTable > xTable( xSet->getPropertyValue(C2U("Model")), UNO_QUERY_THROW ); @@ -295,6 +390,16 @@ SvxTableController* AccessibleTableShape::getTableController() Any SAL_CALL AccessibleTableShape::queryInterface( const Type& aType ) throw (RuntimeException) { + //IAccessibility2 Implementation 2009----- + if ( aType == ::getCppuType((Reference<XAccessibleTableSelection> *)0) ) + { + Reference<XAccessibleTableSelection> xThis( this ); + Any aRet; + aRet <<= xThis; + return aRet; + } + else + //-----IAccessibility2 Implementation 2009 return AccessibleTableShape_Base::queryInterface( aType ); } @@ -331,7 +436,7 @@ OUString SAL_CALL AccessibleTableShape::getImplementationName(void) throw (Runti OUString AccessibleTableShape::CreateAccessibleBaseName(void) throw (RuntimeException) { - return OUString (RTL_CONSTASCII_USTRINGPARAM("TableShape"));; + return OUString (RTL_CONSTASCII_USTRINGPARAM("TableShape")); } //-------------------------------------------------------------------- @@ -443,7 +548,19 @@ sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleColumnExtentAt( sal_Int32 Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleRowHeaders( ) throw (RuntimeException) { - Reference< XAccessibleTable > xRet( this ); // todo + //IAccessibility2 Implementation 2009----- + //Reference< XAccessibleTable > xRet( this ); // todo + Reference< XAccessibleTable > xRet; + SvxTableController* pController = getTableController(); + if( pController ) + { + if( pController->isRowHeader() ) + { + AccessibleTableHeaderShape* pTableHeader = new AccessibleTableHeaderShape( this, sal_True ); + xRet.set( pTableHeader ); + } + } + //-----IAccessibility2 Implementation 2009 return xRet; } @@ -451,7 +568,19 @@ Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleRowHea Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleColumnHeaders( ) throw (RuntimeException) { - Reference< XAccessibleTable > xRet( this ); // todo + //IAccessibility2 Implementation 2009----- + //Reference< XAccessibleTable > xRet( this ); // todo + Reference< XAccessibleTable > xRet; + SvxTableController* pController = getTableController(); + if( pController ) + { + if( pController->isColumnHeader() ) + { + AccessibleTableHeaderShape* pTableHeader = new AccessibleTableHeaderShape( this, sal_False ); + xRet.set( pTableHeader ); + } + } + //-----IAccessibility2 Implementation 2009 return xRet; } @@ -459,16 +588,80 @@ Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleColumn Sequence< sal_Int32 > SAL_CALL AccessibleTableShape::getSelectedAccessibleRows( ) throw (RuntimeException) { - Sequence< sal_Int32 > aRet; + //IAccessibility2 Implementation 2009----- + /*Sequence< sal_Int32 > aRet;*/ + sal_Int32 nRow = getAccessibleRowCount(); + ::std::vector< sal_Bool > aSelected( nRow, sal_True ); + sal_Int32 nCount = nRow; + for( sal_Int32 i = 0; i < nRow; i++ ) + { + try + { + aSelected[i] = isAccessibleRowSelected( i ); + } + catch( ... ) + { + return Sequence< sal_Int32 >(); + } + + if( !aSelected[i] ) + nCount--; + } + Sequence < sal_Int32 > aRet( nCount ); + sal_Int32 *pRet = aRet.getArray(); + sal_Int32 nPos = 0; + size_t nSize = aSelected.size(); + for( size_t i=0; i < nSize && nPos < nCount; i++ ) + { + if( aSelected[i] ) + { + *pRet++ = i; + nPos++; + } + } + return aRet; + //-----IAccessibility2 Implementation 2009 } //-------------------------------------------------------------------- Sequence< sal_Int32 > SAL_CALL AccessibleTableShape::getSelectedAccessibleColumns( ) throw (RuntimeException) { - Sequence< sal_Int32 > aRet; + //IAccessibility2 Implementation 2009----- + /*Sequence< sal_Int32 > aRet;*/ + sal_Int32 nColumn = getAccessibleColumnCount(); + ::std::vector< sal_Bool > aSelected( nColumn, sal_True ); + sal_Int32 nCount = nColumn; + for( sal_Int32 i = 0; i < nColumn; i++ ) + { + try + { + aSelected[i] = isAccessibleColumnSelected( i ); + } + catch( ... ) + { + return Sequence< sal_Int32 >(); + } + + if( !aSelected[i] ) + nCount--; + } + Sequence < sal_Int32 > aRet( nCount ); + sal_Int32 *pRet = aRet.getArray(); + sal_Int32 nPos = 0; + size_t nSize = aSelected.size(); + for( size_t i=0; i < nSize && nPos < nCount; i++ ) + { + if( aSelected[i] ) + { + *pRet++ = i; + nPos++; + } + } + return aRet; + //-----IAccessibility2 Implementation 2009 } //-------------------------------------------------------------------- @@ -477,6 +670,13 @@ sal_Bool SAL_CALL AccessibleTableShape::isAccessibleRowSelected( sal_Int32 nRow { ::vos::OGuard aSolarGuard (::Application::GetSolarMutex()); checkCellPosition( 0, nRow ); + //IAccessibility2 Implementation 2009----- + SvxTableController* pController = getTableController(); + if( pController ) + { + return pController->isRowSelected( nRow ); + } + //-----IAccessibility2 Implementation 2009 return sal_False; } @@ -486,6 +686,13 @@ sal_Bool SAL_CALL AccessibleTableShape::isAccessibleColumnSelected( sal_Int32 nC { ::vos::OGuard aSolarGuard (::Application::GetSolarMutex()); checkCellPosition( nColumn, 0 ); + //IAccessibility2 Implementation 2009----- + SvxTableController* pController = getTableController(); + if( pController ) + { + return pController->isColumnSelected( nColumn ); + } + //-----IAccessibility2 Implementation 2009 return sal_False; } @@ -564,7 +771,10 @@ sal_Int32 SAL_CALL AccessibleTableShape::getAccessibleColumn( sal_Int32 nChildIn ::vos::OGuard aSolarGuard (::Application::GetSolarMutex()); sal_Int32 nColumn = 0, nRow = 0; mxImpl->getColumnAndRow( nChildIndex, nColumn, nRow ); - return nChildIndex; + //IAccessibility2 Implementation 2009----- + //return nChildIndex; + return nColumn; + //-----IAccessibility2 Implementation 2009 } //-------------------------------------------------------------------- @@ -603,7 +813,11 @@ sal_Bool SAL_CALL AccessibleTableShape::isAccessibleChildSelected( sal_Int32 nCh CellPos aPos; mxImpl->getColumnAndRow( nChildIndex, aPos.mnCol, aPos.mnRow ); - return isAccessibleSelected(aPos.mnCol, aPos.mnRow); + //IAccessibility2 Implementation 2009----- + // Para order is not correct + //return isAccessibleSelected(aPos.mnCol, aPos.mnRow); + return isAccessibleSelected(aPos.mnRow, aPos.mnCol); + //-----IAccessibility2 Implementation 2009 } //-------------------------------------------------------------------- @@ -654,7 +868,8 @@ Reference< XAccessible > SAL_CALL AccessibleTableShape::getSelectedAccessibleChi { ::vos::OGuard aSolarGuard (::Application::GetSolarMutex()); - SvxTableController* pController = getTableController(); + //IAccessibility2 Implementation 2009----- + /*SvxTableController* pController = getTableController(); if( pController && pController->hasSelectedCells() ) { CellPos aFirstPos, aLastPos; @@ -675,6 +890,22 @@ Reference< XAccessible > SAL_CALL AccessibleTableShape::getSelectedAccessibleChi } throw IndexOutOfBoundsException(); + */ + if( nSelectedChildIndex < 0 ) + throw IndexOutOfBoundsException(); + + sal_Int32 nChildIndex = GetIndexOfSelectedChild( nSelectedChildIndex ); + + if( nChildIndex < 0 ) + throw IndexOutOfBoundsException(); + + if ( nChildIndex >= getAccessibleChildCount() ) + { + throw IndexOutOfBoundsException(); + } + + return getAccessibleChild( nChildIndex ); + //-----IAccessibility2 Implementation 2009 } //-------------------------------------------------------------------- @@ -705,9 +936,180 @@ void SAL_CALL AccessibleTableShape::deselectAccessibleChild( sal_Int32 nChildInd pController->setSelectedCells( aFirstPos, aLastPos ); } } - //-------------------------------------------------------------------- +//IAccessibility2 Implementation 2009----- +//===== XAccessibleTableSelection ============================================ +sal_Bool SAL_CALL AccessibleTableShape::selectRow( sal_Int32 row ) +throw (IndexOutOfBoundsException, RuntimeException) +{ + ::vos::OGuard aSolarGuard (::Application::GetSolarMutex()); + SvxTableController* pController = getTableController(); + if( !pController ) + return sal_False; + return pController->selectRow( row ); +} +sal_Bool SAL_CALL AccessibleTableShape::selectColumn( sal_Int32 column ) +throw (IndexOutOfBoundsException, RuntimeException) +{ + ::vos::OGuard aSolarGuard (::Application::GetSolarMutex()); + SvxTableController* pController = getTableController(); + if( !pController ) + return sal_False; + return pController->selectColumn( column ); +} +sal_Bool SAL_CALL AccessibleTableShape::unselectRow( sal_Int32 row ) +throw (IndexOutOfBoundsException, RuntimeException) +{ + ::vos::OGuard aSolarGuard (::Application::GetSolarMutex()); + SvxTableController* pController = getTableController(); + if( !pController ) + return sal_False; + return pController->deselectRow( row ); +} +sal_Bool SAL_CALL AccessibleTableShape::unselectColumn( sal_Int32 column ) +throw (IndexOutOfBoundsException, RuntimeException) +{ + ::vos::OGuard aSolarGuard (::Application::GetSolarMutex()); + SvxTableController* pController = getTableController(); + if( !pController ) + return sal_False; + return pController->deselectColumn( column ); +} +sal_Int32 AccessibleTableShape::GetIndexOfSelectedChild( + sal_Int32 nSelectedChildIndex ) const +{ + sal_Int32 nChildren = const_cast<AccessibleTableShape*>(this)->getAccessibleChildCount(); + + if( nSelectedChildIndex >= nChildren ) + return -1L; + + sal_Int32 n = 0; + while( n < nChildren ) + { + if( const_cast<AccessibleTableShape*>(this)->isAccessibleChildSelected( n ) ) + { + if( 0 == nSelectedChildIndex ) + break; + else + --nSelectedChildIndex; + } + ++n; + } + + return n < nChildren ? n : -1L; +} +void AccessibleTableShape::getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (IndexOutOfBoundsException ) +{ + mxImpl->getColumnAndRow(nChildIndex, rnColumn, rnRow); +} +//-------------------------------------------------------------------- +// XSelectionChangeListener +void SAL_CALL + AccessibleTableShape::disposing (const EventObject& aEvent) + throw (RuntimeException) +{ + AccessibleShape::disposing(aEvent); +} +void SAL_CALL AccessibleTableShape::selectionChanged (const EventObject& rEvent) + throw (RuntimeException) +{ + //::sdr::table::CellRef xCellRef = static_cast< ::sdr::table::CellRef > (rEvent.Source); + Reference< XCell > xCell(rEvent.Source, UNO_QUERY); + if (xCell.is()) + { + Reference< AccessibleCell > xAccCell = mxImpl->getAccessibleCell( xCell ); + if (xAccCell.is()) + { + sal_Int32 nIndex = xAccCell->getAccessibleIndexInParent(), + nCount = getSelectedAccessibleChildCount(); + sal_Bool bSelected = isAccessibleChildSelected(nIndex); + if (mnPreviousSelectionCount == 0 && nCount > 0 && bSelected) + { + xAccCell->SetState(AccessibleStateType::SELECTED); + xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED, Any(), Any()); + } + else if (bSelected) + { + xAccCell->SetState(AccessibleStateType::SELECTED); + xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD, Any(), Any()); + } + else + { + xAccCell->ResetState(AccessibleStateType::SELECTED); + xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, Any(), Any()); + } + mnPreviousSelectionCount = nCount; + } + } +} +// Get the currently active cell which is text editing +AccessibleCell* AccessibleTableShape::GetActiveAccessibleCell() +{ + sal_Bool bCellEditing = sal_False; + Reference< AccessibleCell > xAccCell; + AccessibleCell* pAccCell = NULL; + SvxTableController* pController = getTableController(); + if (pController) + { + ::sdr::table::SdrTableObj* pTableObj = pController->GetTableObj(); + if ( pTableObj ) + { + ::sdr::table::CellRef xCellRef (pTableObj->getActiveCell()); + if ( xCellRef.is() ) + { + bCellEditing = xCellRef->IsTextEditActive(); + if (bCellEditing) + { + //Reference< XCell > xCell(xCellRef.get(), UNO_QUERY); + xAccCell = mxImpl->getAccessibleCell(Reference< XCell >( xCellRef.get() )); + if (xAccCell.is()) + pAccCell = xAccCell.get(); + } + } + } + } + return pAccCell; +} +//-------------------------------------------------------------------- +//If current active cell is in editing, the focus state should be set to internal text +sal_Bool AccessibleTableShape::SetState (sal_Int16 aState) +{ + AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell(); + sal_Bool bStateHasChanged = sal_False; + if (aState == AccessibleStateType::FOCUSED && pActiveAccessibleCell != NULL) + { + return pActiveAccessibleCell->SetState(aState); + } + else + bStateHasChanged = AccessibleShape::SetState (aState); + return bStateHasChanged; +} +//-------------------------------------------------------------------- +//If current active cell is in editing, the focus state should be reset to internal text +sal_Bool AccessibleTableShape::ResetState (sal_Int16 aState) +{ + AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell(); + sal_Bool bStateHasChanged = sal_False; + if (aState == AccessibleStateType::FOCUSED && pActiveAccessibleCell != NULL) + { + return pActiveAccessibleCell->ResetState(aState); + } + else + bStateHasChanged = AccessibleShape::ResetState (aState); + return bStateHasChanged; +} +//-------------------------------------------------------------------- +sal_Bool AccessibleTableShape::SetStateDirectly (sal_Int16 aState) +{ + return AccessibleContextBase::SetState (aState); +} +//-------------------------------------------------------------------- +sal_Bool AccessibleTableShape::ResetStateDirectly (sal_Int16 aState) +{ + return AccessibleContextBase::ResetState (aState); +} +//-----IAccessibility2 Implementation 2009 void AccessibleTableShape::checkCellPosition( sal_Int32 nCol, sal_Int32 nRow ) throw ( IndexOutOfBoundsException ) { if( (nCol >= 0) && (nRow >= 0) && mxImpl->mxTable.is() && (nCol < mxImpl->mxTable->getColumnCount()) && (nRow < mxImpl->mxTable->getRowCount()) ) @@ -716,4 +1118,333 @@ void AccessibleTableShape::checkCellPosition( sal_Int32 nCol, sal_Int32 nRow ) t throw IndexOutOfBoundsException(); } +//IAccessibility2 Implementation 2009----- +AccessibleTableHeaderShape::AccessibleTableHeaderShape( AccessibleTableShape* pTable, sal_Bool bRow ) +{ + mpTable = pTable; + mbRow = bRow; +} + +AccessibleTableHeaderShape::~AccessibleTableHeaderShape (void) +{ + mpTable = NULL; +} + +// XAccessible +Reference< XAccessibleContext > SAL_CALL AccessibleTableHeaderShape::getAccessibleContext(void) throw (RuntimeException) +{ + return this; +} + +// XAccessibleContext +sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleChildCount( ) throw(RuntimeException) +{ + return getAccessibleRowCount() * getAccessibleColumnCount(); +} + +Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleChild( sal_Int32 i ) throw(IndexOutOfBoundsException, RuntimeException) +{ + return mpTable->getAccessibleChild( i ); +} + +Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleParent (void) throw (RuntimeException) +{ + Reference< XAccessible > XParent; + return XParent; +} + +sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleIndexInParent (void) throw (RuntimeException) +{ + return -1; +} + +sal_Int16 SAL_CALL AccessibleTableHeaderShape::getAccessibleRole (void) throw (RuntimeException) +{ + return mpTable->getAccessibleRole(); +} + +OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleDescription (void) throw (RuntimeException) +{ + return mpTable->getAccessibleDescription(); +} + +OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleName (void) throw (RuntimeException) +{ + return mpTable->getAccessibleName(); +} + +Reference< XAccessibleStateSet > SAL_CALL AccessibleTableHeaderShape::getAccessibleStateSet (void) throw (RuntimeException) +{ + return mpTable->getAccessibleStateSet(); +} + +Reference< XAccessibleRelationSet > SAL_CALL AccessibleTableHeaderShape::getAccessibleRelationSet (void) throw (RuntimeException) +{ + return mpTable->getAccessibleRelationSet(); +} + +Locale SAL_CALL AccessibleTableHeaderShape::getLocale (void) throw (IllegalAccessibleComponentStateException, RuntimeException) +{ + return mpTable->getLocale(); +} + +//XAccessibleComponent +sal_Bool SAL_CALL AccessibleTableHeaderShape::containsPoint ( const ::com::sun::star::awt::Point& aPoint ) throw (RuntimeException) +{ + return mpTable->containsPoint( aPoint ); +} + +Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleAtPoint ( const ::com::sun::star::awt::Point& aPoint) throw (RuntimeException) +{ + return mpTable->getAccessibleAtPoint( aPoint ); +} + +::com::sun::star::awt::Rectangle SAL_CALL AccessibleTableHeaderShape::getBounds (void) throw (RuntimeException) +{ + return mpTable->getBounds(); +} + +::com::sun::star::awt::Point SAL_CALL AccessibleTableHeaderShape::getLocation (void) throw (RuntimeException) +{ + return mpTable->getLocation(); +} + +::com::sun::star::awt::Point SAL_CALL AccessibleTableHeaderShape::getLocationOnScreen (void) throw (RuntimeException) +{ + return mpTable->getLocationOnScreen(); +} + +::com::sun::star::awt::Size SAL_CALL AccessibleTableHeaderShape::getSize (void) throw (RuntimeException) +{ + return mpTable->getSize(); +} + +sal_Int32 SAL_CALL AccessibleTableHeaderShape::getForeground (void) throw (RuntimeException) +{ + return mpTable->getForeground(); +} + +sal_Int32 SAL_CALL AccessibleTableHeaderShape::getBackground (void) throw (RuntimeException) +{ + return mpTable->getBackground(); +} + +void SAL_CALL AccessibleTableHeaderShape::grabFocus (void) throw (RuntimeException) +{ + mpTable->grabFocus(); +} +//===== XAccessibleTable ============================================ + +sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleRowCount() throw (RuntimeException) +{ + return mbRow ? 1 : mpTable->getAccessibleRowCount(); +} + +sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnCount() throw (RuntimeException) +{ + return !mbRow ? 1 : mpTable->getAccessibleColumnCount(); +} + +OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleRowDescription( sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException) +{ + return mpTable->getAccessibleRowDescription( nRow ); +} + +OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnDescription( sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException) +{ + return mpTable->getAccessibleColumnDescription( nColumn ); +} + +sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException) +{ + return mpTable->getAccessibleRowExtentAt( nRow, nColumn ); +} + +sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException) +{ + return mpTable->getAccessibleColumnExtentAt( nRow, nColumn ); +} + +Reference< XAccessibleTable > SAL_CALL AccessibleTableHeaderShape::getAccessibleRowHeaders( ) throw (RuntimeException) +{ + Reference< XAccessibleTable > xRet; + return xRet; +} + +Reference< XAccessibleTable > SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnHeaders( ) throw (RuntimeException) +{ + Reference< XAccessibleTable > xRet; + return xRet; +} + +Sequence< sal_Int32 > SAL_CALL AccessibleTableHeaderShape::getSelectedAccessibleRows( ) throw (RuntimeException) +{ + sal_Int32 nRow = getAccessibleRowCount(); + ::std::vector< sal_Bool > aSelected( nRow, sal_True ); + sal_Int32 nCount = nRow; + for( sal_Int32 i = 0; i < nRow; i++ ) + { + try + { + aSelected[i] = isAccessibleRowSelected( i ); + } + catch( ... ) + { + return Sequence< sal_Int32 >(); + } + + if( !aSelected[i] ) + nCount--; + } + Sequence < sal_Int32 > aRet( nCount ); + sal_Int32 *pRet = aRet.getArray(); + sal_Int32 nPos = 0; + size_t nSize = aSelected.size(); + for( size_t i=0; i < nSize && nPos < nCount; i++ ) + { + if( aSelected[i] ) + { + *pRet++ = i; + nPos++; + } + } + + return aRet; +} + +Sequence< sal_Int32 > SAL_CALL AccessibleTableHeaderShape::getSelectedAccessibleColumns( ) throw (RuntimeException) +{ + sal_Int32 nColumn = getAccessibleColumnCount(); + ::std::vector< sal_Bool > aSelected( nColumn, sal_True ); + sal_Int32 nCount = nColumn; + for( sal_Int32 i = 0; i < nColumn; i++ ) + { + try + { + aSelected[i] = isAccessibleColumnSelected( i ); + } + catch( ... ) + { + return Sequence< sal_Int32 >(); + } + + if( !aSelected[i] ) + nCount--; + } + Sequence < sal_Int32 > aRet( nCount ); + sal_Int32 *pRet = aRet.getArray(); + sal_Int32 nPos = 0; + size_t nSize = aSelected.size(); + for( size_t i=0; i < nSize && nPos < nCount; i++ ) + { + if( aSelected[i] ) + { + *pRet++ = i; + nPos++; + } + } + + return aRet; +} + +sal_Bool SAL_CALL AccessibleTableHeaderShape::isAccessibleRowSelected( sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException) +{ + return mpTable->isAccessibleRowSelected( nRow ); +} + +sal_Bool SAL_CALL AccessibleTableHeaderShape::isAccessibleColumnSelected( sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException) +{ + return mpTable->isAccessibleColumnSelected( nColumn ); +} + +Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException) +{ + return mpTable->getAccessibleCellAt( nRow, nColumn ); +} + +Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleCaption( ) throw (RuntimeException) +{ + return mpTable->getAccessibleCaption(); +} + +Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleSummary( ) throw (RuntimeException) +{ + return mpTable->getAccessibleSummary(); +} + +sal_Bool SAL_CALL AccessibleTableHeaderShape::isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException) +{ + return mpTable->isAccessibleSelected( nRow, nColumn ); +} + +sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException) +{ + return mpTable->getAccessibleIndex( nRow, nColumn ); +} + +sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleRow( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + return mpTable->getAccessibleRow( nChildIndex ); +} + +sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleColumn( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + return mpTable->getAccessibleColumn( nChildIndex ); +} + +//===== XAccessibleTableSelection ============================================ +sal_Bool SAL_CALL AccessibleTableHeaderShape::selectRow( sal_Int32 row ) +throw (IndexOutOfBoundsException, RuntimeException) +{ + if( mbRow ) + return mpTable->selectRow( row ); + else + { + mpTable->clearAccessibleSelection(); + sal_Int32 nIndex = mpTable->getAccessibleIndex( row, 0 ); + mpTable->selectAccessibleChild( nIndex ); + return sal_True; + } +} + +sal_Bool SAL_CALL AccessibleTableHeaderShape::selectColumn( sal_Int32 column ) +throw (IndexOutOfBoundsException, RuntimeException) +{ + if( !mbRow ) + return mpTable->selectColumn( column ); + else + { + mpTable->clearAccessibleSelection(); + sal_Int32 nIndex = mpTable->getAccessibleIndex( 0, column ); + mpTable->selectAccessibleChild( nIndex ); + return sal_True; + } +} + +sal_Bool SAL_CALL AccessibleTableHeaderShape::unselectRow( sal_Int32 row ) +throw (IndexOutOfBoundsException, RuntimeException) +{ + if( mbRow ) + return mpTable->unselectRow( row ); + else + { + sal_Int32 nIndex = mpTable->getAccessibleIndex( row, 0 ); + mpTable->deselectAccessibleChild( nIndex ); + return sal_True; + } +} + +sal_Bool SAL_CALL AccessibleTableHeaderShape::unselectColumn( sal_Int32 column ) +throw (IndexOutOfBoundsException, RuntimeException) +{ + if( !mbRow ) + return mpTable->unselectColumn( column ); + else + { + sal_Int32 nIndex = mpTable->getAccessibleIndex( 0, column ); + mpTable->deselectAccessibleChild( nIndex ); + return sal_True; + } +} +//-----IAccessibility2 Implementation 2009 } diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 9606c43726f2..deb75a87aac3 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -2612,4 +2612,90 @@ IMPL_LINK( SvxTableController, UpdateHdl, void *, EMPTYARG ) return 0; } +//IAccessibility2 Implementation 2009----- +sal_Bool SvxTableController::selectRow( sal_Int32 row ) +{ + if( !mxTable.is() ) + return sal_False; + CellPos aStart( 0, row ), aEnd( mxTable->getColumnCount() - 1, row ); + StartSelection( aEnd ); + gotoCell( aStart, true, 0 ); + return sal_True; +} +sal_Bool SvxTableController::selectColumn( sal_Int32 column ) +{ + if( !mxTable.is() ) + return sal_False; + CellPos aStart( column, 0 ), aEnd( column, mxTable->getRowCount() - 1 ); + StartSelection( aEnd ); + gotoCell( aStart, true, 0 ); + return sal_True; +} +sal_Bool SvxTableController::deselectRow( sal_Int32 row ) +{ + if( !mxTable.is() ) + return sal_False; + CellPos aStart( 0, row ), aEnd( mxTable->getColumnCount() - 1, row ); + StartSelection( aEnd ); + gotoCell( aStart, false, 0 ); + return sal_True; +} +sal_Bool SvxTableController::deselectColumn( sal_Int32 column ) +{ + if( !mxTable.is() ) + return sal_False; + CellPos aStart( column, 0 ), aEnd( column, mxTable->getRowCount() - 1 ); + StartSelection( aEnd ); + gotoCell( aStart, false, 0 ); + return sal_True; +} +sal_Bool SvxTableController::isRowSelected( sal_Int32 nRow ) +{ + if( hasSelectedCells() ) + { + CellPos aFirstPos, aLastPos; + getSelectedCells( aFirstPos, aLastPos ); + if( (aFirstPos.mnCol == 0) && (nRow >= aFirstPos.mnRow && nRow <= aLastPos.mnRow) && (mxTable->getColumnCount() - 1 == aLastPos.mnCol) ) + return sal_True; + } + return sal_False; +} +sal_Bool SvxTableController::isColumnSelected( sal_Int32 nColumn ) +{ + if( hasSelectedCells() ) + { + CellPos aFirstPos, aLastPos; + getSelectedCells( aFirstPos, aLastPos ); + if( (aFirstPos.mnRow == 0) && (nColumn >= aFirstPos.mnCol && nColumn <= aLastPos.mnCol) && (mxTable->getRowCount() - 1 == aLastPos.mnRow) ) + return sal_True; + } + return sal_False; +} + +sal_Bool SvxTableController::isRowHeader() +{ + SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() ); + SdrModel* pModel = pTableObj ? pTableObj->GetModel() : 0; + + if( !pTableObj || !pModel ) + return sal_False; + + TableStyleSettings aSettings( pTableObj->getTableStyleSettings() ); + + return aSettings.mbUseFirstRow; +} + +sal_Bool SvxTableController::isColumnHeader() +{ + SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() ); + SdrModel* pModel = pTableObj ? pTableObj->GetModel() : 0; + + if( !pTableObj || !pModel ) + return sal_False; + + TableStyleSettings aSettings( pTableObj->getTableStyleSettings() ); + + return aSettings.mbUseFirstColumn; +} +//-----IAccessibility2 Implementation 2009 } } diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index 306708921eca..a12930b6c16d 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -776,6 +776,9 @@ SfxItemPropertyMapEntry* ImplGetSvxTableShapePropertyMap() { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT), SDRATTR_OBJMOVEPROTECT, &::getBooleanCppuType(),0, 0}, { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT), SDRATTR_OBJSIZEPROTECT, &::getBooleanCppuType(),0, 0}, { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_BOUNDRECT), OWN_ATTR_BOUNDRECT, &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, + //IAccessibility2 Implementation 2009-----, the name property of table should also be exported. + { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_NAME), SDRATTR_OBJECTNAME , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, + //-----IAccessibility2 Implementation 2009 { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_TITLE), OWN_ATTR_MISC_OBJ_TITLE , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_DESCRIPTION), OWN_ATTR_MISC_OBJ_DESCRIPTION , &::getCppuType((const ::rtl::OUString*)0), 0, 0}, { MAP_CHAR_LEN("Model"), OWN_ATTR_OLEMODEL , &::com::sun::star::table::XTable::static_type(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0}, diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index a74f1ddb1117..5f12233020c2 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -51,6 +51,12 @@ #include <com/sun/star/linguistic2/XLinguServiceManager.hpp> #include <comphelper/processfactory.hxx> #include <vos/mutex.hxx> + +//IAccessibility2 Implementation 2009----- +#include <svx/svdotable.hxx> +#include <../table/cell.hxx> +//-----IAccessibility2 Implementation 2009 + #include <svx/sdrpaintwindow.hxx> using namespace ::osl; @@ -385,6 +391,29 @@ void SvxTextEditSourceImpl::Notify( SfxBroadcaster&, const SfxHint& rHint ) case HINT_BEGEDIT: if( mpObject == pSdrHint->GetObject() ) { + //IAccessibility2 Implementation 2009-----, one EditSource object is created for each AccessibleCell, and it will monitor the hint. + // Once HINT_BEGEDIT is broadcast, each EditSource of AccessibleCell will handle it here and + // call below: mpView->GetTextEditOutliner()->SetNotifyHdl(), which will replace the Notifer for current + // editable cell. It is totally wrong. So add check here to avoid the incorrect replacement of notifer. + // To be safe, add accessibility check here because currently it only happen on the editsource of AccessibleCell + if (Application::IsAccessibilityEnabled()) + { + if (mpObject && mpText) + { + sdr::table::SdrTableObj* pTableObj = PTR_CAST( sdr::table::SdrTableObj, mpObject ); + if(pTableObj) + { + sdr::table::CellRef xCell = pTableObj->getActiveCell(); + if (xCell.is()) + { + sdr::table::Cell* pCellObj = dynamic_cast< sdr::table::Cell* >( mpText ); + if (pCellObj && xCell.get() != pCellObj) + break; + } + } + } + } + //-----IAccessibility2 Implementation 2009 // invalidate old forwarder if( !mbForwarderIsEditMode ) { |