1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_VCL_ENUMCONTEXT_HXX
20 #define INCLUDED_VCL_ENUMCONTEXT_HXX
22 #include <vcl/dllapi.h>
24 #include <rtl/ustring.hxx>
29 class VCL_DLLPUBLIC EnumContext
32 enum class Application
47 // For your convenience to avoid duplicate code in the common
48 // case that Draw and Impress use identical context configurations.
51 // Also for your convenience for the different variants of Writer documents.
54 // Used only by deck or panel descriptors. Matches any
58 // Use this only in special circumstances. One might be the
59 // wish to disable a deck or panel during debugging.
62 LAST
= Application::NONE
99 // Default context of an application. Do we need this?
102 // Used only by deck or panel descriptors. Matches any context.
105 // Special context name that is only used when a deck would
106 // otherwise be empty.
116 const Application eApplication
,
117 const Context eContext
);
119 /** This variant of the GetCombinedContext() method treats some
120 application names as identical to each other. Replacements
122 Draw or Impress -> DrawImpress
123 Writer or WriterWeb -> WriterAndWeb
124 Use the Application::DrawImpress or Application::WriterAndWeb values in the CombinedEnumContext macro.
126 sal_Int32
GetCombinedContext_DI() const;
128 Application
GetApplication_DI() const;
130 bool operator == (const EnumContext
& rOther
);
131 bool operator != (const EnumContext
& rOther
);
133 /** When two contexts are matched against each other, then
134 application or context name may have the wildcard value 'any'.
135 In order to prefer matches without wildcards over matches with
136 wildcards we introduce an integer evaluation for matches.
138 const static sal_Int32 NoMatch
;
139 const static sal_Int32 OptimalMatch
;
141 static Application
GetApplicationEnum (const OUString
& rsApplicationName
);
142 static const OUString
& GetApplicationName (const Application eApplication
);
144 static Context
GetContextEnum (const OUString
& rsContextName
);
145 static const OUString
& GetContextName (const Context eContext
);
148 Application meApplication
;
151 static void ProvideApplicationContainers();
152 static void ProvideContextContainers();
153 static void AddEntry (const OUString
& rsName
, const Application eApplication
);
154 static void AddEntry (const OUString
& rsName
, const Context eContext
);
158 #define CombinedEnumContext(a,e) ((static_cast<sal_uInt16>(::vcl::EnumContext::a)<<16)\
159 | static_cast<sal_uInt16>(::vcl::EnumContext::e))
161 } // end of namespace vcl
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */