Update git submodules
[LibreOffice.git] / include / vcl / EnumContext.hxx
blobb8e02efd1f6811529b61b50afd7d35ef46852d37
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
27 namespace vcl {
29 class VCL_DLLPUBLIC EnumContext
31 public:
32 enum class Application
34 Writer,
35 WriterGlobal,
36 WriterWeb,
37 WriterXML,
38 WriterForm,
39 WriterReport,
40 Calc,
41 Chart,
42 Draw,
43 Impress,
44 Formula,
45 Base,
47 // For your convenience to avoid duplicate code in the common
48 // case that Draw and Impress use identical context configurations.
49 DrawImpress,
51 // Also for your convenience for the different variants of Writer documents.
52 WriterVariants,
54 // Used only by deck or panel descriptors. Matches any
55 // application.
56 Any,
58 // Use this only in special circumstances. One might be the
59 // wish to disable a deck or panel during debugging.
60 NONE,
62 LAST = Application::NONE
64 enum class Context
66 ThreeDObject,
67 Annotation,
68 Auditing,
69 Axis,
70 Cell,
71 Chart,
72 ChartElements,
73 Draw,
74 DrawFontwork,
75 DrawLine,
76 DrawPage,
77 DrawText,
78 EditCell,
79 ErrorBar,
80 Form,
81 Frame,
82 Graphic,
83 Grid,
84 HandoutPage,
85 MasterPage,
86 Math,
87 Media,
88 MultiObject,
89 NotesPage,
90 OLE,
91 OutlineText,
92 Pivot,
93 Printpreview,
94 Series,
95 SlidesorterPage,
96 Table,
97 Text,
98 TextObject,
99 Trendline,
100 Sparkline,
102 // Default context of an application. Do we need this?
103 Default,
105 // Used only by deck or panel descriptors. Matches any context.
106 Any,
108 // Special context name that is only used when a deck would
109 // otherwise be empty.
110 Empty,
112 Unknown,
114 LAST = Unknown
117 EnumContext();
118 EnumContext (
119 const Application eApplication,
120 const Context eContext);
122 /** This variant of the GetCombinedContext() method treats some
123 application names as identical to each other. Replacements
124 made are:
125 Draw or Impress -> DrawImpress
126 Writer or WriterWeb -> WriterAndWeb
127 Use the Application::DrawImpress or Application::WriterAndWeb values in the CombinedEnumContext macro.
129 sal_Int32 GetCombinedContext_DI() const;
131 Application GetApplication() const;
132 Application GetApplication_DI() const;
134 bool operator == (const EnumContext& rOther) const;
135 bool operator != (const EnumContext& rOther) const;
137 /** When two contexts are matched against each other, then
138 application or context name may have the wildcard value 'any'.
139 In order to prefer matches without wildcards over matches with
140 wildcards we introduce an integer evaluation for matches.
142 const static sal_Int32 NoMatch;
144 static Application GetApplicationEnum (const OUString& rsApplicationName);
145 static const OUString& GetApplicationName (const Application eApplication);
147 static Context GetContextEnum (const OUString& rsContextName);
148 static const OUString& GetContextName (const Context eContext);
150 private:
151 Application meApplication;
152 Context meContext;
154 static void ProvideApplicationContainers();
155 static void ProvideContextContainers();
156 static void AddEntry (const OUString& rsName, const Application eApplication);
157 static void AddEntry (const OUString& rsName, const Context eContext);
161 #define CombinedEnumContext(a,e) ((static_cast<sal_uInt16>(::vcl::EnumContext::a)<<16)\
162 | static_cast<sal_uInt16>(::vcl::EnumContext::e))
164 } // end of namespace vcl
166 #endif
168 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */