diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2017-06-25 17:21:45 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2017-07-04 09:32:16 +0200 |
commit | 6e0eafe576436ec229c6d90f654ff1b11ff9bdfd (patch) | |
tree | 274bae3e4959fc461eb719369573fe88d965a41a /include | |
parent | 788a87d46a64dc9e50eb371680c883a1d274b3e1 (diff) |
tdf#108789: branch 5.4 only
- 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
Cherry-pick:
- https://cgit.freedesktop.org/libreoffice/core/commit/?id=7f1465a9599e9665159dd2d823a6e9064cca5703
- https://cgit.freedesktop.org/libreoffice/core/commit/?id=857d64ed3ebbeb0ee4e8a75bfeaa4eb406944571
- https://cgit.freedesktop.org/libreoffice/core/commit/?id=9170d10cc57c3f0f3e82b27ce4b2cd9c897e669d
Change-Id: Id80b7c505858b88f717b0ce6bd890527909e5fd1
Reviewed-on: https://gerrit.libreoffice.org/39451
Reviewed-by: Lionel Elie Mamane <lionel@mamane.lu>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/connectivity/dbtools.hxx | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/include/connectivity/dbtools.hxx b/include/connectivity/dbtools.hxx index 93fad78229a6..1899ce9761ed 100644 --- a/include/connectivity/dbtools.hxx +++ b/include/connectivity/dbtools.hxx @@ -27,6 +27,7 @@ #include <unotools/sharedunocomponent.hxx> #include <connectivity/dbtoolsdllapi.hxx> #include <connectivity/FValue.hxx> +#include <tools/stream.hxx> namespace com { namespace sun { namespace star { @@ -786,10 +787,54 @@ namespace dbtools OUStringBuffer& _out_rSQLPredicate ); - } // namespace dbtools +namespace connectivity +{ +namespace dbase +{ + enum DBFType { dBaseIII = 0x03, + dBaseIV = 0x04, + dBaseV = 0x05, + VisualFoxPro = 0x30, + VisualFoxProAuto = 0x31, // Visual FoxPro with AutoIncrement field + dBaseFS = 0x43, + dBaseFSMemo = 0xB3, + dBaseIIIMemo = 0x83, + dBaseIVMemo = 0x8B, + dBaseIVMemoSQL = 0x8E, + FoxProMemo = 0xF5 + }; + /** decode a DBase file's codepage byte to a RTL charset + @param _out_nCharset + in case of success, the decoded RTL charset is written there. + else, this is not written to. + @param nType + the file's type byte + @param nCodepage + the file's codepage byte + @return + true if a RTL charset was successfully decoded and written to _out_nCharset + false if nothing was written to _out_nCharset + */ + OOO_DLLPUBLIC_DBTOOLS bool dbfDecodeCharset(rtl_TextEncoding &_out_nCharset, sal_uInt8 nType, sal_uInt8 nCodepage); + + /** decode a DBase file's codepage byte to a RTL charset + @param _out_nCharset + in case of success, the decoded RTL charset is written there. + else, this is not written to. + @param dbf_Stream + pointer to a SvStream encapsulating the DBase file. + The stream will be rewinded and read from. + No guarantee is made on its position afterwards. Caller must reposition it itself. + @return + true if a RTL charset was successfully decoded and written to _out_nCharset + false if nothing was written to _out_nCharset + */ + OOO_DLLPUBLIC_DBTOOLS bool dbfReadCharset(rtl_TextEncoding &nCharSet, SvStream* dbf_Stream); +} // namespace connectivity::dbase +} // namespace connectivity #endif // INCLUDED_CONNECTIVITY_DBTOOLS_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |