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.bergmann@allotropia.de>
This commit is contained in:
Marc Mondesir
2025-01-22 08:14:40 +01:00
committed by Stephan Bergmann
parent 35a61e79b2
commit b3d5a3d7a7
2 changed files with 17 additions and 12 deletions
@@ -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);
+13 -10
View File
@@ -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;
}
}