MWAWChart.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.
*/
/*
* Structure to store and construct a chart
*
*/
#ifndef MWAW_CHART
# define MWAW_CHART
#include <iostream>
#include <vector>
#include <map>
#include "libmwaw_internal.hxx"
#include "MWAWEntry.hxx"
#include "MWAWFont.hxx"
#include "MWAWGraphicStyle.hxx"
namespace MWAWChartInternal
{
class SubDocument;
}
class MWAWChart
{
friend class MWAWChartInternal::SubDocument;
public:
struct Axis {
enum Type { A_None, A_Numeric, A_Logarithmic, A_Sequence, A_Sequence_Skip_Empty };
Axis();
Axis &operator=(Axis const &)=default;
~Axis();
void addContentTo(std::string const &sheetName, int coord, librevenge::RVNGPropertyList &propList) const;
void addStyleTo(librevenge::RVNGPropertyList &propList) const;
friend std::ostream &operator<<(std::ostream &o, Axis const &axis);
Type m_type;
bool m_showGrid;
bool m_showLabel;
MWAWBox2i m_labelRange;
MWAWGraphicStyle m_style;
};
struct Legend {
Legend()
: m_show(false)
, m_autoPosition(true)
, m_relativePosition(libmwaw::RightBit)
, m_position(0,0)
, m_font()
, m_style()
{
}
void addContentTo(librevenge::RVNGPropertyList &propList) const;
void addStyleTo(librevenge::RVNGPropertyList &propList, std::shared_ptr<MWAWFontConverter> fontConverter) const;
friend std::ostream &operator<<(std::ostream &o, Legend const &legend);
bool m_show;
bool m_autoPosition;
int m_relativePosition;
MWAWVec2f m_position;
MWAWFont m_font;
MWAWGraphicStyle m_style;
};
struct Series {
enum Type { S_Area, S_Bar, S_Column, S_Line, S_Pie, S_Scatter, S_Stock };
Series();
Series(Series const &)=default;
virtual ~Series();
void addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const;
void addStyleTo(librevenge::RVNGPropertyList &propList) const;
static std::string getSeriesTypeName(Type type);
friend std::ostream &operator<<(std::ostream &o, Series const &series);
Type m_type;
MWAWBox2i m_range;
MWAWGraphicStyle m_style;
};
struct TextZone {
enum Type { T_Title, T_SubTitle, T_AxisX, T_AxisY, T_AxisZ };
enum ContentType { C_Cell, C_Text };
TextZone();
TextZone(TextZone const &)=default;
TextZone &operator=(TextZone const &)=default;
~TextZone();
void addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const;
void addStyleTo(librevenge::RVNGPropertyList &propList, std::shared_ptr<MWAWFontConverter> fontConverter) const;
friend std::ostream &operator<<(std::ostream &o, TextZone const &zone);
Type m_type;
ContentType m_contentType;
MWAWVec2f m_position;
MWAWVec2i m_cell;
MWAWEntry m_textEntry;
MWAWFont m_font;
MWAWGraphicStyle m_style;
};
MWAWChart(std::string const &sheetName, MWAWFontConverterPtr const &fontConverter, MWAWVec2f const &dim=MWAWVec2f());
virtual ~MWAWChart();
void sendChart(MWAWSpreadsheetListenerPtr &listener, librevenge::RVNGSpreadsheetInterface *interface);
virtual void sendContent(TextZone const &zone, MWAWListenerPtr &listener)=0;
void setDataType(Series::Type type, bool dataStacked)
{
m_type=type;
m_dataStacked=dataStacked;
}
MWAWVec2f const &getDimension() const
{
return m_dim;
}
void setDimension(MWAWVec2f const &dim)
{
m_dim=dim;
}
void add(int coord, Axis const &axis);
Axis const &getAxis(int coord) const;
void set(Legend const &legend)
{
m_legend=legend;
}
Legend const &getLegend() const
{
return m_legend;
}
void add(Series const &series);
std::vector<Series> const &getSeries() const
{
return m_seriesList;
}
void add(TextZone const &textZone);
bool getTextZone(TextZone::Type type, TextZone &textZone);
protected:
void sendTextZoneContent(TextZone::Type type, MWAWListenerPtr &listener);
protected:
std::string m_sheetName;
MWAWVec2f m_dim;
Series::Type m_type;
bool m_dataStacked;
Axis m_axis[4];
Legend m_legend;
std::vector<Series> m_seriesList;
std::map<TextZone::Type, TextZone> m_textZoneMap;
MWAWFontConverterPtr m_fontConverter;
private:
explicit MWAWChart(MWAWChart const &orig) = delete;
MWAWChart &operator=(MWAWChart const &orig) = delete;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWEntry.hxx
MWAWFont.hxx
MWAWGraphicStyle.hxx
MWAWChartInternal::SubDocument
Internal: the subdocument of a MWAWChart.
Definition MWAWChart.cxx:62
MWAWChart::getAxis
Axis const & getAxis(int coord) const
return an axis (corresponding to a coord)
Definition MWAWChart.cxx:140
MWAWChart::setDimension
void setDimension(MWAWVec2f const &dim)
return the chart dimension
Definition MWAWChart.hxx:199
MWAWChart::getTextZone
bool getTextZone(TextZone::Type type, TextZone &textZone)
returns a textzone content(if set)
Definition MWAWChart.cxx:154
MWAWChart::sendTextZoneContent
void sendTextZoneContent(TextZone::Type type, MWAWListenerPtr &listener)
sends a textzone content
Definition MWAWChart.cxx:162
MWAWChart::MWAWChart
MWAWChart(MWAWChart const &orig)=delete
MWAWChart::m_fontConverter
MWAWFontConverterPtr m_fontConverter
the font converter
Definition MWAWChart.hxx:254
MWAWChart::m_type
Series::Type m_type
the chart type (if no series)
Definition MWAWChart.hxx:242
MWAWChart::getDimension
MWAWVec2f const & getDimension() const
return the chart dimension
Definition MWAWChart.hxx:194
MWAWChart::~MWAWChart
virtual ~MWAWChart()
the destructor
Definition MWAWChart.cxx:127
MWAWChart::m_legend
Legend m_legend
the legend
Definition MWAWChart.hxx:248
MWAWChart::getLegend
Legend const & getLegend() const
return the legend
Definition MWAWChart.hxx:214
MWAWChart::sendContent
virtual void sendContent(TextZone const &zone, MWAWListenerPtr &listener)=0
send the zone content (called when the zone is of text type)
MWAWChart::m_dataStacked
bool m_dataStacked
a flag to know if the data are stacked or not
Definition MWAWChart.hxx:244
MWAWChart::m_seriesList
std::vector< Series > m_seriesList
the list of series
Definition MWAWChart.hxx:250
MWAWChart::setDataType
void setDataType(Series::Type type, bool dataStacked)
sets the chart type
Definition MWAWChart.hxx:187
MWAWChart::m_textZoneMap
std::map< TextZone::Type, TextZone > m_textZoneMap
a map text zone type to text zone
Definition MWAWChart.hxx:252
MWAWChart::add
void add(int coord, Axis const &axis)
adds an axis (corresponding to a coord)
Definition MWAWChart.cxx:131
MWAWChart::sendChart
void sendChart(MWAWSpreadsheetListenerPtr &listener, librevenge::RVNGSpreadsheetInterface *interface)
send the chart to the listener
Definition MWAWChart.cxx:176
MWAWChart::operator=
MWAWChart & operator=(MWAWChart const &orig)=delete
MWAWChart::getSeries
std::vector< Series > const & getSeries() const
return the list of series
Definition MWAWChart.hxx:222
MWAWChart::MWAWChart
MWAWChart(std::string const &sheetName, MWAWFontConverterPtr const &fontConverter, MWAWVec2f const &dim=MWAWVec2f())
the constructor
Definition MWAWChart.cxx:115
MWAWChart::set
void set(Legend const &legend)
set the legend
Definition MWAWChart.hxx:209
MWAWChart::m_axis
Axis m_axis[4]
the x,y,z and a bad axis
Definition MWAWChart.hxx:246
MWAWChart::m_dim
MWAWVec2f m_dim
the chart dimension in point
Definition MWAWChart.hxx:240
MWAWChart::m_sheetName
std::string m_sheetName
the sheet name
Definition MWAWChart.hxx:238
MWAWEntry
basic class to store an entry in a file This contained :
Definition MWAWEntry.hxx:47
MWAWFont
Class to store font.
Definition MWAWFont.hxx:44
MWAWGraphicStyle
a structure used to define a picture style
Definition MWAWGraphicStyle.hxx:48
libmwaw_internal.hxx
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition libmwaw_internal.hxx:838
MWAWSpreadsheetListenerPtr
std::shared_ptr< MWAWSpreadsheetListener > MWAWSpreadsheetListenerPtr
a smart pointer of MWAWSpreadsheetListener
Definition libmwaw_internal.hxx:563
MWAWFontConverterPtr
std::shared_ptr< MWAWFontConverter > MWAWFontConverterPtr
a smart pointer of MWAWFontConverter
Definition libmwaw_internal.hxx:545
MWAWBox2i
MWAWBox2< int > MWAWBox2i
MWAWBox2 of int.
Definition libmwaw_internal.hxx:1191
MWAWListenerPtr
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition libmwaw_internal.hxx:553
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition libmwaw_internal.hxx:842
MWAWChartInternal
Internal: the structures of a MWAWChart.
Definition MWAWChart.cxx:58
libmwaw
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition libmwaw_internal.cxx:51
MWAWChart::Axis
a axis in a chart
Definition MWAWChart.hxx:62
MWAWChart::Axis::operator<<
friend std::ostream & operator<<(std::ostream &o, Axis const &axis)
operator<<
Definition MWAWChart.cxx:387
MWAWChart::Axis::m_style
MWAWGraphicStyle m_style
the graphic style
Definition MWAWChart.hxx:85
MWAWChart::Axis::Axis
Axis()
constructor
Definition MWAWChart.cxx:331
MWAWChart::Axis::m_labelRange
MWAWBox2i m_labelRange
the label range if defined
Definition MWAWChart.hxx:83
MWAWChart::Axis::operator=
Axis & operator=(Axis const &)=default
MWAWChart::Axis::~Axis
~Axis()
destructor
Definition MWAWChart.cxx:341
MWAWChart::Axis::Type
Type
the axis content
Definition MWAWChart.hxx:64
MWAWChart::Axis::A_Sequence_Skip_Empty
@ A_Sequence_Skip_Empty
Definition MWAWChart.hxx:64
MWAWChart::Axis::A_Sequence
@ A_Sequence
Definition MWAWChart.hxx:64
MWAWChart::Axis::A_Logarithmic
@ A_Logarithmic
Definition MWAWChart.hxx:64
MWAWChart::Axis::A_None
@ A_None
Definition MWAWChart.hxx:64
MWAWChart::Axis::A_Numeric
@ A_Numeric
Definition MWAWChart.hxx:64
MWAWChart::Axis::m_type
Type m_type
the sequence type
Definition MWAWChart.hxx:77
MWAWChart::Axis::addStyleTo
void addStyleTo(librevenge::RVNGPropertyList &propList) const
add style to the propList
Definition MWAWChart.cxx:377
MWAWChart::Axis::m_showGrid
bool m_showGrid
show or not the grid
Definition MWAWChart.hxx:79
MWAWChart::Axis::addContentTo
void addContentTo(std::string const &sheetName, int coord, librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition MWAWChart.cxx:345
MWAWChart::Axis::m_showLabel
bool m_showLabel
show or not the label
Definition MWAWChart.hxx:81
MWAWChart::Legend
a legend in a chart
Definition MWAWChart.hxx:88
MWAWChart::Legend::m_autoPosition
bool m_autoPosition
automatic position
Definition MWAWChart.hxx:108
MWAWChart::Legend::Legend
Legend()
constructor
Definition MWAWChart.hxx:90
MWAWChart::Legend::m_style
MWAWGraphicStyle m_style
the graphic style
Definition MWAWChart.hxx:116
MWAWChart::Legend::m_relativePosition
int m_relativePosition
the automatic position libmwaw::LeftBit|...
Definition MWAWChart.hxx:110
MWAWChart::Legend::m_position
MWAWVec2f m_position
the position in points
Definition MWAWChart.hxx:112
MWAWChart::Legend::m_show
bool m_show
show or not the legend
Definition MWAWChart.hxx:106
MWAWChart::Legend::addStyleTo
void addStyleTo(librevenge::RVNGPropertyList &propList, std::shared_ptr< MWAWFontConverter > fontConverter) const
add style to the propList
Definition MWAWChart.cxx:443
MWAWChart::Legend::operator<<
friend std::ostream & operator<<(std::ostream &o, Legend const &legend)
operator<<
Definition MWAWChart.cxx:450
MWAWChart::Legend::m_font
MWAWFont m_font
the font
Definition MWAWChart.hxx:114
MWAWChart::Legend::addContentTo
void addContentTo(librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition MWAWChart.cxx:423
MWAWChart::Series::Series
Series()
constructor
Definition MWAWChart.cxx:479
MWAWChart::Series::addContentTo
void addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition MWAWChart.cxx:517
MWAWChart::Series::Series
Series(Series const &)=default
MWAWChart::Series::m_type
Type m_type
the type
Definition MWAWChart.hxx:136
MWAWChart::Series::m_range
MWAWBox2i m_range
the data range
Definition MWAWChart.hxx:138
MWAWChart::Series::~Series
virtual ~Series()
destructor
Definition MWAWChart.cxx:488
MWAWChart::Series::Type
Type
the series type
Definition MWAWChart.hxx:121
MWAWChart::Series::S_Stock
@ S_Stock
Definition MWAWChart.hxx:121
MWAWChart::Series::S_Area
@ S_Area
Definition MWAWChart.hxx:121
MWAWChart::Series::S_Bar
@ S_Bar
Definition MWAWChart.hxx:121
MWAWChart::Series::S_Column
@ S_Column
Definition MWAWChart.hxx:121
MWAWChart::Series::S_Line
@ S_Line
Definition MWAWChart.hxx:121
MWAWChart::Series::S_Scatter
@ S_Scatter
Definition MWAWChart.hxx:121
MWAWChart::Series::S_Pie
@ S_Pie
Definition MWAWChart.hxx:121
MWAWChart::Series::getSeriesTypeName
static std::string getSeriesTypeName(Type type)
returns a string corresponding to a series type
Definition MWAWChart.cxx:492
MWAWChart::Series::operator<<
friend std::ostream & operator<<(std::ostream &o, Series const &series)
operator<<
Definition MWAWChart.cxx:543
MWAWChart::Series::addStyleTo
void addStyleTo(librevenge::RVNGPropertyList &propList) const
add style to the propList
Definition MWAWChart.cxx:538
MWAWChart::Series::m_style
MWAWGraphicStyle m_style
the graphic style
Definition MWAWChart.hxx:140
MWAWChart::TextZone
a text zone a chart
Definition MWAWChart.hxx:143
MWAWChart::TextZone::m_type
Type m_type
the zone type
Definition MWAWChart.hxx:162
MWAWChart::TextZone::TextZone
TextZone(TextZone const &)=default
MWAWChart::TextZone::m_cell
MWAWVec2i m_cell
the cell position ( for title and subtitle )
Definition MWAWChart.hxx:168
MWAWChart::TextZone::~TextZone
~TextZone()
destructor
Definition MWAWChart.cxx:594
MWAWChart::TextZone::m_style
MWAWGraphicStyle m_style
the graphic style
Definition MWAWChart.hxx:174
MWAWChart::TextZone::Type
Type
the text type
Definition MWAWChart.hxx:145
MWAWChart::TextZone::T_Title
@ T_Title
Definition MWAWChart.hxx:145
MWAWChart::TextZone::T_AxisX
@ T_AxisX
Definition MWAWChart.hxx:145
MWAWChart::TextZone::T_SubTitle
@ T_SubTitle
Definition MWAWChart.hxx:145
MWAWChart::TextZone::T_AxisY
@ T_AxisY
Definition MWAWChart.hxx:145
MWAWChart::TextZone::T_AxisZ
@ T_AxisZ
Definition MWAWChart.hxx:145
MWAWChart::TextZone::m_textEntry
MWAWEntry m_textEntry
the text entry
Definition MWAWChart.hxx:170
MWAWChart::TextZone::addContentTo
void addContentTo(std::string const &sheetName, librevenge::RVNGPropertyList &propList) const
add content to the propList
Definition MWAWChart.cxx:598
MWAWChart::TextZone::m_contentType
ContentType m_contentType
the content type
Definition MWAWChart.hxx:164
MWAWChart::TextZone::TextZone
TextZone()
constructor
Definition MWAWChart.cxx:582
MWAWChart::TextZone::m_font
MWAWFont m_font
the zone format
Definition MWAWChart.hxx:172
MWAWChart::TextZone::ContentType
ContentType
the text content type
Definition MWAWChart.hxx:147
MWAWChart::TextZone::C_Cell
@ C_Cell
Definition MWAWChart.hxx:147
MWAWChart::TextZone::C_Text
@ C_Text
Definition MWAWChart.hxx:147
MWAWChart::TextZone::operator=
TextZone & operator=(TextZone const &)=default
MWAWChart::TextZone::operator<<
friend std::ostream & operator<<(std::ostream &o, TextZone const &zone)
operator<<
Definition MWAWChart.cxx:639
MWAWChart::TextZone::m_position
MWAWVec2f m_position
the position in the zone
Definition MWAWChart.hxx:166
MWAWChart::TextZone::addStyleTo
void addStyleTo(librevenge::RVNGPropertyList &propList, std::shared_ptr< MWAWFontConverter > fontConverter) const
add to the propList
Definition MWAWChart.cxx:633