MWAWGraphicStyle.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_GRAPHIC_STYLE
# define MWAW_GRAPHIC_STYLE
# include <ostream>
# include <string>
# include <vector>
# include "librevenge/librevenge.h"
# include "libmwaw_internal.hxx"
class MWAWGraphicStyle
{
public:
enum LineCap { C_Butt, C_Square, C_Round };
enum LineJoin { J_Miter, J_Round, J_Bevel };
enum VerticalAlignment { V_AlignBottom, V_AlignCenter, V_AlignJustify, V_AlignTop, V_AlignDefault };
struct Arrow {
Arrow()
: m_viewBox()
, m_path("")
, m_width(0)
, m_isCentered(false)
{
}
Arrow(float w, MWAWBox2i const &box, std::string const &path, bool centered=false)
: m_viewBox(box)
, m_path(path)
, m_width(w)
, m_isCentered(centered)
{
}
static Arrow plain()
{
return Arrow(5, MWAWBox2i(MWAWVec2i(0,0),MWAWVec2i(20,30)), "m10 0-10 30h20z", false);
}
friend std::ostream &operator<<(std::ostream &o, Arrow const &arrow)
{
if (arrow.isEmpty()) return o;
o << "w=" << arrow.m_width << ",";
o << "viewbox=" << arrow.m_viewBox << ",";
o << "path=" << arrow.m_path << ",";
if (arrow.m_isCentered) o << "centered,";
return o;
}
bool operator==(Arrow const &arrow) const
{
return m_width>=arrow.m_width && m_width<=arrow.m_width &&
m_viewBox==arrow.m_viewBox && m_path==arrow.m_path && m_isCentered==arrow.m_isCentered;
}
bool operator!=(Arrow const &arrow) const
{
return !(*this==arrow);
}
bool operator<(Arrow const &arrow) const
{
if (m_isCentered<arrow.m_isCentered) return m_isCentered ? true : false;
return m_width<arrow.m_width && m_viewBox<arrow.m_viewBox && m_path < arrow.m_path;
}
bool operator<=(Arrow const &arrow) const
{
return *this<arrow || *this==arrow;
}
bool operator>(Arrow const &arrow) const
{
return !(*this<=arrow);
}
bool operator>=(Arrow const &arrow) const
{
return !(*this<arrow);
}
bool isEmpty() const
{
return m_width<=0 || m_path.empty();
}
void addTo(librevenge::RVNGPropertyList &propList, std::string const &type) const;
MWAWBox2i m_viewBox;
std::string m_path;
float m_width;
bool m_isCentered;
};
struct Gradient {
struct Stop {
explicit Stop(float offset=0.0, MWAWColor const &col=MWAWColor::black(), float opacity=1.0)
: m_offset(offset)
, m_color(col)
, m_opacity(opacity)
{
}
int cmp(Stop const &a) const
{
if (m_offset < a.m_offset) return -1;
if (m_offset > a.m_offset) return 1;
if (m_color < a.m_color) return -1;
if (m_color > a.m_color) return 1;
if (m_opacity < a.m_opacity) return -1;
if (m_opacity > a.m_opacity) return 1;
return 0;
}
friend std::ostream &operator<<(std::ostream &o, Stop const &st)
{
o << "offset=" << st.m_offset << ",";
o << "color=" << st.m_color << ",";
if (st.m_opacity<1)
o << "opacity=" << st.m_opacity*100.f << "%,";
return o;
}
float m_offset;
MWAWColor m_color;
float m_opacity;
};
enum Type { G_None, G_Axial, G_Linear, G_Radial, G_Rectangular, G_Square, G_Ellipsoid };
Gradient()
: m_type(G_None)
, m_stopList()
, m_angle(0)
, m_border(0)
, m_percentCenter(0.5f,0.5f)
, m_radius(1)
{
m_stopList.push_back(Stop(0.0, MWAWColor::white()));
m_stopList.push_back(Stop(1.0, MWAWColor::black()));
}
bool hasGradient(bool complex=false) const
{
return m_type != G_None && static_cast<int>(m_stopList.size()) >= (complex ? 3 : 2);
}
void addTo(librevenge::RVNGPropertyList &propList) const;
bool getAverageColor(MWAWColor &color) const;
friend std::ostream &operator<<(std::ostream &o, Gradient const &grad)
{
switch (grad.m_type) {
case Gradient::G_Axial:
o << "axial,";
break;
case Gradient::G_Linear:
o << "linear,";
break;
case Gradient::G_Radial:
o << "radial,";
break;
case Gradient::G_Rectangular:
o << "rectangular,";
break;
case Gradient::G_Square:
o << "square,";
break;
case Gradient::G_Ellipsoid:
o << "ellipsoid,";
break;
case Gradient::G_None:
#if !defined(__clang__)
default:
#endif
break;
}
if (grad.m_angle>0 || grad.m_angle<0) o << "angle=" << grad.m_angle << ",";
if (grad.m_stopList.size() >= 2) {
o << "stops=[";
for (auto const &stop : grad.m_stopList)
o << "[" << stop << "],";
o << "],";
}
if (grad.m_border>0) o << "border=" << grad.m_border*100 << "%,";
if (grad.m_percentCenter != MWAWVec2f(0.5f,0.5f)) o << "center=" << grad.m_percentCenter << ",";
if (grad.m_radius<1) o << "radius=" << grad.m_radius << ",";
return o;
}
int cmp(Gradient const &a) const
{
if (m_type < a.m_type) return -1;
if (m_type > a.m_type) return 1;
if (m_angle < a.m_angle) return -1;
if (m_angle > a.m_angle) return 1;
if (m_stopList.size() < a.m_stopList.size()) return 1;
if (m_stopList.size() > a.m_stopList.size()) return -1;
for (auto const &c :m_stopList) {
int diff = c.cmp(c);
if (diff) return diff;
}
if (m_border < a.m_border) return -1;
if (m_border > a.m_border) return 1;
int diff=m_percentCenter.cmp(a.m_percentCenter);
if (diff) return diff;
if (m_radius < a.m_radius) return -1;
if (m_radius > a.m_radius) return 1;
return 0;
}
Type m_type;
std::vector<Stop> m_stopList;
float m_angle;
float m_border;
MWAWVec2f m_percentCenter;
float m_radius;
};
struct Hatch {
enum Type { H_None, H_Single, H_Double, H_Triple };
Hatch()
: m_type(H_None)
, m_color(MWAWColor::black())
, m_distance(1.f/72)
, m_rotation(0)
{
}
bool hasHatch() const
{
return m_type != H_None && m_distance>0;
}
void addTo(librevenge::RVNGPropertyList &propList) const;
friend std::ostream &operator<<(std::ostream &o, Hatch const &hatch)
{
if (hatch.m_type==H_None || hatch.m_distance<=0)
return o;
switch (hatch.m_type) {
case Hatch::H_None:
break;
case Hatch::H_Single:
o << "single,";
break;
case Hatch::H_Double:
o << "double,";
break;
case Hatch::H_Triple:
o << "triple,";
break;
default:
o << "###type=" << int(hatch.m_type) << ",";
break;
}
if (!hatch.m_color.isBlack())
o << hatch.m_color << ",";
o << "dist=" << 72*hatch.m_distance << "pt,";
if (hatch.m_rotation>0 || hatch.m_rotation<0)
o << "rot=" << hatch.m_rotation << "deg,";
return o;
}
int cmp(Hatch const &a) const
{
if (m_type < a.m_type) return -1;
if (m_type > a.m_type) return 1;
if (m_color < a.m_color) return -1;
if (m_color > a.m_color) return 1;
if (m_distance < a.m_distance) return -1;
if (m_distance > a.m_distance) return 1;
if (m_rotation < a.m_rotation) return -1;
if (m_rotation > a.m_rotation) return 1;
return 0;
}
Type m_type;
MWAWColor m_color;
float m_distance;
float m_rotation;
};
struct Pattern {
Pattern()
: m_dim(0,0)
, m_data()
, m_picture()
, m_pictureAverageColor(MWAWColor::white())
{
m_colors[0]=MWAWColor::black();
m_colors[1]=MWAWColor::white();
}
Pattern(MWAWVec2i dim, MWAWEmbeddedObject const &picture, MWAWColor const &avColor)
: m_dim(dim)
, m_data()
, m_picture(picture)
, m_pictureAverageColor(avColor)
{
m_colors[0]=MWAWColor::black();
m_colors[1]=MWAWColor::white();
}
Pattern(Pattern const &)=default;
Pattern &operator=(Pattern const &)=default;
Pattern &operator=(Pattern &&)=default;
virtual ~Pattern();
bool empty() const
{
if (m_dim[0]==0 || m_dim[1]==0) return true;
if (!m_picture.m_dataList.empty()) return false;
if (m_dim[0]!=8 && m_dim[0]!=16 && m_dim[0]!=32) return true;
return m_data.size()!=size_t((m_dim[0]/8)*m_dim[1]);
}
bool getAverageColor(MWAWColor &col) const;
bool getUniqueColor(MWAWColor &col) const;
bool getBinary(MWAWEmbeddedObject &picture) const;
int cmp(Pattern const &a) const
{
int diff = m_dim.cmp(a.m_dim);
if (diff) return diff;
if (m_data.size() < a.m_data.size()) return -1;
if (m_data.size() > a.m_data.size()) return 1;
for (size_t h=0; h < m_data.size(); ++h) {
if (m_data[h]<a.m_data[h]) return 1;
if (m_data[h]>a.m_data[h]) return -1;
}
for (int i=0; i<2; ++i) {
if (m_colors[i] < a.m_colors[i]) return 1;
if (m_colors[i] > a.m_colors[i]) return -1;
}
if (m_pictureAverageColor < a.m_pictureAverageColor) return 1;
if (m_pictureAverageColor > a.m_pictureAverageColor) return -1;
diff=m_picture.cmp(a.m_picture);
if (diff) return diff;
return 0;
}
friend std::ostream &operator<<(std::ostream &o, Pattern const &pat)
{
o << "dim=" << pat.m_dim << ",";
if (!pat.m_picture.isEmpty()) {
o << "pict=" << pat.m_picture << ",";
o << "col[average]=" << pat.m_pictureAverageColor << ",";
}
else {
if (!pat.m_colors[0].isBlack()) o << "col0=" << pat.m_colors[0] << ",";
if (!pat.m_colors[1].isWhite()) o << "col1=" << pat.m_colors[1] << ",";
o << "[";
for (auto data : pat.m_data)
o << std::hex << static_cast<int>(data) << std::dec << ",";
o << "],";
}
return o;
}
MWAWVec2i m_dim;
MWAWColor m_colors[2];
std::vector<unsigned char> m_data;
protected:
MWAWEmbeddedObject m_picture;
MWAWColor m_pictureAverageColor;
};
MWAWGraphicStyle()
: m_lineDashWidth()
, m_lineWidth(1)
, m_lineCap(C_Butt)
, m_lineJoin(J_Miter)
, m_lineOpacity(1)
, m_lineColor(MWAWColor::black())
, m_surfaceColor(MWAWColor::white())
, m_surfaceOpacity(0)
, m_shadowColor(MWAWColor::black())
, m_shadowOpacity(0)
, m_shadowOffset(1,1)
, m_pattern()
, m_gradient()
, m_hatch()
, m_backgroundColor(MWAWColor::white())
, m_backgroundOpacity(-1)
, m_rotate(0)
, m_bordersList()
, m_frameName("")
, m_frameNextName("")
, m_fillRuleEvenOdd(false)
, m_doNotPrint(false)
, m_verticalAlignment(V_AlignDefault)
, m_extra("")
{
for (auto &fl : m_flip) fl=false;
}
MWAWGraphicStyle(MWAWGraphicStyle const &)=default;
MWAWGraphicStyle &operator=(MWAWGraphicStyle const &)=default;
MWAWGraphicStyle &operator=(MWAWGraphicStyle &&)=default;
static MWAWGraphicStyle emptyStyle()
{
MWAWGraphicStyle res;
res.m_lineWidth=0;
return res;
}
virtual ~MWAWGraphicStyle();
bool hasLine() const
{
return m_lineWidth>0 && m_lineOpacity>0;
}
void setSurfaceColor(MWAWColor const &col, float opacity = 1)
{
m_surfaceColor = col;
m_surfaceOpacity = opacity;
}
bool hasSurfaceColor() const
{
return m_surfaceOpacity > 0;
}
void setPattern(Pattern const &pat, float opacity = 1)
{
m_pattern=pat;
m_surfaceOpacity = opacity;
}
bool hasPattern() const
{
return !m_pattern.empty() && m_surfaceOpacity > 0;
}
bool hasGradient(bool complex=false) const
{
return m_gradient.hasGradient(complex);
}
bool hasHatch() const
{
return m_hatch.hasHatch();
}
bool hasSurface() const
{
return hasSurfaceColor() || hasPattern() || hasGradient() || hasHatch();
}
void setBackgroundColor(MWAWColor const &col, float opacity = 1)
{
m_backgroundColor = col;
m_backgroundOpacity = opacity;
}
bool hasBackgroundColor() const
{
return m_backgroundOpacity > 0;
}
void setShadowColor(MWAWColor const &col, float opacity = 1)
{
m_shadowColor = col;
m_shadowOpacity = opacity;
}
bool hasShadow() const
{
return m_shadowOpacity > 0;
}
bool hasBorders() const
{
return !m_bordersList.empty();
}
bool hasSameBorders() const
{
if (m_bordersList.empty()) return true;
if (m_bordersList.size()!=4) return false;
for (size_t i=1; i<m_bordersList.size(); ++i) {
if (m_bordersList[i]!=m_bordersList[0])
return false;
}
return true;
}
std::vector<MWAWBorder> const &borders() const
{
return m_bordersList;
}
void resetBorders()
{
m_bordersList.resize(0);
}
void setBorders(int wh, MWAWBorder const &border);
friend std::ostream &operator<<(std::ostream &o, MWAWGraphicStyle const &st);
void addTo(librevenge::RVNGPropertyList &pList, bool only1d=false) const;
void addFrameTo(librevenge::RVNGPropertyList &pList) const;
int cmp(MWAWGraphicStyle const &a) const;
std::vector<float> m_lineDashWidth;
float m_lineWidth;
LineCap m_lineCap;
LineJoin m_lineJoin;
float m_lineOpacity;
MWAWColor m_lineColor;
MWAWColor m_surfaceColor;
float m_surfaceOpacity;
MWAWColor m_shadowColor;
float m_shadowOpacity;
MWAWVec2f m_shadowOffset;
Pattern m_pattern;
Gradient m_gradient;
Hatch m_hatch;
//
// related to the frame
//
MWAWColor m_backgroundColor;
float m_backgroundOpacity;
float m_rotate;
std::vector<MWAWBorder> m_bordersList;
std::string m_frameName;
std::string m_frameNextName;
Arrow m_arrows[2];
//
// some transformation: must probably be somewhere else
//
bool m_flip[2];
bool m_fillRuleEvenOdd;
bool m_doNotPrint;
VerticalAlignment m_verticalAlignment;
std::string m_extra;
};
#endif
// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWGraphicStyle
a structure used to define a picture style
Definition MWAWGraphicStyle.hxx:48
MWAWGraphicStyle::m_doNotPrint
bool m_doNotPrint
a bool to know if the shape must not be printed
Definition MWAWGraphicStyle.hxx:649
MWAWGraphicStyle::hasHatch
bool hasHatch() const
returns true if the hatch is defined
Definition MWAWGraphicStyle.hxx:518
MWAWGraphicStyle::setShadowColor
void setShadowColor(MWAWColor const &col, float opacity=1)
set the shadow color
Definition MWAWGraphicStyle.hxx:539
MWAWGraphicStyle::m_bordersList
std::vector< MWAWBorder > m_bordersList
the borders MWAWBorder::Pos (for a frame)
Definition MWAWGraphicStyle.hxx:629
MWAWGraphicStyle::m_shadowOffset
MWAWVec2f m_shadowOffset
the shadow offset
Definition MWAWGraphicStyle.hxx:608
MWAWGraphicStyle::m_verticalAlignment
VerticalAlignment m_verticalAlignment
related to text area
Definition MWAWGraphicStyle.hxx:652
MWAWGraphicStyle::m_gradient
Gradient m_gradient
the gradient
Definition MWAWGraphicStyle.hxx:614
MWAWGraphicStyle::VerticalAlignment
VerticalAlignment
an enum used to define the vertical alignment
Definition MWAWGraphicStyle.hxx:56
MWAWGraphicStyle::V_AlignJustify
@ V_AlignJustify
Definition MWAWGraphicStyle.hxx:56
MWAWGraphicStyle::V_AlignTop
@ V_AlignTop
Definition MWAWGraphicStyle.hxx:56
MWAWGraphicStyle::V_AlignDefault
@ V_AlignDefault
Definition MWAWGraphicStyle.hxx:56
MWAWGraphicStyle::V_AlignCenter
@ V_AlignCenter
Definition MWAWGraphicStyle.hxx:56
MWAWGraphicStyle::V_AlignBottom
@ V_AlignBottom
Definition MWAWGraphicStyle.hxx:56
MWAWGraphicStyle::operator<<
friend std::ostream & operator<<(std::ostream &o, MWAWGraphicStyle const &st)
a print operator
Definition MWAWGraphicStyle.cxx:572
MWAWGraphicStyle::m_fillRuleEvenOdd
bool m_fillRuleEvenOdd
true if the fill rule is evenod
Definition MWAWGraphicStyle.hxx:646
MWAWGraphicStyle::m_rotate
float m_rotate
the rotation
Definition MWAWGraphicStyle.hxx:627
MWAWGraphicStyle::hasBackgroundColor
bool hasBackgroundColor() const
returns true if the background is defined
Definition MWAWGraphicStyle.hxx:534
MWAWGraphicStyle::hasSurfaceColor
bool hasSurfaceColor() const
returns true if the surface is defined
Definition MWAWGraphicStyle.hxx:497
MWAWGraphicStyle::m_frameNextName
std::string m_frameNextName
the frame next name (if there is a link)
Definition MWAWGraphicStyle.hxx:633
MWAWGraphicStyle::addFrameTo
void addFrameTo(librevenge::RVNGPropertyList &pList) const
add all the frame parameters to propList: the background and the borders
Definition MWAWGraphicStyle.cxx:451
MWAWGraphicStyle::cmp
int cmp(MWAWGraphicStyle const &a) const
compare two styles
Definition MWAWGraphicStyle.cxx:499
MWAWGraphicStyle::m_surfaceColor
MWAWColor m_surfaceColor
the surface color
Definition MWAWGraphicStyle.hxx:599
MWAWGraphicStyle::m_shadowOpacity
float m_shadowOpacity
true if the shadow has some color
Definition MWAWGraphicStyle.hxx:606
MWAWGraphicStyle::m_lineWidth
float m_lineWidth
the linewidth
Definition MWAWGraphicStyle.hxx:589
MWAWGraphicStyle::hasSurface
bool hasSurface() const
returns true if the interior surface is defined
Definition MWAWGraphicStyle.hxx:523
MWAWGraphicStyle::m_backgroundColor
MWAWColor m_backgroundColor
the background color
Definition MWAWGraphicStyle.hxx:623
MWAWGraphicStyle::setBorders
void setBorders(int wh, MWAWBorder const &border)
sets the cell border: wh=libmwaw::LeftBit|...
Definition MWAWGraphicStyle.cxx:274
MWAWGraphicStyle::m_frameName
std::string m_frameName
the frame name
Definition MWAWGraphicStyle.hxx:631
MWAWGraphicStyle::m_shadowColor
MWAWColor m_shadowColor
the shadow color
Definition MWAWGraphicStyle.hxx:604
MWAWGraphicStyle::m_extra
std::string m_extra
extra data
Definition MWAWGraphicStyle.hxx:655
MWAWGraphicStyle::hasShadow
bool hasShadow() const
returns true if the shadow is defined
Definition MWAWGraphicStyle.hxx:545
MWAWGraphicStyle::emptyStyle
static MWAWGraphicStyle emptyStyle()
returns an empty style.
Definition MWAWGraphicStyle.hxx:477
MWAWGraphicStyle::MWAWGraphicStyle
MWAWGraphicStyle()
constructor
Definition MWAWGraphicStyle.hxx:445
MWAWGraphicStyle::m_lineOpacity
float m_lineOpacity
the line opacity: 0=transparent
Definition MWAWGraphicStyle.hxx:595
MWAWGraphicStyle::hasGradient
bool hasGradient(bool complex=false) const
returns true if the gradient is defined
Definition MWAWGraphicStyle.hxx:513
MWAWGraphicStyle::setBackgroundColor
void setBackgroundColor(MWAWColor const &col, float opacity=1)
set the background color
Definition MWAWGraphicStyle.hxx:528
MWAWGraphicStyle::hasLine
bool hasLine() const
returns true if the border is defined
Definition MWAWGraphicStyle.hxx:486
MWAWGraphicStyle::m_surfaceOpacity
float m_surfaceOpacity
true if the surface has some color
Definition MWAWGraphicStyle.hxx:601
MWAWGraphicStyle::m_backgroundOpacity
float m_backgroundOpacity
true if the background has some color
Definition MWAWGraphicStyle.hxx:625
MWAWGraphicStyle::m_hatch
Hatch m_hatch
the hatch
Definition MWAWGraphicStyle.hxx:616
MWAWGraphicStyle::operator=
MWAWGraphicStyle & operator=(MWAWGraphicStyle &&)=default
MWAWGraphicStyle::m_flip
bool m_flip[2]
two bool to indicated we need to flip the shape or not
Definition MWAWGraphicStyle.hxx:643
MWAWGraphicStyle::LineCap
LineCap
an enum used to define the basic line cap
Definition MWAWGraphicStyle.hxx:51
MWAWGraphicStyle::C_Round
@ C_Round
Definition MWAWGraphicStyle.hxx:51
MWAWGraphicStyle::C_Butt
@ C_Butt
Definition MWAWGraphicStyle.hxx:51
MWAWGraphicStyle::C_Square
@ C_Square
Definition MWAWGraphicStyle.hxx:51
MWAWGraphicStyle::m_lineDashWidth
std::vector< float > m_lineDashWidth
the dash array: a sequence of (fullsize, emptysize)
Definition MWAWGraphicStyle.hxx:587
MWAWGraphicStyle::m_pattern
Pattern m_pattern
the pattern if it exists
Definition MWAWGraphicStyle.hxx:611
MWAWGraphicStyle::m_lineColor
MWAWColor m_lineColor
the line color
Definition MWAWGraphicStyle.hxx:597
MWAWGraphicStyle::hasBorders
bool hasBorders() const
return true if the frame has some border
Definition MWAWGraphicStyle.hxx:550
MWAWGraphicStyle::setSurfaceColor
void setSurfaceColor(MWAWColor const &col, float opacity=1)
set the surface color
Definition MWAWGraphicStyle.hxx:491
MWAWGraphicStyle::~MWAWGraphicStyle
virtual ~MWAWGraphicStyle()
virtual destructor
Definition MWAWGraphicStyle.cxx:270
MWAWGraphicStyle::hasPattern
bool hasPattern() const
returns true if the pattern is defined
Definition MWAWGraphicStyle.hxx:508
MWAWGraphicStyle::borders
std::vector< MWAWBorder > const & borders() const
return the frame border: libmwaw::Left | ...
Definition MWAWGraphicStyle.hxx:566
MWAWGraphicStyle::resetBorders
void resetBorders()
reset the border
Definition MWAWGraphicStyle.hxx:571
MWAWGraphicStyle::hasSameBorders
bool hasSameBorders() const
return true if the frame has some border
Definition MWAWGraphicStyle.hxx:555
MWAWGraphicStyle::MWAWGraphicStyle
MWAWGraphicStyle(MWAWGraphicStyle const &)=default
MWAWGraphicStyle::m_arrows
Arrow m_arrows[2]
the two arrows corresponding to start and end extremity
Definition MWAWGraphicStyle.hxx:636
MWAWGraphicStyle::LineJoin
LineJoin
an enum used to define the basic line join
Definition MWAWGraphicStyle.hxx:53
MWAWGraphicStyle::J_Bevel
@ J_Bevel
Definition MWAWGraphicStyle.hxx:53
MWAWGraphicStyle::J_Miter
@ J_Miter
Definition MWAWGraphicStyle.hxx:53
MWAWGraphicStyle::J_Round
@ J_Round
Definition MWAWGraphicStyle.hxx:53
MWAWGraphicStyle::addTo
void addTo(librevenge::RVNGPropertyList &pList, bool only1d=false) const
add all the parameters to the propList excepted the frame parameter: the background and the borders
Definition MWAWGraphicStyle.cxx:293
MWAWGraphicStyle::operator=
MWAWGraphicStyle & operator=(MWAWGraphicStyle const &)=default
MWAWGraphicStyle::m_lineCap
LineCap m_lineCap
the line cap
Definition MWAWGraphicStyle.hxx:591
MWAWGraphicStyle::m_lineJoin
LineJoin m_lineJoin
the line join
Definition MWAWGraphicStyle.hxx:593
MWAWGraphicStyle::setPattern
void setPattern(Pattern const &pat, float opacity=1)
set the pattern
Definition MWAWGraphicStyle.hxx:502
libmwaw_internal.hxx
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition libmwaw_internal.hxx:838
MWAWBox2i
MWAWBox2< int > MWAWBox2i
MWAWBox2 of int.
Definition libmwaw_internal.hxx:1191
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition libmwaw_internal.hxx:842
MWAWBorder
a border
Definition libmwaw_internal.hxx:333
MWAWColor
the class to store a color
Definition libmwaw_internal.hxx:192
MWAWColor::black
static MWAWColor black()
return the back color
Definition libmwaw_internal.hxx:245
MWAWColor::isWhite
bool isWhite() const
return true if the color is white
Definition libmwaw_internal.hxx:289
MWAWColor::white
static MWAWColor white()
return the white color
Definition libmwaw_internal.hxx:250
MWAWColor::isBlack
bool isBlack() const
return true if the color is black
Definition libmwaw_internal.hxx:284
MWAWEmbeddedObject
small class use to define a embedded object
Definition libmwaw_internal.hxx:467
MWAWEmbeddedObject::isEmpty
bool isEmpty() const
return true if the picture contains no data
Definition libmwaw_internal.hxx:486
MWAWGraphicStyle::Arrow
a structure used to define an arrow
Definition MWAWGraphicStyle.hxx:59
MWAWGraphicStyle::Arrow::addTo
void addTo(librevenge::RVNGPropertyList &propList, std::string const &type) const
add a arrow to the propList knowing the type (start, end)
Definition MWAWGraphicStyle.cxx:56
MWAWGraphicStyle::Arrow::m_path
std::string m_path
the arrow path
Definition MWAWGraphicStyle.hxx:134
MWAWGraphicStyle::Arrow::m_isCentered
bool m_isCentered
flag to know if the arrow is centered
Definition MWAWGraphicStyle.hxx:138
MWAWGraphicStyle::Arrow::plain
static Arrow plain()
returns a basic plain arrow
Definition MWAWGraphicStyle.hxx:77
MWAWGraphicStyle::Arrow::operator>
bool operator>(Arrow const &arrow) const
operator>
Definition MWAWGraphicStyle.hxx:114
MWAWGraphicStyle::Arrow::m_width
float m_width
the arrow width in point
Definition MWAWGraphicStyle.hxx:136
MWAWGraphicStyle::Arrow::operator!=
bool operator!=(Arrow const &arrow) const
operator!=
Definition MWAWGraphicStyle.hxx:98
MWAWGraphicStyle::Arrow::operator>=
bool operator>=(Arrow const &arrow) const
operator>=
Definition MWAWGraphicStyle.hxx:119
MWAWGraphicStyle::Arrow::operator<=
bool operator<=(Arrow const &arrow) const
operator<=
Definition MWAWGraphicStyle.hxx:109
MWAWGraphicStyle::Arrow::operator<<
friend std::ostream & operator<<(std::ostream &o, Arrow const &arrow)
operator<<
Definition MWAWGraphicStyle.hxx:82
MWAWGraphicStyle::Arrow::isEmpty
bool isEmpty() const
returns true if there is no arrow
Definition MWAWGraphicStyle.hxx:124
MWAWGraphicStyle::Arrow::operator<
bool operator<(Arrow const &arrow) const
operator<
Definition MWAWGraphicStyle.hxx:103
MWAWGraphicStyle::Arrow::operator==
bool operator==(Arrow const &arrow) const
operator==
Definition MWAWGraphicStyle.hxx:92
MWAWGraphicStyle::Arrow::Arrow
Arrow(float w, MWAWBox2i const &box, std::string const &path, bool centered=false)
constructor
Definition MWAWGraphicStyle.hxx:69
MWAWGraphicStyle::Arrow::m_viewBox
MWAWBox2i m_viewBox
the arrow viewbox
Definition MWAWGraphicStyle.hxx:132
MWAWGraphicStyle::Arrow::Arrow
Arrow()
constructor ( no arrow)
Definition MWAWGraphicStyle.hxx:61
MWAWGraphicStyle::Gradient::Stop
a structure used to define the gradient limit in MWAWGraphicStyle
Definition MWAWGraphicStyle.hxx:144
MWAWGraphicStyle::Gradient::Stop::m_opacity
float m_opacity
the opacity
Definition MWAWGraphicStyle.hxx:177
MWAWGraphicStyle::Gradient::Stop::operator<<
friend std::ostream & operator<<(std::ostream &o, Stop const &st)
a print operator
Definition MWAWGraphicStyle.hxx:164
MWAWGraphicStyle::Gradient::Stop::m_offset
float m_offset
the offset
Definition MWAWGraphicStyle.hxx:173
MWAWGraphicStyle::Gradient::Stop::m_color
MWAWColor m_color
the color
Definition MWAWGraphicStyle.hxx:175
MWAWGraphicStyle::Gradient::Stop::cmp
int cmp(Stop const &a) const
compare two gradient
Definition MWAWGraphicStyle.hxx:153
MWAWGraphicStyle::Gradient::Stop::Stop
Stop(float offset=0.0, MWAWColor const &col=MWAWColor::black(), float opacity=1.0)
constructor
Definition MWAWGraphicStyle.hxx:146
MWAWGraphicStyle::Gradient
a basic gradient used in a MWAWGraphicStyle
Definition MWAWGraphicStyle.hxx:142
MWAWGraphicStyle::Gradient::m_radius
float m_radius
the gradient radius
Definition MWAWGraphicStyle.hxx:275
MWAWGraphicStyle::Gradient::m_stopList
std::vector< Stop > m_stopList
the list of gradient limits
Definition MWAWGraphicStyle.hxx:267
MWAWGraphicStyle::Gradient::Gradient
Gradient()
constructor
Definition MWAWGraphicStyle.hxx:182
MWAWGraphicStyle::Gradient::Type
Type
an enum used to define the gradient type
Definition MWAWGraphicStyle.hxx:180
MWAWGraphicStyle::Gradient::G_Axial
@ G_Axial
Definition MWAWGraphicStyle.hxx:180
MWAWGraphicStyle::Gradient::G_Linear
@ G_Linear
Definition MWAWGraphicStyle.hxx:180
MWAWGraphicStyle::Gradient::G_Square
@ G_Square
Definition MWAWGraphicStyle.hxx:180
MWAWGraphicStyle::Gradient::G_Rectangular
@ G_Rectangular
Definition MWAWGraphicStyle.hxx:180
MWAWGraphicStyle::Gradient::G_Radial
@ G_Radial
Definition MWAWGraphicStyle.hxx:180
MWAWGraphicStyle::Gradient::G_None
@ G_None
Definition MWAWGraphicStyle.hxx:180
MWAWGraphicStyle::Gradient::G_Ellipsoid
@ G_Ellipsoid
Definition MWAWGraphicStyle.hxx:180
MWAWGraphicStyle::Gradient::addTo
void addTo(librevenge::RVNGPropertyList &propList) const
add a gradient to the propList
Definition MWAWGraphicStyle.cxx:191
MWAWGraphicStyle::Gradient::hasGradient
bool hasGradient(bool complex=false) const
returns true if the gradient is defined
Definition MWAWGraphicStyle.hxx:194
MWAWGraphicStyle::Gradient::m_angle
float m_angle
the gradient angle
Definition MWAWGraphicStyle.hxx:269
MWAWGraphicStyle::Gradient::m_border
float m_border
the gradient border opacity
Definition MWAWGraphicStyle.hxx:271
MWAWGraphicStyle::Gradient::cmp
int cmp(Gradient const &a) const
compare two gradient
Definition MWAWGraphicStyle.hxx:244
MWAWGraphicStyle::Gradient::operator<<
friend std::ostream & operator<<(std::ostream &o, Gradient const &grad)
a print operator
Definition MWAWGraphicStyle.hxx:203
MWAWGraphicStyle::Gradient::getAverageColor
bool getAverageColor(MWAWColor &color) const
returns the average gradient color if the gradient is defined.
Definition MWAWGraphicStyle.cxx:168
MWAWGraphicStyle::Gradient::m_percentCenter
MWAWVec2f m_percentCenter
the gradient center
Definition MWAWGraphicStyle.hxx:273
MWAWGraphicStyle::Gradient::m_type
Type m_type
the gradient type
Definition MWAWGraphicStyle.hxx:265
MWAWGraphicStyle::Hatch
a basic hatch used in MWAWGraphicStyle
Definition MWAWGraphicStyle.hxx:279
MWAWGraphicStyle::Hatch::m_distance
float m_distance
the hatch distance in inches
Definition MWAWGraphicStyle.hxx:343
MWAWGraphicStyle::Hatch::operator<<
friend std::ostream & operator<<(std::ostream &o, Hatch const &hatch)
a print operator
Definition MWAWGraphicStyle.hxx:298
MWAWGraphicStyle::Hatch::Type
Type
the potential type
Definition MWAWGraphicStyle.hxx:281
MWAWGraphicStyle::Hatch::H_Triple
@ H_Triple
Definition MWAWGraphicStyle.hxx:281
MWAWGraphicStyle::Hatch::H_Single
@ H_Single
Definition MWAWGraphicStyle.hxx:281
MWAWGraphicStyle::Hatch::H_None
@ H_None
Definition MWAWGraphicStyle.hxx:281
MWAWGraphicStyle::Hatch::H_Double
@ H_Double
Definition MWAWGraphicStyle.hxx:281
MWAWGraphicStyle::Hatch::hasHatch
bool hasHatch() const
returns true if the gradient is defined
Definition MWAWGraphicStyle.hxx:291
MWAWGraphicStyle::Hatch::Hatch
Hatch()
constructor
Definition MWAWGraphicStyle.hxx:283
MWAWGraphicStyle::Hatch::m_color
MWAWColor m_color
the hatch color
Definition MWAWGraphicStyle.hxx:341
MWAWGraphicStyle::Hatch::cmp
int cmp(Hatch const &a) const
compare two hatchs
Definition MWAWGraphicStyle.hxx:326
MWAWGraphicStyle::Hatch::addTo
void addTo(librevenge::RVNGPropertyList &propList) const
add a hatch to the propList
Definition MWAWGraphicStyle.cxx:251
MWAWGraphicStyle::Hatch::m_rotation
float m_rotation
the rotation (in degrees)
Definition MWAWGraphicStyle.hxx:345
MWAWGraphicStyle::Hatch::m_type
Type m_type
the hatch type
Definition MWAWGraphicStyle.hxx:339
MWAWGraphicStyle::Pattern
a basic pattern used in a MWAWGraphicStyle:
Definition MWAWGraphicStyle.hxx:351
MWAWGraphicStyle::Pattern::m_colors
MWAWColor m_colors[2]
the two indexed colors
Definition MWAWGraphicStyle.hxx:435
MWAWGraphicStyle::Pattern::Pattern
Pattern()
constructor
Definition MWAWGraphicStyle.hxx:353
MWAWGraphicStyle::Pattern::m_dim
MWAWVec2i m_dim
the dimension width x height
Definition MWAWGraphicStyle.hxx:432
MWAWGraphicStyle::Pattern::operator<<
friend std::ostream & operator<<(std::ostream &o, Pattern const &pat)
a print operator
Definition MWAWGraphicStyle.hxx:414
MWAWGraphicStyle::Pattern::getAverageColor
bool getAverageColor(MWAWColor &col) const
return the average color
Definition MWAWGraphicStyle.cxx:101
MWAWGraphicStyle::Pattern::Pattern
Pattern(MWAWVec2i dim, MWAWEmbeddedObject const &picture, MWAWColor const &avColor)
constructor from a binary data
Definition MWAWGraphicStyle.hxx:363
MWAWGraphicStyle::Pattern::operator=
Pattern & operator=(Pattern const &)=default
MWAWGraphicStyle::Pattern::m_data
std::vector< unsigned char > m_data
the pattern data: a sequence of data: p[0..7,0],p[8..15,0]...p[0..7,1],p[8..15,1],...
Definition MWAWGraphicStyle.hxx:437
MWAWGraphicStyle::Pattern::operator=
Pattern & operator=(Pattern &&)=default
MWAWGraphicStyle::Pattern::m_pictureAverageColor
MWAWColor m_pictureAverageColor
the picture average color
Definition MWAWGraphicStyle.hxx:442
MWAWGraphicStyle::Pattern::Pattern
Pattern(Pattern const &)=default
MWAWGraphicStyle::Pattern::getUniqueColor
bool getUniqueColor(MWAWColor &col) const
check if the pattern has only one color; if so returns true...
Definition MWAWGraphicStyle.cxx:86
MWAWGraphicStyle::Pattern::cmp
int cmp(Pattern const &a) const
compare two patterns
Definition MWAWGraphicStyle.hxx:393
MWAWGraphicStyle::Pattern::getBinary
bool getBinary(MWAWEmbeddedObject &picture) const
tries to convert the picture in a binary data ( ppm)
Definition MWAWGraphicStyle.cxx:128
MWAWGraphicStyle::Pattern::~Pattern
virtual ~Pattern()
virtual destructor
Definition MWAWGraphicStyle.cxx:82
MWAWGraphicStyle::Pattern::m_picture
MWAWEmbeddedObject m_picture
a picture
Definition MWAWGraphicStyle.hxx:440
MWAWGraphicStyle::Pattern::empty
bool empty() const
return true if we does not have a pattern
Definition MWAWGraphicStyle.hxx:378