diff options
author | Balazs Varga <balazs.varga.extern@allotropia.de> | 2023-07-31 15:11:44 +0200 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2023-08-02 01:15:51 +0200 |
commit | 47ca3f1f762352b488d58b3bf23d5776576f1cca (patch) | |
tree | da1ff1182d5aff481421371a2fd55a2a035aea40 /sw/source/core/access | |
parent | a454ee60efcb4eb3401d3c6b5196155375452993 (diff) |
tdf#156545 - a11y - fix warns about background character style formattings
Do not add warn to a11y sidebar if we use charstyle for character background
format.
Change-Id: Ide558b590cae2bc20c71c5c44909cd2cdeb89985
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155095
Tested-by: Jenkins
Tested-by: Gabor Kelemen <kelemeng@ubuntu.com>
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Diffstat (limited to 'sw/source/core/access')
-rw-r--r-- | sw/source/core/access/AccessibilityCheck.cxx | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index ac0f442a5041..501799a2a2ff 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -480,15 +480,43 @@ private: aBackgroundColor = nParaBackColor; else { - auto pIssue - = lclAddIssue(m_rIssueCollection, SwResId(STR_TEXT_FORMATTING_CONVEYS_MEANING), - sfx::AccessibilityIssueID::TEXT_FORMATTING); - pIssue->setIssueObject(IssueObject::TEXT); - pIssue->setNode(pTextNode); - SwDoc& rDocument = pTextNode->GetDoc(); - pIssue->setDoc(rDocument); - pIssue->setStart(nTextStart); - pIssue->setEnd(nTextStart + xTextRange->getString().getLength()); + OUString sCharStyleName; + Color nCharStyleBackColor(COL_AUTO); + if (xProperties->getPropertyValue("CharStyleName") >>= sCharStyleName) + { + try + { + uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier( + pTextNode->GetDoc().GetDocShell()->GetModel(), uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xCont + = xStyleFamiliesSupplier->getStyleFamilies(); + uno::Reference<container::XNameAccess> xStyleFamily( + xCont->getByName("CharacterStyles"), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xInfo( + xStyleFamily->getByName(sCharStyleName), uno::UNO_QUERY); + xInfo->getPropertyValue("CharBackColor") >>= nCharStyleBackColor; + } + catch (const uno::Exception&) + { + } + } + else + { + SAL_WARN("sw.a11y", "CharStyleName void"); + } + + if (aBackgroundColor != nCharStyleBackColor) + { + auto pIssue + = lclAddIssue(m_rIssueCollection, SwResId(STR_TEXT_FORMATTING_CONVEYS_MEANING), + sfx::AccessibilityIssueID::TEXT_FORMATTING); + pIssue->setIssueObject(IssueObject::TEXT); + pIssue->setNode(pTextNode); + SwDoc& rDocument = pTextNode->GetDoc(); + pIssue->setDoc(rDocument); + pIssue->setStart(nTextStart); + pIssue->setEnd(nTextStart + xTextRange->getString().getLength()); + } } Color aForegroundColor(ColorTransparency, nCharColor); |