[Libreoffice-commits] core.git: 2 commits - basic/source chart2/source compilerplugins/clang configure.ac cui/source dbaccess/source editeng/source extensions/source formula/source include/formula include/svl include/svx oox/source README.md sc/inc sc/qa sc/source sfx2/source svl/qa svl/source svtools/source svx/source sw/source uui/source xmloff/source

Stephan Bergmann sbergman at redhat.com
Tue Dec 19 21:08:49 UTC 2017


 README.md                                              |    2 
 basic/source/comp/scanner.cxx                          |    4 
 basic/source/runtime/methods.cxx                       |   12 
 basic/source/runtime/runtime.cxx                       |    5 
 basic/source/sbx/sbxdate.cxx                           |   11 
 basic/source/sbx/sbxscan.cxx                           |    2 
 chart2/source/controller/dialogs/DataBrowser.cxx       |    4 
 chart2/source/controller/dialogs/tp_Scale.cxx          |   20 -
 chart2/source/tools/DiagramHelper.cxx                  |    4 
 compilerplugins/clang/check.cxx                        |   17 -
 compilerplugins/clang/checkconfigmacros.cxx            |   20 -
 compilerplugins/clang/compat.hxx                       |  191 -----------
 compilerplugins/clang/constantparam.cxx                |    9 
 compilerplugins/clang/countusersofdefaultparams.cxx    |   11 
 compilerplugins/clang/datamembershadow.cxx             |    3 
 compilerplugins/clang/expandablemethods.cxx            |    5 
 compilerplugins/clang/getimplementationname.cxx        |    2 
 compilerplugins/clang/implicitboolconversion.cxx       |   36 --
 compilerplugins/clang/includeform.cxx                  |    4 
 compilerplugins/clang/inlinesimplememberfunctions.cxx  |   10 
 compilerplugins/clang/oslendian.cxx                    |   12 
 compilerplugins/clang/passstuffbyref.cxx               |    3 
 compilerplugins/clang/pluginhandler.cxx                |   21 -
 compilerplugins/clang/pluginhandler.hxx                |    4 
 compilerplugins/clang/redundantcast.cxx                |   16 
 compilerplugins/clang/refcounting.cxx                  |   12 
 compilerplugins/clang/reservedid.cxx                   |    2 
 compilerplugins/clang/salbool.cxx                      |    8 
 compilerplugins/clang/sfxpoolitem.cxx                  |   21 -
 compilerplugins/clang/singlevalfields.cxx              |    7 
 compilerplugins/clang/staticmethods.cxx                |   11 
 compilerplugins/clang/store/removevirtuals.cxx         |    3 
 compilerplugins/clang/store/returnbyref.cxx            |    3 
 compilerplugins/clang/test/datamembershadow.cxx        |    5 
 compilerplugins/clang/unnecessaryoverride.cxx          |   22 -
 compilerplugins/clang/unnecessaryvirtual.cxx           |    2 
 compilerplugins/clang/unusedmethods.cxx                |    7 
 compilerplugins/clang/unusedmethodsremove.cxx          |    2 
 compilerplugins/clang/vclwidgets.cxx                   |   11 
 configure.ac                                           |   10 
 cui/source/options/optupdt.cxx                         |    4 
 dbaccess/source/ui/misc/UITools.cxx                    |    2 
 editeng/source/items/flditem.cxx                       |    6 
 extensions/source/propctrlr/standardcontrol.cxx        |    2 
 extensions/source/propctrlr/usercontrol.cxx            |    8 
 formula/source/core/api/FormulaCompiler.cxx            |   30 -
 formula/source/core/api/token.cxx                      |   10 
 include/formula/FormulaCompiler.hxx                    |    5 
 include/formula/token.hxx                              |   16 
 include/svl/zforlist.hxx                               |   80 +++-
 include/svl/zformat.hxx                                |   21 -
 include/svx/numfmtsh.hxx                               |    6 
 oox/source/drawingml/chart/datasourcecontext.cxx       |    2 
 sc/inc/column.hxx                                      |    2 
 sc/inc/dociter.hxx                                     |    7 
 sc/inc/document.hxx                                    |    4 
 sc/inc/dpcache.hxx                                     |    3 
 sc/inc/externalrefmgr.hxx                              |    2 
 sc/inc/formulacell.hxx                                 |    7 
 sc/inc/global.hxx                                      |    9 
 sc/inc/simpleformulacalc.hxx                           |    4 
 sc/inc/stringutil.hxx                                  |    3 
 sc/inc/table.hxx                                       |    2 
 sc/qa/unit/ucalc.cxx                                   |    2 
 sc/source/core/data/clipcontext.cxx                    |    4 
 sc/source/core/data/column.cxx                         |    8 
 sc/source/core/data/column3.cxx                        |   22 -
 sc/source/core/data/dbdocutl.cxx                       |   10 
 sc/source/core/data/dociter.cxx                        |   10 
 sc/source/core/data/documen4.cxx                       |   17 -
 sc/source/core/data/document.cxx                       |   10 
 sc/source/core/data/dpcache.cxx                        |   12 
 sc/source/core/data/dpobject.cxx                       |   14 
 sc/source/core/data/dputil.cxx                         |    4 
 sc/source/core/data/formulacell.cxx                    |   43 +-
 sc/source/core/data/global.cxx                         |    2 
 sc/source/core/data/global2.cxx                        |    6 
 sc/source/core/data/simpleformulacalc.cxx              |    2 
 sc/source/core/data/stlsheet.cxx                       |    2 
 sc/source/core/data/table2.cxx                         |    2 
 sc/source/core/data/table3.cxx                         |    8 
 sc/source/core/data/table4.cxx                         |   14 
 sc/source/core/inc/interpre.hxx                        |   16 
 sc/source/core/tool/chartpos.cxx                       |    4 
 sc/source/core/tool/compiler.cxx                       |    8 
 sc/source/core/tool/interpr1.cxx                       |   76 ++--
 sc/source/core/tool/interpr2.cxx                       |   66 ++--
 sc/source/core/tool/interpr4.cxx                       |   86 ++---
 sc/source/core/tool/interpr5.cxx                       |   87 ++---
 sc/source/core/tool/interpr6.cxx                       |   10 
 sc/source/core/tool/scmatrix.cxx                       |    8 
 sc/source/core/tool/stringutil.cxx                     |    2 
 sc/source/core/tool/zforauto.cxx                       |    2 
 sc/source/filter/excel/xelink.cxx                      |    2 
 sc/source/filter/excel/xepivot.cxx                     |    6 
 sc/source/filter/excel/xetable.cxx                     |   20 -
 sc/source/filter/excel/xipivot.cxx                     |    8 
 sc/source/filter/excel/xistyle.cxx                     |    2 
 sc/source/filter/html/htmlpars.cxx                     |    2 
 sc/source/filter/lotus/tool.cxx                        |   42 +-
 sc/source/filter/orcus/interface.cxx                   |    2 
 sc/source/filter/rtf/eeimpars.cxx                      |    4 
 sc/source/filter/xcl97/XclImpChangeTrack.cxx           |    2 
 sc/source/filter/xml/XMLChangeTrackingExportHelper.cxx |   11 
 sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx |    4 
 sc/source/ui/app/inputhdl.cxx                          |    2 
 sc/source/ui/dbgui/filtdlg.cxx                         |    2 
 sc/source/ui/docshell/docsh8.cxx                       |   10 
 sc/source/ui/docshell/externalrefmgr.cxx               |    6 
 sc/source/ui/docshell/impex.cxx                        |    6 
 sc/source/ui/inc/formatsh.hxx                          |    3 
 sc/source/ui/inc/viewfunc.hxx                          |    4 
 sc/source/ui/unoobj/cellsuno.cxx                       |   12 
 sc/source/ui/view/cellsh1.cxx                          |   10 
 sc/source/ui/view/cellsh2.cxx                          |    4 
 sc/source/ui/view/dbfunc3.cxx                          |    4 
 sc/source/ui/view/formatsh.cxx                         |  176 +++++-----
 sc/source/ui/view/output2.cxx                          |    2 
 sc/source/ui/view/viewfun2.cxx                         |    2 
 sc/source/ui/view/viewfun6.cxx                         |   60 +--
 sc/source/ui/view/viewfunc.cxx                         |   22 -
 sfx2/source/bastyp/sfxhtml.cxx                         |    2 
 svl/qa/unit/svl.cxx                                    |    8 
 svl/source/numbers/numfmuno.cxx                        |   19 -
 svl/source/numbers/zforfind.cxx                        |  277 ++++++++---------
 svl/source/numbers/zforfind.hxx                        |    7 
 svl/source/numbers/zforlist.cxx                        |  252 +++++++--------
 svl/source/numbers/zformat.cxx                         |   96 +++--
 svl/source/numbers/zforscan.cxx                        |  182 +++++------
 svl/source/numbers/zforscan.hxx                        |    4 
 svtools/source/control/fmtfield.cxx                    |   16 
 svx/source/items/numfmtsh.cxx                          |  134 +++-----
 sw/source/core/doc/tblafmt.cxx                         |    2 
 sw/source/core/docnode/ndtbl.cxx                       |    4 
 sw/source/core/fields/cellfml.cxx                      |    8 
 sw/source/core/fields/fldbas.cxx                       |    6 
 sw/source/core/table/swtable.cxx                       |    8 
 sw/source/core/text/EnhancedPDFExportHelper.cxx        |    2 
 sw/source/core/unocore/unostyle.cxx                    |    2 
 sw/source/filter/html/htmlfld.cxx                      |    7 
 sw/source/filter/ww8/writerwordglue.cxx                |    2 
 sw/source/filter/ww8/ww8par.hxx                        |    2 
 sw/source/filter/ww8/ww8par5.cxx                       |   28 -
 sw/source/ui/dbui/dbinsdlg.cxx                         |    6 
 sw/source/ui/fldui/flddinf.cxx                         |   24 -
 sw/source/ui/fldui/flddok.cxx                          |   10 
 sw/source/ui/fldui/fldvar.cxx                          |    4 
 sw/source/ui/table/tautofmt.cxx                        |    2 
 sw/source/uibase/fldui/fldmgr.cxx                      |    8 
 sw/source/uibase/inc/numfmtlb.hxx                      |    9 
 sw/source/uibase/shells/tabsh.cxx                      |   21 -
 sw/source/uibase/utlui/numfmtlb.cxx                    |   65 ++-
 uui/source/iahndl-ssl.cxx                              |    4 
 xmloff/source/style/xmlnumfe.cxx                       |   76 ++--
 xmloff/source/style/xmlnumfi.cxx                       |    4 
 155 files changed, 1420 insertions(+), 1657 deletions(-)

New commits:
commit 9663341f9249c739219ffe6cccf3762aa8dd78f3
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 15 14:20:38 2017 +0100

    Bump --enable-compiler-plugins to Clang 3.8.0
    
    <https://lists.freedesktop.org/archives/libreoffice/2017-December/079107.html>
    "Clang baseline bump"
    
    Change-Id: I18fca8794ea34118fc6308458064d0c28cf5caf7
    Reviewed-on: https://gerrit.libreoffice.org/46557
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/README.md b/README.md
index 475509abeac1..9721813c23f1 100644
--- a/README.md
+++ b/README.md
@@ -50,7 +50,7 @@ C++17, C++14, or C++11" in its current form (due to the #pragma GCC diagnostic i
 that it does not understand).
 
 If you want to use Clang with the LibreOffice compiler plugins, the minimal
-version of Clang is 3.4. Since Xcode doesn't provide the compiler plugin
+version of Clang is 3.8. Since Xcode doesn't provide the compiler plugin
 headers, you have to compile your own Clang to use them on macOS.
 
 You can find the TDF configure switches in the distro-configs/ directory.
diff --git a/compilerplugins/clang/check.cxx b/compilerplugins/clang/check.cxx
index 9ded6d296e5f..2a7b0a978348 100644
--- a/compilerplugins/clang/check.cxx
+++ b/compilerplugins/clang/check.cxx
@@ -9,8 +9,9 @@
 
 #include <cassert>
 
+#include <clang/AST/DeclCXX.h>
+
 #include "check.hxx"
-#include "compat.hxx"
 
 namespace loplugin {
 
@@ -153,14 +154,14 @@ ContextCheck DeclCheck::MemberFunction() const {
 TerminalCheck ContextCheck::GlobalNamespace() const {
     return TerminalCheck(
         context_ != nullptr
-        && ((compat::isLookupContext(*context_)
+        && ((context_->isLookupContext()
              ? context_ : context_->getLookupParent())
             ->isTranslationUnit()));
 }
 
 TerminalCheck ContextCheck::StdNamespace() const {
     return TerminalCheck(
-        context_ != nullptr && compat::isStdNamespace(*context_));
+        context_ != nullptr && context_->isStdNamespace());
 }
 
 ContextCheck ContextCheck::AnonymousNamespace() const {
@@ -171,13 +172,7 @@ ContextCheck ContextCheck::AnonymousNamespace() const {
 
 namespace {
 
-bool BaseCheckNotSomethingInterestingSubclass(
-    const clang::CXXRecordDecl *BaseDefinition
-#if CLANG_VERSION < 30800
-    , void *
-#endif
-    )
-{
+bool BaseCheckNotSomethingInterestingSubclass(const clang::CXXRecordDecl *BaseDefinition) {
     if (BaseDefinition) {
         auto tc = TypeCheck(BaseDefinition);
         if (tc.Class("Dialog").GlobalNamespace() || tc.Class("SfxPoolItem").GlobalNamespace()) {
@@ -201,7 +196,7 @@ bool isDerivedFromSomethingInteresting(const clang::CXXRecordDecl *decl) {
     if (// not sure what hasAnyDependentBases() does,
         // but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
         !decl->hasAnyDependentBases() &&
-        !compat::forallBases(*decl, BaseCheckNotSomethingInterestingSubclass, nullptr, true)) {
+        !decl->forallBases(BaseCheckNotSomethingInterestingSubclass, true)) {
         return true;
     }
     return false;
diff --git a/compilerplugins/clang/checkconfigmacros.cxx b/compilerplugins/clang/checkconfigmacros.cxx
index 46cb35a450c3..7e0a722ef2bb 100644
--- a/compilerplugins/clang/checkconfigmacros.cxx
+++ b/compilerplugins/clang/checkconfigmacros.cxx
@@ -9,9 +9,9 @@
  *
  */
 
+#include <memory>
 #include <set>
 
-#include "compat.hxx"
 #include "plugin.hxx"
 
 #include <clang/Lex/Preprocessor.h>
@@ -37,14 +37,14 @@ class CheckConfigMacros
         explicit CheckConfigMacros( const InstantiationData& data );
         virtual void run() override;
         virtual void MacroDefined( const Token& macroToken, const MacroDirective* info ) override;
-        virtual void MacroUndefined( const Token& macroToken, compat::MacroDefinitionParam
+        virtual void MacroUndefined( const Token& macroToken, MacroDefinition const &
 #if CLANG_VERSION >= 50000
             , MacroDirective const *
 #endif
             ) override;
-        virtual void Ifdef( SourceLocation location, const Token& macroToken, compat::MacroDefinitionParam ) override;
-        virtual void Ifndef( SourceLocation location, const Token& macroToken, compat::MacroDefinitionParam ) override;
-        virtual void Defined( const Token& macroToken, compat::MacroDefinitionParam, SourceRange Range ) override;
+        virtual void Ifdef( SourceLocation location, const Token& macroToken, MacroDefinition const & ) override;
+        virtual void Ifndef( SourceLocation location, const Token& macroToken, MacroDefinition const & ) override;
+        virtual void Defined( const Token& macroToken, MacroDefinition const &, SourceRange Range ) override;
         enum { isPPCallback = true };
     private:
         void checkMacro( const Token& macroToken, SourceLocation location );
@@ -54,7 +54,7 @@ class CheckConfigMacros
 CheckConfigMacros::CheckConfigMacros( const InstantiationData& data )
     : Plugin( data )
     {
-    compat::addPPCallbacks(compiler.getPreprocessor(), this);
+    compiler.getPreprocessor().addPPCallbacks(std::unique_ptr<PPCallbacks>(this));
     }
 
 void CheckConfigMacros::run()
@@ -75,7 +75,7 @@ void CheckConfigMacros::MacroDefined( const Token& macroToken, const MacroDirect
         }
     }
 
-void CheckConfigMacros::MacroUndefined( const Token& macroToken, compat::MacroDefinitionParam
+void CheckConfigMacros::MacroUndefined( const Token& macroToken, MacroDefinition const &
 #if CLANG_VERSION >= 50000
                                         , MacroDirective const *
 #endif
@@ -84,17 +84,17 @@ void CheckConfigMacros::MacroUndefined( const Token& macroToken, compat::MacroDe
     configMacros.erase( macroToken.getIdentifierInfo()->getName());
     }
 
-void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken, compat::MacroDefinitionParam )
+void CheckConfigMacros::Ifdef( SourceLocation location, const Token& macroToken, MacroDefinition const & )
     {
     checkMacro( macroToken, location );
     }
 
-void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken, compat::MacroDefinitionParam )
+void CheckConfigMacros::Ifndef( SourceLocation location, const Token& macroToken, MacroDefinition const & )
     {
     checkMacro( macroToken, location );
     }
 
-void CheckConfigMacros::Defined( const Token& macroToken, compat::MacroDefinitionParam , SourceRange )
+void CheckConfigMacros::Defined( const Token& macroToken, MacroDefinition const &, SourceRange )
     {
     checkMacro( macroToken, macroToken.getLocation());
     }
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index 60eab1251e28..5a540b8ef695 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -11,26 +11,14 @@
 #define INCLUDED_COMPILERPLUGINS_CLANG_COMPAT_HXX
 
 #include <cstddef>
-#include <memory>
-#include <string>
 
 #include "clang/AST/Decl.h"
-#include "clang/AST/DeclBase.h"
-#include "clang/AST/DeclCXX.h"
 #include "clang/AST/Expr.h"
 #include "clang/AST/ExprCXX.h"
-#include "clang/AST/Type.h"
-#include "clang/Basic/Diagnostic.h"
-#include "clang/Basic/DiagnosticIDs.h"
-#include "clang/Basic/Linkage.h"
 #include "clang/Basic/SourceManager.h"
-#include "clang/Basic/Visibility.h"
 #include "clang/Frontend/CompilerInstance.h"
-#include "clang/Lex/PPCallbacks.h"
-#include "clang/Lex/Preprocessor.h"
+#include "clang/Lex/Lexer.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/raw_ostream.h"
 
 #include "config_clang.h"
 
@@ -46,37 +34,6 @@ inline llvm::StringRef take_front(llvm::StringRef ref, std::size_t N = 1) {
 #endif
 }
 
-inline bool isLookupContext(clang::DeclContext const & ctxt) {
-#if CLANG_VERSION >= 30700
-    return ctxt.isLookupContext();
-#else
-    return !ctxt.isFunctionOrMethod()
-        && ctxt.getDeclKind() != clang::Decl::LinkageSpec;
-#endif
-}
-
-inline bool forallBases(
-    clang::CXXRecordDecl const & decl,
-    clang::CXXRecordDecl::ForallBasesCallback BaseMatches,
-    void* callbackParam,
-    bool AllowShortCircuit)
-{
-#if CLANG_VERSION >= 30800
-    (void) callbackParam;
-    return decl.forallBases(BaseMatches, AllowShortCircuit);
-#else
-    return decl.forallBases(BaseMatches, callbackParam, AllowShortCircuit);
-#endif
-}
-
-inline clang::QualType getReturnType(clang::FunctionDecl const & decl) {
-#if CLANG_VERSION >= 30500
-    return decl.getReturnType();
-#else
-    return decl.getResultType();
-#endif
-}
-
 
 #if CLANG_VERSION >= 30900
 inline clang::ArrayRef<clang::ParmVarDecl *> parameters(
@@ -84,127 +41,14 @@ inline clang::ArrayRef<clang::ParmVarDecl *> parameters(
 {
     return decl.parameters();
 }
-#elif CLANG_VERSION >= 30500
+#else
 inline clang::FunctionDecl::param_const_range parameters(
     clang::FunctionDecl const & decl)
 {
     return decl.params();
 }
-#else
-struct FunctionDeclParamsWrapper
-{
-    clang::FunctionDecl const & decl;
-    FunctionDeclParamsWrapper(clang::FunctionDecl const & _decl) : decl(_decl) {}
-    clang::FunctionDecl::param_const_iterator begin() const { return decl.param_begin(); }
-    clang::FunctionDecl::param_const_iterator end() const { return decl.param_end(); }
-};
-inline FunctionDeclParamsWrapper parameters(
-    clang::FunctionDecl const & decl)
-{
-    return FunctionDeclParamsWrapper(decl);
-}
-#endif
-
-
-inline clang::QualType getReturnType(clang::FunctionProtoType const & type) {
-#if CLANG_VERSION >= 30500
-    return type.getReturnType();
-#else
-    return type.getResultType();
-#endif
-}
-
-inline unsigned getNumParams(clang::FunctionProtoType const & type) {
-#if CLANG_VERSION >= 30500
-    return type.getNumParams();
-#else
-    return type.getNumArgs();
-#endif
-}
-
-inline clang::QualType getParamType(
-    clang::FunctionProtoType const & type, unsigned i)
-{
-#if CLANG_VERSION >= 30500
-    return type.getParamType(i);
-#else
-    return type.getArgType(i);
-#endif
-}
-
-inline clang::Stmt::const_child_iterator begin(
-    clang::Stmt::const_child_range const & range)
-{
-#if CLANG_VERSION >= 30800
-    return range.begin();
-#else
-    return range.first;
-#endif
-}
-
-inline clang::Stmt::const_child_iterator end(
-    clang::Stmt::const_child_range const & range)
-{
-#if CLANG_VERSION >= 30800
-    return range.end();
-#else
-    return range.second;
-#endif
-}
-
-inline unsigned getBuiltinCallee(clang::CallExpr const & expr) {
-#if CLANG_VERSION >= 30500
-    return expr.getBuiltinCallee();
-#else
-    return expr.isBuiltinCall();
-#endif
-}
-
-inline unsigned getCustomDiagID(
-    clang::DiagnosticsEngine & engine, clang::DiagnosticsEngine::Level L,
-    llvm::StringRef FormatString)
-{
-#if CLANG_VERSION >= 30500
-    return engine.getDiagnosticIDs()->getCustomDiagID(
-        static_cast<clang::DiagnosticIDs::Level>(L), FormatString);
-#else
-    return engine.getCustomDiagID(L, FormatString);
-#endif
-}
-
-inline std::unique_ptr<llvm::raw_fd_ostream> create_raw_fd_ostream(
-    char const * Filename, std::string & ErrorInfo)
-{
-#if CLANG_VERSION >= 30600
-    std::error_code ec;
-    std::unique_ptr<llvm::raw_fd_ostream> s(
-        new llvm::raw_fd_ostream(Filename, ec, llvm::sys::fs::F_None));
-    ErrorInfo = ec ? "error: " + ec.message() : std::string();
-    return s;
-#elif CLANG_VERSION >= 30500
-    return std::unique_ptr<llvm::raw_fd_ostream>(
-        new llvm::raw_fd_ostream(Filename, ErrorInfo, llvm::sys::fs::F_None));
-#else
-    return std::unique_ptr<llvm::raw_fd_ostream>(
-        new llvm::raw_fd_ostream(Filename, ErrorInfo));
-#endif
-}
-
-#if CLANG_VERSION >= 30700
-using MacroDefinitionParam = clang::MacroDefinition const &;
-#else
-using MacroDefinitionParam = clang::MacroDirective const *;
 #endif
 
-inline void addPPCallbacks(
-    clang::Preprocessor & preprocessor, clang::PPCallbacks * C)
-{
-#if CLANG_VERSION >= 30600
-    preprocessor.addPPCallbacks(std::unique_ptr<clang::PPCallbacks>(C));
-#else
-    preprocessor.addPPCallbacks(C);
-#endif
-}
 
 inline bool isPointWithin(
     clang::SourceManager const & SM, clang::SourceLocation Location, clang::SourceLocation Start,
@@ -272,37 +116,6 @@ inline llvm::StringRef getImmediateMacroNameForDiagnostics(
 #endif
 }
 
-inline auto getAsTagDecl(clang::Type const& t) -> clang::TagDecl *
-{
-#if CLANG_VERSION >= 30500
-    // TODO not sure if it works with clang 3.6, trunk is known to work
-    return t.getAsTagDecl();
-#else
-    return t.getAs<clang::TagType>()->getDecl();
-#endif
-}
-
-inline bool isStdNamespace(clang::DeclContext const & context) {
-#if CLANG_VERSION >= 30500
-    return context.isStdNamespace();
-#else
-    // cf. lib/AST/DeclBase.cpp:
-    if (!context.isNamespace()) {
-        return false;
-    }
-    const clang::NamespaceDecl *ND = clang::cast<clang::NamespaceDecl>(
-        &context);
-    if (ND->isInline()) {
-        return isStdNamespace(*ND->getParent());
-    }
-    if (!context.getParent()->getRedeclContext()->isTranslationUnit()) {
-        return false;
-    }
-    const clang::IdentifierInfo *II = ND->getIdentifier();
-    return II && II->isStr("std");
-#endif
-}
-
 // Work around <http://reviews.llvm.org/D22128>:
 //
 // SfxErrorHandler::GetClassString (svtools/source/misc/ehdl.cxx):
diff --git a/compilerplugins/clang/constantparam.cxx b/compilerplugins/clang/constantparam.cxx
index e09050a2af12..461eb52a2e97 100644
--- a/compilerplugins/clang/constantparam.cxx
+++ b/compilerplugins/clang/constantparam.cxx
@@ -107,12 +107,8 @@ void ConstantParam::addToCallSet(const FunctionDecl* functionDecl, int paramInde
         functionDecl = functionDecl->getInstantiatedFromMemberFunction();
     else if (functionDecl->getClassScopeSpecializationPattern())
         functionDecl = functionDecl->getClassScopeSpecializationPattern();
-// workaround clang-3.5 issue
-#if CLANG_VERSION >= 30600
     else if (functionDecl->getTemplateInstantiationPattern())
         functionDecl = functionDecl->getTemplateInstantiationPattern();
-#endif
-
 
     if (!functionDecl->getNameInfo().getLoc().isValid())
         return;
@@ -131,7 +127,7 @@ void ConstantParam::addToCallSet(const FunctionDecl* functionDecl, int paramInde
 
 
     MyCallSiteInfo aInfo;
-    aInfo.returnType = compat::getReturnType(*functionDecl).getCanonicalType().getAsString();
+    aInfo.returnType = functionDecl->getReturnType().getCanonicalType().getAsString();
 
     if (isa<CXXMethodDecl>(functionDecl)) {
         const CXXRecordDecl* recordDecl = dyn_cast<CXXMethodDecl>(functionDecl)->getParent();
@@ -259,11 +255,8 @@ bool ConstantParam::VisitCallExpr(const CallExpr * callExpr) {
         functionDecl = functionDecl->getInstantiatedFromMemberFunction();
     else if (functionDecl->getClassScopeSpecializationPattern())
         functionDecl = functionDecl->getClassScopeSpecializationPattern();
-// workaround clang-3.5 issue
-#if CLANG_VERSION >= 30600
     else if (functionDecl->getTemplateInstantiationPattern())
         functionDecl = functionDecl->getTemplateInstantiationPattern();
-#endif
 
     unsigned len = std::max(callExpr->getNumArgs(), functionDecl->getNumParams());
     for (unsigned i = 0; i < len; ++i) {
diff --git a/compilerplugins/clang/countusersofdefaultparams.cxx b/compilerplugins/clang/countusersofdefaultparams.cxx
index de0ab7e741cf..d86e66a35490 100644
--- a/compilerplugins/clang/countusersofdefaultparams.cxx
+++ b/compilerplugins/clang/countusersofdefaultparams.cxx
@@ -95,11 +95,8 @@ void CountUsersOfDefaultParams::niceName(const FunctionDecl* functionDecl, MyFun
         functionDecl = functionDecl->getInstantiatedFromMemberFunction();
     else if (functionDecl->getClassScopeSpecializationPattern())
         functionDecl = functionDecl->getClassScopeSpecializationPattern();
-// workaround clang-3.5 issue
-#if CLANG_VERSION >= 30600
     else if (functionDecl->getTemplateInstantiationPattern())
         functionDecl = functionDecl->getTemplateInstantiationPattern();
-#endif
 
     switch (functionDecl->getAccess())
     {
@@ -108,7 +105,7 @@ void CountUsersOfDefaultParams::niceName(const FunctionDecl* functionDecl, MyFun
     case AS_protected: aInfo.access = "protected"; break;
     default: aInfo.access = "unknown"; break;
     }
-    aInfo.returnType = compat::getReturnType(*functionDecl).getCanonicalType().getAsString();
+    aInfo.returnType = functionDecl->getReturnType().getCanonicalType().getAsString();
 
     if (isa<CXXMethodDecl>(functionDecl)) {
         const CXXRecordDecl* recordDecl = dyn_cast<CXXMethodDecl>(functionDecl)->getParent();
@@ -160,11 +157,8 @@ bool CountUsersOfDefaultParams::VisitCallExpr(const CallExpr * callExpr) {
         functionDecl = functionDecl->getInstantiatedFromMemberFunction();
     else if (functionDecl->getClassScopeSpecializationPattern())
         functionDecl = functionDecl->getClassScopeSpecializationPattern();
-// workaround clang-3.5 issue
-#if CLANG_VERSION >= 30600
     else if (functionDecl->getTemplateInstantiationPattern())
         functionDecl = functionDecl->getTemplateInstantiationPattern();
-#endif
     int n = functionDecl->getNumParams() - 1;
     if (n < 0 || !functionDecl->getParamDecl(n)->hasDefaultArg()) {
         return true;
@@ -192,11 +186,8 @@ bool CountUsersOfDefaultParams::VisitCXXConstructExpr(const CXXConstructExpr * c
         constructorDecl = dyn_cast<CXXConstructorDecl>(constructorDecl->getInstantiatedFromMemberFunction());
     else if (constructorDecl->getClassScopeSpecializationPattern())
         constructorDecl = dyn_cast<CXXConstructorDecl>(constructorDecl->getClassScopeSpecializationPattern());
-// workaround clang-3.5 issue
-#if CLANG_VERSION >= 30600
     else if (constructorDecl->getTemplateInstantiationPattern())
         constructorDecl = dyn_cast<CXXConstructorDecl>(constructorDecl->getTemplateInstantiationPattern());
-#endif
     int n = constructorDecl->getNumParams() - 1;
     if (n < 0 || !constructorDecl->getParamDecl(n)->hasDefaultArg()) {
         return true;
diff --git a/compilerplugins/clang/datamembershadow.cxx b/compilerplugins/clang/datamembershadow.cxx
index cc2ec7675b8d..040743bad028 100644
--- a/compilerplugins/clang/datamembershadow.cxx
+++ b/compilerplugins/clang/datamembershadow.cxx
@@ -100,8 +100,6 @@ bool DataMemberShadow::VisitFieldDecl(FieldDecl const * fieldDecl)
 
     fieldDecl = fieldDecl->getCanonicalDecl();
 
-#if CLANG_VERSION >= 30800
-
     auto BaseMatchesCallback = [&](const CXXBaseSpecifier *cxxBaseSpecifier, CXXBasePath& Paths)
     {
         if (!cxxBaseSpecifier->getType().getTypePtr())
@@ -143,7 +141,6 @@ bool DataMemberShadow::VisitFieldDecl(FieldDecl const * fieldDecl)
 
     CXXBasePaths aPaths;
     parentCXXRecordDecl->lookupInBases(BaseMatchesCallback, aPaths);
-#endif
     return true;
 }
 
diff --git a/compilerplugins/clang/expandablemethods.cxx b/compilerplugins/clang/expandablemethods.cxx
index 2f2c3a2d68db..6d70ad81cefa 100644
--- a/compilerplugins/clang/expandablemethods.cxx
+++ b/compilerplugins/clang/expandablemethods.cxx
@@ -116,11 +116,8 @@ MyFuncInfo ExpandableMethods::niceName(const FunctionDecl* functionDecl)
         functionDecl = functionDecl->getInstantiatedFromMemberFunction();
     else if (functionDecl->getClassScopeSpecializationPattern())
         functionDecl = functionDecl->getClassScopeSpecializationPattern();
-// workaround clang-3.5 issue
-#if CLANG_VERSION >= 30600
     else if (functionDecl->getTemplateInstantiationPattern())
         functionDecl = functionDecl->getTemplateInstantiationPattern();
-#endif
 
     MyFuncInfo aInfo;
     switch (functionDecl->getAccess())
@@ -131,7 +128,7 @@ MyFuncInfo ExpandableMethods::niceName(const FunctionDecl* functionDecl)
     default: aInfo.access = "unknown"; break;
     }
     if (!isa<CXXConstructorDecl>(functionDecl)) {
-        aInfo.returnType = compat::getReturnType(*functionDecl).getCanonicalType().getAsString();
+        aInfo.returnType = functionDecl->getReturnType().getCanonicalType().getAsString();
     } else {
         aInfo.returnType = "";
     }
diff --git a/compilerplugins/clang/getimplementationname.cxx b/compilerplugins/clang/getimplementationname.cxx
index 81c3473aa678..4c8f2d19ee73 100644
--- a/compilerplugins/clang/getimplementationname.cxx
+++ b/compilerplugins/clang/getimplementationname.cxx
@@ -13,7 +13,6 @@
 // only compile this on clang 3.7 or higher, which is known to work
 // there were problems on clang 3.5 at least
 #include "config_clang.h"
-#if CLANG_VERSION >= 30700
 #include <cassert>
 #include <stdlib.h>
 #include <string>
@@ -312,6 +311,5 @@ loplugin::Plugin::Registration<GetImplementationName> X(
     "getimplementationname", false);
 }
 #endif
-#endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx
index 41f6fd56bcae..d7e80f56ab36 100644
--- a/compilerplugins/clang/implicitboolconversion.cxx
+++ b/compilerplugins/clang/implicitboolconversion.cxx
@@ -19,30 +19,6 @@
 #include "compat.hxx"
 #include "plugin.hxx"
 
-#if CLANG_VERSION < 30700
-
-namespace std {
-
-template<> struct iterator_traits<ExprIterator> {
-    typedef std::ptrdiff_t difference_type;
-    typedef Expr * value_type;
-    typedef Expr const ** pointer;
-    typedef Expr const & reference;
-    typedef std::random_access_iterator_tag iterator_category;
-};
-
-template<> struct iterator_traits<ConstExprIterator> {
-    typedef std::ptrdiff_t difference_type;
-    typedef Expr const * value_type;
-    typedef Expr const ** pointer;
-    typedef Expr const & reference;
-    typedef std::random_access_iterator_tag iterator_category;
-};
-
-}
-
-#endif
-
 namespace {
 
 Expr const * ignoreParenAndTemporaryMaterialization(Expr const * expr) {
@@ -334,19 +310,19 @@ bool ImplicitBoolConversion::TraverseCallExpr(CallExpr * expr) {
             std::ptrdiff_t n = j - expr->arg_begin();
             assert(n >= 0);
             if (t != nullptr
-                && static_cast<std::size_t>(n) >= compat::getNumParams(*t))
+                && static_cast<std::size_t>(n) >= t->getNumParams())
             {
                 assert(t->isVariadic());
                 // ignore bool to int promotions of variadic arguments
             } else if (bExt) {
                 if (t != nullptr) {
                     assert(
-                        static_cast<std::size_t>(n) < compat::getNumParams(*t));
-                    if (!(compat::getParamType(*t, n)->isSpecificBuiltinType(
+                        static_cast<std::size_t>(n) < t->getNumParams());
+                    if (!(t->getParamType(n)->isSpecificBuiltinType(
                               BuiltinType::Int)
-                          || compat::getParamType(*t, n)->isSpecificBuiltinType(
+                          || t->getParamType(n)->isSpecificBuiltinType(
                               BuiltinType::UInt)
-                          || compat::getParamType(*t, n)->isSpecificBuiltinType(
+                          || t->getParamType(n)->isSpecificBuiltinType(
                               BuiltinType::Long)))
                     {
                         reportWarning(i);
@@ -831,7 +807,7 @@ bool ImplicitBoolConversion::TraverseReturnStmt(ReturnStmt * stmt) {
 bool ImplicitBoolConversion::TraverseFunctionDecl(FunctionDecl * decl) {
     bool bExt = false;
     if (hasCLanguageLinkageType(decl) && decl->isThisDeclarationADefinition()) {
-        QualType t { compat::getReturnType(*decl) };
+        QualType t { decl->getReturnType() };
         if (t->isSpecificBuiltinType(BuiltinType::Int)
             || t->isSpecificBuiltinType(BuiltinType::UInt))
         {
diff --git a/compilerplugins/clang/includeform.cxx b/compilerplugins/clang/includeform.cxx
index bf3d689c603b..4994e8ddd75b 100644
--- a/compilerplugins/clang/includeform.cxx
+++ b/compilerplugins/clang/includeform.cxx
@@ -7,6 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <memory>
+
 #include "compat.hxx"
 #include "plugin.hxx"
 
@@ -16,7 +18,7 @@ class IncludeForm final: public PPCallbacks, public loplugin::RewritePlugin {
 public:
     explicit IncludeForm(loplugin::InstantiationData const & data):
         RewritePlugin(data)
-    { compat::addPPCallbacks(compiler.getPreprocessor(), this); }
+    { compiler.getPreprocessor().addPPCallbacks(std::unique_ptr<PPCallbacks>(this)); }
 
 private:
     void run() override {}
diff --git a/compilerplugins/clang/inlinesimplememberfunctions.cxx b/compilerplugins/clang/inlinesimplememberfunctions.cxx
index de8de482513b..9a1d1f6f3abb 100644
--- a/compilerplugins/clang/inlinesimplememberfunctions.cxx
+++ b/compilerplugins/clang/inlinesimplememberfunctions.cxx
@@ -31,10 +31,10 @@ private:
 };
 
 static bool oneAndOnlyOne(clang::Stmt::const_child_range range) {
-    if (compat::begin(range) == compat::end(range)) {
+    if (range.begin() == range.end()) {
         return false;
     }
-    if (++compat::begin(range) != compat::end(range)) {
+    if (++range.begin() != range.end()) {
         return false;
     }
     return true;
@@ -133,7 +133,7 @@ bool InlineSimpleMemberFunctions::VisitCXXMethodDecl(const CXXMethodDecl * funct
         {
             childStmt2 = *childStmt2->child_begin();
             if (dyn_cast<CXXThisExpr>( childStmt2 ) != nullptr
-                && compat::begin(childStmt2->children()) == compat::end(childStmt2->children()))
+                && childStmt2->children().begin() == childStmt2->children().end())
             {
                 return true;
             }
@@ -144,7 +144,7 @@ bool InlineSimpleMemberFunctions::VisitCXXMethodDecl(const CXXMethodDecl * funct
     {
         const Stmt* childStmt2 = *childStmt->child_begin();
         if (dyn_cast<CXXThisExpr>( childStmt2 ) != nullptr
-            && compat::begin(childStmt2->children()) == compat::end(childStmt2->children()))
+            && childStmt2->children().begin() == childStmt2->children().end())
         {
             return true;
         }
@@ -207,7 +207,7 @@ bool InlineSimpleMemberFunctions::VisitCXXMethodDecl(const CXXMethodDecl * funct
                 }
              return true;
         }
-        if ( compat::begin(childStmt->children()) == compat::end(childStmt->children()) )
+        if ( childStmt->children().begin() == childStmt->children().end() )
             return true;
         childStmt = *childStmt->child_begin();
     }
diff --git a/compilerplugins/clang/oslendian.cxx b/compilerplugins/clang/oslendian.cxx
index 2a7bfa6b2efb..75b1dcfdde9f 100644
--- a/compilerplugins/clang/oslendian.cxx
+++ b/compilerplugins/clang/oslendian.cxx
@@ -8,8 +8,8 @@
  */
 
 #include <cassert>
+#include <memory>
 
-#include "compat.hxx"
 #include "plugin.hxx"
 
 namespace {
@@ -17,7 +17,7 @@ namespace {
 class OslEndian: public loplugin::Plugin, public PPCallbacks {
 public:
     explicit OslEndian(loplugin::InstantiationData const & data): Plugin(data) {
-        compat::addPPCallbacks(compiler.getPreprocessor(), this);
+        compiler.getPreprocessor().addPPCallbacks(std::unique_ptr<PPCallbacks>(this));
     }
 
     enum { isPPCallback = true };
@@ -59,7 +59,7 @@ private:
     }
 
     void MacroUndefined(
-        Token const & MacroNameTok, compat::MacroDefinitionParam
+        Token const & MacroNameTok, MacroDefinition const &
 #if CLANG_VERSION >= 50000
         , MacroDirective const *
 #endif
@@ -75,7 +75,7 @@ private:
     }
 
     void Defined(
-        Token const & MacroNameTok, compat::MacroDefinitionParam, SourceRange)
+        Token const & MacroNameTok, MacroDefinition const &, SourceRange)
         override
     {
         check(MacroNameTok);
@@ -83,14 +83,14 @@ private:
 
     void Ifdef(
         SourceLocation, Token const & MacroNameTok,
-        compat::MacroDefinitionParam) override
+        MacroDefinition const &) override
     {
         check(MacroNameTok);
     }
 
     void Ifndef(
         SourceLocation, Token const & MacroNameTok,
-        compat::MacroDefinitionParam) override
+        MacroDefinition const &) override
     {
         check(MacroNameTok);
     }
diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx
index 3b4b974c697f..8c522efb5dbe 100644
--- a/compilerplugins/clang/passstuffbyref.cxx
+++ b/compilerplugins/clang/passstuffbyref.cxx
@@ -11,7 +11,6 @@
 #include <set>
 
 #include "check.hxx"
-#include "compat.hxx"
 #include "plugin.hxx"
 
 // Find places where various things are passed by value.
@@ -222,7 +221,7 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
         return;
     }
 
-    const QualType type = compat::getReturnType(*functionDecl).getDesugaredType(compiler.getASTContext());
+    const QualType type = functionDecl->getReturnType().getDesugaredType(compiler.getASTContext());
     if (type->isReferenceType() || type->isIntegralOrEnumerationType() || type->isPointerType()
         || type->isTemplateTypeParmType() || type->isDependentType() || type->isBuiltinType()
         || type->isScalarType())
diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx
index 1740a5d05486..433bd0a9efad 100644
--- a/compilerplugins/clang/pluginhandler.cxx
+++ b/compilerplugins/clang/pluginhandler.cxx
@@ -10,7 +10,8 @@
  */
 
 #include <memory>
-#include "compat.hxx"
+#include <system_error>
+
 #include "plugin.hxx"
 #include "pluginhandler.hxx"
 
@@ -168,9 +169,9 @@ DiagnosticBuilder PluginHandler::report( DiagnosticsEngine::Level level, const c
     }
     fullMessage += "]";
     if( loc.isValid())
-        return diag.Report( loc, compat::getCustomDiagID(diag, level, fullMessage) );
+        return diag.Report( loc, diag.getDiagnosticIDs()->getCustomDiagID(static_cast<DiagnosticIDs::Level>(level), fullMessage) );
     else
-        return diag.Report( compat::getCustomDiagID(diag, level, fullMessage) );
+        return diag.Report( diag.getDiagnosticIDs()->getCustomDiagID(static_cast<DiagnosticIDs::Level>(level), fullMessage) );
 }
 
 DiagnosticBuilder PluginHandler::report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc )
@@ -305,15 +306,18 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
         sprintf( filename, "%s.new.%d", modifyFile.c_str(), getpid());
         std::string error;
         bool bOk = false;
+        std::error_code ec;
         std::unique_ptr<raw_fd_ostream> ostream(
-            compat::create_raw_fd_ostream(filename, error) );
-        if( error.empty())
+            new raw_fd_ostream(filename, ec, sys::fs::F_None));
+        if( !ec)
         {
             it->second.write( *ostream );
             ostream->close();
             if( !ostream->has_error() && rename( filename, modifyFile.c_str()) == 0 )
                 bOk = true;
         }
+        else
+            error = "error: " + ec.message();
         ostream->clear_error();
         unlink( filename );
         if( !bOk )
@@ -323,17 +327,10 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
 #endif
  }
 
-#if CLANG_VERSION >= 30600
 std::unique_ptr<ASTConsumer> LibreOfficeAction::CreateASTConsumer( CompilerInstance& Compiler, StringRef )
 {
     return llvm::make_unique<PluginHandler>( Compiler, _args );
 }
-#else
-ASTConsumer* LibreOfficeAction::CreateASTConsumer( CompilerInstance& Compiler, StringRef )
-{
-    return new PluginHandler( Compiler, _args );
-}
-#endif
 
 bool LibreOfficeAction::ParseArgs( const CompilerInstance&, const std::vector< std::string >& args )
 {
diff --git a/compilerplugins/clang/pluginhandler.hxx b/compilerplugins/clang/pluginhandler.hxx
index 2befaf7fc6a8..ea0eb2444506 100644
--- a/compilerplugins/clang/pluginhandler.hxx
+++ b/compilerplugins/clang/pluginhandler.hxx
@@ -80,11 +80,7 @@ class LibreOfficeAction
     : public PluginASTAction
 {
 public:
-#if CLANG_VERSION >= 30600
     virtual std::unique_ptr<ASTConsumer> CreateASTConsumer( CompilerInstance& Compiler, StringRef InFile );
-#else
-    virtual ASTConsumer* CreateASTConsumer( CompilerInstance& Compiler, StringRef InFile );
-#endif
 
     virtual bool ParseArgs( const CompilerInstance& CI, const std::vector< std::string >& args );
 private:
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx
index 2f905d355720..c4d50424b1a0 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -103,20 +103,10 @@ public:
         }
     }
 
-    bool TraverseInitListExpr(
-        InitListExpr * expr
-#if CLANG_VERSION >= 30800
-        , DataRecursionQueue * queue = nullptr
-#endif
-        )
-    {
+    bool TraverseInitListExpr(InitListExpr * expr, DataRecursionQueue * queue = nullptr) {
         return WalkUpFromInitListExpr(expr)
             && TraverseSynOrSemInitListExpr(
-                expr->isSemanticForm() ? expr : expr->getSemanticForm()
-#if CLANG_VERSION >= 30800
-                , queue
-#endif
-                );
+                expr->isSemanticForm() ? expr : expr->getSemanticForm(), queue);
     }
 
     bool VisitImplicitCastExpr(ImplicitCastExpr const * expr);
@@ -806,7 +796,7 @@ bool RedundantCast::visitBinOp(BinaryOperator const * expr) {
 
 bool RedundantCast::isOverloadedFunction(FunctionDecl const * decl) {
     auto const ctx = decl->getDeclContext();
-    if (!compat::isLookupContext(*ctx)) {
+    if (!ctx->isLookupContext()) {
         return false;
     }
     auto const canon = decl->getCanonicalDecl();
diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx
index 58a9884ede0d..b902db4efd10 100644
--- a/compilerplugins/clang/refcounting.cxx
+++ b/compilerplugins/clang/refcounting.cxx
@@ -11,7 +11,6 @@
 #include <iostream>
 
 #include "check.hxx"
-#include "compat.hxx"
 #include "plugin.hxx"
 #include "clang/AST/CXXInheritance.h"
 
@@ -95,15 +94,10 @@ bool isDerivedFrom(const CXXRecordDecl *decl, DeclChecker base) {
     if (!decl->hasDefinition()) {
         return false;
     }
-    if (!compat::forallBases(
-            *decl,
-#if CLANG_VERSION < 30800
-            BaseCheckNotSubclass,
-#else
+    if (!decl->forallBases(
             [&base](const CXXRecordDecl *BaseDefinition) -> bool
                 { return BaseCheckNotSubclass(BaseDefinition, &base); },
-#endif
-            &base, true))
+            true))
     {
         return true;
     }
@@ -550,7 +544,7 @@ bool RefCounting::VisitFunctionDecl(const FunctionDecl * functionDecl) {
     if (methodDecl && methodDecl->size_overridden_methods() > 0) {
             return true;
     }
-    checkUnoReference(compat::getReturnType(*functionDecl), functionDecl, nullptr, "return");
+    checkUnoReference(functionDecl->getReturnType(), functionDecl, nullptr, "return");
     return true;
 }
 
diff --git a/compilerplugins/clang/reservedid.cxx b/compilerplugins/clang/reservedid.cxx
index 82bbc7ea033c..5fefb26c2589 100644
--- a/compilerplugins/clang/reservedid.cxx
+++ b/compilerplugins/clang/reservedid.cxx
@@ -59,7 +59,6 @@ void ReservedId::run() {
     if (TraverseDecl(compiler.getASTContext().getTranslationUnitDecl())
         && compiler.hasPreprocessor())
     {
-#if CLANG_VERSION >= 30700
         auto & prep = compiler.getPreprocessor();
         for (auto const & m: prep.macros(false)) {
             auto id = m.first->getName();
@@ -129,7 +128,6 @@ void ReservedId::run() {
                 }
             }
         }
-#endif
     }
 }
 
diff --git a/compilerplugins/clang/salbool.cxx b/compilerplugins/clang/salbool.cxx
index 2402986467b1..e828dbfcfc55 100644
--- a/compilerplugins/clang/salbool.cxx
+++ b/compilerplugins/clang/salbool.cxx
@@ -108,7 +108,7 @@ BoolOverloadKind isBoolOverloadOf(
 // encounter in practice:
 bool hasBoolOverload(FunctionDecl const * decl, bool mustBeDeleted) {
     auto ctx = decl->getDeclContext();
-    if (!compat::isLookupContext(*ctx)) {
+    if (!ctx->isLookupContext()) {
         return false;
     }
     auto res = ctx->lookup(decl->getDeclName());
@@ -285,8 +285,8 @@ bool SalBool::VisitCallExpr(CallExpr * expr) {
         }
     }
     if (ft != nullptr) {
-        for (unsigned i = 0; i != compat::getNumParams(*ft); ++i) {
-            QualType t(compat::getParamType(*ft, i));
+        for (unsigned i = 0; i != ft->getNumParams(); ++i) {
+            QualType t(ft->getParamType(i));
             bool b = false;
             if (t->isLValueReferenceType()) {
                 t = t.getNonReferenceType();
@@ -688,7 +688,7 @@ bool SalBool::VisitFunctionDecl(FunctionDecl const * decl) {
     if (ignoreLocation(decl)) {
         return true;
     }
-    if (isSalBool(compat::getReturnType(*decl).getNonReferenceType())
+    if (isSalBool(decl->getReturnType().getNonReferenceType())
         && !(decl->isDeletedAsWritten() && isa<CXXConversionDecl>(decl)))
     {
         FunctionDecl const * f = decl->getCanonicalDecl();
diff --git a/compilerplugins/clang/sfxpoolitem.cxx b/compilerplugins/clang/sfxpoolitem.cxx
index d2d469d2f4a3..d269070e03fe 100644
--- a/compilerplugins/clang/sfxpoolitem.cxx
+++ b/compilerplugins/clang/sfxpoolitem.cxx
@@ -11,7 +11,6 @@
 #include <iostream>
 
 #include "plugin.hxx"
-#include "compat.hxx"
 #include "check.hxx"
 #include "clang/AST/CXXInheritance.h"
 
@@ -34,13 +33,7 @@ public:
     bool VisitCXXRecordDecl( const CXXRecordDecl* );
 };
 
-bool BaseCheckNotSfxPoolItemSubclass(
-    const CXXRecordDecl *BaseDefinition
-#if CLANG_VERSION < 30800
-    , void *
-#endif
-    )
-{
+bool BaseCheckNotSfxPoolItemSubclass(const CXXRecordDecl *BaseDefinition) {
     if (BaseDefinition && loplugin::TypeCheck(BaseDefinition).Class("SfxPoolItem").GlobalNamespace()) {
         return false;
     }
@@ -58,20 +51,14 @@ bool isDerivedFromSfxPoolItem(const CXXRecordDecl *decl) {
     if (// not sure what hasAnyDependentBases() does,
         // but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
         !decl->hasAnyDependentBases() &&
-        !compat::forallBases(*decl, BaseCheckNotSfxPoolItemSubclass, nullptr, true)) {
+        !decl->forallBases(BaseCheckNotSfxPoolItemSubclass, true)) {
         return true;
     }
     return false;
 }
 
 
-bool BaseCheckNotSwMsgPoolItemSubclass(
-    const CXXRecordDecl *BaseDefinition
-#if CLANG_VERSION < 30800
-    , void *
-#endif
-    )
-{
+bool BaseCheckNotSwMsgPoolItemSubclass(const CXXRecordDecl *BaseDefinition) {
     if (BaseDefinition && loplugin::TypeCheck(BaseDefinition).Class("SwMsgPoolItem")) {
         return false;
     }
@@ -89,7 +76,7 @@ bool isDerivedFromSwMsgPoolItem(const CXXRecordDecl *decl) {
     if (// not sure what hasAnyDependentBases() does,
         // but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
         !decl->hasAnyDependentBases() &&
-        !compat::forallBases(*decl, BaseCheckNotSwMsgPoolItemSubclass, nullptr, true)) {
+        !decl->forallBases(BaseCheckNotSwMsgPoolItemSubclass, true)) {
         return true;
     }
     return false;
diff --git a/compilerplugins/clang/singlevalfields.cxx b/compilerplugins/clang/singlevalfields.cxx
index 85d77b005562..61cfe044d1fd 100644
--- a/compilerplugins/clang/singlevalfields.cxx
+++ b/compilerplugins/clang/singlevalfields.cxx
@@ -13,7 +13,6 @@
 #include <fstream>
 #include <set>
 #include "plugin.hxx"
-#include "compat.hxx"
 
 /**
 Look for fields that are only ever assigned a single constant value.
@@ -262,7 +261,7 @@ bool SingleValFields::VisitMemberExpr( const MemberExpr* memberExpr )
     if (parentFunction && parent && isa<ReturnStmt>(parent)) {
         const Stmt* parent2 = getParentStmt(parent);
         if (parent2 && isa<CompoundStmt>(parent2)) {
-            QualType qt = compat::getReturnType(*parentFunction).getDesugaredType(compiler.getASTContext());
+            QualType qt = parentFunction->getReturnType().getDesugaredType(compiler.getASTContext());
             if (!qt.isConstQualified() && qt->isReferenceType()) {
                 bPotentiallyAssignedTo = true;
             }
@@ -449,10 +448,10 @@ void SingleValFields::checkCallExpr(const Stmt* child, const CallExpr* callExpr,
         return;
     }
     for (unsigned i = 0; i < callExpr->getNumArgs(); ++i) {
-        if (i >= compat::getNumParams(*proto)) // can happen in template code
+        if (i >= proto->getNumParams()) // can happen in template code
             break;
         if (callExpr->getArg(i) == child) {
-            QualType qt = compat::getParamType(*proto, i).getDesugaredType(compiler.getASTContext());
+            QualType qt = proto->getParamType(i).getDesugaredType(compiler.getASTContext());
             if (!qt.isConstQualified() && qt->isReferenceType()) {
                 assignValue = "?";
                 bPotentiallyAssignedTo = true;
diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx
index 7d5b23a7ba04..f4e1f068ec0e 100644
--- a/compilerplugins/clang/staticmethods.cxx
+++ b/compilerplugins/clang/staticmethods.cxx
@@ -10,7 +10,6 @@
 #include "clang/AST/Attr.h"
 
 #include "check.hxx"
-#include "compat.hxx"
 #include "plugin.hxx"
 
 /*
@@ -39,13 +38,7 @@ private:
     StringRef getFilename(SourceLocation loc);
 };
 
-bool BaseCheckNotTestFixtureSubclass(
-    const CXXRecordDecl *BaseDefinition
-#if CLANG_VERSION < 30800
-    , void *
-#endif
-    )
-{
+bool BaseCheckNotTestFixtureSubclass(const CXXRecordDecl *BaseDefinition) {
     if (loplugin::TypeCheck(BaseDefinition).Class("TestFixture").Namespace("CppUnit").GlobalNamespace()) {
         return false;
     }
@@ -58,7 +51,7 @@ bool isDerivedFromTestFixture(const CXXRecordDecl *decl) {
     if (// not sure what hasAnyDependentBases() does,
         // but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
         !decl->hasAnyDependentBases() &&
-        !compat::forallBases(*decl, BaseCheckNotTestFixtureSubclass, nullptr, true)) {
+        !decl->forallBases(BaseCheckNotTestFixtureSubclass, true)) {
         return true;
     }
     return false;
diff --git a/compilerplugins/clang/store/removevirtuals.cxx b/compilerplugins/clang/store/removevirtuals.cxx
index 6ed3dd60e191..e44cb738629e 100644
--- a/compilerplugins/clang/store/removevirtuals.cxx
+++ b/compilerplugins/clang/store/removevirtuals.cxx
@@ -11,7 +11,6 @@
 #include <string>
 #include <iostream>
 #include "plugin.hxx"
-#include "compat.hxx"
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <fcntl.h>
@@ -75,7 +74,7 @@ std::string niceName(const CXXMethodDecl* functionDecl)
 {
     std::string s =
            functionDecl->getParent()->getQualifiedNameAsString() + "::"
-           + compat::getReturnType(*functionDecl).getAsString() + "-"
+           + functionDecl->getReturnType().getAsString() + "-"
            + functionDecl->getNameAsString() + "(";
     for (const ParmVarDecl *pParmVarDecl : functionDecl->params()) {
         s += pParmVarDecl->getType().getAsString();
diff --git a/compilerplugins/clang/store/returnbyref.cxx b/compilerplugins/clang/store/returnbyref.cxx
index 9fa66131a880..51723c0f40a4 100644
--- a/compilerplugins/clang/store/returnbyref.cxx
+++ b/compilerplugins/clang/store/returnbyref.cxx
@@ -10,7 +10,6 @@
 #include <string>
 #include <set>
 
-#include "compat.hxx"
 #include "plugin.hxx"
 
 // Find places where we are returning a pointer to something, where we can be returning a reference.
@@ -55,7 +54,7 @@ bool ReturnByRef::VisitCXXMethodDecl(const CXXMethodDecl * functionDecl) {
     if (isInUnoIncludeFile(functionDecl)) {
         return true;
     }
-    QualType t1 { compat::getReturnType(*functionDecl) };
+    QualType t1 { functionDecl->getReturnType() };
     if (!t1->isPointerType()) {
         return true;
     }
diff --git a/compilerplugins/clang/test/datamembershadow.cxx b/compilerplugins/clang/test/datamembershadow.cxx
index 5965421360ec..a11a7cc51c65 100644
--- a/compilerplugins/clang/test/datamembershadow.cxx
+++ b/compilerplugins/clang/test/datamembershadow.cxx
@@ -11,8 +11,6 @@
 
 #include <config_clang.h>
 
-// '#if CLANG_VERSION >= 30800' covers large parts of compilerplugins/clang/datamembershadow.cxx
-#if CLANG_VERSION >= 30800
 struct Bar {
     int x; // expected-note {{superclass member here [loplugin:datamembershadow]}}
 };
@@ -20,8 +18,5 @@ struct Bar {
 struct Foo : public Bar {
     int x; // expected-error {{data member x is shadowing member in superclass, through inheritance path Foo->Bar [loplugin:datamembershadow]}}
 };
-#else
-// expected-no-diagnostics
-#endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/compilerplugins/clang/unnecessaryoverride.cxx b/compilerplugins/clang/unnecessaryoverride.cxx
index 336c7712a95f..f912e43009bb 100644
--- a/compilerplugins/clang/unnecessaryoverride.cxx
+++ b/compilerplugins/clang/unnecessaryoverride.cxx
@@ -14,7 +14,6 @@
 #include <set>
 
 #include <clang/AST/CXXInheritance.h>
-#include "compat.hxx"
 #include "plugin.hxx"
 
 /**
@@ -102,12 +101,7 @@ public:
 
 private:
     const CXXMethodDecl * findOverriddenOrSimilarMethodInSuperclasses(const CXXMethodDecl *);
-    bool BaseCheckCallback(
-        const CXXRecordDecl *BaseDefinition
-    #if CLANG_VERSION < 30800
-        , void *
-    #endif
-        );
+    bool BaseCheckCallback(const CXXRecordDecl *BaseDefinition);
 };
 
 bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
@@ -277,8 +271,8 @@ bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
         }
     }
 
-    if (compat::getReturnType(*methodDecl).getCanonicalType()
-        != compat::getReturnType(*overriddenMethodDecl).getCanonicalType())
+    if (methodDecl->getReturnType().getCanonicalType()
+        != overriddenMethodDecl->getReturnType().getCanonicalType())
     {
         return true;
     }
@@ -290,7 +284,7 @@ bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
         return true;
 
     const CXXMemberCallExpr* callExpr = nullptr;
-    if (compat::getReturnType(*methodDecl).getCanonicalType()->isVoidType())
+    if (methodDecl->getReturnType().getCanonicalType()->isVoidType())
     {
         if (auto const e = dyn_cast<Expr>(*compoundStmt->body_begin())) {
             callExpr = dyn_cast<CXXMemberCallExpr>(e->IgnoreImplicit()->IgnoreParens());
@@ -395,9 +389,6 @@ const CXXMethodDecl* UnnecessaryOverride::findOverriddenOrSimilarMethodInSupercl
         return nullptr;
     }
 
-#if CLANG_VERSION < 30800
-        return nullptr;
-#else
     std::vector<const CXXMethodDecl*> maSimilarMethods;
 
     auto BaseMatchesCallback = [&](const CXXBaseSpecifier *cxxBaseSpecifier, CXXBasePath& )
@@ -425,8 +416,8 @@ const CXXMethodDecl* UnnecessaryOverride::findOverriddenOrSimilarMethodInSupercl
             {
                 continue;
             }
-            if (compat::getReturnType(*methodDecl).getCanonicalType()
-                != compat::getReturnType(*baseMethod).getCanonicalType())
+            if (methodDecl->getReturnType().getCanonicalType()
+                != baseMethod->getReturnType().getCanonicalType())
             {
                 continue;
             }
@@ -454,7 +445,6 @@ const CXXMethodDecl* UnnecessaryOverride::findOverriddenOrSimilarMethodInSupercl
         return maSimilarMethods[0];
     }
     return nullptr;
-#endif
 }
 
 
diff --git a/compilerplugins/clang/unnecessaryvirtual.cxx b/compilerplugins/clang/unnecessaryvirtual.cxx
index 9ff389d1290e..f9283e3a1754 100644
--- a/compilerplugins/clang/unnecessaryvirtual.cxx
+++ b/compilerplugins/clang/unnecessaryvirtual.cxx
@@ -84,7 +84,7 @@ std::string niceName(const CXXMethodDecl* functionDecl)
 {
     std::string s =
            functionDecl->getParent()->getQualifiedNameAsString() + "::"
-           + compat::getReturnType(*functionDecl).getAsString() + "-"
+           + functionDecl->getReturnType().getAsString() + "-"
            + functionDecl->getNameAsString() + "(";
     for (const ParmVarDecl *pParmVarDecl : compat::parameters(*functionDecl)) {
         s += pParmVarDecl->getType().getAsString();
diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx
index 9122e3565d54..6ea3da69716b 100644
--- a/compilerplugins/clang/unusedmethods.cxx
+++ b/compilerplugins/clang/unusedmethods.cxx
@@ -136,11 +136,8 @@ MyFuncInfo UnusedMethods::niceName(const FunctionDecl* functionDecl)
         functionDecl = functionDecl->getInstantiatedFromMemberFunction();
     else if (functionDecl->getClassScopeSpecializationPattern())
         functionDecl = functionDecl->getClassScopeSpecializationPattern();
-// workaround clang-3.5 issue
-#if CLANG_VERSION >= 30600
     else if (functionDecl->getTemplateInstantiationPattern())
         functionDecl = functionDecl->getTemplateInstantiationPattern();
-#endif
 
     MyFuncInfo aInfo;
     switch (functionDecl->getAccess())
@@ -151,7 +148,7 @@ MyFuncInfo UnusedMethods::niceName(const FunctionDecl* functionDecl)
     default: aInfo.access = "unknown"; break;
     }
     if (!isa<CXXConstructorDecl>(functionDecl)) {
-        aInfo.returnType = compat::getReturnType(*functionDecl).getCanonicalType().getAsString();
+        aInfo.returnType = functionDecl->getReturnType().getCanonicalType().getAsString();
     } else {
         aInfo.returnType = "";
     }
@@ -262,7 +259,7 @@ gotfunc:
     }
 
     // Now do the checks necessary for the "unused return value" analysis
-    if (compat::getReturnType(*calleeFunctionDecl)->isVoidType()) {
+    if (calleeFunctionDecl->getReturnType()->isVoidType()) {
         return true;
     }
     if (!parent) {
diff --git a/compilerplugins/clang/unusedmethodsremove.cxx b/compilerplugins/clang/unusedmethodsremove.cxx
index 3d3886ace0db..33c7ee7a1fec 100644
--- a/compilerplugins/clang/unusedmethodsremove.cxx
+++ b/compilerplugins/clang/unusedmethodsremove.cxx
@@ -76,7 +76,7 @@ UnusedMethodsRemove::~UnusedMethodsRemove()
 std::string niceName(const CXXMethodDecl* functionDecl)
 {
     std::string s =
-        compat::getReturnType(*functionDecl).getCanonicalType().getAsString()
+        functionDecl->getReturnType().getCanonicalType().getAsString()
         + " " + functionDecl->getParent()->getQualifiedNameAsString()
         + "::" + functionDecl->getNameAsString()
         + "(";
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 0f966708bc2d..c2cfeaa08095 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -12,7 +12,6 @@
 #include <iostream>
 
 #include "plugin.hxx"
-#include "compat.hxx"
 #include "check.hxx"
 #include "clang/AST/CXXInheritance.h"
 
@@ -55,13 +54,7 @@ private:
 
 #define BASE_REF_COUNTED_CLASS "VclReferenceBase"
 
-bool BaseCheckNotWindowSubclass(
-    const CXXRecordDecl *BaseDefinition
-#if CLANG_VERSION < 30800
-    , void *
-#endif
-    )
-{
+bool BaseCheckNotWindowSubclass(const CXXRecordDecl *BaseDefinition) {
     return !loplugin::DeclCheck(BaseDefinition).Class(BASE_REF_COUNTED_CLASS)
         .GlobalNamespace();
 }
@@ -80,7 +73,7 @@ bool isDerivedFromVclReferenceBase(const CXXRecordDecl *decl) {
     if (// not sure what hasAnyDependentBases() does,
         // but it avoids classes we don't want, e.g. WeakAggComponentImplHelper1
         !decl->hasAnyDependentBases() &&
-        !compat::forallBases(*decl, BaseCheckNotWindowSubclass, nullptr, true)) {
+        !decl->forallBases(BaseCheckNotWindowSubclass, true)) {
         return true;
     }
     return false;
diff --git a/configure.ac b/configure.ac
index 0689111ae700..4e00de777ec4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5921,8 +5921,7 @@ if test "$GCC" = "yes" -o "$COM_IS_CLANG" = TRUE; then
         ], [AC_MSG_RESULT([no])])
     AC_LANG_POP([C++])
 
-    dnl Available in GCC 4.9 and at least in Clang 3.4 (which is the baseline
-    dnl for at least --enable-compiler-plugins according to README.md):
+    dnl Available in GCC 4.9 and at least since Clang 3.4:
     AC_MSG_CHECKING([whether $CXX supports __attribute__((warn_unused))])
     AC_LANG_PUSH([C++])
     save_CXXFLAGS=$CXXFLAGS
@@ -6419,6 +6418,13 @@ if test "$COM_IS_CLANG" = "TRUE"; then
     else
         compiler_plugins=no
     fi
+    if test "$compiler_plugins" != no -a "$CLANGVER" -lt 30800; then
+        if test "$compiler_plugins" = yes; then
+            AC_MSG_ERROR([Clang $CLANGVER is too old to build compiler plugins; need >= 3.8.0.])
+        else
+            compiler_plugins=no
+        fi
+    fi
     if test "$compiler_plugins" != "no"; then
         dnl The prefix where Clang resides, override to where Clang resides if
         dnl using a source build:
commit 00bc5a097313fbd003675267be961ad3a152ba42
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sun Dec 3 21:46:37 2017 +0200

    wrap scoped enum around css::util::NumberFormat
    
    Change-Id: Icab5ded8bccdb95f79b3fa35ea164f47919c68fa
    Reviewed-on: https://gerrit.libreoffice.org/46339
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index 67177b7d9f44..2ecb7310d543 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -575,8 +575,8 @@ bool SbiScanner::NextSym()
             bool bSuccess = pFormatter->IsNumberFormat(aSym, nIndex, nVal);
             if( bSuccess )
             {
-                short nType_ = pFormatter->GetType(nIndex);
-                if( !(nType_ & css::util::NumberFormat::DATE) )
+                SvNumFormatType nType_ = pFormatter->GetType(nIndex);
+                if( !(nType_ & SvNumFormatType::DATE) )
                     bSuccess = false;
             }
 
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 542c8817700c..d1f4206c31c5 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -2048,7 +2048,7 @@ void SbRtl_DateValue(StarBASIC *, SbxArray & rPar, bool)
         double fResult;
         OUString aStr( rPar.Get(1)->GetOUString() );
         bool bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult );
-        short nType = pFormatter->GetType( nIndex );
+        SvNumFormatType nType = pFormatter->GetType( nIndex );
 
         // DateValue("February 12, 1969") raises error if the system locale is not en_US
         // It seems that both locale number formatter and English number
@@ -2061,9 +2061,9 @@ void SbRtl_DateValue(StarBASIC *, SbxArray & rPar, bool)
             nType = pFormatter->GetType( nIndex );
         }
 
-        if(bSuccess && (nType==css::util::NumberFormat::DATE || nType==css::util::NumberFormat::DATETIME))
+        if(bSuccess && (nType==SvNumFormatType::DATE || nType==SvNumFormatType::DATETIME))
         {
-            if ( nType == css::util::NumberFormat::DATETIME )
+            if ( nType == SvNumFormatType::DATETIME )
             {
                 // cut time
                 if ( fResult  > 0.0 )
@@ -2105,10 +2105,10 @@ void SbRtl_TimeValue(StarBASIC *, SbxArray & rPar, bool)
         double fResult;
         bool bSuccess = pFormatter->IsNumberFormat( rPar.Get(1)->GetOUString(),
                                                    nIndex, fResult );
-        short nType = pFormatter->GetType(nIndex);
-        if(bSuccess && (nType==css::util::NumberFormat::TIME||nType==css::util::NumberFormat::DATETIME))
+        SvNumFormatType nType = pFormatter->GetType(nIndex);
+        if(bSuccess && (nType==SvNumFormatType::TIME||nType==SvNumFormatType::DATETIME))
         {
-            if ( nType == css::util::NumberFormat::DATETIME )
+            if ( nType == SvNumFormatType::DATETIME )
             {
                 // cut days
                 fResult = fmod( fResult, 1 );
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 2eaa60f85e5f..2b81778917e0 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -408,8 +408,9 @@ std::shared_ptr<SvNumberFormatter> SbiInstance::PrepareNumberFormatter( sal_uInt
     std::shared_ptr<SvNumberFormatter> pNumberFormatter(
             new SvNumberFormatter( comphelper::getProcessComponentContext(), eLangType ));
 
-    sal_Int32 nCheckPos = 0; short nType;
-    rnStdTimeIdx = pNumberFormatter->GetStandardFormat( css::util::NumberFormat::TIME, eLangType );
+    sal_Int32 nCheckPos = 0;
+    SvNumFormatType nType;
+    rnStdTimeIdx = pNumberFormatter->GetStandardFormat( SvNumFormatType::TIME, eLangType );
 
     // the formatter's standard templates have only got a two-digit date
     // -> registering an own format
diff --git a/basic/source/sbx/sbxdate.cxx b/basic/source/sbx/sbxdate.cxx
index e59c9214a90b..5342d557e1f0 100644
--- a/basic/source/sbx/sbxdate.cxx
+++ b/basic/source/sbx/sbxdate.cxx
@@ -116,7 +116,8 @@ double ImpGetDate( const SbxValues* p )
 
             sal_uInt32 nIndex;
             sal_Int32 nCheckPos = 0;
-            short nType = 127;
+            SvNumFormatType nType = SvNumFormatType::DEFINED | SvNumFormatType::DATE | SvNumFormatType::TIME | SvNumFormatType::CURRENCY
+                                    | SvNumFormatType::NUMBER | SvNumFormatType::SCIENTIFIC | SvNumFormatType::FRACTION;
 
             // Default templates of the formatter have only two-digit
             // date. Therefore register an own format.
@@ -144,9 +145,9 @@ double ImpGetDate( const SbxValues* p )
             bool bSuccess = pFormatter->IsNumberFormat( *p->pOUString, nIndex, nRes );
             if ( bSuccess )
             {
-                short nType_ = pFormatter->GetType( nIndex );
-                if(!(nType_ & ( css::util::NumberFormat::DATETIME | css::util::NumberFormat::DATE |
-                                css::util::NumberFormat::TIME | css::util::NumberFormat::DEFINED )))
+                SvNumFormatType nType_ = pFormatter->GetType( nIndex );
+                if(!(nType_ & ( SvNumFormatType::DATETIME | SvNumFormatType::DATE |
+                                SvNumFormatType::TIME | SvNumFormatType::DEFINED )))
                 {
                     bSuccess = false;
                 }
@@ -292,7 +293,7 @@ start:
 
             sal_uInt32 nIndex;
             sal_Int32 nCheckPos = 0;
-            short nType;
+            SvNumFormatType nType;
 
             SvtSysLocale aSysLocale;
             DateOrder eDate = aSysLocale.GetLocaleData().getDateOrder();
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 3408c0e9f151..d13cacb3616c 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -703,7 +703,7 @@ void SbxValue::Format( OUString& rRes, const OUString* pFmt ) const
         if( bSuccess )
         {
             sal_Int32 nCheckPos = 0;
-            short nType;
+            SvNumFormatType nType;
             OUString aFmtStr = *pFmt;
             const VbaFormatInfo* pInfo = getFormatInfo( aFmtStr );
             if( pInfo->meType != VbaFormatType::Null )
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index 5071974206a3..31372feab01a 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -1130,8 +1130,8 @@ bool DataBrowser::isDateTimeString( const OUString& aInputString, double& fOutDa
     SvNumberFormatter* pSvNumberFormatter = m_spNumberFormatterWrapper.get() ? m_spNumberFormatterWrapper->getSvNumberFormatter() : nullptr;
     if( !aInputString.isEmpty() &&  pSvNumberFormatter && pSvNumberFormatter->IsNumberFormat( aInputString, nNumberFormat, fOutDateTimeValue ) )
     {
-        short nType = pSvNumberFormatter->GetType( nNumberFormat);
-        return (nType & util::NumberFormat::DATE) || (nType & util::NumberFormat::TIME);
+        SvNumFormatType nType = pSvNumberFormatter->GetType( nNumberFormat);
+        return (nType & SvNumFormatType::DATE) || (nType & SvNumFormatType::TIME);
     }
     return false;
 }
diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx
index 3a791f53baf2..c4e04638abda 100644
--- a/chart2/source/controller/dialogs/tp_Scale.cxx
+++ b/chart2/source/controller/dialogs/tp_Scale.cxx
@@ -422,11 +422,11 @@ DeactivateRC ScaleTabPage::DeactivatePage(SfxItemSet* pItemSet)
     bool bDateAxis = m_nAxisType == chart2::AxisType::DATE;
 
     sal_uInt32 nMinMaxOriginFmt = m_pFmtFldMax->GetFormatKey();
-    if (pNumFormatter->GetType(nMinMaxOriginFmt) == css::util::NumberFormat::TEXT)
+    if (pNumFormatter->GetType(nMinMaxOriginFmt) == SvNumFormatType::TEXT)
         nMinMaxOriginFmt = 0;
     // numberformat_text cause numbers to fail being numbers...  Shouldn't happen, but can.
     sal_uInt32 nStepFmt = m_pFmtFldStepMain->GetFormatKey();
-    if (pNumFormatter->GetType(nStepFmt) == css::util::NumberFormat::TEXT)
+    if (pNumFormatter->GetType(nStepFmt) == SvNumFormatType::TEXT)
         nStepFmt = 0;
 
     Control* pControl = nullptr;
@@ -564,8 +564,8 @@ void ScaleTabPage::SetNumFormat()
 
         if( pNumFormatter )
         {
-            short eType = pNumFormatter->GetType( nFmt );
-            if( eType == css::util::NumberFormat::DATE )
+            SvNumFormatType eType = pNumFormatter->GetType( nFmt );
+            if( eType == SvNumFormatType::DATE )
             {
                 // for intervals use standard format for dates (so you can enter a number of days)
                 const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
@@ -574,23 +574,23 @@ void ScaleTabPage::SetNumFormat()
                 else
                     nFmt = pNumFormatter->GetStandardIndex();
             }
-            else if( eType == css::util::NumberFormat::DATETIME )
+            else if( eType == SvNumFormatType::DATETIME )
             {
                 // for intervals use time format for date times
                 const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
                 if( pFormat )
-                    nFmt = pNumFormatter->GetStandardFormat( css::util::NumberFormat::TIME, pFormat->GetLanguage() );
+                    nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::TIME, pFormat->GetLanguage() );
                 else
-                    nFmt = pNumFormatter->GetStandardFormat( css::util::NumberFormat::TIME );
+                    nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::TIME );
             }
 
-            if( m_nAxisType == chart2::AxisType::DATE && ( eType != css::util::NumberFormat::DATE && eType != css::util::NumberFormat::DATETIME) )
+            if( m_nAxisType == chart2::AxisType::DATE && ( eType != SvNumFormatType::DATE && eType != SvNumFormatType::DATETIME) )
             {
                 const SvNumberformat* pFormat = pNumFormatter->GetEntry( nFmt );
                 if( pFormat )
-                    nFmt = pNumFormatter->GetStandardFormat( css::util::NumberFormat::DATE, pFormat->GetLanguage() );
+                    nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::DATE, pFormat->GetLanguage() );
                 else
-                    nFmt = pNumFormatter->GetStandardFormat( css::util::NumberFormat::DATE );
+                    nFmt = pNumFormatter->GetStandardFormat( SvNumFormatType::DATE );
 
                 m_pFmtFldMax->SetFormatKey( nFmt );
                 m_pFmtFldMin->SetFormatKey( nFmt );
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx
index 7430402e9af5..5d1c3e7c6a90 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -1173,7 +1173,7 @@ sal_Int32 DiagramHelper::getDateTimeInputNumberFormat( const Reference< util::XN
         SAL_WARN("chart2", "DiagramHelper::getDateTimeInputNumberFormat - no SvNumberFormatter");
     else
     {
-        short nType;
+        SvNumFormatType nType;
         // Obtain best matching date, time or datetime format.
         nRet = pNumFormatter->GuessDateTimeFormat( nType, fNumber, LANGUAGE_SYSTEM);
         // Obtain the corresponding edit format.
@@ -1190,7 +1190,7 @@ sal_Int32 DiagramHelper::getPercentNumberFormat( const Reference< util::XNumberF
     SvNumberFormatter* pNumFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
     if( pNumFormatter )
     {
-        nRet = pNumFormatter->GetStandardFormat( util::NumberFormat::PERCENT, rLanguageTag.getLanguageType() );
+        nRet = pNumFormatter->GetStandardFormat( SvNumFormatType::PERCENT, rLanguageTag.getLanguageType() );
     }
     else
     {
diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx
index f0287be40e27..9a517007374d 100644
--- a/cui/source/options/optupdt.cxx
+++ b/cui/source/options/optupdt.cxx
@@ -145,11 +145,11 @@ void SvxOnlineUpdateTabPage::UpdateLastCheckedText()
         SvNumberFormatter *pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessComponentContext(), eUILang );
         Color*      pColor = nullptr;
         const Date& rNullDate = pNumberFormatter->GetNullDate();
-        sal_uInt32  nFormat = pNumberFormatter->GetStandardFormat( css::util::NumberFormat::DATE, eUILang );
+        sal_uInt32  nFormat = pNumberFormatter->GetStandardFormat( SvNumFormatType::DATE, eUILang );
 
         pNumberFormatter->GetOutputString( aDate - rNullDate, nFormat, aDateStr, &pColor );
 
-        nFormat = pNumberFormatter->GetStandardFormat( css::util::NumberFormat::TIME, eUILang );
+        nFormat = pNumberFormatter->GetStandardFormat( SvNumFormatType::TIME, eUILang );
         pNumberFormatter->GetOutputString( aTime.GetTimeInDays(), nFormat, aTimeStr, &pColor );
 
         delete pColor;
diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx
index bae06ba9c1ca..cc7eb2c97f78 100644
--- a/dbaccess/source/ui/misc/UITools.cxx
+++ b/dbaccess/source/ui/misc/UITools.cxx
@@ -834,7 +834,7 @@ bool callColumnFormatDialog(vcl::Window* _pParent,
             pFormatDescriptor->Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, true));
             if (!_pFormatter->IsTextFormat(_nFormatKey))
                 // text fields can only have text formats
-                _nFormatKey = _pFormatter->GetStandardFormat(css::util::NumberFormat::TEXT,_pParent->GetSettings().GetLanguageTag().getLanguageType());
+                _nFormatKey = _pFormatter->GetStandardFormat(SvNumFormatType::TEXT,_pParent->GetSettings().GetLanguageTag().getLanguageType());
         }
 
         pFormatDescriptor->Put(SfxUInt32Item(SBA_DEF_FMTVALUE, _nFormatKey));
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 4435fcf490b9..21baa1593ee6 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -418,7 +418,7 @@ OUString SvxDateField::GetFormatted( Date const & aDate, SvxDateFormat eFormat,
             nFormatKey = rFormatter.GetFormatIndex( NF_DATE_SYS_NNNNDMMMMYYYY, eLang );
         break;
         default:
-            nFormatKey = rFormatter.GetStandardFormat( css::util::NumberFormat::DATE, eLang );
+            nFormatKey = rFormatter.GetStandardFormat( SvNumFormatType::DATE, eLang );
     }
 
     double fDiffDate = aDate - rFormatter.GetNullDate();
@@ -675,7 +675,7 @@ OUString SvxExtTimeField::GetFormatted( tools::Time const & aTime, SvxTimeFormat
             // no builtin format available, try to insert or reuse
             OUString aFormatCode( "HH:MM:SS.00 AM/PM" );
             sal_Int32 nCheckPos;
-            short nType;
+            SvNumFormatType nType;
             rFormatter.PutandConvertEntry( aFormatCode, nCheckPos, nType,
                                            nFormatKey, LANGUAGE_ENGLISH_US, eLang );
             DBG_ASSERT( nCheckPos == 0, "SvxTimeFormat::HH12_MM_SS_00: could not insert format code" );
@@ -699,7 +699,7 @@ OUString SvxExtTimeField::GetFormatted( tools::Time const & aTime, SvxTimeFormat
             break;
         case SvxTimeFormat::Standard:
         default:
-            nFormatKey = rFormatter.GetStandardFormat( css::util::NumberFormat::TIME, eLang );
+            nFormatKey = rFormatter.GetStandardFormat( SvNumFormatType::TIME, eLang );
     }
 
     double fFracTime = aTime.GetTimeInDays();
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index 8be81dbb32c1..5985f5f507d1 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -261,7 +261,7 @@ namespace pcr
 
         getTypedControlWindow()->SetFormatter( getTypedControlWindow()->StandardFormatter() );
         SvNumberFormatter* pFormatter = getTypedControlWindow()->GetFormatter();
-        sal_uLong nStandardDateTimeFormat = pFormatter->GetStandardFormat( css::util::NumberFormat::DATETIME, eSysLanguage );
+        sal_uLong nStandardDateTimeFormat = pFormatter->GetStandardFormat( SvNumFormatType::DATETIME, eSysLanguage );
 
         getTypedControlWindow()->SetFormatKey( nStandardDateTimeFormat );
     }
diff --git a/extensions/source/propctrlr/usercontrol.cxx b/extensions/source/propctrlr/usercontrol.cxx
index 7edad44a1367..213d61c6efa1 100644
--- a/extensions/source/propctrlr/usercontrol.cxx
+++ b/extensions/source/propctrlr/usercontrol.cxx
@@ -118,17 +118,17 @@ namespace pcr
     double OFormatSampleControl::getPreviewValue( const SvNumberformat& i_rEntry )
     {
         double nValue = 1234.56789;
-        switch ( i_rEntry.GetType() & ~css::util::NumberFormat::DEFINED )
+        switch ( i_rEntry.GetType() & ~SvNumFormatType::DEFINED )
         {
-            case css::util::NumberFormat::DATE:
+            case SvNumFormatType::DATE:
                 {
                     Date aCurrentDate( Date::SYSTEM );
                     static css::util::Date STANDARD_DB_DATE(30,12,1899);
                     nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toDate(aCurrentDate.GetDate()),STANDARD_DB_DATE);
                 }
                 break;
-            case css::util::NumberFormat::TIME:
-            case css::util::NumberFormat::DATETIME:
+            case SvNumFormatType::TIME:
+            case SvNumFormatType::DATETIME:
                 {
                     tools::Time aCurrentTime( tools::Time::SYSTEM );
                     nValue = ::dbtools::DBTypeConversion::toDouble(::dbtools::DBTypeConversion::toTime(aCurrentTime.GetTime()));
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 0ee613dcd8f0..da9ac30cc136 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -52,7 +52,7 @@ class FormulaCompilerRecursionGuard
         ~FormulaCompilerRecursionGuard() { --rRecursion; }
 };
 
-short lcl_GetRetFormat( OpCode eOpCode )
+SvNumFormatType lcl_GetRetFormat( OpCode eOpCode )
 {
     switch (eOpCode)
     {
@@ -81,15 +81,15 @@ short lcl_GetRetFormat( OpCode eOpCode )
         case ocIsEven:
         case ocIsOdd:
         case ocExact:
-            return css::util::NumberFormat::LOGICAL;
+            return SvNumFormatType::LOGICAL;
         case ocGetActDate:
         case ocGetDate:
         case ocEasterSunday :
-            return css::util::NumberFormat::DATE;
+            return SvNumFormatType::DATE;
         case ocGetActTime:
-            return css::util::NumberFormat::DATETIME;
+            return SvNumFormatType::DATETIME;
         case ocGetTime:
-            return css::util::NumberFormat::TIME;
+            return SvNumFormatType::TIME;
         case ocNPV:
         case ocPV:
         case ocSYD:
@@ -103,7 +103,7 @@ short lcl_GetRetFormat( OpCode eOpCode )
         case ocPpmt:
         case ocCumIpmt:
         case ocCumPrinc:
-            return css::util::NumberFormat::CURRENCY;
+            return SvNumFormatType::CURRENCY;
         case ocRate:
         case ocIRR:
         case ocMIRR:
@@ -111,9 +111,9 @@ short lcl_GetRetFormat( OpCode eOpCode )
         case ocEffect:
         case ocNominal:
         case ocPercentSign:
-            return css::util::NumberFormat::PERCENT;
+            return SvNumFormatType::PERCENT;
         default:
-            return css::util::NumberFormat::NUMBER;
+            return SvNumFormatType::NUMBER;
     }
 }
 
@@ -716,7 +716,7 @@ FormulaCompiler::FormulaCompiler( FormulaTokenArray& rArr )
         pStack( nullptr ),
         eLastOp( ocPush ),
         nRecursion( 0 ),
-        nNumFmt( css::util::NumberFormat::UNDEFINED ),
+        nNumFmt( SvNumFormatType::UNDEFINED ),
         pc( 0 ),
         meGrammar( formula::FormulaGrammar::GRAM_UNSPECIFIED ),
         bAutoCorrect( false ),
@@ -738,7 +738,7 @@ FormulaCompiler::FormulaCompiler()
         pStack( nullptr ),
         eLastOp( ocPush ),
         nRecursion(0),
-        nNumFmt( css::util::NumberFormat::UNDEFINED ),
+        nNumFmt( SvNumFormatType::UNDEFINED ),
         pc( 0 ),
         meGrammar( formula::FormulaGrammar::GRAM_UNSPECIFIED ),
         bAutoCorrect( false ),
@@ -1417,7 +1417,7 @@ void FormulaCompiler::Factor()
     }
     else
     {
-        if( nNumFmt == css::util::NumberFormat::UNDEFINED )
+        if( nNumFmt == SvNumFormatType::UNDEFINED )
             nNumFmt = lcl_GetRetFormat( eOp );
 
         if ( IsOpCodeVolatile( eOp) )
@@ -1556,8 +1556,8 @@ void FormulaCompiler::Factor()
                 // standard handling of ocNot, ocNeg and 1-parameter opcodes
                 pFacToken = mpToken;
                 eOp = NextToken();
-                if( nNumFmt == css::util::NumberFormat::UNDEFINED && eOp == ocNot )
-                    nNumFmt = css::util::NumberFormat::LOGICAL;
+                if( nNumFmt == SvNumFormatType::UNDEFINED && eOp == ocNot )
+                    nNumFmt = SvNumFormatType::LOGICAL;
                 if (eOp == ocOpen)
                 {
                     NextToken();
@@ -2036,8 +2036,8 @@ bool FormulaCompiler::CompileTokenArray()
         if ( bWasForced )
             pArr->SetRecalcModeForced();
     }
-    if( nNumFmt == css::util::NumberFormat::UNDEFINED )
-        nNumFmt = css::util::NumberFormat::NUMBER;
+    if( nNumFmt == SvNumFormatType::UNDEFINED )
+        nNumFmt = SvNumFormatType::NUMBER;
     return glSubTotal;
 }
 
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index 07ff7cc59b6e..cfd759562d59 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -210,13 +210,13 @@ double & FormulaToken::GetDoubleAsReference()
     return fVal;
 }
 
-short FormulaToken::GetDoubleType() const
+sal_Int16 FormulaToken::GetDoubleType() const
 {
     SAL_WARN( "formula.core", "FormulaToken::GetDoubleType: virtual dummy called" );
     return 0;
 }
 
-void FormulaToken::SetDoubleType( short )
+void FormulaToken::SetDoubleType( sal_Int16 )
 {
     assert( !"virtual dummy called" );
 }
@@ -1785,7 +1785,7 @@ void FormulaTokenArrayPlainIterator::AfterRemoveToken( sal_uInt16 nOffset, sal_u
 double      FormulaDoubleToken::GetDouble() const            { return fDouble; }
 double &    FormulaDoubleToken::GetDoubleAsReference()       { return fDouble; }
 
-short FormulaDoubleToken::GetDoubleType() const
+sal_Int16 FormulaDoubleToken::GetDoubleType() const
 {
     // This is a plain double value without type information, don't emit a
     // warning via FormulaToken::GetDoubleType().
@@ -1797,12 +1797,12 @@ bool FormulaDoubleToken::operator==( const FormulaToken& r ) const
     return FormulaToken::operator==( r ) && fDouble == r.GetDouble();
 }
 
-short FormulaTypedDoubleToken::GetDoubleType() const
+sal_Int16 FormulaTypedDoubleToken::GetDoubleType() const
 {
     return mnType;
 }
 
-void FormulaTypedDoubleToken::SetDoubleType( short nType )
+void FormulaTypedDoubleToken::SetDoubleType( sal_Int16 nType )
 {
     mnType = nType;
 }
diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx
index 852e996dad79..26d996f374e8 100644
--- a/include/formula/FormulaCompiler.hxx
+++ b/include/formula/FormulaCompiler.hxx
@@ -52,6 +52,7 @@ namespace com { namespace sun { namespace star {
 
 class CharClass;
 enum class FormulaError : sal_uInt16;
+enum class SvNumFormatType : sal_Int16;
 
 namespace formula
 {
@@ -236,7 +237,7 @@ public:
     static sal_Unicode      GetNativeSymbolChar( OpCode eOp );
     static  bool            IsMatrixFunction(OpCode _eOpCode);   // if a function _always_ returns a Matrix
 
-    short GetNumFormatType() const { return nNumFmt; }
+    SvNumFormatType GetNumFormatType() const { return nNumFmt; }
     bool  CompileTokenArray();
 
     void CreateStringFromTokenArray( OUString& rFormula );
@@ -340,7 +341,7 @@ protected:
 
     OpCode              eLastOp;
     short               nRecursion;             // GetToken() recursions
-    short               nNumFmt;                // set during CompileTokenArray()
+    SvNumFormatType     nNumFmt;                // set during CompileTokenArray()
     sal_uInt16          pc;                     // program counter
 
     FormulaGrammar::Grammar meGrammar;          // The grammar used, language plus convention.
diff --git a/include/formula/token.hxx b/include/formula/token.hxx
index c3144b4a2dcb..d464ec67d39e 100644
--- a/include/formula/token.hxx
+++ b/include/formula/token.hxx
@@ -183,8 +183,8 @@ public:
     virtual void                SetInForceArray( ParamClass c );
     virtual double              GetDouble() const;
     virtual double&             GetDoubleAsReference();
-    virtual short               GetDoubleType() const;
-    virtual void                SetDoubleType( short nType );
+    virtual sal_Int16           GetDoubleType() const;
+    virtual void                SetDoubleType( sal_Int16 nType );
     virtual svl::SharedString   GetString() const;
     virtual void                SetString( const svl::SharedString& rStr );
     virtual sal_uInt16          GetIndex() const;
@@ -304,7 +304,7 @@ public:
     virtual FormulaToken*       Clone() const override { return new FormulaDoubleToken(*this); }
     virtual double              GetDouble() const override;
     virtual double&             GetDoubleAsReference() override;
-    virtual short               GetDoubleType() const override;     ///< always returns 0 for "not typed"
+    virtual sal_Int16           GetDoubleType() const override;     ///< always returns 0 for "not typed"
     virtual bool                operator==( const FormulaToken& rToken ) const override;
 
     DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaDoubleToken )
@@ -313,19 +313,19 @@ public:
 class FORMULA_DLLPUBLIC FormulaTypedDoubleToken : public FormulaDoubleToken
 {
 private:
-            short               mnType;     /**< Can hold, for example, a value
-                                              of css::util::NumberFormat, or by
+            sal_Int16           mnType;     /**< Can hold, for example, a value
+                                              of SvNumFormatType, or by
                                               contract any other
                                               classification. */
 public:
-                                FormulaTypedDoubleToken( double f, short nType ) :
+                                FormulaTypedDoubleToken( double f, sal_Int16 nType ) :
                                     FormulaDoubleToken( f ), mnType( nType ) {}
                                 FormulaTypedDoubleToken( const FormulaTypedDoubleToken& r ) :
                                     FormulaDoubleToken( r ), mnType( r.mnType ) {}
 
     virtual FormulaToken*       Clone() const override { return new FormulaTypedDoubleToken(*this); }
-    virtual short               GetDoubleType() const override;
-    virtual void                SetDoubleType( short nType ) override;
+    virtual sal_Int16           GetDoubleType() const override;
+    virtual void                SetDoubleType( sal_Int16 nType ) override;
     virtual bool                operator==( const FormulaToken& rToken ) const override;
 
     DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaTypedDoubleToken )
diff --git a/include/svl/zforlist.hxx b/include/svl/zforlist.hxx
index a2ff78f90a34..6e7d196c2a61 100644
--- a/include/svl/zforlist.hxx
+++ b/include/svl/zforlist.hxx
@@ -32,6 +32,7 @@
 #include <tools/link.hxx>
 #include <svl/ondemand.hxx>
 #include <svl/nfkeytab.hxx>
+#include <o3tl/typed_flags_set.hxx>
 
 #include <map>
 #include <memory>
@@ -61,6 +62,55 @@ constexpr sal_uInt32 NF_STANDARD_FORMAT_TEXT = SV_MAX_COUNT_STANDARD_FORMATS;
 
 #define NUMBERFORMAT_ENTRY_NOT_FOUND (sal_uInt32)(0xffffffff)   /// MAX_ULONG
 
+enum class SvNumFormatType : sal_Int16
+{
+    /** selects all number formats.
+      */
+     ALL = css::util::NumberFormat::ALL, // 0
+     /** selects only user-defined number formats.
+      */
+     DEFINED = css::util::NumberFormat::DEFINED,  // 1
+     /** selects date formats.
+      */
+     DATE = css::util::NumberFormat::DATE, // 2
+     /** selects time formats.
+      */
+     TIME = css::util::NumberFormat::TIME, // 4
+     /** selects currency formats.
+      */
+     CURRENCY = css::util::NumberFormat::CURRENCY,  // 8
+     /** selects decimal number formats.
+      */
+     NUMBER = css::util::NumberFormat::NUMBER, // 16
+     /** selects scientific number formats.
+      */
+     SCIENTIFIC = css::util::NumberFormat::SCIENTIFIC, // 32
+     /** selects number formats for fractions.
+      */
+     FRACTION = css::util::NumberFormat::FRACTION, // 64
+     /** selects percentage number formats.
+      */
+     PERCENT = css::util::NumberFormat::PERCENT, // 128
+     /** selects text number formats.
+      */
+     TEXT = css::util::NumberFormat::TEXT, // 256
+     /** selects number formats which contain date and time.
+      */
+     DATETIME = DATE | TIME, // 6
+     /** selects boolean number formats.
+      */
+     LOGICAL = css::util::NumberFormat::LOGICAL, // 1024
+     /** is used as a return value if no format exists.
+      */
+     UNDEFINED = css::util::NumberFormat::UNDEFINED, // 2048
+     /** @internal is used to flag an empty sub format.
+         @since LibreOffice 5.1
+      */
+     EMPTY = css::util::NumberFormat::EMPTY, // 4096
+};
+namespace o3tl {
+    template<> struct typed_flags<SvNumFormatType> : is_typed_flags<SvNumFormatType, 0x1dff> {};
+}
 
 /** enum values for <method>SvNumberFormatter::GetFormatIndex</method>
 
@@ -361,26 +411,26 @@ public:
     LanguageType GetLanguage() const;
 
     // Determine whether two format types are input compatible or not
-    static bool IsCompatible(short eOldType, short eNewType);
+    static bool IsCompatible(SvNumFormatType eOldType, SvNumFormatType eNewType);
 
     /** Get table of formats of a specific type of a locale. A format FIndex is
         tested whether it has the type and locale requested, if it doesn't
         match FIndex returns the default format for the type/locale. If no
         specific format is to be selected FIndex may be initialized to 0. */
-    SvNumberFormatTable& GetEntryTable(short eType,
+    SvNumberFormatTable& GetEntryTable(SvNumFormatType eType,
                                        sal_uInt32& FIndex,
                                        LanguageType eLnge);
 
     /** Get table of formats of a specific type of a language/country.
         FIndex returns the default format of that type.
         If the language/country was never touched before new entries are generated */
-    SvNumberFormatTable& ChangeCL(short eType,
+    SvNumberFormatTable& ChangeCL(SvNumFormatType eType,
                                   sal_uInt32& FIndex,
                                   LanguageType eLnge);
 
     /** Get table of formats of the same type as FIndex; eType and rLnge are
         set accordingly. An unknown format is set to Standard/General */
-    SvNumberFormatTable& GetFirstEntryTable(short& eType,
+    SvNumberFormatTable& GetFirstEntryTable(SvNumFormatType& eType,
                                             sal_uInt32& FIndex,
                                             LanguageType& rLnge);
 
@@ -400,14 +450,14 @@ public:
             nType contains the type of the format.
             nKey contains the index key of the format.
      */
-    bool PutEntry( OUString& rString, sal_Int32& nCheckPos, short& nType, sal_uInt32& nKey,
+    bool PutEntry( OUString& rString, sal_Int32& nCheckPos, SvNumFormatType& nType, sal_uInt32& nKey,
                    LanguageType eLnge = LANGUAGE_DONTKNOW );
 
     /** Same as <method>PutEntry</method> but the format code string is
          considered to be of language/country eLnge and is converted to
         language/country eNewLnge */
     bool PutandConvertEntry( OUString& rString, sal_Int32& nCheckPos,
-                             short& nType, sal_uInt32& nKey,
+                             SvNumFormatType& nType, sal_uInt32& nKey,
                              LanguageType eLnge, LanguageType eNewLnge,
                              bool bForExcelExport = false );
 
@@ -416,7 +466,7 @@ public:
         converted to another System language/country eNewLnge. In this case
          the automatic currency is converted too. */
     bool PutandConvertEntrySystem( OUString& rString, sal_Int32& nCheckPos,
-                                   short& nType, sal_uInt32& nKey,
+                                   SvNumFormatType& nType, sal_uInt32& nKey,
                                    LanguageType eLnge, LanguageType eNewLnge );
 
     /** Similar to <method>PutEntry</method> and
@@ -457,7 +507,7 @@ public:
             and/or could not be converted.
      */
     sal_uInt32 GetIndexPuttingAndConverting( OUString & rString, LanguageType eLnge,
-                                             LanguageType eSysLnge, short & rType,
+                                             LanguageType eSysLnge, SvNumFormatType & rType,
                                              bool & rNewInserted, sal_Int32 & rCheckPos );
 
     /** Create a format code string using format nIndex as a template and
@@ -566,17 +616,17 @@ public:
     sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW);
 
     /// Return the format index of the default format of a type for language/country
-    sal_uInt32 GetStandardFormat(short eType, LanguageType eLnge = LANGUAGE_DONTKNOW);
+    sal_uInt32 GetStandardFormat(SvNumFormatType eType, LanguageType eLnge = LANGUAGE_DONTKNOW);
 
     /** Return the format index of the default format of a type for language/country.
         Maybe not the default format but a special builtin format, e.g. for
         NF_TIME_HH_MMSS00, if that format is passed in nFIndex. */
-    sal_uInt32 GetStandardFormat( sal_uInt32 nFIndex, short eType, LanguageType eLnge );
+    sal_uInt32 GetStandardFormat( sal_uInt32 nFIndex, SvNumFormatType eType, LanguageType eLnge );
 
     /** Return the format index of the default format of a type for language/country.
         Maybe not the default format but a special builtin format, e.g. for
         NF_TIME_HH_MMSS00, or NF_TIME_HH_MMSS if fNumber >= 1.0  */
-    sal_uInt32 GetStandardFormat( double fNumber, sal_uInt32 nFIndex, short eType,
+    sal_uInt32 GetStandardFormat( double fNumber, sal_uInt32 nFIndex, SvNumFormatType eType,
                                   LanguageType eLnge );
 
     /// Whether nFIndex is a special builtin format
@@ -589,10 +639,10 @@ public:
         fNumber is assumed to be a date, time or datetime value, but unknown
         which. Originally introduced for Chart databrowser editor, probably
         should not be used otherwise. */
-    sal_uInt32 GuessDateTimeFormat( short& rType, double fNumber, LanguageType eLnge );
+    sal_uInt32 GuessDateTimeFormat( SvNumFormatType& rType, double fNumber, LanguageType eLnge );
 
     /** Return the corresponding edit format of a format. */
-    sal_uInt32 GetEditFormat( double fNumber, sal_uInt32 nFIndex, short eType,
+    sal_uInt32 GetEditFormat( double fNumber, sal_uInt32 nFIndex, SvNumFormatType eType,
                               LanguageType eLnge, SvNumberformat const * pFormat );
 
     /// Return the reference date
@@ -603,7 +653,7 @@ public:
     bool GetNoZero() const;
     /** Get the type of a format (or css::util::NumberFormat::UNDEFINED if no entry),
          but with css::util::NumberFormat::DEFINED masked out */
-    short GetType(sal_uInt32 nFIndex) const;
+    SvNumFormatType GetType(sal_uInt32 nFIndex) const;
 
     /// As the name says
     void ClearMergeTable();
@@ -909,7 +959,7 @@ private:
 
     // Return the default format for a given type and current locale.
     // May ONLY be called from within GetStandardFormat().
-    SVL_DLLPRIVATE sal_uInt32   ImpGetDefaultFormat( short nType );
+    SVL_DLLPRIVATE sal_uInt32   ImpGetDefaultFormat( SvNumFormatType nType );
 
     // Return the index in a sequence of format codes matching an enum of
     // NfIndexTableOffset. If not found 0 is returned. If the sequence doesn't
diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx
index 2b4813184c9d..38479dfc6aef 100644
--- a/include/svl/zformat.hxx
+++ b/include/svl/zformat.hxx
@@ -46,7 +46,6 @@ enum SvNumberformatLimitOps
     NUMBERFORMAT_OP_GE  = 6             // Operator >=
 };
 
-
 struct ImpSvNumberformatInfo            // Struct for FormatInfo
 {
     std::vector<OUString> sStrArray;    // Array of symbols
@@ -55,7 +54,7 @@ struct ImpSvNumberformatInfo            // Struct for FormatInfo
     sal_uInt16 nCntPre;                 // Count of digits before decimal point
     sal_uInt16 nCntPost;                // Count of digits after decimal point
     sal_uInt16 nCntExp;                 // Count of exponent digits, or AM/PM
-    short eScannedType;                 // Type determined by scan
+    SvNumFormatType eScannedType;       // Type determined by scan
     bool bThousand;                     // Has group (AKA thousand) separator
 
     void Copy( const ImpSvNumberformatInfo& rNumFor, sal_uInt16 nAnz );
@@ -176,12 +175,12 @@ public:
     ~SvNumberformat();
 
     /// Get type of format, may include css::util::NumberFormat::DEFINED bit
-    short GetType() const                       { return eType; }
+    SvNumFormatType GetType() const             { return eType; }
 
     /// Get type of format, does not include css::util::NumberFormat::DEFINED
-    short GetMaskedType() const                 { return eType & ~css::util::NumberFormat::DEFINED; }
+    SvNumFormatType GetMaskedType() const       { return eType & ~SvNumFormatType::DEFINED; }
 
-    void SetType(const short eSetType)          { eType = eSetType; }
+    void SetType(SvNumFormatType eSetType)      { eType = eSetType; }
     // Standard means the I18N defined standard format of this type
     void SetStandard()                          { bStandard = true; }
     bool IsStandard() const                     { return bStandard; }
@@ -233,12 +232,12 @@ public:
     void GetOutputString( const OUString& sString, OUString& OutString, Color** ppColor );
 
     // True if type text
-    bool IsTextFormat() const { return (eType & css::util::NumberFormat::TEXT) != 0; }
+    bool IsTextFormat() const { return bool(eType & SvNumFormatType::TEXT); }
     // True if 4th subformat present
     bool HasTextFormat() const
         {
             return (NumFor[3].GetCount() > 0) ||
-                (NumFor[3].Info().eScannedType == css::util::NumberFormat::TEXT);
+                (NumFor[3].Info().eScannedType == SvNumFormatType::TEXT);
         }
 
     void GetFormatSpecialInfo(bool& bThousand,
@@ -318,9 +317,9 @@ public:
     sal_uInt16 GetNumForNumberElementCount( sal_uInt16 nNumFor ) const;
 
     /** Get the scanned type of the specified subformat. */
-    short GetNumForInfoScannedType( sal_uInt16 nNumFor ) const
+    SvNumFormatType GetNumForInfoScannedType( sal_uInt16 nNumFor ) const
     {
-        return (nNumFor < 4) ? NumFor[nNumFor].Info().eScannedType : css::util::NumberFormat::UNDEFINED;
+        return (nNumFor < 4) ? NumFor[nNumFor].Info().eScannedType : SvNumFormatType::UNDEFINED;
     }
 
     // Whether the second subformat code is really for negative numbers
@@ -427,7 +426,7 @@ public:
     void GetConditions( SvNumberformatLimitOps& rOper1, double& rVal1,
                         SvNumberformatLimitOps& rOper2, double& rVal2 ) const;
     Color* GetColor( sal_uInt16 nNumFor ) const;
-    void GetNumForInfo( sal_uInt16 nNumFor, short& rScannedType,
+    void GetNumForInfo( sal_uInt16 nNumFor, SvNumFormatType& rScannedType,
                     bool& bThousand, sal_uInt16& nPrecision, sal_uInt16& nLeadingCnt ) const;
 
     // rAttr.Number not empty if NatNum attributes are to be stored
@@ -483,7 +482,7 @@ private:
     LocaleType maLocale;            // Language/country of the format, numeral shape and calendar type from Excel.
     SvNumberformatLimitOps eOp1;    // Operator for first condition
     SvNumberformatLimitOps eOp2;    // Operator for second condition
-    short eType;                    // Type of format
+    SvNumFormatType eType;          // Type of format
     bool bAdditionalBuiltin;        // If this is an additional built-in format defined by i18n
     bool bStarFlag;                 // Take *n format as ESC n
     bool bStandard;                 // If this is a default standard format
diff --git a/include/svx/numfmtsh.hxx b/include/svx/numfmtsh.hxx
index a7d0fb7662f1..da26e9cbf707 100644
--- a/include/svx/numfmtsh.hxx
+++ b/include/svx/numfmtsh.hxx
@@ -187,7 +187,7 @@ private:
     std::vector<sal_uInt32> aDelList;
     std::vector<sal_uInt32> aCurEntryList;
     sal_uInt32              nCurFormatKey;
-    short                   nCurCategory;
+    SvNumFormatType         nCurCategory;
     LanguageType            eCurLanguage;
     std::vector<sal_uInt16> aCurCurrencyList;
     NfCurrencyEntry*        pCurCurrencyEntry;
@@ -214,8 +214,8 @@ private:
 
     SVX_DLLPRIVATE void  GetPreviewString_Impl( OUString& rString,
                                                 Color*& rpColor );
-    SVX_DLLPRIVATE static void PosToCategory_Impl(sal_uInt16 nPos, short& rCategory);
-    SVX_DLLPRIVATE static void CategoryToPos_Impl(short nCategory, sal_uInt16& rPos);
+    SVX_DLLPRIVATE static void PosToCategory_Impl(sal_uInt16 nPos, SvNumFormatType& rCategory);
+    SVX_DLLPRIVATE static void CategoryToPos_Impl(SvNumFormatType nCategory, sal_uInt16& rPos);
 };
 
 #endif
diff --git a/oox/source/drawingml/chart/datasourcecontext.cxx b/oox/source/drawingml/chart/datasourcecontext.cxx
index 63779e71435f..527ee336f172 100644
--- a/oox/source/drawingml/chart/datasourcecontext.cxx
+++ b/oox/source/drawingml/chart/datasourcecontext.cxx
@@ -118,7 +118,7 @@ void DoubleSequenceContext::onCharacters( const OUString& rChars )
                         {
                             OUString aFormatCode = mrModel.maFormatCode;
                             sal_Int32 nCheckPos = 0;
-                            short nType;
+                            SvNumFormatType nType;
                             pNumFrmt->PutEntry( aFormatCode, nCheckPos, nType, nKey );
                             bNoKey = (nCheckPos != 0);
                         }
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 60dfd3edf1d6..5c34279ad3c4 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -468,7 +468,7 @@ public:
     void        SetPatternArea( SCROW nStartRow, SCROW nEndRow,
                                 const ScPatternAttr& rPatAttr );
     void        ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
-                            const ScPatternAttr& rPattern, short nNewType );
+                            const ScPatternAttr& rPattern, SvNumFormatType nNewType );
 
     void        ApplyStyle( SCROW nRow, const ScStyleSheet* rStyle );
     void        ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle );
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index 6e8011438d73..915f478f4bfa 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -46,6 +46,7 @@ struct ScDBQueryParamInternal;
 struct ScDBQueryParamMatrix;
 class ScFormulaCell;
 struct ScInterpreterContext;
+enum class SvNumFormatType : sal_Int16;
 
 class ScValueIterator            // walk through all values in an area
 {
@@ -61,7 +62,7 @@ class ScValueIterator            // walk through all values in an area
     SCTAB           mnTab;
     SCROW           nAttrEndRow;
     SubtotalFlags   mnSubTotalFlags;
-    short           nNumFmtType;
+    SvNumFormatType nNumFmtType;
     bool            bNumValid;
     bool            bCalcAsShown;
     bool            bTextAsZero;
@@ -85,7 +86,7 @@ public:
         ScDocument* pDocument, const ScRange& rRange, SubtotalFlags nSubTotalFlags = SubtotalFlags::NONE,
         bool bTextAsZero = false );
 
-    void GetCurNumFmtInfo( const ScInterpreterContext& rContext, sal_uInt32& nType, sal_uInt32& nIndex );
+    void GetCurNumFmtInfo( const ScInterpreterContext& rContext, SvNumFormatType& nType, sal_uInt32& nIndex );
 
     /// Does NOT reset rValue if no value found!
     bool GetFirst( double& rValue, FormulaError& rErr );
@@ -148,7 +149,7 @@ private:
         SCROW               nRow;
         SCROW               nAttrEndRow;
         SCTAB               nTab;
-        sal_uInt32          nNumFmtType;
+        SvNumFormatType     nNumFmtType;
         bool                bCalcAsShown;
     };
 
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index ac3025ffb1d8..4d908c9e20cb 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1120,7 +1120,7 @@ public:
     SC_DLLPUBLIC sal_uInt32                   GetNumberFormat( const ScInterpreterContext& rContext, const ScAddress& ) const;
     void                                      SetNumberFormat( const ScAddress& rPos, sal_uInt32 nNumberFormat );
 
-    void                                      GetNumberFormatInfo( const ScInterpreterContext& rContext, sal_uInt32& nType, sal_uInt32& nIndex, const ScAddress& rPos ) const;
+    void                                      GetNumberFormatInfo( const ScInterpreterContext& rContext, SvNumFormatType& nType, sal_uInt32& nIndex, const ScAddress& rPos ) const;
     SC_DLLPUBLIC const ScFormulaCell*         GetFormulaCell( const ScAddress& rPos ) const;
     SC_DLLPUBLIC ScFormulaCell*               GetFormulaCell( const ScAddress& rPos );
     SC_DLLPUBLIC void                         GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, OUString& rFormula ) const;
@@ -1680,7 +1680,7 @@ public:
     SC_DLLPUBLIC void           ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
                                                                         const ScMarkData& rMark,
                                                                         const ScPatternAttr& rPattern,
-                                                                        short nNewType );
+                                                                        SvNumFormatType nNewType );
 
     void               ApplyStyle( SCCOL nCol, SCROW nRow, SCTAB nTab,
                                    const ScStyleSheet& rStyle);
diff --git a/sc/inc/dpcache.hxx b/sc/inc/dpcache.hxx
index 8601d7177aae..08517c167d0a 100644
--- a/sc/inc/dpcache.hxx
+++ b/sc/inc/dpcache.hxx
@@ -35,6 +35,7 @@ struct ScQueryParam;
 class ScDPObject;
 class ScDPItemData;
 struct ScDPNumGroupInfo;
+enum class SvNumFormatType : sal_Int16;
 
 /**
  * This class represents the cached data part of the datapilot cache table
@@ -98,7 +99,7 @@ public:
         virtual bool first() = 0;
         virtual bool next() = 0;
         virtual void finish() = 0;
-        virtual void getValue(long nCol, ScDPItemData& rData, short& rNumType) const = 0;

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list