33 #ifndef MWAW_GRAPHIC_STYLE 34 # define MWAW_GRAPHIC_STYLE 39 # include "librevenge/librevenge.h" 64 Arrow(
float w,
MWAWBox2i const &box, std::string path,
bool centered=
false) :
77 o <<
"w=" << arrow.
m_width <<
",";
78 o <<
"viewbox=" << arrow.
m_viewBox <<
",";
79 o <<
"path=" << arrow.
m_path <<
",";
92 return !(*
this==arrow);
103 return *
this<arrow || *
this==arrow;
108 return !(*
this<=arrow);
113 return !(*
this<arrow);
121 void addTo(librevenge::RVNGPropertyList &propList, std::string
const &type)
const;
137 m_offset(offset), m_color(col), m_opacity(opacity)
143 if (m_offset < a.
m_offset)
return -1;
144 if (m_offset > a.
m_offset)
return 1;
145 if (m_color < a.
m_color)
return -1;
146 if (m_color > a.
m_color)
return 1;
154 o <<
"offset=" << st.
m_offset <<
",";
155 o <<
"color=" << st.
m_color <<
",";
157 o <<
"opacity=" << st.
m_opacity*100.f <<
"%,";
180 m_dim(dim), m_data(), m_picture(picture), m_pictureAverageColor(avColor)
190 if (m_dim[0]==0 || m_dim[1]==0)
return true;
191 if (!m_picture.m_dataList.empty())
return false;
192 if (m_dim[0]!=8 && m_dim[0]!=16 && m_dim[0]!=32)
return true;
193 return m_data.size()!=size_t((m_dim[0]/8)*m_dim[1]);
196 bool getAverageColor(
MWAWColor &col)
const;
198 bool getUniqueColor(
MWAWColor &col)
const;
205 int diff = m_dim.cmp(a.
m_dim);
206 if (diff)
return diff;
207 if (m_data.size() < a.
m_data.size())
return -1;
208 if (m_data.size() > a.
m_data.size())
return 1;
209 for (
size_t h=0; h < m_data.size(); ++h) {
210 if (m_data[h]<a.
m_data[h])
return 1;
211 if (m_data[h]>a.
m_data[h])
return -1;
213 for (
int i=0; i<2; ++i) {
214 if (m_colors[i] < a.
m_colors[i])
return 1;
215 if (m_colors[i] > a.
m_colors[i])
return -1;
220 if (diff)
return diff;
226 o <<
"dim=" << pat.
m_dim <<
",";
235 for (
size_t h=0; h < pat.
m_data.size(); ++h)
236 o << std::hex << static_cast<int>(pat.
m_data[h]) << std::dec <<
",";
352 std::vector<MWAWBorder>
const &
borders()
const 366 void addTo(librevenge::RVNGPropertyList &pList,
bool only1d=
false)
const;
368 void addFrameTo(librevenge::RVNGPropertyList &pList)
const;
MWAWBox2i m_viewBox
the arrow viewbox
Definition: MWAWGraphicStyle.hxx:124
bool operator>(Arrow const &arrow) const
operator>
Definition: MWAWGraphicStyle.hxx:106
bool m_flip[2]
two bool to indicated we need to flip the shape or not
Definition: MWAWGraphicStyle.hxx:437
bool isEmpty() const
return true if the picture contains no data
Definition: libmwaw_internal.hxx:439
friend std::ostream & operator<<(std::ostream &o, GradientStop const &st)
a print operator
Definition: MWAWGraphicStyle.hxx:152
bool hasSurfaceColor() const
returns true if the surface is defined
Definition: MWAWGraphicStyle.hxx:288
MWAWVec2i m_dim
the dimension width x height
Definition: MWAWGraphicStyle.hxx:242
bool empty() const
return true if we does not have a pattern
Definition: MWAWGraphicStyle.hxx:188
MWAWColor m_surfaceColor
the surface color
Definition: MWAWGraphicStyle.hxx:385
std::string m_frameNextName
the frame next name (if there is a link)
Definition: MWAWGraphicStyle.hxx:427
MWAWColor m_shadowColor
the shadow color
Definition: MWAWGraphicStyle.hxx:390
Definition: MWAWGraphicStyle.hxx:53
float m_opacity
the opacity
Definition: MWAWGraphicStyle.hxx:165
float m_backgroundOpacity
true if the background has some color
Definition: MWAWGraphicStyle.hxx:419
std::string m_frameName
the frame name
Definition: MWAWGraphicStyle.hxx:425
float m_shadowOpacity
true if the shadow has some color
Definition: MWAWGraphicStyle.hxx:392
Pattern()
constructor
Definition: MWAWGraphicStyle.hxx:173
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:231
MWAWGraphicStyle()
constructor
Definition: MWAWGraphicStyle.hxx:255
Arrow()
constructor ( no arrow)
Definition: MWAWGraphicStyle.hxx:60
Definition: MWAWGraphicStyle.hxx:55
Pattern(MWAWVec2i dim, MWAWEmbeddedObject const &picture, MWAWColor const &avColor)
constructor from a binary data
Definition: MWAWGraphicStyle.hxx:179
MWAWVec2f m_gradientPercentCenter
the gradient center
Definition: MWAWGraphicStyle.hxx:408
MWAWEmbeddedObject m_picture
a picture
Definition: MWAWGraphicStyle.hxx:250
static Arrow plain()
returns a basic plain arrow
Definition: MWAWGraphicStyle.hxx:69
void setPattern(Pattern const &pat, float opacity=1)
set the pattern
Definition: MWAWGraphicStyle.hxx:293
MWAWColor m_colors[2]
the two indexed colors
Definition: MWAWGraphicStyle.hxx:245
LineCap
an enum used to define the basic line cap
Definition: MWAWGraphicStyle.hxx:51
LineJoin m_lineJoin
the line join
Definition: MWAWGraphicStyle.hxx:379
Arrow m_arrows[2]
the two arrows corresponding to start and end extremity
Definition: MWAWGraphicStyle.hxx:430
MWAWColor m_lineColor
the line color
Definition: MWAWGraphicStyle.hxx:383
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:226
float m_gradientRadius
the gradient radius
Definition: MWAWGraphicStyle.hxx:410
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
Definition: MWAWGraphicStyle.hxx:51
GradientType
an enum used to define the gradient type
Definition: MWAWGraphicStyle.hxx:55
bool m_isCentered
flag to know if the arrow is centered
Definition: MWAWGraphicStyle.hxx:130
bool operator<(Arrow const &arrow) const
operator<
Definition: MWAWGraphicStyle.hxx:95
Definition: MWAWGraphicStyle.hxx:55
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:778
MWAWBox2< int > MWAWBox2i
MWAWBox2 of int.
Definition: libmwaw_internal.hxx:1129
bool hasSameBorders() const
return true if the frame has some border
Definition: MWAWGraphicStyle.hxx:341
void addFrameTo(librevenge::RVNGPropertyList &pList) const
add all the frame parameters to propList: the background and the borders
Definition: MWAWGraphicStyle.cxx:370
the class to store a color
Definition: libmwaw_internal.hxx:182
Definition: MWAWGraphicStyle.hxx:51
float m_width
the arrow width in point
Definition: MWAWGraphicStyle.hxx:128
bool hasGradient(bool complex=false) const
returns true if the gradient is defined
Definition: MWAWGraphicStyle.hxx:304
float m_rotate
the rotation
Definition: MWAWGraphicStyle.hxx:421
std::vector< float > m_lineDashWidth
the dash array: a sequence of (fullsize, emptysize)
Definition: MWAWGraphicStyle.hxx:373
friend std::ostream & operator<<(std::ostream &o, Arrow const &arrow)
operator<<
Definition: MWAWGraphicStyle.hxx:74
a structure used to define the gradient limit in MWAWGraphicStyle
Definition: MWAWGraphicStyle.hxx:134
bool isEmpty() const
returns true if there is no arrow
Definition: MWAWGraphicStyle.hxx:116
a border
Definition: libmwaw_internal.hxx:314
Definition: MWAWGraphicStyle.hxx:55
std::string m_extra
extra data
Definition: MWAWGraphicStyle.hxx:442
bool hasPattern() const
returns true if the pattern is defined
Definition: MWAWGraphicStyle.hxx:299
MWAWVec2f m_shadowOffset
the shadow offset
Definition: MWAWGraphicStyle.hxx:394
LineCap m_lineCap
the line cap
Definition: MWAWGraphicStyle.hxx:377
float m_surfaceOpacity
true if the surface has some color
Definition: MWAWGraphicStyle.hxx:387
float m_gradientBorder
the gradient border opacity
Definition: MWAWGraphicStyle.hxx:406
GradientType m_gradientType
the gradient type
Definition: MWAWGraphicStyle.hxx:396
MWAWColor m_backgroundColor
the background color
Definition: MWAWGraphicStyle.hxx:417
Definition: MWAWGraphicStyle.hxx:53
float m_gradientAngle
the gradient angle
Definition: MWAWGraphicStyle.hxx:404
bool hasBackgroundColor() const
returns true if the background is defined
Definition: MWAWGraphicStyle.hxx:320
Pattern m_pattern
the pattern if it exists
Definition: MWAWGraphicStyle.hxx:399
bool hasBorders() const
return true if the frame has some border
Definition: MWAWGraphicStyle.hxx:336
Definition: MWAWGraphicStyle.hxx:53
void setSurfaceColor(MWAWColor const &col, float opacity=1)
set the surface color
Definition: MWAWGraphicStyle.hxx:282
Definition: MWAWGraphicStyle.hxx:51
bool m_fillRuleEvenOdd
true if the fill rule is evenod
Definition: MWAWGraphicStyle.hxx:440
small class use to define a embedded object
Definition: libmwaw_internal.hxx:425
bool hasSurface() const
returns true if the interior surface is defined
Definition: MWAWGraphicStyle.hxx:309
Definition: MWAWGraphicStyle.hxx:55
a structure used to define an arrow
Definition: MWAWGraphicStyle.hxx:58
std::vector< MWAWBorder > const & borders() const
return the frame border: libmwaw::Left | ...
Definition: MWAWGraphicStyle.hxx:352
Definition: MWAWGraphicStyle.hxx:55
bool operator==(Arrow const &arrow) const
operator==
Definition: MWAWGraphicStyle.hxx:84
int cmp(GradientStop const &a) const
compare two gradient
Definition: MWAWGraphicStyle.hxx:141
MWAWColor m_color
the color
Definition: MWAWGraphicStyle.hxx:163
Definition: MWAWGraphicStyle.hxx:55
bool operator!=(Arrow const &arrow) const
operator!=
Definition: MWAWGraphicStyle.hxx:90
bool hasShadow() const
returns true if the shadow is defined
Definition: MWAWGraphicStyle.hxx:331
std::vector< MWAWBorder > m_bordersList
the borders MWAWBorder::Pos (for a frame)
Definition: MWAWGraphicStyle.hxx:423
LineJoin
an enum used to define the basic line join
Definition: MWAWGraphicStyle.hxx:53
void setShadowColor(MWAWColor const &col, float opacity=1)
set the shadow color
Definition: MWAWGraphicStyle.hxx:325
virtual ~MWAWGraphicStyle()
virtual destructor
Definition: MWAWGraphicStyle.cxx:168
float m_lineOpacity
the line opacity: 0=transparent
Definition: MWAWGraphicStyle.hxx:381
MWAWColor m_pictureAverageColor
the picture average color
Definition: MWAWGraphicStyle.hxx:252
bool operator<=(Arrow const &arrow) const
operator<=
Definition: MWAWGraphicStyle.hxx:101
void setBackgroundColor(MWAWColor const &col, float opacity=1)
set the background color
Definition: MWAWGraphicStyle.hxx:314
float m_lineWidth
the linewidth
Definition: MWAWGraphicStyle.hxx:375
friend std::ostream & operator<<(std::ostream &o, Pattern const &pat)
a print operator
Definition: MWAWGraphicStyle.hxx:224
bool isWhite() const
return true if the color is white
Definition: libmwaw_internal.hxx:270
bool isBlack() const
return true if the color is black
Definition: libmwaw_internal.hxx:265
bool hasLine() const
returns true if the border is defined
Definition: MWAWGraphicStyle.hxx:277
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:247
int cmp(Pattern const &a) const
compare two patterns
Definition: MWAWGraphicStyle.hxx:203
GradientStop(float offset=0.0, MWAWColor const &col=MWAWColor::black(), float opacity=1.0)
constructor
Definition: MWAWGraphicStyle.hxx:136
Arrow(float w, MWAWBox2i const &box, std::string path, bool centered=false)
constructor
Definition: MWAWGraphicStyle.hxx:64
int cmp(MWAWGraphicStyle const &a) const
compare two styles
Definition: MWAWGraphicStyle.cxx:418
a basic pattern used in a MWAWGraphicStyle:
Definition: MWAWGraphicStyle.hxx:171
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
float m_offset
the offset
Definition: MWAWGraphicStyle.hxx:161
void setBorders(int wh, MWAWBorder const &border)
sets the cell border: wh=libmwaw::LeftBit|...
Definition: MWAWGraphicStyle.cxx:172
Definition: MWAWGraphicStyle.hxx:55
std::vector< GradientStop > m_gradientStopList
the list of gradient limits
Definition: MWAWGraphicStyle.hxx:402
bool operator>=(Arrow const &arrow) const
operator>=
Definition: MWAWGraphicStyle.hxx:111
std::string m_path
the arrow path
Definition: MWAWGraphicStyle.hxx:126
static MWAWGraphicStyle emptyStyle()
returns an empty style.
Definition: MWAWGraphicStyle.hxx:268
void resetBorders()
reset the border
Definition: MWAWGraphicStyle.hxx:357