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 STOFF_GRAPHIC_LISTENER_H
00035 #define STOFF_GRAPHIC_LISTENER_H
00036
00037 #include <vector>
00038
00039 #include <librevenge/librevenge.h>
00040
00041 #include "libstaroffice_internal.hxx"
00042
00043 #include "STOFFGraphicStyle.hxx"
00044
00045 #include "STOFFListener.hxx"
00046
00047 class STOFFGraphicShape;
00048
00049 namespace STOFFGraphicListenerInternal
00050 {
00051 struct GraphicState;
00052 struct State;
00053 }
00054
00059 class STOFFGraphicListener : public STOFFListener
00060 {
00061 public:
00063 STOFFGraphicListener(STOFFListManagerPtr listManager, std::vector<STOFFPageSpan> const &pageList, librevenge::RVNGDrawingInterface *documentInterface);
00065 virtual ~STOFFGraphicListener();
00066
00068 Type getType() const
00069 {
00070 return Graphic;
00071 }
00072
00074 void setDocumentLanguage(std::string locale);
00076 void setDocumentMetaData(const librevenge::RVNGPropertyList &list);
00078 void startDocument();
00080 void endDocument(bool sendDelayedSubDoc=true);
00081
00082
00084 bool canWriteText() const;
00086 bool isDocumentStarted() const;
00087
00089 void handleSubDocument(STOFFSubDocumentPtr subDocument, libstoff::SubDocumentType subDocumentType);
00091 bool isSubDocumentOpened(libstoff::SubDocumentType &subdocType) const;
00093 bool openFrame(STOFFPosition const &pos, STOFFGraphicStyle const &style=STOFFGraphicStyle());
00095 void closeFrame();
00097 bool openGroup(STOFFPosition const &pos);
00099 void closeGroup();
00101 bool openLayer(librevenge::RVNGString const &name);
00103 void closeLayer();
00104
00105
00107 bool openMasterPage(STOFFPageSpan &masterPage);
00109 void closeMasterPage()
00110 {
00111 _closePageSpan(true);
00112 }
00114 bool isPageSpanOpened() const;
00118 STOFFPageSpan const &getPageSpan();
00119
00120
00122 bool openHeader(librevenge::RVNGPropertyList const &extras);
00124 bool openFooter(librevenge::RVNGPropertyList const &extras);
00126 bool closeHeader();
00128 bool closeFooter();
00130 bool insertHeaderRegion(STOFFSubDocumentPtr subDocument, librevenge::RVNGString const &which);
00132 bool insertFooterRegion(STOFFSubDocumentPtr subDocument, librevenge::RVNGString const &which);
00134 bool isHeaderFooterOpened() const;
00135
00136
00138 void insertChar(uint8_t character);
00143 void insertUnicode(uint32_t character);
00145 void insertUnicodeString(librevenge::RVNGString const &str);
00146
00148 void insertTab();
00150 void insertEOL(bool softBreak=false);
00151
00152
00154 void setFont(STOFFFont const &font);
00156 STOFFFont const &getFont() const;
00157
00158
00160 bool isParagraphOpened() const;
00162 void setParagraph(STOFFParagraph const ¶graph);
00164 STOFFParagraph const &getParagraph() const;
00165
00166
00168 void defineStyle(STOFFFont const &style);
00170 bool isFontStyleDefined(librevenge::RVNGString const &name) const;
00172 void defineStyle(STOFFGraphicStyle const &style);
00174 bool isGraphicStyleDefined(librevenge::RVNGString const &name) const;
00176 void defineStyle(STOFFParagraph const &style);
00178 bool isParagraphStyleDefined(librevenge::RVNGString const &name) const;
00179
00180
00182 void insertField(STOFFField const &field);
00183
00184
00186 void openLink(STOFFLink const &link);
00188 void closeLink();
00189
00190
00192 void insertShape(STOFFGraphicShape const &shape, STOFFGraphicStyle const &style, STOFFPosition const &pos);
00194 void insertTextBox(STOFFPosition const &pos, STOFFSubDocumentPtr subDocument, STOFFGraphicStyle const &style=STOFFGraphicStyle());
00196 void insertPicture(STOFFPosition const &pos, STOFFEmbeddedObject const &picture,
00197 STOFFGraphicStyle const &style=STOFFGraphicStyle());
00201 void insertNote(STOFFNote const ¬e, STOFFSubDocumentPtr &subDocument);
00205 void insertComment(STOFFSubDocumentPtr &subDocument, librevenge::RVNGString const &creator="", librevenge::RVNGString const &date="");
00206
00207
00208
00210 void insertTable(STOFFPosition const &pos, STOFFTable &table, STOFFGraphicStyle const &style=STOFFGraphicStyle());
00212 void openTable(STOFFTable const &table);
00214 void openTable(STOFFPosition const &pos, STOFFTable const &table);
00216 void closeTable();
00218 void openTableRow(float h, librevenge::RVNGUnit unit, bool headerRow=false);
00220 void closeTableRow();
00222 void openTableCell(STOFFCell const &cell);
00224 void closeTableCell();
00226 void addEmptyTableCell(STOFFVec2i const &pos, STOFFVec2i span=STOFFVec2i(1,1));
00227
00228
00229
00231 bool canOpenSectionAddBreak() const
00232 {
00233 return false;
00234 }
00236 bool isSectionOpened() const
00237 {
00238 return false;
00239 }
00241 STOFFSection const &getSection() const;
00243 bool openSection(STOFFSection const §ion);
00245 bool closeSection()
00246 {
00247 return false;
00248 }
00250 void insertBreak(BreakType breakType);
00251
00252 protected:
00254 void _openPageSpan(bool sendHeaderFooters=true);
00256 void _closePageSpan(bool masterPage=false);
00257
00258 void _startSubDocument();
00259 void _endSubDocument();
00260
00264 void _handleFrameParameters(librevenge::RVNGPropertyList &propList, STOFFPosition const &pos, STOFFGraphicStyle const &style);
00265
00266 void _openParagraph();
00267 void _closeParagraph();
00268 void _resetParagraphState(const bool isListElement=false);
00269
00271 void _openListElement();
00273 void _closeListElement();
00275 void _changeList();
00280 int _getListId() const;
00281
00282 void _openSpan();
00283 void _closeSpan();
00284
00285 void _flushText();
00286
00290 shared_ptr<STOFFGraphicListenerInternal::State> _pushParsingState();
00292 void _popParsingState();
00293
00294 protected:
00296 shared_ptr<STOFFGraphicListenerInternal::GraphicState> m_ds;
00298 shared_ptr<STOFFGraphicListenerInternal::State> m_ps;
00300 std::vector<shared_ptr<STOFFGraphicListenerInternal::State> > m_psStack;
00302 librevenge::RVNGDrawingInterface *m_documentInterface;
00303
00304 private:
00305 STOFFGraphicListener(const STOFFGraphicListener &);
00306 STOFFGraphicListener &operator=(const STOFFGraphicListener &);
00307 };
00308
00309 #endif
00310