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>
This commit is contained in:
Mike Kaganski
2023-02-27 09:54:16 +00:00
parent 41b991ea0c
commit 59bc90c9d6
4 changed files with 15 additions and 29 deletions
+3 -6
View File
@@ -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());
+8 -11
View File
@@ -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;
}
+1 -5
View File
@@ -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() )
+3 -7
View File
@@ -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")