23 #ifndef WPS_GRAPHIC_STYLE    24 #  define WPS_GRAPHIC_STYLE    29 #  include "librevenge/librevenge.h"    69                         o << 
"offset=" << st.
m_offset << 
",";
    70                         o << 
"color=" << st.
m_color << 
",";
    72                                 o << 
"opacity=" << st.
m_opacity*100.f << 
"%,";
    89                 Pattern() : m_dim(0,0), m_data(), m_picture(), m_pictureMime(
""), m_pictureAverageColor(
WPSColor::white())
    95                 Pattern(
Vec2i dim, librevenge::RVNGBinaryData 
const &picture, std::string 
const &mime, 
WPSColor const &avColor) :
    96                         m_dim(dim), m_data(), m_picture(picture), m_pictureMime(mime), m_pictureAverageColor(avColor)
   106                         if (m_dim[0]==0 || m_dim[1]==0) 
return true;
   107                         if (m_picture.size()) 
return false;
   108                         if (m_dim[0]!=8 && m_dim[0]!=16 && m_dim[0]!=32) 
return true;
   109                         return m_data.size()!=size_t((m_dim[0]/8)*m_dim[1]);
   112                 bool getAverageColor(
WPSColor &col) 
const;
   114                 bool getUniqueColor(
WPSColor &col) 
const;
   116                 bool getBinary(librevenge::RVNGBinaryData &data, std::string &type) 
const;
   121                         int diff = m_dim.cmp(a.
m_dim);
   122                         if (diff) 
return diff;
   123                         if (m_data.size() < a.
m_data.size()) 
return -1;
   124                         if (m_data.size() > a.
m_data.size()) 
return 1;
   125                         for (
size_t h=0; h < m_data.size(); ++h)
   127                                 if (m_data[h]<a.
m_data[h]) 
return 1;
   128                                 if (m_data[h]>a.
m_data[h]) 
return -1;
   130                         for (
int i=0; i<2; ++i)
   132                                 if (m_colors[i] < a.
m_colors[i]) 
return 1;
   133                                 if (m_colors[i] > a.
m_colors[i]) 
return -1;
   139                         if (m_picture.size() < a.
m_picture.size()) 
return 1;
   140                         if (m_picture.size() > a.
m_picture.size()) 
return -1;
   141                         const unsigned char *ptr=m_picture.getDataBuffer();
   142                         const unsigned char *aPtr=a.
m_picture.getDataBuffer();
   143                         if (!ptr || !aPtr) 
return 0; 
   144                         for (
unsigned long h=0; h < m_picture.size(); ++h, ++ptr, ++aPtr)
   146                                 if (*ptr < *aPtr) 
return 1;
   147                                 if (*ptr > *aPtr) 
return -1;
   154                         o << 
"dim=" << pat.
m_dim << 
",";
   165                                 for (
size_t h=0; h < pat.
m_data.size(); ++h)
   166                                         o << std::hex << (
int) pat.
m_data[h] << std::dec << 
",";
   299         void addTo(librevenge::RVNGPropertyList &pList, 
bool only1d=
false) 
const;
   301         void addFrameTo(librevenge::RVNGPropertyList &pList) 
const;
 int cmp(Pattern const &a) const
compare two patterns 
Definition: WPSGraphicStyle.h:119
virtual ~WPSGraphicStyle()
virtual destructor 
Definition: WPSGraphicStyle.h:208
bool m_flip[2]
two bool to indicated we need to flip the shape or not 
Definition: WPSGraphicStyle.h:372
a structure used to define the gradient limit 
Definition: WPSGraphicStyle.h:48
std::string m_pictureMime
the picture type 
Definition: WPSGraphicStyle.h:182
Vec2f m_shadowOffset
the shadow offset 
Definition: WPSGraphicStyle.h:329
a border list 
Definition: libwps_internal.h:393
float m_surfaceOpacity
true if the surface has some color 
Definition: WPSGraphicStyle.h:322
Definition: WPSGraphicStyle.h:45
bool hasLine() const
returns true if the border is defined 
Definition: WPSGraphicStyle.h:210
bool empty() const
return true if we does not have a pattern 
Definition: WPSGraphicStyle.h:104
LineJoin m_lineJoin
the line join 
Definition: WPSGraphicStyle.h:312
float m_shadowOpacity
true if the shadow has some color 
Definition: WPSGraphicStyle.h:327
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: WPSGraphicStyle.h:177
float m_rotate
the rotation 
Definition: WPSGraphicStyle.h:370
LineCap m_lineCap
the line cap 
Definition: WPSGraphicStyle.h:310
Definition: WPSGraphicStyle.h:43
Definition: WPSGraphicStyle.h:45
Definition: WPSGraphicStyle.h:45
WPSColor m_pictureAverageColor
the picture average color 
Definition: WPSGraphicStyle.h:184
std::vector< WPSBorder > const  & borders() const
return the frame border: libwps::Left | ... 
Definition: WPSGraphicStyle.h:285
static WPSColor black()
return the back color 
Definition: libwps_internal.h:305
void setBorders(int wh, WPSBorder const &border)
sets the cell border: wh=libwps::LeftBit|... 
Definition: WPSGraphicStyle.cpp:136
std::vector< WPSBorder > m_bordersList
the borders WPSBorder::Pos (for a frame) 
Definition: WPSGraphicStyle.h:359
static WPSColor white()
return the white color 
Definition: libwps_internal.h:310
int cmp(GradientStop const &a) const
compare two gradient 
Definition: WPSGraphicStyle.h:56
Definition: WPSGraphicStyle.h:45
std::vector< float > m_lineDashWidth
the dash array: a sequence of (fullsize, emptysize) 
Definition: WPSGraphicStyle.h:308
bool hasShadow() const
returns true if the shadow is defined 
Definition: WPSGraphicStyle.h:263
bool isWhite() const
return true if the color is white 
Definition: libwps_internal.h:349
float m_opacity
the opacity 
Definition: WPSGraphicStyle.h:80
virtual ~Pattern()
virtual destructor 
Definition: WPSGraphicStyle.h:102
Definition: WPSGraphicStyle.h:43
void setSurfaceColor(WPSColor const &col, float opacity=1)
set the surface color 
Definition: WPSGraphicStyle.h:215
float m_gradientAngle
the gradient angle 
Definition: WPSGraphicStyle.h:339
Vec2i m_dim
the dimension width x height 
Definition: WPSGraphicStyle.h:172
float m_gradientRadius
the gradient radius 
Definition: WPSGraphicStyle.h:345
Pattern(Vec2i dim, librevenge::RVNGBinaryData const &picture, std::string const &mime, WPSColor const &avColor)
constructor from a binary data 
Definition: WPSGraphicStyle.h:95
a structure used to define a picture style 
Definition: WPSGraphicStyle.h:37
Vec2f m_gradientPercentCenter
the gradient center 
Definition: WPSGraphicStyle.h:343
std::string m_frameName
the frame name 
Definition: WPSGraphicStyle.h:361
static WPSGraphicStyle emptyStyle()
returns an empty style. 
Definition: WPSGraphicStyle.h:201
bool isBlack() const
return true if the color is black 
Definition: libwps_internal.h:344
bool hasPattern() const
returns true if the pattern is defined 
Definition: WPSGraphicStyle.h:231
librevenge::RVNGBinaryData m_picture
a picture 
Definition: WPSGraphicStyle.h:180
LineJoin
an enum used to define the basic line join 
Definition: WPSGraphicStyle.h:43
bool hasBorders() const
return true if the frame has some border 
Definition: WPSGraphicStyle.h:268
void setPattern(Pattern const &pat)
set the pattern 
Definition: WPSGraphicStyle.h:226
Pattern m_pattern
the pattern if it exists 
Definition: WPSGraphicStyle.h:332
WPSColor m_shadowColor
the shadow color 
Definition: WPSGraphicStyle.h:325
bool hasSurface() const
returns true if the interior surface is defined 
Definition: WPSGraphicStyle.h:241
float m_lineOpacity
the line opacity: 0=transparent 
Definition: WPSGraphicStyle.h:314
float m_offset
the offset 
Definition: WPSGraphicStyle.h:76
WPSColor m_colors[2]
the two indexed colors 
Definition: WPSGraphicStyle.h:175
std::string m_extra
extra data 
Definition: WPSGraphicStyle.h:375
Definition: WPSGraphicStyle.h:45
std::vector< GradientStop > m_gradientStopList
the list of gradient limits 
Definition: WPSGraphicStyle.h:337
bool m_fillRuleEvenOdd
true if the fill rule is evenod 
Definition: WPSGraphicStyle.h:318
WPSColor m_backgroundColor
the background color 
Definition: WPSGraphicStyle.h:355
WPSColor m_color
the color 
Definition: WPSGraphicStyle.h:78
the class to store a color 
Definition: libwps_internal.h:287
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: WPSGraphicStyle.cpp:157
bool hasSurfaceColor() const
returns true if the surface is defined 
Definition: WPSGraphicStyle.h:221
WPSColor m_surfaceColor
the surface color 
Definition: WPSGraphicStyle.h:320
void addFrameTo(librevenge::RVNGPropertyList &pList) const
add all the frame parameters to propList: the background and the borders 
Definition: WPSGraphicStyle.cpp:361
Pattern()
constructor 
Definition: WPSGraphicStyle.h:89
Definition: WPSGraphicStyle.h:43
Definition: WPSGraphicStyle.h:41
bool hasGradient(bool complex=false) const
returns true if the gradient is defined 
Definition: WPSGraphicStyle.h:236
bool m_arrows[2]
two bool to indicated if extremity has arrow or not 
Definition: WPSGraphicStyle.h:348
WPSColor m_lineColor
the line color 
Definition: WPSGraphicStyle.h:316
float m_backgroundOpacity
true if the background has some color 
Definition: WPSGraphicStyle.h:357
float m_gradientBorder
the gradient border opacity 
Definition: WPSGraphicStyle.h:341
bool hasSameBorders() const
return true if the frame has some border 
Definition: WPSGraphicStyle.h:273
friend std::ostream & operator<<(std::ostream &o, Pattern const &pat)
a print operator 
Definition: WPSGraphicStyle.h:152
bool hasBackgroundColor() const
returns true if the background is defined 
Definition: WPSGraphicStyle.h:252
Definition: WPSGraphicStyle.h:41
GradientStop(float offset=0.0, WPSColor const &col=WPSColor::black(), float opacity=1.0)
constructor 
Definition: WPSGraphicStyle.h:51
LineCap
an enum used to define the basic line cap 
Definition: WPSGraphicStyle.h:41
WPSGraphicStyle()
constructor 
Definition: WPSGraphicStyle.h:187
void setBackgroundColor(WPSColor const &col, float opacity=1)
set the background color 
Definition: WPSGraphicStyle.h:246
float m_lineWidth
the linewidth 
Definition: WPSGraphicStyle.h:306
std::string m_frameNextName
the frame next name (if there is a link) 
Definition: WPSGraphicStyle.h:363
Definition: WPSGraphicStyle.h:41
void setShadowColor(WPSColor const &col, float opacity=1)
set the shadow color 
Definition: WPSGraphicStyle.h:257
a basic pattern used in a WPSGraphicStyle: 
Definition: WPSGraphicStyle.h:86
void resetBorders()
reset the border 
Definition: WPSGraphicStyle.h:290
Definition: WPSGraphicStyle.h:45
GradientType m_gradientType
the gradient type 
Definition: WPSGraphicStyle.h:335
GradientType
an enum used to define the gradient type 
Definition: WPSGraphicStyle.h:45
Definition: WPSGraphicStyle.h:45
friend std::ostream & operator<<(std::ostream &o, GradientStop const &st)
a print operator 
Definition: WPSGraphicStyle.h:67