dbaccess/source/ui/misc/TokenWriter.cxx     |   20 +++----
 editeng/source/editeng/impedit4.cxx         |   54 +++++++++---------
 include/tools/stream.hxx                    |    4 -
 svtools/source/svrtf/rtfout.cxx             |    4 -
 sw/inc/shellio.hxx                          |    4 -
 sw/source/filter/writer/writer.cxx          |   35 ------------
 sw/source/filter/ww8/rtfattributeoutput.cxx |   67 +++++++++++------------
 sw/source/filter/ww8/rtfexport.cxx          |   62 ++++++++++-----------
 sw/source/filter/ww8/rtfexport.hxx          |    2 
 tools/source/stream/stream.cxx              |   10 ---
 vcl/source/filter/ipdf/pdfdocument.cxx      |   80 ++++++++++++++--------------
 11 files changed, 145 insertions(+), 197 deletions(-)

New commits:
commit 1155def95bfe5b43f2b68e6c85632716df87bcf8
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Apr 11 00:04:24 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Apr 11 09:06:10 2023 +0200

    Drop Writer::OutLong
    
    ... and use SvStream::WriteNumberAsString, replacing Write[U]Int32AsString
    
    Change-Id: I10e56c532494239ed40ec01b6184dd06db463a0c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150193
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx 
b/dbaccess/source/ui/misc/TokenWriter.cxx
index dea0a750646d..8d898fe24e1f 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -324,7 +324,7 @@ bool ORTFImportExport::Write()
     m_pStream->WriteOString(OOO_STRING_SVTOOLS_RTF_ANSI);
     if (sal_uInt32 nCpg = rtl_getWindowsCodePageFromTextEncoding(m_eDestEnc); 
nCpg && nCpg != 65001)
     {
-        
m_pStream->WriteOString(OOO_STRING_SVTOOLS_RTF_ANSICPG).WriteUInt32AsString(nCpg);
+        
m_pStream->WriteOString(OOO_STRING_SVTOOLS_RTF_ANSICPG).WriteNumberAsString(nCpg);
     }
     m_pStream->WriteOString(SAL_NEWLINE_STRING);
 
@@ -351,7 +351,7 @@ bool ORTFImportExport::Write()
         sal_Int32 nTok{-1}; // to compensate pre-increment
         do {
             m_pStream->WriteOString( "\\f" );
-            m_pStream->WriteInt32AsString(++nTok);
+            m_pStream->WriteNumberAsString(++nTok);
             m_pStream->WriteOString( "\\fcharset0\\fnil " );
             m_pStream->WriteOString( o3tl::getToken(aFonts, 0, ';', nIdx) );
             m_pStream->WriteChar( ';' );
@@ -361,11 +361,11 @@ bool ORTFImportExport::Write()
     m_pStream->WriteOString( SAL_NEWLINE_STRING );
     // write the rtf color table
     m_pStream->WriteChar( '{' ).WriteOString( OOO_STRING_SVTOOLS_RTF_COLORTBL 
).WriteOString( OOO_STRING_SVTOOLS_RTF_RED );
-    m_pStream->WriteUInt32AsString(aColor.GetRed());
+    m_pStream->WriteNumberAsString(aColor.GetRed());
     m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_GREEN );
-    m_pStream->WriteUInt32AsString(aColor.GetGreen());
+    m_pStream->WriteNumberAsString(aColor.GetGreen());
     m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_BLUE );
-    m_pStream->WriteUInt32AsString(aColor.GetBlue());
+    m_pStream->WriteNumberAsString(aColor.GetBlue());
 
     m_pStream->WriteOString( 
";\\red255\\green255\\blue255;\\red192\\green192\\blue192;}" )
                 .WriteOString( SAL_NEWLINE_STRING );
@@ -373,7 +373,7 @@ bool ORTFImportExport::Write()
     static char const aCell1[] = 
"\\clbrdrl\\brdrs\\brdrcf0\\clbrdrt\\brdrs\\brdrcf0\\clbrdrb\\brdrs\\brdrcf0\\clbrdrr\\brdrs\\brdrcf0\\clshdng10000\\clcfpat2\\cellx";
 
     m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteOString( 
OOO_STRING_SVTOOLS_RTF_TRGAPH );
-    m_pStream->WriteInt32AsString(40);
+    m_pStream->WriteOString("40");
     m_pStream->WriteOString( SAL_NEWLINE_STRING );
 
     if(m_xObject.is())
@@ -394,7 +394,7 @@ bool ORTFImportExport::Write()
         for( sal_Int32 i=1; i<=nCount; ++i )
         {
             m_pStream->WriteOString( aCell1 );
-            m_pStream->WriteInt32AsString(i*CELL_X);
+            m_pStream->WriteNumberAsString(i*CELL_X);
             m_pStream->WriteOString( SAL_NEWLINE_STRING );
         }
 
@@ -497,7 +497,7 @@ void ORTFImportExport::appendRow(OString const * 
pHorzChar,sal_Int32 _nColumnCou
 {
     ++kk;
     m_pStream->WriteOString( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteOString( 
OOO_STRING_SVTOOLS_RTF_TRGAPH );
-    m_pStream->WriteInt32AsString(40);
+    m_pStream->WriteOString("40");
     m_pStream->WriteOString( SAL_NEWLINE_STRING );
 
     static char const aCell2[] = 
"\\clbrdrl\\brdrs\\brdrcf2\\clbrdrt\\brdrs\\brdrcf2\\clbrdrb\\brdrs\\brdrcf2\\clbrdrr\\brdrs\\brdrcf2\\clshdng10000\\clcfpat1\\cellx";
@@ -505,7 +505,7 @@ void ORTFImportExport::appendRow(OString const * 
pHorzChar,sal_Int32 _nColumnCou
     for ( sal_Int32 i=1; i<=_nColumnCount; ++i )
     {
         m_pStream->WriteOString( aCell2 );
-        m_pStream->WriteInt32AsString(i*CELL_X);
+        m_pStream->WriteNumberAsString(i*CELL_X);
         m_pStream->WriteOString( SAL_NEWLINE_STRING );
     }
 
@@ -649,7 +649,7 @@ void OHTMLImportExport::WriteBody()
     m_pStream->WriteOString( OOO_STRING_SVTOOLS_HTML_body ).WriteOString( " { 
" ).WriteOString( "font-family: " ).WriteChar( '"' ).WriteOString( 
OUStringToOString(m_aFont.Name, osl_getThreadTextEncoding()) ).WriteChar( '\"' 
);
         // TODO : think about the encoding of the font name
     m_pStream->WriteOString( "; " ).WriteOString( "font-size: " );
-    m_pStream->WriteInt32AsString(m_aFont.Height);
+    m_pStream->WriteNumberAsString(m_aFont.Height);
     m_pStream->WriteChar( '}' );
 
     m_pStream->WriteOString(SAL_NEWLINE_STRING).WriteOString(GetIndentStr());
diff --git a/editeng/source/editeng/impedit4.cxx 
b/editeng/source/editeng/impedit4.cxx
index a2b3b07d8db2..34d26b1a899a 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -327,7 +327,7 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, 
EditSelection aSel )
         SvxFontItem* pFontItem = aFontTable[ j ].get();
         rOutput.WriteChar( '{' );
         rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_F );
-        rOutput.WriteUInt32AsString( j );
+        rOutput.WriteNumberAsString( j );
         switch ( pFontItem->GetFamily()  )
         {
             case FAMILY_DONTKNOW:       rOutput.WriteOString( 
OOO_STRING_SVTOOLS_RTF_FNIL );
@@ -354,7 +354,7 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, 
EditSelection aSel )
             default:
                 break;
         }
-        rOutput.WriteUInt32AsString( nVal );
+        rOutput.WriteNumberAsString( nVal );
 
         rtl_TextEncoding eChrSet = pFontItem->GetCharSet();
         // tdf#47679 OpenSymbol is not encoded in Symbol Encoding
@@ -371,7 +371,7 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, 
EditSelection aSel )
         if( RTL_TEXTENCODING_DONTKNOW == eChrSet )
             eChrSet = osl_getThreadTextEncoding();
         rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_FCHARSET );
-        rOutput.WriteUInt32AsString( 
rtl_getBestWindowsCharsetFromTextEncoding( eChrSet ) );
+        rOutput.WriteNumberAsString( 
rtl_getBestWindowsCharsetFromTextEncoding( eChrSet ) );
 
         rOutput.WriteChar( ' ' );
         RTFOutFuncs::Out_String( rOutput, pFontItem->GetFamilyName(), eDestEnc 
);
@@ -405,11 +405,11 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, 
EditSelection aSel )
         if (color != COL_AUTO) // auto is represented by "empty" element
         {
             rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_RED );
-            rOutput.WriteUInt32AsString( color.GetRed() );
+            rOutput.WriteNumberAsString( color.GetRed() );
             rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_GREEN );
-            rOutput.WriteUInt32AsString( color.GetGreen() );
+            rOutput.WriteNumberAsString( color.GetGreen() );
             rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_BLUE );
-            rOutput.WriteUInt32AsString( color.GetBlue() );
+            rOutput.WriteNumberAsString( color.GetBlue() );
         }
         rOutput.WriteChar( ';' );
     }
@@ -444,7 +444,7 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, 
EditSelection aSel )
                 rOutput << endl;
                 rOutput.WriteChar( '{' ).WriteOString( 
OOO_STRING_SVTOOLS_RTF_S );
                 sal_uInt32 nNumber = nStyle + 1;
-                rOutput.WriteUInt32AsString( nNumber );
+                rOutput.WriteNumberAsString( nNumber );
 
                 // Attribute, also from Parent!
                 for ( sal_uInt16 nParAttr = EE_PARA_START; nParAttr <= 
EE_CHAR_END; nParAttr++ )
@@ -463,7 +463,7 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, 
EditSelection aSel )
                     DBG_ASSERT( pParent, "Parent not found!" );
                     rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_SBASEDON );
                     nNumber = aStyleSheetToIdMap.find(pParent)->second;
-                    rOutput.WriteUInt32AsString( nNumber );
+                    rOutput.WriteNumberAsString( nNumber );
                 }
 
                 // Next Style... (more)
@@ -475,7 +475,7 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, 
EditSelection aSel )
                 DBG_ASSERT( pNext, "Next not found!" );
                 rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_SNEXT );
                 nNumber = aStyleSheetToIdMap.find(pNext)->second;
-                rOutput.WriteUInt32AsString( nNumber );
+                rOutput.WriteNumberAsString( nNumber );
 
                 // Name of the template...
                 rOutput.WriteOString( " " );
@@ -503,7 +503,7 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, 
EditSelection aSel )
                                         Point( aEditDoc.GetDefTab(), 0 ),
                                         &GetRefMapMode(), &aTwpMode ).X());
     rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_DEFTAB );
-    rOutput.WriteUInt32AsString( nDefTabTwps );
+    rOutput.WriteNumberAsString( nDefTabTwps );
     rOutput << endl;
 
     // iterate over the paragraphs ...
@@ -522,7 +522,7 @@ ErrCode ImpEditEngine::WriteRTF( SvStream& rOutput, 
EditSelection aSel )
             // Number of template
             rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_S );
             sal_uInt32 nNumber = 
aStyleSheetToIdMap.find(pNode->GetStyleSheet())->second;
-            rOutput.WriteUInt32AsString( nNumber );
+            rOutput.WriteNumberAsString( nNumber );
 
             // All Attribute
             // Attribute, also from Parent!
@@ -676,7 +676,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& 
rItem, SvStream& rOutput,
             if( nLevel >= 0 )
             {
                 rOutput.WriteOString( "\\level" );
-                rOutput.WriteInt32AsString( nLevel );
+                rOutput.WriteNumberAsString( nLevel );
             }
         }
         break;
@@ -686,15 +686,15 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& 
rItem, SvStream& rOutput,
             rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_FI );
             sal_Int32 nTxtFirst = static_cast<const 
SvxLRSpaceItem&>(rItem).GetTextFirstLineOffset();
             nTxtFirst = LogicToTwips( nTxtFirst );
-            rOutput.WriteInt32AsString( nTxtFirst );
+            rOutput.WriteNumberAsString( nTxtFirst );
             rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_LI );
             sal_uInt32 nTxtLeft = static_cast< sal_uInt32 >(static_cast<const 
SvxLRSpaceItem&>(rItem).GetTextLeft());
             nTxtLeft = static_cast<sal_uInt32>(LogicToTwips( nTxtLeft ));
-            rOutput.WriteInt32AsString( nTxtLeft );
+            rOutput.WriteNumberAsString( nTxtLeft );
             rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_RI );
             sal_uInt32 nTxtRight = static_cast<const 
SvxLRSpaceItem&>(rItem).GetRight();
             nTxtRight = LogicToTwips( nTxtRight);
-            rOutput.WriteUInt32AsString( nTxtRight );
+            rOutput.WriteNumberAsString( nTxtRight );
         }
         break;
         case EE_PARA_ULSPACE:
@@ -702,11 +702,11 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& 
rItem, SvStream& rOutput,
             rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_SB );
             sal_uInt32 nUpper = static_cast<const 
SvxULSpaceItem&>(rItem).GetUpper();
             nUpper = static_cast<sal_uInt32>(LogicToTwips( nUpper ));
-            rOutput.WriteUInt32AsString( nUpper );
+            rOutput.WriteNumberAsString( nUpper );
             rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_SA );
             sal_uInt32 nLower = static_cast<const 
SvxULSpaceItem&>(rItem).GetLower();
             nLower = LogicToTwips( nLower );
-            rOutput.WriteUInt32AsString( nLower );
+            rOutput.WriteNumberAsString( nLower );
         }
         break;
         case EE_PARA_SBL:
@@ -723,7 +723,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& 
rItem, SvStream& rOutput,
                 nVal /= 100;
                 cMult = '1';
             }
-            rOutput.WriteInt32AsString( nVal );
+            rOutput.WriteNumberAsString( nVal );
             rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_SLMULT ).WriteChar( 
cMult );
         }
         break;
@@ -748,7 +748,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& 
rItem, SvStream& rOutput,
             {
                 const SvxTabStop& rTab = rTabs[i];
                 rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_TX );
-                rOutput.WriteInt32AsString( LogicToTwips( rTab.GetTabPos() ) );
+                rOutput.WriteNumberAsString( LogicToTwips( rTab.GetTabPos() ) 
);
             }
         }
         break;
@@ -760,7 +760,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& 
rItem, SvStream& rOutput,
             assert(iter != rColorList.end());
             sal_uInt32 const n = iter - rColorList.begin();
             rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_CF );
-            rOutput.WriteUInt32AsString( n );
+            rOutput.WriteNumberAsString( n );
         }
         break;
         case EE_CHAR_FONTINFO:
@@ -778,7 +778,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& 
rItem, SvStream& rOutput,
             }
 
             rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_F );
-            rOutput.WriteUInt32AsString( n );
+            rOutput.WriteNumberAsString( n );
         }
         break;
         case EE_CHAR_FONTHEIGHT:
@@ -790,7 +790,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& 
rItem, SvStream& rOutput,
             nHeight = LogicToTwips( nHeight );
             // Twips => HalfPoints
             nHeight /= 10;
-            rOutput.WriteInt32AsString( nHeight );
+            rOutput.WriteNumberAsString( nHeight );
         }
         break;
         case EE_CHAR_WEIGHT:
@@ -910,14 +910,14 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& 
rItem, SvStream& rOutput,
         case EE_CHAR_KERNING:
         {
             rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_EXPNDTW );
-            rOutput.WriteInt32AsString( LogicToTwips(
+            rOutput.WriteNumberAsString( LogicToTwips(
                 static_cast<const SvxKerningItem&>(rItem).GetValue() ) );
         }
         break;
         case EE_CHAR_PAIRKERNING:
         {
             rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_KERNING );
-            rOutput.WriteUInt32AsString( static_cast<const 
SvxAutoKernItem&>(rItem).GetValue() ? 1 : 0 );
+            rOutput.WriteNumberAsString( static_cast<const 
SvxAutoKernItem&>(rItem).GetValue() ? 1 : 0 );
         }
         break;
         case EE_CHAR_ESCAPEMENT:
@@ -954,15 +954,15 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& 
rItem, SvStream& rOutput,
             // SWG:
             if ( nEsc )
             {
-                rOutput.WriteOString( "{\\*\\updnprop" ).WriteOString( 
OString::number(
-                    nProp100) ).WriteChar( '}' );
+                rOutput.WriteOString( "{\\*\\updnprop" ).WriteNumberAsString(
+                    nProp100 ).WriteChar( '}' );
             }
             tools::Long nUpDown = nFontHeight * std::abs( nEsc ) / 100;
             if ( nEsc < 0 )
                 rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_DN );
             else if ( nEsc > 0 )
                 rOutput.WriteOString( OOO_STRING_SVTOOLS_RTF_UP );
-            rOutput.WriteOString( OString::number(nUpDown) );
+            rOutput.WriteNumberAsString(nUpDown);
         }
         break;
     }
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx
index 2072aeff4451..d3e741bbd016 100644
--- a/include/tools/stream.hxx
+++ b/include/tools/stream.hxx
@@ -261,8 +261,8 @@ public:
     SvStream&       WriteFloat( float nFloat );
     SvStream&       WriteDouble( const double& rDouble );
 
-    SvStream&       WriteUInt32AsString( sal_uInt32 nUInt32 );
-    SvStream&       WriteInt32AsString( sal_Int32 nInt32 );
+    template <typename N>
+    SvStream&       WriteNumberAsString( N n ) { return 
WriteOString(OString::number(n)); }
 
     std::size_t     ReadBytes( void* pData, std::size_t nSize );
     std::size_t     WriteBytes( const void* pData, std::size_t nSize );
diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx
index 4b4c35ae01a8..843256dc2d47 100644
--- a/svtools/source/svrtf/rtfout.cxx
+++ b/svtools/source/svrtf/rtfout.cxx
@@ -151,11 +151,11 @@ SvStream& Out_Char(SvStream& rStream, sal_Unicode c,
                             // #i47831# add an additional whitespace, so that
                             // "document whitespaces" are not ignored.;
                             rStream.WriteOString( "\\uc" )
-                               .WriteOString( OString::number(nLen) 
).WriteOString( " " );
+                               .WriteNumberAsString( nLen ).WriteOString( " " 
);
                             *pUCMode = nLen;
                         }
                         rStream.WriteOString( "\\u" )
-                           .WriteInt32AsString(c);
+                           .WriteNumberAsString(c);
                     }
 
                     for (sal_Int32 nI = 0; nI < nLen; ++nI)
diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx
index b3a18e65f510..f902194c6c00 100644
--- a/sw/inc/shellio.hxx
+++ b/sw/inc/shellio.hxx
@@ -461,10 +461,6 @@ public:
 
     // Stream-specific routines. Do not use in storage-writer!
 
-    // Optimizing output on stream.
-    static SvStream& OutLong( SvStream& rStrm, tools::Long nVal );
-    static SvStream& OutULong( SvStream& rStrm, sal_uLong nVal );
-
     void SetStream(SvStream *const pStream);
     SvStream& Strm();
 
diff --git a/sw/source/filter/writer/writer.cxx 
b/sw/source/filter/writer/writer.cxx
index 3df92c4226bd..6c7565e5dcc4 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -38,27 +38,6 @@
 
 using namespace css;
 
-namespace
-{
-    SvStream& lcl_OutLongExt( SvStream& rStrm, sal_uLong nVal, bool bNeg )
-    {
-        char aBuf[28];
-
-        int i = SAL_N_ELEMENTS(aBuf);
-        aBuf[--i] = 0;
-        do
-        {
-            aBuf[--i] = '0' + static_cast<char>(nVal % 10);
-            nVal /= 10;
-        } while (nVal);
-
-        if (bNeg)
-            aBuf[--i] = '-';
-
-        return rStrm.WriteOString( &aBuf[i] );
-    }
-}
-
 typedef std::multimap<SwNodeOffset, const ::sw::mark::IMark*> 
SwBookmarkNodeTable;
 
 struct Writer_Impl
@@ -222,20 +201,6 @@ void Writer::SetStream(SvStream *const pStream)
     m_pImpl->m_pStream = pStream;
 }
 
-SvStream& Writer::OutLong( SvStream& rStrm, tools::Long nVal )
-{
-    const bool bNeg = nVal < 0;
-    if (bNeg)
-        nVal = -nVal;
-
-    return lcl_OutLongExt(rStrm, static_cast<sal_uLong>(nVal), bNeg);
-}
-
-SvStream& Writer::OutULong( SvStream& rStrm, sal_uLong nVal )
-{
-    return lcl_OutLongExt(rStrm, nVal, false);
-}
-
 ErrCode Writer::Write( SwPaM& rPaM, SvStream& rStrm, const OUString* pFName )
 {
     if ( IsStgWriter() )
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 6e98e56c29b2..f5134d4da2e2 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1277,16 +1277,16 @@ void RtfAttributeOutput::SectionLineNumbering(sal_uLong 
nRestartNo,
                                               const SwLineNumberInfo& 
rLnNumInfo)
 {
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_LINEMOD);
-    m_rExport.OutLong(rLnNumInfo.GetCountBy());
+    m_rExport.Strm().WriteNumberAsString(rLnNumInfo.GetCountBy());
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_LINEX);
-    m_rExport.OutLong(rLnNumInfo.GetPosFromLeft());
+    m_rExport.Strm().WriteNumberAsString(rLnNumInfo.GetPosFromLeft());
     if (!rLnNumInfo.IsRestartEachPage())
         m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_LINECONT);
 
     if (nRestartNo > 0)
     {
         m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_LINESTARTS);
-        m_rExport.OutLong(nRestartNo);
+        m_rExport.Strm().WriteNumberAsString(nRestartNo);
     }
 }
 
@@ -1482,10 +1482,10 @@ void RtfAttributeOutput::NumberingDefinition(sal_uInt16 
nId, const SwNumRule& /*
 {
     
m_rExport.Strm().WriteChar('{').WriteOString(OOO_STRING_SVTOOLS_RTF_LISTOVERRIDE);
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_LISTID);
-    m_rExport.OutULong(nId);
+    m_rExport.Strm().WriteNumberAsString(nId);
     
m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_LISTOVERRIDECOUNT).WriteChar('0');
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_LS);
-    m_rExport.OutULong(nId).WriteChar('}');
+    m_rExport.Strm().WriteNumberAsString(nId).WriteChar('}');
 }
 
 void RtfAttributeOutput::StartAbstractNumbering(sal_uInt16 nId)
@@ -1494,14 +1494,14 @@ void 
RtfAttributeOutput::StartAbstractNumbering(sal_uInt16 nId)
         .WriteChar('{')
         .WriteOString(OOO_STRING_SVTOOLS_RTF_LIST)
         .WriteOString(OOO_STRING_SVTOOLS_RTF_LISTTEMPLATEID);
-    m_rExport.OutULong(nId);
+    m_rExport.Strm().WriteNumberAsString(nId);
     m_nListId = nId;
 }
 
 void RtfAttributeOutput::EndAbstractNumbering()
 {
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_LISTID);
-    
m_rExport.OutULong(m_nListId).WriteChar('}').WriteOString(SAL_NEWLINE_STRING);
+    
m_rExport.Strm().WriteNumberAsString(m_nListId).WriteChar('}').WriteOString(SAL_NEWLINE_STRING);
 }
 
 void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, sal_uInt16 nStart,
@@ -1618,7 +1618,7 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, 
sal_uInt16 nStart,
             break;
     }
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_LEVELNFC);
-    m_rExport.OutULong(nVal);
+    m_rExport.Strm().WriteNumberAsString(nVal);
 
     switch (eAdjust)
     {
@@ -1633,7 +1633,7 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, 
sal_uInt16 nStart,
             break;
     }
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_LEVELJC);
-    m_rExport.OutULong(nVal);
+    m_rExport.Strm().WriteNumberAsString(nVal);
 
     // bullet
     if (nNumberingType == SVX_NUM_BITMAP && pBrush)
@@ -1642,15 +1642,15 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 
nLevel, sal_uInt16 nStart,
         if (nIndex != -1)
         {
             m_rExport.Strm().WriteOString(LO_STRING_SVTOOLS_RTF_LEVELPICTURE);
-            m_rExport.OutULong(nIndex);
+            m_rExport.Strm().WriteNumberAsString(nIndex);
         }
     }
 
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_LEVELSTARTAT);
-    m_rExport.OutULong(nStart);
+    m_rExport.Strm().WriteNumberAsString(nStart);
 
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_LEVELFOLLOW);
-    m_rExport.OutULong(nFollow);
+    m_rExport.Strm().WriteNumberAsString(nFollow);
 
     // leveltext group
     
m_rExport.Strm().WriteChar('{').WriteOString(OOO_STRING_SVTOOLS_RTF_LEVELTEXT).WriteChar('
 ');
@@ -1660,7 +1660,7 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, 
sal_uInt16 nStart,
         m_rExport.Strm().WriteOString("\\'01");
         sal_Unicode cChar = rNumberingString[0];
         m_rExport.Strm().WriteOString("\\u");
-        m_rExport.OutULong(cChar);
+        m_rExport.Strm().WriteNumberAsString(cChar);
         m_rExport.Strm().WriteOString(" ?");
     }
     else
@@ -1688,7 +1688,7 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, 
sal_uInt16 nStart,
         if (pFont)
         {
             m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_F);
-            m_rExport.OutULong(m_rExport.m_aFontHelper.GetId(*pFont));
+            
m_rExport.Strm().WriteNumberAsString(m_rExport.m_aFontHelper.GetId(*pFont));
         }
         m_rExport.OutputItemSet(*pOutSet, false, true, i18n::ScriptType::LATIN,
                                 m_rExport.m_bExportModeRTF);
@@ -1697,8 +1697,8 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, 
sal_uInt16 nStart,
     }
 
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_FI);
-    m_rExport.OutLong(nFirstLineIndex).WriteOString(OOO_STRING_SVTOOLS_RTF_LI);
-    m_rExport.OutLong(nIndentAt);
+    
m_rExport.Strm().WriteNumberAsString(nFirstLineIndex).WriteOString(OOO_STRING_SVTOOLS_RTF_LI);
+    m_rExport.Strm().WriteNumberAsString(nIndentAt);
 
     m_rExport.Strm().WriteChar('}');
     if (nLevel > 8)
@@ -2074,7 +2074,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const 
ww8::Frame& rFrame, const Poi
             if (const SdrObject* pObject = 
rFrame.GetFrameFormat().FindRealSdrObject())
             {
                 m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_SHPZ);
-                m_rExport.OutULong(pObject->GetOrdNum());
+                m_rExport.Strm().WriteNumberAsString(pObject->GetOrdNum());
             }
 
             m_rExport.Strm().WriteOString(m_aRunText.makeStringAndClear());
@@ -3429,11 +3429,11 @@ void RtfAttributeOutput::FormatSurround(const 
SwFormatSurround& rSurround)
             nWr = 4; // tight
 
         m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_SHPWR);
-        m_rExport.OutLong(nWr);
+        m_rExport.Strm().WriteNumberAsString(nWr);
         if (oWrk)
         {
             m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_SHPWRK);
-            m_rExport.OutLong(*oWrk);
+            m_rExport.Strm().WriteNumberAsString(*oWrk);
         }
     }
 }
@@ -3480,11 +3480,11 @@ void RtfAttributeOutput::FormatVertOrientation(const 
SwFormatVertOrient& rFlyVer
     }
 
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_SHPTOP);
-    m_rExport.OutLong(rFlyVert.GetPos());
+    m_rExport.Strm().WriteNumberAsString(rFlyVert.GetPos());
     if (m_pFlyFrameSize)
     {
         m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_SHPBOTTOM);
-        m_rExport.OutLong(rFlyVert.GetPos() + m_pFlyFrameSize->Height());
+        m_rExport.Strm().WriteNumberAsString(rFlyVert.GetPos() + 
m_pFlyFrameSize->Height());
     }
 }
 
@@ -3527,11 +3527,11 @@ void RtfAttributeOutput::FormatHorizOrientation(const 
SwFormatHoriOrient& rFlyHo
     }
 
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_SHPLEFT);
-    m_rExport.OutLong(rFlyHori.GetPos());
+    m_rExport.Strm().WriteNumberAsString(rFlyHori.GetPos());
     if (m_pFlyFrameSize)
     {
         m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_SHPRIGHT);
-        m_rExport.OutLong(rFlyHori.GetPos() + m_pFlyFrameSize->Width());
+        m_rExport.Strm().WriteNumberAsString(rFlyHori.GetPos() + 
m_pFlyFrameSize->Width());
     }
 }
 
@@ -3720,7 +3720,7 @@ void RtfAttributeOutput::FormatColumns_Impl(sal_uInt16 
nCols, const SwFormatCol&
                                             SwTwips nPageSize)
 {
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_COLS);
-    m_rExport.OutLong(nCols);
+    m_rExport.Strm().WriteNumberAsString(nCols);
 
     if (rCol.GetLineAdj() != COLADJ_NONE)
         m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_LINEBETCOL);
@@ -3728,7 +3728,7 @@ void RtfAttributeOutput::FormatColumns_Impl(sal_uInt16 
nCols, const SwFormatCol&
     if (bEven)
     {
         m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_COLSX);
-        m_rExport.OutLong(rCol.GetGutterWidth(true));
+        m_rExport.Strm().WriteNumberAsString(rCol.GetGutterWidth(true));
     }
     else
     {
@@ -3736,15 +3736,16 @@ void RtfAttributeOutput::FormatColumns_Impl(sal_uInt16 
nCols, const SwFormatCol&
         for (sal_uInt16 n = 0; n < nCols;)
         {
             m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_COLNO);
-            m_rExport.OutLong(n + 1);
+            m_rExport.Strm().WriteNumberAsString(n + 1);
 
             m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_COLW);
-            m_rExport.OutLong(rCol.CalcPrtColWidth(n, nPageSize));
+            m_rExport.Strm().WriteNumberAsString(rCol.CalcPrtColWidth(n, 
nPageSize));
 
             if (++n != nCols)
             {
                 m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_COLSR);
-                m_rExport.OutLong(rColumns[n - 1].GetRight() + 
rColumns[n].GetLeft());
+                m_rExport.Strm().WriteNumberAsString(rColumns[n - 1].GetRight()
+                                                     + rColumns[n].GetLeft());
             }
         }
     }
@@ -3992,7 +3993,7 @@ void RtfAttributeOutput::FontAlternateName(const 
OUString& rName) const
 void RtfAttributeOutput::FontCharset(sal_uInt8 nCharSet) const
 {
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_FCHARSET);
-    m_rExport.OutULong(nCharSet);
+    m_rExport.Strm().WriteNumberAsString(nCharSet);
     m_rExport.Strm().WriteChar(' ');
     
m_rExport.SetCurrentEncoding(rtl_getTextEncodingFromWindowsCharset(nCharSet));
 }
@@ -4023,7 +4024,7 @@ void RtfAttributeOutput::FontFamilyType(FontFamily 
eFamily, const wwFont& rFont)
         default:
             break;
     }
-    
m_rExport.OutULong(m_rExport.m_aFontHelper.GetId(rFont)).WriteOString(pStr);
+    
m_rExport.Strm().WriteNumberAsString(m_rExport.m_aFontHelper.GetId(rFont)).WriteOString(pStr);
 }
 
 /// Font pitch.
@@ -4043,7 +4044,7 @@ void RtfAttributeOutput::FontPitchType(FontPitch ePitch) 
const
         default:
             break;
     }
-    m_rExport.OutULong(nVal);
+    m_rExport.Strm().WriteNumberAsString(nVal);
 }
 
 static void lcl_AppendSP(OStringBuffer& rBuffer, const char cName[], const 
OUString& rValue,
@@ -4461,9 +4462,9 @@ void RtfAttributeOutput::BulletDefinition(int /*nId*/, 
const Graphic& rGraphic,
     m_rExport.Strm().WriteOString("{" OOO_STRING_SVTOOLS_RTF_PICT 
OOO_STRING_SVTOOLS_RTF_PNGBLIP);
 
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_PICWGOAL);
-    m_rExport.OutULong(aSize.Width());
+    m_rExport.Strm().WriteNumberAsString(aSize.Width());
     m_rExport.Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_PICHGOAL);
-    m_rExport.OutULong(aSize.Height());
+    m_rExport.Strm().WriteNumberAsString(aSize.Height());
 
     m_rExport.Strm().WriteOString(SAL_NEWLINE_STRING);
     const sal_uInt8* pGraphicAry = nullptr;
diff --git a/sw/source/filter/ww8/rtfexport.cxx 
b/sw/source/filter/ww8/rtfexport.cxx
index 1cd2827384e5..b59012b857d7 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -572,8 +572,7 @@ void RtfExport::WriteInfo()
 
 void RtfExport::WriteUserPropType(int nType)
 {
-    Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_PROPTYPE);
-    OutULong(nType);
+    
Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_PROPTYPE).WriteNumberAsString(nType);
 }
 
 void RtfExport::WriteUserPropValue(const OUString& rValue)
@@ -751,8 +750,8 @@ void RtfExport::WritePageDescTable()
             .WriteOString(SAL_NEWLINE_STRING)
             .WriteChar('{')
             .WriteOString(OOO_STRING_SVTOOLS_RTF_PGDSC);
-        OutULong(n).WriteOString(OOO_STRING_SVTOOLS_RTF_PGDSCUSE);
-        OutULong(static_cast<sal_uLong>(rPageDesc.ReadUseOn()));
+        
Strm().WriteNumberAsString(n).WriteOString(OOO_STRING_SVTOOLS_RTF_PGDSCUSE);
+        
Strm().WriteNumberAsString(static_cast<sal_uLong>(rPageDesc.ReadUseOn()));
 
         OutPageDescription(rPageDesc, false);
 
@@ -762,7 +761,7 @@ void RtfExport::WritePageDescTable()
             if (rPageDesc.GetFollow() == &m_rDoc.GetPageDesc(--i))
                 break;
         Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_PGDSCNXT);
-        OutULong(i).WriteChar(' ');
+        Strm().WriteNumberAsString(i).WriteChar(' ');
         Strm()
             .WriteOString(msfilter::rtfutil::OutString(rPageDesc.GetName(), 
m_eDefaultEncoding))
             .WriteOString(";}");
@@ -784,7 +783,8 @@ ErrCode RtfExport::ExportDocument_Impl()
         .WriteChar('1')
         .WriteOString(OOO_STRING_SVTOOLS_RTF_ANSI);
     Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_DEFF);
-    
OutULong(m_aFontHelper.GetId(m_rDoc.GetAttrPool().GetDefaultItem(RES_CHRATR_FONT)));
+    Strm().WriteNumberAsString(
+        
m_aFontHelper.GetId(m_rDoc.GetAttrPool().GetDefaultItem(RES_CHRATR_FONT)));
     // If this not exist, MS don't understand our ansi characters (0x80-0xff).
     Strm().WriteOString("\\adeflang1025");
 
@@ -812,14 +812,14 @@ ErrCode RtfExport::ExportDocument_Impl()
     // Automatic hyphenation: it's a global setting in Word, it's a paragraph 
setting in Writer.
     // Set it's value to "auto" and disable on paragraph level, if no 
hyphenation is used there.
     Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_HYPHAUTO);
-    OutULong(1);
+    Strm().WriteOString("1");
 
     // Zoom
     SwViewShell* 
pViewShell(m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell());
     if (pViewShell && pViewShell->GetViewOptions()->GetZoomType() == 
SvxZoomType::PERCENT)
     {
         Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_VIEWSCALE);
-        OutULong(pViewShell->GetViewOptions()->GetZoom());
+        Strm().WriteNumberAsString(pViewShell->GetViewOptions()->GetZoom());
     }
     // Record changes?
     if (RedlineFlags::On & m_nOrigRedlineFlags)
@@ -886,7 +886,7 @@ ErrCode RtfExport::ExportDocument_Impl()
                         .WriteChar('{')
                         .WriteOString(OOO_STRING_SVTOOLS_RTF_IGNORE)
                         .WriteOString(OOO_STRING_SVTOOLS_RTF_PGDSCNO);
-                    OutULong(nPosInDoc).WriteChar('}');
+                    Strm().WriteNumberAsString(nPosInDoc).WriteChar('}');
                 }
             }
         }
@@ -904,29 +904,31 @@ ErrCode RtfExport::ExportDocument_Impl()
             {
                 Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_PAPERH);
                 Size a4 = SvxPaperInfo::GetPaperSize(PAPER_A4);
-                
OutULong(a4.Height()).WriteOString(OOO_STRING_SVTOOLS_RTF_PAPERW);
-                OutULong(a4.Width());
+                
Strm().WriteNumberAsString(a4.Height()).WriteOString(OOO_STRING_SVTOOLS_RTF_PAPERW);
+                Strm().WriteNumberAsString(a4.Width());
             }
             else
             {
                 Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_PAPERH);
-                
OutULong(rSz.GetHeight()).WriteOString(OOO_STRING_SVTOOLS_RTF_PAPERW);
-                OutULong(rSz.GetWidth());
+                Strm()
+                    .WriteNumberAsString(rSz.GetHeight())
+                    .WriteOString(OOO_STRING_SVTOOLS_RTF_PAPERW);
+                Strm().WriteNumberAsString(rSz.GetWidth());
             }
         }
 
         {
             const SvxLRSpaceItem& rLR = rFormatPage.GetLRSpace();
             Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_MARGL);
-            OutLong(rLR.GetLeft()).WriteOString(OOO_STRING_SVTOOLS_RTF_MARGR);
-            OutLong(rLR.GetRight());
+            
Strm().WriteNumberAsString(rLR.GetLeft()).WriteOString(OOO_STRING_SVTOOLS_RTF_MARGR);
+            Strm().WriteNumberAsString(rLR.GetRight());
         }
 
         {
             const SvxULSpaceItem& rUL = rFormatPage.GetULSpace();
             Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_MARGT);
-            OutLong(rUL.GetUpper()).WriteOString(OOO_STRING_SVTOOLS_RTF_MARGB);
-            OutLong(rUL.GetLower());
+            
Strm().WriteNumberAsString(rUL.GetUpper()).WriteOString(OOO_STRING_SVTOOLS_RTF_MARGB);
+            Strm().WriteNumberAsString(rUL.GetLower());
         }
 
         Strm()
@@ -935,7 +937,7 @@ ErrCode RtfExport::ExportDocument_Impl()
         m_pAttrOutput->SectFootnoteEndnotePr();
         // All sections are unlocked by default
         Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_SECTUNLOCKED);
-        OutLong(1);
+        Strm().WriteOString("1");
         OutPageDescription(rPageDesc, true); // Changed bCheckForFirstPage to 
true so headers
         // following title page are correctly added - i13107
         if (pSttPgDsc)
@@ -962,7 +964,7 @@ ErrCode RtfExport::ExportDocument_Impl()
         const char* pOut = FTNPOS_CHAPTER == rFootnoteInfo.m_ePos ? 
OOO_STRING_SVTOOLS_RTF_ENDDOC
                                                                   : 
OOO_STRING_SVTOOLS_RTF_FTNBJ;
         
Strm().WriteOString(pOut).WriteOString(OOO_STRING_SVTOOLS_RTF_FTNSTART);
-        OutLong(rFootnoteInfo.m_nFootnoteOffset + 1);
+        Strm().WriteNumberAsString(rFootnoteInfo.m_nFootnoteOffset + 1);
 
         switch (rFootnoteInfo.m_eNum)
         {
@@ -1009,7 +1011,7 @@ ErrCode RtfExport::ExportDocument_Impl()
             .WriteOString(OOO_STRING_SVTOOLS_RTF_AENDDOC)
             .WriteOString(OOO_STRING_SVTOOLS_RTF_AFTNRSTCONT)
             .WriteOString(OOO_STRING_SVTOOLS_RTF_AFTNSTART);
-        OutLong(rEndNoteInfo.m_nFootnoteOffset + 1);
+        Strm().WriteNumberAsString(rEndNoteInfo.m_nFootnoteOffset + 1);
 
         switch (rEndNoteInfo.m_aFormat.GetNumberingType())
         {
@@ -1180,10 +1182,6 @@ OString RtfExport::getStream()
 
 void RtfExport::resetStream() { m_pStream.reset(); }
 
-SvStream& RtfExport::OutULong(sal_uLong nVal) { return 
Writer::OutULong(Strm(), nVal); }
-
-SvStream& RtfExport::OutLong(tools::Long nVal) { return 
Writer::OutLong(Strm(), nVal); }
-
 void RtfExport::OutUnicode(const char* pToken, const OUString& rContent, bool 
bUpr)
 {
     if (rContent.isEmpty())
@@ -1202,11 +1200,11 @@ void RtfExport::OutUnicode(const char* pToken, const 
OUString& rContent, bool bU
 void RtfExport::OutDateTime(const char* pStr, const util::DateTime& rDT)
 {
     
Strm().WriteChar('{').WriteOString(pStr).WriteOString(OOO_STRING_SVTOOLS_RTF_YR);
-    OutULong(rDT.Year).WriteOString(OOO_STRING_SVTOOLS_RTF_MO);
-    OutULong(rDT.Month).WriteOString(OOO_STRING_SVTOOLS_RTF_DY);
-    OutULong(rDT.Day).WriteOString(OOO_STRING_SVTOOLS_RTF_HR);
-    OutULong(rDT.Hours).WriteOString(OOO_STRING_SVTOOLS_RTF_MIN);
-    OutULong(rDT.Minutes).WriteChar('}');
+    
Strm().WriteNumberAsString(rDT.Year).WriteOString(OOO_STRING_SVTOOLS_RTF_MO);
+    
Strm().WriteNumberAsString(rDT.Month).WriteOString(OOO_STRING_SVTOOLS_RTF_DY);
+    
Strm().WriteNumberAsString(rDT.Day).WriteOString(OOO_STRING_SVTOOLS_RTF_HR);
+    
Strm().WriteNumberAsString(rDT.Hours).WriteOString(OOO_STRING_SVTOOLS_RTF_MIN);
+    Strm().WriteNumberAsString(rDT.Minutes).WriteChar('}');
 }
 
 sal_uInt16 RtfExport::GetColor(const Color& rColor) const
@@ -1407,9 +1405,9 @@ void RtfExport::OutColorTable()
         if (n || COL_AUTO != rCol)
         {
             Strm().WriteOString(OOO_STRING_SVTOOLS_RTF_RED);
-            OutULong(rCol.GetRed()).WriteOString(OOO_STRING_SVTOOLS_RTF_GREEN);
-            
OutULong(rCol.GetGreen()).WriteOString(OOO_STRING_SVTOOLS_RTF_BLUE);
-            OutULong(rCol.GetBlue());
+            
Strm().WriteNumberAsString(rCol.GetRed()).WriteOString(OOO_STRING_SVTOOLS_RTF_GREEN);
+            
Strm().WriteNumberAsString(rCol.GetGreen()).WriteOString(OOO_STRING_SVTOOLS_RTF_BLUE);
+            Strm().WriteNumberAsString(rCol.GetBlue());
         }
         Strm().WriteChar(';');
     }
diff --git a/sw/source/filter/ww8/rtfexport.hxx 
b/sw/source/filter/ww8/rtfexport.hxx
index 3e59c432be6c..ff6ae87bd072 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -186,8 +186,6 @@ public:
     OString getStream();
     /// Return back to the real stream.
     void resetStream();
-    SvStream& OutULong(sal_uLong nVal);
-    SvStream& OutLong(tools::Long nVal);
     void OutUnicode(const char* pToken, const OUString& rContent, bool bUpr = 
false);
     void OutDateTime(const char* pStr, const css::util::DateTime& rDT);
     void OutPageDescription(const SwPageDesc& rPgDsc, bool bCheckForFirstPage);
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 32a0c49f04f3..6318348de5ec 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1353,16 +1353,6 @@ void SvStream::RefreshBuffer()
     m_isIoRead = m_isIoWrite = false;
 }
 
-SvStream& SvStream::WriteInt32AsString(sal_Int32 nInt32)
-{
-    return WriteOString(OString::number(nInt32));
-}
-
-SvStream& SvStream::WriteUInt32AsString(sal_uInt32 nUInt32)
-{
-    return WriteOString(OString::number(nUInt32));
-}
-
 #define CRYPT_BUFSIZE 1024
 
 /// Encrypt and write
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx 
b/vcl/source/filter/ipdf/pdfdocument.cxx
index 148f0bb45cf8..be6375d10675 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -255,7 +255,7 @@ sal_Int32 
PDFDocument::WriteAppearanceObject(tools::Rectangle& rSignatureRectang
 
     // Write the object content.
     SvMemoryStream aEditBuffer;
-    aEditBuffer.WriteUInt32AsString(nAppearanceId);
+    aEditBuffer.WriteNumberAsString(nAppearanceId);
     aEditBuffer.WriteOString(" 0 obj\n");
     aEditBuffer.WriteOString("<</Type/XObject\n/Subtype/Form\n");
 
@@ -269,9 +269,9 @@ sal_Int32 
PDFDocument::WriteAppearanceObject(tools::Rectangle& rSignatureRectang
     }
 
     aEditBuffer.WriteOString("/BBox[0 0 ");
-    
aEditBuffer.WriteOString(OString::number(rSignatureRectangle.getOpenWidth()));
+    aEditBuffer.WriteNumberAsString(rSignatureRectangle.getOpenWidth());
     aEditBuffer.WriteOString(" ");
-    
aEditBuffer.WriteOString(OString::number(rSignatureRectangle.getOpenHeight()));
+    aEditBuffer.WriteNumberAsString(rSignatureRectangle.getOpenHeight());
     aEditBuffer.WriteOString("]\n/Length ");
 
     // Add the object to the doc-level edit buffer and update the offset.
@@ -282,7 +282,7 @@ sal_Int32 
PDFDocument::WriteAppearanceObject(tools::Rectangle& rSignatureRectang
     {
         nLength = PDFObjectCopier::copyPageStreams(aContentStreams, aStream, 
bCompressed);
     }
-    aEditBuffer.WriteOString(OString::number(nLength));
+    aEditBuffer.WriteNumberAsString(nLength);
     if (bCompressed)
     {
         aEditBuffer.WriteOString(" /Filter/FlateDecode");
@@ -321,29 +321,29 @@ sal_Int32 PDFDocument::WriteAnnotObject(PDFObjectElement 
const& rFirstPage, sal_
     aAnnotEntry.SetOffset(m_aEditBuffer.Tell());
     aAnnotEntry.SetDirty(true);
     m_aXRef[nAnnotId] = aAnnotEntry;
-    m_aEditBuffer.WriteUInt32AsString(nAnnotId);
+    m_aEditBuffer.WriteNumberAsString(nAnnotId);
     m_aEditBuffer.WriteOString(" 0 obj\n");
     m_aEditBuffer.WriteOString("<</Type/Annot/Subtype/Widget/F 132\n");
     m_aEditBuffer.WriteOString("/Rect[0 0 ");
-    
m_aEditBuffer.WriteOString(OString::number(rSignatureRectangle.getOpenWidth()));
+    m_aEditBuffer.WriteNumberAsString(rSignatureRectangle.getOpenWidth());
     m_aEditBuffer.WriteOString(" ");
-    
m_aEditBuffer.WriteOString(OString::number(rSignatureRectangle.getOpenHeight()));
+    m_aEditBuffer.WriteNumberAsString(rSignatureRectangle.getOpenHeight());
     m_aEditBuffer.WriteOString("]\n");
     m_aEditBuffer.WriteOString("/FT/Sig\n");
     m_aEditBuffer.WriteOString("/P ");
-    m_aEditBuffer.WriteUInt32AsString(rFirstPage.GetObjectValue());
+    m_aEditBuffer.WriteNumberAsString(rFirstPage.GetObjectValue());
     m_aEditBuffer.WriteOString(" 0 R\n");
     m_aEditBuffer.WriteOString("/T(Signature");
-    m_aEditBuffer.WriteUInt32AsString(nNextSignature);
+    m_aEditBuffer.WriteNumberAsString(nNextSignature);
     m_aEditBuffer.WriteOString(")\n");
     m_aEditBuffer.WriteOString("/V ");
-    m_aEditBuffer.WriteUInt32AsString(nSignatureId);
+    m_aEditBuffer.WriteNumberAsString(nSignatureId);
     m_aEditBuffer.WriteOString(" 0 R\n");
     m_aEditBuffer.WriteOString("/DV ");
-    m_aEditBuffer.WriteUInt32AsString(nSignatureId);
+    m_aEditBuffer.WriteNumberAsString(nSignatureId);
     m_aEditBuffer.WriteOString(" 0 R\n");
     m_aEditBuffer.WriteOString("/AP<<\n/N ");
-    m_aEditBuffer.WriteInt32AsString(nAppearanceId);
+    m_aEditBuffer.WriteNumberAsString(nAppearanceId);
     m_aEditBuffer.WriteOString(" 0 R\n>>\n");
     m_aEditBuffer.WriteOString(">>\nendobj\n\n");
 
@@ -368,7 +368,7 @@ bool PDFDocument::WritePageObject(PDFObjectElement& 
rFirstPage, sal_Int32 nAnnot
         m_aXRef[nAnnotsId].SetType(XRefEntryType::NOT_COMPRESSED);
         m_aXRef[nAnnotsId].SetOffset(m_aEditBuffer.Tell());
         m_aXRef[nAnnotsId].SetDirty(true);
-        m_aEditBuffer.WriteUInt32AsString(nAnnotsId);
+        m_aEditBuffer.WriteNumberAsString(nAnnotsId);
         m_aEditBuffer.WriteOString(" 0 obj\n[");
 
         // Write existing references.
@@ -387,12 +387,12 @@ bool PDFDocument::WritePageObject(PDFObjectElement& 
rFirstPage, sal_Int32 nAnnot
 
             if (i)
                 m_aEditBuffer.WriteOString(" ");
-            m_aEditBuffer.WriteUInt32AsString(pReference->GetObjectValue());
+            m_aEditBuffer.WriteNumberAsString(pReference->GetObjectValue());
             m_aEditBuffer.WriteOString(" 0 R");
         }
         // Write our reference.
         m_aEditBuffer.WriteOString(" ");
-        m_aEditBuffer.WriteUInt32AsString(nAnnotId);
+        m_aEditBuffer.WriteNumberAsString(nAnnotId);
         m_aEditBuffer.WriteOString(" 0 R");
 
         m_aEditBuffer.WriteOString("]\nendobj\n\n");
@@ -408,7 +408,7 @@ bool PDFDocument::WritePageObject(PDFObjectElement& 
rFirstPage, sal_Int32 nAnnot
         }
         m_aXRef[nFirstPageId].SetOffset(m_aEditBuffer.Tell());
         m_aXRef[nFirstPageId].SetDirty(true);
-        m_aEditBuffer.WriteUInt32AsString(nFirstPageId);
+        m_aEditBuffer.WriteNumberAsString(nFirstPageId);
         m_aEditBuffer.WriteOString(" 0 obj\n");
         m_aEditBuffer.WriteOString("<<");
         auto pAnnotsArray = dynamic_cast<PDFArrayElement*>(pAnnots);
@@ -419,7 +419,7 @@ bool PDFDocument::WritePageObject(PDFObjectElement& 
rFirstPage, sal_Int32 nAnnot
                                          + rFirstPage.GetDictionaryOffset(),
                                      rFirstPage.GetDictionaryLength());
             m_aEditBuffer.WriteOString("/Annots[");
-            m_aEditBuffer.WriteUInt32AsString(nAnnotId);
+            m_aEditBuffer.WriteNumberAsString(nAnnotId);
             m_aEditBuffer.WriteOString(" 0 R]");
         }
         else
@@ -436,7 +436,7 @@ bool PDFDocument::WritePageObject(PDFObjectElement& 
rFirstPage, sal_Int32 nAnnot
                                          + rFirstPage.GetDictionaryOffset(),
                                      nAnnotsBeforeEndLength);
             m_aEditBuffer.WriteOString(" ");
-            m_aEditBuffer.WriteUInt32AsString(nAnnotId);
+            m_aEditBuffer.WriteNumberAsString(nAnnotId);
             m_aEditBuffer.WriteOString(" 0 R");
             // Length of Annots end -> end of the dictionary.
             sal_uInt64 nAnnotsAfterEndLength = rFirstPage.GetDictionaryOffset()
@@ -499,7 +499,7 @@ bool PDFDocument::WriteCatalogObject(sal_Int32 nAnnotId, 
PDFReferenceElement*& p
         m_aXRef[nAcroFormId].SetType(XRefEntryType::NOT_COMPRESSED);
         m_aXRef[nAcroFormId].SetOffset(m_aEditBuffer.Tell());
         m_aXRef[nAcroFormId].SetDirty(true);
-        m_aEditBuffer.WriteUInt32AsString(nAcroFormId);
+        m_aEditBuffer.WriteNumberAsString(nAcroFormId);
         m_aEditBuffer.WriteOString(" 0 obj\n");
 
         // If this is nullptr, then the AcroForm object is not in an object 
stream.
@@ -539,7 +539,7 @@ bool PDFDocument::WriteCatalogObject(sal_Int32 nAnnotId, 
PDFReferenceElement*& p
 
         // Append our reference at the end of the Fields array.
         m_aEditBuffer.WriteOString(" ");
-        m_aEditBuffer.WriteUInt32AsString(nAnnotId);
+        m_aEditBuffer.WriteNumberAsString(nAnnotId);
         m_aEditBuffer.WriteOString(" 0 R");
 
         // Length of Fields end -> end of the object dictionary.
@@ -569,7 +569,7 @@ bool PDFDocument::WriteCatalogObject(sal_Int32 nAnnotId, 
PDFReferenceElement*& p
         auto pAcroFormDictionary = 
dynamic_cast<PDFDictionaryElement*>(pAcroForm);
         m_aXRef[nCatalogId].SetOffset(m_aEditBuffer.Tell());
         m_aXRef[nCatalogId].SetDirty(true);
-        m_aEditBuffer.WriteUInt32AsString(nCatalogId);
+        m_aEditBuffer.WriteNumberAsString(nCatalogId);
         m_aEditBuffer.WriteOString(" 0 obj\n");
         m_aEditBuffer.WriteOString("<<");
         if (!pAcroFormDictionary)
@@ -579,7 +579,7 @@ bool PDFDocument::WriteCatalogObject(sal_Int32 nAnnotId, 
PDFReferenceElement*& p
                                          + pCatalog->GetDictionaryOffset(),
                                      pCatalog->GetDictionaryLength());
             m_aEditBuffer.WriteOString("/AcroForm<</Fields[\n");
-            m_aEditBuffer.WriteUInt32AsString(nAnnotId);
+            m_aEditBuffer.WriteNumberAsString(nAnnotId);
             m_aEditBuffer.WriteOString(" 0 R\n]/SigFlags 3>>\n");
         }
         else
@@ -608,7 +608,7 @@ bool PDFDocument::WriteCatalogObject(sal_Int32 nAnnotId, 
PDFReferenceElement*& p
                                          + pCatalog->GetDictionaryOffset(),
                                      nFieldsBeforeEndLength);
             m_aEditBuffer.WriteOString(" ");
-            m_aEditBuffer.WriteUInt32AsString(nAnnotId);
+            m_aEditBuffer.WriteNumberAsString(nAnnotId);
             m_aEditBuffer.WriteOString(" 0 R");
             // Length of Fields end -> end of the Catalog dictionary.
             sal_uInt64 nFieldsAfterEndLength = pCatalog->GetDictionaryOffset()
@@ -700,7 +700,7 @@ void PDFDocument::WriteXRef(sal_uInt64 nXRefOffset, 
PDFReferenceElement const* p
             aXRefStream.WriteBytes(aFilteredLine.data(), aFilteredLine.size());
         }
 
-        m_aEditBuffer.WriteUInt32AsString(nXRefStreamId);
+        m_aEditBuffer.WriteNumberAsString(nXRefStreamId);
         m_aEditBuffer.WriteOString(
             " 0 obj\n<</DecodeParms<</Columns 5/Predictor 
12>>/Filter/FlateDecode");
 
@@ -730,7 +730,7 @@ void PDFDocument::WriteXRef(sal_uInt64 nXRefOffset, 
PDFReferenceElement const* p
             if (!rXRef.second.GetDirty())
                 continue;
 
-            m_aEditBuffer.WriteUInt32AsString(rXRef.first);
+            m_aEditBuffer.WriteNumberAsString(rXRef.first);
             m_aEditBuffer.WriteOString(" 1 ");
         }
         m_aEditBuffer.WriteOString("] ");
@@ -740,9 +740,9 @@ void PDFDocument::WriteXRef(sal_uInt64 nXRefOffset, 
PDFReferenceElement const* p
         if (pInfo)
         {
             m_aEditBuffer.WriteOString("/Info ");
-            m_aEditBuffer.WriteUInt32AsString(pInfo->GetObjectValue());
+            m_aEditBuffer.WriteNumberAsString(pInfo->GetObjectValue());
             m_aEditBuffer.WriteOString(" ");
-            m_aEditBuffer.WriteUInt32AsString(pInfo->GetGenerationValue());
+            m_aEditBuffer.WriteNumberAsString(pInfo->GetGenerationValue());
             m_aEditBuffer.WriteOString(" R ");
         }
 
@@ -760,25 +760,25 @@ void PDFDocument::WriteXRef(sal_uInt64 nXRefOffset, 
PDFReferenceElement const* p
             aStream.Seek(0);
             aXRefStream.WriteStream(aStream);
         }
-        m_aEditBuffer.WriteUInt32AsString(aXRefStream.GetSize());
+        m_aEditBuffer.WriteNumberAsString(aXRefStream.GetSize());
 
         if (!m_aStartXRefs.empty())
         {
             // Write location of the previous cross-reference section.
             m_aEditBuffer.WriteOString("/Prev ");
-            m_aEditBuffer.WriteUInt32AsString(m_aStartXRefs.back());
+            m_aEditBuffer.WriteNumberAsString(m_aStartXRefs.back());
         }
 
         // Root.
         m_aEditBuffer.WriteOString("/Root ");
-        m_aEditBuffer.WriteUInt32AsString(pRoot->GetObjectValue());
+        m_aEditBuffer.WriteNumberAsString(pRoot->GetObjectValue());
         m_aEditBuffer.WriteOString(" ");
-        m_aEditBuffer.WriteUInt32AsString(pRoot->GetGenerationValue());
+        m_aEditBuffer.WriteNumberAsString(pRoot->GetGenerationValue());
         m_aEditBuffer.WriteOString(" R ");
 
         // Size.
         m_aEditBuffer.WriteOString("/Size ");
-        m_aEditBuffer.WriteUInt32AsString(m_aXRef.size());
+        m_aEditBuffer.WriteNumberAsString(m_aXRef.size());
 
         m_aEditBuffer.WriteOString("/Type/XRef/W[1 3 1]>>\nstream\n");
         aXRefStream.Seek(0);
@@ -796,7 +796,7 @@ void PDFDocument::WriteXRef(sal_uInt64 nXRefOffset, 
PDFReferenceElement const* p
             if (!rXRef.second.GetDirty())
                 continue;
 
-            m_aEditBuffer.WriteUInt32AsString(nObject);
+            m_aEditBuffer.WriteNumberAsString(nObject);
             m_aEditBuffer.WriteOString(" 1\n");
             OStringBuffer aBuffer = 
OString::number(static_cast<sal_Int32>(nOffset));
             while (aBuffer.getLength() < 10)
@@ -810,19 +810,19 @@ void PDFDocument::WriteXRef(sal_uInt64 nXRefOffset, 
PDFReferenceElement const* p
 
         // Write the trailer.
         m_aEditBuffer.WriteOString("trailer\n<</Size ");
-        m_aEditBuffer.WriteUInt32AsString(m_aXRef.size());
+        m_aEditBuffer.WriteNumberAsString(m_aXRef.size());
         m_aEditBuffer.WriteOString("/Root ");
-        m_aEditBuffer.WriteUInt32AsString(pRoot->GetObjectValue());
+        m_aEditBuffer.WriteNumberAsString(pRoot->GetObjectValue());
         m_aEditBuffer.WriteOString(" ");
-        m_aEditBuffer.WriteUInt32AsString(pRoot->GetGenerationValue());
+        m_aEditBuffer.WriteNumberAsString(pRoot->GetGenerationValue());
         m_aEditBuffer.WriteOString(" R\n");
         auto pInfo = 
dynamic_cast<PDFReferenceElement*>(m_pTrailer->Lookup("Info"));
         if (pInfo)
         {
             m_aEditBuffer.WriteOString("/Info ");
-            m_aEditBuffer.WriteUInt32AsString(pInfo->GetObjectValue());
+            m_aEditBuffer.WriteNumberAsString(pInfo->GetObjectValue());
             m_aEditBuffer.WriteOString(" ");
-            m_aEditBuffer.WriteUInt32AsString(pInfo->GetGenerationValue());
+            m_aEditBuffer.WriteNumberAsString(pInfo->GetGenerationValue());
             m_aEditBuffer.WriteOString(" R\n");
         }
         auto pID = dynamic_cast<PDFArrayElement*>(m_pTrailer->Lookup("ID"));
@@ -847,7 +847,7 @@ void PDFDocument::WriteXRef(sal_uInt64 nXRefOffset, 
PDFReferenceElement const* p
         {
             // Write location of the previous cross-reference section.
             m_aEditBuffer.WriteOString("/Prev ");
-            m_aEditBuffer.WriteUInt32AsString(m_aStartXRefs.back());
+            m_aEditBuffer.WriteNumberAsString(m_aStartXRefs.back());
         }
 
         m_aEditBuffer.WriteOString(">>\n");
@@ -907,7 +907,7 @@ bool PDFDocument::Sign(const 
uno::Reference<security::XCertificate>& xCertificat
 
     // Write startxref.
     m_aEditBuffer.WriteOString("startxref\n");
-    m_aEditBuffer.WriteUInt32AsString(nXRefOffset);
+    m_aEditBuffer.WriteNumberAsString(nXRefOffset);
     m_aEditBuffer.WriteOString("\n%%EOF\n");
 
     // Finalize the signature, now that we know the total file size.

Reply via email to