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
00040 #ifndef MWAW_SPREADSHEET_LISTENER_H
00041 #define MWAW_SPREADSHEET_LISTENER_H
00042
00043 #include <vector>
00044
00045 #include <librevenge/librevenge.h>
00046
00047 #include "libmwaw_internal.hxx"
00048
00049 #include "MWAWListener.hxx"
00050
00051 class MWAWCell;
00052 class MWAWCellContent;
00053 class MWAWChart;
00054 class MWAWGraphicStyle;
00055 class MWAWGraphicShape;
00056 class MWAWTable;
00057
00058 namespace MWAWSpreadsheetListenerInternal
00059 {
00060 struct DocumentState;
00061 struct State;
00062 }
00063
00065 class MWAWSpreadsheetListener : public MWAWListener
00066 {
00067 public:
00069 MWAWSpreadsheetListener(MWAWParserState &parserState, std::vector<MWAWPageSpan> const &pageList, librevenge::RVNGSpreadsheetInterface *documentInterface);
00073 MWAWSpreadsheetListener(MWAWParserState &parserState, MWAWBox2f const &box, librevenge::RVNGSpreadsheetInterface *documentInterface);
00075 virtual ~MWAWSpreadsheetListener();
00076
00078 Type getType() const
00079 {
00080 return Spreadsheet;
00081 }
00082
00084 void setDocumentLanguage(std::string locale);
00085
00087 void startDocument();
00089 void endDocument(bool sendDelayedSubDoc=true);
00091 bool isDocumentStarted() const;
00092
00094 void handleSubDocument(MWAWSubDocumentPtr subDocument, libmwaw::SubDocumentType subDocumentType);
00096 bool isSubDocumentOpened(libmwaw::SubDocumentType &subdocType) const;
00098 bool openFrame(MWAWPosition const &pos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle());
00100 void closeFrame();
00101
00103 bool canWriteText() const;
00104
00105
00107 bool isPageSpanOpened() const;
00111 MWAWPageSpan const &getPageSpan();
00112
00113
00115 bool insertHeader(MWAWSubDocumentPtr subDocument, librevenge::RVNGPropertyList const &extras);
00117 bool insertFooter(MWAWSubDocumentPtr subDocument, librevenge::RVNGPropertyList const &extras);
00119 bool isHeaderFooterOpened() const;
00120
00121
00123 void openSheet(std::vector<float> const &colWidth, librevenge::RVNGUnit unit, std::string const &name="");
00125 void closeSheet();
00127 void openSheetRow(float h, librevenge::RVNGUnit unit);
00129 void closeSheetRow();
00131 void openSheetCell(MWAWCell const &cell, MWAWCellContent const &content);
00133 void closeSheetCell();
00134
00135
00137 void insertChart(MWAWPosition const &pos, MWAWChart &chart,
00138 MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle());
00139
00140
00141
00143 void insertChar(uint8_t character);
00146 void insertCharacter(unsigned char c);
00152 int insertCharacter(unsigned char c, MWAWInputStreamPtr &input, long endPos=-1);
00155 void insertUnicode(uint32_t character);
00157 void insertUnicodeString(librevenge::RVNGString const &str);
00158
00160 void insertTab();
00162 void insertEOL(bool softBreak=false);
00163
00164
00166 void setFont(MWAWFont const &font);
00168 MWAWFont const &getFont() const;
00169
00170
00172 bool isParagraphOpened() const;
00174 void setParagraph(MWAWParagraph const ¶graph);
00176 MWAWParagraph const &getParagraph() const;
00177
00178
00180 void insertField(MWAWField const &field);
00181
00182
00184 void openLink(MWAWLink const &link);
00186 void closeLink();
00187
00188
00190 void insertNote(MWAWNote const ¬e, MWAWSubDocumentPtr &subDocument);
00191
00193 void insertComment(MWAWSubDocumentPtr &subDocument);
00194
00196 void insertPicture(MWAWPosition const &pos, const librevenge::RVNGBinaryData &binaryData,
00197 std::string type="image/pict", MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle());
00199 void insertPicture(MWAWPosition const &pos, MWAWGraphicShape const &shape,
00200 MWAWGraphicStyle const &style);
00202 void insertTextBox(MWAWPosition const &pos, MWAWSubDocumentPtr subDocument,
00203 MWAWGraphicStyle const &frameStyle=MWAWGraphicStyle::emptyStyle());
00204
00205
00207 void insertTable(MWAWPosition const &pos, MWAWTable &table, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle());
00209 void openTable(MWAWTable const &table);
00211 void closeTable();
00213 void openTableRow(float h, librevenge::RVNGUnit unit, bool headerRow=false);
00215 void closeTableRow();
00217 void openTableCell(MWAWCell const &cell);
00219 void closeTableCell();
00221 void addEmptyTableCell(MWAWVec2i const &pos, MWAWVec2i span=MWAWVec2i(1,1));
00222
00223
00225 bool canOpenSectionAddBreak() const
00226 {
00227 return false;
00228 }
00230 bool isSectionOpened() const
00231 {
00232 return false;
00233 }
00235 MWAWSection const &getSection() const;
00237 bool openSection(MWAWSection const §ion);
00239 bool closeSection();
00241 void insertBreak(BreakType breakType);
00242
00243 protected:
00245 void _openPageSpan(bool sendHeaderFooters=true);
00247 void _closePageSpan();
00248
00249 void _startSubDocument();
00250 void _endSubDocument();
00251
00252 void _handleFrameParameters(librevenge::RVNGPropertyList &propList, MWAWPosition const &pos);
00253
00254 void _openParagraph();
00255 void _closeParagraph();
00256 void _resetParagraphState(const bool isListElement=false);
00257
00259 void _openListElement();
00261 void _closeListElement();
00263 void _changeList();
00268 int _getListId() const;
00269
00270 void _openSpan();
00271 void _closeSpan();
00272
00273 void _flushText();
00274 void _flushDeferredTabs();
00275
00279 shared_ptr<MWAWSpreadsheetListenerInternal::State> _pushParsingState();
00281 void _popParsingState();
00282
00283 protected:
00285 shared_ptr<MWAWSpreadsheetListenerInternal::DocumentState> m_ds;
00287 shared_ptr<MWAWSpreadsheetListenerInternal::State> m_ps;
00289 std::vector<shared_ptr<MWAWSpreadsheetListenerInternal::State> > m_psStack;
00291 MWAWParserState &m_parserState;
00293 librevenge::RVNGSpreadsheetInterface *m_documentInterface;
00294
00295 private:
00297 MWAWSpreadsheetListener(const MWAWSpreadsheetListener &);
00299 MWAWSpreadsheetListener &operator=(const MWAWSpreadsheetListener &);
00300 };
00301
00302 #endif
00303