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