Line data Source code
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 :
20 : #ifndef _SV_FONT_HXX
21 : #define _SV_FONT_HXX
22 :
23 : #include <sal/types.h>
24 : #include <vcl/dllapi.h>
25 : #include <tools/string.hxx>
26 : #include <i18nlangtag/lang.h>
27 : #include <tools/color.hxx>
28 : #include <vcl/vclenum.hxx>
29 : #include <vcl/fntstyle.hxx>
30 :
31 : class SvStream;
32 : #define FontAlign TextAlign
33 :
34 : class Impl_Font;
35 : class ImplFontAttributes;
36 : class Size;
37 :
38 : // --------
39 : // - Font -
40 : // --------
41 :
42 : class VCL_DLLPUBLIC Font
43 : {
44 : private:
45 : Impl_Font* mpImplFont;
46 : void MakeUnique();
47 :
48 : public:
49 : Font();
50 : Font( const Font& );
51 : Font( const String& rFamilyName, const Size& );
52 : Font( const String& rFamilyName, const String& rStyleName, const Size& );
53 : Font( FontFamily eFamily, const Size& );
54 : ~Font();
55 :
56 : // setting the color on the font is obsolete, the only remaining
57 : // valid use is for keeping backward compatibility with old MetaFiles
58 : void SetColor( const Color& );
59 : const Color& GetColor() const;
60 : void SetFillColor( const Color& );
61 : const Color& GetFillColor() const;
62 : void SetTransparent( sal_Bool bTransparent );
63 : sal_Bool IsTransparent() const;
64 : void SetAlign( FontAlign );
65 : FontAlign GetAlign() const;
66 :
67 : void SetName( const OUString& rFamilyName );
68 : const String& GetName() const;
69 : void SetStyleName( const String& rStyleName );
70 : const String& GetStyleName() const;
71 : void SetSize( const Size& );
72 : const Size& GetSize() const;
73 : void SetHeight( long nHeight );
74 : long GetHeight() const;
75 : void SetWidth( long nWidth );
76 : long GetWidth() const;
77 :
78 : void SetFamily( FontFamily );
79 : FontFamily GetFamily() const;
80 : void SetCharSet( rtl_TextEncoding );
81 : rtl_TextEncoding GetCharSet() const;
82 : void SetLanguage( LanguageType );
83 : LanguageType GetLanguage() const;
84 : void SetCJKContextLanguage( LanguageType );
85 : LanguageType GetCJKContextLanguage() const;
86 : void SetPitch( FontPitch ePitch );
87 : FontPitch GetPitch() const;
88 :
89 : void SetOrientation( short nLineOrientation );
90 : short GetOrientation() const;
91 : void SetVertical( sal_Bool bVertical );
92 : sal_Bool IsVertical() const;
93 : void SetKerning( FontKerning nKerning );
94 : FontKerning GetKerning() const;
95 : sal_Bool IsKerning() const;
96 :
97 : void SetWeight( FontWeight );
98 : FontWeight GetWeight() const;
99 : void SetWidthType( FontWidth );
100 : FontWidth GetWidthType() const;
101 : void SetItalic( FontItalic );
102 : FontItalic GetItalic() const;
103 : void SetOutline( sal_Bool bOutline );
104 : sal_Bool IsOutline() const;
105 : void SetShadow( sal_Bool bShadow );
106 : sal_Bool IsShadow() const;
107 : void SetRelief( FontRelief );
108 : FontRelief GetRelief() const;
109 : void SetUnderline( FontUnderline );
110 : FontUnderline GetUnderline() const;
111 : void SetOverline( FontUnderline );
112 : FontUnderline GetOverline() const;
113 : void SetStrikeout( FontStrikeout );
114 : FontStrikeout GetStrikeout() const;
115 : void SetEmphasisMark( FontEmphasisMark );
116 : FontEmphasisMark GetEmphasisMark() const;
117 : void SetWordLineMode( sal_Bool bWordLine );
118 : sal_Bool IsWordLineMode() const;
119 :
120 : void Merge( const Font& rFont );
121 : void GetFontAttributes( ImplFontAttributes& rAttrs ) const;
122 :
123 : Font& operator=( const Font& );
124 : sal_Bool operator==( const Font& ) const;
125 21691 : sal_Bool operator!=( const Font& rFont ) const
126 21691 : { return !(Font::operator==( rFont )); }
127 : sal_Bool IsSameInstance( const Font& ) const;
128 :
129 : friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStm, Font& );
130 : friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStm, const Font& );
131 :
132 : static Font identifyFont( const void* pBuffer, sal_uInt32 nLen );
133 : };
134 :
135 : #endif // _VCL_FONT_HXX
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|