MWAWListener.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2 
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33 
34 #ifndef MWAW_LISTENER_H
35 #define MWAW_LISTENER_H
36 
37 #include <vector>
38 
39 #include <librevenge/librevenge.h>
40 
41 #include "libmwaw_internal.hxx"
42 
43 #include "MWAWGraphicStyle.hxx"
44 
45 class MWAWCell;
46 class MWAWTable;
47 
50 {
51 public:
53  virtual ~MWAWListener() {}
54 
59 
60  //------- generic accessor ---
62  virtual Type getType() const = 0;
64  virtual bool canWriteText() const =0;
65 
66  // ------ main document -------
68  virtual void setDocumentLanguage(std::string locale) = 0;
70  virtual void startDocument() = 0;
72  virtual bool isDocumentStarted() const =0;
74  virtual void endDocument(bool sendDelayedSubDoc=true) = 0;
75 
76  // ------ page --------
78  virtual bool isPageSpanOpened() const = 0;
82  virtual MWAWPageSpan const &getPageSpan() = 0;
83 
84  // ------ header/footer --------
86  virtual bool insertHeader(MWAWSubDocumentPtr subDocument, librevenge::RVNGPropertyList const &extras) = 0;
88  virtual bool insertFooter(MWAWSubDocumentPtr subDocument, librevenge::RVNGPropertyList const &extras) = 0;
90  virtual bool isHeaderFooterOpened() const = 0;
91 
92  // ------ text data -----------
94  virtual void insertChar(uint8_t character)=0;
97  virtual void insertCharacter(unsigned char c)=0;
103  virtual int insertCharacter(unsigned char c, MWAWInputStreamPtr &input, long endPos=-1)=0;
106  virtual void insertUnicode(uint32_t character)=0;
108  virtual void insertUnicodeString(librevenge::RVNGString const &str)=0;
109 
111  virtual void insertTab()=0;
113  virtual void insertEOL(bool softBreak=false)=0;
114 
115  // ------ text format -----------
117  virtual void setFont(MWAWFont const &font)=0;
119  virtual MWAWFont const &getFont() const=0;
120 
121  // ------ paragraph format -----------
123  virtual bool isParagraphOpened() const=0;
125  virtual void setParagraph(MWAWParagraph const &paragraph)=0;
127  virtual MWAWParagraph const &getParagraph() const=0;
128 
129  // ------- fields ----------------
131  virtual void insertField(MWAWField const &field)=0;
132 
133  // ------- link ----------------
134 
136  virtual void openLink(MWAWLink const &link)=0;
138  virtual void closeLink()=0;
139 
140  // ------- table -----------------
142  virtual void openTable(MWAWTable const &table) = 0;
144  virtual void closeTable() = 0;
146  virtual void openTableRow(float h, librevenge::RVNGUnit unit, bool headerRow=false) = 0;
148  virtual void closeTableRow() = 0;
150  virtual void openTableCell(MWAWCell const &cell) = 0;
152  virtual void closeTableCell() = 0;
154  virtual void addEmptyTableCell(MWAWVec2i const &pos, MWAWVec2i span=MWAWVec2i(1,1)) = 0;
155 
156  // ------- section ---------------
158  virtual bool canOpenSectionAddBreak() const =0;
160  virtual bool isSectionOpened() const=0;
162  virtual MWAWSection const &getSection() const=0;
164  virtual bool openSection(MWAWSection const &section)=0;
166  virtual bool closeSection()=0;
168  virtual void insertBreak(BreakType breakType)=0;
169 
170  // ------- subdocument ---------------
172  virtual void insertNote(MWAWNote const &note, MWAWSubDocumentPtr &subDocument)=0;
174  virtual void insertComment(MWAWSubDocumentPtr &subDocument) = 0;
177  virtual void insertPicture(MWAWPosition const &pos, MWAWEmbeddedObject const &picture,
180  virtual void insertShape(MWAWPosition const &pos, MWAWGraphicShape const &shape,
181  MWAWGraphicStyle const &style) = 0;
183  virtual void insertTextBox(MWAWPosition const &pos, MWAWSubDocumentPtr subDocument,
184  MWAWGraphicStyle const &frameStyle=MWAWGraphicStyle::emptyStyle()) = 0;
186  virtual void insertTextBoxInShape(MWAWPosition const &pos, MWAWSubDocumentPtr subDocument,
187  MWAWGraphicShape const &/*shape*/,
189  {
190  static bool first=true;
191  if (first) {
192  MWAW_DEBUG_MSG(("MWAWListener::insertTextBoxInShape: umimplemented, revert to basic insertTextBox\n"));
193  first=false;
194  }
195  insertTextBox(pos, subDocument, frameStyle);
196  }
198  virtual bool openFrame(MWAWPosition const &pos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle()) = 0;
200  virtual void closeFrame() = 0;
202  virtual bool openGroup(MWAWPosition const &pos) = 0;
204  virtual void closeGroup() = 0;
206  virtual void handleSubDocument(MWAWSubDocumentPtr subDocument, libmwaw::SubDocumentType subDocumentType) = 0;
208  virtual bool isSubDocumentOpened(libmwaw::SubDocumentType &subdocType) const = 0;
209 };
210 
211 #endif
212 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:

Generated on Tue Mar 1 2016 23:42:50 for libmwaw by doxygen 1.8.4