diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-01-15 14:49:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-16 10:07:07 +0100 |
commit | 63a68064bb33f180b8a231f7524d99405d910226 (patch) | |
tree | 7ecf05b057c5ca4d80a48af045998a4b34484561 /sw/source/core/access | |
parent | d534a4c7b45ff254b339e806c6a11f13d9ff0043 (diff) |
make the Color constructors explicitly specify transparency
to reduce the churn, we leave the existing constructor in place,
and add a clang plugin to detect when the value passed to the
existing constructor may contain transparency/alpha data.
i.e. we leave expressions like Color(0xffffff) alone, but
warn about any non-constant expression, and any expression
like Color(0xff000000)
Change-Id: Id2ce58e08882d9b7bd0b9f88eca97359dcdbcc8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109362
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/access')
-rw-r--r-- | sw/source/core/access/AccessibilityCheck.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/access/acccell.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/access/accpara.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/access/acctable.cxx | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/sw/source/core/access/AccessibilityCheck.cxx b/sw/source/core/access/AccessibilityCheck.cxx index b8dc54b69ccf..82589ef9f715 100644 --- a/sw/source/core/access/AccessibilityCheck.cxx +++ b/sw/source/core/access/AccessibilityCheck.cxx @@ -343,7 +343,7 @@ private: uno::Reference<text::XTextContent> const& xParagraph, const SwTextNode* pTextNode) { - sal_Int32 nParaBackColor(COL_AUTO); + Color nParaBackColor(COL_AUTO); uno::Reference<beans::XPropertySet> xParagraphProperties(xParagraph, uno::UNO_QUERY); if (!(xParagraphProperties->getPropertyValue("ParaBackColor") >>= nParaBackColor)) { @@ -362,7 +362,7 @@ private: SAL_WARN("sw.a11y", "CharColor void"); return; } - Color aForegroundColor(nCharColor); + Color aForegroundColor(ColorTransparency, nCharColor); if (aForegroundColor == COL_AUTO) return; @@ -381,7 +381,7 @@ private: aPageBackground = rXFillColorItem->GetColorValue(); } - sal_Int32 nCharBackColor(COL_AUTO); + Color nCharBackColor(COL_AUTO); if (!(xProperties->getPropertyValue("CharBackColor") >>= nCharBackColor)) { @@ -394,7 +394,7 @@ private: // If not character background color, try paragraph background color if (aBackgroundColor == COL_AUTO) - aBackgroundColor = Color(nParaBackColor); + aBackgroundColor = nParaBackColor; // If not paragraph background color, try page color if (aBackgroundColor == COL_AUTO) diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx index 9d2aa207cfc8..206dd51b5784 100644 --- a/sw/source/core/access/acccell.cxx +++ b/sw/source/core/access/acccell.cxx @@ -419,7 +419,7 @@ sal_Int32 SAL_CALL SwAccessibleCell::getBackground() uno::Reference<XAccessibleComponent> xComponentDoc(xAccDoc, uno::UNO_QUERY); if (xComponentDoc.is()) { - crBack = Color(xComponentDoc->getBackground()); + crBack = Color(ColorTransparency, xComponentDoc->getBackground()); } } } diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 29bd4be8a1e0..05cd3f4e2bc4 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1917,7 +1917,7 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex, { uno::Any &anyChar = rValue.Value; sal_uInt32 crBack = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved)); - if (COL_AUTO == Color(crBack)) + if (COL_AUTO == Color(ColorTransparency, crBack)) { uno::Reference<XAccessibleComponent> xComponent(this); if (xComponent.is()) @@ -1937,12 +1937,12 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex, uno::Any &anyChar = rValue.Value; sal_uInt32 crChar = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved)); - if( COL_AUTO == Color(crChar) ) + if( COL_AUTO == Color(ColorTransparency, crChar) ) { uno::Reference<XAccessibleComponent> xComponent(this); if (xComponent.is()) { - Color cr(xComponent->getBackground()); + Color cr(ColorTransparency, xComponent->getBackground()); crChar = sal_uInt32(cr.IsDark() ? COL_WHITE : COL_BLACK); rValue.Value <<= crChar; } @@ -1993,12 +1993,12 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex, uno::Any &anyChar = rValue.Value; sal_uInt32 crUnderline = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved)); - if ( COL_AUTO == Color(crUnderline) ) + if ( COL_AUTO == Color(ColorTransparency, crUnderline) ) { uno::Reference<XAccessibleComponent> xComponent(this); if (xComponent.is()) { - Color cr(xComponent->getBackground()); + Color cr(ColorTransparency, xComponent->getBackground()); crUnderline = sal_uInt32(cr.IsDark() ? COL_WHITE : COL_BLACK); rValue.Value <<= crUnderline; } diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index c9de6594f484..679b23fc9d37 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -1496,7 +1496,7 @@ sal_Int32 SAL_CALL SwAccessibleTable::getBackground() uno::Reference<XAccessibleComponent> xComponentDoc(xAccDoc,uno::UNO_QUERY); if (xComponentDoc.is()) { - crBack = Color(xComponentDoc->getBackground()); + crBack = Color(ColorTransparency, xComponentDoc->getBackground()); } } } |