diff options
Diffstat (limited to 'accessibility/inc/accessibility')
70 files changed, 10214 insertions, 0 deletions
diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBox.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBox.hxx new file mode 100644 index 000000000000..82c09c8b13bc --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBox.hxx @@ -0,0 +1,313 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOX_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOX_HXX + +#include <accessibility/extended/AccessibleBrowseBoxBase.hxx> +#include <cppuhelper/weakref.hxx> +#include <svtools/accessibletableprovider.hxx> + + +#include <memory> + +// ============================================================================ + +namespace accessibility { + + class AccessibleBrowseBoxImpl; + class AccessibleBrowseBoxTable; + +// ============================================================================ + +/** This class represents the complete accessible BrowseBox object. */ +class AccessibleBrowseBox : public AccessibleBrowseBoxBase +{ + friend class AccessibleBrowseBoxAccess; + +protected: + AccessibleBrowseBox( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator, + ::svt::IAccessibleTableProvider& _rBrowseBox + ); + + virtual ~AccessibleBrowseBox(); + + /** sets the XAccessible which created the context + + <p>To be called only once, and only if in the ctor NULL was passed.</p> + */ + void setCreator( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator + ); + + /** Cleans up members. */ + using AccessibleBrowseBoxBase::disposing; + virtual void SAL_CALL disposing(); + +protected: + // XAccessibleContext ----------------------------------------------------- + + /** @return The count of visible children. */ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The XAccessible interface of the specified child. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The role of this object (a table). */ +// virtual sal_Int16 SAL_CALL getAccessibleRole() +// throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleComponent --------------------------------------------------- + + /** @return + The accessible child rendered under the given point. + */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Grabs the focus to the BrowseBox. */ + virtual void SAL_CALL grabFocus() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The key bindings associated with this object. */ + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo ----------------------------------------------------------- + + /** @return + The name of this class. + */ + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ); + +public: + // helper functions + /** commitHeaderBarEvent commit the event at all listeners of the column/row header bar + @param nEventId + the event id + @param rNewValue + the new value + @param rOldValue + the old value + */ + void commitHeaderBarEvent(sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, + const ::com::sun::star::uno::Any& rOldValue,sal_Bool _bColumnHeaderBar = sal_True); + + // helper functions + /** commitTableEvent commit the event at all listeners of the table + @param nEventId + the event id + @param rNewValue + the new value + @param rOldValue + the old value + */ + void commitTableEvent(sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, + const ::com::sun::star::uno::Any& rOldValue); + + /** returns the accessible object for the row or the column header bar + */ + inline ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) + { + return implGetHeaderBar(_eObjType); + } + + /** returns the accessible object for the table representation + */ + inline ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + getTable( ) + { + return implGetTable(); + } + +protected: + // internal virtual methods ----------------------------------------------- + + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) relative to the parent window. */ + virtual Rectangle implGetBoundingBox(); + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) in screen coordinates. */ + virtual Rectangle implGetBoundingBoxOnScreen(); + + // internal helper methods ------------------------------------------------ + + /** This method creates (once) and returns the accessible data table child. + @attention This method requires locked mutex's and a living object. + @return The XAccessible interface of the data table. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > implGetTable(); + + /** This method creates (once) and returns the specified header bar. + @attention This method requires locked mutex's and a living object. + @return The XAccessible interface of the header bar. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + implGetHeaderBar( ::svt::AccessibleBrowseBoxObjType eObjType ); + + /** This method returns one of the children that are always present: + Data table, row and column header bar or corner control. + @attention This method requires locked mutex's and a living object. + @return The XAccessible interface of the specified child. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + implGetFixedChild( sal_Int32 nChildIndex ); + + /** This method creates and returns an accessible table. + @return An AccessibleBrowseBoxTable. */ + virtual AccessibleBrowseBoxTable* createAccessibleTable(); + +private: + // members ---------------------------------------------------------------- + ::std::auto_ptr< AccessibleBrowseBoxImpl > m_pImpl; +}; + +// ============================================================================ +/** the XAccessible which creates/returns an AccessibleBrowseBox + + <p>The instance holds it's XAccessibleContext with a hard reference, while + the contxt holds this instance weak.</p> +*/ +typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessible + > AccessibleBrowseBoxAccess_Base; + +class AccessibleBrowseBoxAccess :public AccessibleBrowseBoxAccess_Base + ,public ::svt::IAccessibleBrowseBox +{ +private: + ::osl::Mutex m_aMutex; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + m_xParent; + ::svt::IAccessibleTableProvider& m_rBrowseBox; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + m_xContext; + AccessibleBrowseBox* m_pContext; + // note that this pointer is valid as long as m_xContext is valid! + +public: + AccessibleBrowseBoxAccess( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + ::svt::IAccessibleTableProvider& _rBrowseBox + ); + + /// checks whether the accessible context is still alive + bool isContextAlive() const; + + /// returns the AccessibleContext belonging to this Accessible + inline AccessibleBrowseBox* getContext() { return m_pContext; } + inline const AccessibleBrowseBox* getContext() const { return m_pContext; } + +protected: + virtual ~AccessibleBrowseBoxAccess(); + + // XAccessible + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + SAL_CALL getAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException ); + + // IAccessibleBrowseBox + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getMyself() + { + return this; + } + void dispose(); + virtual sal_Bool isAlive() const + { + return isContextAlive(); + } + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible; + AccessibleBrowseBox* pContext( getContext() ); + if ( pContext ) + xAccessible = pContext->getHeaderBar( _eObjType ); + return xAccessible; + } + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getTable() + { + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible; + AccessibleBrowseBox* pContext( getContext() ); + if ( pContext ) + xAccessible = pContext->getTable(); + return xAccessible; + } + virtual void commitHeaderBarEvent( sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue, + const ::com::sun::star::uno::Any& rOldValue, sal_Bool _bColumnHeaderBar ) + { + AccessibleBrowseBox* pContext( getContext() ); + if ( pContext ) + pContext->commitHeaderBarEvent( nEventId, rNewValue, rOldValue, _bColumnHeaderBar ); + } + virtual void commitTableEvent( sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue ) + { + AccessibleBrowseBox* pContext( getContext() ); + if ( pContext ) + pContext->commitTableEvent( nEventId, rNewValue, rOldValue ); + } + virtual void commitEvent( sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue ) + { + AccessibleBrowseBox* pContext( getContext() ); + if ( pContext ) + pContext->commitEvent( nEventId, rNewValue, rOldValue ); + } + +private: + AccessibleBrowseBoxAccess(); // never implemented + AccessibleBrowseBoxAccess( const AccessibleBrowseBoxAccess& ); // never implemented + AccessibleBrowseBoxAccess& operator=( const AccessibleBrowseBoxAccess& ); // never implemented +}; + +// ============================================================================ +} // namespace accessibility + +// ============================================================================ + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx new file mode 100644 index 000000000000..67f0574ab436 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx @@ -0,0 +1,520 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXBASE_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXBASE_HXX + +#include <svtools/AccessibleBrowseBoxObjType.hxx> +#include <tools/debug.hxx> +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> +#include <vcl/svapp.hxx> +#include <cppuhelper/compbase5.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <unotools/accessiblestatesethelper.hxx> +#include <toolkit/helper/convert.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include <comphelper/accessibleeventnotifier.hxx> +#include <comphelper/uno3.hxx> + +// ============================================================================ + +class Window; + +namespace utl { + class AccessibleStateSetHelper; +} + +namespace svt { + class IAccessibleTableProvider; +} + +// ============================================================================ + +namespace accessibility { + +// ============================================================================ + +typedef ::cppu::WeakAggComponentImplHelper5< + ::com::sun::star::accessibility::XAccessibleContext, + ::com::sun::star::accessibility::XAccessibleComponent, + ::com::sun::star::accessibility::XAccessibleEventBroadcaster, + ::com::sun::star::awt::XFocusListener, + ::com::sun::star::lang::XServiceInfo > + AccessibleBrowseBoxImplHelper; + +/** The BrowseBox accessible objects inherit from this base class. It + implements basic functionality for various Accessibility interfaces and + the event broadcaster and contains the ::osl::Mutex. */ +class AccessibleBrowseBoxBase : + public ::comphelper::OBaseMutex, + public AccessibleBrowseBoxImplHelper +{ +public: + /** Constructor sets specified name and description. If the constant of a + text is BBTEXT_NONE, the derived class has to set the text via + implSetName() and implSetDescription() (in Ctor) or later via + setAccessibleName() and setAccessibleDescription() (these methods + notify the listeners about the change). + @param rxParent XAccessible interface of the parent object. + @param rBrowseBox The BrowseBox control. + @param eNameText The constant for the name text. + @param eDescrText The constant for the description text. */ + AccessibleBrowseBoxBase( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::IAccessibleTableProvider& rBrowseBox, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, + ::svt::AccessibleBrowseBoxObjType eObjType ); + + /** Constructor sets specified name and description. + @param rxParent XAccessible interface of the parent object. + @param rBrowseBox The BrowseBox control. + @param rName The name of this object. + @param rDescription The description text of this object. */ + AccessibleBrowseBoxBase( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::IAccessibleTableProvider& rBrowseBox, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, + ::svt::AccessibleBrowseBoxObjType eObjType, + const ::rtl::OUString& rName, + const ::rtl::OUString& rDescription ); + +protected: + virtual ~AccessibleBrowseBoxBase(); + + /** Commits DeFunc event to listeners and cleans up members. */ + virtual void SAL_CALL disposing(); + +public: + // XAccessibleContext ----------------------------------------------------- + + /** @return A reference to the parent accessible object. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The description of this object. + */ + virtual ::rtl::OUString SAL_CALL getAccessibleDescription() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The name of this object. + */ + virtual ::rtl::OUString SAL_CALL getAccessibleName() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The relation set (the BrowseBox does not have one). + */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL + getAccessibleRelationSet() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The set of current states. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL + getAccessibleStateSet() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The parent's locale. */ + virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() + throw ( ::com::sun::star::accessibility::IllegalAccessibleComponentStateException, + ::com::sun::star::uno::RuntimeException ); + + /** @return + The role of this object. Panel, ROWHEADER, COLUMNHEADER, TABLE, TABLE_CELL are supported. + */ + virtual sal_Int16 SAL_CALL getAccessibleRole() + throw ( ::com::sun::star::uno::RuntimeException ); + + /* Derived classes have to implement: + - getAccessibleChildCount, + - getAccessibleChild, + - getAccessibleRole. + Derived classes may overwrite getAccessibleIndexInParent to increase + performance. */ + + // XAccessibleComponent --------------------------------------------------- + + /** @return + <TRUE/>, if the point lies within the bounding box of this object. */ + virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& rPoint ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The bounding box of this object. */ + virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The upper left corner of the bounding box relative to the parent. */ + virtual ::com::sun::star::awt::Point SAL_CALL getLocation() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The upper left corner of the bounding box in screen coordinates. */ + virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The size of the bounding box. */ + virtual ::com::sun::star::awt::Size SAL_CALL getSize() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the object is showing. */ + virtual sal_Bool SAL_CALL isShowing() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the object is visible. */ + virtual sal_Bool SAL_CALL isVisible() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the object can accept the focus. */ + virtual sal_Bool SAL_CALL isFocusTraversable() + 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); + + // XFocusListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw (::com::sun::star::uno::RuntimeException); + + /* Derived classes have to implement: + - getAccessibleAt, + - grabFocus, + - getAccessibleKeyBinding. */ + + /** @return + No key bindings supported by default. + */ + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() + throw ( ::com::sun::star::uno::RuntimeException ); + /** @return + The accessible child rendered under the given point. + */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleEventBroadcaster -------------------------------------------- + + /** Adds a new event listener */ + using cppu::WeakAggComponentImplHelperBase::addEventListener; + virtual void SAL_CALL addEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleEventListener>& rxListener ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Removes an event listener. */ + using cppu::WeakAggComponentImplHelperBase::removeEventListener; + virtual void SAL_CALL removeEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleEventListener>& rxListener ) + throw ( ::com::sun::star::uno::RuntimeException ); + + // XTypeProvider ---------------------------------------------------------- + + /** @return An unique implementation ID. */ + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo ----------------------------------------------------------- + + /** @return Whether the specified service is supported by this class. */ + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return A list of all supported services. */ + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames() + throw ( ::com::sun::star::uno::RuntimeException ); + + /* Derived classes have to implement: + - getImplementationName. */ + + // helper methods --------------------------------------------------------- + + /** @return The BrowseBox object type. */ + inline ::svt::AccessibleBrowseBoxObjType getType() const; + + /** Changes the name of the object and notifies listeners. */ + void setAccessibleName( const ::rtl::OUString& rName ); + /** Changes the description of the object and notifies listeners. */ + void setAccessibleDescription( const ::rtl::OUString& rDescription ); + + /** Commits an event to all listeners. */ + void commitEvent( + sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, + + const ::com::sun::star::uno::Any& rOldValue ); + /** @return <TRUE/>, if the object is not disposed or disposing. */ + sal_Bool isAlive() const; + +protected: + // internal virtual methods ----------------------------------------------- + + /** Determines whether the BrowseBox control is really showing inside of + its parent accessible window. Derived classes may implement different + behaviour. + @attention This method requires locked mutex's and a living object. + @return <TRUE/>, if the object is really showing. */ + virtual sal_Bool implIsShowing(); + + /** Derived classes return the bounding box relative to the parent window. + @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) relative to the parent window. */ + virtual Rectangle implGetBoundingBox() = 0; + /** Derived classes return the bounding box in screen coordinates. + @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) in screen coordinates. */ + virtual Rectangle implGetBoundingBoxOnScreen() = 0; + + /** Creates a new AccessibleStateSetHelper and fills it with states of the + current object. This method calls FillStateSet at the BrowseBox which + fills it with more states depending on the object type. Derived classes + may overwrite this method and add more states. + @attention This method requires locked mutex's. + @return A filled AccessibleStateSetHelper. */ + virtual ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); + + // internal helper methods ------------------------------------------------ + + /** @throws <type>DisposedException</type> If the object is not alive. */ + void ensureIsAlive() const + throw ( ::com::sun::star::lang::DisposedException ); + + /** @return The ::osl::Mutex member provided by the class OBaseMutex. */ + inline ::osl::Mutex& getOslMutex(); + /** @return Pointer to the global ::osl::Mutex. */ + static inline ::osl::Mutex* getOslGlobalMutex(); + + /** Changes the name of the object (flat assignment, no notify). + @attention This method requires a locked mutex. */ + inline void implSetName( const ::rtl::OUString& rName ); + /** Changes the description of the object (flat assignment, no notify). + @attention This method requires a locked mutex. */ + inline void implSetDescription( const ::rtl::OUString& rDescription ); + + /** Locks all mutex's and calculates the bounding box relative to the + parent window. + @return The bounding box (VCL rect.) relative to the parent object. */ + Rectangle getBoundingBox() + throw ( ::com::sun::star::lang::DisposedException ); + /** Locks all mutex's and calculates the bounding box in screen + coordinates. + @return The bounding box (VCL rect.) in screen coordinates. */ + Rectangle getBoundingBoxOnScreen() + throw ( ::com::sun::star::lang::DisposedException ); + + /** Creates a new UUID, if rId is empty. + @attention This method requires locked global mutex to prevent double + creation of an UUID. */ + static void implCreateUuid( ::com::sun::star::uno::Sequence< sal_Int8 >& rId ); + + ::comphelper::AccessibleEventNotifier::TClientId getClientId() const { return m_aClientId; } + void setClientId(::comphelper::AccessibleEventNotifier::TClientId _aNewClientId) { m_aClientId = _aNewClientId; } + +public: + // public versions of internal helper methods, with access control + struct AccessControl { friend class SolarMethodGuard; private: AccessControl() { } }; + + inline ::osl::Mutex& getMutex( const AccessControl& ) { return getOslMutex(); } + inline void ensureIsAlive( const AccessControl& ) { ensureIsAlive(); } + +protected: + // members ---------------------------------------------------------------- + + /** The parent accessible object. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > mxParent; + /** The VCL BrowseBox control. */ + ::svt::IAccessibleTableProvider* mpBrowseBox; + + /** This is the window which get all the nice focus events + */ + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xFocusWindow; + +private: + /** Localized name. */ + ::rtl::OUString maName; + /** Localized description text. */ + ::rtl::OUString maDescription; + + /** The type of this object (for names, descriptions, state sets, ...). */ + ::svt::AccessibleBrowseBoxObjType meObjType; + + ::comphelper::AccessibleEventNotifier::TClientId m_aClientId; +}; + +// ============================================================================ +// a version of AccessibleBrowseBoxBase which implements not only the XAccessibleContext, +// but also the XAccessible + +typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible + > BrowseBoxAccessibleElement_Base; + +class BrowseBoxAccessibleElement + :public AccessibleBrowseBoxBase + ,public BrowseBoxAccessibleElement_Base +{ +protected: + /** Constructor sets specified name and description. If the constant of a + text is BBTEXT_NONE, the derived class has to set the text via + implSetName() and implSetDescription() (in Ctor) or later via + setAccessibleName() and setAccessibleDescription() (these methods + notify the listeners about the change). + + @param rxParent XAccessible interface of the parent object. + @param rBrowseBox The BrowseBox control. + @param eNameText The constant for the name text. + @param eDescrText The constant for the description text. + */ + BrowseBoxAccessibleElement( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::IAccessibleTableProvider& rBrowseBox, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, + ::svt::AccessibleBrowseBoxObjType eObjType ); + + /** Constructor sets specified name and description. + + @param rxParent XAccessible interface of the parent object. + @param rBrowseBox The BrowseBox control. + @param rName The name of this object. + @param rDescription The description text of this object. + */ + BrowseBoxAccessibleElement( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::IAccessibleTableProvider& rBrowseBox, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, + ::svt::AccessibleBrowseBoxObjType eObjType, + const ::rtl::OUString& rName, + const ::rtl::OUString& rDescription ); + +public: + // XInterface + DECLARE_XINTERFACE( ) + // XTypeProvider + DECLARE_XTYPEPROVIDER( ) + +protected: + virtual ~BrowseBoxAccessibleElement(); + +protected: + // XAccessible ------------------------------------------------------------ + + /** @return The XAccessibleContext interface of this object. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL + getAccessibleContext() + throw ( ::com::sun::star::uno::RuntimeException ); + +private: + BrowseBoxAccessibleElement(); // never implemented + BrowseBoxAccessibleElement( const BrowseBoxAccessibleElement& ); // never implemented + BrowseBoxAccessibleElement& operator=( const BrowseBoxAccessibleElement& ); // never implemented +}; + +// ============================================================================ +// a helper class for protecting methods which need to lock the solar mutex in addition to the own mutex + +typedef ::osl::MutexGuard OslMutexGuard; + +class SolarMethodGuard : public SolarMutexGuard, public OslMutexGuard +{ +public: + inline SolarMethodGuard( AccessibleBrowseBoxBase& _rOwner, bool _bEnsureAlive = true ) + :SolarMutexGuard( ) + ,OslMutexGuard( _rOwner.getMutex( AccessibleBrowseBoxBase::AccessControl() ) ) + { + if ( _bEnsureAlive ) + _rOwner.ensureIsAlive( AccessibleBrowseBoxBase::AccessControl() ); + } +}; + +// inlines -------------------------------------------------------------------- + +inline ::svt::AccessibleBrowseBoxObjType AccessibleBrowseBoxBase::getType() const +{ + return meObjType; +} + +inline ::osl::Mutex& AccessibleBrowseBoxBase::getOslMutex() +{ + return m_aMutex; +} + +inline ::osl::Mutex* AccessibleBrowseBoxBase::getOslGlobalMutex() +{ + return ::osl::Mutex::getGlobalMutex(); +} + +inline void AccessibleBrowseBoxBase::implSetName( + const ::rtl::OUString& rName ) +{ + maName = rName; +} + +inline void AccessibleBrowseBoxBase::implSetDescription( + const ::rtl::OUString& rDescription ) +{ + maDescription = rDescription; +} + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx new file mode 100644 index 000000000000..8346c1173fb3 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXCHECKBOXCELL_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXCHECKBOXCELL_HXX + +#include <com/sun/star/accessibility/XAccessibleValue.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include "accessibility/extended/accessiblebrowseboxcell.hxx" +#include <cppuhelper/implbase2.hxx> +#include <vcl/wintypes.hxx> +// ============================================================================ +namespace accessibility +{ +// ============================================================================ + typedef ::cppu::ImplHelper2 < ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleValue + > AccessibleCheckBoxCell_BASE; + + class AccessibleCheckBoxCell : public AccessibleBrowseBoxCell + ,public AccessibleCheckBoxCell_BASE + { + private: + TriState m_eState; + BOOL m_bEnabled; + BOOL m_bIsTriState; + + protected: + virtual ~AccessibleCheckBoxCell() {} + + virtual ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); + + public: + AccessibleCheckBoxCell(const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + ::svt::IAccessibleTableProvider& _rBrowseBox, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos, + const TriState& _eState, + sal_Bool _bEnabled, + sal_Bool _bIsTriState = sal_True); + + // XInterface + DECLARE_XINTERFACE( ) + // XTypeProvider + DECLARE_XTYPEPROVIDER( ) + + // 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::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ); + virtual ::sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); + + + // XAccessibleValue + virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); + + // internal + void SetChecked( sal_Bool _bChecked ); + }; +} +#endif // ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXCHECKBOXCELL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx new file mode 100644 index 000000000000..92cb1b5d2d71 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx @@ -0,0 +1,283 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERBAR_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERBAR_HXX + +#include "accessibility/extended/AccessibleBrowseBoxTableBase.hxx" +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> + +// ============================================================================ + +namespace accessibility { + +// ============================================================================ + +typedef ::cppu::ImplHelper1< + ::com::sun::star::accessibility::XAccessibleSelection > + AccessibleBrowseBoxHeaderBarImplHelper; + +/** This class represents the accessible object of a header bar of a BrowseBox + control (row or column header bar). This object supports the + XAccessibleSelection interface. Selecting a child of this object selects + complete rows or columns of the data table. */ +class AccessibleBrowseBoxHeaderBar : + public AccessibleBrowseBoxTableBase, + public AccessibleBrowseBoxHeaderBarImplHelper +{ +public: + /** @param eObjType One of the two allowed types BBTYPE_ROWHEADERBAR or + BBTYPE_COLUMNHEADERBAR. */ + AccessibleBrowseBoxHeaderBar( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::IAccessibleTableProvider& rBrowseBox, + ::svt::AccessibleBrowseBoxObjType eObjType ); + +protected: + virtual ~AccessibleBrowseBoxHeaderBar(); + +public: + // XAccessibleContext ----------------------------------------------------- + + /** @return + The XAccessible interface of the specified child. + */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleComponent --------------------------------------------------- + + /** @return The accessible child rendered under the given point. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Grabs the focus to (the current cell of) the data table. */ + virtual void SAL_CALL grabFocus() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The key bindings associated with this object. */ + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleTable ------------------------------------------------------- + + /** @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 ); + + // XAccessibleSelection --------------------------------------------------- + + /** Selects the specified child (row or column of the table). */ + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the specified child (row/column) is selected. */ + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** Clears the complete selection. */ + virtual void SAL_CALL clearAccessibleSelection() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Selects all children or first, if multiselection is not supported. */ + virtual void SAL_CALL selectAllAccessibleChildren() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The number of selected rows/columns. */ + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The specified selected row/column. */ + virtual ::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 ); + + /** Removes the specified row/column from the selection. */ + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + // XInterface ------------------------------------------------------------- + + /** Queries for a new interface. */ + ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type& rType ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Aquires the object (calls acquire() on base class). */ + virtual void SAL_CALL acquire() throw (); + + /** Releases the object (calls release() on base class). */ + virtual void SAL_CALL release() throw (); + + // XServiceInfo ----------------------------------------------------------- + + /** @return The name of this class. */ + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return An unique implementation ID. */ + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw ( ::com::sun::star::uno::RuntimeException ); + +protected: + // internal virtual methods ----------------------------------------------- + + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) relative to the parent window. */ + virtual Rectangle implGetBoundingBox(); + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) in screen coordinates. */ + virtual Rectangle implGetBoundingBoxOnScreen(); + + /** @attention This method requires locked mutex's and a living object. + @return The count of used rows. */ + virtual sal_Int32 implGetRowCount() const; + /** @attention This method requires locked mutex's and a living object. + @return The count of used columns. */ + virtual sal_Int32 implGetColumnCount() const; + + // internal helper methods ------------------------------------------------ + + /** @return <TRUE/>, if the objects is a header bar for rows. */ + inline sal_Bool isRowBar() const; + /** @return <TRUE/>, if the objects is a header bar for columns. */ + inline sal_Bool isColumnBar() const; + + /** Returns the specified row or column. Uses one of the parameters, + depending on object type. + @attention This method requires locked mutex's and a living object. + @return The XAccessible interface of the specified column/row. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + implGetChild( sal_Int32 nRow, sal_uInt16 nColumnPos ); + + /** @attention This method requires locked mutex's and a living object. + @return The absolute child index from the index of selected children. + @throws <type>IndexOutOfBoundsException</type> + If the specified index is invalid. */ + sal_Int32 implGetChildIndexFromSelectedIndex( sal_Int32 nSelectedChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); + + /** @attention This method requires locked mutex's and a living object. + @throws <type>IndexOutOfBoundsException</type> + If the specified row/column index (depending on type) is invalid. */ + void ensureIsValidHeaderIndex( sal_Int32 nIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); +}; + +// inlines -------------------------------------------------------------------- + +inline sal_Bool AccessibleBrowseBoxHeaderBar::isRowBar() const +{ + return getType() == ::svt::BBTYPE_ROWHEADERBAR; +} + +inline sal_Bool AccessibleBrowseBoxHeaderBar::isColumnBar() const +{ + return getType() == ::svt::BBTYPE_COLUMNHEADERBAR; +} + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx new file mode 100644 index 000000000000..2c55887462cb --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERCELL_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERCELL_HXX + +#include "accessibility/extended/AccessibleBrowseBoxBase.hxx" + +namespace accessibility +{ + class AccessibleBrowseBoxHeaderCell : public BrowseBoxAccessibleElement + { + sal_Int32 m_nColumnRowId; + public: + AccessibleBrowseBoxHeaderCell(sal_Int32 _nColumnRowId, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::IAccessibleTableProvider& _rBrowseBox, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, + ::svt::AccessibleBrowseBoxObjType _eObjType); + /** @return The count of visible children. */ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The XAccessible interface of the specified child. */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException ); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw ( ::com::sun::star::uno::RuntimeException ); + + /** Grabs the focus to the BrowseBox. */ + virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException ); + + inline sal_Bool isRowBarCell() const + { + return getType() == ::svt::BBTYPE_ROWHEADERCELL; + } + + /** @return + The name of this class. + */ + virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ); + + /** Creates a new AccessibleStateSetHelper and fills it with states of the + current object. + @return + A filled AccessibleStateSetHelper. + */ + ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); + + protected: + virtual Rectangle implGetBoundingBox(); + + virtual Rectangle implGetBoundingBoxOnScreen(); + }; +} + +#endif // ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERCELL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTable.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTable.hxx new file mode 100644 index 000000000000..021f1c614324 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTable.hxx @@ -0,0 +1,177 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLE_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLE_HXX + +#include "accessibility/extended/AccessibleBrowseBoxTableBase.hxx" + +// ============================================================================ + +namespace accessibility { + +// ============================================================================ + +/** This class represents the accessible object of the data table of a + BrowseBox control. */ +class AccessibleBrowseBoxTable : public AccessibleBrowseBoxTableBase +{ + friend class AccessibleBrowseBox; // to create header bars + +public: + AccessibleBrowseBoxTable( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::IAccessibleTableProvider& rBrowseBox ); + +protected: + virtual ~AccessibleBrowseBoxTable(); + +public: + // XAccessibleContext ----------------------------------------------------- + + /** @return The XAccessible interface of the specified child. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleComponent --------------------------------------------------- + + /** @return The accessible child rendered under the given point. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Grabs the focus to (the current cell of) the data table. */ + virtual void SAL_CALL grabFocus() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The key bindings associated with this object. */ + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleTable ------------------------------------------------------- + + /** @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 ); + + // XServiceInfo ----------------------------------------------------------- + + /** @return The name of this class. */ + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ); + +protected: + // internal virtual methods ----------------------------------------------- + + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) relative to the parent window. */ + virtual Rectangle implGetBoundingBox(); + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) in screen coordinates. */ + virtual Rectangle implGetBoundingBoxOnScreen(); + + // internal helper methods ------------------------------------------------ + + /** @attention This method requires a locked mutex. + @return The XAccessibleTable interface of the specified header bar. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleTable > + implGetHeaderBar( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::uno::RuntimeException ); +}; + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableBase.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableBase.hxx new file mode 100644 index 000000000000..d775104614c6 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableBase.hxx @@ -0,0 +1,282 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLEBASE_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLEBASE_HXX + +#include "accessibility/extended/AccessibleBrowseBoxBase.hxx" +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/accessibility/XAccessibleTable.hpp> + +// ============================================================================ + +namespace accessibility { + +typedef ::cppu::ImplHelper1< + ::com::sun::star::accessibility::XAccessibleTable > + AccessibleBrowseBoxTableImplHelper; + +/** The BrowseBox accessible table objects inherit from this base class. It + implements basic functionality for the XAccessibleTable interface. + BrowseBox table objects are: the data table, the column header bar and the + row header bar. */ +class AccessibleBrowseBoxTableBase : + public BrowseBoxAccessibleElement, + public AccessibleBrowseBoxTableImplHelper +{ +public: + /** Constructor sets specified name and description. If the constant of a + text is BBTEXT_NONE, the derived class has to set the text via + implSetName() and implSetDescription() (in Ctor) or later via + setAccessibleName() and setAccessibleDescription() (these methods + notify the listeners about the change). + @param rxParent XAccessible interface of the parent object. + @param rBrowseBox The BrowseBox control. + @param eNameText The constant for the name text. + @param eDescrText The constant for the description text. */ + AccessibleBrowseBoxTableBase( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::IAccessibleTableProvider& rBrowseBox, + ::svt::AccessibleBrowseBoxObjType eObjType ); + +protected: + virtual ~AccessibleBrowseBoxTableBase(); + +public: + // XAccessibleContext ----------------------------------------------------- + + /** @return The count of visible children. */ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The role of this object (a table). */ + virtual sal_Int16 SAL_CALL getAccessibleRole() + throw ( ::com::sun::star::uno::RuntimeException ); + + /* Derived classes have to implement: + - getAccessibleChild, + - getAccessibleIndexInParent. */ + + // XAccessibleComponent --------------------------------------------------- + + /* Derived classes have to implement: + - getAccessibleAt, + - grabFocus, + - getAccessibleKeyBinding. */ + + // 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 ); + + /* Derived classes have to implement: + - getAccessibleRowDescription, + - getAccessibleColumnDescription, + - getAccessibleRowHeaders, + - getAccessibleColumnHeaders, + - getSelectedAccessibleRows, + - getSelectedAccessibleColumns, + - isAccessibleRowSelected, + - isAccessibleColumnSelected, + - getAccessibleCellAt, + - isAccessibleSelected. */ + + // XInterface ------------------------------------------------------------- + + /** Queries for a new interface. */ + ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type& rType ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Aquires the object (calls acquire() on base class). */ + virtual void SAL_CALL acquire() throw (); + + /** Releases the object (calls release() on base class). */ + virtual void SAL_CALL release() throw (); + + // XTypeProvider ---------------------------------------------------------- + + /** @return A sequence of possible types (received from base classes). */ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return An unique implementation ID. */ + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo ----------------------------------------------------------- + + /* Derived classes have to implement: + - getImplementationName */ + +protected: + // internal virtual methods ----------------------------------------------- + + /** @attention This method requires locked mutex's and a living object. + @return The count of data rows without header bar. */ + virtual sal_Int32 implGetRowCount() const; + /** @attention This method requires locked mutex's and a living object. + @return The count of data columns without "handle column". */ + virtual sal_Int32 implGetColumnCount() const; + + // internal helper methods ------------------------------------------------ + + /** @return <TRUE/>, if first BrowseBox column is the "handle column". */ + sal_Bool implHasHandleColumn() const; + + /** @attention This method requires locked mutex's and a living object. + @param nColumn + the position of the column in the Accessible world + @return + the position of the column in VCL the Accessible world + */ + sal_uInt16 implToVCLColumnPos( sal_Int32 nColumn ) const; + + /** @attention This method requires locked mutex's and a living object. + @return The number of cells of the table. */ + sal_Int32 implGetChildCount() const; + + /** @attention This method requires locked mutex's and a living object. + @return The row index of the specified cell index. */ + sal_Int32 implGetRow( sal_Int32 nChildIndex ) const; + /** @attention This method requires locked mutex's and a living object. + @return The column index of the specified cell index. */ + sal_Int32 implGetColumn( sal_Int32 nChildIndex ) const; + /** @attention This method requires locked mutex's and a living object. + @return The child index of the specified cell address. */ + sal_Int32 implGetChildIndex( sal_Int32 nRow, sal_Int32 nColumn ) const; + + /** @attention This method requires locked mutex's and a living object. + @return <TRUE/>, if the specified row is selected. */ + sal_Bool implIsRowSelected( sal_Int32 nRow ) const; + /** @attention This method requires locked mutex's and a living object. + @return <TRUE/>, if the specified column is selected. */ + sal_Bool implIsColumnSelected( sal_Int32 nColumn ) const; + + /** Selects/deselects a row (tries to expand selection). + @attention This method requires locked mutex's and a living object. + @param bSelect <TRUE/> = select, <FALSE/> = deselect */ + void implSelectRow( sal_Int32 nRow, sal_Bool bSelect ); + /** Selects/deselects a column (tries to expand selection). + @attention This method requires locked mutex's and a living object. + @param bSelect <TRUE/> = select, <FALSE/> = deselect */ + void implSelectColumn( sal_Int32 nColumnPos, sal_Bool bSelect ); + + /** @attention This method requires locked mutex's and a living object. + @return The count of selected rows. */ + sal_Int32 implGetSelectedRowCount() const; + /** @attention This method requires locked mutex's and a living object. + @return The count of selected columns. */ + sal_Int32 implGetSelectedColumnCount() const; + + /** Fills a sequence with sorted indexes of completely selected rows. + @attention This method requires locked mutex's and a living object. + @param rSeq Out-parameter that takes the sorted row index list. */ + void implGetSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq ); + /** Fills a sequence with sorted indexes of completely selected columns. + @attention This method requires locked mutex's and a living object. + @param rSeq Out-parameter that takes the sorted column index list. */ + void implGetSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq ); + + /** @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 ); +}; + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableCell.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableCell.hxx new file mode 100644 index 000000000000..b689235908c5 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableCell.hxx @@ -0,0 +1,145 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef ACCESSIBILITY_EXT_ACCESSIBILEBROWSEBOXTABLECELL_HXX +#define ACCESSIBILITY_EXT_ACCESSIBILEBROWSEBOXTABLECELL_HXX + +#include "accessibility/extended/accessiblebrowseboxcell.hxx" +#include <comphelper/accessibletexthelper.hxx> +#include <cppuhelper/implbase2.hxx> + +namespace accessibility +{ + typedef ::cppu::ImplHelper2 < ::com::sun::star::accessibility::XAccessibleText + , ::com::sun::star::accessibility::XAccessible + > AccessibleTextHelper_BASE; + + // implementation of a table cell of BrowseBox + class AccessibleBrowseBoxTableCell :public AccessibleBrowseBoxCell + ,public AccessibleTextHelper_BASE + ,public ::comphelper::OCommonAccessibleText + { + private: + sal_Int32 m_nOffset; + + protected: + // OCommonAccessibleText + virtual ::rtl::OUString implGetText(); + virtual ::com::sun::star::lang::Locale implGetLocale(); + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); + + public: + AccessibleBrowseBoxTableCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + ::svt::IAccessibleTableProvider& _rBrowseBox, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, + sal_Int32 _nRowId, + sal_uInt16 _nColId, + sal_Int32 _nOffset ); + + void nameChanged( const ::rtl::OUString& rNewName, const ::rtl::OUString& rOldName ); + + // XInterface ------------------------------------------------------------- + + /** Queries for a new interface. */ + ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type& rType ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Aquires the object (calls acquire() on base class). */ + virtual void SAL_CALL acquire() throw (); + + /** Releases the object (calls release() on base class). */ + virtual void SAL_CALL release() throw (); + + // XEventListener + using AccessibleBrowseBoxBase::disposing; + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) + throw(::com::sun::star::uno::RuntimeException); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The name of this class. + */ + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The count of visible children. + */ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The XAccessible interface of the specified child. + */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** Creates a new AccessibleStateSetHelper and fills it with states of the + current object. + @return + A filled AccessibleStateSetHelper. + */ + ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); + + // XAccessible ------------------------------------------------------------ + + /** @return The XAccessibleContext interface of this object. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL + getAccessibleContext() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // ACCESSIBILITY_EXT_ACCESSIBILEBROWSEBOXTABLECELL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx new file mode 100644 index 000000000000..ff31cb78bfaa --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx @@ -0,0 +1,267 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROL_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROL_HXX + +#include <accessibility/extended/AccessibleGridControlBase.hxx> +#include <accessibility/extended/AccessibleGridControlTable.hxx> +#include <cppuhelper/weakref.hxx> +#include <svtools/accessibletable.hxx> + + +#include <memory> + +using namespace ::svt::table; + +// ============================================================================ + +namespace accessibility { + + class AccessibleGridControl_Impl; + +// ============================================================================ + +/** This class represents the complete accessible Grid Control object. */ +class AccessibleGridControl : public AccessibleGridControlBase +{ + friend class AccessibleGridControlAccess; + +protected: + AccessibleGridControl( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator, + ::svt::table::IAccessibleTable& _rTable + ); + + virtual ~AccessibleGridControl(); + + /** Cleans up members. */ + using AccessibleGridControlBase::disposing; + virtual void SAL_CALL disposing(); + +protected: + // XAccessibleContext ----------------------------------------------------- + + /** @return The count of visible children. */ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The XAccessible interface of the specified child. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The role of this object (a table). */ + virtual sal_Int16 SAL_CALL getAccessibleRole() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleComponent --------------------------------------------------- + + /** @return + The accessible child rendered under the given point. + */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Grabs the focus to the Grid Control. */ + virtual void SAL_CALL grabFocus() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The key bindings associated with this object. */ + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo ----------------------------------------------------------- + + /** @return + The name of this class. + */ + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ); + +public: + // helper functions + /** returns the accessible object for the row or the column header bar + */ + inline ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + getHeaderBar( ::svt::table::AccessibleTableControlObjType _eObjType ) + { + return implGetHeaderBar(_eObjType); + } + + /** returns the accessible object for the table representation + */ + inline ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + getTable( ) + { + return implGetTable(); + } + +protected: + // internal virtual methods ----------------------------------------------- + + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) relative to the parent window. */ + virtual Rectangle implGetBoundingBox(); + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) in screen coordinates. */ + virtual Rectangle implGetBoundingBoxOnScreen(); + + // internal helper methods ------------------------------------------------ + + /** This method creates (once) and returns the accessible data table child. + @attention This method requires locked mutex's and a living object. + @return The XAccessible interface of the data table. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > implGetTable(); + + /** This method creates (once) and returns the specified header bar. + @attention This method requires locked mutex's and a living object. + @return The XAccessible interface of the header bar. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + implGetHeaderBar( ::svt::table::AccessibleTableControlObjType eObjType ); + + /** This method returns one of the children that are always present: + Data table, row and column header bar or corner control. + @attention This method requires locked mutex's and a living object. + @return The XAccessible interface of the specified child. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + implGetFixedChild( sal_Int32 nChildIndex ); + + /** This method creates and returns an accessible table. + @return An AccessibleGridControlTable. */ + virtual AccessibleGridControlTable* createAccessibleTable(); + +private: + // members ---------------------------------------------------------------- + ::std::auto_ptr< AccessibleGridControl_Impl > m_pImpl; +}; + +// ============================================================================ +/** the XAccessible which creates/returns an AccessibleGridControl + + <p>The instance holds it's XAccessibleContext with a hard reference, while + the contxt holds this instance weak.</p> +*/ +typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessible > AccessibleGridControlAccess_Base; + +class AccessibleGridControlAccess :public AccessibleGridControlAccess_Base + ,public ::svt::table::IAccessibleTableControl +{ +private: + ::osl::Mutex m_aMutex; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + m_xParent; + ::svt::table::IAccessibleTable& m_rTable; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + m_xContext; + AccessibleGridControl* m_pContext; + // note that this pointer is valid as long as m_xContext is valid! + +public: + AccessibleGridControlAccess( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + ::svt::table::IAccessibleTable& _rTable + ); + + /// checks whether the accessible context is still alive + bool isContextAlive() const; + + /// returns the AccessibleContext belonging to this Accessible + inline AccessibleGridControl* getContext() { return m_pContext; } + inline const AccessibleGridControl* getContext() const { return m_pContext; } + +protected: + virtual ~AccessibleGridControlAccess(); + + // XAccessible + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > + SAL_CALL getAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException ); + + // IAccessibleTable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getMyself() + { + return this; + } + void dispose(); + virtual sal_Bool isAlive() const + { + return isContextAlive(); + } + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getTableHeader( ::svt::table::AccessibleTableControlObjType _eObjType ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible; + AccessibleGridControl* pContext( getContext() ); + if ( pContext ) + xAccessible = pContext->getHeaderBar( _eObjType ); + return xAccessible; + } + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getTable() + { + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible; + AccessibleGridControl* pContext( getContext() ); + if ( pContext ) + xAccessible = pContext->getTable(); + return xAccessible; + } + virtual void commitEvent( sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue ) + { + AccessibleGridControl* pContext( getContext() ); + if ( pContext ) + pContext->commitEvent( nEventId, rNewValue, rOldValue ); + } + +private: + AccessibleGridControlAccess(); // never implemented + AccessibleGridControlAccess( const AccessibleGridControlAccess& ); // never implemented + AccessibleGridControlAccess& operator=( const AccessibleGridControlAccess& ); // never implemented +}; + +// ============================================================================ +} // namespace accessibility + +// ============================================================================ + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx new file mode 100644 index 000000000000..383c6410eaeb --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx @@ -0,0 +1,462 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLBASE_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLBASE_HXX + +#include <svtools/accessibletable.hxx> +#include <tools/debug.hxx> +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> +#include <vcl/svapp.hxx> +#include <cppuhelper/compbase4.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <unotools/accessiblestatesethelper.hxx> +#include <toolkit/helper/convert.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include <comphelper/accessibleeventnotifier.hxx> +#include <comphelper/uno3.hxx> + +// ============================================================================ + +class Window; + +namespace utl { + class AccessibleStateSetHelper; +} + +// ============================================================================ + +namespace accessibility { + +// ============================================================================ + +// ============================================================================ + +typedef ::cppu::WeakAggComponentImplHelper4< + ::com::sun::star::accessibility::XAccessibleContext, + ::com::sun::star::accessibility::XAccessibleComponent, + ::com::sun::star::accessibility::XAccessibleEventBroadcaster, + ::com::sun::star::lang::XServiceInfo > + AccessibleGridControlImplHelper; + +/** The GridControl accessible objects inherit from this base class. It + implements basic functionality for various Accessibility interfaces and + the event broadcaster and contains the ::osl::Mutex. */ +class AccessibleGridControlBase : + public ::comphelper::OBaseMutex, + public AccessibleGridControlImplHelper +{ +public: + /** Constructor sets specified name and description. + @param rxParent XAccessible interface of the parent object. + @param rTable The Table control. + @param eNameText The constant for the name text. + @param eDescrText The constant for the description text. */ + AccessibleGridControlBase( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& rTable, + ::svt::table::AccessibleTableControlObjType eObjType ); + +protected: + virtual ~AccessibleGridControlBase(); + + /** Commits DeFunc event to listeners and cleans up members. */ + virtual void SAL_CALL disposing(); + +public: + // XAccessibleContext ----------------------------------------------------- + + /** @return A reference to the parent accessible object. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The description of this object. + */ + virtual ::rtl::OUString SAL_CALL getAccessibleDescription() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The name of this object. + */ + virtual ::rtl::OUString SAL_CALL getAccessibleName() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The relation set (the GridControl does not have one). + */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL + getAccessibleRelationSet() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The set of current states. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL + getAccessibleStateSet() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The parent's locale. */ + virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() + throw ( ::com::sun::star::accessibility::IllegalAccessibleComponentStateException, + ::com::sun::star::uno::RuntimeException ); + + /** @return + The role of this object. Panel, ROWHEADER, COLUMNHEADER, TABLE, TABLE_CELL are supported. + */ + virtual sal_Int16 SAL_CALL getAccessibleRole() + throw ( ::com::sun::star::uno::RuntimeException ); + + /* Derived classes have to implement: + - getAccessibleChildCount, + - getAccessibleChild, + - getAccessibleRole. + Derived classes may overwrite getAccessibleIndexInParent to increase + performance. */ + + // XAccessibleComponent --------------------------------------------------- + + /** @return + <TRUE/>, if the point lies within the bounding box of this object. */ + virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& rPoint ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The bounding box of this object. */ + virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The upper left corner of the bounding box relative to the parent. */ + virtual ::com::sun::star::awt::Point SAL_CALL getLocation() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The upper left corner of the bounding box in screen coordinates. */ + virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The size of the bounding box. */ + virtual ::com::sun::star::awt::Size SAL_CALL getSize() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the object is showing. */ + virtual sal_Bool SAL_CALL isShowing() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the object is visible. */ + virtual sal_Bool SAL_CALL isVisible() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the object can accept the focus. */ + virtual sal_Bool SAL_CALL isFocusTraversable() + 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); + + + /* Derived classes have to implement: + - getAccessibleAt, + - grabFocus, + - getAccessibleKeyBinding. */ + + /** @return + No key bindings supported by default. + */ + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() + throw ( ::com::sun::star::uno::RuntimeException ); + /** @return + The accessible child rendered under the given point. + */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleEventBroadcaster -------------------------------------------- + + /** Adds a new event listener */ + using cppu::WeakAggComponentImplHelperBase::addEventListener; + virtual void SAL_CALL addEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleEventListener>& rxListener ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Removes an event listener. */ + using cppu::WeakAggComponentImplHelperBase::removeEventListener; + virtual void SAL_CALL removeEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleEventListener>& rxListener ) + throw ( ::com::sun::star::uno::RuntimeException ); + + // XTypeProvider ---------------------------------------------------------- + + /** @return An unique implementation ID. */ + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XServiceInfo ----------------------------------------------------------- + + /** @return Whether the specified service is supported by this class. */ + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return A list of all supported services. */ + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames() + throw ( ::com::sun::star::uno::RuntimeException ); + + /* Derived classes have to implement: + - getImplementationName. */ + + // helper methods --------------------------------------------------------- + + /** @return The GridControl object type. */ + inline ::svt::table::AccessibleTableControlObjType getType() const; + + /** Commits an event to all listeners. */ + void commitEvent( + sal_Int16 nEventId, + const ::com::sun::star::uno::Any& rNewValue, + + const ::com::sun::star::uno::Any& rOldValue ); + /** @return <TRUE/>, if the object is not disposed or disposing. */ + sal_Bool isAlive() const; + +protected: + // internal virtual methods ----------------------------------------------- + + /** Determines whether the Grid control is really showing inside of + its parent accessible window. Derived classes may implement different + behaviour. + @attention This method requires locked mutex's and a living object. + @return <TRUE/>, if the object is really showing. */ + virtual sal_Bool implIsShowing(); + + /** Derived classes return the bounding box relative to the parent window. + @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) relative to the parent window. */ + virtual Rectangle implGetBoundingBox() = 0; + ///** Derived classes return the bounding box in screen coordinates. + // @attention This method requires locked mutex's and a living object. + // @return The bounding box (VCL rect.) in screen coordinates. */ + virtual Rectangle implGetBoundingBoxOnScreen() = 0; + + /** Creates a new AccessibleStateSetHelper and fills it with states of the + current object. This method calls FillStateSet at the GridControl which + fills it with more states depending on the object type. Derived classes + may overwrite this method and add more states. + @attention This method requires locked mutex's. + @return A filled AccessibleStateSetHelper. */ + virtual ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); + + // internal helper methods ------------------------------------------------ + + /** @throws <type>DisposedException</type> If the object is not alive. */ + void ensureIsAlive() const + throw ( ::com::sun::star::lang::DisposedException ); + + /** @return The ::osl::Mutex member provided by the class OBaseMutex. */ + inline ::osl::Mutex& getOslMutex(); + /** @return Pointer to the global ::osl::Mutex. */ + static inline ::osl::Mutex* getOslGlobalMutex(); + + /** Changes the name of the object (flat assignment, no notify). + @attention This method requires a locked mutex. */ + inline void implSetName( const ::rtl::OUString& rName ); + /** Changes the description of the object (flat assignment, no notify). + @attention This method requires a locked mutex. */ + inline void implSetDescription( const ::rtl::OUString& rDescription ); + + /** Locks all mutex's and calculates the bounding box relative to the + parent window. + @return The bounding box (VCL rect.) relative to the parent object. */ + Rectangle getBoundingBox() + throw ( ::com::sun::star::lang::DisposedException ); + ///** Locks all mutex's and calculates the bounding box in screen + // coordinates. + // @return The bounding box (VCL rect.) in screen coordinates. */ + Rectangle getBoundingBoxOnScreen() + throw ( ::com::sun::star::lang::DisposedException ); + + /** Creates a new UUID, if rId is empty. + @attention This method requires locked global mutex to prevent double + creation of an UUID. */ + static void implCreateUuid( ::com::sun::star::uno::Sequence< sal_Int8 >& rId ); + + ::comphelper::AccessibleEventNotifier::TClientId getClientId() const { return m_aClientId; } + void setClientId(::comphelper::AccessibleEventNotifier::TClientId _aNewClientId) { m_aClientId = _aNewClientId; } + +public: + // public versions of internal helper methods, with access control + struct TC_AccessControl { friend class TC_SolarMethodGuard; private: TC_AccessControl() { } }; + + inline ::osl::Mutex& getMutex( const TC_AccessControl& ) { return getOslMutex(); } + inline void ensureIsAlive( const TC_AccessControl& ) { ensureIsAlive(); } + +protected: + // members ---------------------------------------------------------------- + + /** The parent accessible object. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > m_xParent; + /** The SVT Table control. */ + ::svt::table::IAccessibleTable& m_aTable; + /** The type of this object (for names, descriptions, state sets, ...). */ + ::svt::table::AccessibleTableControlObjType m_eObjType; + +private: + /** Localized name. */ + ::rtl::OUString m_aName; + /** Localized description text. */ + ::rtl::OUString m_aDescription; + ::comphelper::AccessibleEventNotifier::TClientId m_aClientId; +}; + +// ============================================================================ +// a version of AccessibleGridControlBase which implements not only the XAccessibleContext, +// but also the XAccessible + +typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible + > GridControlAccessibleElement_Base; + +class GridControlAccessibleElement + :public AccessibleGridControlBase + ,public GridControlAccessibleElement_Base +{ +protected: + /** Constructor sets specified name and description. + + @param rxParent XAccessible interface of the parent object. + @param rTable The Table control. + @param eNameText The constant for the name text. + @param eDescrText The constant for the description text. + */ + GridControlAccessibleElement( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& rTable, + ::svt::table::AccessibleTableControlObjType eObjType ); + +public: + // XInterface + DECLARE_XINTERFACE( ) + // XTypeProvider + DECLARE_XTYPEPROVIDER( ) + +protected: + virtual ~GridControlAccessibleElement(); + +protected: + // XAccessible ------------------------------------------------------------ + + /** @return The XAccessibleContext interface of this object. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL + getAccessibleContext() + throw ( ::com::sun::star::uno::RuntimeException ); + +private: + GridControlAccessibleElement(); // never implemented + GridControlAccessibleElement( const GridControlAccessibleElement& ); // never implemented + GridControlAccessibleElement& operator=( const GridControlAccessibleElement& ); // never implemented +}; + +// ============================================================================ +// a helper class for protecting methods which need to lock the solar mutex in addition to the own mutex + +typedef ::osl::MutexGuard OslMutexGuard; + +class TC_SolarMethodGuard : public SolarMutexGuard, public OslMutexGuard +{ +public: + inline TC_SolarMethodGuard( AccessibleGridControlBase& _rOwner, bool _bEnsureAlive = true ) + : SolarMutexGuard(), + OslMutexGuard( _rOwner.getMutex( AccessibleGridControlBase::TC_AccessControl() ) ) + { + if ( _bEnsureAlive ) + _rOwner.ensureIsAlive( AccessibleGridControlBase::TC_AccessControl() ); + } +}; + +// inlines -------------------------------------------------------------------- + +inline ::svt::table::AccessibleTableControlObjType AccessibleGridControlBase::getType() const +{ + return m_eObjType; +} + +inline ::osl::Mutex& AccessibleGridControlBase::getOslMutex() +{ + return m_aMutex; +} + +inline ::osl::Mutex* AccessibleGridControlBase::getOslGlobalMutex() +{ + return ::osl::Mutex::getGlobalMutex(); +} + +inline void AccessibleGridControlBase::implSetName( + const ::rtl::OUString& rName ) +{ + m_aName = rName; +} + +inline void AccessibleGridControlBase::implSetDescription( + const ::rtl::OUString& rDescription ) +{ + m_aDescription = rDescription; +} + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + +#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLBASE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx new file mode 100644 index 000000000000..6732fa2b6576 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx @@ -0,0 +1,220 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADER_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADER_HXX + + +#include "accessibility/extended/AccessibleGridControlHeaderCell.hxx" +#include "accessibility/extended/AccessibleGridControlTableBase.hxx" + +// ============================================================================ + +namespace accessibility { + +// ============================================================================ + +/** This class represents the accessible object of a header bar of a Grid Control + (row or column header bar). This object supports the + XAccessibleSelection interface. Selecting a child of this object selects + complete rows or columns of the data table. */ +class AccessibleGridControlHeader : public AccessibleGridControlTableBase +{ +public: + /** @param eObjType One of the two allowed types TCTYPE_ROWHEADERBAR or + TCTYPE_COLUMNHEADERBAR. */ + AccessibleGridControlHeader( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& rTable, + ::svt::table::AccessibleTableControlObjType eObjType ); + +protected: + virtual ~AccessibleGridControlHeader(); + +public: + // XAccessibleContext ----------------------------------------------------- + + /** @return + The XAccessible interface of the specified child. + */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleComponent --------------------------------------------------- + + /** @return The accessible child rendered under the given point. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Grabs the focus to (the current cell of) the data table. */ + virtual void SAL_CALL grabFocus() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The key bindings associated with this object. */ + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleTable ------------------------------------------------------- + + /** @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 ); + + // XServiceInfo ----------------------------------------------------------- + + /** @return The name of this class. */ + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return An unique implementation ID. */ + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw ( ::com::sun::star::uno::RuntimeException ); + +protected: + // internal virtual methods ----------------------------------------------- + /** @attention This method requires locked mutex's and a living object. + @return The absolute child index from the index of selected children. + @throws <type>IndexOutOfBoundsException</type> + If the specified index is invalid. */ + //sal_Int32 implGetChildIndexFromSelectedIndex( sal_Int32 nSelectedChildIndex ) + // throw ( ::com::sun::star::lang::IndexOutOfBoundsException ); + + /** Returns the specified row or column. Uses one of the parameters, + depending on object type. + @attention This method requires locked mutex's and a living object. + @return The XAccessible interface of the specified column/row. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > + implGetChild( sal_Int32 nRow, sal_uInt32 nColumnPos ); + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) relative to the parent window. */ + virtual Rectangle implGetBoundingBox(); + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) in screen coordinates. */ + virtual Rectangle implGetBoundingBoxOnScreen(); + + /** @attention This method requires locked mutex's and a living object. + @return The count of used rows. */ + virtual sal_Int32 implGetRowCount() const; + /** @attention This method requires locked mutex's and a living object. + @return The count of used columns. */ + virtual sal_Int32 implGetColumnCount() const; + + // internal helper methods ------------------------------------------------ + + /** @return <TRUE/>, if the objects is a header bar for rows. */ + inline sal_Bool isRowBar() const; + /** @return <TRUE/>, if the objects is a header bar for columns. */ + inline sal_Bool isColumnBar() const; +}; + +// inlines -------------------------------------------------------------------- + +inline sal_Bool AccessibleGridControlHeader::isRowBar() const +{ + return getType() == ::svt::table::TCTYPE_ROWHEADERBAR; +} + +inline sal_Bool AccessibleGridControlHeader::isColumnBar() const +{ + return getType() == ::svt::table::TCTYPE_COLUMNHEADERBAR; +} + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + +#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLHEADER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx new file mode 100644 index 000000000000..f7f02f5828b0 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx @@ -0,0 +1,104 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADERCELL_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADERCELL_HXX + +#include "accessibility/extended/AccessibleGridControlTableCell.hxx" + +namespace accessibility +{ + class AccessibleGridControlHeaderCell : public AccessibleGridControlCell, public ::com::sun::star::accessibility::XAccessible + { + sal_Int32 m_nColumnRowId; + public: + AccessibleGridControlHeaderCell(sal_Int32 _nColumnRowId, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& _rTable, + ::svt::table::AccessibleTableControlObjType _eObjType); + /** @return The count of visible children. */ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The XAccessible interface of the specified child. */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException ); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw ( ::com::sun::star::uno::RuntimeException ); + + /** Grabs the focus to the GridControl. */ + virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException ); + + // XInterface ------------------------------------------------------------- + + /** Queries for a new interface. */ + ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type& rType ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Aquires the object (calls acquire() on base class). */ + virtual void SAL_CALL acquire() throw (); + + /** Releases the object (calls release() on base class). */ + virtual void SAL_CALL release() throw (); + // XAccessible ------------------------------------------------------------ + + /** @return The XAccessibleContext interface of this object. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL + getAccessibleContext() + throw ( ::com::sun::star::uno::RuntimeException ); + //------------------------------------------------------------------------- + inline sal_Bool isRowBarCell() const + { + return getType() == ::svt::table::TCTYPE_ROWHEADERCELL; + } + + /** @return + The name of this class. + */ + virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ); + + /** Creates a new AccessibleStateSetHelper and fills it with states of the + current object. + @return + A filled AccessibleStateSetHelper. + */ + ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); + + protected: + virtual Rectangle implGetBoundingBox(); + + virtual Rectangle implGetBoundingBoxOnScreen(); + private: + ::rtl::OUString m_sHeaderName; + }; +} + +#endif // ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADERCELL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx new file mode 100644 index 000000000000..1d79e1d2d199 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx @@ -0,0 +1,228 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLE_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLE_HXX + +#include "accessibility/extended/AccessibleGridControlTableBase.hxx" +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> + +// ============================================================================ + +namespace accessibility { + +// ============================================================================ +typedef ::cppu::ImplHelper1< + ::com::sun::star::accessibility::XAccessibleSelection > + AccessibleGridControlTableImplHelper1; +/** This class represents the accessible object of the data table of a + Grid control. */ +class AccessibleGridControlTable : public AccessibleGridControlTableBase, + public AccessibleGridControlTableImplHelper1 +{ +public: + AccessibleGridControlTable( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& rTable, + ::svt::table::AccessibleTableControlObjType _eType); + +protected: + virtual ~AccessibleGridControlTable(); + +public: + // XAccessibleContext ----------------------------------------------------- + + /** @return The XAccessible interface of the specified child. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleComponent --------------------------------------------------- + + /** @return The accessible child rendered under the given point. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Grabs the focus to (the current cell of) the data table. */ + virtual void SAL_CALL grabFocus() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The key bindings associated with this object. */ + virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleTable ------------------------------------------------------- + + /** @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 ); + + // XAccessibleSelection --------------------------------------------------- + + /** Selects the specified child (row or column of the table). */ + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** @return <TRUE/>, if the specified child (row/column) is selected. */ + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** Clears the complete selection. */ + virtual void SAL_CALL clearAccessibleSelection() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Selects all children or first, if multiselection is not supported. */ + virtual void SAL_CALL selectAllAccessibleChildren() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The number of selected rows/columns. */ + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The specified selected row/column. */ + virtual ::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 ); + + /** Removes the specified row/column from the selection. */ + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + // XInterface ------------------------------------------------------------- + + /** Queries for a new interface. */ + ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type& rType ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Aquires the object (calls acquire() on base class). */ + virtual void SAL_CALL acquire() throw (); + + /** Releases the object (calls release() on base class). */ + virtual void SAL_CALL release() throw (); + // XServiceInfo ----------------------------------------------------------- + + /** @return The name of this class. */ + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ); + +protected: + // internal virtual methods ----------------------------------------------- + + /** @attention This method requires locked mutex's and a living object. + @return The bounding box (VCL rect.) relative to the parent window. */ + virtual Rectangle implGetBoundingBox(); + ///** @attention This method requires locked mutex's and a living object. + // @return The bounding box (VCL rect.) in screen coordinates. */ + virtual Rectangle implGetBoundingBoxOnScreen(); + + + //// internal helper methods ------------------------------------------------ + ///** @attention This method requires a locked mutex. + // @return The XAccessibleTable interface of the specified header bar. */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleTable > + implGetHeaderBar( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::uno::RuntimeException ); +}; + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + +#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx new file mode 100644 index 000000000000..daa6fd179ef6 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx @@ -0,0 +1,230 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLEBASE_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLEBASE_HXX + +#include "accessibility/extended/AccessibleGridControlBase.hxx" +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/accessibility/XAccessibleTable.hpp> + +// ============================================================================ + +namespace accessibility { + +typedef ::cppu::ImplHelper1< + ::com::sun::star::accessibility::XAccessibleTable > + AccessibleGridControlTableImplHelper; + +/** The Grid Control accessible table objects inherit from this base class. It + implements basic functionality for the XAccessibleTable interface. + Grid COntrol table objects are: the data table, the column header bar and the + row header bar. */ +class AccessibleGridControlTableBase : + public GridControlAccessibleElement, + public AccessibleGridControlTableImplHelper +{ +public: + /** Constructor sets specified name and description. + @param rxParent XAccessible interface of the parent object. + @param rTable The Table control. + @param eNameText The constant for the name text. + @param eDescrText The constant for the description text. */ + AccessibleGridControlTableBase( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rxParent, + ::svt::table::IAccessibleTable& rTable, + ::svt::table::AccessibleTableControlObjType eObjType ); + +protected: + virtual ~AccessibleGridControlTableBase(); + +public: + // XAccessibleContext ----------------------------------------------------- + + /** @return The count of visible children. */ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The role of this object (a table). */ + virtual sal_Int16 SAL_CALL getAccessibleRole() + throw ( ::com::sun::star::uno::RuntimeException ); + + /* Derived classes have to implement: + - getAccessibleChild, + - getAccessibleIndexInParent. */ + + // XAccessibleComponent --------------------------------------------------- + + /* Derived classes have to implement: + - getAccessibleAt, + - grabFocus, + - getAccessibleKeyBinding. */ + + // 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 ); + + /* Derived classes have to implement: + - getAccessibleRowDescription, + - getAccessibleColumnDescription, + - getAccessibleRowHeaders, + - getAccessibleColumnHeaders, + - getSelectedAccessibleRows, + - getSelectedAccessibleColumns, + - isAccessibleRowSelected, + - isAccessibleColumnSelected, + - getAccessibleCellAt, + - isAccessibleSelected. */ + + // XInterface ------------------------------------------------------------- + + /** Queries for a new interface. */ + ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type& rType ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Aquires the object (calls acquire() on base class). */ + virtual void SAL_CALL acquire() throw (); + + /** Releases the object (calls release() on base class). */ + virtual void SAL_CALL release() throw (); + + // XTypeProvider ---------------------------------------------------------- + + /** @return A sequence of possible types (received from base classes). */ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return An unique implementation ID. */ + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw ( ::com::sun::star::uno::RuntimeException ); + +protected: + // internal helper methods ------------------------------------------------ + + /** @attention This method requires locked mutex's and a living object. + @return The number of cells of the table. */ + sal_Int32 implGetChildCount() const; + + /** @attention This method requires locked mutex's and a living object. + @return The row index of the specified cell index. */ + sal_Int32 implGetRow( sal_Int32 nChildIndex ) const; + /** @attention This method requires locked mutex's and a living object. + @return The column index of the specified cell index. */ + sal_Int32 implGetColumn( sal_Int32 nChildIndex ) const; + /** @attention This method requires locked mutex's and a living object. + @return The child index of the specified cell address. */ + sal_Int32 implGetChildIndex( sal_Int32 nRow, sal_Int32 nColumn ) const; + + /** Fills a sequence with sorted indexes of completely selected rows. + @attention This method requires locked mutex's and a living object. + @param rSeq Out-parameter that takes the sorted row index list. */ + void implGetSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq ); + /** Fills a sequence with sorted indexes of completely selected columns. + @attention This method requires locked mutex's and a living object. + @param rSeq Out-parameter that takes the sorted column index list. */ + //void implGetSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq ); + + /** @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 ); +}; + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + +#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLEBASE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx new file mode 100644 index 000000000000..7dd2d982e186 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx @@ -0,0 +1,170 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX +#define ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX + +#include <comphelper/accessibletexthelper.hxx> +#include <cppuhelper/implbase2.hxx> +#include "accessibility/extended/AccessibleGridControlBase.hxx" +#include <svtools/accessibletable.hxx> + +namespace accessibility +{ + class AccessibleGridControlCell : public AccessibleGridControlBase + { + private: + sal_Int32 m_nRowPos; // the row number of the table cell + sal_Int32 m_nColPos; // the column id of the table cell + + protected: + // attribute access + inline sal_Int32 getRowPos( ) const { return m_nRowPos; } + inline sal_Int32 getColumnPos( ) const { return m_nColPos; } + + // XAccessibleComponent + virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException ); + + protected: + AccessibleGridControlCell( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + ::svt::table::IAccessibleTable& _rTable, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos, + ::svt::table::AccessibleTableControlObjType _eType + ); + + virtual ~AccessibleGridControlCell(); + + private: + AccessibleGridControlCell(); // never implemented + AccessibleGridControlCell( const AccessibleGridControlCell& ); // never implemented + AccessibleGridControlCell& operator=( const AccessibleGridControlCell& ); // never implemented + }; + + typedef ::cppu::ImplHelper2 < ::com::sun::star::accessibility::XAccessibleText + , ::com::sun::star::accessibility::XAccessible + > AccessibleTextHelper_BASE; + // implementation of a table cell of GridControl + class AccessibleGridControlTableCell :public AccessibleGridControlCell + ,public AccessibleTextHelper_BASE + ,public ::comphelper::OCommonAccessibleText + { + private: + sal_Int32 m_nOffset; + + protected: + // OCommonAccessibleText + virtual ::rtl::OUString implGetText(); + virtual ::com::sun::star::lang::Locale implGetLocale(); + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); + virtual Rectangle implGetBoundingBox(); + virtual Rectangle implGetBoundingBoxOnScreen(); + + public: + AccessibleGridControlTableCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + ::svt::table::IAccessibleTable& _rTable, + sal_Int32 _nRowId, + sal_uInt16 _nColId, + svt::table::AccessibleTableControlObjType eObjType); + + // XInterface ------------------------------------------------------------- + + /** Queries for a new interface. */ + ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type& rType ) + throw ( ::com::sun::star::uno::RuntimeException ); + + /** Aquires the object (calls acquire() on base class). */ + virtual void SAL_CALL acquire() throw (); + + /** Releases the object (calls release() on base class). */ + virtual void SAL_CALL release() throw (); + + /** @return The index of this object among the parent's children. */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The name of this class. + */ + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The count of visible children. + */ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return + The XAccessible interface of the specified child. + */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + /** Creates a new AccessibleStateSetHelper and fills it with states of the + current object. + @return + A filled AccessibleStateSetHelper. + */ + ::utl::AccessibleStateSetHelper* implCreateStateSetHelper(); + + // XAccessible ------------------------------------------------------------ + + /** @return The XAccessibleContext interface of this object. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL + getAccessibleContext() + throw ( ::com::sun::star::uno::RuntimeException ); + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; +} +#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx new file mode 100644 index 000000000000..fb8664e521e4 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACC_ACCESSIBLETOOLPANELDECK_HXX +#define ACC_ACCESSIBLETOOLPANELDECK_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <cppuhelper/implbase1.hxx> +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + +#include <boost/scoped_ptr.hpp> + +namespace svt +{ + class ToolPanelDeck; +} + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + //================================================================================================================== + //= AccessibleToolPanelDeck + //================================================================================================================== + class AccessibleToolPanelDeck_Impl; + typedef VCLXAccessibleComponent AccessibleToolPanelDeck_Base; + class AccessibleToolPanelDeck : public AccessibleToolPanelDeck_Base + { + public: + AccessibleToolPanelDeck( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + ::svt::ToolPanelDeck& i_rPanelDeck + ); + + using AccessibleToolPanelDeck_Base::NotifyAccessibleEvent; + + protected: + virtual ~AccessibleToolPanelDeck(); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + 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 void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + // VCLXAccessibleComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ); + virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ); + + private: + ::boost::scoped_ptr< AccessibleToolPanelDeck_Impl > m_pImpl; + }; + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... + +#endif // ACC_ACCESSIBLETOOLPANELDECK_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx new file mode 100644 index 000000000000..295d6e6624bd --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACC_ACCESSIBLETOOLPANELTABBAR_HXX +#define ACC_ACCESSIBLETOOLPANELTABBAR_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <cppuhelper/implbase1.hxx> +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + +#include <boost/scoped_ptr.hpp> + +namespace svt +{ + class IToolPanelDeck; + class PanelTabBar; +} + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + //================================================================================================================== + //= AccessibleToolPanelTabBar + //================================================================================================================== + class AccessibleToolPanelTabBar_Impl; + typedef VCLXAccessibleComponent AccessibleToolPanelTabBar_Base; + class AccessibleToolPanelTabBar : public AccessibleToolPanelTabBar_Base + { + public: + AccessibleToolPanelTabBar( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + ::svt::IToolPanelDeck& i_rPanelDeck, + ::svt::PanelTabBar& i_rTabBar + ); + + using AccessibleToolPanelTabBar_Base::NotifyAccessibleEvent; + + protected: + virtual ~AccessibleToolPanelTabBar(); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + 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); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + // VCLXAccessibleComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent ); + virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet ); + + private: + ::boost::scoped_ptr< AccessibleToolPanelTabBar_Impl > m_pImpl; + }; + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... + +#endif // ACC_ACCESSIBLETOOLPANELTABBAR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx new file mode 100644 index 000000000000..83ca6d8101c7 --- /dev/null +++ b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx @@ -0,0 +1,110 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX +#define ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX + +/** === begin UNO includes === **/ +/** === end UNO includes === **/ + +#include <comphelper/accessiblecomponenthelper.hxx> +#include <cppuhelper/implbase1.hxx> + +#include <boost/scoped_ptr.hpp> + +namespace svt +{ + class IToolPanelDeck; + class PanelTabBar; +} + +//...................................................................................................................... +namespace accessibility +{ +//...................................................................................................................... + + //================================================================================================================== + //= AccessibleToolPanelDeckTabBarItem + //================================================================================================================== + class AccessibleToolPanelDeckTabBarItem_Impl; + typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleToolPanelDeckTabBarItem_Base; + class AccessibleToolPanelDeckTabBarItem : public AccessibleToolPanelDeckTabBarItem_Base + { + public: + AccessibleToolPanelDeckTabBarItem( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent, + ::svt::IToolPanelDeck& i_rPanelDeck, + ::svt::PanelTabBar& i_rTabBar, + const size_t i_nItemPos + ); + + using AccessibleToolPanelDeckTabBarItem_Base::NotifyAccessibleEvent; + using AccessibleToolPanelDeckTabBarItem_Base::lateInit; + + protected: + virtual ~AccessibleToolPanelDeckTabBarItem(); + + public: + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) 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::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) 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); + + // XAccessibleComponent + 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 void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleExtendedComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); + + protected: + // OCommonAccessibleComponent + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + + // OComponentHelper + virtual void SAL_CALL disposing(); + + protected: + ::boost::scoped_ptr< AccessibleToolPanelDeckTabBarItem_Impl > m_pImpl; + }; + +//...................................................................................................................... +} // namespace accessibility +//...................................................................................................................... + +#endif // ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessiblebrowseboxcell.hxx b/accessibility/inc/accessibility/extended/accessiblebrowseboxcell.hxx new file mode 100644 index 000000000000..3314648ac6e7 --- /dev/null +++ b/accessibility/inc/accessibility/extended/accessiblebrowseboxcell.hxx @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_ACCESSIBLE_BROWSE_BOX_CELL_HXX +#define ACCESSIBILITY_ACCESSIBLE_BROWSE_BOX_CELL_HXX + +#include "accessibility/extended/AccessibleBrowseBoxBase.hxx" +#include <svtools/AccessibleBrowseBoxObjType.hxx> + +// ................................................................................. +namespace accessibility +{ +// ................................................................................. + + // ============================================================================= + // = AccessibleBrowseBoxCell + // ============================================================================= + /** common accessibility-functionality for browse box elements which occupy a cell + */ + class AccessibleBrowseBoxCell : public AccessibleBrowseBoxBase + { + private: + sal_Int32 m_nRowPos; // the row number of the table cell + sal_uInt16 m_nColPos; // the column id of the table cell + + protected: + // attribute access + inline sal_Int32 getRowPos( ) const { return m_nRowPos; } + inline sal_Int32 getColumnPos( ) const { return m_nColPos; } + + protected: + // AccessibleBrowseBoxBase overridables + virtual Rectangle implGetBoundingBox(); + virtual Rectangle implGetBoundingBoxOnScreen(); + + // XAccessibleComponent + virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException ); + + protected: + AccessibleBrowseBoxCell( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + ::svt::IAccessibleTableProvider& _rBrowseBox, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos, + ::svt::AccessibleBrowseBoxObjType _eType = ::svt::BBTYPE_TABLECELL + ); + + virtual ~AccessibleBrowseBoxCell(); + + private: + AccessibleBrowseBoxCell(); // never implemented + AccessibleBrowseBoxCell( const AccessibleBrowseBoxCell& ); // never implemented + AccessibleBrowseBoxCell& operator=( const AccessibleBrowseBoxCell& ); // never implemented + }; + +// ................................................................................. +} // namespace accessibility +// ................................................................................. + + +#endif // ACCESSIBILITY_ACCESSIBLE_BROWSE_BOX_CELL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibleeditbrowseboxcell.hxx b/accessibility/inc/accessibility/extended/accessibleeditbrowseboxcell.hxx new file mode 100644 index 000000000000..2abe7d871022 --- /dev/null +++ b/accessibility/inc/accessibility/extended/accessibleeditbrowseboxcell.hxx @@ -0,0 +1,156 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef ACCESSIBILITY_EXT_ACCESSIBILEEDITBROWSEBOXTABLECELL_HXX +#define ACCESSIBILITY_EXT_ACCESSIBILEEDITBROWSEBOXTABLECELL_HXX + +#include "accessiblebrowseboxcell.hxx" +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> +#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/compbase1.hxx> +#include <comphelper/accessiblewrapper.hxx> + +namespace accessibility +{ + // ============================================================================= + // = EditBrowseBoxTableCell + // ============================================================================= + class EditBrowseBoxTableCell :public AccessibleBrowseBoxCell + ,public ::comphelper::OAccessibleContextWrapperHelper + { + public: + EditBrowseBoxTableCell( + const com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent, + const com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxOwningAccessible, + const com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _xControlChild, + ::svt::IAccessibleTableProvider& _rBrowseBox, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos + ); + + protected: + virtual ~EditBrowseBoxTableCell(); + + protected: + // XAccessibleComponent + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException) ; + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException) ; + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException ); + + // XInterface + DECLARE_XINTERFACE( ) + // XTypeProvider + DECLARE_XTYPEPROVIDER( ) + + // XAccessibleContext + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) 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::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) 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); + + sal_Int16 SAL_CALL getAccessibleRole() throw ( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + protected: + // OComponentHelper + virtual void SAL_CALL disposing(); + + // XComponent/OComponentProxyAggregationHelper (needs to be disambiguated) + virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException ); + + // OAccessibleContextWrapperHelper(); + void notifyTranslatedEvent( const ::com::sun::star::accessibility::AccessibleEventObject& _rEvent ) throw (::com::sun::star::uno::RuntimeException); + + private: + EditBrowseBoxTableCell(); // never implemented + EditBrowseBoxTableCell( const EditBrowseBoxTableCell& ); // never implemented + EditBrowseBoxTableCell& operator=( const EditBrowseBoxTableCell& ); // never implemented + }; + + // ============================================================================= + // = EditBrowseBoxTableCell + // ============================================================================= + typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::accessibility::XAccessible + > EditBrowseBoxTableCellAccess_Base; + // XAccessible providing an EditBrowseBoxTableCell + class EditBrowseBoxTableCellAccess + :public ::comphelper::OBaseMutex + ,public EditBrowseBoxTableCellAccess_Base + { + protected: + ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessibleContext > + m_aContext; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + m_xParent; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + m_xControlAccessible; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > + m_xFocusWindow; + ::svt::IAccessibleTableProvider* m_pBrowseBox; + sal_Int32 m_nRowPos; + sal_uInt16 m_nColPos; + + public: + EditBrowseBoxTableCellAccess( + const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& _rxParent, + const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible > _xControlAccessible, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow, + ::svt::IAccessibleTableProvider& _rBrowseBox, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos + ); + + protected: + virtual ~EditBrowseBoxTableCellAccess(); + + // XAccessible + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); + + // XComponent/OComponentHelper + virtual void SAL_CALL disposing(); + + private: + EditBrowseBoxTableCellAccess(); // never implemented + EditBrowseBoxTableCellAccess( const EditBrowseBoxTableCellAccess& ); // never implemented + EditBrowseBoxTableCellAccess& operator=( const EditBrowseBoxTableCellAccess& ); // never implemented + }; +} + +#endif // ACCESSIBILITY_EXT_ACCESSIBILEEDITBROWSEBOXTABLECELL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx b/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx new file mode 100644 index 000000000000..2289dd45baec --- /dev/null +++ b/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRL_HXX_ +#define ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRL_HXX_ + +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <cppuhelper/implbase2.hxx> +#include <vcl/vclevent.hxx> +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + +// class AccessibleListBox ----------------------------------------------- + +class SvtIconChoiceCtrl; + +//........................................................................ +namespace accessibility +{ +//........................................................................ + + typedef ::cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessible + , ::com::sun::star::accessibility::XAccessibleSelection> AccessibleIconChoiceCtrl_BASE; + + /** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry + */ + class AccessibleIconChoiceCtrl :public AccessibleIconChoiceCtrl_BASE + ,public VCLXAccessibleComponent + { + protected: + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent; + + protected: + virtual ~AccessibleIconChoiceCtrl(); + + /** this function is called upon disposing the component */ + virtual void SAL_CALL disposing(); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + SvtIconChoiceCtrl* getCtrl(); + public: + /** OAccessibleBase needs a valid view + @param _rIconCtrl + is the box for which we implement an accessible object + @param _xParent + is our parent accessible object + */ + AccessibleIconChoiceCtrl( SvtIconChoiceCtrl& _rIconCtrl, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent ); + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XInterface + DECLARE_XINTERFACE() + + // 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); + + // XServiceInfo - static methods + static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException); + static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException); + + // 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::lang::IndexOutOfBoundsException, + ::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_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); + + // 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); + }; + +//........................................................................ +}// namespace accessibility +//........................................................................ + +#endif // ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRL_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx b/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx new file mode 100644 index 000000000000..09af3e2466ca --- /dev/null +++ b/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx @@ -0,0 +1,215 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRLENTRY_HXX_ +#define ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRLENTRY_HXX_ + +#include <deque> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleStateSet.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/compbase8.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <comphelper/accessibletexthelper.hxx> +#include <tools/gen.hxx> + +// forward --------------------------------------------------------------- + +class SvxIconChoiceCtrlEntry; +class SvtIconChoiceCtrl; + +//........................................................................ +namespace accessibility +{ +//........................................................................ + +// class AccessibleIconChoiceCtrlEntry ------------------------------------------ + + typedef ::cppu::WeakAggComponentImplHelper8< ::com::sun::star::accessibility::XAccessible + , ::com::sun::star::accessibility::XAccessibleContext + , ::com::sun::star::accessibility::XAccessibleComponent + , ::com::sun::star::accessibility::XAccessibleEventBroadcaster + , ::com::sun::star::accessibility::XAccessibleText + , ::com::sun::star::accessibility::XAccessibleAction + , ::com::sun::star::lang::XServiceInfo + , ::com::sun::star::lang::XEventListener > AccessibleIconChoiceCtrlEntry_BASE; + + /** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */ + class AccessibleIconChoiceCtrlEntry : public ::comphelper::OBaseMutex, + public AccessibleIconChoiceCtrlEntry_BASE, + public ::comphelper::OCommonAccessibleText + { + private: + /** The treelistbox control */ + SvtIconChoiceCtrl* m_pIconCtrl; + sal_Int32 m_nIndex; + + protected: + /// client id in the AccessibleEventNotifier queue + sal_uInt32 m_nClientId; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent; + + private: + #ifdef ACCESSIBLE_EVENT_NOTIFICATION_ENABLED + // (the following method is unused currently. If you need it, simply remove the #ifdef thing here and + // in the cxx) + /** notifies all listeners that this object has changed + @param _nEventId + is the event id + @param _aOldValue + is the old value + @param _aNewValue + is the new value + */ + void NotifyAccessibleEvent( sal_Int16 _nEventId, + const ::com::sun::star::uno::Any& _aOldValue, + const ::com::sun::star::uno::Any& _aNewValue ); + #endif + + Rectangle GetBoundingBox_Impl() const; + Rectangle GetBoundingBoxOnScreen_Impl() const; + sal_Bool IsAlive_Impl() const; + sal_Bool IsShowing_Impl() const; + + Rectangle GetBoundingBox() throw ( ::com::sun::star::lang::DisposedException ); + Rectangle GetBoundingBoxOnScreen() throw ( ::com::sun::star::lang::DisposedException ); + void EnsureIsAlive() const throw ( ::com::sun::star::lang::DisposedException ); + + protected: + virtual ~AccessibleIconChoiceCtrlEntry(); + /** this function is called upon disposing the component + */ + virtual void SAL_CALL disposing(); + + // OCommonAccessibleText + virtual ::rtl::OUString implGetText(); + virtual ::com::sun::star::lang::Locale implGetLocale(); + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); + + public: + /** Ctor() + @param _rListBox + the view control + @param _pEntry + the entry + @param _xParent + is our parent accessible object + */ + AccessibleIconChoiceCtrlEntry( SvtIconChoiceCtrl& _rIconCtrl, + ULONG _nPos, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() 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); + + // XServiceInfo - static methods + static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException); + static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + + // 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::lang::IndexOutOfBoundsException, + ::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::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) 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::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 void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleEventBroadcaster + using cppu::WeakAggComponentImplHelperBase::addEventListener; + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + using cppu::WeakAggComponentImplHelperBase::removeEventListener; + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + + // 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); + }; + +//........................................................................ +}// namespace accessibility +//........................................................................ + +#endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessiblelistbox.hxx b/accessibility/inc/accessibility/extended/accessiblelistbox.hxx new file mode 100644 index 000000000000..9e81e7eed7d4 --- /dev/null +++ b/accessibility/inc/accessibility/extended/accessiblelistbox.hxx @@ -0,0 +1,127 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_ +#define ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_ + +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <cppuhelper/implbase2.hxx> +#include <vcl/vclevent.hxx> +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + + +// class AccessibleListBox ----------------------------------------------- + +class SvTreeListBox; + +//........................................................................ +namespace accessibility +{ +//........................................................................ + + typedef ::cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessible + , ::com::sun::star::accessibility::XAccessibleSelection> AccessibleListBox_BASE; + + /** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry + */ + class AccessibleListBox :public AccessibleListBox_BASE + ,public VCLXAccessibleComponent + { + protected: + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent; + + protected: + virtual ~AccessibleListBox(); + + // OComponentHelper overridables + /** this function is called upon disposing the component */ + virtual void SAL_CALL disposing(); + + // VCLXAccessibleComponent + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + SvTreeListBox* getListBox() const; + + public: + /** OAccessibleBase needs a valid view + @param _rListBox + is the box for which we implement an accessible object + @param _xParent + is our parent accessible object + */ + AccessibleListBox( SvTreeListBox& _rListBox, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent ); + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XInterface + DECLARE_XINTERFACE() + + // 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); + + // XServiceInfo - static methods + static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException); + static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException); + + // 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::lang::IndexOutOfBoundsException, + ::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_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); + + // 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); + }; + +//........................................................................ +}// namespace accessibility +//........................................................................ + +#endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx b/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx new file mode 100644 index 000000000000..4521c0e0d03e --- /dev/null +++ b/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx @@ -0,0 +1,225 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ +#define ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ + +#include <deque> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleStateSet.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/compbase8.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <comphelper/accessibletexthelper.hxx> +#include <tools/gen.hxx> +#include "accessibility/extended/listboxaccessible.hxx" + +// forward --------------------------------------------------------------- + +namespace com { namespace sun { namespace star { namespace awt { + struct Point; + struct Rectangle; + struct Size; + class XFocusListener; +} } } } + +class SvTreeListBox; +class SvLBoxEntry; + +//........................................................................ +namespace accessibility +{ +//........................................................................ + +// class AccessibleListBoxEntry ------------------------------------------ + + typedef ::cppu::WeakAggComponentImplHelper8< ::com::sun::star::accessibility::XAccessible + , ::com::sun::star::accessibility::XAccessibleContext + , ::com::sun::star::accessibility::XAccessibleComponent + , ::com::sun::star::accessibility::XAccessibleEventBroadcaster + , ::com::sun::star::accessibility::XAccessibleAction + , ::com::sun::star::accessibility::XAccessibleSelection + , ::com::sun::star::accessibility::XAccessibleText + , ::com::sun::star::lang::XServiceInfo > AccessibleListBoxEntry_BASE; + + /** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */ + class AccessibleListBoxEntry:public ::comphelper::OBaseMutex + ,public AccessibleListBoxEntry_BASE + ,public ::comphelper::OCommonAccessibleText + ,public ListBoxAccessibleBase + { + friend class AccessibleListBox; + + private: + /** The treelistbox control */ + SvTreeListBox* m_pListBox; + ::std::deque< sal_Int32 > m_aEntryPath; + + protected: + /// client id in the AccessibleEventNotifier queue + sal_uInt32 m_nClientId; + + ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > + m_aParent; + + private: + Rectangle GetBoundingBox_Impl() const; + Rectangle GetBoundingBoxOnScreen_Impl() const; + sal_Bool IsAlive_Impl() const; + sal_Bool IsShowing_Impl() const; + + Rectangle GetBoundingBox() throw ( ::com::sun::star::lang::DisposedException ); + Rectangle GetBoundingBoxOnScreen() throw ( ::com::sun::star::lang::DisposedException ); + void EnsureIsAlive() const throw ( ::com::sun::star::lang::DisposedException ); + + protected: + virtual ~AccessibleListBoxEntry(); + + /** this function is called upon disposing the component + */ + virtual void SAL_CALL disposing(); + + // ListBoxAccessible/XComponent + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ); + + // OCommonAccessibleText + virtual ::rtl::OUString implGetText(); + virtual ::com::sun::star::lang::Locale implGetLocale(); + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); + + public: + /** Ctor() + @param _rListBox + the view control + @param _pEntry + the entry + @param _xParent + is our parent accessible object + */ + AccessibleListBoxEntry( SvTreeListBox& _rListBox, SvLBoxEntry* _pEntry, + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& _xParent ); + + protected: + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() 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); + + // XServiceInfo - static methods + static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException); + static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException); + + // 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::lang::IndexOutOfBoundsException, + ::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::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) 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::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 void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleEventBroadcaster + using cppu::WeakAggComponentImplHelperBase::addEventListener; + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + using cppu::WeakAggComponentImplHelperBase::removeEventListener; + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + + // 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); + + // 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); + + private: + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > implGetParentAccessible( ) const; + }; + +//........................................................................ +}// namespace accessibility +//........................................................................ + +#endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibletabbar.hxx b/accessibility/inc/accessibility/extended/accessibletabbar.hxx new file mode 100644 index 000000000000..d7b43bc5870c --- /dev/null +++ b/accessibility/inc/accessibility/extended/accessibletabbar.hxx @@ -0,0 +1,122 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBAR_HXX_ +#define ACCESSIBILITY_EXT_ACCESSIBLETABBAR_HXX_ + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase2.hxx> +#include "accessibility/extended/accessibletabbarbase.hxx" + +#include <vector> + +namespace utl { +class AccessibleStateSetHelper; +} + +//......................................................................... +namespace accessibility +{ +//......................................................................... + + // ---------------------------------------------------- + // class AccessibleTabBar + // ---------------------------------------------------- + + typedef ::cppu::ImplHelper2< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::lang::XServiceInfo > AccessibleTabBar_BASE; + + class AccessibleTabBar : public AccessibleTabBarBase, + public AccessibleTabBar_BASE + { + private: + typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren; + + AccessibleChildren m_aAccessibleChildren; + + protected: + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // OCommonAccessibleComponent + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL disposing(); + + public: + AccessibleTabBar( TabBar* pTabBar ); + ~AccessibleTabBar(); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // 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::lang::IndexOutOfBoundsException, ::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::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) 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::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + 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 void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleExtendedComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); + }; + +//......................................................................... +} // namespace accessibility +//......................................................................... + +#endif // ACCESSIBILITY_EXT_ACCESSIBLETABBAR_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx b/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx new file mode 100644 index 000000000000..b4e62f517d3f --- /dev/null +++ b/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx @@ -0,0 +1,80 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBARBASE_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLETABBARBASE_HXX + +#include <comphelper/accessiblecomponenthelper.hxx> +#include <tools/link.hxx> + +class TabBar; +class VCLExternalSolarLock; +class VclSimpleEvent; +class VclWindowEvent; + +//......................................................................... +namespace accessibility +{ +//......................................................................... + +// ============================================================================ + +typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE; + +class AccessibleTabBarBase : public AccessibleExtendedComponentHelper_BASE +{ +public: + explicit AccessibleTabBarBase( TabBar* pTabBar ); + virtual ~AccessibleTabBarBase(); + +protected: + DECL_LINK( WindowEventListener, VclSimpleEvent* ); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + + // XComponent + virtual void SAL_CALL disposing(); + +private: + void SetTabBarPointer( TabBar* pTabBar ); + void ClearTabBarPointer(); + +protected: + VCLExternalSolarLock* m_pExternalLock; + TabBar* m_pTabBar; +}; + +// ============================================================================ + +//......................................................................... +} // namespace accessibility +//......................................................................... + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibletabbarpage.hxx b/accessibility/inc/accessibility/extended/accessibletabbarpage.hxx new file mode 100644 index 000000000000..756d2fff4b35 --- /dev/null +++ b/accessibility/inc/accessibility/extended/accessibletabbarpage.hxx @@ -0,0 +1,139 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGE_HXX_ +#define ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGE_HXX_ + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase2.hxx> +#include "accessibility/extended/accessibletabbarbase.hxx" + +#include <vector> + +namespace utl { +class AccessibleStateSetHelper; +} + +//......................................................................... +namespace accessibility +{ +//......................................................................... + + // ---------------------------------------------------- + // class AccessibleTabBarPage + // ---------------------------------------------------- + + typedef ::cppu::ImplHelper2< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::lang::XServiceInfo > AccessibleTabBarPage_BASE; + + class AccessibleTabBarPage : public AccessibleTabBarBase, + public AccessibleTabBarPage_BASE + { + friend class AccessibleTabBarPageList; + + private: + sal_uInt16 m_nPageId; + sal_Bool m_bEnabled; + sal_Bool m_bShowing; + sal_Bool m_bSelected; + ::rtl::OUString m_sPageText; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent; + + protected: + sal_Bool IsEnabled(); + sal_Bool IsShowing(); + sal_Bool IsSelected(); + + void SetEnabled( sal_Bool bEnabled ); + void SetShowing( sal_Bool bShowing ); + void SetSelected( sal_Bool bSelected ); + void SetPageText( const ::rtl::OUString& sPageText ); + + sal_uInt16 GetPageId() const { return m_nPageId; } + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // OCommonAccessibleComponent + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL disposing(); + + public: + AccessibleTabBarPage( TabBar* pTabBar, sal_uInt16 nPageId, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent ); + virtual ~AccessibleTabBarPage(); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // 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::lang::IndexOutOfBoundsException, ::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::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) 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::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + 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 void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleExtendedComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); + }; + +//......................................................................... +} // namespace accessibility +//......................................................................... + +#endif // ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibletabbarpagelist.hxx b/accessibility/inc/accessibility/extended/accessibletabbarpagelist.hxx new file mode 100644 index 000000000000..cc5dc276cd24 --- /dev/null +++ b/accessibility/inc/accessibility/extended/accessibletabbarpagelist.hxx @@ -0,0 +1,143 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGELIST_HXX_ +#define ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGELIST_HXX_ + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase3.hxx> +#include "accessibility/extended/accessibletabbarbase.hxx" + +#include <vector> + +namespace utl { +class AccessibleStateSetHelper; +} + +//......................................................................... +namespace accessibility +{ +//......................................................................... + + // ---------------------------------------------------- + // class AccessibleTabBarPageList + // ---------------------------------------------------- + + typedef ::cppu::ImplHelper3< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleSelection, + ::com::sun::star::lang::XServiceInfo > AccessibleTabBarPageList_BASE; + + class AccessibleTabBarPageList : public AccessibleTabBarBase, + public AccessibleTabBarPageList_BASE + { + private: + typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren; + + AccessibleChildren m_aAccessibleChildren; + sal_Int32 m_nIndexInParent; + + protected: + void UpdateEnabled( sal_Int32 i, sal_Bool bEnabled ); + void UpdateShowing( sal_Bool bShowing ); + void UpdateSelected( sal_Int32 i, sal_Bool bSelected ); + void UpdatePageText( sal_Int32 i ); + + void InsertChild( sal_Int32 i ); + void RemoveChild( sal_Int32 i ); + void MoveChild( sal_Int32 i, sal_Int32 j ); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // OCommonAccessibleComponent + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL disposing(); + + public: + AccessibleTabBarPageList( TabBar* pTabBar, sal_Int32 nIndexInParent ); + virtual ~AccessibleTabBarPageList(); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // 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::lang::IndexOutOfBoundsException, ::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::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) 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::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + 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 void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleExtendedComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleSelection + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::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); + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + }; + +//......................................................................... +} // namespace accessibility +//......................................................................... + +#endif // ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGELIST_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibletablistbox.hxx b/accessibility/inc/accessibility/extended/accessibletablistbox.hxx new file mode 100644 index 000000000000..4e6f03af3c9b --- /dev/null +++ b/accessibility/inc/accessibility/extended/accessibletablistbox.hxx @@ -0,0 +1,117 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX + +#include "AccessibleBrowseBox.hxx" +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <svtools/accessibletableprovider.hxx> + +class SvHeaderTabListBox; + +// ============================================================================ + +namespace accessibility { + +class AccessibleBrowseBoxTable; + +typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible + > AccessibleTabListBox_Base; + +/** !!! */ +class AccessibleTabListBox + :public AccessibleBrowseBox + ,public AccessibleTabListBox_Base + ,public ::svt::IAccessibleTabListBox +{ +private: + SvHeaderTabListBox* m_pTabListBox; + +public: + /** ctor() + @param rxParent XAccessible interface of the parent object. + @param rBox The HeaderTabListBox control. */ + AccessibleTabListBox( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, + SvHeaderTabListBox& rBox ); + +public: + // XInterface + DECLARE_XINTERFACE( ) + // XTypeProvider + DECLARE_XTYPEPROVIDER( ) + + // XAccessibleContext ----------------------------------------------------- + + /** @return The count of visible children. */ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() + throw ( ::com::sun::star::uno::RuntimeException ); + + /** @return The XAccessible interface of the specified child. */ + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + // XAccessibleContext + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException ); + + // IAccessibleTabListBox + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getMyself() + { + return this; + } + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType ) + { + return AccessibleBrowseBox::getHeaderBar( _eObjType ); + } + +protected: + /** dtor() */ + virtual ~AccessibleTabListBox(); + + /** This method creates and returns an accessible table. + @return An AccessibleBrowseBoxTable. */ + virtual AccessibleBrowseBoxTable* createAccessibleTable(); +}; + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + +#endif // ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx b/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx new file mode 100644 index 000000000000..153dc76f2a65 --- /dev/null +++ b/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx @@ -0,0 +1,124 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOXTABLE_HXX +#define ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOXTABLE_HXX + +#include "AccessibleBrowseBoxTable.hxx" +#include <comphelper/uno3.hxx> +#include <cppuhelper/implbase1.hxx> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> + +class SvHeaderTabListBox; + +// ============================================================================ + +namespace accessibility { + +typedef ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleSelection > + AccessibleTabListBoxTableImplHelper; + +class AccessibleTabListBoxTable : public AccessibleBrowseBoxTable, public AccessibleTabListBoxTableImplHelper +{ +private: + SvHeaderTabListBox* m_pTabListBox; + + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + DECL_LINK( WindowEventListener, VclSimpleEvent* ); + + // helpers ---------------------------------------------------------------- + + /** Throws an exception, if nIndex is not a valid child index. */ + void ensureValidIndex( sal_Int32 _nIndex ) const + SAL_THROW( ( ::com::sun::star::lang::IndexOutOfBoundsException ) ); + + /** Returns true, if the specified row is selected. */ + sal_Bool implIsRowSelected( sal_Int32 _nRow ) const; + /** Selects the specified row. */ + void implSelectRow( sal_Int32 _nRow, sal_Bool _bSelect ); + + /** Returns the count of rows in the table. */ + sal_Int32 implGetRowCount() const; + /** Returns the total column count in the table. */ + sal_Int32 implGetColumnCount() const; + /** Returns the count of selected rows in the table. */ + sal_Int32 implGetSelRowCount() const; + /** Returns the total cell count in the table (including header). */ + inline sal_Int32 implGetCellCount() const { return implGetRowCount() * implGetColumnCount(); } + + /** Returns the row index from cell index. */ + inline sal_Int32 implGetRow( sal_Int32 _nIndex ) const { return _nIndex / implGetColumnCount(); } + /** Returns the column index from cell index. */ + inline sal_Int32 implGetColumn( sal_Int32 _nIndex ) const { return _nIndex % implGetColumnCount(); } + /** Returns the absolute row index of the nSelRow-th selected row. */ + sal_Int32 implGetSelRow( sal_Int32 _nSelRow ) const; + /** Returns the child index from cell position. */ + inline sal_Int32 implGetIndex( sal_Int32 _nRow, sal_Int32 _nColumn ) const { return _nRow * implGetColumnCount() + _nColumn; } + +public: + /** ctor() + @param rxParent XAccessible interface of the parent object. + @param rBox The HeaderTabListBox control. */ + AccessibleTabListBoxTable( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent, + SvHeaderTabListBox& rBox ); + +protected: + /** dtor() */ + virtual ~AccessibleTabListBoxTable(); + +public: + // XInterface + DECLARE_XINTERFACE( ) + + // XTypeProvider + DECLARE_XTYPEPROVIDER( ) + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName (void) + 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); +}; + +// ============================================================================ + +} // namespace accessibility + +// ============================================================================ + +#endif // ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/listboxaccessible.hxx b/accessibility/inc/accessibility/extended/listboxaccessible.hxx new file mode 100644 index 000000000000..b82291f91e79 --- /dev/null +++ b/accessibility/inc/accessibility/extended/listboxaccessible.hxx @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_EXT_LISTBOX_ACCESSIBLE +#define ACCESSIBILITY_EXT_LISTBOX_ACCESSIBLE + +#include <com/sun/star/uno/RuntimeException.hpp> +#include <tools/link.hxx> + +class SvTreeListBox; +class VclSimpleEvent; +class VclWindowEvent; + +//........................................................................ +namespace accessibility +{ +//........................................................................ + + //==================================================================== + //= ListBoxAccessibleBase + //==================================================================== + /** helper class which couples it's life time to the life time of an + SvTreeListBox + */ + class ListBoxAccessibleBase + { + private: + SvTreeListBox* m_pWindow; + + protected: + inline SvTreeListBox* getListBox() const + { + return const_cast< ListBoxAccessibleBase* >( this )->m_pWindow; + } + + inline bool isAlive() const { return NULL != m_pWindow; } + + public: + ListBoxAccessibleBase( SvTreeListBox& _rWindow ); + + protected: + virtual ~ListBoxAccessibleBase( ); + + // own overridables + /// will be called for any VclWindowEvent events broadcasted by our VCL window + virtual void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ); + + /** will be called when our window broadcasts the VCLEVENT_OBJECT_DYING event + + <p>Usually, you derive your class from both ListBoxAccessibleBase and XComponent, + and call XComponent::dispose here.</p> + */ + virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ) = 0; + + /// to be called in the dispose method of your derived class + void disposing(); + + private: + DECL_LINK( WindowEventListener, VclSimpleEvent* ); + + private: + ListBoxAccessibleBase( ); // never implemented + ListBoxAccessibleBase( const ListBoxAccessibleBase& ); // never implemented + ListBoxAccessibleBase& operator=( const ListBoxAccessibleBase& ); // never implemented + }; + +//........................................................................ +} // namespace accessibility +//........................................................................ + +#endif // ACCESSIBILITY_EXT_LISTBOX_ACCESSIBLE + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx new file mode 100644 index 000000000000..091eebe46d18 --- /dev/null +++ b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx @@ -0,0 +1,714 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#if !defined INCLUDED_ACCESSIBILITY_TEXTWINDOWACCESSIBILITY_HXX +#define INCLUDED_ACCESSIBILITY_TEXTWINDOWACCESSIBILITY_HXX + +#include <toolkit/awt/vclxaccessiblecomponent.hxx> +#include <svl/lstner.hxx> +#include <svtools/textdata.hxx> +#include <svtools/texteng.hxx> +#include <svtools/textview.hxx> +#include <svtools/txtattr.hxx> +#include <com/sun/star/awt/FontWeight.hpp> +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/util/Color.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/AccessibleRelationType.hpp> +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/accessibility/AccessibleTextType.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleEditableText.hpp> +#include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp> +#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <toolkit/awt/vclxwindow.hxx> +#include <cppuhelper/compbase7.hxx> +#include <comphelper/accessiblecontexthelper.hxx> +#include <comphelper/accessibletexthelper.hxx> +#include <rtl/ref.hxx> + +#include <memory> +#include <queue> +#include <hash_map> + +class TextEngine; +class TextView; + +namespace css = ::com::sun::star; + +namespace accessibility +{ + +class Paragraph; +class Document; + +class SfxListenerGuard +{ +public: + inline SfxListenerGuard(::SfxListener & rListener): + m_rListener(rListener), m_pNotifier(0) {} + + inline ~SfxListenerGuard() { endListening(); } + + // Not thread safe: + void startListening(::SfxBroadcaster & rNotifier); + + // Not thread safe: + void endListening(); + +private: + ::SfxListener & m_rListener; + ::SfxBroadcaster * m_pNotifier; +}; + +class WindowListenerGuard +{ +public: + inline WindowListenerGuard(::Link const & rListener): + m_aListener(rListener), m_pNotifier(0) {} + + inline ~WindowListenerGuard() { endListening(); } + + // Not thread safe: + void startListening(::Window & rNotifier); + + // Not thread safe: + void endListening(); + +private: + ::Link m_aListener; + ::Window * m_pNotifier; +}; + +class ParagraphInfo +{ +public: + inline ParagraphInfo(::sal_Int32 nHeight): m_nHeight(nHeight) {} + + inline + ::css::uno::WeakReference< ::css::accessibility::XAccessible > const & + getParagraph() const { return m_xParagraph; } + + inline ::sal_Int32 getHeight() const { return m_nHeight; } + + inline void setParagraph( + ::css::uno::Reference< ::css::accessibility::XAccessible > const & + rParagraph) { m_xParagraph = rParagraph; } + + inline void changeHeight(::sal_Int32 nHeight) { m_nHeight = nHeight; } + +private: + ::css::uno::WeakReference< ::css::accessibility::XAccessible > + m_xParagraph; + ::sal_Int32 m_nHeight; +}; + +typedef ::std::vector< ParagraphInfo > Paragraphs; + +typedef ::cppu::WeakAggComponentImplHelper7< + ::css::accessibility::XAccessible, + ::css::accessibility::XAccessibleContext, + ::css::accessibility::XAccessibleComponent, + ::css::accessibility::XAccessibleEditableText, + ::css::accessibility::XAccessibleMultiLineText, + ::css::accessibility::XAccessibleTextAttributes, + ::css::accessibility::XAccessibleEventBroadcaster > ParagraphBase; + +// The Paragraph's number is the absolute position within the text engine (from +// 0 to N - 1), whereas the Paragraph's index is the position within the text +// view/accessible parent (from 0 to M - 1). Paragraphs outside the currently +// visible range have an index of -1. +class ParagraphImpl: + public ParagraphBase, private ::comphelper::OCommonAccessibleText +{ +public: + ParagraphImpl(::rtl::Reference< Document > const & rDocument, + Paragraphs::size_type nNumber, ::osl::Mutex & rMutex); + + // Not thread-safe. + inline Paragraphs::size_type getNumber() const { return m_nNumber; } + + // Not thread-safe. + void numberChanged(bool bIncremented); + + // Not thread-safe. + void textChanged(); + + // Thread-safe. + void notifyEvent(::sal_Int16 nEventId, ::css::uno::Any const & rOldValue, + ::css::uno::Any const & rNewValue); + +protected: + // OCommonAccessibleText + virtual void implGetParagraphBoundary( ::css::i18n::Boundary& rBoundary, + ::sal_Int32 nIndex ); + virtual void implGetLineBoundary( ::css::i18n::Boundary& rBoundary, + ::sal_Int32 nIndex ); + +private: + virtual ::css::uno::Reference< ::css::accessibility::XAccessibleContext > + SAL_CALL getAccessibleContext() throw (::css::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL getAccessibleChildCount() + throw (::css::uno::RuntimeException); + + virtual ::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL + getAccessibleChild(::sal_Int32 i) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL + getAccessibleParent() throw (::css::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL getAccessibleIndexInParent() + throw (::css::uno::RuntimeException); + + virtual ::sal_Int16 SAL_CALL getAccessibleRole() + throw (::css::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL getAccessibleDescription() + throw (::css::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL getAccessibleName() + throw (::css::uno::RuntimeException); + + virtual + ::css::uno::Reference< ::css::accessibility::XAccessibleRelationSet > + SAL_CALL getAccessibleRelationSet() throw (::css::uno::RuntimeException); + + virtual + ::css::uno::Reference< ::css::accessibility::XAccessibleStateSet > SAL_CALL + getAccessibleStateSet() throw (::css::uno::RuntimeException); + + virtual ::css::lang::Locale SAL_CALL getLocale() + throw (::css::accessibility::IllegalAccessibleComponentStateException, + ::css::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL containsPoint(::css::awt::Point const & rPoint) + throw (::css::uno::RuntimeException); + + virtual ::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint(::css::awt::Point const & rPoint) + throw (::css::uno::RuntimeException); + + virtual ::css::awt::Rectangle SAL_CALL getBounds() + throw (::css::uno::RuntimeException); + + virtual ::css::awt::Point SAL_CALL getLocation() + throw (::css::uno::RuntimeException); + + virtual ::css::awt::Point SAL_CALL getLocationOnScreen() + throw (::css::uno::RuntimeException); + + virtual ::css::awt::Size SAL_CALL getSize() + throw (::css::uno::RuntimeException); + + virtual void SAL_CALL grabFocus() throw (::css::uno::RuntimeException); + + virtual ::css::uno::Any SAL_CALL getAccessibleKeyBinding() + throw (::css::uno::RuntimeException); + + virtual ::css::util::Color SAL_CALL getForeground() + throw (::css::uno::RuntimeException); + + virtual ::css::util::Color SAL_CALL getBackground() + throw (::css::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL getCaretPosition() + throw (::css::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL setCaretPosition(::sal_Int32 nIndex) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::sal_Unicode SAL_CALL getCharacter(::sal_Int32 nIndex) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL + getCharacterAttributes(::sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::css::awt::Rectangle SAL_CALL + getCharacterBounds(::sal_Int32 nIndex) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL getCharacterCount() + throw (::css::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL + getIndexAtPoint(::css::awt::Point const & rPoint) + throw (::css::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL getSelectedText() + throw (::css::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL getSelectionStart() + throw (::css::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL getSelectionEnd() + throw (::css::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL setSelection(::sal_Int32 nStartIndex, + ::sal_Int32 nEndIndex) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL getText() + throw (::css::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL getTextRange(::sal_Int32 nStartIndex, + ::sal_Int32 nEndIndex) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL copyText(::sal_Int32 nStartIndex, + ::sal_Int32 nEndIndex) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL cutText(::sal_Int32 nStartIndex, + ::sal_Int32 nEndIndex) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL pasteText(::sal_Int32 nIndex) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL deleteText(::sal_Int32 nStartIndex, + ::sal_Int32 nEndIndex) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL insertText(::rtl::OUString const & rText, + ::sal_Int32 nIndex) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL replaceText( + ::sal_Int32 nStartIndex, ::sal_Int32 nEndIndex, + ::rtl::OUString const & rReplacement) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL setAttributes( + ::sal_Int32 nStartIndex, ::sal_Int32 nEndIndex, + ::css::uno::Sequence< ::css::beans::PropertyValue > const & + rAttributeSet) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL setText(::rtl::OUString const & rText) + throw (::css::uno::RuntimeException); + + virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL + getDefaultAttributes(const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes) + throw (::css::uno::RuntimeException); + + virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL + getRunAttributes(::sal_Int32 Index, const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineWithCaret( ) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL getNumberOfLineWithCaret( ) + throw (::com::sun::star::uno::RuntimeException); + + using cppu::WeakAggComponentImplHelperBase::addEventListener; + virtual void SAL_CALL addEventListener( + ::css::uno::Reference< + ::css::accessibility::XAccessibleEventListener > const & rListener) + throw (::css::uno::RuntimeException); + + using cppu::WeakAggComponentImplHelperBase::removeEventListener; + virtual void SAL_CALL removeEventListener( + ::css::uno::Reference< + ::css::accessibility::XAccessibleEventListener > const & rListener) + throw (::css::uno::RuntimeException); + + virtual void SAL_CALL disposing(); + + virtual ::rtl::OUString implGetText(); + + virtual ::css::lang::Locale implGetLocale(); + + virtual void implGetSelection(::sal_Int32 & rStartIndex, + ::sal_Int32 & rEndIndex); + + // Throws ::css::lang::DisposedException: + void checkDisposed(); + + ::rtl::Reference< Document > m_xDocument; + Paragraphs::size_type m_nNumber; + +// ::cppu::OInterfaceContainerHelper m_aListeners; + /// client id in the AccessibleEventNotifier queue + sal_uInt32 m_nClientId; + + ::rtl::OUString m_aParagraphText; +}; + + +typedef ::std::hash_map< ::rtl::OUString, + ::css::beans::PropertyValue, + ::rtl::OUStringHash, + ::std::equal_to< ::rtl::OUString > > tPropValMap; + +class Document: public ::VCLXAccessibleComponent, public ::SfxListener +{ +public: + Document(::VCLXWindow * pVclXWindow, ::TextEngine & rEngine, + ::TextView & rView, bool bCompoundControlChild); + + inline ::css::uno::Reference< ::css::accessibility::XAccessible > + getAccessible() { return m_xAccessible; } + + // Must be called only after init has been called. + ::css::lang::Locale retrieveLocale(); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const *" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + ::sal_Int32 retrieveParagraphIndex(ParagraphImpl const * pParagraph); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const *" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + ::sal_Int64 retrieveParagraphState(ParagraphImpl const * pParagraph); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const &" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + ::css::awt::Rectangle + retrieveParagraphBounds(ParagraphImpl const * pParagraph, bool bAbsolute); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const &" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + ::rtl::OUString retrieveParagraphText(ParagraphImpl const * pParagraph); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const &" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + void retrieveParagraphSelection(ParagraphImpl const * pParagraph, + ::sal_Int32 * pBegin, ::sal_Int32 * pEnd); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const *" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + ::sal_Int32 retrieveParagraphCaretPosition(ParagraphImpl const * pParagraph); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const &" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + // Throws ::css::lang::IndexOutOfBoundsException. + ::css::awt::Rectangle + retrieveCharacterBounds(ParagraphImpl const * pParagraph, + ::sal_Int32 nIndex); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const &" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + ::sal_Int32 retrieveCharacterIndex(ParagraphImpl const * pParagraph, + ::css::awt::Point const & rPoint); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const &" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + // Throws ::css::lang::IndexOutOfBoundsException. + ::css::uno::Sequence< ::css::beans::PropertyValue > retrieveCharacterAttributes( + ParagraphImpl const * pParagraph, ::sal_Int32 nIndex, + const ::css::uno::Sequence< ::rtl::OUString >& aRequestedAttributes); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const &" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + ::css::uno::Sequence< ::css::beans::PropertyValue > retrieveDefaultAttributes( + ParagraphImpl const * pParagraph, + const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const &" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + // Throws ::css::lang::IndexOutOfBoundsException. + ::css::uno::Sequence< ::css::beans::PropertyValue > retrieveRunAttributes( + ParagraphImpl const * pParagraph, ::sal_Int32 Index, + const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const &" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + void changeParagraphText(ParagraphImpl * pParagraph, + ::rtl::OUString const & rText); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const &" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + // Throws ::css::lang::IndexOutOfBoundsException. + void changeParagraphText(ParagraphImpl * pParagraph, ::sal_Int32 nBegin, + ::sal_Int32 nEnd, bool bCut, bool bPaste, + ::rtl::OUString const & rText); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const &" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + // Throws ::css::lang::IndexOutOfBoundsException. + void copyParagraphText(ParagraphImpl const * pParagraph, + ::sal_Int32 nBegin, ::sal_Int32 nEnd); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const &" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + // Throws ::css::lang::IndexOutOfBoundsException. + void changeParagraphAttributes( + ParagraphImpl * pParagraph, ::sal_Int32 nBegin, ::sal_Int32 nEnd, + ::css::uno::Sequence< ::css::beans::PropertyValue > const & + rAttributeSet); + + // Must be called only after init has been called. + // To make it possible for this method to be (indirectly) called from + // within Paragraph's constructor (i.e., when the Paragraph's ref count is + // still zero), pass a "ParagraphImpl const &" instead of a + // "::rtl::Reference< ParagraphImpl > const &". + // Throws ::css::lang::IndexOutOfBoundsException. + void changeParagraphSelection(ParagraphImpl * pParagraph, + ::sal_Int32 nBegin, ::sal_Int32 nEnd); + + ::css::i18n::Boundary + retrieveParagraphLineBoundary( ParagraphImpl const * pParagraph, + ::sal_Int32 nIndex, ::sal_Int32 *pLineNo = NULL); + + ::css::i18n::Boundary + retrieveParagraphBoundaryOfLine( ParagraphImpl const * pParagraph, + ::sal_Int32 nIndex ); + + sal_Int32 retrieveParagraphLineWithCursor( ParagraphImpl const * pParagraph ); + + ::css::uno::Reference< ::css::accessibility::XAccessibleRelationSet > + retrieveParagraphRelationSet( ParagraphImpl const * pParagraph ); + +protected: + // window event listener from base class + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + +private: + virtual ::sal_Int32 SAL_CALL getAccessibleChildCount() + throw (::css::uno::RuntimeException); + + virtual ::css::uno::Reference< ::css::accessibility::XAccessible > + SAL_CALL getAccessibleChild(::sal_Int32 i) + throw (::css::lang::IndexOutOfBoundsException, + ::css::uno::RuntimeException); + + virtual ::sal_Int16 SAL_CALL getAccessibleRole() + throw (::css::uno::RuntimeException); + + virtual ::css::uno::Reference< ::css::accessibility::XAccessible > + SAL_CALL getAccessibleAtPoint(::css::awt::Point const & rPoint) + throw (::css::uno::RuntimeException); + + // ??? Will be called with both the external (Solar) and internal mutex + // locked: + virtual void SAL_CALL disposing(); + + // ??? Will be called with the external (Solar) mutex locked. + // init will already have been called. + virtual void Notify(::SfxBroadcaster & rBC, ::SfxHint const & rHint); + + // Assuming that this will only be called with the external (Solar) mutex + // locked. + // init will already have been called. + DECL_LINK(WindowEventHandler, VclSimpleEvent *); + + // Must be called with both the external (Solar) and internal mutex + // locked. + void init(); + + // Must be called with both the external (Solar) and internal mutex + // locked, and after init has been called: + ::rtl::Reference< ParagraphImpl > + getParagraph(Paragraphs::iterator const & rIt); + + // Must be called with both the external (Solar) and internal mutex + // locked, and after init has been called. + // Throws ::css::uno::RuntimeException. + ::css::uno::Reference< ::css::accessibility::XAccessible > + getAccessibleChild(Paragraphs::iterator const & rIt); + + // Must be called with both the external (Solar) and internal mutex + // locked, and after init has been called: + void determineVisibleRange(); + + // Must be called with both the external (Solar) and internal mutex + // locked, and after init has been called: + void notifyVisibleRangeChanges( + Paragraphs::iterator const & rOldVisibleBegin, + Paragraphs::iterator const & rOldVisibleEnd, + Paragraphs::iterator const & rInserted); + + // Must be called with both the external (Solar) and internal mutex + // locked, and after init has been called: + void changeParagraphText(::ULONG nNumber, ::USHORT nBegin, ::USHORT nEnd, + bool bCut, bool bPaste, + ::rtl::OUString const & rText); + + void + handleParagraphNotifications(); + + void handleSelectionChangeNotification(); + + void notifySelectionChange( sal_Int32 nFirst, sal_Int32 nLast ); + + void justifySelection( TextPaM& rTextStart, TextPaM& rTextEnd ); + + void disposeParagraphs(); + + static ::css::uno::Any mapFontColor(::Color const & rColor); + + static ::Color mapFontColor(::css::uno::Any const & rColor); + + static ::css::uno::Any mapFontWeight(::FontWeight nWeight); + + static ::FontWeight mapFontWeight(::css::uno::Any const & rWeight); + + void retrieveDefaultAttributesImpl( + ParagraphImpl const * pParagraph, + const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes, + tPropValMap& rDefAttrSeq); + + void retrieveRunAttributesImpl( + ParagraphImpl const * pParagraph, ::sal_Int32 Index, + const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes, + tPropValMap& rRunAttrSeq); + + static ::css::uno::Sequence< ::css::beans::PropertyValue > + convertHashMapToSequence(tPropValMap& rAttrSeq); + + ::css::uno::Reference< ::css::accessibility::XAccessible > m_xAccessible; + ::TextEngine & m_rEngine; + ::TextView & m_rView; + + SfxListenerGuard m_aEngineListener; + WindowListenerGuard m_aViewListener; + + // All the following members have valid values only after calling init: + + ::std::auto_ptr< Paragraphs > m_xParagraphs; + + // m_nViewOffset is from the start of the document (0) to the start of the + // current view, and m_nViewHeight is the height of the view: + ::sal_Int32 m_nViewOffset; + ::sal_Int32 m_nViewHeight; + + // m_aVisibleBegin points to the first Paragraph that is (partially) + // contained in the view, and m_aVisibleEnd points past the last Paragraph + // that is (partially) contained. If no Paragraphs are (partially) in the + // view, both m_aVisibleBegin and m_aVisibleEnd are set to + // m_xParagraphs->end(). These values are only changed by + // determineVisibleRange. + Paragraphs::iterator m_aVisibleBegin; + Paragraphs::iterator m_aVisibleEnd; + + // m_nVisibleBeginOffset is from m_nViewOffset back to the start of the + // Paragraph pointed to by m_aVisibleBegin (and always has a non-negative + // value). If m_aVisibleBegin == m_xParagraphs->end(), + // m_nVisibleBeginOffset is set to 0. These values are only changed by + // determineVisibleRange. + ::sal_Int32 m_nVisibleBeginOffset; + + // If no selection has yet been set, all the following four variables are + // set to -1. m_nSelectionLastPara/Pos is also the cursor position. + ::sal_Int32 m_nSelectionFirstPara; + ::sal_Int32 m_nSelectionFirstPos; + ::sal_Int32 m_nSelectionLastPara; + ::sal_Int32 m_nSelectionLastPos; + + Paragraphs::iterator m_aFocused; + + ::std::queue< ::TextHint > m_aParagraphNotifications; + bool m_bSelectionChangedNotification; + bool m_bCompoundControlChild; +}; + +} + +#endif // INCLUDED_ACCESSIBILITY_TEXTWINDOWACCESSIBILITY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx b/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx new file mode 100644 index 000000000000..fa6331ba4228 --- /dev/null +++ b/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef ACCESSIBILITY_HELPER_COMBOLISTBOXHELPER_HXX +#define ACCESSIBILITY_HELPER_COMBOLISTBOXHELPER_HXX + +#include <tools/string.hxx> +#include <vcl/wintypes.hxx> +#include <tools/gen.hxx> + +namespace com { namespace sun { namespace star { namespace datatransfer { namespace clipboard { + class XClipboard; +} } } } } + +class Window; +namespace accessibility +{ + class SAL_NO_VTABLE IComboListBoxHelper + { + public: + virtual String GetEntry( USHORT nPos ) const = 0; + virtual Rectangle GetDropDownPosSizePixel( ) const = 0; + virtual Rectangle GetBoundingRectangle( USHORT nItem ) const = 0; + virtual Rectangle GetWindowExtentsRelative( Window* pRelativeWindow ) = 0; + virtual BOOL IsActive() const = 0; + virtual BOOL IsEntryVisible( USHORT nPos ) const = 0; + virtual USHORT GetDisplayLineCount() const = 0; + virtual void GetMaxVisColumnsAndLines( USHORT& rnCols, USHORT& rnLines ) const = 0; + virtual WinBits GetStyle() const = 0; + virtual BOOL IsMultiSelectionEnabled() const = 0; + virtual USHORT GetTopEntry() const = 0; + virtual BOOL IsEntryPosSelected( USHORT nPos ) const = 0; + virtual USHORT GetEntryCount() const = 0; + virtual void Select() = 0; + virtual void SelectEntryPos( USHORT nPos, BOOL bSelect = TRUE ) = 0; + virtual USHORT GetSelectEntryCount() const = 0; + virtual void SetNoSelection() = 0; + virtual USHORT GetSelectEntryPos( USHORT nSelIndex = 0 ) const = 0; + virtual BOOL IsInDropDown() const = 0; + virtual Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const = 0; + virtual long GetIndexForPoint( const Point& rPoint, USHORT& nPos ) const = 0; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > + GetClipboard() = 0; + }; +} +#endif // ACCESSIBILITY_HELPER_COMBOLISTBOXHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/helper/acc_factory.hxx b/accessibility/inc/accessibility/helper/acc_factory.hxx new file mode 100644 index 000000000000..b3dec4607517 --- /dev/null +++ b/accessibility/inc/accessibility/helper/acc_factory.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_HELPER_FACTORY_HXX +#define ACCESSIBILITY_HELPER_FACTORY_HXX + +#include <toolkit/helper/accessiblefactory.hxx> +#include <svtools/accessiblefactory.hxx> + +/** this is the entry point to retrieve a factory for the toolkit-level Accessible/Contexts supplied + by this library + + This function implements the factory function needed in toolkit + (of type GetStandardAccComponentFactory). +*/ +extern "C" void* SAL_CALL getStandardAccessibleFactory(); + +/** this is the entry point to retrieve a factory for the svtools-level Accessible/Contexts supplied + by this library + + This function implements the factory function needed in svtools + (of type GetSvtAccessibilityComponentFactory). +*/ +extern "C" void* SAL_CALL getSvtAccessibilityComponentFactory(); + +#endif // ACCESSIBILITY_HELPER_FACTORY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/helper/accessiblestrings.hrc b/accessibility/inc/accessibility/helper/accessiblestrings.hrc new file mode 100644 index 000000000000..1f936e678b98 --- /dev/null +++ b/accessibility/inc/accessibility/helper/accessiblestrings.hrc @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_HELPER_ACCESSIBLESTRINGS_HRC_ +#define ACCESSIBILITY_HELPER_ACCESSIBLESTRINGS_HRC_ + + +//------------------------------------------------------------------------------ + +#define RID_TK_ACC_START 1000 + + +// Accessible Action Id's ------------------------------------------------------ + +#define RID_STR_ACC_ACTION_CLICK ( RID_TK_ACC_START + 0 ) +#define RID_STR_ACC_ACTION_TOGGLEPOPUP ( RID_TK_ACC_START + 1 ) +#define RID_STR_ACC_ACTION_SELECT ( RID_TK_ACC_START + 2 ) +#define RID_STR_ACC_ACTION_INCLINE ( RID_TK_ACC_START + 3 ) +#define RID_STR_ACC_ACTION_DECLINE ( RID_TK_ACC_START + 4 ) +#define RID_STR_ACC_ACTION_INCBLOCK ( RID_TK_ACC_START + 5 ) +#define RID_STR_ACC_ACTION_DECBLOCK ( RID_TK_ACC_START + 6 ) + + +#define RID_STR_ACC_NAME_BROWSEBUTTON ( RID_TK_ACC_START + 100 ) +#define RID_STR_ACC_DESC_PANELDECL_TABBAR ( RID_TK_ACC_START + 101 ) + +// ----------------------------------------------------------------------------- + +#endif // ACCESSIBILITY_HELPER_ACCESSIBLESTRINGS_HRC_ diff --git a/accessibility/inc/accessibility/helper/accresmgr.hxx b/accessibility/inc/accessibility/helper/accresmgr.hxx new file mode 100644 index 000000000000..4208d6d80f06 --- /dev/null +++ b/accessibility/inc/accessibility/helper/accresmgr.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_HELPER_TKARESMGR_HXX +#define ACCESSIBILITY_HELPER_TKARESMGR_HXX + +#include <rtl/ustring.hxx> + +class SimpleResMgr; + +#define TK_RES_STRING(id) TkResMgr::loadString(id) + +// ----------------------------------------------------------------------------- +// TkResMgr +// ----------------------------------------------------------------------------- + +class TkResMgr +{ + static SimpleResMgr* m_pImpl; + +private: + // no instantiation allowed + TkResMgr() { } + ~TkResMgr() { } + + // we'll instantiate one static member of the following class, + // which in it's dtor ensures that m_pImpl will be deleted + class EnsureDelete + { + public: + EnsureDelete() { } + ~EnsureDelete(); + }; + friend class EnsureDelete; + +protected: + static void ensureImplExists(); + +public: + // loads the string with the specified resource id + static ::rtl::OUString loadString( sal_uInt16 nResId ); +}; + + +#endif // ACCESSIBILITY_HELPER_TKARESMGR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/helper/characterattributeshelper.hxx b/accessibility/inc/accessibility/helper/characterattributeshelper.hxx new file mode 100644 index 000000000000..16e37f4e103c --- /dev/null +++ b/accessibility/inc/accessibility/helper/characterattributeshelper.hxx @@ -0,0 +1,61 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_HELPER_CHARACTERATTRIBUTESHELPER_HXX +#define ACCESSIBILITY_HELPER_CHARACTERATTRIBUTESHELPER_HXX + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <vcl/font.hxx> + +#include <map> + +// ----------------------------------------------------------------------------- +// class CharacterAttributesHelper +// ----------------------------------------------------------------------------- + +class CharacterAttributesHelper +{ +private: + + typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any, ::std::less< ::rtl::OUString > > AttributeMap; + + AttributeMap m_aAttributeMap; + +public: + + CharacterAttributesHelper( const Font& rFont, sal_Int32 nBackColor, sal_Int32 nColor ); + ~CharacterAttributesHelper(); + + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetCharacterAttributes(); + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetCharacterAttributes( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ); +}; + +#endif // ACCESSIBILITY_HELPER_CHARACTERATTRIBUTESHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/helper/listboxhelper.hxx b/accessibility/inc/accessibility/helper/listboxhelper.hxx new file mode 100644 index 000000000000..8343d95e9447 --- /dev/null +++ b/accessibility/inc/accessibility/helper/listboxhelper.hxx @@ -0,0 +1,198 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX +#define ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX + +#include <accessibility/helper/IComboListBoxHelper.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/combobox.hxx> +#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> + +// ----------------------------------------------------------------------------- +// globals +// ----------------------------------------------------------------------------- + +const sal_Int32 DEFAULT_INDEX_IN_PARENT = -1; + +// ----------------------------------------------------------------------------- +// class VCLListBoxHelper +// ----------------------------------------------------------------------------- + +template< class T > class VCLListBoxHelper : public ::accessibility::IComboListBoxHelper +{ +private: + T& m_aComboListBox; + +public: + inline + VCLListBoxHelper( T& _pListBox ) : + m_aComboListBox( _pListBox ){} + + // ----------------------------------------------------------------------------- + virtual String GetEntry( USHORT nPos ) const + { + return m_aComboListBox.GetEntry( nPos ); + } + // ----------------------------------------------------------------------------- + virtual Rectangle GetDropDownPosSizePixel() const + { + Rectangle aTemp = m_aComboListBox.GetWindowExtentsRelative(NULL); + Rectangle aRet = m_aComboListBox.GetDropDownPosSizePixel(); + aRet.Move(aTemp.TopLeft().X(),aTemp.TopLeft().Y()); + return aRet; + } + // ----------------------------------------------------------------------------- + virtual Rectangle GetBoundingRectangle( USHORT nItem ) const + { + Rectangle aRect; + if ( m_aComboListBox.IsInDropDown() && IsEntryVisible( nItem ) ) + { + Rectangle aTemp = m_aComboListBox.GetDropDownPosSizePixel(); + Size aSize = aTemp.GetSize(); + aSize.Height() /= m_aComboListBox.GetDisplayLineCount(); + Point aTopLeft = aTemp.TopLeft(); + aTopLeft.Y() += aSize.Height() * ( nItem - m_aComboListBox.GetTopEntry() ); + aRect = Rectangle( aTopLeft, aSize ); + } + else + aRect = m_aComboListBox.GetBoundingRectangle( nItem ); + return aRect; + } + // ----------------------------------------------------------------------------- + virtual Rectangle GetWindowExtentsRelative( Window* pRelativeWindow ) + { + return m_aComboListBox.GetWindowExtentsRelative( pRelativeWindow ); + } + // ----------------------------------------------------------------------------- + virtual BOOL IsActive() const + { + return m_aComboListBox.IsActive(); + } + // ----------------------------------------------------------------------------- + virtual BOOL IsEntryVisible( USHORT nPos ) const + { + USHORT nTopEntry = m_aComboListBox.GetTopEntry(); + USHORT nLines = m_aComboListBox.GetDisplayLineCount(); + return ( nPos >= nTopEntry && nPos < ( nTopEntry + nLines ) ); + } + // ----------------------------------------------------------------------------- + virtual USHORT GetDisplayLineCount() const + { + return m_aComboListBox.GetDisplayLineCount(); + } + // ----------------------------------------------------------------------------- + virtual void GetMaxVisColumnsAndLines( USHORT& rnCols, USHORT& rnLines ) const + { + m_aComboListBox.GetMaxVisColumnsAndLines(rnCols,rnLines); + } + // ----------------------------------------------------------------------------- + virtual WinBits GetStyle() const + { + return m_aComboListBox.GetStyle(); + } + // ----------------------------------------------------------------------------- + virtual BOOL IsMultiSelectionEnabled() const + { + return m_aComboListBox.IsMultiSelectionEnabled(); + } + // ----------------------------------------------------------------------------- + virtual USHORT GetTopEntry() const + { + return m_aComboListBox.GetTopEntry(); + } + // ----------------------------------------------------------------------------- + virtual BOOL IsEntryPosSelected( USHORT nPos ) const + { + return m_aComboListBox.IsEntryPosSelected(nPos); + } + // ----------------------------------------------------------------------------- + virtual USHORT GetEntryCount() const + { + return m_aComboListBox.GetEntryCount(); + } + // ----------------------------------------------------------------------------- + virtual void Select() + { + m_aComboListBox.Select(); + } + // ----------------------------------------------------------------------------- + virtual void SelectEntryPos( USHORT nPos, BOOL bSelect = TRUE ) + { + m_aComboListBox.SelectEntryPos(nPos,bSelect); + } + // ----------------------------------------------------------------------------- + virtual USHORT GetSelectEntryCount() const + { + return m_aComboListBox.GetSelectEntryCount(); + } + // ----------------------------------------------------------------------------- + virtual void SetNoSelection() + { + m_aComboListBox.SetNoSelection(); + } + // ----------------------------------------------------------------------------- + virtual USHORT GetSelectEntryPos( USHORT nSelIndex = 0 ) const + { + return m_aComboListBox.GetSelectEntryPos(nSelIndex); + } + // ----------------------------------------------------------------------------- + virtual BOOL IsInDropDown() const + { + return m_aComboListBox.IsInDropDown(); + } + // ----------------------------------------------------------------------------- + virtual Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const + { + Rectangle aRect; + + Pair aEntryCharacterRange = m_aComboListBox.GetLineStartEnd( _nEntryPos ); + if ( aEntryCharacterRange.A() + _nCharacterIndex <= aEntryCharacterRange.B() ) + { + long nIndex = aEntryCharacterRange.A() + _nCharacterIndex; + aRect = m_aComboListBox.GetCharacterBounds( nIndex ); + } + return aRect; + } + // ----------------------------------------------------------------------------- + long GetIndexForPoint( const Point& rPoint, USHORT& nPos ) const + { + return m_aComboListBox.GetIndexForPoint( rPoint, nPos ); + } + // ----------------------------------------------------------------------------- + ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > + GetClipboard() + { + return m_aComboListBox.GetClipboard(); + } + // ----------------------------------------------------------------------------- +}; + +#endif // ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx b/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx new file mode 100644 index 000000000000..9dee945787ff --- /dev/null +++ b/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx @@ -0,0 +1,157 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_ACCESSIBLEMENUBASECOMPONENT_HXX +#define ACCESSIBILITY_STANDARD_ACCESSIBLEMENUBASECOMPONENT_HXX + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/awt/Point.hpp> +#include <comphelper/accessiblecomponenthelper.hxx> +#include <cppuhelper/implbase2.hxx> +#include <tools/link.hxx> + +#include <vector> + +class Menu; +class VclSimpleEvent; +class VclMenuEvent; +class VCLExternalSolarLock; + +namespace utl { +class AccessibleStateSetHelper; +} + +// ---------------------------------------------------- +// class OAccessibleMenuBaseComponent +// ---------------------------------------------------- + +typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE; + +typedef ::cppu::ImplHelper2< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::lang::XServiceInfo > OAccessibleMenuBaseComponent_BASE; + +class OAccessibleMenuBaseComponent : public AccessibleExtendedComponentHelper_BASE, + public OAccessibleMenuBaseComponent_BASE +{ + friend class OAccessibleMenuItemComponent; + friend class VCLXAccessibleMenuItem; + friend class VCLXAccessibleMenu; + +private: + VCLExternalSolarLock* m_pExternalLock; + +protected: + typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren; + + AccessibleChildren m_aAccessibleChildren; + Menu* m_pMenu; + + sal_Bool m_bEnabled; + sal_Bool m_bFocused; + sal_Bool m_bVisible; + sal_Bool m_bSelected; + sal_Bool m_bChecked; + + Menu* GetMenu() { return m_pMenu; } + + virtual sal_Bool IsEnabled(); + virtual sal_Bool IsFocused(); + virtual sal_Bool IsVisible(); + virtual sal_Bool IsSelected(); + virtual sal_Bool IsChecked(); + + void SetEnabled( sal_Bool bEnabled ); + void SetFocused( sal_Bool bFocused ); + void SetVisible( sal_Bool bVisible ); + void SetSelected( sal_Bool bSelected ); + void SetChecked( sal_Bool bChecked ); + + void UpdateEnabled( sal_Int32 i, sal_Bool bEnabled ); + void UpdateFocused( sal_Int32 i, sal_Bool bFocused ); + void UpdateVisible(); + void UpdateSelected( sal_Int32 i, sal_Bool bSelected ); + void UpdateChecked( sal_Int32 i, sal_Bool bChecked ); + void UpdateAccessibleName( sal_Int32 i ); + void UpdateItemText( sal_Int32 i ); + + sal_Int32 GetChildCount(); + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChild( sal_Int32 i ); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAt( const ::com::sun::star::awt::Point& rPoint ); + + void InsertChild( sal_Int32 i ); + void RemoveChild( sal_Int32 i ); + + virtual sal_Bool IsHighlighted(); + sal_Bool IsChildHighlighted(); + + void SelectChild( sal_Int32 i ); + void DeSelectAll(); + sal_Bool IsChildSelected( sal_Int32 i ); + + virtual void Select(); + virtual void DeSelect(); + virtual void Click(); + virtual sal_Bool IsPopupMenuOpen(); + + DECL_LINK( MenuEventListener, VclSimpleEvent* ); + + virtual void ProcessMenuEvent( const VclMenuEvent& rVclMenuEvent ); + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) = 0; + + // XComponent + virtual void SAL_CALL disposing(); + +public: + OAccessibleMenuBaseComponent( Menu* pMenu ); + virtual ~OAccessibleMenuBaseComponent(); + + void SetStates(); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessible + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_ACCESSIBLEMENUBASECOMPONENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/accessiblemenucomponent.hxx b/accessibility/inc/accessibility/standard/accessiblemenucomponent.hxx new file mode 100644 index 000000000000..d33d3e05e0dd --- /dev/null +++ b/accessibility/inc/accessibility/standard/accessiblemenucomponent.hxx @@ -0,0 +1,102 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_ACCESSIBLEMENUCOMPONENT_HXX +#define ACCESSIBILITY_STANDARD_ACCESSIBLEMENUCOMPONENT_HXX + +#include <accessibility/standard/accessiblemenubasecomponent.hxx> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <cppuhelper/implbase1.hxx> + + +// ---------------------------------------------------- +// class OAccessibleMenuComponent +// ---------------------------------------------------- + +typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE; + +typedef ::cppu::ImplHelper1< + ::com::sun::star::accessibility::XAccessibleSelection > OAccessibleMenuComponent_BASE; + +class OAccessibleMenuComponent : public OAccessibleMenuBaseComponent, + public OAccessibleMenuComponent_BASE +{ +protected: + virtual sal_Bool IsEnabled(); + virtual sal_Bool IsVisible(); + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // OCommonAccessibleComponent + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + +public: + OAccessibleMenuComponent( Menu* pMenu ); + virtual ~OAccessibleMenuComponent(); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) 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::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 ::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::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleExtendedComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleSelection + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::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); + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_ACCESSIBLEMENUCOMPONENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx b/accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx new file mode 100644 index 000000000000..730175e685a2 --- /dev/null +++ b/accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_ACCESSIBLEMENUITEMCOMPONENT_HXX +#define ACCESSIBILITY_STANDARD_ACCESSIBLEMENUITEMCOMPONENT_HXX + +#include <accessibility/standard/accessiblemenubasecomponent.hxx> + + +// ---------------------------------------------------- +// class OAccessibleMenuItemComponent +// ---------------------------------------------------- + +class OAccessibleMenuItemComponent : public OAccessibleMenuBaseComponent +{ + friend class OAccessibleMenuBaseComponent; + +protected: + Menu* m_pParent; + sal_uInt16 m_nItemPos; + ::rtl::OUString m_sAccessibleName; + ::rtl::OUString m_sItemText; + + virtual sal_Bool IsEnabled(); + virtual sal_Bool IsVisible(); + virtual void Select(); + virtual void DeSelect(); + virtual void Click(); + + void SetItemPos( sal_uInt16 nItemPos ); + void SetAccessibleName( const ::rtl::OUString& sAccessibleName ); + ::rtl::OUString GetAccessibleName(); + void SetItemText( const ::rtl::OUString& sItemText ); + ::rtl::OUString GetItemText(); + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // OCommonAccessibleComponent + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL disposing(); + +public: + OAccessibleMenuItemComponent( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu ); + virtual ~OAccessibleMenuItemComponent(); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::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::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 ::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 void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleExtendedComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_ACCESSIBLEMENUITEMCOMPONENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx new file mode 100644 index 000000000000..1aa73ab26a2b --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx @@ -0,0 +1,182 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBOX_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBOX_HXX + +#include <map> +#include <accessibility/standard/vclxaccessibleedit.hxx> +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp> +#include <cppuhelper/implbase2.hxx> + + +typedef ::cppu::ImplHelper2< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleAction + > VCLXAccessibleBox_BASE; + + +/** Base class for list- and combo boxes. This class manages the box' + children. The classed derived from this one have only to implement the + <member>IsValid</member> method and return the corrent implementation name. +*/ +class VCLXAccessibleBox + : public VCLXAccessibleComponent, + public VCLXAccessibleBox_BASE +{ +public: + enum BoxType {COMBOBOX, LISTBOX}; + + /** The constructor is initialized with the box type whitch may be + either <const>COMBOBOX</const> or <const>LISTBOX</const> and a flag + indicating whether the box is a drop down box. + */ + VCLXAccessibleBox (VCLXWindow* pVCLXindow, BoxType aType, bool bIsDropDownBox); + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XInterface + DECLARE_XINTERFACE() + + + + // XAccessible + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL + getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + + /** Each object has one or two children: an optional text field and the + actual list. The text field is not provided for non drop down list + boxes. + */ + sal_Int32 SAL_CALL getAccessibleChildCount (void) + throw (::com::sun::star::uno::RuntimeException); + /** For drop down list boxes the text field is a not editable + <type>VCLXAccessibleTextField</type>, for combo boxes it is an + editable <type>VLCAccessibleEdit</type>. + */ + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL + getAccessibleChild (sal_Int32 i) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + /** The role is always <const + scope="com::sun::star::accessibility">AccessibleRole::COMBO_BOX</const>. + */ + sal_Int16 SAL_CALL getAccessibleRole (void) + throw (::com::sun::star::uno::RuntimeException); + + sal_Int32 SAL_CALL getAccessibleIndexInParent (void) + throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleAction + + /** There is one action for drop down boxes and none for others. + */ + virtual sal_Int32 SAL_CALL getAccessibleActionCount (void) + throw (::com::sun::star::uno::RuntimeException); + /** The action for drop down boxes lets the user toggle the visibility of the + popup menu. + */ + virtual sal_Bool SAL_CALL doAccessibleAction (sal_Int32 nIndex) + throw (::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + /** The returned string is assoicated with resource + <const>RID_STR_ACC_ACTION_TOGGLEPOPUP</const>. + */ + virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription (sal_Int32 nIndex) + throw (::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + /** No keybinding returned so far. + */ + 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); + + // XComponent + + /** This method is called from the implementation helper during an + XComponent::dispose() call. + */ + virtual void SAL_CALL disposing (void); + + +protected: + /** Specifies whether the box is a combo box or a list box. List boxes + have multi selection. + */ + BoxType m_aBoxType; + + /// Specifies whether the box is a drop down box and thus has an action. + bool m_bIsDropDownBox; + + /// The child that represents the text field if there is one. + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> + m_xText; + + /// The child that contains the items of this box. + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> + m_xList; + + /** This flag specifies whether an object has a text field as child + regardless of whether that child being currently instantiated or + not. + */ + bool m_bHasTextChild; + + /** This flag specifies whether an object has a list as child regardless + of whether that child being currently instantiated or not. This + flag is always true in the current implementation because the list + child is just another wrapper arround this object and thus has the + same life time. + */ + bool m_bHasListChild; + + virtual ~VCLXAccessibleBox (void); + + /** Returns </true> when the object is valid. + */ + virtual bool IsValid (void) const = 0; + + virtual void ProcessWindowChildEvent (const VclWindowEvent& rVclWindowEvent); + virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent); + + +private: + /// Index in parent. This is settable from the outside. + sal_Int32 m_nIndexInParent; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblebutton.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblebutton.hxx new file mode 100644 index 000000000000..f1e74db2fb2e --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblebutton.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBUTTON_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBUTTON_HXX + +#include <accessibility/standard/vclxaccessibletextcomponent.hxx> + +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> + +#include <cppuhelper/implbase2.hxx> + + +// ---------------------------------------------------- +// class VCLXAccessibleButton +// ---------------------------------------------------- + +typedef ::cppu::ImplHelper2< + ::com::sun::star::accessibility::XAccessibleAction, + ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleButton_BASE; + +class VCLXAccessibleButton : public VCLXAccessibleTextComponent, + public VCLXAccessibleButton_BASE +{ +protected: + virtual ~VCLXAccessibleButton(); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + +public: + VCLXAccessibleButton( VCLXWindow* pVCLXindow ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); + + // 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); + + // XAccessibleValue + virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBUTTON_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblecheckbox.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblecheckbox.hxx new file mode 100644 index 000000000000..7545a7c93756 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblecheckbox.hxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLECHECKBOX_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLECHECKBOX_HXX + +#include <accessibility/standard/vclxaccessibletextcomponent.hxx> + +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> + +#include <cppuhelper/implbase2.hxx> + + +// ---------------------------------------------------- +// class VCLXAccessibleCheckBox +// ---------------------------------------------------- + +typedef ::cppu::ImplHelper2< + ::com::sun::star::accessibility::XAccessibleAction, + ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleCheckBox_BASE; + +class VCLXAccessibleCheckBox : public VCLXAccessibleTextComponent, + public VCLXAccessibleCheckBox_BASE +{ +private: + bool m_bChecked; + bool m_bIndeterminate; + +protected: + virtual ~VCLXAccessibleCheckBox(); + + bool IsChecked(); + bool IsIndeterminate(); + + void SetChecked( bool bChecked ); + void SetIndeterminate( bool bIndeterminate ); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + +public: + VCLXAccessibleCheckBox( VCLXWindow* pVCLXindow ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // 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); + + // XAccessibleValue + virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLECHECKBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblecombobox.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblecombobox.hxx new file mode 100644 index 000000000000..3eba57f58bca --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblecombobox.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLECOMBOBOX_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLECOMBOBOX_HXX + +#include <map> +#include <accessibility/standard/vclxaccessiblebox.hxx> +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <cppuhelper/implbase1.hxx> + + +/** The accessible combobox has two children. The first is the text field + represented by an object of the <type>VCLXAccessibleEdit</type> class. + The second is the list containing all items and is represented by an + object of the <type>VCLXAccessibleList</type> class which does not + support selection at the moment. +*/ +class VCLXAccessibleComboBox + : public VCLXAccessibleBox +{ +public: + VCLXAccessibleComboBox (VCLXWindow* pVCLXindow); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName (void) + throw (::com::sun::star::uno::RuntimeException); + // Return combo box specific services. + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames (void) + throw (::com::sun::star::uno::RuntimeException); + +protected: + virtual ~VCLXAccessibleComboBox (void); + + virtual bool IsValid (void) const; + virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLECHECKBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibledropdowncombobox.hxx b/accessibility/inc/accessibility/standard/vclxaccessibledropdowncombobox.hxx new file mode 100644 index 000000000000..c90e91b179d5 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessibledropdowncombobox.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNCOMBOBOX_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNCOMBOBOX_HXX + +#include <accessibility/standard/vclxaccessiblebox.hxx> +#include <accessibility/standard/vclxaccessibleedit.hxx> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> + +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/weakref.hxx> + + +/** The accessible drop down combobox has two children. The first is the + text field represented by an object of the + <type>VCLXAccessibleEdit</type> class. The second is the list + containing all items and is represented by an object of the + <type>VCLXAccessibleList</type> class which does not support selection + at the moment. +*/ +class VCLXAccessibleDropDownComboBox : public VCLXAccessibleBox +{ +public: + VCLXAccessibleDropDownComboBox (VCLXWindow* pVCLXindow); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName (void) + throw (::com::sun::star::uno::RuntimeException); + // Return drop down combo box specific services. + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames (void) + throw (::com::sun::star::uno::RuntimeException); + +protected: + virtual ~VCLXAccessibleDropDownComboBox (void); + + virtual bool IsValid (void) const; + virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNCOMBOBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibledropdownlistbox.hxx b/accessibility/inc/accessibility/standard/vclxaccessibledropdownlistbox.hxx new file mode 100644 index 000000000000..67e942b7a917 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessibledropdownlistbox.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNLISTBOX_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNLISTBOX_HXX + +#include <accessibility/standard/vclxaccessiblebox.hxx> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> + +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/weakref.hxx> + + +/** The accessible drop down combobox has two children. The first is the + text field represented by an object of the + <type>VCLXAccessibleTextField</type> class which can not be edited. The + second is the list containing all items and is represented by an object + of the <type>VCLXAccessibleListBoxList</type> class which does support + selection. +*/ +class VCLXAccessibleDropDownListBox : public VCLXAccessibleBox +{ +public: + VCLXAccessibleDropDownListBox (VCLXWindow* pVCLXindow); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName (void) + throw (::com::sun::star::uno::RuntimeException); + // Return drop down list box specific services. + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames (void) + throw (::com::sun::star::uno::RuntimeException); + +protected: + virtual ~VCLXAccessibleDropDownListBox (void); + + virtual bool IsValid (void) const; + virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent); + +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNLISTBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx b/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx new file mode 100644 index 000000000000..9fc77a0c8e7c --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx @@ -0,0 +1,121 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEEDIT_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEEDIT_HXX + +#include <accessibility/standard/vclxaccessibletextcomponent.hxx> +#include <com/sun/star/accessibility/XAccessibleEditableText.hpp> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> + +#include <cppuhelper/implbase2.hxx> + + +// ---------------------------------------------------- +// class VCLXAccessibleEdit +// ---------------------------------------------------- + +typedef ::cppu::ImplHelper2< + ::com::sun::star::accessibility::XAccessibleAction, + ::com::sun::star::accessibility::XAccessibleEditableText > VCLXAccessibleEdit_BASE; + +class VCLXAccessibleEdit : public VCLXAccessibleTextComponent, + public VCLXAccessibleEdit_BASE +{ + friend class VCLXAccessibleBox; + +private: + sal_Int32 m_nSelectionStart; + sal_Int32 m_nCaretPosition; + +protected: + virtual ~VCLXAccessibleEdit(); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // OCommonAccessibleText + virtual ::rtl::OUString implGetText(); + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); + +public: + VCLXAccessibleEdit( VCLXWindow* pVCLXindow ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + + // 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); + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSelectedText( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getText( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleEditableText + virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL insertText( const ::rtl::OUString& sText, sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::rtl::OUString& sReplacement ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aAttributeSet ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setText( const ::rtl::OUString& sText ) throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEEDIT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblefixedhyperlink.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblefixedhyperlink.hxx new file mode 100644 index 000000000000..9777ed472104 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblefixedhyperlink.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDHYPERLINK_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDHYPERLINK_HXX + +#include <accessibility/standard/vclxaccessibletextcomponent.hxx> + +// ---------------------------------------------------- +// class VCLXAccessibleFixedHyperlink +// ---------------------------------------------------- + +class VCLXAccessibleFixedHyperlink : public VCLXAccessibleTextComponent +{ +protected: + virtual ~VCLXAccessibleFixedHyperlink(); + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex ); + +public: + VCLXAccessibleFixedHyperlink( VCLXWindow* pVCLXindow ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDHYPERLINK_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblefixedtext.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblefixedtext.hxx new file mode 100644 index 000000000000..2caaee09f7e6 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblefixedtext.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDTEXT_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDTEXT_HXX + +#include <accessibility/standard/vclxaccessibletextcomponent.hxx> + +// ---------------------------------------------------- +// class VCLXAccessibleFixedText +// ---------------------------------------------------- + +class VCLXAccessibleFixedText : public VCLXAccessibleTextComponent +{ +protected: + virtual ~VCLXAccessibleFixedText(); + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex ); + +public: + VCLXAccessibleFixedText( VCLXWindow* pVCLXindow ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx new file mode 100644 index 000000000000..ea08b1b33919 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx @@ -0,0 +1,226 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLELIST_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLELIST_HXX + +#include <vector> +#include <functional> +#include "accessibility/standard/vclxaccessiblelistitem.hxx" +#include <accessibility/standard/vclxaccessibleedit.hxx> +#include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <cppuhelper/implbase2.hxx> + +typedef ::cppu::ImplHelper2< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleSelection + > VCLXAccessibleList_BASE; + +typedef std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > > + ListItems; + +namespace accessibility +{ + class IComboListBoxHelper; +} + + +/** Base class for the list contained in list- and combo boxes. This class + does not support selection because lists of combo boxes give no direct + access to their underlying list implementation. Look into derived + classes for selection. +*/ +class VCLXAccessibleList + : public VCLXAccessibleComponent, + public VCLXAccessibleList_BASE +{ +public: + enum BoxType {COMBOBOX, LISTBOX}; + + VCLXAccessibleList (VCLXWindow* pVCLXindow, BoxType aBoxType, + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& _xParent); + + /** The index that is passed to this method is returned on following + calls to <member>getAccessibleIndexInParent</member>. + */ + void SetIndexInParent (sal_Int32 nIndex); + + /** Process some of the events and delegate the rest to the base classes. + */ + virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent); + + /** Called on reception of selection events this method checks all known + list items for a possible change in their selection state and + updates that accordingly. No accessibility events are send because + the XAccessibleSelection interface is not supported and the items + are transient. + @param sTextOfSelectedItem + This string contains the text of the the currently selected + item. It is used to retrieve the index of that item. + */ + void UpdateSelection (::rtl::OUString sTextOfSelectedItem); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XAccessible + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL + getAccessibleContext (void) + throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount (void) + throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL + getAccessibleChild (sal_Int32 i) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleParent( ) + throw (::com::sun::star::uno::RuntimeException); + + /** The index returned as index in parent is always the one set with the + <member>SetIndexInParent()</member> method. + */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent (void) + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole (void) + throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + virtual sal_Bool SAL_CALL contains (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 + getAccessibleAt (const ::com::sun::star::awt::Point& aPoint) + throw (::com::sun::star::uno::RuntimeException); + + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName (void) + throw (::com::sun::star::uno::RuntimeException); + // Return list specific services. + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames (void) + throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleSelection + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::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); + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException); + +protected: + BoxType m_aBoxType; + ::accessibility::IComboListBoxHelper* m_pListBoxHelper; + ListItems m_aAccessibleChildren; + sal_Int32 m_nVisibleLineCount; + /// Index in parent. This is settable from the outside. + sal_Int32 m_nIndexInParent; + sal_Int32 m_nLastTopEntry; + USHORT m_nLastSelectedPos; + bool m_bDisableProcessEvent; + bool m_bVisible; + + + + /// The currently selected item. + ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible> + m_xSelectedItem; + + virtual ~VCLXAccessibleList (void); + + /** This function is called from the implementation helper during a + XComponent::dispose call. Free the list of items and the items themselves. + */ + virtual void SAL_CALL disposing (void); + + /** This method adds the states + <const>AccessibleStateType::FOCUSABLE</const> and possibly + <const>AccessibleStateType::MULTI_SELECTABLE</const> to the state set + of the base classes. + */ + virtual void FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet); + + /** Create the specified child and insert it into the list of children. + Sets the child's states. + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreateChild (sal_Int32 i); + + /** Call this method when the item list has been changed, i.e. items + have been deleted or inserted. + @param bItemInserted + Indicate whether items have been inserted (<TRUE/>) or removed + (<FALSE/>). + @param nIndex + Index of the new or removed item. A value of -1 indicates that + the whole list has been cleared. + */ + virtual void HandleChangedItemList (bool bItemInserted, sal_Int32 nIndex); + + // VCLXAccessibleComponent + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + +private: + /** We need to save the accessible parent to return it in <type>getAccessibleParent()</type>, + because this method of the base class returns the wrong parent. + */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > m_xParent; + + + /** dispose all items aand clears the container + */ + void clearItems(); + + void adjustEntriesIndexInParent(ListItems::iterator& _aBegin,::std::mem_fun_t<bool,VCLXAccessibleListItem>& _rMemFun); + void UpdateEntryRange_Impl (void); +protected: + void UpdateSelection_Impl (USHORT nPos = 0); + BOOL checkEntrySelected(USHORT _nPos, + ::com::sun::star::uno::Any& _rNewValue, + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxNewAcc); +private: + void notifyVisibleStates(sal_Bool _bSetNew ); + void UpdateVisibleLineCount(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblelistbox.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblelistbox.hxx new file mode 100644 index 000000000000..52c07318c720 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblelistbox.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOX_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOX_HXX + +#include <accessibility/standard/vclxaccessiblebox.hxx> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> + + +/** The accessible drop down combobox has one children. It is the list + containing all items and is represented by an object of the + <type>VCLXAccessibleListBoxList</type> class which does support + selection. +*/ +class VCLXAccessibleListBox : public VCLXAccessibleBox +{ +public: + VCLXAccessibleListBox (VCLXWindow* pVCLXindow); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName (void) + throw (::com::sun::star::uno::RuntimeException); + // Return list box specific services. + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames (void) + throw (::com::sun::star::uno::RuntimeException); + +protected: + virtual ~VCLXAccessibleListBox (void); + + virtual bool IsValid (void) const; + virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblelistboxlist.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblelistboxlist.hxx new file mode 100644 index 000000000000..436a20f55f28 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblelistboxlist.hxx @@ -0,0 +1,108 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOXLIST_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOXLIST_HXX + +#include <accessibility/standard/vclxaccessiblelist.hxx> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <comphelper/broadcasthelper.hxx> +#include <comphelper/uno3.hxx> +#include <cppuhelper/implbase1.hxx> + +typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleSelection + > VCLXAccessibleListBoxList_BASE; + + +class ListBox; +/** This class extends the list of the <type>VCLXAccessibleList</type> class + about selection. +*/ +class VCLXAccessibleListBoxList : + public VCLXAccessibleList, + public VCLXAccessibleListBoxList_BASE +{ +public: + VCLXAccessibleListBoxList (VCLXWindow* pVCLXindow, BoxType aBoxType, + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& _xParent); + + // XInterface + DECLARE_XINTERFACE( ) + + // XTypeProvider + DECLARE_XTYPEPROVIDER( ) + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName (void) + throw (::com::sun::star::uno::RuntimeException); + // Return list box list specific services. + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames (void) + 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); + + /** Create the specified child and insert it into the list of children. + Sets the child's states. + */ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreateChild (sal_Int32 i); + + +protected: + virtual ~VCLXAccessibleListBoxList (void); + + virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent); + +private: + sal_Int32 m_nLastTopEntry; + USHORT m_nLastSelectedPos; + bool m_bDisableProcessEvent; + + void UpdateEntryRange_Impl (void); + using VCLXAccessibleList::UpdateSelection_Impl; + void UpdateSelection_Impl (void); + using VCLXAccessibleList::checkEntrySelected; + BOOL checkEntrySelected(ListBox* _pListBox, + USHORT _nPos, + ::com::sun::star::uno::Any& _rNewValue, + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxNewAcc); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx new file mode 100644 index 000000000000..9dc4936988a8 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx @@ -0,0 +1,198 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTITEM_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTITEM_HXX + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleStateSet.hpp> +#include <com/sun/star/accessibility/XAccessibleText.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/compbase6.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <comphelper/accessibletexthelper.hxx> + +// forward --------------------------------------------------------------- + +namespace com { namespace sun { namespace star { namespace awt { + struct Point; + struct Rectangle; + struct Size; + class XFocusListener; +} } } } + +namespace accessibility +{ + class IComboListBoxHelper; +} + +// class VCLXAccessibleListItem ------------------------------------------ + +typedef ::cppu::WeakAggComponentImplHelper6< ::com::sun::star::accessibility::XAccessible + , ::com::sun::star::accessibility::XAccessibleContext + , ::com::sun::star::accessibility::XAccessibleComponent + , ::com::sun::star::accessibility::XAccessibleEventBroadcaster + , ::com::sun::star::accessibility::XAccessibleText + , ::com::sun::star::lang::XServiceInfo > VCLXAccessibleListItem_BASE; + +/** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry +*/ +class VCLXAccessibleListItem : public ::comphelper::OBaseMutex, + public ::comphelper::OCommonAccessibleText, + public VCLXAccessibleListItem_BASE +{ +private: + ::rtl::OUString m_sEntryText; + sal_Int32 m_nIndexInParent; + sal_Bool m_bSelected; + sal_Bool m_bVisible; + +protected: + /// client id in the AccessibleEventNotifier queue + sal_uInt32 m_nClientId; + ::accessibility::IComboListBoxHelper* m_pListBoxHelper; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > m_xParentContext; + +private: + /** notifies all listeners that this object has changed + @param _nEventId + is the event id + @param _aOldValue + is the old value + @param _aNewValue + is the new value + */ + void NotifyAccessibleEvent( sal_Int16 _nEventId, + const ::com::sun::star::uno::Any& _aOldValue, + const ::com::sun::star::uno::Any& _aNewValue ); + +protected: + virtual ~VCLXAccessibleListItem(); + /** this function is called upon disposing the component + */ + virtual void SAL_CALL disposing(); + + // OCommonAccessibleText + virtual ::rtl::OUString implGetText(); + virtual ::com::sun::star::lang::Locale implGetLocale(); + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); + +public: + /** OAccessibleBase needs a valid view + @param _pListBoxHelper + is the list- or combobox for which we implement an accessible object + @param _nIndexInParent + is the position of the entry inside the listbox + @param _xParent + is our parent accessible object + */ + VCLXAccessibleListItem( ::accessibility::IComboListBoxHelper* _pListBoxHelper, + sal_Int32 _nIndexInParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent ); + + + inline sal_Bool IsSelected() const { return m_bSelected; } + void SetSelected( sal_Bool _bSelected ); + void SetVisible( sal_Bool _bVisible ); + inline bool DecrementIndexInParent() { OSL_ENSURE(m_nIndexInParent != 0,"Invalid call!");--m_nIndexInParent; return true;} + inline bool IncrementIndexInParent() { ++m_nIndexInParent; return true;} + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire( ) throw(); + virtual void SAL_CALL release( ) throw(); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() 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& rServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // 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::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) 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::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 void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground (void) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground (void) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleEventBroadcaster + using cppu::WeakAggComponentImplHelperBase::addEventListener; + using cppu::WeakAggComponentImplHelperBase::removeEventListener; + 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); +}; + +#endif // ACCESSIBILITY_STANDARD_ACCESSIBLELISTBOXENTRY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx new file mode 100644 index 000000000000..6103dbeb6fe7 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENU_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENU_HXX + +#include <accessibility/standard/vclxaccessiblemenuitem.hxx> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> + +#include <cppuhelper/implbase1.hxx> + + +// ---------------------------------------------------- +// class VCLXAccessibleMenu +// ---------------------------------------------------- + +typedef ::cppu::ImplHelper1 < + ::com::sun::star::accessibility::XAccessibleSelection > VCLXAccessibleMenu_BASE; + +class VCLXAccessibleMenu : public VCLXAccessibleMenuItem, + public VCLXAccessibleMenu_BASE +{ +protected: + virtual sal_Bool IsFocused(); + virtual sal_Bool IsPopupMenuOpen(); + +public: + VCLXAccessibleMenu( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu ); + virtual ~VCLXAccessibleMenu(); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + 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); + + // XAccessibleSelection + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::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); + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENU_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx new file mode 100644 index 000000000000..ffe565fcd1db --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUBAR_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUBAR_HXX + +#include <accessibility/standard/accessiblemenucomponent.hxx> + +class VclSimpleEvent; +class VclWindowEvent; +class Window; + + +// ---------------------------------------------------- +// class VCLXAccessibleMenuBar +// ---------------------------------------------------- + +class VCLXAccessibleMenuBar : public OAccessibleMenuComponent +{ +protected: + Window* m_pWindow; + + virtual sal_Bool IsFocused(); + + DECL_LINK( WindowEventListener, VclSimpleEvent* ); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + + // XComponent + virtual void SAL_CALL disposing(); + +public: + VCLXAccessibleMenuBar( Menu* pMenu ); + virtual ~VCLXAccessibleMenuBar(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleExtendedComponent + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUBAR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenuitem.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenuitem.hxx new file mode 100644 index 000000000000..78e08bc4d0af --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblemenuitem.hxx @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUITEM_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUITEM_HXX + +#include <accessibility/standard/accessiblemenuitemcomponent.hxx> + +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> + +#include <cppuhelper/implbase3.hxx> +#include <comphelper/accessibletexthelper.hxx> + + +// ---------------------------------------------------- +// class VCLXAccessibleMenuItem +// ---------------------------------------------------- + +typedef ::cppu::ImplHelper3< + ::com::sun::star::accessibility::XAccessibleText, + ::com::sun::star::accessibility::XAccessibleAction, + ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleMenuItem_BASE; + +class VCLXAccessibleMenuItem : public OAccessibleMenuItemComponent, + public ::comphelper::OCommonAccessibleText, + public VCLXAccessibleMenuItem_BASE +{ +protected: + virtual sal_Bool IsFocused(); + virtual sal_Bool IsSelected(); + virtual sal_Bool IsChecked(); + + virtual sal_Bool IsHighlighted(); + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // OCommonAccessibleText + virtual ::rtl::OUString implGetText(); + virtual ::com::sun::star::lang::Locale implGetLocale(); + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); + +public: + VCLXAccessibleMenuItem( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu = 0 ); + virtual ~VCLXAccessibleMenuItem(); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // 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); + + // XAccessibleValue + virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenuseparator.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenuseparator.hxx new file mode 100644 index 000000000000..0cfb3e50545b --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblemenuseparator.hxx @@ -0,0 +1,56 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUSEPARATOR_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUSEPARATOR_HXX + +#include <accessibility/standard/accessiblemenuitemcomponent.hxx> + + +// ---------------------------------------------------- +// class VCLXAccessibleMenuSeparator +// ---------------------------------------------------- + +class VCLXAccessibleMenuSeparator : public OAccessibleMenuItemComponent +{ +public: + VCLXAccessibleMenuSeparator( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu = 0 ); + virtual ~VCLXAccessibleMenuSeparator(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); +}; + + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUSEPARATOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblepopupmenu.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblepopupmenu.hxx new file mode 100644 index 000000000000..536241abab4e --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblepopupmenu.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEPOPUPMENU_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEPOPUPMENU_HXX + +#include <accessibility/standard/accessiblemenucomponent.hxx> + + +// ---------------------------------------------------- +// class VCLXAccessiblePopupMenu +// ---------------------------------------------------- + +class VCLXAccessiblePopupMenu : public OAccessibleMenuComponent +{ +protected: + virtual sal_Bool IsFocused(); + +public: + VCLXAccessiblePopupMenu( Menu* pMenu ); + virtual ~VCLXAccessiblePopupMenu(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleExtendedComponent + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEPOPUPMENU_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx b/accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx new file mode 100644 index 000000000000..649b844a0159 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLERADIOBUTTON_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLERADIOBUTTON_HXX + +#include <accessibility/standard/vclxaccessibletextcomponent.hxx> + +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> + +#include <cppuhelper/implbase2.hxx> + + +// ---------------------------------------------------- +// class VCLXAccessibleRadioButton +// ---------------------------------------------------- + +typedef ::cppu::ImplHelper2< + ::com::sun::star::accessibility::XAccessibleAction, + ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleRadioButton_BASE; + +class VCLXAccessibleRadioButton : public VCLXAccessibleTextComponent, + public VCLXAccessibleRadioButton_BASE +{ +protected: + virtual ~VCLXAccessibleRadioButton(); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet ); + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + +public: + VCLXAccessibleRadioButton( VCLXWindow* pVCLXindow ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // 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); + + // XAccessibleValue + virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLERADIOBUTTON_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx new file mode 100644 index 000000000000..b1d26c84f7cb --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLESCROLLBAR_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLESCROLLBAR_HXX + +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> + +#include <cppuhelper/implbase2.hxx> + + +// ---------------------------------------------------- +// class VCLXAccessibleScrollBar +// ---------------------------------------------------- + +typedef ::cppu::ImplHelper2< + ::com::sun::star::accessibility::XAccessibleAction, + ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleScrollBar_BASE; + +class VCLXAccessibleScrollBar : public VCLXAccessibleComponent, + public VCLXAccessibleScrollBar_BASE +{ +protected: + virtual ~VCLXAccessibleScrollBar(); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + +public: + VCLXAccessibleScrollBar( VCLXWindow* pVCLXindow ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // 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); + + // XAccessibleValue + virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLESCROLLBAR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx new file mode 100644 index 000000000000..60d88e1c9f14 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBAR_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBAR_HXX + +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + +#include <vector> + +class StatusBar; + +// ---------------------------------------------------- +// class VCLXAccessibleStatusBar +// ---------------------------------------------------- + +class VCLXAccessibleStatusBar : public VCLXAccessibleComponent +{ +private: + typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren; + + AccessibleChildren m_aAccessibleChildren; + StatusBar* m_pStatusBar; + +protected: + void UpdateShowing( sal_Int32 i, sal_Bool bShowing ); + void UpdateItemName( sal_Int32 i ); + void UpdateItemText( sal_Int32 i ); + + void InsertChild( sal_Int32 i ); + void RemoveChild( sal_Int32 i ); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + + // XComponent + virtual void SAL_CALL disposing(); + +public: + VCLXAccessibleStatusBar( VCLXWindow* pVCLXWindow ); + ~VCLXAccessibleStatusBar(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + 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); +}; + + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBAR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx new file mode 100644 index 000000000000..1c7525764c40 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx @@ -0,0 +1,144 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <comphelper/accessibletexthelper.hxx> +#include <cppuhelper/implbase2.hxx> + + +class StatusBar; +class VCLExternalSolarLock; + +namespace utl { +class AccessibleStateSetHelper; +} + + +// ---------------------------------------------------- +// class VCLXAccessibleStatusBarItem +// ---------------------------------------------------- + +typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE; + +typedef ::cppu::ImplHelper2< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::lang::XServiceInfo > VCLXAccessibleStatusBarItem_BASE; + +class VCLXAccessibleStatusBarItem : public AccessibleTextHelper_BASE, + public VCLXAccessibleStatusBarItem_BASE +{ + friend class VCLXAccessibleStatusBar; + +private: + VCLExternalSolarLock* m_pExternalLock; + StatusBar* m_pStatusBar; + sal_uInt16 m_nItemId; + ::rtl::OUString m_sItemName; + ::rtl::OUString m_sItemText; + sal_Bool m_bShowing; + +protected: + sal_Bool IsShowing(); + void SetShowing( sal_Bool bShowing ); + void SetItemName( const ::rtl::OUString& sItemName ); + ::rtl::OUString GetItemName(); + void SetItemText( const ::rtl::OUString& sItemText ); + ::rtl::OUString GetItemText(); + sal_uInt16 GetItemId() const { return m_nItemId; } + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // OCommonAccessibleComponent + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + + // OCommonAccessibleText + virtual ::rtl::OUString implGetText(); + virtual ::com::sun::star::lang::Locale implGetLocale(); + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); + + // XComponent + virtual void SAL_CALL disposing(); + +public: + VCLXAccessibleStatusBarItem( StatusBar* pStatusBar, sal_uInt16 nItemId ); + virtual ~VCLXAccessibleStatusBarItem(); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // 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::lang::IndexOutOfBoundsException, ::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::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) 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::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + 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 void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleExtendedComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx new file mode 100644 index 000000000000..b46eadcd9a23 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABCONTROL_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABCONTROL_HXX + +#include <toolkit/awt/vclxaccessiblecomponent.hxx> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> + +#include <vector> + +class TabControl; + + +// ---------------------------------------------------- +// class VCLXAccessibleTabControl +// ---------------------------------------------------- + +typedef ::cppu::ImplHelper1 < + ::com::sun::star::accessibility::XAccessibleSelection > VCLXAccessibleTabControl_BASE; + +class VCLXAccessibleTabControl : public VCLXAccessibleComponent, + public VCLXAccessibleTabControl_BASE +{ +private: + typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren; + + AccessibleChildren m_aAccessibleChildren; + TabControl* m_pTabControl; + +protected: + void UpdateFocused(); + void UpdateSelected( sal_Int32 i, bool bSelected ); + void UpdatePageText( sal_Int32 i ); + void UpdateTabPage( sal_Int32 i, bool bNew ); + + void InsertChild( sal_Int32 i ); + void RemoveChild( sal_Int32 i ); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // XComponent + virtual void SAL_CALL disposing(); + +public: + VCLXAccessibleTabControl( VCLXWindow* pVCLXWindow ); + ~VCLXAccessibleTabControl(); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleSelection + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::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); + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); +}; + + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABCONTROL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx new file mode 100644 index 000000000000..9380d517158c --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx @@ -0,0 +1,148 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGE_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGE_HXX + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <comphelper/accessibletexthelper.hxx> +#include <cppuhelper/implbase2.hxx> + + +class TabControl; +class VCLExternalSolarLock; + +namespace utl { +class AccessibleStateSetHelper; +} + + +// ---------------------------------------------------- +// class VCLXAccessibleTabPage +// ---------------------------------------------------- + +typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE; + +typedef ::cppu::ImplHelper2< + ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::lang::XServiceInfo > VCLXAccessibleTabPage_BASE; + +class VCLXAccessibleTabPage : public AccessibleTextHelper_BASE, + public VCLXAccessibleTabPage_BASE +{ + friend class VCLXAccessibleTabControl; + +private: + VCLExternalSolarLock* m_pExternalLock; + TabControl* m_pTabControl; + sal_uInt16 m_nPageId; + bool m_bFocused; + bool m_bSelected; + ::rtl::OUString m_sPageText; + +protected: + bool IsFocused(); + bool IsSelected(); + + void SetFocused( bool bFocused ); + void SetSelected( bool bSelected ); + void SetPageText( const ::rtl::OUString& sPageText ); + ::rtl::OUString GetPageText(); + + void Update( bool bNew ); + + sal_uInt16 GetPageId() const { return m_nPageId; } + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // OCommonAccessibleComponent + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + + // OCommonAccessibleText + virtual ::rtl::OUString implGetText(); + virtual ::com::sun::star::lang::Locale implGetLocale(); + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); + + // XComponent + virtual void SAL_CALL disposing(); + +public: + VCLXAccessibleTabPage( TabControl* pTabControl, sal_uInt16 nPageId ); + virtual ~VCLXAccessibleTabPage(); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // 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::lang::IndexOutOfBoundsException, ::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::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) 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::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + 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 void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleExtendedComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx new file mode 100644 index 000000000000..cf7c2de10d3c --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGEWINDOW_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGEWINDOW_HXX + +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + + +class TabControl; +class TabPage; + + +// ---------------------------------------------------- +// class VCLXAccessibleTabPageWindow +// ---------------------------------------------------- + +class VCLXAccessibleTabPageWindow : public VCLXAccessibleComponent +{ +private: + TabControl* m_pTabControl; + TabPage* m_pTabPage; + sal_uInt16 m_nPageId; + +protected: + // OCommonAccessibleComponent + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL disposing(); + +public: + VCLXAccessibleTabPageWindow( VCLXWindow* pVCLXWindow ); + ~VCLXAccessibleTabPageWindow(); + + // XAccessibleContext + 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); +}; + + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGEWINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletextcomponent.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletextcomponent.hxx new file mode 100644 index 000000000000..187bfb107f8a --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessibletextcomponent.hxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTCOMPONENT_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTCOMPONENT_HXX + +#include <toolkit/awt/vclxaccessiblecomponent.hxx> +#include <comphelper/accessibletexthelper.hxx> + + +// ---------------------------------------------------- +// class VCLXAccessibleTextComponent +// ---------------------------------------------------- + +typedef ::cppu::ImplHelper1 < + ::com::sun::star::accessibility::XAccessibleText > VCLXAccessibleTextComponent_BASE; + +class VCLXAccessibleTextComponent : public VCLXAccessibleComponent, + public ::comphelper::OCommonAccessibleText, + public VCLXAccessibleTextComponent_BASE +{ +protected: + ::rtl::OUString m_sText; + + void SetText( const ::rtl::OUString& sText ); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + + // OCommonAccessibleText + virtual ::rtl::OUString implGetText(); + virtual ::com::sun::star::lang::Locale implGetLocale(); + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); + + // XComponent + virtual void SAL_CALL disposing(); + +public: + VCLXAccessibleTextComponent( VCLXWindow* pVCLXWindow ); + ~VCLXAccessibleTextComponent(); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); +}; + + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTCOMPONENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletextfield.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletextfield.hxx new file mode 100644 index 000000000000..b01c63fe8e4e --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessibletextfield.hxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTFIELD_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTFIELD_HXX + +#include <accessibility/standard/vclxaccessibletextcomponent.hxx> + +#include <cppuhelper/implbase1.hxx> + +typedef ::cppu::ImplHelper1< + ::com::sun::star::accessibility::XAccessible + > VCLXAccessible_BASE; + + +/** This class represents non editable text fields. The object passed to + the constructor is expected to be a list (a <type>ListBox</type> to be + more specific). From this allways the selected item is token to be made + accessible by this class. When the selected item changes then also the + exported text changes. +*/ +class VCLXAccessibleTextField : + public VCLXAccessibleTextComponent, + public VCLXAccessible_BASE +{ +public: + VCLXAccessibleTextField (VCLXWindow* pVCLXindow, + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& _xParent); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XAccessible + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL + getAccessibleContext (void) + throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + sal_Int32 SAL_CALL getAccessibleChildCount (void) + throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL + getAccessibleChild (sal_Int32 i) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + sal_Int16 SAL_CALL getAccessibleRole (void) + throw (::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getAccessibleParent( ) + throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName (void) + throw (::com::sun::star::uno::RuntimeException); + // Return text field specific services. + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames (void) + throw (::com::sun::star::uno::RuntimeException); + +protected: + virtual ~VCLXAccessibleTextField (void); + + /** With this method the text of the currently selected item is made + available to the <type>VCLXAccessibleTextComponent</type> base class. + */ + ::rtl::OUString implGetText (void); + +private: + /** We need to save the accessible parent to return it in <type>getAccessibleParent()</type>, + because this method of the base class returns the wrong parent. + */ + ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible > m_xParent; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx new file mode 100644 index 000000000000..846dfea93967 --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx @@ -0,0 +1,115 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX + +#include <map> +#include <toolkit/awt/vclxaccessiblecomponent.hxx> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> + +// ---------------------------------------------------- +// class VCLXAccessibleToolBox +// ---------------------------------------------------- + +typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleSelection > VCLXAccessibleToolBox_BASE; + +typedef std::map< sal_Int32, com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > ToolBoxItemsMap; + +class VCLXAccessibleToolBoxItem; +class ToolBox; + +class VCLXAccessibleToolBox : public VCLXAccessibleComponent, public VCLXAccessibleToolBox_BASE +{ +private: + ToolBoxItemsMap m_aAccessibleChildren; + + VCLXAccessibleToolBoxItem* GetItem_Impl( sal_Int32 _nPos, bool _bMustHaveFocus ); + + void UpdateFocus_Impl(); + void ReleaseFocus_Impl( sal_Int32 _nPos ); + void UpdateChecked_Impl( sal_Int32 _nPos ); + void UpdateIndeterminate_Impl( sal_Int32 _nPos ); + void UpdateItem_Impl( sal_Int32 _nPos, sal_Bool _bItemAdded ); + void UpdateAllItems_Impl(); + void UpdateItemName_Impl( sal_Int32 _nPos ); + void UpdateItemEnabled_Impl( sal_Int32 _nPos ); + void UpdateCustomPopupItemp_Impl( Window* pWindow, bool bOpen ); + void HandleSubToolBarEvent( const VclWindowEvent& rVclWindowEvent, bool _bShow ); + void ReleaseSubToolBox( ToolBox* _pSubToolBox ); + +protected: + virtual ~VCLXAccessibleToolBox(); + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& rVclWindowEvent ); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetItemWindowAccessible( const VclWindowEvent& rVclWindowEvent ); + + // XComponent + virtual void SAL_CALL disposing(); + +public: + VCLXAccessibleToolBox( VCLXWindow* pVCLXWindow ); + + // XInterface + DECLARE_XINTERFACE( ) + + // XTypeProvider + DECLARE_XTYPEPROVIDER( ) + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::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); + + // XAccessibleSelection + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::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); + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + +private: + void implReleaseToolboxItem( + ToolBoxItemsMap::iterator& _rMapPos, + bool _bNotifyRemoval, + bool _bDispose + ); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx new file mode 100644 index 000000000000..26070a4e91bb --- /dev/null +++ b/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx @@ -0,0 +1,168 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOXITEM_HXX +#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOXITEM_HXX + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleStateSet.hpp> +#include <com/sun/star/accessibility/XAccessibleText.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase4.hxx> +#include <comphelper/accessibletexthelper.hxx> +#include <tools/solar.h> + +// class VCLXAccessibleToolBoxItem --------------------------------------------- + +class ToolBox; + +typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE; +typedef ::cppu::ImplHelper4 < ::com::sun::star::accessibility::XAccessible, + ::com::sun::star::accessibility::XAccessibleAction, + ::com::sun::star::accessibility::XAccessibleValue, + ::com::sun::star::lang::XServiceInfo > VCLXAccessibleToolBoxItem_BASE; + +class VCLExternalSolarLock; + +class VCLXAccessibleToolBoxItem : public AccessibleTextHelper_BASE, + public VCLXAccessibleToolBoxItem_BASE +{ +private: + ::rtl::OUString m_sOldName; + ToolBox* m_pToolBox; + VCLExternalSolarLock* m_pExternalLock; + sal_Int32 m_nIndexInParent; + sal_Int16 m_nRole; + USHORT m_nItemId; + sal_Bool m_bHasFocus; + sal_Bool m_bIsChecked; + bool m_bIndeterminate; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xChild; + +public: + inline sal_Int32 getIndexInParent() const { return m_nIndexInParent; } + inline void setIndexInParent( sal_Int32 _nNewIndex ) { m_nIndexInParent = _nNewIndex; } + +protected: + virtual ~VCLXAccessibleToolBoxItem(); + + virtual void SAL_CALL disposing(); + + /// implements the calculation of the bounding rectangle + virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException); + + // OCommonAccessibleText + virtual ::rtl::OUString implGetText(); + virtual ::com::sun::star::lang::Locale implGetLocale(); + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ); + + ::rtl::OUString GetText( bool _bAsName ); + +public: + VCLXAccessibleToolBoxItem( ToolBox* _pToolBox, sal_Int32 _nPos ); + + void SetFocus( sal_Bool _bFocus ); + inline sal_Bool HasFocus() const { return m_bHasFocus; } + void SetChecked( sal_Bool _bCheck ); + inline sal_Bool IsChecked() const { return m_bIsChecked; } + void SetIndeterminate( bool _bIndeterminate ); + inline bool IsIndeterminate() const { return m_bIndeterminate; } + inline void ReleaseToolBox() { m_pToolBox = NULL; } + void NameChanged(); + void SetChild( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xChild ); + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + GetChild() const { return m_xChild; } + void NotifyChildEvent( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xChild, bool _bShow ); + + void ToggleEnableState(); + + // XInterface + DECLARE_XINTERFACE( ) + DECLARE_XTYPEPROVIDER( ) + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException); + + // 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::lang::IndexOutOfBoundsException, ::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::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) 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); + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XAccessibleComponent + 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 void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleExtendedComponent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getFontMetrics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& xFont ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException); + + // 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); + + // XAccessibleValue + virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException); +}; + +#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOXITEM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |