gb_var2file: remove now unused chunk-size parameter
[LibreOffice.git] / vcl / inc / impfont.hxx
blob08a1fd558ca1afc23a9f7608963e1bad5d72cb0e
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 .
20 #pragma once
22 #include <sal/config.h>
24 #include <rtl/ustring.hxx>
25 #include <tools/color.hxx>
26 #include <tools/fontenum.hxx>
27 #include <tools/gen.hxx>
28 #include <i18nlangtag/languagetag.hxx>
29 #include <vcl/fntstyle.hxx>
31 /* The following class is extraordinarily similar to FontAttributes. */
33 class ImplFont
35 public:
36 explicit ImplFont();
37 explicit ImplFont( const ImplFont& );
39 // device independent font functions
40 const OUString& GetFamilyName() const { return maFamilyName; }
41 FontFamily GetFamilyType() { if(meFamily==FAMILY_DONTKNOW) AskConfig(); return meFamily; }
42 const OUString& GetStyleName() const { return maStyleName; }
44 FontWeight GetWeight() { if(meWeight==WEIGHT_DONTKNOW) AskConfig(); return meWeight; }
45 FontItalic GetItalic() { if(meItalic==ITALIC_DONTKNOW) AskConfig(); return meItalic; }
46 FontPitch GetPitch() { if(mePitch==PITCH_DONTKNOW) AskConfig(); return mePitch; }
47 FontWidth GetWidthType() { if(meWidthType==WIDTH_DONTKNOW) AskConfig(); return meWidthType; }
48 TextAlign GetAlignment() const { return meAlign; }
49 rtl_TextEncoding GetCharSet() const { return meCharSet; }
50 const Size& GetFontSize() const { return maAverageFontSize; }
52 void SetFamilyName( const OUString& sFamilyName ) { maFamilyName = sFamilyName; }
53 void SetStyleName( const OUString& sStyleName ) { maStyleName = sStyleName; }
54 void SetFamilyType( const FontFamily eFontFamily ) { meFamily = eFontFamily; }
56 void SetPitch( const FontPitch ePitch ) { mePitch = ePitch; }
57 void SetItalic( const FontItalic eItalic ) { meItalic = eItalic; }
58 void SetWeight( const FontWeight eWeight ) { meWeight = eWeight; }
59 void SetWidthType( const FontWidth eWidthType ) { meWidthType = eWidthType; }
60 void SetAlignment( const TextAlign eAlignment ) { meAlign = eAlignment; }
61 void SetCharSet( const rtl_TextEncoding eCharSet ) { meCharSet = eCharSet; }
62 void SetFontSize( const Size& rSize )
64 if(rSize.Height() != maAverageFontSize.Height())
66 // reset evtl. buffered calculated AverageFontSize, it depends
67 // on Font::Height
68 mnCalculatedAverageFontWidth = 0;
70 maAverageFontSize = rSize;
73 // straight properties, no getting them from AskConfig()
74 FontFamily GetFamilyTypeNoAsk() const { return meFamily; }
75 FontWeight GetWeightNoAsk() const { return meWeight; }
76 FontItalic GetItalicNoAsk() const { return meItalic; }
77 FontPitch GetPitchNoAsk() const { return mePitch; }
78 FontWidth GetWidthTypeNoAsk() const { return meWidthType; }
80 // device dependent functions
81 int GetQuality() const { return mnQuality; }
83 void SetQuality( int nQuality ) { mnQuality = nQuality; }
84 void IncreaseQualityBy( int nQualityAmount ) { mnQuality += nQualityAmount; }
85 void DecreaseQualityBy( int nQualityAmount ) { mnQuality -= nQualityAmount; }
87 tools::Long GetCalculatedAverageFontWidth() const { return mnCalculatedAverageFontWidth; }
88 void SetCalculatedAverageFontWidth(tools::Long nNew) { mnCalculatedAverageFontWidth = nNew; }
90 bool operator==( const ImplFont& ) const;
91 bool EqualIgnoreColor( const ImplFont& ) const;
93 size_t GetHashValue() const;
94 size_t GetHashValueIgnoreColor() const;
96 private:
97 friend class vcl::Font;
98 friend SvStream& ReadImplFont( SvStream& rIStm, ImplFont&, tools::Long& );
99 friend SvStream& WriteImplFont( SvStream& rOStm, const ImplFont&, tools::Long );
101 void AskConfig();
103 // Device independent variables
104 OUString maFamilyName;
105 OUString maStyleName;
106 FontWeight meWeight;
107 FontFamily meFamily;
108 FontPitch mePitch;
109 FontWidth meWidthType;
110 FontItalic meItalic;
111 TextAlign meAlign;
112 FontLineStyle meUnderline;
113 FontLineStyle meOverline;
114 FontStrikeout meStrikeout;
115 FontRelief meRelief;
116 FontEmphasisMark meEmphasisMark;
117 FontKerning meKerning;
118 short mnSpacing;
119 Size maAverageFontSize;
120 rtl_TextEncoding meCharSet;
122 LanguageTag maLanguageTag;
123 LanguageTag maCJKLanguageTag;
125 // Flags - device independent
126 bool mbOutline:1,
127 mbConfigLookup:1, // config lookup should only be done once
128 mbShadow:1,
129 mbVertical:1,
130 mbTransparent:1; // compatibility, now on output device
132 // deprecated variables - device independent
133 Color maColor; // compatibility, now on output device
134 Color maFillColor; // compatibility, now on output device
136 // Device dependent variables
137 bool mbWordLine:1;
139 // TODO: metric data, should be migrated to ImplFontMetric
140 Degree10 mnOrientation;
142 int mnQuality;
144 tools::Long mnCalculatedAverageFontWidth;
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */