diff options
author | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-03-30 16:00:37 +0200 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@sun.com> | 2010-03-30 16:00:37 +0200 |
commit | 2f81fe520e4f778fd03fe7503f44565e500ad88a (patch) | |
tree | 67b31b9199f2ceac51726cc90a77b40092b60132 /sd/source/ui/toolpanel | |
parent | 21cdc409181bc82a5aec83a1f09f62984b12537f (diff) |
slidecopy: more A11Y implementations for the ToolPanelDeck
Diffstat (limited to 'sd/source/ui/toolpanel')
-rw-r--r-- | sd/source/ui/toolpanel/CustomToolPanel.cxx | 35 | ||||
-rw-r--r-- | sd/source/ui/toolpanel/CustomToolPanel.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/toolpanel/StandardToolPanel.cxx | 18 | ||||
-rw-r--r-- | sd/source/ui/toolpanel/StandardToolPanel.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/toolpanel/TaskPaneToolPanel.hxx | 4 | ||||
-rwxr-xr-x | sd/source/ui/toolpanel/ToolPanelDrawer.cxx | 1 |
6 files changed, 66 insertions, 0 deletions
diff --git a/sd/source/ui/toolpanel/CustomToolPanel.cxx b/sd/source/ui/toolpanel/CustomToolPanel.cxx index b09b03725c58..12ffe484a22f 100644 --- a/sd/source/ui/toolpanel/CustomToolPanel.cxx +++ b/sd/source/ui/toolpanel/CustomToolPanel.cxx @@ -32,6 +32,7 @@ /** === begin UNO includes === **/ #include <com/sun/star/drawing/framework/ResourceId.hpp> #include <com/sun/star/awt/PosSize.hpp> +#include <com/sun/star/drawing/framework/XPane2.hpp> /** === end UNO includes === **/ #include <comphelper/processfactory.hxx> @@ -64,6 +65,8 @@ namespace sd { namespace toolpanel using ::com::sun::star::drawing::framework::ResourceId; using ::com::sun::star::drawing::framework::XResource; using ::com::sun::star::awt::XWindow; + using ::com::sun::star::accessibility::XAccessible; + using ::com::sun::star::drawing::framework::XPane2; /** === end UNO using === **/ namespace PosSize = ::com::sun::star::awt::PosSize; @@ -208,6 +211,38 @@ namespace sd { namespace toolpanel } //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > CustomToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) + { + ENSURE_OR_RETURN( !isDisposed(), "CustomToolPanel::CreatePanelAccessible: already disposed!", NULL ); + + // an XResource might also be an XPane2, which can provide an XAccessible. Check this first. + const Reference< XPane2 > xPane( m_xResource, UNO_QUERY ); + if ( xPane.is() ) + { + const Reference< XAccessible > xPaneAccessible( xPane->getAccessible() ); + if ( xPaneAccessible.is() ) + return xPaneAccessible; + } + + // if we have an XToolPanel, ask it for its XWindow, and query it + impl_ensurePanel(); + if ( !m_xToolPanel.is() ) + return NULL; + + const Reference< XAccessible > xPanelWindowAccessible( m_xToolPanel->getWindow(), UNO_QUERY ); + if ( xPanelWindowAccessible.is() ) + return xPanelWindowAccessible; + + // maybe the XToolPanel itself can provide an XAccessible? + const Reference< XAccessible > xPanelAccessible( m_xToolPanel, UNO_QUERY ); + if ( xPanelAccessible.is() ) + return xPanelAccessible; + + OSL_ENSURE( false, "CustomToolPanel::CreatePanelAccessible: no XAccessible for the custom panel!" ); + return NULL; + } + + //------------------------------------------------------------------------------------------------------------------ void CustomToolPanel::LockResourceAccess() { ++m_nResourceAccessLock; diff --git a/sd/source/ui/toolpanel/CustomToolPanel.hxx b/sd/source/ui/toolpanel/CustomToolPanel.hxx index fe5865150063..ee10c6748bbd 100644 --- a/sd/source/ui/toolpanel/CustomToolPanel.hxx +++ b/sd/source/ui/toolpanel/CustomToolPanel.hxx @@ -78,6 +78,10 @@ namespace sd { namespace toolpanel virtual void SetSizePixel( const Size& i_rPanelWindowSize ); virtual void GrabFocus(); virtual void Dispose(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreatePanelAccessible( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible + ); /** locks (aka prevents) the access to the associated XResource object */ diff --git a/sd/source/ui/toolpanel/StandardToolPanel.cxx b/sd/source/ui/toolpanel/StandardToolPanel.cxx index 9d5eaa46c101..ede20ea3404c 100644 --- a/sd/source/ui/toolpanel/StandardToolPanel.cxx +++ b/sd/source/ui/toolpanel/StandardToolPanel.cxx @@ -53,6 +53,7 @@ namespace sd { namespace toolpanel using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Type; using ::com::sun::star::drawing::framework::XResourceId; + using ::com::sun::star::accessibility::XAccessible; /** === end UNO using === **/ //================================================================================================================== @@ -116,6 +117,23 @@ namespace sd { namespace toolpanel } //------------------------------------------------------------------------------------------------------------------ + Reference< XAccessible > StandardToolPanel::CreatePanelAccessible( const Reference< XAccessible >& i_rParentAccessible ) + { + ENSURE_OR_RETURN( !isDisposed(), "already disposed!", NULL ); + + Window* pControlWindow( m_pControl->GetWindow() ); + + Reference< XAccessible > xControlAccessible( pControlWindow->GetAccessible( FALSE ) ); + if ( !xControlAccessible.is() ) + { + xControlAccessible = m_pControl->CreateAccessibleObject( i_rParentAccessible ); + OSL_ENSURE( xControlAccessible.is(), "StandardToolPanel::CreatePanelAccessible: invalid XAccessible returned by CreateAccessibleObject!" ); + pControlWindow->SetAccessible( xControlAccessible ); + } + return xControlAccessible; + } + + //------------------------------------------------------------------------------------------------------------------ const Reference< XResourceId >& StandardToolPanel::getResourceId() const { return m_xPanelResourceId; diff --git a/sd/source/ui/toolpanel/StandardToolPanel.hxx b/sd/source/ui/toolpanel/StandardToolPanel.hxx index 1f3fd8ff7a90..a40c3d4af5f2 100644 --- a/sd/source/ui/toolpanel/StandardToolPanel.hxx +++ b/sd/source/ui/toolpanel/StandardToolPanel.hxx @@ -58,6 +58,10 @@ namespace sd { namespace toolpanel virtual void SetSizePixel( const Size& i_rPanelWindowSize ); virtual void GrabFocus(); virtual void Dispose(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreatePanelAccessible( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible + ); // TaskPaneToolPanel overridables virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const; diff --git a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx index f62e0b7a8fb1..d92b1c14bf27 100644 --- a/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx +++ b/sd/source/ui/toolpanel/TaskPaneToolPanel.hxx @@ -71,6 +71,10 @@ namespace sd { namespace toolpanel virtual void Deactivate() = 0; virtual void SetSizePixel( const Size& i_rPanelWindowSize ) = 0; virtual void GrabFocus() = 0; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + CreatePanelAccessible( + const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible + ) = 0; // own overridables virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::framework::XResourceId >& getResourceId() const = 0; diff --git a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx index 065f1b3a5011..aa3af47535f4 100755 --- a/sd/source/ui/toolpanel/ToolPanelDrawer.cxx +++ b/sd/source/ui/toolpanel/ToolPanelDrawer.cxx @@ -161,6 +161,7 @@ namespace sd { namespace toolpanel if ( !xItemAccessible.is() ) { xItemAccessible = pTitleBar->CreateAccessibleObject( i_rParentAccessible ); + OSL_ENSURE( xItemAccessible.is(), "ToolPanelDrawer::GetPanelItemAccessible: invalid XAccessible returned by CreateAccessibleObject!" ); pItemWindow->SetAccessible( xItemAccessible ); } |