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_PRESENTATION_LISTENER_H
00035 #define MWAW_PRESENTATION_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 MWAWPresentationListenerInternal
00050 {
00051 struct GraphicState;
00052 struct State;
00053 }
00054
00059 class MWAWPresentationListener : public MWAWListener
00060 {
00061 public:
00063 MWAWPresentationListener(MWAWParserState &parserState, std::vector<MWAWPageSpan> const &pageList, librevenge::RVNGPresentationInterface *documentInterface);
00065 virtual ~MWAWPresentationListener();
00066
00068 Type getType() const
00069 {
00070 return Presentation;
00071 }
00072
00074 void setDocumentLanguage(std::string locale);
00076 void startDocument();
00078 void endDocument(bool delayed=true);
00079
00080
00082 bool canWriteText() const;
00084 bool isDocumentStarted() const;
00085
00087 void handleSubDocument(MWAWVec2f const &orig, MWAWSubDocumentPtr subDocument, libmwaw::SubDocumentType subDocumentType);
00089 void handleSubDocument(MWAWSubDocumentPtr subDocument, libmwaw::SubDocumentType subDocumentType)
00090 {
00091 handleSubDocument(MWAWVec2f(0,0), subDocument, subDocumentType);
00092 }
00094 bool isSubDocumentOpened(libmwaw::SubDocumentType &subdocType) const;
00096 bool openFrame(MWAWPosition const &pos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle());
00098 void closeFrame();
00100 bool openGroup(MWAWPosition const &pos);
00102 void closeGroup();
00104 bool openLayer(librevenge::RVNGString const &name);
00106 void closeLayer();
00107
00108
00110 bool openMasterPage(MWAWPageSpan &masterPage);
00112 void closeMasterPage()
00113 {
00114 _closePageSpan(true);
00115 }
00117 bool isPageSpanOpened() const;
00121 MWAWPageSpan const &getPageSpan();
00122
00123
00125 bool insertHeader(MWAWSubDocumentPtr subDocument, librevenge::RVNGPropertyList const &extras);
00127 bool insertFooter(MWAWSubDocumentPtr subDocument, librevenge::RVNGPropertyList const &extras);
00129 bool isHeaderFooterOpened() const;
00130
00131
00133 void insertChar(uint8_t character);
00136 void insertCharacter(unsigned char c);
00142 int insertCharacter(unsigned char c, MWAWInputStreamPtr &input, long endPos=-1);
00145 void insertUnicode(uint32_t character);
00147 void insertUnicodeString(librevenge::RVNGString const &str);
00148
00150 void insertTab();
00152 void insertEOL(bool softBreak=false);
00153
00154
00156 void setFont(MWAWFont const &font);
00158 MWAWFont const &getFont() const;
00159
00160
00162 bool isParagraphOpened() const;
00164 void setParagraph(MWAWParagraph const ¶graph);
00166 MWAWParagraph const &getParagraph() const;
00167
00168
00170 void insertField(MWAWField const &field);
00171
00172
00174 void openLink(MWAWLink const &link);
00176 void closeLink();
00177
00178
00180 void insertPicture(MWAWPosition const &pos, const librevenge::RVNGBinaryData &binaryData,
00181 std::string type="image/pict", MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle());
00183 void insertPicture(MWAWPosition const &pos, MWAWGraphicShape const &shape, MWAWGraphicStyle const &style);
00185 void insertTextBox(MWAWPosition const &pos, MWAWSubDocumentPtr subDocument, MWAWGraphicStyle const &style);
00187 void insertGroup(MWAWBox2f const &bdbox, MWAWSubDocumentPtr subDocument);
00189 void insertSlideNote(MWAWPosition const &pos, MWAWSubDocumentPtr &subDocument);
00193 void insertNote(MWAWNote const ¬e, MWAWSubDocumentPtr &subDocument);
00197 void insertComment(MWAWSubDocumentPtr &subDocument);
00198
00199
00200
00202 void insertTable(MWAWPosition const &pos, MWAWTable &table, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle());
00204 void openTable(MWAWTable const &table);
00206 void openTable(MWAWPosition const &pos, MWAWTable const &table, MWAWGraphicStyle const &style);
00208 void closeTable();
00210 void openTableRow(float h, librevenge::RVNGUnit unit, bool headerRow=false);
00212 void closeTableRow();
00214 void openTableCell(MWAWCell const &cell);
00216 void closeTableCell();
00218 void addEmptyTableCell(MWAWVec2i const &pos, MWAWVec2i span=MWAWVec2i(1,1));
00219
00220
00221
00223 bool canOpenSectionAddBreak() const
00224 {
00225 return false;
00226 }
00228 bool isSectionOpened() const
00229 {
00230 return false;
00231 }
00233 MWAWSection const &getSection() const;
00235 bool openSection(MWAWSection const §ion);
00237 bool closeSection()
00238 {
00239 return false;
00240 }
00242 void insertBreak(BreakType breakType);
00243
00244 protected:
00246 void _openPageSpan(bool sendHeaderFooters=true);
00248 void _closePageSpan(bool masterPage=false);
00249
00250 void _startSubDocument();
00251 void _endSubDocument();
00252
00256 void _handleFrameParameters(librevenge::RVNGPropertyList &propList, MWAWPosition const &pos, MWAWGraphicStyle const &style);
00257
00258 void _openParagraph();
00259 void _closeParagraph();
00260 void _resetParagraphState(const bool isListElement=false);
00261
00263 void _openListElement();
00265 void _closeListElement();
00267 void _changeList();
00272 int _getListId() const;
00273
00274 void _openSpan();
00275 void _closeSpan();
00276
00277 void _flushText();
00278
00282 shared_ptr<MWAWPresentationListenerInternal::State> _pushParsingState();
00284 void _popParsingState();
00285
00286 protected:
00288 shared_ptr<MWAWPresentationListenerInternal::GraphicState> m_ds;
00290 shared_ptr<MWAWPresentationListenerInternal::State> m_ps;
00292 std::vector<shared_ptr<MWAWPresentationListenerInternal::State> > m_psStack;
00294 MWAWParserState &m_parserState;
00296 librevenge::RVNGPresentationInterface *m_documentInterface;
00297
00298 private:
00299 MWAWPresentationListener(const MWAWPresentationListener &);
00300 MWAWPresentationListener &operator=(const MWAWPresentationListener &);
00301 };
00302
00303 #endif
00304