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 <vector>
27 
28 #include <librevenge-stream/librevenge-stream.h>
29 
30 #include "libwps_internal.h"
31 
32 #include "WPSDebug.h"
33 
35 {
36 struct State;
37 }
38 
39 class LotusParser;
40 
46 {
47 public:
48  friend class LotusParser;
49 
51  explicit LotusStyleManager(LotusParser &parser);
55  void cleanState();
57  void updateState();
58 
60  bool getColor8(int cId, WPSColor &color) const;
62  bool getColor16(int cId, WPSColor &color) const;
64  bool getColor256(int cId, WPSColor &color) const;
65 
67  bool updateCellStyle(int cellId, WPSCellFormat &format,
68  WPSFont &font, libwps_tools_win::Font::Type &fontType);
70  bool updateFontStyle(int fontId, WPSFont &font, libwps_tools_win::Font::Type &fontType);
72  bool updateLineStyle(int lineId, WPSGraphicStyle &style) const;
74  bool updateSurfaceStyle(int colorId, WPSGraphicStyle &style) const;
76  bool updateGraphicStyle(int graphicId, WPSGraphicStyle &style) const;
78  bool updateSurfaceStyle(int fColorId, int bColorId, int patternId, WPSGraphicStyle &style) const;
79 protected:
81  int version() const;
82 
84  bool getPattern48(int id, WPSGraphicStyle::Pattern &pattern) const;
86  bool getPattern64(int id, WPSGraphicStyle::Pattern &pattern) const;
87 
88  //
89  // low level
90  //
91 
93  bool readColorStyle(shared_ptr<WPSStream> stream, long endPos);
95  bool readFormatStyle(shared_ptr<WPSStream> stream, long endPos);
97  bool readLineStyle(shared_ptr<WPSStream> stream, long endPos, int vers);
99  bool readGraphicStyle(shared_ptr<WPSStream> stream, long endPos);
100 
101  // 1b style
102 
104  bool readFontStyleA0(shared_ptr<WPSStream> stream, long endPos);
106  bool readFontStyleF0(shared_ptr<WPSStream> stream, long endPos);
108  bool readCellStyleD2(shared_ptr<WPSStream> stream, long endPos);
110  bool readCellStyleE6(shared_ptr<WPSStream> stream, long endPos);
111 
113  bool readMenuStyleE7(shared_ptr<WPSStream> stream, long endPos);
114 
115  // old fmt style
116 
118  bool readFMTFontName(shared_ptr<WPSStream> stream);
120  bool readFMTFontSize(shared_ptr<WPSStream> stream);
122  bool readFMTFontId(shared_ptr<WPSStream> stream);
123 
125  bool updateShadowStyle(int colorId, WPSGraphicStyle &style) const;
126 
127 private:
133  shared_ptr<LotusStyleManagerInternal::State> m_state;
134 };
135 
136 #endif /* LOTUS_STYLE_MANAGER_H */
137 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
bool updateLineStyle(int lineId, WPSGraphicStyle &style) const
update style using line id
Definition: LotusStyleManager.cpp:610
shared_ptr< LotusStyleManagerInternal::State > m_state
the internal state
Definition: LotusStyleManager.h:133
bool readFontStyleF0(shared_ptr< WPSStream > stream, long endPos)
reads a font style: ff0 (wk4)
Definition: LotusStyleManager.cpp:948
void updateState()
update the state (need to be called before asking for style)
Definition: LotusStyleManager.cpp:477
define the font properties
Definition: WPSFont.h:36
LotusStyleManager(LotusParser &parser)
constructor
Definition: LotusStyleManager.cpp:463
bool getColor8(int cId, WPSColor &color) const
returns if possible the color(id between 0 and 7)
Definition: LotusStyleManager.cpp:502
LotusParser & m_mainParser
the main parser
Definition: LotusStyleManager.h:131
a structure used to defined the cell format
Definition: WPSCell.h:40
Type
enum Type
Definition: libwps_tools_win.h:46
~LotusStyleManager()
destructor
Definition: LotusStyleManager.cpp:468
bool updateGraphicStyle(int graphicId, WPSGraphicStyle &style) const
update style using graphic id
Definition: LotusStyleManager.cpp:851
int version() const
return the file version
Definition: LotusStyleManager.cpp:495
bool readFontStyleA0(shared_ptr< WPSStream > stream, long endPos)
reads a font style: fa0
Definition: LotusStyleManager.cpp:870
bool readFMTFontSize(shared_ptr< WPSStream > stream)
reads a format font sizes zones 0xaf and 0xb1
Definition: LotusStyleManager.cpp:1619
void cleanState()
clean internal state
Definition: LotusStyleManager.cpp:472
bool getColor256(int cId, WPSColor &color) const
returns if possible the color(id between 0 and 255)
Definition: LotusStyleManager.cpp:512
This class parses a WK2..WK4 Lotus spreadsheet.
Definition: Lotus.h:66
a structure used to define a picture style
Definition: WPSGraphicStyle.h:37
bool getColor16(int cId, WPSColor &color) const
returns if possible the color(id between 0 and 15)
Definition: LotusStyleManager.cpp:507
bool updateShadowStyle(int colorId, WPSGraphicStyle &style) const
update style using color id for defining shadow
Definition: LotusStyleManager.cpp:752
bool readColorStyle(shared_ptr< WPSStream > stream, long endPos)
reads a color style
Definition: LotusStyleManager.cpp:625
bool readMenuStyleE7(shared_ptr< WPSStream > stream, long endPos)
reads the list of style: 32e7 (wk4)
Definition: LotusStyleManager.cpp:1671
bool updateCellStyle(int cellId, WPSCellFormat &format, WPSFont &font, libwps_tools_win::Font::Type &fontType)
update a cell format using the cell id
Definition: LotusStyleManager.cpp:1429
bool readCellStyleE6(shared_ptr< WPSStream > stream, long endPos)
reads a cell style: fe6 (wk4)
Definition: LotusStyleManager.cpp:1248
bool getPattern48(int id, WPSGraphicStyle::Pattern &pattern) const
returns the pattern corresponding to a pattern id (id between 1 and 48)
bool readFormatStyle(shared_ptr< WPSStream > stream, long endPos)
reads a format style
Definition: LotusStyleManager.cpp:1056
This class parses the Lotus style.
Definition: LotusStyleManager.h:45
Definition: LotusStyleManager.cpp:47
bool updateFontStyle(int fontId, WPSFont &font, libwps_tools_win::Font::Type &fontType)
update a font using the font id
Definition: LotusStyleManager.cpp:1036
bool readFMTFontName(shared_ptr< WPSStream > stream)
reads a format font name: zones 0xae
Definition: LotusStyleManager.cpp:1505
the class to store a color
Definition: libwps_internal.h:268
LotusStyleManager & operator=(LotusStyleManager const &orig)
bool updateSurfaceStyle(int colorId, WPSGraphicStyle &style) const
update style using color id
Definition: LotusStyleManager.cpp:683
bool readGraphicStyle(shared_ptr< WPSStream > stream, long endPos)
reads a graphic style
Definition: LotusStyleManager.cpp:779
bool readCellStyleD2(shared_ptr< WPSStream > stream, long endPos)
reads a cell style: fd2
Definition: LotusStyleManager.cpp:1133
bool readFMTFontId(shared_ptr< WPSStream > stream)
reads a format font id zone: 0xb0
Definition: LotusStyleManager.cpp:1568
a basic pattern used in a WPSGraphicStyle:
Definition: WPSGraphicStyle.h:86
bool readLineStyle(shared_ptr< WPSStream > stream, long endPos, int vers)
reads a line style
Definition: LotusStyleManager.cpp:525
bool getPattern64(int id, WPSGraphicStyle::Pattern &pattern) const
returns the pattern corresponding to a pattern id (id between 1 and 64)
Definition: LotusStyleManager.cpp:517

Generated on Mon Dec 12 2016 16:26:36 for libwps by doxygen 1.8.8