Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef NISUS_WRT_STRUCT
00035 # define NISUS_WRT_STRUCT
00036
00037 #include <iostream>
00038 #include <vector>
00039
00040 #include "libmwaw_internal.hxx"
00041
00042 #include "MWAWEntry.hxx"
00043
00044 class NisusWrtParser;
00045
00047 namespace NisusWrtStruct
00048 {
00050 enum ZoneType { Z_Main=0, Z_Footnote, Z_HeaderFooter };
00051
00053 enum VariableType { V_None=0, V_Numbering, V_Variable, V_Version };
00054
00056 struct Position {
00058 Position() : m_paragraph(0), m_word(0), m_char(0)
00059 {
00060 }
00062 friend std::ostream &operator<< (std::ostream &o, Position const &pos);
00063
00065 bool operator==(Position const &p2) const
00066 {
00067 return cmp(p2)==0;
00068 }
00070 bool operator!=(Position const &p2) const
00071 {
00072 return cmp(p2)!=0;
00073 }
00075 int cmp(Position const &p2) const
00076 {
00077 if (m_paragraph < p2.m_paragraph) return -1;
00078 if (m_paragraph > p2.m_paragraph) return 1;
00079 if (m_word < p2.m_word) return -1;
00080 if (m_word > p2.m_word) return 1;
00081 if (m_char < p2.m_char) return -1;
00082 if (m_char > p2.m_char) return 1;
00083 return 0;
00084 }
00086 int m_paragraph;
00088 int m_word;
00090 int m_char;
00091
00093 struct Compare {
00095 bool operator()(Position const &p1, Position const &p2) const
00096 {
00097 return p1.cmp(p2) < 0;
00098 }
00099 };
00100 };
00101
00103
00104
00106 struct FootnoteInfo {
00108 FootnoteInfo() : m_flags(0), m_distToDocument(5), m_distSeparator(36),
00109 m_separatorLength(108), m_unknown(0)
00110 {
00111 }
00113 friend std::ostream &operator<< (std::ostream &o, FootnoteInfo const &fnote);
00114
00116 bool endNotes() const
00117 {
00118 return (m_flags&0x8);
00119 }
00121 bool resetNumberOnNewPage() const
00122 {
00123 return (m_flags&0x8)==0 && (m_flags&0x10);
00124 }
00126 int m_flags;
00128 int m_distToDocument;
00130 int m_distSeparator;
00132 int m_separatorLength;
00134 int m_unknown;
00135 };
00136
00138 struct RecursifData {
00139 struct Node;
00140 struct Info;
00142 RecursifData(NisusWrtStruct::ZoneType zone, NisusWrtStruct::VariableType vType=NisusWrtStruct::V_None, int level=0) :
00143 m_info(new Info(zone, vType)), m_level(level), m_childList()
00144 {
00145 }
00147 RecursifData(RecursifData const &orig) :
00148 m_info(orig.m_info), m_level(-1), m_childList()
00149 {
00150 }
00152 RecursifData &operator=(RecursifData const &orig)
00153 {
00154 if (this != &orig) {
00155 m_info = orig.m_info;
00156 m_level = orig.m_level;
00157 m_childList = orig.m_childList;
00158 }
00159 return *this;
00160 }
00162 bool read(NisusWrtParser &parser, MWAWEntry const &entry);
00163
00165 shared_ptr<Info> m_info;
00167 int m_level;
00169 std::vector<Node> m_childList;
00170
00172 struct Info {
00174 Info(NisusWrtStruct::ZoneType zType, NisusWrtStruct::VariableType vType=NisusWrtStruct::V_None) :
00175 m_zoneType(zType), m_variableType(vType)
00176 {
00177 }
00179 NisusWrtStruct::ZoneType m_zoneType;
00181 NisusWrtStruct::VariableType m_variableType;
00182 };
00184 struct Node {
00186 Node() : m_type(0), m_entry(), m_data()
00187 {
00188 }
00190 bool isLeaf() const
00191 {
00192 return !m_data;
00193 }
00194
00196 int m_type;
00198 MWAWEntry m_entry;
00200 shared_ptr<RecursifData> m_data;
00201 };
00202 };
00203 }
00204
00205 #endif
00206