From ebdc36c12dbdd8bc2305adabf83c95c666f7b04f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 24 Sep 2014 20:14:01 +0200 Subject: [PATCH] SvStream - rename WriteNumber methods to Write?Int32AsString. Since the original name was so generic as to be meaningless. Change-Id: Iaaaf592904af51f2b9988fa8efb344c1b2bf9b0f --- dbaccess/source/ui/misc/TokenWriter.cxx | 18 +++++----- editeng/source/editeng/impedit4.cxx | 48 ++++++++++++------------- include/tools/stream.hxx | 4 +-- tools/source/stream/stream.cxx | 4 +-- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index 994909ec6476..65c18bb2a066 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -392,7 +392,7 @@ bool ORTFImportExport::Write() for(sal_Int32 j=0; jWriteCharPtr( "\\f" ); - m_pStream->WriteNumber(j); + m_pStream->WriteInt32AsString(j); m_pStream->WriteCharPtr( "\\fcharset0\\fnil " ); m_pStream->WriteCharPtr( comphelper::string::getToken(aFonts, j, ';').getStr() ); m_pStream->WriteChar( ';' ); @@ -401,11 +401,11 @@ bool ORTFImportExport::Write() m_pStream->WriteCharPtr( SAL_NEWLINE_STRING ); // write the rtf color table m_pStream->WriteChar( '{' ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_COLORTBL ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_RED ); - m_pStream->WriteNumber(static_cast(aColor.GetRed())); + m_pStream->WriteUInt32AsString(aColor.GetRed()); m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_GREEN ); - m_pStream->WriteNumber(static_cast(aColor.GetGreen())); + m_pStream->WriteUInt32AsString(aColor.GetGreen()); m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_BLUE ); - m_pStream->WriteNumber(static_cast(aColor.GetBlue())); + m_pStream->WriteUInt32AsString(aColor.GetBlue()); m_pStream->WriteCharPtr( ";\\red255\\green255\\blue255;\\red192\\green192\\blue192;}" ) .WriteCharPtr( SAL_NEWLINE_STRING ); @@ -415,7 +415,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->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TRGAPH ); - m_pStream->WriteNumber(static_cast(40)); + m_pStream->WriteInt32AsString(40); m_pStream->WriteCharPtr( SAL_NEWLINE_STRING ); if(m_xObject.is()) @@ -436,7 +436,7 @@ bool ORTFImportExport::Write() for( sal_Int32 i=1; i<=nCount; ++i ) { m_pStream->WriteCharPtr( aCell1 ); - m_pStream->WriteNumber(i*CELL_X); + m_pStream->WriteInt32AsString(i*CELL_X); m_pStream->WriteCharPtr( SAL_NEWLINE_STRING ); } @@ -542,7 +542,7 @@ void ORTFImportExport::appendRow(OString* pHorzChar,sal_Int32 _nColumnCount,sal_ { ++kk; m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TROWD ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TRGAPH ); - m_pStream->WriteNumber(static_cast(40)); + m_pStream->WriteInt32AsString(40); m_pStream->WriteCharPtr( SAL_NEWLINE_STRING ); static char const aCell2[] = "\\clbrdrl\\brdrs\\brdrcf2\\clbrdrt\\brdrs\\brdrcf2\\clbrdrb\\brdrs\\brdrcf2\\clbrdrr\\brdrs\\brdrcf2\\clshdng10000\\clcfpat1\\cellx"; @@ -551,7 +551,7 @@ void ORTFImportExport::appendRow(OString* pHorzChar,sal_Int32 _nColumnCount,sal_ for ( sal_Int32 i=1; i<=_nColumnCount; ++i ) { m_pStream->WriteCharPtr( aCell2 ); - m_pStream->WriteNumber(i*CELL_X); + m_pStream->WriteInt32AsString(i*CELL_X); m_pStream->WriteCharPtr( SAL_NEWLINE_STRING ); } @@ -715,7 +715,7 @@ void OHTMLImportExport::WriteBody() m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_HTML_body ).WriteCharPtr( " { " ).WriteCharPtr( sFontFamily ).WriteChar( '"' ).WriteCharPtr( OUStringToOString(m_aFont.Name, osl_getThreadTextEncoding()).getStr() ).WriteChar( '\"' ); // TODO : think about the encoding of the font name m_pStream->WriteCharPtr( "; " ).WriteCharPtr( sFontSize ); - m_pStream->WriteNumber(static_cast(m_aFont.Height)); + m_pStream->WriteInt32AsString(m_aFont.Height); m_pStream->WriteChar( '}' ); OUT_LF(); diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index bc1986abb535..38c04623f9a9 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -369,7 +369,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) SvxFontItem* pFontItem = aFontTable[ j ]; rOutput.WriteChar( '{' ); rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_F ); - rOutput.WriteNumber( static_cast( j ) ); + rOutput.WriteUInt32AsString( j ); switch ( pFontItem->GetFamily() ) { case FAMILY_DONTKNOW: rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_FNIL ); @@ -396,14 +396,14 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) default: break; } - rOutput.WriteNumber( static_cast( nVal ) ); + rOutput.WriteUInt32AsString( nVal ); rtl_TextEncoding eChrSet = pFontItem->GetCharSet(); DBG_ASSERT( eChrSet != 9, "SystemCharSet?!" ); if( RTL_TEXTENCODING_DONTKNOW == eChrSet ) eChrSet = osl_getThreadTextEncoding(); rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_FCHARSET ); - rOutput.WriteNumber( static_cast( rtl_getBestWindowsCharsetFromTextEncoding( eChrSet ) ) ); + rOutput.WriteUInt32AsString( rtl_getBestWindowsCharsetFromTextEncoding( eChrSet ) ); rOutput.WriteChar( ' ' ); RTFOutFuncs::Out_String( rOutput, pFontItem->GetFamilyName(), eDestEnc ); @@ -443,11 +443,11 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) if (color != COL_AUTO) // auto is represented by "empty" element { rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_RED ); - rOutput.WriteNumber( static_cast(color.GetRed()) ); + rOutput.WriteUInt32AsString( color.GetRed() ); rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_GREEN ); - rOutput.WriteNumber( static_cast(color.GetGreen()) ); + rOutput.WriteUInt32AsString( color.GetGreen() ); rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_BLUE ); - rOutput.WriteNumber( static_cast(color.GetBlue()) ); + rOutput.WriteUInt32AsString( color.GetBlue() ); } rOutput.WriteChar( ';' ); } @@ -482,7 +482,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) rOutput << endl; rOutput.WriteChar( '{' ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_S ); sal_uInt32 nNumber = nStyle + 1; - rOutput.WriteNumber( nNumber ); + rOutput.WriteUInt32AsString( nNumber ); // Attribute, alos from Parent! for ( sal_uInt16 nParAttr = EE_PARA_START; nParAttr <= EE_CHAR_END; nParAttr++ ) @@ -501,7 +501,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) DBG_ASSERT( pParent, "Parent not found!" ); rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_SBASEDON ); nNumber = aStyleSheetToIdMap.find(pParent)->second; - rOutput.WriteNumber( nNumber ); + rOutput.WriteUInt32AsString( nNumber ); } // Next Style ... (more) @@ -513,7 +513,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) DBG_ASSERT( pNext, "Next ot found!" ); rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_SNEXT ); nNumber = aStyleSheetToIdMap.find(pNext)->second; - rOutput.WriteNumber( nNumber ); + rOutput.WriteUInt32AsString( nNumber ); // Name of the template ... rOutput.WriteCharPtr( " " ).WriteCharPtr( OUStringToOString(pStyle->GetName(), eDestEnc).getStr() ); @@ -540,7 +540,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) Point( aEditDoc.GetDefTab(), 0 ), &GetRefMapMode(), &aTwpMode ).X(); rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_DEFTAB ); - rOutput.WriteNumber( static_cast( nDefTabTwps ) ); + rOutput.WriteUInt32AsString( nDefTabTwps ); rOutput << endl; // iterate over the paragraphs ... @@ -559,7 +559,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel ) // Number of template rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_S ); sal_uInt32 nNumber = aStyleSheetToIdMap.find(pNode->GetStyleSheet())->second; - rOutput.WriteNumber( nNumber ); + rOutput.WriteUInt32AsString( nNumber ); // All Attribute // Attribute, also from Parent! @@ -715,7 +715,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, if( nLevel >= 0 ) { rOutput.WriteCharPtr( "\\level" ); - rOutput.WriteNumber( nLevel ); + rOutput.WriteInt32AsString( nLevel ); } } break; @@ -725,15 +725,15 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_FI ); sal_Int32 nTxtFirst = ((const SvxLRSpaceItem&)rItem).GetTxtFirstLineOfst(); nTxtFirst = LogicToTwips( nTxtFirst ); - rOutput.WriteNumber( nTxtFirst ); + rOutput.WriteInt32AsString( nTxtFirst ); rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_LI ); sal_uInt32 nTxtLeft = static_cast< sal_uInt32 >(((const SvxLRSpaceItem&)rItem).GetTxtLeft()); nTxtLeft = (sal_uInt32)LogicToTwips( nTxtLeft ); - rOutput.WriteNumber( nTxtLeft ); + rOutput.WriteInt32AsString( nTxtLeft ); rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_RI ); sal_uInt32 nTxtRight = ((const SvxLRSpaceItem&)rItem).GetRight(); nTxtRight = LogicToTwips( nTxtRight); - rOutput.WriteNumber( nTxtRight ); + rOutput.WriteUInt32AsString( nTxtRight ); } break; case EE_PARA_ULSPACE: @@ -741,11 +741,11 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_SB ); sal_uInt32 nUpper = ((const SvxULSpaceItem&)rItem).GetUpper(); nUpper = (sal_uInt32)LogicToTwips( nUpper ); - rOutput.WriteNumber( nUpper ); + rOutput.WriteUInt32AsString( nUpper ); rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_SA ); sal_uInt32 nLower = ((const SvxULSpaceItem&)rItem).GetLower(); nLower = LogicToTwips( nLower ); - rOutput.WriteNumber( nLower ); + rOutput.WriteUInt32AsString( nLower ); } break; case EE_PARA_SBL: @@ -762,7 +762,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, nVal /= 100; cMult = '1'; } - rOutput.WriteNumber( nVal ); + rOutput.WriteInt32AsString( nVal ); rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_SLMULT ).WriteChar( cMult ); } break; @@ -787,7 +787,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, { const SvxTabStop& rTab = rTabs[i]; rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_TX ); - rOutput.WriteNumber( LogicToTwips( rTab.GetTabPos() ) ); + rOutput.WriteInt32AsString( LogicToTwips( rTab.GetTabPos() ) ); } } break; @@ -799,7 +799,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, assert(iter != rColorList.end()); sal_uInt32 const n = iter - rColorList.begin(); rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_CF ); - rOutput.WriteNumber( n ); + rOutput.WriteUInt32AsString( n ); } break; case EE_CHAR_FONTINFO: @@ -817,7 +817,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, } rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_F ); - rOutput.WriteNumber( n ); + rOutput.WriteUInt32AsString( n ); } break; case EE_CHAR_FONTHEIGHT: @@ -829,7 +829,7 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, nHeight = LogicToTwips( nHeight ); // Twips => HalfPoints nHeight /= 10; - rOutput.WriteNumber( nHeight ); + rOutput.WriteInt32AsString( nHeight ); } break; case EE_CHAR_WEIGHT: @@ -949,14 +949,14 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& rItem, SvStream& rOutput, case EE_CHAR_KERNING: { rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_EXPNDTW ); - rOutput.WriteNumber( LogicToTwips( + rOutput.WriteInt32AsString( LogicToTwips( ((const SvxKerningItem&)rItem).GetValue() ) ); } break; case EE_CHAR_PAIRKERNING: { rOutput.WriteCharPtr( OOO_STRING_SVTOOLS_RTF_KERNING ); - rOutput.WriteNumber( static_cast(((const SvxAutoKernItem&)rItem).GetValue() ? 1 : 0 )); + rOutput.WriteUInt32AsString( ((const SvxAutoKernItem&)rItem).GetValue() ? 1 : 0 ); } break; case EE_CHAR_ESCAPEMENT: diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx index 920b1bf856b8..19dae556192f 100644 --- a/include/tools/stream.hxx +++ b/include/tools/stream.hxx @@ -326,8 +326,8 @@ public: SvStream& WriteDouble( const double& rDouble ); SvStream& WriteCharPtr( const char* pBuf ); - SvStream& WriteNumber( sal_uInt32 nUInt32 ); - SvStream& WriteNumber( sal_Int32 nInt32 ); + SvStream& WriteUInt32AsString( sal_uInt32 nUInt32 ); + SvStream& WriteInt32AsString( sal_Int32 nInt32 ); sal_Size Read( void* pData, sal_Size nSize ); sal_Size Write( const void* pData, sal_Size nSize ); diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 1109bd80a611..1a9ee6b28929 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1506,7 +1506,7 @@ void SvStream::RefreshBuffer() bIoRead = bIoWrite = false; } -SvStream& SvStream::WriteNumber(sal_Int32 nInt32) +SvStream& SvStream::WriteInt32AsString(sal_Int32 nInt32) { char buffer[12]; sal_Size nLen = sprintf(buffer, "%" SAL_PRIdINT32, nInt32); @@ -1514,7 +1514,7 @@ SvStream& SvStream::WriteNumber(sal_Int32 nInt32) return *this; } -SvStream& SvStream::WriteNumber(sal_uInt32 nUInt32) +SvStream& SvStream::WriteUInt32AsString(sal_uInt32 nUInt32) { char buffer[11]; sal_Size nLen = sprintf(buffer, "%" SAL_PRIuUINT32, nUInt32);