tdf#119030: Disable entries if open file read-only is unchecked
[LibreOffice.git] / vcl / inc / impfont.hxx
blobb9b8fb4654e468c81a7ffada2bb61a1c0adee4a6
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 #ifndef INCLUDED_VCL_INC_IMPFONT_HXX
21 #define INCLUDED_VCL_INC_IMPFONT_HXX
23 #include <rtl/ustring.hxx>
24 #include <tools/color.hxx>
25 #include <i18nlangtag/languagetag.hxx>
26 #include <vcl/vclenum.hxx>
28 #include "fontinstance.hxx"
30 /* The following class is extraordinarily similar to FontAttributes. */
32 class ImplFont
34 public:
35 explicit ImplFont();
36 explicit ImplFont( const ImplFont& );
38 // device independent font functions
39 const OUString& GetFamilyName() const { return maFamilyName; }
40 FontFamily GetFamilyType() { if(meFamily==FAMILY_DONTKNOW) AskConfig(); return meFamily; }
41 const OUString& GetStyleName() const { return maStyleName; }
43 FontWeight GetWeight() { if(meWeight==WEIGHT_DONTKNOW) AskConfig(); return meWeight; }
44 FontItalic GetItalic() { if(meItalic==ITALIC_DONTKNOW) AskConfig(); return meItalic; }
45 FontPitch GetPitch() { if(mePitch==PITCH_DONTKNOW) AskConfig(); return mePitch; }
46 FontWidth GetWidthType() { if(meWidthType==WIDTH_DONTKNOW) AskConfig(); return meWidthType; }
47 TextAlign GetAlignment() const { return meAlign; }
48 rtl_TextEncoding GetCharSet() const { return meCharSet; }
49 const Size& GetFontSize() const { return maAverageFontSize; }
51 bool IsSymbolFont() const { return mbSymbolFlag; }
53 void SetFamilyName( const OUString& sFamilyName ) { maFamilyName = sFamilyName; }
54 void SetStyleName( const OUString& sStyleName ) { maStyleName = sStyleName; }
55 void SetFamilyType( const FontFamily eFontFamily ) { meFamily = eFontFamily; }
57 void SetPitch( const FontPitch ePitch ) { mePitch = ePitch; }
58 void SetItalic( const FontItalic eItalic ) { meItalic = eItalic; }
59 void SetWeight( const FontWeight eWeight ) { meWeight = eWeight; }
60 void SetWidthType( const FontWidth eWidthType ) { meWidthType = eWidthType; }
61 void SetAlignment( const TextAlign eAlignment ) { meAlign = eAlignment; }
62 void SetCharSet( const rtl_TextEncoding eCharSet ) { meCharSet = eCharSet; }
63 void SetFontSize( const Size& rSize ) { maAverageFontSize = rSize; }
65 void SetSymbolFlag( const bool bSymbolFlag ) { mbSymbolFlag = bSymbolFlag; }
67 // straight properties, no getting them from AskConfig()
68 FontFamily GetFamilyTypeNoAsk() const { return meFamily; }
69 FontWeight GetWeightNoAsk() const { return meWeight; }
70 FontItalic GetItalicNoAsk() const { return meItalic; }
71 FontPitch GetPitchNoAsk() const { return mePitch; }
72 FontWidth GetWidthTypeNoAsk() const { return meWidthType; }
74 // device dependent functions
75 int GetQuality() const { return mnQuality; }
77 void SetQuality( int nQuality ) { mnQuality = nQuality; }
78 void IncreaseQualityBy( int nQualityAmount ) { mnQuality += nQualityAmount; }
79 void DecreaseQualityBy( int nQualityAmount ) { mnQuality -= nQualityAmount; }
80 void SetMapNames( OUString const & aMapNames ) { maMapNames = aMapNames; }
82 bool operator==( const ImplFont& ) const;
84 private:
85 friend class vcl::Font;
86 friend SvStream& ReadImplFont( SvStream& rIStm, ImplFont& );
87 friend SvStream& WriteImplFont( SvStream& rOStm, const ImplFont& );
89 void AskConfig();
91 // Device independent variables
92 OUString maFamilyName;
93 OUString maStyleName;
94 FontWeight meWeight;
95 FontFamily meFamily;
96 FontPitch mePitch;
97 FontWidth meWidthType;
98 FontItalic meItalic;
99 TextAlign meAlign;
100 FontLineStyle meUnderline;
101 FontLineStyle meOverline;
102 FontStrikeout meStrikeout;
103 FontRelief meRelief;
104 FontEmphasisMark meEmphasisMark;
105 FontKerning meKerning;
106 Size maAverageFontSize;
107 rtl_TextEncoding meCharSet;
109 LanguageTag maLanguageTag;
110 LanguageTag maCJKLanguageTag;
112 // Flags - device independent
113 bool mbSymbolFlag:1,
114 mbOutline:1,
115 mbConfigLookup:1, // config lookup should only be done once
116 mbShadow:1,
117 mbVertical:1,
118 mbTransparent:1; // compatibility, now on output device
120 // deprecated variables - device independent
121 Color maColor; // compatibility, now on output device
122 Color maFillColor; // compatibility, now on output device
124 // Device dependent variables
125 OUString maMapNames;
126 bool mbWordLine:1;
128 // TODO: metric data, should be migrated to ImplFontMetric
129 short mnOrientation;
131 int mnQuality;
135 #endif // INCLUDED_VCL_INC_IMPFONT_HXX
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */