summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2013-05-31 09:03:08 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-05-31 16:13:16 +0100
commit3e0fa22de3b761686fb5b5bf4e44a91172c45f3b (patch)
tree1b4747bfb2eae8a15d6d9a17967d4e496490cc3a /sfx2
parent681449afee3f21b0df608109649e35ccdc770abd (diff)
Resolves: #i122271# FOCUSABLE flag at accessibility object sidebar title bars
so that bridges create focus events and title bars become visible to AT devices. (cherry picked from commit 6055c2b50b36a0fc1b26c18b030827e3e08a51fc) Conflicts: sfx2/source/sidebar/TitleBar.cxx Change-Id: If863c2c9d5ba19ba627639b294a430869f245abd (cherry picked from commit 8502b8006fdf03d2bc634f53490200f853474867)
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/Library_sfx.mk2
-rw-r--r--sfx2/source/sidebar/Accessible.cxx63
-rw-r--r--sfx2/source/sidebar/Accessible.hxx70
-rw-r--r--sfx2/source/sidebar/AccessibleTitleBar.cxx67
-rw-r--r--sfx2/source/sidebar/AccessibleTitleBar.hxx49
-rw-r--r--sfx2/source/sidebar/DeckTitleBar.cxx11
-rw-r--r--sfx2/source/sidebar/DeckTitleBar.hxx1
-rw-r--r--sfx2/source/sidebar/PanelTitleBar.cxx21
-rw-r--r--sfx2/source/sidebar/PanelTitleBar.hxx2
-rw-r--r--sfx2/source/sidebar/TitleBar.cxx32
-rw-r--r--sfx2/source/sidebar/TitleBar.hxx5
11 files changed, 301 insertions, 22 deletions
diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 03775fda52a8..aefe3a2d116d 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -233,6 +233,8 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
sfx2/source/sidebar/SidebarController \
sfx2/source/sidebar/SidebarPanelBase \
sfx2/source/sidebar/SidebarToolBox \
+ sfx2/source/sidebar/Accessible \
+ sfx2/source/sidebar/AccessibleTitleBar \
sfx2/source/sidebar/AsynchronousCall \
sfx2/source/sidebar/CommandInfoProvider \
sfx2/source/sidebar/Context \
diff --git a/sfx2/source/sidebar/Accessible.cxx b/sfx2/source/sidebar/Accessible.cxx
new file mode 100644
index 000000000000..13d52aa67275
--- /dev/null
+++ b/sfx2/source/sidebar/Accessible.cxx
@@ -0,0 +1,63 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "Accessible.hxx"
+
+
+using namespace css;
+using namespace cssu;
+
+
+namespace sfx2 { namespace sidebar {
+
+
+Accessible::Accessible (
+ const Reference<accessibility::XAccessibleContext>& rxContext)
+ : AccessibleInterfaceBase(m_aMutex),
+ mxContext(rxContext)
+{
+}
+
+
+
+
+Accessible::~Accessible (void)
+{
+}
+
+
+
+
+void SAL_CALL Accessible::disposing (void)
+{
+ Reference<XComponent> xComponent (mxContext, UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+}
+
+
+
+
+Reference<accessibility::XAccessibleContext> SAL_CALL Accessible::getAccessibleContext (void)
+ throw (cssu::RuntimeException)
+{
+ return mxContext;
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/Accessible.hxx b/sfx2/source/sidebar/Accessible.hxx
new file mode 100644
index 000000000000..d6b8584b9bb3
--- /dev/null
+++ b/sfx2/source/sidebar/Accessible.hxx
@@ -0,0 +1,70 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef SFX_SIDEBAR_ACCESSIBLE_HXX
+#define SFX_SIDEBAR_ACCESSIBLE_HXX
+
+#include <boost/noncopyable.hpp>
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace
+{
+ typedef ::cppu::WeakComponentImplHelper1 <
+ css::accessibility::XAccessible
+ > AccessibleInterfaceBase;
+}
+
+namespace sfx2 { namespace sidebar {
+
+
+/** Simple implementation of the XAccessible interface.
+ Its getAccessibleContext() method returns a context object given
+ to its constructor.
+*/
+class Accessible
+ : private ::boost::noncopyable,
+ private ::cppu::BaseMutex,
+ public AccessibleInterfaceBase
+{
+public:
+ Accessible (
+ const cssu::Reference<css::accessibility::XAccessibleContext>& rxContext);
+ virtual ~Accessible (void);
+
+ virtual void SAL_CALL disposing (void);
+
+
+ // XAccessible
+ virtual cssu::Reference<css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext (void)
+ throw (cssu::RuntimeException);
+
+private:
+ cssu::Reference<css::accessibility::XAccessibleContext> mxContext;
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/sfx2/source/sidebar/AccessibleTitleBar.cxx b/sfx2/source/sidebar/AccessibleTitleBar.cxx
new file mode 100644
index 000000000000..47600f08d5f8
--- /dev/null
+++ b/sfx2/source/sidebar/AccessibleTitleBar.cxx
@@ -0,0 +1,67 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "AccessibleTitleBar.hxx"
+#include "Accessible.hxx"
+#include "TitleBar.hxx"
+
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+
+using namespace css;
+using namespace cssu;
+
+namespace sfx2 { namespace sidebar {
+
+
+Reference<accessibility::XAccessible> AccessibleTitleBar::Create (TitleBar& rTitleBar)
+{
+ rTitleBar.GetComponentInterface(sal_True);
+ VCLXWindow* pWindow = rTitleBar.GetWindowPeer();
+ if (pWindow != NULL)
+ return new Accessible(new AccessibleTitleBar(pWindow));
+ else
+ return NULL;
+}
+
+
+
+
+AccessibleTitleBar::AccessibleTitleBar (VCLXWindow* pWindow)
+ : VCLXAccessibleComponent(pWindow)
+{
+}
+
+
+
+
+AccessibleTitleBar::~AccessibleTitleBar (void)
+{
+}
+
+
+
+
+void AccessibleTitleBar::FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet)
+{
+ VCLXAccessibleComponent::FillAccessibleStateSet(rStateSet);
+ rStateSet.AddState(accessibility::AccessibleStateType::FOCUSABLE);
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/AccessibleTitleBar.hxx b/sfx2/source/sidebar/AccessibleTitleBar.hxx
new file mode 100644
index 000000000000..ffbe8ac9a5ac
--- /dev/null
+++ b/sfx2/source/sidebar/AccessibleTitleBar.hxx
@@ -0,0 +1,49 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef SFX_SIDEBAR_ACCESSIBLE_TITLE_BAR_HXX
+#define SFX_SIDEBAR_ACCESSIBLE_TITLE_BAR_HXX
+
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace sfx2 { namespace sidebar {
+
+class TitleBar;
+
+class AccessibleTitleBar
+ : public VCLXAccessibleComponent
+{
+public:
+ static cssu::Reference<css::accessibility::XAccessible> Create (TitleBar& rTitleBar);
+
+protected:
+ virtual void FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet);
+
+private:
+ AccessibleTitleBar (VCLXWindow* pWindow);
+ virtual ~AccessibleTitleBar (void);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/sfx2/source/sidebar/DeckTitleBar.cxx b/sfx2/source/sidebar/DeckTitleBar.cxx
index ed7fd178fa81..7855347b3854 100644
--- a/sfx2/source/sidebar/DeckTitleBar.cxx
+++ b/sfx2/source/sidebar/DeckTitleBar.cxx
@@ -134,6 +134,17 @@ void DeckTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
+cssu::Reference<css::accessibility::XAccessible> DeckTitleBar::CreateAccessible (void)
+{
+ const ::rtl::OUString sAccessibleName(msTitle);
+ SetAccessibleName(sAccessibleName);
+ SetAccessibleDescription(sAccessibleName);
+ return TitleBar::CreateAccessible();
+}
+
+
+
+
void DeckTitleBar::DataChanged (const DataChangedEvent& rEvent)
{
maToolBox.SetItemImage(
diff --git a/sfx2/source/sidebar/DeckTitleBar.hxx b/sfx2/source/sidebar/DeckTitleBar.hxx
index aab05648fe93..bc31d9863ccd 100644
--- a/sfx2/source/sidebar/DeckTitleBar.hxx
+++ b/sfx2/source/sidebar/DeckTitleBar.hxx
@@ -45,6 +45,7 @@ protected:
virtual sidebar::Paint GetBackgroundPaint (void);
virtual Color GetTextColor (void);
virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex);
+ virtual cssu::Reference<css::accessibility::XAccessible> CreateAccessible (void);
private:
const sal_uInt16 mnCloserItemIndex;
diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx
index 738593a96f0d..dd1b681f847a 100644
--- a/sfx2/source/sidebar/PanelTitleBar.cxx
+++ b/sfx2/source/sidebar/PanelTitleBar.cxx
@@ -30,7 +30,6 @@
#include <vcl/image.hxx>
#include <toolkit/helper/vclunohelper.hxx>
-
using namespace css;
using namespace cssu;
@@ -50,16 +49,11 @@ PanelTitleBar::PanelTitleBar (
mpPanel(pPanel),
mnMenuItemIndex(1),
mxFrame(),
- msMoreOptionsCommand()
+ msMoreOptionsCommand(),
+ msAccessibleNamePrefix(String(SfxResId(SFX_STR_SIDEBAR_ACCESSIBILITY_PANEL_PREFIX)))
{
OSL_ASSERT(mpPanel != NULL);
- const ::rtl::OUString sAccessibleName(
- String(SfxResId(SFX_STR_SIDEBAR_ACCESSIBILITY_PANEL_PREFIX))
- + rsTitle);
- SetAccessibleName(sAccessibleName);
- SetAccessibleDescription(sAccessibleName);
-
#ifdef DEBUG
SetText(A2S("PanelTitleBar"));
#endif
@@ -190,6 +184,17 @@ void PanelTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
+Reference<accessibility::XAccessible> PanelTitleBar::CreateAccessible (void)
+{
+ const ::rtl::OUString sAccessibleName(msAccessibleNamePrefix + msTitle);
+ SetAccessibleName(sAccessibleName);
+ SetAccessibleDescription(sAccessibleName);
+ return TitleBar::CreateAccessible();
+}
+
+
+
+
void PanelTitleBar::MouseButtonDown (const MouseEvent& rMouseEvent)
{
if (rMouseEvent.IsLeft())
diff --git a/sfx2/source/sidebar/PanelTitleBar.hxx b/sfx2/source/sidebar/PanelTitleBar.hxx
index f47f86e8c539..6044e2727615 100644
--- a/sfx2/source/sidebar/PanelTitleBar.hxx
+++ b/sfx2/source/sidebar/PanelTitleBar.hxx
@@ -52,6 +52,7 @@ protected:
virtual sidebar::Paint GetBackgroundPaint (void);
virtual Color GetTextColor (void);
virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex);
+ virtual cssu::Reference<css::accessibility::XAccessible> CreateAccessible (void);
private:
bool mbIsLeftButtonDown;
@@ -59,6 +60,7 @@ private:
const sal_uInt16 mnMenuItemIndex;
cssu::Reference<css::frame::XFrame> mxFrame;
::rtl::OUString msMoreOptionsCommand;
+ ::rtl::OUString msAccessibleNamePrefix;
};
diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx
index bab96310ba84..e45a6fb9731c 100644
--- a/sfx2/source/sidebar/TitleBar.cxx
+++ b/sfx2/source/sidebar/TitleBar.cxx
@@ -18,11 +18,16 @@
#include "TitleBar.hxx"
#include "Paint.hxx"
+#include "Accessible.hxx"
+#include "AccessibleTitleBar.hxx"
#include <tools/svborder.hxx>
#include <vcl/gradient.hxx>
#include <vcl/lineinfo.hxx>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+
namespace
{
const static sal_Int32 gnLeftIconSpace (3);
@@ -89,8 +94,7 @@ void TitleBar::Paint (const Rectangle& rUpdateArea)
PaintDecoration(aTitleBarBox);
const Rectangle aTitleBox (GetTitleArea(aTitleBarBox));
PaintTitle(aTitleBox);
- if (HasFocus())
- PaintFocus(aTitleBox);
+ PaintFocus(aTitleBox);
}
@@ -149,6 +153,15 @@ void TitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
+cssu::Reference<css::accessibility::XAccessible> TitleBar::CreateAccessible (void)
+{
+ SetAccessibleRole(css::accessibility::AccessibleRole::PANEL);
+ return AccessibleTitleBar::Create(*this);
+}
+
+
+
+
void TitleBar::PaintTitle (const Rectangle& rTitleBox)
{
Push(PUSH_FONT | PUSH_TEXTCOLOR);
@@ -186,7 +199,7 @@ void TitleBar::PaintTitle (const Rectangle& rTitleBox)
void TitleBar::PaintFocus (const Rectangle& rFocusBox)
{
- Push(PUSH_FONT | PUSH_TEXTCOLOR | PUSH_LINECOLOR | PUSH_FILLCOLOR);
+ Push(PUSH_FONT | PUSH_TEXTCOLOR);
Font aFont(GetFont());
aFont.SetWeight(WEIGHT_BOLD);
@@ -203,15 +216,10 @@ void TitleBar::PaintFocus (const Rectangle& rFocusBox)
aTextBox.Right() + 2,
aTextBox.Bottom() + 2);
- LineInfo aDottedStyle (LINE_DASH);
- aDottedStyle.SetDashCount(0);
- aDottedStyle.SetDotCount(1);
- aDottedStyle.SetDotLen(1);
- aDottedStyle.SetDistance(1);
-
- SetFillColor();
- SetLineColor(COL_BLACK);
- DrawPolyLine(Polygon(aLargerTextBox), aDottedStyle);
+ if (HasFocus())
+ Window::ShowFocus(aLargerTextBox);
+ else
+ Window::HideFocus();
Pop();
}
diff --git a/sfx2/source/sidebar/TitleBar.hxx b/sfx2/source/sidebar/TitleBar.hxx
index 229d3b7edcc1..36c31a6f4676 100644
--- a/sfx2/source/sidebar/TitleBar.hxx
+++ b/sfx2/source/sidebar/TitleBar.hxx
@@ -20,7 +20,7 @@
#include "Paint.hxx"
-#include <vcl/window.hxx>
+#include <vcl/fixed.hxx>
#include "sfx2/sidebar/SidebarToolBox.hxx"
@@ -53,6 +53,7 @@ public:
protected:
SidebarToolBox maToolBox;
+ ::rtl::OUString msTitle;
virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) = 0;
virtual void PaintDecoration (const Rectangle& rTitleBarBox) = 0;
@@ -60,9 +61,9 @@ protected:
virtual sidebar::Paint GetBackgroundPaint (void) = 0;
virtual Color GetTextColor (void) = 0;
virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex);
+ virtual cssu::Reference<css::accessibility::XAccessible> CreateAccessible (void);
private:
- ::rtl::OUString msTitle;
Image maIcon;
void PaintTitle (const Rectangle& rTitleBox);