Debian Codegraph @

src/lib/ReadySetGoStyleManager.hxx

raw
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance ([email protected])
18 * Copyright (C) 2002,2004 Marc Maurer ([email protected])
19 * Copyright (C) 2004-2006 Fridrich Strba ([email protected])
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent ([email protected])
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33
34 #ifndef READYSETGO_STYLE_MANAGER
35 # define READYSETGO_STYLE_MANAGER
36
37 #include <string>
38 #include <vector>
39
40 #include <librevenge/librevenge.h>
41
42 #include "MWAWDebug.hxx"
43 #include "MWAWGraphicStyle.hxx"
44 #include "MWAWInputStream.hxx"
45
46 #include "MWAWParser.hxx"
47
48 struct MWAWTabStop;
49
50 namespace ReadySetGoStyleManagerInternal
51 {
52 struct State;
53 }
54
55 class ReadySetGoParser;
56
57 /** \brief class to read/store ReadySetGo v1-v6 styles
58 *
59 */
60 class ReadySetGoStyleManager
61 {
62 friend class ReadySetGoParser;
63 public:
64 //! constructor
65 explicit ReadySetGoStyleManager(ReadySetGoParser &parser);
66 //! destructor
67 virtual ~ReadySetGoStyleManager();
68
69 //! try to retrieve the i^th color
70 bool getColor(int colorId, MWAWColor &color) const;
71 //! try to retrieve a pattern
72 bool getPattern(int patternId, MWAWGraphicStyle::Pattern &pattern) const;
73
74 //! try to read a style: v3
75 bool readStyle(MWAWFont &font, MWAWParagraph &para, int *cPos=nullptr);
76 //! try to read a list of tabulations: v1-2
77 bool readTabulationsV1(std::vector<MWAWTabStop> &tabulations, std::string &extra);
78 //! try to read a list of tabulations: v3
79 bool readTabulations(std::vector<MWAWTabStop> &tabs, long len=-1, int *cPos=nullptr);
80
81 protected:
82 //! returns the file version
83 int version() const;
84
85 //
86 // data
87 //
88
89 //! try to read the list of colors: v4.5
90 bool readColors();
91 //! try to read the list of colors: v4.5
92 bool readColorNames();
93 //! try to read the list of font block: unsure, name + data?, v4.5
94 bool readFontsBlock();
95 //! try to read the optional list of font block: name + data?, v6
96 bool readFontsBlock2();
97 //! try to read the list of font name: v6
98 bool readFontsName();
99
100 //! try to read the list of style block: v4
101 bool readStyles(int numStyles);
102 protected:
103 //! the main parser
104 ReadySetGoParser &m_parser;
105 //! the parser state
106 MWAWParserStatePtr m_parserState;
107 //! the state
108 std::shared_ptr<ReadySetGoStyleManagerInternal::State> m_state;
109 };
110 #endif
111 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab: