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 <iostream>
32 #include <map>
33 #include <string>
34 #include <vector>
35 
36 #include <librevenge-stream/librevenge-stream.h>
37 #include <librevenge/librevenge.h>
38 
39 #if defined(_MSC_VER) || defined(__DJGPP__)
40 typedef signed char int8_t;
41 typedef unsigned char uint8_t;
42 typedef signed short int16_t;
43 typedef unsigned short uint16_t;
44 typedef signed int int32_t;
45 typedef unsigned int uint32_t;
46 #else /* !_MSC_VER && !__DJGPP__*/
47 # include <inttypes.h>
48 #endif /* _MSC_VER || __DJGPP__*/
49 
50 /* ---------- memory --------------- */
51 #ifdef HAVE_CONFIG_H
52 # include "config.h"
53 #endif
54 
55 // define localtime_r on Windows, so that can use
56 // thread-safe functions on other environments
57 #ifdef _WIN32
58 # define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
59 # define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0)
60 #endif
61 
62 #if defined(SHAREDPTR_TR1)
63 #include <tr1/memory>
64 using std::tr1::shared_ptr;
65 #elif defined(SHAREDPTR_STD)
66 #include <memory>
67 using std::shared_ptr;
68 #else
69 #include <boost/shared_ptr.hpp>
70 using boost::shared_ptr;
71 #endif
72 
74 template <class T>
76 {
77  void operator()(T *) {}
78 };
79 
80 // basic classes and autoptr
82 typedef shared_ptr<librevenge::RVNGInputStream> RVNGInputStreamPtr;
83 
84 class WPSCell;
85 class WPSListener;
86 class WPSContentListener;
87 class WPSEntry;
88 class WPSFont;
89 class WPSHeader;
90 class WPSPosition;
91 class WPSSubDocument;
92 
93 class WKSContentListener;
95 
97 typedef shared_ptr<WPSCell> WPSCellPtr;
99 typedef shared_ptr<WPSListener> WPSListenerPtr;
101 typedef shared_ptr<WPSContentListener> WPSContentListenerPtr;
103 typedef shared_ptr<WPSHeader> WPSHeaderPtr;
105 typedef shared_ptr<WPSSubDocument> WPSSubDocumentPtr;
106 
108 typedef shared_ptr<WKSContentListener> WKSContentListenerPtr;
110 typedef shared_ptr<WKSSubDocument> WKSSubDocumentPtr;
111 
112 #if defined(__clang__) || defined(__GNUC__)
113 # define WPS_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((__format__(__printf__, fmt, arg)))
114 #else
115 # define WPS_ATTRIBUTE_PRINTF(fmt, arg)
116 #endif
117 /* ---------- debug --------------- */
118 #ifdef DEBUG
119 namespace libwps
120 {
121 void printDebugMsg(const char *format, ...) WPS_ATTRIBUTE_PRINTF(1, 2);
122 }
123 #define WPS_DEBUG_MSG(M) libwps::printDebugMsg M
124 #else
125 #define WPS_DEBUG_MSG(M)
126 #endif
127 
128 /* ---------- exception ------------ */
129 namespace libwps
130 {
131 // Various exceptions
133 {
134  // needless to say, we could flesh this class out a bit
135 };
136 
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 }
152 
153 /* ---------- input ----------------- */
154 namespace libwps
155 {
156 uint8_t readU8(librevenge::RVNGInputStream *input);
157 uint16_t readU16(librevenge::RVNGInputStream *input);
158 uint32_t readU32(librevenge::RVNGInputStream *input);
159 
160 int8_t read8(librevenge::RVNGInputStream *input);
161 int16_t read16(librevenge::RVNGInputStream *input);
162 int32_t read32(librevenge::RVNGInputStream *input);
163 
164 inline uint8_t readU8(RVNGInputStreamPtr &input)
165 {
166  return readU8(input.get());
167 }
168 inline uint16_t readU16(RVNGInputStreamPtr &input)
169 {
170  return readU16(input.get());
171 }
172 inline uint32_t readU32(RVNGInputStreamPtr &input)
173 {
174  return readU32(input.get());
175 }
176 
177 inline int8_t read8(RVNGInputStreamPtr &input)
178 {
179  return read8(input.get());
180 }
181 inline int16_t read16(RVNGInputStreamPtr &input)
182 {
183  return read16(input.get());
184 }
185 inline int32_t read32(RVNGInputStreamPtr &input)
186 {
187  return read32(input.get());
188 }
189 
191 bool readDouble4(RVNGInputStreamPtr &input, double &res, bool &isNaN);
193 bool readDouble8(RVNGInputStreamPtr &input, double &res, bool &isNaN);
195 bool readDouble10(RVNGInputStreamPtr &input, double &res, bool &isNaN);
197 bool readDouble2Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN);
199 bool readDouble4Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN);
200 
201 bool readData(RVNGInputStreamPtr &input, unsigned long sz, librevenge::RVNGBinaryData &data);
202 bool readDataToEnd(RVNGInputStreamPtr &input, librevenge::RVNGBinaryData &data);
203 }
204 
205 #define WPS_LE_GET_GUINT16(p) \
206  (uint16_t)((((uint8_t const *)(p))[0] << 0) | \
207  (((uint8_t const *)(p))[1] << 8))
208 #define WPS_LE_GET_GUINT32(p) \
209  (uint32_t)((((uint8_t const *)(p))[0] << 0) | \
210  (((uint8_t const *)(p))[1] << 8) | \
211  (((uint8_t const *)(p))[2] << 16) | \
212  (((uint8_t const *)(p))[3] << 24))
213 
214 // Various helper structures for the parser..
215 /* ---------- small enum/class ------------- */
216 
218 {
220  {
221  }
222  double m_width;
223  double m_leftGutter;
225 };
226 
228 {
230  {
231  }
232  uint32_t m_attributes;
233  uint8_t m_alignment;
234 };
235 
237 struct WPSColor
238 {
240  WPSColor(uint32_t argb=0) : m_value(argb)
241  {
242  }
244  WPSColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) :
245  m_value(uint32_t((a<<24)+(r<<16)+(g<<8)+b))
246  {
247  }
249  WPSColor &operator=(uint32_t argb)
250  {
251  m_value = argb;
252  return *this;
253  }
255  static WPSColor black()
256  {
257  return WPSColor(0,0,0);
258  }
260  static WPSColor white()
261  {
262  return WPSColor(255,255,255);
263  }
264 
266  static WPSColor barycenter(float alpha, WPSColor const &colA,
267  float beta, WPSColor const &colB);
269  uint32_t value() const
270  {
271  return m_value;
272  }
274  unsigned char getAlpha() const
275  {
276  return (unsigned char)((m_value>>24)&0xFF);
277  }
279  unsigned char getBlue() const
280  {
281  return (unsigned char)(m_value&0xFF);
282  }
284  unsigned char getRed() const
285  {
286  return (unsigned char)((m_value>>16)&0xFF);
287  }
289  unsigned char getGreen() const
290  {
291  return (unsigned char)((m_value>>8)&0xFF);
292  }
294  bool isBlack() const
295  {
296  return (m_value&0xFFFFFF)==0;
297  }
299  bool isWhite() const
300  {
301  return (m_value&0xFFFFFF)==0xFFFFFF;
302  }
304  bool operator==(WPSColor const &c) const
305  {
306  return (c.m_value&0xFFFFFF)==(m_value&0xFFFFFF);
307  }
309  bool operator!=(WPSColor const &c) const
310  {
311  return !operator==(c);
312  }
314  bool operator<(WPSColor const &c) const
315  {
316  return (c.m_value&0xFFFFFF)<(m_value&0xFFFFFF);
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 !operator<=(c);
327  }
329  bool operator>=(WPSColor const &c) const
330  {
331  return !operator<(c);
332  }
334  friend std::ostream &operator<< (std::ostream &o, WPSColor const &c);
336  std::string str() const;
337 protected:
339  uint32_t m_value;
340 };
341 
343 struct WPSBorder
344 {
348  enum Type { Single, Double, Triple };
349  enum Pos { Left = 0, Right = 1, Top = 2, Bottom = 3 };
350  enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08 };
351 
357  bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const;
359  bool isEmpty() const
360  {
361  return m_style==None || m_width <= 0;
362  }
363 
365  bool operator==(WPSBorder const &orig) const
366  {
367  return m_style == orig.m_style && m_type == orig.m_type && m_width == orig.m_width
368  && m_color == orig.m_color;
369  }
371  bool operator!=(WPSBorder const &orig) const
372  {
373  return !operator==(orig);
374  }
376  int compare(WPSBorder const &orig) const;
377 
379  friend std::ostream &operator<< (std::ostream &o, WPSBorder const &border);
381  friend std::ostream &operator<< (std::ostream &o, WPSBorder::Style const &style);
387  int m_width;
391  std::vector<double> m_widthsList;
395  std::string m_extra;
396 };
397 
398 namespace libwps
399 {
401 std::string numberingTypeToString(NumberingType type);
405  };
406 enum { NoBreakBit = 0x1, NoBreakWithNextBit=0x2};
407 }
408 
409 // ATTRIBUTE bits
410 #define WPS_EXTRA_LARGE_BIT 1
411 #define WPS_VERY_LARGE_BIT 2
412 #define WPS_LARGE_BIT 4
413 #define WPS_SMALL_PRINT_BIT 8
414 #define WPS_FINE_PRINT_BIT 0x10
415 #define WPS_SUPERSCRIPT_BIT 0x20
416 #define WPS_SUBSCRIPT_BIT 0x40
417 #define WPS_OUTLINE_BIT 0x80
418 #define WPS_ITALICS_BIT 0x100
419 #define WPS_SHADOW_BIT 0x200
420 #define WPS_REDLINE_BIT 0x400
421 #define WPS_DOUBLE_UNDERLINE_BIT 0x800
422 #define WPS_BOLD_BIT 0x1000
423 #define WPS_STRIKEOUT_BIT 0x2000
424 #define WPS_UNDERLINE_BIT 0x4000
425 #define WPS_SMALL_CAPS_BIT 0x8000
426 #define WPS_BLINK_BIT 0x10000L
427 #define WPS_REVERSEVIDEO_BIT 0x20000L
428 #define WPS_ALL_CAPS_BIT 0x40000L
429 #define WPS_EMBOSS_BIT 0x80000L
430 #define WPS_ENGRAVE_BIT 0x100000L
431 #define WPS_OVERLINE_BIT 0x400000L
432 #define WPS_HIDDEN_BIT 0x800000L
433 
434 // BREAK bits
435 #define WPS_PAGE_BREAK 0x00
436 #define WPS_SOFT_PAGE_BREAK 0x01
437 #define WPS_COLUMN_BREAK 0x02
438 
439 // Generic bits
440 #define WPS_LEFT 0x00
441 #define WPS_RIGHT 0x01
442 #define WPS_CENTER 0x02
443 #define WPS_TOP 0x03
444 #define WPS_BOTTOM 0x04
445 
446 /* ---------- vec2/box2f ------------- */
450 template <class T> class Vec2
451 {
452 public:
454  Vec2(T xx=0,T yy=0) : m_x(xx), m_y(yy) { }
456  template <class U> Vec2(Vec2<U> const &p) : m_x(T(p.x())), m_y(T(p.y())) {}
457 
459  T x() const
460  {
461  return m_x;
462  }
464  T y() const
465  {
466  return m_y;
467  }
469  T operator[](int c) const
470  {
471  if (c<0 || c>1) throw libwps::GenericException();
472  return (c==0) ? m_x : m_y;
473  }
475  T &operator[](int c)
476  {
477  if (c<0 || c>1) throw libwps::GenericException();
478  return (c==0) ? m_x : m_y;
479  }
480 
482  void set(T xx, T yy)
483  {
484  m_x = xx;
485  m_y = yy;
486  }
488  void setX(T xx)
489  {
490  m_x = xx;
491  }
493  void setY(T yy)
494  {
495  m_y = yy;
496  }
497 
499  void add(T dx, T dy)
500  {
501  m_x += dx;
502  m_y += dy;
503  }
504 
507  {
508  m_x += p.m_x;
509  m_y += p.m_y;
510  return *this;
511  }
514  {
515  m_x -= p.m_x;
516  m_y -= p.m_y;
517  return *this;
518  }
520  template <class U>
521  Vec2<T> &operator*=(U scale)
522  {
523  m_x = T(m_x*scale);
524  m_y = T(m_y*scale);
525  return *this;
526  }
527 
529  friend Vec2<T> operator+(Vec2<T> const &p1, Vec2<T> const &p2)
530  {
531  Vec2<T> p(p1);
532  return p+=p2;
533  }
535  friend Vec2<T> operator-(Vec2<T> const &p1, Vec2<T> const &p2)
536  {
537  Vec2<T> p(p1);
538  return p-=p2;
539  }
541  template <class U>
542  friend Vec2<T> operator*(U scale, Vec2<T> const &p1)
543  {
544  Vec2<T> p(p1);
545  return p *= scale;
546  }
547 
549  bool operator==(Vec2<T> const &p) const
550  {
551  return cmpY(p) == 0;
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  int cmp(Vec2<T> const &p) const
565  {
566  if (m_x<p.m_x) return -1;
567  if (m_x>p.m_x) return 1;
568  if (m_y<p.m_y) return -1;
569  if (m_y>p.m_y) return 1;
570  return 0;
571  }
573  int cmpY(Vec2<T> const &p) const
574  {
575  if (m_y<p.m_y) return -1;
576  if (m_y>p.m_y) return 1;
577  if (m_x<p.m_x) return -1;
578  if (m_x>p.m_x) return 1;
579  return 0;
580  }
581 
583  friend std::ostream &operator<< (std::ostream &o, Vec2<T> const &f)
584  {
585  o << f.m_x << "x" << f.m_y;
586  return o;
587  }
588 
592  struct PosSizeLtX
593  {
595  bool operator()(Vec2<T> const &s1, Vec2<T> const &s2) const
596  {
597  return s1.cmp(s2) < 0;
598  }
599  };
603  typedef std::map<Vec2<T>, T,struct PosSizeLtX> MapX;
604 
608  struct PosSizeLtY
609  {
611  bool operator()(Vec2<T> const &s1, Vec2<T> const &s2) const
612  {
613  return s1.cmpY(s2) < 0;
614  }
615  };
619  typedef std::map<Vec2<T>, T,struct PosSizeLtY> MapY;
620 protected:
621  T m_x, m_y;
622 };
623 
627 typedef Vec2<int> Vec2i;
630 
634 template <class T> class Box2
635 {
636 public:
638  Box2(Vec2<T> minPt=Vec2<T>(), Vec2<T> maxPt=Vec2<T>())
639  {
640  m_pt[0] = minPt;
641  m_pt[1] = maxPt;
642  }
644  template <class U> Box2(Box2<U> const &p)
645  {
646  for (int c=0; c < 2; c++) m_pt[c] = p[c];
647  }
648 
650  Vec2<T> const &min() const
651  {
652  return m_pt[0];
653  }
655  Vec2<T> const &max() const
656  {
657  return m_pt[1];
658  }
661  {
662  return m_pt[0];
663  }
666  {
667  return m_pt[1];
668  }
669 
674  Vec2<T> const &operator[](int c) const
675  {
676  if (c<0 || c>1) throw libwps::GenericException();
677  return m_pt[c];
678  }
680  Vec2<T> size() const
681  {
682  return m_pt[1]-m_pt[0];
683  }
685  Vec2<T> center() const
686  {
687  return 0.5*(m_pt[0]+m_pt[1]);
688  }
689 
691  void set(Vec2<T> const &x, Vec2<T> const &y)
692  {
693  m_pt[0] = x;
694  m_pt[1] = y;
695  }
697  void setMin(Vec2<T> const &x)
698  {
699  m_pt[0] = x;
700  }
702  void setMax(Vec2<T> const &y)
703  {
704  m_pt[1] = y;
705  }
706 
708  void resizeFromMin(Vec2<T> const &sz)
709  {
710  m_pt[1] = m_pt[0]+sz;
711  }
713  void resizeFromMax(Vec2<T> const &sz)
714  {
715  m_pt[0] = m_pt[1]-sz;
716  }
718  void resizeFromCenter(Vec2<T> const &sz)
719  {
720  Vec2<T> ctr = 0.5*(m_pt[0]+m_pt[1]);
721  m_pt[0] = ctr - 0.5*sz;
722  m_pt[1] = ctr + (sz - 0.5*sz);
723  }
724 
726  template <class U> void scale(U factor)
727  {
728  m_pt[0] *= factor;
729  m_pt[1] *= factor;
730  }
731 
733  void extend(T val)
734  {
735  m_pt[0] -= Vec2<T>(val/2,val/2);
736  m_pt[1] += Vec2<T>(val-(val/2),val-(val/2));
737  }
739  Box2<T> getUnion(Box2<T> const &box) const
740  {
741  Box2<T> res;
742  res.m_pt[0]=Vec2<T>(m_pt[0][0]<box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
743  m_pt[0][1]<box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
744  res.m_pt[1]=Vec2<T>(m_pt[1][0]>box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
745  m_pt[1][1]>box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
746  return res;
747  }
749  Box2<T> getIntersection(Box2<T> const &box) const
750  {
751  Box2<T> res;
752  res.m_pt[0]=Vec2<T>(m_pt[0][0]>box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
753  m_pt[0][1]>box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
754  res.m_pt[1]=Vec2<T>(m_pt[1][0]<box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
755  m_pt[1][1]<box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
756  return res;
757  }
758 
760  bool operator==(Box2<T> const &p) const
761  {
762  return cmp(p) == 0;
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  }
774 
776  int cmp(Box2<T> const &p) const
777  {
778  int diff = m_pt[0].cmpY(p.m_pt[0]);
779  if (diff) return diff;
780  diff = m_pt[1].cmpY(p.m_pt[1]);
781  if (diff) return diff;
782  return 0;
783  }
784 
786  friend std::ostream &operator<< (std::ostream &o, Box2<T> const &f)
787  {
788  o << "(" << f.m_pt[0] << "<->" << f.m_pt[1] << ")";
789  return o;
790  }
791 
795  struct PosSizeLt
796  {
798  bool operator()(Box2<T> const &s1, Box2<T> const &s2) const
799  {
800  return s1.cmp(s2) < 0;
801  }
802  };
806  typedef std::map<Box2<T>, T,struct PosSizeLt> Map;
807 
808 protected:
811 };
812 
814 typedef Box2<int> Box2i;
817 
818 #endif /* LIBWPS_INTERNAL_H */
819 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:39
Definition: libwps_internal.h:346
Definition: libwps_internal.h:400
shared_ptr< WPSContentListener > WPSContentListenerPtr
shared pointer to WPSContentListener
Definition: libwps_internal.h:101
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:629
WPSColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition: libwps_internal.h:244
void set(Vec2< T > const &x, Vec2< T > const &y)
resets the data to minimum x and maximum y
Definition: libwps_internal.h:691
void setY(T yy)
resets the second element
Definition: libwps_internal.h:493
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:343
Definition: libwps_internal.h:346
Definition: libwps_internal.h:227
Definition: libwps_internal.h:147
T m_x
first element
Definition: libwps_internal.h:621
Definition: libwps_internal.h:348
Definition: libwps_internal.cpp:37
Vec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition: libwps_internal.h:674
Vec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libwps_internal.h:650
shared_ptr< WPSSubDocument > WPSSubDocumentPtr
shared pointer to WPSSubDocument
Definition: libwps_internal.h:105
bool operator!=(Box2< T > const &p) const
comparison operator!=
Definition: libwps_internal.h:765
int cmp(Box2< T > const &p) const
comparison function : fist sorts min by Y,X values then max extremity
Definition: libwps_internal.h:776
Definition: libwps_internal.h:406
friend Vec2< T > operator-(Vec2< T > const &p1, Vec2< T > const &p2)
operator-
Definition: libwps_internal.h:535
Definition: libwps_internal.h:348
int32_t read32(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:84
T & operator[](int c)
operator[]
Definition: libwps_internal.h:475
Definition: libwps_internal.h:349
small class which defines a 2D Box
Definition: libwps_internal.h:634
Definition: libwps_internal.h:350
internal struct used to create sorted map, sorted first min then max
Definition: libwps_internal.h:795
define the font properties
Definition: WPSFont.h:36
bool operator==(WPSColor const &c) const
operator==
Definition: libwps_internal.h:304
void resizeFromMin(Vec2< T > const &sz)
resize the box keeping the minimum
Definition: libwps_internal.h:708
double m_leftGutter
Definition: libwps_internal.h:223
Definition: libwps_internal.h:346
#define WPS_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libwps_internal.h:115
virtual class for content listener
Definition: WPSListener.h:36
internal struct used to create sorted map, sorted by X
Definition: libwps_internal.h:592
static WPSColor black()
return the back color
Definition: libwps_internal.h:255
std::map< Vec2< bool >, bool, struct PosSizeLtY > MapY
Definition: libwps_internal.h:619
int m_width
the border width
Definition: libwps_internal.h:387
static WPSColor white()
return the white color
Definition: libwps_internal.h:260
Definition: libwps_internal.h:402
Definition: libwps_internal.h:349
Vec2< T > & operator+=(Vec2< T > const &p)
operator+=
Definition: libwps_internal.h:506
Definition: libwps_internal.h:400
void set(T xx, T yy)
resets the two elements
Definition: libwps_internal.h:482
Definition: libwps_internal.h:400
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition: libwps_internal.h:733
Definition: libwps_internal.h:402
Definition: WPSContentListener.h:44
WPSColor & operator=(uint32_t argb)
operator=
Definition: libwps_internal.h:249
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:232
Definition: libwps_internal.h:402
unsigned char getRed() const
returns the red value
Definition: libwps_internal.h:284
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:814
bool isBlack() const
return true if the color is black
Definition: libwps_internal.h:294
bool operator<(WPSColor const &c) const
operator<
Definition: libwps_internal.h:314
bool operator>=(WPSColor const &c) const
operator>=
Definition: libwps_internal.h:329
Vec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libwps_internal.h:665
a structure used to defined the cell position, and a format
Definition: WPSCell.h:251
double m_width
Definition: libwps_internal.h:222
Vec2< T > center() const
the box center
Definition: libwps_internal.h:685
Justification
Definition: libwps_internal.h:403
double m_rightGutter
Definition: libwps_internal.h:224
virtual class to define a sub document
Definition: WPSSubDocument.h:33
bool operator==(Vec2< T > const &p) const
comparison==
Definition: libwps_internal.h:549
Definition: libwps_internal.h:346
Definition: libwps_internal.h:400
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:103
Definition: libwps_internal.h:349
Definition: libwps_internal.h:402
bool operator!=(Vec2< T > const &p) const
comparison!=
Definition: libwps_internal.h:554
T y() const
second element
Definition: libwps_internal.h:464
Vec2(T xx=0, T yy=0)
constructor
Definition: libwps_internal.h:454
Box2< float > Box2f
Box2 of float.
Definition: libwps_internal.h:816
shared_ptr< WPSListener > WPSListenerPtr
shared pointer to WPSListener
Definition: libwps_internal.h:99
void setX(T xx)
resets the first element
Definition: libwps_internal.h:488
Definition: libwps_internal.h:406
std::map< Box2< int >, int, struct PosSizeLt > Map
Definition: libwps_internal.h:806
WPSBorder()
constructor
Definition: libwps_internal.h:353
Definition: libwps_internal.h:349
SubDocumentType
Definition: libwps_internal.h:402
Definition: libwps_internal.h:400
Definition: libwps_internal.h:403
Definition: libwps_internal.h:402
Definition: libwps_internal.h:142
std::vector< double > m_widthsList
the different length used for each line/sep (if defined)
Definition: libwps_internal.h:391
Basic class used to store a spreadsheet sub document.
Definition: WKSSubDocument.h:35
Definition: libwps_internal.h:404
bool isWhite() const
return true if the color is white
Definition: libwps_internal.h:299
shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:108
Definition: WPSHeader.h:31
Vec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition: libwps_internal.h:655
bool operator!=(WPSBorder const &orig) const
operator!=
Definition: libwps_internal.h:371
Definition: libwps_internal.h:402
Definition: libwps_internal.h:132
unsigned char getBlue() const
returns the green value
Definition: libwps_internal.h:279
Box2(Box2< U > const &p)
generic constructor
Definition: libwps_internal.h:644
uint32_t m_value
the argb color
Definition: libwps_internal.h:339
internal struct used to create sorted map, sorted by Y
Definition: libwps_internal.h:608
Vec2< T > m_pt[2]
the two extremities
Definition: libwps_internal.h:810
T x() const
first element
Definition: libwps_internal.h:459
void operator()(T *)
Definition: libwps_internal.h:77
Type
the line repetition
Definition: libwps_internal.h:348
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:499
uint8_t m_alignment
Definition: libwps_internal.h:233
Definition: libwps_internal.h:217
bool operator()(Vec2< T > const &s1, Vec2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:611
bool isEmpty() const
returns true if the border is empty
Definition: libwps_internal.h:359
WPSColumnProperties()
Definition: libwps_internal.h:229
Vec2< T > & operator-=(Vec2< T > const &p)
operator-=
Definition: libwps_internal.h:513
WPSColor m_color
the border color
Definition: libwps_internal.h:393
Vec2< T > & operator*=(U scale)
generic operator*=
Definition: libwps_internal.h:521
NumberingType
Definition: libwps_internal.h:400
uint32_t value() const
return the rgba value
Definition: libwps_internal.h:269
bool operator!=(WPSColor const &c) const
operator!=
Definition: libwps_internal.h:309
Definition: libwps_internal.h:350
int cmpY(Vec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libwps_internal.h:573
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:603
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:82
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:627
the class to store a color
Definition: libwps_internal.h:237
friend std::ostream & operator<<(std::ostream &o, WPSBorder const &border)
operator<<
Definition: libwps_internal.cpp:543
Definition: libwps_internal.h:346
Pos
Definition: libwps_internal.h:349
Definition: libwps_internal.h:404
Vec2(Vec2< U > const &p)
generic copy constructor
Definition: libwps_internal.h:456
bool operator==(Box2< T > const &p) const
comparison operator==
Definition: libwps_internal.h:760
T operator[](int c) const
operator[]
Definition: libwps_internal.h:469
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:289
void resizeFromMax(Vec2< T > const &sz)
resize the box keeping the maximum
Definition: libwps_internal.h:713
bool operator<=(WPSColor const &c) const
operator<=
Definition: libwps_internal.h:319
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:726
std::string numberingTypeToString(NumberingType type)
Definition: libwps_internal.cpp:356
bool operator>(WPSColor const &c) const
operator>
Definition: libwps_internal.h:324
void setMax(Vec2< T > const &y)
resets the maximum point
Definition: libwps_internal.h:702
Box2< T > getUnion(Box2< T > const &box) const
returns the union between this and box
Definition: libwps_internal.h:739
Style
the line style
Definition: libwps_internal.h:346
Definition: libwps_internal.h:348
bool operator==(WPSBorder const &orig) const
operator==
Definition: libwps_internal.h:365
void setMin(Vec2< T > const &x)
resets the minimum point
Definition: libwps_internal.h:697
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:638
Definition: libwps_internal.h:137
Definition: libwps_internal.h:350
WPSColumnDefinition()
Definition: libwps_internal.h:219
Style m_style
the border style
Definition: libwps_internal.h:383
Definition: libwps_internal.h:403
Definition: libwps_internal.h:400
shared_ptr< WKSSubDocument > WKSSubDocumentPtr
shared pointer to WKSSubDocument
Definition: libwps_internal.h:110
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:403
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:450
bool operator()(Vec2< T > const &s1, Vec2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:595
Definition: libwps_internal.h:400
friend Vec2< T > operator*(U scale, Vec2< T > const &p1)
generic operator*
Definition: libwps_internal.h:542
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:680
std::string m_extra
extra data ( if needed)
Definition: libwps_internal.h:395
shared_ptr< WPSCell > WPSCellPtr
shared pointer to WPSCell
Definition: libwps_internal.h:94
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:749
WPSColor(uint32_t argb=0)
constructor
Definition: libwps_internal.h:240
T m_y
second element
Definition: libwps_internal.h:621
a noop deleter used to transform a librevenge pointer in a false shared_ptr
Definition: libwps_internal.h:75
bool operator()(Box2< T > const &s1, Box2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:798
Type m_type
the border repetition
Definition: libwps_internal.h:385
Definition: WKSContentListener.h:50
int cmp(Vec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libwps_internal.h:564
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:625
Definition: libwps_internal.h:350
unsigned char getAlpha() const
returns the alpha value
Definition: libwps_internal.h:274
void resizeFromCenter(Vec2< T > const &sz)
resize the box keeping the center
Definition: libwps_internal.h:718
Vec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libwps_internal.h:660
friend Vec2< T > operator+(Vec2< T > const &p1, Vec2< T > const &p2)
operator+
Definition: libwps_internal.h:529

Generated on Sun Sep 13 2015 08:56:51 for libwps by doxygen 1.8.9.1