[Libreoffice-commits] core.git: 2 commits - configure.ac connectivity/source include/connectivity sc/CppunitTest_sc_ucalc.mk sc/Library_sc.mk sc/source

2017-07-02 Thread Lionel Elie Mamane
 configure.ac |2 
 connectivity/source/commontools/dbtools.cxx  |   83 
 connectivity/source/drivers/dbase/DTable.cxx |   43 
 include/connectivity/dbtools.hxx |   45 
 sc/CppunitTest_sc_ucalc.mk   |1 
 sc/Library_sc.mk |1 
 sc/source/ui/docshell/docsh8.cxx |4 
 sc/source/ui/unoobj/filtuno.cxx  |  140 +++
 8 files changed, 234 insertions(+), 85 deletions(-)

New commits:
commit 7f1465a9599e9665159dd2d823a6e9064cca5703
Author: Lionel Elie Mamane 
Date:   Sun Jun 25 17:21:45 2017 +0200

tdf#108789 and others: overhaul DBase files encoding handling

 - Calc: make the complete "what encoding to use" decision before
 calling the connectivity driver, so that the driver has
 no ambiguity about whether it should override our setting
 or not.

 To this end, factorise the part of the driver that reads
 the encoding from the file header into dbtools.

 - Calc: don't ask for encoding when the file's header give the encoding.

 - don't confuse CP850 (the default) and "don't know", including:
   * don't ignore CP850 user setting
   * don't overwrite user setting with CP850

Thanks to Julien Nabet for the extensive collaboration on this.

Change-Id: Id80b7c505858b88f717b0ce6bd890527909e5fd1

diff --git a/connectivity/source/commontools/dbtools.cxx 
b/connectivity/source/commontools/dbtools.cxx
index 97316e5e2536..fa34331d85f9 100644
--- a/connectivity/source/commontools/dbtools.cxx
+++ b/connectivity/source/commontools/dbtools.cxx
@@ -2026,6 +2026,89 @@ OSQLColumns::Vector::const_iterator 
find(OSQLColumns::Vector::const_iterator fir
 ++first;
 return first;
 }
+
+namespace dbase
+{
+bool dbfDecodeCharset(rtl_TextEncoding &_out_encoding, sal_uInt8 nType, 
sal_uInt8 nCodepage)
+{
+switch (nType)
+{
+case dBaseIII:
+case dBaseIV:
+case dBaseV:
+case VisualFoxPro:
+case VisualFoxProAuto:
+case dBaseFS:
+case dBaseFSMemo:
+case dBaseIVMemoSQL:
+case dBaseIIIMemo:
+case FoxProMemo:
+{
+if (nCodepage != 0x00)
+{
+auto eEncoding(RTL_TEXTENCODING_DONTKNOW);
+switch(nCodepage)
+{
+case 0x01: eEncoding = RTL_TEXTENCODING_IBM_437; break;   
// DOS USA  code page 437
+case 0x02: eEncoding = RTL_TEXTENCODING_IBM_850; break;   
// DOS Multilingual code page 850
+case 0x03: eEncoding = RTL_TEXTENCODING_MS_1252; break;   
// Windows ANSI code page 1252
+case 0x04: eEncoding = RTL_TEXTENCODING_APPLE_ROMAN; break;   
// Standard Macintosh
+case 0x64: eEncoding = RTL_TEXTENCODING_IBM_852; break;   
// EE MS-DOScode page 852
+case 0x65: eEncoding = RTL_TEXTENCODING_IBM_866; break;   
// Russian MS-DOS   code page 866
+case 0x66: eEncoding = RTL_TEXTENCODING_IBM_865; break;   
// Nordic MS-DOScode page 865
+case 0x67: eEncoding = RTL_TEXTENCODING_IBM_861; break;   
// Icelandic MS-DOS
+//case 0x68: eEncoding = ; break; // Kamenicky (Czech) 
MS-DOS
+//case 0x69: eEncoding = ; break; // Mazovia (Polish) 
MS-DOS
+case 0x6A: eEncoding = RTL_TEXTENCODING_IBM_737; break;   
// Greek MS-DOS (437G)
+case 0x6B: eEncoding = RTL_TEXTENCODING_IBM_857; break;   
// Turkish MS-DOS
+case 0x6C: eEncoding = RTL_TEXTENCODING_IBM_863; break;   
// MS-DOS, Canada
+case 0x78: eEncoding = RTL_TEXTENCODING_MS_950; break;
// Windows, Traditional Chinese
+case 0x79: eEncoding = RTL_TEXTENCODING_MS_949; break;
// Windows, Korean (Hangul)
+case 0x7A: eEncoding = RTL_TEXTENCODING_MS_936; break;
// Windows, Simplified Chinese
+case 0x7B: eEncoding = RTL_TEXTENCODING_MS_932; break;
// Windows, Japanese (Shift-jis)
+case 0x7C: eEncoding = RTL_TEXTENCODING_MS_874; break;
// Windows, Thai
+case 0x7D: eEncoding = RTL_TEXTENCODING_MS_1255; break;   
// Windows, Hebrew
+case 0x7E: eEncoding = RTL_TEXTENCODING_MS_1256; break;   
// Windows, Arabic
+case 0x96: eEncoding = RTL_TEXTENCODING_APPLE_CYRILLIC; break; 
   // Russian Macintosh
+case 0x97: eEncoding = RTL_TEXTENCODING_APPLE_CENTEURO; break; 
   // Eastern European Macintosh
+case 0x98: eEncoding = RTL_TEXTENCODING_APPLE_GREEK; break;   
// Greek Macintosh
+case 0xC8: eEncoding = RTL_TEXTENCODING_MS_1250; break;   
// Windows EE   

[Libreoffice-commits] core.git: 2 commits - configure.ac connectivity/source include/connectivity

2014-09-26 Thread Lionel Elie Mamane
 configure.ac|   20 +-
 connectivity/source/commontools/TSkipDeletedSet.cxx |8 +++
 connectivity/source/drivers/calc/CTable.cxx |8 +++
 connectivity/source/drivers/dbase/DTable.cxx|8 +++
 connectivity/source/drivers/file/FResultSet.cxx |   22 ++--
 connectivity/source/drivers/flat/ETable.cxx |   10 -
 connectivity/source/drivers/odbc/OResultSet.cxx |   12 +-
 connectivity/source/inc/TResultSetHelper.hxx|7 +++---
 connectivity/source/inc/odbc/OFunctiondefs.hxx  |6 +
 connectivity/source/parse/sqlbison.y|2 -
 connectivity/source/parse/sqliterator.cxx   |4 +--
 include/connectivity/IParseContext.hxx  |5 ++--
 12 files changed, 65 insertions(+), 47 deletions(-)

New commits:
commit 314c469c93f0ac139f64f742d3fd89e587f42970
Author: Lionel Elie Mamane lio...@mamane.lu
Date:   Tue Sep 16 12:25:29 2014 +0200

try Use system ODBC on MS Windows unless specifically overriden again

Now that Noel has a working pattch for system ODBC on MS Windows

Change-Id: I11abb53486e45d9c7058c42011df41b5fad0fcde

diff --git a/configure.ac b/configure.ac
index a0b6ed5..823fcdd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1822,7 +1822,7 @@ AC_ARG_WITH(libbase-jar,
 AC_ARG_WITH(system-odbc,
 AS_HELP_STRING([--with-system-odbc],
 [Use the odbc headers already on system.]),,
-[with_system_odbc=$with_system_headers])
+[with_system_odbc=auto])
 
 AC_ARG_WITH(system-sane,
 AS_HELP_STRING([--with-system-sane],
@@ -8598,7 +8598,7 @@ dnl 
===
 dnl Check for system odbc
 dnl ===
 AC_MSG_CHECKING([which odbc headers to use])
-if test $with_system_odbc = yes ; then
+if test $with_system_odbc = yes -o '(' $with_system_headers = yes -a 
$with_system_odbc = auto ')' -o '(' $_os = WINNT -a  
$with_system_odbc != no ')'; then
 AC_MSG_RESULT([external])
 SYSTEM_ODBC_HEADERS=TRUE
 
commit ac10225762ce2c242d21126b5730b1d60f0150ed
Author: Noel Grandin n...@peralex.com
Date:   Thu Sep 18 10:04:20 2014 +0300

implement --with-system-odbc on windows

Change-Id: I1757b9ce74277b1c11533f41caeafaf9b88658ef

diff --git a/configure.ac b/configure.ac
index c4367d9..a0b6ed5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2783,7 +2783,6 @@ if test $_os = Darwin; then
 ;;
 esac
 
-# If no CC and CXX environment vars, try to guess where the compiler is
 LIBTOOL=libtool
 INSTALL_NAME_TOOL=install_name_tool
 if test -z $save_CC; then
@@ -8603,8 +8602,19 @@ if test $with_system_odbc = yes ; then
 AC_MSG_RESULT([external])
 SYSTEM_ODBC_HEADERS=TRUE
 
-AC_CHECK_HEADER(sqlext.h, [],
-  [AC_MSG_ERROR(odbc not found. install odbc)], [])
+if test $build_os = cygwin; then
+save_CPPFLAGS=$CPPFLAGS
+find_winsdk
+PathFormat $winsdktest
+CPPFLAGS=$CPPFLAGS -I$formatted_path/include/um 
-I$formatted_path/include -I$formatted_path/include/shared
+AC_CHECK_HEADER(sqlext.h, [],
+[AC_MSG_ERROR(odbc not found. install odbc)],
+[#include windows.h])
+CPPFLAGS=$save_CPPFLAGS
+else
+AC_CHECK_HEADER(sqlext.h, [],
+[AC_MSG_ERROR(odbc not found. install odbc)],[])
+fi
 elif test $enable_database_connectivity != yes; then
 AC_MSG_RESULT([none])
 else
diff --git a/connectivity/source/commontools/TSkipDeletedSet.cxx 
b/connectivity/source/commontools/TSkipDeletedSet.cxx
index 563d545..cd98dd3 100644
--- a/connectivity/source/commontools/TSkipDeletedSet.cxx
+++ b/connectivity/source/commontools/TSkipDeletedSet.cxx
@@ -45,7 +45,7 @@ bool OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement 
_eCursorPosition, s
 
 switch (_eCursorPosition)
 {
-case IResultSetHelper::ABSOLUTE:
+case IResultSetHelper::ABSOLUTE1:
 return moveAbsolute(_nOffset,_bRetrieveData);
 case IResultSetHelper::FIRST:   // set the movement 
when positioning failed
 eDelPosition = IResultSetHelper::NEXT;
@@ -55,7 +55,7 @@ bool OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement 
_eCursorPosition, s
 eDelPosition = IResultSetHelper::PRIOR; // last row is invalid so 
position before
 nDelOffset = 1;
 break;
-case IResultSetHelper::RELATIVE:
+case IResultSetHelper::RELATIVE1:
 eDelPosition = (_nOffset = 0) ? IResultSetHelper::NEXT : 
IResultSetHelper::PRIOR;
 break;
 default:
@@ -107,7 +107,7 @@ bool 
OSkipDeletedSet::skipDeleted(IResultSetHelper::Movement _eCursorPosition, s
 }
 return bDataFound;
 }
-else if (_eCursorPosition != IResultSetHelper::RELATIVE)
+else if (_eCursorPosition !=