[Libreoffice-commits] core.git: sc/inc sc/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Sat Aug 6 16:49:54 UTC 2016


 sc/inc/address.hxx              |    1 -
 sc/inc/global.hxx               |    1 -
 sc/source/ui/docshell/impex.cxx |   33 ++++++++++++++++++++++++++++++++-
 sc/source/ui/inc/impex.hxx      |   34 ++--------------------------------
 4 files changed, 34 insertions(+), 35 deletions(-)

New commits:
commit 05c89af876fc7bb2e02e7de84df0cfc2869b0071
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Fri Aug 5 21:58:58 2016 +0200

    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 at yahoo.fr>
    Tested-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index b2c41cc..95bc9a4 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 c5492da..396865b 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 15b4102..a6df957 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 feaff38..ba06e4f 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


More information about the Libreoffice-commits mailing list