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 MWAW_GRAPHIC_LISTENER_H
00035 #define MWAW_GRAPHIC_LISTENER_H
00036
00037 #include <vector>
00038
00039 #include <librevenge/librevenge.h>
00040
00041 #include "libmwaw_internal.hxx"
00042
00043 #include "MWAWGraphicStyle.hxx"
00044
00045 #include "MWAWListener.hxx"
00046
00047 class MWAWGraphicShape;
00048
00049 namespace MWAWGraphicListenerInternal
00050 {
00051 struct GraphicState;
00052 struct State;
00053 }
00054
00059 class MWAWGraphicListener : public MWAWListener
00060 {
00061 public:
00063 MWAWGraphicListener(MWAWParserState &parserState, std::vector<MWAWPageSpan> const &pageList, librevenge::RVNGDrawingInterface *documentInterface);
00067 MWAWGraphicListener(MWAWParserState &parserState, MWAWBox2f const &box, librevenge::RVNGDrawingInterface *documentInterface);
00069 virtual ~MWAWGraphicListener();
00070
00072 Type getType() const
00073 {
00074 return Graphic;
00075 }
00076
00078 void setDocumentLanguage(std::string locale);
00080 void startDocument();
00082 void endDocument(bool delayed=true);
00083
00084
00086 bool canWriteText() const;
00088 bool isDocumentStarted() const;
00089
00091 void handleSubDocument(MWAWVec2f const &orig, MWAWSubDocumentPtr subDocument, libmwaw::SubDocumentType subDocumentType);
00093 void handleSubDocument(MWAWSubDocumentPtr subDocument, libmwaw::SubDocumentType subDocumentType)
00094 {
00095 handleSubDocument(MWAWVec2f(0,0), subDocument, subDocumentType);
00096 }
00098 bool isSubDocumentOpened(libmwaw::SubDocumentType &subdocType) const;
00100 bool openFrame(MWAWPosition const &pos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle());
00102 void closeFrame();
00104 bool openGroup(MWAWPosition const &pos);
00106 void closeGroup();
00108 bool openLayer(librevenge::RVNGString const &name);
00110 void closeLayer();
00111
00112
00114 bool openMasterPage(MWAWPageSpan &masterPage);
00116 void closeMasterPage()
00117 {
00118 _closePageSpan(true);
00119 }
00121 bool isPageSpanOpened() const;
00125 MWAWPageSpan const &getPageSpan();
00126
00127
00129 bool insertHeader(MWAWSubDocumentPtr subDocument, librevenge::RVNGPropertyList const &extras);
00131 bool insertFooter(MWAWSubDocumentPtr subDocument, librevenge::RVNGPropertyList const &extras);
00133 bool isHeaderFooterOpened() const;
00134
00135
00137 void insertChar(uint8_t character);
00140 void insertCharacter(unsigned char c);
00146 int insertCharacter(unsigned char c, MWAWInputStreamPtr &input, long endPos=-1);
00149 void insertUnicode(uint32_t character);
00151 void insertUnicodeString(librevenge::RVNGString const &str);
00152
00154 void insertTab();
00156 void insertEOL(bool softBreak=false);
00157
00158
00160 void setFont(MWAWFont const &font);
00162 MWAWFont const &getFont() const;
00163
00164
00166 bool isParagraphOpened() const;
00168 void setParagraph(MWAWParagraph const ¶graph);
00170 MWAWParagraph const &getParagraph() const;
00171
00172
00174 void insertField(MWAWField const &field);
00175
00176
00178 void openLink(MWAWLink const &link);
00180 void closeLink();
00181
00182
00184 void insertPicture(MWAWPosition const &pos, const librevenge::RVNGBinaryData &binaryData,
00185 std::string type="image/pict", MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle());
00187 void insertPicture(MWAWPosition const &pos, MWAWGraphicShape const &shape, MWAWGraphicStyle const &style);
00189 void insertTextBox(MWAWPosition const &pos, MWAWSubDocumentPtr subDocument, MWAWGraphicStyle const &style);
00191 void insertGroup(MWAWBox2f const &bdbox, MWAWSubDocumentPtr subDocument);
00195 void insertNote(MWAWNote const ¬e, MWAWSubDocumentPtr &subDocument);
00199 void insertComment(MWAWSubDocumentPtr &subDocument);
00200
00201
00202
00204 void insertTable(MWAWPosition const &pos, MWAWTable &table, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle());
00206 void openTable(MWAWTable const &table);
00208 void openTable(MWAWPosition const &pos, MWAWTable const &table, MWAWGraphicStyle const &style);
00210 void closeTable();
00212 void openTableRow(float h, librevenge::RVNGUnit unit, bool headerRow=false);
00214 void closeTableRow();
00216 void openTableCell(MWAWCell const &cell);
00218 void closeTableCell();
00220 void addEmptyTableCell(MWAWVec2i const &pos, MWAWVec2i span=MWAWVec2i(1,1));
00221
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()
00240 {
00241 return false;
00242 }
00244 void insertBreak(BreakType breakType);
00245
00246 protected:
00248 void _openPageSpan(bool sendHeaderFooters=true);
00250 void _closePageSpan(bool masterPage=false);
00251
00252 void _startSubDocument();
00253 void _endSubDocument();
00254
00258 void _handleFrameParameters(librevenge::RVNGPropertyList &propList, MWAWPosition const &pos, MWAWGraphicStyle const &style);
00259
00260 void _openParagraph();
00261 void _closeParagraph();
00262 void _resetParagraphState(const bool isListElement=false);
00263
00265 void _openListElement();
00267 void _closeListElement();
00269 void _changeList();
00274 int _getListId() const;
00275
00276 void _openSpan();
00277 void _closeSpan();
00278
00279 void _flushText();
00280
00284 shared_ptr<MWAWGraphicListenerInternal::State> _pushParsingState();
00286 void _popParsingState();
00287
00288 protected:
00290 shared_ptr<MWAWGraphicListenerInternal::GraphicState> m_ds;
00292 shared_ptr<MWAWGraphicListenerInternal::State> m_ps;
00294 std::vector<shared_ptr<MWAWGraphicListenerInternal::State> > m_psStack;
00296 MWAWParserState &m_parserState;
00298 librevenge::RVNGDrawingInterface *m_documentInterface;
00299
00300 private:
00301 MWAWGraphicListener(const MWAWGraphicListener &);
00302 MWAWGraphicListener &operator=(const MWAWGraphicListener &);
00303 };
00304
00305 #endif
00306