diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2016-08-05 21:58:58 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2016-08-06 16:49:21 +0000 |
commit | 05c89af876fc7bb2e02e7de84df0cfc2869b0071 (patch) | |
tree | a1c697c28ebe41a4729241d3019221ae39ed329c /sc | |
parent | 07966a9999b0b3f27e1adeea1f4c97b3ba2944fa (diff) |
sc: drop most osl/endian.h includes
only users in implementation of ScImportExport and ScImportStringStream
moving them to impex.cxx
Change-Id: Ic7a78f9dd11830ad0ed330c5349beddd724236da
Reviewed-on: https://gerrit.libreoffice.org/27918
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/address.hxx | 1 | ||||
-rw-r--r-- | sc/inc/global.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 33 | ||||
-rw-r--r-- | sc/source/ui/inc/impex.hxx | 34 |
4 files changed, 34 insertions, 35 deletions
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index b2c41cc8c0af..95bc9a489659 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -22,7 +22,6 @@ #include <rtl/ustrbuf.hxx> #include <rtl/strbuf.hxx> -#include <osl/endian.h> #include <limits> #include "scdllapi.h" diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index c5492dac4e50..396865bce851 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -23,7 +23,6 @@ #include "address.hxx" #include <i18nlangtag/lang.h> #include <tools/stream.hxx> -#include <osl/endian.h> #include <com/sun/star/uno/Reference.hxx> #include "scdllapi.h" #include <rtl/ustring.hxx> diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 15b4102e9bcf..a6df957c4cb9 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -56,6 +56,7 @@ #include <vcl/svapp.hxx> #include <memory> +#include <osl/endian.h> // We don't want to end up with 2GB read in one line just because of malformed // multiline fields, so chop it _somewhere_, which is twice supported columns @@ -69,6 +70,15 @@ namespace const char SYLK_LF[] = "\x1b :"; const char DOUBLE_SEMICOLON[] = ";;"; const char DOUBLE_DOUBLEQUOTE[] = "\"\""; + + inline bool lcl_IsEndianSwap( const SvStream& rStrm ) + { + #ifdef OSL_BIGENDIAN + return rStrm.GetEndian() != SvStreamEndian::BIG; + #else + return rStrm.GetEndian() != SvStreamEndian::LITTLE; + #endif + } } enum SylkVersion @@ -479,7 +489,7 @@ void ScImportExport::WriteUnicodeOrByteString( SvStream& rStrm, const OUString& rtl_TextEncoding eEnc = rStrm.GetStreamCharSet(); if ( eEnc == RTL_TEXTENCODING_UNICODE ) { - if ( !IsEndianSwap( rStrm ) ) + if ( !lcl_IsEndianSwap( rStrm ) ) rStrm.WriteBytes(rString.getStr(), rString.getLength() * sizeof(sal_Unicode)); else { @@ -523,6 +533,15 @@ void ScImportExport::WriteUnicodeOrByteEndl( SvStream& rStrm ) endl( rStrm ); } +void ScImportExport::SetNoEndianSwap( SvStream& rStrm ) +{ +#ifdef OSL_BIGENDIAN + rStrm.SetEndian( SvStreamEndian::BIG ); +#else + rStrm.SetEndian( SvStreamEndian::LITTLE ); +#endif +} + enum QuoteType { FIELDSTART_QUOTE, @@ -2294,6 +2313,18 @@ static inline const sal_Unicode* lcl_UnicodeStrChr( const sal_Unicode* pStr, return nullptr; } +ScImportStringStream::ScImportStringStream( const OUString& rStr ) + : SvMemoryStream( const_cast<sal_Unicode *>(rStr.getStr()), + rStr.getLength() * sizeof(sal_Unicode), StreamMode::READ) +{ + SetStreamCharSet( RTL_TEXTENCODING_UNICODE ); +#ifdef OSL_BIGENDIAN + SetEndian(SvStreamEndian::BIG); +#else + SetEndian(SvStreamEndian::LITTLE); +#endif +} + OUString ReadCsvLine( SvStream &rStream, bool bEmbeddedLineBreak, const OUString& rFieldSeparators, sal_Unicode cFieldQuote ) { diff --git a/sc/source/ui/inc/impex.hxx b/sc/source/ui/inc/impex.hxx index feaff387777b..ba06e4fd1b64 100644 --- a/sc/source/ui/inc/impex.hxx +++ b/sc/source/ui/inc/impex.hxx @@ -20,7 +20,6 @@ #ifndef INCLUDED_SC_SOURCE_UI_INC_IMPEX_HXX #define INCLUDED_SC_SOURCE_UI_INC_IMPEX_HXX -#include <osl/endian.h> #include <sot/exchange.hxx> #include "global.hxx" #include "address.hxx" @@ -109,10 +108,9 @@ public: bool bMergeSeps, bool& rbIsQuoted, bool& rbOverflowCell ); static void WriteUnicodeOrByteString( SvStream& rStrm, const OUString& rString, bool bZero = false ); static void WriteUnicodeOrByteEndl( SvStream& rStrm ); - static inline bool IsEndianSwap( const SvStream& rStrm ); //! only if stream is only used in own (!) memory - static inline void SetNoEndianSwap( SvStream& rStrm ); + static void SetNoEndianSwap( SvStream& rStrm ); void SetSeparator( sal_Unicode c ) { cSep = c; } void SetDelimiter( sal_Unicode c ) { cStr = c; } @@ -147,39 +145,11 @@ public: void SetExportTextOptions( const ScExportTextOptions& options ) { mExportTextOptions = options; } }; -inline bool ScImportExport::IsEndianSwap( const SvStream& rStrm ) -{ -#ifdef OSL_BIGENDIAN - return rStrm.GetEndian() != SvStreamEndian::BIG; -#else - return rStrm.GetEndian() != SvStreamEndian::LITTLE; -#endif -} - -inline void ScImportExport::SetNoEndianSwap( SvStream& rStrm ) -{ -#ifdef OSL_BIGENDIAN - rStrm.SetEndian( SvStreamEndian::BIG ); -#else - rStrm.SetEndian( SvStreamEndian::LITTLE ); -#endif -} - // Helper class for importing clipboard strings as streams. class ScImportStringStream : public SvMemoryStream { public: - ScImportStringStream( const OUString& rStr ) - : SvMemoryStream( const_cast<sal_Unicode *>(rStr.getStr()), - rStr.getLength() * sizeof(sal_Unicode), StreamMode::READ) - { - SetStreamCharSet( RTL_TEXTENCODING_UNICODE ); -#ifdef OSL_BIGENDIAN - SetEndian(SvStreamEndian::BIG); -#else - SetEndian(SvStreamEndian::LITTLE); -#endif - } + ScImportStringStream(const OUString& rStr); }; /** Read a CSV (comma separated values) data line using |