summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accessibility/source/standard/vclxaccessibletabpage.cxx18
-rw-r--r--include/vcl/tabctrl.hxx6
-rw-r--r--vcl/source/control/tabctrl.cxx34
-rw-r--r--vcl/source/window/builder.cxx26
4 files changed, 73 insertions, 11 deletions
diff --git a/accessibility/source/standard/vclxaccessibletabpage.cxx b/accessibility/source/standard/vclxaccessibletabpage.cxx
index fb0936f2f360..ab981634a7db 100644
--- a/accessibility/source/standard/vclxaccessibletabpage.cxx
+++ b/accessibility/source/standard/vclxaccessibletabpage.cxx
@@ -339,34 +339,34 @@ sal_Int32 VCLXAccessibleTabPage::getAccessibleIndexInParent( )
return nIndexInParent;
}
-
-sal_Int16 VCLXAccessibleTabPage::getAccessibleRole( )
+sal_Int16 VCLXAccessibleTabPage::getAccessibleRole()
{
OExternalLockGuard aGuard( this );
return AccessibleRole::PAGE_TAB;
}
-
-OUString VCLXAccessibleTabPage::getAccessibleDescription( )
+OUString VCLXAccessibleTabPage::getAccessibleDescription()
{
OExternalLockGuard aGuard( this );
OUString sDescription;
if ( m_pTabControl )
- sDescription = m_pTabControl->GetHelpText( m_nPageId );
+ sDescription = m_pTabControl->GetAccessibleDescription( m_nPageId );
return sDescription;
}
-
-OUString VCLXAccessibleTabPage::getAccessibleName( )
+OUString VCLXAccessibleTabPage::getAccessibleName()
{
OExternalLockGuard aGuard( this );
- return GetPageText();
-}
+ OUString sName;
+ if ( m_pTabControl )
+ sName = m_pTabControl->GetAccessibleName( m_nPageId );
+ return sName;
+}
Reference< XAccessibleRelationSet > VCLXAccessibleTabPage::getAccessibleRelationSet( )
{
diff --git a/include/vcl/tabctrl.hxx b/include/vcl/tabctrl.hxx
index 4fe386da3d15..edfa86cf37f0 100644
--- a/include/vcl/tabctrl.hxx
+++ b/include/vcl/tabctrl.hxx
@@ -152,6 +152,12 @@ public:
void SetPageName( sal_uInt16 nPageId, const OString& rName ) const;
OString GetPageName( sal_uInt16 nPageId ) const;
+ void SetAccessibleName( sal_uInt16 nItemId, const OUString& rStr );
+ OUString GetAccessibleName( sal_uInt16 nItemId ) const;
+
+ void SetAccessibleDescription( sal_uInt16 nItemId, const OUString& rStr );
+ OUString GetAccessibleDescription( sal_uInt16 nItemId ) const;
+
void SetPageImage( sal_uInt16 nPageId, const Image& rImage );
using Control::SetHelpId;
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
{