| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 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 |
|
| 36 |
class WPSGraphicStyle; |
| 37 |
|
| 38 |
namespace LotusStyleManagerInternal |
| 39 |
{ |
| 40 |
struct CellStyleEntry; |
| 41 |
struct State; |
| 42 |
} |
| 43 |
|
| 44 |
class LotusParser; |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
class LotusStyleManager |
| 51 |
{ |
| 52 |
public: |
| 53 |
friend class LotusParser; |
| 54 |
|
| 55 |
|
| 56 |
explicit LotusStyleManager(LotusParser &parser); |
| 57 |
|
| 58 |
~LotusStyleManager(); |
| 59 |
|
| 60 |
void cleanState(); |
| 61 |
|
| 62 |
void updateState(); |
| 63 |
|
| 64 |
|
| 65 |
bool getColor8(int cId, WPSColor &color) const; |
| 66 |
|
| 67 |
bool getColor16(int cId, WPSColor &color) const; |
| 68 |
|
| 69 |
bool getColor256(int cId, WPSColor &color) const; |
| 70 |
|
| 71 |
|
| 72 |
bool getPattern48(int id, WPSGraphicStyle::Pattern &pattern) const; |
| 73 |
|
| 74 |
bool getPattern64(int id, WPSGraphicStyle::Pattern &pattern) const; |
| 75 |
|
| 76 |
|
| 77 |
bool updateCellStyle(int cellId, WPSCellFormat &format, |
| 78 |
WPSFont &font, libwps_tools_win::Font::Type &fontType); |
| 79 |
|
| 80 |
bool updateFontStyle(int fontId, WPSFont &font, libwps_tools_win::Font::Type &fontType); |
| 81 |
|
| 82 |
bool updateLineStyle(int lineId, WPSGraphicStyle &style) const; |
| 83 |
|
| 84 |
bool updateSurfaceStyle(int colorId, WPSGraphicStyle &style) const; |
| 85 |
|
| 86 |
bool updateGraphicStyle(int graphicId, WPSGraphicStyle &style) const; |
| 87 |
|
| 88 |
bool updateSurfaceStyle(int fColorId, int bColorId, int patternId, WPSGraphicStyle &style) const; |
| 89 |
protected: |
| 90 |
|
| 91 |
int version() const; |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
bool readColorStyle(std::shared_ptr<WPSStream> stream, long endPos); |
| 99 |
|
| 100 |
bool readFormatStyle(std::shared_ptr<WPSStream> stream, long endPos); |
| 101 |
|
| 102 |
bool readLineStyle(std::shared_ptr<WPSStream> stream, long endPos, int vers); |
| 103 |
|
| 104 |
bool readGraphicStyle(std::shared_ptr<WPSStream> stream, long endPos); |
| 105 |
|
| 106 |
bool readGraphicStyleC9(std::shared_ptr<WPSStream> stream, long endPos); |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
bool readFontStyleA0(std::shared_ptr<WPSStream> stream, long endPos); |
| 112 |
|
| 113 |
bool readFontStyleF0(std::shared_ptr<WPSStream> stream, long endPos); |
| 114 |
|
| 115 |
bool readCellStyleD2(std::shared_ptr<WPSStream> stream, long endPos); |
| 116 |
|
| 117 |
bool readCellStyleE6(std::shared_ptr<WPSStream> stream, long endPos); |
| 118 |
|
| 119 |
|
| 120 |
static bool readMenuStyleE7(std::shared_ptr<WPSStream> stream, long endPos); |
| 121 |
|
| 122 |
bool readStyleE6(std::shared_ptr<WPSStream> stream, long endPos); |
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
bool readFMTFontName(std::shared_ptr<WPSStream> stream); |
| 128 |
|
| 129 |
bool readFMTFontSize(std::shared_ptr<WPSStream> stream); |
| 130 |
|
| 131 |
bool readFMTFontId(std::shared_ptr<WPSStream> stream); |
| 132 |
|
| 133 |
|
| 134 |
bool updateShadowStyle(int colorId, WPSGraphicStyle &style) const; |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
bool readCellStyleD2Data(LotusStyleManagerInternal::CellStyleEntry const &entry, std::set<int> &seen); |
| 145 |
private: |
| 146 |
LotusStyleManager(LotusStyleManager const &orig) = delete; |
| 147 |
LotusStyleManager &operator=(LotusStyleManager const &orig) = delete; |
| 148 |
|
| 149 |
LotusParser &m_mainParser; |
| 150 |
|
| 151 |
std::shared_ptr<LotusStyleManagerInternal::State> m_state; |
| 152 |
}; |
| 153 |
|
| 154 |
#endif |
| 155 |
|