Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /* FontStyle: Stores (and writes) font-based information that is needed at
3 : : * the head of an OO document.
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 : : * For further information visit http://libwpd.sourceforge.net
10 : : */
11 : :
12 : : #ifndef _FONTSTYLE_H
13 : : #define _FONTSTYLE_H
14 : : #include <map>
15 : :
16 : : #include <libwpd/libwpd.h>
17 : :
18 : : #include "FilterInternal.hxx"
19 : :
20 : : #include "Style.hxx"
21 : :
22 : : class FontStyle : public Style
23 : : {
24 : : public:
25 : : FontStyle(const char *psName, const char *psFontFamily);
26 : : ~FontStyle();
27 : : virtual void write(OdfDocumentHandler *pHandler) const;
28 : : const WPXString &getFontFamily() const
29 : : {
30 : : return msFontFamily;
31 : : }
32 : :
33 : : private:
34 : : WPXString msFontFamily;
35 : : WPXString msFontPitch;
36 : : };
37 : :
38 : : class FontStyleManager : public StyleManager
39 : : {
40 : : public:
41 [ # # ]: 0 : FontStyleManager() : mStyleHash() {}
42 : 0 : virtual ~FontStyleManager()
43 : 0 : {
44 [ # # ]: 0 : clean();
45 [ # # ]: 0 : }
46 : :
47 : : /* create a new font if the font does not exists and returns a font name
48 : :
49 : : Note: the returned font name is actually equalled to psFontFamily
50 : : */
51 : : WPXString findOrAdd(const char *psFontFamily);
52 : :
53 : : virtual void clean();
54 : 0 : virtual void write(OdfDocumentHandler *) const {}
55 : : virtual void writeFontsDeclaration(OdfDocumentHandler *) const;
56 : :
57 : :
58 : : protected:
59 : : // style name -> SpanStyle
60 : : std::map<WPXString, shared_ptr<FontStyle>, ltstr> mStyleHash;
61 : : };
62 : :
63 : : #endif
64 : :
65 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|