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_TEXT_LISTENER_H
00035 #define STOFF_TEXT_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 STOFFTextShape;
00048
00049 namespace STOFFTextListenerInternal
00050 {
00051 struct TextState;
00052 struct State;
00053 }
00054
00059 class STOFFTextListener : public STOFFListener
00060 {
00061 public:
00063 STOFFTextListener(STOFFListManagerPtr listManager, std::vector<STOFFPageSpan> const &pageList, librevenge::RVNGTextInterface *documentInterface);
00065 virtual ~STOFFTextListener();
00066
00068 Type getType() const
00069 {
00070 return Text;
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
00085 {
00086 return STOFFTextListener::isDocumentStarted();
00087 }
00088
00090 bool isDocumentStarted() const;
00091
00093 void handleSubDocument(STOFFSubDocumentPtr subDocument, libstoff::SubDocumentType subDocumentType);
00095 bool isSubDocumentOpened(libstoff::SubDocumentType &subdocType) const;
00097 bool openFrame(STOFFPosition const &pos, STOFFGraphicStyle const &style=STOFFGraphicStyle());
00099 void closeFrame();
00101 bool openGroup(STOFFPosition const &pos);
00103 void closeGroup();
00105 bool openLayer(librevenge::RVNGString const &name);
00107 void closeLayer();
00108
00109
00111 bool openMasterPage(STOFFPageSpan &);
00113 void closeMasterPage()
00114 {
00115 }
00117 bool isPageSpanOpened() const;
00121 STOFFPageSpan const &getPageSpan();
00122
00123
00125 bool openHeader(librevenge::RVNGPropertyList const &extras);
00127 bool openFooter(librevenge::RVNGPropertyList const &extras);
00129 bool closeHeader();
00131 bool closeFooter();
00133 bool insertHeaderRegion(STOFFSubDocumentPtr subDocument, librevenge::RVNGString const &which);
00135 bool insertFooterRegion(STOFFSubDocumentPtr subDocument, librevenge::RVNGString const &which);
00137 bool isHeaderFooterOpened() const;
00138
00139
00141 void insertChar(uint8_t character);
00146 void insertUnicode(uint32_t character);
00148 void insertUnicodeString(librevenge::RVNGString const &str);
00149
00151 void insertTab();
00153 void insertEOL(bool softBreak=false);
00154
00155
00157 void setFont(STOFFFont const &font);
00159 STOFFFont const &getFont() const;
00160
00161
00163 bool isParagraphOpened() const;
00165 void setParagraph(STOFFParagraph const ¶graph);
00167 STOFFParagraph const &getParagraph() const;
00168
00169
00171 void defineStyle(STOFFFont const &style);
00173 bool isFontStyleDefined(librevenge::RVNGString const &name) const;
00175 void defineStyle(STOFFGraphicStyle const &style);
00177 bool isGraphicStyleDefined(librevenge::RVNGString const &name) const;
00179 void defineStyle(STOFFParagraph const &style);
00181 bool isParagraphStyleDefined(librevenge::RVNGString const &name) const;
00182
00183
00185 void insertField(STOFFField const &field);
00186
00187
00189 void openLink(STOFFLink const &link);
00191 void closeLink();
00192
00193
00195 void insertShape(STOFFGraphicShape const &shape, STOFFGraphicStyle const &style, STOFFPosition const &pos);
00197 void insertTextBox(STOFFPosition const &pos, STOFFSubDocumentPtr subDocument, STOFFGraphicStyle const &style=STOFFGraphicStyle());
00199 void insertPicture(STOFFPosition const &pos, STOFFEmbeddedObject const &picture,
00200 STOFFGraphicStyle const &style=STOFFGraphicStyle());
00202 void insertNote(STOFFNote const ¬e, STOFFSubDocumentPtr &subDocument);
00204 void insertComment(STOFFSubDocumentPtr &subDocument, librevenge::RVNGString const &creator="", librevenge::RVNGString const &date="");
00205
00206
00207
00209 void insertTable(STOFFPosition const &pos, STOFFTable &table, STOFFGraphicStyle const &style=STOFFGraphicStyle());
00211 void openTable(STOFFTable const &table);
00213 void openTable(STOFFPosition const &pos, STOFFTable const &table);
00215 void closeTable();
00217 void openTableRow(float h, librevenge::RVNGUnit unit, bool headerRow=false);
00219 void closeTableRow();
00221 void openTableCell(STOFFCell const &cell);
00223 void closeTableCell();
00225 void addEmptyTableCell(STOFFVec2i const &pos, STOFFVec2i span=STOFFVec2i(1,1));
00226
00227
00228
00230 bool canOpenSectionAddBreak() const;
00232 bool isSectionOpened() const;
00234 STOFFSection const &getSection() const;
00236 bool openSection(STOFFSection const §ion);
00238 bool closeSection();
00240 void insertBreak(BreakType breakType);
00241
00242 protected:
00244 void _openSection();
00246 void _closeSection();
00248 void _openPageSpan(bool sendHeaderFooters=true);
00250 void _closePageSpan();
00251
00252 void _startSubDocument();
00253 void _endSubDocument();
00254
00258 void _handleFrameParameters(librevenge::RVNGPropertyList &propList, STOFFPosition const &pos, STOFFGraphicStyle const &style);
00259
00260 void _openParagraph();
00261 void _closeParagraph();
00262 void _appendParagraphProperties(librevenge::RVNGPropertyList &propList, const bool isListElement=false);
00263 void _resetParagraphState(const bool isListElement=false);
00264
00266 void _openListElement();
00268 void _closeListElement();
00270 void _changeList();
00275 int _getListId() const;
00276
00278 void _openSpan();
00280 void _closeSpan();
00281
00283 void _flushText();
00285 void _flushDeferredTabs();
00286
00287 void _insertBreakIfNecessary(librevenge::RVNGPropertyList &propList);
00288
00292 shared_ptr<STOFFTextListenerInternal::State> _pushParsingState();
00294 void _popParsingState();
00295
00296 protected:
00298 shared_ptr<STOFFTextListenerInternal::TextState> m_ds;
00300 shared_ptr<STOFFTextListenerInternal::State> m_ps;
00302 std::vector<shared_ptr<STOFFTextListenerInternal::State> > m_psStack;
00304 librevenge::RVNGTextInterface *m_documentInterface;
00305
00306 private:
00307 STOFFTextListener(const STOFFTextListener &);
00308 STOFFTextListener &operator=(const STOFFTextListener &);
00309 };
00310
00311 #endif
00312