/src/libreoffice/include/editeng/fontitem.hxx
Line | Count | Source |
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 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | #ifndef INCLUDED_EDITENG_FONTITEM_HXX |
20 | | #define INCLUDED_EDITENG_FONTITEM_HXX |
21 | | |
22 | | #include <editeng/editengdllapi.h> |
23 | | #include <rtl/ustring.hxx> |
24 | | #include <tools/fontenum.hxx> |
25 | | #include <svl/poolitem.hxx> |
26 | | |
27 | | class OutputDevice; |
28 | | |
29 | | /** This item describes a Font. |
30 | | */ |
31 | | class EDITENG_DLLPUBLIC SvxFontItem final : public SfxPoolItem |
32 | | { |
33 | | OUString aFamilyName; |
34 | | OUString aStyleName; |
35 | | FontFamily eFamily; |
36 | | FontPitch ePitch; |
37 | | rtl_TextEncoding eTextEncoding; |
38 | | |
39 | | protected: |
40 | | virtual ItemInstanceManager* getItemInstanceManager() const override; |
41 | | |
42 | | public: |
43 | | static SfxPoolItem* CreateDefault(); |
44 | | |
45 | | DECLARE_ITEM_TYPE_FUNCTION(SvxFontItem) |
46 | | explicit SvxFontItem(const sal_uInt16 nId); |
47 | | SvxFontItem(const FontFamily eFam, OUString aFamilyName, |
48 | | OUString aStyleName, |
49 | | const FontPitch eFontPitch /*= PITCH_DONTKNOW*/, |
50 | | const rtl_TextEncoding eFontTextEncoding /*= RTL_TEXTENCODING_DONTKNOW*/, |
51 | | const sal_uInt16 nId); |
52 | | |
53 | | // "pure virtual Methods" from SfxPoolItem |
54 | | virtual bool operator==(const SfxPoolItem& rItem) const override; |
55 | | virtual size_t hashCode() const override; |
56 | | virtual SvxFontItem* Clone(SfxItemPool *pPool = nullptr) const override; |
57 | | virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; |
58 | | virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; |
59 | | |
60 | | virtual bool GetPresentation(SfxItemPresentation ePres, |
61 | | MapUnit eCoreMetric, MapUnit ePresMetric, |
62 | | OUString &rText, const IntlWrapper&) const override; |
63 | | |
64 | | // Access methods: |
65 | | void SetFamilyName(const OUString& rFamilyName); |
66 | | const OUString &GetFamilyName() const |
67 | 40.3M | { |
68 | 40.3M | return aFamilyName; |
69 | 40.3M | } |
70 | | |
71 | | void SetStyleName(const OUString &rStyleName); |
72 | | const OUString &GetStyleName() const |
73 | 40.3M | { |
74 | 40.3M | return aStyleName; |
75 | 40.3M | } |
76 | | |
77 | | void makeTypographic(const OutputDevice& rDevice, FontWeight eWeight = WEIGHT_DONTKNOW, |
78 | | FontWidth eWidth = WIDTH_DONTKNOW, FontItalic eItalic = ITALIC_DONTKNOW); |
79 | | |
80 | | void SetFamily(FontFamily _eFamily); |
81 | | FontFamily GetFamily() const |
82 | 31.6M | { |
83 | 31.6M | return eFamily; |
84 | 31.6M | } |
85 | | |
86 | | void SetPitch(FontPitch _ePitch); |
87 | | FontPitch GetPitch() const |
88 | 31.5M | { |
89 | 31.5M | return ePitch; |
90 | 31.5M | } |
91 | | |
92 | | void SetCharSet(rtl_TextEncoding _eEncoding); |
93 | | rtl_TextEncoding GetCharSet() const |
94 | 39.9M | { |
95 | 39.9M | return eTextEncoding; |
96 | 39.9M | } |
97 | | |
98 | | void dumpAsXml(xmlTextWriterPtr pWriter) const override; |
99 | | }; |
100 | | |
101 | | EDITENG_DLLPUBLIC void GetDefaultFonts(SvxFontItem& rLatin, |
102 | | SvxFontItem& rAsian, |
103 | | SvxFontItem& rComplex); |
104 | | |
105 | | #endif // INCLUDED_EDITENG_FONTITEM_HXX |
106 | | |
107 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |