editeng/source/accessibility/AccessibleEditableTextPara.cxx | 6 ++- sw/source/core/access/accpara.cxx | 23 ++++++------ 2 files changed, 17 insertions(+), 12 deletions(-)
New commits: commit b3d5a3d7a79715464cc221f5b0e5489b3c2b250e Author: Marc Mondesir <timepilot3...@gmail.com> AuthorDate: Mon Nov 25 13:43:09 2024 -0800 Commit: Stephan Bergmann <stephan.bergm...@allotropia.de> CommitDate: Wed Jan 22 08:14:40 2025 +0100 tdf#75280: Convert sal_uIntPtr use to operator >>= Color. Replace casts to sal_uIntPtr, then to other types with operator >>= Color. Change-Id: Ib30370da83f3f653f8c5816e4d88cc5381ae648b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177303 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de> diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index a5c4c3b3bdb3..887648433d36 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -1423,7 +1423,8 @@ namespace accessibility if (rRes.Name == "CharColor") { uno::Any &anyChar = rRes.Value; - Color crChar(ColorTransparency, static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved))); + Color crChar; + anyChar >>= crChar; if (COL_AUTO == crChar ) { uno::Reference< css::accessibility::XAccessibleComponent > xComponent(mxParent,uno::UNO_QUERY); @@ -1454,7 +1455,8 @@ namespace accessibility if (rRes.Name == "CharUnderlineColor") { uno::Any &anyCharUnderLine = rRes.Value; - Color crCharUnderLine(ColorTransparency, static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>( anyCharUnderLine.pReserved))); + Color crCharUnderLine; + anyCharUnderLine >>= crCharUnderLine; if (COL_AUTO == crCharUnderLine ) { uno::Reference< css::accessibility::XAccessibleComponent > xComponent(mxParent,uno::UNO_QUERY); diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index d3781432b648..7427d6fefdcd 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1847,15 +1847,16 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex, if (rValue.Name == UNO_NAME_CHAR_BACK_COLOR) { uno::Any &anyChar = rValue.Value; - sal_uInt32 crBack = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved)); - if (COL_AUTO == Color(ColorTransparency, crBack)) + Color backColor; + anyChar >>= backColor; + if (COL_AUTO == backColor) { uno::Reference<XAccessibleComponent> xComponent(this); if (xComponent.is()) { - crBack = static_cast<sal_uInt32>(xComponent->getBackground()); + sal_uInt32 crBack = static_cast<sal_uInt32>(xComponent->getBackground()); + rValue.Value <<= crBack; } - rValue.Value <<= crBack; } continue; } @@ -1866,15 +1867,16 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex, if( GetPortionData().IsInGrayPortion( nIndex ) ) rValue.Value <<= GetCursorShell()->GetViewOptions()->GetFieldShadingsColor(); uno::Any &anyChar = rValue.Value; - sal_uInt32 crChar = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved)); + Color charColor; + anyChar >>= charColor; - if( COL_AUTO == Color(ColorTransparency, crChar) ) + if( COL_AUTO == charColor ) { uno::Reference<XAccessibleComponent> xComponent(this); if (xComponent.is()) { Color cr(ColorTransparency, xComponent->getBackground()); - crChar = sal_uInt32(cr.IsDark() ? COL_WHITE : COL_BLACK); + sal_uInt32 crChar = sal_uInt32(cr.IsDark() ? COL_WHITE : COL_BLACK); rValue.Value <<= crChar; } } @@ -1885,14 +1887,15 @@ void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex, if (rValue.Name == UNO_NAME_CHAR_UNDERLINE_COLOR) { uno::Any &anyChar = rValue.Value; - sal_uInt32 crUnderline = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved)); - if ( COL_AUTO == Color(ColorTransparency, crUnderline) ) + Color underlineColor; + anyChar >>= underlineColor; + if ( COL_AUTO == underlineColor ) { uno::Reference<XAccessibleComponent> xComponent(this); if (xComponent.is()) { Color cr(ColorTransparency, xComponent->getBackground()); - crUnderline = sal_uInt32(cr.IsDark() ? COL_WHITE : COL_BLACK); + sal_uInt32 crUnderline = sal_uInt32(cr.IsDark() ? COL_WHITE : COL_BLACK); rValue.Value <<= crUnderline; } }