libstaroffice_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 /* libstaroffice
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 LIBSTAROFFICE_INTERNAL_H
35 #define LIBSTAROFFICE_INTERNAL_H
36 
37 #include <assert.h>
38 #include <math.h>
39 #ifdef DEBUG
40 #include <stdio.h>
41 #endif
42 
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 
99 template <class T>
101  void operator()(T *) {}
102 };
103 
105 #if defined(HAVE_CLANG_ATTRIBUTE_FALLTHROUGH)
106 # define STOFF_FALLTHROUGH [[clang::fallthrough]]
107 #elif defined(HAVE_GCC_ATTRIBUTE_FALLTHROUGH)
108 # define STOFF_FALLTHROUGH __attribute__((fallthrough))
109 #else
110 # define STOFF_FALLTHROUGH ((void) 0)
111 #endif
112 
113 #if defined(HAVE_FUNC_ATTRIBUTE_FORMAT)
114 # define LIBSTOFF_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg)))
115 #else
116 # define LIBSTOFF_ATTRIBUTE_PRINTF(fmt, arg)
117 #endif
118 
119 #define STOFF_N_ELEMENTS(m) sizeof(m)/sizeof(m[0])
120 
121 /* ---------- debug --------------- */
122 #ifdef DEBUG
123 namespace libstoff
124 {
125 void printDebugMsg(const char *format, ...) LIBSTOFF_ATTRIBUTE_PRINTF(1,2);
126 }
127 #define STOFF_DEBUG_MSG(M) libstoff::printDebugMsg M
128 #else
129 #define STOFF_DEBUG_MSG(M)
130 #endif
131 
132 namespace libstoff
133 {
134 // Various exceptions:
136 {
137 };
138 
140 {
141 };
142 
144 {
145 };
146 
148 {
149 };
150 
152 {
153 };
154 }
155 
156 /* ---------- input ----------------- */
157 namespace libstoff
158 {
159 uint8_t readU8(librevenge::RVNGInputStream *input);
161 void appendUnicode(uint32_t val, librevenge::RVNGString &buffer);
163 librevenge::RVNGString getString(std::vector<uint32_t> const &unicode);
164 
166 template<typename T>
167 bool checkAddOverflow(T x, T y)
168 {
169  return (x < 0 && y < std::numeric_limits<T>::lowest() - x)
170  || (x > 0 && y > std::numeric_limits<T>::max() - x);
171 }
172 }
173 
174 /* ---------- small enum/class ------------- */
175 namespace libstoff
176 {
178 enum Position { Left = 0, Right = 1, Top = 2, Bottom = 3, HMiddle = 4, VMiddle = 5 };
180 enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08, HMiddleBit = 0x10, VMiddleBit = 0x20 };
181 
183 std::string numberingTypeToString(NumberingType type);
184 std::string numberingValueToString(NumberingType type, int value);
186 }
187 
189 struct STOFFColor {
191  explicit STOFFColor(uint32_t argb=0) : m_value(argb)
192  {
193  }
195  STOFFColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) :
196  m_value(uint32_t((a<<24)+(r<<16)+(g<<8)+b))
197  {
198  }
200  STOFFColor &operator=(uint32_t argb)
201  {
202  m_value = argb;
203  return *this;
204  }
206  static STOFFColor colorFromCMYK(unsigned char c, unsigned char m, unsigned char y, unsigned char k)
207  {
208  double w=1.-double(k)/255.;
209  return STOFFColor
210  (static_cast<unsigned char>(255 * (1-double(c)/255) * w),
211  static_cast<unsigned char>(255 * (1-double(m)/255) * w),
212  static_cast<unsigned char>(255 * (1-double(y)/255) * w)
213  );
214  }
216  static STOFFColor colorFromHSL(unsigned char H, unsigned char S, unsigned char L)
217  {
218  double c=(1-((L>=128) ? (2*double(L)-255) : (255-2*double(L)))/255)*
219  double(S)/255;
220  double tmp=std::fmod((double(H)*6/255),2)-1;
221  double x=c*(1-(tmp>0 ? tmp : -tmp));
222  auto C=static_cast<unsigned char>(255*c);
223  auto M=static_cast<unsigned char>(double(L)-255*c/2);
224  auto X=static_cast<unsigned char>(255*x);
225  if (H<=42) return STOFFColor(static_cast<unsigned char>(M+C),static_cast<unsigned char>(M+X),static_cast<unsigned char>(M));
226  if (H<=85) return STOFFColor(static_cast<unsigned char>(M+X),static_cast<unsigned char>(M+C),static_cast<unsigned char>(M));
227  if (H<=127) return STOFFColor(static_cast<unsigned char>(M),static_cast<unsigned char>(M+C),static_cast<unsigned char>(M+X));
228  if (H<=170) return STOFFColor(static_cast<unsigned char>(M),static_cast<unsigned char>(M+X),static_cast<unsigned char>(M+C));
229  if (H<=212) return STOFFColor(static_cast<unsigned char>(M+X),static_cast<unsigned char>(M),static_cast<unsigned char>(M+C));
230  return STOFFColor(static_cast<unsigned char>(M+C),static_cast<unsigned char>(M),static_cast<unsigned char>(M+X));
231  }
233  static STOFFColor black()
234  {
235  return STOFFColor(0,0,0);
236  }
238  static STOFFColor white()
239  {
240  return STOFFColor(255,255,255);
241  }
242 
244  static STOFFColor barycenter(float alpha, STOFFColor const &colA,
245  float beta, STOFFColor const &colB);
247  uint32_t value() const
248  {
249  return m_value;
250  }
252  unsigned char getAlpha() const
253  {
254  return static_cast<unsigned char>((m_value>>24)&0xFF);
255  }
257  void setAlpha(unsigned char alpha)
258  {
259  m_value=(m_value&0xFFFFFF)|uint32_t(alpha<<24);
260  }
262  unsigned char getBlue() const
263  {
264  return static_cast<unsigned char>(m_value&0xFF);
265  }
267  unsigned char getRed() const
268  {
269  return static_cast<unsigned char>((m_value>>16)&0xFF);
270  }
272  unsigned char getGreen() const
273  {
274  return static_cast<unsigned char>((m_value>>8)&0xFF);
275  }
277  bool isBlack() const
278  {
279  return (m_value&0xFFFFFF)==0;
280  }
282  bool isWhite() const
283  {
284  return (m_value&0xFFFFFF)==0xFFFFFF;
285  }
287  bool operator==(STOFFColor const &c) const
288  {
289  return (c.m_value&0xFFFFFF)==(m_value&0xFFFFFF);
290  }
292  bool operator!=(STOFFColor const &c) const
293  {
294  return !operator==(c);
295  }
297  bool operator<(STOFFColor const &c) const
298  {
299  return (c.m_value&0xFFFFFF)<(m_value&0xFFFFFF);
300  }
302  bool operator<=(STOFFColor const &c) const
303  {
304  return (c.m_value&0xFFFFFF)<=(m_value&0xFFFFFF);
305  }
307  bool operator>(STOFFColor const &c) const
308  {
309  return !operator<=(c);
310  }
312  bool operator>=(STOFFColor const &c) const
313  {
314  return !operator<(c);
315  }
317  friend std::ostream &operator<< (std::ostream &o, STOFFColor const &c);
319  std::string str() const;
320 protected:
322  uint32_t m_value;
323 };
324 
332  bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const;
334  bool isEmpty() const
335  {
336  return m_outWidth==0 && m_inWidth==0;
337  }
339  bool operator==(STOFFBorderLine const &orig) const
340  {
341  return !operator!=(orig);
342  }
344  bool operator!=(STOFFBorderLine const &orig) const
345  {
346  return m_outWidth != orig.m_outWidth || m_inWidth != orig.m_inWidth ||
347  m_distance != orig.m_distance || m_color != orig.m_color;
348  }
349 
351  friend std::ostream &operator<< (std::ostream &o, STOFFBorderLine const &border);
360 };
361 
363 struct STOFFField {
366  {
367  }
369  void addTo(librevenge::RVNGPropertyList &propList) const;
371  librevenge::RVNGPropertyList m_propertyList;
372 };
373 
375 struct STOFFLink {
378  {
379  }
380 
382  bool addTo(librevenge::RVNGPropertyList &propList) const;
383 
385  std::string m_HRef;
386 };
387 
389 struct STOFFNote {
391  enum Type { FootNote, EndNote };
393  explicit STOFFNote(Type type) : m_type(type), m_label(""), m_number(-1)
394  {
395  }
399  librevenge::RVNGString m_label;
401  int m_number;
402 };
403 
411  {
412  }
414  STOFFEmbeddedObject(librevenge::RVNGBinaryData const &binaryData,
415  std::string const &type="image/pict") : m_dataList(), m_typeList(), m_filenameLink("")
416  {
417  add(binaryData, type);
418  }
422  bool isEmpty() const
423  {
424  if (!m_filenameLink.empty())
425  return false;
426  for (const auto &i : m_dataList) {
427  if (!i.empty())
428  return false;
429  }
430  return true;
431  }
433  void add(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
434  {
435  size_t pos=m_dataList.size();
436  if (pos<m_typeList.size()) pos=m_typeList.size();
437  m_dataList.resize(pos+1);
438  m_dataList[pos]=binaryData;
439  m_typeList.resize(pos+1);
440  m_typeList[pos]=type;
441  }
443  bool addTo(librevenge::RVNGPropertyList &propList) const;
445  bool addAsFillImageTo(librevenge::RVNGPropertyList &propList) const;
447  friend std::ostream &operator<<(std::ostream &o, STOFFEmbeddedObject const &pict);
449  int cmp(STOFFEmbeddedObject const &pict) const;
450 
452  std::vector<librevenge::RVNGBinaryData> m_dataList;
454  std::vector<std::string> m_typeList;
456  librevenge::RVNGString m_filenameLink;
457 };
458 
459 // forward declarations of basic classes and smart pointers
460 class STOFFFont;
461 class STOFFFrameStyle;
462 class STOFFGraphicShape;
463 class STOFFGraphicStyle;
464 class STOFFList;
465 class STOFFParagraph;
466 class STOFFSection;
467 class STOFFPageSpan;
468 
469 class STOFFEntry;
470 class STOFFHeader;
471 class STOFFParser;
472 class STOFFPosition;
473 
475 class STOFFInputStream;
476 class STOFFListener;
477 class STOFFListManager;
478 class STOFFParserState;
480 class STOFFSubDocument;
483 typedef std::shared_ptr<STOFFGraphicListener> STOFFGraphicListenerPtr;
485 typedef std::shared_ptr<STOFFInputStream> STOFFInputStreamPtr;
487 typedef std::shared_ptr<STOFFListener> STOFFListenerPtr;
489 typedef std::shared_ptr<STOFFListManager> STOFFListManagerPtr;
491 typedef std::shared_ptr<STOFFParserState> STOFFParserStatePtr;
493 typedef std::shared_ptr<STOFFSpreadsheetListener> STOFFSpreadsheetListenerPtr;
495 typedef std::shared_ptr<STOFFSubDocument> STOFFSubDocumentPtr;
497 typedef std::shared_ptr<STOFFTextListener> STOFFTextListenerPtr;
498 
505 template <class T> struct STOFFVariable {
507  STOFFVariable() : m_data(), m_set(false) {}
509  explicit STOFFVariable(T const &def) : m_data(def), m_set(false) {}
511  STOFFVariable(STOFFVariable const &orig) : m_data(orig.m_data), m_set(orig.m_set) {}
514  {
515  if (this != &orig) {
516  m_data = orig.m_data;
517  m_set = orig.m_set;
518  }
519  return std::forward<STOFFVariable &>(*this);
520  }
522  STOFFVariable &operator=(T const &val)
523  {
524  m_data = val;
525  m_set = true;
526  return std::forward<STOFFVariable &>(*this);
527  }
529  void insert(STOFFVariable const &orig)
530  {
531  if (orig.m_set) {
532  m_data = orig.m_data;
533  m_set = orig.m_set;
534  }
535  }
537  T const *operator->() const
538  {
539  return &m_data;
540  }
543  {
544  m_set = true;
545  return &m_data;
546  }
548  T const &operator*() const
549  {
550  return m_data;
551  }
554  {
555  m_set = true;
556  return m_data;
557  }
559  T const &get() const
560  {
561  return m_data;
562  }
564  bool isSet() const
565  {
566  return m_set;
567  }
569  void setSet(bool newVal)
570  {
571  m_set=newVal;
572  }
573 protected:
577  bool m_set;
578 };
579 
580 /* ---------- vec2/box2f ------------- */
584 template <class T> class STOFFVec2
585 {
586 public:
588  STOFFVec2(T xx=0,T yy=0) : m_x(xx), m_y(yy) { }
590  template <class U> STOFFVec2(STOFFVec2<U> const &p) : m_x(T(p.x())), m_y(T(p.y())) {}
591 
593  T x() const
594  {
595  return m_x;
596  }
598  T y() const
599  {
600  return m_y;
601  }
603  T operator[](int c) const
604  {
605  if (c<0 || c>1) throw libstoff::GenericException();
606  return (c==0) ? m_x : m_y;
607  }
609  T &operator[](int c)
610  {
611  if (c<0 || c>1) throw libstoff::GenericException();
612  return (c==0) ? m_x : m_y;
613  }
614 
616  void set(T xx, T yy)
617  {
618  m_x = xx;
619  m_y = yy;
620  }
622  void setX(T xx)
623  {
624  m_x = xx;
625  }
627  void setY(T yy)
628  {
629  m_y = yy;
630  }
631 
633  void add(T dx, T dy)
634  {
637  m_x += dx;
638  m_y += dy;
639  }
640 
643  {
644  add(p.m_x, p.m_y);
645  return *this;
646  }
649  {
650  // check if negation of either of the coords will cause overflow
651  const T diff = std::numeric_limits<T>::min() + std::numeric_limits<T>::max();
654  add(-p.m_x, -p.m_y);
655  return *this;
656  }
658  template <class U>
660  {
661  m_x = T(m_x*scale);
662  m_y = T(m_y*scale);
663  return *this;
664  }
665 
667  friend STOFFVec2<T> operator+(STOFFVec2<T> const &p1, STOFFVec2<T> const &p2)
668  {
669  STOFFVec2<T> p(p1);
670  return p+=p2;
671  }
673  friend STOFFVec2<T> operator-(STOFFVec2<T> const &p1, STOFFVec2<T> const &p2)
674  {
675  STOFFVec2<T> p(p1);
676  return p-=p2;
677  }
679  template <class U>
680  friend STOFFVec2<T> operator*(U scale, STOFFVec2<T> const &p1)
681  {
682  STOFFVec2<T> p(p1);
683  return p *= scale;
684  }
685 
687  bool operator==(STOFFVec2<T> const &p) const
688  {
689  return cmpY(p) == 0;
690  }
692  bool operator!=(STOFFVec2<T> const &p) const
693  {
694  return cmpY(p) != 0;
695  }
697  bool operator<(STOFFVec2<T> const &p) const
698  {
699  return cmpY(p) < 0;
700  }
702  int cmp(STOFFVec2<T> const &p) const
703  {
704  if (m_x < p.m_x) return -1;
705  if (m_x > p.m_x) return 1;
706  if (m_y < p.m_y) return -1;
707  if (m_y > p.m_y) return 1;
708  return 0;
709  }
711  int cmpY(STOFFVec2<T> const &p) const
712  {
713  if (m_y < p.m_y) return -1;
714  if (m_y > p.m_y) return 1;
715  if (m_x < p.m_x) return -1;
716  if (m_x > p.m_x) return 1;
717  return 0;
718  }
719 
721  friend std::ostream &operator<< (std::ostream &o, STOFFVec2<T> const &f)
722  {
723  o << f.m_x << "x" << f.m_y;
724  return o;
725  }
726 
730  struct PosSizeLtX {
732  bool operator()(STOFFVec2<T> const &s1, STOFFVec2<T> const &s2) const
733  {
734  return s1.cmp(s2) < 0;
735  }
736  };
740  typedef std::map<STOFFVec2<T>, T,struct PosSizeLtX> MapX;
741 
745  struct PosSizeLtY {
747  bool operator()(STOFFVec2<T> const &s1, STOFFVec2<T> const &s2) const
748  {
749  return s1.cmpY(s2) < 0;
750  }
751  };
755  typedef std::map<STOFFVec2<T>, T,struct PosSizeLtY> MapY;
756 protected:
757  T m_x, m_y;
758 };
759 
768 
772 template <class T> class STOFFVec3
773 {
774 public:
776  STOFFVec3(T xx=0,T yy=0,T zz=0)
777  {
778  m_val[0] = xx;
779  m_val[1] = yy;
780  m_val[2] = zz;
781  }
783  template <class U> STOFFVec3(STOFFVec3<U> const &p)
784  {
785  for (int c = 0; c < 3; c++) m_val[c] = T(p[c]);
786  }
787 
789  T x() const
790  {
791  return m_val[0];
792  }
794  T y() const
795  {
796  return m_val[1];
797  }
799  T z() const
800  {
801  return m_val[2];
802  }
804  T operator[](int c) const
805  {
806  if (c<0 || c>2) throw libstoff::GenericException();
807  return m_val[c];
808  }
810  T &operator[](int c)
811  {
812  if (c<0 || c>2) throw libstoff::GenericException();
813  return m_val[c];
814  }
815 
817  void set(T xx, T yy, T zz)
818  {
819  m_val[0] = xx;
820  m_val[1] = yy;
821  m_val[2] = zz;
822  }
824  void setX(T xx)
825  {
826  m_val[0] = xx;
827  }
829  void setY(T yy)
830  {
831  m_val[1] = yy;
832  }
834  void setZ(T zz)
835  {
836  m_val[2] = zz;
837  }
838 
840  void add(T dx, T dy, T dz)
841  {
842  m_val[0] += dx;
843  m_val[1] += dy;
844  m_val[2] += dz;
845  }
846 
849  {
850  for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]);
851  return *this;
852  }
855  {
856  for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]-p.m_val[c]);
857  return *this;
858  }
860  template <class U>
862  {
863  for (auto &c : m_val) c = T(c*scale);
864  return *this;
865  }
866 
868  friend STOFFVec3<T> operator+(STOFFVec3<T> const &p1, STOFFVec3<T> const &p2)
869  {
870  STOFFVec3<T> p(p1);
871  return p+=p2;
872  }
874  friend STOFFVec3<T> operator-(STOFFVec3<T> const &p1, STOFFVec3<T> const &p2)
875  {
876  STOFFVec3<T> p(p1);
877  return p-=p2;
878  }
880  template <class U>
881  friend STOFFVec3<T> operator*(U scale, STOFFVec3<T> const &p1)
882  {
883  STOFFVec3<T> p(p1);
884  return p *= scale;
885  }
886 
888  bool operator==(STOFFVec3<T> const &p) const
889  {
890  return cmp(p) == 0;
891  }
893  bool operator!=(STOFFVec3<T> const &p) const
894  {
895  return cmp(p) != 0;
896  }
898  bool operator<(STOFFVec3<T> const &p) const
899  {
900  return cmp(p) < 0;
901  }
903  int cmp(STOFFVec3<T> const &p) const
904  {
905  for (int c = 0; c < 3; c++) {
906  if (m_val[c]<p.m_val[c]) return -1;
907  if (m_val[c]>p.m_val[c]) return 1;
908  }
909  return 0;
910  }
911 
913  friend std::ostream &operator<< (std::ostream &o, STOFFVec3<T> const &f)
914  {
915  o << f.m_val[0] << "x" << f.m_val[1] << "x" << f.m_val[2];
916  return o;
917  }
918 
922  struct PosSizeLt {
924  bool operator()(STOFFVec3<T> const &s1, STOFFVec3<T> const &s2) const
925  {
926  return s1.cmp(s2) < 0;
927  }
928  };
932  typedef std::map<STOFFVec3<T>, T,struct PosSizeLt> Map;
933 
934 protected:
936  T m_val[3];
937 };
938 
947 
951 template <class T> class STOFFBox2
952 {
953 public:
956  {
957  m_pt[0] = minPt;
958  m_pt[1] = maxPt;
959  }
961  template <class U> STOFFBox2(STOFFBox2<U> const &p)
962  {
963  for (int c=0; c < 2; c++) m_pt[c] = p[c];
964  }
965 
967  STOFFVec2<T> const &min() const
968  {
969  return m_pt[0];
970  }
972  STOFFVec2<T> const &max() const
973  {
974  return m_pt[1];
975  }
978  {
979  return m_pt[0];
980  }
983  {
984  return m_pt[1];
985  }
989  STOFFVec2<T> const &operator[](int c) const
990  {
991  if (c<0 || c>1) throw libstoff::GenericException();
992  return m_pt[c];
993  }
996  {
997  return m_pt[1]-m_pt[0];
998  }
1001  {
1002  return STOFFVec2<T>((m_pt[0].x()+m_pt[1].x())/2,
1003  (m_pt[0].y()+m_pt[1].y())/2);
1004  }
1005 
1007  void set(STOFFVec2<T> const &x, STOFFVec2<T> const &y)
1008  {
1009  m_pt[0] = x;
1010  m_pt[1] = y;
1011  }
1013  void setMin(STOFFVec2<T> const &x)
1014  {
1015  m_pt[0] = x;
1016  }
1018  void setMax(STOFFVec2<T> const &y)
1019  {
1020  m_pt[1] = y;
1021  }
1022 
1024  void resizeFromMin(STOFFVec2<T> const &sz)
1025  {
1026  m_pt[1] = m_pt[0]+sz;
1027  }
1029  void resizeFromMax(STOFFVec2<T> const &sz)
1030  {
1031  m_pt[0] = m_pt[1]-sz;
1032  }
1035  {
1036  STOFFVec2<T> centerPt = 0.5*(m_pt[0]+m_pt[1]);
1037  m_pt[0] = centerPt - 0.5*sz;
1038  m_pt[1] = centerPt + (sz - 0.5*sz);
1039  }
1040 
1042  template <class U> void scale(U factor)
1043  {
1044  m_pt[0] *= factor;
1045  m_pt[1] *= factor;
1046  }
1047 
1049  void extend(T val)
1050  {
1051  m_pt[0] -= STOFFVec2<T>(val/2,val/2);
1052  m_pt[1] += STOFFVec2<T>(val-(val/2),val-(val/2));
1053  }
1054 
1057  {
1058  STOFFBox2<T> res;
1059  res.m_pt[0]=STOFFVec2<T>(m_pt[0][0]<box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
1060  m_pt[0][1]<box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
1061  res.m_pt[1]=STOFFVec2<T>(m_pt[1][0]>box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
1062  m_pt[1][1]>box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
1063  return res;
1064  }
1067  {
1068  STOFFBox2<T> res;
1069  res.m_pt[0]=STOFFVec2<T>(m_pt[0][0]>box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
1070  m_pt[0][1]>box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
1071  res.m_pt[1]=STOFFVec2<T>(m_pt[1][0]<box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
1072  m_pt[1][1]<box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
1073  return res;
1074  }
1076  bool operator==(STOFFBox2<T> const &p) const
1077  {
1078  return cmp(p) == 0;
1079  }
1081  bool operator!=(STOFFBox2<T> const &p) const
1082  {
1083  return cmp(p) != 0;
1084  }
1086  bool operator<(STOFFBox2<T> const &p) const
1087  {
1088  return cmp(p) < 0;
1089  }
1090 
1092  int cmp(STOFFBox2<T> const &p) const
1093  {
1094  int diff = m_pt[0].cmpY(p.m_pt[0]);
1095  if (diff) return diff;
1096  diff = m_pt[1].cmpY(p.m_pt[1]);
1097  if (diff) return diff;
1098  return 0;
1099  }
1100 
1102  friend std::ostream &operator<< (std::ostream &o, STOFFBox2<T> const &f)
1103  {
1104  o << "(" << f.m_pt[0] << "<->" << f.m_pt[1] << ")";
1105  return o;
1106  }
1107 
1111  struct PosSizeLt {
1113  bool operator()(STOFFBox2<T> const &s1, STOFFBox2<T> const &s2) const
1114  {
1115  return s1.cmp(s2) < 0;
1116  }
1117  };
1121  typedef std::map<STOFFBox2<T>, T,struct PosSizeLt> Map;
1122 
1123 protected:
1126 };
1127 
1134 
1135 namespace libstoff
1136 {
1138 bool convertToDateTime(uint32_t date, uint32_t time, std::string &dateTime);
1140 void splitString(librevenge::RVNGString const &string, librevenge::RVNGString const &delim,
1141  librevenge::RVNGString &string1, librevenge::RVNGString &string2);
1145 librevenge::RVNGString simplifyString(librevenge::RVNGString const &s);
1147 std::string getCellName(STOFFVec2i const &cellPos, STOFFVec2b const &relative=STOFFVec2b(true,true));
1148 // some geometrical function
1150 float getScaleFactor(librevenge::RVNGUnit orig, librevenge::RVNGUnit dest);
1152 STOFFVec2f rotatePointAroundCenter(STOFFVec2f const &point, STOFFVec2f const &center, float angle);
1154 STOFFBox2f rotateBoxFromCenter(STOFFBox2f const &box, float angle);
1155 }
1156 #endif /* LIBSTAROFFICE_INTERNAL_H */
1157 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
STOFFBox2::STOFFBox2
STOFFBox2(STOFFVec2< T > minPt=STOFFVec2< T >(), STOFFVec2< T > maxPt=STOFFVec2< T >())
constructor
Definition: libstaroffice_internal.hxx:955
libstoff::DOC_CHART
Definition: libstaroffice_internal.hxx:185
STOFFListenerPtr
std::shared_ptr< STOFFListener > STOFFListenerPtr
a smart pointer of STOFFListener
Definition: libstaroffice_internal.hxx:487
STOFFVariable::operator->
const T * operator->() const
operator*
Definition: libstaroffice_internal.hxx:537
STOFFParagraph
class to store the paragraph properties
Definition: STOFFParagraph.hxx:47
STOFFField
a field
Definition: libstaroffice_internal.hxx:363
STOFFVec2< int >
STOFFEntry
basic class to store an entry in a file This contained :
Definition: STOFFEntry.hxx:46
STOFFVec2::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFVec2< T > const &f)
operator<<: prints data in form "XxY"
Definition: libstaroffice_internal.hxx:721
libstoff::getString
librevenge::RVNGString getString(std::vector< uint32_t > const &unicode)
transform a unicode string in a RNVGString
Definition: libstaroffice_internal.cxx:63
STOFFVec3::PosSizeLt::operator()
bool operator()(STOFFVec3< T > const &s1, STOFFVec3< T > const &s2) const
comparaison function
Definition: libstaroffice_internal.hxx:924
STOFFVec3::operator*=
STOFFVec3< T > & operator*=(U scale)
generic operator*=
Definition: libstaroffice_internal.hxx:861
STOFFVec3::operator!=
bool operator!=(STOFFVec3< T > const &p) const
comparison!=
Definition: libstaroffice_internal.hxx:893
STOFFVec2< bool >::MapY
std::map< STOFFVec2< bool >, bool, struct PosSizeLtY > MapY
map of STOFFVec2
Definition: libstaroffice_internal.hxx:755
STOFFBox2::resizeFromMax
void resizeFromMax(STOFFVec2< T > const &sz)
resize the box keeping the maximum
Definition: libstaroffice_internal.hxx:1029
STOFFVec3::m_val
T m_val[3]
the values
Definition: libstaroffice_internal.hxx:936
libstoff::FileException
Definition: libstaroffice_internal.hxx:139
STOFFBox2::cmp
int cmp(STOFFBox2< T > const &p) const
comparison function : fist sorts min by Y,X values then max extremity
Definition: libstaroffice_internal.hxx:1092
STOFF_DEBUG_MSG
#define STOFF_DEBUG_MSG(M)
Definition: libstaroffice_internal.hxx:129
STOFFColor::barycenter
static STOFFColor barycenter(float alpha, STOFFColor const &colA, float beta, STOFFColor const &colB)
return alpha*colA+beta*colB
Definition: libstaroffice_internal.cxx:200
STOFFVariable::STOFFVariable
STOFFVariable(STOFFVariable const &orig)
copy constructor
Definition: libstaroffice_internal.hxx:511
STOFFBox2f
STOFFBox2< float > STOFFBox2f
STOFFBox2 of float.
Definition: libstaroffice_internal.hxx:1131
STOFFVec2::operator[]
T & operator[](int c)
operator[]
Definition: libstaroffice_internal.hxx:609
STOFFColor::black
static STOFFColor black()
return the back color
Definition: libstaroffice_internal.hxx:233
STOFFVec3::setZ
void setZ(T zz)
resets the third element
Definition: libstaroffice_internal.hxx:834
STOFFBorderLine::operator==
bool operator==(STOFFBorderLine const &orig) const
operator==
Definition: libstaroffice_internal.hxx:339
libstoff::rotateBoxFromCenter
STOFFBox2f rotateBoxFromCenter(STOFFBox2f const &box, float angle)
rotate a bdox and returns the final bdbox, angle is given in degree
Definition: libstaroffice_internal.cxx:479
libstoff::VersionException
Definition: libstaroffice_internal.hxx:135
STOFFEmbeddedObject::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFEmbeddedObject const &pict)
operator<<
Definition: libstaroffice_internal.cxx:372
libstoff::DOC_GRAPHIC_GROUP
Definition: libstaroffice_internal.hxx:185
STOFFSubDocument
abstract class used to store a subdocument (with a comparison function)
Definition: STOFFSubDocument.hxx:41
STOFFBox2::min
STOFFVec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libstaroffice_internal.hxx:977
STOFFGraphicShape
a structure used to define a picture shape
Definition: STOFFGraphicShape.hxx:45
STOFFVec3::STOFFVec3
STOFFVec3(T xx=0, T yy=0, T zz=0)
constructor
Definition: libstaroffice_internal.hxx:776
STOFFFrameStyle
Class to store a frame style.
Definition: STOFFFrameStyle.hxx:45
libstoff::DOC_SHEET
Definition: libstaroffice_internal.hxx:185
STOFFVec2::x
T x() const
first element
Definition: libstaroffice_internal.hxx:593
libstoff::Top
Definition: libstaroffice_internal.hxx:178
STOFFVec2::PosSizeLtX::operator()
bool operator()(STOFFVec2< T > const &s1, STOFFVec2< T > const &s2) const
comparaison function
Definition: libstaroffice_internal.hxx:732
STOFFColor::operator>=
bool operator>=(STOFFColor const &c) const
operator>=
Definition: libstaroffice_internal.hxx:312
STOFFPageSpan
A class which defines the page properties.
Definition: STOFFPageSpan.hxx:75
STOFFBox2i
STOFFBox2< int > STOFFBox2i
STOFFBox2 of int.
Definition: libstaroffice_internal.hxx:1129
STOFFGraphicListener
This class contains the code needed to create Graphic document.
Definition: STOFFGraphicListener.hxx:59
STOFFVariable::m_set
bool m_set
a flag to know if the variable is set or not
Definition: libstaroffice_internal.hxx:577
STOFFBox2::setMax
void setMax(STOFFVec2< T > const &y)
resets the maximum point
Definition: libstaroffice_internal.hxx:1018
STOFFBox2::operator==
bool operator==(STOFFBox2< T > const &p) const
comparison operator==
Definition: libstaroffice_internal.hxx:1076
STOFFVec3::operator-=
STOFFVec3< T > & operator-=(STOFFVec3< T > const &p)
operator-=
Definition: libstaroffice_internal.hxx:854
STOFFParserState
a class to define the parser state
Definition: STOFFParser.hxx:49
STOFFVariable::operator->
T * operator->()
operator*
Definition: libstaroffice_internal.hxx:542
STOFFVec2::PosSizeLtY
internal struct used to create sorted map, sorted by Y
Definition: libstaroffice_internal.hxx:745
STOFFBox2::resizeFromMin
void resizeFromMin(STOFFVec2< T > const &sz)
resize the box keeping the minimum
Definition: libstaroffice_internal.hxx:1024
libstoff::simplifyString
librevenge::RVNGString simplifyString(librevenge::RVNGString const &s)
returns a simplify version of a string.
Definition: libstaroffice_internal.cxx:430
STOFFColor::operator=
STOFFColor & operator=(uint32_t argb)
operator=
Definition: libstaroffice_internal.hxx:200
STOFFBox2::operator!=
bool operator!=(STOFFBox2< T > const &p) const
comparison operator!=
Definition: libstaroffice_internal.hxx:1081
STOFFTextListener
This class contains the code needed to create Text document.
Definition: STOFFTextListener.hxx:59
libstoff::LeftBit
Definition: libstaroffice_internal.hxx:180
STOFFParserStatePtr
std::shared_ptr< STOFFParserState > STOFFParserStatePtr
a smart pointer of STOFFParserState
Definition: libstaroffice_internal.hxx:491
STOFFVec3uc
STOFFVec3< unsigned char > STOFFVec3uc
STOFFVec3 of unsigned char.
Definition: libstaroffice_internal.hxx:942
STOFFVec2::operator-
friend STOFFVec2< T > operator-(STOFFVec2< T > const &p1, STOFFVec2< T > const &p2)
operator-
Definition: libstaroffice_internal.hxx:673
STOFFColor::value
uint32_t value() const
return the rgba value
Definition: libstaroffice_internal.hxx:247
STOFFBox2< float >
STOFFBorderLine
a border line
Definition: libstaroffice_internal.hxx:326
STOFFColor::str
std::string str() const
print the color in the form #rrggbb
Definition: libstaroffice_internal.cxx:226
libstoff::getCellName
std::string getCellName(STOFFVec2i const &cellPos, STOFFVec2b const &relative)
returns the cell name corresponding to a cell's position
Definition: libstaroffice_internal.cxx:455
STOFFVec3i
STOFFVec3< int > STOFFVec3i
STOFFVec3 of int.
Definition: libstaroffice_internal.hxx:944
STOFFVec3::operator*
friend STOFFVec3< T > operator*(U scale, STOFFVec3< T > const &p1)
generic operator*
Definition: libstaroffice_internal.hxx:881
STOFFEmbeddedObject::addTo
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist
Definition: libstaroffice_internal.cxx:309
STOFFColor
the class to store a color
Definition: libstaroffice_internal.hxx:189
libstoff::VMiddleBit
Definition: libstaroffice_internal.hxx:180
STOFFSpreadsheetListenerPtr
std::shared_ptr< STOFFSpreadsheetListener > STOFFSpreadsheetListenerPtr
a smart pointer of STOFFSpreadsheetListener
Definition: libstaroffice_internal.hxx:493
libstoff::appendUnicode
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer)
adds an unicode character to a string
Definition: libstaroffice_internal.cxx:81
STOFFPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: STOFFPosition.hxx:47
libstoff::DOC_TEXT_BOX
Definition: libstaroffice_internal.hxx:185
STOFFNote
a note
Definition: libstaroffice_internal.hxx:389
STOFFBox2::PosSizeLt::operator()
bool operator()(STOFFBox2< T > const &s1, STOFFBox2< T > const &s2) const
comparaison function
Definition: libstaroffice_internal.hxx:1113
STOFFBox2::center
STOFFVec2< T > center() const
the box center
Definition: libstaroffice_internal.hxx:1000
STOFFVariable::m_data
T m_data
the value
Definition: libstaroffice_internal.hxx:575
STOFFColor::operator<
bool operator<(STOFFColor const &c) const
operator<
Definition: libstaroffice_internal.hxx:297
STOFFVec3::STOFFVec3
STOFFVec3(STOFFVec3< U > const &p)
generic copy constructor
Definition: libstaroffice_internal.hxx:783
libstoff::WrongPasswordException
Definition: libstaroffice_internal.hxx:151
STOFFVariable::setSet
void setSet(bool newVal)
define if the variable is set
Definition: libstaroffice_internal.hxx:569
STOFFVariable::operator*
T & operator*()
operator*
Definition: libstaroffice_internal.hxx:553
STOFFEmbeddedObject::addAsFillImageTo
bool addAsFillImageTo(librevenge::RVNGPropertyList &propList) const
add the link property to a graph style as bitmap
Definition: libstaroffice_internal.cxx:297
STOFFEmbeddedObject
small class use to define a embedded object
Definition: libstaroffice_internal.hxx:408
STOFFVec2::operator+=
STOFFVec2< T > & operator+=(STOFFVec2< T > const &p)
operator+=
Definition: libstaroffice_internal.hxx:642
STOFFVec3::z
T z() const
third element
Definition: libstaroffice_internal.hxx:799
libstaroffice_internal.hxx
STOFFEmbeddedObject::m_typeList
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition: libstaroffice_internal.hxx:454
STOFFBox2::STOFFBox2
STOFFBox2(STOFFBox2< U > const &p)
generic constructor
Definition: libstaroffice_internal.hxx:961
STOFFVec3::PosSizeLt
internal struct used to create sorted map, sorted by X, Y, Z
Definition: libstaroffice_internal.hxx:922
libstoff::DOC_TABLE
Definition: libstaroffice_internal.hxx:185
STOFFNote::EndNote
Definition: libstaroffice_internal.hxx:391
STOFFColor::isWhite
bool isWhite() const
return true if the color is white
Definition: libstaroffice_internal.hxx:282
STOFFBox2::getUnion
STOFFBox2< T > getUnion(STOFFBox2< T > const &box) const
returns the union between this and box
Definition: libstaroffice_internal.hxx:1056
STOFFBorderLine::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFBorderLine const &border)
operator<<
Definition: libstaroffice_internal.cxx:282
STOFFVec2::operator[]
T operator[](int c) const
operator[]
Definition: libstaroffice_internal.hxx:603
STOFFBox2::scale
void scale(U factor)
scales all points of the box by factor
Definition: libstaroffice_internal.hxx:1042
STOFFBorderLine::m_distance
int m_distance
the border distance
Definition: libstaroffice_internal.hxx:359
STOFFVec3
small class which defines a vector with 3 elements
Definition: libstaroffice_internal.hxx:772
STOFFEmbeddedObject::m_filenameLink
librevenge::RVNGString m_filenameLink
a picture link
Definition: libstaroffice_internal.hxx:456
STOFFVariable
a generic variable template: value + flag to know if the variable is set
Definition: libstaroffice_internal.hxx:505
STOFFSubDocumentPtr
std::shared_ptr< STOFFSubDocument > STOFFSubDocumentPtr
a smart pointer of STOFFSubDocument
Definition: libstaroffice_internal.hxx:495
STOFFVec3::cmp
int cmp(STOFFVec3< T > const &p) const
a comparison function: which first compares x values, then y values then z values.
Definition: libstaroffice_internal.hxx:903
libstoff::DOC_COMMENT_ANNOTATION
Definition: libstaroffice_internal.hxx:185
STOFFVec2::y
T y() const
second element
Definition: libstaroffice_internal.hxx:598
STOFFListManager
a manager which manages the lists, keeps the different kind of lists, to assure the unicity of each l...
Definition: STOFFList.hxx:205
STOFFBox2::size
STOFFVec2< T > size() const
the box size
Definition: libstaroffice_internal.hxx:995
libstoff::DOC_NONE
Definition: libstaroffice_internal.hxx:185
STOFF_shared_ptr_noop_deleter::operator()
void operator()(T *)
Definition: libstaroffice_internal.hxx:101
STOFFVec3::operator[]
T & operator[](int c)
operator[]
Definition: libstaroffice_internal.hxx:810
STOFFColor::getRed
unsigned char getRed() const
returns the red value
Definition: libstaroffice_internal.hxx:267
STOFFInputStreamPtr
std::shared_ptr< STOFFInputStream > STOFFInputStreamPtr
a smart pointer of STOFFInputStream
Definition: libstaroffice_internal.hxx:485
STOFFField::m_propertyList
librevenge::RVNGPropertyList m_propertyList
the property list
Definition: libstaroffice_internal.hxx:371
STOFFVec2::m_y
T m_y
second element
Definition: libstaroffice_internal.hxx:757
STOFFBox2l
STOFFBox2< long > STOFFBox2l
STOFFBox2 of long.
Definition: libstaroffice_internal.hxx:1133
libstoff::NONE
Definition: libstaroffice_internal.hxx:182
STOFFVec2::operator!=
bool operator!=(STOFFVec2< T > const &p) const
comparison!=
Definition: libstaroffice_internal.hxx:692
libstoff::SubDocumentType
SubDocumentType
Definition: libstaroffice_internal.hxx:185
STOFFEmbeddedObject::m_dataList
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition: libstaroffice_internal.hxx:452
STOFFColor::m_value
uint32_t m_value
the argb color
Definition: libstaroffice_internal.hxx:322
STOFFBox2::operator<
bool operator<(STOFFBox2< T > const &p) const
comparison operator< : fist sorts min by Y,X values then max extremity
Definition: libstaroffice_internal.hxx:1086
STOFFEmbeddedObject::STOFFEmbeddedObject
STOFFEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
constructor
Definition: libstaroffice_internal.hxx:414
STOFFBox2::extend
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition: libstaroffice_internal.hxx:1049
operator<<
std::ostream & operator<<(std::ostream &o, STOFFColor const &c)
Definition: libstaroffice_internal.cxx:214
STOFFEmbeddedObject::cmp
int cmp(STOFFEmbeddedObject const &pict) const
a comparison function
Definition: libstaroffice_internal.cxx:347
STOFFVec3b
STOFFVec3< bool > STOFFVec3b
STOFFVec3 of bool.
Definition: libstaroffice_internal.hxx:940
STOFFBox2::m_pt
STOFFVec2< T > m_pt[2]
the two extremities
Definition: libstaroffice_internal.hxx:1125
STOFFVec2::operator==
bool operator==(STOFFVec2< T > const &p) const
comparison==
Definition: libstaroffice_internal.hxx:687
STOFFColor::STOFFColor
STOFFColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition: libstaroffice_internal.hxx:195
libstoff::GenericException
Definition: libstaroffice_internal.hxx:147
STOFFSpreadsheetListener
This class contents the main functions needed to create a spreadsheet processing Document.
Definition: STOFFSpreadsheetListener.hxx:64
libstoff::DOC_HEADER_FOOTER_REGION
Definition: libstaroffice_internal.hxx:185
STOFFBorderLine::STOFFBorderLine
STOFFBorderLine()
constructor
Definition: libstaroffice_internal.hxx:328
STOFFVariable::operator=
STOFFVariable & operator=(T const &val)
set a value
Definition: libstaroffice_internal.hxx:522
STOFFVec2::cmp
int cmp(STOFFVec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libstaroffice_internal.hxx:702
STOFFVec3::setX
void setX(T xx)
resets the first element
Definition: libstaroffice_internal.hxx:824
libstoff::TopBit
Definition: libstaroffice_internal.hxx:180
STOFFVec2::set
void set(T xx, T yy)
resets the two elements
Definition: libstaroffice_internal.hxx:616
STOFFColor::operator!=
bool operator!=(STOFFColor const &c) const
operator!=
Definition: libstaroffice_internal.hxx:292
STOFFVec2< bool >::MapX
std::map< STOFFVec2< bool >, bool, struct PosSizeLtX > MapX
map of STOFFVec2
Definition: libstaroffice_internal.hxx:740
STOFFVec2::add
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition: libstaroffice_internal.hxx:633
libstoff::BULLET
Definition: libstaroffice_internal.hxx:182
STOFFVariable::operator*
const T & operator*() const
operator*
Definition: libstaroffice_internal.hxx:548
STOFFVec2::cmpY
int cmpY(STOFFVec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libstaroffice_internal.hxx:711
STOFFBorderLine::m_inWidth
int m_inWidth
the inline width in TWIP
Definition: libstaroffice_internal.hxx:355
libstoff::ParseException
Definition: libstaroffice_internal.hxx:143
libstoff::BottomBit
Definition: libstaroffice_internal.hxx:180
STOFFColor::STOFFColor
STOFFColor(uint32_t argb=0)
constructor
Definition: libstaroffice_internal.hxx:191
STOFFBorderLine::addTo
bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const
add the border property to proplist (if needed )
Definition: libstaroffice_internal.cxx:256
libstoff::DOC_CHART_ZONE
Definition: libstaroffice_internal.hxx:185
STOFFColor::setAlpha
void setAlpha(unsigned char alpha)
reset the alpha value
Definition: libstaroffice_internal.hxx:257
libstoff::HMiddle
Definition: libstaroffice_internal.hxx:178
STOFFGraphicListenerPtr
std::shared_ptr< STOFFGraphicListener > STOFFGraphicListenerPtr
a smart pointer of STOFFGraphicListener
Definition: libstaroffice_internal.hxx:481
STOFFHeader
a function used by STOFFDocument to store the version of document
Definition: STOFFHeader.hxx:56
libstoff::UPPERCASE_ROMAN
Definition: libstaroffice_internal.hxx:182
libstoff::LOWERCASE
Definition: libstaroffice_internal.hxx:182
STOFFFont
Class to store font.
Definition: STOFFFont.hxx:43
STOFFColor::operator>
bool operator>(STOFFColor const &c) const
operator>
Definition: libstaroffice_internal.hxx:307
STOFFVariable::operator=
STOFFVariable & operator=(STOFFVariable const &orig)
copy operator
Definition: libstaroffice_internal.hxx:513
STOFFEmbeddedObject::~STOFFEmbeddedObject
~STOFFEmbeddedObject()
destructor
Definition: libstaroffice_internal.cxx:293
STOFFVec3::operator==
bool operator==(STOFFVec3< T > const &p) const
comparison==
Definition: libstaroffice_internal.hxx:888
STOFFNote::STOFFNote
STOFFNote(Type type)
constructor
Definition: libstaroffice_internal.hxx:393
STOFFParser
virtual class which defines the ancestor of all main zone parser
Definition: STOFFParser.hxx:89
STOFFBox2::set
void set(STOFFVec2< T > const &x, STOFFVec2< T > const &y)
resets the data to minimum x and maximum y
Definition: libstaroffice_internal.hxx:1007
STOFFVec2f
STOFFVec2< float > STOFFVec2f
STOFFVec2 of float.
Definition: libstaroffice_internal.hxx:767
STOFFGraphicStyle
Class to store a graphic style.
Definition: STOFFGraphicStyle.hxx:44
libstoff::getScaleFactor
float getScaleFactor(librevenge::RVNGUnit orig, librevenge::RVNGUnit dest)
factor to convert from one unit to other
Definition: libstaroffice_internal.cxx:499
STOFFVariable::insert
void insert(STOFFVariable const &orig)
update the current value if orig is set
Definition: libstaroffice_internal.hxx:529
STOFFField::STOFFField
STOFFField()
basic constructor
Definition: libstaroffice_internal.hxx:365
STOFFBorderLine::m_color
STOFFColor m_color
the border color
Definition: libstaroffice_internal.hxx:357
STOFFVariable::STOFFVariable
STOFFVariable(T const &def)
constructor with a default value
Definition: libstaroffice_internal.hxx:509
STOFFBox2::PosSizeLt
internal struct used to create sorted map, sorted first min then max
Definition: libstaroffice_internal.hxx:1111
STOFFBox2::resizeFromCenter
void resizeFromCenter(STOFFVec2< T > const &sz)
resize the box keeping the center
Definition: libstaroffice_internal.hxx:1034
STOFFVec2::operator*=
STOFFVec2< T > & operator*=(U scale)
generic operator*=
Definition: libstaroffice_internal.hxx:659
STOFFVec2::operator+
friend STOFFVec2< T > operator+(STOFFVec2< T > const &p1, STOFFVec2< T > const &p2)
operator+
Definition: libstaroffice_internal.hxx:667
STOFFVec3::operator[]
T operator[](int c) const
operator[]
Definition: libstaroffice_internal.hxx:804
STOFFVariable::isSet
bool isSet() const
return true if the variable is set
Definition: libstaroffice_internal.hxx:564
STOFFBox2::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFBox2< T > const &f)
print data in form X0xY0<->X1xY1
Definition: libstaroffice_internal.hxx:1102
STOFFBox2::max
STOFFVec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libstaroffice_internal.hxx:982
libstoff::ARABIC
Definition: libstaroffice_internal.hxx:182
STOFFVec3::setY
void setY(T yy)
resets the second element
Definition: libstaroffice_internal.hxx:829
STOFFBox2::max
const STOFFVec2< T > & max() const
the maximum 2D point (in x and in y)
Definition: libstaroffice_internal.hxx:972
STOFFVec2::operator*
friend STOFFVec2< T > operator*(U scale, STOFFVec2< T > const &p1)
generic operator*
Definition: libstaroffice_internal.hxx:680
STOFFNote::m_label
librevenge::RVNGString m_label
the note label
Definition: libstaroffice_internal.hxx:399
STOFFVec3::add
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition: libstaroffice_internal.hxx:840
STOFFBorderLine::operator!=
bool operator!=(STOFFBorderLine const &orig) const
operator!=
Definition: libstaroffice_internal.hxx:344
libstoff::VMiddle
Definition: libstaroffice_internal.hxx:178
STOFFColor::operator==
bool operator==(STOFFColor const &c) const
operator==
Definition: libstaroffice_internal.hxx:287
STOFFColor::getGreen
unsigned char getGreen() const
returns the green value
Definition: libstaroffice_internal.hxx:272
STOFFNote::FootNote
Definition: libstaroffice_internal.hxx:391
STOFFBox2::operator[]
const STOFFVec2< T > & operator[](int c) const
the two extremum points which defined the box
Definition: libstaroffice_internal.hxx:989
STOFFBox2::setMin
void setMin(STOFFVec2< T > const &x)
resets the minimum point
Definition: libstaroffice_internal.hxx:1013
STOFFColor::operator<=
bool operator<=(STOFFColor const &c) const
operator<=
Definition: libstaroffice_internal.hxx:302
STOFFSection
a class which stores section properties
Definition: STOFFSection.hxx:45
STOFFVec2::setX
void setX(T xx)
resets the first element
Definition: libstaroffice_internal.hxx:622
STOFFBox2< int >::Map
std::map< STOFFBox2< int >, int, struct PosSizeLt > Map
map of STOFFBox2
Definition: libstaroffice_internal.hxx:1121
STOFFVec3::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFVec3< T > const &f)
operator<<: prints data in form "XxYxZ"
Definition: libstaroffice_internal.hxx:913
libstoff::convertToDateTime
bool convertToDateTime(uint32_t date, uint32_t time, std::string &dateTime)
convert a date/time in a date time format
Definition: libstaroffice_internal.cxx:389
STOFFColor::colorFromCMYK
static STOFFColor colorFromCMYK(unsigned char c, unsigned char m, unsigned char y, unsigned char k)
return a color from a cmyk color ( basic)
Definition: libstaroffice_internal.hxx:206
STOFFBox2::getIntersection
STOFFBox2< T > getIntersection(STOFFBox2< T > const &box) const
returns the intersection between this and box
Definition: libstaroffice_internal.hxx:1066
STOFFVec2::setY
void setY(T yy)
resets the second element
Definition: libstaroffice_internal.hxx:627
STOFFVec3f
STOFFVec3< float > STOFFVec3f
STOFFVec3 of float.
Definition: libstaroffice_internal.hxx:946
libstoff::Left
Definition: libstaroffice_internal.hxx:178
STOFFVec3::operator+=
STOFFVec3< T > & operator+=(STOFFVec3< T > const &p)
operator+=
Definition: libstaroffice_internal.hxx:848
STOFFListManagerPtr
std::shared_ptr< STOFFListManager > STOFFListManagerPtr
a smart pointer of STOFFListManager
Definition: libstaroffice_internal.hxx:489
LIBSTOFF_ATTRIBUTE_PRINTF
#define LIBSTOFF_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libstaroffice_internal.hxx:116
STOFFNote::m_type
Type m_type
the note type
Definition: libstaroffice_internal.hxx:397
libstoff::numberingTypeToString
std::string numberingTypeToString(NumberingType type)
Definition: libstaroffice_internal.cxx:124
STOFFList
a small structure used to store the informations about a list
Definition: STOFFList.hxx:105
STOFFColor::getBlue
unsigned char getBlue() const
returns the green value
Definition: libstaroffice_internal.hxx:262
libstoff::numberingValueToString
std::string numberingValueToString(NumberingType type, int value)
Definition: libstaroffice_internal.cxx:146
STOFFColor::getAlpha
unsigned char getAlpha() const
returns the alpha value
Definition: libstaroffice_internal.hxx:252
STOFFVec3::operator-
friend STOFFVec3< T > operator-(STOFFVec3< T > const &p1, STOFFVec3< T > const &p2)
operator-
Definition: libstaroffice_internal.hxx:874
STOFFVec3::x
T x() const
first element
Definition: libstaroffice_internal.hxx:789
libstoff::readU8
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libstaroffice_internal.cxx:52
STOFFVec3::operator<
bool operator<(STOFFVec3< T > const &p) const
comparison<: which first compares x values, then y values then z values.
Definition: libstaroffice_internal.hxx:898
STOFFVec3::y
T y() const
second element
Definition: libstaroffice_internal.hxx:794
STOFFInputStream
Internal class used to read the file stream Internal class used to read the file stream,...
Definition: STOFFInputStream.hxx:53
libstoff::HMiddleBit
Definition: libstaroffice_internal.hxx:180
STOFFNote::m_number
int m_number
the note number if defined
Definition: libstaroffice_internal.hxx:401
STOFFVec2b
STOFFVec2< bool > STOFFVec2b
STOFFVec2 of bool.
Definition: libstaroffice_internal.hxx:761
STOFFVariable::STOFFVariable
STOFFVariable()
constructor
Definition: libstaroffice_internal.hxx:507
STOFFVec2::STOFFVec2
STOFFVec2(T xx=0, T yy=0)
constructor
Definition: libstaroffice_internal.hxx:588
libstoff::splitString
void splitString(librevenge::RVNGString const &string, librevenge::RVNGString const &delim, librevenge::RVNGString &string1, librevenge::RVNGString &string2)
split a string in two. If the delimiter is not present, string1=string
Definition: libstaroffice_internal.cxx:414
M_PI
#define M_PI
Definition: libstaroffice_internal.hxx:52
STOFFVec2::PosSizeLtX
internal struct used to create sorted map, sorted by X
Definition: libstaroffice_internal.hxx:730
STOFFField::addTo
void addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist (if possible)
Definition: libstaroffice_internal.cxx:234
STOFFVec3::operator+
friend STOFFVec3< T > operator+(STOFFVec3< T > const &p1, STOFFVec3< T > const &p2)
operator+
Definition: libstaroffice_internal.hxx:868
libstoff::RightBit
Definition: libstaroffice_internal.hxx:180
STOFFVec3::set
void set(T xx, T yy, T zz)
resets the three elements
Definition: libstaroffice_internal.hxx:817
libstoff::checkAddOverflow
bool checkAddOverflow(T x, T y)
checks whether addition of x and y would overflow
Definition: libstaroffice_internal.hxx:167
libstoff::LOWERCASE_ROMAN
Definition: libstaroffice_internal.hxx:182
STOFFListener
This class contains a virtual interface to all listener.
Definition: STOFFListener.hxx:50
STOFFNote::Type
Type
enum to define note type
Definition: libstaroffice_internal.hxx:391
STOFFVariable::get
const T & get() const
return the current value
Definition: libstaroffice_internal.hxx:559
STOFFVec2::m_x
T m_x
first element
Definition: libstaroffice_internal.hxx:757
libstoff::UPPERCASE
Definition: libstaroffice_internal.hxx:182
STOFFVec2i
STOFFVec2< int > STOFFVec2i
STOFFVec2 of int.
Definition: libstaroffice_internal.hxx:763
STOFFVec2::operator<
bool operator<(STOFFVec2< T > const &p) const
comparison<: sort by y
Definition: libstaroffice_internal.hxx:697
STOFFVec2::STOFFVec2
STOFFVec2(STOFFVec2< U > const &p)
generic copy constructor
Definition: libstaroffice_internal.hxx:590
STOFFColor::isBlack
bool isBlack() const
return true if the color is black
Definition: libstaroffice_internal.hxx:277
libstoff::rotatePointAroundCenter
STOFFVec2f rotatePointAroundCenter(STOFFVec2f const &point, STOFFVec2f const &center, float angle)
rotate a point around center, angle is given in degree
Definition: libstaroffice_internal.cxx:471
libstoff
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition: libstaroffice_internal.cxx:50
libstoff::Position
Position
basic position enum
Definition: libstaroffice_internal.hxx:178
STOFFTextListenerPtr
std::shared_ptr< STOFFTextListener > STOFFTextListenerPtr
a smart pointer of STOFFTextListener
Definition: libstaroffice_internal.hxx:497
libstoff::Right
Definition: libstaroffice_internal.hxx:178
STOFFBorderLine::isEmpty
bool isEmpty() const
returns true if the border is empty
Definition: libstaroffice_internal.hxx:334
libstoff::NumberingType
NumberingType
Definition: libstaroffice_internal.hxx:182
STOFFColor::white
static STOFFColor white()
return the white color
Definition: libstaroffice_internal.hxx:238
libstoff::DOC_NOTE
Definition: libstaroffice_internal.hxx:185
STOFF_shared_ptr_noop_deleter
an noop deleter used to transform a libwpd pointer in a false std::shared_ptr
Definition: libstaroffice_internal.hxx:100
STOFFColor::colorFromHSL
static STOFFColor colorFromHSL(unsigned char H, unsigned char S, unsigned char L)
return a color from a hsl color (basic)
Definition: libstaroffice_internal.hxx:216
STOFFEmbeddedObject::STOFFEmbeddedObject
STOFFEmbeddedObject()
empty constructor
Definition: libstaroffice_internal.hxx:410
STOFFVec3< bool >::Map
std::map< STOFFVec3< bool >, bool, struct PosSizeLt > Map
map of STOFFVec3
Definition: libstaroffice_internal.hxx:932
STOFFVec2l
STOFFVec2< long > STOFFVec2l
STOFFVec2 of long.
Definition: libstaroffice_internal.hxx:765
STOFFVec2::operator-=
STOFFVec2< T > & operator-=(STOFFVec2< T > const &p)
operator-=
Definition: libstaroffice_internal.hxx:648
STOFFBorderLine::m_outWidth
int m_outWidth
the outline width in TWIP
Definition: libstaroffice_internal.hxx:353
STOFFColor::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFColor const &c)
operator<< in the form #rrggbb
Definition: libstaroffice_internal.cxx:214
STOFFBox2::min
const STOFFVec2< T > & min() const
the minimum 2D point (in x and in y)
Definition: libstaroffice_internal.hxx:967
STOFFVec2::PosSizeLtY::operator()
bool operator()(STOFFVec2< T > const &s1, STOFFVec2< T > const &s2) const
comparaison function
Definition: libstaroffice_internal.hxx:747
STOFFEmbeddedObject::isEmpty
bool isEmpty() const
return true if the picture contains no data
Definition: libstaroffice_internal.hxx:422
libstoff::Bottom
Definition: libstaroffice_internal.hxx:178
STOFFEmbeddedObject::add
void add(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
add a picture
Definition: libstaroffice_internal.hxx:433

Generated on Mon Jan 20 2020 23:02:16 for libstaroffice by doxygen 1.8.16