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 <string>
36 #include <vector>
37 
38 #include <librevenge-stream/librevenge-stream.h>
39 #include <librevenge/librevenge.h>
40 
41 #ifndef M_PI
42 #define M_PI 3.14159265358979323846
43 #endif
44 
45 #if defined(_MSC_VER) || defined(__DJGPP__)
46 typedef signed char int8_t;
47 typedef unsigned char uint8_t;
48 typedef signed short int16_t;
49 typedef unsigned short uint16_t;
50 typedef signed int int32_t;
51 typedef unsigned int uint32_t;
52 #else /* !_MSC_VER && !__DJGPP__*/
53 # include <inttypes.h>
54 #endif /* _MSC_VER || __DJGPP__*/
55 
56 /* ---------- memory --------------- */
57 #ifdef HAVE_CONFIG_H
58 # include "config.h"
59 #endif
60 
61 // define localtime_r on Windows, so that can use
62 // thread-safe functions on other environments
63 #ifdef _WIN32
64 # define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
65 # define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0)
66 #endif
67 
68 #if defined(SHAREDPTR_TR1)
69 #include <tr1/memory>
70 using std::tr1::shared_ptr;
71 #elif defined(SHAREDPTR_STD)
72 #include <memory>
73 using std::shared_ptr;
74 #else
75 #include <boost/shared_ptr.hpp>
76 using boost::shared_ptr;
77 #endif
78 
80 template <class T>
82 {
83  void operator()(T *) {}
84 };
85 
86 // basic classes and autoptr
88 typedef shared_ptr<librevenge::RVNGInputStream> RVNGInputStreamPtr;
89 
90 struct WPSStream;
91 class WPSCell;
92 class WPSListener;
93 class WPSContentListener;
94 class WPSEntry;
95 class WPSFont;
96 class WPSHeader;
97 class WPSPosition;
98 class WPSSubDocument;
99 
100 class WKSContentListener;
102 
104 typedef shared_ptr<WPSCell> WPSCellPtr;
106 typedef shared_ptr<WPSListener> WPSListenerPtr;
108 typedef shared_ptr<WPSContentListener> WPSContentListenerPtr;
110 typedef shared_ptr<WPSHeader> WPSHeaderPtr;
112 typedef shared_ptr<WPSSubDocument> WPSSubDocumentPtr;
113 
115 typedef shared_ptr<WKSContentListener> WKSContentListenerPtr;
117 typedef shared_ptr<WKSSubDocument> WKSSubDocumentPtr;
118 
119 #if defined(__clang__) || defined(__GNUC__)
120 # define WPS_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((__format__(__printf__, fmt, arg)))
121 #else
122 # define WPS_ATTRIBUTE_PRINTF(fmt, arg)
123 #endif
124 /* ---------- debug --------------- */
125 #ifdef DEBUG
126 namespace libwps
127 {
128 void printDebugMsg(const char *format, ...) WPS_ATTRIBUTE_PRINTF(1, 2);
129 }
130 #define WPS_DEBUG_MSG(M) libwps::printDebugMsg M
131 #else
132 #define WPS_DEBUG_MSG(M)
133 #endif
134 
135 /* ---------- exception ------------ */
136 namespace libwps
137 {
138 // Various exceptions
140 {
141  // needless to say, we could flesh this class out a bit
142 };
143 
145 {
146  // needless to say, we could flesh this class out a bit
147 };
148 
150 {
151  // needless to say, we could flesh this class out a bit
152 };
153 
155 {
156  // needless to say, we could flesh this class out a bit
157 };
158 }
159 
160 /* ---------- input ----------------- */
161 namespace libwps
162 {
163 uint8_t readU8(librevenge::RVNGInputStream *input);
164 uint16_t readU16(librevenge::RVNGInputStream *input);
165 uint32_t readU32(librevenge::RVNGInputStream *input);
166 
167 int8_t read8(librevenge::RVNGInputStream *input);
168 int16_t read16(librevenge::RVNGInputStream *input);
169 int32_t read32(librevenge::RVNGInputStream *input);
170 
171 inline uint8_t readU8(RVNGInputStreamPtr &input)
172 {
173  return readU8(input.get());
174 }
175 inline uint16_t readU16(RVNGInputStreamPtr &input)
176 {
177  return readU16(input.get());
178 }
179 inline uint32_t readU32(RVNGInputStreamPtr &input)
180 {
181  return readU32(input.get());
182 }
183 
184 inline int8_t read8(RVNGInputStreamPtr &input)
185 {
186  return read8(input.get());
187 }
188 inline int16_t read16(RVNGInputStreamPtr &input)
189 {
190  return read16(input.get());
191 }
192 inline int32_t read32(RVNGInputStreamPtr &input)
193 {
194  return read32(input.get());
195 }
196 
198 bool readDouble4(RVNGInputStreamPtr &input, double &res, bool &isNaN);
200 bool readDouble8(RVNGInputStreamPtr &input, double &res, bool &isNaN);
202 bool readDouble10(RVNGInputStreamPtr &input, double &res, bool &isNaN);
204 bool readDouble2Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN);
206 bool readDouble4Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN);
207 
209 bool readData(RVNGInputStreamPtr &input, unsigned long sz, librevenge::RVNGBinaryData &data);
211 bool readDataToEnd(RVNGInputStreamPtr &input, librevenge::RVNGBinaryData &data);
213 void appendUnicode(uint32_t val, librevenge::RVNGString &buffer);
214 }
215 
216 #define WPS_LE_GET_GUINT16(p) \
217  (uint16_t)((((uint8_t const *)(p))[0] << 0) | \
218  (((uint8_t const *)(p))[1] << 8))
219 #define WPS_LE_GET_GUINT32(p) \
220  (uint32_t)((((uint8_t const *)(p))[0] << 0) | \
221  (((uint8_t const *)(p))[1] << 8) | \
222  (((uint8_t const *)(p))[2] << 16) | \
223  (((uint8_t const *)(p))[3] << 24))
224 
225 #define WPS_LE_PUT_GUINT16(p, v) \
226  *((uint8_t*)(p)) = uint8_t(v); \
227  *(((uint8_t*)(p)) + 1) = uint8_t((v) >> 8)
228 
229 #define WPS_LE_PUT_GUINT32(p, v) \
230  *((uint8_t*)(p)) = uint8_t(v); \
231  *(((uint8_t*)(p)) + 1) = uint8_t((v) >> 8); \
232  *(((uint8_t*)(p)) + 2) = uint8_t((v) >> 16); \
233  *(((uint8_t*)(p)) + 3) = uint8_t((v) >> 24)
234 
235 // Various helper structures for the parser..
236 /* ---------- small enum/class ------------- */
237 namespace libwps
238 {
240 std::string numberingTypeToString(NumberingType type);
244  };
245 enum { NoBreakBit = 0x1, NoBreakWithNextBit=0x2};
246 }
247 
249 {
250  WPSColumnDefinition() : m_width(0), m_leftGutter(0), m_rightGutter(0)
251  {
252  }
253  double m_width;
254  double m_leftGutter;
256 };
257 
259 {
260  WPSColumnProperties() : m_attributes(0), m_alignment(0)
261  {
262  }
263  uint32_t m_attributes;
264  uint8_t m_alignment;
265 };
266 
268 struct WPSColor
269 {
271  explicit WPSColor(uint32_t argb=0) : m_value(argb)
272  {
273  }
275  WPSColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) :
276  m_value(uint32_t((a<<24)+(r<<16)+(g<<8)+b))
277  {
278  }
280  WPSColor &operator=(uint32_t argb)
281  {
282  m_value = argb;
283  return *this;
284  }
286  static WPSColor black()
287  {
288  return WPSColor(0,0,0);
289  }
291  static WPSColor white()
292  {
293  return WPSColor(255,255,255);
294  }
295 
297  static WPSColor barycenter(float alpha, WPSColor const &colA,
298  float beta, WPSColor const &colB);
300  uint32_t value() const
301  {
302  return m_value;
303  }
305  unsigned char getAlpha() const
306  {
307  return (unsigned char)((m_value>>24)&0xFF);
308  }
310  unsigned char getBlue() const
311  {
312  return (unsigned char)(m_value&0xFF);
313  }
315  unsigned char getRed() const
316  {
317  return (unsigned char)((m_value>>16)&0xFF);
318  }
320  unsigned char getGreen() const
321  {
322  return (unsigned char)((m_value>>8)&0xFF);
323  }
325  bool isBlack() const
326  {
327  return (m_value&0xFFFFFF)==0;
328  }
330  bool isWhite() const
331  {
332  return (m_value&0xFFFFFF)==0xFFFFFF;
333  }
335  bool operator==(WPSColor const &c) const
336  {
337  return (c.m_value&0xFFFFFF)==(m_value&0xFFFFFF);
338  }
340  bool operator!=(WPSColor const &c) const
341  {
342  return !operator==(c);
343  }
345  bool operator<(WPSColor const &c) const
346  {
347  return (c.m_value&0xFFFFFF)<(m_value&0xFFFFFF);
348  }
350  bool operator<=(WPSColor const &c) const
351  {
352  return (c.m_value&0xFFFFFF)<=(m_value&0xFFFFFF);
353  }
355  bool operator>(WPSColor const &c) const
356  {
357  return !operator<=(c);
358  }
360  bool operator>=(WPSColor const &c) const
361  {
362  return !operator<(c);
363  }
365  friend std::ostream &operator<< (std::ostream &o, WPSColor const &c);
367  std::string str() const;
368 protected:
370  uint32_t m_value;
371 };
372 
374 struct WPSBorder
375 {
377  enum Style { None, Simple, Dot, LargeDot, Dash };
379  enum Type { Single, Double, Triple };
380  enum Pos { Left = 0, Right = 1, Top = 2, Bottom = 3 };
381  enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08 };
382 
384  WPSBorder() : m_style(Simple), m_type(Single), m_width(1), m_widthsList(), m_color(WPSColor::black()), m_extra("") { }
388  bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const;
390  bool isEmpty() const
391  {
392  return m_style==None || m_width <= 0;
393  }
394 
396  bool operator==(WPSBorder const &orig) const
397  {
398  return m_style == orig.m_style && m_type == orig.m_type && m_width == orig.m_width
399  && m_color == orig.m_color;
400  }
402  bool operator!=(WPSBorder const &orig) const
403  {
404  return !operator==(orig);
405  }
407  int compare(WPSBorder const &orig) const;
408 
410  friend std::ostream &operator<< (std::ostream &o, WPSBorder const &border);
412  friend std::ostream &operator<< (std::ostream &o, WPSBorder::Style const &style);
418  int m_width;
422  std::vector<double> m_widthsList;
426  std::string m_extra;
427 };
428 
434 {
436  WPSEmbeddedObject() : m_dataList(), m_typeList()
437  {
438  }
440  WPSEmbeddedObject(librevenge::RVNGBinaryData const &binaryData,
441  std::string type="image/pict") : m_dataList(), m_typeList()
442  {
443  add(binaryData, type);
444  }
447  {
448  }
450  bool isEmpty() const
451  {
452  for (size_t i=0; i<m_dataList.size(); ++i)
453  {
454  if (!m_dataList[i].empty())
455  return false;
456  }
457  return true;
458  }
460  void add(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
461  {
462  size_t pos=m_dataList.size();
463  if (pos<m_typeList.size()) pos=m_typeList.size();
464  m_dataList.resize(pos+1);
465  m_dataList[pos]=binaryData;
466  m_typeList.resize(pos+1);
467  m_typeList[pos]=type;
468  }
470  bool addTo(librevenge::RVNGPropertyList &propList) const;
472  friend std::ostream &operator<<(std::ostream &o, WPSEmbeddedObject const &pict);
473 
475  std::vector<librevenge::RVNGBinaryData> m_dataList;
477  std::vector<std::string> m_typeList;
478 };
479 
481 struct WPSField
482 {
484  enum Type { None, Database, Date, Link, PageCount, PageNumber, PageNumberNext, Time, Title };
485 
487  explicit WPSField(Type type) : m_type(type), m_DTFormat(""), m_numberingType(libwps::ARABIC), m_data("")
488  {
489  }
491  bool addTo(librevenge::RVNGPropertyList &propList) const;
493  librevenge::RVNGString getString() const;
497  std::string m_DTFormat;
501  std::string m_data;
502 };
503 
504 // ATTRIBUTE bits
505 #define WPS_EXTRA_LARGE_BIT 1
506 #define WPS_VERY_LARGE_BIT 2
507 #define WPS_LARGE_BIT 4
508 #define WPS_SMALL_PRINT_BIT 8
509 #define WPS_FINE_PRINT_BIT 0x10
510 #define WPS_SUPERSCRIPT_BIT 0x20
511 #define WPS_SUBSCRIPT_BIT 0x40
512 #define WPS_OUTLINE_BIT 0x80
513 #define WPS_ITALICS_BIT 0x100
514 #define WPS_SHADOW_BIT 0x200
515 #define WPS_REDLINE_BIT 0x400
516 #define WPS_DOUBLE_UNDERLINE_BIT 0x800
517 #define WPS_BOLD_BIT 0x1000
518 #define WPS_STRIKEOUT_BIT 0x2000
519 #define WPS_UNDERLINE_BIT 0x4000
520 #define WPS_SMALL_CAPS_BIT 0x8000
521 #define WPS_BLINK_BIT 0x10000L
522 #define WPS_REVERSEVIDEO_BIT 0x20000L
523 #define WPS_ALL_CAPS_BIT 0x40000L
524 #define WPS_EMBOSS_BIT 0x80000L
525 #define WPS_ENGRAVE_BIT 0x100000L
526 #define WPS_OVERLINE_BIT 0x400000L
527 #define WPS_HIDDEN_BIT 0x800000L
528 
529 // BREAK bits
530 #define WPS_PAGE_BREAK 0x00
531 #define WPS_SOFT_PAGE_BREAK 0x01
532 #define WPS_COLUMN_BREAK 0x02
533 
534 // Generic bits
535 #define WPS_LEFT 0x00
536 #define WPS_RIGHT 0x01
537 #define WPS_CENTER 0x02
538 #define WPS_TOP 0x03
539 #define WPS_BOTTOM 0x04
540 
541 /* ---------- vec2/box2f ------------- */
545 template <class T> class Vec2
546 {
547 public:
549  Vec2(T xx=0,T yy=0) : m_x(xx), m_y(yy) { }
551  template <class U> Vec2(Vec2<U> const &p) : m_x(T(p.x())), m_y(T(p.y())) {}
552 
554  T x() const
555  {
556  return m_x;
557  }
559  T y() const
560  {
561  return m_y;
562  }
564  T operator[](int c) const
565  {
566  if (c<0 || c>1) throw libwps::GenericException();
567  return (c==0) ? m_x : m_y;
568  }
570  T &operator[](int c)
571  {
572  if (c<0 || c>1) throw libwps::GenericException();
573  return (c==0) ? m_x : m_y;
574  }
575 
577  void set(T xx, T yy)
578  {
579  m_x = xx;
580  m_y = yy;
581  }
583  void setX(T xx)
584  {
585  m_x = xx;
586  }
588  void setY(T yy)
589  {
590  m_y = yy;
591  }
592 
594  void add(T dx, T dy)
595  {
596  m_x += dx;
597  m_y += dy;
598  }
599 
602  {
603  m_x += p.m_x;
604  m_y += p.m_y;
605  return *this;
606  }
609  {
610  m_x -= p.m_x;
611  m_y -= p.m_y;
612  return *this;
613  }
615  template <class U>
616  Vec2<T> &operator*=(U scale)
617  {
618  m_x = T(m_x*scale);
619  m_y = T(m_y*scale);
620  return *this;
621  }
622 
624  friend Vec2<T> operator+(Vec2<T> const &p1, Vec2<T> const &p2)
625  {
626  Vec2<T> p(p1);
627  return p+=p2;
628  }
630  friend Vec2<T> operator-(Vec2<T> const &p1, Vec2<T> const &p2)
631  {
632  Vec2<T> p(p1);
633  return p-=p2;
634  }
636  template <class U>
637  friend Vec2<T> operator*(U scale, Vec2<T> const &p1)
638  {
639  Vec2<T> p(p1);
640  return p *= scale;
641  }
642 
644  bool operator==(Vec2<T> const &p) const
645  {
646  return cmpY(p) == 0;
647  }
649  bool operator!=(Vec2<T> const &p) const
650  {
651  return cmpY(p) != 0;
652  }
654  bool operator<(Vec2<T> const &p) const
655  {
656  return cmpY(p) < 0;
657  }
659  int cmp(Vec2<T> const &p) const
660  {
661  if (m_x<p.m_x) return -1;
662  if (m_x>p.m_x) return 1;
663  if (m_y<p.m_y) return -1;
664  if (m_y>p.m_y) return 1;
665  return 0;
666  }
668  int cmpY(Vec2<T> const &p) const
669  {
670  if (m_y<p.m_y) return -1;
671  if (m_y>p.m_y) return 1;
672  if (m_x<p.m_x) return -1;
673  if (m_x>p.m_x) return 1;
674  return 0;
675  }
676 
678  friend std::ostream &operator<< (std::ostream &o, Vec2<T> const &f)
679  {
680  o << f.m_x << "x" << f.m_y;
681  return o;
682  }
683 
687  struct PosSizeLtX
688  {
690  bool operator()(Vec2<T> const &s1, Vec2<T> const &s2) const
691  {
692  return s1.cmp(s2) < 0;
693  }
694  };
695 
699  struct PosSizeLtY
700  {
702  bool operator()(Vec2<T> const &s1, Vec2<T> const &s2) const
703  {
704  return s1.cmpY(s2) < 0;
705  }
706  };
707 protected:
708  T m_x, m_y;
709 };
710 
714 typedef Vec2<int> Vec2i;
717 
721 template <class T> class WPSBox2
722 {
723 public:
726  {
727  m_pt[0] = minPt;
728  m_pt[1] = maxPt;
729  }
731  template <class U> WPSBox2(WPSBox2<U> const &p)
732  {
733  for (int c=0; c < 2; c++) m_pt[c] = p[c];
734  }
735 
737  Vec2<T> const &min() const
738  {
739  return m_pt[0];
740  }
742  Vec2<T> const &max() const
743  {
744  return m_pt[1];
745  }
748  {
749  return m_pt[0];
750  }
753  {
754  return m_pt[1];
755  }
756 
760  Vec2<T> const &operator[](int c) const
761  {
762  if (c<0 || c>1) throw libwps::GenericException();
763  return m_pt[c];
764  }
766  Vec2<T> size() const
767  {
768  return m_pt[1]-m_pt[0];
769  }
771  Vec2<T> center() const
772  {
773  return 0.5*(m_pt[0]+m_pt[1]);
774  }
775 
777  void set(Vec2<T> const &x, Vec2<T> const &y)
778  {
779  m_pt[0] = x;
780  m_pt[1] = y;
781  }
783  void setMin(Vec2<T> const &x)
784  {
785  m_pt[0] = x;
786  }
788  void setMax(Vec2<T> const &y)
789  {
790  m_pt[1] = y;
791  }
792 
794  void resizeFromMin(Vec2<T> const &sz)
795  {
796  m_pt[1] = m_pt[0]+sz;
797  }
799  void resizeFromMax(Vec2<T> const &sz)
800  {
801  m_pt[0] = m_pt[1]-sz;
802  }
804  void resizeFromCenter(Vec2<T> const &sz)
805  {
806  Vec2<T> ctr = 0.5*(m_pt[0]+m_pt[1]);
807  m_pt[0] = ctr - 0.5*sz;
808  m_pt[1] = ctr + (sz - 0.5*sz);
809  }
810 
812  template <class U> void scale(U factor)
813  {
814  m_pt[0] *= factor;
815  m_pt[1] *= factor;
816  }
817 
819  void extend(T val)
820  {
821  m_pt[0] -= Vec2<T>(val/2,val/2);
822  m_pt[1] += Vec2<T>(val-(val/2),val-(val/2));
823  }
825  WPSBox2<T> getUnion(WPSBox2<T> const &box) const
826  {
827  WPSBox2<T> res;
828  res.m_pt[0]=Vec2<T>(m_pt[0][0]<box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
829  m_pt[0][1]<box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
830  res.m_pt[1]=Vec2<T>(m_pt[1][0]>box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
831  m_pt[1][1]>box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
832  return res;
833  }
836  {
837  WPSBox2<T> res;
838  res.m_pt[0]=Vec2<T>(m_pt[0][0]>box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
839  m_pt[0][1]>box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
840  res.m_pt[1]=Vec2<T>(m_pt[1][0]<box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
841  m_pt[1][1]<box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
842  return res;
843  }
844 
846  bool operator==(WPSBox2<T> const &p) const
847  {
848  return cmp(p) == 0;
849  }
851  bool operator!=(WPSBox2<T> const &p) const
852  {
853  return cmp(p) != 0;
854  }
856  bool operator<(WPSBox2<T> const &p) const
857  {
858  return cmp(p) < 0;
859  }
860 
862  int cmp(WPSBox2<T> const &p) const
863  {
864  int diff = m_pt[0].cmpY(p.m_pt[0]);
865  if (diff) return diff;
866  diff = m_pt[1].cmpY(p.m_pt[1]);
867  if (diff) return diff;
868  return 0;
869  }
870 
872  friend std::ostream &operator<< (std::ostream &o, WPSBox2<T> const &f)
873  {
874  o << "(" << f.m_pt[0] << "<->" << f.m_pt[1] << ")";
875  return o;
876  }
877 
881  struct PosSizeLt
882  {
884  bool operator()(WPSBox2<T> const &s1, WPSBox2<T> const &s2) const
885  {
886  return s1.cmp(s2) < 0;
887  }
888  };
892  typedef std::map<WPSBox2<T>, T,struct PosSizeLt> Map;
893 
894 protected:
896  Vec2<T> m_pt[2];
897 };
898 
903 
907 template <class T> class WPSVec3
908 {
909 public:
911  explicit WPSVec3(T xx=0,T yy=0,T zz=0)
912  {
913  m_val[0] = xx;
914  m_val[1] = yy;
915  m_val[2] = zz;
916  }
918  template <class U> WPSVec3(WPSVec3<U> const &p)
919  {
920  for (int c = 0; c < 3; c++) m_val[c] = T(p[c]);
921  }
922 
924  T x() const
925  {
926  return m_val[0];
927  }
929  T y() const
930  {
931  return m_val[1];
932  }
934  T z() const
935  {
936  return m_val[2];
937  }
939  T operator[](int c) const
940  {
941  if (c<0 || c>2) throw libwps::GenericException();
942  return m_val[c];
943  }
945  T &operator[](int c)
946  {
947  if (c<0 || c>2) throw libwps::GenericException();
948  return m_val[c];
949  }
950 
952  void set(T xx, T yy, T zz)
953  {
954  m_val[0] = xx;
955  m_val[1] = yy;
956  m_val[2] = zz;
957  }
959  void setX(T xx)
960  {
961  m_val[0] = xx;
962  }
964  void setY(T yy)
965  {
966  m_val[1] = yy;
967  }
969  void setZ(T zz)
970  {
971  m_val[2] = zz;
972  }
973 
975  void add(T dx, T dy, T dz)
976  {
977  m_val[0] += dx;
978  m_val[1] += dy;
979  m_val[2] += dz;
980  }
981 
984  {
985  for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]);
986  return *this;
987  }
990  {
991  for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]-p.m_val[c]);
992  return *this;
993  }
995  template <class U>
997  {
998  for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]*scale);
999  return *this;
1000  }
1001 
1003  friend WPSVec3<T> operator+(WPSVec3<T> const &p1, WPSVec3<T> const &p2)
1004  {
1005  WPSVec3<T> p(p1);
1006  return p+=p2;
1007  }
1009  friend WPSVec3<T> operator-(WPSVec3<T> const &p1, WPSVec3<T> const &p2)
1010  {
1011  WPSVec3<T> p(p1);
1012  return p-=p2;
1013  }
1015  template <class U>
1016  friend WPSVec3<T> operator*(U scale, WPSVec3<T> const &p1)
1017  {
1018  WPSVec3<T> p(p1);
1019  return p *= scale;
1020  }
1021 
1023  bool operator==(WPSVec3<T> const &p) const
1024  {
1025  return cmp(p) == 0;
1026  }
1028  bool operator!=(WPSVec3<T> const &p) const
1029  {
1030  return cmp(p) != 0;
1031  }
1033  bool operator<(WPSVec3<T> const &p) const
1034  {
1035  return cmp(p) < 0;
1036  }
1038  int cmp(WPSVec3<T> const &p) const
1039  {
1040  for (int c = 0; c < 3; c++)
1041  {
1042  if (m_val[c]<p.m_val[c]) return -1;
1043  if (m_val[c]>p.m_val[c]) return 1;
1044  }
1045  return 0;
1046  }
1047 
1049  friend std::ostream &operator<< (std::ostream &o, WPSVec3<T> const &f)
1050  {
1051  o << f.m_val[0] << "x" << f.m_val[1] << "x" << f.m_val[2];
1052  return o;
1053  }
1054 
1058  struct PosSizeLt
1059  {
1061  bool operator()(WPSVec3<T> const &s1, WPSVec3<T> const &s2) const
1062  {
1063  return s1.cmp(s2) < 0;
1064  }
1065  };
1069  typedef std::map<WPSVec3<T>, T,struct PosSizeLt> Map;
1070 
1071 protected:
1073  T m_val[3];
1074 };
1075 
1082 
1085 {
1086 public:
1088  explicit WPSTransformation(WPSVec3f const &xRow=WPSVec3f(1,0,0), WPSVec3f const &yRow=WPSVec3f(0,1,0)) : m_data(xRow, yRow), m_isIdentity(false)
1089  {
1090  checkIdentity();
1091  }
1093  bool isIdentity() const
1094  {
1095  return m_isIdentity;
1096  }
1098  void checkIdentity() const
1099  {
1100  m_isIdentity= m_data.first==WPSVec3f(1,0,0) && m_data.second==WPSVec3f(0,1,0);
1101  }
1105  WPSVec3f const &operator[](int c) const
1106  {
1107  if (c<0 || c>1) throw libwps::GenericException();
1108  return c==0 ? m_data.first : m_data.second;
1109  }
1111  Vec2f operator*(Vec2f const &pt) const
1112  {
1113  if (m_isIdentity) return pt;
1114  return multiplyDirection(pt)+Vec2f(m_data.first[2],m_data.second[2]);
1115  }
1117  Vec2f multiplyDirection(Vec2f const &dir) const
1118  {
1119  if (m_isIdentity) return dir;
1120  Vec2f res;
1121  for (int coord=0; coord<2; ++coord)
1122  {
1123  WPSVec3f const &row=coord==0 ? m_data.first : m_data.second;
1124  float value=0;
1125  for (int i=0; i<2; ++i)
1126  value+=row[i]*dir[i];
1127  res[coord]=value;
1128  }
1129  return res;
1130  }
1132  WPSBox2f operator*(WPSBox2f const &box) const
1133  {
1134  if (m_isIdentity) return box;
1135  return WPSBox2f(operator*(box.min()), operator*(box.max()));
1136  }
1139  {
1140  if (mat.m_isIdentity) return *this;
1141  WPSTransformation res;
1142  for (int row=0; row<2; ++row)
1143  {
1144  WPSVec3f &resRow=row==0 ? res.m_data.first : res.m_data.second;
1145  for (int col=0; col<3; ++col)
1146  {
1147  float value=0;
1148  for (int i=0; i<3; ++i)
1149  value+=(*this)[row][i]*(i==2 ? (col==2 ? 1.f : 0.f) : mat[i][col]);
1150  resRow[col]=value;
1151  }
1152  }
1153  res.checkIdentity();
1154  return res;
1155  }
1158  {
1159  if (!mat.m_isIdentity)
1160  *this=(*this)*mat;
1161  return *this;
1162  }
1164  bool operator==(WPSTransformation const &mat) const
1165  {
1166  return m_data==mat.m_data;
1167  }
1169  bool operator!=(WPSTransformation const &mat) const
1170  {
1171  return m_data!=mat.m_data;
1172  }
1174  bool operator<(WPSTransformation const &mat) const
1175  {
1176  return m_data<mat.m_data;
1177  }
1179  bool operator<=(WPSTransformation const &mat) const
1180  {
1181  return m_data<=mat.m_data;
1182  }
1184  bool operator>(WPSTransformation const &mat) const
1185  {
1186  return m_data>mat.m_data;
1187  }
1189  bool operator>=(WPSTransformation const &mat) const
1190  {
1191  return m_data>=mat.m_data;
1192  }
1196  bool decompose(float &rotation, Vec2f &shearing, WPSTransformation &transform, Vec2f const &center) const;
1197 
1199  static WPSTransformation translation(Vec2f const &trans)
1200  {
1201  return WPSTransformation(WPSVec3f(1, 0, trans[0]), WPSVec3f(0, 1, trans[1]));
1202  }
1204  static WPSTransformation scale(Vec2f const &trans)
1205  {
1206  return WPSTransformation(WPSVec3f(trans[0], 0, 0), WPSVec3f(0, trans[1], 0));
1207  }
1211  static WPSTransformation rotation(float angle, Vec2f const &center=Vec2f(0,0));
1215  static WPSTransformation shear(Vec2f s, Vec2f const &center=Vec2f(0,0))
1216  {
1217  return WPSTransformation(WPSVec3f(1, s[0], -s[0]*center[1]), WPSVec3f(s[1], 1, -s[1]*center[0]));
1218  }
1219 protected:
1221  std::pair<WPSVec3f, WPSVec3f > m_data;
1223  mutable bool m_isIdentity;
1224 };
1225 #endif /* LIBWPS_INTERNAL_H */
1226 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
bool operator!=(Vec2< T > const &p) const
comparison!=
Definition: libwps_internal.h:649
std::string m_data
the database/link field ( if defined )
Definition: libwps_internal.h:501
int cmpY(Vec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libwps_internal.h:668
bool isEmpty() const
return true if the picture contains no data
Definition: libwps_internal.h:450
Definition: libwps_internal.h:239
void resizeFromCenter(Vec2< T > const &sz)
resize the box keeping the center
Definition: libwps_internal.h:804
void scale(U factor)
scales all points of the box by factor
Definition: libwps_internal.h:812
shared_ptr< WPSContentListener > WPSContentListenerPtr
shared pointer to WPSContentListener
Definition: libwps_internal.h:108
WPSTransformation(WPSVec3f const &xRow=WPSVec3f(1, 0, 0), WPSVec3f const &yRow=WPSVec3f(0, 1, 0))
constructor
Definition: libwps_internal.h:1088
Vec2< float > Vec2f
Vec2 of float.
Definition: libwps_internal.h:716
int16_t read16(RVNGInputStreamPtr &input)
Definition: libwps_internal.h:188
Vec2f multiplyDirection(Vec2f const &dir) const
operator* for direction
Definition: libwps_internal.h:1117
WPSColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition: libwps_internal.h:275
void setY(T yy)
resets the second element
Definition: libwps_internal.h:588
a border list
Definition: libwps_internal.h:374
T m_val[3]
the values
Definition: libwps_internal.h:1073
Definition: libwps_internal.h:258
Definition: libwps_internal.h:154
T m_x
first element
Definition: libwps_internal.h:708
bool m_isIdentity
flag to know if this matrix is an identity matrix
Definition: libwps_internal.h:1223
libwps::NumberingType m_numberingType
the number type ( for number field )
Definition: libwps_internal.h:499
Definition: libwps_internal.cpp:38
WPSVec3< T > & operator*=(U scale)
generic operator*=
Definition: libwps_internal.h:996
Vec2< T > size() const
the box size
Definition: libwps_internal.h:766
uint8_t readU8(RVNGInputStreamPtr &input)
Definition: libwps_internal.h:171
shared_ptr< WPSSubDocument > WPSSubDocumentPtr
shared pointer to WPSSubDocument
Definition: libwps_internal.h:112
bool operator<=(WPSTransformation const &mat) const
operator<=
Definition: libwps_internal.h:1179
WPSBox2< T > getIntersection(WPSBox2< T > const &box) const
returns the intersection between this and box
Definition: libwps_internal.h:835
int8_t read8(RVNGInputStreamPtr &input)
Definition: libwps_internal.h:184
bool operator()(Vec2< T > const &s1, Vec2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:702
unsigned char getGreen() const
returns the green value
Definition: libwps_internal.h:320
WPSBox2f operator*(WPSBox2f const &box) const
operator* for box2f
Definition: libwps_internal.h:1132
friend Vec2< T > operator-(Vec2< T > const &p1, Vec2< T > const &p2)
operator-
Definition: libwps_internal.h:630
WPSBox2(Vec2< T > minPt=Vec2< T >(), Vec2< T > maxPt=Vec2< T >())
constructor
Definition: libwps_internal.h:725
int cmp(WPSBox2< T > const &p) const
comparison function : fist sorts min by Y,X values then max extremity
Definition: libwps_internal.h:862
uint32_t value() const
return the rgba value
Definition: libwps_internal.h:300
bool operator==(WPSBorder const &orig) const
operator==
Definition: libwps_internal.h:396
WPSEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
constructor
Definition: libwps_internal.h:440
T & operator[](int c)
operator[]
Definition: libwps_internal.h:570
bool operator()(Vec2< T > const &s1, Vec2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:690
uint16_t readU16(RVNGInputStreamPtr &input)
Definition: libwps_internal.h:175
define the font properties
Definition: WPSFont.h:36
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition: libwps_internal.h:477
WPSVec3< T > & operator+=(WPSVec3< T > const &p)
operator+=
Definition: libwps_internal.h:983
WPSBox2< int > WPSBox2i
WPSBox2 of int.
Definition: libwps_internal.h:900
double m_leftGutter
Definition: libwps_internal.h:254
a field
Definition: libwps_internal.h:481
#define WPS_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libwps_internal.h:122
T x() const
first element
Definition: libwps_internal.h:924
virtual class for content listener
Definition: WPSListener.h:36
internal struct used to create sorted map, sorted by X
Definition: libwps_internal.h:687
Type m_type
the type
Definition: libwps_internal.h:495
static WPSColor black()
return the back color
Definition: libwps_internal.h:286
int m_width
the border width
Definition: libwps_internal.h:418
Vec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition: libwps_internal.h:742
static WPSColor white()
return the white color
Definition: libwps_internal.h:291
Definition: libwps_internal.h:241
WPSEmbeddedObject()
empty constructor
Definition: libwps_internal.h:436
void setX(T xx)
resets the first element
Definition: libwps_internal.h:959
Vec2< T > & operator+=(Vec2< T > const &p)
operator+=
Definition: libwps_internal.h:601
Definition: libwps_internal.h:239
Definition: libwps_internal.h:239
Definition: libwps_internal.h:241
Definition: WPSContentListener.h:44
WPSColor & operator=(uint32_t argb)
operator=
Definition: libwps_internal.h:280
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
T operator[](int c) const
operator[]
Definition: libwps_internal.h:939
void checkIdentity() const
check if a matrix is the identity matrix
Definition: libwps_internal.h:1098
bool operator>(WPSTransformation const &mat) const
operator>
Definition: libwps_internal.h:1184
bool isWhite() const
return true if the color is white
Definition: libwps_internal.h:330
uint32_t m_attributes
Definition: libwps_internal.h:263
Definition: libwps_internal.h:241
bool operator>=(WPSTransformation const &mat) const
operator>=
Definition: libwps_internal.h:1189
WPSVec3f const & operator[](int c) const
the two extremum points which defined the box
Definition: libwps_internal.h:1105
WPSBox2< float > WPSBox2f
WPSBox2 of float.
Definition: libwps_internal.h:902
void add(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
add a picture
Definition: libwps_internal.h:460
Type
Defines some basic type for field.
Definition: libwps_internal.h:484
a structure used to defined the cell position, and a format
Definition: WPSCell.h:251
internal struct used to create sorted map, sorted first min then max
Definition: libwps_internal.h:881
double m_width
Definition: libwps_internal.h:253
Justification
Definition: libwps_internal.h:242
T operator[](int c) const
operator[]
Definition: libwps_internal.h:564
bool operator!=(WPSBox2< T > const &p) const
comparison operator!=
Definition: libwps_internal.h:851
double m_rightGutter
Definition: libwps_internal.h:255
internal struct used to create sorted map, sorted by X, Y, Z
Definition: libwps_internal.h:1058
std::map< WPSBox2< int >, int, struct PosSizeLt > Map
map of WPSBox2
Definition: libwps_internal.h:892
virtual class to define a sub document
Definition: WPSSubDocument.h:33
bool operator!=(WPSBorder const &orig) const
operator!=
Definition: libwps_internal.h:402
static WPSTransformation scale(Vec2f const &trans)
returns a scaling transformation
Definition: libwps_internal.h:1204
WPSField(Type type)
basic constructor
Definition: libwps_internal.h:487
Definition: libwps_internal.h:239
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
bool isEmpty() const
returns true if the border is empty
Definition: libwps_internal.h:390
T y() const
second element
Definition: libwps_internal.h:559
bool operator==(WPSColor const &c) const
operator==
Definition: libwps_internal.h:335
shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:110
Definition: libwps_internal.h:241
void setMax(Vec2< T > const &y)
resets the maximum point
Definition: libwps_internal.h:788
Vec2(T xx=0, T yy=0)
constructor
Definition: libwps_internal.h:549
Definition: libwps_internal.h:245
uint32_t readU32(RVNGInputStreamPtr &input)
Definition: libwps_internal.h:179
shared_ptr< WPSListener > WPSListenerPtr
shared pointer to WPSListener
Definition: libwps_internal.h:106
void setX(T xx)
resets the first element
Definition: libwps_internal.h:583
WPSBorder()
constructor
Definition: libwps_internal.h:384
bool operator<(WPSColor const &c) const
operator<
Definition: libwps_internal.h:345
Definition: libwps_internal.h:245
std::pair< WPSVec3f, WPSVec3f > m_data
the data
Definition: libwps_internal.h:1221
bool isBlack() const
return true if the color is black
Definition: libwps_internal.h:325
SubDocumentType
Definition: libwps_internal.h:241
Definition: libwps_internal.h:239
unsigned char getAlpha() const
returns the alpha value
Definition: libwps_internal.h:305
bool operator!=(WPSTransformation const &mat) const
operator!=
Definition: libwps_internal.h:1169
Definition: libwps_internal.h:242
Definition: libwps_internal.h:241
static WPSTransformation shear(Vec2f s, Vec2f const &center=Vec2f(0, 0))
returns a shear transformation letting center invariant, ie.
Definition: libwps_internal.h:1215
Definition: libwps_internal.h:149
Vec2< T > center() const
the box center
Definition: libwps_internal.h:771
WPSBox2(WPSBox2< U > const &p)
generic constructor
Definition: libwps_internal.h:731
bool operator==(Vec2< T > const &p) const
comparison==
Definition: libwps_internal.h:644
std::vector< double > m_widthsList
the different length used for each line/sep (if defined)
Definition: libwps_internal.h:422
Basic class used to store a spreadsheet sub document.
Definition: WKSSubDocument.h:35
void setZ(T zz)
resets the third element
Definition: libwps_internal.h:969
Definition: libwps_internal.h:243
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer)
adds an unicode character to a string ( with correct encoding ).
Definition: libwps_internal.cpp:718
Vec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libwps_internal.h:747
shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:115
Definition: WPSHeader.h:31
small class which defines a 2D WPSBox
Definition: libwps_internal.h:721
Definition: libwps_internal.h:241
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition: libwps_internal.h:975
Definition: libwps_internal.h:139
friend WPSVec3< T > operator*(U scale, WPSVec3< T > const &p1)
generic operator*
Definition: libwps_internal.h:1016
uint32_t m_value
the argb color
Definition: libwps_internal.h:370
internal struct used to create sorted map, sorted by Y
Definition: libwps_internal.h:699
WPSVec3< T > & operator-=(WPSVec3< T > const &p)
operator-=
Definition: libwps_internal.h:989
int cmp(Vec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libwps_internal.h:659
void operator()(T *)
Definition: libwps_internal.h:83
bool operator!=(WPSVec3< T > const &p) const
comparison!=
Definition: libwps_internal.h:1028
WPSVec3< unsigned char > WPSVec3uc
WPSVec3 of unsigned char.
Definition: libwps_internal.h:1077
Type
the line repetition
Definition: libwps_internal.h:379
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition: libwps_internal.h:819
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition: libwps_internal.h:594
bool operator<(WPSTransformation const &mat) const
operator<
Definition: libwps_internal.h:1174
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition: libwps_internal.h:475
uint8_t m_alignment
Definition: libwps_internal.h:264
Definition: libwps_internal.h:248
bool operator>(WPSColor const &c) const
operator>
Definition: libwps_internal.h:355
WPSColumnProperties()
Definition: libwps_internal.h:260
Vec2< T > & operator-=(Vec2< T > const &p)
operator-=
Definition: libwps_internal.h:608
void setMin(Vec2< T > const &x)
resets the minimum point
Definition: libwps_internal.h:783
WPSColor m_color
the border color
Definition: libwps_internal.h:424
Vec2< T > & operator*=(U scale)
generic operator*=
Definition: libwps_internal.h:616
bool operator!=(WPSColor const &c) const
operator!=
Definition: libwps_internal.h:340
NumberingType
Definition: libwps_internal.h:239
bool isIdentity() const
returns true if the matrix is an identity matrix
Definition: libwps_internal.h:1093
int32_t read32(RVNGInputStreamPtr &input)
Definition: libwps_internal.h:192
T y() const
second element
Definition: libwps_internal.h:929
unsigned char getBlue() const
returns the green value
Definition: libwps_internal.h:310
void resizeFromMin(Vec2< T > const &sz)
resize the box keeping the minimum
Definition: libwps_internal.h:794
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:88
bool operator<=(WPSColor const &c) const
operator<=
Definition: libwps_internal.h:350
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
Vec2< int > Vec2i
Vec2 of int.
Definition: libwps_internal.h:714
the class to store a color
Definition: libwps_internal.h:268
virtual ~WPSEmbeddedObject()
destructor
Definition: libwps_internal.h:446
bool operator==(WPSVec3< T > const &p) const
comparison==
Definition: libwps_internal.h:1023
Pos
Definition: libwps_internal.h:380
T z() const
third element
Definition: libwps_internal.h:934
Definition: libwps_internal.h:243
Vec2(Vec2< U > const &p)
generic copy constructor
Definition: libwps_internal.h:551
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
bool operator==(WPSTransformation const &mat) const
operator==
Definition: libwps_internal.h:1164
static WPSTransformation translation(Vec2f const &trans)
returns a translation transformation
Definition: libwps_internal.h:1199
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
WPSVec3< int > WPSVec3i
WPSVec3 of int.
Definition: libwps_internal.h:1079
std::string numberingTypeToString(NumberingType type)
Definition: libwps_internal.cpp:357
bool operator()(WPSVec3< T > const &s1, WPSVec3< T > const &s2) const
comparaison function
Definition: libwps_internal.h:1061
WPSVec3(T xx=0, T yy=0, T zz=0)
constructor
Definition: libwps_internal.h:911
Style
the line style
Definition: libwps_internal.h:377
WPSTransformation & operator*=(WPSTransformation const &mat)
operator*=
Definition: libwps_internal.h:1157
WPSBox2< T > getUnion(WPSBox2< T > const &box) const
returns the union between this and box
Definition: libwps_internal.h:825
small class use to define a embedded object
Definition: libwps_internal.h:433
Vec2f operator*(Vec2f const &pt) const
operator* for vec2f
Definition: libwps_internal.h:1111
unsigned char getRed() const
returns the red value
Definition: libwps_internal.h:315
std::map< WPSVec3< T >, T, struct PosSizeLt > Map
map of WPSVec3
Definition: libwps_internal.h:1069
void setY(T yy)
resets the second element
Definition: libwps_internal.h:964
Definition: libwps_internal.h:144
WPSVec3(WPSVec3< U > const &p)
generic copy constructor
Definition: libwps_internal.h:918
friend WPSVec3< T > operator+(WPSVec3< T > const &p1, WPSVec3< T > const &p2)
operator+
Definition: libwps_internal.h:1003
WPSColumnDefinition()
Definition: libwps_internal.h:250
Style m_style
the border style
Definition: libwps_internal.h:414
Definition: libwps_internal.h:242
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:1038
Definition: libwps_internal.h:239
a transformation which stored the first row of a 3x3 perspective matrix
Definition: libwps_internal.h:1084
shared_ptr< WKSSubDocument > WKSSubDocumentPtr
shared pointer to WKSSubDocument
Definition: libwps_internal.h:117
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
Definition: libwps_internal.h:242
bool operator==(WPSBox2< T > const &p) const
comparison operator==
Definition: libwps_internal.h:846
void resizeFromMax(Vec2< T > const &sz)
resize the box keeping the maximum
Definition: libwps_internal.h:799
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:38
small class which defines a vector with 2 elements
Definition: libwps_internal.h:545
Definition: libwps_internal.h:239
friend Vec2< T > operator*(U scale, Vec2< T > const &p1)
generic operator*
Definition: libwps_internal.h:637
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: WPSPosition.h:39
bool operator>=(WPSColor const &c) const
operator>=
Definition: libwps_internal.h:360
WPSTransformation operator*(WPSTransformation const &mat) const
operator* for transform
Definition: libwps_internal.h:1138
std::string m_extra
extra data ( if needed)
Definition: libwps_internal.h:426
shared_ptr< WPSCell > WPSCellPtr
shared pointer to WPSCell
Definition: libwps_internal.h:101
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
small structure use to store a stream and it debug file
Definition: WPSStream.h:29
std::ostream & operator<<(std::ostream &o, WPSColor const &c)
Definition: libwps_internal.cpp:401
WPSColor(uint32_t argb=0)
constructor
Definition: libwps_internal.h:271
WPSVec3< float > WPSVec3f
WPSVec3 of float.
Definition: libwps_internal.h:1081
bool operator()(WPSBox2< T > const &s1, WPSBox2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:884
T m_y
second element
Definition: libwps_internal.h:708
a noop deleter used to transform a librevenge pointer in a false shared_ptr
Definition: libwps_internal.h:81
T & operator[](int c)
operator[]
Definition: libwps_internal.h:945
Vec2< T > m_pt[2]
the two extremities
Definition: libwps_internal.h:896
T x() const
first element
Definition: libwps_internal.h:554
Type m_type
the border repetition
Definition: libwps_internal.h:416
std::string m_DTFormat
the date/time format using strftime format if defined (see strftime)
Definition: libwps_internal.h:497
Vec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libwps_internal.h:752
Definition: WKSContentListener.h:50
small class which defines a vector with 3 elements
Definition: libwps_internal.h:907
Vec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition: libwps_internal.h:760
Vec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libwps_internal.h:737
Vec2< bool > Vec2b
Vec2 of bool.
Definition: libwps_internal.h:712
friend WPSVec3< T > operator-(WPSVec3< T > const &p1, WPSVec3< T > const &p2)
operator-
Definition: libwps_internal.h:1009
friend Vec2< T > operator+(Vec2< T > const &p1, Vec2< T > const &p2)
operator+
Definition: libwps_internal.h:624

Generated on Wed Oct 26 2016 16:54:37 for libwps by doxygen 1.8.12