Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef STAR_GRAPHIC_STRUCT
00035 # define STAR_GRAPHIC_STRUCT
00036
00037 #include <ostream>
00038 #include <string>
00039 #include <vector>
00040
00041 #include "libstaroffice_internal.hxx"
00042
00043 class StarBitmap;
00044 class StarObject;
00045 class StarZone;
00046
00048 namespace StarGraphicStruct
00049 {
00051 class StarBrush
00052 {
00053 public:
00055 StarBrush() : m_transparency(0), m_color(STOFFColor::white()), m_fillColor(STOFFColor::white()), m_style(0), m_position(0), m_linkName(""), m_filterName(""), m_extra("")
00056 {
00057 }
00059 bool isEmpty() const
00060 {
00061 return m_style<=0 || m_style>=11 || m_transparency>=255;
00062 }
00064 bool hasUniqueColor() const
00065 {
00066 return m_style==1;
00067 }
00069 bool getColor(STOFFColor &color) const;
00071 bool getPattern(STOFFEmbeddedObject &object, STOFFVec2i &sz) const;
00073 bool read(StarZone &zone, int nVers, long endPos, StarObject &document);
00075 friend std::ostream &operator<<(std::ostream &o, StarBrush const &brush);
00077 int m_transparency;
00079 STOFFColor m_color;
00081 STOFFColor m_fillColor;
00084 int m_style;
00086 int m_position;
00088 librevenge::RVNGString m_linkName;
00090 librevenge::RVNGString m_filterName;
00092 std::string m_extra;
00093 };
00094
00096 class StarGraphic
00097 {
00098 public:
00100 StarGraphic() : m_object(), m_bitmap()
00101 {
00102 }
00104 bool read(StarZone &zone, long lastPos=-1);
00106 STOFFEmbeddedObject m_object;
00108 shared_ptr<StarBitmap> m_bitmap;
00109 };
00110
00112 class StarPolygon
00113 {
00114 public:
00116 struct Point {
00118 explicit Point(STOFFVec2i point=STOFFVec2i(), int flag=0) : m_point(point), m_flags(flag)
00119 {
00120 }
00122 friend std::ostream &operator<<(std::ostream &o, Point const &point)
00123 {
00124 o << point.m_point;
00125 switch (point.m_flags) {
00126 case 0:
00127 break;
00128 case 1:
00129 o << ":s";
00130 break;
00131 case 2:
00132 o << ":c";
00133 break;
00134 case 3:
00135 o << ":S";
00136 break;
00137 default:
00138 STOFF_DEBUG_MSG(("StarObjectSmallGraphicStruct::StarPolygon::Point::operator<< unexpected flag\n"));
00139 o << ":[##" << point.m_flags << "]";
00140 }
00141 return o;
00142 }
00144 STOFFVec2i m_point;
00146 int m_flags;
00147 };
00149 StarPolygon() : m_points()
00150 {
00151 }
00153 bool hasSpecialPoints() const
00154 {
00155 for (size_t i=0; i<m_points.size(); ++i) {
00156 if (m_points[i].m_flags)
00157 return true;
00158 }
00159 return false;
00160 }
00162 bool empty() const
00163 {
00164 return m_points.empty();
00165 }
00167 size_t size() const
00168 {
00169 return m_points.size();
00170 }
00172 void addToPath(librevenge::RVNGPropertyListVector &path, bool isClosed) const;
00174 bool convert(librevenge::RVNGString &path, librevenge::RVNGString &viewbox) const;
00176 friend std::ostream &operator<<(std::ostream &o, StarPolygon const &poly);
00178 std::vector<Point> m_points;
00179 };
00180
00181 }
00182
00183 #endif
00184