libwps_internal.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwps
3  * Version: MPL 2.0 / LGPLv2.1+
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * Major Contributor(s):
10  * Copyright (C) 2002 William Lachance (william.lachance@sympatico.ca)
11  * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
12  *
13  * For minor contributions see the git repository.
14  *
15  * Alternatively, the contents of this file may be used under the terms
16  * of the GNU Lesser General Public License Version 2.1 or later
17  * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
18  * applicable instead of those above.
19  *
20  * For further information visit http://libwps.sourceforge.net
21  */
22 
23 #ifndef LIBWPS_INTERNAL_H
24 #define LIBWPS_INTERNAL_H
25 
26 #include <assert.h>
27 #ifdef DEBUG
28 #include <stdio.h>
29 #endif
30 
31 #include <cmath>
32 #include <iostream>
33 #include <map>
34 #include <string>
35 #include <vector>
36 
37 #include <librevenge-stream/librevenge-stream.h>
38 #include <librevenge/librevenge.h>
39 
40 #ifndef M_PI
41 #define M_PI 3.14159265358979323846
42 #endif
43 
44 #if defined(_MSC_VER) || defined(__DJGPP__)
45 typedef signed char int8_t;
46 typedef unsigned char uint8_t;
47 typedef signed short int16_t;
48 typedef unsigned short uint16_t;
49 typedef signed int int32_t;
50 typedef unsigned int uint32_t;
51 #else /* !_MSC_VER && !__DJGPP__*/
52 # include <inttypes.h>
53 #endif /* _MSC_VER || __DJGPP__*/
54 
55 /* ---------- memory --------------- */
56 #ifdef HAVE_CONFIG_H
57 # include "config.h"
58 #endif
59 
60 // define localtime_r on Windows, so that can use
61 // thread-safe functions on other environments
62 #ifdef _WIN32
63 # define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
64 # define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0)
65 #endif
66 
67 #if defined(SHAREDPTR_TR1)
68 #include <tr1/memory>
69 using std::tr1::shared_ptr;
70 #elif defined(SHAREDPTR_STD)
71 #include <memory>
72 using std::shared_ptr;
73 #else
74 #include <boost/shared_ptr.hpp>
75 using boost::shared_ptr;
76 #endif
77 
79 template <class T>
81 {
82  void operator()(T *) {}
83 };
84 
85 // basic classes and autoptr
87 typedef shared_ptr<librevenge::RVNGInputStream> RVNGInputStreamPtr;
88 
89 class WPSCell;
90 class WPSListener;
91 class WPSContentListener;
92 class WPSEntry;
93 class WPSFont;
94 class WPSHeader;
95 class WPSPosition;
96 class WPSSubDocument;
97 
98 class WKSContentListener;
100 
102 typedef shared_ptr<WPSCell> WPSCellPtr;
104 typedef shared_ptr<WPSListener> WPSListenerPtr;
106 typedef shared_ptr<WPSContentListener> WPSContentListenerPtr;
108 typedef shared_ptr<WPSHeader> WPSHeaderPtr;
110 typedef shared_ptr<WPSSubDocument> WPSSubDocumentPtr;
111 
113 typedef shared_ptr<WKSContentListener> WKSContentListenerPtr;
115 typedef shared_ptr<WKSSubDocument> WKSSubDocumentPtr;
116 
117 #if defined(__clang__) || defined(__GNUC__)
118 # define WPS_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((__format__(__printf__, fmt, arg)))
119 #else
120 # define WPS_ATTRIBUTE_PRINTF(fmt, arg)
121 #endif
122 /* ---------- debug --------------- */
123 #ifdef DEBUG
124 namespace libwps
125 {
126 void printDebugMsg(const char *format, ...) WPS_ATTRIBUTE_PRINTF(1, 2);
127 }
128 #define WPS_DEBUG_MSG(M) libwps::printDebugMsg M
129 #else
130 #define WPS_DEBUG_MSG(M)
131 #endif
132 
133 /* ---------- exception ------------ */
134 namespace libwps
135 {
136 // Various exceptions
138 {
139  // needless to say, we could flesh this class out a bit
140 };
141 
143 {
144  // needless to say, we could flesh this class out a bit
145 };
146 
148 {
149  // needless to say, we could flesh this class out a bit
150 };
151 
153 {
154  // needless to say, we could flesh this class out a bit
155 };
156 }
157 
158 /* ---------- input ----------------- */
159 namespace libwps
160 {
161 uint8_t readU8(librevenge::RVNGInputStream *input);
162 uint16_t readU16(librevenge::RVNGInputStream *input);
163 uint32_t readU32(librevenge::RVNGInputStream *input);
164 
165 int8_t read8(librevenge::RVNGInputStream *input);
166 int16_t read16(librevenge::RVNGInputStream *input);
167 int32_t read32(librevenge::RVNGInputStream *input);
168 
169 inline uint8_t readU8(RVNGInputStreamPtr &input)
170 {
171  return readU8(input.get());
172 }
173 inline uint16_t readU16(RVNGInputStreamPtr &input)
174 {
175  return readU16(input.get());
176 }
177 inline uint32_t readU32(RVNGInputStreamPtr &input)
178 {
179  return readU32(input.get());
180 }
181 
182 inline int8_t read8(RVNGInputStreamPtr &input)
183 {
184  return read8(input.get());
185 }
186 inline int16_t read16(RVNGInputStreamPtr &input)
187 {
188  return read16(input.get());
189 }
190 inline int32_t read32(RVNGInputStreamPtr &input)
191 {
192  return read32(input.get());
193 }
194 
196 bool readDouble4(RVNGInputStreamPtr &input, double &res, bool &isNaN);
198 bool readDouble8(RVNGInputStreamPtr &input, double &res, bool &isNaN);
200 bool readDouble10(RVNGInputStreamPtr &input, double &res, bool &isNaN);
202 bool readDouble2Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN);
204 bool readDouble4Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN);
205 
206 bool readData(RVNGInputStreamPtr &input, unsigned long sz, librevenge::RVNGBinaryData &data);
207 bool readDataToEnd(RVNGInputStreamPtr &input, librevenge::RVNGBinaryData &data);
208 }
209 
210 #define WPS_LE_GET_GUINT16(p) \
211  (uint16_t)((((uint8_t const *)(p))[0] << 0) | \
212  (((uint8_t const *)(p))[1] << 8))
213 #define WPS_LE_GET_GUINT32(p) \
214  (uint32_t)((((uint8_t const *)(p))[0] << 0) | \
215  (((uint8_t const *)(p))[1] << 8) | \
216  (((uint8_t const *)(p))[2] << 16) | \
217  (((uint8_t const *)(p))[3] << 24))
218 
219 // Various helper structures for the parser..
220 /* ---------- small enum/class ------------- */
221 
223 {
225  {
226  }
227  double m_width;
228  double m_leftGutter;
230 };
231 
233 {
235  {
236  }
237  uint32_t m_attributes;
238  uint8_t m_alignment;
239 };
240 
242 struct WPSColor
243 {
245  WPSColor(uint32_t argb=0) : m_value(argb)
246  {
247  }
249  WPSColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) :
250  m_value(uint32_t((a<<24)+(r<<16)+(g<<8)+b))
251  {
252  }
254  WPSColor &operator=(uint32_t argb)
255  {
256  m_value = argb;
257  return *this;
258  }
260  static WPSColor black()
261  {
262  return WPSColor(0,0,0);
263  }
265  static WPSColor white()
266  {
267  return WPSColor(255,255,255);
268  }
269 
271  static WPSColor barycenter(float alpha, WPSColor const &colA,
272  float beta, WPSColor const &colB);
274  uint32_t value() const
275  {
276  return m_value;
277  }
279  unsigned char getAlpha() const
280  {
281  return (unsigned char)((m_value>>24)&0xFF);
282  }
284  unsigned char getBlue() const
285  {
286  return (unsigned char)(m_value&0xFF);
287  }
289  unsigned char getRed() const
290  {
291  return (unsigned char)((m_value>>16)&0xFF);
292  }
294  unsigned char getGreen() const
295  {
296  return (unsigned char)((m_value>>8)&0xFF);
297  }
299  bool isBlack() const
300  {
301  return (m_value&0xFFFFFF)==0;
302  }
304  bool isWhite() const
305  {
306  return (m_value&0xFFFFFF)==0xFFFFFF;
307  }
309  bool operator==(WPSColor const &c) const
310  {
311  return (c.m_value&0xFFFFFF)==(m_value&0xFFFFFF);
312  }
314  bool operator!=(WPSColor const &c) const
315  {
316  return !operator==(c);
317  }
319  bool operator<(WPSColor const &c) const
320  {
321  return (c.m_value&0xFFFFFF)<(m_value&0xFFFFFF);
322  }
324  bool operator<=(WPSColor const &c) const
325  {
326  return (c.m_value&0xFFFFFF)<=(m_value&0xFFFFFF);
327  }
329  bool operator>(WPSColor const &c) const
330  {
331  return !operator<=(c);
332  }
334  bool operator>=(WPSColor const &c) const
335  {
336  return !operator<(c);
337  }
339  friend std::ostream &operator<< (std::ostream &o, WPSColor const &c);
341  std::string str() const;
342 protected:
344  uint32_t m_value;
345 };
346 
348 struct WPSBorder
349 {
353  enum Type { Single, Double, Triple };
354  enum Pos { Left = 0, Right = 1, Top = 2, Bottom = 3 };
355  enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08 };
356 
362  bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const;
364  bool isEmpty() const
365  {
366  return m_style==None || m_width <= 0;
367  }
368 
370  bool operator==(WPSBorder const &orig) const
371  {
372  return m_style == orig.m_style && m_type == orig.m_type && m_width == orig.m_width
373  && m_color == orig.m_color;
374  }
376  bool operator!=(WPSBorder const &orig) const
377  {
378  return !operator==(orig);
379  }
381  int compare(WPSBorder const &orig) const;
382 
384  friend std::ostream &operator<< (std::ostream &o, WPSBorder const &border);
386  friend std::ostream &operator<< (std::ostream &o, WPSBorder::Style const &style);
392  int m_width;
396  std::vector<double> m_widthsList;
400  std::string m_extra;
401 };
402 
403 namespace libwps
404 {
406 std::string numberingTypeToString(NumberingType type);
410  };
411 enum { NoBreakBit = 0x1, NoBreakWithNextBit=0x2};
412 }
413 
414 // ATTRIBUTE bits
415 #define WPS_EXTRA_LARGE_BIT 1
416 #define WPS_VERY_LARGE_BIT 2
417 #define WPS_LARGE_BIT 4
418 #define WPS_SMALL_PRINT_BIT 8
419 #define WPS_FINE_PRINT_BIT 0x10
420 #define WPS_SUPERSCRIPT_BIT 0x20
421 #define WPS_SUBSCRIPT_BIT 0x40
422 #define WPS_OUTLINE_BIT 0x80
423 #define WPS_ITALICS_BIT 0x100
424 #define WPS_SHADOW_BIT 0x200
425 #define WPS_REDLINE_BIT 0x400
426 #define WPS_DOUBLE_UNDERLINE_BIT 0x800
427 #define WPS_BOLD_BIT 0x1000
428 #define WPS_STRIKEOUT_BIT 0x2000
429 #define WPS_UNDERLINE_BIT 0x4000
430 #define WPS_SMALL_CAPS_BIT 0x8000
431 #define WPS_BLINK_BIT 0x10000L
432 #define WPS_REVERSEVIDEO_BIT 0x20000L
433 #define WPS_ALL_CAPS_BIT 0x40000L
434 #define WPS_EMBOSS_BIT 0x80000L
435 #define WPS_ENGRAVE_BIT 0x100000L
436 #define WPS_OVERLINE_BIT 0x400000L
437 #define WPS_HIDDEN_BIT 0x800000L
438 
439 // BREAK bits
440 #define WPS_PAGE_BREAK 0x00
441 #define WPS_SOFT_PAGE_BREAK 0x01
442 #define WPS_COLUMN_BREAK 0x02
443 
444 // Generic bits
445 #define WPS_LEFT 0x00
446 #define WPS_RIGHT 0x01
447 #define WPS_CENTER 0x02
448 #define WPS_TOP 0x03
449 #define WPS_BOTTOM 0x04
450 
451 /* ---------- vec2/box2f ------------- */
455 template <class T> class Vec2
456 {
457 public:
459  Vec2(T xx=0,T yy=0) : m_x(xx), m_y(yy) { }
461  template <class U> Vec2(Vec2<U> const &p) : m_x(T(p.x())), m_y(T(p.y())) {}
462 
464  T x() const
465  {
466  return m_x;
467  }
469  T y() const
470  {
471  return m_y;
472  }
474  T operator[](int c) const
475  {
476  if (c<0 || c>1) throw libwps::GenericException();
477  return (c==0) ? m_x : m_y;
478  }
480  T &operator[](int c)
481  {
482  if (c<0 || c>1) throw libwps::GenericException();
483  return (c==0) ? m_x : m_y;
484  }
485 
487  void set(T xx, T yy)
488  {
489  m_x = xx;
490  m_y = yy;
491  }
493  void setX(T xx)
494  {
495  m_x = xx;
496  }
498  void setY(T yy)
499  {
500  m_y = yy;
501  }
502 
504  void add(T dx, T dy)
505  {
506  m_x += dx;
507  m_y += dy;
508  }
509 
512  {
513  m_x += p.m_x;
514  m_y += p.m_y;
515  return *this;
516  }
519  {
520  m_x -= p.m_x;
521  m_y -= p.m_y;
522  return *this;
523  }
525  template <class U>
526  Vec2<T> &operator*=(U scale)
527  {
528  m_x = T(m_x*scale);
529  m_y = T(m_y*scale);
530  return *this;
531  }
532 
534  friend Vec2<T> operator+(Vec2<T> const &p1, Vec2<T> const &p2)
535  {
536  Vec2<T> p(p1);
537  return p+=p2;
538  }
540  friend Vec2<T> operator-(Vec2<T> const &p1, Vec2<T> const &p2)
541  {
542  Vec2<T> p(p1);
543  return p-=p2;
544  }
546  template <class U>
547  friend Vec2<T> operator*(U scale, Vec2<T> const &p1)
548  {
549  Vec2<T> p(p1);
550  return p *= scale;
551  }
552 
554  bool operator==(Vec2<T> const &p) const
555  {
556  return cmpY(p) == 0;
557  }
559  bool operator!=(Vec2<T> const &p) const
560  {
561  return cmpY(p) != 0;
562  }
564  bool operator<(Vec2<T> const &p) const
565  {
566  return cmpY(p) < 0;
567  }
569  int cmp(Vec2<T> const &p) const
570  {
571  if (m_x<p.m_x) return -1;
572  if (m_x>p.m_x) return 1;
573  if (m_y<p.m_y) return -1;
574  if (m_y>p.m_y) return 1;
575  return 0;
576  }
578  int cmpY(Vec2<T> const &p) const
579  {
580  if (m_y<p.m_y) return -1;
581  if (m_y>p.m_y) return 1;
582  if (m_x<p.m_x) return -1;
583  if (m_x>p.m_x) return 1;
584  return 0;
585  }
586 
588  friend std::ostream &operator<< (std::ostream &o, Vec2<T> const &f)
589  {
590  o << f.m_x << "x" << f.m_y;
591  return o;
592  }
593 
597  struct PosSizeLtX
598  {
600  bool operator()(Vec2<T> const &s1, Vec2<T> const &s2) const
601  {
602  return s1.cmp(s2) < 0;
603  }
604  };
608  typedef std::map<Vec2<T>, T,struct PosSizeLtX> MapX;
609 
613  struct PosSizeLtY
614  {
616  bool operator()(Vec2<T> const &s1, Vec2<T> const &s2) const
617  {
618  return s1.cmpY(s2) < 0;
619  }
620  };
624  typedef std::map<Vec2<T>, T,struct PosSizeLtY> MapY;
625 protected:
626  T m_x, m_y;
627 };
628 
632 typedef Vec2<int> Vec2i;
635 
639 template <class T> class Box2
640 {
641 public:
643  Box2(Vec2<T> minPt=Vec2<T>(), Vec2<T> maxPt=Vec2<T>())
644  {
645  m_pt[0] = minPt;
646  m_pt[1] = maxPt;
647  }
649  template <class U> Box2(Box2<U> const &p)
650  {
651  for (int c=0; c < 2; c++) m_pt[c] = p[c];
652  }
653 
655  Vec2<T> const &min() const
656  {
657  return m_pt[0];
658  }
660  Vec2<T> const &max() const
661  {
662  return m_pt[1];
663  }
666  {
667  return m_pt[0];
668  }
671  {
672  return m_pt[1];
673  }
674 
679  Vec2<T> const &operator[](int c) const
680  {
681  if (c<0 || c>1) throw libwps::GenericException();
682  return m_pt[c];
683  }
685  Vec2<T> size() const
686  {
687  return m_pt[1]-m_pt[0];
688  }
690  Vec2<T> center() const
691  {
692  return 0.5*(m_pt[0]+m_pt[1]);
693  }
694 
696  void set(Vec2<T> const &x, Vec2<T> const &y)
697  {
698  m_pt[0] = x;
699  m_pt[1] = y;
700  }
702  void setMin(Vec2<T> const &x)
703  {
704  m_pt[0] = x;
705  }
707  void setMax(Vec2<T> const &y)
708  {
709  m_pt[1] = y;
710  }
711 
713  void resizeFromMin(Vec2<T> const &sz)
714  {
715  m_pt[1] = m_pt[0]+sz;
716  }
718  void resizeFromMax(Vec2<T> const &sz)
719  {
720  m_pt[0] = m_pt[1]-sz;
721  }
723  void resizeFromCenter(Vec2<T> const &sz)
724  {
725  Vec2<T> ctr = 0.5*(m_pt[0]+m_pt[1]);
726  m_pt[0] = ctr - 0.5*sz;
727  m_pt[1] = ctr + (sz - 0.5*sz);
728  }
729 
731  template <class U> void scale(U factor)
732  {
733  m_pt[0] *= factor;
734  m_pt[1] *= factor;
735  }
736 
738  void extend(T val)
739  {
740  m_pt[0] -= Vec2<T>(val/2,val/2);
741  m_pt[1] += Vec2<T>(val-(val/2),val-(val/2));
742  }
744  Box2<T> getUnion(Box2<T> const &box) const
745  {
746  Box2<T> res;
747  res.m_pt[0]=Vec2<T>(m_pt[0][0]<box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
748  m_pt[0][1]<box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
749  res.m_pt[1]=Vec2<T>(m_pt[1][0]>box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
750  m_pt[1][1]>box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
751  return res;
752  }
754  Box2<T> getIntersection(Box2<T> const &box) const
755  {
756  Box2<T> res;
757  res.m_pt[0]=Vec2<T>(m_pt[0][0]>box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
758  m_pt[0][1]>box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
759  res.m_pt[1]=Vec2<T>(m_pt[1][0]<box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
760  m_pt[1][1]<box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
761  return res;
762  }
763 
765  bool operator==(Box2<T> const &p) const
766  {
767  return cmp(p) == 0;
768  }
770  bool operator!=(Box2<T> const &p) const
771  {
772  return cmp(p) != 0;
773  }
775  bool operator<(Box2<T> const &p) const
776  {
777  return cmp(p) < 0;
778  }
779 
781  int cmp(Box2<T> const &p) const
782  {
783  int diff = m_pt[0].cmpY(p.m_pt[0]);
784  if (diff) return diff;
785  diff = m_pt[1].cmpY(p.m_pt[1]);
786  if (diff) return diff;
787  return 0;
788  }
789 
791  friend std::ostream &operator<< (std::ostream &o, Box2<T> const &f)
792  {
793  o << "(" << f.m_pt[0] << "<->" << f.m_pt[1] << ")";
794  return o;
795  }
796 
800  struct PosSizeLt
801  {
803  bool operator()(Box2<T> const &s1, Box2<T> const &s2) const
804  {
805  return s1.cmp(s2) < 0;
806  }
807  };
811  typedef std::map<Box2<T>, T,struct PosSizeLt> Map;
812 
813 protected:
816 };
817 
819 typedef Box2<int> Box2i;
822 
823 #endif /* LIBWPS_INTERNAL_H */
824 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:39
Definition: libwps_internal.h:351
Definition: libwps_internal.h:405
shared_ptr< WPSContentListener > WPSContentListenerPtr
shared pointer to WPSContentListener
Definition: libwps_internal.h:106
bool readData(RVNGInputStreamPtr &input, unsigned long size, librevenge::RVNGBinaryData &data)
Definition: libwps_internal.cpp:331
Vec2< float > Vec2f
Vec2 of float.
Definition: libwps_internal.h:634
WPSColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition: libwps_internal.h:249
void set(Vec2< T > const &x, Vec2< T > const &y)
resets the data to minimum x and maximum y
Definition: libwps_internal.h:696
void setY(T yy)
resets the second element
Definition: libwps_internal.h:498
static WPSColor barycenter(float alpha, WPSColor const &colA, float beta, WPSColor const &colB)
return alpha*colA+beta*colB
Definition: libwps_internal.cpp:385
a border list
Definition: libwps_internal.h:348
Definition: libwps_internal.h:351
Definition: libwps_internal.h:232
Definition: libwps_internal.h:152
T m_x
first element
Definition: libwps_internal.h:626
Definition: libwps_internal.h:353
Definition: libwps_internal.cpp:37
Vec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition: libwps_internal.h:679
Vec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libwps_internal.h:655
shared_ptr< WPSSubDocument > WPSSubDocumentPtr
shared pointer to WPSSubDocument
Definition: libwps_internal.h:110
bool operator!=(Box2< T > const &p) const
comparison operator!=
Definition: libwps_internal.h:770
int cmp(Box2< T > const &p) const
comparison function : fist sorts min by Y,X values then max extremity
Definition: libwps_internal.h:781
Definition: libwps_internal.h:411
friend Vec2< T > operator-(Vec2< T > const &p1, Vec2< T > const &p2)
operator-
Definition: libwps_internal.h:540
Definition: libwps_internal.h:353
int32_t read32(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:84
T & operator[](int c)
operator[]
Definition: libwps_internal.h:480
Definition: libwps_internal.h:354
small class which defines a 2D Box
Definition: libwps_internal.h:639
Definition: libwps_internal.h:355
internal struct used to create sorted map, sorted first min then max
Definition: libwps_internal.h:800
define the font properties
Definition: WPSFont.h:36
bool operator==(WPSColor const &c) const
operator==
Definition: libwps_internal.h:309
void resizeFromMin(Vec2< T > const &sz)
resize the box keeping the minimum
Definition: libwps_internal.h:713
double m_leftGutter
Definition: libwps_internal.h:228
Definition: libwps_internal.h:351
#define WPS_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libwps_internal.h:120
virtual class for content listener
Definition: WPSListener.h:36
internal struct used to create sorted map, sorted by X
Definition: libwps_internal.h:597
static WPSColor black()
return the back color
Definition: libwps_internal.h:260
std::map< Vec2< bool >, bool, struct PosSizeLtY > MapY
Definition: libwps_internal.h:624
int m_width
the border width
Definition: libwps_internal.h:392
static WPSColor white()
return the white color
Definition: libwps_internal.h:265
Definition: libwps_internal.h:407
Definition: libwps_internal.h:354
Vec2< T > & operator+=(Vec2< T > const &p)
operator+=
Definition: libwps_internal.h:511
Definition: libwps_internal.h:405
void set(T xx, T yy)
resets the two elements
Definition: libwps_internal.h:487
Definition: libwps_internal.h:405
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition: libwps_internal.h:738
Definition: libwps_internal.h:407
Definition: WPSContentListener.h:44
WPSColor & operator=(uint32_t argb)
operator=
Definition: libwps_internal.h:254
bool readDouble4(RVNGInputStreamPtr &input, double &res, bool &isNaN)
read a double store with 4 bytes: mantisse 2.5 bytes, exponent 1.5 bytes
Definition: libwps_internal.cpp:89
uint32_t m_attributes
Definition: libwps_internal.h:237
Definition: libwps_internal.h:407
unsigned char getRed() const
returns the red value
Definition: libwps_internal.h:289
friend std::ostream & operator<<(std::ostream &o, WPSColor const &c)
operator<< in the form #rrggbb
Definition: libwps_internal.cpp:400
Box2< int > Box2i
Box2 of int.
Definition: libwps_internal.h:819
bool isBlack() const
return true if the color is black
Definition: libwps_internal.h:299
bool operator<(WPSColor const &c) const
operator<
Definition: libwps_internal.h:319
bool operator>=(WPSColor const &c) const
operator>=
Definition: libwps_internal.h:334
Vec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libwps_internal.h:670
a structure used to defined the cell position, and a format
Definition: WPSCell.h:251
double m_width
Definition: libwps_internal.h:227
Vec2< T > center() const
the box center
Definition: libwps_internal.h:690
Justification
Definition: libwps_internal.h:408
double m_rightGutter
Definition: libwps_internal.h:229
virtual class to define a sub document
Definition: WPSSubDocument.h:33
bool operator==(Vec2< T > const &p) const
comparison==
Definition: libwps_internal.h:554
Definition: libwps_internal.h:351
Definition: libwps_internal.h:405
bool readDouble10(RVNGInputStreamPtr &input, double &res, bool &isNaN)
read a double store with 10 bytes: mantisse 8 bytes, exponent 2 bytes
Definition: libwps_internal.cpp:223
shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:108
Definition: libwps_internal.h:354
Definition: libwps_internal.h:407
bool operator!=(Vec2< T > const &p) const
comparison!=
Definition: libwps_internal.h:559
T y() const
second element
Definition: libwps_internal.h:469
Vec2(T xx=0, T yy=0)
constructor
Definition: libwps_internal.h:459
Box2< float > Box2f
Box2 of float.
Definition: libwps_internal.h:821
shared_ptr< WPSListener > WPSListenerPtr
shared pointer to WPSListener
Definition: libwps_internal.h:104
void setX(T xx)
resets the first element
Definition: libwps_internal.h:493
Definition: libwps_internal.h:411
std::map< Box2< int >, int, struct PosSizeLt > Map
Definition: libwps_internal.h:811
WPSBorder()
constructor
Definition: libwps_internal.h:358
Definition: libwps_internal.h:354
SubDocumentType
Definition: libwps_internal.h:407
Definition: libwps_internal.h:405
Definition: libwps_internal.h:408
Definition: libwps_internal.h:407
Definition: libwps_internal.h:147
std::vector< double > m_widthsList
the different length used for each line/sep (if defined)
Definition: libwps_internal.h:396
Basic class used to store a spreadsheet sub document.
Definition: WKSSubDocument.h:35
Definition: libwps_internal.h:409
bool isWhite() const
return true if the color is white
Definition: libwps_internal.h:304
shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:113
Definition: WPSHeader.h:31
Vec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition: libwps_internal.h:660
bool operator!=(WPSBorder const &orig) const
operator!=
Definition: libwps_internal.h:376
Definition: libwps_internal.h:407
Definition: libwps_internal.h:137
unsigned char getBlue() const
returns the green value
Definition: libwps_internal.h:284
Box2(Box2< U > const &p)
generic constructor
Definition: libwps_internal.h:649
uint32_t m_value
the argb color
Definition: libwps_internal.h:344
internal struct used to create sorted map, sorted by Y
Definition: libwps_internal.h:613
Vec2< T > m_pt[2]
the two extremities
Definition: libwps_internal.h:815
T x() const
first element
Definition: libwps_internal.h:464
void operator()(T *)
Definition: libwps_internal.h:82
Type
the line repetition
Definition: libwps_internal.h:353
int8_t read8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:58
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition: libwps_internal.h:504
uint8_t m_alignment
Definition: libwps_internal.h:238
Definition: libwps_internal.h:222
bool operator()(Vec2< T > const &s1, Vec2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:616
bool isEmpty() const
returns true if the border is empty
Definition: libwps_internal.h:364
WPSColumnProperties()
Definition: libwps_internal.h:234
Vec2< T > & operator-=(Vec2< T > const &p)
operator-=
Definition: libwps_internal.h:518
WPSColor m_color
the border color
Definition: libwps_internal.h:398
Vec2< T > & operator*=(U scale)
generic operator*=
Definition: libwps_internal.h:526
NumberingType
Definition: libwps_internal.h:405
uint32_t value() const
return the rgba value
Definition: libwps_internal.h:274
bool operator!=(WPSColor const &c) const
operator!=
Definition: libwps_internal.h:314
Definition: libwps_internal.h:355
int cmpY(Vec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libwps_internal.h:578
bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const
add the border property to proplist (if needed )
Definition: libwps_internal.cpp:441
std::map< Vec2< bool >, bool, struct PosSizeLtX > MapX
Definition: libwps_internal.h:608
int16_t read16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:70
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
bool readDouble4Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN)
read a double store with 4 bytes: exponent 3.5 bytes, mantisse 0.5 bytes
Definition: libwps_internal.cpp:302
Vec2< int > Vec2i
Vec2 of int.
Definition: libwps_internal.h:632
the class to store a color
Definition: libwps_internal.h:242
friend std::ostream & operator<<(std::ostream &o, WPSBorder const &border)
operator<<
Definition: libwps_internal.cpp:543
Definition: libwps_internal.h:351
Pos
Definition: libwps_internal.h:354
Definition: libwps_internal.h:409
Vec2(Vec2< U > const &p)
generic copy constructor
Definition: libwps_internal.h:461
bool operator==(Box2< T > const &p) const
comparison operator==
Definition: libwps_internal.h:765
T operator[](int c) const
operator[]
Definition: libwps_internal.h:474
int compare(WPSBorder const &orig) const
compare two cell
Definition: libwps_internal.cpp:423
unsigned char getGreen() const
returns the green value
Definition: libwps_internal.h:294
void resizeFromMax(Vec2< T > const &sz)
resize the box keeping the maximum
Definition: libwps_internal.h:718
bool operator<=(WPSColor const &c) const
operator<=
Definition: libwps_internal.h:324
uint16_t readU16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:63
bool readDataToEnd(RVNGInputStreamPtr &input, librevenge::RVNGBinaryData &data)
Definition: libwps_internal.cpp:345
void scale(U factor)
scales all points of the box by factor
Definition: libwps_internal.h:731
std::string numberingTypeToString(NumberingType type)
Definition: libwps_internal.cpp:356
bool operator>(WPSColor const &c) const
operator>
Definition: libwps_internal.h:329
void setMax(Vec2< T > const &y)
resets the maximum point
Definition: libwps_internal.h:707
Box2< T > getUnion(Box2< T > const &box) const
returns the union between this and box
Definition: libwps_internal.h:744
Style
the line style
Definition: libwps_internal.h:351
Definition: libwps_internal.h:353
bool operator==(WPSBorder const &orig) const
operator==
Definition: libwps_internal.h:370
void setMin(Vec2< T > const &x)
resets the minimum point
Definition: libwps_internal.h:702
uint32_t readU32(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:75
Box2(Vec2< T > minPt=Vec2< T >(), Vec2< T > maxPt=Vec2< T >())
constructor
Definition: libwps_internal.h:643
Definition: libwps_internal.h:142
Definition: libwps_internal.h:355
WPSColumnDefinition()
Definition: libwps_internal.h:224
Style m_style
the border style
Definition: libwps_internal.h:388
Definition: libwps_internal.h:408
Definition: libwps_internal.h:405
shared_ptr< WKSSubDocument > WKSSubDocumentPtr
shared pointer to WKSSubDocument
Definition: libwps_internal.h:115
bool readDouble8(RVNGInputStreamPtr &input, double &res, bool &isNaN)
read a double store with 8 bytes: mantisse 6.5 bytes, exponent 1.5 bytes
Definition: libwps_internal.cpp:172
Definition: libwps_internal.h:408
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:37
small class which defines a vector with 2 elements
Definition: libwps_internal.h:455
bool operator()(Vec2< T > const &s1, Vec2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:600
Definition: libwps_internal.h:405
friend Vec2< T > operator*(U scale, Vec2< T > const &p1)
generic operator*
Definition: libwps_internal.h:547
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: WPSPosition.h:39
Vec2< T > size() const
the box size
Definition: libwps_internal.h:685
std::string m_extra
extra data ( if needed)
Definition: libwps_internal.h:400
shared_ptr< WPSCell > WPSCellPtr
shared pointer to WPSCell
Definition: libwps_internal.h:99
bool readDouble2Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN)
read a double store with 2 bytes: exponent 1.5 bytes, kind of mantisse 0.5 bytes
Definition: libwps_internal.cpp:272
Box2< T > getIntersection(Box2< T > const &box) const
returns the intersection between this and box
Definition: libwps_internal.h:754
WPSColor(uint32_t argb=0)
constructor
Definition: libwps_internal.h:245
T m_y
second element
Definition: libwps_internal.h:626
a noop deleter used to transform a librevenge pointer in a false shared_ptr
Definition: libwps_internal.h:80
bool operator()(Box2< T > const &s1, Box2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:803
Type m_type
the border repetition
Definition: libwps_internal.h:390
Definition: WKSContentListener.h:50
int cmp(Vec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libwps_internal.h:569
std::string str() const
print the color in the form #rrggbb
Definition: libwps_internal.cpp:412
Vec2< bool > Vec2b
Vec2 of bool.
Definition: libwps_internal.h:630
Definition: libwps_internal.h:355
unsigned char getAlpha() const
returns the alpha value
Definition: libwps_internal.h:279
void resizeFromCenter(Vec2< T > const &sz)
resize the box keeping the center
Definition: libwps_internal.h:723
Vec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libwps_internal.h:665
friend Vec2< T > operator+(Vec2< T > const &p1, Vec2< T > const &p2)
operator+
Definition: libwps_internal.h:534

Generated on Wed Sep 23 2015 10:46:51 for libwps by doxygen 1.8.9.1