sw/source/filter/ww8/rtfattributeoutput.cxx |   15 +++++++--------
 sw/source/filter/ww8/rtfexport.cxx          |    2 +-
 sw/source/filter/ww8/rtfexport.hxx          |    2 +-
 3 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit ad644992c842306b697d0654902c99d8e81226f5
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Jul 18 19:35:38 2025 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Jul 18 22:11:50 2025 +0200

    Return sal_Int32 from RtfExport::GetColor, for ease of use
    
    sal_uInt16 requires explicit cast to convert / append to string.
    
    Change-Id: Iaa900a570f2c5e096415b5c17357484fd5b8f754
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188052
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index e199cb37d338..82643081d739 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -192,7 +192,7 @@ static OString OutTBLBorderLine(RtfExport const& rExport, 
const editeng::SvxBord
         }
 
         aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRCF
-                    + 
OString::number(static_cast<sal_Int32>(rExport.GetColor(pLine->GetColor()))));
+                    + OString::number(rExport.GetColor(pLine->GetColor())));
     }
     else // tdf#129758 "no border" may be needed to override style
     {
@@ -963,8 +963,8 @@ void RtfAttributeOutput::TableBackgrounds(
 
     if (!aColor.IsTransparent())
     {
-        m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLCBPAT);
-        m_aRowDefs.append(static_cast<sal_Int32>(m_rExport.GetColor(aColor)));
+        m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLCBPAT
+                          + OString::number(m_rExport.GetColor(aColor)));
     }
 }
 
@@ -2606,8 +2606,7 @@ void RtfAttributeOutput::CharColor(const SvxColorItem& 
rColor)
 {
     const Color aColor(rColor.GetValue());
 
-    m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CF);
-    m_aStyles.append(static_cast<sal_Int32>(m_rExport.GetColor(aColor)));
+    m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CF + 
OString::number(m_rExport.GetColor(aColor)));
 }
 
 void RtfAttributeOutput::CharContour(const SvxContourItem& rContour)
@@ -2852,7 +2851,7 @@ void RtfAttributeOutput::CharUnderline(const 
SvxUnderlineItem& rUnderline)
         // NEEDSWORK looks like here rUnderline.GetColor() is always black,
         // even if the color in the odt is for example green...
         m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ULC);
-        
m_aStyles.append(static_cast<sal_Int32>(m_rExport.GetColor(rUnderline.GetColor())));
+        m_aStyles.append(m_rExport.GetColor(rUnderline.GetColor()));
     }
 }
 
@@ -2880,7 +2879,7 @@ void RtfAttributeOutput::CharBackground(const 
SvxBrushItem& rBrush)
     if (!rBrush.GetColor().IsTransparent())
     {
         m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CHCBPAT);
-        
m_aStyles.append(static_cast<sal_Int32>(m_rExport.GetColor(rBrush.GetColor())));
+        m_aStyles.append(m_rExport.GetColor(rBrush.GetColor()));
     }
 }
 
@@ -3772,7 +3771,7 @@ void RtfAttributeOutput::FormatBackground(const 
SvxBrushItem& rBrush)
     else if (!rBrush.GetColor().IsTransparent())
     {
         m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CBPAT);
-        
m_aStyles.append(static_cast<sal_Int32>(m_rExport.GetColor(rBrush.GetColor())));
+        m_aStyles.append(m_rExport.GetColor(rBrush.GetColor()));
     }
 }
 
diff --git a/sw/source/filter/ww8/rtfexport.cxx 
b/sw/source/filter/ww8/rtfexport.cxx
index bd9e176a7c5f..c12f528e43db 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -1243,7 +1243,7 @@ void RtfExport::OutDateTime(std::string_view pStr, const 
util::DateTime& rDT)
     Strm().WriteNumberAsString(rDT.Minutes).WriteChar('}');
 }
 
-sal_uInt16 RtfExport::GetColor(const Color& rColor) const
+sal_Int32 RtfExport::GetColor(const Color& rColor) const
 {
     for (const auto& rEntry : m_aColTable)
         if (rEntry.second == rColor)
diff --git a/sw/source/filter/ww8/rtfexport.hxx 
b/sw/source/filter/ww8/rtfexport.hxx
index 04d98a3cdfff..6b285dbab485 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -188,7 +188,7 @@ public:
     void OutDateTime(std::string_view pStr, const css::util::DateTime& rDT);
     void OutPageDescription(const SwPageDesc& rPgDsc);
 
-    sal_uInt16 GetColor(const Color& rColor) const;
+    sal_Int32 GetColor(const Color& rColor) const;
     void InsColor(const Color& rCol);
     void InsColorLine(const SvxBoxItem& rBox);
     void OutColorTable();

Reply via email to