LotusStyleManager.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2/* libwps
3 * Version: MPL 2.0 / LGPLv2.1+
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 * Major Contributor(s):
10 * Copyright (C) 2006, 2007 Andrew Ziem
11 * Copyright (C) 2003-2005 William Lachance (william.lachance@sympatico.ca)
12 * Copyright (C) 2003 Marc Maurer (uwog@uwog.net)
13 *
14 * For minor contributions see the git repository.
15 *
16 * Alternatively, the contents of this file may be used under the terms
17 * of the GNU Lesser General Public License Version 2.1 or later
18 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
19 * applicable instead of those above.
20 */
21
22#ifndef LOTUS_STYLE_MANAGER_H
23#define LOTUS_STYLE_MANAGER_H
24
25#include <ostream>
26#include <set>
27#include <vector>
28
29#include <librevenge-stream/librevenge-stream.h>
30
31#include "libwps_internal.h"
32#include "libwps_tools_win.h"
33
34#include "WPSDebug.h"
35
36class WPSGraphicStyle;
37
39{
40struct CellStyleEntry;
41struct State;
42}
43
44class LotusParser;
45
51{
52public:
53 friend class LotusParser;
54
56 explicit LotusStyleManager(LotusParser &parser);
60 void cleanState();
62 void updateState();
63
65 bool getColor8(int cId, WPSColor &color) const;
67 bool getColor16(int cId, WPSColor &color) const;
69 bool getColor256(int cId, WPSColor &color) const;
70
72 bool getPattern48(int id, WPSGraphicStyle::Pattern &pattern) const;
74 bool getPattern64(int id, WPSGraphicStyle::Pattern &pattern) const;
75
77 bool updateCellStyle(int cellId, WPSCellFormat &format, WPSFont &font);
79 bool hasAcrossColumnFlag(int cId) const;
81 bool updateFontStyle(int fontId, WPSFont &font);
83 bool updateLineStyle(int lineId, WPSGraphicStyle &style) const;
85 bool updateSurfaceStyle(int colorId, WPSGraphicStyle &style) const;
87 bool updateGraphicStyle(int graphicId, WPSGraphicStyle &style) const;
89 bool updateSurfaceStyle(int fColorId, int bColorId, int patternId, WPSGraphicStyle &style) const;
90
91protected:
93 int version() const;
94
95 //
96 // low level
97 //
98
100 bool readColorStyle(std::shared_ptr<WPSStream> stream, long endPos);
102 bool readFormatStyle(std::shared_ptr<WPSStream> stream, long endPos);
104 bool readLineStyle(std::shared_ptr<WPSStream> stream, long endPos, int vers);
106 bool readGraphicStyle(std::shared_ptr<WPSStream> stream, long endPos);
108 bool readGraphicStyleC9(std::shared_ptr<WPSStream> stream, long endPos);
109
110 // 1b style
111
113 bool readFontStyleA0(std::shared_ptr<WPSStream> stream, long endPos);
115 bool readFontStyleF0(std::shared_ptr<WPSStream> stream, long endPos);
117 bool readCellStyleD2(std::shared_ptr<WPSStream> stream, long endPos);
119 bool readCellStyleE6(std::shared_ptr<WPSStream> stream, long endPos);
120
122 bool readMenuStyleE7(std::shared_ptr<WPSStream> stream, long endPos);
124 bool readStyleE6(std::shared_ptr<WPSStream> stream, long endPos);
125
126 // old fmt style
127
129 bool readFMTFontName(std::shared_ptr<WPSStream> stream);
131 bool readFMTFontSize(std::shared_ptr<WPSStream> stream);
133 bool readFMTFontId(std::shared_ptr<WPSStream> stream);
134
136 bool updateShadowStyle(int colorId, WPSGraphicStyle &style) const;
137
138 //
139 // low level
140 //
141
146 bool readCellStyleD2Data(LotusStyleManagerInternal::CellStyleEntry const &entry, std::set<int> &seen);
147private:
153 std::shared_ptr<LotusStyleManagerInternal::State> m_state;
154};
155
156#endif /* LOTUS_STYLE_MANAGER_H */
157/* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
This class parses a wk3,wk4,123 Lotus spreadsheet.
Definition Lotus.h:73
bool updateCellStyle(int cellId, WPSCellFormat &format, WPSFont &font)
update a cell format using the cell id
Definition LotusStyleManager.cpp:2026
bool readCellStyleD2(std::shared_ptr< WPSStream > stream, long endPos)
reads a cell style: fd2 (mac 123 or 123)
Definition LotusStyleManager.cpp:1653
LotusParser & m_mainParser
the main parser
Definition LotusStyleManager.h:151
void cleanState()
clean internal state
Definition LotusStyleManager.cpp:596
bool readGraphicStyle(std::shared_ptr< WPSStream > stream, long endPos)
reads a graphic style
Definition LotusStyleManager.cpp:916
bool updateLineStyle(int lineId, WPSGraphicStyle &style) const
update style using line id
Definition LotusStyleManager.cpp:737
bool getPattern64(int id, WPSGraphicStyle::Pattern &pattern) const
returns the pattern corresponding to a pattern id (id between 1 and 64)
Definition LotusStyleManager.cpp:640
LotusStyleManager(LotusStyleManager const &orig)=delete
bool readFMTFontId(std::shared_ptr< WPSStream > stream)
reads a format font id zone: 0xb0
Definition LotusStyleManager.cpp:2171
bool updateSurfaceStyle(int colorId, WPSGraphicStyle &style) const
update style using color id
Definition LotusStyleManager.cpp:810
int version() const
return the file version
Definition LotusStyleManager.cpp:618
bool readCellStyleD2Data(LotusStyleManagerInternal::CellStyleEntry const &entry, std::set< int > &seen)
really reads the cell style: fd2 (123)
Definition LotusStyleManager.cpp:1387
~LotusStyleManager()
destructor
Definition LotusStyleManager.cpp:592
bool readFontStyleA0(std::shared_ptr< WPSStream > stream, long endPos)
reads a font style: fa0
Definition LotusStyleManager.cpp:1113
bool readColorStyle(std::shared_ptr< WPSStream > stream, long endPos)
reads a color style
Definition LotusStyleManager.cpp:752
bool readCellStyleE6(std::shared_ptr< WPSStream > stream, long endPos)
reads a cell style: fe6 (wk4)
Definition LotusStyleManager.cpp:1783
bool getPattern48(int id, WPSGraphicStyle::Pattern &pattern) const
returns the pattern corresponding to a pattern id (id between 1 and 48)
bool readFMTFontSize(std::shared_ptr< WPSStream > stream)
reads a format font sizes zones 0xaf and 0xb1
Definition LotusStyleManager.cpp:2222
std::shared_ptr< LotusStyleManagerInternal::State > m_state
the internal state
Definition LotusStyleManager.h:153
bool updateShadowStyle(int colorId, WPSGraphicStyle &style) const
update style using color id for defining shadow
Definition LotusStyleManager.cpp:889
bool readGraphicStyleC9(std::shared_ptr< WPSStream > stream, long endPos)
reads a graphic style: fc9, lotus123
Definition LotusStyleManager.cpp:988
bool getColor16(int cId, WPSColor &color) const
returns if possible the color(id between 0 and 15)
Definition LotusStyleManager.cpp:630
bool readLineStyle(std::shared_ptr< WPSStream > stream, long endPos, int vers)
reads a line style
Definition LotusStyleManager.cpp:652
friend class LotusParser
Definition LotusStyleManager.h:53
bool updateGraphicStyle(int graphicId, WPSGraphicStyle &style) const
update style using graphic id
Definition LotusStyleManager.cpp:1086
void updateState()
update the state (need to be called before asking for style)
Definition LotusStyleManager.cpp:601
bool readFontStyleF0(std::shared_ptr< WPSStream > stream, long endPos)
reads a font style: ff0 (wk4)
Definition LotusStyleManager.cpp:1191
bool readFormatStyle(std::shared_ptr< WPSStream > stream, long endPos)
reads a format style
Definition LotusStyleManager.cpp:1300
bool readFMTFontName(std::shared_ptr< WPSStream > stream)
reads a format font name: zones 0xae
Definition LotusStyleManager.cpp:2114
bool readMenuStyleE7(std::shared_ptr< WPSStream > stream, long endPos)
reads the list of style: 32e7 (wk4)
Definition LotusStyleManager.cpp:2274
bool updateFontStyle(int fontId, WPSFont &font)
update a font using the font id
Definition LotusStyleManager.cpp:1281
bool hasAcrossColumnFlag(int cId) const
check if a cell id has a text across column flags : WKS4 only
Definition LotusStyleManager.cpp:645
LotusStyleManager & operator=(LotusStyleManager const &orig)=delete
bool getColor8(int cId, WPSColor &color) const
returns if possible the color(id between 0 and 7)
Definition LotusStyleManager.cpp:625
bool getColor256(int cId, WPSColor &color) const
returns if possible the color(id between 0 and 255)
Definition LotusStyleManager.cpp:635
bool readStyleE6(std::shared_ptr< WPSStream > stream, long endPos)
reads a style: fe6 (123)
Definition LotusStyleManager.cpp:1975
LotusStyleManager(LotusParser &parser)
constructor
Definition LotusStyleManager.cpp:586
a structure used to defined the cell format
Definition WPSCell.h:41
define the font properties
Definition WPSFont.h:37
a structure used to define a picture style
Definition WPSGraphicStyle.h:38
Definition LotusStyleManager.cpp:48
small struct used to defined cell style file entry
Definition LotusStyleManager.cpp:330
the state of LotusStyleManager
Definition LotusStyleManager.cpp:384
the class to store a color
Definition libwps_internal.h:281
a basic pattern used in a WPSGraphicStyle:
Definition WPSGraphicStyle.h:89

Generated on for libwps by doxygen 1.17.0