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;
176  virtual void insertPicture(MWAWPosition const &pos, const librevenge::RVNGBinaryData &binaryData,
177  std::string type="image/pict", MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle()) = 0;
179  virtual void insertPicture(MWAWPosition const &pos, MWAWGraphicShape const &shape,
180  MWAWGraphicStyle const &style) = 0;
182  virtual void insertTextBox(MWAWPosition const &pos, MWAWSubDocumentPtr subDocument,
183  MWAWGraphicStyle const &frameStyle=MWAWGraphicStyle::emptyStyle()) = 0;
185  virtual bool openFrame(MWAWPosition const &pos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle()) = 0;
187  virtual void closeFrame() = 0;
189  virtual void handleSubDocument(MWAWSubDocumentPtr subDocument, libmwaw::SubDocumentType subDocumentType) = 0;
191  virtual bool isSubDocumentOpened(libmwaw::SubDocumentType &subdocType) const = 0;
192 };
193 
194 #endif
195 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
virtual bool canOpenSectionAddBreak() const =0
returns true if we can add open a section, add page break, ...
virtual void startDocument()=0
starts the document
virtual void endDocument(bool sendDelayedSubDoc=true)=0
ends the document
virtual void insertCharacter(unsigned char c)=0
insert a character using the font converter to find the utf8 character
virtual bool openSection(MWAWSection const &section)=0
open a section if possible
virtual bool isSectionOpened() const =0
returns true if a section is opened
virtual bool isParagraphOpened() const =0
returns true if a paragraph or a list is opened
A class which defines the page properties.
Definition: MWAWPageSpan.hxx:95
virtual ~MWAWListener()
destructor
Definition: MWAWListener.hxx:53
virtual void closeTableCell()=0
close a cell
Definition: MWAWListener.hxx:58
virtual void insertUnicode(uint32_t character)=0
adds an unicode character.
Definition: MWAWListener.hxx:56
virtual void setParagraph(MWAWParagraph const &paragraph)=0
sets the paragraph
virtual void openLink(MWAWLink const &link)=0
open a link
virtual void insertComment(MWAWSubDocumentPtr &subDocument)=0
adds comment
virtual void openTable(MWAWTable const &table)=0
open a table
virtual void setFont(MWAWFont const &font)=0
sets the font
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
SubDocumentType
Definition: libmwaw_internal.hxx:173
Definition: MWAWListener.hxx:58
a class used to recreate the table structure using cell informations, ....
Definition: MWAWTable.hxx:51
virtual bool isHeaderFooterOpened() const =0
returns true if the header/footer is open
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:717
virtual void addEmptyTableCell(MWAWVec2i const &pos, MWAWVec2i span=MWAWVec2i(1, 1))=0
add empty cell
virtual MWAWFont const & getFont() const =0
returns the actual font
virtual bool isDocumentStarted() const =0
returns true if a document is opened
virtual void insertChar(uint8_t character)=0
adds a basic character, ..
Type
the listener type
Definition: MWAWListener.hxx:56
a structure used to define a cell and its format
Definition: MWAWCell.hxx:52
shared_ptr< MWAWSubDocument > MWAWSubDocumentPtr
a smart pointer of MWAWSubDocument
Definition: libmwaw_internal.hxx:453
virtual bool isPageSpanOpened() const =0
returns true if a page is opened
virtual void insertUnicodeString(librevenge::RVNGString const &str)=0
adds a unicode string
Class to store font.
Definition: MWAWFont.hxx:44
virtual void insertBreak(BreakType breakType)=0
inserts a break type: ColumBreak, PageBreak, ..
virtual void insertTextBox(MWAWPosition const &pos, MWAWSubDocumentPtr subDocument, MWAWGraphicStyle const &frameStyle=MWAWGraphicStyle::emptyStyle())=0
adds a textbox in given position
BreakType
the different break type
Definition: MWAWListener.hxx:58
virtual bool canWriteText() const =0
returns true if we can add text data
virtual void closeLink()=0
close a link
virtual void closeFrame()=0
low level: tries to close the last open frame
virtual bool insertFooter(MWAWSubDocumentPtr subDocument, librevenge::RVNGPropertyList const &extras)=0
insert a footer (interaction with MWAWPageSpan which fills the parameters for openFooter) ...
virtual void closeTableRow()=0
closes this row
virtual void insertPicture(MWAWPosition const &pos, const librevenge::RVNGBinaryData &binaryData, std::string type="image/pict", MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())=0
adds a picture in given position
virtual void insertEOL(bool softBreak=false)=0
adds an end of line ( by default an hard one)
virtual MWAWPageSpan const & getPageSpan()=0
returns the current page span
virtual MWAWSection const & getSection() const =0
returns the actual section
virtual void insertNote(MWAWNote const &note, MWAWSubDocumentPtr &subDocument)=0
insert a note
Definition: MWAWListener.hxx:58
a class which stores section properties
Definition: MWAWSection.hxx:45
Definition: MWAWListener.hxx:56
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:439
Definition: MWAWListener.hxx:56
virtual void openTableCell(MWAWCell const &cell)=0
open a cell
virtual void insertField(MWAWField const &field)=0
adds a field type
virtual MWAWParagraph const & getParagraph() const =0
returns the actual paragraph
Definition: MWAWListener.hxx:56
a structure used to define a picture shape
Definition: MWAWGraphicShape.hxx:45
virtual bool isSubDocumentOpened(libmwaw::SubDocumentType &subdocType) const =0
returns true if a subdocument is open
class to store the paragraph properties
Definition: MWAWParagraph.hxx:82
virtual void setDocumentLanguage(std::string locale)=0
sets the documents language
a field
Definition: libmwaw_internal.hxx:361
virtual bool openFrame(MWAWPosition const &pos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())=0
low level: tries to open a frame
virtual void insertTab()=0
adds a tab
virtual void handleSubDocument(MWAWSubDocumentPtr subDocument, libmwaw::SubDocumentType subDocumentType)=0
low level: function called to add a subdocument
a note
Definition: libmwaw_internal.hxx:394
virtual void closeTable()=0
closes this table
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
This class contains a virtual interface to all listener.
Definition: MWAWListener.hxx:49
virtual Type getType() const =0
returns the listener type
virtual void openTableRow(float h, librevenge::RVNGUnit unit, bool headerRow=false)=0
open a row with given height ( if h < 0.0, set min-row-height = -h )
virtual bool insertHeader(MWAWSubDocumentPtr subDocument, librevenge::RVNGPropertyList const &extras)=0
insert a header (interaction with MWAWPageSpan which fills the parameters for openHeader) ...
static MWAWGraphicStyle emptyStyle()
returns an empty style.
Definition: MWAWGraphicStyle.hxx:204
virtual bool closeSection()=0
close a section

Generated on Thu Jul 9 2015 20:26:36 for libmwaw by doxygen 1.8.8