summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-08-31 19:17:39 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-02 09:37:08 +0200
commit7541fac2c0d5341f4d362779594ae236f05ff9a6 (patch)
tree73aefef941dd91b562b84689d50625858da2d15e /vcl/source
parent8ce0c756e64242431361059566d41495e3550d99 (diff)
tdf#136331 implement applying atk properties to tab pages
Change-Id: I2ee57dbdb3d743fe1dd3d505a3aa2f479ffa62b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101765 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/control/tabctrl.cxx34
-rw-r--r--vcl/source/window/builder.cxx26
2 files changed, 58 insertions, 2 deletions
diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx
index b5275f6cb539..c3c894cb451d 100644
--- a/vcl/source/control/tabctrl.cxx
+++ b/vcl/source/control/tabctrl.cxx
@@ -53,6 +53,8 @@ public:
OUString maText;
OUString maFormatText;
OUString maHelpText;
+ OUString maAccessibleName;
+ OUString maAccessibleDescription;
OString maTabName;
tools::Rectangle maRect;
sal_uInt16 mnLine;
@@ -1948,6 +1950,38 @@ const OUString& TabControl::GetHelpText( sal_uInt16 nPageId ) const
return pItem->maHelpText;
}
+void TabControl::SetAccessibleName(sal_uInt16 nPageId, const OUString& rName)
+{
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+ assert( pItem );
+ pItem->maAccessibleName = rName;
+}
+
+OUString TabControl::GetAccessibleName( sal_uInt16 nPageId ) const
+{
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+ assert( pItem );
+ if (!pItem->maAccessibleName.isEmpty())
+ return pItem->maAccessibleName;
+ return OutputDevice::GetNonMnemonicString(pItem->maText);
+}
+
+void TabControl::SetAccessibleDescription(sal_uInt16 nPageId, const OUString& rDesc)
+{
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+ assert( pItem );
+ pItem->maAccessibleDescription = rDesc;
+}
+
+OUString TabControl::GetAccessibleDescription( sal_uInt16 nPageId ) const
+{
+ ImplTabItem* pItem = ImplGetItem( nPageId );
+ assert( pItem );
+ if (!pItem->maAccessibleDescription.isEmpty())
+ return pItem->maAccessibleDescription;
+ return pItem->maHelpText;
+}
+
void TabControl::SetPageName( sal_uInt16 nPageId, const OString& rName ) const
{
ImplTabItem* pItem = ImplGetItem( nPageId );
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index d3f9febb7208..03f686f0a664 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -2599,10 +2599,14 @@ VclPtr<vcl::Window> VclBuilder::insertObject(vcl::Window *pParent, const OString
void VclBuilder::handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &reader)
{
+ TabControl *pTabControl = pParent && pParent->GetType() == WindowType::TABCONTROL ?
+ static_cast<TabControl*>(pParent) : nullptr;
+
std::vector<OString> sIDs;
int nLevel = 1;
stringmap aProperties;
+ stringmap aAtkProperties;
std::vector<vcl::EnumContext::Context> context;
while(true)
@@ -2643,6 +2647,12 @@ void VclBuilder::handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &read
}
else if (name == "property")
collectProperty(reader, aProperties);
+ else if (pTabControl && name == "child")
+ {
+ // just to collect the atk properties (if any) for the label
+ handleChild(nullptr, &aAtkProperties, reader);
+ --nLevel;
+ }
}
if (res == xmlreader::XmlReader::Result::End)
@@ -2658,8 +2668,6 @@ void VclBuilder::handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &read
if (!pParent)
return;
- TabControl *pTabControl = pParent->GetType() == WindowType::TABCONTROL ?
- static_cast<TabControl*>(pParent) : nullptr;
VerticalTabControl *pVerticalTabControl = pParent->GetType() == WindowType::VERTICALTABCONTROL ?
static_cast<VerticalTabControl*>(pParent) : nullptr;
assert(pTabControl || pVerticalTabControl);
@@ -2676,6 +2684,20 @@ void VclBuilder::handleTabChild(vcl::Window *pParent, xmlreader::XmlReader &read
TabPage* pPage = pTabControl->GetTabPage(nPageId);
pPage->SetContext(context);
}
+
+ for (auto const& prop : aAtkProperties)
+ {
+ const OString &rKey = prop.first;
+ const OUString &rValue = prop.second;
+
+ if (rKey == "AtkObject::accessible-name")
+ pTabControl->SetAccessibleName(nPageId, rValue);
+ else if (rKey == "AtkObject::accessible-description")
+ pTabControl->SetAccessibleDescription(nPageId, rValue);
+ else
+ SAL_INFO("vcl.builder", "unhandled atk property: " << rKey);
+ }
+
}
else
{