STOFFListener.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 /* libstaroffice
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 STOFF_LISTENER_H
35 #define STOFF_LISTENER_H
36 
37 #include <vector>
38 
39 #include <librevenge/librevenge.h>
40 
42 
43 #include "STOFFGraphicStyle.hxx"
44 #include "STOFFPosition.hxx"
45 
46 class STOFFCell;
47 class STOFFTable;
48 
51 {
52 public:
54  virtual ~STOFFListener();
55 
60 
61  //------- generic accessor ---
63  virtual Type getType() const = 0;
65  virtual bool canWriteText() const =0;
68  {
69  return m_listManager;
70  }
71  // ------ main document -------
73  virtual void setDocumentLanguage(std::string locale) = 0;
75  virtual void setDocumentMetaData(const librevenge::RVNGPropertyList &list) = 0;
77  virtual void startDocument() = 0;
79  virtual bool isDocumentStarted() const =0;
81  virtual void endDocument(bool sendDelayedSubDoc=true) = 0;
82 
83  // ------ page --------
85  virtual bool isPageSpanOpened() const = 0;
89  virtual STOFFPageSpan const &getPageSpan() = 0;
90 
91  // ------ header/footer --------
93  virtual bool openHeader(librevenge::RVNGPropertyList const &extras) = 0;
95  virtual bool openFooter(librevenge::RVNGPropertyList const &extras) = 0;
97  virtual bool closeHeader() = 0;
99  virtual bool closeFooter() = 0;
101  virtual bool insertHeaderRegion(STOFFSubDocumentPtr subDocument, librevenge::RVNGString const &which) = 0;
103  virtual bool insertFooterRegion(STOFFSubDocumentPtr subDocument, librevenge::RVNGString const &which) = 0;
105  virtual bool isHeaderFooterOpened() const = 0;
106 
107  // ------ text data -----------
109  virtual void insertChar(uint8_t character)=0;
112  virtual void insertUnicode(uint32_t character)=0;
114  void insertUnicodeList(std::vector<uint32_t> const &list)
115  {
116  if (list.empty() || !canWriteText())
117  return;
118  for (unsigned int i : list) {
119  if (i==0x9) insertTab();
120  else if (i==0xa || i==0xc) insertEOL(); // checkme: use softBreak ?
121  else insertUnicode(i);
122  }
123  }
125  virtual void insertUnicodeString(librevenge::RVNGString const &str)=0;
126 
128  virtual void insertTab()=0;
130  virtual void insertEOL(bool softBreak=false)=0;
131 
132  // ------ text format -----------
134  virtual void setFont(STOFFFont const &font)=0;
136  virtual STOFFFont const &getFont() const=0;
137 
138  // ------ paragraph format -----------
140  virtual bool isParagraphOpened() const=0;
142  virtual void setParagraph(STOFFParagraph const &paragraph)=0;
144  virtual STOFFParagraph const &getParagraph() const=0;
145 
146  // ------ style definition -----------
148  virtual void defineStyle(STOFFFont const &style) = 0;
150  virtual bool isFontStyleDefined(librevenge::RVNGString const &name) const = 0;
152  virtual void defineStyle(STOFFGraphicStyle const &style) = 0;
154  virtual bool isGraphicStyleDefined(librevenge::RVNGString const &name) const = 0;
156  virtual void defineStyle(STOFFParagraph const &style) = 0;
158  virtual bool isParagraphStyleDefined(librevenge::RVNGString const &name) const = 0;
159  // ------- fields ----------------
161  virtual void insertField(STOFFField const &field)=0;
162 
163  // ------- link ----------------
164 
166  virtual void openLink(STOFFLink const &link)=0;
168  virtual void closeLink()=0;
169 
170  // ------- table -----------------
172  virtual void openTable(STOFFTable const &table) = 0;
174  virtual void closeTable() = 0;
176  virtual void openTableRow(float h, librevenge::RVNGUnit unit, bool headerRow=false) = 0;
178  virtual void closeTableRow() = 0;
180  virtual void openTableCell(STOFFCell const &cell) = 0;
182  virtual void closeTableCell() = 0;
184  virtual void addCoveredTableCell(STOFFVec2i const &pos) = 0;
186  virtual void addEmptyTableCell(STOFFVec2i const &pos, STOFFVec2i span=STOFFVec2i(1,1)) = 0;
187 
188  // ------- section ---------------
190  virtual bool canOpenSectionAddBreak() const =0;
192  virtual bool isSectionOpened() const=0;
194  virtual STOFFSection const &getSection() const=0;
196  virtual bool openSection(STOFFSection const &section)=0;
198  virtual bool closeSection()=0;
200  virtual void insertBreak(BreakType breakType)=0;
201 
202  // ------- subdocument ---------------
204  virtual void insertNote(STOFFNote const &note, STOFFSubDocumentPtr &subDocument)=0;
206  virtual void insertComment(STOFFSubDocumentPtr &subDocument, librevenge::RVNGString const &creator="", librevenge::RVNGString const &date="") = 0;
208  virtual void insertEquation(STOFFFrameStyle const &frame, librevenge::RVNGString const &equation,
209  STOFFGraphicStyle const &style=STOFFGraphicStyle()) = 0;
212  virtual void insertPicture(STOFFFrameStyle const &frame, STOFFEmbeddedObject const &picture,
213  STOFFGraphicStyle const &style=STOFFGraphicStyle())=0;
215  virtual void insertShape(STOFFFrameStyle const &frame, STOFFGraphicShape const &shape, STOFFGraphicStyle const &style) = 0;
217  virtual void insertTextBox(STOFFFrameStyle const &frame, STOFFSubDocumentPtr subDocument,
218  STOFFGraphicStyle const &frameStyle=STOFFGraphicStyle()) = 0;
219 #if 0
220 
221  virtual void insertTextBoxInShape(STOFFFrameStyle const &frame, STOFFSubDocumentPtr subDocument,
222  STOFFGraphicShape const &/*shape*/,
223  STOFFGraphicStyle const &frameStyle=STOFFGraphicStyle())
224  {
225  static bool first=true;
226  if (first) {
227  STOFF_DEBUG_MSG(("STOFFListener::insertTextBoxInShape: umimplemented, revert to basic insertTextBox\n"));
228  first=false;
229  }
230  insertTextBox(frame, subDocument, frameStyle);
231  }
232 #endif
233 
234  virtual bool openFrame(STOFFFrameStyle const &frame, STOFFGraphicStyle const &style=STOFFGraphicStyle()) = 0;
236  virtual void closeFrame() = 0;
238  virtual bool openGroup(STOFFFrameStyle const &frame) = 0;
240  virtual void closeGroup() = 0;
242  virtual void handleSubDocument(STOFFSubDocumentPtr subDocument, libstoff::SubDocumentType subDocumentType) = 0;
244  virtual bool isSubDocumentOpened(libstoff::SubDocumentType &subdocType) const = 0;
245 
246 protected:
248  explicit STOFFListener(STOFFListManagerPtr &listManager);
251 };
252 
253 #endif
254 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
STOFFListener::closeFooter
virtual bool closeFooter()=0
close a footer
STOFFParagraph
class to store the paragraph properties
Definition: STOFFParagraph.hxx:47
STOFFField
a field
Definition: libstaroffice_internal.hxx:363
STOFFVec2< int >
STOFFListener::closeTableCell
virtual void closeTableCell()=0
close a cell
STOFFListener::openTable
virtual void openTable(STOFFTable const &table)=0
open a table
STOFFListener::isSectionOpened
virtual bool isSectionOpened() const =0
returns true if a section is opened
STOFFListener::closeLink
virtual void closeLink()=0
close a link
STOFF_DEBUG_MSG
#define STOFF_DEBUG_MSG(M)
Definition: libstaroffice_internal.hxx:129
STOFFListener::insertHeaderRegion
virtual bool insertHeaderRegion(STOFFSubDocumentPtr subDocument, librevenge::RVNGString const &which)=0
insert a header
STOFFListener::insertEOL
virtual void insertEOL(bool softBreak=false)=0
adds an end of line ( by default an hard one)
STOFFListener::closeTableRow
virtual void closeTableRow()=0
closes this row
STOFFListener::m_listManager
STOFFListManagerPtr m_listManager
the list manager
Definition: STOFFListener.hxx:250
STOFFListener::startDocument
virtual void startDocument()=0
starts the document
STOFFGraphicShape
a structure used to define a picture shape
Definition: STOFFGraphicShape.hxx:45
STOFFListener::Type
Type
the listener type
Definition: STOFFListener.hxx:57
STOFFListener::BreakType
BreakType
the different break type
Definition: STOFFListener.hxx:59
STOFFFrameStyle
Class to store a frame style.
Definition: STOFFFrameStyle.hxx:45
STOFFListener::Text
Definition: STOFFListener.hxx:57
STOFFListener::setDocumentMetaData
virtual void setDocumentMetaData(const librevenge::RVNGPropertyList &list)=0
sets the document meta data
STOFFPageSpan
A class which defines the page properties.
Definition: STOFFPageSpan.hxx:75
STOFFListener::isHeaderFooterOpened
virtual bool isHeaderFooterOpened() const =0
returns true if the header/footer is open
STOFFListener::openTableRow
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 )
STOFFListener::getParagraph
virtual const STOFFParagraph & getParagraph() const =0
returns the actual paragraph
STOFFCell
a structure used to define a cell and its format
Definition: STOFFCell.hxx:53
STOFFListener::closeGroup
virtual void closeGroup()=0
low level: tries to close the last opened group
STOFFListener::insertTextBox
virtual void insertTextBox(STOFFFrameStyle const &frame, STOFFSubDocumentPtr subDocument, STOFFGraphicStyle const &frameStyle=STOFFGraphicStyle())=0
adds a textbox in given position
STOFFListener::setDocumentLanguage
virtual void setDocumentLanguage(std::string locale)=0
sets the documents language
STOFFNote
a note
Definition: libstaroffice_internal.hxx:389
STOFFListener::insertPicture
virtual void insertPicture(STOFFFrameStyle const &frame, STOFFEmbeddedObject const &picture, STOFFGraphicStyle const &style=STOFFGraphicStyle())=0
adds a picture with various representationin given position.
STOFFListener::insertComment
virtual void insertComment(STOFFSubDocumentPtr &subDocument, librevenge::RVNGString const &creator="", librevenge::RVNGString const &date="")=0
adds comment
STOFFEmbeddedObject
small class use to define a embedded object
Definition: libstaroffice_internal.hxx:408
libstaroffice_internal.hxx
STOFFListener::openSection
virtual bool openSection(STOFFSection const &section)=0
open a section if possible
STOFFListener::~STOFFListener
virtual ~STOFFListener()
destructor
Definition: STOFFListener.cxx:48
STOFFListener::getFont
virtual const STOFFFont & getFont() const =0
returns the actual font
STOFFListener::insertChar
virtual void insertChar(uint8_t character)=0
adds a basic character, ..
STOFFListener::STOFFListener
STOFFListener(STOFFListManagerPtr &listManager)
constructor
Definition: STOFFListener.cxx:41
STOFFListener::addEmptyTableCell
virtual void addEmptyTableCell(STOFFVec2i const &pos, STOFFVec2i span=STOFFVec2i(1, 1))=0
add empty cell
STOFFListener::isParagraphOpened
virtual bool isParagraphOpened() const =0
returns true if a paragraph or a list is opened
STOFFListener::SoftPageBreak
Definition: STOFFListener.hxx:59
STOFFSubDocumentPtr
std::shared_ptr< STOFFSubDocument > STOFFSubDocumentPtr
a smart pointer of STOFFSubDocument
Definition: libstaroffice_internal.hxx:495
STOFFListener::openGroup
virtual bool openGroup(STOFFFrameStyle const &frame)=0
low level: tries to open a group
STOFFListener.hxx
STOFFListManager
a manager which manages the lists, keeps the different kind of lists, to assure the unicity of each l...
Definition: STOFFList.hxx:205
STOFFList.hxx
STOFFListener::closeTable
virtual void closeTable()=0
closes this table
libstoff::SubDocumentType
SubDocumentType
Definition: libstaroffice_internal.hxx:185
STOFFListener::closeHeader
virtual bool closeHeader()=0
close a header
STOFFListener::openFooter
virtual bool openFooter(librevenge::RVNGPropertyList const &extras)=0
open a footer (interaction with STOFFPageSpan which fills the parameters for openFooter)
STOFFListener::insertBreak
virtual void insertBreak(BreakType breakType)=0
inserts a break type: ColumBreak, PageBreak, ..
STOFFListener::isGraphicStyleDefined
virtual bool isGraphicStyleDefined(librevenge::RVNGString const &name) const =0
check if a graphic style with a display name is already defined
STOFFTable
a class used to recreate the table structure using cell informations, ....
Definition: STOFFTable.hxx:51
STOFFListener::getListManager
STOFFListManagerPtr getListManager() const
return the list manager
Definition: STOFFListener.hxx:67
STOFFListener::isFontStyleDefined
virtual bool isFontStyleDefined(librevenge::RVNGString const &name) const =0
check if a font style with a display name is already defined
STOFFListener::insertShape
virtual void insertShape(STOFFFrameStyle const &frame, STOFFGraphicShape const &shape, STOFFGraphicStyle const &style)=0
adds a shape picture in given position
STOFFListener::openLink
virtual void openLink(STOFFLink const &link)=0
open a link
STOFFGraphicStyle.hxx
STOFFListener::setParagraph
virtual void setParagraph(STOFFParagraph const &paragraph)=0
sets the paragraph
STOFFListener::insertUnicodeList
void insertUnicodeList(std::vector< uint32_t > const &list)
try to insert a list of unicode character
Definition: STOFFListener.hxx:114
STOFFListener::openFrame
virtual bool openFrame(STOFFFrameStyle const &frame, STOFFGraphicStyle const &style=STOFFGraphicStyle())=0
low level: tries to open a frame
STOFFListener::isSubDocumentOpened
virtual bool isSubDocumentOpened(libstoff::SubDocumentType &subdocType) const =0
returns true if a subdocument is open
STOFFListener::closeSection
virtual bool closeSection()=0
close a section
STOFFFont
Class to store font.
Definition: STOFFFont.hxx:43
STOFFListener::Spreadsheet
Definition: STOFFListener.hxx:57
STOFFListener::insertFooterRegion
virtual bool insertFooterRegion(STOFFSubDocumentPtr subDocument, librevenge::RVNGString const &which)=0
insert a footer
STOFFGraphicStyle
Class to store a graphic style.
Definition: STOFFGraphicStyle.hxx:44
STOFFListener::getPageSpan
virtual const STOFFPageSpan & getPageSpan()=0
returns the current page span
STOFFListener::canWriteText
virtual bool canWriteText() const =0
returns true if we can add text data
STOFFListener::isDocumentStarted
virtual bool isDocumentStarted() const =0
returns true if a document is opened
STOFFListener::closeFrame
virtual void closeFrame()=0
low level: tries to close the last opened frame
STOFFListener::isParagraphStyleDefined
virtual bool isParagraphStyleDefined(librevenge::RVNGString const &name) const =0
check if a paragraph style with a display name is already defined
STOFFListener::addCoveredTableCell
virtual void addCoveredTableCell(STOFFVec2i const &pos)=0
add covered cell
STOFFSection
a class which stores section properties
Definition: STOFFSection.hxx:45
STOFFListener::handleSubDocument
virtual void handleSubDocument(STOFFSubDocumentPtr subDocument, libstoff::SubDocumentType subDocumentType)=0
low level: function called to add a subdocument
STOFFListener::endDocument
virtual void endDocument(bool sendDelayedSubDoc=true)=0
ends the document
STOFFListener::openTableCell
virtual void openTableCell(STOFFCell const &cell)=0
open a cell
STOFFListener::getType
virtual Type getType() const =0
returns the listener type
STOFFListManagerPtr
std::shared_ptr< STOFFListManager > STOFFListManagerPtr
a smart pointer of STOFFListManager
Definition: libstaroffice_internal.hxx:489
STOFFListener::PageBreak
Definition: STOFFListener.hxx:59
STOFFPosition.hxx
STOFFListener::insertUnicodeString
virtual void insertUnicodeString(librevenge::RVNGString const &str)=0
adds a unicode string
STOFFListener::insertTab
virtual void insertTab()=0
adds a tab
STOFFListener::getSection
virtual const STOFFSection & getSection() const =0
returns the actual section
STOFFListener::Graphic
Definition: STOFFListener.hxx:57
STOFFListener
This class contains a virtual interface to all listener.
Definition: STOFFListener.hxx:50
STOFFListener::ColumnBreak
Definition: STOFFListener.hxx:59
STOFFListener::isPageSpanOpened
virtual bool isPageSpanOpened() const =0
returns true if a page is opened
STOFFListener::openHeader
virtual bool openHeader(librevenge::RVNGPropertyList const &extras)=0
open a header (interaction with STOFFPageSpan which fills the parameters for openHeader)
STOFFVec2i
STOFFVec2< int > STOFFVec2i
STOFFVec2 of int.
Definition: libstaroffice_internal.hxx:763
STOFFFont.hxx
STOFFListener::insertField
virtual void insertField(STOFFField const &field)=0
adds a field type
STOFFListener::defineStyle
virtual void defineStyle(STOFFFont const &style)=0
defines a font styles
STOFFListener::canOpenSectionAddBreak
virtual bool canOpenSectionAddBreak() const =0
returns true if we can add open a section, add page break, ...
STOFFListener::insertEquation
virtual void insertEquation(STOFFFrameStyle const &frame, librevenge::RVNGString const &equation, STOFFGraphicStyle const &style=STOFFGraphicStyle())=0
adds a equation given a position
STOFFListener::Presentation
Definition: STOFFListener.hxx:57
STOFFListener::insertNote
virtual void insertNote(STOFFNote const &note, STOFFSubDocumentPtr &subDocument)=0
insert a note
STOFFListener::insertUnicode
virtual void insertUnicode(uint32_t character)=0
adds an unicode character.
STOFFListener::setFont
virtual void setFont(STOFFFont const &font)=0
sets the font

Generated on Mon Jan 20 2020 23:02:18 for libstaroffice by doxygen 1.8.16