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 <algorithm>
32 #include <cmath>
33 #include <iostream>
34 #include <map>
35 #include <memory>
36 #include <string>
37 #include <vector>
38 
39 #include <librevenge-stream/librevenge-stream.h>
40 #include <librevenge/librevenge.h>
41 
42 #ifndef M_PI
43 #define M_PI 3.14159265358979323846
44 #endif
45 
46 #if defined(_MSC_VER) || defined(__DJGPP__)
47 typedef signed char int8_t;
48 typedef unsigned char uint8_t;
49 typedef signed short int16_t;
50 typedef unsigned short uint16_t;
51 typedef signed int int32_t;
52 typedef unsigned int uint32_t;
53 #else /* !_MSC_VER && !__DJGPP__*/
54 # include <inttypes.h>
55 #endif /* _MSC_VER || __DJGPP__*/
56 
57 /* ---------- time/... --------------- */
58 #ifdef HAVE_CONFIG_H
59 # include "config.h"
60 #endif
61 
62 // define localtime_r on Windows, so that can use
63 // thread-safe functions on other environments
64 #ifdef _WIN32
65 # define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
66 # define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0)
67 #endif
68 
70 template <class T>
72 {
73  void operator()(T *) {}
74 };
75 
77 #if defined(HAVE_CLANG_ATTRIBUTE_FALLTHROUGH)
78 # define WPS_FALLTHROUGH [[clang::fallthrough]]
79 #elif defined(HAVE_GCC_ATTRIBUTE_FALLTHROUGH)
80 # define WPS_FALLTHROUGH __attribute__((fallthrough))
81 #else
82 # define WPS_FALLTHROUGH ((void) 0)
83 #endif
84 
85 // basic classes and autoptr
87 typedef std::shared_ptr<librevenge::RVNGInputStream> RVNGInputStreamPtr;
88 
89 struct WPSStream;
90 class WPSCell;
91 class WPSListener;
92 class WPSContentListener;
93 class WPSEntry;
94 class WPSFont;
95 class WPSHeader;
96 class WPSPosition;
97 class WPSSubDocument;
98 
99 class WKSContentListener;
100 class WKSSubDocument;
101 
103 typedef std::shared_ptr<WPSCell> WPSCellPtr;
105 typedef std::shared_ptr<WPSListener> WPSListenerPtr;
107 typedef std::shared_ptr<WPSContentListener> WPSContentListenerPtr;
109 typedef std::shared_ptr<WPSHeader> WPSHeaderPtr;
111 typedef std::shared_ptr<WPSSubDocument> WPSSubDocumentPtr;
112 
114 typedef std::shared_ptr<WKSContentListener> WKSContentListenerPtr;
116 typedef std::shared_ptr<WKSSubDocument> WKSSubDocumentPtr;
117 
118 #if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
119 # define WPS_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg)))
120 #else
121 # define WPS_ATTRIBUTE_PRINTF(fmt, arg)
122 #endif
123 
124 #define WPS_N_ELEMENTS(m) sizeof(m)/sizeof(m[0])
125 
126 /* ---------- debug --------------- */
127 #ifdef DEBUG
128 namespace libwps
129 {
130 void printDebugMsg(const char *format, ...) WPS_ATTRIBUTE_PRINTF(1, 2);
131 }
132 #define WPS_DEBUG_MSG(M) libwps::printDebugMsg M
133 #else
134 #define WPS_DEBUG_MSG(M)
135 #endif
136 
137 /* ---------- exception ------------ */
138 namespace libwps
139 {
140 // Various exceptions
142 {
143  // needless to say, we could flesh this class out a bit
144 };
145 
147 {
148  // needless to say, we could flesh this class out a bit
149 };
150 
152 {
153  // needless to say, we could flesh this class out a bit
154 };
155 
157 {
158  // needless to say, we could flesh this class out a bit
159 };
160 
162 {
163  // needless to say, we could flesh this class out a bit
164 };
165 }
166 
167 /* ---------- input ----------------- */
168 namespace libwps
169 {
170 uint8_t readU8(librevenge::RVNGInputStream *input);
171 uint16_t readU16(librevenge::RVNGInputStream *input);
172 uint32_t readU32(librevenge::RVNGInputStream *input);
173 
174 int8_t read8(librevenge::RVNGInputStream *input);
175 int16_t read16(librevenge::RVNGInputStream *input);
176 int32_t read32(librevenge::RVNGInputStream *input);
177 
178 inline uint8_t readU8(RVNGInputStreamPtr const &input)
179 {
180  return readU8(input.get());
181 }
182 inline uint16_t readU16(RVNGInputStreamPtr const &input)
183 {
184  return readU16(input.get());
185 }
186 inline uint32_t readU32(RVNGInputStreamPtr const &input)
187 {
188  return readU32(input.get());
189 }
190 
191 inline int8_t read8(RVNGInputStreamPtr const &input)
192 {
193  return read8(input.get());
194 }
195 inline int16_t read16(RVNGInputStreamPtr const &input)
196 {
197  return read16(input.get());
198 }
199 inline int32_t read32(RVNGInputStreamPtr const &input)
200 {
201  return read32(input.get());
202 }
203 
205 bool readDouble4(RVNGInputStreamPtr &input, double &res, bool &isNaN);
207 bool readDouble8(RVNGInputStreamPtr &input, double &res, bool &isNaN);
209 bool readDouble10(RVNGInputStreamPtr &input, double &res, bool &isNaN);
211 bool readDouble2Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN);
213 bool readDouble4Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN);
214 
216 bool readData(RVNGInputStreamPtr &input, unsigned long sz, librevenge::RVNGBinaryData &data);
218 bool readDataToEnd(RVNGInputStreamPtr &input, librevenge::RVNGBinaryData &data);
220 void appendUnicode(uint32_t val, librevenge::RVNGString &buffer);
221 }
222 
223 #define WPS_LE_GET_GUINT16(p) \
224  uint16_t(((reinterpret_cast<uint8_t const *>(p))[0] << 0) | \
225  ((reinterpret_cast<uint8_t const *>(p))[1] << 8))
226 #define WPS_LE_GET_GUINT32(p) \
227  uint32_t(((reinterpret_cast<uint8_t const *>(p))[0] << 0) | \
228  ((reinterpret_cast<uint8_t const *>(p))[1] << 8) | \
229  ((reinterpret_cast<uint8_t const *>(p))[2] << 16) | \
230  ((reinterpret_cast<uint8_t const *>(p))[3] << 24))
231 
232 #define WPS_LE_PUT_GUINT16(p, v) \
233  *(reinterpret_cast<uint8_t*>(p)) = uint8_t(v); \
234  *((reinterpret_cast<uint8_t*>(p)) + 1) = uint8_t((v) >> 8)
235 
236 #define WPS_LE_PUT_GUINT32(p, v) \
237  *(reinterpret_cast<uint8_t*>(p)) = uint8_t(v); \
238  *((reinterpret_cast<uint8_t*>(p)) + 1) = uint8_t((v) >> 8); \
239  *((reinterpret_cast<uint8_t*>(p)) + 2) = uint8_t((v) >> 16); \
240  *((reinterpret_cast<uint8_t*>(p)) + 3) = uint8_t((v) >> 24)
241 
242 // Various helper structures for the parser..
243 /* ---------- small enum/class ------------- */
244 namespace libwps
245 {
247 std::string numberingTypeToString(NumberingType type);
251  };
252 enum { NoBreakBit = 0x1, NoBreakWithNextBit=0x2};
253 }
254 
256 {
258  : m_width(0)
259  , m_leftGutter(0)
260  , m_rightGutter(0)
261  {
262  }
263  double m_width;
264  double m_leftGutter;
266 };
267 
269 {
271  : m_attributes(0)
272  , m_alignment(0)
273  {
274  }
275  uint32_t m_attributes;
276  uint8_t m_alignment;
277 };
278 
280 struct WPSColor
281 {
283  explicit WPSColor(uint32_t argb=0) : m_value(argb)
284  {
285  }
287  WPSColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) :
288  m_value(uint32_t((a<<24)+(r<<16)+(g<<8)+b))
289  {
290  }
292  WPSColor(WPSColor const &) = default;
294  WPSColor(WPSColor &&) = default;
296  WPSColor &operator=(uint32_t argb)
297  {
298  m_value = argb;
299  return *this;
300  }
302  WPSColor &operator=(WPSColor const &) = default;
304  WPSColor &operator=(WPSColor &&) = default;
306  static WPSColor black()
307  {
308  return WPSColor(0,0,0);
309  }
311  static WPSColor white()
312  {
313  return WPSColor(255,255,255);
314  }
315 
317  static WPSColor barycenter(float alpha, WPSColor const &colA,
318  float beta, WPSColor const &colB);
320  uint32_t value() const
321  {
322  return m_value;
323  }
325  unsigned char getAlpha() const
326  {
327  return static_cast<unsigned char>((m_value>>24)&0xFF);
328  }
330  unsigned char getBlue() const
331  {
332  return static_cast<unsigned char>(m_value&0xFF);
333  }
335  unsigned char getRed() const
336  {
337  return static_cast<unsigned char>((m_value>>16)&0xFF);
338  }
340  unsigned char getGreen() const
341  {
342  return static_cast<unsigned char>((m_value>>8)&0xFF);
343  }
345  bool isBlack() const
346  {
347  return (m_value&0xFFFFFF)==0;
348  }
350  bool isWhite() const
351  {
352  return (m_value&0xFFFFFF)==0xFFFFFF;
353  }
355  bool operator==(WPSColor const &c) const
356  {
357  return (c.m_value&0xFFFFFF)==(m_value&0xFFFFFF);
358  }
360  bool operator!=(WPSColor const &c) const
361  {
362  return !operator==(c);
363  }
365  bool operator<(WPSColor const &c) const
366  {
367  return (c.m_value&0xFFFFFF)<(m_value&0xFFFFFF);
368  }
370  bool operator<=(WPSColor const &c) const
371  {
372  return (c.m_value&0xFFFFFF)<=(m_value&0xFFFFFF);
373  }
375  bool operator>(WPSColor const &c) const
376  {
377  return !operator<=(c);
378  }
380  bool operator>=(WPSColor const &c) const
381  {
382  return !operator<(c);
383  }
385  friend std::ostream &operator<< (std::ostream &o, WPSColor const &c);
387  std::string str() const;
388 protected:
390  uint32_t m_value;
391 };
392 
394 struct WPSBorder
395 {
399  enum Type { Single, Double, Triple };
400  enum Pos { Left = 0, Right = 1, Top = 2, Bottom = 3 };
401  enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08 };
402 
405  : m_style(Simple)
406  , m_type(Single)
407  , m_width(1)
408  , m_widthsList()
409  , m_color(WPSColor::black())
410  , m_extra("") { }
411 
412  WPSBorder(WPSBorder const &) = default;
413  WPSBorder(WPSBorder &&) = default;
414  WPSBorder &operator=(WPSBorder const &) = default;
415  WPSBorder &operator=(WPSBorder &&) = default;
416 
420  bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const;
422  bool isEmpty() const
423  {
424  return m_style==None || m_width <= 0;
425  }
426 
428  bool operator==(WPSBorder const &orig) const
429  {
430  return m_style == orig.m_style && m_type == orig.m_type && m_width == orig.m_width
431  && m_color == orig.m_color && m_widthsList==orig.m_widthsList;
432  }
434  bool operator!=(WPSBorder const &orig) const
435  {
436  return !operator==(orig);
437  }
439  int compare(WPSBorder const &orig) const;
440 
442  friend std::ostream &operator<< (std::ostream &o, WPSBorder const &border);
444  friend std::ostream &operator<< (std::ostream &o, WPSBorder::Style const &style);
450  int m_width;
454  std::vector<double> m_widthsList;
458  std::string m_extra;
459 };
460 
462 struct WPSField
463 {
466 
468  explicit WPSField(Type type)
469  : m_type(type)
470  , m_DTFormat("")
472  , m_data("")
473  {
474  }
475  WPSField(WPSField &&) = default;
476  WPSField(WPSField const &) = default;
477  WPSField &operator=(WPSField const &) = default;
478  WPSField &operator=(WPSField &&) = default;
480  bool addTo(librevenge::RVNGPropertyList &propList) const;
482  librevenge::RVNGString getString() const;
486  std::string m_DTFormat;
490  std::string m_data;
491 };
492 
493 // ATTRIBUTE bits
494 #define WPS_EXTRA_LARGE_BIT 1
495 #define WPS_VERY_LARGE_BIT 2
496 #define WPS_LARGE_BIT 4
497 #define WPS_SMALL_PRINT_BIT 8
498 #define WPS_FINE_PRINT_BIT 0x10
499 #define WPS_SUPERSCRIPT_BIT 0x20
500 #define WPS_SUBSCRIPT_BIT 0x40
501 #define WPS_OUTLINE_BIT 0x80
502 #define WPS_ITALICS_BIT 0x100
503 #define WPS_SHADOW_BIT 0x200
504 #define WPS_REDLINE_BIT 0x400
505 #define WPS_DOUBLE_UNDERLINE_BIT 0x800
506 #define WPS_BOLD_BIT 0x1000
507 #define WPS_STRIKEOUT_BIT 0x2000
508 #define WPS_UNDERLINE_BIT 0x4000
509 #define WPS_SMALL_CAPS_BIT 0x8000
510 #define WPS_BLINK_BIT 0x10000L
511 #define WPS_REVERSEVIDEO_BIT 0x20000L
512 #define WPS_ALL_CAPS_BIT 0x40000L
513 #define WPS_EMBOSS_BIT 0x80000L
514 #define WPS_ENGRAVE_BIT 0x100000L
515 #define WPS_OVERLINE_BIT 0x400000L
516 #define WPS_HIDDEN_BIT 0x800000L
517 
518 // BREAK bits
519 #define WPS_PAGE_BREAK 0x00
520 #define WPS_SOFT_PAGE_BREAK 0x01
521 #define WPS_COLUMN_BREAK 0x02
522 
523 // Generic bits
524 #define WPS_LEFT 0x00
525 #define WPS_RIGHT 0x01
526 #define WPS_CENTER 0x02
527 #define WPS_TOP 0x03
528 #define WPS_BOTTOM 0x04
529 
530 /* ---------- vec2/box2f ------------- */
534 template <class T> class Vec2
535 {
536 public:
538  explicit Vec2(T xx=0,T yy=0) : m_x(xx), m_y(yy) { }
540  template <class U> explicit Vec2(Vec2<U> const &p) : m_x(T(p.x())), m_y(T(p.y())) {}
542  T x() const
543  {
544  return m_x;
545  }
547  T y() const
548  {
549  return m_y;
550  }
552  T operator[](int c) const
553  {
554  if (c<0 || c>1) throw libwps::GenericException();
555  return (c==0) ? m_x : m_y;
556  }
558  T &operator[](int c)
559  {
560  if (c<0 || c>1) throw libwps::GenericException();
561  return (c==0) ? m_x : m_y;
562  }
563 
565  void set(T xx, T yy)
566  {
567  m_x = xx;
568  m_y = yy;
569  }
571  void setX(T xx)
572  {
573  m_x = xx;
574  }
576  void setY(T yy)
577  {
578  m_y = yy;
579  }
580 
582  void add(T dx, T dy)
583  {
584  m_x += dx;
585  m_y += dy;
586  }
587 
590  {
591  m_x += p.m_x;
592  m_y += p.m_y;
593  return *this;
594  }
597  {
598  m_x -= p.m_x;
599  m_y -= p.m_y;
600  return *this;
601  }
603  template <class U>
604  Vec2<T> &operator*=(U scale)
605  {
606  m_x = m_x*T(scale);
607  m_y = m_y*T(scale);
608  return *this;
609  }
610 
612  friend Vec2<T> operator+(Vec2<T> const &p1, Vec2<T> const &p2)
613  {
614  Vec2<T> p(p1);
615  return p+=p2;
616  }
618  friend Vec2<T> operator-(Vec2<T> const &p1, Vec2<T> const &p2)
619  {
620  Vec2<T> p(p1);
621  return p-=p2;
622  }
624  template <class U>
625  friend Vec2<T> operator*(U scale, Vec2<T> const &p1)
626  {
627  Vec2<T> p(p1);
628  return p *= scale;
629  }
630 
632  bool operator==(Vec2<T> const &p) const
633  {
634  return cmpY(p) == 0;
635  }
637  bool operator!=(Vec2<T> const &p) const
638  {
639  return cmpY(p) != 0;
640  }
642  bool operator<(Vec2<T> const &p) const
643  {
644  return cmpY(p) < 0;
645  }
647  int cmp(Vec2<T> const &p) const
648  {
649  if (m_x<p.m_x) return -1;
650  if (m_x>p.m_x) return 1;
651  if (m_y<p.m_y) return -1;
652  if (m_y>p.m_y) return 1;
653  return 0;
654  }
656  int cmpY(Vec2<T> const &p) const
657  {
658  if (m_y<p.m_y) return -1;
659  if (m_y>p.m_y) return 1;
660  if (m_x<p.m_x) return -1;
661  if (m_x>p.m_x) return 1;
662  return 0;
663  }
664 
666  friend std::ostream &operator<< (std::ostream &o, Vec2<T> const &f)
667  {
668  o << f.m_x << "x" << f.m_y;
669  return o;
670  }
671 
675  struct PosSizeLtX
676  {
678  bool operator()(Vec2<T> const &s1, Vec2<T> const &s2) const
679  {
680  return s1.cmp(s2) < 0;
681  }
682  };
683 
687  struct PosSizeLtY
688  {
690  bool operator()(Vec2<T> const &s1, Vec2<T> const &s2) const
691  {
692  return s1.cmpY(s2) < 0;
693  }
694  };
695 protected:
696  T m_x, m_y;
697 };
698 
702 typedef Vec2<int> Vec2i;
705 
709 template <class T> class WPSBox2
710 {
711 public:
713  explicit WPSBox2(Vec2<T> minPt=Vec2<T>(), Vec2<T> maxPt=Vec2<T>())
714  {
715  m_pt[0] = minPt;
716  m_pt[1] = maxPt;
717  }
719  template <class U> explicit WPSBox2(WPSBox2<U> const &p)
720  {
721  for (int c=0; c < 2; c++) m_pt[c] = Vec2<T>(p[c]);
722  }
723 
725  Vec2<T> const &min() const
726  {
727  return m_pt[0];
728  }
730  Vec2<T> const &max() const
731  {
732  return m_pt[1];
733  }
736  {
737  return m_pt[0];
738  }
741  {
742  return m_pt[1];
743  }
744 
748  Vec2<T> const &operator[](int c) const
749  {
750  if (c<0 || c>1) throw libwps::GenericException();
751  return m_pt[c];
752  }
754  Vec2<T> size() const
755  {
756  return m_pt[1]-m_pt[0];
757  }
759  Vec2<T> center() const
760  {
761  return 0.5*(m_pt[0]+m_pt[1]);
762  }
763 
765  void set(Vec2<T> const &x, Vec2<T> const &y)
766  {
767  m_pt[0] = x;
768  m_pt[1] = y;
769  }
771  void setMin(Vec2<T> const &x)
772  {
773  m_pt[0] = x;
774  }
776  void setMax(Vec2<T> const &y)
777  {
778  m_pt[1] = y;
779  }
780 
782  void resizeFromMin(Vec2<T> const &sz)
783  {
784  m_pt[1] = m_pt[0]+sz;
785  }
787  void resizeFromMax(Vec2<T> const &sz)
788  {
789  m_pt[0] = m_pt[1]-sz;
790  }
792  void resizeFromCenter(Vec2<T> const &sz)
793  {
794  Vec2<T> ctr = 0.5*(m_pt[0]+m_pt[1]);
795  m_pt[0] = ctr - 0.5*sz;
796  m_pt[1] = ctr + (sz - 0.5*sz);
797  }
798 
800  template <class U> void scale(U factor)
801  {
802  m_pt[0] *= factor;
803  m_pt[1] *= factor;
804  }
805 
807  void extend(T val)
808  {
809  m_pt[0] -= Vec2<T>(val/2,val/2);
810  m_pt[1] += Vec2<T>(val-(val/2),val-(val/2));
811  }
813  WPSBox2<T> getUnion(WPSBox2<T> const &box) const
814  {
815  WPSBox2<T> res;
816  res.m_pt[0]=Vec2<T>(m_pt[0][0]<box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
817  m_pt[0][1]<box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
818  res.m_pt[1]=Vec2<T>(m_pt[1][0]>box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
819  m_pt[1][1]>box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
820  return res;
821  }
824  {
825  WPSBox2<T> res;
826  res.m_pt[0]=Vec2<T>(m_pt[0][0]>box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
827  m_pt[0][1]>box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
828  res.m_pt[1]=Vec2<T>(m_pt[1][0]<box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
829  m_pt[1][1]<box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
830  return res;
831  }
832 
834  bool operator==(WPSBox2<T> const &p) const
835  {
836  return cmp(p) == 0;
837  }
839  bool operator!=(WPSBox2<T> const &p) const
840  {
841  return cmp(p) != 0;
842  }
844  bool operator<(WPSBox2<T> const &p) const
845  {
846  return cmp(p) < 0;
847  }
848 
850  int cmp(WPSBox2<T> const &p) const
851  {
852  int diff = m_pt[0].cmpY(p.m_pt[0]);
853  if (diff) return diff;
854  diff = m_pt[1].cmpY(p.m_pt[1]);
855  if (diff) return diff;
856  return 0;
857  }
858 
860  friend std::ostream &operator<< (std::ostream &o, WPSBox2<T> const &f)
861  {
862  o << "(" << f.m_pt[0] << "<->" << f.m_pt[1] << ")";
863  return o;
864  }
865 
869  struct PosSizeLt
870  {
872  bool operator()(WPSBox2<T> const &s1, WPSBox2<T> const &s2) const
873  {
874  return s1.cmp(s2) < 0;
875  }
876  };
880  typedef std::map<WPSBox2<T>, T,struct PosSizeLt> Map;
881 
882 protected:
885 };
886 
891 
895 template <class T> class WPSVec3
896 {
897 public:
899  explicit WPSVec3(T xx=0,T yy=0,T zz=0)
900  {
901  m_val[0] = xx;
902  m_val[1] = yy;
903  m_val[2] = zz;
904  }
906  template <class U> explicit WPSVec3(WPSVec3<U> const &p)
907  {
908  for (int c = 0; c < 3; c++) m_val[c] = T(p[c]);
909  }
910 
912  T x() const
913  {
914  return m_val[0];
915  }
917  T y() const
918  {
919  return m_val[1];
920  }
922  T z() const
923  {
924  return m_val[2];
925  }
927  T operator[](int c) const
928  {
929  if (c<0 || c>2) throw libwps::GenericException();
930  return m_val[c];
931  }
933  T &operator[](int c)
934  {
935  if (c<0 || c>2) throw libwps::GenericException();
936  return m_val[c];
937  }
938 
940  void set(T xx, T yy, T zz)
941  {
942  m_val[0] = xx;
943  m_val[1] = yy;
944  m_val[2] = zz;
945  }
947  void setX(T xx)
948  {
949  m_val[0] = xx;
950  }
952  void setY(T yy)
953  {
954  m_val[1] = yy;
955  }
957  void setZ(T zz)
958  {
959  m_val[2] = zz;
960  }
961 
963  void add(T dx, T dy, T dz)
964  {
965  m_val[0] += dx;
966  m_val[1] += dy;
967  m_val[2] += dz;
968  }
969 
972  {
973  for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]);
974  return *this;
975  }
978  {
979  for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]-p.m_val[c]);
980  return *this;
981  }
983  template <class U>
985  {
986  for (auto &c : m_val) c = T(c*scale);
987  return *this;
988  }
989 
991  friend WPSVec3<T> operator+(WPSVec3<T> const &p1, WPSVec3<T> const &p2)
992  {
993  WPSVec3<T> p(p1);
994  return p+=p2;
995  }
997  friend WPSVec3<T> operator-(WPSVec3<T> const &p1, WPSVec3<T> const &p2)
998  {
999  WPSVec3<T> p(p1);
1000  return p-=p2;
1001  }
1003  template <class U>
1004  friend WPSVec3<T> operator*(U scale, WPSVec3<T> const &p1)
1005  {
1006  WPSVec3<T> p(p1);
1007  return p *= scale;
1008  }
1009 
1011  bool operator==(WPSVec3<T> const &p) const
1012  {
1013  return cmp(p) == 0;
1014  }
1016  bool operator!=(WPSVec3<T> const &p) const
1017  {
1018  return cmp(p) != 0;
1019  }
1021  bool operator<(WPSVec3<T> const &p) const
1022  {
1023  return cmp(p) < 0;
1024  }
1026  int cmp(WPSVec3<T> const &p) const
1027  {
1028  for (int c = 0; c < 3; c++)
1029  {
1030  if (m_val[c]<p.m_val[c]) return -1;
1031  if (m_val[c]>p.m_val[c]) return 1;
1032  }
1033  return 0;
1034  }
1035 
1037  friend std::ostream &operator<< (std::ostream &o, WPSVec3<T> const &f)
1038  {
1039  o << f.m_val[0] << "x" << f.m_val[1] << "x" << f.m_val[2];
1040  return o;
1041  }
1042 
1046  struct PosSizeLt
1047  {
1049  bool operator()(WPSVec3<T> const &s1, WPSVec3<T> const &s2) const
1050  {
1051  return s1.cmp(s2) < 0;
1052  }
1053  };
1057  typedef std::map<WPSVec3<T>, T,struct PosSizeLt> Map;
1058 
1059 protected:
1061  T m_val[3];
1062 };
1063 
1070 
1071 
1077 {
1080  {
1081  }
1087  WPSEmbeddedObject(librevenge::RVNGBinaryData const &binaryData,
1088  std::string const &type="image/pict") : m_size(), m_dataList(), m_typeList(), m_sent(false)
1089  {
1090  add(binaryData, type);
1091  }
1093  virtual ~WPSEmbeddedObject();
1095  bool isEmpty() const
1096  {
1097  for (auto const &data : m_dataList)
1098  {
1099  if (!data.empty())
1100  return false;
1101  }
1102  return true;
1103  }
1105  void add(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
1106  {
1107  size_t pos=m_dataList.size();
1108  if (pos<m_typeList.size()) pos=m_typeList.size();
1109  m_dataList.resize(pos+1);
1110  m_dataList[pos]=binaryData;
1111  m_typeList.resize(pos+1);
1112  m_typeList[pos]=type;
1113  }
1115  bool addTo(librevenge::RVNGPropertyList &propList) const;
1117  friend std::ostream &operator<<(std::ostream &o, WPSEmbeddedObject const &pict);
1118 
1122  std::vector<librevenge::RVNGBinaryData> m_dataList;
1124  std::vector<std::string> m_typeList;
1126  mutable bool m_sent;
1127 };
1128 
1131 {
1132 public:
1134  explicit WPSTransformation(WPSVec3f const &xRow=WPSVec3f(1,0,0), WPSVec3f const &yRow=WPSVec3f(0,1,0))
1135  : m_data(xRow, yRow)
1136  , m_isIdentity(false)
1137  {
1138  checkIdentity();
1139  }
1145  bool isIdentity() const
1146  {
1147  return m_isIdentity;
1148  }
1150  void checkIdentity() const
1151  {
1152  m_isIdentity= m_data.first==WPSVec3f(1,0,0) && m_data.second==WPSVec3f(0,1,0);
1153  }
1157  WPSVec3f const &operator[](int c) const
1158  {
1159  if (c<0 || c>1) throw libwps::GenericException();
1160  return c==0 ? m_data.first : m_data.second;
1161  }
1163  Vec2f operator*(Vec2f const &pt) const
1164  {
1165  if (m_isIdentity) return pt;
1166  return multiplyDirection(pt)+Vec2f(m_data.first[2],m_data.second[2]);
1167  }
1169  Vec2f multiplyDirection(Vec2f const &dir) const
1170  {
1171  if (m_isIdentity) return dir;
1172  Vec2f res;
1173  for (int coord=0; coord<2; ++coord)
1174  {
1175  WPSVec3f const &row=coord==0 ? m_data.first : m_data.second;
1176  float value=0;
1177  for (int i=0; i<2; ++i)
1178  value+=row[i]*dir[i];
1179  res[coord]=value;
1180  }
1181  return res;
1182  }
1184  WPSBox2f operator*(WPSBox2f const &box) const
1185  {
1186  if (m_isIdentity) return box;
1187  return WPSBox2f(operator*(box.min()), operator*(box.max()));
1188  }
1191  {
1192  if (mat.m_isIdentity) return *this;
1193  WPSTransformation res;
1194  for (int row=0; row<2; ++row)
1195  {
1196  WPSVec3f &resRow=row==0 ? res.m_data.first : res.m_data.second;
1197  for (int col=0; col<3; ++col)
1198  {
1199  float value=0;
1200  for (int i=0; i<3; ++i)
1201  value+=(*this)[row][i]*(i==2 ? (col==2 ? 1.f : 0.f) : mat[i][col]);
1202  resRow[col]=value;
1203  }
1204  }
1205  res.checkIdentity();
1206  return res;
1207  }
1210  {
1211  if (!mat.m_isIdentity)
1212  *this=(*this)*mat;
1213  return *this;
1214  }
1216  bool operator==(WPSTransformation const &mat) const
1217  {
1218  return m_data==mat.m_data;
1219  }
1221  bool operator!=(WPSTransformation const &mat) const
1222  {
1223  return m_data!=mat.m_data;
1224  }
1226  bool operator<(WPSTransformation const &mat) const
1227  {
1228  return m_data<mat.m_data;
1229  }
1231  bool operator<=(WPSTransformation const &mat) const
1232  {
1233  return m_data<=mat.m_data;
1234  }
1236  bool operator>(WPSTransformation const &mat) const
1237  {
1238  return m_data>mat.m_data;
1239  }
1241  bool operator>=(WPSTransformation const &mat) const
1242  {
1243  return m_data>=mat.m_data;
1244  }
1248  bool decompose(float &rotation, Vec2f &shearing, WPSTransformation &transform, Vec2f const &center) const;
1249 
1251  static WPSTransformation translation(Vec2f const &trans)
1252  {
1253  return WPSTransformation(WPSVec3f(1, 0, trans[0]), WPSVec3f(0, 1, trans[1]));
1254  }
1256  static WPSTransformation scale(Vec2f const &trans)
1257  {
1258  return WPSTransformation(WPSVec3f(trans[0], 0, 0), WPSVec3f(0, trans[1], 0));
1259  }
1263  static WPSTransformation rotation(float angle, Vec2f const &center=Vec2f(0,0));
1267  static WPSTransformation shear(Vec2f s, Vec2f const &center=Vec2f(0,0))
1268  {
1269  return WPSTransformation(WPSVec3f(1, s[0], -s[0]*center[1]), WPSVec3f(s[1], 1, -s[1]*center[0]));
1270  }
1271 protected:
1273  std::pair<WPSVec3f, WPSVec3f > m_data;
1275  mutable bool m_isIdentity;
1276 };
1277 
1278 //
1279 // utility
1280 //
1281 
1282 namespace libwps
1283 {
1285 std::string getCellName(Vec2i const &cellPos, Vec2b const &relative=Vec2b(true,true));
1287 bool encodeLotusPassword(char const *password, uint16_t &key, std::vector<uint8_t> &keys, uint8_t const(&defValues)[16]);
1288 }
1289 #endif /* LIBWPS_INTERNAL_H */
1290 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
Vec2::PosSizeLtX::operator()
bool operator()(Vec2< T > const &s1, Vec2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:678
WPSVec3::setX
void setX(T xx)
resets the first element
Definition: libwps_internal.h:947
WPSBox2::center
Vec2< T > center() const
the box center
Definition: libwps_internal.h:759
WPSField::WPSField
WPSField(WPSField const &)=default
WPSTransformation::m_isIdentity
bool m_isIdentity
flag to know if this matrix is an identity matrix
Definition: libwps_internal.h:1275
WPSBox2::WPSBox2
WPSBox2(WPSBox2< U > const &p)
generic constructor
Definition: libwps_internal.h:719
WPSSubDocument
virtual class to define a sub document
Definition: WPSSubDocument.h:34
WPSBox2::WPSBox2
WPSBox2(Vec2< T > minPt=Vec2< T >(), Vec2< T > maxPt=Vec2< T >())
constructor
Definition: libwps_internal.h:713
WPSColor::white
static WPSColor white()
return the white color
Definition: libwps_internal.h:311
WPSBox2::getIntersection
WPSBox2< T > getIntersection(WPSBox2< T > const &box) const
returns the intersection between this and box
Definition: libwps_internal.h:823
WPSVec3::m_val
T m_val[3]
the values
Definition: libwps_internal.h:1061
WPSBox2< int >::Map
std::map< WPSBox2< int >, int, struct PosSizeLt > Map
map of WPSBox2
Definition: libwps_internal.h:880
libwps::numberingTypeToString
std::string numberingTypeToString(NumberingType type)
Definition: libwps_internal.cpp:357
WPSField
a field
Definition: libwps_internal.h:463
WPSBox2::operator!=
bool operator!=(WPSBox2< T > const &p) const
comparison operator!=
Definition: libwps_internal.h:839
WPSBorder::Style
Style
the line style
Definition: libwps_internal.h:397
libwps::VersionException
Definition: libwps_internal.h:142
libwps::UPPERCASE_ROMAN
@ UPPERCASE_ROMAN
Definition: libwps_internal.h:246
Vec2::operator==
bool operator==(Vec2< T > const &p) const
comparison==
Definition: libwps_internal.h:632
Vec2::Vec2
Vec2(Vec2< U > const &p)
generic copy constructor
Definition: libwps_internal.h:540
libwps::convertDTFormat
static bool convertDTFormat(std::string const &dtFormat, librevenge::RVNGPropertyListVector &propVect)
Definition: libwps_internal.cpp:426
WPSTransformation
a transformation which stored the first row of a 3x3 perspective matrix
Definition: libwps_internal.h:1131
WPSField::PageNumber
@ PageNumber
Definition: libwps_internal.h:465
WPSTransformation::operator>
bool operator>(WPSTransformation const &mat) const
operator>
Definition: libwps_internal.h:1236
Vec2::PosSizeLtX
internal struct used to create sorted map, sorted by X
Definition: libwps_internal.h:676
WPSBorder::Simple
@ Simple
Definition: libwps_internal.h:397
Vec2::operator*=
Vec2< T > & operator*=(U scale)
generic operator*=
Definition: libwps_internal.h:604
WPSVec3::operator<<
friend std::ostream & operator<<(std::ostream &o, WPSVec3< T > const &f)
operator<<: prints data in form "XxYxZ"
Definition: libwps_internal.h:1037
WPSColor::operator==
bool operator==(WPSColor const &c) const
operator==
Definition: libwps_internal.h:355
libwps::encodeLotusPassword
bool encodeLotusPassword(char const *password, uint16_t &key, std::vector< uint8_t > &keys, uint8_t const(&defValues)[16])
returns the checksum and the keys (to encode a lotus file) given a password file
Definition: libwps_internal.cpp:977
WPSBox2f
WPSBox2< float > WPSBox2f
WPSBox2 of float.
Definition: libwps_internal.h:890
WPSColor::getBlue
unsigned char getBlue() const
returns the green value
Definition: libwps_internal.h:330
WPSVec3::operator<
bool operator<(WPSVec3< T > const &p) const
comparison<: which first compares x values, then y values then z values.
Definition: libwps_internal.h:1021
WPSBorder::Top
@ Top
Definition: libwps_internal.h:400
WPSTransformation::WPSTransformation
WPSTransformation(WPSTransformation const &)=default
WPSVec3::WPSVec3
WPSVec3(WPSVec3< U > const &p)
generic copy constructor
Definition: libwps_internal.h:906
WPSBox2::setMin
void setMin(Vec2< T > const &x)
resets the minimum point
Definition: libwps_internal.h:771
WPSVec3::operator!=
bool operator!=(WPSVec3< T > const &p) const
comparison!=
Definition: libwps_internal.h:1016
WPSBox2::PosSizeLt::operator()
bool operator()(WPSBox2< T > const &s1, WPSBox2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:872
WPSField::m_numberingType
libwps::NumberingType m_numberingType
the number type ( for number field )
Definition: libwps_internal.h:488
WPSVec3::setY
void setY(T yy)
resets the second element
Definition: libwps_internal.h:952
WPSColor::operator=
WPSColor & operator=(uint32_t argb)
operator=
Definition: libwps_internal.h:296
WPSEmbeddedObject::WPSEmbeddedObject
WPSEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
constructor
Definition: libwps_internal.h:1087
libwps::readDouble2Inv
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:273
WPSTransformation::operator*
WPSBox2f operator*(WPSBox2f const &box) const
operator* for box2f
Definition: libwps_internal.h:1184
WPSField::WPSField
WPSField(WPSField &&)=default
WPSField::PageNumberNext
@ PageNumberNext
Definition: libwps_internal.h:465
WPSField::Title
@ Title
Definition: libwps_internal.h:465
WPSVec3::WPSVec3
WPSVec3(T xx=0, T yy=0, T zz=0)
constructor
Definition: libwps_internal.h:899
Vec2::PosSizeLtY::operator()
bool operator()(Vec2< T > const &s1, Vec2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:690
WPSBox2::resizeFromMin
void resizeFromMin(Vec2< T > const &sz)
resize the box keeping the minimum
Definition: libwps_internal.h:782
M_PI
#define M_PI
Definition: libwps_internal.h:43
WPSContentListenerPtr
std::shared_ptr< WPSContentListener > WPSContentListenerPtr
shared pointer to WPSContentListener
Definition: libwps_internal.h:107
libwps
Definition: libwps_internal.cpp:39
WPSBorder::Single
@ Single
Definition: libwps_internal.h:399
libwps::BULLET
@ BULLET
Definition: libwps_internal.h:246
WPSBorder::BottomBit
@ BottomBit
Definition: libwps_internal.h:401
WPSStream
small structure use to store a stream and it debug file
Definition: WPSStream.h:30
WPSBox2::min
Vec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libwps_internal.h:735
WPSColor::value
uint32_t value() const
return the rgba value
Definition: libwps_internal.h:320
WPSEmbeddedObject::operator=
WPSEmbeddedObject & operator=(WPSEmbeddedObject const &)=default
WPSBorder::operator=
WPSBorder & operator=(WPSBorder &&)=default
WPSEmbeddedObject::m_dataList
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition: libwps_internal.h:1122
Vec2::cmp
int cmp(Vec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libwps_internal.h:647
WPSBorder::Right
@ Right
Definition: libwps_internal.h:400
Vec2::add
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition: libwps_internal.h:582
WPSBorder::m_width
int m_width
the border width
Definition: libwps_internal.h:450
WPSColumnProperties::m_alignment
uint8_t m_alignment
Definition: libwps_internal.h:276
Vec2::operator-=
Vec2< T > & operator-=(Vec2< T > const &p)
operator-=
Definition: libwps_internal.h:596
WKSSubDocumentPtr
std::shared_ptr< WKSSubDocument > WKSSubDocumentPtr
shared pointer to WKSSubDocument
Definition: libwps_internal.h:116
WPSTransformation::shear
static WPSTransformation shear(Vec2f s, Vec2f const &center=Vec2f(0, 0))
returns a shear transformation letting center invariant, ie.
Definition: libwps_internal.h:1267
WPSTransformation::operator=
WPSTransformation & operator=(WPSTransformation &&)=default
libwps::JustificationFullAllLines
@ JustificationFullAllLines
Definition: libwps_internal.h:250
libwps::ARABIC
@ ARABIC
Definition: libwps_internal.h:246
WPSColor::isWhite
bool isWhite() const
return true if the color is white
Definition: libwps_internal.h:350
WPSColumnProperties::m_attributes
uint32_t m_attributes
Definition: libwps_internal.h:275
libwps::NumberingType
NumberingType
Definition: libwps_internal.h:246
WPSVec3::cmp
int cmp(WPSVec3< T > const &p) const
a comparison function: which first compares x values, then y values then z values.
Definition: libwps_internal.h:1026
WPSContentListener
Definition: WPSContentListener.h:45
WPSFont
define the font properties
Definition: WPSFont.h:37
WPSBorder::Triple
@ Triple
Definition: libwps_internal.h:399
WPSColor::barycenter
static WPSColor barycenter(float alpha, WPSColor const &colA, float beta, WPSColor const &colB)
return alpha*colA+beta*colB
Definition: libwps_internal.cpp:386
WPSVec3::PosSizeLt::operator()
bool operator()(WPSVec3< T > const &s1, WPSVec3< T > const &s2) const
comparaison function
Definition: libwps_internal.h:1049
WPS_shared_ptr_noop_deleter::operator()
void operator()(T *)
Definition: libwps_internal.h:73
WPSVec3::PosSizeLt
internal struct used to create sorted map, sorted by X, Y, Z
Definition: libwps_internal.h:1047
WPSTransformation::operator==
bool operator==(WPSTransformation const &mat) const
operator==
Definition: libwps_internal.h:1216
WPSField::Type
Type
Defines some basic type for field.
Definition: libwps_internal.h:465
WPSBorder::operator==
bool operator==(WPSBorder const &orig) const
operator==
Definition: libwps_internal.h:428
WPSBox2::operator<<
friend std::ostream & operator<<(std::ostream &o, WPSBox2< T > const &f)
print data in form X0xY0<->X1xY1
Definition: libwps_internal.h:860
WPSEntry
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:39
Vec2i
Vec2< int > Vec2i
Vec2 of int.
Definition: libwps_internal.h:702
WPSColor::operator!=
bool operator!=(WPSColor const &c) const
operator!=
Definition: libwps_internal.h:360
WPSColumnDefinition
Definition: libwps_internal.h:256
WPSVec3::x
T x() const
first element
Definition: libwps_internal.h:912
WPSColor::getGreen
unsigned char getGreen() const
returns the green value
Definition: libwps_internal.h:340
WPSEmbeddedObject::m_typeList
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition: libwps_internal.h:1124
libwps::DOC_TEXT_BOX
@ DOC_TEXT_BOX
Definition: libwps_internal.h:248
WPSField::m_data
std::string m_data
the database/link field ( if defined )
Definition: libwps_internal.h:490
libwps::readDouble10
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:224
WPSColor::operator<=
bool operator<=(WPSColor const &c) const
operator<=
Definition: libwps_internal.h:370
Vec2::m_y
T m_y
second element
Definition: libwps_internal.h:696
WPSListenerPtr
std::shared_ptr< WPSListener > WPSListenerPtr
shared pointer to WPSListener
Definition: libwps_internal.h:105
WPSTransformation::translation
static WPSTransformation translation(Vec2f const &trans)
returns a translation transformation
Definition: libwps_internal.h:1251
WPSBorder::operator!=
bool operator!=(WPSBorder const &orig) const
operator!=
Definition: libwps_internal.h:434
WPSBorder::m_color
WPSColor m_color
the border color
Definition: libwps_internal.h:456
WPSBorder::operator=
WPSBorder & operator=(WPSBorder const &)=default
WPSColumnDefinition::m_leftGutter
double m_leftGutter
Definition: libwps_internal.h:264
WPSVec3f
WPSVec3< float > WPSVec3f
WPSVec3 of float.
Definition: libwps_internal.h:1069
WPSField::addTo
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist (if possible)
Definition: libwps_internal.cpp:530
WPSEmbeddedObject::m_size
Vec2f m_size
the picture size in inches(if known)
Definition: libwps_internal.h:1120
WPSVec3::operator+
friend WPSVec3< T > operator+(WPSVec3< T > const &p1, WPSVec3< T > const &p2)
operator+
Definition: libwps_internal.h:991
WPSBorder::Left
@ Left
Definition: libwps_internal.h:400
Vec2f
Vec2< float > Vec2f
Vec2 of float.
Definition: libwps_internal.h:704
Vec2::operator<
bool operator<(Vec2< T > const &p) const
comparison<: sort by y
Definition: libwps_internal.h:642
WPSBox2::m_pt
Vec2< T > m_pt[2]
the two extremities
Definition: libwps_internal.h:884
WPSVec3::z
T z() const
third element
Definition: libwps_internal.h:922
WPSVec3::operator-
friend WPSVec3< T > operator-(WPSVec3< T > const &p1, WPSVec3< T > const &p2)
operator-
Definition: libwps_internal.h:997
WPSColumnProperties::WPSColumnProperties
WPSColumnProperties()
Definition: libwps_internal.h:270
libwps::ParseException
Definition: libwps_internal.h:152
Vec2< float >
libwps::PasswordException
Definition: libwps_internal.h:157
WPSField::m_type
Type m_type
the type
Definition: libwps_internal.h:484
WPSColor::operator=
WPSColor & operator=(WPSColor &&)=default
move operator=
WPSVec3
small class which defines a vector with 3 elements
Definition: libwps_internal.h:896
WPSBorder::TopBit
@ TopBit
Definition: libwps_internal.h:401
WPSVec3::set
void set(T xx, T yy, T zz)
resets the three elements
Definition: libwps_internal.h:940
WPSTransformation::WPSTransformation
WPSTransformation(WPSTransformation &&)=default
WPS_DEBUG_MSG
#define WPS_DEBUG_MSG(M)
Definition: libwps_internal.h:134
libwps::readU32
uint32_t readU32(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:76
operator<<
std::ostream & operator<<(std::ostream &o, WPSColor const &c)
Definition: libwps_internal.cpp:401
WPSEmbeddedObject::m_sent
bool m_sent
a mutable flag which can be used to know if the picture was send to a listener
Definition: libwps_internal.h:1126
libwps::LOWERCASE_ROMAN
@ LOWERCASE_ROMAN
Definition: libwps_internal.h:246
WPS_FALLTHROUGH
#define WPS_FALLTHROUGH
fall through attributes
Definition: libwps_internal.h:82
WPSTransformation::WPSTransformation
WPSTransformation(WPSVec3f const &xRow=WPSVec3f(1, 0, 0), WPSVec3f const &yRow=WPSVec3f(0, 1, 0))
constructor
Definition: libwps_internal.h:1134
WPSTransformation::operator<
bool operator<(WPSTransformation const &mat) const
operator<
Definition: libwps_internal.h:1226
WPSEmbeddedObject::WPSEmbeddedObject
WPSEmbeddedObject()
empty constructor
Definition: libwps_internal.h:1079
Vec2::x
T x() const
first element
Definition: libwps_internal.h:542
WPSBox2::PosSizeLt
internal struct used to create sorted map, sorted first min then max
Definition: libwps_internal.h:870
WPSTransformation::scale
static WPSTransformation scale(Vec2f const &trans)
returns a scaling transformation
Definition: libwps_internal.h:1256
WPSBox2::operator[]
Vec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition: libwps_internal.h:748
WKSContentListenerPtr
std::shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:114
WPSHeader
Definition: WPSHeader.h:32
libwps::DOC_COMMENT_ANNOTATION
@ DOC_COMMENT_ANNOTATION
Definition: libwps_internal.h:248
libwps::GenericException
Definition: libwps_internal.h:162
libwps::appendUnicode
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer)
adds an unicode character to a string ( with correct encoding ).
Definition: libwps_internal.cpp:836
Vec2::operator-
friend Vec2< T > operator-(Vec2< T > const &p1, Vec2< T > const &p2)
operator-
Definition: libwps_internal.h:618
libwps::read32
int32_t read32(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:85
libwps::UPPERCASE
@ UPPERCASE
Definition: libwps_internal.h:246
Vec2::PosSizeLtY
internal struct used to create sorted map, sorted by Y
Definition: libwps_internal.h:688
libwps::SubDocumentType
SubDocumentType
Definition: libwps_internal.h:248
Vec2::operator[]
T & operator[](int c)
operator[]
Definition: libwps_internal.h:558
WPSListener
virtual class for content listener
Definition: WPSListener.h:37
Vec2::setY
void setY(T yy)
resets the second element
Definition: libwps_internal.h:576
WPSField::Date
@ Date
Definition: libwps_internal.h:465
WPSBorder::Bottom
@ Bottom
Definition: libwps_internal.h:400
WPSBorder::Dot
@ Dot
Definition: libwps_internal.h:397
WPSColor::WPSColor
WPSColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition: libwps_internal.h:287
WPSVec3::operator[]
T operator[](int c) const
operator[]
Definition: libwps_internal.h:927
WPSField::getString
librevenge::RVNGString getString() const
returns a string corresponding to the field (if possible) *‍/
Definition: libwps_internal.cpp:584
WPSVec3::operator-=
WPSVec3< T > & operator-=(WPSVec3< T > const &p)
operator-=
Definition: libwps_internal.h:977
WPSTransformation::operator[]
WPSVec3f const & operator[](int c) const
the two extremum points which defined the box
Definition: libwps_internal.h:1157
WPSField::None
@ None
Definition: libwps_internal.h:465
WPSBorder::RightBit
@ RightBit
Definition: libwps_internal.h:401
WPSColor::operator=
WPSColor & operator=(WPSColor const &)=default
operator=
WPSBorder::operator<<
friend std::ostream & operator<<(std::ostream &o, WPSBorder const &border)
operator<<
Definition: libwps_internal.cpp:743
Vec2::operator*
friend Vec2< T > operator*(U scale, Vec2< T > const &p1)
generic operator*
Definition: libwps_internal.h:625
WPSTransformation::operator>=
bool operator>=(WPSTransformation const &mat) const
operator>=
Definition: libwps_internal.h:1241
WPSEmbeddedObject::~WPSEmbeddedObject
virtual ~WPSEmbeddedObject()
destructor
Definition: libwps_internal.cpp:780
libwps::readDouble4
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:90
libwps::DOC_HEADER_FOOTER
@ DOC_HEADER_FOOTER
Definition: libwps_internal.h:248
libwps::readDouble4Inv
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:303
WPSBox2::set
void set(Vec2< T > const &x, Vec2< T > const &y)
resets the data to minimum x and maximum y
Definition: libwps_internal.h:765
Vec2::cmpY
int cmpY(Vec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libwps_internal.h:656
libwps::DOC_CHART_ZONE
@ DOC_CHART_ZONE
Definition: libwps_internal.h:248
libwps::read8
int8_t read8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:59
WPSEmbeddedObject::isEmpty
bool isEmpty() const
return true if the picture contains no data
Definition: libwps_internal.h:1095
WPSEmbeddedObject::WPSEmbeddedObject
WPSEmbeddedObject(WPSEmbeddedObject const &)=default
WPSEmbeddedObject::add
void add(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
add a picture
Definition: libwps_internal.h:1105
WPSBorder::m_style
Style m_style
the border style
Definition: libwps_internal.h:446
WPSVec3::operator*
friend WPSVec3< T > operator*(U scale, WPSVec3< T > const &p1)
generic operator*
Definition: libwps_internal.h:1004
WPSSubDocumentPtr
std::shared_ptr< WPSSubDocument > WPSSubDocumentPtr
shared pointer to WPSSubDocument
Definition: libwps_internal.h:111
Vec2::operator<<
friend std::ostream & operator<<(std::ostream &o, Vec2< T > const &f)
operator<<: prints data in form "XxY"
Definition: libwps_internal.h:666
WPSEmbeddedObject
small class use to define a embedded object
Definition: libwps_internal.h:1077
WPSField::m_DTFormat
std::string m_DTFormat
the date/time format using strftime format if defined (see strftime)
Definition: libwps_internal.h:486
WPSVec3::operator*=
WPSVec3< T > & operator*=(U scale)
generic operator*=
Definition: libwps_internal.h:984
WPSTransformation::operator*
WPSTransformation operator*(WPSTransformation const &mat) const
operator* for transform
Definition: libwps_internal.h:1190
libwps::readDouble8
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:173
WPSColumnDefinition::WPSColumnDefinition
WPSColumnDefinition()
Definition: libwps_internal.h:257
WPSBorder::Dash
@ Dash
Definition: libwps_internal.h:397
WPSBorder::WPSBorder
WPSBorder(WPSBorder &&)=default
WPSHeaderPtr
std::shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:109
libwps::DOC_NOTE
@ DOC_NOTE
Definition: libwps_internal.h:248
WPSBox2::min
Vec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libwps_internal.h:725
WPSBox2::max
Vec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libwps_internal.h:740
WPSField::operator=
WPSField & operator=(WPSField &&)=default
WPSCell
a structure used to defined the cell position, and a format
Definition: WPSCell.h:291
Vec2::operator+
friend Vec2< T > operator+(Vec2< T > const &p1, Vec2< T > const &p2)
operator+
Definition: libwps_internal.h:612
WPSBorder::isEmpty
bool isEmpty() const
returns true if the border is empty
Definition: libwps_internal.h:422
WKSSubDocument
Basic class used to store a spreadsheet sub document.
Definition: WKSSubDocument.h:36
WPSField::WPSField
WPSField(Type type)
basic constructor
Definition: libwps_internal.h:468
Vec2::operator!=
bool operator!=(Vec2< T > const &p) const
comparison!=
Definition: libwps_internal.h:637
libwps::readU8
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:40
WPSTransformation::operator*=
WPSTransformation & operator*=(WPSTransformation const &mat)
operator*=
Definition: libwps_internal.h:1209
WPSBorder
a border list
Definition: libwps_internal.h:395
WPSColumnProperties
Definition: libwps_internal.h:269
WPSTransformation::checkIdentity
void checkIdentity() const
check if a matrix is the identity matrix
Definition: libwps_internal.h:1150
WPSEmbeddedObject::WPSEmbeddedObject
WPSEmbeddedObject(WPSEmbeddedObject &&)=default
WPSBorder::Type
Type
the line repetition
Definition: libwps_internal.h:399
libwps::DOC_NONE
@ DOC_NONE
Definition: libwps_internal.h:248
WPSVec3::operator[]
T & operator[](int c)
operator[]
Definition: libwps_internal.h:933
WPSField::Link
@ Link
Definition: libwps_internal.h:465
libwps::Justification
Justification
Definition: libwps_internal.h:249
WPSColor::operator>=
bool operator>=(WPSColor const &c) const
operator>=
Definition: libwps_internal.h:380
WPSField::PageCount
@ PageCount
Definition: libwps_internal.h:465
WPSVec3i
WPSVec3< int > WPSVec3i
WPSVec3 of int.
Definition: libwps_internal.h:1067
WPSBox2::resizeFromCenter
void resizeFromCenter(Vec2< T > const &sz)
resize the box keeping the center
Definition: libwps_internal.h:792
WPSBorder::compare
int compare(WPSBorder const &orig) const
compare two cell
Definition: libwps_internal.cpp:623
libwps::readData
bool readData(RVNGInputStreamPtr &input, unsigned long size, librevenge::RVNGBinaryData &data)
try to read sz bytes from input and store them in a librevenge::RVNGBinaryData
Definition: libwps_internal.cpp:332
WPSTransformation::isIdentity
bool isIdentity() const
returns true if the matrix is an identity matrix
Definition: libwps_internal.h:1145
WPSColumnDefinition::m_width
double m_width
Definition: libwps_internal.h:263
WPSBox2::scale
void scale(U factor)
scales all points of the box by factor
Definition: libwps_internal.h:800
Vec2::m_x
T m_x
first element
Definition: libwps_internal.h:696
WPSBorder::WPSBorder
WPSBorder()
constructor
Definition: libwps_internal.h:404
WPSField::Time
@ Time
Definition: libwps_internal.h:465
libwps::readU16
uint16_t readU16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:64
WPSBox2::extend
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition: libwps_internal.h:807
WPSBox2::setMax
void setMax(Vec2< T > const &y)
resets the maximum point
Definition: libwps_internal.h:776
WPSBox2::resizeFromMax
void resizeFromMax(Vec2< T > const &sz)
resize the box keeping the maximum
Definition: libwps_internal.h:787
WPSTransformation::decompose
bool decompose(float &rotation, Vec2f &shearing, WPSTransformation &transform, Vec2f const &center) const
try to decompose the matrix in a rotation + scaling/translation matrix.
Definition: libwps_internal.cpp:899
libwps::DOC_TABLE
@ DOC_TABLE
Definition: libwps_internal.h:248
WPSBorder::Double
@ Double
Definition: libwps_internal.h:399
WPSTransformation::m_data
std::pair< WPSVec3f, WPSVec3f > m_data
the data
Definition: libwps_internal.h:1273
RVNGInputStreamPtr
std::shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:87
WPSVec3::setZ
void setZ(T zz)
resets the third element
Definition: libwps_internal.h:957
WPSBox2::max
Vec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition: libwps_internal.h:730
WPSBorder::m_widthsList
std::vector< double > m_widthsList
the different length used for each line/sep (if defined)
Definition: libwps_internal.h:454
WPSPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: WPSPosition.h:40
WPSBorder::LeftBit
@ LeftBit
Definition: libwps_internal.h:401
WPSBorder::m_type
Type m_type
the border repetition
Definition: libwps_internal.h:448
WPSEmbeddedObject::addTo
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist
Definition: libwps_internal.cpp:784
WPSBorder::Pos
Pos
Definition: libwps_internal.h:400
WPSBox2::size
Vec2< T > size() const
the box size
Definition: libwps_internal.h:754
libwps::readDataToEnd
bool readDataToEnd(RVNGInputStreamPtr &input, librevenge::RVNGBinaryData &data)
try to read the last bytes from input and store them in a librevenge::RVNGBinaryData
Definition: libwps_internal.cpp:346
WPSColor::WPSColor
WPSColor(WPSColor &&)=default
move assignement
WPSColor::operator>
bool operator>(WPSColor const &c) const
operator>
Definition: libwps_internal.h:375
WPSBorder::None
@ None
Definition: libwps_internal.h:397
WPSCellPtr
std::shared_ptr< WPSCell > WPSCellPtr
shared pointer to WPSCell
Definition: libwps_internal.h:100
Vec2::operator+=
Vec2< T > & operator+=(Vec2< T > const &p)
operator+=
Definition: libwps_internal.h:589
WPSColumnDefinition::m_rightGutter
double m_rightGutter
Definition: libwps_internal.h:265
WPSBorder::addTo
bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const
add the border property to proplist (if needed )
Definition: libwps_internal.cpp:641
WPSField::operator=
WPSField & operator=(WPSField const &)=default
libwps::LOWERCASE
@ LOWERCASE
Definition: libwps_internal.h:246
libwps::read16
int16_t read16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:71
WPS_ATTRIBUTE_PRINTF
#define WPS_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libwps_internal.h:121
WPSField::Database
@ Database
Definition: libwps_internal.h:465
Vec2::set
void set(T xx, T yy)
resets the two elements
Definition: libwps_internal.h:565
libwps::JustificationFull
@ JustificationFull
Definition: libwps_internal.h:249
libwps_internal.h
libwps::NoBreakWithNextBit
@ NoBreakWithNextBit
Definition: libwps_internal.h:252
WPSColor::m_value
uint32_t m_value
the argb color
Definition: libwps_internal.h:390
WPSEmbeddedObject::operator=
WPSEmbeddedObject & operator=(WPSEmbeddedObject &&)=default
libwps::JustificationLeft
@ JustificationLeft
Definition: libwps_internal.h:249
WPSVec3uc
WPSVec3< unsigned char > WPSVec3uc
WPSVec3 of unsigned char.
Definition: libwps_internal.h:1065
WPSColor::str
std::string str() const
print the color in the form #rrggbb
Definition: libwps_internal.cpp:413
WPSColor::getRed
unsigned char getRed() const
returns the red value
Definition: libwps_internal.h:335
WPSColor
the class to store a color
Definition: libwps_internal.h:281
WPSBox2i
WPSBox2< int > WPSBox2i
WPSBox2 of int.
Definition: libwps_internal.h:888
WPSTransformation::operator!=
bool operator!=(WPSTransformation const &mat) const
operator!=
Definition: libwps_internal.h:1221
libwps::NoBreakBit
@ NoBreakBit
Definition: libwps_internal.h:252
WPSBox2::cmp
int cmp(WPSBox2< T > const &p) const
comparison function : fist sorts min by Y,X values then max extremity
Definition: libwps_internal.h:850
WPSTransformation::multiplyDirection
Vec2f multiplyDirection(Vec2f const &dir) const
operator* for direction
Definition: libwps_internal.h:1169
WPSTransformation::rotation
static WPSTransformation rotation(float angle, Vec2f const &center=Vec2f(0, 0))
returns a rotation transformation around center.
Definition: libwps_internal.cpp:890
WPSBox2
small class which defines a 2D WPSBox
Definition: libwps_internal.h:710
WPSBox2::getUnion
WPSBox2< T > getUnion(WPSBox2< T > const &box) const
returns the union between this and box
Definition: libwps_internal.h:813
WPSVec3::y
T y() const
second element
Definition: libwps_internal.h:917
WPSVec3::operator==
bool operator==(WPSVec3< T > const &p) const
comparison==
Definition: libwps_internal.h:1011
Vec2b
Vec2< bool > Vec2b
Vec2 of bool.
Definition: libwps_internal.h:700
Vec2::setX
void setX(T xx)
resets the first element
Definition: libwps_internal.h:571
WKSContentListener
Definition: WKSContentListener.h:54
libwps::NONE
@ NONE
Definition: libwps_internal.h:246
WPSBorder::LargeDot
@ LargeDot
Definition: libwps_internal.h:397
WPSColor::operator<<
friend std::ostream & operator<<(std::ostream &o, WPSColor const &c)
operator<< in the form #rrggbb
Definition: libwps_internal.cpp:401
WPSColor::WPSColor
WPSColor(uint32_t argb=0)
constructor
Definition: libwps_internal.h:283
WPSBorder::WPSBorder
WPSBorder(WPSBorder const &)=default
libwps::JustificationCenter
@ JustificationCenter
Definition: libwps_internal.h:249
WPSVec3::operator+=
WPSVec3< T > & operator+=(WPSVec3< T > const &p)
operator+=
Definition: libwps_internal.h:971
libwps::JustificationRight
@ JustificationRight
Definition: libwps_internal.h:250
WPSBorder::m_extra
std::string m_extra
extra data ( if needed)
Definition: libwps_internal.h:458
WPS_shared_ptr_noop_deleter
a noop deleter used to transform a librevenge pointer in a false std::shared_ptr
Definition: libwps_internal.h:72
WPSTransformation::operator*
Vec2f operator*(Vec2f const &pt) const
operator* for vec2f
Definition: libwps_internal.h:1163
WPSVec3::add
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition: libwps_internal.h:963
WPSColor::getAlpha
unsigned char getAlpha() const
returns the alpha value
Definition: libwps_internal.h:325
libwps::FileException
Definition: libwps_internal.h:147
WPSBox2::operator<
bool operator<(WPSBox2< T > const &p) const
comparison operator< : fist sorts min by Y,X values then max extremity
Definition: libwps_internal.h:844
Vec2::y
T y() const
second element
Definition: libwps_internal.h:547
WPSTransformation::operator<=
bool operator<=(WPSTransformation const &mat) const
operator<=
Definition: libwps_internal.h:1231
WPSColor::black
static WPSColor black()
return the back color
Definition: libwps_internal.h:306
WPSEmbeddedObject::operator<<
friend std::ostream & operator<<(std::ostream &o, WPSEmbeddedObject const &pict)
operator<<
Definition: libwps_internal.cpp:814
WPSColor::operator<
bool operator<(WPSColor const &c) const
operator<
Definition: libwps_internal.h:365
libwps::getCellName
std::string getCellName(Vec2i const &cellPos, Vec2b const &relative)
returns the cell name corresponding to a cell's position
Definition: libwps_internal.cpp:953
Vec2::Vec2
Vec2(T xx=0, T yy=0)
constructor
Definition: libwps_internal.h:538
WPSColor::isBlack
bool isBlack() const
return true if the color is black
Definition: libwps_internal.h:345
WPSVec3< int >::Map
std::map< WPSVec3< int >, int, struct PosSizeLt > Map
map of WPSVec3
Definition: libwps_internal.h:1057
Vec2::operator[]
T operator[](int c) const
operator[]
Definition: libwps_internal.h:552
WPSTransformation::operator=
WPSTransformation & operator=(WPSTransformation const &)=default
WPSBox2::operator==
bool operator==(WPSBox2< T > const &p) const
comparison operator==
Definition: libwps_internal.h:834
WPSColor::WPSColor
WPSColor(WPSColor const &)=default
copy constructor

Generated on Tue Nov 14 2023 08:14:49 for libwps by doxygen 1.8.20