Avoid crash in printer dlg due to empty QImage
[LibreOffice.git] / include / vcl / font.hxx
blob2dc0a5b326cd9abacd6dab6d36d8976c4ff0eb38
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_FONT_HXX
21 #define INCLUDED_VCL_FONT_HXX
23 #include <rtl/ustring.hxx>
24 #include <sal/types.h>
25 #include <vcl/dllapi.h>
26 #include <i18nlangtag/languagetag.hxx>
27 #include <tools/color.hxx>
28 #include <tools/gen.hxx>
29 #include <vcl/vclenum.hxx>
30 #include <vcl/fntstyle.hxx>
31 #include <o3tl/cow_wrapper.hxx>
33 class SvStream;
34 #define FontAlign TextAlign
36 class ImplFont;
37 class FontAttributes;
38 namespace vcl { class Font; }
39 // need to first declare these outside the vcl namespace, or the friend declarations won't work right
40 VCL_DLLPUBLIC SvStream& ReadFont( SvStream& rIStm, vcl::Font& );
41 VCL_DLLPUBLIC SvStream& WriteFont( SvStream& rOStm, const vcl::Font& );
43 namespace vcl {
45 class VCL_DLLPUBLIC Font
47 public:
48 explicit Font();
49 Font( const Font& ); // TODO make me explicit
50 Font( Font&& );
51 explicit Font( const OUString& rFamilyName, const Size& );
52 explicit Font( const OUString& rFamilyName, const OUString& rStyleName, const Size& );
53 explicit Font( FontFamily eFamily, const Size& );
54 virtual ~Font();
56 const OUString& GetFamilyName() const;
57 FontFamily GetFamilyType();
58 FontFamily GetFamilyType() const;
59 const OUString& GetStyleName() const;
61 FontWeight GetWeight();
62 FontWeight GetWeight() const;
63 FontItalic GetItalic();
64 FontItalic GetItalic() const;
65 FontPitch GetPitch();
66 FontPitch GetPitch() const;
67 FontWidth GetWidthType();
68 FontWidth GetWidthType() const;
69 FontAlign GetAlignment() const;
70 rtl_TextEncoding GetCharSet() const;
72 bool IsSymbolFont() const;
74 void SetFamilyName( const OUString& rFamilyName );
75 void SetStyleName( const OUString& rStyleName );
76 void SetFamily( FontFamily );
78 void SetPitch( FontPitch ePitch );
79 void SetItalic( FontItalic );
80 void SetWeight( FontWeight );
81 void SetWidthType( FontWidth );
82 void SetAlignment( FontAlign );
83 void SetCharSet( rtl_TextEncoding );
85 void SetSymbolFlag( bool );
87 // Device dependent functions
88 int GetQuality() const;
90 void SetQuality(int);
91 void IncreaseQualityBy(int);
92 void DecreaseQualityBy(int);
93 void SetMapNames(OUString const &);
95 // setting the color on the font is obsolete, the only remaining
96 // valid use is for keeping backward compatibility with old MetaFiles
97 const Color& GetColor() const;
98 const Color& GetFillColor() const;
100 bool IsTransparent() const;
102 void SetColor( const Color& );
103 void SetFillColor( const Color& );
105 void SetTransparent( bool bTransparent );
107 void SetFontSize( const Size& );
108 const Size& GetFontSize() const;
109 void SetFontHeight( long nHeight );
110 long GetFontHeight() const;
111 void SetAverageFontWidth( long nWidth );
112 long GetAverageFontWidth() const;
114 // Prefer LanguageTag over LanguageType
115 void SetLanguageTag( const LanguageTag & );
116 const LanguageTag& GetLanguageTag() const;
117 void SetCJKContextLanguageTag( const LanguageTag& );
118 const LanguageTag& GetCJKContextLanguageTag() const;
119 void SetLanguage( LanguageType );
120 LanguageType GetLanguage() const;
121 void SetCJKContextLanguage( LanguageType );
122 LanguageType GetCJKContextLanguage() const;
124 void SetOrientation( short nLineOrientation );
125 short GetOrientation() const;
126 void SetVertical( bool bVertical );
127 bool IsVertical() const;
128 void SetKerning( FontKerning nKerning );
129 FontKerning GetKerning() const;
130 bool IsKerning() const;
132 void SetOutline( bool bOutline );
133 bool IsOutline() const;
134 void SetShadow( bool bShadow );
135 bool IsShadow() const;
136 void SetRelief( FontRelief );
137 FontRelief GetRelief() const;
138 void SetUnderline( FontLineStyle );
139 FontLineStyle GetUnderline() const;
140 void SetOverline( FontLineStyle );
141 FontLineStyle GetOverline() const;
142 void SetStrikeout( FontStrikeout );
143 FontStrikeout GetStrikeout() const;
144 void SetEmphasisMark( FontEmphasisMark );
145 FontEmphasisMark GetEmphasisMark() const;
146 void SetWordLineMode( bool bWordLine );
147 bool IsWordLineMode() const;
149 void Merge( const Font& rFont );
150 void GetFontAttributes( FontAttributes& rAttrs ) const;
152 Font& operator=( const Font& );
153 Font& operator=( Font&& );
154 bool operator==( const Font& ) const;
155 bool operator!=( const Font& rFont ) const
156 { return !(Font::operator==( rFont )); }
157 bool IsSameInstance( const Font& ) const;
159 friend VCL_DLLPUBLIC SvStream& ::ReadFont( SvStream& rIStm, vcl::Font& );
160 friend VCL_DLLPUBLIC SvStream& ::WriteFont( SvStream& rOStm, const vcl::Font& );
162 static Font identifyFont( const void* pBuffer, sal_uInt32 nLen );
164 typedef o3tl::cow_wrapper< ImplFont > ImplType;
166 private:
167 ImplType mpImplFont;
172 #endif // _VCL_FONT_HXX
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */