sd presenter a11y: Decouple displayed pane title from a11y name

So far, the title displayed for a pane in the Impress Presenter
Console was always the same as the accessible name.

For the "Current slide" pane in the presenter console, the
title was different depending on whether or not accessibility
was enabled, as different templates were used, see the
"Title" and "AccessibleTitle" entries in
officecfg/registry/data/org/openoffice/Office/PresenterScreen.xcu:

With a11 disabled,
"Current Slide (%CURRENT_SLIDE_NUMBER% of %SLIDE_COUNT%)"
was used, with a11y enabled,
"Current Slide, %CURRENT_SLIDE_NAME%, %CURRENT_SLIDE_NUMBER% of %SLIDE_COUNT%"
was used, i.e. if a11y is enabled, the slide title is displayed in
addition.

No more make what's displayed on screen dependent on that,
but use the "accessible title" for the accessible name instead,
so it still e.g. gets announced by the Orca screen reader when
switching between slides.

Introduce PaneDescriptor::msAccessibleName to hold the
accessible name.

Adjust PresenterController::UpdatePaneTitles
to always process both properties.

Rename PaneDescriptor::msAccessibleTitleTemplate to
PaneDescriptor::msAccessibleNameTemplate for consistency.

Drop call to PresenterController::UpdatePaneTitles from
PresenterController::SetAccessibilityActiveState as that
should be unnecessary, now that
PresenterController::UpdatePaneTitles behavior no longer
depends on whether or not accessibility is considered
enabled or not.

Also adjust the template used for the accessible name to
first announce the text that is displayed on screen
(e.g. "Current Slide (2 of 4)"), then the slide name, and
add brackets + remove comma to align it more with the
displayed title.

Whether it generally makes sense to use string templates
read from the config for such a purpose may be a valid question,
but leave that general approach unchanged at least for now.

Change-Id: I52b2d014086e1532b0fb958e15ad915234e4718a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185324
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2025-05-15 06:50:54 +02:00
parent fbe9b2b6b0
commit bfedefe516
5 changed files with 12 additions and 15 deletions
@@ -1882,7 +1882,7 @@
<value xml:lang="en-US">Current Slide (%CURRENT_SLIDE_NUMBER% of %SLIDE_COUNT%)</value>
</prop>
<prop oor:name="AccessibleTitle">
<value xml:lang="en-US">Current Slide, %CURRENT_SLIDE_NAME%, %CURRENT_SLIDE_NUMBER% of %SLIDE_COUNT%</value>
<value xml:lang="en-US">Current Slide (%CURRENT_SLIDE_NUMBER% of %SLIDE_COUNT%), %CURRENT_SLIDE_NAME%</value>
</prop>
<prop oor:name="IsOpaque">
<value>true</value>
+2 -2
View File
@@ -163,7 +163,7 @@ void PresenterAccessible::UpdateAccessibilityHierarchy()
UpdateAccessibilityHierarchy(
pPreviewPane ? pPreviewPane->mxContentWindow : Reference<awt::XWindow>(),
pPreviewPane ? pPreviewPane->mxBorderWindow : Reference<awt::XWindow>(),
pPreviewPane ? pPreviewPane->msTitle : OUString(),
pPreviewPane ? pPreviewPane->msAccessibleName : OUString(),
pNotesPane ? pNotesPane->mxContentWindow : Reference<awt::XWindow>(),
pNotesPane ? pNotesPane->mxBorderWindow : Reference<awt::XWindow>(),
pNotesView.is()
@@ -233,7 +233,7 @@ void PresenterAccessible::NotifyCurrentSlideChange ()
{
PresenterPaneContainer::SharedPaneDescriptor pPreviewPane (GetPreviewPane());
mpAccessiblePreview->SetAccessibleName(
pPreviewPane ? pPreviewPane->msTitle : OUString());
pPreviewPane ? pPreviewPane->msAccessibleName : OUString());
}
// Play some focus ping-pong to trigger AT tools.
+6 -10
View File
@@ -360,13 +360,13 @@ void PresenterController::UpdatePaneTitles()
{
OSL_ASSERT(rxPane != nullptr);
OUString sTemplate (IsAccessibilityActive()
? rxPane->msAccessibleTitleTemplate
: rxPane->msTitleTemplate);
if (sTemplate.isEmpty())
rxPane->msAccessibleName = lcl_replacePlaceholders(rxPane->msAccessibleNameTemplate, sCurrentSlideNumber,
sCurrentSlideName, sSlideCount);
if (rxPane->msTitleTemplate.isEmpty())
continue;
rxPane->msTitle = lcl_replacePlaceholders(sTemplate, sCurrentSlideNumber, sCurrentSlideName,
rxPane->msTitle = lcl_replacePlaceholders(rxPane->msTitleTemplate, sCurrentSlideNumber, sCurrentSlideName,
sSlideCount);
if (rxPane->mxPane.is())
rxPane->mxPane->SetTitle(rxPane->msTitle);
@@ -595,11 +595,7 @@ bool PresenterController::HasCustomAnimation (Reference<drawing::XDrawPage> cons
void PresenterController::SetAccessibilityActiveState (const bool bIsActive)
{
if ( mbIsAccessibilityActive != bIsActive)
{
mbIsAccessibilityActive = bIsActive;
UpdatePaneTitles();
}
mbIsAccessibilityActive = bIsActive;
}
+1 -1
View File
@@ -65,7 +65,7 @@ void PresenterPaneContainer::PreparePane (
pDescriptor->msTitleTemplate = rsTitle;
pDescriptor->msTitle.clear();
}
pDescriptor->msAccessibleTitleTemplate = rsAccessibleTitle;
pDescriptor->msAccessibleNameTemplate = rsAccessibleTitle;
pDescriptor->maViewInitialization = rViewInitialization;
pDescriptor->mbIsActive = true;
pDescriptor->mbIsOpaque = bIsOpaque;
+2 -1
View File
@@ -77,8 +77,9 @@ public:
css::uno::Reference<css::awt::XWindow> mxContentWindow;
css::uno::Reference<css::awt::XWindow> mxBorderWindow;
OUString msTitleTemplate;
OUString msAccessibleTitleTemplate;
OUString msAccessibleNameTemplate;
OUString msTitle;
OUString msAccessibleName;
ViewInitializationFunction maViewInitialization;
bool mbIsActive;
bool mbIsOpaque;