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
45class MWAWCell;
46class MWAWTable;
47
50{
51public:
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 setDocumentMetaData(librevenge::RVNGPropertyList const &metadata) = 0;
70 virtual void setDocumentLanguage(std::string const &locale) = 0;
72 virtual void startDocument() = 0;
74 virtual bool isDocumentStarted() const =0;
76 virtual void endDocument(bool sendDelayedSubDoc=true) = 0;
77
78 // ------ page --------
80 virtual bool isPageSpanOpened() const = 0;
84 virtual MWAWPageSpan const &getPageSpan() = 0;
85
86 // ------ header/footer --------
88 virtual bool insertHeader(MWAWSubDocumentPtr const &subDocument, librevenge::RVNGPropertyList const &extras) = 0;
90 virtual bool insertFooter(MWAWSubDocumentPtr const &subDocument, librevenge::RVNGPropertyList const &extras) = 0;
92 virtual bool isHeaderFooterOpened() const = 0;
93
94 // ------ text data -----------
96 virtual void insertChar(uint8_t character)=0;
99 virtual void insertCharacter(unsigned char c)=0;
105 virtual int insertCharacter(unsigned char c, MWAWInputStreamPtr &input, long endPos=-1)=0;
108 virtual void insertUnicode(uint32_t character)=0;
110 virtual void insertUnicodeString(librevenge::RVNGString const &str)=0;
111
113 virtual void insertTab()=0;
115 virtual void insertEOL(bool softBreak=false)=0;
116
117 // ------ text format -----------
119 virtual void setFont(MWAWFont const &font)=0;
121 virtual MWAWFont const &getFont() const=0;
122
123 // ------ paragraph format -----------
125 virtual bool isParagraphOpened() const=0;
127 virtual void setParagraph(MWAWParagraph const &paragraph)=0;
129 virtual MWAWParagraph const &getParagraph() const=0;
130
131 // ------- fields ----------------
133 virtual void insertField(MWAWField const &field)=0;
134
135 // ------- link ----------------
136
138 virtual void openLink(MWAWLink const &link)=0;
140 virtual void closeLink()=0;
141
142 // ------- table -----------------
144 virtual void openTable(MWAWTable const &table) = 0;
146 virtual void closeTable() = 0;
148 virtual void openTableRow(float h, librevenge::RVNGUnit unit, bool headerRow=false) = 0;
150 virtual void closeTableRow() = 0;
152 virtual void openTableCell(MWAWCell const &cell) = 0;
154 virtual void closeTableCell() = 0;
156 virtual void addEmptyTableCell(MWAWVec2i const &pos, MWAWVec2i span=MWAWVec2i(1,1)) = 0;
157
158 // ------- section ---------------
160 virtual bool canOpenSectionAddBreak() const =0;
162 virtual bool isSectionOpened() const=0;
164 virtual MWAWSection const &getSection() const=0;
166 virtual bool openSection(MWAWSection const &section)=0;
168 virtual bool closeSection()=0;
170 virtual void insertBreak(BreakType breakType)=0;
171
172 // ------- subdocument ---------------
174 virtual void insertNote(MWAWNote const &note, MWAWSubDocumentPtr &subDocument)=0;
176 virtual void insertComment(MWAWSubDocumentPtr &subDocument) = 0;
179 virtual void insertPicture(MWAWPosition const &pos, MWAWEmbeddedObject const &picture,
182 virtual void insertShape(MWAWPosition const &pos, MWAWGraphicShape const &shape,
183 MWAWGraphicStyle const &style) = 0;
185 virtual void insertTextBox(MWAWPosition const &pos, MWAWSubDocumentPtr const &subDocument,
186 MWAWGraphicStyle const &frameStyle=MWAWGraphicStyle::emptyStyle()) = 0;
188 virtual void insertTextBoxInShape(MWAWPosition const &pos, MWAWSubDocumentPtr const &subDocument,
189 MWAWGraphicShape const &/*shape*/,
191 {
192 static bool first=true;
193 if (first) {
194 MWAW_DEBUG_MSG(("MWAWListener::insertTextBoxInShape: umimplemented, revert to basic insertTextBox\n"));
195 first=false;
196 }
197 insertTextBox(pos, subDocument, frameStyle);
198 }
200 virtual bool openFrame(MWAWPosition const &pos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle()) = 0;
202 virtual void closeFrame() = 0;
204 virtual bool openGroup(MWAWPosition const &pos) = 0;
206 virtual void closeGroup() = 0;
208 virtual void handleSubDocument(MWAWSubDocumentPtr const &subDocument, libmwaw::SubDocumentType subDocumentType) = 0;
210 virtual bool isSubDocumentOpened(libmwaw::SubDocumentType &subdocType) const = 0;
211};
212
213#endif
214// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
a structure used to define a cell and its format
Definition: MWAWCell.hxx:53
Class to store font.
Definition: MWAWFont.hxx:44
a structure used to define a picture shape
Definition: MWAWGraphicShape.hxx:46
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:48
static MWAWGraphicStyle emptyStyle()
returns an empty style.
Definition: MWAWGraphicStyle.hxx:477
This class contains a virtual interface to all listener.
Definition: MWAWListener.hxx:50
virtual bool isDocumentStarted() const =0
returns true if a document is opened
virtual Type getType() const =0
returns the listener type
virtual bool isSectionOpened() const =0
returns true if a section is opened
virtual void insertBreak(BreakType breakType)=0
inserts a break type: ColumBreak, PageBreak, ..
virtual bool insertHeader(MWAWSubDocumentPtr const &subDocument, librevenge::RVNGPropertyList const &extras)=0
insert a header (interaction with MWAWPageSpan which fills the parameters for openHeader)
virtual bool isPageSpanOpened() const =0
returns true if a page is opened
Type
the listener type
Definition: MWAWListener.hxx:56
@ Graphic
Definition: MWAWListener.hxx:56
@ Presentation
Definition: MWAWListener.hxx:56
@ Spreadsheet
Definition: MWAWListener.hxx:56
@ Text
Definition: MWAWListener.hxx:56
virtual bool openGroup(MWAWPosition const &pos)=0
low level: tries to open a group
virtual void insertTextBox(MWAWPosition const &pos, MWAWSubDocumentPtr const &subDocument, MWAWGraphicStyle const &frameStyle=MWAWGraphicStyle::emptyStyle())=0
adds a textbox in given position
virtual int insertCharacter(unsigned char c, MWAWInputStreamPtr &input, long endPos=-1)=0
insert a character using the font converter to find the utf8 character and if needed,...
virtual void insertCharacter(unsigned char c)=0
insert a character using the font converter to find the utf8 character
virtual void setFont(MWAWFont const &font)=0
sets the font
virtual void insertChar(uint8_t character)=0
adds a basic character, ..
virtual void insertEOL(bool softBreak=false)=0
adds an end of line ( by default an hard one)
virtual bool openFrame(MWAWPosition const &pos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())=0
low level: tries to open a frame
virtual MWAWParagraph const & getParagraph() const =0
returns the actual paragraph
virtual void setParagraph(MWAWParagraph const &paragraph)=0
sets the paragraph
virtual void handleSubDocument(MWAWSubDocumentPtr const &subDocument, libmwaw::SubDocumentType subDocumentType)=0
low level: function called to add a subdocument
virtual bool openSection(MWAWSection const &section)=0
open a section if possible
virtual MWAWPageSpan const & getPageSpan()=0
returns the current page span
BreakType
the different break type
Definition: MWAWListener.hxx:58
@ PageBreak
Definition: MWAWListener.hxx:58
@ SoftPageBreak
Definition: MWAWListener.hxx:58
@ ColumnBreak
Definition: MWAWListener.hxx:58
virtual void closeTableCell()=0
close a cell
virtual void openTableCell(MWAWCell const &cell)=0
open a cell
virtual void insertField(MWAWField const &field)=0
adds a field type
virtual void insertTab()=0
adds a tab
virtual void openTable(MWAWTable const &table)=0
open a table
virtual void closeTable()=0
closes this table
virtual void setDocumentLanguage(std::string const &locale)=0
sets the documents language
virtual void closeFrame()=0
low level: tries to close the last opened frame
virtual bool isParagraphOpened() const =0
returns true if a paragraph or a list is opened
virtual bool closeSection()=0
close a section
virtual ~MWAWListener()
destructor
Definition: MWAWListener.cxx:36
virtual void closeLink()=0
close a link
virtual void insertTextBoxInShape(MWAWPosition const &pos, MWAWSubDocumentPtr const &subDocument, MWAWGraphicShape const &, MWAWGraphicStyle const &frameStyle=MWAWGraphicStyle::emptyStyle())
adds a textbox in given position
Definition: MWAWListener.hxx:188
virtual MWAWFont const & getFont() const =0
returns the actual font
virtual void endDocument(bool sendDelayedSubDoc=true)=0
ends the document
virtual void addEmptyTableCell(MWAWVec2i const &pos, MWAWVec2i span=MWAWVec2i(1, 1))=0
add empty cell
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 isHeaderFooterOpened() const =0
returns true if the header/footer is open
virtual void openLink(MWAWLink const &link)=0
open a link
virtual void startDocument()=0
starts the document
virtual void insertUnicodeString(librevenge::RVNGString const &str)=0
adds a unicode string
virtual bool canOpenSectionAddBreak() const =0
returns true if we can add open a section, add page break, ...
virtual void setDocumentMetaData(librevenge::RVNGPropertyList const &metadata)=0
sets the documents metadata
virtual void insertUnicode(uint32_t character)=0
adds an unicode character.
virtual void closeGroup()=0
low level: tries to close the last opened group
virtual void insertNote(MWAWNote const &note, MWAWSubDocumentPtr &subDocument)=0
insert a note
virtual bool insertFooter(MWAWSubDocumentPtr const &subDocument, librevenge::RVNGPropertyList const &extras)=0
insert a footer (interaction with MWAWPageSpan which fills the parameters for openFooter)
virtual void insertShape(MWAWPosition const &pos, MWAWGraphicShape const &shape, MWAWGraphicStyle const &style)=0
adds a shape picture in given position
virtual bool canWriteText() const =0
returns true if we can add text data
virtual void insertPicture(MWAWPosition const &pos, MWAWEmbeddedObject const &picture, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())=0
adds a picture with various representationin given position.
virtual void insertComment(MWAWSubDocumentPtr &subDocument)=0
adds comment
virtual void closeTableRow()=0
closes this row
virtual MWAWSection const & getSection() const =0
returns the actual section
virtual bool isSubDocumentOpened(libmwaw::SubDocumentType &subdocType) const =0
returns true if a subdocument is open
A class which defines the page properties.
Definition: MWAWPageSpan.hxx:99
class to store the paragraph properties
Definition: MWAWParagraph.hxx:85
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: MWAWPosition.hxx:48
a class which stores section properties
Definition: MWAWSection.hxx:46
a class used to recreate the table structure using cell informations, ....
Definition: MWAWTable.hxx:52
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:838
std::shared_ptr< MWAWSubDocument > MWAWSubDocumentPtr
a smart pointer of MWAWSubDocument
Definition: libmwaw_internal.hxx:565
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:129
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
SubDocumentType
Definition: libmwaw_internal.hxx:188
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467
a field
Definition: libmwaw_internal.hxx:399
a note
Definition: libmwaw_internal.hxx:445

Generated on Thu Jan 19 2023 00:00:00 for libmwaw by doxygen 1.9.6