Extend loplugin:external to warn about enums

To mitigate the dangers of silently breaking ADL when moving enums into unnamed
namespaces (see the commit message of 206b5b2661be37efdff3c6aedb6f248c4636be79
"New loplugin:external"), note all functions that are affected.  (The plan is to
extend loplugin:external further to also warn about classes and class templates,
and the code to identify affected functions already takes that into account, so
some parts of that code are not actually relevant for enums.)

But it appears that none of the functions that are actually affected by the
changes in this commit relied on being found through ADL, so no adaptions were
necessary for them.

(clang::DeclContext::collectAllContexts is non-const, which recursively means
that External's Visit... functions must take non-const Decl*.  Which required
compilerplugins/clang/sharedvisitor/analyzer.cxx to be generalized to support
such Visit... functions with non-const Decl* parameters.)

Change-Id: Ia215291402bf850d43defdab3cff4db5b270d1bd
Reviewed-on: https://gerrit.libreoffice.org/83001
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
diff --git a/UnoControls/source/controls/framecontrol.cxx b/UnoControls/source/controls/framecontrol.cxx
index a954c11..004facf 100644
--- a/UnoControls/source/controls/framecontrol.cxx
+++ b/UnoControls/source/controls/framecontrol.cxx
@@ -44,6 +44,8 @@ using namespace ::com::sun::star::util;

namespace unocontrols {

namespace {

enum PropertyHandle  // values represent index in PropertyArray
{                   // for FrameControl
    Componenturl    = 0,
@@ -51,6 +53,8 @@ enum PropertyHandle  // values represent index in PropertyArray
    Loaderarguments = 2
};

}

//  construct/destruct

FrameControl::FrameControl( const Reference< XComponentContext >& rxContext)
diff --git a/basctl/source/basicide/doceventnotifier.cxx b/basctl/source/basicide/doceventnotifier.cxx
index 36ed3d3..96eea35 100644
--- a/basctl/source/basicide/doceventnotifier.cxx
+++ b/basctl/source/basicide/doceventnotifier.cxx
@@ -52,12 +52,16 @@ namespace basctl
    typedef ::cppu::WeakComponentImplHelper<   XDocumentEventListener
                                           >   DocumentEventNotifier_Impl_Base;

    namespace {

    enum ListenerAction
    {
        RegisterListener,
        RemoveListener
    };

    }

    /** impl class for DocumentEventNotifier
    */
    class DocumentEventNotifier::Impl   :public ::cppu::BaseMutex
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 26aeddd..8fbb3dd 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -1488,11 +1488,17 @@ static void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, s
    }

}

namespace {

enum class INVOKETYPE
{
   GetProp = 0,
   Func
};

}

static Any invokeAutomationMethod( const OUString& Name, Sequence< Any > const & args, SbxArray* pParams, sal_uInt32 nParamCount, Reference< XInvocation > const & rxInvocation, INVOKETYPE invokeType )
{
    Sequence< sal_Int16 > OutParamIndex;
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 19f0aca..ea65461 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1771,6 +1771,7 @@ void SbRtl_Weekday(StarBASIC *, SbxArray & rPar, bool)
    }
}

namespace {

enum Interval
{
@@ -1786,6 +1787,8 @@ enum Interval
    INTERVAL_S
};

}

struct IntervalInfo
{
    Interval    meInterval;
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
index 3da3ada..ceed901 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/abi.cxx
@@ -58,6 +58,8 @@

using namespace x86_64;

namespace {

/* Register class used for passing given 64bit part of the argument.
   These represent classes as documented by the PS ABI, with the exception
   of SSESF, SSEDF classes, that are basically SSE class, just gcc will
@@ -80,6 +82,8 @@ enum x86_64_reg_class
    X86_64_MEMORY_CLASS
};

}

#define MAX_CLASSES 4

/* x86-64 register passing implementation.  See x86-64 ABI for details.  Goal
diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx
index fccdf87c..ea47532 100644
--- a/chart2/source/controller/dialogs/tp_Scale.cxx
+++ b/chart2/source/controller/dialogs/tp_Scale.cxx
@@ -193,6 +193,8 @@ IMPL_LINK( ScaleTabPage, EnableValueHdl, weld::ToggleButton&, rCbx, void )
    }
}

namespace {

enum AxisTypeListBoxEntry
{
    TYPE_AUTO=0,
@@ -200,6 +202,8 @@ enum AxisTypeListBoxEntry
    TYPE_DATE=2
};

}

IMPL_LINK_NOARG(ScaleTabPage, SelectAxisTypeHdl, weld::ComboBox&, void)
{
    const sal_Int32 nPos = m_xLB_AxisType->get_active();
diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx
index f003fe0..bee5d03 100644
--- a/comphelper/source/container/enumerablemap.cxx
+++ b/comphelper/source/container/enumerablemap.cxx
@@ -194,12 +194,14 @@ namespace comphelper
        MapData             m_aData;
    };

    namespace {

    enum EnumerationType
    {
        eKeys, eValues, eBoth
    };

    }

    class MapEnumerator final
    {
diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx
index b3f62a7..60ecc7b 100644
--- a/comphelper/source/misc/syntaxhighlight.cxx
+++ b/comphelper/source/misc/syntaxhighlight.cxx
@@ -26,6 +26,8 @@
#include <comphelper/syntaxhighlight.hxx>
#include <o3tl/typed_flags_set.hxx>

namespace {

// Flags for character properties
enum class CharFlags {
    StartIdentifier   = 0x0001,
@@ -39,6 +41,9 @@ enum class CharFlags {
    Space             = 0x0100,
    EOL               = 0x0200
};

}

namespace o3tl {
    template<> struct typed_flags<CharFlags> : is_typed_flags<CharFlags, 0x03ff> {};
}
diff --git a/compilerplugins/clang/external.cxx b/compilerplugins/clang/external.cxx
index 2b6b689..e4a6b0df 100644
--- a/compilerplugins/clang/external.cxx
+++ b/compilerplugins/clang/external.cxx
@@ -10,6 +10,9 @@

#include <algorithm>
#include <cassert>
#include <iterator>
#include <list>
#include <set>

#include "clang/Sema/SemaDiagnostic.h"

@@ -45,6 +48,79 @@ bool isInjectedFunction(FunctionDecl const* decl)
    return true;
}

// Whether type1 mentions type2 (in a way relevant for argument-dependent name lookup):
bool mentions(QualType type1, QualType type2)
{
    auto t1 = type1;
    for (;;)
    {
        if (auto const t2 = t1->getAs<ReferenceType>())
        {
            t1 = t2->getPointeeType();
        }
        else if (auto const t3 = t1->getAs<PointerType>())
        {
            t1 = t3->getPointeeType();
        }
        else if (auto const t4 = t1->getAsArrayTypeUnsafe())
        {
            t1 = t4->getElementType();
        }
        else
        {
            break;
        }
    }
    if (t1.getCanonicalType().getTypePtr() == type2.getTypePtr())
    {
        return true;
    }
    if (auto const t2 = t1->getAs<TemplateSpecializationType>())
    {
        for (auto a = t2->begin(); a != t2->end(); ++a)
        {
            if (a->getKind() != TemplateArgument::Type)
            {
                continue;
            }
            if (mentions(a->getAsType(), type2))
            {
                return true;
            }
        }
        auto const t3 = t2->desugar();
        if (t3.getTypePtr() == t2)
        {
            return false;
        }
        return mentions(t3, type2);
    }
    if (auto const t2 = t1->getAs<FunctionProtoType>())
    {
        if (mentions(t2->getReturnType(), type2))
        {
            return true;
        }
        for (auto t3 = t2->param_type_begin(); t3 != t2->param_type_end(); ++t3)
        {
            if (mentions(*t3, type2))
            {
                return true;
            }
        }
        return false;
    }
    if (auto const t2 = t1->getAs<MemberPointerType>())
    {
        if (t2->getClass()->getUnqualifiedDesugaredType() == type2.getTypePtr())
        {
            return true;
        }
        return mentions(t2->getPointeeType(), type2);
    }
    return false;
}

class External : public loplugin::FilteringPlugin<External>
{
public:
@@ -55,10 +131,11 @@ public:

    void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }

    bool VisitTagDecl(TagDecl const* decl)
    bool VisitTagDecl(TagDecl* decl)
    {
        /*TODO:*/
        return true; // in general, moving classes or enumerations into an unnamed namespace can break ADL
        if (!isa<EnumDecl>(decl))
            return true; // in general, moving classes into an unnamed namespace can break ADL
        if (isa<ClassTemplateSpecializationDecl>(decl))
        {
            return true;
@@ -102,7 +179,7 @@ public:
        return handleDeclaration(decl);
    }

    bool VisitFunctionDecl(FunctionDecl const* decl)
    bool VisitFunctionDecl(FunctionDecl* decl)
    {
        if (isa<CXXMethodDecl>(decl))
        {
@@ -166,7 +243,7 @@ public:
        return handleDeclaration(decl);
    }

    bool VisitVarDecl(VarDecl const* decl)
    bool VisitVarDecl(VarDecl* decl)
    {
        if (decl->isStaticDataMember())
        {
@@ -187,7 +264,7 @@ public:
        return handleDeclaration(decl);
    }

    bool VisitClassTemplateDecl(ClassTemplateDecl const* decl)
    bool VisitClassTemplateDecl(ClassTemplateDecl* decl)
    {
        /*TODO:*/
        return true; // in general, moving classes or enumerations into an unnamed namespace can break ADL
@@ -202,7 +279,7 @@ public:
        return handleDeclaration(decl);
    }

    bool VisitFunctionTemplateDecl(FunctionTemplateDecl const* decl)
    bool VisitFunctionTemplateDecl(FunctionTemplateDecl* decl)
    {
        if (!decl->isThisDeclarationADefinition())
        {
@@ -219,7 +296,7 @@ public:
        return handleDeclaration(decl);
    }

    bool VisitVarTemplateDecl(VarTemplateDecl const* decl)
    bool VisitVarTemplateDecl(VarTemplateDecl* decl)
    {
        if (!decl->isThisDeclarationADefinition())
        {
@@ -243,7 +320,149 @@ private:
        }
    }

    bool handleDeclaration(NamedDecl const* decl)
    void computeAffectedTypes(Decl const* decl, std::vector<QualType>* affected)
    {
        assert(affected != nullptr);
        if (auto const d = dyn_cast<EnumDecl>(decl))
        {
            affected->push_back(compiler.getASTContext().getEnumType(d));
        }
        else
        {
            CXXRecordDecl const* rec;
            if (auto const d = dyn_cast<ClassTemplateDecl>(decl))
            {
                rec = d->getTemplatedDecl();
            }
            else
            {
                rec = cast<CXXRecordDecl>(decl);
            }
            affected->push_back(compiler.getASTContext().getRecordType(rec));
            for (auto d = rec->decls_begin(); d != rec->decls_end(); ++d)
            {
                if (*d != (*d)->getCanonicalDecl())
                {
                    continue;
                }
                if (isa<TagDecl>(*d) || isa<ClassTemplateDecl>(*d))
                {
                    if (auto const d1 = dyn_cast<RecordDecl>(*d))
                    {
                        if (d1->isInjectedClassName())
                        {
                            continue;
                        }
                    }
                    computeAffectedTypes(*d, affected);
                }
            }
        }
    }

    void reportAssociatingFunctions(std::vector<QualType> const& affected, Decl* decl)
    {
        auto c = decl->getDeclContext();
        while (isa<LinkageSpecDecl>(c) || c->isInlineNamespace())
        {
            c = c->getParent();
        }
        assert(c->isTranslationUnit() || c->isNamespace());
        SmallVector<DeclContext*, 2> parts;
        c->collectAllContexts(parts);
        std::list<DeclContext const*> ctxs;
        std::copy(parts.begin(), parts.end(),
                  std::back_insert_iterator<std::list<DeclContext const*>>(ctxs));
        if (auto const d = dyn_cast<CXXRecordDecl>(decl))
        {
            // To find friend functions declared in the class:
            ctxs.push_back(d);
        }
        std::set<FunctionDecl const*> fdecls; // to report every function just once
        for (auto ctx = ctxs.begin(); ctx != ctxs.end(); ++ctx)
        {
            for (auto i = (*ctx)->decls_begin(); i != (*ctx)->decls_end(); ++i)
            {
                auto d = *i;
                if (auto const d1 = dyn_cast<LinkageSpecDecl>(d))
                {
                    ctxs.push_back(d1);
                    continue;
                }
                if (auto const d1 = dyn_cast<NamespaceDecl>(d))
                {
                    if (d1->isInline())
                    {
                        ctxs.push_back(d1);
                    }
                    continue;
                }
                if (auto const d1 = dyn_cast<FriendDecl>(d))
                {
                    d = d1->getFriendDecl();
                }
                FunctionDecl const* f;
                if (auto const d1 = dyn_cast<FunctionTemplateDecl>(d))
                {
                    f = d1->getTemplatedDecl();
                }
                else
                {
                    f = dyn_cast<FunctionDecl>(d);
                    if (f == nullptr)
                    {
                        continue;
                    }
                }
                if (!fdecls.insert(f->getCanonicalDecl()).second)
                {
                    continue;
                }
                if (isa<CXXMethodDecl>(f))
                {
                    continue;
                }
                for (auto const t : affected)
                {
                    auto const tc = t.getCanonicalType();
                    for (auto p = f->param_begin(); p != f->param_end(); ++p)
                    {
                        if (mentions((*p)->getType(), tc))
                        {
                            report(DiagnosticsEngine::Note,
                                   "a %select{function|function template|function template "
                                   "specialization}0 associating %1 is declared here",
                                   f->getLocation())
                                << (f->isFunctionTemplateSpecialization()
                                        ? 2
                                        : f->getDescribedFunctionTemplate() != nullptr ? 1 : 0)
                                << t << f->getSourceRange();
                            for (auto f1 = f->redecls_begin(); f1 != f->redecls_end(); ++f1)
                            {
                                if (*f1 == f)
                                {
                                    continue;
                                }
                                report(DiagnosticsEngine::Note, "another declaration is here",
                                       f1->getLocation())
                                    << f1->getSourceRange();
                            }
                            break;
                        }
                    }
                }
            }
        }
    }

    void reportAssociatingFunctions(Decl* decl)
    {
        std::vector<QualType> affected; // enum/class/class template + recursively affected members
        computeAffectedTypes(decl, &affected);
        reportAssociatingFunctions(affected, decl);
    }

    bool handleDeclaration(NamedDecl* decl)
    {
        if (ignoreLocation(decl))
        {
@@ -364,6 +583,10 @@ private:
        {
            reportSpecializations(d->specializations());
        }
        if (isa<TagDecl>(decl) || isa<ClassTemplateDecl>(decl))
        {
            reportAssociatingFunctions(decl);
        }
        return true;
    }
};
diff --git a/compilerplugins/clang/sharedvisitor/analyzer.cxx b/compilerplugins/clang/sharedvisitor/analyzer.cxx
index d0f5d4e..7450646 100644
--- a/compilerplugins/clang/sharedvisitor/analyzer.cxx
+++ b/compilerplugins/clang/sharedvisitor/analyzer.cxx
@@ -14,6 +14,7 @@
#include "clang/Tooling/Tooling.h"
#include "llvm/ADT/StringExtras.h"

#include <cassert>
#include <cstddef>
#include <cstring>
#include <iostream>
@@ -55,6 +56,8 @@ class CheckFileVisitor
    : public RecursiveASTVisitor< CheckFileVisitor >
{
public:
    void setContext(ASTContext const& context) { context_ = &context; }

    bool VisitCXXRecordDecl(CXXRecordDecl *Declaration);

    bool TraverseNamespaceDecl(NamespaceDecl * decl)
@@ -67,6 +70,21 @@ public:
        }
        return RecursiveASTVisitor<CheckFileVisitor>::TraverseNamespaceDecl(decl);
    }

private:
    ASTContext const* context_ = nullptr;

    QualType unqualifyPointeeType(QualType type)
    {
        assert(context_ != nullptr);
        if (auto const t = type->getAs<PointerType>())
        {
            return context_->getQualifiedType(
                context_->getPointerType(t->getPointeeType().getUnqualifiedType()),
                type.getQualifiers());
        }
        return type;
    }
};

static bool inheritsPluginClassCheck( const Decl* decl )
@@ -116,7 +134,8 @@ bool CheckFileVisitor::VisitCXXRecordDecl( CXXRecordDecl* decl )
                cout << "VisitFunctionStart" << endl;
                cout << "VisitFunctionName:" << method->getName().str() << endl;
                cout << "VisitFunctionArgument:"
                    << method->getParamDecl( 0 )->getTypeSourceInfo()->getType().getAsString()
                    << unqualifyPointeeType(
                        method->getParamDecl( 0 )->getTypeSourceInfo()->getType()).getAsString()
                    << endl;
                cout << "VisitFunctionEnd" << endl;
            }
@@ -185,6 +204,10 @@ class FindNamedClassConsumer
    : public ASTConsumer
{
public:
    void Initialize(ASTContext& context) override
    {
        visitor.setContext(context);
    }
    virtual void HandleTranslationUnit(ASTContext& context) override
    {
        visitor.TraverseDecl( context.getTranslationUnitDecl());
diff --git a/compilerplugins/clang/test/external.cxx b/compilerplugins/clang/test/external.cxx
index ff996f5..28b7c6d 100644
--- a/compilerplugins/clang/test/external.cxx
+++ b/compilerplugins/clang/test/external.cxx
@@ -7,6 +7,10 @@
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include <sal/config.h>

#include <vector>

// expected-error@+1 {{externally available entity 'n1' is not previously declared in an included file (if it is only used in this translation unit, make it static or put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}}
int n1 = 0;
// expected-note@+1 {{another declaration is here [loplugin:external]}}
@@ -42,11 +46,68 @@ static void g()
// expected-note@+1 {{another declaration is here [loplugin:external]}}
void f2();

namespace N
{
inline namespace I1
{
extern "C++" {
// expected-note@+1 {{another declaration is here [loplugin:external]}}
enum E : int;

// expected-error@+1 {{externally available entity 'E' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}}
enum E : int
{
};
}
}

// expected-note@+1 {{a function associating 'N::I1::E' is declared here [loplugin:external]}}
static void g(std::vector<E>)
{
    // expected-note@+1 {{another declaration is here [loplugin:external]}}
    void f(E const*);
}

// expected-note@+1 {{a function associating 'N::I1::E' is declared here [loplugin:external]}}
void f(E const*);

extern "C++" {
// expected-note@+1 {{a function associating 'N::I1::E' is declared here [loplugin:external]}}
void fc(E const*);
}

struct S1
{
    struct S2;
    // No note about associating function; injected friend function not found by ADL:
    friend void f2(E const*);
};

inline namespace I2
{
// expected-note@+1 {{a function associating 'N::I1::E' is declared here [loplugin:external]}}
void f3(E);

inline namespace I3
{
// expected-note@+1 {{a function associating 'N::I1::E' is declared here [loplugin:external]}}
void f4(E);
}
}
}

struct N::S1::S2
{
    // expected-note@+1 {{another declaration is here [loplugin:external]}}
    friend void f(E const*);
};

int main()
{
    (void)n2;
    (void)n3;
    g();
    (void)&N::g;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index bddca8e..e3b46bc 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -43,6 +43,8 @@ using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::beans;
using namespace ::basegfx;

namespace {

enum class UpdateFlags
{
    NONE         = 0x00,
@@ -54,6 +56,9 @@ enum class UpdateFlags
    Hex          = 0x20,
    All          = 0x3f,
};

}

namespace o3tl {
    template<> struct typed_flags<UpdateFlags> : is_typed_flags<UpdateFlags, 0x3f> {};
}
@@ -62,6 +67,8 @@ namespace o3tl {
namespace cui
{

namespace {

enum class ColorComponent {
    Red,
    Green,
@@ -75,6 +82,7 @@ enum class ColorComponent {
    Key,
};

}

// color space conversion helpers

@@ -171,7 +179,12 @@ void ColorPreviewControl::Paint(vcl::RenderContext& rRenderContext, const tools:
    rRenderContext.DrawRect(tools::Rectangle(Point(0, 0), GetOutputSizePixel()));
}

namespace {

enum ColorMode { HUE, SATURATION, BRIGHTNESS, RED, GREEN, BLUE };

}

const ColorMode DefaultMode = HUE;

class ColorFieldControl : public weld::CustomWidgetController
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index 07080a7..9e001832 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -66,9 +66,13 @@ static OUString getNormDicEntry_Impl(const OUString &rText)
    return aTmp.replaceAll("=", "");
}

namespace {

// Compare Dictionary Entry  result
enum CDE_RESULT { CDE_EQUAL, CDE_SIMILAR, CDE_DIFFERENT };

}

static CDE_RESULT cmpDicEntry_Impl( const OUString &rText1, const OUString &rText2 )
{
    CDE_RESULT eRes = CDE_DIFFERENT;
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 2026c73..5e394e9 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -172,6 +172,8 @@ DicUserData::DicUserData(
    Entry IDs for options listbox of dialog
--------------------------------------------------*/

namespace {

enum EID_OPTIONS
{
    EID_SPELL_AUTO,
@@ -186,6 +188,8 @@ enum EID_OPTIONS
    EID_HYPH_SPECIAL
};

}

//! this array must have an entry for every value of EID_OPTIONS.
//  It is used to get the respective property name.
static const char * aEidToPropName[] =
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index cae7b77..edb129d 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -321,6 +321,8 @@ public:
/*                                                                   */
/*********************************************************************/

namespace {

enum OfaAutoFmtOptions
{
    USE_REPLACE_TABLE,
@@ -343,6 +345,8 @@ enum OfaAutoFmtOptions
    MERGE_SINGLE_LINE_PARA
};

}

OfaSwAutoFmtOptionsPage::OfaSwAutoFmtOptionsPage(weld::Container* pPage, weld::DialogController* pController,
                                                 const SfxItemSet& rSet )
    : SfxTabPage(pPage, pController, "cui/ui/applyautofmtpage.ui", "ApplyAutoFmtPage", &rSet)
@@ -1516,12 +1520,16 @@ IMPL_LINK(OfaAutocorrExceptPage, ModifyHdl, weld::Entry&, rEdt, void)
    }
}

namespace {

enum OfaQuoteOptions
{
    ADD_NONBRK_SPACE,
    REPLACE_1ST
};

}

void OfaQuoteTabPage::CreateEntry(weld::TreeView& rCheckLB, const OUString& rTxt, sal_uInt16 nCol, sal_uInt16 nTextCol)
{
    rCheckLB.append();
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index 7990744..8cfb01f 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -84,6 +84,8 @@ const sal_uInt16 SvxExtParagraphTabPage::pExtRanges[] =
                            // according to BP
#define FIX_DIST_DEF 283    // standard fix distance 0,5 cm

namespace {

enum LineSpaceList
{
    LLINESPACE_1    = 0,
@@ -96,6 +98,8 @@ enum LineSpaceList
    LLINESPACE_FIX  = 7
};

}

static void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 );

void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace,
diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx
index 46a2105..33a0649 100644
--- a/cui/source/tabpages/swpossizetabpage.cxx
+++ b/cui/source/tabpages/swpossizetabpage.cxx
@@ -41,8 +41,12 @@ using namespace ::com::sun::star::text;

#define SwFPos SvxSwFramePosString

namespace {

enum class LB;

}

struct FrmMap
{
    SvxSwFramePosString::StringId   eStrId;
@@ -64,6 +68,8 @@ struct StringIdPair_Impl
    SvxSwFramePosString::StringId eVert;
};

namespace {

enum class LB {
    NONE                = 0x000000,
    Frame               = 0x000001, // paragraph text area
@@ -96,6 +102,9 @@ enum class LB {

    LAST = VertLine
};

}

namespace o3tl {
    template<> struct typed_flags<LB> : is_typed_flags<LB, 0x0fffff> {};
}
diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx
index d0c70b6..079b717 100644
--- a/cui/source/tabpages/tparea.cxx
+++ b/cui/source/tabpages/tparea.cxx
@@ -32,6 +32,8 @@ using namespace com::sun::star;

// static ----------------------------------------------------------------

namespace {

enum FillType
{
    TRANSPARENT,
@@ -42,6 +44,8 @@ enum FillType
    PATTERN
};

}

const sal_uInt16 SvxAreaTabPage::pAreaRanges[] =
{
    XATTR_GRADIENTSTEPCOUNT,
diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx
index 7d1f17b..aea6853 100644
--- a/cui/source/tabpages/tpbitmap.cxx
+++ b/cui/source/tabpages/tpbitmap.cxx
@@ -48,6 +48,8 @@

using namespace com::sun::star;

namespace {

enum BitmapStyle
{
    CUSTOM,
@@ -61,6 +63,8 @@ enum TileOffset
    COLUMN
};

}

const sal_uInt16 SvxBitmapTabPage::pBitmapRanges[] =
{
    SID_ATTR_TRANSFORM_WIDTH,
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index bc0fd62..1e97c1a 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4261,12 +4261,16 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
    return pJson;
}

namespace {

enum class UndoOrRedo
{
    UNDO,
    REDO
};

}

/// Returns the JSON representation of either an undo or a redo stack.
static char* getUndoOrRedo(LibreOfficeKitDocument* pThis, UndoOrRedo eCommand)
{
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx
index b72c026..debbf5c 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -104,6 +104,8 @@ namespace emfplushelper
    {
    }

    namespace {

    typedef enum
    {
        StringAlignmentNear = 0x00000000,
@@ -111,6 +113,8 @@ namespace emfplushelper
        StringAlignmentFar = 0x00000002
    } StringAlignment;

    }

    float EmfPlusHelperData::getUnitToPixelMultiplier(const UnitType aUnitType)
    {
        switch (aUnitType)
diff --git a/drawinglayer/source/tools/emfppen.cxx b/drawinglayer/source/tools/emfppen.cxx
index 039a5c0..85a5e17 100644
--- a/drawinglayer/source/tools/emfppen.cxx
+++ b/drawinglayer/source/tools/emfppen.cxx
@@ -28,6 +28,8 @@ using namespace ::basegfx;

namespace emfplushelper
{
    namespace {

    enum EmfPlusPenData
    {
        PenDataTransform        = 0x00000001,
@@ -45,6 +47,8 @@ namespace emfplushelper
        PenDataCustomEndCap     = 0x00001000
    };

    }

    EMFPPen::EMFPPen()
        : EMFPBrush()
        , penDataFlags(0)
diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx
index 983f210..fd3c1e5 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -67,6 +67,7 @@ SfxPoolItem* SvxFormatSplitItem::CreateDefault() { return new  SvxFormatSplitIte
SfxPoolItem* SvxPageModelItem::CreateDefault() { return new  SvxPageModelItem(0);}
SfxPoolItem* SvxParaVertAlignItem::CreateDefault() { return new  SvxParaVertAlignItem(Align::Automatic, 0);}

namespace {

enum class SvxSpecialLineSpace
{
@@ -77,6 +78,7 @@ enum class SvxSpecialLineSpace
    End
};

}

SvxLineSpacingItem::SvxLineSpacingItem( sal_uInt16 nHeight, const sal_uInt16 nId )
    : SfxEnumItemInterface( nId )
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 8d0d346..71249b9 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -89,12 +89,17 @@ using namespace ::com::sun::star;
using namespace ::xmloff::token;
using namespace ::utl;

namespace {

enum class Flags {
    NONE            = 0x00,
    FullStop        = 0x01,
    ExclamationMark = 0x02,
    QuestionMark    = 0x04,
};

}

namespace o3tl {
    template<> struct typed_flags<Flags> : is_typed_flags<Flags, 0x07> {};
}
diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx
index d64c8677..1e77361 100644
--- a/extensions/source/propctrlr/browserlistbox.cxx
+++ b/extensions/source/propctrlr/browserlistbox.cxx
@@ -59,6 +59,8 @@ namespace pcr

    namespace PropertyControlType = ::com::sun::star::inspection::PropertyControlType;

    namespace {

    enum ControlEventType
    {
        FOCUS_GAINED,
@@ -66,6 +68,8 @@ namespace pcr
        ACTIVATE_NEXT
    };

    }

    struct ControlEvent : public ::comphelper::AnyEvent
    {
        Reference< XPropertyControl >   xControl;
diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx
index 47055a2..67889ce 100644
--- a/extensions/source/scanner/sane.cxx
+++ b/extensions/source/scanner/sane.cxx
@@ -466,10 +466,14 @@ void Sane::SetOptionValue( int n, double const * pSet )
    ControlOption( n, SANE_ACTION_SET_VALUE, pFixedSet.get() );
}

namespace {

enum FrameStyleType {
    FrameStyle_BW, FrameStyle_Gray, FrameStyle_RGB, FrameStyle_Separated
};

}

#define BYTE_BUFFER_SIZE 32768

static sal_uInt8 ReadValue( FILE* fp, int depth )
diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx
index 236506a..b0426d5 100644
--- a/filter/source/graphicfilter/ios2met/ios2met.cxx
+++ b/filter/source/graphicfilter/ios2met/ios2met.cxx
@@ -35,8 +35,11 @@

class FilterConfigItem;

namespace {

enum PenStyle { PEN_NULL, PEN_SOLID, PEN_DOT, PEN_DASH, PEN_DASHDOT };

}

// -----------------------------Field Types-------------------------------

diff --git a/filter/source/graphicfilter/ipcd/ipcd.cxx b/filter/source/graphicfilter/ipcd/ipcd.cxx
index f76ba22..c1b3f00 100644
--- a/filter/source/graphicfilter/ipcd/ipcd.cxx
+++ b/filter/source/graphicfilter/ipcd/ipcd.cxx
@@ -29,6 +29,8 @@

//============================ PCDReader ==================================

namespace {

// these resolutions are contained in a PCD file:
enum PCDResolution {
    PCDRES_BASE16,  //  192 x  128
@@ -40,6 +42,8 @@ enum PCDResolution {
    PCDRES_16BASE   // 3072 x 3072
};

}

class PCDReader {

private:
diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx
index e2d0e9c..8fc618b 100644
--- a/filter/source/graphicfilter/ipict/ipict.cxx
+++ b/filter/source/graphicfilter/ipict/ipict.cxx
@@ -138,11 +138,15 @@ namespace PictReaderInternal {

//============================ PictReader ==================================

namespace {

enum class PictDrawingMethod {
    FRAME, PAINT, ERASE, INVERT, FILL,
    TEXT, UNDEFINED
};

}

class PictReader {
  typedef class PictReaderInternal::Pattern Pattern;
private:
diff --git a/forms/source/misc/limitedformats.cxx b/forms/source/misc/limitedformats.cxx
index a0eaf02..c079591 100644
--- a/forms/source/misc/limitedformats.cxx
+++ b/forms/source/misc/limitedformats.cxx
@@ -43,6 +43,7 @@ namespace frm

    //=

    namespace {

    enum LocaleType
    {
@@ -51,6 +52,7 @@ namespace frm
        ltSystem
    };

    }

    static const Locale& getLocale(LocaleType _eType)
    {
diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx
index ce65644..c544da9 100644
--- a/fpicker/source/office/fileview.cxx
+++ b/fpicker/source/office/fileview.cxx
@@ -82,6 +82,8 @@ using ::svt::FolderDescriptor;

#define QUICK_SEARCH_TIMEOUT    1500    // time in mSec before the quicksearch string will be reset

namespace {

enum class FileViewFlags
{
    NONE               = 0x00,
@@ -89,6 +91,9 @@ enum class FileViewFlags
    SHOW_TYPE          = 0x04,
    SHOW_NONE          = 0x20,
};

}

namespace o3tl
{
    template<> struct typed_flags<FileViewFlags> : is_typed_flags<FileViewFlags, 0x26> {};
diff --git a/framework/source/fwe/classes/actiontriggerpropertyset.cxx b/framework/source/fwe/classes/actiontriggerpropertyset.cxx
index 66cc5dd1..128f581 100644
--- a/framework/source/fwe/classes/actiontriggerpropertyset.cxx
+++ b/framework/source/fwe/classes/actiontriggerpropertyset.cxx
@@ -33,6 +33,8 @@ using namespace com::sun::star::awt;

//struct SAL_DLLPUBLIC_IMPORT ::cppu::OBroadcastHelperVar< OMultiTypeInterfaceContainerHelper, OMultiTypeInterfaceContainerHelper::keyType >;

namespace {

// Handles for properties
// (PLEASE SORT THIS FIELD, IF YOU ADD NEW PROPERTIES!)
// We use an enum to define these handles, to use all numbers from 0 to nn and
@@ -48,6 +50,8 @@ enum EPROPERTIES
    PROPERTYCOUNT
};

}

namespace framework
{

diff --git a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
index aa8397a..eb9d6d2 100644
--- a/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
+++ b/framework/source/fwe/classes/actiontriggerseparatorpropertyset.cxx
@@ -31,6 +31,8 @@ using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
using namespace com::sun::star::awt;

namespace {

// Handles for properties
// (PLEASE SORT THIS FIELD, IF YOU ADD NEW PROPERTIES!)
// We use an enum to define these handles, to use all numbers from 0 to nn and
@@ -42,6 +44,8 @@ enum EPROPERTIES
    PROPERTYCOUNT
};

}

namespace framework
{

diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index cce5892..4910416 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -76,10 +76,14 @@

namespace framework{

namespace {

enum PropHandle {
    ActiveFrame, DispatchRecorderSupplier, IsPlugged, SuspendQuickstartVeto,
    Title };

}

OUString SAL_CALL Desktop::getImplementationName()
{
    return "com.sun.star.comp.framework.Desktop";
diff --git a/l10ntools/source/common.cxx b/l10ntools/source/common.cxx
index 92dc802..84adb76 100644
--- a/l10ntools/source/common.cxx
+++ b/l10ntools/source/common.cxx
@@ -9,11 +9,15 @@

#include <common.hxx>

namespace {

//flags for handleArguments()
enum class State {
    NONE, Input, Output, MergeSrc, Languages
};

}

namespace common {

bool handleArguments(
diff --git a/linguistic/source/misc2.cxx b/linguistic/source/misc2.cxx
index 664812f..6e48fc7 100644
--- a/linguistic/source/misc2.cxx
+++ b/linguistic/source/misc2.cxx
@@ -30,6 +30,8 @@

using namespace com::sun::star;

namespace {

/// Flags to be used with the multi-path related functions
/// @see GetDictionaryPaths
enum class DictionaryPathFlags
@@ -38,6 +40,9 @@ enum class DictionaryPathFlags
    INTERNAL  = 0x01,
    USER      = 0x02,
};

}

namespace o3tl
{
    template<> struct typed_flags<DictionaryPathFlags> : is_typed_flags<DictionaryPathFlags, 0x03> {};
diff --git a/o3tl/qa/test-typed_flags.cxx b/o3tl/qa/test-typed_flags.cxx
index e9c7bb6..ef6e4fa 100644
--- a/o3tl/qa/test-typed_flags.cxx
+++ b/o3tl/qa/test-typed_flags.cxx
@@ -15,9 +15,12 @@

using namespace ::o3tl;

namespace {

enum class ConfigurationChangedHint { NONE, ONE, TWO };

}

namespace o3tl
{
    template<> struct typed_flags< ConfigurationChangedHint> : is_typed_flags< ConfigurationChangedHint, 0xFF> {};
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index b7acbe0..fced97e 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -111,8 +111,6 @@ DocumentOpenedGuard::~DocumentOpenedGuard()
        rUrlPool.maUrls.erase( maUrl );
}

} // namespace

/** Specifies whether this filter is an import or export filter. */
enum FilterDirection
{
@@ -121,6 +119,8 @@ enum FilterDirection
    FILTERDIRECTION_EXPORT
};

} // namespace

struct FilterBaseImpl
{
    typedef std::shared_ptr< GraphicHelper >        GraphicHelperRef;
diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx
index 5991b0a..20db50d 100644
--- a/oox/source/drawingml/customshapegeometry.cxx
+++ b/oox/source/drawingml/customshapegeometry.cxx
@@ -39,6 +39,8 @@ using namespace ::com::sun::star::xml::sax;

namespace oox { namespace drawingml {

namespace {

enum FormularCommand
{
    FC_MULDIV = 0,
@@ -60,6 +62,9 @@ enum FormularCommand
    FC_TAN,
    FC_VAL
};

}

struct FormularCommandNameTable
{
    const char*     pS;
diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx
index 44e7243..ad8868b 100644
--- a/sal/osl/unx/profile.cxx
+++ b/sal/osl/unx/profile.cxx
@@ -51,11 +51,15 @@

typedef time_t  osl_TStamp;

namespace {

enum osl_TLockMode
{
    un_lock, read_lock, write_lock
};

}

struct osl_TFile
{
    int     m_Handle;
diff --git a/sal/qa/osl/condition/osl_Condition.cxx b/sal/qa/osl/condition/osl_Condition.cxx
index e2c50fb..0d3cba7 100644
--- a/sal/qa/osl/condition/osl_Condition.cxx
+++ b/sal/qa/osl/condition/osl_Condition.cxx
@@ -22,6 +22,8 @@

using namespace osl;

namespace {

enum ConditionType
{
    thread_type_set,
@@ -29,6 +31,8 @@ enum ConditionType
    thread_type_wait
};

}

/** thread for testing Condition.
 */
class ConditionThread : public Thread
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index 6b17d07..54c0e01 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -277,6 +277,8 @@ static void deleteTestDirectory(const OUString& basename, const OUString& dirnam
    deleteTestDirectory(aBaseURL);
}

namespace {

/** Check for the file and directory access right.
*/
enum class oslCheckMode {
@@ -285,6 +287,8 @@ enum class oslCheckMode {
    WriteAccess
};

}

/** check if the file exist
*/
static bool ifFileExist(const OUString & str)
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index dafccb4..f60fdc9 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -890,11 +890,15 @@ void SAL_CALL rtl_string2UString( rtl_uString** ppThis,

/* ----------------------------------------------------------------------- */

namespace {

enum StrLifecycle {
    CANNOT_RETURN,
    CAN_RETURN = 1
};

}

static oslMutex
getInternMutex()
{
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index a0790ce..b94e1f9 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -944,8 +944,12 @@ void Converter::convertDuration(OUStringBuffer& rBuffer,
    }
}

namespace {

enum Result { R_NOTHING, R_OVERFLOW, R_SUCCESS };

}

static Result
readUnsignedNumber(const OUString & rString,
    sal_Int32 & io_rnPos, sal_Int32 & o_rNumber)
diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx
index ad0cf03..4a9bec3 100644
--- a/sc/source/core/opencl/op_statistical.cxx
+++ b/sc/source/core/opencl/op_statistical.cxx
@@ -7645,6 +7645,8 @@ void OpHypGeomDist::GenSlidingWindowFunction(std::stringstream &ss,
    ss << "}\n";
}

namespace {

enum MixDoubleString
{
    svDoubleVectorRefDoubleString,
@@ -7658,6 +7660,8 @@ enum MixDoubleString
    svDoubleDouble
};

}

void OpMinA::GenSlidingWindowFunction(
    std::stringstream &ss, const std::string &sSymName, SubArguments &vSubArguments)
{
diff --git a/sc/source/core/tool/cellkeytranslator.cxx b/sc/source/core/tool/cellkeytranslator.cxx
index 5999204..5ad71ca4 100644
--- a/sc/source/core/tool/cellkeytranslator.cxx
+++ b/sc/source/core/tool/cellkeytranslator.cxx
@@ -32,6 +32,8 @@ using ::com::sun::star::uno::Sequence;

using namespace ::com::sun::star;

namespace {

enum LocaleMatch
{
    LOCALE_MATCH_NONE = 0,
@@ -41,6 +43,8 @@ enum LocaleMatch
    LOCALE_MATCH_ALL
};

}

static LocaleMatch lclLocaleCompare(const lang::Locale& rLocale1, const LanguageTag& rLanguageTag2)
{
    LocaleMatch eMatchLevel = LOCALE_MATCH_NONE;
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index f0c755f..ac0390d 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -81,6 +81,8 @@ using ::std::vector;
CharClass*                          ScCompiler::pCharClassEnglish = nullptr;
const ScCompiler::Convention*       ScCompiler::pConventions[ ]   = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };

namespace {

enum ScanState
{
    ssGetChar,
@@ -97,6 +99,8 @@ enum ScanState
    ssStop
};

}

static const sal_Char* pInternal[2] = { "TTT", "__DEBUG_VAR" };

using namespace ::com::sun::star::i18n;
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 740a4af..3ea84ef 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -81,12 +81,16 @@ using namespace com::sun::star;
// The checkForUniqueItem method then finds a unique name for the item's value.
#define SC_LINEEND_NAME     EMPTY_OUSTRING

namespace {

enum DetInsertResult {              // return-values for inserting in one level
            DET_INS_CONTINUE,
            DET_INS_INSERTED,
            DET_INS_EMPTY,
            DET_INS_CIRCULAR };

}

class ScDetectiveData
{
private:
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index 2e49ffd..9af3ad9 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -43,6 +43,8 @@
#include <oox/token/properties.hxx>
#include <o3tl/typed_flags_set.hxx>

namespace {

enum class FuncFlags : sal_uInt16 {
    NONE              = 0x0000,
    VOLATILE          = 0x0001,   /// Result is volatile (e.g. NOW() function).
@@ -64,6 +66,9 @@ enum class FuncFlags : sal_uInt16 {
    INTERNAL          = 0x2000,   /// Function is internal in Calc.
    EUROTOOL          = 0x4000,   /// function of euro tool lib, FUNCLIB_EUROTOOL
};

}

namespace o3tl {
    template<> struct typed_flags<FuncFlags> : is_typed_flags<FuncFlags, 0x77ff> {};
}
diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx
index f52d4f6..14e4f9b 100644
--- a/sc/source/filter/oox/pagesettings.cxx
+++ b/sc/source/filter/oox/pagesettings.cxx
@@ -343,6 +343,8 @@ void PageSettings::importPictureData( const Relations& rRelations, const OUStrin
    }
}

namespace {

enum HFPortionId
{
    HF_LEFT,
@@ -351,6 +353,8 @@ enum HFPortionId
    HF_COUNT
};

}

struct HFPortionInfo
{
    Reference<text::XText>  mxText;                 /// XText interface of this portion.
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 7d5695a..dae95ab 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -88,6 +88,8 @@ using com::sun::star::uno::UNO_QUERY;
using com::sun::star::frame::XLayoutManager;
using com::sun::star::beans::XPropertySet;

namespace {

enum ScNameInputType
{
    SC_NAME_INPUT_CELL,
@@ -102,6 +104,8 @@ enum ScNameInputType
    SC_MANAGE_NAMES
};

}

ScTextWndBase::ScTextWndBase( vcl::Window* pParent,  WinBits nStyle )
    : Window ( pParent, nStyle )
{
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 75d9154..2cc3770 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -42,6 +42,8 @@ const SCSIZE ASCIIDLG_MAXROWS                = MAXROWCOUNT;

using namespace com::sun::star::uno;

namespace {

// Defines - CSV Import Preserve Options
enum CSVImportOptionsIndex
{
@@ -59,6 +61,8 @@ enum CSVImportOptionsIndex
    CSVIO_PasteSkipEmptyCells
};

}

const ::std::vector<OUString> CSVImportOptionNames =
{
    "MergeDelimiters",
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 7015c16..317fc2e 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -85,6 +85,8 @@ namespace
    }
}

namespace {

enum class SylkVersion
{
    SCALC3,    // Wrote wrongly quoted strings and unescaped semicolons.
@@ -93,6 +95,8 @@ enum class SylkVersion
    OTHER      // Assume that aliens wrote correct strings.
};

}

// Whole document without Undo
ScImportExport::ScImportExport( ScDocument* p )
    : pDocSh( dynamic_cast< ScDocShell* >(p->GetDocumentShell()) ), pDoc( p ),
@@ -544,6 +548,8 @@ void ScImportExport::SetNoEndianSwap( SvStream& rStrm )
#endif
}

namespace {

enum QuoteType
{
    FIELDSTART_QUOTE,
@@ -553,6 +559,8 @@ enum QuoteType
    DONTKNOW_QUOTE
};

}

/** Determine if *p is a quote that ends a quoted field.

    Precondition: we are parsing a quoted field already and *p is a quote.
@@ -638,12 +646,16 @@ static bool lcl_appendLineData( OUString& rField, const sal_Unicode* p1, const s
    }
}

namespace {

enum class DoubledQuoteMode
{
    KEEP_ALL,   // both are taken, additionally start and end quote are included in string
    ESCAPE,     // escaped quote, one is taken, one ignored
};

}

static const sal_Unicode* lcl_ScanString( const sal_Unicode* p, OUString& rString,
            const sal_Unicode* pSeps, sal_Unicode cStr, DoubledQuoteMode eMode, bool& rbOverflowCell )
{
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 61948b4..4e6b633 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -147,6 +147,8 @@ sal_Int16 lcl_SvxToUnoFileFormat( SvxFileFormat nSvxValue )
SC_SIMPLE_SERVICE_INFO( ScCellFieldsObj, "ScCellFieldsObj", "com.sun.star.text.TextFields" )
SC_SIMPLE_SERVICE_INFO( ScHeaderFieldsObj, "ScHeaderFieldsObj", "com.sun.star.text.TextFields" )

namespace {

enum ScUnoCollectMode
{
    SC_UNO_COLLECT_NONE,
@@ -155,6 +157,8 @@ enum ScUnoCollectMode
    SC_UNO_COLLECT_FINDPOS
};

}

/**
 * This class exists solely to allow searching through field items.  TODO:
 * Look into providing the same functionality directly in EditEngine, to
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 17c1bc5..725937a 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -140,12 +140,16 @@
using namespace css;
using namespace css::uno;

namespace {

enum class ScFilterBoxMode
{
    DataSelect,
    Scenario
};

}

struct ScGridWindow::MouseEventState
{
    bool mbActivatePart;
diff --git a/sc/source/ui/view/prevloc.cxx b/sc/source/ui/view/prevloc.cxx
index 030f3c7..2c00bf2 100644
--- a/sc/source/ui/view/prevloc.cxx
+++ b/sc/source/ui/view/prevloc.cxx
@@ -23,6 +23,8 @@
#include <osl/diagnose.h>
#include <vcl/outdev.hxx>

namespace {

enum ScPreviewLocationType
{
    SC_PLOC_CELLRANGE,
@@ -36,6 +38,8 @@ enum ScPreviewLocationType
    SC_PLOC_NOTETEXT
};

}

struct ScPreviewLocationEntry
{
    ScPreviewLocationType const   eType;
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 0ab2d08..1f6a66a 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -229,6 +229,8 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow )
    return bChanged;
}

namespace {

enum ScAutoSum
{
    ScAutoSumNone = 0,
@@ -240,6 +242,8 @@ enum ScAutoSum
    ScAutoSumCount
};

}

static ScAutoSum lcl_IsAutoSumData( ScDocument* pDoc, SCCOL nCol, SCROW nRow,
        SCTAB nTab, ScDirection eDir, SCCOLROW& nExtend )
{
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 8a7db73..9ef75df 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -133,6 +133,8 @@ void WriteSndAc(const FSHelperPtr& pFS, const OUString& sSoundRelId, const OUStr
}
}

namespace {

enum PPTXLayout
{
    LAYOUT_BLANK,
@@ -150,6 +152,8 @@ enum PPTXLayout
    LAYOUT_SIZE
};

}

struct PPTXLayoutInfo
{
    int const nType;
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx
index 98e57e7..873bbd4 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -67,6 +67,8 @@ using ::com::sun::star::uno::Reference;

namespace sd { namespace sidebar {

namespace {

enum eFillStyle
{
    NONE,
@@ -77,6 +79,8 @@ enum eFillStyle
    PATTERN
};

}

SlideBackground::SlideBackground(
    Window * pParent,
    ViewShellBase& rBase,
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index b765dc5..701c5462 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -128,6 +128,8 @@ namespace sd
        return static_cast<XWeak*>(new DocumentSettings( pModel ));
    }

namespace {

enum SdDocumentSettingsPropertyHandles
{
    HANDLE_PRINTDRAWING, HANDLE_PRINTNOTES, HANDLE_PRINTHANDOUT, HANDLE_PRINTOUTLINE, HANDLE_MEASUREUNIT, HANDLE_SCALE_NUM,
@@ -144,6 +146,8 @@ enum SdDocumentSettingsPropertyHandles
    HANDLE_EMBED_LATIN_SCRIPT_FONTS, HANDLE_EMBED_ASIAN_SCRIPT_FONTS, HANDLE_EMBED_COMPLEX_SCRIPT_FONTS,
};

}

#define MID_PRINTER 1

    static rtl::Reference<PropertySetInfo> createSettingsInfoImpl( bool bIsDraw )
diff --git a/sd/source/ui/unoidl/facreg.cxx b/sd/source/ui/unoidl/facreg.cxx
index dc93ddb..9314a60 100644
--- a/sd/source/ui/unoidl/facreg.cxx
+++ b/sd/source/ui/unoidl/facreg.cxx
@@ -33,11 +33,16 @@ using namespace com::sun::star;
// Declaration and initialization of a map from service names to locally
// unique factory identifiers.

namespace {

enum FactoryId
{
    SdDrawingDocumentFactoryId,
    SdPresentationDocumentFactoryId,
};

}

typedef std::unordered_map<OUString, FactoryId> FactoryMap;

namespace {
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index 9bcc212..ae275dd 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -1080,6 +1080,8 @@ SdUnoEventsAccess::SdUnoEventsAccess( SdXShape* pShape ) throw()
{
}

namespace {

enum class FoundFlags {
    NONE          = 0x0000,
    ClickAction   = 0x0001,
@@ -1093,6 +1095,9 @@ enum class FoundFlags {
    Macro         = 0x0100,
    Library       = 0x0200,
};

}

namespace o3tl {
    template<> struct typed_flags<FoundFlags> : is_typed_flags<FoundFlags, 0x03ff> {};
}
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 244c27b..55340b4 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -78,6 +78,8 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::drawing;
using namespace ::com::sun::star::office;

namespace {

// this are the ids for page properties
enum WID_PAGE
{
@@ -93,6 +95,8 @@ enum WID_PAGE
    WID_NAVORDER, WID_PAGE_PREVIEWMETAFILE
};

}

static sal_Char const sEmptyPageName[sizeof("page")] = "page";

// this function stores the property maps for draw pages in impress and draw
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index f8e1b28..496ea66 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -82,6 +82,8 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::util;

namespace {

enum URLTypeId
{
    URLType_BOOL,
@@ -95,6 +97,8 @@ enum URLTypeId
    URLType_COUNT
};

}

const char* const URLTypeNames[URLType_COUNT] =
{
    "bool",
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index e5fad08..c5a350a 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -815,7 +815,12 @@ static bool lcl_isSystemFilePicker( const uno::Reference< XFilePicker3 >& _rxFP 
    return false;
}

namespace {

enum open_or_save_t {OPEN, SAVE, UNDEFINED};

}

static open_or_save_t lcl_OpenOrSave(sal_Int16 const nDialogType)
{
    switch (nDialogType)
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index a059819..1c76383 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -298,6 +298,7 @@ static OUString impl_retrieveFilterNameFromTypeAndModule(
    return aFoundFilterName;
}

namespace {

/** search for an internal typename, which map to the current app module
    and map also to a "family" of file formats as e.g. PDF/MS Doc/OOo Doc.
@@ -308,6 +309,8 @@ enum ETypeFamily
    E_OOO_DOC
};

}

static OUString impl_searchFormatTypeForApp(const css::uno::Reference< css::frame::XFrame >& xFrame     ,
                                                  ETypeFamily                                eTypeFamily)
{
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index ad21f46..b00e587 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -154,6 +154,8 @@ SmPrintUIOptions::SmPrintUIOptions()

// class SmModel

namespace {

enum SmModelPropertyHandles
{
    HANDLE_FORMULA,
@@ -225,6 +227,8 @@ enum SmModelPropertyHandles
    HANDLE_INTEROP_GRAB_BAG,
};

}

static rtl::Reference<PropertySetInfo> lcl_createModelPropertyInfo ()
{
    static PropertyMapEntry aModelPropertyInfoMap[] =
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index cd889ce..e56a5ce 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -182,6 +182,7 @@ double ImpSvNumberInputScan::StringToDouble( const OUString& rStr, bool bForceFr
    return fNum;
}

namespace {

/**
 * Splits up the input into numbers and strings for further processing
@@ -209,6 +210,8 @@ enum ScanState  // States of the Turing machine
    SsGetString = 3
};

}

bool ImpSvNumberInputScan::NextNumberStringSymbol( const sal_Unicode*& pStr,
                                                   OUString& rSymbol )
{
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index ce04f09..0ba7c9b 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -348,6 +348,8 @@ bool ImpSvNumFor::GetNewCurrencySymbol( OUString& rSymbol,
 * SvNumberformat
 */

namespace {

enum BracketFormatSymbolType
{
    BRACKET_SYMBOLTYPE_FORMAT   = -1,   // subformat string
@@ -385,6 +387,8 @@ enum BracketFormatSymbolType
    BRACKET_SYMBOLTYPE_NATNUM19 = -33
};

}

void SvNumberformat::ImpCopyNumberformat( const SvNumberformat& rFormat )
{
    sFormatstring = rFormat.sFormatstring;
@@ -1408,6 +1412,8 @@ SvNumberformat::~SvNumberformat()
 * ---------------+-------------------+----------------------------+---------------
 */

namespace {

enum ScanState
{
    SsStop,
@@ -1420,6 +1426,8 @@ enum ScanState
    SsGetQuoted         // quoted text
};

}

// read a string until ']' and delete spaces in input
// static
sal_Int32 SvNumberformat::ImpGetNumber(OUStringBuffer& rString,
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 04e86ea..1216ae6 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -757,6 +757,8 @@ short ImpSvNumberformatScan::GetKeyWord( const OUString& sSymbol, sal_Int32 nPos
 * we write back the rest of the characters!
 */

namespace {

enum ScanState
{
    SsStop      = 0,
@@ -768,6 +770,8 @@ enum ScanState
    SsGetBlank  = 6
};

}

short ImpSvNumberformatScan::Next_Symbol( const OUString& rStr,
                                          sal_Int32& nPos,
                                          OUString& sSymbol ) const
diff --git a/svtools/source/config/helpopt.cxx b/svtools/source/config/helpopt.cxx
index 07834d8..1137caa 100644
--- a/svtools/source/config/helpopt.cxx
+++ b/svtools/source/config/helpopt.cxx
@@ -38,7 +38,6 @@ using namespace com::sun::star;
namespace {
    //global
    std::weak_ptr<SvtHelpOptions_Impl> g_pHelpOptions;
}

enum class HelpProperty
{
@@ -50,6 +49,8 @@ enum class HelpProperty
    OfflineHelpPopUp = 5
};

}

class SvtHelpOptions_Impl : public utl::ConfigItem
{
    bool            bExtendedHelp;
diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx
index ed8fbfe..fbd7f57 100644
--- a/svtools/source/config/htmlcfg.cxx
+++ b/svtools/source/config/htmlcfg.cxx
@@ -29,6 +29,8 @@
#include <o3tl/typed_flags_set.hxx>
#include <com/sun/star/uno/Sequence.hxx>

namespace {

enum class HtmlCfgFlags {
    NONE                  = 0x000,
    UnknownTags           = 0x001,
@@ -39,6 +41,9 @@ enum class HtmlCfgFlags {
    IsBasicWarning        = 0x080,
    NumbersEnglishUS      = 0x100,
};

}

namespace o3tl {
    template<> struct typed_flags<HtmlCfgFlags> : is_typed_flags<HtmlCfgFlags, 0x1f9> {};
}
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index 2ba347b..957e153 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -89,12 +89,17 @@ public:
    OutputDevice*           GetDevice() const { return mpDevice; }
};

namespace {

enum class FontListFontNameType
{
    NONE              = 0x00,
    PRINTER           = 0x01,
    SCREEN            = 0x02,
};

}

namespace o3tl
{
    template<> struct typed_flags<FontListFontNameType> : is_typed_flags<FontListFontNameType, 0x3> {};
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index 6ce2365..523ed4f 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -1894,6 +1894,8 @@ bool HTMLParser::InternalImgToPrivateURL( OUString& rURL )
    return bFound;
}

namespace {

enum class HtmlMeta {
    NONE = 0,
    Author,
@@ -1910,6 +1912,8 @@ enum class HtmlMeta {
    ContentType
};

}

// <META NAME=xxx>
static HTMLOptionEnum<HtmlMeta> const aHTMLMetaNameTable[] =
{
diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx
index ebbe12f..a96e8d9 100644
--- a/svx/source/fmcomp/fmgridcl.cxx
+++ b/svx/source/fmcomp/fmgridcl.cxx
@@ -777,8 +777,12 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe
    }
}

namespace {

enum InspectorAction { eOpenInspector, eCloseInspector, eUpdateInspector, eNone };

}

void FmGridHeader::PostExecuteColumnContextMenu(sal_uInt16 nColId, const PopupMenu& rMenu, sal_uInt16 nExecutionResult)
{
    Reference< css::container::XIndexContainer >  xCols(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns());
diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
index a4388ce..d83a9a0 100644
--- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
+++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx
@@ -45,6 +45,8 @@ const char UNO_SIDEBARGRADIENT[] = ".uno:sidebargradient";

namespace svx { namespace sidebar {

namespace {

enum eFillStyle
{
    NONE,
@@ -55,6 +57,8 @@ enum eFillStyle
    PATTERN
};

}

const sal_Int32 AreaPropertyPanelBase::DEFAULT_CENTERX = 50;
const sal_Int32 AreaPropertyPanelBase::DEFAULT_CENTERY = 50;
const sal_Int32 AreaPropertyPanelBase::DEFAULT_ANGLE = 0;
diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx
index a19219d..a08d358 100644
--- a/svx/source/svdraw/svdibrow.cxx
+++ b/svx/source/svdraw/svdibrow.cxx
@@ -74,6 +74,8 @@ using namespace com::sun::star;

#define ITEM_NOT_FOUND std::numeric_limits<std::size_t>::max()

namespace {

enum class ItemType {
    DONTKNOW, BYTE, INT16, UINT16, INT32, UINT32,
    ENUM, BOOL, FLAG, STRING, POINT, RECT, RANGE,
@@ -83,6 +85,7 @@ enum class ItemType {
    FONT, FONTHEIGHT, FONTWIDTH, FIELD
};

}

class ImpItemListRow
{
diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
index b4714c9..ea96430 100644
--- a/svx/source/svdraw/svdocapt.cxx
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -63,9 +63,12 @@
#include <vcl/canvastools.hxx>
#include <vcl/ptrstyle.hxx>

namespace {

enum EscDir {LKS,RTS,OBN,UNT};

}

class ImpCaptParams
{
public:
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index ffd6ca9..d4c5ab1 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -88,6 +88,8 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::text;
using namespace ::com::sun::star::style;

namespace {

enum class CellPosFlag  // signals the relative position of a cell to a selection
{
    NONE   = 0x0000, // not set or inside
@@ -102,6 +104,9 @@ enum class CellPosFlag  // signals the relative position of a cell to a selectio
    Bottom = 0x0040,
    Lower  = 0x0080
};

}

namespace o3tl
{ template<> struct typed_flags<CellPosFlag> : is_typed_flags<CellPosFlag, 0xff> {}; }

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 1b8d6fe..782dd2c 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2427,6 +2427,8 @@ void SvxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
    }
}

namespace {

enum class FrmValidFlags {
    NONE      = 0x00,
    Left      = 0x01,
@@ -2437,6 +2439,9 @@ enum class FrmValidFlags {
    VInner    = 0x20,
    AllMask   = 0x3f,
};

}

namespace o3tl {
    template<> struct typed_flags<FrmValidFlags> : is_typed_flags<FrmValidFlags, 0x3f> {};
}
diff --git a/svx/source/xml/xmlxtimp.cxx b/svx/source/xml/xmlxtimp.cxx
index c9b5ecf..4fbed12 100644
--- a/svx/source/xml/xmlxtimp.cxx
+++ b/svx/source/xml/xmlxtimp.cxx
@@ -66,8 +66,11 @@ using namespace com::sun::star::xml::sax;
using namespace ::xmloff::token;
using namespace cppu;

namespace {

enum class SvxXMLTableImportContextEnum { Color, Marker, Dash, Hatch, Gradient, Bitmap };

}

class SvxXMLTableImportContext : public SvXMLImportContext
{
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index d1436b3..d3bb318 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -113,9 +113,13 @@ const SwCursorShell* SwAccessibleContext::GetCursorShell() const
    return dynamic_cast<const SwCursorShell*>( pViewShell);
}

namespace {

enum class Action { NONE, SCROLLED, SCROLLED_WITHIN,
                          SCROLLED_IN, SCROLLED_OUT };

}

void SwAccessibleContext::ChildrenScrolled( const SwFrame *pFrame,
                                            const SwRect& rOldVisArea )
{
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 437864f..afc89c8 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -191,8 +191,12 @@ std::ostream &operator <<(std::ostream& s, const SwPosition& position)
    return s << "SwPosition (node " << position.nNode.GetIndex() << ", offset " << position.nContent.GetIndex() << ")";
}

namespace {

enum CHKSECTION { Chk_Both, Chk_One, Chk_None };

}

static CHKSECTION lcl_TstIdx( sal_uLong nSttIdx, sal_uLong nEndIdx, const SwNode& rEndNd )
{
    sal_uLong nStt = rEndNd.StartOfSectionIndex(), nEnd = rEndNd.GetIndex();
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index f467449..3a22635 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -51,12 +51,16 @@

using namespace ::com::sun::star;

namespace {

enum SwSplitDocType
{
    SPLITDOC_TO_GLOBALDOC,
    SPLITDOC_TO_HTML
};

}

bool SwDoc::GenerateGlobalDoc( const OUString& rPath,
                                   const SwTextFormatColl* pSplitColl )
{
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index eeb6fd4..5e69b24 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -129,6 +129,8 @@ using std::make_pair;

struct SwPaintProperties;

namespace {

//Class declaration; here because they are only used in this file
enum class SubColFlags {
    Page     = 0x01,    //Helplines of the page
@@ -136,6 +138,9 @@ enum class SubColFlags {
    Fly      = 0x10,    //Helplines inside fly frames
    Sect     = 0x20,    //Helplines inside sections
};

}

namespace o3tl {
    template<> struct typed_flags<SubColFlags> : is_typed_flags<SubColFlags, 0x39> {};
}
@@ -5698,7 +5703,12 @@ bool SwPageFrame::IsLeftShadowNeeded() const
    }
}

namespace {

enum PaintArea {LEFT, RIGHT, TOP, BOTTOM};

}

#define BORDER_TILE_SIZE 512

/// Wrapper around pOut->DrawBitmapEx.
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 1e4009a..0005d65 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -181,7 +181,12 @@ bool isSplittable(const sal_uInt16 nWhich)
    return false;
}

namespace {

enum Split_t { FAIL, SPLIT_NEW, SPLIT_OTHER };

}

/**
  Calculate splitting policy for overlapping hints, based on what kind of
  hint is inserted, and what kind of existing hint overlaps.
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index dc47a6d..74b70cd 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -789,8 +789,12 @@ void SwXTextCursor::DeleteAndInsert(const OUString& rText,
    }
}

namespace {

enum ForceIntoMetaMode { META_CHECK_BOTH, META_INIT_START, META_INIT_END };

}

static bool
lcl_ForceIntoMeta(SwPaM & rCursor,
        uno::Reference<text::XText> const & xParentText,
diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx
index 62b0071..909ec61 100644
--- a/sw/source/filter/html/css1atr.cxx
+++ b/sw/source/filter/html/css1atr.cxx
@@ -99,6 +99,8 @@ using editeng::SvxBorderLine;

#define HTML_HEADSPACE (12*20)

namespace {

enum class Css1Background {
    Attr    = 1,
    Page    = 2,
@@ -115,6 +117,9 @@ enum class Css1FrameSize {
    AnyHeight  = 0x06,
    Pixel      = 0x10,
};

}

namespace o3tl {
    template<> struct typed_flags<Css1FrameSize> : is_typed_flags<Css1FrameSize, 0x17> {};
}
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index c54d311..67ca2a1 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -1057,6 +1057,8 @@ HTMLStartEndPos::HTMLStartEndPos( const SfxPoolItem& rItem, sal_Int32 nStt,

typedef std::vector<HTMLStartEndPos *> HTMLStartEndPositions;

namespace {

enum HTMLOnOffState { HTML_NOT_SUPPORTED,   // unsupported Attribute
                      HTML_REAL_VALUE,      // Attribute with value
                      HTML_ON_VALUE,        // Attribute is On-Tag
@@ -1067,6 +1069,8 @@ enum HTMLOnOffState { HTML_NOT_SUPPORTED,   // unsupported Attribute
                      HTML_DROPCAP_VALUE,   // DropCap-Attribute
                      HTML_AUTOFMT_VALUE }; // Attribute for automatic character styles

}

class HTMLEndPosLst
{
    HTMLStartEndPositions aStartLst;  // list, sorted for start positions
diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx
index c58a8e4..13f33ac 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -103,8 +103,12 @@ static HTMLOptionEnum<FormSubmitEncoding> const aHTMLFormEncTypeTable[] =
    { nullptr,                              FormSubmitEncoding(0)           }
};

namespace {

enum HTMLWordWrapMode { HTML_WM_OFF, HTML_WM_HARD, HTML_WM_SOFT };

}

static HTMLOptionEnum<HTMLWordWrapMode> const aHTMLTextAreaWrapTable[] =
{
    { OOO_STRING_SVTOOLS_HTML_WW_off,      HTML_WM_OFF     },
diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index c1a6f731..721a9e4 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -170,8 +170,12 @@ static CSS1PropertyEnum const aBorderWidthTable[] =
    { nullptr,                    0   }
};

namespace {

enum CSS1BorderStyle { CSS1_BS_NONE, CSS1_BS_SINGLE, CSS1_BS_DOUBLE, CSS1_BS_DOTTED, CSS1_BS_DASHED, CSS1_BS_GROOVE, CSS1_BS_RIDGE, CSS1_BS_INSET, CSS1_BS_OUTSET };

}

static CSS1PropertyEnum const aBorderStyleTable[] =
{
    { "none",        CSS1_BS_NONE        },
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 12ce9f9..1db18cf 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -1626,6 +1626,8 @@ namespace
    }
}

namespace {

enum wwTableSprm
{
    sprmNil,
@@ -1637,6 +1639,8 @@ enum wwTableSprm
    sprmTDefTableNewShd, sprmTCellPadding, sprmTCellPaddingDefault
};

}

static wwTableSprm GetTableSprm(sal_uInt16 nId, ww::WordVersion eVer)
{
    switch (eVer)
diff --git a/sw/source/filter/xml/xmlbrsh.cxx b/sw/source/filter/xml/xmlbrsh.cxx
index aebefd1..e55e60e 100644
--- a/sw/source/filter/xml/xmlbrsh.cxx
+++ b/sw/source/filter/xml/xmlbrsh.cxx
@@ -40,6 +40,8 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::xmloff::token;

namespace {

enum SvXMLTokenMapAttrs
{
    XML_TOK_BGIMG_HREF,
@@ -51,6 +53,8 @@ enum SvXMLTokenMapAttrs
    XML_TOK_BGIMG_FILTER,
};

}

static const SvXMLTokenMapEntry aBGImgAttributesAttrTokenMap[] =
{
    { XML_NAMESPACE_XLINK, XML_HREF,        XML_TOK_BGIMG_HREF      },
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index c198632..ad64270 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -104,6 +104,8 @@ using namespace ::com::sun::star::xforms;
using namespace ::xmloff::token;
using namespace ::std;

namespace {

enum SwXMLDocTokens
{
    XML_TOK_DOC_FONTDECLS,
@@ -117,6 +119,8 @@ enum SwXMLDocTokens
    XML_TOK_DOC_XFORMS,
};

}

static const SvXMLTokenMapEntry aDocTokenMap[] =
{
    { XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS,     XML_TOK_DOC_FONTDECLS  },
diff --git a/sw/source/filter/xml/xmlmeta.cxx b/sw/source/filter/xml/xmlmeta.cxx
index 35ffb99..2a95dc8 100644
--- a/sw/source/filter/xml/xmlmeta.cxx
+++ b/sw/source/filter/xml/xmlmeta.cxx
@@ -72,6 +72,8 @@ SvXMLImportContext *SwXMLImport::CreateMetaContext(
    return pContext;
}

namespace {

enum SvXMLTokenMapAttrs
{
    XML_TOK_META_STAT_TABLE = 1,
@@ -85,6 +87,8 @@ enum SvXMLTokenMapAttrs
    XML_TOK_META_STAT_END=XML_TOK_UNKNOWN
};

}

struct statistic {
    SvXMLTokenMapAttrs const token;
    const char* name;
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index b7807e0..657ac47 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -77,6 +77,8 @@ using namespace ::com::sun::star::table;
using namespace ::com::sun::star::xml::sax;
using namespace ::xmloff::token;

namespace {

enum SwXMLTableElemTokens
{
    XML_TOK_TABLE_HEADER_COLS,
@@ -105,6 +107,8 @@ enum SwXMLTableCellAttrTokens
    XML_TOK_TABLE_VALUE_TYPE,
};

}

static const SvXMLTokenMapEntry aTableElemTokenMap[] =
{
    { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_COLUMNS,
diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx
index 509784e..284b48c 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -58,6 +58,8 @@ using namespace ::com::sun::star::document;
using namespace ::com::sun::star::io;
using namespace ::xmloff::token;

namespace {

enum SvEmbeddedObjectTypes
{
    SV_EMBEDDED_OWN,
@@ -67,6 +69,8 @@ enum SvEmbeddedObjectTypes
    SV_EMBEDDED_FRAME
};

}

SwNoTextNode *SwXMLTextParagraphExport::GetNoTextNode(
    const Reference < XPropertySet >& rPropSet )
{
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index 4b89a8a..6791ce5 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -730,6 +730,8 @@ bool SwFieldRefPage::MatchSubstring( const OUString& rListString, const OUString
    return aListString.indexOf(aSubstr) >= 0;
}

namespace {

enum FMT_REF_IDX
{
    FMT_REF_PAGE_IDX                = 0,
@@ -745,6 +747,8 @@ enum FMT_REF_IDX
    FMT_REF_NUMBER_FULL_CONTEXT_IDX = 10
};

}

static const char* FMT_REF_ARY[] =
{
    FMT_REF_PAGE,
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 3cb8099..836fde5 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -91,6 +91,8 @@ struct StringIdPair_Impl
#define MAX_PERCENT_WIDTH   254
#define MAX_PERCENT_HEIGHT  254

namespace {

enum class LB {
    NONE                = 0x00000000L,
    Frame               = 0x00000001L,  // text region of the paragraph
@@ -119,6 +121,9 @@ enum class LB {

    VertLine            = 0x00400000L,  // vertical text line
};

}

namespace o3tl {
    template<> struct typed_flags<LB> : is_typed_flags<LB, 0x00773fffL> {};
}
diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index 006ad51..7aefbfc 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -359,6 +359,8 @@ void SwRevisionConfig::Load()
    }
}

namespace {

enum InsertConfigProp
{
    INS_PROP_TABLE_HEADER = 0,
@@ -456,6 +458,9 @@ enum InsertConfigProp
    INS_PROP_CAP_OBJECT_OLEMISC_CHARACTERSTYLE,         //92
    INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES        //93
};

}

const Sequence<OUString>& SwInsertConfig::GetPropertyNames() const
{
    static Sequence<OUString> aNames
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index 8d11292..c899b6c 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -169,10 +169,20 @@ void lcl_emitEvent(SfxEventHintId nEventId, sal_Int32 nStrId, SfxObjectShell* pD

std::vector<std::pair<SwDocShell*, OUString>> SwDBManager::m_aUncommittedRegistrations;

namespace {

enum class SwDBNextRecord { NEXT, FIRST };

}

static bool lcl_ToNextRecord( SwDSParam* pParam, const SwDBNextRecord action = SwDBNextRecord::NEXT );

namespace {

enum class WorkingDocType { SOURCE, TARGET, COPY };

}

static SfxObjectShell* lcl_CreateWorkingDocument(
    const WorkingDocType aType, const SwWrtShell &rSourceWrtShell,
    const vcl::Window *pSourceWindow,
diff --git a/sw/source/uibase/sidebar/PageStylesPanel.cxx b/sw/source/uibase/sidebar/PageStylesPanel.cxx
index 025a38f..70595db 100644
--- a/sw/source/uibase/sidebar/PageStylesPanel.cxx
+++ b/sw/source/uibase/sidebar/PageStylesPanel.cxx
@@ -44,6 +44,8 @@ using namespace ::com::sun::star;

namespace sw { namespace sidebar{

namespace {

enum eFillStyle
{
    NONE,
@@ -54,6 +56,8 @@ enum eFillStyle
    PATTERN
};

}

const SvxPageUsage aArr[] =
{
    SvxPageUsage::All,
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 93dc022..ebe65c3 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -64,6 +64,8 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::i18n;

namespace {

enum SwDocumentSettingsPropertyHandles
{
    HANDLE_FORBIDDEN_CHARS,
@@ -146,6 +148,8 @@ enum SwDocumentSettingsPropertyHandles
    HANDLE_CONTINUOUS_ENDNOTES,
};

}

static MasterPropertySetInfo * lcl_createSettingsInfo()
{
    static PropertyInfo const aWriterSettingsInfoMap[] =
diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx
index 388d59c..83682db 100644
--- a/sw/source/uibase/uno/unomailmerge.cxx
+++ b/sw/source/uibase/uno/unomailmerge.cxx
@@ -87,12 +87,17 @@ static osl::Mutex &    GetMailMergeMutex()
    return aMutex;
}

namespace {

enum CloseResult
{
    eSuccess,       // successfully closed
    eVetoed,        // vetoed, ownership transferred to the vetoing instance
    eFailed         // failed for some unknown reason
};

}

static CloseResult CloseModelAndDocSh(
       Reference< frame::XModel > const &rxModel,
       SfxObjectShellRef &rxDocSh )
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index 5df0c5a..07ce19e 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -49,6 +49,8 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::comphelper;

namespace {

enum SwViewSettingsPropertyHandles
{
    HANDLE_VIEWSET_ANNOTATIONS,
@@ -119,6 +121,8 @@ enum SwPrintSettingsPropertyHandles
    HANDLE_PRINTSET_HIDDEN_TEXT
};

}

static ChainablePropertySetInfo * lcl_createViewSettingsInfo()
{
    static PropertyInfo const aViewSettingsMap_Impl[] =
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 21b72b3..468ba6c 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -821,6 +821,8 @@ void SwContentType::FillMemberList(bool* pbLevelOrVisibilityChanged)
    m_bDataValid = true;
}

namespace {

enum STR_CONTEXT_IDX
{
    IDX_STR_OUTLINE_LEVEL = 0,
@@ -838,6 +840,8 @@ enum STR_CONTEXT_IDX
    IDX_STR_SEND_OUTLINE_TO_CLIPBOARD_ENTRY = 12
};

}

static const char* STR_CONTEXT_ARY[] =
{
    STR_OUTLINE_LEVEL,
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 2b056fc..1859e70 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -135,6 +135,8 @@ void SwGlobalFrameListener_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint&
        bValid = false;
}

namespace {

enum GLOBAL_CONTEXT_IDX
{
    IDX_STR_UPDATE = 0,
@@ -153,6 +155,8 @@ enum GLOBAL_CONTEXT_IDX
    IDX_STR_EDIT_LINK = 13
};

}

static const char* GLOBAL_CONTEXT_ARY[] =
{
    STR_UPDATE,
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index e016ab6..fa97463 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -585,6 +585,8 @@ void SwNavigationPI::ZoomIn()
    m_aContentToolBox->CheckItem(m_aContentToolBox->GetItemId("listbox"), false);
}

namespace {

enum StatusIndex
{
    IDX_STR_HIDDEN = 0,
@@ -592,6 +594,8 @@ enum StatusIndex
    IDX_STR_INACTIVE = 2
};

}

SwNavigationPI::SwNavigationPI(SfxBindings* _pBindings,
                               vcl::Window* pParent)
    : PanelLayout(pParent, "NavigatorPanel", "modules/swriter/ui/navigatorpanel.ui", nullptr)
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index 92c3639..eede2a3 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -219,6 +219,8 @@ ResultSetBase* ResultSetFactory::createResultSet()

// XCommandProcessor methods.

namespace {

enum ACTION { NOACTION,
              THROWAUTHENTICATIONREQUEST,
              THROWACCESSDENIED,
@@ -228,6 +230,8 @@ enum ACTION { NOACTION,
              THROWNOFILE,
              THROWGENERAL };

}

// virtual
Any SAL_CALL FTPContent::execute( const Command& aCommand,
                                  sal_Int32 /*CommandId*/,
diff --git a/ucb/source/ucp/ftp/ftpurl.cxx b/ucb/source/ucp/ftp/ftpurl.cxx
index ecc9fdc..93b7dc3 100644
--- a/ucb/source/ucp/ftp/ftpurl.cxx
+++ b/ucb/source/ucp/ftp/ftpurl.cxx
@@ -354,10 +354,14 @@ OUString FTPURL::child() const

namespace ftp {

    namespace {

    enum OS {
        FTP_DOS,FTP_UNIX,FTP_VMS,FTP_UNKNOWN
    };

    }

}


diff --git a/unotools/source/config/configvaluecontainer.cxx b/unotools/source/config/configvaluecontainer.cxx
index fcdae8f..780a59d 100644
--- a/unotools/source/config/configvaluecontainer.cxx
+++ b/unotools/source/config/configvaluecontainer.cxx
@@ -34,12 +34,16 @@ namespace utl

    //= NodeValueAccessor

    namespace {

    enum class LocationType
    {
        SimplyObjectInstance,
        Unbound
    };

    }

    struct NodeValueAccessor
    {
    private:
diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx
index 5ebfdbf..92ec14e 100644
--- a/unotools/source/config/fltrcfg.cxx
+++ b/unotools/source/config/fltrcfg.cxx
@@ -28,6 +28,8 @@
using namespace utl;
using namespace com::sun::star::uno;

namespace {

enum class ConfigFlags {
    NONE                         = 0x0000000,
    WordCode                     = 0x0000001,
@@ -55,6 +57,9 @@ enum class ConfigFlags {
    CreateMSOLockFiles           = 0x2000000,
    VisioLoad                    = 0x4000000,
};

}

namespace o3tl {
    template<> struct typed_flags<ConfigFlags> : is_typed_flags<ConfigFlags, 0xe7fff3f> {};
}
diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx
index 12c6528..d9d80ce 100644
--- a/unotools/source/misc/fontcvt.cxx
+++ b/unotools/source/misc/fontcvt.cxx
@@ -1011,12 +1011,16 @@ static sal_Unicode ImplStarSymbolToStarBats( sal_Unicode c )
    return c;
}

namespace {

enum SymbolFont
{
    Symbol=1, Wingdings=2, MonotypeSorts=4, Webdings=8, Wingdings2=16,
    Wingdings3=32, MTExtra=64, TimesNewRoman=128
};

}

const char * const aSymbolNames[] =
{
    "Symbol", "Wingdings", "Monotype Sorts", "Webdings", "Wingdings 2",
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index a621f6c..18c6f0f 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -2091,8 +2091,12 @@ static BitmapEx readBitmapEx( const OUString& rPath )
    return aGraphic.GetBitmapEx();
}

namespace {

enum WhichPersona { PERSONA_HEADER, PERSONA_FOOTER };

}

/** Update the setting of the Persona header / footer in ImplStyleData */
static void setupPersonaHeaderFooter( WhichPersona eWhich, OUString& rHeaderFooter, BitmapEx& rHeaderFooterBitmap, boost::optional<Color>& rMenuBarTextColor )
{
diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx
index 7ae57b9..51c21ac 100644
--- a/vcl/source/control/fmtfield.cxx
+++ b/vcl/source/control/fmtfield.cxx
@@ -43,6 +43,8 @@ using namespace ::com::sun::star::util;

namespace validation
{
    namespace {

    // the states of our automat.
    enum State
    {
@@ -59,6 +61,8 @@ namespace validation
        END                 // reached the end of the string
    };

    }

    // a row in the transition table (means the set of states to be reached from a given state)
    typedef ::std::map< sal_Unicode, State >        StateTransitions;

diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx
index 6bd2290..34e35738 100644
--- a/vcl/source/filter/igif/gifread.cxx
+++ b/vcl/source/filter/igif/gifread.cxx
@@ -26,6 +26,8 @@

#define NO_PENDING( rStm ) ( ( rStm ).GetError() != ERRCODE_IO_PENDING )

namespace {

enum GIFAction
{
    GLOBAL_HEADER_READING,
@@ -45,6 +47,8 @@ enum ReadState
    GIFREAD_NEED_MORE
};

}

class GIFLZWDecompressor;

class SvStream;
diff --git a/vcl/source/filter/ixbm/xbmread.cxx b/vcl/source/filter/ixbm/xbmread.cxx
index 6d88ec5..bea2791 100644
--- a/vcl/source/filter/ixbm/xbmread.cxx
+++ b/vcl/source/filter/ixbm/xbmread.cxx
@@ -26,6 +26,8 @@

#include "xbmread.hxx"

namespace {

enum XBMFormat
{
    XBM10,
@@ -39,6 +41,8 @@ enum ReadState
    XBMREAD_NEED_MORE
};

}

class XBMReader : public GraphicReader
{
    SvStream&           rIStm;
diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx
index 85a9bfd..36183e7 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -42,6 +42,8 @@
#define XPMSTRING           0x00000004
#define XPMFINISHED         0x00000008

namespace {

enum ReadState
{
    XPMREAD_OK,
@@ -49,6 +51,8 @@ enum ReadState
    XPMREAD_NEED_MORE
};

}

class BitmapWriteAccess;
class Graphic;

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index fd6e6f9..7b905f5 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -54,6 +54,8 @@ static const char * const modextra = "gelf";

/*- private functions, constants and data types */

namespace {

enum PathSegmentType {
    PS_NOOP      = 0,
    PS_MOVETO    = 1,
@@ -62,6 +64,8 @@ enum PathSegmentType {
    PS_CLOSEPATH = 4
};

}

struct PSPathElement
{
    PathSegmentType type;
@@ -1013,6 +1017,8 @@ static void GetNames(TrueTypeFont *t)
    }
}

namespace {

enum cmapType {
    CMAP_NOT_USABLE           = -1,
    CMAP_MS_Symbol            = 10,
@@ -1024,6 +1030,8 @@ enum cmapType {
    CMAP_MS_Johab             = 16
};

}

#define MISSING_GLYPH_INDEX 0

static sal_uInt32 getGlyph0(const sal_uInt8* cmap, sal_uInt32, sal_uInt32 c) {
diff --git a/vcl/source/gdi/regionband.cxx b/vcl/source/gdi/regionband.cxx
index adddd26..8478ebb 100644
--- a/vcl/source/gdi/regionband.cxx
+++ b/vcl/source/gdi/regionband.cxx
@@ -190,8 +190,12 @@ bool RegionBand::operator==( const RegionBand& rRegionBand ) const
    return true;
}

namespace {

enum StreamEntryType { STREAMENTRY_BANDHEADER, STREAMENTRY_SEPARATION, STREAMENTRY_END };

}

bool RegionBand::load(SvStream& rIStrm)
{
    // clear this instance data
diff --git a/vcl/source/graphic/UnoGraphicDescriptor.cxx b/vcl/source/graphic/UnoGraphicDescriptor.cxx
index 9db06af..e27f8c5 100644
--- a/vcl/source/graphic/UnoGraphicDescriptor.cxx
+++ b/vcl/source/graphic/UnoGraphicDescriptor.cxx
@@ -32,6 +32,8 @@
#include <vcl/svapp.hxx>
#include <memory>

namespace {

enum class UnoGraphicProperty
{
      GraphicType = 1
@@ -46,6 +48,7 @@ enum class UnoGraphicProperty
    , OriginURL = 10
};

}

using namespace ::com::sun::star;

diff --git a/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx b/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx
index 52f0a34..fa5ab60 100644
--- a/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx
+++ b/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx
@@ -73,6 +73,8 @@ static AtkTextAttribute atk_text_attribute_mm_to_pixel_ratio = ATK_TEXT_ATTR_INV
  *                        and re-arrange the enum values accordingly.
  */

namespace {

enum ExportedAttribute
{
    TEXT_ATTRIBUTE_BACKGROUND_COLOR = 0,
@@ -109,6 +111,8 @@ enum ExportedAttribute
    TEXT_ATTRIBUTE_LAST
};

}

static const char * ExportedTextAttributes[TEXT_ATTRIBUTE_LAST] =
{
    "CharBackColor",        // TEXT_ATTRIBUTE_BACKGROUND_COLOR
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 5680ddf..6988f87 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -133,6 +133,8 @@ static GtkStateFlags NWConvertVCLStateToGTKState(ControlState nVCLState)
    return nGTKState;
}

namespace {

enum class RenderType {
    BackgroundAndFrame = 1,
    Check,
@@ -152,6 +154,8 @@ enum class RenderType {
    Focus
};

}

static void NWCalcArrowRect( const tools::Rectangle& rButton, tools::Rectangle& rArrow )
{
    // Size the arrow appropriately
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx
index 74dc6fb..42e4c5c 100644
--- a/vcl/workben/vcldemo.cxx
+++ b/vcl/workben/vcldemo.cxx
@@ -86,11 +86,15 @@ namespace {

}

namespace {

enum RenderStyle {
    RENDER_THUMB,    // small view <n> to a page
    RENDER_EXPANDED, // expanded view of this renderer
};

}

class DemoRenderer
{
    Bitmap   maIntroBW;
diff --git a/xmloff/source/chart/XMLSymbolImageContext.cxx b/xmloff/source/chart/XMLSymbolImageContext.cxx
index 5fce5f6..36fd0ea 100644
--- a/xmloff/source/chart/XMLSymbolImageContext.cxx
+++ b/xmloff/source/chart/XMLSymbolImageContext.cxx
@@ -29,6 +29,8 @@

using namespace css;

namespace {

enum SvXMLTokenMapAttrs
{
    XML_TOK_SYMBOL_IMAGE_HREF,
@@ -37,6 +39,8 @@ enum SvXMLTokenMapAttrs
    XML_TOK_SYMBOL_IMAGE_SHOW,
};

}

static const SvXMLTokenMapEntry aSymbolImageAttrTokenMap[] =
{
    { XML_NAMESPACE_XLINK,  ::xmloff::token::XML_HREF,     XML_TOK_SYMBOL_IMAGE_HREF    },
diff --git a/xmloff/source/draw/XMLImageMapContext.cxx b/xmloff/source/draw/XMLImageMapContext.cxx
index c7126b0..40d5a8f 100644
--- a/xmloff/source/draw/XMLImageMapContext.cxx
+++ b/xmloff/source/draw/XMLImageMapContext.cxx
@@ -55,6 +55,7 @@ using ::com::sun::star::uno::XInterface;
using ::com::sun::star::uno::Any;
using ::com::sun::star::document::XEventsSupplier;

namespace {

enum XMLImageMapToken: decltype(XML_TOK_UNKNOWN)
{
@@ -73,6 +74,8 @@ enum XMLImageMapToken: decltype(XML_TOK_UNKNOWN)
    XML_TOK_IMAP_TARGET
};

}

static const SvXMLTokenMapEntry aImageMapObjectTokenMap[] =
{
    { XML_NAMESPACE_XLINK,  XML_HREF,           XML_TOK_IMAP_URL            },
diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx
index f436035..082f7ad 100644
--- a/xmloff/source/draw/animationimport.cxx
+++ b/xmloff/source/draw/animationimport.cxx
@@ -164,6 +164,8 @@ const SvXMLTokenMap& AnimationsImportHelperImpl::getAnimationNodeTokenMap()
    return *mpAnimationNodeTokenMap;
}

namespace {

enum AnimationNodeAttributes
{
    ANA_Begin,
@@ -217,6 +219,8 @@ enum AnimationNodeAttributes
    ANA_Volume
};

}

const SvXMLTokenMap& AnimationsImportHelperImpl::getAnimationNodeAttributeTokenMap()
{
    if( mpAnimationNodeAttributeTokenMap == nullptr )
diff --git a/xmloff/source/draw/animexp.cxx b/xmloff/source/draw/animexp.cxx
index 3036aa9..2b0071c 100644
--- a/xmloff/source/draw/animexp.cxx
+++ b/xmloff/source/draw/animexp.cxx
@@ -186,6 +186,8 @@ void SdXMLImplSetEffect( AnimationEffect eEffect, XMLEffect& eKind, XMLEffectDir
    bIn = rEffect.mbIn;
}

namespace {

enum XMLActionKind
{
    XMLE_SHOW,
@@ -194,6 +196,8 @@ enum XMLActionKind
    XMLE_PLAY
};

}

struct XMLEffectHint
{
    XMLActionKind   meKind;
diff --git a/xmloff/source/draw/animimp.cxx b/xmloff/source/draw/animimp.cxx
index 38d8f5e..f1ad97e 100644
--- a/xmloff/source/draw/animimp.cxx
+++ b/xmloff/source/draw/animimp.cxx
@@ -335,6 +335,8 @@ public:
    static constexpr OUStringLiteral gsIsAnimation = "IsAnimation";
};

namespace {

enum XMLActionKind
{
    XMLE_SHOW,
@@ -343,6 +345,8 @@ enum XMLActionKind
    XMLE_PLAY
};

}

class XMLAnimationsEffectContext : public SvXMLImportContext
{
public:
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index ddd128d..affbfd0 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -1577,6 +1577,7 @@ void XMLShapeExport::ImpExportText( const uno::Reference< drawing::XShape >& xSh
    }
}

namespace {

enum class Found {
    NONE              = 0x0000,
@@ -1591,6 +1592,9 @@ enum class Found {
    MACRO             = 0x0100,
    LIBRARY           = 0x0200,
};

}

namespace o3tl {
    template<> struct typed_flags<Found> : is_typed_flags<Found, 0x03ff> {};
}
diff --git a/xmloff/source/style/DashStyle.cxx b/xmloff/source/style/DashStyle.cxx
index 85173e1..5f61a15 100644
--- a/xmloff/source/style/DashStyle.cxx
+++ b/xmloff/source/style/DashStyle.cxx
@@ -39,6 +39,8 @@ using namespace ::com::sun::star;

using namespace ::xmloff::token;

namespace {

enum SvXMLTokenMapAttrs
{
    XML_TOK_DASH_NAME,
@@ -51,6 +53,8 @@ enum SvXMLTokenMapAttrs
    XML_TOK_DASH_DISTANCE,
};

}

static const SvXMLTokenMapEntry aDashStyleAttrTokenMap[] =
{
    { XML_NAMESPACE_DRAW, XML_NAME,             XML_TOK_DASH_NAME },
diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx
index 177c21b..5949589 100644
--- a/xmloff/source/style/GradientStyle.cxx
+++ b/xmloff/source/style/GradientStyle.cxx
@@ -39,6 +39,8 @@ using namespace ::com::sun::star;

using namespace ::xmloff::token;

namespace {

enum SvXMLTokenMapAttrs
{
    XML_TOK_GRADIENT_NAME,
@@ -55,6 +57,8 @@ enum SvXMLTokenMapAttrs
    XML_TOK_TABSTOP_END=XML_TOK_UNKNOWN
};

}

SvXMLEnumMapEntry<awt::GradientStyle> const pXML_GradientStyle_Enum[] =
{
    { XML_GRADIENTSTYLE_LINEAR,         awt::GradientStyle_LINEAR },
diff --git a/xmloff/source/style/HatchStyle.cxx b/xmloff/source/style/HatchStyle.cxx
index 8992237..e7f03a8 100644
--- a/xmloff/source/style/HatchStyle.cxx
+++ b/xmloff/source/style/HatchStyle.cxx
@@ -39,6 +39,8 @@ using namespace ::com::sun::star;

using namespace ::xmloff::token;

namespace {

enum SvXMLTokenMapAttrs
{
    XML_TOK_HATCH_NAME,
@@ -50,6 +52,8 @@ enum SvXMLTokenMapAttrs
    XML_TOK_TABSTOP_END=XML_TOK_UNKNOWN
};

}

SvXMLEnumMapEntry<drawing::HatchStyle> const pXML_HatchStyle_Enum[] =
{
    { XML_HATCHSTYLE_SINGLE,    drawing::HatchStyle_SINGLE },
diff --git a/xmloff/source/style/ImageStyle.cxx b/xmloff/source/style/ImageStyle.cxx
index 164f155..6fe12b4 100644
--- a/xmloff/source/style/ImageStyle.cxx
+++ b/xmloff/source/style/ImageStyle.cxx
@@ -32,6 +32,8 @@
using namespace css;
using namespace xmloff::token;

namespace {

enum SvXMLTokenMapAttrs
{
    XML_TOK_IMAGE_NAME,
@@ -42,6 +44,8 @@ enum SvXMLTokenMapAttrs
    XML_TOK_IMAGE_ACTUATE
};

}

void XMLImageStyle::exportXML(OUString const & rStrName, uno::Any const & rValue, SvXMLExport& rExport)
{
    if (rStrName.isEmpty())
diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx
index 510713c..30e4e56 100644
--- a/xmloff/source/style/TransGradientStyle.cxx
+++ b/xmloff/source/style/TransGradientStyle.cxx
@@ -39,6 +39,8 @@ using namespace ::com::sun::star;

using namespace ::xmloff::token;

namespace {

enum SvXMLTokenMapAttrs
{
    XML_TOK_GRADIENT_NAME,
@@ -52,6 +54,8 @@ enum SvXMLTokenMapAttrs
    XML_TOK_GRADIENT_BORDER
};

}

SvXMLEnumMapEntry<awt::GradientStyle> const pXML_GradientStyle_Enum[] =
{
    { XML_GRADIENTSTYLE_LINEAR,         awt::GradientStyle_LINEAR },
diff --git a/xmloff/source/style/XMLBackgroundImageContext.cxx b/xmloff/source/style/XMLBackgroundImageContext.cxx
index 6bdafccf..b9ccb73 100644
--- a/xmloff/source/style/XMLBackgroundImageContext.cxx
+++ b/xmloff/source/style/XMLBackgroundImageContext.cxx
@@ -43,6 +43,8 @@ using namespace ::com::sun::star::style;
using namespace ::com::sun::star::io;
using namespace ::xmloff::token;

namespace {

enum SvXMLTokenMapAttrs
{
    XML_TOK_BGIMG_HREF,
@@ -54,6 +56,9 @@ enum SvXMLTokenMapAttrs
    XML_TOK_BGIMG_FILTER,
    XML_TOK_BGIMG_OPACITY
};

}

static const SvXMLTokenMapEntry aBGImgAttributesAttrTokenMap[] =
{
    { XML_NAMESPACE_XLINK, XML_HREF,        XML_TOK_BGIMG_HREF      },
diff --git a/xmloff/source/style/XMLFontStylesContext.cxx b/xmloff/source/style/XMLFontStylesContext.cxx
index 0c8e18a..cbb3646 100644
--- a/xmloff/source/style/XMLFontStylesContext.cxx
+++ b/xmloff/source/style/XMLFontStylesContext.cxx
@@ -50,6 +50,8 @@ using namespace ::xmloff::token;

#define XML_STYLE_FAMILY_FONT 1

namespace {

enum XMLFontStyleAttrTokens
{
    XML_TOK_FONT_STYLE_ATTR_FAMILY,
@@ -59,6 +61,8 @@ enum XMLFontStyleAttrTokens
    XML_TOK_FONT_STYLE_ATTR_CHARSET,
};

}

static const SvXMLTokenMapEntry* lcl_getFontStyleAttrTokenMap()
{
    static const SvXMLTokenMapEntry aFontStyleAttrTokenMap[] =
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
index c019927..29f9e1f 100644
--- a/xmloff/source/style/xmlnumfi.cxx
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -192,6 +192,8 @@ public:
    virtual void EndElement() override;
};

namespace {

enum SvXMLStyleTokens
{
    XML_TOK_STYLE_TEXT,
@@ -264,6 +266,7 @@ enum SvXMLStyleElemAttrTokens
    XML_TOK_ELEM_ATTR_CALENDAR
};

}

//  standard colors

diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
index 710bb3e..09c9517 100644
--- a/xmloff/source/style/xmlnumi.cxx
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -99,6 +99,8 @@ public:
            SvxXMLListLevelStyleContext_Impl& rLLevel   );
};

namespace {

enum SvxXMLTextListLevelStyleAttrTokens
{
    XML_TOK_TEXT_LEVEL_ATTR_LEVEL,
@@ -116,6 +118,8 @@ enum SvxXMLTextListLevelStyleAttrTokens
    XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS
};

}

static const SvXMLTokenMapEntry* lcl_getLevelAttrTokenMap()
{
    static const SvXMLTokenMapEntry aLevelAttrTokenMap[] =
@@ -583,6 +587,8 @@ Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties()
    return aPropSeq;
}

namespace {

enum SvxXMLStyleAttributesAttrTokens
{
    XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE,
@@ -605,6 +611,8 @@ enum SvxXMLStyleAttributesAttrTokens
    XML_TOK_STYLE_ATTRIBUTES_ATTR_POSITION_AND_SPACE_MODE
};

}

static const SvXMLTokenMapEntry* lcl_getStyleAttributesAttrTokenMap()
{
    static const SvXMLTokenMapEntry aStyleAttributesAttrTokenMap[] =
@@ -912,6 +920,8 @@ SvXMLImportContextRef SvxXMLListLevelStyleAttrContext_Impl::CreateChildContext(
    return pContext;
}

namespace {

enum SvxXMLStyleAttributesLabelAlignmentAttrTokens
{
    XML_TOK_STYLE_ATTRIBUTES_ATTR_LABEL_FOLLOWED_BY,
@@ -919,6 +929,9 @@ enum SvxXMLStyleAttributesLabelAlignmentAttrTokens
    XML_TOK_STYLE_ATTRIBUTES_ATTR_FIRST_LINE_INDENT,
    XML_TOK_STYLE_ATTRIBUTES_ATTR_INDENT_AT
};

}

static const SvXMLTokenMapEntry* lcl_getStyleAlignmentAttributesAttrTokenMap()
{
    static const SvXMLTokenMapEntry aStyleAlignmentAttributesAttrTokenMap[] =
diff --git a/xmloff/source/style/xmltabi.cxx b/xmloff/source/style/xmltabi.cxx
index 95ae3a6..158d696 100644
--- a/xmloff/source/style/xmltabi.cxx
+++ b/xmloff/source/style/xmltabi.cxx
@@ -31,6 +31,8 @@
using namespace ::com::sun::star;
using namespace ::xmloff::token;

namespace {

enum SvXMLTokenMapAttrs
{
    XML_TOK_TABSTOP_POSITION,
@@ -40,6 +42,8 @@ enum SvXMLTokenMapAttrs
    XML_TOK_TABSTOP_LEADER_TEXT
};

}

static const SvXMLTokenMapEntry aTabsAttributesAttrTokenMap[] =
{
    { XML_NAMESPACE_STYLE, XML_POSITION,     XML_TOK_TABSTOP_POSITION },
diff --git a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
index d9ce113..cf3beb0 100644
--- a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
+++ b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx
@@ -159,6 +159,8 @@ XMLFootnoteConfigurationImportContext::~XMLFootnoteConfigurationImportContext()
{
}

namespace {

enum XMLFtnConfigToken
{
    XML_TOK_FTNCONFIG_CITATION_STYLENAME,
@@ -174,6 +176,8 @@ enum XMLFtnConfigToken
    XML_TOK_FTNCONFIG_POSITION
};

}

static const SvXMLTokenMapEntry aTextFieldAttrTokenMap[] =
{
    { XML_NAMESPACE_TEXT, XML_CITATION_STYLE_NAME,      XML_TOK_FTNCONFIG_CITATION_STYLENAME },
diff --git a/xmloff/source/text/XMLFootnoteImportContext.cxx b/xmloff/source/text/XMLFootnoteImportContext.cxx
index 9569d41..4361417 100644
--- a/xmloff/source/text/XMLFootnoteImportContext.cxx
+++ b/xmloff/source/text/XMLFootnoteImportContext.cxx
@@ -42,12 +42,15 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::xml::sax;
using namespace ::xmloff::token;

namespace {

enum XMLFootnoteChildToken {
    XML_TOK_FTN_NOTE_CITATION,
    XML_TOK_FTN_NOTE_BODY
};

}

static const SvXMLTokenMapEntry aFootnoteChildTokenMap[] =
{
    { XML_NAMESPACE_TEXT, XML_NOTE_CITATION,
diff --git a/xmloff/source/text/XMLIndexTemplateContext.cxx b/xmloff/source/text/XMLIndexTemplateContext.cxx
index 02d545c..66be9d7 100644
--- a/xmloff/source/text/XMLIndexTemplateContext.cxx
+++ b/xmloff/source/text/XMLIndexTemplateContext.cxx
@@ -185,7 +185,7 @@ void XMLIndexTemplateContext::EndElement()
    }
}


namespace {
/// template token types; used for aTokenTypeMap parameter
enum TemplateTokenType
{
@@ -199,6 +199,7 @@ enum TemplateTokenType
    XML_TOK_INDEX_TYPE_BIBLIOGRAPHY
};

}

SvXMLEnumMapEntry<TemplateTokenType> const aTemplateTokenTypeMap[] =
{
diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx
index 2ae5b75..db93665 100644
--- a/xmloff/source/text/XMLSectionExport.cxx
+++ b/xmloff/source/text/XMLSectionExport.cxx
@@ -1041,6 +1041,7 @@ bool XMLSectionExport::ExportIndexTemplate(
    return true;
}

namespace {

enum TemplateTypeEnum
{
@@ -1070,6 +1071,8 @@ enum TemplateParamEnum
    TOK_TPARAM_BIBLIOGRAPHY_DATA
};

}

SvXMLEnumStringMapEntry<TemplateTypeEnum> const aTemplateTypeMap[] =
{
    ENUM_STRING_MAP_ENTRY( "TokenEntryNumber",  TOK_TTYPE_ENTRY_NUMBER ),
diff --git a/xmloff/source/text/XMLSectionImportContext.cxx b/xmloff/source/text/XMLSectionImportContext.cxx
index e775404..d5783a2 100644
--- a/xmloff/source/text/XMLSectionImportContext.cxx
+++ b/xmloff/source/text/XMLSectionImportContext.cxx
@@ -47,6 +47,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::text;
using namespace ::xmloff::token;

namespace {

enum XMLSectionToken
{
@@ -60,6 +61,8 @@ enum XMLSectionToken
    XML_TOK_SECTION_IS_HIDDEN
};

}

static const SvXMLTokenMapEntry aSectionTokenMap[] =
{
    { XML_NAMESPACE_XML , XML_ID, XML_TOK_SECTION_XMLID },
diff --git a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
index beecdbb5b..3969bab 100644
--- a/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
+++ b/xmloff/source/text/XMLSectionSourceDDEImportContext.cxx
@@ -53,6 +53,8 @@ XMLSectionSourceDDEImportContext::~XMLSectionSourceDDEImportContext()
{
}

namespace {

enum XMLSectionSourceDDEToken
{
    XML_TOK_SECTION_DDE_APPLICATION,
@@ -61,6 +63,8 @@ enum XMLSectionSourceDDEToken
    XML_TOK_SECTION_IS_AUTOMATIC_UPDATE
};

}

static const SvXMLTokenMapEntry aSectionSourceDDETokenMap[] =
{
    { XML_NAMESPACE_OFFICE, XML_DDE_APPLICATION,
diff --git a/xmloff/source/text/XMLSectionSourceImportContext.cxx b/xmloff/source/text/XMLSectionSourceImportContext.cxx
index 006fbe5..ec6bd06 100644
--- a/xmloff/source/text/XMLSectionSourceImportContext.cxx
+++ b/xmloff/source/text/XMLSectionSourceImportContext.cxx
@@ -52,6 +52,7 @@ XMLSectionSourceImportContext::~XMLSectionSourceImportContext()
{
}

namespace {
enum XMLSectionSourceToken
{
    XML_TOK_SECTION_XLINK_HREF,
@@ -59,6 +60,8 @@ enum XMLSectionSourceToken
    XML_TOK_SECTION_TEXT_SECTION_NAME
};

}

static const SvXMLTokenMapEntry aSectionSourceTokenMap[] =
{
    { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SECTION_XLINK_HREF },
diff --git a/xmloff/source/text/XMLTextColumnsContext.cxx b/xmloff/source/text/XMLTextColumnsContext.cxx
index b62b66f..b8f3d55 100644
--- a/xmloff/source/text/XMLTextColumnsContext.cxx
+++ b/xmloff/source/text/XMLTextColumnsContext.cxx
@@ -40,6 +40,8 @@ using namespace ::com::sun::star::style;
using namespace ::com::sun::star::beans;
using namespace ::xmloff::token;

namespace {

enum SvXMLTokenMapAttrs
{
    XML_TOK_COLUMN_WIDTH,
@@ -56,6 +58,8 @@ enum SvXMLSepTokenMapAttrs
    XML_TOK_COLUMN_SEP_STYLE
};

}

static const SvXMLTokenMapEntry aColAttrTokenMap[] =
{
    { XML_NAMESPACE_STYLE,  XML_REL_WIDTH,      XML_TOK_COLUMN_WIDTH },
diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx
index 9d13c81..4dd5c1e 100644
--- a/xmloff/source/text/XMLTextMarkImportContext.cxx
+++ b/xmloff/source/text/XMLTextMarkImportContext.cxx
@@ -107,11 +107,15 @@ XMLTextMarkImportContext::XMLTextMarkImportContext(
{
}

namespace {

enum lcl_MarkType { TypeReference, TypeReferenceStart, TypeReferenceEnd,
                    TypeBookmark, TypeBookmarkStart, TypeBookmarkEnd,
                    TypeFieldmark, TypeFieldmarkStart, TypeFieldmarkEnd
                  };

}

static SvXMLEnumMapEntry<lcl_MarkType> const lcl_aMarkTypeMap[] =
{
    { XML_REFERENCE_MARK,         TypeReference },
diff --git a/xmloff/source/text/txtdropi.cxx b/xmloff/source/text/txtdropi.cxx
index 8e7dc0e..cceb49c 100644
--- a/xmloff/source/text/txtdropi.cxx
+++ b/xmloff/source/text/txtdropi.cxx
@@ -37,6 +37,7 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::style;
using namespace ::xmloff::token;

namespace {

enum SvXMLTokenMapDropAttrs
{
@@ -46,6 +47,8 @@ enum SvXMLTokenMapDropAttrs
    XML_TOK_DROP_STYLE
};

}

static const SvXMLTokenMapEntry aDropAttrTokenMap[] =
{
    { XML_NAMESPACE_STYLE, XML_LINES,       XML_TOK_DROP_LINES  },
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index cde1edd..10e2465 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -2666,6 +2666,7 @@ void XMLReferenceFieldImportContext::PrepareField(

// field declarations container

namespace {

enum DdeFieldDeclAttrs
{
@@ -2676,6 +2677,8 @@ enum DdeFieldDeclAttrs
    XML_TOK_DDEFIELD_UPDATE
};

}

static const SvXMLTokenMapEntry aDdeDeclAttrTokenMap[] =
{
    { XML_NAMESPACE_OFFICE, XML_NAME, XML_TOK_DDEFIELD_NAME },
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 0238e91..00b4968 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -355,6 +355,8 @@ static const sal_Char* aParagraphPropertyNamesAuto[] =
    nullptr
};

namespace {

enum eParagraphPropertyNamesEnumAuto
{
    NUMBERING_RULES_AUTO = 0,
@@ -362,6 +364,8 @@ enum eParagraphPropertyNamesEnumAuto
    PARA_STYLE_NAME_AUTO = 2
};

}

static const sal_Char* aParagraphPropertyNames[] =
{
    "NumberingIsNumber",
@@ -373,6 +377,8 @@ static const sal_Char* aParagraphPropertyNames[] =
    nullptr
};

namespace {

enum eParagraphPropertyNamesEnum
{
    NUMBERING_IS_NUMBER = 0,
@@ -383,6 +389,8 @@ enum eParagraphPropertyNamesEnum
    TEXT_SECTION = 5
};

}

void BoundFrames::Fill(const filter_t& rFilter)
{
    if(!m_xEnumAccess.is())
diff --git a/xmloff/source/text/txtvfldi.cxx b/xmloff/source/text/txtvfldi.cxx
index 5a1f225..e2ddd6e 100644
--- a/xmloff/source/text/txtvfldi.cxx
+++ b/xmloff/source/text/txtvfldi.cxx
@@ -1052,6 +1052,7 @@ void XMLDatabaseDisplayImportContext::EndElement()

// value import helper

namespace {

enum ValueType
{
@@ -1064,6 +1065,8 @@ enum ValueType
    XML_VALUE_TYPE_BOOLEAN
};

}

static SvXMLEnumMapEntry<ValueType> const aValueTypeMap[] =
{
    { XML_FLOAT,        XML_VALUE_TYPE_FLOAT },
diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx
index f270cb4..1e6055e 100644
--- a/xmloff/source/transform/OOo2Oasis.cxx
+++ b/xmloff/source/transform/OOo2Oasis.cxx
@@ -50,6 +50,8 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::beans;

namespace {

enum XMLUserDefinedTransformerAction
{
    XML_ETACTION_DOCUMENT=XML_ETACTION_USER_DEFINED,
@@ -68,6 +70,8 @@ enum XMLUserDefinedTransformerAction
    XML_ETACTION_TABLE
};

}

#define ENTRY3( n, l, a, p1, p2, p3 ) \
    { XML_NAMESPACE_##n, XML_##l, a, p1, p2, p3 }
#define ENTRY3QQN( n, l, a, n1, l1, n2, l2, p3 ) \
diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx
index 4b85666..0f55019 100644
--- a/xmloff/source/transform/Oasis2OOo.cxx
+++ b/xmloff/source/transform/Oasis2OOo.cxx
@@ -54,6 +54,8 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::beans;

namespace {

enum XMLUserDefinedTransformerAction
{
    XML_ETACTION_META=XML_ETACTION_USER_DEFINED,
@@ -75,6 +77,8 @@ enum XMLUserDefinedTransformerAction
    XML_ETACTION_CHART_PLOT_AREA
};

}

#define ENTRY3( n, l, a, p1, p2, p3 ) \
    { XML_NAMESPACE_##n, XML_##l, a, p1, p2, p3 }
#define ENTRY3QNQ( n, l, a, n1, l1, p2, n3, l3 ) \