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 /svtools/source | |
parent | add missing dep (diff) | |
download | core-6954aad4e5c99ce193d3dd60a43f6d41d7c0a87f.tar.gz core-6954aad4e5c99ce193d3dd60a43f6d41d7c0a87f.zip |
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 'svtools/source')
-rw-r--r-- | svtools/source/svhtml/htmlout.cxx | 20 | ||||
-rw-r--r-- | svtools/source/svrtf/rtfout.cxx | 8 |
2 files changed, 7 insertions, 21 deletions
diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 5c0b1d8cc840..4ad0a8542711 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -31,12 +31,6 @@ #include <svtools/imappoly.hxx> #include "svl/urihelper.hxx" -#ifdef _WIN32 -const sal_Char HTMLOutFuncs::sNewLine[] = "\015\012"; -#else -const sal_Char HTMLOutFuncs::sNewLine[] = "\012"; -#endif - #define TXTCONV_BUFFER_SIZE 20 HTMLOutContext::HTMLOutContext( rtl_TextEncoding eDestEnc ) @@ -841,12 +835,12 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, if( !rSource.isEmpty() || pSBLibrary || pSBModule ) { - rStrm << sNewLine; + rStrm << SAL_NEWLINE_STRING; if( JAVASCRIPT != eScriptType ) { rStrm << "<!--" - << sNewLine; + << SAL_NEWLINE_STRING; } if( STARBASIC == eScriptType ) @@ -857,7 +851,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_SB_library)) .append(' ') .append(OUStringToOString(*pSBLibrary, eDestEnc)); - rStrm << sOut.makeStringAndClear().getStr() << sNewLine; + rStrm << sOut.makeStringAndClear().getStr() << SAL_NEWLINE_STRING; } if( pSBModule ) @@ -866,7 +860,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_SB_module)) .append(' ') .append(OUStringToOString(*pSBModule, eDestEnc)); - rStrm << sOut.makeStringAndClear().getStr() << sNewLine; + rStrm << sOut.makeStringAndClear().getStr() << SAL_NEWLINE_STRING; } } @@ -875,9 +869,9 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, // Wir schreiben das Modul mm ANSI-Zeichensatz, aber mit // System-Zeilenumbruechen raus. const OString sSource(OUStringToOString(rSource, eDestEnc)); - rStrm << sSource.getStr() << sNewLine; + rStrm << sSource.getStr() << SAL_NEWLINE_STRING; } - rStrm << sNewLine; + rStrm << SAL_NEWLINE_STRING; if( JAVASCRIPT != eScriptType ) { @@ -885,7 +879,7 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm, // falsch sein. Da der Kommentar aber beim Einlesen wider // entfernt wird, schickt uns das nicht weiter ... rStrm << (STARBASIC == eScriptType ? "' -->" : "// -->") - << sNewLine; + << SAL_NEWLINE_STRING; } } diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx index 919a009a1ee1..703a24c82d5b 100644 --- a/svtools/source/svrtf/rtfout.cxx +++ b/svtools/source/svrtf/rtfout.cxx @@ -24,14 +24,6 @@ #include <svtools/rtfkeywd.hxx> #include <svtools/rtfout.hxx> - -#ifdef _WIN32 -const sal_Char RTFOutFuncs::sNewLine[] = "\015\012"; -#else -const sal_Char RTFOutFuncs::sNewLine[] = "\012"; -#endif - - SvStream& RTFOutFuncs::Out_Char(SvStream& rStream, sal_Unicode c, int *pUCMode, rtl_TextEncoding eDestEnc, sal_Bool bWriteHelpFile) { |