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 
87 #define WPS_FALLTHROUGH
88 #if defined(__clang__)
89 # if defined(__has_cpp_attribute) && __has_cpp_attribute(clang::fallthrough)
90 # undef WPS_FALLTHROUGH
91 # define WPS_FALLTHROUGH [[clang::fallthrough]]
92 # endif
93 #elif defined(__GNUC__)
94 # if __GNUC__>=7
95 # undef WPS_FALLTHROUGH
96 # define WPS_FALLTHROUGH __attribute__ ((fallthrough))
97 # endif
98 #endif
99 
100 // basic classes and autoptr
102 typedef shared_ptr<librevenge::RVNGInputStream> RVNGInputStreamPtr;
103 
104 struct WPSStream;
105 class WPSCell;
106 class WPSListener;
107 class WPSContentListener;
108 class WPSEntry;
109 class WPSFont;
110 class WPSHeader;
111 class WPSPosition;
112 class WPSSubDocument;
113 
114 class WKSContentListener;
116 
118 typedef shared_ptr<WPSCell> WPSCellPtr;
120 typedef shared_ptr<WPSListener> WPSListenerPtr;
122 typedef shared_ptr<WPSContentListener> WPSContentListenerPtr;
124 typedef shared_ptr<WPSHeader> WPSHeaderPtr;
126 typedef shared_ptr<WPSSubDocument> WPSSubDocumentPtr;
127 
129 typedef shared_ptr<WKSContentListener> WKSContentListenerPtr;
131 typedef shared_ptr<WKSSubDocument> WKSSubDocumentPtr;
132 
133 #if defined(__clang__) || defined(__GNUC__)
134 # define WPS_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((__format__(__printf__, fmt, arg)))
135 #else
136 # define WPS_ATTRIBUTE_PRINTF(fmt, arg)
137 #endif
138 /* ---------- debug --------------- */
139 #ifdef DEBUG
140 namespace libwps
141 {
142 void printDebugMsg(const char *format, ...) WPS_ATTRIBUTE_PRINTF(1, 2);
143 }
144 #define WPS_DEBUG_MSG(M) libwps::printDebugMsg M
145 #else
146 #define WPS_DEBUG_MSG(M)
147 #endif
148 
149 /* ---------- exception ------------ */
150 namespace libwps
151 {
152 // Various exceptions
154 {
155  // needless to say, we could flesh this class out a bit
156 };
157 
159 {
160  // needless to say, we could flesh this class out a bit
161 };
162 
164 {
165  // needless to say, we could flesh this class out a bit
166 };
167 
169 {
170  // needless to say, we could flesh this class out a bit
171 };
172 
174 {
175  // needless to say, we could flesh this class out a bit
176 };
177 }
178 
179 /* ---------- input ----------------- */
180 namespace libwps
181 {
182 uint8_t readU8(librevenge::RVNGInputStream *input);
183 uint16_t readU16(librevenge::RVNGInputStream *input);
184 uint32_t readU32(librevenge::RVNGInputStream *input);
185 
186 int8_t read8(librevenge::RVNGInputStream *input);
187 int16_t read16(librevenge::RVNGInputStream *input);
188 int32_t read32(librevenge::RVNGInputStream *input);
189 
190 inline uint8_t readU8(RVNGInputStreamPtr &input)
191 {
192  return readU8(input.get());
193 }
194 inline uint16_t readU16(RVNGInputStreamPtr &input)
195 {
196  return readU16(input.get());
197 }
198 inline uint32_t readU32(RVNGInputStreamPtr &input)
199 {
200  return readU32(input.get());
201 }
202 
203 inline int8_t read8(RVNGInputStreamPtr &input)
204 {
205  return read8(input.get());
206 }
207 inline int16_t read16(RVNGInputStreamPtr &input)
208 {
209  return read16(input.get());
210 }
211 inline int32_t read32(RVNGInputStreamPtr &input)
212 {
213  return read32(input.get());
214 }
215 
217 bool readDouble4(RVNGInputStreamPtr &input, double &res, bool &isNaN);
219 bool readDouble8(RVNGInputStreamPtr &input, double &res, bool &isNaN);
221 bool readDouble10(RVNGInputStreamPtr &input, double &res, bool &isNaN);
223 bool readDouble2Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN);
225 bool readDouble4Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN);
226 
228 bool readData(RVNGInputStreamPtr &input, unsigned long sz, librevenge::RVNGBinaryData &data);
230 bool readDataToEnd(RVNGInputStreamPtr &input, librevenge::RVNGBinaryData &data);
232 void appendUnicode(uint32_t val, librevenge::RVNGString &buffer);
233 }
234 
235 #define WPS_LE_GET_GUINT16(p) \
236  (uint16_t)((((uint8_t const *)(p))[0] << 0) | \
237  (((uint8_t const *)(p))[1] << 8))
238 #define WPS_LE_GET_GUINT32(p) \
239  (uint32_t)((((uint8_t const *)(p))[0] << 0) | \
240  (((uint8_t const *)(p))[1] << 8) | \
241  (((uint8_t const *)(p))[2] << 16) | \
242  (((uint8_t const *)(p))[3] << 24))
243 
244 #define WPS_LE_PUT_GUINT16(p, v) \
245  *((uint8_t*)(p)) = uint8_t(v); \
246  *(((uint8_t*)(p)) + 1) = uint8_t((v) >> 8)
247 
248 #define WPS_LE_PUT_GUINT32(p, v) \
249  *((uint8_t*)(p)) = uint8_t(v); \
250  *(((uint8_t*)(p)) + 1) = uint8_t((v) >> 8); \
251  *(((uint8_t*)(p)) + 2) = uint8_t((v) >> 16); \
252  *(((uint8_t*)(p)) + 3) = uint8_t((v) >> 24)
253 
254 // Various helper structures for the parser..
255 /* ---------- small enum/class ------------- */
256 namespace libwps
257 {
259 std::string numberingTypeToString(NumberingType type);
263  };
264 enum { NoBreakBit = 0x1, NoBreakWithNextBit=0x2};
265 }
266 
268 {
270  {
271  }
272  double m_width;
273  double m_leftGutter;
275 };
276 
278 {
280  {
281  }
282  uint32_t m_attributes;
283  uint8_t m_alignment;
284 };
285 
287 struct WPSColor
288 {
290  explicit WPSColor(uint32_t argb=0) : m_value(argb)
291  {
292  }
294  WPSColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) :
295  m_value(uint32_t((a<<24)+(r<<16)+(g<<8)+b))
296  {
297  }
299  WPSColor &operator=(uint32_t argb)
300  {
301  m_value = argb;
302  return *this;
303  }
305  static WPSColor black()
306  {
307  return WPSColor(0,0,0);
308  }
310  static WPSColor white()
311  {
312  return WPSColor(255,255,255);
313  }
314 
316  static WPSColor barycenter(float alpha, WPSColor const &colA,
317  float beta, WPSColor const &colB);
319  uint32_t value() const
320  {
321  return m_value;
322  }
324  unsigned char getAlpha() const
325  {
326  return (unsigned char)((m_value>>24)&0xFF);
327  }
329  unsigned char getBlue() const
330  {
331  return (unsigned char)(m_value&0xFF);
332  }
334  unsigned char getRed() const
335  {
336  return (unsigned char)((m_value>>16)&0xFF);
337  }
339  unsigned char getGreen() const
340  {
341  return (unsigned char)((m_value>>8)&0xFF);
342  }
344  bool isBlack() const
345  {
346  return (m_value&0xFFFFFF)==0;
347  }
349  bool isWhite() const
350  {
351  return (m_value&0xFFFFFF)==0xFFFFFF;
352  }
354  bool operator==(WPSColor const &c) const
355  {
356  return (c.m_value&0xFFFFFF)==(m_value&0xFFFFFF);
357  }
359  bool operator!=(WPSColor const &c) const
360  {
361  return !operator==(c);
362  }
364  bool operator<(WPSColor const &c) const
365  {
366  return (c.m_value&0xFFFFFF)<(m_value&0xFFFFFF);
367  }
369  bool operator<=(WPSColor const &c) const
370  {
371  return (c.m_value&0xFFFFFF)<=(m_value&0xFFFFFF);
372  }
374  bool operator>(WPSColor const &c) const
375  {
376  return !operator<=(c);
377  }
379  bool operator>=(WPSColor const &c) const
380  {
381  return !operator<(c);
382  }
384  friend std::ostream &operator<< (std::ostream &o, WPSColor const &c);
386  std::string str() const;
387 protected:
389  uint32_t m_value;
390 };
391 
393 struct WPSBorder
394 {
398  enum Type { Single, Double, Triple };
399  enum Pos { Left = 0, Right = 1, Top = 2, Bottom = 3 };
400  enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08 };
401 
407  bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const;
409  bool isEmpty() const
410  {
411  return m_style==None || m_width <= 0;
412  }
413 
415  bool operator==(WPSBorder const &orig) const
416  {
417  return m_style == orig.m_style && m_type == orig.m_type && m_width == orig.m_width
418  && m_color == orig.m_color;
419  }
421  bool operator!=(WPSBorder const &orig) const
422  {
423  return !operator==(orig);
424  }
426  int compare(WPSBorder const &orig) const;
427 
429  friend std::ostream &operator<< (std::ostream &o, WPSBorder const &border);
431  friend std::ostream &operator<< (std::ostream &o, WPSBorder::Style const &style);
437  int m_width;
441  std::vector<double> m_widthsList;
445  std::string m_extra;
446 };
447 
453 {
456  {
457  }
459  WPSEmbeddedObject(librevenge::RVNGBinaryData const &binaryData,
460  std::string type="image/pict") : m_dataList(), m_typeList()
461  {
462  add(binaryData, type);
463  }
466  {
467  }
469  bool isEmpty() const
470  {
471  for (size_t i=0; i<m_dataList.size(); ++i)
472  {
473  if (!m_dataList[i].empty())
474  return false;
475  }
476  return true;
477  }
479  void add(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
480  {
481  size_t pos=m_dataList.size();
482  if (pos<m_typeList.size()) pos=m_typeList.size();
483  m_dataList.resize(pos+1);
484  m_dataList[pos]=binaryData;
485  m_typeList.resize(pos+1);
486  m_typeList[pos]=type;
487  }
489  bool addTo(librevenge::RVNGPropertyList &propList) const;
491  friend std::ostream &operator<<(std::ostream &o, WPSEmbeddedObject const &pict);
492 
494  std::vector<librevenge::RVNGBinaryData> m_dataList;
496  std::vector<std::string> m_typeList;
497 };
498 
500 struct WPSField
501 {
504 
506  explicit WPSField(Type type) : m_type(type), m_DTFormat(""), m_numberingType(libwps::ARABIC), m_data("")
507  {
508  }
510  bool addTo(librevenge::RVNGPropertyList &propList) const;
512  librevenge::RVNGString getString() const;
516  std::string m_DTFormat;
520  std::string m_data;
521 };
522 
523 // ATTRIBUTE bits
524 #define WPS_EXTRA_LARGE_BIT 1
525 #define WPS_VERY_LARGE_BIT 2
526 #define WPS_LARGE_BIT 4
527 #define WPS_SMALL_PRINT_BIT 8
528 #define WPS_FINE_PRINT_BIT 0x10
529 #define WPS_SUPERSCRIPT_BIT 0x20
530 #define WPS_SUBSCRIPT_BIT 0x40
531 #define WPS_OUTLINE_BIT 0x80
532 #define WPS_ITALICS_BIT 0x100
533 #define WPS_SHADOW_BIT 0x200
534 #define WPS_REDLINE_BIT 0x400
535 #define WPS_DOUBLE_UNDERLINE_BIT 0x800
536 #define WPS_BOLD_BIT 0x1000
537 #define WPS_STRIKEOUT_BIT 0x2000
538 #define WPS_UNDERLINE_BIT 0x4000
539 #define WPS_SMALL_CAPS_BIT 0x8000
540 #define WPS_BLINK_BIT 0x10000L
541 #define WPS_REVERSEVIDEO_BIT 0x20000L
542 #define WPS_ALL_CAPS_BIT 0x40000L
543 #define WPS_EMBOSS_BIT 0x80000L
544 #define WPS_ENGRAVE_BIT 0x100000L
545 #define WPS_OVERLINE_BIT 0x400000L
546 #define WPS_HIDDEN_BIT 0x800000L
547 
548 // BREAK bits
549 #define WPS_PAGE_BREAK 0x00
550 #define WPS_SOFT_PAGE_BREAK 0x01
551 #define WPS_COLUMN_BREAK 0x02
552 
553 // Generic bits
554 #define WPS_LEFT 0x00
555 #define WPS_RIGHT 0x01
556 #define WPS_CENTER 0x02
557 #define WPS_TOP 0x03
558 #define WPS_BOTTOM 0x04
559 
560 /* ---------- vec2/box2f ------------- */
564 template <class T> class Vec2
565 {
566 public:
568  Vec2(T xx=0,T yy=0) : m_x(xx), m_y(yy) { }
570  template <class U> Vec2(Vec2<U> const &p) : m_x(T(p.x())), m_y(T(p.y())) {}
571 
573  T x() const
574  {
575  return m_x;
576  }
578  T y() const
579  {
580  return m_y;
581  }
583  T operator[](int c) const
584  {
585  if (c<0 || c>1) throw libwps::GenericException();
586  return (c==0) ? m_x : m_y;
587  }
589  T &operator[](int c)
590  {
591  if (c<0 || c>1) throw libwps::GenericException();
592  return (c==0) ? m_x : m_y;
593  }
594 
596  void set(T xx, T yy)
597  {
598  m_x = xx;
599  m_y = yy;
600  }
602  void setX(T xx)
603  {
604  m_x = xx;
605  }
607  void setY(T yy)
608  {
609  m_y = yy;
610  }
611 
613  void add(T dx, T dy)
614  {
615  m_x += dx;
616  m_y += dy;
617  }
618 
621  {
622  m_x += p.m_x;
623  m_y += p.m_y;
624  return *this;
625  }
628  {
629  m_x -= p.m_x;
630  m_y -= p.m_y;
631  return *this;
632  }
634  template <class U>
635  Vec2<T> &operator*=(U scale)
636  {
637  m_x = T(m_x*scale);
638  m_y = T(m_y*scale);
639  return *this;
640  }
641 
643  friend Vec2<T> operator+(Vec2<T> const &p1, Vec2<T> const &p2)
644  {
645  Vec2<T> p(p1);
646  return p+=p2;
647  }
649  friend Vec2<T> operator-(Vec2<T> const &p1, Vec2<T> const &p2)
650  {
651  Vec2<T> p(p1);
652  return p-=p2;
653  }
655  template <class U>
656  friend Vec2<T> operator*(U scale, Vec2<T> const &p1)
657  {
658  Vec2<T> p(p1);
659  return p *= scale;
660  }
661 
663  bool operator==(Vec2<T> const &p) const
664  {
665  return cmpY(p) == 0;
666  }
668  bool operator!=(Vec2<T> const &p) const
669  {
670  return cmpY(p) != 0;
671  }
673  bool operator<(Vec2<T> const &p) const
674  {
675  return cmpY(p) < 0;
676  }
678  int cmp(Vec2<T> const &p) const
679  {
680  if (m_x<p.m_x) return -1;
681  if (m_x>p.m_x) return 1;
682  if (m_y<p.m_y) return -1;
683  if (m_y>p.m_y) return 1;
684  return 0;
685  }
687  int cmpY(Vec2<T> const &p) const
688  {
689  if (m_y<p.m_y) return -1;
690  if (m_y>p.m_y) return 1;
691  if (m_x<p.m_x) return -1;
692  if (m_x>p.m_x) return 1;
693  return 0;
694  }
695 
697  friend std::ostream &operator<< (std::ostream &o, Vec2<T> const &f)
698  {
699  o << f.m_x << "x" << f.m_y;
700  return o;
701  }
702 
706  struct PosSizeLtX
707  {
709  bool operator()(Vec2<T> const &s1, Vec2<T> const &s2) const
710  {
711  return s1.cmp(s2) < 0;
712  }
713  };
714 
718  struct PosSizeLtY
719  {
721  bool operator()(Vec2<T> const &s1, Vec2<T> const &s2) const
722  {
723  return s1.cmpY(s2) < 0;
724  }
725  };
726 protected:
727  T m_x, m_y;
728 };
729 
733 typedef Vec2<int> Vec2i;
736 
740 template <class T> class WPSBox2
741 {
742 public:
745  {
746  m_pt[0] = minPt;
747  m_pt[1] = maxPt;
748  }
750  template <class U> WPSBox2(WPSBox2<U> const &p)
751  {
752  for (int c=0; c < 2; c++) m_pt[c] = p[c];
753  }
754 
756  Vec2<T> const &min() const
757  {
758  return m_pt[0];
759  }
761  Vec2<T> const &max() const
762  {
763  return m_pt[1];
764  }
767  {
768  return m_pt[0];
769  }
772  {
773  return m_pt[1];
774  }
775 
779  Vec2<T> const &operator[](int c) const
780  {
781  if (c<0 || c>1) throw libwps::GenericException();
782  return m_pt[c];
783  }
785  Vec2<T> size() const
786  {
787  return m_pt[1]-m_pt[0];
788  }
790  Vec2<T> center() const
791  {
792  return 0.5*(m_pt[0]+m_pt[1]);
793  }
794 
796  void set(Vec2<T> const &x, Vec2<T> const &y)
797  {
798  m_pt[0] = x;
799  m_pt[1] = y;
800  }
802  void setMin(Vec2<T> const &x)
803  {
804  m_pt[0] = x;
805  }
807  void setMax(Vec2<T> const &y)
808  {
809  m_pt[1] = y;
810  }
811 
813  void resizeFromMin(Vec2<T> const &sz)
814  {
815  m_pt[1] = m_pt[0]+sz;
816  }
818  void resizeFromMax(Vec2<T> const &sz)
819  {
820  m_pt[0] = m_pt[1]-sz;
821  }
823  void resizeFromCenter(Vec2<T> const &sz)
824  {
825  Vec2<T> ctr = 0.5*(m_pt[0]+m_pt[1]);
826  m_pt[0] = ctr - 0.5*sz;
827  m_pt[1] = ctr + (sz - 0.5*sz);
828  }
829 
831  template <class U> void scale(U factor)
832  {
833  m_pt[0] *= factor;
834  m_pt[1] *= factor;
835  }
836 
838  void extend(T val)
839  {
840  m_pt[0] -= Vec2<T>(val/2,val/2);
841  m_pt[1] += Vec2<T>(val-(val/2),val-(val/2));
842  }
844  WPSBox2<T> getUnion(WPSBox2<T> const &box) const
845  {
846  WPSBox2<T> res;
847  res.m_pt[0]=Vec2<T>(m_pt[0][0]<box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
848  m_pt[0][1]<box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
849  res.m_pt[1]=Vec2<T>(m_pt[1][0]>box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
850  m_pt[1][1]>box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
851  return res;
852  }
855  {
856  WPSBox2<T> res;
857  res.m_pt[0]=Vec2<T>(m_pt[0][0]>box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
858  m_pt[0][1]>box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
859  res.m_pt[1]=Vec2<T>(m_pt[1][0]<box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
860  m_pt[1][1]<box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
861  return res;
862  }
863 
865  bool operator==(WPSBox2<T> const &p) const
866  {
867  return cmp(p) == 0;
868  }
870  bool operator!=(WPSBox2<T> const &p) const
871  {
872  return cmp(p) != 0;
873  }
875  bool operator<(WPSBox2<T> const &p) const
876  {
877  return cmp(p) < 0;
878  }
879 
881  int cmp(WPSBox2<T> const &p) const
882  {
883  int diff = m_pt[0].cmpY(p.m_pt[0]);
884  if (diff) return diff;
885  diff = m_pt[1].cmpY(p.m_pt[1]);
886  if (diff) return diff;
887  return 0;
888  }
889 
891  friend std::ostream &operator<< (std::ostream &o, WPSBox2<T> const &f)
892  {
893  o << "(" << f.m_pt[0] << "<->" << f.m_pt[1] << ")";
894  return o;
895  }
896 
900  struct PosSizeLt
901  {
903  bool operator()(WPSBox2<T> const &s1, WPSBox2<T> const &s2) const
904  {
905  return s1.cmp(s2) < 0;
906  }
907  };
911  typedef std::map<WPSBox2<T>, T,struct PosSizeLt> Map;
912 
913 protected:
916 };
917 
922 
926 template <class T> class WPSVec3
927 {
928 public:
930  explicit WPSVec3(T xx=0,T yy=0,T zz=0)
931  {
932  m_val[0] = xx;
933  m_val[1] = yy;
934  m_val[2] = zz;
935  }
937  template <class U> WPSVec3(WPSVec3<U> const &p)
938  {
939  for (int c = 0; c < 3; c++) m_val[c] = T(p[c]);
940  }
941 
943  T x() const
944  {
945  return m_val[0];
946  }
948  T y() const
949  {
950  return m_val[1];
951  }
953  T z() const
954  {
955  return m_val[2];
956  }
958  T operator[](int c) const
959  {
960  if (c<0 || c>2) throw libwps::GenericException();
961  return m_val[c];
962  }
964  T &operator[](int c)
965  {
966  if (c<0 || c>2) throw libwps::GenericException();
967  return m_val[c];
968  }
969 
971  void set(T xx, T yy, T zz)
972  {
973  m_val[0] = xx;
974  m_val[1] = yy;
975  m_val[2] = zz;
976  }
978  void setX(T xx)
979  {
980  m_val[0] = xx;
981  }
983  void setY(T yy)
984  {
985  m_val[1] = yy;
986  }
988  void setZ(T zz)
989  {
990  m_val[2] = zz;
991  }
992 
994  void add(T dx, T dy, T dz)
995  {
996  m_val[0] += dx;
997  m_val[1] += dy;
998  m_val[2] += dz;
999  }
1000 
1003  {
1004  for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]);
1005  return *this;
1006  }
1009  {
1010  for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]-p.m_val[c]);
1011  return *this;
1012  }
1014  template <class U>
1016  {
1017  for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]*scale);
1018  return *this;
1019  }
1020 
1022  friend WPSVec3<T> operator+(WPSVec3<T> const &p1, WPSVec3<T> const &p2)
1023  {
1024  WPSVec3<T> p(p1);
1025  return p+=p2;
1026  }
1028  friend WPSVec3<T> operator-(WPSVec3<T> const &p1, WPSVec3<T> const &p2)
1029  {
1030  WPSVec3<T> p(p1);
1031  return p-=p2;
1032  }
1034  template <class U>
1035  friend WPSVec3<T> operator*(U scale, WPSVec3<T> const &p1)
1036  {
1037  WPSVec3<T> p(p1);
1038  return p *= scale;
1039  }
1040 
1042  bool operator==(WPSVec3<T> const &p) const
1043  {
1044  return cmp(p) == 0;
1045  }
1047  bool operator!=(WPSVec3<T> const &p) const
1048  {
1049  return cmp(p) != 0;
1050  }
1052  bool operator<(WPSVec3<T> const &p) const
1053  {
1054  return cmp(p) < 0;
1055  }
1057  int cmp(WPSVec3<T> const &p) const
1058  {
1059  for (int c = 0; c < 3; c++)
1060  {
1061  if (m_val[c]<p.m_val[c]) return -1;
1062  if (m_val[c]>p.m_val[c]) return 1;
1063  }
1064  return 0;
1065  }
1066 
1068  friend std::ostream &operator<< (std::ostream &o, WPSVec3<T> const &f)
1069  {
1070  o << f.m_val[0] << "x" << f.m_val[1] << "x" << f.m_val[2];
1071  return o;
1072  }
1073 
1077  struct PosSizeLt
1078  {
1080  bool operator()(WPSVec3<T> const &s1, WPSVec3<T> const &s2) const
1081  {
1082  return s1.cmp(s2) < 0;
1083  }
1084  };
1088  typedef std::map<WPSVec3<T>, T,struct PosSizeLt> Map;
1089 
1090 protected:
1092  T m_val[3];
1093 };
1094 
1101 
1104 {
1105 public:
1107  explicit WPSTransformation(WPSVec3f const &xRow=WPSVec3f(1,0,0), WPSVec3f const &yRow=WPSVec3f(0,1,0)) : m_data(xRow, yRow), m_isIdentity(false)
1108  {
1109  checkIdentity();
1110  }
1112  bool isIdentity() const
1113  {
1114  return m_isIdentity;
1115  }
1117  void checkIdentity() const
1118  {
1119  m_isIdentity= m_data.first==WPSVec3f(1,0,0) && m_data.second==WPSVec3f(0,1,0);
1120  }
1124  WPSVec3f const &operator[](int c) const
1125  {
1126  if (c<0 || c>1) throw libwps::GenericException();
1127  return c==0 ? m_data.first : m_data.second;
1128  }
1130  Vec2f operator*(Vec2f const &pt) const
1131  {
1132  if (m_isIdentity) return pt;
1133  return multiplyDirection(pt)+Vec2f(m_data.first[2],m_data.second[2]);
1134  }
1136  Vec2f multiplyDirection(Vec2f const &dir) const
1137  {
1138  if (m_isIdentity) return dir;
1139  Vec2f res;
1140  for (int coord=0; coord<2; ++coord)
1141  {
1142  WPSVec3f const &row=coord==0 ? m_data.first : m_data.second;
1143  float value=0;
1144  for (int i=0; i<2; ++i)
1145  value+=row[i]*dir[i];
1146  res[coord]=value;
1147  }
1148  return res;
1149  }
1151  WPSBox2f operator*(WPSBox2f const &box) const
1152  {
1153  if (m_isIdentity) return box;
1154  return WPSBox2f(operator*(box.min()), operator*(box.max()));
1155  }
1158  {
1159  if (mat.m_isIdentity) return *this;
1160  WPSTransformation res;
1161  for (int row=0; row<2; ++row)
1162  {
1163  WPSVec3f &resRow=row==0 ? res.m_data.first : res.m_data.second;
1164  for (int col=0; col<3; ++col)
1165  {
1166  float value=0;
1167  for (int i=0; i<3; ++i)
1168  value+=(*this)[row][i]*(i==2 ? (col==2 ? 1.f : 0.f) : mat[i][col]);
1169  resRow[col]=value;
1170  }
1171  }
1172  res.checkIdentity();
1173  return res;
1174  }
1177  {
1178  if (!mat.m_isIdentity)
1179  *this=(*this)*mat;
1180  return *this;
1181  }
1183  bool operator==(WPSTransformation const &mat) const
1184  {
1185  return m_data==mat.m_data;
1186  }
1188  bool operator!=(WPSTransformation const &mat) const
1189  {
1190  return m_data!=mat.m_data;
1191  }
1193  bool operator<(WPSTransformation const &mat) const
1194  {
1195  return m_data<mat.m_data;
1196  }
1198  bool operator<=(WPSTransformation const &mat) const
1199  {
1200  return m_data<=mat.m_data;
1201  }
1203  bool operator>(WPSTransformation const &mat) const
1204  {
1205  return m_data>mat.m_data;
1206  }
1208  bool operator>=(WPSTransformation const &mat) const
1209  {
1210  return m_data>=mat.m_data;
1211  }
1215  bool decompose(float &rotation, Vec2f &shearing, WPSTransformation &transform, Vec2f const &center) const;
1216 
1218  static WPSTransformation translation(Vec2f const &trans)
1219  {
1220  return WPSTransformation(WPSVec3f(1, 0, trans[0]), WPSVec3f(0, 1, trans[1]));
1221  }
1223  static WPSTransformation scale(Vec2f const &trans)
1224  {
1225  return WPSTransformation(WPSVec3f(trans[0], 0, 0), WPSVec3f(0, trans[1], 0));
1226  }
1230  static WPSTransformation rotation(float angle, Vec2f const &center=Vec2f(0,0));
1234  static WPSTransformation shear(Vec2f s, Vec2f const &center=Vec2f(0,0))
1235  {
1236  return WPSTransformation(WPSVec3f(1, s[0], -s[0]*center[1]), WPSVec3f(s[1], 1, -s[1]*center[0]));
1237  }
1238 protected:
1240  std::pair<WPSVec3f, WPSVec3f > m_data;
1242  mutable bool m_isIdentity;
1243 };
1244 
1245 //
1246 // password utility
1247 //
1248 
1249 namespace libwps
1250 {
1252 bool encodeLotusPassword(char const *password, uint16_t &key, std::vector<uint8_t> &keys, uint8_t const(&defValues)[16]);
1253 }
1254 #endif /* LIBWPS_INTERNAL_H */
1255 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:40
std::string m_data
the database/link field ( if defined )
Definition: libwps_internal.h:520
Definition: libwps_internal.h:396
Definition: libwps_internal.h:258
void resizeFromCenter(Vec2< T > const &sz)
resize the box keeping the center
Definition: libwps_internal.h:823
void scale(U factor)
scales all points of the box by factor
Definition: libwps_internal.h:831
shared_ptr< WPSContentListener > WPSContentListenerPtr
shared pointer to WPSContentListener
Definition: libwps_internal.h:122
WPSTransformation(WPSVec3f const &xRow=WPSVec3f(1, 0, 0), WPSVec3f const &yRow=WPSVec3f(0, 1, 0))
constructor
Definition: libwps_internal.h:1107
Vec2< float > Vec2f
Vec2 of float.
Definition: libwps_internal.h:735
WPSColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition: libwps_internal.h:294
void set(Vec2< T > const &x, Vec2< T > const &y)
resets the data to minimum x and maximum y
Definition: libwps_internal.h:796
void setY(T yy)
resets the second element
Definition: libwps_internal.h:607
static WPSColor barycenter(float alpha, WPSColor const &colA, float beta, WPSColor const &colB)
return alpha*colA+beta*colB
Definition: libwps_internal.cpp:386
a border list
Definition: libwps_internal.h:393
Definition: libwps_internal.h:396
T m_val[3]
the values
Definition: libwps_internal.h:1092
Definition: libwps_internal.h:277
Definition: libwps_internal.h:173
T m_x
first element
Definition: libwps_internal.h:727
bool m_isIdentity
flag to know if this matrix is an identity matrix
Definition: libwps_internal.h:1242
libwps::NumberingType m_numberingType
the number type ( for number field )
Definition: libwps_internal.h:518
Definition: libwps_internal.h:398
bool operator==(WPSVec3< T > const &p) const
comparison==
Definition: libwps_internal.h:1042
Definition: libwps_internal.cpp:38
Vec2< T > size() const
the box size
Definition: libwps_internal.h:785
WPSVec3< T > & operator*=(U scale)
generic operator*=
Definition: libwps_internal.h:1015
bool isIdentity() const
returns true if the matrix is an identity matrix
Definition: libwps_internal.h:1112
bool operator()(WPSVec3< T > const &s1, WPSVec3< T > const &s2) const
comparaison function
Definition: libwps_internal.h:1080
shared_ptr< WPSSubDocument > WPSSubDocumentPtr
shared pointer to WPSSubDocument
Definition: libwps_internal.h:126
friend Vec2< T > operator-(Vec2< T > const &p1, Vec2< T > const &p2)
operator-
Definition: libwps_internal.h:649
bool encodeLotusPassword(char const *password, uint16_t &key, std::vector< uint8_t > &keys, uint8_t const (&defValues)[16])
try to encode a lotus file
Definition: libwps_internal.cpp:837
WPSBox2(Vec2< T > minPt=Vec2< T >(), Vec2< T > maxPt=Vec2< T >())
constructor
Definition: libwps_internal.h:744
Definition: libwps_internal.h:398
int32_t read32(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:85
WPSEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
constructor
Definition: libwps_internal.h:459
T & operator[](int c)
operator[]
Definition: libwps_internal.h:589
Definition: libwps_internal.h:399
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:496
WPSVec3< T > & operator+=(WPSVec3< T > const &p)
operator+=
Definition: libwps_internal.h:1002
bool operator==(WPSColor const &c) const
operator==
Definition: libwps_internal.h:354
WPSBox2< int > WPSBox2i
WPSBox2 of int.
Definition: libwps_internal.h:919
double m_leftGutter
Definition: libwps_internal.h:273
bool operator!=(WPSVec3< T > const &p) const
comparison!=
Definition: libwps_internal.h:1047
Definition: libwps_internal.h:396
a field
Definition: libwps_internal.h:500
Definition: libwps_internal.h:400
#define WPS_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libwps_internal.h:136
virtual class for content listener
Definition: WPSListener.h:36
internal struct used to create sorted map, sorted by X
Definition: libwps_internal.h:706
Definition: libwps_internal.h:503
Type m_type
the type
Definition: libwps_internal.h:514
bool operator()(WPSBox2< T > const &s1, WPSBox2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:903
static WPSColor black()
return the back color
Definition: libwps_internal.h:305
int m_width
the border width
Definition: libwps_internal.h:437
static WPSColor white()
return the white color
Definition: libwps_internal.h:310
Definition: libwps_internal.h:260
Definition: libwps_internal.h:399
WPSEmbeddedObject()
empty constructor
Definition: libwps_internal.h:455
void setX(T xx)
resets the first element
Definition: libwps_internal.h:978
WPSVec3f const & operator[](int c) const
the two extremum points which defined the box
Definition: libwps_internal.h:1124
Vec2< T > & operator+=(Vec2< T > const &p)
operator+=
Definition: libwps_internal.h:620
Definition: libwps_internal.h:258
void set(T xx, T yy)
resets the two elements
Definition: libwps_internal.h:596
Definition: libwps_internal.h:258
Definition: libwps_internal.h:260
Definition: WPSContentListener.h:44
WPSColor & operator=(uint32_t argb)
operator=
Definition: libwps_internal.h:299
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
uint32_t m_attributes
Definition: libwps_internal.h:282
Definition: libwps_internal.h:260
unsigned char getRed() const
returns the red value
Definition: libwps_internal.h:334
friend std::ostream & operator<<(std::ostream &o, WPSColor const &c)
operator<< in the form #rrggbb
Definition: libwps_internal.cpp:401
bool operator>(WPSTransformation const &mat) const
operator>
Definition: libwps_internal.h:1203
Vec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libwps_internal.h:756
WPSBox2< float > WPSBox2f
WPSBox2 of float.
Definition: libwps_internal.h:921
bool isBlack() const
return true if the color is black
Definition: libwps_internal.h:344
librevenge::RVNGString getString() const
returns a string corresponding to the field (if possible) */
Definition: libwps_internal.cpp:453
bool operator<(WPSColor const &c) const
operator<
Definition: libwps_internal.h:364
bool operator>=(WPSColor const &c) const
operator>=
Definition: libwps_internal.h:379
void add(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
add a picture
Definition: libwps_internal.h:479
Type
Defines some basic type for field.
Definition: libwps_internal.h:503
a structure used to defined the cell position, and a format
Definition: WPSCell.h:277
internal struct used to create sorted map, sorted first min then max
Definition: libwps_internal.h:900
double m_width
Definition: libwps_internal.h:272
Vec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition: libwps_internal.h:761
Justification
Definition: libwps_internal.h:261
double m_rightGutter
Definition: libwps_internal.h:274
internal struct used to create sorted map, sorted by X, Y, Z
Definition: libwps_internal.h:1077
bool operator==(WPSBox2< T > const &p) const
comparison operator==
Definition: libwps_internal.h:865
std::map< WPSBox2< int >, int, struct PosSizeLt > Map
Definition: libwps_internal.h:911
Vec2f operator*(Vec2f const &pt) const
operator* for vec2f
Definition: libwps_internal.h:1130
virtual class to define a sub document
Definition: WPSSubDocument.h:33
T x() const
first element
Definition: libwps_internal.h:943
static WPSTransformation scale(Vec2f const &trans)
returns a scaling transformation
Definition: libwps_internal.h:1223
WPSField(Type type)
basic constructor
Definition: libwps_internal.h:506
bool operator==(Vec2< T > const &p) const
comparison==
Definition: libwps_internal.h:663
Definition: libwps_internal.h:396
Definition: libwps_internal.h:258
Definition: libwps_internal.h:400
bool readDouble10(RVNGInputStreamPtr &input, double &res, bool &isNaN)
read a double store with 10 bytes: mantisse 8 bytes, exponent 2 bytes
Definition: libwps_internal.cpp:224
bool isEmpty() const
return true if the picture contains no data
Definition: libwps_internal.h:469
shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:124
Definition: libwps_internal.h:399
Definition: libwps_internal.h:503
Definition: libwps_internal.h:260
bool operator!=(Vec2< T > const &p) const
comparison!=
Definition: libwps_internal.h:668
T y() const
second element
Definition: libwps_internal.h:578
void setMax(Vec2< T > const &y)
resets the maximum point
Definition: libwps_internal.h:807
Vec2(T xx=0, T yy=0)
constructor
Definition: libwps_internal.h:568
Definition: libwps_internal.h:503
Definition: libwps_internal.h:264
WPSTransformation operator*(WPSTransformation const &mat) const
operator* for transform
Definition: libwps_internal.h:1157
bool operator==(WPSTransformation const &mat) const
operator==
Definition: libwps_internal.h:1183
T operator[](int c) const
operator[]
Definition: libwps_internal.h:958
Vec2f multiplyDirection(Vec2f const &dir) const
operator* for direction
Definition: libwps_internal.h:1136
shared_ptr< WPSListener > WPSListenerPtr
shared pointer to WPSListener
Definition: libwps_internal.h:120
void setX(T xx)
resets the first element
Definition: libwps_internal.h:602
WPSBorder()
constructor
Definition: libwps_internal.h:403
Definition: libwps_internal.h:264
Definition: libwps_internal.h:399
std::pair< WPSVec3f, WPSVec3f > m_data
the data
Definition: libwps_internal.h:1240
SubDocumentType
Definition: libwps_internal.h:260
Definition: libwps_internal.h:258
bool operator<(WPSTransformation const &mat) const
operator<
Definition: libwps_internal.h:1193
Definition: libwps_internal.h:261
Definition: libwps_internal.h:260
static WPSTransformation shear(Vec2f s, Vec2f const &center=Vec2f(0, 0))
returns a shear transformation letting center invariant, ie.
Definition: libwps_internal.h:1234
Definition: libwps_internal.h:163
void set(T xx, T yy, T zz)
resets the three elements
Definition: libwps_internal.h:971
WPSBox2(WPSBox2< U > const &p)
generic constructor
Definition: libwps_internal.h:750
std::vector< double > m_widthsList
the different length used for each line/sep (if defined)
Definition: libwps_internal.h:441
static WPSTransformation rotation(float angle, Vec2f const &center=Vec2f(0, 0))
returns a rotation transformation around center.
Definition: libwps_internal.cpp:773
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:988
Definition: libwps_internal.h:262
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer)
adds an unicode character to a string ( with correct encoding ).
Definition: libwps_internal.cpp:719
Vec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libwps_internal.h:766
bool isWhite() const
return true if the color is white
Definition: libwps_internal.h:349
shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:129
Definition: WPSHeader.h:31
bool operator!=(WPSBorder const &orig) const
operator!=
Definition: libwps_internal.h:421
small class which defines a 2D WPSBox
Definition: libwps_internal.h:740
Definition: libwps_internal.h:260
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition: libwps_internal.h:994
Definition: libwps_internal.h:153
friend WPSVec3< T > operator*(U scale, WPSVec3< T > const &p1)
generic operator*
Definition: libwps_internal.h:1035
unsigned char getBlue() const
returns the green value
Definition: libwps_internal.h:329
uint32_t m_value
the argb color
Definition: libwps_internal.h:389
internal struct used to create sorted map, sorted by Y
Definition: libwps_internal.h:718
WPSVec3< T > & operator-=(WPSVec3< T > const &p)
operator-=
Definition: libwps_internal.h:1008
bool operator!=(WPSBox2< T > const &p) const
comparison operator!=
Definition: libwps_internal.h:870
T x() const
first element
Definition: libwps_internal.h:573
void operator()(T *)
Definition: libwps_internal.h:83
Definition: libwps_internal.h:503
WPSVec3< unsigned char > WPSVec3uc
WPSVec3 of unsigned char.
Definition: libwps_internal.h:1096
Type
the line repetition
Definition: libwps_internal.h:398
Vec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition: libwps_internal.h:779
int8_t read8(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:59
Definition: libwps_internal.h:503
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition: libwps_internal.h:838
T y() const
second element
Definition: libwps_internal.h:948
Definition: libwps_internal.h:168
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition: libwps_internal.h:613
Definition: libwps_internal.h:400
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition: libwps_internal.h:494
uint8_t m_alignment
Definition: libwps_internal.h:283
Definition: libwps_internal.h:267
bool operator()(Vec2< T > const &s1, Vec2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:721
WPSBox2f operator*(WPSBox2f const &box) const
operator* for box2f
Definition: libwps_internal.h:1151
bool isEmpty() const
returns true if the border is empty
Definition: libwps_internal.h:409
WPSColumnProperties()
Definition: libwps_internal.h:279
Vec2< T > & operator-=(Vec2< T > const &p)
operator-=
Definition: libwps_internal.h:627
void setMin(Vec2< T > const &x)
resets the minimum point
Definition: libwps_internal.h:802
WPSColor m_color
the border color
Definition: libwps_internal.h:443
Vec2< T > & operator*=(U scale)
generic operator*=
Definition: libwps_internal.h:635
NumberingType
Definition: libwps_internal.h:258
WPSBox2< T > getUnion(WPSBox2< T > const &box) const
returns the union between this and box
Definition: libwps_internal.h:844
uint32_t value() const
return the rgba value
Definition: libwps_internal.h:319
bool operator!=(WPSColor const &c) const
operator!=
Definition: libwps_internal.h:359
int cmpY(Vec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libwps_internal.h:687
bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const
add the border property to proplist (if needed )
Definition: libwps_internal.cpp:530
WPSBox2< T > getIntersection(WPSBox2< T > const &box) const
returns the intersection between this and box
Definition: libwps_internal.h:854
int16_t read16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:71
void resizeFromMin(Vec2< T > const &sz)
resize the box keeping the minimum
Definition: libwps_internal.h:813
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:102
Definition: libwps_internal.h:503
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:733
the class to store a color
Definition: libwps_internal.h:287
virtual ~WPSEmbeddedObject()
destructor
Definition: libwps_internal.h:465
friend std::ostream & operator<<(std::ostream &o, WPSBorder const &border)
operator<<
Definition: libwps_internal.cpp:632
Definition: libwps_internal.h:396
Pos
Definition: libwps_internal.h:399
Definition: libwps_internal.h:262
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:1057
bool operator!=(WPSTransformation const &mat) const
operator!=
Definition: libwps_internal.h:1188
Vec2(Vec2< U > const &p)
generic copy constructor
Definition: libwps_internal.h:570
T operator[](int c) const
operator[]
Definition: libwps_internal.h:583
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
int compare(WPSBorder const &orig) const
compare two cell
Definition: libwps_internal.cpp:512
unsigned char getGreen() const
returns the green value
Definition: libwps_internal.h:339
bool operator<=(WPSColor const &c) const
operator<=
Definition: libwps_internal.h:369
static WPSTransformation translation(Vec2f const &trans)
returns a translation transformation
Definition: libwps_internal.h:1218
uint16_t readU16(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:64
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:1098
std::string numberingTypeToString(NumberingType type)
Definition: libwps_internal.cpp:357
bool operator>(WPSColor const &c) const
operator>
Definition: libwps_internal.h:374
WPSVec3(T xx=0, T yy=0, T zz=0)
constructor
Definition: libwps_internal.h:930
Style
the line style
Definition: libwps_internal.h:396
Definition: libwps_internal.h:398
bool operator==(WPSBorder const &orig) const
operator==
Definition: libwps_internal.h:415
bool operator<=(WPSTransformation const &mat) const
operator<=
Definition: libwps_internal.h:1198
WPSTransformation & operator*=(WPSTransformation const &mat)
operator*=
Definition: libwps_internal.h:1176
small class use to define a embedded object
Definition: libwps_internal.h:452
std::map< WPSVec3< int >, int, struct PosSizeLt > Map
Definition: libwps_internal.h:1088
uint32_t readU32(librevenge::RVNGInputStream *input)
Definition: libwps_internal.cpp:76
int cmp(WPSBox2< T > const &p) const
comparison function : fist sorts min by Y,X values then max extremity
Definition: libwps_internal.h:881
void setY(T yy)
resets the second element
Definition: libwps_internal.h:983
T z() const
third element
Definition: libwps_internal.h:953
Definition: libwps_internal.h:503
Definition: libwps_internal.h:158
WPSVec3(WPSVec3< U > const &p)
generic copy constructor
Definition: libwps_internal.h:937
friend WPSVec3< T > operator+(WPSVec3< T > const &p1, WPSVec3< T > const &p2)
operator+
Definition: libwps_internal.h:1022
WPSColumnDefinition()
Definition: libwps_internal.h:269
void checkIdentity() const
check if a matrix is the identity matrix
Definition: libwps_internal.h:1117
Style m_style
the border style
Definition: libwps_internal.h:433
Definition: libwps_internal.h:261
Definition: libwps_internal.h:258
a transformation which stored the first row of a 3x3 perspective matrix
Definition: libwps_internal.h:1103
shared_ptr< WKSSubDocument > WKSSubDocumentPtr
shared pointer to WKSSubDocument
Definition: libwps_internal.h:131
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:261
void resizeFromMax(Vec2< T > const &sz)
resize the box keeping the maximum
Definition: libwps_internal.h:818
Definition: libwps_internal.h:503
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:564
bool operator()(Vec2< T > const &s1, Vec2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:709
Definition: libwps_internal.h:258
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist
Definition: libwps_internal.cpp:669
friend Vec2< T > operator*(U scale, Vec2< T > const &p1)
generic operator*
Definition: libwps_internal.h:656
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: WPSPosition.h:39
friend std::ostream & operator<<(std::ostream &o, WPSEmbeddedObject const &pict)
operator<<
Definition: libwps_internal.cpp:699
std::string m_extra
extra data ( if needed)
Definition: libwps_internal.h:445
shared_ptr< WPSCell > WPSCellPtr
shared pointer to WPSCell
Definition: libwps_internal.h:115
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
WPSColor(uint32_t argb=0)
constructor
Definition: libwps_internal.h:290
WPSVec3< float > WPSVec3f
WPSVec3 of float.
Definition: libwps_internal.h:1100
T m_y
second element
Definition: libwps_internal.h:727
a noop deleter used to transform a librevenge pointer in a false shared_ptr
Definition: libwps_internal.h:81
Vec2< T > center() const
the box center
Definition: libwps_internal.h:790
T & operator[](int c)
operator[]
Definition: libwps_internal.h:964
Vec2< T > m_pt[2]
the two extremities
Definition: libwps_internal.h:915
Type m_type
the border repetition
Definition: libwps_internal.h:435
std::string m_DTFormat
the date/time format using strftime format if defined (see strftime)
Definition: libwps_internal.h:516
Vec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libwps_internal.h:771
Definition: WKSContentListener.h:52
bool operator>=(WPSTransformation const &mat) const
operator>=
Definition: libwps_internal.h:1208
small class which defines a vector with 3 elements
Definition: libwps_internal.h:926
int cmp(Vec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libwps_internal.h:678
std::string str() const
print the color in the form #rrggbb
Definition: libwps_internal.cpp:413
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist (if possible)
Definition: libwps_internal.cpp:423
Definition: libwps_internal.h:400
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:782
Vec2< bool > Vec2b
Vec2 of bool.
Definition: libwps_internal.h:731
friend WPSVec3< T > operator-(WPSVec3< T > const &p1, WPSVec3< T > const &p2)
operator-
Definition: libwps_internal.h:1028
unsigned char getAlpha() const
returns the alpha value
Definition: libwps_internal.h:324
friend Vec2< T > operator+(Vec2< T > const &p1, Vec2< T > const &p2)
operator+
Definition: libwps_internal.h:643
Definition: libwps_internal.h:503

Generated on Sat Jul 29 2017 15:32:22 for libwps by doxygen 1.8.8