LibreOffice Module vcl (master) 1
Feature.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 */
9
10#ifndef INCLUDED_VCL_FONT_FEATURE_HXX
11#define INCLUDED_VCL_FONT_FEATURE_HXX
12
13#include <vcl/dllapi.h>
14#include <rtl/ustring.hxx>
15#include <unotools/resmgr.hxx>
16#include <vector>
17
18namespace vcl::font
19{
20constexpr uint32_t featureCode(const char sFeature[4])
21{
22 return static_cast<uint32_t>(sFeature[0]) << 24U | static_cast<uint32_t>(sFeature[1]) << 16U
23 | static_cast<uint32_t>(sFeature[2]) << 8U | static_cast<uint32_t>(sFeature[3]);
24}
25
26VCL_DLLPUBLIC OUString featureCodeAsString(uint32_t nFeature);
27
29{
30 BOOL,
31 ENUM
32};
33
34enum class FeatureType
35{
38};
39
41{
42private:
43 uint32_t m_nCode;
46
47public:
48 FeatureParameter(uint32_t nCode, OUString aDescription);
49 FeatureParameter(uint32_t nCode, TranslateId pDescriptionID);
50
51 uint32_t getCode() const;
52 OUString getDescription() const;
53};
54
56{
57private:
61 uint32_t m_nCode;
62 uint32_t m_nDefault;
64 // the index of the parameter defines the enum value, string is the description
65 std::vector<FeatureParameter> m_aEnumParameters;
66
67public:
69 FeatureDefinition(uint32_t nCode, OUString aDescription,
71 std::vector<FeatureParameter>&& rEnumParameters
72 = std::vector<FeatureParameter>{},
73 uint32_t nDefault = 0);
74 FeatureDefinition(uint32_t nCode, TranslateId pDescriptionID,
75 OUString aNumericPart = OUString());
76 FeatureDefinition(uint32_t nCode, TranslateId pDescriptionID,
77 std::vector<FeatureParameter> aEnumParameters);
78
79 const std::vector<FeatureParameter>& getEnumParameters() const;
80 uint32_t getCode() const;
81 OUString getDescription() const;
83 uint32_t getDefault() const;
84
85 operator bool() const;
86};
87
89{
91 uint32_t m_aScriptCode;
93};
94
95struct Feature
96{
97 Feature();
99
103};
104
105// This is basically duplicates hb_feature_t to avoid including HarfBuzz
106// headers here, so the member types should remain compatible.
108{
109 FeatureSetting(OString feature);
110
111 uint32_t m_nTag;
112 uint32_t m_nValue;
113 unsigned int m_nStart;
114 unsigned int m_nEnd;
115};
116
117} // namespace vcl::font
118
119#endif // INCLUDED_VCL_FONT_FEATURE_HXX
120
121/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
FeatureParameterType m_eType
Definition: Feature.hxx:63
std::vector< FeatureParameter > m_aEnumParameters
Definition: Feature.hxx:65
TranslateId m_pDescriptionID
Definition: Feature.hxx:59
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
DocumentType eType
A PhysicalFontFaceCollection is created by a PhysicalFontCollection and becomes invalid when original...
constexpr uint32_t featureCode(const char sFeature[4])
Definition: Feature.hxx:20
OUString featureCodeAsString(uint32_t nFeature)
Definition: Feature.cxx:19
FeatureParameterType
Definition: Feature.hxx:29
bool getType(BSTR name, Type &type)
const wchar_t *typedef BOOL
uint32_t m_aFeatureCode
Definition: Feature.hxx:90
uint32_t m_aLanguageCode
Definition: Feature.hxx:92
uint32_t m_aScriptCode
Definition: Feature.hxx:91
TranslateId m_pDescriptionID
Definition: Feature.hxx:45
FeatureSetting(OString feature)
Definition: Feature.cxx:44
FeatureType m_eType
Definition: Feature.hxx:101
FeatureDefinition m_aDefinition
Definition: Feature.hxx:102
FeatureID m_aID
Definition: Feature.hxx:100
ENUM