[Libreoffice-commits] core.git: sc/inc sc/source
Jochen Nitschke
j.nitschke+logerrit at ok.de
Mon Jul 18 02:53:06 UTC 2016
sc/inc/filter.hxx | 21 ++++++++++++++-------
sc/source/filter/dif/difimp.cxx | 8 ++++----
sc/source/filter/inc/dif.hxx | 3 ++-
sc/source/filter/inc/ftools.hxx | 2 +-
sc/source/ui/docshell/impex.cxx | 2 +-
5 files changed, 22 insertions(+), 14 deletions(-)
New commits:
commit 2cb7d3c13cc55d8ee680fe19d99819529d8b9ba5
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date: Sun Jul 17 23:24:37 2016 +0200
sc: convert SC_DIFOPT_* defines to typed_flags
Change-Id: Ic4ec298fa9147edf8fda20fbcceebf6b803b342d
Reviewed-on: https://gerrit.libreoffice.org/27271
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx
index 40ffbda..aaeb9f3 100644
--- a/sc/inc/filter.hxx
+++ b/sc/inc/filter.hxx
@@ -20,6 +20,7 @@
#ifndef INCLUDED_SC_INC_FILTER_HXX
#define INCLUDED_SC_INC_FILTER_HXX
+#include <o3tl/typed_flags_set.hxx>
#include <rtl/textenc.h>
#include <rtl/ustring.hxx>
#include <tools/solar.h>
@@ -60,12 +61,18 @@ enum ExportFormatLotus { ExpWK1, ExpWK3, ExpWK4 };
enum ExportFormatExcel { ExpBiff2, ExpBiff3, ExpBiff4, ExpBiff4W, ExpBiff5, ExpBiff8, Exp2007Xml };
// options for DIF im-/export (combine with '|')
-#define SC_DIFOPT_PLAIN 0x00000000
-#define SC_DIFOPT_DATE 0x00000001
-#define SC_DIFOPT_TIME 0x00000002
-#define SC_DIFOPT_CURRENCY 0x00000004
-
-#define SC_DIFOPT_EXCEL (SC_DIFOPT_DATE|SC_DIFOPT_TIME|SC_DIFOPT_CURRENCY)
+enum class DifOptions
+{
+ Plain = 0x00000000,
+ Date = 0x00000001,
+ Time = 0x00000002,
+ Currency = 0x00000004,
+
+ Excel = (Date|Time|Currency)
+};
+namespace o3tl {
+ template<> struct typed_flags<DifOptions> : is_typed_flags<DifOptions, 0x00000007> {};
+}
// These are implemented inside the scfilt library and lazy loaded
@@ -91,7 +98,7 @@ class SAL_DLLPUBLIC_RTTI ScFormatFilterPlugin {
// eFormat == EIF_BIFF_LE4 -> only non storage files _might_ be read successfully
virtual FltError ScImportStarCalc10( SvStream&, ScDocument* ) = 0;
virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress& rInsPos,
- const rtl_TextEncoding eSrc = RTL_TEXTENCODING_DONTKNOW, sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0;
+ const rtl_TextEncoding eSrc = RTL_TEXTENCODING_DONTKNOW, DifOptions nDifOption = DifOptions::Excel ) = 0;
virtual FltError ScImportRTF( SvStream&, const OUString& rBaseURL, ScDocument*, ScRange& rRange ) = 0;
virtual FltError ScImportHTML( SvStream&, const OUString& rBaseURL, ScDocument*, ScRange& rRange, double nOutputFactor = 1.0,
bool bCalcWidthHeight = true, SvNumberFormatter* pFormatter = nullptr, bool bConvertDate = true ) = 0;
diff --git a/sc/source/filter/dif/difimp.cxx b/sc/source/filter/dif/difimp.cxx
index 48feb1b..704bf66 100644
--- a/sc/source/filter/dif/difimp.cxx
+++ b/sc/source/filter/dif/difimp.cxx
@@ -47,8 +47,8 @@ const sal_Unicode pKeyNA[] = { 'N', 'A', 0 };
const sal_Unicode pKeyV[] = { 'V', 0 };
const sal_Unicode pKey1_0[] = { '1', ',', '0', 0 };
-FltError ScFormatFilterPluginImpl::ScImportDif( SvStream& rIn, ScDocument* pDoc, const ScAddress& rInsPos,
- const rtl_TextEncoding eVon, sal_uInt32 nDifOption )
+FltError ScFormatFilterPluginImpl::ScImportDif(SvStream& rIn, ScDocument* pDoc, const ScAddress& rInsPos,
+ const rtl_TextEncoding eVon, DifOptions nDifOption )
{
DifParser aDifParser( rIn, nDifOption, *pDoc, eVon );
@@ -230,7 +230,7 @@ FltError ScFormatFilterPluginImpl::ScImportDif( SvStream& rIn, ScDocument* pDoc,
return eERR_OK;
}
-DifParser::DifParser( SvStream& rNewIn, const sal_uInt32 nOption, ScDocument& rDoc, rtl_TextEncoding e )
+DifParser::DifParser(SvStream& rNewIn, DifOptions nOption, ScDocument& rDoc, rtl_TextEncoding e )
: fVal(0.0)
, nVector(0)
, nVal(0)
@@ -245,7 +245,7 @@ DifParser::DifParser( SvStream& rNewIn, const sal_uInt32 nOption, ScDocument& rD
}
rIn.StartReadingUnicodeText( eCharSet );
- bPlain = ( nOption == SC_DIFOPT_PLAIN );
+ bPlain = ( nOption == DifOptions::Plain );
if( bPlain )
pNumFormatter = nullptr;
diff --git a/sc/source/filter/inc/dif.hxx b/sc/source/filter/inc/dif.hxx
index 0dd1551..9892408 100644
--- a/sc/source/filter/inc/dif.hxx
+++ b/sc/source/filter/inc/dif.hxx
@@ -57,6 +57,7 @@ enum DATASET { D_BOT, D_EOD, D_NUMERIC, D_STRING, D_UNKNOWN, D_SYNT_ERROR };
class DifAttrCache;
class ScPatternAttr;
+enum class DifOptions;
class DifParser
{
@@ -80,7 +81,7 @@ private:
static inline bool IsEOD( const sal_Unicode* pRef );
static inline bool Is1_0( const sal_Unicode* pRef );
public:
- DifParser( SvStream&, const sal_uInt32 nOption, ScDocument&, rtl_TextEncoding );
+ DifParser( SvStream&, DifOptions nOption, ScDocument&, rtl_TextEncoding );
TOPIC GetNextTopic();
diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx
index 0b75378..2f3d3d8 100644
--- a/sc/source/filter/inc/ftools.hxx
+++ b/sc/source/filter/inc/ftools.hxx
@@ -276,7 +276,7 @@ public:
// eFormat == EIF_BIFF_LE4 -> nur Nicht-Storage-Dateien _koennen_ zum Erfolg fuehren
virtual FltError ScImportStarCalc10( SvStream&, ScDocument* ) override;
virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress& rInsPos,
- const rtl_TextEncoding eSrc = RTL_TEXTENCODING_DONTKNOW, sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) override;
+ const rtl_TextEncoding eSrc = RTL_TEXTENCODING_DONTKNOW, DifOptions nDifOption = DifOptions::Excel ) override;
virtual FltError ScImportRTF( SvStream&, const OUString& rBaseURL, ScDocument*, ScRange& rRange ) override;
virtual FltError ScImportHTML( SvStream&, const OUString& rBaseURL, ScDocument*, ScRange& rRange,
double nOutputFactor = 1.0, bool bCalcWidthHeight = true,
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 193a604..a98ad1f 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -2221,7 +2221,7 @@ class ScFormatFilterMissing : public ScFormatFilterPlugin {
virtual FltError ScImportExcel( SfxMedium&, ScDocument*, const EXCIMPFORMAT ) override { return eERR_INTERN; }
virtual FltError ScImportStarCalc10( SvStream&, ScDocument* ) override { return eERR_INTERN; }
virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress&,
- const rtl_TextEncoding, sal_uInt32 ) override { return eERR_INTERN; }
+ const rtl_TextEncoding, DifOptions ) override { return eERR_INTERN; }
virtual FltError ScImportRTF( SvStream&, const OUString&, ScDocument*, ScRange& ) override { return eERR_INTERN; }
virtual FltError ScImportHTML( SvStream&, const OUString&, ScDocument*, ScRange&, double, bool, SvNumberFormatter*, bool ) override { return eERR_INTERN; }
More information about the Libreoffice-commits
mailing list