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 STOFF_SPREADSHEET_LISTENER_H
00041 #define STOFF_SPREADSHEET_LISTENER_H
00042
00043 #include <vector>
00044
00045 #include <librevenge/librevenge.h>
00046
00047 #include "libstaroffice_internal.hxx"
00048
00049 #include "STOFFListener.hxx"
00050
00051 class STOFFCell;
00052 class STOFFCellContent;
00053 class STOFFChart;
00054 class STOFFGraphicStyle;
00055 class STOFFTable;
00056
00057 namespace STOFFSpreadsheetListenerInternal
00058 {
00059 struct DocumentState;
00060 struct State;
00061 }
00062
00064 class STOFFSpreadsheetListener : public STOFFListener
00065 {
00066 public:
00068 STOFFSpreadsheetListener(STOFFListManagerPtr listManager, std::vector<STOFFPageSpan> const &pageList, librevenge::RVNGSpreadsheetInterface *documentInterface);
00070 virtual ~STOFFSpreadsheetListener();
00071
00073 Type getType() const
00074 {
00075 return Spreadsheet;
00076 }
00077
00079 void setDocumentLanguage(std::string locale);
00081 void setDocumentMetaData(const librevenge::RVNGPropertyList &list);
00082
00084 void startDocument();
00086 void endDocument(bool sendDelayedSubDoc=true);
00088 bool isDocumentStarted() const;
00089
00091 void handleSubDocument(STOFFSubDocumentPtr subDocument, libstoff::SubDocumentType subDocumentType);
00093 bool isSubDocumentOpened(libstoff::SubDocumentType &subdocType) const;
00095 bool openFrame(STOFFPosition const &pos, STOFFGraphicStyle const &style=STOFFGraphicStyle());
00097 void closeFrame();
00099 bool openGroup(STOFFPosition const &pos);
00101 void closeGroup();
00102
00104 bool canWriteText() const;
00105
00106
00108 bool isPageSpanOpened() const;
00112 STOFFPageSpan const &getPageSpan();
00113
00114
00116 bool openHeader(librevenge::RVNGPropertyList const &extras);
00118 bool openFooter(librevenge::RVNGPropertyList const &extras);
00120 bool closeHeader();
00122 bool closeFooter();
00124 bool insertHeaderRegion(STOFFSubDocumentPtr subDocument, librevenge::RVNGString const &which);
00126 bool insertFooterRegion(STOFFSubDocumentPtr subDocument, librevenge::RVNGString const &which);
00128 bool isHeaderFooterOpened() const;
00129
00130
00132 void openSheet(std::vector<float> const &colWidth, librevenge::RVNGUnit unit,
00133 std::vector<int> const &repeatColWidthNumber=std::vector<int>(), librevenge::RVNGString const &name="");
00135 void closeSheet();
00137 void openSheetRow(float h, librevenge::RVNGUnit unit, int numRepeated=1);
00139 void closeSheetRow();
00141 void openSheetCell(STOFFCell const &cell, STOFFCellContent const &content, int numRepeated=1);
00143 void closeSheetCell();
00144
00145
00147 void insertChart(STOFFPosition const &pos, STOFFChart &chart, STOFFGraphicStyle const &style=STOFFGraphicStyle());
00148
00149
00150
00152 void insertChar(uint8_t character);
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(STOFFFont const &font);
00168 STOFFFont const &getFont() const;
00169
00170
00172 bool isParagraphOpened() const;
00174 void setParagraph(STOFFParagraph const ¶graph);
00176 STOFFParagraph const &getParagraph() const;
00177
00178
00180 void defineStyle(STOFFFont const &style);
00182 bool isFontStyleDefined(librevenge::RVNGString const &name) const;
00184 void defineStyle(STOFFGraphicStyle const &style);
00186 bool isGraphicStyleDefined(librevenge::RVNGString const &name) const;
00188 void defineStyle(STOFFParagraph const &style);
00190 bool isParagraphStyleDefined(librevenge::RVNGString const &name) const;
00191
00192
00194 void insertField(STOFFField const &field);
00195
00196
00198 void openLink(STOFFLink const &link);
00200 void closeLink();
00201
00202
00204 void insertNote(STOFFNote const ¬e, STOFFSubDocumentPtr &subDocument);
00206 void insertComment(STOFFSubDocumentPtr &subDocument, librevenge::RVNGString const &creator="", librevenge::RVNGString const &date="");
00207
00209 void insertPicture(STOFFPosition const &pos, STOFFEmbeddedObject const &picture,
00210 STOFFGraphicStyle const &style=STOFFGraphicStyle());
00212 void insertShape(STOFFGraphicShape const &shape, STOFFGraphicStyle const &style, STOFFPosition const &pos);
00214 void insertTextBox(STOFFPosition const &pos, STOFFSubDocumentPtr subDocument,
00215 STOFFGraphicStyle const &frameStyle=STOFFGraphicStyle());
00216
00218 void insertTable(STOFFPosition const &pos, STOFFTable &table, STOFFGraphicStyle const &style=STOFFGraphicStyle());
00220 void openTable(STOFFTable const &table);
00222 void closeTable();
00224 void openTableRow(float h, librevenge::RVNGUnit unit, bool headerRow=false);
00226 void closeTableRow();
00228 void openTableCell(STOFFCell const &cell);
00230 void closeTableCell();
00232 void addEmptyTableCell(STOFFVec2i const &pos, STOFFVec2i span=STOFFVec2i(1,1));
00233
00234
00236 bool canOpenSectionAddBreak() const
00237 {
00238 return false;
00239 }
00241 bool isSectionOpened() const
00242 {
00243 return false;
00244 }
00246 STOFFSection const &getSection() const;
00248 bool openSection(STOFFSection const §ion);
00250 bool closeSection();
00252 void insertBreak(BreakType breakType);
00253
00254 protected:
00256 void _openPageSpan(bool sendHeaderFooters=true);
00258 void _closePageSpan();
00259
00260 void _startSubDocument();
00261 void _endSubDocument();
00262
00263 void _handleFrameParameters(librevenge::RVNGPropertyList &propList, STOFFPosition const &pos);
00264
00265 void _openParagraph();
00266 void _closeParagraph();
00267 void _resetParagraphState(const bool isListElement=false);
00268
00270 void _openListElement();
00272 void _closeListElement();
00274 void _changeList();
00279 int _getListId() const;
00280
00281 void _openSpan();
00282 void _closeSpan();
00283
00284 void _flushText();
00285 void _flushDeferredTabs();
00286
00290 shared_ptr<STOFFSpreadsheetListenerInternal::State> _pushParsingState();
00292 void _popParsingState();
00293
00294 protected:
00296 shared_ptr<STOFFSpreadsheetListenerInternal::DocumentState> m_ds;
00298 shared_ptr<STOFFSpreadsheetListenerInternal::State> m_ps;
00300 std::vector<shared_ptr<STOFFSpreadsheetListenerInternal::State> > m_psStack;
00302 librevenge::RVNGSpreadsheetInterface *m_documentInterface;
00303
00304 private:
00306 STOFFSpreadsheetListener(const STOFFSpreadsheetListener &);
00308 STOFFSpreadsheetListener &operator=(const STOFFSpreadsheetListener &);
00309 };
00310
00311 #endif
00312