MacDrawProStyleManager.hxx
Go to the documentation of this file.
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 (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
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 MACDRAWPRO_STYLE_MANAGER
35 # define MACDRAWPRO_STYLE_MANAGER
36
37 #include <map>
38 #include <string>
39 #include <vector>
40
41 #include <librevenge/librevenge.h>
42
43 #include "MWAWDebug.hxx"
44 #include "MWAWGraphicStyle.hxx"
45 #include "MWAWInputStream.hxx"
46
47 class MWAWFont;
48
49 namespace MacDrawProStyleManagerInternal
50 {
51 struct State;
52 }
53
54 class MacDrawProParser;
55
59 class MacDrawProStyleManager
60 {
61 friend class MacDrawProParser;
62 public:
64 explicit MacDrawProStyleManager(MacDrawProParser &parser);
66 virtual ~MacDrawProStyleManager();
67
68 protected:
70 bool readRSRCZones();
71
72 // Intermediate level
73
75 bool readHeaderInfoStylePart(std::string &extra);
77 bool readStyles(long const(&sizeZones)[6]);
78
80 bool getColor(int cId, MWAWColor &color) const;
82 bool getDash(int dId, std::vector<float> &dash) const;
84 bool getFont(int fId, MWAWFont &font) const;
86 bool getParagraph(int pId, MWAWParagraph &para) const;
88 bool getPattern(int pId, MWAWGraphicStyle::Pattern &pattern) const;
90 bool getPenSize(int pId, float &penSize) const;
92 bool updateGradient(int gId, MWAWGraphicStyle &style) const;
93 //
94 // low level
95 //
96
98 bool readFontStyles(MWAWEntry const &entry);
100 bool readParagraphStyles(MWAWEntry const &entry);
101
102 // data fork or rsrc fork
103
105 bool readArrows(MWAWEntry const &entry, bool inRsrc=false);
107 bool readDashs(MWAWEntry const &entry, bool inRsrc=false);
109 bool readPens(MWAWEntry const &entry, bool inRsrc=false);
111 bool readRulers(MWAWEntry const &entry, bool inRsrc=false);
112
113 // rsrc
114
116 bool readDocumentInfo(MWAWEntry const &entry);
118 bool readPreferences(MWAWEntry const &entry);
120 bool readFontNames();
122 bool readColors(MWAWEntry const &entry);
124 bool readBWPatterns(MWAWEntry const &entry);
126 bool readColorPatterns(MWAWEntry const &entry);
128 bool readPatternsToolList(MWAWEntry const &entry);
130 bool readRulerSettings(MWAWEntry const &entry);
132 bool readViews(MWAWEntry const &entry);
133
135 bool readRSRCDstl(MWAWEntry const &entry);
136
137 // v1
139 bool readPaletteDef(MWAWEntry const &entry);
141 bool readPaletteMap(MWAWEntry const &entry, int N, int dataSz);
143 bool readPaletteData(MWAWEntry const &entry, int dataSz);
144
146 bool readColorMap(MWAWEntry const &entry, int N, int fSz);
148 bool readPatternMap(MWAWEntry const &entry, int N, int fSz);
150 bool readGradientMap(MWAWEntry const &entry, int N, int fSz);
152 bool readFAMap(MWAWEntry const &entry, int N, int fSz);
153
155 bool readColorPalette(MWAWEntry const &entry, int fSz);
157 bool readFAPalette(MWAWEntry const &entry, int fSz);
159 bool readGradientPalette(MWAWEntry const &entry, int fSz);
161 bool readPatternPalette(MWAWEntry const &entry, int fSz);
163 bool readListNames(MWAWEntry const &entry, int N=-1);
165 bool readListNames(char const *type);
166
168 bool readPreferencesListBool(MWAWEntry const &entry, int num);
170 bool readPreferences1(MWAWEntry const &entry);
172 bool readPreferences6(MWAWEntry const &entry);
174 bool readPreferences8(MWAWEntry const &entry);
176 bool readUPDL(MWAWEntry const &entry);
178 bool readGrid(MWAWEntry const &entry);
179
180 //
181 // data
182 //
183
184 protected:
186 MacDrawProParser &m_parser;
188 MWAWParserStatePtr m_parserState;
190 std::shared_ptr<MacDrawProStyleManagerInternal::State> m_state;
191 };
192 #endif
193 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWParserStatePtr
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:553
MWAWGraphicStyle
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
MacDrawProStyleManager::m_parser
MacDrawProParser & m_parser
the main parser
Definition: MacDrawProStyleManager.hxx:186
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:192
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:43
MacDrawProParser
the main class to read a MacDraw II file
Definition: MacDrawProParser.hxx:63
MacDrawProStyleManager
the main class to read a MacDraw II file
Definition: MacDrawProStyleManager.hxx:59
MacDrawProStyleManager::m_parserState
MWAWParserStatePtr m_parserState
the parser state
Definition: MacDrawProStyleManager.hxx:188
MWAWInputStream.hxx
MWAWDebug.hxx
FullWrtStruct::getColor
bool getColor(int color, MWAWColor &col)
try to convert a file data to a color
Definition: FullWrtStruct.cxx:45
MWAWParagraph
class to store the paragraph properties
Definition: MWAWParagraph.hxx:84
MacDrawProStyleManagerInternal
Internal: the structures of a MacDrawProStyleManager.
Definition: MacDrawProStyleManager.cxx:61
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
MacDrawProParser::MacDrawProStyleManager
friend class MacDrawProStyleManager
Definition: MacDrawProParser.hxx:65
MWAWGraphicStyle::Pattern
a basic pattern used in a MWAWGraphicStyle:
Definition: MWAWGraphicStyle.hxx:180
MWAWGraphicStyle.hxx
MacDrawProStyleManager::m_state
std::shared_ptr< MacDrawProStyleManagerInternal::State > m_state
the state
Definition: MacDrawProStyleManager.hxx:190