MWAWListener.hxx
Go to the documentation of this file.
/* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
/* libmwaw
* Version: MPL 2.0 / LGPLv2+
*
* The contents of this file are subject to the Mozilla Public License Version
* 2.0 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* Copyright (C) 2002 William Lachance (wrlach@gmail.com)
* Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
* Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
* Copyright (C) 2006, 2007 Andrew Ziem
* Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
*
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
* in which case the provisions of the LGPLv2+ are applicable
* instead of those above.
*/
#ifndef MWAW_LISTENER_H
#define MWAW_LISTENER_H
#include <vector>
#include <librevenge/librevenge.h>
#include "libmwaw_internal.hxx"
#include "MWAWGraphicStyle.hxx"
class MWAWCell;
class MWAWTable;
class MWAWListener
{
public:
virtual ~MWAWListener();
enum Type { Graphic, Presentation, Spreadsheet, Text };
enum BreakType { PageBreak=0, SoftPageBreak, ColumnBreak };
//------- generic accessor ---
virtual Type getType() const = 0;
virtual bool canWriteText() const =0;
// ------ main document -------
virtual void setDocumentMetaData(librevenge::RVNGPropertyList const &metadata) = 0;
virtual void setDocumentLanguage(std::string const &locale) = 0;
virtual void startDocument() = 0;
virtual bool isDocumentStarted() const =0;
virtual void endDocument(bool sendDelayedSubDoc=true) = 0;
// ------ page --------
virtual bool isPageSpanOpened() const = 0;
virtual MWAWPageSpan const &getPageSpan() = 0;
// ------ header/footer --------
virtual bool insertHeader(MWAWSubDocumentPtr const &subDocument, librevenge::RVNGPropertyList const &extras) = 0;
virtual bool insertFooter(MWAWSubDocumentPtr const &subDocument, librevenge::RVNGPropertyList const &extras) = 0;
virtual bool isHeaderFooterOpened() const = 0;
// ------ text data -----------
virtual void insertChar(uint8_t character)=0;
virtual void insertCharacter(unsigned char c)=0;
virtual int insertCharacter(unsigned char c, MWAWInputStreamPtr &input, long endPos=-1)=0;
virtual void insertUnicode(uint32_t character)=0;
virtual void insertUnicodeString(librevenge::RVNGString const &str)=0;
virtual void insertTab()=0;
virtual void insertEOL(bool softBreak=false)=0;
// ------ text format -----------
virtual void setFont(MWAWFont const &font)=0;
virtual MWAWFont const &getFont() const=0;
// ------ paragraph format -----------
virtual bool isParagraphOpened() const=0;
virtual void setParagraph(MWAWParagraph const &paragraph)=0;
virtual MWAWParagraph const &getParagraph() const=0;
// ------- fields ----------------
virtual void insertField(MWAWField const &field)=0;
// ------- link ----------------
virtual void openLink(MWAWLink const &link)=0;
virtual void closeLink()=0;
// ------- table -----------------
virtual void openTable(MWAWTable const &table) = 0;
virtual void closeTable() = 0;
virtual void openTableRow(float h, librevenge::RVNGUnit unit, bool headerRow=false) = 0;
virtual void closeTableRow() = 0;
virtual void openTableCell(MWAWCell const &cell) = 0;
virtual void closeTableCell() = 0;
virtual void addEmptyTableCell(MWAWVec2i const &pos, MWAWVec2i span=MWAWVec2i(1,1)) = 0;
// ------- section ---------------
virtual bool canOpenSectionAddBreak() const =0;
virtual bool isSectionOpened() const=0;
virtual MWAWSection const &getSection() const=0;
virtual bool openSection(MWAWSection const &section)=0;
virtual bool closeSection()=0;
virtual void insertBreak(BreakType breakType)=0;
// ------- subdocument ---------------
virtual void insertNote(MWAWNote const &note, MWAWSubDocumentPtr &subDocument)=0;
virtual void insertComment(MWAWSubDocumentPtr &subDocument) = 0;
virtual void insertPicture(MWAWPosition const &pos, MWAWEmbeddedObject const &picture,
MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())=0;
virtual void insertShape(MWAWPosition const &pos, MWAWGraphicShape const &shape,
MWAWGraphicStyle const &style) = 0;
virtual void insertTextBox(MWAWPosition const &pos, MWAWSubDocumentPtr const &subDocument,
MWAWGraphicStyle const &frameStyle=MWAWGraphicStyle::emptyStyle()) = 0;
virtual void insertTextBoxInShape(MWAWPosition const &pos, MWAWSubDocumentPtr const &subDocument,
MWAWGraphicShape const &/*shape*/,
MWAWGraphicStyle const &frameStyle=MWAWGraphicStyle::emptyStyle())
{
static bool first=true;
if (first) {
MWAW_DEBUG_MSG(("MWAWListener::insertTextBoxInShape: umimplemented, revert to basic insertTextBox\n"));
first=false;
}
insertTextBox(pos, subDocument, frameStyle);
}
virtual bool openFrame(MWAWPosition const &pos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle()) = 0;
virtual void closeFrame() = 0;
virtual bool openGroup(MWAWPosition const &pos) = 0;
virtual void closeGroup() = 0;
virtual void handleSubDocument(MWAWSubDocumentPtr const &subDocument, libmwaw::SubDocumentType subDocumentType) = 0;
virtual bool isSubDocumentOpened(libmwaw::SubDocumentType &subdocType) const = 0;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWGraphicStyle.hxx
MWAWCell
a structure used to define a cell and its format
Definition MWAWCell.hxx:53
MWAWFont
Class to store font.
Definition MWAWFont.hxx:44
MWAWGraphicShape
a structure used to define a picture shape
Definition MWAWGraphicShape.hxx:46
MWAWGraphicStyle
a structure used to define a picture style
Definition MWAWGraphicStyle.hxx:48
MWAWGraphicStyle::emptyStyle
static MWAWGraphicStyle emptyStyle()
returns an empty style.
Definition MWAWGraphicStyle.hxx:477
MWAWListener
This class contains a virtual interface to all listener.
Definition MWAWListener.hxx:50
MWAWListener::isDocumentStarted
virtual bool isDocumentStarted() const =0
returns true if a document is opened
MWAWListener::getType
virtual Type getType() const =0
returns the listener type
MWAWListener::isSectionOpened
virtual bool isSectionOpened() const =0
returns true if a section is opened
MWAWListener::insertBreak
virtual void insertBreak(BreakType breakType)=0
inserts a break type: ColumBreak, PageBreak, ..
MWAWListener::insertHeader
virtual bool insertHeader(MWAWSubDocumentPtr const &subDocument, librevenge::RVNGPropertyList const &extras)=0
insert a header (interaction with MWAWPageSpan which fills the parameters for openHeader)
MWAWListener::isPageSpanOpened
virtual bool isPageSpanOpened() const =0
returns true if a page is opened
MWAWListener::Type
Type
the listener type
Definition MWAWListener.hxx:56
MWAWListener::Graphic
@ Graphic
Definition MWAWListener.hxx:56
MWAWListener::Presentation
@ Presentation
Definition MWAWListener.hxx:56
MWAWListener::Spreadsheet
@ Spreadsheet
Definition MWAWListener.hxx:56
MWAWListener::Text
@ Text
Definition MWAWListener.hxx:56
MWAWListener::openGroup
virtual bool openGroup(MWAWPosition const &pos)=0
low level: tries to open a group
MWAWListener::insertTextBox
virtual void insertTextBox(MWAWPosition const &pos, MWAWSubDocumentPtr const &subDocument, MWAWGraphicStyle const &frameStyle=MWAWGraphicStyle::emptyStyle())=0
adds a textbox in given position
MWAWListener::insertCharacter
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,...
MWAWListener::insertCharacter
virtual void insertCharacter(unsigned char c)=0
insert a character using the font converter to find the utf8 character
MWAWListener::setFont
virtual void setFont(MWAWFont const &font)=0
sets the font
MWAWListener::insertChar
virtual void insertChar(uint8_t character)=0
adds a basic character, ..
MWAWListener::insertEOL
virtual void insertEOL(bool softBreak=false)=0
adds an end of line ( by default an hard one)
MWAWListener::openFrame
virtual bool openFrame(MWAWPosition const &pos, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())=0
low level: tries to open a frame
MWAWListener::getParagraph
virtual MWAWParagraph const & getParagraph() const =0
returns the actual paragraph
MWAWListener::setParagraph
virtual void setParagraph(MWAWParagraph const &paragraph)=0
sets the paragraph
MWAWListener::handleSubDocument
virtual void handleSubDocument(MWAWSubDocumentPtr const &subDocument, libmwaw::SubDocumentType subDocumentType)=0
low level: function called to add a subdocument
MWAWListener::openSection
virtual bool openSection(MWAWSection const &section)=0
open a section if possible
MWAWListener::getPageSpan
virtual MWAWPageSpan const & getPageSpan()=0
returns the current page span
MWAWListener::BreakType
BreakType
the different break type
Definition MWAWListener.hxx:58
MWAWListener::PageBreak
@ PageBreak
Definition MWAWListener.hxx:58
MWAWListener::SoftPageBreak
@ SoftPageBreak
Definition MWAWListener.hxx:58
MWAWListener::ColumnBreak
@ ColumnBreak
Definition MWAWListener.hxx:58
MWAWListener::closeTableCell
virtual void closeTableCell()=0
close a cell
MWAWListener::openTableCell
virtual void openTableCell(MWAWCell const &cell)=0
open a cell
MWAWListener::insertField
virtual void insertField(MWAWField const &field)=0
adds a field type
MWAWListener::insertTab
virtual void insertTab()=0
adds a tab
MWAWListener::openTable
virtual void openTable(MWAWTable const &table)=0
open a table
MWAWListener::closeTable
virtual void closeTable()=0
closes this table
MWAWListener::setDocumentLanguage
virtual void setDocumentLanguage(std::string const &locale)=0
sets the documents language
MWAWListener::closeFrame
virtual void closeFrame()=0
low level: tries to close the last opened frame
MWAWListener::isParagraphOpened
virtual bool isParagraphOpened() const =0
returns true if a paragraph or a list is opened
MWAWListener::closeSection
virtual bool closeSection()=0
close a section
MWAWListener::~MWAWListener
virtual ~MWAWListener()
destructor
Definition MWAWListener.cxx:36
MWAWListener::closeLink
virtual void closeLink()=0
close a link
MWAWListener::insertTextBoxInShape
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
MWAWListener::getFont
virtual MWAWFont const & getFont() const =0
returns the actual font
MWAWListener::endDocument
virtual void endDocument(bool sendDelayedSubDoc=true)=0
ends the document
MWAWListener::addEmptyTableCell
virtual void addEmptyTableCell(MWAWVec2i const &pos, MWAWVec2i span=MWAWVec2i(1, 1))=0
add empty cell
MWAWListener::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 )
MWAWListener::isHeaderFooterOpened
virtual bool isHeaderFooterOpened() const =0
returns true if the header/footer is open
MWAWListener::openLink
virtual void openLink(MWAWLink const &link)=0
open a link
MWAWListener::startDocument
virtual void startDocument()=0
starts the document
MWAWListener::insertUnicodeString
virtual void insertUnicodeString(librevenge::RVNGString const &str)=0
adds a unicode string
MWAWListener::canOpenSectionAddBreak
virtual bool canOpenSectionAddBreak() const =0
returns true if we can add open a section, add page break, ...
MWAWListener::setDocumentMetaData
virtual void setDocumentMetaData(librevenge::RVNGPropertyList const &metadata)=0
sets the documents metadata
MWAWListener::insertUnicode
virtual void insertUnicode(uint32_t character)=0
adds an unicode character.
MWAWListener::closeGroup
virtual void closeGroup()=0
low level: tries to close the last opened group
MWAWListener::insertNote
virtual void insertNote(MWAWNote const &note, MWAWSubDocumentPtr &subDocument)=0
insert a note
MWAWListener::insertFooter
virtual bool insertFooter(MWAWSubDocumentPtr const &subDocument, librevenge::RVNGPropertyList const &extras)=0
insert a footer (interaction with MWAWPageSpan which fills the parameters for openFooter)
MWAWListener::insertShape
virtual void insertShape(MWAWPosition const &pos, MWAWGraphicShape const &shape, MWAWGraphicStyle const &style)=0
adds a shape picture in given position
MWAWListener::canWriteText
virtual bool canWriteText() const =0
returns true if we can add text data
MWAWListener::insertPicture
virtual void insertPicture(MWAWPosition const &pos, MWAWEmbeddedObject const &picture, MWAWGraphicStyle const &style=MWAWGraphicStyle::emptyStyle())=0
adds a picture with various representationin given position.
MWAWListener::insertComment
virtual void insertComment(MWAWSubDocumentPtr &subDocument)=0
adds comment
MWAWListener::closeTableRow
virtual void closeTableRow()=0
closes this row
MWAWListener::getSection
virtual MWAWSection const & getSection() const =0
returns the actual section
MWAWListener::isSubDocumentOpened
virtual bool isSubDocumentOpened(libmwaw::SubDocumentType &subdocType) const =0
returns true if a subdocument is open
MWAWPageSpan
A class which defines the page properties.
Definition MWAWPageSpan.hxx:99
MWAWParagraph
class to store the paragraph properties
Definition MWAWParagraph.hxx:85
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition MWAWPosition.hxx:48
MWAWSection
a class which stores section properties
Definition MWAWSection.hxx:46
MWAWTable
a class used to recreate the table structure using cell informations, ....
Definition MWAWTable.hxx:52
libmwaw_internal.hxx
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition libmwaw_internal.hxx:838
MWAWSubDocumentPtr
std::shared_ptr< MWAWSubDocument > MWAWSubDocumentPtr
a smart pointer of MWAWSubDocument
Definition libmwaw_internal.hxx:565
MWAW_DEBUG_MSG
#define MWAW_DEBUG_MSG(M)
Definition libmwaw_internal.hxx:129
MWAWInputStreamPtr
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition libmwaw_internal.hxx:551
libmwaw::SubDocumentType
SubDocumentType
Definition libmwaw_internal.hxx:188
MWAWEmbeddedObject
small class use to define a embedded object
Definition libmwaw_internal.hxx:467
MWAWField
a field
Definition libmwaw_internal.hxx:399
MWAWLink
a link
Definition libmwaw_internal.hxx:430
MWAWNote
a note
Definition libmwaw_internal.hxx:445