| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef WPS8_TEXTSTYLE_H |
| 23 |
#define WPS8_TEXTSTYLE_H |
| 24 |
|
| 25 |
#include <ostream> |
| 26 |
#include <string> |
| 27 |
#include <vector> |
| 28 |
|
| 29 |
#include "libwps_internal.h" |
| 30 |
|
| 31 |
#include "WPSDebug.h" |
| 32 |
|
| 33 |
namespace WPS8TextStyleInternal |
| 34 |
{ |
| 35 |
struct State; |
| 36 |
} |
| 37 |
|
| 38 |
class WPS8Text; |
| 39 |
|
| 40 |
class WPS8TextStyle |
| 41 |
{ |
| 42 |
friend class WPS8Text; |
| 43 |
public: |
| 44 |
struct FontData; |
| 45 |
|
| 46 |
explicit WPS8TextStyle(WPS8Text &parser); |
| 47 |
~WPS8TextStyle(); |
| 48 |
|
| 49 |
|
| 50 |
void setListener(WPSContentListenerPtr &listen) |
| 51 |
{ |
| 52 |
m_listener = listen; |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
bool readStructures(); |
| 57 |
|
| 58 |
protected: |
| 59 |
|
| 60 |
bool readFontNames(WPSEntry const &entry); |
| 61 |
|
| 62 |
bool readFont(long endPos, int &id, std::string &mess); |
| 63 |
|
| 64 |
void sendFont(int fId, FontData &data); |
| 65 |
|
| 66 |
|
| 67 |
bool readParagraph(long endPos, int &id, std::string &mess); |
| 68 |
|
| 69 |
void sendParagraph(int pId); |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
bool readSTSH(WPSEntry const &entry); |
| 74 |
|
| 75 |
|
| 76 |
bool readSGP(WPSEntry const &entry); |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
bool findFDPStructures(int which, std::vector<WPSEntry> &result); |
| 85 |
|
| 86 |
|
| 87 |
bool findFDPStructuresByHand(int which, std::vector<WPSEntry> &result); |
| 88 |
|
| 89 |
protected: |
| 90 |
|
| 91 |
libwps::DebugFile &ascii() |
| 92 |
{ |
| 93 |
return m_asciiFile; |
| 94 |
} |
| 95 |
|
| 96 |
private: |
| 97 |
|
| 98 |
WPS8TextStyle(WPS8TextStyle const &orig) = delete; |
| 99 |
|
| 100 |
WPS8TextStyle &operator=(WPS8TextStyle const &orig) = delete; |
| 101 |
|
| 102 |
protected: |
| 103 |
|
| 104 |
WPS8Text &m_mainParser; |
| 105 |
|
| 106 |
RVNGInputStreamPtr m_input; |
| 107 |
|
| 108 |
WPSContentListenerPtr m_listener; |
| 109 |
|
| 110 |
mutable std::shared_ptr<WPS8TextStyleInternal::State> m_state; |
| 111 |
|
| 112 |
libwps::DebugFile &m_asciiFile; |
| 113 |
public: |
| 114 |
struct FontData |
| 115 |
{ |
| 116 |
FontData() |
| 117 |
: m_type(T_None) |
| 118 |
, m_fieldType(F_None) |
| 119 |
, m_fieldFormat(0) {} |
| 120 |
|
| 121 |
friend std::ostream &operator<<(std::ostream &o, FontData const &fData); |
| 122 |
|
| 123 |
std::string format() const; |
| 124 |
|
| 125 |
enum { T_None=0, T_Object=2, T_Footnote=3, T_Endnote=4, T_Field=5, T_Comment=6 }; |
| 126 |
|
| 127 |
int m_type; |
| 128 |
enum { F_None=0, F_PageNumber=-1, F_Date=-4, F_Time=-5 }; |
| 129 |
|
| 130 |
int m_fieldType; |
| 131 |
|
| 132 |
int m_fieldFormat; |
| 133 |
}; |
| 134 |
protected: |
| 135 |
}; |
| 136 |
|
| 137 |
|
| 138 |
#endif |
| 139 |
|