32#ifndef _WORDPERFECTCOLLECTOR_H
33#define _WORDPERFECTCOLLECTOR_H
35#include "SectionStyle.h"
38#include <libwpd/libwpd.h>
39#include "shared_headers.h"
56typedef struct _WriterDocumentState WriterDocumentState;
57struct _WriterDocumentState
59 _WriterDocumentState();
63 bool mbListElementOpenedAtCurrentLevel;
64 bool mbTableCellOpened;
69enum WriterListType { unordered, ordered };
73 bool operator()(
const _SH_String & s1,
const _SH_String & s2)
const
75 return strcmp(s1.cstr(), s2.cstr()) < 0;
79class WordPerfectCollector :
public _SH_DocumentInterface
82 WordPerfectCollector(_SH_InputStream *pInput, DocumentHandler *pHandler);
83 virtual ~WordPerfectCollector();
86 virtual void setDocumentMetaData(
const _SH_PropertyList &propList) {};
87 virtual void startDocument();
88 virtual void endDocument();
90 virtual void openPageSpan(
const _SH_PropertyList &propList);
91 virtual void closePageSpan();
92 virtual void openHeader(
const _SH_PropertyList &propList);
93 virtual void closeHeader();
94 virtual void openFooter(
const _SH_PropertyList &propList);
95 virtual void closeFooter();
96 virtual void openParagraph(
const _SH_PropertyList &propList,
const _SH_PropertyListVector &tabStops);
97 virtual void closeParagraph();
98 virtual void openSpan(
const _SH_PropertyList &propList);
99 virtual void closeSpan();
100 virtual void openSection(
const _SH_PropertyList &propList,
const _SH_PropertyListVector &columns);
101 virtual void closeSection();
102 virtual void insertTab();
103 virtual void insertText(
const _SH_String &text);
104 virtual void insertLineBreak();
105 virtual void defineOrderedListLevel(
const _SH_PropertyList &propList);
106 virtual void defineUnorderedListLevel(
const _SH_PropertyList &propList);
107 virtual void openOrderedListLevel(
const _SH_PropertyList &propList);
108 virtual void openUnorderedListLevel(
const _SH_PropertyList &propList);
109 virtual void closeOrderedListLevel();
110 virtual void closeUnorderedListLevel();
111 virtual void openListElement(
const _SH_PropertyList &propList,
const _SH_PropertyListVector &tabStops);
112 virtual void closeListElement();
113 virtual void openFootnote(
const _SH_PropertyList &propList);
114 virtual void closeFootnote();
115 virtual void openEndnote(
const _SH_PropertyList &propList);
116 virtual void closeEndnote();
117 virtual void openTable(
const _SH_PropertyList &propList,
const _SH_PropertyListVector &columns);
118 virtual void openTableRow(
const _SH_PropertyList &propList);
119 virtual void closeTableRow();
120 virtual void openTableCell(
const _SH_PropertyList &propList);
121 virtual void closeTableCell();
122 virtual void insertCoveredTableCell(
const _SH_PropertyList &propList);
123 virtual void closeTable();
125#if defined(HAVE_LIBWPD_090) || defined(HAVE_LIBWPD_0100)
126 virtual void definePageStyle(
const _SH_PropertyList &propList) {}
127 virtual void defineParagraphStyle(
const _SH_PropertyList &propList,
const _SH_PropertyListVector &tabStops) {}
128 virtual void defineCharacterStyle(
const _SH_PropertyList &propList) {}
129 virtual void defineSectionStyle(
const _SH_PropertyList &propList,
const _SH_PropertyListVector &columns) {}
130 virtual void insertSpace() {}
131 virtual void insertField(
const _SH_String &type,
const _SH_PropertyList &propList) {}
132 virtual void openComment(
const _SH_PropertyList &propList) {}
133 virtual void closeComment() {}
134 virtual void openTextBox(
const _SH_PropertyList &propList) {}
135 virtual void closeTextBox() {}
136 virtual void openFrame(
const _SH_PropertyList &propList) {}
137 virtual void closeFrame() {}
138 virtual void insertBinaryObject(
const _SH_PropertyList &propList,
const _SH_BinaryData &data) {}
139 virtual void insertEquation(
const _SH_PropertyList &propList,
const _SH_String &data) {}
142#if defined(HAVE_LIBWPD_0100)
143 virtual void startDocument(
const _SH_PropertyList &propList) {}
144 virtual void defineEmbeddedFont(
const _SH_PropertyList &propList) {}
145 virtual void defineParagraphStyle(
const _SH_PropertyList &propList) {}
146 virtual void openParagraph(
const _SH_PropertyList &propList) {}
147 virtual void openLink(
const _SH_PropertyList &propList) {}
148 virtual void closeLink() {}
149 virtual void defineSectionStyle(
const _SH_PropertyList &propList) {}
150 virtual void openSection(
const _SH_PropertyList &propList) {}
151 virtual void insertField(
const _SH_PropertyList &propList) {}
152 virtual void openListElement(
const _SH_PropertyList &propList) {}
153 virtual void openTable(
const _SH_PropertyList &propList) {}
154 virtual void insertBinaryObject(
const _SH_PropertyList &propList) {}
155 virtual void insertEquation(
const _SH_PropertyList &propList) {}
156 virtual void openGroup(
const _SH_PropertyList &propList) {}
157 virtual void closeGroup() {}
158 virtual void defineGraphicStyle(
const _SH_PropertyList &propList) {}
159 virtual void drawRectangle(
const _SH_PropertyList &propList) {}
160 virtual void drawEllipse(
const _SH_PropertyList &propList) {}
161 virtual void drawPolygon(
const _SH_PropertyList &propList) {}
162 virtual void drawPolyline(
const _SH_PropertyList &propList) {}
163 virtual void drawPath(
const _SH_PropertyList &propList) {}
164 virtual void drawConnector(
const _SH_PropertyList &propList) {}
168 void _resetDocumentState();
169 bool _parseSourceDocument(_SH_InputStream &input);
170 bool _writeTargetDocument(DocumentHandler &xHandler);
172 void _writeDefaultStyles(DocumentHandler &xHandler);
173 void _writeMasterPages(DocumentHandler &xHandler);
174 void _writePageMasters(DocumentHandler &xHandler);
175 void _allocateFontName(
const _SH_String &);
178 void _openListLevel(TagOpenElement *pListLevelOpenElement);
179 void _closeListLevel(
const char *szListType);
181 _SH_InputStream *mpInput;
182 DocumentHandler *mpHandler;
185 WriterDocumentState mWriterDocumentState;
188 std::map<_SH_String, ParagraphStyle *, ltstr> mTextStyleHash;
191 std::map<_SH_String, SpanStyle *, ltstr> mSpanStyleHash;
194 std::map<_SH_String, FontStyle *, ltstr> mFontHash;
197 std::vector<SectionStyle *> mSectionStyles;
198 float mfSectionSpaceAfter;
201 std::vector<TableStyle *> mTableStyles;
204 unsigned int miNumListStyles;
207 std::vector<DocumentElement *> mStylesElements;
209 std::vector<DocumentElement *> mBodyElements;
211 std::vector<DocumentElement *> * mpCurrentContentElements;
214 std::vector<PageSpan *> mPageSpans;
215 PageSpan *mpCurrentPageSpan;
219 ListStyle *mpCurrentListStyle;
220 unsigned int miCurrentListLevel;
221 unsigned int miLastListLevel;
222 unsigned int miLastListNumber;
223 std::vector<ListStyle *> mListStyles;
224 bool mbListContinueNumbering;
225 bool mbListElementOpened;
226 bool mbListElementParagraphOpened;
229 TableStyle *mpCurrentTableStyle;