00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __ABWCOLLECTOR_H__
00011 #define __ABWCOLLECTOR_H__
00012
00013 #include <string>
00014 #include <map>
00015 #include <librevenge/librevenge.h>
00016
00017 namespace libabw
00018 {
00019
00020 enum ABWUnit
00021 {
00022 ABW_NONE,
00023 ABW_CM,
00024 ABW_IN,
00025 ABW_MM,
00026 ABW_PI,
00027 ABW_PT,
00028 ABW_PX,
00029 ABW_PERCENT
00030 };
00031
00032 enum ABWListType
00033 {
00034 ABW_ORDERED,
00035 ABW_UNORDERED
00036 };
00037
00038 typedef std::map<std::string, std::string> ABWPropertyMap;
00039
00040 bool findInt(const std::string &str, int &res);
00041 bool findDouble(const std::string &str, double &res, ABWUnit &unit);
00042 void parsePropString(const std::string &str, ABWPropertyMap &props);
00043
00044 struct ABWData
00045 {
00046 ABWData()
00047 : m_mimeType(), m_binaryData() {}
00048 ABWData(const ABWData &data)
00049 : m_mimeType(data.m_mimeType), m_binaryData(data.m_binaryData) {}
00050 ABWData(const librevenge::RVNGString &mimeType, const librevenge::RVNGBinaryData binaryData)
00051 : m_mimeType(mimeType), m_binaryData(binaryData) {}
00052 ~ABWData() {}
00053
00054 librevenge::RVNGString m_mimeType;
00055 librevenge::RVNGBinaryData m_binaryData;
00056 };
00057
00058 struct ABWListElement
00059 {
00060 ABWListElement()
00061 : m_listLevel(-1), m_minLabelWidth(0.0), m_spaceBefore(0.0), m_parentId() {}
00062 virtual ~ABWListElement() {}
00063 virtual void writeOut(librevenge::RVNGPropertyList &propList) const;
00064 virtual ABWListType getType() const = 0;
00065
00066 int m_listLevel;
00067 double m_minLabelWidth;
00068 double m_spaceBefore;
00069 int m_parentId;
00070 };
00071
00072 struct ABWOrderedListElement : public ABWListElement
00073 {
00074 ABWOrderedListElement()
00075 : ABWListElement(), m_numFormat(), m_numPrefix(), m_numSuffix(), m_startValue(-1) {}
00076 ~ABWOrderedListElement() {}
00077 void writeOut(librevenge::RVNGPropertyList &propList) const;
00078 ABWListType getType() const
00079 {
00080 return ABW_ORDERED;
00081 }
00082
00083 librevenge::RVNGString m_numFormat;
00084 librevenge::RVNGString m_numPrefix;
00085 librevenge::RVNGString m_numSuffix;
00086 int m_startValue;
00087 };
00088
00089 struct ABWUnorderedListElement : public ABWListElement
00090 {
00091 ABWUnorderedListElement()
00092 : ABWListElement(), m_bulletChar() {}
00093 ~ABWUnorderedListElement() {}
00094 void writeOut(librevenge::RVNGPropertyList &propList) const;
00095 ABWListType getType() const
00096 {
00097 return ABW_UNORDERED;
00098 }
00099
00100 librevenge::RVNGString m_bulletChar;
00101 };
00102
00103 class ABWCollector
00104 {
00105 public:
00106 ABWCollector() {}
00107 virtual ~ABWCollector() {}
00108
00109
00110
00111 virtual void collectTextStyle(const char *name, const char *basedon, const char *followedby, const char *props) = 0;
00112 virtual void collectDocumentProperties(const char *props) = 0;
00113 virtual void collectParagraphProperties(const char *level, const char *listid, const char *parentid,
00114 const char *style, const char *props) = 0;
00115 virtual void collectSectionProperties(const char *footer, const char *footerLeft, const char *footerFirst,
00116 const char *footerLast, const char *header, const char *headerLeft,
00117 const char *headerFirst, const char *headerLast, const char *props) = 0;
00118 virtual void collectCharacterProperties(const char *style, const char *props) = 0;
00119 virtual void collectPageSize(const char *width, const char *height, const char *units, const char *pageScale) = 0;
00120 virtual void closeParagraphOrListElement() = 0;
00121 virtual void closeSpan() = 0;
00122 virtual void openLink(const char *href) = 0;
00123 virtual void closeLink() = 0;
00124 virtual void openFoot(const char *id) = 0;
00125 virtual void closeFoot() = 0;
00126 virtual void openEndnote(const char *id) = 0;
00127 virtual void closeEndnote() = 0;
00128 virtual void endSection() = 0;
00129 virtual void startDocument() = 0;
00130 virtual void endDocument() = 0;
00131 virtual void insertLineBreak() = 0;
00132 virtual void insertColumnBreak() = 0;
00133 virtual void insertPageBreak() = 0;
00134 virtual void insertText(const char *text) = 0;
00135 virtual void insertImage(const char *dataid, const char *props) = 0;
00136 virtual void collectList(const char *id, const char *listDecimal, const char *listDelim,
00137 const char *parentid, const char *startValue, const char *type) = 0;
00138
00139 virtual void collectData(const char *name, const char *mimeType, const librevenge::RVNGBinaryData &data) = 0;
00140 virtual void collectHeaderFooter(const char *id, const char *type) = 0;
00141
00142 virtual void openTable(const char *props) = 0;
00143 virtual void closeTable() = 0;
00144 virtual void openCell(const char *props) = 0;
00145 virtual void closeCell() = 0;
00146
00147 virtual void addMetadataEntry(const char *name, const char *value) = 0;
00148 };
00149
00150 }
00151
00152 #endif
00153