diff options
author | Tor Lillqvist <tml@collabora.com> | 2013-10-13 13:45:17 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2013-10-13 13:49:24 +0300 |
commit | 6954aad4e5c99ce193d3dd60a43f6d41d7c0a87f (patch) | |
tree | ffba0bee05b37a70311ae198281f420600e30127 /sc | |
parent | 8ede32d15735b78e3528107bfbcfb69e3beb7439 (diff) |
Reduce copypasta: Introduce SAL_NEWLINE_STRING and use it
Contains the platform-dependent on-disk line separator ("\r\n" for Windows,
"\n" otherwise, and yes, I assume an ASCII-based world).
Use it instead of static constant char array fields, with ifdeffed
initialisations, in various classes here and there.
Change-Id: Ibea1f2cc1acfb8cc067c3892a41f73bf44f2c78a
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/html/htmlexp.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/html/htmlexp2.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/inc/expbase.hxx | 3 | ||||
-rw-r--r-- | sc/source/filter/rtf/expbase.cxx | 7 | ||||
-rw-r--r-- | sc/source/filter/rtf/rtfexp.cxx | 16 |
5 files changed, 14 insertions, 24 deletions
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 9063b51c74af..e161e0d857db 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -116,12 +116,12 @@ const sal_Char ScHTMLExport::sIndentSource[nIndentMax+1] = #define TAG_ON( tag ) HTMLOutFuncs::Out_AsciiTag( rStrm, tag ) #define TAG_OFF( tag ) HTMLOutFuncs::Out_AsciiTag( rStrm, tag, false ) #define OUT_STR( str ) HTMLOutFuncs::Out_String( rStrm, str, eDestEnc, &aNonConvertibleChars ) -#define OUT_LF() rStrm << ScExportBase::sNewLine << GetIndentStr() -#define TAG_ON_LF( tag ) (TAG_ON( tag ) << ScExportBase::sNewLine << GetIndentStr()) -#define TAG_OFF_LF( tag ) (TAG_OFF( tag ) << ScExportBase::sNewLine << GetIndentStr()) +#define OUT_LF() rStrm << SAL_NEWLINE_STRING << GetIndentStr() +#define TAG_ON_LF( tag ) (TAG_ON( tag ) << SAL_NEWLINE_STRING << GetIndentStr()) +#define TAG_OFF_LF( tag ) (TAG_OFF( tag ) << SAL_NEWLINE_STRING << GetIndentStr()) #define OUT_HR() TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_horzrule ) #define OUT_COMMENT( comment ) (rStrm << sMyBegComment, OUT_STR( comment ) \ - << sMyEndComment << ScExportBase::sNewLine \ + << sMyEndComment << SAL_NEWLINE_STRING \ << GetIndentStr()) #define OUT_SP_CSTR_ASS( s ) rStrm << ' ' << s << '=' @@ -317,7 +317,7 @@ Size ScHTMLExport::MMToPixel( const Size& rSize ) sal_uLong ScHTMLExport::Write() { rStrm << '<' << OOO_STRING_SVTOOLS_HTML_doctype << ' ' << OOO_STRING_SVTOOLS_HTML_doctype40 << '>' - << sNewLine << sNewLine; + << SAL_NEWLINE_STRING << SAL_NEWLINE_STRING; TAG_ON_LF( OOO_STRING_SVTOOLS_HTML_html ); WriteHeader(); OUT_LF(); diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx index a5bce9c71e09..ad2e6b7a0901 100644 --- a/sc/source/filter/html/htmlexp2.cxx +++ b/sc/source/filter/html/htmlexp2.cxx @@ -233,7 +233,7 @@ void ScHTMLExport::WriteImage( OUString& rLinkName, const Graphic& rGrf, rLinkName ), eDestEnc ) << '\"'; if ( !rImgOptions.isEmpty() ) rStrm << rImgOptions.getStr(); - rStrm << '>' << sNewLine << GetIndentStr(); + rStrm << '>' << SAL_NEWLINE_STRING << GetIndentStr(); } } diff --git a/sc/source/filter/inc/expbase.hxx b/sc/source/filter/inc/expbase.hxx index 92ebf3aae6d4..4e957296cdb7 100644 --- a/sc/source/filter/inc/expbase.hxx +++ b/sc/source/filter/inc/expbase.hxx @@ -30,9 +30,6 @@ class ScFieldEditEngine; class ScExportBase { -public: - static const sal_Char sNewLine[]; - protected: SvStream& rStrm; diff --git a/sc/source/filter/rtf/expbase.cxx b/sc/source/filter/rtf/expbase.cxx index f43adb389c8e..eed1a785107a 100644 --- a/sc/source/filter/rtf/expbase.cxx +++ b/sc/source/filter/rtf/expbase.cxx @@ -24,13 +24,6 @@ //------------------------------------------------------------------ -#ifdef _WIN32 -const sal_Char ScExportBase::sNewLine[] = "\015\012"; -#else -const sal_Char ScExportBase::sNewLine[] = "\012"; -#endif - - ScExportBase::ScExportBase( SvStream& rStrmP, ScDocument* pDocP, const ScRange& rRangeP ) : diff --git a/sc/source/filter/rtf/rtfexp.cxx b/sc/source/filter/rtf/rtfexp.cxx index 14153c03fe0b..bb024e066293 100644 --- a/sc/source/filter/rtf/rtfexp.cxx +++ b/sc/source/filter/rtf/rtfexp.cxx @@ -69,7 +69,7 @@ ScRTFExport::~ScRTFExport() sal_uLong ScRTFExport::Write() { rStrm << '{' << OOO_STRING_SVTOOLS_RTF_RTF; - rStrm << OOO_STRING_SVTOOLS_RTF_ANSI << sNewLine; + rStrm << OOO_STRING_SVTOOLS_RTF_ANSI << SAL_NEWLINE_STRING; // Daten for ( SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab(); nTab++ ) @@ -79,14 +79,14 @@ sal_uLong ScRTFExport::Write() WriteTab( nTab ); } - rStrm << '}' << sNewLine; + rStrm << '}' << SAL_NEWLINE_STRING; return rStrm.GetError(); } void ScRTFExport::WriteTab( SCTAB nTab ) { - rStrm << '{' << sNewLine; + rStrm << '{' << SAL_NEWLINE_STRING; if ( pDoc->HasTable( nTab ) ) { memset( &pCellX[0], 0, (MAXCOL+2) * sizeof(sal_uLong) ); @@ -103,7 +103,7 @@ void ScRTFExport::WriteTab( SCTAB nTab ) WriteRow( nTab, nRow ); } } - rStrm << '}' << sNewLine; + rStrm << '}' << SAL_NEWLINE_STRING; } @@ -143,9 +143,9 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow ) rStrm << OOO_STRING_SVTOOLS_RTF_CELLX << OString::number(pCellX[nCol+1]).getStr(); if ( (nCol & 0x0F) == 0x0F ) - rStrm << sNewLine; // Zeilen nicht zu lang werden lassen + rStrm << SAL_NEWLINE_STRING; // Zeilen nicht zu lang werden lassen } - rStrm << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_PLAIN << OOO_STRING_SVTOOLS_RTF_INTBL << sNewLine; + rStrm << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_PLAIN << OOO_STRING_SVTOOLS_RTF_INTBL << SAL_NEWLINE_STRING; sal_uLong nStrmPos = rStrm.Tell(); for ( nCol = aRange.aStart.Col(); nCol <= nEndCol; nCol++ ) @@ -153,11 +153,11 @@ void ScRTFExport::WriteRow( SCTAB nTab, SCROW nRow ) WriteCell( nTab, nRow, nCol ); if ( rStrm.Tell() - nStrmPos > 255 ) { // Zeilen nicht zu lang werden lassen - rStrm << sNewLine; + rStrm << SAL_NEWLINE_STRING; nStrmPos = rStrm.Tell(); } } - rStrm << OOO_STRING_SVTOOLS_RTF_ROW << sNewLine; + rStrm << OOO_STRING_SVTOOLS_RTF_ROW << SAL_NEWLINE_STRING; } |