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 <libwpd/libwpd.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
00060 class MWAWGraphicListener : public MWAWListener
00061 {
00062 public:
00064 MWAWGraphicListener(MWAWParserState &parserState);
00066 virtual ~MWAWGraphicListener();
00067
00069 void startGraphic(Box2f const &bdbox);
00071 bool endGraphic(WPXBinaryData &data, std::string &mimeType);
00073 bool isDocumentStarted() const;
00074
00076 void handleSubDocument(Vec2f const &orig, MWAWSubDocumentPtr subDocument, libmwaw::SubDocumentType subDocumentType);
00078 bool isSubDocumentOpened(libmwaw::SubDocumentType &subdocType) const;
00079
00080
00082 bool canWriteText() const;
00084 Box2f const &getGraphicBdBox();
00085
00086
00088 void insertChar(uint8_t character);
00091 void insertCharacter(unsigned char c);
00097 int insertCharacter(unsigned char c, MWAWInputStreamPtr &input, long endPos=-1);
00100 void insertUnicode(uint32_t character);
00102 void insertUnicodeString(WPXString const &str);
00103
00105 void insertTab();
00107 void insertEOL(bool softBreak=false);
00108
00109
00111 void setFont(MWAWFont const &font);
00113 MWAWFont const &getFont() const;
00114
00115
00117 bool isParagraphOpened() const;
00119 void setParagraph(MWAWParagraph const ¶graph);
00121 MWAWParagraph const &getParagraph() const;
00122
00123
00125 void insertField(MWAWField const &field);
00126
00127
00129 void insertPicture(Box2f const &bdbox, MWAWGraphicStyle const &style,
00130 const WPXBinaryData &binaryData, std::string type="image/pict");
00132 void insertPicture(Box2f const &bdbox, MWAWGraphicShape const &shape,
00133 MWAWGraphicStyle const &style);
00135 void insertTextBox(Box2f const &bdbox, MWAWSubDocumentPtr subDocument, MWAWGraphicStyle const &style);
00137 void insertGroup(Box2f const &bdbox, MWAWSubDocumentPtr subDocument);
00138
00140 bool canOpenSectionAddBreak() const {
00141 return false;
00142 }
00144 bool isSectionOpened() const {
00145 return false;
00146 }
00148 MWAWSection const &getSection() const;
00150 bool openSection(MWAWSection const §ion);
00152 bool closeSection() {
00153 return false;
00154 }
00156 void insertBreak(BreakType breakType);
00157
00158 protected:
00159 void _startSubDocument();
00160 void _endSubDocument();
00161
00162 void _handleFrameParameters(WPXPropertyList &propList, Box2f const &pos, MWAWGraphicStyle const &style);
00163 bool openFrame();
00164 void closeFrame();
00165
00166
00167 void _openParagraph();
00168 void _closeParagraph();
00169 void _resetParagraphState(const bool isListElement=false);
00170
00172 void _openListElement();
00174 void _closeListElement();
00176 void _changeList();
00181 int _getListId() const;
00182
00183 void _openSpan();
00184 void _closeSpan();
00185
00186 void _flushText();
00187
00191 shared_ptr<MWAWGraphicListenerInternal::State> _pushParsingState();
00193 void _popParsingState();
00194
00195 protected:
00197 shared_ptr<MWAWGraphicListenerInternal::GraphicState> m_gs;
00199 shared_ptr<MWAWGraphicListenerInternal::State> m_ps;
00201 std::vector<shared_ptr<MWAWGraphicListenerInternal::State> > m_psStack;
00203 MWAWParserState &m_parserState;
00204
00205 private:
00206 MWAWGraphicListener(const MWAWGraphicListener &);
00207 MWAWGraphicListener &operator=(const MWAWGraphicListener &);
00208 };
00209
00210 #endif
00211