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 /dbaccess | |
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 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/misc/TokenWriter.cxx | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index 5b1be584b18f..174a2d4e4ea7 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -330,10 +330,9 @@ bool ORTFImportExport::Write() bool bUnderline = ( css::awt::FontUnderline::NONE != m_aFont.Underline ); bool bStrikeout = ( css::awt::FontStrikeout::NONE != m_aFont.Strikeout ); - sal_Int32 nColor = 0; + ::Color aColor; if(m_xObject.is()) - m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= nColor; - ::Color aColor(nColor); + m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= aColor; OString aFonts(OUStringToOString(m_aFont.Name, RTL_TEXTENCODING_MS_1252)); if (aFonts.isEmpty()) @@ -661,10 +660,9 @@ void OHTMLImportExport::WriteBody() // default Textcolour black m_pStream->WriteChar( '<' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_body ).WriteChar( ' ' ).WriteCharPtr( OOO_STRING_SVTOOLS_HTML_O_text ).WriteChar( '=' ); - sal_Int32 nColor = 0; + ::Color aColor; if(m_xObject.is()) - m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= nColor; - ::Color aColor(nColor); + m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= aColor; HTMLOutFuncs::Out_Color( (*m_pStream), aColor ); m_pStream->WriteCharPtr( " " OOO_STRING_SVTOOLS_HTML_O_bgcolor "=" ); @@ -931,10 +929,9 @@ void OHTMLImportExport::FontOn() "="; m_pStream->WriteOString( aStrOut ); - sal_Int32 nColor = 0; + ::Color aColor; if(m_xObject.is()) - m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= nColor; - ::Color aColor(nColor); + m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= aColor; HTMLOutFuncs::Out_Color( (*m_pStream), aColor ); m_pStream->WriteCharPtr( ">" ); |