[Libreoffice-commits] core.git: dbaccess/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Aug 16 06:01:59 UTC 2019
dbaccess/source/ui/misc/TokenWriter.cxx | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
New commits:
commit 61e02561aa659d829a6786609fc57d99fd8652b4
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Aug 15 22:02:20 2019 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Aug 16 08:01:25 2019 +0200
tdf#126940: export ansicpg in RTF when copying database
This allows correctly detect encoding of 8-bit characters on paste
Change-Id: I586fd2ec140848e9097927818c492ab2fc7cf8ea
Reviewed-on: https://gerrit.libreoffice.org/77545
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx
index 5a56d78dcc18..fb82d00d1e77 100644
--- a/dbaccess/source/ui/misc/TokenWriter.cxx
+++ b/dbaccess/source/ui/misc/TokenWriter.cxx
@@ -22,6 +22,7 @@
#include <tools/diagnose_ex.h>
#include <tools/stream.hxx>
#include <osl/diagnose.h>
+#include <rtl/tencinfo.h>
#include <sal/log.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <RtfReader.hxx>
@@ -320,8 +321,12 @@ bool ORTFImportExport::Write()
{
ODatabaseImportExport::Write();
m_pStream->WriteChar( '{' ).WriteCharPtr( OOO_STRING_SVTOOLS_RTF_RTF );
- m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_ANSI ).WriteCharPtr( SAL_NEWLINE_STRING );
- rtl_TextEncoding eDestEnc = RTL_TEXTENCODING_MS_1252;
+ m_pStream->WriteCharPtr(OOO_STRING_SVTOOLS_RTF_ANSI);
+ if (sal_uInt32 nCpg = rtl_getWindowsCodePageFromTextEncoding(m_eDestEnc); nCpg && nCpg != 65001)
+ {
+ m_pStream->WriteCharPtr(OOO_STRING_SVTOOLS_RTF_ANSICPG).WriteUInt32AsString(nCpg);
+ }
+ m_pStream->WriteCharPtr(SAL_NEWLINE_STRING);
bool bBold = ( css::awt::FontWeight::BOLD == m_aFont.Weight );
bool bItalic = ( css::awt::FontSlant_ITALIC == m_aFont.Slant );
@@ -333,11 +338,11 @@ bool ORTFImportExport::Write()
m_xObject->getPropertyValue(PROPERTY_TEXTCOLOR) >>= nColor;
::Color aColor(nColor);
- OString aFonts(OUStringToOString(m_aFont.Name, eDestEnc));
+ OString aFonts(OUStringToOString(m_aFont.Name, RTL_TEXTENCODING_MS_1252));
if (aFonts.isEmpty())
{
OUString aName = Application::GetSettings().GetStyleSettings().GetAppFont().GetFamilyName();
- aFonts = OUStringToOString(aName, eDestEnc);
+ aFonts = OUStringToOString(aName, RTL_TEXTENCODING_MS_1252);
}
m_pStream->WriteCharPtr( "{\\fonttbl" );
@@ -437,7 +442,7 @@ bool ORTFImportExport::Write()
m_pStream->WriteCharPtr( "\\fs20\\f0\\cf0\\cb2" );
m_pStream->WriteChar( ' ' );
- RTFOutFuncs::Out_String(*m_pStream,sColumnName,eDestEnc);
+ RTFOutFuncs::Out_String(*m_pStream, sColumnName, m_eDestEnc);
m_pStream->WriteCharPtr( OOO_STRING_SVTOOLS_RTF_CELL );
m_pStream->WriteChar( '}' );
More information about the Libreoffice-commits
mailing list