sw a11y: No longer report underline for misspelling

No longer report a red wavy underline for misspelled
words in Writer.

The underline isn't really a character/text attribute, since
it's not part of the actual formatting of the text, but is
just shown visually.

Each platform a11y API has a better way to explicitly
report misspelling.

    commit ec2e02cfa4
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Tue Oct 17 14:36:58 2023 +0200

        tdf#157696 a11y: Report spelling error via IA2 "invalid:spelling" attr

and

    commit 2bf88c172c
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Wed Oct 18 13:44:42 2023 +0200

        tdf#157696 wina11y: Switch from custom to IA2 text attributes

added the implementation for Windows and
the Qt-based VCL plugins on Linux.

On macOS (`NSAccessibilityMarkedMisspelledTextAttribute`/
`NSAccessibilityMisspelledTextAttribute`) and for gtk3/ATK,
the corresponding attributes were already used before.

Therefore, reporting an underline as a workaround is no
longer needed.

Orca on Linux, NVDA on Windows (with [1] in place)
and CrossOver on macOS all make use of the specific
character attribute to announce spelling errors, not
the underline. If any assistive technology should stop
reporting spelling errors due to this change, it should
be fixed to handle the proper text attribute as well.

After switching to text attributes according to the
IAccessible2 specification on Windows (i.e. with,
the above-mentioned commits and the NVDA commit
to switch to IAccessible2 text attributes for LO [1]),
NVDA was starting to announce not only that a word is
misspelled, but an underline in addition, which is
no more the case now that the underlining is no more
reported.

[1] de4e8814f3

Change-Id: Ifa29e0080a4a039c5a119dd0debe5e924fa546ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158847
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2023-10-20 16:04:51 +02:00
parent e6d34f00a5
commit a2e0b39b62

View File

@@ -1905,7 +1905,6 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex,
pos = pFrame->MapViewToModel(nCorePos + TextFrameIndex(1)); // try this one instead
assert(pos.first->Len() != pos.second);
}
const SwTextNode *const pTextNode(pos.first);
sal_Int32 nValues = rValues.size();
for (sal_Int32 i = 0; i < nValues; ++i)
@@ -1962,47 +1961,9 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex,
continue;
}
// UnderLine
if (rValue.Name == UNO_NAME_CHAR_UNDERLINE)
{
//misspelled word
SwCursorShell* pCursorShell = GetCursorShell();
if( pCursorShell != nullptr && pCursorShell->GetViewOptions() && pCursorShell->GetViewOptions()->IsOnlineSpell())
{
const SwWrongList* pWrongList = pTextNode->GetWrong();
if( nullptr != pWrongList )
{
sal_Int32 nBegin = pos.second;
sal_Int32 nLen = 1;
if (pWrongList->InWrongWord(nBegin, nLen) && !pTextNode->IsSymbolAt(nBegin))
{
rValue.Value <<= sal_uInt16(LINESTYLE_WAVE);
}
}
}
continue;
}
// UnderLineColor
if (rValue.Name == UNO_NAME_CHAR_UNDERLINE_COLOR)
{
//misspelled word
SwCursorShell* pCursorShell = GetCursorShell();
if( pCursorShell != nullptr && pCursorShell->GetViewOptions() && pCursorShell->GetViewOptions()->IsOnlineSpell())
{
const SwWrongList* pWrongList = pTextNode->GetWrong();
if( nullptr != pWrongList )
{
sal_Int32 nBegin = pos.second;
sal_Int32 nLen = 1;
if (pWrongList->InWrongWord(nBegin, nLen) && !pTextNode->IsSymbolAt(nBegin))
{
rValue.Value <<= sal_Int32(0x00ff0000);
continue;
}
}
}
uno::Any &anyChar = rValue.Value;
sal_uInt32 crUnderline = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved));
if ( COL_AUTO == Color(ColorTransparency, crUnderline) )