diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-02-27 09:26:41 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-02-27 09:54:16 +0000 |
commit | 59bc90c9d60b5f425f29ce42d1db9381eb2c1f4d (patch) | |
tree | eda56d3b56277a6c549f379c274db3fca3a5c3af | |
parent | 41b991ea0cf3f8ce36cbdbf16b9c2c6d2bb16b5d (diff) |
Use SAL_NEWLINE_STRING to avoid some wheel re-invention
Change-Id: Ib60ddf2b1111fb2d6caf22ac6e0848bd27373b9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147750
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | cui/source/tabpages/autocdlg.cxx | 9 | ||||
-rw-r--r-- | hwpfilter/source/hwpeq.cxx | 19 | ||||
-rw-r--r-- | sw/source/core/edit/edglss.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/envelp/envimg.cxx | 10 |
4 files changed, 15 insertions, 29 deletions
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index 21716d43a1a9..f8c4a16d0c6e 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + #include <i18nutil/unicode.hxx> #include <o3tl/safeint.hxx> #include <utility> @@ -2113,12 +2115,7 @@ void OfaAutoCompleteTabPage::CopyToClipboard() const for (auto a : rows) { - sData.append(OUStringToOString(m_xLBEntries->get_text(a), nEncode)); -#if defined(_WIN32) - sData.append("\015\012"); -#else - sData.append("\012"); -#endif + sData.append(OUStringToOString(m_xLBEntries->get_text(a), nEncode) + SAL_NEWLINE_STRING); } pCntnr->CopyByteString( SotClipboardFormatId::STRING, sData.makeStringAndClear() ); pCntnr->CopyToClipboard(m_xLBEntries->get_clipboard()); diff --git a/hwpfilter/source/hwpeq.cxx b/hwpfilter/source/hwpeq.cxx index a19bee24acbb..30e12e4e5e9e 100644 --- a/hwpfilter/source/hwpeq.cxx +++ b/hwpfilter/source/hwpeq.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + #include <assert.h> #include <stdio.h> #include <string.h> @@ -33,11 +35,6 @@ #include <rtl/character.hxx> /* @Man: change the hwp formula to LaTeX */ -#ifdef _WIN32 -# define ENDL "\r\n" -#else /* !_WIN32 */ -# define ENDL "\n" -#endif #define EQ_CASE 0x01 // case sensitive cmd #define EQ_ENV 0x02 // equiv to latex environment @@ -740,11 +737,11 @@ static char eq2ltxconv(MzString& sstr, std::istream *strm, const char *sentinel) next_token(white, token, strm); if( token[0] != '{' ) return 0; - sstr << "\\begin" << "{" << eq->key << "}" << ENDL ; + sstr << "\\begin" << "{" << eq->key << "}" << SAL_NEWLINE_STRING ; eq2ltxconv(sstr, strm, "}"); if( sstr[sstr.length() - 1] != '\n' ) - sstr << ENDL ; - sstr << "\\end" << "{" << eq->key << "}" << ENDL ; + sstr << SAL_NEWLINE_STRING ; + sstr << "\\end" << "{" << eq->key << "}" << SAL_NEWLINE_STRING ; } else if( eq && (eq->flag & EQ_ATOP) ) { if( sstr.length() == 0 ) @@ -788,11 +785,11 @@ void eq2latex(MzString& outs, char const *s) std::istringstream strm(tstr.c_str()); if( eqnarray ) - outs << "\\begin{array}{rllll}" << ENDL; + outs << "\\begin{array}{rllll}" << SAL_NEWLINE_STRING; eq2ltxconv(outs, &strm, nullptr); - outs << ENDL; + outs << SAL_NEWLINE_STRING; if( eqnarray ) - outs << "\\end{array}" << ENDL; + outs << "\\end{array}" << SAL_NEWLINE_STRING; delete stk; stk = nullptr; } diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx index 836658d17236..4f1f69971f75 100644 --- a/sw/source/core/edit/edglss.cxx +++ b/sw/source/core/edit/edglss.cxx @@ -269,11 +269,7 @@ void SwEditShell::GetSelectedText( OUString &rBuf, ParaBreakType nHndlParaBrk ) else if( IsSelFullPara() && ParaBreakType::ToOnlyCR != nHndlParaBrk ) { -#ifdef _WIN32 - rBuf += "\015\012"; -#else - rBuf += "\012"; -#endif + rBuf += SAL_NEWLINE_STRING; } } else if( IsSelection() ) diff --git a/sw/source/uibase/envelp/envimg.cxx b/sw/source/uibase/envelp/envimg.cxx index 317179e570c2..b36cfdfa51f3 100644 --- a/sw/source/uibase/envelp/envimg.cxx +++ b/sw/source/uibase/envelp/envimg.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + #include <o3tl/any.hxx> #include <o3tl/string_view.hxx> #include <osl/diagnose.h> @@ -34,12 +36,6 @@ #include <unomid.h> -#ifdef _WIN32 -constexpr OUStringLiteral NEXTLINE = u"\r\n"; -#else -constexpr OUStringLiteral NEXTLINE = u"\n"; -#endif - using namespace utl; using namespace ::com::sun::star::uno; @@ -68,7 +64,7 @@ OUString MakeSender() else if (sToken == u"CR") { if(bLastLength) - sRet.append(NEXTLINE); + sRet.append(SAL_NEWLINE_STRING); bLastLength = true; } else if (sToken == u"FIRSTNAME") |