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
60typedef signed char int8_t;
61typedef unsigned char uint8_t;
62typedef signed short int16_t;
63typedef unsigned short uint16_t;
64typedef signed int int32_t;
65typedef unsigned int uint32_t;
66typedef unsigned __int64 uint64_t;
67typedef __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 --------------- */
100template <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
123namespace libmwaw
124{
125void 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
132namespace libmwaw
133{
134// Various exceptions:
136{
137};
138
140{
141};
142
144{
145};
146
148{
149};
150
152{
153};
154}
155
156/* ---------- input ----------------- */
157namespace libmwaw
158{
159uint8_t readU8(librevenge::RVNGInputStream *input);
161void appendUnicode(uint32_t val, librevenge::RVNGString &buffer);
162
164template<typename T>
165bool 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 ------------- */
173namespace libmwaw
174{
176enum Position { Left = 0, Right = 1, Top = 2, Bottom = 3, HMiddle = 4, VMiddle = 5 };
178enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08, HMiddleBit = 0x10, VMiddleBit = 0x20 };
179
181std::string numberingTypeToString(NumberingType type);
182std::string numberingValueToString(NumberingType type, int value);
183
187std::string writingModeToString(WritingMode mode);
189}
190
192struct 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;
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 }
246 {
247 return MWAWColor(0,0,0);
248 }
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;
327protected:
329 uint32_t m_value;
330};
331
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;
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 ||
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
399struct MWAWField {
402
404 explicit MWAWField(Type type)
405 : m_type(type)
406 , m_numberingType(libmwaw::ARABIC)
407 , m_DTFormat("")
408 , m_data("")
409 {
410 }
411 MWAWField(MWAWField &&) = default;
412 MWAWField(MWAWField const &) = default;
413 MWAWField &operator=(MWAWField const &) = 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
430struct MWAWLink {
433 : m_HRef("")
434 {
435 }
436
438 bool addTo(librevenge::RVNGPropertyList &propList) const;
439
441 std::string m_HRef;
442};
443
445struct MWAWNote {
449 explicit MWAWNote(Type type)
450 : m_type(type)
451 , m_label("")
452 , m_number(-1)
453 {
454 }
458 librevenge::RVNGString m_label;
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 }
486 bool isEmpty() const
487 {
488 for (auto const &data : m_dataList) {
489 if (!data.empty())
490 return false;
491 }
492 return true;
493 }
495 void add(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
496 {
497 size_t pos=m_dataList.size();
498 if (pos<m_typeList.size()) pos=m_typeList.size();
499 m_dataList.resize(pos+1);
500 m_dataList[pos]=binaryData;
501 m_typeList.resize(pos+1);
502 m_typeList[pos]=type;
503 }
505 bool addTo(librevenge::RVNGPropertyList &propList) const;
507 friend std::ostream &operator<<(std::ostream &o, MWAWEmbeddedObject const &pict);
509 int cmp(MWAWEmbeddedObject const &pict) const;
510
512 std::vector<librevenge::RVNGBinaryData> m_dataList;
514 std::vector<std::string> m_typeList;
515};
516
517// forward declarations of basic classes and smart pointers
518struct MWAWStream;
519class MWAWEntry;
520class MWAWFont;
522class MWAWGraphicShape;
523class MWAWGraphicStyle;
524class MWAWHeader;
525class MWAWList;
526class MWAWPageSpan;
527class MWAWParagraph;
528class MWAWParser;
529class MWAWPosition;
530class MWAWSection;
531
533class MWAWFontManager;
535class MWAWInputStream;
536class MWAWListener;
537class MWAWListManager;
538class MWAWParserState;
540class MWAWRSRCParser;
542class MWAWSubDocument;
543class MWAWTextListener;
545typedef std::shared_ptr<MWAWFontConverter> MWAWFontConverterPtr;
547typedef std::shared_ptr<MWAWFontManager> MWAWFontManagerPtr;
549typedef std::shared_ptr<MWAWGraphicListener> MWAWGraphicListenerPtr;
551typedef std::shared_ptr<MWAWInputStream> MWAWInputStreamPtr;
553typedef std::shared_ptr<MWAWListener> MWAWListenerPtr;
555typedef std::shared_ptr<MWAWListManager> MWAWListManagerPtr;
557typedef std::shared_ptr<MWAWParserState> MWAWParserStatePtr;
559typedef std::shared_ptr<MWAWPresentationListener> MWAWPresentationListenerPtr;
561typedef std::shared_ptr<MWAWRSRCParser> MWAWRSRCParserPtr;
563typedef std::shared_ptr<MWAWSpreadsheetListener> MWAWSpreadsheetListenerPtr;
565typedef std::shared_ptr<MWAWSubDocument> MWAWSubDocumentPtr;
567typedef std::shared_ptr<MWAWTextListener> MWAWTextListenerPtr;
568
577template <class T> struct MWAWVariable {
580 : m_data()
581 , m_set(false) {}
583 explicit MWAWVariable(T const &def)
584 : m_data(def)
585 , m_set(false) {}
588 : m_data(orig.m_data)
589 , m_set(orig.m_set) {}
593 MWAWVariable &operator=(T const &val)
594 {
595 m_data = val;
596 m_set = true;
597 return std::forward<MWAWVariable &>(*this);
598 }
600 void insert(MWAWVariable const &orig)
601 {
602 if (orig.m_set) {
603 m_data = orig.m_data;
604 m_set = orig.m_set;
605 }
606 }
608 T const *operator->() const
609 {
610 return &m_data;
611 }
614 {
615 m_set = true;
616 return &m_data;
617 }
619 T const &operator*() const
620 {
621 return m_data;
622 }
625 {
626 m_set = true;
627 return m_data;
628 }
630 T const &get() const
631 {
632 return m_data;
633 }
635 bool isSet() const
636 {
637 return m_set;
638 }
640 void setSet(bool newVal)
641 {
642 m_set=newVal;
643 }
644protected:
648 bool m_set;
649};
650
651/* ---------- vec2/box2f ------------- */
655template <class T> class MWAWVec2
656{
657public:
659 explicit MWAWVec2(T xx=0,T yy=0)
660 : m_x(xx)
661 , m_y(yy) { }
663 template <class U> explicit MWAWVec2(MWAWVec2<U> const &p)
664 : m_x(T(p.x()))
665 , m_y(T(p.y())) {}
666
668 T x() const
669 {
670 return m_x;
671 }
673 T y() const
674 {
675 return m_y;
676 }
678 T operator[](int c) const
679 {
680 if (c<0 || c>1) throw libmwaw::GenericException();
681 return (c==0) ? m_x : m_y;
682 }
684 T &operator[](int c)
685 {
686 if (c<0 || c>1) throw libmwaw::GenericException();
687 return (c==0) ? m_x : m_y;
688 }
689
691 void set(T xx, T yy)
692 {
693 m_x = xx;
694 m_y = yy;
695 }
697 void setX(T xx)
698 {
699 m_x = xx;
700 }
702 void setY(T yy)
703 {
704 m_y = yy;
705 }
706
708 void add(T dx, T dy)
709 {
712 m_x += dx;
713 m_y += dy;
714 }
715
718 {
719 add(p.m_x, p.m_y);
720 return *this;
721 }
724 {
725 // check if negation of either of the coords will cause overflow
726 const T diff = std::numeric_limits<T>::min() + std::numeric_limits<T>::max();
729 add(-p.m_x, -p.m_y);
730 return *this;
731 }
733 template <class U>
735 {
736 m_x = T(m_x*scale);
737 m_y = T(m_y*scale);
738 return *this;
739 }
740
742 friend MWAWVec2<T> operator+(MWAWVec2<T> const &p1, MWAWVec2<T> const &p2)
743 {
744 MWAWVec2<T> p(p1);
745 return p+=p2;
746 }
748 friend MWAWVec2<T> operator-(MWAWVec2<T> const &p1, MWAWVec2<T> const &p2)
749 {
750 MWAWVec2<T> p(p1);
751 return p-=p2;
752 }
754 template <class U>
755 friend MWAWVec2<T> operator*(U scale, MWAWVec2<T> const &p1)
756 {
757 MWAWVec2<T> p(p1);
758 return p *= scale;
759 }
760
762 bool operator==(MWAWVec2<T> const &p) const
763 {
764 return cmpY(p) == 0;
765 }
767 bool operator!=(MWAWVec2<T> const &p) const
768 {
769 return cmpY(p) != 0;
770 }
772 bool operator<(MWAWVec2<T> const &p) const
773 {
774 return cmpY(p) < 0;
775 }
777 int cmp(MWAWVec2<T> const &p) const
778 {
779 if (m_x < p.m_x) return -1;
780 if (m_x > p.m_x) return 1;
781 if (m_y < p.m_y) return -1;
782 if (m_y > p.m_y) return 1;
783 return 0;
784 }
786 int cmpY(MWAWVec2<T> const &p) const
787 {
788 if (m_y < p.m_y) return -1;
789 if (m_y > p.m_y) return 1;
790 if (m_x < p.m_x) return -1;
791 if (m_x > p.m_x) return 1;
792 return 0;
793 }
794
796 friend std::ostream &operator<< (std::ostream &o, MWAWVec2<T> const &f)
797 {
798 o << f.m_x << "x" << f.m_y;
799 return o;
800 }
801
805 struct PosSizeLtX {
807 bool operator()(MWAWVec2<T> const &s1, MWAWVec2<T> const &s2) const
808 {
809 return s1.cmp(s2) < 0;
810 }
811 };
815 typedef std::map<MWAWVec2<T>, T,struct PosSizeLtX> MapX;
816
820 struct PosSizeLtY {
822 bool operator()(MWAWVec2<T> const &s1, MWAWVec2<T> const &s2) const
823 {
824 return s1.cmpY(s2) < 0;
825 }
826 };
830 typedef std::map<MWAWVec2<T>, T,struct PosSizeLtY> MapY;
831protected:
833};
834
843
847template <class T> class MWAWVec3
848{
849public:
851 explicit MWAWVec3(T xx=0,T yy=0,T zz=0)
852 {
853 m_val[0] = xx;
854 m_val[1] = yy;
855 m_val[2] = zz;
856 }
858 template <class U> explicit MWAWVec3(MWAWVec3<U> const &p)
859 {
860 for (int c = 0; c < 3; c++) m_val[c] = T(p[c]);
861 }
862
864 T x() const
865 {
866 return m_val[0];
867 }
869 T y() const
870 {
871 return m_val[1];
872 }
874 T z() const
875 {
876 return m_val[2];
877 }
879 T operator[](int c) const
880 {
881 if (c<0 || c>2) throw libmwaw::GenericException();
882 return m_val[c];
883 }
885 T &operator[](int c)
886 {
887 if (c<0 || c>2) throw libmwaw::GenericException();
888 return m_val[c];
889 }
890
892 void set(T xx, T yy, T zz)
893 {
894 m_val[0] = xx;
895 m_val[1] = yy;
896 m_val[2] = zz;
897 }
899 void setX(T xx)
900 {
901 m_val[0] = xx;
902 }
904 void setY(T yy)
905 {
906 m_val[1] = yy;
907 }
909 void setZ(T zz)
910 {
911 m_val[2] = zz;
912 }
913
915 void add(T dx, T dy, T dz)
916 {
917 m_val[0] += dx;
918 m_val[1] += dy;
919 m_val[2] += dz;
920 }
921
924 {
925 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]);
926 return *this;
927 }
930 {
931 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]-p.m_val[c]);
932 return *this;
933 }
935 template <class U>
937 {
938 for (auto &c : m_val) c = T(c*scale);
939 return *this;
940 }
941
943 friend MWAWVec3<T> operator+(MWAWVec3<T> const &p1, MWAWVec3<T> const &p2)
944 {
945 MWAWVec3<T> p(p1);
946 return p+=p2;
947 }
949 friend MWAWVec3<T> operator-(MWAWVec3<T> const &p1, MWAWVec3<T> const &p2)
950 {
951 MWAWVec3<T> p(p1);
952 return p-=p2;
953 }
955 template <class U>
956 friend MWAWVec3<T> operator*(U scale, MWAWVec3<T> const &p1)
957 {
958 MWAWVec3<T> p(p1);
959 return p *= scale;
960 }
961
963 bool operator==(MWAWVec3<T> const &p) const
964 {
965 return cmp(p) == 0;
966 }
968 bool operator!=(MWAWVec3<T> const &p) const
969 {
970 return cmp(p) != 0;
971 }
973 bool operator<(MWAWVec3<T> const &p) const
974 {
975 return cmp(p) < 0;
976 }
978 int cmp(MWAWVec3<T> const &p) const
979 {
980 for (int c = 0; c < 3; c++) {
981 if (m_val[c]<p.m_val[c]) return -1;
982 if (m_val[c]>p.m_val[c]) return 1;
983 }
984 return 0;
985 }
986
988 friend std::ostream &operator<< (std::ostream &o, MWAWVec3<T> const &f)
989 {
990 o << f.m_val[0] << "x" << f.m_val[1] << "x" << f.m_val[2];
991 return o;
992 }
993
997 struct PosSizeLt {
999 bool operator()(MWAWVec3<T> const &s1, MWAWVec3<T> const &s2) const
1000 {
1001 return s1.cmp(s2) < 0;
1002 }
1003 };
1007 typedef std::map<MWAWVec3<T>, T,struct PosSizeLt> Map;
1008
1009protected:
1011 T m_val[3];
1012};
1013
1020
1024template <class T> class MWAWBox2
1025{
1026public:
1029 : m_data(minPt, maxPt)
1030 {
1031 }
1033 template <class U> explicit MWAWBox2(MWAWBox2<U> const &p)
1034 : m_data(MWAWVec2<T>(p.min()), MWAWVec2<T>(p.max()))
1035 {
1036 }
1037
1039 MWAWVec2<T> const &min() const
1040 {
1041 return m_data.first;
1042 }
1044 MWAWVec2<T> const &max() const
1045 {
1046 return m_data.second;
1047 }
1050 {
1051 return m_data.first;
1052 }
1055 {
1056 return m_data.second;
1057 }
1061 MWAWVec2<T> const &operator[](int c) const
1062 {
1063 if (c<0 || c>1) throw libmwaw::GenericException();
1064 return c==0 ? m_data.first : m_data.second;
1065 }
1068 {
1069 return m_data.second-m_data.first;
1070 }
1073 {
1074 return MWAWVec2<T>((m_data.first.x()+m_data.second.x())/2,
1075 (m_data.first.y()+m_data.second.y())/2);
1076 }
1077
1079 void set(MWAWVec2<T> const &x, MWAWVec2<T> const &y)
1080 {
1081 m_data.first = x;
1082 m_data.second = y;
1083 }
1085 void setMin(MWAWVec2<T> const &x)
1086 {
1087 m_data.first = x;
1088 }
1090 void setMax(MWAWVec2<T> const &y)
1091 {
1092 m_data.second = y;
1093 }
1094
1097 {
1098 m_data.second = m_data.first+sz;
1099 }
1102 {
1103 m_data.first = m_data.second-sz;
1104 }
1107 {
1108 MWAWVec2<T> centerPt = center();
1109 MWAWVec2<T> decal(sz.x()/2,sz.y()/2);
1110 m_data.first = centerPt - decal;
1111 m_data.second = centerPt + (sz - decal);
1112 }
1113
1115 template <class U> void scale(U factor)
1116 {
1117 m_data.first *= factor;
1118 m_data.second *= factor;
1119 }
1120
1122 void extend(T val)
1123 {
1124 m_data.first -= MWAWVec2<T>(val/2,val/2);
1125 m_data.second += MWAWVec2<T>(val-(val/2),val-(val/2));
1126 }
1127
1130 {
1131 MWAWBox2<T> res;
1132 res.m_data.first=MWAWVec2<T>(m_data.first[0]<box.m_data.first[0]?m_data.first[0] : box.m_data.first[0],
1133 m_data.first[1]<box.m_data.first[1]?m_data.first[1] : box.m_data.first[1]);
1134 res.m_data.second=MWAWVec2<T>(m_data.second[0]>box.m_data.second[0]?m_data.second[0] : box.m_data.second[0],
1135 m_data.second[1]>box.m_data.second[1]?m_data.second[1] : box.m_data.second[1]);
1136 return res;
1137 }
1140 {
1141 MWAWBox2<T> res;
1142 res.m_data.first=MWAWVec2<T>(m_data.first[0]>box.m_data.first[0]?m_data.first[0] : box.m_data.first[0],
1143 m_data.first[1]>box.m_data.first[1]?m_data.first[1] : box.m_data.first[1]);
1144 res.m_data.second=MWAWVec2<T>(m_data.second[0]<box.m_data.second[0]?m_data.second[0] : box.m_data.second[0],
1145 m_data.second[1]<box.m_data.second[1]?m_data.second[1] : box.m_data.second[1]);
1146 return res;
1147 }
1149 bool operator==(MWAWBox2<T> const &mat) const
1150 {
1151 return m_data==mat.m_data;
1152 }
1154 bool operator!=(MWAWBox2<T> const &mat) const
1155 {
1156 return m_data!=mat.m_data;
1157 }
1159 bool operator<(MWAWBox2<T> const &mat) const
1160 {
1161 return m_data<mat.m_data;
1162 }
1164 bool operator<=(MWAWBox2<T> const &mat) const
1165 {
1166 return m_data<=mat.m_data;
1167 }
1169 bool operator>(MWAWBox2<T> const &mat) const
1170 {
1171 return m_data>mat.m_data;
1172 }
1174 bool operator>=(MWAWBox2<T> const &mat) const
1175 {
1176 return m_data>=mat.m_data;
1177 }
1179 friend std::ostream &operator<< (std::ostream &o, MWAWBox2<T> const &f)
1180 {
1181 o << "(" << f.min() << "<->" << f.max() << ")";
1182 return o;
1183 }
1184
1185protected:
1187 std::pair<MWAWVec2<T>, MWAWVec2<T> > m_data;
1188};
1189
1196
1199{
1200public:
1202 explicit MWAWTransformation(MWAWVec3f const &xRow=MWAWVec3f(1,0,0), MWAWVec3f const &yRow=MWAWVec3f(0,1,0))
1203 : m_data(xRow, yRow)
1204 , m_isIdentity(false)
1205 {
1206 checkIdentity();
1207 }
1209 bool isIdentity() const
1210 {
1211 return m_isIdentity;
1212 }
1214 void checkIdentity() const
1215 {
1216 m_isIdentity= m_data.first==MWAWVec3f(1,0,0) && m_data.second==MWAWVec3f(0,1,0);
1217 }
1221 MWAWVec3f const &operator[](int c) const
1222 {
1223 if (c<0 || c>1) throw libmwaw::GenericException();
1224 return c==0 ? m_data.first : m_data.second;
1225 }
1228 {
1229 if (m_isIdentity) return pt;
1230 return multiplyDirection(pt)+MWAWVec2f(m_data.first[2],m_data.second[2]);
1231 }
1234 {
1235 if (m_isIdentity) return dir;
1236 MWAWVec2f res;
1237 for (int coord=0; coord<2; ++coord) {
1238 MWAWVec3f const &row=coord==0 ? m_data.first : m_data.second;
1239 float value=0;
1240 for (int i=0; i<2; ++i)
1241 value+=row[i]*dir[i];
1242 res[coord]=value;
1243 }
1244 return res;
1245 }
1248 {
1249 if (m_isIdentity) return box;
1250 return MWAWBox2f(operator*(box.min()), operator*(box.max()));
1251 }
1254 {
1255 if (mat.m_isIdentity) return *this;
1257 for (int row=0; row<2; ++row) {
1258 MWAWVec3f &resRow=row==0 ? res.m_data.first : res.m_data.second;
1259 for (int col=0; col<3; ++col) {
1260 float value=0;
1261 for (int i=0; i<3; ++i)
1262 value+=(*this)[row][i]*(i==2 ? (col==2 ? 1.f : 0.f) : mat[i][col]);
1263 resRow[col]=value;
1264 }
1265 }
1266 res.checkIdentity();
1267 return res;
1268 }
1271 {
1272 if (!mat.m_isIdentity)
1273 *this=(*this)*mat;
1274 return *this;
1275 }
1277 bool operator==(MWAWTransformation const &mat) const
1278 {
1279 return m_data==mat.m_data;
1280 }
1282 bool operator!=(MWAWTransformation const &mat) const
1283 {
1284 return m_data!=mat.m_data;
1285 }
1287 bool operator<(MWAWTransformation const &mat) const
1288 {
1289 return m_data<mat.m_data;
1290 }
1292 bool operator<=(MWAWTransformation const &mat) const
1293 {
1294 return m_data<=mat.m_data;
1295 }
1297 bool operator>(MWAWTransformation const &mat) const
1298 {
1299 return m_data>mat.m_data;
1300 }
1302 bool operator>=(MWAWTransformation const &mat) const
1303 {
1304 return m_data>=mat.m_data;
1305 }
1309 bool decompose(float &rotation, MWAWVec2f &shearing, MWAWTransformation &transform, MWAWVec2f const &center) const;
1310
1313 {
1314 return MWAWTransformation(MWAWVec3f(1, 0, trans[0]), MWAWVec3f(0, 1, trans[1]));
1315 }
1318 {
1319 return MWAWTransformation(MWAWVec3f(trans[0], 0, 0), MWAWVec3f(0, trans[1], 0));
1320 }
1324 static MWAWTransformation rotation(float angle, MWAWVec2f const &center=MWAWVec2f(0,0));
1329 {
1330 return MWAWTransformation(MWAWVec3f(1, s[0], -s[0]*center[1]), MWAWVec3f(s[1], 1, -s[1]*center[0]));
1331 }
1332protected:
1334 std::pair<MWAWVec3f, MWAWVec3f > m_data;
1336 mutable bool m_isIdentity;
1337};
1338
1339// some format function
1340namespace libmwaw
1341{
1343bool convertDTFormat(std::string const &dtFormat, librevenge::RVNGPropertyListVector &propVect);
1344}
1345
1346// some geometrical function
1347namespace libmwaw
1348{
1350MWAWVec2f rotatePointAroundCenter(MWAWVec2f const &point, MWAWVec2f const &center, float angle);
1352MWAWBox2f rotateBoxFromCenter(MWAWBox2f const &box, float angle);
1353}
1354#endif /* LIBMWAW_INTERNAL_H */
1355// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
small class which defines a 2D Box
Definition: libmwaw_internal.hxx:1025
MWAWBox2(MWAWBox2< U > const &p)
generic constructor
Definition: libmwaw_internal.hxx:1033
bool operator>(MWAWBox2< T > const &mat) const
operator>
Definition: libmwaw_internal.hxx:1169
MWAWVec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:1044
void resizeFromCenter(MWAWVec2< T > const &sz)
resize the box keeping the center
Definition: libmwaw_internal.hxx:1106
MWAWVec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:1049
MWAWVec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:1039
void scale(U factor)
scales all points of the box by factor
Definition: libmwaw_internal.hxx:1115
bool operator==(MWAWBox2< T > const &mat) const
operator==
Definition: libmwaw_internal.hxx:1149
MWAWVec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:1054
void setMin(MWAWVec2< T > const &x)
resets the minimum point
Definition: libmwaw_internal.hxx:1085
MWAWVec2< T > center() const
the box center
Definition: libmwaw_internal.hxx:1072
bool operator<=(MWAWBox2< T > const &mat) const
operator<=
Definition: libmwaw_internal.hxx:1164
friend std::ostream & operator<<(std::ostream &o, MWAWBox2< T > const &f)
print data in form X0xY0<->X1xY1
Definition: libmwaw_internal.hxx:1179
bool operator<(MWAWBox2< T > const &mat) const
operator<
Definition: libmwaw_internal.hxx:1159
bool operator!=(MWAWBox2< T > const &mat) const
operator!=
Definition: libmwaw_internal.hxx:1154
void set(MWAWVec2< T > const &x, MWAWVec2< T > const &y)
resets the data to minimum x and maximum y
Definition: libmwaw_internal.hxx:1079
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition: libmwaw_internal.hxx:1122
bool operator>=(MWAWBox2< T > const &mat) const
operator>=
Definition: libmwaw_internal.hxx:1174
MWAWBox2< T > getIntersection(MWAWBox2< T > const &box) const
returns the intersection between this and box
Definition: libmwaw_internal.hxx:1139
void resizeFromMax(MWAWVec2< T > const &sz)
resize the box keeping the maximum
Definition: libmwaw_internal.hxx:1101
void resizeFromMin(MWAWVec2< T > const &sz)
resize the box keeping the minimum
Definition: libmwaw_internal.hxx:1096
MWAWVec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition: libmwaw_internal.hxx:1061
MWAWVec2< T > size() const
the box size
Definition: libmwaw_internal.hxx:1067
MWAWBox2(MWAWVec2< T > minPt=MWAWVec2< T >(), MWAWVec2< T > maxPt=MWAWVec2< T >())
constructor
Definition: libmwaw_internal.hxx:1028
std::pair< MWAWVec2< T >, MWAWVec2< T > > m_data
the data
Definition: libmwaw_internal.hxx:1187
void setMax(MWAWVec2< T > const &y)
resets the maximum point
Definition: libmwaw_internal.hxx:1090
MWAWBox2< T > getUnion(MWAWBox2< T > const &box) const
returns the union between this and box
Definition: libmwaw_internal.hxx:1129
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:47
a namespace used to convert Mac font characters in unicode
Definition: MWAWFontConverter.hxx:63
a font manager which can be used to store fonts, ...
Definition: MWAWFont.hxx:583
Class to store font.
Definition: MWAWFont.hxx:44
main class used to define store librevenge::RVNGDrawingInterface lists of command in a librevenge::RV...
Definition: MWAWGraphicEncoder.hxx:56
This class contains the code needed to create Graphic document.
Definition: MWAWGraphicListener.hxx:60
a structure used to define a picture shape
Definition: MWAWGraphicShape.hxx:46
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:48
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:57
Internal class used to read the file stream Internal class used to read the file stream,...
Definition: MWAWInputStream.hxx:54
a manager which manages the lists, keeps the different kind of lists, to assure the unicity of each l...
Definition: MWAWList.hxx:216
a small structure used to store the informations about a list
Definition: MWAWList.hxx:123
This class contains a virtual interface to all listener.
Definition: MWAWListener.hxx:50
A class which defines the page properties.
Definition: MWAWPageSpan.hxx:99
class to store the paragraph properties
Definition: MWAWParagraph.hxx:85
a class to define the parser state
Definition: MWAWParser.hxx:50
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:100
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: MWAWPosition.hxx:48
This class contains code needed to write a presention document.
Definition: MWAWPresentationListener.hxx:60
the main class to read a Mac resource fork
Definition: MWAWRSRCParser.hxx:47
a class which stores section properties
Definition: MWAWSection.hxx:46
This class contents the main functions needed to create a spreadsheet processing Document.
Definition: MWAWSpreadsheetListener.hxx:66
abstract class used to store a subdocument (with a comparison function)
Definition: MWAWSubDocument.hxx:42
This class contents the main functions needed to create a Word processing Document.
Definition: MWAWTextListener.hxx:65
a transformation which stored the first row of a 3x3 perspective matrix
Definition: libmwaw_internal.hxx:1199
MWAWVec2f multiplyDirection(MWAWVec2f const &dir) const
operator* for direction
Definition: libmwaw_internal.hxx:1233
void checkIdentity() const
check if a matrix is the identity matrix
Definition: libmwaw_internal.hxx:1214
static MWAWTransformation shear(MWAWVec2f s, MWAWVec2f const &center=MWAWVec2f(0, 0))
returns a shear transformation letting center invariant, ie.
Definition: libmwaw_internal.hxx:1328
static MWAWTransformation scale(MWAWVec2f const &trans)
returns a scaling transformation
Definition: libmwaw_internal.hxx:1317
static MWAWTransformation rotation(float angle, MWAWVec2f const &center=MWAWVec2f(0, 0))
returns a rotation transformation around center.
Definition: libmwaw_internal.cxx:646
MWAWBox2f operator*(MWAWBox2f const &box) const
operator* for box2f
Definition: libmwaw_internal.hxx:1247
MWAWVec2f operator*(MWAWVec2f const &pt) const
operator* for vec2f
Definition: libmwaw_internal.hxx:1227
MWAWVec3f const & operator[](int c) const
the two extremum points which defined the box
Definition: libmwaw_internal.hxx:1221
bool isIdentity() const
returns true if the matrix is an identity matrix
Definition: libmwaw_internal.hxx:1209
bool operator>=(MWAWTransformation const &mat) const
operator>=
Definition: libmwaw_internal.hxx:1302
MWAWTransformation & operator*=(MWAWTransformation const &mat)
operator*=
Definition: libmwaw_internal.hxx:1270
MWAWTransformation operator*(MWAWTransformation const &mat) const
operator* for transform
Definition: libmwaw_internal.hxx:1253
static MWAWTransformation translation(MWAWVec2f const &trans)
returns a translation transformation
Definition: libmwaw_internal.hxx:1312
std::pair< MWAWVec3f, MWAWVec3f > m_data
the data
Definition: libmwaw_internal.hxx:1334
bool operator<(MWAWTransformation const &mat) const
operator<
Definition: libmwaw_internal.hxx:1287
bool operator==(MWAWTransformation const &mat) const
operator==
Definition: libmwaw_internal.hxx:1277
bool operator<=(MWAWTransformation const &mat) const
operator<=
Definition: libmwaw_internal.hxx:1292
MWAWTransformation(MWAWVec3f const &xRow=MWAWVec3f(1, 0, 0), MWAWVec3f const &yRow=MWAWVec3f(0, 1, 0))
constructor
Definition: libmwaw_internal.hxx:1202
bool operator>(MWAWTransformation const &mat) const
operator>
Definition: libmwaw_internal.hxx:1297
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:655
bool operator!=(MWAWTransformation const &mat) const
operator!=
Definition: libmwaw_internal.hxx:1282
bool m_isIdentity
flag to know if this matrix is an identity matrix
Definition: libmwaw_internal.hxx:1336
small class which defines a vector with 2 elements
Definition: libmwaw_internal.hxx:656
friend MWAWVec2< T > operator+(MWAWVec2< T > const &p1, MWAWVec2< T > const &p2)
operator+
Definition: libmwaw_internal.hxx:742
friend std::ostream & operator<<(std::ostream &o, MWAWVec2< T > const &f)
operator<<: prints data in form "XxY"
Definition: libmwaw_internal.hxx:796
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition: libmwaw_internal.hxx:708
T operator[](int c) const
operator[]
Definition: libmwaw_internal.hxx:678
void setY(T yy)
resets the second element
Definition: libmwaw_internal.hxx:702
MWAWVec2< T > & operator-=(MWAWVec2< T > const &p)
operator-=
Definition: libmwaw_internal.hxx:723
T m_x
first element
Definition: libmwaw_internal.hxx:832
int cmp(MWAWVec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libmwaw_internal.hxx:777
MWAWVec2< T > & operator+=(MWAWVec2< T > const &p)
operator+=
Definition: libmwaw_internal.hxx:717
int cmpY(MWAWVec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:786
bool operator<(MWAWVec2< T > const &p) const
comparison<: sort by y
Definition: libmwaw_internal.hxx:772
friend MWAWVec2< T > operator*(U scale, MWAWVec2< T > const &p1)
generic operator*
Definition: libmwaw_internal.hxx:755
T y() const
second element
Definition: libmwaw_internal.hxx:673
std::map< MWAWVec2< T >, T, struct PosSizeLtY > MapY
map of MWAWVec2
Definition: libmwaw_internal.hxx:830
T x() const
first element
Definition: libmwaw_internal.hxx:668
bool operator==(MWAWVec2< T > const &p) const
comparison==
Definition: libmwaw_internal.hxx:762
void set(T xx, T yy)
resets the two elements
Definition: libmwaw_internal.hxx:691
MWAWVec2(T xx=0, T yy=0)
constructor
Definition: libmwaw_internal.hxx:659
MWAWVec2< T > & operator*=(U scale)
generic operator*=
Definition: libmwaw_internal.hxx:734
T m_y
second element
Definition: libmwaw_internal.hxx:832
T & operator[](int c)
operator[]
Definition: libmwaw_internal.hxx:684
bool operator!=(MWAWVec2< T > const &p) const
comparison!=
Definition: libmwaw_internal.hxx:767
void setX(T xx)
resets the first element
Definition: libmwaw_internal.hxx:697
std::map< MWAWVec2< T >, T, struct PosSizeLtX > MapX
map of MWAWVec2
Definition: libmwaw_internal.hxx:815
friend MWAWVec2< T > operator-(MWAWVec2< T > const &p1, MWAWVec2< T > const &p2)
operator-
Definition: libmwaw_internal.hxx:748
MWAWVec2(MWAWVec2< U > const &p)
generic copy constructor
Definition: libmwaw_internal.hxx:663
small class which defines a vector with 3 elements
Definition: libmwaw_internal.hxx:848
MWAWVec3< T > & operator*=(U scale)
generic operator*=
Definition: libmwaw_internal.hxx:936
T z() const
third element
Definition: libmwaw_internal.hxx:874
MWAWVec3(T xx=0, T yy=0, T zz=0)
constructor
Definition: libmwaw_internal.hxx:851
T operator[](int c) const
operator[]
Definition: libmwaw_internal.hxx:879
MWAWVec3< T > & operator+=(MWAWVec3< T > const &p)
operator+=
Definition: libmwaw_internal.hxx:923
friend MWAWVec3< T > operator*(U scale, MWAWVec3< T > const &p1)
generic operator*
Definition: libmwaw_internal.hxx:956
T x() const
first element
Definition: libmwaw_internal.hxx:864
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition: libmwaw_internal.hxx:915
T & operator[](int c)
operator[]
Definition: libmwaw_internal.hxx:885
void setX(T xx)
resets the first element
Definition: libmwaw_internal.hxx:899
void setY(T yy)
resets the second element
Definition: libmwaw_internal.hxx:904
MWAWVec3< T > & operator-=(MWAWVec3< T > const &p)
operator-=
Definition: libmwaw_internal.hxx:929
void setZ(T zz)
resets the third element
Definition: libmwaw_internal.hxx:909
friend MWAWVec3< T > operator-(MWAWVec3< T > const &p1, MWAWVec3< T > const &p2)
operator-
Definition: libmwaw_internal.hxx:949
friend std::ostream & operator<<(std::ostream &o, MWAWVec3< T > const &f)
operator<<: prints data in form "XxYxZ"
Definition: libmwaw_internal.hxx:988
std::map< MWAWVec3< T >, T, struct PosSizeLt > Map
map of MWAWVec3
Definition: libmwaw_internal.hxx:1007
void set(T xx, T yy, T zz)
resets the three elements
Definition: libmwaw_internal.hxx:892
bool operator!=(MWAWVec3< T > const &p) const
comparison!=
Definition: libmwaw_internal.hxx:968
bool operator==(MWAWVec3< T > const &p) const
comparison==
Definition: libmwaw_internal.hxx:963
friend MWAWVec3< T > operator+(MWAWVec3< T > const &p1, MWAWVec3< T > const &p2)
operator+
Definition: libmwaw_internal.hxx:943
MWAWVec3(MWAWVec3< U > const &p)
generic copy constructor
Definition: libmwaw_internal.hxx:858
T m_val[3]
the values
Definition: libmwaw_internal.hxx:1011
T y() const
second element
Definition: libmwaw_internal.hxx:869
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:978
bool operator<(MWAWVec3< T > const &p) const
comparison<: which first compares x values, then y values then z values.
Definition: libmwaw_internal.hxx:973
Definition: libmwaw_internal.hxx:140
Definition: libmwaw_internal.hxx:148
Definition: libmwaw_internal.hxx:144
Definition: libmwaw_internal.hxx:136
Definition: libmwaw_internal.hxx:152
std::shared_ptr< MWAWPresentationListener > MWAWPresentationListenerPtr
a smart pointer of MWAWPresentationListener
Definition: libmwaw_internal.hxx:559
std::shared_ptr< MWAWListManager > MWAWListManagerPtr
a smart pointer of MWAWListManager
Definition: libmwaw_internal.hxx:555
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:838
std::shared_ptr< MWAWGraphicListener > MWAWGraphicListenerPtr
a smart pointer of MWAWGraphicListener
Definition: libmwaw_internal.hxx:549
std::shared_ptr< MWAWSpreadsheetListener > MWAWSpreadsheetListenerPtr
a smart pointer of MWAWSpreadsheetListener
Definition: libmwaw_internal.hxx:563
std::shared_ptr< MWAWSubDocument > MWAWSubDocumentPtr
a smart pointer of MWAWSubDocument
Definition: libmwaw_internal.hxx:565
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1193
MWAWVec2< long > MWAWVec2l
MWAWVec2 of long.
Definition: libmwaw_internal.hxx:840
std::shared_ptr< MWAWFontConverter > MWAWFontConverterPtr
a smart pointer of MWAWFontConverter
Definition: libmwaw_internal.hxx:545
MWAWBox2< int > MWAWBox2i
MWAWBox2 of int.
Definition: libmwaw_internal.hxx:1191
std::shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:557
std::shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:561
MWAWBox2< long > MWAWBox2l
MWAWBox2 of long.
Definition: libmwaw_internal.hxx:1195
std::shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:553
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:842
MWAWVec2< bool > MWAWVec2b
MWAWVec2 of bool.
Definition: libmwaw_internal.hxx:836
MWAWVec3< float > MWAWVec3f
MWAWVec3 of float.
Definition: libmwaw_internal.hxx:1019
MWAWVec3< int > MWAWVec3i
MWAWVec3 of int.
Definition: libmwaw_internal.hxx:1017
#define LIBMWAW_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libmwaw_internal.hxx:108
std::shared_ptr< MWAWFontManager > MWAWFontManagerPtr
a smart pointer of MWAWFontManager
Definition: libmwaw_internal.hxx:547
MWAWVec3< unsigned char > MWAWVec3uc
MWAWVec3 of unsigned char.
Definition: libmwaw_internal.hxx:1015
std::shared_ptr< MWAWTextListener > MWAWTextListenerPtr
a smart pointer of MWAWTextListener
Definition: libmwaw_internal.hxx:567
std::shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:551
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition: libmwaw_internal.cxx:51
std::string writingModeToString(WritingMode mode)
a function to convert a writing mode in string lt-rb, ...
Definition: libmwaw_internal.cxx:184
WritingMode
the different writing mode
Definition: libmwaw_internal.hxx:185
@ WritingLeftBottom
Definition: libmwaw_internal.hxx:185
@ WritingLeftTop
Definition: libmwaw_internal.hxx:185
@ WritingInherited
Definition: libmwaw_internal.hxx:185
@ WritingRightBottom
Definition: libmwaw_internal.hxx:185
@ WritingRightTop
Definition: libmwaw_internal.hxx:185
std::string numberingTypeToString(NumberingType type)
Definition: libmwaw_internal.cxx:106
SubDocumentType
Definition: libmwaw_internal.hxx:188
@ DOC_CHART
Definition: libmwaw_internal.hxx:188
@ DOC_CHART_ZONE
Definition: libmwaw_internal.hxx:188
@ DOC_TEXT_BOX
Definition: libmwaw_internal.hxx:188
@ DOC_HEADER_FOOTER
Definition: libmwaw_internal.hxx:188
@ DOC_NONE
Definition: libmwaw_internal.hxx:188
@ DOC_TABLE
Definition: libmwaw_internal.hxx:188
@ DOC_SHEET
Definition: libmwaw_internal.hxx:188
@ DOC_COMMENT_ANNOTATION
Definition: libmwaw_internal.hxx:188
@ DOC_GRAPHIC_GROUP
Definition: libmwaw_internal.hxx:188
@ DOC_NOTE
Definition: libmwaw_internal.hxx:188
@ VMiddleBit
Definition: libmwaw_internal.hxx:178
@ LeftBit
Definition: libmwaw_internal.hxx:178
@ BottomBit
Definition: libmwaw_internal.hxx:178
@ HMiddleBit
Definition: libmwaw_internal.hxx:178
@ TopBit
Definition: libmwaw_internal.hxx:178
@ RightBit
Definition: libmwaw_internal.hxx:178
MWAWVec2f rotatePointAroundCenter(MWAWVec2f const &point, MWAWVec2f const &center, float angle)
rotate a point around center, angle is given in degree
Definition: libmwaw_internal.cxx:700
bool checkAddOverflow(T x, T y)
checks whether addition of x and y would overflow
Definition: libmwaw_internal.hxx:165
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libmwaw_internal.cxx:52
std::string numberingValueToString(NumberingType type, int value)
Definition: libmwaw_internal.cxx:130
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer)
adds an unicode character to a string
Definition: libmwaw_internal.cxx:63
MWAWBox2f rotateBoxFromCenter(MWAWBox2f const &box, float angle)
rotate a bdox and returns the final bdbox, angle is given in degree
Definition: libmwaw_internal.cxx:708
bool convertDTFormat(std::string const &dtFormat, librevenge::RVNGPropertyListVector &propVect)
convert a DTFormat in a propertyList
Definition: libmwaw_internal.cxx:324
NumberingType
Definition: libmwaw_internal.hxx:180
@ NONE
Definition: libmwaw_internal.hxx:180
@ BULLET
Definition: libmwaw_internal.hxx:180
@ LOWERCASE_ROMAN
Definition: libmwaw_internal.hxx:180
@ UPPERCASE_ROMAN
Definition: libmwaw_internal.hxx:180
@ LOWERCASE
Definition: libmwaw_internal.hxx:180
@ UPPERCASE
Definition: libmwaw_internal.hxx:180
@ ARABIC
Definition: libmwaw_internal.hxx:180
Position
basic position enum
Definition: libmwaw_internal.hxx:176
@ VMiddle
Definition: libmwaw_internal.hxx:176
@ Top
Definition: libmwaw_internal.hxx:176
@ Bottom
Definition: libmwaw_internal.hxx:176
@ HMiddle
Definition: libmwaw_internal.hxx:176
@ Left
Definition: libmwaw_internal.hxx:176
@ Right
Definition: libmwaw_internal.hxx:176
a border
Definition: libmwaw_internal.hxx:333
bool operator!=(MWAWBorder const &orig) const
operator!=
Definition: libmwaw_internal.hxx:366
Style m_style
the border style
Definition: libmwaw_internal.hxx:380
int compare(MWAWBorder const &orig) const
compare two borders
Definition: libmwaw_internal.cxx:432
MWAWBorder()
constructor
Definition: libmwaw_internal.hxx:340
Type
the line repetition
Definition: libmwaw_internal.hxx:337
@ Single
Definition: libmwaw_internal.hxx:337
@ Double
Definition: libmwaw_internal.hxx:337
@ Triple
Definition: libmwaw_internal.hxx:337
Type m_type
the border repetition
Definition: libmwaw_internal.hxx:385
MWAWBorder(MWAWBorder const &)=default
MWAWBorder & operator=(MWAWBorder const &)=default
std::string m_extra
extra data ( if needed)
Definition: libmwaw_internal.hxx:395
std::vector< double > m_widthsList
the different length used for each line/sep (if defined)
Definition: libmwaw_internal.hxx:391
bool operator==(MWAWBorder const &orig) const
operator==
Definition: libmwaw_internal.hxx:361
Style
the line style
Definition: libmwaw_internal.hxx:335
@ Simple
Definition: libmwaw_internal.hxx:335
@ Dash
Definition: libmwaw_internal.hxx:335
@ Dot
Definition: libmwaw_internal.hxx:335
@ LargeDot
Definition: libmwaw_internal.hxx:335
@ None
Definition: libmwaw_internal.hxx:335
double m_width
the border total width in point
Definition: libmwaw_internal.hxx:387
friend std::ostream & operator<<(std::ostream &o, MWAWBorder const &border)
operator<<
Definition: libmwaw_internal.cxx:541
bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const
add the border property to proplist (if needed )
Definition: libmwaw_internal.cxx:444
MWAWBorder & operator=(MWAWBorder &&)=default
MWAWColor m_color
the border color
Definition: libmwaw_internal.hxx:393
MWAWBorder(MWAWBorder &&)=default
bool isEmpty() const
returns true if the border is empty
Definition: libmwaw_internal.hxx:356
the class to store a color
Definition: libmwaw_internal.hxx:192
unsigned char getGreen() const
returns the green value
Definition: libmwaw_internal.hxx:279
unsigned char getBlue() const
returns the green value
Definition: libmwaw_internal.hxx:269
MWAWColor(MWAWColor const &)=default
copy constructor
bool operator<(MWAWColor const &c) const
operator<
Definition: libmwaw_internal.hxx:304
static MWAWColor barycenter(float alpha, MWAWColor const &colA, float beta, MWAWColor const &colB)
return alpha*colA+beta*colB
Definition: libmwaw_internal.cxx:206
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
std::string str() const
print the color in the form #rrggbb
Definition: libmwaw_internal.cxx:232
bool operator>(MWAWColor const &c) const
operator>
Definition: libmwaw_internal.hxx:314
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:245
MWAWColor(MWAWColor &&)=default
move assignement
MWAWColor & operator=(MWAWColor &&)=default
move operator=
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
uint32_t value() const
return the rgba value
Definition: libmwaw_internal.hxx:259
friend std::ostream & operator<<(std::ostream &o, MWAWColor const &c)
operator<< in the form #rrggbb
Definition: libmwaw_internal.cxx:220
bool isWhite() const
return true if the color is white
Definition: libmwaw_internal.hxx:289
bool operator>=(MWAWColor const &c) const
operator>=
Definition: libmwaw_internal.hxx:319
bool operator!=(MWAWColor const &c) const
operator!=
Definition: libmwaw_internal.hxx:299
bool operator<=(MWAWColor const &c) const
operator<=
Definition: libmwaw_internal.hxx:309
MWAWColor(uint32_t argb=0)
constructor
Definition: libmwaw_internal.hxx:194
MWAWColor & operator=(MWAWColor const &)=default
operator=
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:250
uint32_t m_value
the argb color
Definition: libmwaw_internal.hxx:329
MWAWColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition: libmwaw_internal.hxx:199
unsigned char getAlpha() const
returns the alpha value
Definition: libmwaw_internal.hxx:264
MWAWColor & operator=(uint32_t argb)
operator=
Definition: libmwaw_internal.hxx:212
bool isBlack() const
return true if the color is black
Definition: libmwaw_internal.hxx:284
bool operator==(MWAWColor const &c) const
operator==
Definition: libmwaw_internal.hxx:294
unsigned char getRed() const
returns the red value
Definition: libmwaw_internal.hxx:274
small class use to define a embedded object
Definition: libmwaw_internal.hxx:467
int cmp(MWAWEmbeddedObject const &pict) const
a comparison function
Definition: libmwaw_internal.cxx:606
MWAWEmbeddedObject(MWAWEmbeddedObject const &)=default
~MWAWEmbeddedObject()
destructor
Definition: libmwaw_internal.cxx:575
bool isEmpty() const
return true if the picture contains no data
Definition: libmwaw_internal.hxx:486
MWAWEmbeddedObject & operator=(MWAWEmbeddedObject &&)=default
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition: libmwaw_internal.hxx:514
friend std::ostream & operator<<(std::ostream &o, MWAWEmbeddedObject const &pict)
operator<<
Definition: libmwaw_internal.cxx:631
MWAWEmbeddedObject()
empty constructor
Definition: libmwaw_internal.hxx:469
MWAWEmbeddedObject & operator=(MWAWEmbeddedObject const &)=default
MWAWEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
constructor
Definition: libmwaw_internal.hxx:475
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist
Definition: libmwaw_internal.cxx:579
void add(librevenge::RVNGBinaryData const &binaryData, std::string const &type="image/pict")
add a picture
Definition: libmwaw_internal.hxx:495
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition: libmwaw_internal.hxx:512
a field
Definition: libmwaw_internal.hxx:399
Type
Defines some basic type for field.
Definition: libmwaw_internal.hxx:401
@ BookmarkStart
Definition: libmwaw_internal.hxx:401
@ PageCount
Definition: libmwaw_internal.hxx:401
@ Title
Definition: libmwaw_internal.hxx:401
@ Database
Definition: libmwaw_internal.hxx:401
@ BookmarkEnd
Definition: libmwaw_internal.hxx:401
@ None
Definition: libmwaw_internal.hxx:401
@ PageNumber
Definition: libmwaw_internal.hxx:401
@ Time
Definition: libmwaw_internal.hxx:401
@ Date
Definition: libmwaw_internal.hxx:401
std::string m_DTFormat
the date/time format using strftime format if defined
Definition: libmwaw_internal.hxx:424
libmwaw::NumberingType m_numberingType
the number type ( for number field )
Definition: libmwaw_internal.hxx:422
MWAWField & operator=(MWAWField const &)=default
MWAWField(MWAWField &&)=default
librevenge::RVNGString getString() const
returns a string corresponding to the field (if possible) *‍/
Definition: libmwaw_internal.cxx:294
MWAWField & operator=(MWAWField &&)=default
std::string m_data
the database/link field ( if defined ) or the bookmark name
Definition: libmwaw_internal.hxx:426
Type m_type
the type
Definition: libmwaw_internal.hxx:420
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist (if possible)
Definition: libmwaw_internal.cxx:240
MWAWField(MWAWField const &)=default
MWAWField(Type type)
basic constructor
Definition: libmwaw_internal.hxx:404
a note
Definition: libmwaw_internal.hxx:445
Type
enum to define note type
Definition: libmwaw_internal.hxx:447
@ FootNote
Definition: libmwaw_internal.hxx:447
@ EndNote
Definition: libmwaw_internal.hxx:447
int m_number
the note number if defined
Definition: libmwaw_internal.hxx:460
Type m_type
the note type
Definition: libmwaw_internal.hxx:456
MWAWNote(Type type)
constructor
Definition: libmwaw_internal.hxx:449
librevenge::RVNGString m_label
the note label
Definition: libmwaw_internal.hxx:458
small structure use to store a stream and it debug file
Definition: MWAWStream.hxx:41
a generic variable template: value + flag to know if the variable is set
Definition: libmwaw_internal.hxx:577
T & operator*()
operator*
Definition: libmwaw_internal.hxx:624
T const & operator*() const
operator*
Definition: libmwaw_internal.hxx:619
void insert(MWAWVariable const &orig)
update the current value if orig is set
Definition: libmwaw_internal.hxx:600
MWAWVariable & operator=(MWAWVariable const &)=default
copy operator
bool isSet() const
return true if the variable is set
Definition: libmwaw_internal.hxx:635
T m_data
the value
Definition: libmwaw_internal.hxx:646
T const * operator->() const
operator*
Definition: libmwaw_internal.hxx:608
MWAWVariable()
constructor
Definition: libmwaw_internal.hxx:579
MWAWVariable(T const &def)
constructor with a default value
Definition: libmwaw_internal.hxx:583
void setSet(bool newVal)
define if the variable is set
Definition: libmwaw_internal.hxx:640
bool m_set
a flag to know if the variable is set or not
Definition: libmwaw_internal.hxx:648
T const & get() const
return the current value
Definition: libmwaw_internal.hxx:630
MWAWVariable(MWAWVariable const &orig)
copy constructor
Definition: libmwaw_internal.hxx:587
MWAWVariable & operator=(T const &val)
set a value
Definition: libmwaw_internal.hxx:593
T * operator->()
operator*
Definition: libmwaw_internal.hxx:613
internal struct used to create sorted map, sorted by X
Definition: libmwaw_internal.hxx:805
bool operator()(MWAWVec2< T > const &s1, MWAWVec2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:807
internal struct used to create sorted map, sorted by Y
Definition: libmwaw_internal.hxx:820
bool operator()(MWAWVec2< T > const &s1, MWAWVec2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:822
internal struct used to create sorted map, sorted by X, Y, Z
Definition: libmwaw_internal.hxx:997
bool operator()(MWAWVec3< T > const &s1, MWAWVec3< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:999
an noop deleter used to transform a libwpd pointer in a false std::shared_ptr
Definition: libmwaw_internal.hxx:101
void operator()(T *)
Definition: libmwaw_internal.hxx:102

Generated on Thu Jan 19 2023 00:00:00 for libmwaw by doxygen 1.9.6