libmwaw_internal.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; c-default-style: "k&r"; indent-tabs-mode: nil; tab-width: 2; c-basic-offset: 2 -*- */
2 
3 /* libmwaw
4 * Version: MPL 2.0 / LGPLv2+
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 2.0 (the "License"); you may not use this file except in compliance with
8 * the License or as specified alternatively below. You may obtain a copy of
9 * the License at http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * Major Contributor(s):
17 * Copyright (C) 2002 William Lachance (wrlach@gmail.com)
18 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
19 * Copyright (C) 2004-2006 Fridrich Strba (fridrich.strba@bluewin.ch)
20 * Copyright (C) 2006, 2007 Andrew Ziem
21 * Copyright (C) 2011, 2012 Alonso Laurent (alonso@loria.fr)
22 *
23 *
24 * All Rights Reserved.
25 *
26 * For minor contributions see the git repository.
27 *
28 * Alternatively, the contents of this file may be used under the terms of
29 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
30 * in which case the provisions of the LGPLv2+ are applicable
31 * instead of those above.
32 */
33 
34 #ifndef LIBMWAW_INTERNAL_H
35 #define LIBMWAW_INTERNAL_H
36 #ifdef DEBUG
37 #include <stdio.h>
38 #endif
39 
40 #include <math.h>
41 
42 #include <algorithm>
43 #include <cmath>
44 #include <limits>
45 #include <map>
46 #include <memory>
47 #include <ostream>
48 #include <string>
49 #include <vector>
50 
51 #ifndef M_PI
52 #define M_PI 3.14159265358979323846
53 #endif
54 
55 #include <librevenge-stream/librevenge-stream.h>
56 #include <librevenge/librevenge.h>
57 
58 #if defined(_MSC_VER) || defined(__DJGPP__)
59 
60 typedef signed char int8_t;
61 typedef unsigned char uint8_t;
62 typedef signed short int16_t;
63 typedef unsigned short uint16_t;
64 typedef signed int int32_t;
65 typedef unsigned int uint32_t;
66 typedef unsigned __int64 uint64_t;
67 typedef __int64 int64_t;
68 
69 #else /* !_MSC_VER && !__DJGPP__*/
70 
71 # ifdef HAVE_CONFIG_H
72 
73 # include <config.h>
74 # ifdef HAVE_STDINT_H
75 # include <stdint.h>
76 # endif
77 # ifdef HAVE_INTTYPES_H
78 # include <inttypes.h>
79 # endif
80 
81 # else
82 
83 // assume that the headers are there inside LibreOffice build when no HAVE_CONFIG_H is defined
84 # include <stdint.h>
85 # include <inttypes.h>
86 
87 # endif
88 
89 #endif /* _MSC_VER || __DJGPP__ */
90 
91 // define gmtime_r and localtime_r on Windows, so that can use
92 // thread-safe functions on other environments
93 #ifdef _WIN32
94 # define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
95 # define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0)
96 #endif
97 
98 /* ---------- memory --------------- */
100 template <class T>
102  void operator()(T *) {}
103 };
104 
105 #if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
106 # define LIBMWAW_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg)))
107 #else
108 # define LIBMWAW_ATTRIBUTE_PRINTF(fmt, arg)
109 #endif
110 
111 #define MWAW_N_ELEMENTS(m) sizeof(m)/sizeof(m[0])
112 
113 #if defined(HAVE_CLANG_ATTRIBUTE_FALLTHROUGH)
114 # define MWAW_FALLTHROUGH [[clang::fallthrough]]
115 #elif defined(HAVE_GCC_ATTRIBUTE_FALLTHROUGH)
116 # define MWAW_FALLTHROUGH __attribute__((fallthrough))
117 #else
118 # define MWAW_FALLTHROUGH ((void) 0)
119 #endif
120 
121 /* ---------- debug --------------- */
122 #ifdef DEBUG
123 namespace libmwaw
124 {
125 void printDebugMsg(const char *format, ...) LIBMWAW_ATTRIBUTE_PRINTF(1,2);
126 }
127 #define MWAW_DEBUG_MSG(M) libmwaw::printDebugMsg M
128 #else
129 #define MWAW_DEBUG_MSG(M)
130 #endif
131 
132 namespace libmwaw
133 {
134 // Various exceptions:
136 {
137 };
138 
140 {
141 };
142 
144 {
145 };
146 
148 {
149 };
150 
152 {
153 };
154 }
155 
156 /* ---------- input ----------------- */
157 namespace libmwaw
158 {
159 uint8_t readU8(librevenge::RVNGInputStream *input);
161 void appendUnicode(uint32_t val, librevenge::RVNGString &buffer);
162 
164 template<typename T>
165 bool checkAddOverflow(T x, T y)
166 {
167  return (x < 0 && y < std::numeric_limits<T>::lowest() - x)
168  || (x > 0 && y > std::numeric_limits<T>::max() - x);
169 }
170 }
171 
172 /* ---------- small enum/class ------------- */
173 namespace libmwaw
174 {
176 enum Position { Left = 0, Right = 1, Top = 2, Bottom = 3, HMiddle = 4, VMiddle = 5 };
178 enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08, HMiddleBit = 0x10, VMiddleBit = 0x20 };
179 
181 std::string numberingTypeToString(NumberingType type);
182 std::string numberingValueToString(NumberingType type, int value);
183 
187 std::string writingModeToString(WritingMode mode);
189 }
190 
192 struct MWAWColor {
194  explicit MWAWColor(uint32_t argb=0)
195  : m_value(argb)
196  {
197  }
199  MWAWColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
200  : m_value(uint32_t((a<<24)+(r<<16)+(g<<8)+b))
201  {
202  }
204  MWAWColor(MWAWColor const &) = default;
206  MWAWColor(MWAWColor &&) = default;
208  MWAWColor &operator=(MWAWColor const &) = default;
210  MWAWColor &operator=(MWAWColor &&) = default;
212  MWAWColor &operator=(uint32_t argb)
213  {
214  m_value = argb;
215  return *this;
216  }
218  static MWAWColor colorFromCMYK(unsigned char c, unsigned char m, unsigned char y, unsigned char k)
219  {
220  double w=1.-static_cast<double>(k)/255.;
221  return MWAWColor
222  (static_cast<unsigned char>(255 * (1-static_cast<double>(c)/255) * w),
223  static_cast<unsigned char>(255 * (1-static_cast<double>(m)/255) * w),
224  static_cast<unsigned char>(255 * (1-static_cast<double>(y)/255) * w)
225  );
226  }
228  static MWAWColor colorFromHSL(unsigned char H, unsigned char S, unsigned char L)
229  {
230  double c=(1-((L>=128) ? (2*static_cast<double>(L)-255) : (255-2*static_cast<double>(L)))/255)*
231  static_cast<double>(S)/255;
232  double tmp=std::fmod((static_cast<double>(H)*6/255),2)-1;
233  double x=c*(1-(tmp>0 ? tmp : -tmp));
234  auto C=static_cast<unsigned char>(255*c);
235  auto M=static_cast<unsigned char>(static_cast<double>(L)-255*c/2);
236  auto X=static_cast<unsigned char>(255*x);
237  if (H<=42) return MWAWColor(static_cast<unsigned char>(M+C),static_cast<unsigned char>(M+X),static_cast<unsigned char>(M));
238  if (H<=85) return MWAWColor(static_cast<unsigned char>(M+X),static_cast<unsigned char>(M+C),static_cast<unsigned char>(M));
239  if (H<=127) return MWAWColor(static_cast<unsigned char>(M),static_cast<unsigned char>(M+C),static_cast<unsigned char>(M+X));
240  if (H<=170) return MWAWColor(static_cast<unsigned char>(M),static_cast<unsigned char>(M+X),static_cast<unsigned char>(M+C));
241  if (H<=212) return MWAWColor(static_cast<unsigned char>(M+X),static_cast<unsigned char>(M),static_cast<unsigned char>(M+C));
242  return MWAWColor(static_cast<unsigned char>(M+C),static_cast<unsigned char>(M),static_cast<unsigned char>(M+X));
243  }
245  static MWAWColor black()
246  {
247  return MWAWColor(0,0,0);
248  }
250  static MWAWColor white()
251  {
252  return MWAWColor(255,255,255);
253  }
254 
256  static MWAWColor barycenter(float alpha, MWAWColor const &colA,
257  float beta, MWAWColor const &colB);
259  uint32_t value() const
260  {
261  return m_value;
262  }
264  unsigned char getAlpha() const
265  {
266  return static_cast<unsigned char>((m_value>>24)&0xFF);
267  }
269  unsigned char getBlue() const
270  {
271  return static_cast<unsigned char>(m_value&0xFF);
272  }
274  unsigned char getRed() const
275  {
276  return static_cast<unsigned char>((m_value>>16)&0xFF);
277  }
279  unsigned char getGreen() const
280  {
281  return static_cast<unsigned char>((m_value>>8)&0xFF);
282  }
284  bool isBlack() const
285  {
286  return (m_value&0xFFFFFF)==0;
287  }
289  bool isWhite() const
290  {
291  return (m_value&0xFFFFFF)==0xFFFFFF;
292  }
294  bool operator==(MWAWColor const &c) const
295  {
296  return (c.m_value&0xFFFFFF)==(m_value&0xFFFFFF);
297  }
299  bool operator!=(MWAWColor const &c) const
300  {
301  return !operator==(c);
302  }
304  bool operator<(MWAWColor const &c) const
305  {
306  return (c.m_value&0xFFFFFF)<(m_value&0xFFFFFF);
307  }
309  bool operator<=(MWAWColor const &c) const
310  {
311  return (c.m_value&0xFFFFFF)<=(m_value&0xFFFFFF);
312  }
314  bool operator>(MWAWColor const &c) const
315  {
316  return !operator<=(c);
317  }
319  bool operator>=(MWAWColor const &c) const
320  {
321  return !operator<(c);
322  }
324  friend std::ostream &operator<< (std::ostream &o, MWAWColor const &c);
326  std::string str() const;
327 protected:
329  uint32_t m_value;
330 };
331 
333 struct MWAWBorder {
337  enum Type { Single, Double, Triple };
338 
341  : m_style(Simple)
342  , m_type(Single)
343  , m_width(1)
344  , m_widthsList()
345  , m_color(MWAWColor::black())
346  , m_extra("") { }
347  MWAWBorder(MWAWBorder const &) = default;
348  MWAWBorder(MWAWBorder &&) = default;
349  MWAWBorder &operator=(MWAWBorder const &) = default;
350  MWAWBorder &operator=(MWAWBorder &&) = default;
354  bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const;
356  bool isEmpty() const
357  {
358  return m_style==None || m_width <= 0;
359  }
361  bool operator==(MWAWBorder const &orig) const
362  {
363  return !operator!=(orig);
364  }
366  bool operator!=(MWAWBorder const &orig) const
367  {
368  return m_style != orig.m_style || m_type != orig.m_type ||
369  m_width < orig.m_width || m_width > orig.m_width || m_color != orig.m_color ||
370  m_widthsList != orig.m_widthsList;
371  }
373  int compare(MWAWBorder const &orig) const;
374 
376  friend std::ostream &operator<< (std::ostream &o, MWAWBorder const &border);
378  friend std::ostream &operator<< (std::ostream &o, MWAWBorder::Style const &style);
381 
382  // multiple borders
383 
387  double m_width;
391  std::vector<double> m_widthsList;
395  std::string m_extra;
396 };
397 
399 struct MWAWField {
402 
404  explicit MWAWField(Type type)
405  : m_type(type)
407  , m_DTFormat("")
408  , m_data("")
409  {
410  }
411  MWAWField(MWAWField &&) = default;
412  MWAWField(MWAWField const &) = default;
413  MWAWField &operator=(MWAWField const &) = default;
414  MWAWField &operator=(MWAWField &&) = default;
416  bool addTo(librevenge::RVNGPropertyList &propList) const;
418  librevenge::RVNGString getString() const;
424  std::string m_DTFormat;
426  std::string m_data;
427 };
428 
430 struct MWAWLink {
433  : m_HRef("")
434  {
435  }
436 
438  bool addTo(librevenge::RVNGPropertyList &propList) const;
439 
441  std::string m_HRef;
442 };
443 
445 struct MWAWNote {
447  enum Type { FootNote, EndNote };
449  explicit MWAWNote(Type type)
450  : m_type(type)
451  , m_label("")
452  , m_number(-1)
453  {
454  }
458  librevenge::RVNGString m_label;
460  int m_number;
461 };
462 
470  : m_dataList()
471  , m_typeList()
472  {
473  }
475  MWAWEmbeddedObject(librevenge::RVNGBinaryData const &binaryData,
476  std::string const &type="image/pict") : m_dataList(), m_typeList()
477  {
478  add(binaryData, type);
479  }
483  bool isEmpty() const
484  {
485  for (auto const &data : m_dataList) {
486  if (!data.empty())
487  return false;
488  }
489  return true;
490  }
492  void add(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
493  {
494  size_t pos=m_dataList.size();
495  if (pos<m_typeList.size()) pos=m_typeList.size();
496  m_dataList.resize(pos+1);
497  m_dataList[pos]=binaryData;
498  m_typeList.resize(pos+1);
499  m_typeList[pos]=type;
500  }
502  bool addTo(librevenge::RVNGPropertyList &propList) const;
504  friend std::ostream &operator<<(std::ostream &o, MWAWEmbeddedObject const &pict);
506  int cmp(MWAWEmbeddedObject const &pict) const;
507 
509  std::vector<librevenge::RVNGBinaryData> m_dataList;
511  std::vector<std::string> m_typeList;
512 };
513 
514 // forward declarations of basic classes and smart pointers
515 class MWAWEntry;
516 class MWAWFont;
517 class MWAWGraphicEncoder;
518 class MWAWGraphicShape;
519 class MWAWGraphicStyle;
520 class MWAWHeader;
521 class MWAWList;
522 class MWAWPageSpan;
523 class MWAWParagraph;
524 class MWAWParser;
525 class MWAWPosition;
526 class MWAWSection;
527 
528 class MWAWFontConverter;
529 class MWAWFontManager;
530 class MWAWGraphicListener;
531 class MWAWInputStream;
532 class MWAWListener;
533 class MWAWListManager;
534 class MWAWParserState;
536 class MWAWRSRCParser;
538 class MWAWSubDocument;
541 typedef std::shared_ptr<MWAWFontConverter> MWAWFontConverterPtr;
543 typedef std::shared_ptr<MWAWFontManager> MWAWFontManagerPtr;
545 typedef std::shared_ptr<MWAWGraphicListener> MWAWGraphicListenerPtr;
547 typedef std::shared_ptr<MWAWInputStream> MWAWInputStreamPtr;
549 typedef std::shared_ptr<MWAWListener> MWAWListenerPtr;
551 typedef std::shared_ptr<MWAWListManager> MWAWListManagerPtr;
553 typedef std::shared_ptr<MWAWParserState> MWAWParserStatePtr;
555 typedef std::shared_ptr<MWAWPresentationListener> MWAWPresentationListenerPtr;
557 typedef std::shared_ptr<MWAWRSRCParser> MWAWRSRCParserPtr;
559 typedef std::shared_ptr<MWAWSpreadsheetListener> MWAWSpreadsheetListenerPtr;
561 typedef std::shared_ptr<MWAWSubDocument> MWAWSubDocumentPtr;
563 typedef std::shared_ptr<MWAWTextListener> MWAWTextListenerPtr;
564 
573 template <class T> struct MWAWVariable {
576  : m_data()
577  , m_set(false) {}
579  explicit MWAWVariable(T const &def)
580  : m_data(def)
581  , m_set(false) {}
584  : m_data(orig.m_data)
585  , m_set(orig.m_set) {}
587  MWAWVariable &operator=(MWAWVariable const &) = default;
589  MWAWVariable &operator=(T const &val)
590  {
591  m_data = val;
592  m_set = true;
593  return std::forward<MWAWVariable &>(*this);
594  }
596  void insert(MWAWVariable const &orig)
597  {
598  if (orig.m_set) {
599  m_data = orig.m_data;
600  m_set = orig.m_set;
601  }
602  }
604  T const *operator->() const
605  {
606  return &m_data;
607  }
610  {
611  m_set = true;
612  return &m_data;
613  }
615  T const &operator*() const
616  {
617  return m_data;
618  }
621  {
622  m_set = true;
623  return m_data;
624  }
626  T const &get() const
627  {
628  return m_data;
629  }
631  bool isSet() const
632  {
633  return m_set;
634  }
636  void setSet(bool newVal)
637  {
638  m_set=newVal;
639  }
640 protected:
644  bool m_set;
645 };
646 
647 /* ---------- vec2/box2f ------------- */
651 template <class T> class MWAWVec2
652 {
653 public:
655  explicit MWAWVec2(T xx=0,T yy=0)
656  : m_x(xx)
657  , m_y(yy) { }
659  template <class U> explicit MWAWVec2(MWAWVec2<U> const &p)
660  : m_x(T(p.x()))
661  , m_y(T(p.y())) {}
662 
664  T x() const
665  {
666  return m_x;
667  }
669  T y() const
670  {
671  return m_y;
672  }
674  T operator[](int c) const
675  {
676  if (c<0 || c>1) throw libmwaw::GenericException();
677  return (c==0) ? m_x : m_y;
678  }
680  T &operator[](int c)
681  {
682  if (c<0 || c>1) throw libmwaw::GenericException();
683  return (c==0) ? m_x : m_y;
684  }
685 
687  void set(T xx, T yy)
688  {
689  m_x = xx;
690  m_y = yy;
691  }
693  void setX(T xx)
694  {
695  m_x = xx;
696  }
698  void setY(T yy)
699  {
700  m_y = yy;
701  }
702 
704  void add(T dx, T dy)
705  {
708  m_x += dx;
709  m_y += dy;
710  }
711 
714  {
715  add(p.m_x, p.m_y);
716  return *this;
717  }
720  {
721  // check if negation of either of the coords will cause overflow
722  const T diff = std::numeric_limits<T>::min() + std::numeric_limits<T>::max();
725  add(-p.m_x, -p.m_y);
726  return *this;
727  }
729  template <class U>
731  {
732  m_x = T(m_x*scale);
733  m_y = T(m_y*scale);
734  return *this;
735  }
736 
738  friend MWAWVec2<T> operator+(MWAWVec2<T> const &p1, MWAWVec2<T> const &p2)
739  {
740  MWAWVec2<T> p(p1);
741  return p+=p2;
742  }
744  friend MWAWVec2<T> operator-(MWAWVec2<T> const &p1, MWAWVec2<T> const &p2)
745  {
746  MWAWVec2<T> p(p1);
747  return p-=p2;
748  }
750  template <class U>
751  friend MWAWVec2<T> operator*(U scale, MWAWVec2<T> const &p1)
752  {
753  MWAWVec2<T> p(p1);
754  return p *= scale;
755  }
756 
758  bool operator==(MWAWVec2<T> const &p) const
759  {
760  return cmpY(p) == 0;
761  }
763  bool operator!=(MWAWVec2<T> const &p) const
764  {
765  return cmpY(p) != 0;
766  }
768  bool operator<(MWAWVec2<T> const &p) const
769  {
770  return cmpY(p) < 0;
771  }
773  int cmp(MWAWVec2<T> const &p) const
774  {
775  if (m_x < p.m_x) return -1;
776  if (m_x > p.m_x) return 1;
777  if (m_y < p.m_y) return -1;
778  if (m_y > p.m_y) return 1;
779  return 0;
780  }
782  int cmpY(MWAWVec2<T> const &p) const
783  {
784  if (m_y < p.m_y) return -1;
785  if (m_y > p.m_y) return 1;
786  if (m_x < p.m_x) return -1;
787  if (m_x > p.m_x) return 1;
788  return 0;
789  }
790 
792  friend std::ostream &operator<< (std::ostream &o, MWAWVec2<T> const &f)
793  {
794  o << f.m_x << "x" << f.m_y;
795  return o;
796  }
797 
801  struct PosSizeLtX {
803  bool operator()(MWAWVec2<T> const &s1, MWAWVec2<T> const &s2) const
804  {
805  return s1.cmp(s2) < 0;
806  }
807  };
811  typedef std::map<MWAWVec2<T>, T,struct PosSizeLtX> MapX;
812 
816  struct PosSizeLtY {
818  bool operator()(MWAWVec2<T> const &s1, MWAWVec2<T> const &s2) const
819  {
820  return s1.cmpY(s2) < 0;
821  }
822  };
826  typedef std::map<MWAWVec2<T>, T,struct PosSizeLtY> MapY;
827 protected:
828  T m_x, m_y;
829 };
830 
839 
843 template <class T> class MWAWVec3
844 {
845 public:
847  explicit MWAWVec3(T xx=0,T yy=0,T zz=0)
848  {
849  m_val[0] = xx;
850  m_val[1] = yy;
851  m_val[2] = zz;
852  }
854  template <class U> explicit MWAWVec3(MWAWVec3<U> const &p)
855  {
856  for (int c = 0; c < 3; c++) m_val[c] = T(p[c]);
857  }
858 
860  T x() const
861  {
862  return m_val[0];
863  }
865  T y() const
866  {
867  return m_val[1];
868  }
870  T z() const
871  {
872  return m_val[2];
873  }
875  T operator[](int c) const
876  {
877  if (c<0 || c>2) throw libmwaw::GenericException();
878  return m_val[c];
879  }
881  T &operator[](int c)
882  {
883  if (c<0 || c>2) throw libmwaw::GenericException();
884  return m_val[c];
885  }
886 
888  void set(T xx, T yy, T zz)
889  {
890  m_val[0] = xx;
891  m_val[1] = yy;
892  m_val[2] = zz;
893  }
895  void setX(T xx)
896  {
897  m_val[0] = xx;
898  }
900  void setY(T yy)
901  {
902  m_val[1] = yy;
903  }
905  void setZ(T zz)
906  {
907  m_val[2] = zz;
908  }
909 
911  void add(T dx, T dy, T dz)
912  {
913  m_val[0] += dx;
914  m_val[1] += dy;
915  m_val[2] += dz;
916  }
917 
920  {
921  for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]);
922  return *this;
923  }
926  {
927  for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]-p.m_val[c]);
928  return *this;
929  }
931  template <class U>
933  {
934  for (auto &c : m_val) c = T(c*scale);
935  return *this;
936  }
937 
939  friend MWAWVec3<T> operator+(MWAWVec3<T> const &p1, MWAWVec3<T> const &p2)
940  {
941  MWAWVec3<T> p(p1);
942  return p+=p2;
943  }
945  friend MWAWVec3<T> operator-(MWAWVec3<T> const &p1, MWAWVec3<T> const &p2)
946  {
947  MWAWVec3<T> p(p1);
948  return p-=p2;
949  }
951  template <class U>
952  friend MWAWVec3<T> operator*(U scale, MWAWVec3<T> const &p1)
953  {
954  MWAWVec3<T> p(p1);
955  return p *= scale;
956  }
957 
959  bool operator==(MWAWVec3<T> const &p) const
960  {
961  return cmp(p) == 0;
962  }
964  bool operator!=(MWAWVec3<T> const &p) const
965  {
966  return cmp(p) != 0;
967  }
969  bool operator<(MWAWVec3<T> const &p) const
970  {
971  return cmp(p) < 0;
972  }
974  int cmp(MWAWVec3<T> const &p) const
975  {
976  for (int c = 0; c < 3; c++) {
977  if (m_val[c]<p.m_val[c]) return -1;
978  if (m_val[c]>p.m_val[c]) return 1;
979  }
980  return 0;
981  }
982 
984  friend std::ostream &operator<< (std::ostream &o, MWAWVec3<T> const &f)
985  {
986  o << f.m_val[0] << "x" << f.m_val[1] << "x" << f.m_val[2];
987  return o;
988  }
989 
993  struct PosSizeLt {
995  bool operator()(MWAWVec3<T> const &s1, MWAWVec3<T> const &s2) const
996  {
997  return s1.cmp(s2) < 0;
998  }
999  };
1003  typedef std::map<MWAWVec3<T>, T,struct PosSizeLt> Map;
1004 
1005 protected:
1007  T m_val[3];
1008 };
1009 
1016 
1020 template <class T> class MWAWBox2
1021 {
1022 public:
1025  : m_data(minPt, maxPt)
1026  {
1027  }
1029  template <class U> explicit MWAWBox2(MWAWBox2<U> const &p)
1030  : m_data(MWAWVec2<T>(p.min()), MWAWVec2<T>(p.max()))
1031  {
1032  }
1033 
1035  MWAWVec2<T> const &min() const
1036  {
1037  return m_data.first;
1038  }
1040  MWAWVec2<T> const &max() const
1041  {
1042  return m_data.second;
1043  }
1046  {
1047  return m_data.first;
1048  }
1051  {
1052  return m_data.second;
1053  }
1057  MWAWVec2<T> const &operator[](int c) const
1058  {
1059  if (c<0 || c>1) throw libmwaw::GenericException();
1060  return c==0 ? m_data.first : m_data.second;
1061  }
1064  {
1065  return m_data.second-m_data.first;
1066  }
1069  {
1070  return MWAWVec2<T>((m_data.first.x()+m_data.second.x())/2,
1071  (m_data.first.y()+m_data.second.y())/2);
1072  }
1073 
1075  void set(MWAWVec2<T> const &x, MWAWVec2<T> const &y)
1076  {
1077  m_data.first = x;
1078  m_data.second = y;
1079  }
1081  void setMin(MWAWVec2<T> const &x)
1082  {
1083  m_data.first = x;
1084  }
1086  void setMax(MWAWVec2<T> const &y)
1087  {
1088  m_data.second = y;
1089  }
1090 
1092  void resizeFromMin(MWAWVec2<T> const &sz)
1093  {
1094  m_data.second = m_data.first+sz;
1095  }
1097  void resizeFromMax(MWAWVec2<T> const &sz)
1098  {
1099  m_data.first = m_data.second-sz;
1100  }
1103  {
1104  MWAWVec2<T> centerPt = center();
1105  MWAWVec2<T> decal(sz.x()/2,sz.y()/2);
1106  m_data.first = centerPt - decal;
1107  m_data.second = centerPt + (sz - decal);
1108  }
1109 
1111  template <class U> void scale(U factor)
1112  {
1113  m_data.first *= factor;
1114  m_data.second *= factor;
1115  }
1116 
1118  void extend(T val)
1119  {
1120  m_data.first -= MWAWVec2<T>(val/2,val/2);
1121  m_data.second += MWAWVec2<T>(val-(val/2),val-(val/2));
1122  }
1123 
1126  {
1127  MWAWBox2<T> res;
1128  res.m_data.first=MWAWVec2<T>(m_data.first[0]<box.m_data.first[0]?m_data.first[0] : box.m_data.first[0],
1129  m_data.first[1]<box.m_data.first[1]?m_data.first[1] : box.m_data.first[1]);
1130  res.m_data.second=MWAWVec2<T>(m_data.second[0]>box.m_data.second[0]?m_data.second[0] : box.m_data.second[0],
1131  m_data.second[1]>box.m_data.second[1]?m_data.second[1] : box.m_data.second[1]);
1132  return res;
1133  }
1136  {
1137  MWAWBox2<T> res;
1138  res.m_data.first=MWAWVec2<T>(m_data.first[0]>box.m_data.first[0]?m_data.first[0] : box.m_data.first[0],
1139  m_data.first[1]>box.m_data.first[1]?m_data.first[1] : box.m_data.first[1]);
1140  res.m_data.second=MWAWVec2<T>(m_data.second[0]<box.m_data.second[0]?m_data.second[0] : box.m_data.second[0],
1141  m_data.second[1]<box.m_data.second[1]?m_data.second[1] : box.m_data.second[1]);
1142  return res;
1143  }
1145  bool operator==(MWAWBox2<T> const &mat) const
1146  {
1147  return m_data==mat.m_data;
1148  }
1150  bool operator!=(MWAWBox2<T> const &mat) const
1151  {
1152  return m_data!=mat.m_data;
1153  }
1155  bool operator<(MWAWBox2<T> const &mat) const
1156  {
1157  return m_data<mat.m_data;
1158  }
1160  bool operator<=(MWAWBox2<T> const &mat) const
1161  {
1162  return m_data<=mat.m_data;
1163  }
1165  bool operator>(MWAWBox2<T> const &mat) const
1166  {
1167  return m_data>mat.m_data;
1168  }
1170  bool operator>=(MWAWBox2<T> const &mat) const
1171  {
1172  return m_data>=mat.m_data;
1173  }
1175  friend std::ostream &operator<< (std::ostream &o, MWAWBox2<T> const &f)
1176  {
1177  o << "(" << f.min() << "<->" << f.max() << ")";
1178  return o;
1179  }
1180 
1181 protected:
1183  std::pair<MWAWVec2<T>, MWAWVec2<T> > m_data;
1184 };
1185 
1192 
1195 {
1196 public:
1198  explicit MWAWTransformation(MWAWVec3f const &xRow=MWAWVec3f(1,0,0), MWAWVec3f const &yRow=MWAWVec3f(0,1,0))
1199  : m_data(xRow, yRow)
1200  , m_isIdentity(false)
1201  {
1202  checkIdentity();
1203  }
1205  bool isIdentity() const
1206  {
1207  return m_isIdentity;
1208  }
1210  void checkIdentity() const
1211  {
1212  m_isIdentity= m_data.first==MWAWVec3f(1,0,0) && m_data.second==MWAWVec3f(0,1,0);
1213  }
1217  MWAWVec3f const &operator[](int c) const
1218  {
1219  if (c<0 || c>1) throw libmwaw::GenericException();
1220  return c==0 ? m_data.first : m_data.second;
1221  }
1223  MWAWVec2f operator*(MWAWVec2f const &pt) const
1224  {
1225  if (m_isIdentity) return pt;
1226  return multiplyDirection(pt)+MWAWVec2f(m_data.first[2],m_data.second[2]);
1227  }
1230  {
1231  if (m_isIdentity) return dir;
1232  MWAWVec2f res;
1233  for (int coord=0; coord<2; ++coord) {
1234  MWAWVec3f const &row=coord==0 ? m_data.first : m_data.second;
1235  float value=0;
1236  for (int i=0; i<2; ++i)
1237  value+=row[i]*dir[i];
1238  res[coord]=value;
1239  }
1240  return res;
1241  }
1243  MWAWBox2f operator*(MWAWBox2f const &box) const
1244  {
1245  if (m_isIdentity) return box;
1246  return MWAWBox2f(operator*(box.min()), operator*(box.max()));
1247  }
1250  {
1251  if (mat.m_isIdentity) return *this;
1252  MWAWTransformation res;
1253  for (int row=0; row<2; ++row) {
1254  MWAWVec3f &resRow=row==0 ? res.m_data.first : res.m_data.second;
1255  for (int col=0; col<3; ++col) {
1256  float value=0;
1257  for (int i=0; i<3; ++i)
1258  value+=(*this)[row][i]*(i==2 ? (col==2 ? 1.f : 0.f) : mat[i][col]);
1259  resRow[col]=value;
1260  }
1261  }
1262  res.checkIdentity();
1263  return res;
1264  }
1267  {
1268  if (!mat.m_isIdentity)
1269  *this=(*this)*mat;
1270  return *this;
1271  }
1273  bool operator==(MWAWTransformation const &mat) const
1274  {
1275  return m_data==mat.m_data;
1276  }
1278  bool operator!=(MWAWTransformation const &mat) const
1279  {
1280  return m_data!=mat.m_data;
1281  }
1283  bool operator<(MWAWTransformation const &mat) const
1284  {
1285  return m_data<mat.m_data;
1286  }
1288  bool operator<=(MWAWTransformation const &mat) const
1289  {
1290  return m_data<=mat.m_data;
1291  }
1293  bool operator>(MWAWTransformation const &mat) const
1294  {
1295  return m_data>mat.m_data;
1296  }
1298  bool operator>=(MWAWTransformation const &mat) const
1299  {
1300  return m_data>=mat.m_data;
1301  }
1305  bool decompose(float &rotation, MWAWVec2f &shearing, MWAWTransformation &transform, MWAWVec2f const &center) const;
1306 
1309  {
1310  return MWAWTransformation(MWAWVec3f(1, 0, trans[0]), MWAWVec3f(0, 1, trans[1]));
1311  }
1313  static MWAWTransformation scale(MWAWVec2f const &trans)
1314  {
1315  return MWAWTransformation(MWAWVec3f(trans[0], 0, 0), MWAWVec3f(0, trans[1], 0));
1316  }
1320  static MWAWTransformation rotation(float angle, MWAWVec2f const &center=MWAWVec2f(0,0));
1324  static MWAWTransformation shear(MWAWVec2f s, MWAWVec2f const &center=MWAWVec2f(0,0))
1325  {
1326  return MWAWTransformation(MWAWVec3f(1, s[0], -s[0]*center[1]), MWAWVec3f(s[1], 1, -s[1]*center[0]));
1327  }
1328 protected:
1330  std::pair<MWAWVec3f, MWAWVec3f > m_data;
1332  mutable bool m_isIdentity;
1333 };
1334 
1335 // some format function
1336 namespace libmwaw
1337 {
1339 bool convertDTFormat(std::string const &dtFormat, librevenge::RVNGPropertyListVector &propVect);
1340 }
1341 
1342 // some geometrical function
1343 namespace libmwaw
1344 {
1346 MWAWVec2f rotatePointAroundCenter(MWAWVec2f const &point, MWAWVec2f const &center, float angle);
1348 MWAWBox2f rotateBoxFromCenter(MWAWBox2f const &box, float angle);
1349 }
1350 #endif /* LIBMWAW_INTERNAL_H */
1351 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
T z() const
third element
Definition: libmwaw_internal.hxx:870
void add(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
add a picture
Definition: libmwaw_internal.hxx:492
std::shared_ptr< MWAWTextListener > MWAWTextListenerPtr
a smart pointer of MWAWTextListener
Definition: libmwaw_internal.hxx:563
void setY(T yy)
resets the second element
Definition: libmwaw_internal.hxx:698
Definition: libmwaw_internal.hxx:337
int m_number
the note number if defined
Definition: libmwaw_internal.hxx:460
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
MWAWVec3< T > & operator*=(U scale)
generic operator*=
Definition: libmwaw_internal.hxx:932
NumberingType
Definition: libmwaw_internal.hxx:180
bool operator<(MWAWColor const &c) const
operator<
Definition: libmwaw_internal.hxx:304
MWAWVec2< T > & operator-=(MWAWVec2< T > const &p)
operator-=
Definition: libmwaw_internal.hxx:719
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer)
adds an unicode character to a string
Definition: libmwaw_internal.cxx:63
Definition: libmwaw_internal.hxx:188
MWAWColor & operator=(uint32_t argb)
operator=
Definition: libmwaw_internal.hxx:212
Definition: libmwaw_internal.hxx:180
Definition: libmwaw_internal.hxx:335
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:553
Definition: libmwaw_internal.hxx:180
MWAWVec3< int > MWAWVec3i
MWAWVec3 of int.
Definition: libmwaw_internal.hxx:1013
std::map< MWAWVec2< bool >, bool, struct PosSizeLtX > MapX
map of MWAWVec2
Definition: libmwaw_internal.hxx:811
MWAWVec2f multiplyDirection(MWAWVec2f const &dir) const
operator* for direction
Definition: libmwaw_internal.hxx:1229
T y() const
second element
Definition: libmwaw_internal.hxx:669
Definition: libmwaw_internal.hxx:188
Definition: libmwaw_internal.hxx:180
std::string m_data
the database/link field ( if defined )
Definition: libmwaw_internal.hxx:426
MWAWVariable & operator=(MWAWVariable const &)=default
copy operator
Definition: libmwaw_internal.hxx:401
int cmp(MWAWEmbeddedObject const &pict) const
a comparison function
Definition: libmwaw_internal.cxx:598
a font manager which can be used to store fonts, ...
Definition: MWAWFont.hxx:582
unsigned char getRed() const
returns the red value
Definition: libmwaw_internal.hxx:274
This class contains code needed to write a presention document.
Definition: MWAWPresentationListener.hxx:59
Type m_type
the border repetition
Definition: libmwaw_internal.hxx:385
Definition: libmwaw_internal.hxx:178
A class which defines the page properties.
Definition: MWAWPageSpan.hxx:95
bool isEmpty() const
returns true if the border is empty
Definition: libmwaw_internal.hxx:356
static MWAWTransformation translation(MWAWVec2f const &trans)
returns a translation transformation
Definition: libmwaw_internal.hxx:1308
MWAWBox2f rotateBoxFromCenter(MWAWBox2f const &box, float angle)
rotate a bdox and returns the final bdbox, angle is given in degree
Definition: libmwaw_internal.cxx:700
T & operator*()
operator*
Definition: libmwaw_internal.hxx:620
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition: libmwaw_internal.hxx:509
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:549
bool isWhite() const
return true if the color is white
Definition: libmwaw_internal.hxx:289
Definition: libmwaw_internal.hxx:188
This class contents the main functions needed to create a Word processing Document.
Definition: MWAWTextListener.hxx:64
bool isBlack() const
return true if the color is black
Definition: libmwaw_internal.hxx:284
Definition: libmwaw_internal.hxx:401
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:250
MWAWNote(Type type)
constructor
Definition: libmwaw_internal.hxx:449
MWAWVec2(T xx=0, T yy=0)
constructor
Definition: libmwaw_internal.hxx:655
Definition: libmwaw_internal.hxx:188
std::string numberingValueToString(NumberingType type, int value)
Definition: libmwaw_internal.cxx:130
std::shared_ptr< MWAWSpreadsheetListener > MWAWSpreadsheetListenerPtr
a smart pointer of MWAWSpreadsheetListener
Definition: libmwaw_internal.hxx:559
int compare(MWAWBorder const &orig) const
compare two borders
Definition: libmwaw_internal.cxx:424
T m_data
the value
Definition: libmwaw_internal.hxx:642
bool operator!=(MWAWVec3< T > const &p) const
comparison!=
Definition: libmwaw_internal.hxx:964
bool convertDTFormat(std::string const &dtFormat, librevenge::RVNGPropertyListVector &propVect)
convert a DTFormat in a propertyList
Definition: libmwaw_internal.cxx:316
Definition: libmwaw_internal.hxx:178
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition: libmwaw_internal.hxx:1118
T * operator->()
operator*
Definition: libmwaw_internal.hxx:609
MWAWTransformation(MWAWVec3f const &xRow=MWAWVec3f(1, 0, 0), MWAWVec3f const &yRow=MWAWVec3f(0, 1, 0))
constructor
Definition: libmwaw_internal.hxx:1198
MWAWColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition: libmwaw_internal.hxx:199
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition: libmwaw_internal.hxx:911
MWAWVec2f operator*(MWAWVec2f const &pt) const
operator* for vec2f
Definition: libmwaw_internal.hxx:1223
Definition: libmwaw_internal.hxx:401
Definition: libmwaw_internal.hxx:188
MWAWVariable(T const &def)
constructor with a default value
Definition: libmwaw_internal.hxx:579
void resizeFromMax(MWAWVec2< T > const &sz)
resize the box keeping the maximum
Definition: libmwaw_internal.hxx:1097
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:245
bool m_isIdentity
flag to know if this matrix is an identity matrix
Definition: libmwaw_internal.hxx:1332
std::map< MWAWVec3< int >, int, struct PosSizeLt > Map
map of MWAWVec3
Definition: libmwaw_internal.hxx:1003
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
bool operator==(MWAWBox2< T > const &mat) const
operator==
Definition: libmwaw_internal.hxx:1145
MWAWVec2< T > center() const
the box center
Definition: libmwaw_internal.hxx:1068
MWAWVec3< T > & operator-=(MWAWVec3< T > const &p)
operator-=
Definition: libmwaw_internal.hxx:925
void insert(MWAWVariable const &orig)
update the current value if orig is set
Definition: libmwaw_internal.hxx:596
This class contains the code needed to create Graphic document.
Definition: MWAWGraphicListener.hxx:59
SubDocumentType
Definition: libmwaw_internal.hxx:188
friend MWAWVec3< T > operator*(U scale, MWAWVec3< T > const &p1)
generic operator*
Definition: libmwaw_internal.hxx:952
static MWAWTransformation shear(MWAWVec2f s, MWAWVec2f const &center=MWAWVec2f(0, 0))
returns a shear transformation letting center invariant, ie.
Definition: libmwaw_internal.hxx:1324
std::shared_ptr< MWAWPresentationListener > MWAWPresentationListenerPtr
a smart pointer of MWAWPresentationListener
Definition: libmwaw_internal.hxx:555
std::string numberingTypeToString(NumberingType type)
Definition: libmwaw_internal.cxx:106
T y() const
second element
Definition: libmwaw_internal.hxx:865
static MWAWTransformation rotation(float angle, MWAWVec2f const &center=MWAWVec2f(0, 0))
returns a rotation transformation around center.
Definition: libmwaw_internal.cxx:638
bool operator>(MWAWTransformation const &mat) const
operator>
Definition: libmwaw_internal.hxx:1293
Definition: libmwaw_internal.hxx:176
MWAWVec2< T > size() const
the box size
Definition: libmwaw_internal.hxx:1063
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:834
double m_width
the border total width in point
Definition: libmwaw_internal.hxx:387
bool operator!=(MWAWTransformation const &mat) const
operator!=
Definition: libmwaw_internal.hxx:1278
Definition: libmwaw_internal.hxx:176
MWAWVec2(MWAWVec2< U > const &p)
generic copy constructor
Definition: libmwaw_internal.hxx:659
T x() const
first element
Definition: libmwaw_internal.hxx:860
friend MWAWVec2< T > operator-(MWAWVec2< T > const &p1, MWAWVec2< T > const &p2)
operator-
Definition: libmwaw_internal.hxx:744
Position
basic position enum
Definition: libmwaw_internal.hxx:176
Definition: libmwaw_internal.hxx:176
MWAWVec2< T > & operator*=(U scale)
generic operator*=
Definition: libmwaw_internal.hxx:730
MWAWBox2< int > MWAWBox2i
MWAWBox2 of int.
Definition: libmwaw_internal.hxx:1187
Type m_type
the note type
Definition: libmwaw_internal.hxx:456
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition: libmwaw_internal.hxx:704
bool operator>(MWAWBox2< T > const &mat) const
operator>
Definition: libmwaw_internal.hxx:1165
Definition: libmwaw_internal.hxx:176
T & operator[](int c)
operator[]
Definition: libmwaw_internal.hxx:680
MWAWVec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:1035
small class which defines a vector with 3 elements
Definition: libmwaw_internal.hxx:843
bool isSet() const
return true if the variable is set
Definition: libmwaw_internal.hxx:631
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition: libmwaw_internal.cxx:50
Definition: libmwaw_internal.hxx:447
Type
the line repetition
Definition: libmwaw_internal.hxx:337
int cmp(MWAWVec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libmwaw_internal.hxx:773
friend std::ostream & operator<<(std::ostream &o, MWAWColor const &c)
operator<< in the form #rrggbb
Definition: libmwaw_internal.cxx:220
Definition: libmwaw_internal.hxx:185
MWAWVec3f const & operator[](int c) const
the two extremum points which defined the box
Definition: libmwaw_internal.hxx:1217
static MWAWColor colorFromCMYK(unsigned char c, unsigned char m, unsigned char y, unsigned char k)
return a color from a cmyk color ( basic)
Definition: libmwaw_internal.hxx:218
friend std::ostream & operator<<(std::ostream &o, MWAWBorder const &border)
operator<<
Definition: libmwaw_internal.cxx:533
the class to store a color
Definition: libmwaw_internal.hxx:192
Definition: libmwaw_internal.hxx:188
MWAWEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
constructor
Definition: libmwaw_internal.hxx:475
Definition: libmwaw_internal.hxx:151
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist (if possible)
Definition: libmwaw_internal.cxx:240
friend MWAWVec3< T > operator-(MWAWVec3< T > const &p1, MWAWVec3< T > const &p2)
operator-
Definition: libmwaw_internal.hxx:945
std::shared_ptr< MWAWGraphicListener > MWAWGraphicListenerPtr
a smart pointer of MWAWGraphicListener
Definition: libmwaw_internal.hxx:545
Definition: libmwaw_internal.hxx:401
MWAWField(Type type)
basic constructor
Definition: libmwaw_internal.hxx:404
bool decompose(float &rotation, MWAWVec2f &shearing, MWAWTransformation &transform, MWAWVec2f const &center) const
try to decompose the matrix in a rotation + scaling/translation matrix.
Definition: libmwaw_internal.cxx:647
T & operator[](int c)
operator[]
Definition: libmwaw_internal.hxx:881
Definition: libmwaw_internal.hxx:176
bool operator<=(MWAWTransformation const &mat) const
operator<=
Definition: libmwaw_internal.hxx:1288
Definition: libmwaw_internal.hxx:185
librevenge::RVNGString m_label
the note label
Definition: libmwaw_internal.hxx:458
Style
the line style
Definition: libmwaw_internal.hxx:335
friend std::ostream & operator<<(std::ostream &o, MWAWEmbeddedObject const &pict)
operator<<
Definition: libmwaw_internal.cxx:623
Definition: libmwaw_internal.hxx:180
T x() const
first element
Definition: libmwaw_internal.hxx:664
MWAWTransformation operator*(MWAWTransformation const &mat) const
operator* for transform
Definition: libmwaw_internal.hxx:1249
Internal class used to read the file stream Internal class used to read the file stream, this class adds some usefull functions to the basic librevenge::RVNGInputStream:
Definition: MWAWInputStream.hxx:53
Type
enum to define note type
Definition: libmwaw_internal.hxx:447
static MWAWTransformation scale(MWAWVec2f const &trans)
returns a scaling transformation
Definition: libmwaw_internal.hxx:1313
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:557
T m_y
second element
Definition: libmwaw_internal.hxx:828
bool operator()(MWAWVec3< T > const &s1, MWAWVec3< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:995
MWAWBorder & operator=(MWAWBorder const &)=default
std::vector< double > m_widthsList
the different length used for each line/sep (if defined)
Definition: libmwaw_internal.hxx:391
MWAWVec2f rotatePointAroundCenter(MWAWVec2f const &point, MWAWVec2f const &center, float angle)
rotate a point around center, angle is given in degree
Definition: libmwaw_internal.cxx:692
Class to store font.
Definition: MWAWFont.hxx:43
a border
Definition: libmwaw_internal.hxx:333
small class which defines a 2D Box
Definition: libmwaw_internal.hxx:1020
Definition: libmwaw_internal.hxx:185
MWAWVariable & operator=(T const &val)
set a value
Definition: libmwaw_internal.hxx:589
MWAWVec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:1045
T m_val[3]
the values
Definition: libmwaw_internal.hxx:1007
a class to define the parser state
Definition: MWAWParser.hxx:49
bool m_set
a flag to know if the variable is set or not
Definition: libmwaw_internal.hxx:644
Definition: libmwaw_internal.hxx:188
bool operator==(MWAWVec3< T > const &p) const
comparison==
Definition: libmwaw_internal.hxx:959
bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const
add the border property to proplist (if needed )
Definition: libmwaw_internal.cxx:436
Definition: libmwaw_internal.hxx:335
Definition: libmwaw_internal.hxx:401
void setX(T xx)
resets the first element
Definition: libmwaw_internal.hxx:693
bool operator>=(MWAWBox2< T > const &mat) const
operator>=
Definition: libmwaw_internal.hxx:1170
Definition: libmwaw_internal.hxx:147
This class contents the main functions needed to create a spreadsheet processing Document.
Definition: MWAWSpreadsheetListener.hxx:65
std::shared_ptr< MWAWFontManager > MWAWFontManagerPtr
a smart pointer of MWAWFontManager
Definition: libmwaw_internal.hxx:543
Type m_type
the type
Definition: libmwaw_internal.hxx:420
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:838
Definition: libmwaw_internal.hxx:180
bool operator==(MWAWColor const &c) const
operator==
Definition: libmwaw_internal.hxx:294
MWAWVec3< float > MWAWVec3f
MWAWVec3 of float.
Definition: libmwaw_internal.hxx:1015
MWAWVec2< T > & operator+=(MWAWVec2< T > const &p)
operator+=
Definition: libmwaw_internal.hxx:713
MWAWBox2(MWAWBox2< U > const &p)
generic constructor
Definition: libmwaw_internal.hxx:1029
MWAWVec2< bool > MWAWVec2b
MWAWVec2 of bool.
Definition: libmwaw_internal.hxx:832
Definition: libmwaw_internal.hxx:180
std::shared_ptr< MWAWListManager > MWAWListManagerPtr
a smart pointer of MWAWListManager
Definition: libmwaw_internal.hxx:551
bool operator>(MWAWColor const &c) const
operator>
Definition: libmwaw_internal.hxx:314
int cmp(MWAWVec3< T > const &p) const
a comparison function: which first compares x values, then y values then z values.
Definition: libmwaw_internal.hxx:974
bool checkAddOverflow(T x, T y)
checks whether addition of x and y would overflow
Definition: libmwaw_internal.hxx:165
bool operator!=(MWAWBox2< T > const &mat) const
operator!=
Definition: libmwaw_internal.hxx:1150
abstract class used to store a subdocument (with a comparison function)
Definition: MWAWSubDocument.hxx:41
MWAWColor & operator=(MWAWColor const &)=default
operator=
bool operator==(MWAWVec2< T > const &p) const
comparison==
Definition: libmwaw_internal.hxx:758
std::pair< MWAWVec3f, MWAWVec3f > m_data
the data
Definition: libmwaw_internal.hxx:1330
Definition: libmwaw_internal.hxx:335
a manager which manages the lists, keeps the different kind of lists, to assure the unicity of each l...
Definition: MWAWList.hxx:212
Definition: libmwaw_internal.hxx:178
internal struct used to create sorted map, sorted by X, Y, Z
Definition: libmwaw_internal.hxx:993
uint32_t value() const
return the rgba value
Definition: libmwaw_internal.hxx:259
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition: libmwaw_internal.hxx:511
void setX(T xx)
resets the first element
Definition: libmwaw_internal.hxx:895
Definition: libmwaw_internal.hxx:143
MWAWColor(uint32_t argb=0)
constructor
Definition: libmwaw_internal.hxx:194
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467
Definition: libmwaw_internal.hxx:337
void resizeFromCenter(MWAWVec2< T > const &sz)
resize the box keeping the center
Definition: libmwaw_internal.hxx:1102
#define LIBMWAW_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libmwaw_internal.hxx:108
Definition: libmwaw_internal.hxx:139
Definition: libmwaw_internal.hxx:188
Definition: libmwaw_internal.hxx:185
unsigned char getGreen() const
returns the green value
Definition: libmwaw_internal.hxx:279
MWAWVec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition: libmwaw_internal.hxx:1057
Definition: libmwaw_internal.hxx:401
static MWAWColor barycenter(float alpha, MWAWColor const &colA, float beta, MWAWColor const &colB)
return alpha*colA+beta*colB
Definition: libmwaw_internal.cxx:206
a class which stores section properties
Definition: MWAWSection.hxx:45
MWAWBox2< T > getUnion(MWAWBox2< T > const &box) const
returns the union between this and box
Definition: libmwaw_internal.hxx:1125
MWAWVec3(MWAWVec3< U > const &p)
generic copy constructor
Definition: libmwaw_internal.hxx:854
bool operator>=(MWAWColor const &c) const
operator>=
Definition: libmwaw_internal.hxx:319
librevenge::RVNGString getString() const
returns a string corresponding to the field (if possible) */
Definition: libmwaw_internal.cxx:288
MWAWEmbeddedObject()
empty constructor
Definition: libmwaw_internal.hxx:469
MWAWBox2(MWAWVec2< T > minPt=MWAWVec2< T >(), MWAWVec2< T > maxPt=MWAWVec2< T >())
constructor
Definition: libmwaw_internal.hxx:1024
friend MWAWVec2< T > operator+(MWAWVec2< T > const &p1, MWAWVec2< T > const &p2)
operator+
Definition: libmwaw_internal.hxx:738
bool operator!=(MWAWColor const &c) const
operator!=
Definition: libmwaw_internal.hxx:299
std::string writingModeToString(WritingMode mode)
a function to convert a writing mode in string lt-rb, ...
Definition: libmwaw_internal.cxx:184
Definition: libmwaw_internal.hxx:178
Style m_style
the border style
Definition: libmwaw_internal.hxx:380
friend MWAWVec3< T > operator+(MWAWVec3< T > const &p1, MWAWVec3< T > const &p2)
operator+
Definition: libmwaw_internal.hxx:939
a namespace used to convert Mac font characters in unicode
Definition: MWAWFontConverter.hxx:62
Definition: libmwaw_internal.hxx:401
void setZ(T zz)
resets the third element
Definition: libmwaw_internal.hxx:905
MWAWVec3< unsigned char > MWAWVec3uc
MWAWVec3 of unsigned char.
Definition: libmwaw_internal.hxx:1011
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:547
MWAWVec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:1050
Definition: libmwaw_internal.hxx:447
T operator[](int c) const
operator[]
Definition: libmwaw_internal.hxx:875
MWAWVec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:1040
an noop deleter used to transform a libwpd pointer in a false std::shared_ptr
Definition: libmwaw_internal.hxx:101
Definition: libmwaw_internal.hxx:178
a structure used to define a picture shape
Definition: MWAWGraphicShape.hxx:45
MWAWVec3(T xx=0, T yy=0, T zz=0)
constructor
Definition: libmwaw_internal.hxx:847
Definition: libmwaw_internal.hxx:180
bool operator()(MWAWVec2< T > const &s1, MWAWVec2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:818
std::pair< MWAWVec2< T >, MWAWVec2< T > > m_data
the data
Definition: libmwaw_internal.hxx:1183
internal struct used to create sorted map, sorted by Y
Definition: libmwaw_internal.hxx:816
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1189
unsigned char getBlue() const
returns the green value
Definition: libmwaw_internal.hxx:269
bool operator!=(MWAWVec2< T > const &p) const
comparison!=
Definition: libmwaw_internal.hxx:763
MWAWBox2< T > getIntersection(MWAWBox2< T > const &box) const
returns the intersection between this and box
Definition: libmwaw_internal.hxx:1135
bool isEmpty() const
return true if the picture contains no data
Definition: libmwaw_internal.hxx:483
class to store the paragraph properties
Definition: MWAWParagraph.hxx:84
std::shared_ptr< MWAWFontConverter > MWAWFontConverterPtr
a smart pointer of MWAWFontConverter
Definition: libmwaw_internal.hxx:539
void setMax(MWAWVec2< T > const &y)
resets the maximum point
Definition: libmwaw_internal.hxx:1086
Definition: libmwaw_internal.hxx:335
MWAWField & operator=(MWAWField const &)=default
bool isIdentity() const
returns true if the matrix is an identity matrix
Definition: libmwaw_internal.hxx:1205
void setSet(bool newVal)
define if the variable is set
Definition: libmwaw_internal.hxx:636
a field
Definition: libmwaw_internal.hxx:399
static MWAWColor colorFromHSL(unsigned char H, unsigned char S, unsigned char L)
return a color from a hsl color (basic)
Definition: libmwaw_internal.hxx:228
std::map< MWAWVec2< bool >, bool, struct PosSizeLtY > MapY
map of MWAWVec2
Definition: libmwaw_internal.hxx:826
bool operator==(MWAWBorder const &orig) const
operator==
Definition: libmwaw_internal.hxx:361
std::string m_DTFormat
the date/time format using strftime format if defined
Definition: libmwaw_internal.hxx:424
MWAWVariable(MWAWVariable const &orig)
copy constructor
Definition: libmwaw_internal.hxx:583
unsigned char getAlpha() const
returns the alpha value
Definition: libmwaw_internal.hxx:264
Definition: libmwaw_internal.hxx:337
Definition: libmwaw_internal.hxx:188
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist
Definition: libmwaw_internal.cxx:571
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libmwaw_internal.cxx:52
std::string m_extra
extra data ( if needed)
Definition: libmwaw_internal.hxx:395
WritingMode
the different writing mode
Definition: libmwaw_internal.hxx:185
int cmpY(MWAWVec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:782
a note
Definition: libmwaw_internal.hxx:445
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:99
T const * operator->() const
operator*
Definition: libmwaw_internal.hxx:604
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
~MWAWEmbeddedObject()
destructor
Definition: libmwaw_internal.cxx:567
Type
Defines some basic type for field.
Definition: libmwaw_internal.hxx:401
This class contains a virtual interface to all listener.
Definition: MWAWListener.hxx:49
MWAWVec2< long > MWAWVec2l
MWAWVec2 of long.
Definition: libmwaw_internal.hxx:836
bool operator>=(MWAWTransformation const &mat) const
operator>=
Definition: libmwaw_internal.hxx:1298
std::shared_ptr< MWAWSubDocument > MWAWSubDocumentPtr
a smart pointer of MWAWSubDocument
Definition: libmwaw_internal.hxx:561
MWAWBorder()
constructor
Definition: libmwaw_internal.hxx:340
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
MWAWTransformation & operator*=(MWAWTransformation const &mat)
operator*=
Definition: libmwaw_internal.hxx:1266
T operator[](int c) const
operator[]
Definition: libmwaw_internal.hxx:674
void operator()(T *)
Definition: libmwaw_internal.hxx:102
MWAWBox2f operator*(MWAWBox2f const &box) const
operator* for box2f
Definition: libmwaw_internal.hxx:1243
T m_x
first element
Definition: libmwaw_internal.hxx:828
bool operator==(MWAWTransformation const &mat) const
operator==
Definition: libmwaw_internal.hxx:1273
void scale(U factor)
scales all points of the box by factor
Definition: libmwaw_internal.hxx:1111
MWAWBox2< long > MWAWBox2l
MWAWBox2 of long.
Definition: libmwaw_internal.hxx:1191
Definition: libmwaw_internal.hxx:185
a small structure used to store the informations about a list
Definition: MWAWList.hxx:119
bool operator<(MWAWTransformation const &mat) const
operator<
Definition: libmwaw_internal.hxx:1283
Definition: libmwaw_internal.hxx:335
the main class to read a Mac resource fork
Definition: MWAWRSRCParser.hxx:46
Definition: libmwaw_internal.hxx:178
MWAWColor m_color
the border color
Definition: libmwaw_internal.hxx:393
bool operator<=(MWAWColor const &c) const
operator<=
Definition: libmwaw_internal.hxx:309
MWAWVec3< T > & operator+=(MWAWVec3< T > const &p)
operator+=
Definition: libmwaw_internal.hxx:919
libmwaw::NumberingType m_numberingType
the number type ( for number field )
Definition: libmwaw_internal.hxx:422
Definition: libmwaw_internal.hxx:188
MWAWVariable()
constructor
Definition: libmwaw_internal.hxx:575
main class used to define store librevenge::RVNGDrawingInterface lists of command in a librevenge::RV...
Definition: MWAWGraphicEncoder.hxx:55
friend MWAWVec2< T > operator*(U scale, MWAWVec2< T > const &p1)
generic operator*
Definition: libmwaw_internal.hxx:751
internal struct used to create sorted map, sorted by X
Definition: libmwaw_internal.hxx:801
a generic variable template: value + flag to know if the variable is set
Definition: libmwaw_internal.hxx:573
bool operator!=(MWAWBorder const &orig) const
operator!=
Definition: libmwaw_internal.hxx:366
Definition: libmwaw_internal.hxx:176
void resizeFromMin(MWAWVec2< T > const &sz)
resize the box keeping the minimum
Definition: libmwaw_internal.hxx:1092
uint32_t m_value
the argb color
Definition: libmwaw_internal.hxx:329
T const & operator*() const
operator*
Definition: libmwaw_internal.hxx:615
a transformation which stored the first row of a 3x3 perspective matrix
Definition: libmwaw_internal.hxx:1194
Definition: libmwaw_internal.hxx:135
small class which defines a vector with 2 elements
Definition: libmwaw_internal.hxx:651
void checkIdentity() const
check if a matrix is the identity matrix
Definition: libmwaw_internal.hxx:1210
void setY(T yy)
resets the second element
Definition: libmwaw_internal.hxx:900
bool operator()(MWAWVec2< T > const &s1, MWAWVec2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:803
void setMin(MWAWVec2< T > const &x)
resets the minimum point
Definition: libmwaw_internal.hxx:1081
std::string str() const
print the color in the form #rrggbb
Definition: libmwaw_internal.cxx:232

Generated on Sat Apr 28 2018 09:11:30 for libmwaw by doxygen 1.8.14