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 <algorithm>
41#include <cmath>
42#include <map>
43#include <ostream>
44#include <string>
45#include <math.h>
46#include <vector>
47
48#ifndef M_PI
49#define M_PI 3.14159265358979323846
50#endif
51
52#include <librevenge-stream/librevenge-stream.h>
53#include <librevenge/librevenge.h>
54
55#if defined(_MSC_VER) || defined(__DJGPP__)
56
57typedef signed char int8_t;
58typedef unsigned char uint8_t;
59typedef signed short int16_t;
60typedef unsigned short uint16_t;
61typedef signed int int32_t;
62typedef unsigned int uint32_t;
63typedef unsigned __int64 uint64_t;
64typedef __int64 int64_t;
65
66#else /* !_MSC_VER && !__DJGPP__*/
67
68# ifdef HAVE_CONFIG_H
69
70# include <config.h>
71# ifdef HAVE_STDINT_H
72# include <stdint.h>
73# endif
74# ifdef HAVE_INTTYPES_H
75# include <inttypes.h>
76# endif
77
78# else
79
80// assume that the headers are there inside LibreOffice build when no HAVE_CONFIG_H is defined
81# include <stdint.h>
82# include <inttypes.h>
83
84# endif
85
86#endif /* _MSC_VER || __DJGPP__ */
87
88// define gmtime_r and localtime_r on Windows, so that can use
89// thread-safe functions on other environments
90#ifdef _WIN32
91# define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
92# define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0)
93#endif
94
95/* ---------- memory --------------- */
96#if defined(SHAREDPTR_TR1)
97#include <tr1/memory>
98using std::tr1::shared_ptr;
99#elif defined(SHAREDPTR_STD)
100#include <memory>
101using std::shared_ptr;
102#else
103#include <boost/shared_ptr.hpp>
104using boost::shared_ptr;
105#endif
106
108template <class T>
110 void operator()(T *) {}
111};
112
113#if defined(__clang__) || defined(__GNUC__)
114# define LIBMWAW_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((__format__(__printf__, fmt, arg)))
115#else
116# define LIBMWAW_ATTRIBUTE_PRINTF(fmt, arg)
117#endif
118
119/* ---------- debug --------------- */
120#ifdef DEBUG
121namespace libmwaw
122{
123void printDebugMsg(const char *format, ...) LIBMWAW_ATTRIBUTE_PRINTF(1,2);
124}
125#define MWAW_DEBUG_MSG(M) libmwaw::printDebugMsg M
126#else
127#define MWAW_DEBUG_MSG(M)
128#endif
129
130namespace libmwaw
131{
132// Various exceptions:
134{
135};
136
138{
139};
140
142{
143};
144
146{
147};
148
150{
151};
152}
153
154/* ---------- input ----------------- */
155namespace libmwaw
156{
157uint8_t readU8(librevenge::RVNGInputStream *input);
159void appendUnicode(uint32_t val, librevenge::RVNGString &buffer);
160}
161
162/* ---------- small enum/class ------------- */
163namespace libmwaw
164{
166enum Position { Left = 0, Right = 1, Top = 2, Bottom = 3, HMiddle = 4, VMiddle = 5 };
168enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08, HMiddleBit = 0x10, VMiddleBit = 0x20 };
169
171std::string numberingTypeToString(NumberingType type);
172std::string numberingValueToString(NumberingType type, int value);
173
177std::string writingModeToString(WritingMode mode);
179}
180
182struct MWAWColor {
184 explicit MWAWColor(uint32_t argb=0) : m_value(argb)
185 {
186 }
188 MWAWColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) :
189 m_value(uint32_t((a<<24)+(r<<16)+(g<<8)+b))
190 {
191 }
193 MWAWColor &operator=(uint32_t argb)
194 {
195 m_value = argb;
196 return *this;
197 }
199 static MWAWColor colorFromCMYK(unsigned char c, unsigned char m, unsigned char y, unsigned char k)
200 {
201 double w=1.-static_cast<double>(k)/255.;
202 return MWAWColor
203 (static_cast<unsigned char>(255 * (1-static_cast<double>(c)/255) * w),
204 static_cast<unsigned char>(255 * (1-static_cast<double>(m)/255) * w),
205 static_cast<unsigned char>(255 * (1-static_cast<double>(y)/255) * w)
206 );
207 }
209 static MWAWColor colorFromHSL(unsigned char H, unsigned char S, unsigned char L)
210 {
211 double c=(1-((L>=128) ? (2*static_cast<double>(L)-255) : (255-2*static_cast<double>(L)))/255)*
212 static_cast<double>(S)/255;
213 double tmp=std::fmod((static_cast<double>(H)*6/255),2)-1;
214 double x=c*(1-(tmp>0 ? tmp : -tmp));
215 unsigned char C=static_cast<unsigned char>(255*c);
216 unsigned char M=static_cast<unsigned char>(static_cast<double>(L)-255*c/2);
217 unsigned char X=static_cast<unsigned char>(255*x);
218 if (H<=42) return MWAWColor(static_cast<unsigned char>(M+C),static_cast<unsigned char>(M+X),static_cast<unsigned char>(M));
219 if (H<=85) return MWAWColor(static_cast<unsigned char>(M+X),static_cast<unsigned char>(M+C),static_cast<unsigned char>(M));
220 if (H<=127) return MWAWColor(static_cast<unsigned char>(M),static_cast<unsigned char>(M+C),static_cast<unsigned char>(M+X));
221 if (H<=170) return MWAWColor(static_cast<unsigned char>(M),static_cast<unsigned char>(M+X),static_cast<unsigned char>(M+C));
222 if (H<=212) return MWAWColor(static_cast<unsigned char>(M+X),static_cast<unsigned char>(M),static_cast<unsigned char>(M+C));
223 return MWAWColor(static_cast<unsigned char>(M+C),static_cast<unsigned char>(M),static_cast<unsigned char>(M+X));
224 }
227 {
228 return MWAWColor(0,0,0);
229 }
232 {
233 return MWAWColor(255,255,255);
234 }
235
237 static MWAWColor barycenter(float alpha, MWAWColor const &colA,
238 float beta, MWAWColor const &colB);
240 uint32_t value() const
241 {
242 return m_value;
243 }
245 unsigned char getAlpha() const
246 {
247 return static_cast<unsigned char>((m_value>>24)&0xFF);
248 }
250 unsigned char getBlue() const
251 {
252 return static_cast<unsigned char>(m_value&0xFF);
253 }
255 unsigned char getRed() const
256 {
257 return static_cast<unsigned char>((m_value>>16)&0xFF);
258 }
260 unsigned char getGreen() const
261 {
262 return static_cast<unsigned char>((m_value>>8)&0xFF);
263 }
265 bool isBlack() const
266 {
267 return (m_value&0xFFFFFF)==0;
268 }
270 bool isWhite() const
271 {
272 return (m_value&0xFFFFFF)==0xFFFFFF;
273 }
275 bool operator==(MWAWColor const &c) const
276 {
277 return (c.m_value&0xFFFFFF)==(m_value&0xFFFFFF);
278 }
280 bool operator!=(MWAWColor const &c) const
281 {
282 return !operator==(c);
283 }
285 bool operator<(MWAWColor const &c) const
286 {
287 return (c.m_value&0xFFFFFF)<(m_value&0xFFFFFF);
288 }
290 bool operator<=(MWAWColor const &c) const
291 {
292 return (c.m_value&0xFFFFFF)<=(m_value&0xFFFFFF);
293 }
295 bool operator>(MWAWColor const &c) const
296 {
297 return !operator<=(c);
298 }
300 bool operator>=(MWAWColor const &c) const
301 {
302 return !operator<(c);
303 }
305 friend std::ostream &operator<< (std::ostream &o, MWAWColor const &c);
307 std::string str() const;
308protected:
310 uint32_t m_value;
311};
312
319
325 bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const;
327 bool isEmpty() const
328 {
329 return m_style==None || m_width <= 0;
330 }
332 bool operator==(MWAWBorder const &orig) const
333 {
334 return !operator!=(orig);
335 }
337 bool operator!=(MWAWBorder const &orig) const
338 {
339 return m_style != orig.m_style || m_type != orig.m_type ||
340 m_width < orig.m_width || m_width > orig.m_width || m_color != orig.m_color;
341 }
343 int compare(MWAWBorder const &orig) const;
344
346 friend std::ostream &operator<< (std::ostream &o, MWAWBorder const &border);
348 friend std::ostream &operator<< (std::ostream &o, MWAWBorder::Style const &style);
351
352 // multiple borders
353
357 double m_width;
361 std::vector<double> m_widthsList;
365 std::string m_extra;
366};
367
369struct MWAWField {
372
375 {
376 }
378 bool addTo(librevenge::RVNGPropertyList &propList) const;
380 librevenge::RVNGString getString() const;
386 std::string m_DTFormat;
388 std::string m_data;
389};
390
392struct MWAWLink {
395 {
396 }
397
399 bool addTo(librevenge::RVNGPropertyList &propList) const;
400
402 std::string m_HRef;
403};
404
406struct MWAWNote {
410 explicit MWAWNote(Type type) : m_type(type), m_label(""), m_number(-1)
411 {
412 }
416 librevenge::RVNGString m_label;
419};
420
428 {
429 }
431 MWAWEmbeddedObject(librevenge::RVNGBinaryData const &binaryData,
432 std::string type="image/pict") : m_dataList(), m_typeList()
433 {
434 add(binaryData, type);
435 }
439 bool isEmpty() const
440 {
441 for (size_t i=0; i<m_dataList.size(); ++i) {
442 if (!m_dataList[i].empty())
443 return false;
444 }
445 return true;
446 }
448 void add(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
449 {
450 size_t pos=m_dataList.size();
451 if (pos<m_typeList.size()) pos=m_typeList.size();
452 m_dataList.resize(pos+1);
453 m_dataList[pos]=binaryData;
454 m_typeList.resize(pos+1);
455 m_typeList[pos]=type;
456 }
458 bool addTo(librevenge::RVNGPropertyList &propList) const;
460 friend std::ostream &operator<<(std::ostream &o, MWAWEmbeddedObject const &pict);
462 int cmp(MWAWEmbeddedObject const &pict) const;
463
465 std::vector<librevenge::RVNGBinaryData> m_dataList;
467 std::vector<std::string> m_typeList;
468};
469
470// forward declarations of basic classes and smart pointers
471class MWAWEntry;
472class MWAWFont;
474class MWAWGraphicShape;
475class MWAWGraphicStyle;
476class MWAWHeader;
477class MWAWList;
478class MWAWPageSpan;
479class MWAWParagraph;
480class MWAWParser;
481class MWAWPosition;
482class MWAWSection;
483
485class MWAWFontManager;
487class MWAWInputStream;
488class MWAWListener;
489class MWAWListManager;
490class MWAWParserState;
492class MWAWRSRCParser;
494class MWAWSubDocument;
495class MWAWTextListener;
497typedef shared_ptr<MWAWFontConverter> MWAWFontConverterPtr;
499typedef shared_ptr<MWAWFontManager> MWAWFontManagerPtr;
501typedef shared_ptr<MWAWGraphicListener> MWAWGraphicListenerPtr;
503typedef shared_ptr<MWAWInputStream> MWAWInputStreamPtr;
505typedef shared_ptr<MWAWListener> MWAWListenerPtr;
507typedef shared_ptr<MWAWListManager> MWAWListManagerPtr;
509typedef shared_ptr<MWAWParserState> MWAWParserStatePtr;
511typedef shared_ptr<MWAWPresentationListener> MWAWPresentationListenerPtr;
513typedef shared_ptr<MWAWRSRCParser> MWAWRSRCParserPtr;
515typedef shared_ptr<MWAWSpreadsheetListener> MWAWSpreadsheetListenerPtr;
517typedef shared_ptr<MWAWSubDocument> MWAWSubDocumentPtr;
519typedef shared_ptr<MWAWTextListener> MWAWTextListenerPtr;
520
527template <class T> struct MWAWVariable {
529 MWAWVariable() : m_data(), m_set(false) {}
531 explicit MWAWVariable(T const &def) : m_data(def), m_set(false) {}
533 MWAWVariable(MWAWVariable const &orig) : m_data(orig.m_data), m_set(orig.m_set) {}
536 {
537 if (this != &orig) {
538 m_data = orig.m_data;
539 m_set = orig.m_set;
540 }
541 return *this;
542 }
544 MWAWVariable &operator=(T const &val)
545 {
546 m_data = val;
547 m_set = true;
548 return *this;
549 }
551 void insert(MWAWVariable const &orig)
552 {
553 if (orig.m_set) {
554 m_data = orig.m_data;
555 m_set = orig.m_set;
556 }
557 }
559 T const *operator->() const
560 {
561 return &m_data;
562 }
565 {
566 m_set = true;
567 return &m_data;
568 }
570 T const &operator*() const
571 {
572 return m_data;
573 }
576 {
577 m_set = true;
578 return m_data;
579 }
581 T const &get() const
582 {
583 return m_data;
584 }
586 bool isSet() const
587 {
588 return m_set;
589 }
591 void setSet(bool newVal)
592 {
593 m_set=newVal;
594 }
595protected:
599 bool m_set;
600};
601
602/* ---------- vec2/box2f ------------- */
606template <class T> class MWAWVec2
607{
608public:
610 explicit MWAWVec2(T xx=0,T yy=0) : m_x(xx), m_y(yy) { }
612 template <class U> MWAWVec2(MWAWVec2<U> const &p) : m_x(T(p.x())), m_y(T(p.y())) {}
613
615 T x() const
616 {
617 return m_x;
618 }
620 T y() const
621 {
622 return m_y;
623 }
625 T operator[](int c) const
626 {
627 if (c<0 || c>1) throw libmwaw::GenericException();
628 return (c==0) ? m_x : m_y;
629 }
631 T &operator[](int c)
632 {
633 if (c<0 || c>1) throw libmwaw::GenericException();
634 return (c==0) ? m_x : m_y;
635 }
636
638 void set(T xx, T yy)
639 {
640 m_x = xx;
641 m_y = yy;
642 }
644 void setX(T xx)
645 {
646 m_x = xx;
647 }
649 void setY(T yy)
650 {
651 m_y = yy;
652 }
653
655 void add(T dx, T dy)
656 {
657 m_x += dx;
658 m_y += dy;
659 }
660
663 {
664 m_x += p.m_x;
665 m_y += p.m_y;
666 return *this;
667 }
670 {
671 m_x -= p.m_x;
672 m_y -= p.m_y;
673 return *this;
674 }
676 template <class U>
678 {
679 m_x = T(m_x*scale);
680 m_y = T(m_y*scale);
681 return *this;
682 }
683
685 friend MWAWVec2<T> operator+(MWAWVec2<T> const &p1, MWAWVec2<T> const &p2)
686 {
687 MWAWVec2<T> p(p1);
688 return p+=p2;
689 }
691 friend MWAWVec2<T> operator-(MWAWVec2<T> const &p1, MWAWVec2<T> const &p2)
692 {
693 MWAWVec2<T> p(p1);
694 return p-=p2;
695 }
697 template <class U>
698 friend MWAWVec2<T> operator*(U scale, MWAWVec2<T> const &p1)
699 {
700 MWAWVec2<T> p(p1);
701 return p *= scale;
702 }
703
705 bool operator==(MWAWVec2<T> const &p) const
706 {
707 return cmpY(p) == 0;
708 }
710 bool operator!=(MWAWVec2<T> const &p) const
711 {
712 return cmpY(p) != 0;
713 }
715 bool operator<(MWAWVec2<T> const &p) const
716 {
717 return cmpY(p) < 0;
718 }
720 int cmp(MWAWVec2<T> const &p) const
721 {
722 if (m_x < p.m_x) return -1;
723 if (m_x > p.m_x) return 1;
724 if (m_y < p.m_y) return -1;
725 if (m_y > p.m_y) return 1;
726 return 0;
727 }
729 int cmpY(MWAWVec2<T> const &p) const
730 {
731 if (m_y < p.m_y) return -1;
732 if (m_y > p.m_y) return 1;
733 if (m_x < p.m_x) return -1;
734 if (m_x > p.m_x) return 1;
735 return 0;
736 }
737
739 friend std::ostream &operator<< (std::ostream &o, MWAWVec2<T> const &f)
740 {
741 o << f.m_x << "x" << f.m_y;
742 return o;
743 }
744
748 struct PosSizeLtX {
750 bool operator()(MWAWVec2<T> const &s1, MWAWVec2<T> const &s2) const
751 {
752 return s1.cmp(s2) < 0;
753 }
754 };
758 typedef std::map<MWAWVec2<T>, T,struct PosSizeLtX> MapX;
759
763 struct PosSizeLtY {
765 bool operator()(MWAWVec2<T> const &s1, MWAWVec2<T> const &s2) const
766 {
767 return s1.cmpY(s2) < 0;
768 }
769 };
773 typedef std::map<MWAWVec2<T>, T,struct PosSizeLtY> MapY;
774protected:
776};
777
786
790template <class T> class MWAWVec3
791{
792public:
794 explicit MWAWVec3(T xx=0,T yy=0,T zz=0)
795 {
796 m_val[0] = xx;
797 m_val[1] = yy;
798 m_val[2] = zz;
799 }
801 template <class U> MWAWVec3(MWAWVec3<U> const &p)
802 {
803 for (int c = 0; c < 3; c++) m_val[c] = T(p[c]);
804 }
805
807 T x() const
808 {
809 return m_val[0];
810 }
812 T y() const
813 {
814 return m_val[1];
815 }
817 T z() const
818 {
819 return m_val[2];
820 }
822 T operator[](int c) const
823 {
824 if (c<0 || c>2) throw libmwaw::GenericException();
825 return m_val[c];
826 }
828 T &operator[](int c)
829 {
830 if (c<0 || c>2) throw libmwaw::GenericException();
831 return m_val[c];
832 }
833
835 void set(T xx, T yy, T zz)
836 {
837 m_val[0] = xx;
838 m_val[1] = yy;
839 m_val[2] = zz;
840 }
842 void setX(T xx)
843 {
844 m_val[0] = xx;
845 }
847 void setY(T yy)
848 {
849 m_val[1] = yy;
850 }
852 void setZ(T zz)
853 {
854 m_val[2] = zz;
855 }
856
858 void add(T dx, T dy, T dz)
859 {
860 m_val[0] += dx;
861 m_val[1] += dy;
862 m_val[2] += dz;
863 }
864
867 {
868 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]);
869 return *this;
870 }
873 {
874 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]-p.m_val[c]);
875 return *this;
876 }
878 template <class U>
880 {
881 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]*scale);
882 return *this;
883 }
884
886 friend MWAWVec3<T> operator+(MWAWVec3<T> const &p1, MWAWVec3<T> const &p2)
887 {
888 MWAWVec3<T> p(p1);
889 return p+=p2;
890 }
892 friend MWAWVec3<T> operator-(MWAWVec3<T> const &p1, MWAWVec3<T> const &p2)
893 {
894 MWAWVec3<T> p(p1);
895 return p-=p2;
896 }
898 template <class U>
899 friend MWAWVec3<T> operator*(U scale, MWAWVec3<T> const &p1)
900 {
901 MWAWVec3<T> p(p1);
902 return p *= scale;
903 }
904
906 bool operator==(MWAWVec3<T> const &p) const
907 {
908 return cmp(p) == 0;
909 }
911 bool operator!=(MWAWVec3<T> const &p) const
912 {
913 return cmp(p) != 0;
914 }
916 bool operator<(MWAWVec3<T> const &p) const
917 {
918 return cmp(p) < 0;
919 }
921 int cmp(MWAWVec3<T> const &p) const
922 {
923 for (int c = 0; c < 3; c++) {
924 if (m_val[c]<p.m_val[c]) return -1;
925 if (m_val[c]>p.m_val[c]) return 1;
926 }
927 return 0;
928 }
929
931 friend std::ostream &operator<< (std::ostream &o, MWAWVec3<T> const &f)
932 {
933 o << f.m_val[0] << "x" << f.m_val[1] << "x" << f.m_val[2];
934 return o;
935 }
936
940 struct PosSizeLt {
942 bool operator()(MWAWVec3<T> const &s1, MWAWVec3<T> const &s2) const
943 {
944 return s1.cmp(s2) < 0;
945 }
946 };
950 typedef std::map<MWAWVec3<T>, T,struct PosSizeLt> Map;
951
952protected:
954 T m_val[3];
955};
956
963
967template <class T> class MWAWBox2
968{
969public:
971 explicit MWAWBox2(MWAWVec2<T> minPt=MWAWVec2<T>(), MWAWVec2<T> maxPt=MWAWVec2<T>()) : m_data(minPt, maxPt)
972 {
973 }
975 template <class U> MWAWBox2(MWAWBox2<U> const &p) : m_data(p.min(), p.max())
976 {
977 }
978
980 MWAWVec2<T> const &min() const
981 {
982 return m_data.first;
983 }
985 MWAWVec2<T> const &max() const
986 {
987 return m_data.second;
988 }
991 {
992 return m_data.first;
993 }
996 {
997 return m_data.second;
998 }
1002 MWAWVec2<T> const &operator[](int c) const
1003 {
1004 if (c<0 || c>1) throw libmwaw::GenericException();
1005 return c==0 ? m_data.first : m_data.second;
1006 }
1009 {
1010 return m_data.second-m_data.first;
1011 }
1014 {
1015 return MWAWVec2<T>((m_data.first.x()+m_data.second.x())/2,
1016 (m_data.first.y()+m_data.second.y())/2);
1017 }
1018
1020 void set(MWAWVec2<T> const &x, MWAWVec2<T> const &y)
1021 {
1022 m_data.first = x;
1023 m_data.second = y;
1024 }
1026 void setMin(MWAWVec2<T> const &x)
1027 {
1028 m_data.first = x;
1029 }
1031 void setMax(MWAWVec2<T> const &y)
1032 {
1033 m_data.second = y;
1034 }
1035
1038 {
1039 m_data.second = m_data.first+sz;
1040 }
1043 {
1044 m_data.first = m_data.second-sz;
1045 }
1048 {
1049 MWAWVec2<T> centerPt = center();
1050 MWAWVec2<T> decal(sz.x()/2,sz.y()/2);
1051 m_data.first = centerPt - decal;
1052 m_data.second = centerPt + (sz - decal);
1053 }
1054
1056 template <class U> void scale(U factor)
1057 {
1058 m_data.first *= factor;
1059 m_data.second *= factor;
1060 }
1061
1063 void extend(T val)
1064 {
1065 m_data.first -= MWAWVec2<T>(val/2,val/2);
1066 m_data.second += MWAWVec2<T>(val-(val/2),val-(val/2));
1067 }
1068
1071 {
1072 MWAWBox2<T> res;
1073 res.m_data.first=MWAWVec2<T>(m_data.first[0]<box.m_data.first[0]?m_data.first[0] : box.m_data.first[0],
1074 m_data.first[1]<box.m_data.first[1]?m_data.first[1] : box.m_data.first[1]);
1075 res.m_data.second=MWAWVec2<T>(m_data.second[0]>box.m_data.second[0]?m_data.second[0] : box.m_data.second[0],
1076 m_data.second[1]>box.m_data.second[1]?m_data.second[1] : box.m_data.second[1]);
1077 return res;
1078 }
1081 {
1082 MWAWBox2<T> res;
1083 res.m_data.first=MWAWVec2<T>(m_data.first[0]>box.m_data.first[0]?m_data.first[0] : box.m_data.first[0],
1084 m_data.first[1]>box.m_data.first[1]?m_data.first[1] : box.m_data.first[1]);
1085 res.m_data.second=MWAWVec2<T>(m_data.second[0]<box.m_data.second[0]?m_data.second[0] : box.m_data.second[0],
1086 m_data.second[1]<box.m_data.second[1]?m_data.second[1] : box.m_data.second[1]);
1087 return res;
1088 }
1090 bool operator==(MWAWBox2<T> const &mat) const
1091 {
1092 return m_data==mat.m_data;
1093 }
1095 bool operator!=(MWAWBox2<T> const &mat) const
1096 {
1097 return m_data!=mat.m_data;
1098 }
1100 bool operator<(MWAWBox2<T> const &mat) const
1101 {
1102 return m_data<mat.m_data;
1103 }
1105 bool operator<=(MWAWBox2<T> const &mat) const
1106 {
1107 return m_data<=mat.m_data;
1108 }
1110 bool operator>(MWAWBox2<T> const &mat) const
1111 {
1112 return m_data>mat.m_data;
1113 }
1115 bool operator>=(MWAWBox2<T> const &mat) const
1116 {
1117 return m_data>=mat.m_data;
1118 }
1120 friend std::ostream &operator<< (std::ostream &o, MWAWBox2<T> const &f)
1121 {
1122 o << "(" << f.min() << "<->" << f.max() << ")";
1123 return o;
1124 }
1125
1126protected:
1128 std::pair<MWAWVec2<T>, MWAWVec2<T> > m_data;
1129};
1130
1137
1140{
1141public:
1143 explicit MWAWTransformation(MWAWVec3f const &xRow=MWAWVec3f(1,0,0), MWAWVec3f const &yRow=MWAWVec3f(0,1,0)) : m_data(xRow, yRow), m_isIdentity(false)
1144 {
1145 checkIdentity();
1146 }
1148 bool isIdentity() const
1149 {
1150 return m_isIdentity;
1151 }
1153 void checkIdentity() const
1154 {
1155 m_isIdentity= m_data.first==MWAWVec3f(1,0,0) && m_data.second==MWAWVec3f(0,1,0);
1156 }
1160 MWAWVec3f const &operator[](int c) const
1161 {
1162 if (c<0 || c>1) throw libmwaw::GenericException();
1163 return c==0 ? m_data.first : m_data.second;
1164 }
1167 {
1168 if (m_isIdentity) return pt;
1169 return multiplyDirection(pt)+MWAWVec2f(m_data.first[2],m_data.second[2]);
1170 }
1173 {
1174 if (m_isIdentity) return dir;
1175 MWAWVec2f res;
1176 for (int coord=0; coord<2; ++coord) {
1177 MWAWVec3f const &row=coord==0 ? m_data.first : m_data.second;
1178 float value=0;
1179 for (int i=0; i<2; ++i)
1180 value+=row[i]*dir[i];
1181 res[coord]=value;
1182 }
1183 return res;
1184 }
1187 {
1188 if (m_isIdentity) return box;
1189 return MWAWBox2f(operator*(box.min()), operator*(box.max()));
1190 }
1193 {
1194 if (mat.m_isIdentity) return *this;
1196 for (int row=0; row<2; ++row) {
1197 MWAWVec3f &resRow=row==0 ? res.m_data.first : res.m_data.second;
1198 for (int col=0; col<3; ++col) {
1199 float value=0;
1200 for (int i=0; i<3; ++i)
1201 value+=(*this)[row][i]*(i==2 ? (col==2 ? 1.f : 0.f) : mat[i][col]);
1202 resRow[col]=value;
1203 }
1204 }
1205 res.checkIdentity();
1206 return res;
1207 }
1210 {
1211 if (!mat.m_isIdentity)
1212 *this=(*this)*mat;
1213 return *this;
1214 }
1216 bool operator==(MWAWTransformation const &mat) const
1217 {
1218 return m_data==mat.m_data;
1219 }
1221 bool operator!=(MWAWTransformation const &mat) const
1222 {
1223 return m_data!=mat.m_data;
1224 }
1226 bool operator<(MWAWTransformation const &mat) const
1227 {
1228 return m_data<mat.m_data;
1229 }
1231 bool operator<=(MWAWTransformation const &mat) const
1232 {
1233 return m_data<=mat.m_data;
1234 }
1236 bool operator>(MWAWTransformation const &mat) const
1237 {
1238 return m_data>mat.m_data;
1239 }
1241 bool operator>=(MWAWTransformation const &mat) const
1242 {
1243 return m_data>=mat.m_data;
1244 }
1248 bool decompose(float &rotation, MWAWVec2f &shearing, MWAWTransformation &transform, MWAWVec2f const &center) const;
1249
1252 {
1253 return MWAWTransformation(MWAWVec3f(1, 0, trans[0]), MWAWVec3f(0, 1, trans[1]));
1254 }
1257 {
1258 return MWAWTransformation(MWAWVec3f(trans[0], 0, 0), MWAWVec3f(0, trans[1], 0));
1259 }
1263 static MWAWTransformation rotation(float angle, MWAWVec2f const &center=MWAWVec2f(0,0));
1268 {
1269 return MWAWTransformation(MWAWVec3f(1, s[0], -s[0]*center[1]), MWAWVec3f(s[1], 1, -s[1]*center[0]));
1270 }
1271protected:
1273 std::pair<MWAWVec3f, MWAWVec3f > m_data;
1275 mutable bool m_isIdentity;
1276};
1277
1278// some format function
1279namespace libmwaw
1280{
1282bool convertDTFormat(std::string const &dtFormat, librevenge::RVNGPropertyListVector &propVect);
1283}
1284
1285// some geometrical function
1286namespace libmwaw
1287{
1289MWAWVec2f rotatePointAroundCenter(MWAWVec2f const &point, MWAWVec2f const &center, float angle);
1291MWAWBox2f rotateBoxFromCenter(MWAWBox2f const &box, float angle);
1292}
1293#endif /* LIBMWAW_INTERNAL_H */
1294// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
small class which defines a 2D Box
Definition: libmwaw_internal.hxx:968
MWAWBox2(MWAWBox2< U > const &p)
generic constructor
Definition: libmwaw_internal.hxx:975
bool operator>(MWAWBox2< T > const &mat) const
operator>
Definition: libmwaw_internal.hxx:1110
MWAWVec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:985
void resizeFromCenter(MWAWVec2< T > const &sz)
resize the box keeping the center
Definition: libmwaw_internal.hxx:1047
MWAWVec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:990
MWAWVec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:980
void scale(U factor)
scales all points of the box by factor
Definition: libmwaw_internal.hxx:1056
bool operator==(MWAWBox2< T > const &mat) const
operator==
Definition: libmwaw_internal.hxx:1090
MWAWVec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:995
void setMin(MWAWVec2< T > const &x)
resets the minimum point
Definition: libmwaw_internal.hxx:1026
MWAWVec2< T > center() const
the box center
Definition: libmwaw_internal.hxx:1013
bool operator<=(MWAWBox2< T > const &mat) const
operator<=
Definition: libmwaw_internal.hxx:1105
friend std::ostream & operator<<(std::ostream &o, MWAWBox2< T > const &f)
print data in form X0xY0<->X1xY1
Definition: libmwaw_internal.hxx:1120
bool operator<(MWAWBox2< T > const &mat) const
operator<
Definition: libmwaw_internal.hxx:1100
bool operator!=(MWAWBox2< T > const &mat) const
operator!=
Definition: libmwaw_internal.hxx:1095
void set(MWAWVec2< T > const &x, MWAWVec2< T > const &y)
resets the data to minimum x and maximum y
Definition: libmwaw_internal.hxx:1020
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition: libmwaw_internal.hxx:1063
bool operator>=(MWAWBox2< T > const &mat) const
operator>=
Definition: libmwaw_internal.hxx:1115
MWAWBox2< T > getIntersection(MWAWBox2< T > const &box) const
returns the intersection between this and box
Definition: libmwaw_internal.hxx:1080
void resizeFromMax(MWAWVec2< T > const &sz)
resize the box keeping the maximum
Definition: libmwaw_internal.hxx:1042
void resizeFromMin(MWAWVec2< T > const &sz)
resize the box keeping the minimum
Definition: libmwaw_internal.hxx:1037
MWAWVec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition: libmwaw_internal.hxx:1002
MWAWVec2< T > size() const
the box size
Definition: libmwaw_internal.hxx:1008
MWAWBox2(MWAWVec2< T > minPt=MWAWVec2< T >(), MWAWVec2< T > maxPt=MWAWVec2< T >())
constructor
Definition: libmwaw_internal.hxx:971
std::pair< MWAWVec2< T >, MWAWVec2< T > > m_data
the data
Definition: libmwaw_internal.hxx:1128
void setMax(MWAWVec2< T > const &y)
resets the maximum point
Definition: libmwaw_internal.hxx:1031
MWAWBox2< T > getUnion(MWAWBox2< T > const &box) const
returns the union between this and box
Definition: libmwaw_internal.hxx:1070
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:562
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:198
a small structure used to store the informations about a list
Definition: MWAWList.hxx:108
This class contains a virtual interface to all listener.
Definition: MWAWListener.hxx:50
A class which defines the page properties.
Definition: MWAWPageSpan.hxx:96
class to store the paragraph properties
Definition: MWAWParagraph.hxx:82
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:1140
MWAWVec2f multiplyDirection(MWAWVec2f const &dir) const
operator* for direction
Definition: libmwaw_internal.hxx:1172
void checkIdentity() const
check if a matrix is the identity matrix
Definition: libmwaw_internal.hxx:1153
static MWAWTransformation shear(MWAWVec2f s, MWAWVec2f const &center=MWAWVec2f(0, 0))
returns a shear transformation letting center invariant, ie.
Definition: libmwaw_internal.hxx:1267
static MWAWTransformation scale(MWAWVec2f const &trans)
returns a scaling transformation
Definition: libmwaw_internal.hxx:1256
static MWAWTransformation rotation(float angle, MWAWVec2f const &center=MWAWVec2f(0, 0))
returns a rotation transformation around center.
Definition: libmwaw_internal.cxx:635
MWAWBox2f operator*(MWAWBox2f const &box) const
operator* for box2f
Definition: libmwaw_internal.hxx:1186
MWAWVec2f operator*(MWAWVec2f const &pt) const
operator* for vec2f
Definition: libmwaw_internal.hxx:1166
MWAWVec3f const & operator[](int c) const
the two extremum points which defined the box
Definition: libmwaw_internal.hxx:1160
bool isIdentity() const
returns true if the matrix is an identity matrix
Definition: libmwaw_internal.hxx:1148
bool operator>=(MWAWTransformation const &mat) const
operator>=
Definition: libmwaw_internal.hxx:1241
MWAWTransformation & operator*=(MWAWTransformation const &mat)
operator*=
Definition: libmwaw_internal.hxx:1209
MWAWTransformation operator*(MWAWTransformation const &mat) const
operator* for transform
Definition: libmwaw_internal.hxx:1192
static MWAWTransformation translation(MWAWVec2f const &trans)
returns a translation transformation
Definition: libmwaw_internal.hxx:1251
std::pair< MWAWVec3f, MWAWVec3f > m_data
the data
Definition: libmwaw_internal.hxx:1273
bool operator<(MWAWTransformation const &mat) const
operator<
Definition: libmwaw_internal.hxx:1226
bool operator==(MWAWTransformation const &mat) const
operator==
Definition: libmwaw_internal.hxx:1216
bool operator<=(MWAWTransformation const &mat) const
operator<=
Definition: libmwaw_internal.hxx:1231
MWAWTransformation(MWAWVec3f const &xRow=MWAWVec3f(1, 0, 0), MWAWVec3f const &yRow=MWAWVec3f(0, 1, 0))
constructor
Definition: libmwaw_internal.hxx:1143
bool operator>(MWAWTransformation const &mat) const
operator>
Definition: libmwaw_internal.hxx:1236
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:644
bool operator!=(MWAWTransformation const &mat) const
operator!=
Definition: libmwaw_internal.hxx:1221
bool m_isIdentity
flag to know if this matrix is an identity matrix
Definition: libmwaw_internal.hxx:1275
small class which defines a vector with 2 elements
Definition: libmwaw_internal.hxx:607
friend MWAWVec2< T > operator+(MWAWVec2< T > const &p1, MWAWVec2< T > const &p2)
operator+
Definition: libmwaw_internal.hxx:685
friend std::ostream & operator<<(std::ostream &o, MWAWVec2< T > const &f)
operator<<: prints data in form "XxY"
Definition: libmwaw_internal.hxx:739
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition: libmwaw_internal.hxx:655
T operator[](int c) const
operator[]
Definition: libmwaw_internal.hxx:625
void setY(T yy)
resets the second element
Definition: libmwaw_internal.hxx:649
MWAWVec2< T > & operator-=(MWAWVec2< T > const &p)
operator-=
Definition: libmwaw_internal.hxx:669
T m_x
first element
Definition: libmwaw_internal.hxx:775
int cmp(MWAWVec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libmwaw_internal.hxx:720
MWAWVec2< T > & operator+=(MWAWVec2< T > const &p)
operator+=
Definition: libmwaw_internal.hxx:662
int cmpY(MWAWVec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:729
bool operator<(MWAWVec2< T > const &p) const
comparison<: sort by y
Definition: libmwaw_internal.hxx:715
friend MWAWVec2< T > operator*(U scale, MWAWVec2< T > const &p1)
generic operator*
Definition: libmwaw_internal.hxx:698
T y() const
second element
Definition: libmwaw_internal.hxx:620
std::map< MWAWVec2< T >, T, struct PosSizeLtY > MapY
map of MWAWVec2
Definition: libmwaw_internal.hxx:773
T x() const
first element
Definition: libmwaw_internal.hxx:615
bool operator==(MWAWVec2< T > const &p) const
comparison==
Definition: libmwaw_internal.hxx:705
void set(T xx, T yy)
resets the two elements
Definition: libmwaw_internal.hxx:638
MWAWVec2(T xx=0, T yy=0)
constructor
Definition: libmwaw_internal.hxx:610
MWAWVec2< T > & operator*=(U scale)
generic operator*=
Definition: libmwaw_internal.hxx:677
T m_y
second element
Definition: libmwaw_internal.hxx:775
T & operator[](int c)
operator[]
Definition: libmwaw_internal.hxx:631
bool operator!=(MWAWVec2< T > const &p) const
comparison!=
Definition: libmwaw_internal.hxx:710
void setX(T xx)
resets the first element
Definition: libmwaw_internal.hxx:644
std::map< MWAWVec2< T >, T, struct PosSizeLtX > MapX
map of MWAWVec2
Definition: libmwaw_internal.hxx:758
friend MWAWVec2< T > operator-(MWAWVec2< T > const &p1, MWAWVec2< T > const &p2)
operator-
Definition: libmwaw_internal.hxx:691
MWAWVec2(MWAWVec2< U > const &p)
generic copy constructor
Definition: libmwaw_internal.hxx:612
small class which defines a vector with 3 elements
Definition: libmwaw_internal.hxx:791
MWAWVec3< T > & operator*=(U scale)
generic operator*=
Definition: libmwaw_internal.hxx:879
T z() const
third element
Definition: libmwaw_internal.hxx:817
MWAWVec3(T xx=0, T yy=0, T zz=0)
constructor
Definition: libmwaw_internal.hxx:794
T operator[](int c) const
operator[]
Definition: libmwaw_internal.hxx:822
MWAWVec3< T > & operator+=(MWAWVec3< T > const &p)
operator+=
Definition: libmwaw_internal.hxx:866
friend MWAWVec3< T > operator*(U scale, MWAWVec3< T > const &p1)
generic operator*
Definition: libmwaw_internal.hxx:899
T x() const
first element
Definition: libmwaw_internal.hxx:807
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition: libmwaw_internal.hxx:858
T & operator[](int c)
operator[]
Definition: libmwaw_internal.hxx:828
void setX(T xx)
resets the first element
Definition: libmwaw_internal.hxx:842
void setY(T yy)
resets the second element
Definition: libmwaw_internal.hxx:847
MWAWVec3< T > & operator-=(MWAWVec3< T > const &p)
operator-=
Definition: libmwaw_internal.hxx:872
void setZ(T zz)
resets the third element
Definition: libmwaw_internal.hxx:852
friend MWAWVec3< T > operator-(MWAWVec3< T > const &p1, MWAWVec3< T > const &p2)
operator-
Definition: libmwaw_internal.hxx:892
friend std::ostream & operator<<(std::ostream &o, MWAWVec3< T > const &f)
operator<<: prints data in form "XxYxZ"
Definition: libmwaw_internal.hxx:931
std::map< MWAWVec3< T >, T, struct PosSizeLt > Map
map of MWAWVec3
Definition: libmwaw_internal.hxx:950
void set(T xx, T yy, T zz)
resets the three elements
Definition: libmwaw_internal.hxx:835
bool operator!=(MWAWVec3< T > const &p) const
comparison!=
Definition: libmwaw_internal.hxx:911
bool operator==(MWAWVec3< T > const &p) const
comparison==
Definition: libmwaw_internal.hxx:906
friend MWAWVec3< T > operator+(MWAWVec3< T > const &p1, MWAWVec3< T > const &p2)
operator+
Definition: libmwaw_internal.hxx:886
MWAWVec3(MWAWVec3< U > const &p)
generic copy constructor
Definition: libmwaw_internal.hxx:801
T m_val[3]
the values
Definition: libmwaw_internal.hxx:954
T y() const
second element
Definition: libmwaw_internal.hxx:812
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:921
bool operator<(MWAWVec3< T > const &p) const
comparison<: which first compares x values, then y values then z values.
Definition: libmwaw_internal.hxx:916
Definition: libmwaw_internal.hxx:138
Definition: libmwaw_internal.hxx:146
Definition: libmwaw_internal.hxx:142
Definition: libmwaw_internal.hxx:134
Definition: libmwaw_internal.hxx:150
shared_ptr< MWAWFontManager > MWAWFontManagerPtr
a smart pointer of MWAWFontManager
Definition: libmwaw_internal.hxx:499
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:781
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1134
MWAWVec2< long > MWAWVec2l
MWAWVec2 of long.
Definition: libmwaw_internal.hxx:783
shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:505
shared_ptr< MWAWSubDocument > MWAWSubDocumentPtr
a smart pointer of MWAWSubDocument
Definition: libmwaw_internal.hxx:517
MWAWBox2< int > MWAWBox2i
MWAWBox2 of int.
Definition: libmwaw_internal.hxx:1132
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:513
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:503
shared_ptr< MWAWPresentationListener > MWAWPresentationListenerPtr
a smart pointer of MWAWPresentationListener
Definition: libmwaw_internal.hxx:511
MWAWBox2< long > MWAWBox2l
MWAWBox2 of long.
Definition: libmwaw_internal.hxx:1136
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:509
shared_ptr< MWAWTextListener > MWAWTextListenerPtr
a smart pointer of MWAWTextListener
Definition: libmwaw_internal.hxx:519
shared_ptr< MWAWFontConverter > MWAWFontConverterPtr
a smart pointer of MWAWFontConverter
Definition: libmwaw_internal.hxx:495
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:785
MWAWVec2< bool > MWAWVec2b
MWAWVec2 of bool.
Definition: libmwaw_internal.hxx:779
shared_ptr< MWAWListManager > MWAWListManagerPtr
a smart pointer of MWAWListManager
Definition: libmwaw_internal.hxx:507
shared_ptr< MWAWSpreadsheetListener > MWAWSpreadsheetListenerPtr
a smart pointer of MWAWSpreadsheetListener
Definition: libmwaw_internal.hxx:515
MWAWVec3< float > MWAWVec3f
MWAWVec3 of float.
Definition: libmwaw_internal.hxx:962
MWAWVec3< int > MWAWVec3i
MWAWVec3 of int.
Definition: libmwaw_internal.hxx:960
#define LIBMWAW_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libmwaw_internal.hxx:116
shared_ptr< MWAWGraphicListener > MWAWGraphicListenerPtr
a smart pointer of MWAWGraphicListener
Definition: libmwaw_internal.hxx:501
MWAWVec3< unsigned char > MWAWVec3uc
MWAWVec3 of unsigned char.
Definition: libmwaw_internal.hxx:958
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:183
WritingMode
the different writing mode
Definition: libmwaw_internal.hxx:175
@ WritingLeftBottom
Definition: libmwaw_internal.hxx:175
@ WritingLeftTop
Definition: libmwaw_internal.hxx:175
@ WritingInherited
Definition: libmwaw_internal.hxx:175
@ WritingRightBottom
Definition: libmwaw_internal.hxx:175
@ WritingRightTop
Definition: libmwaw_internal.hxx:175
std::string numberingTypeToString(NumberingType type)
Definition: libmwaw_internal.cxx:105
SubDocumentType
Definition: libmwaw_internal.hxx:178
@ DOC_CHART
Definition: libmwaw_internal.hxx:178
@ DOC_CHART_ZONE
Definition: libmwaw_internal.hxx:178
@ DOC_TEXT_BOX
Definition: libmwaw_internal.hxx:178
@ DOC_HEADER_FOOTER
Definition: libmwaw_internal.hxx:178
@ DOC_NONE
Definition: libmwaw_internal.hxx:178
@ DOC_TABLE
Definition: libmwaw_internal.hxx:178
@ DOC_SHEET
Definition: libmwaw_internal.hxx:178
@ DOC_COMMENT_ANNOTATION
Definition: libmwaw_internal.hxx:178
@ DOC_GRAPHIC_GROUP
Definition: libmwaw_internal.hxx:178
@ DOC_NOTE
Definition: libmwaw_internal.hxx:178
@ VMiddleBit
Definition: libmwaw_internal.hxx:168
@ LeftBit
Definition: libmwaw_internal.hxx:168
@ BottomBit
Definition: libmwaw_internal.hxx:168
@ HMiddleBit
Definition: libmwaw_internal.hxx:168
@ TopBit
Definition: libmwaw_internal.hxx:168
@ RightBit
Definition: libmwaw_internal.hxx:168
MWAWVec2f rotatePointAroundCenter(MWAWVec2f const &point, MWAWVec2f const &center, float angle)
rotate a point around center, angle is given in degree
Definition: libmwaw_internal.cxx:689
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libmwaw_internal.cxx:52
std::string numberingValueToString(NumberingType type, int value)
Definition: libmwaw_internal.cxx:129
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:697
bool convertDTFormat(std::string const &dtFormat, librevenge::RVNGPropertyListVector &propVect)
convert a DTFormat in a propertyList
Definition: libmwaw_internal.cxx:315
NumberingType
Definition: libmwaw_internal.hxx:170
@ NONE
Definition: libmwaw_internal.hxx:170
@ BULLET
Definition: libmwaw_internal.hxx:170
@ LOWERCASE_ROMAN
Definition: libmwaw_internal.hxx:170
@ UPPERCASE_ROMAN
Definition: libmwaw_internal.hxx:170
@ LOWERCASE
Definition: libmwaw_internal.hxx:170
@ UPPERCASE
Definition: libmwaw_internal.hxx:170
@ ARABIC
Definition: libmwaw_internal.hxx:170
Position
basic position enum
Definition: libmwaw_internal.hxx:166
@ VMiddle
Definition: libmwaw_internal.hxx:166
@ Top
Definition: libmwaw_internal.hxx:166
@ Bottom
Definition: libmwaw_internal.hxx:166
@ HMiddle
Definition: libmwaw_internal.hxx:166
@ Left
Definition: libmwaw_internal.hxx:166
@ Right
Definition: libmwaw_internal.hxx:166
a border
Definition: libmwaw_internal.hxx:314
bool operator!=(MWAWBorder const &orig) const
operator!=
Definition: libmwaw_internal.hxx:337
Style m_style
the border style
Definition: libmwaw_internal.hxx:350
int compare(MWAWBorder const &orig) const
compare two borders
Definition: libmwaw_internal.cxx:420
MWAWBorder()
constructor
Definition: libmwaw_internal.hxx:321
Type
the line repetition
Definition: libmwaw_internal.hxx:318
@ Single
Definition: libmwaw_internal.hxx:318
@ Double
Definition: libmwaw_internal.hxx:318
@ Triple
Definition: libmwaw_internal.hxx:318
Type m_type
the border repetition
Definition: libmwaw_internal.hxx:355
std::string m_extra
extra data ( if needed)
Definition: libmwaw_internal.hxx:365
std::vector< double > m_widthsList
the different length used for each line/sep (if defined)
Definition: libmwaw_internal.hxx:361
bool operator==(MWAWBorder const &orig) const
operator==
Definition: libmwaw_internal.hxx:332
Style
the line style
Definition: libmwaw_internal.hxx:316
@ Simple
Definition: libmwaw_internal.hxx:316
@ Dash
Definition: libmwaw_internal.hxx:316
@ Dot
Definition: libmwaw_internal.hxx:316
@ LargeDot
Definition: libmwaw_internal.hxx:316
@ None
Definition: libmwaw_internal.hxx:316
double m_width
the border total width in point
Definition: libmwaw_internal.hxx:357
friend std::ostream & operator<<(std::ostream &o, MWAWBorder const &border)
operator<<
Definition: libmwaw_internal.cxx:529
bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const
add the border property to proplist (if needed )
Definition: libmwaw_internal.cxx:432
MWAWColor m_color
the border color
Definition: libmwaw_internal.hxx:363
bool isEmpty() const
returns true if the border is empty
Definition: libmwaw_internal.hxx:327
the class to store a color
Definition: libmwaw_internal.hxx:182
unsigned char getGreen() const
returns the green value
Definition: libmwaw_internal.hxx:260
unsigned char getBlue() const
returns the green value
Definition: libmwaw_internal.hxx:250
bool operator<(MWAWColor const &c) const
operator<
Definition: libmwaw_internal.hxx:285
static MWAWColor barycenter(float alpha, MWAWColor const &colA, float beta, MWAWColor const &colB)
return alpha*colA+beta*colB
Definition: libmwaw_internal.cxx:205
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:199
std::string str() const
print the color in the form #rrggbb
Definition: libmwaw_internal.cxx:231
bool operator>(MWAWColor const &c) const
operator>
Definition: libmwaw_internal.hxx:295
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:226
static MWAWColor colorFromHSL(unsigned char H, unsigned char S, unsigned char L)
return a color from a hsl color (basic)
Definition: libmwaw_internal.hxx:209
uint32_t value() const
return the rgba value
Definition: libmwaw_internal.hxx:240
friend std::ostream & operator<<(std::ostream &o, MWAWColor const &c)
operator<< in the form #rrggbb
Definition: libmwaw_internal.cxx:219
bool isWhite() const
return true if the color is white
Definition: libmwaw_internal.hxx:270
bool operator>=(MWAWColor const &c) const
operator>=
Definition: libmwaw_internal.hxx:300
bool operator!=(MWAWColor const &c) const
operator!=
Definition: libmwaw_internal.hxx:280
bool operator<=(MWAWColor const &c) const
operator<=
Definition: libmwaw_internal.hxx:290
MWAWColor(uint32_t argb=0)
constructor
Definition: libmwaw_internal.hxx:184
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:231
uint32_t m_value
the argb color
Definition: libmwaw_internal.hxx:310
MWAWColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition: libmwaw_internal.hxx:188
unsigned char getAlpha() const
returns the alpha value
Definition: libmwaw_internal.hxx:245
MWAWColor & operator=(uint32_t argb)
operator=
Definition: libmwaw_internal.hxx:193
bool isBlack() const
return true if the color is black
Definition: libmwaw_internal.hxx:265
bool operator==(MWAWColor const &c) const
operator==
Definition: libmwaw_internal.hxx:275
unsigned char getRed() const
returns the red value
Definition: libmwaw_internal.hxx:255
small class use to define a embedded object
Definition: libmwaw_internal.hxx:425
int cmp(MWAWEmbeddedObject const &pict) const
a comparison function
Definition: libmwaw_internal.cxx:595
MWAWEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
constructor
Definition: libmwaw_internal.hxx:431
~MWAWEmbeddedObject()
destructor
Definition: libmwaw_internal.cxx:564
bool isEmpty() const
return true if the picture contains no data
Definition: libmwaw_internal.hxx:439
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition: libmwaw_internal.hxx:467
friend std::ostream & operator<<(std::ostream &o, MWAWEmbeddedObject const &pict)
operator<<
Definition: libmwaw_internal.cxx:620
MWAWEmbeddedObject()
empty constructor
Definition: libmwaw_internal.hxx:427
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist
Definition: libmwaw_internal.cxx:568
void add(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
add a picture
Definition: libmwaw_internal.hxx:448
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition: libmwaw_internal.hxx:465
a field
Definition: libmwaw_internal.hxx:369
Type
Defines some basic type for field.
Definition: libmwaw_internal.hxx:371
@ PageCount
Definition: libmwaw_internal.hxx:371
@ Title
Definition: libmwaw_internal.hxx:371
@ Database
Definition: libmwaw_internal.hxx:371
@ None
Definition: libmwaw_internal.hxx:371
@ PageNumber
Definition: libmwaw_internal.hxx:371
@ Time
Definition: libmwaw_internal.hxx:371
@ Date
Definition: libmwaw_internal.hxx:371
std::string m_DTFormat
the date/time format using strftime format if defined
Definition: libmwaw_internal.hxx:386
libmwaw::NumberingType m_numberingType
the number type ( for number field )
Definition: libmwaw_internal.hxx:384
librevenge::RVNGString getString() const
returns a string corresponding to the field (if possible) *‍/
Definition: libmwaw_internal.cxx:287
std::string m_data
the database/link field ( if defined )
Definition: libmwaw_internal.hxx:388
Type m_type
the type
Definition: libmwaw_internal.hxx:382
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist (if possible)
Definition: libmwaw_internal.cxx:239
MWAWField(Type type)
basic constructor
Definition: libmwaw_internal.hxx:374
a note
Definition: libmwaw_internal.hxx:406
Type
enum to define note type
Definition: libmwaw_internal.hxx:408
@ FootNote
Definition: libmwaw_internal.hxx:408
@ EndNote
Definition: libmwaw_internal.hxx:408
int m_number
the note number if defined
Definition: libmwaw_internal.hxx:418
Type m_type
the note type
Definition: libmwaw_internal.hxx:414
MWAWNote(Type type)
constructor
Definition: libmwaw_internal.hxx:410
librevenge::RVNGString m_label
the note label
Definition: libmwaw_internal.hxx:416
a generic variable template: value + flag to know if the variable is set
Definition: libmwaw_internal.hxx:527
T & operator*()
operator*
Definition: libmwaw_internal.hxx:575
T const & operator*() const
operator*
Definition: libmwaw_internal.hxx:570
void insert(MWAWVariable const &orig)
update the current value if orig is set
Definition: libmwaw_internal.hxx:551
bool isSet() const
return true if the variable is set
Definition: libmwaw_internal.hxx:586
T m_data
the value
Definition: libmwaw_internal.hxx:597
T const * operator->() const
operator*
Definition: libmwaw_internal.hxx:559
MWAWVariable()
constructor
Definition: libmwaw_internal.hxx:529
MWAWVariable(T const &def)
constructor with a default value
Definition: libmwaw_internal.hxx:531
void setSet(bool newVal)
define if the variable is set
Definition: libmwaw_internal.hxx:591
bool m_set
a flag to know if the variable is set or not
Definition: libmwaw_internal.hxx:599
MWAWVariable & operator=(MWAWVariable const &orig)
copy operator
Definition: libmwaw_internal.hxx:535
T const & get() const
return the current value
Definition: libmwaw_internal.hxx:581
MWAWVariable(MWAWVariable const &orig)
copy constructor
Definition: libmwaw_internal.hxx:533
MWAWVariable & operator=(T const &val)
set a value
Definition: libmwaw_internal.hxx:544
T * operator->()
operator*
Definition: libmwaw_internal.hxx:564
internal struct used to create sorted map, sorted by X
Definition: libmwaw_internal.hxx:748
bool operator()(MWAWVec2< T > const &s1, MWAWVec2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:750
internal struct used to create sorted map, sorted by Y
Definition: libmwaw_internal.hxx:763
bool operator()(MWAWVec2< T > const &s1, MWAWVec2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:765
internal struct used to create sorted map, sorted by X, Y, Z
Definition: libmwaw_internal.hxx:940
bool operator()(MWAWVec3< T > const &s1, MWAWVec3< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:942
an noop deleter used to transform a libwpd pointer in a false shared_ptr
Definition: libmwaw_internal.hxx:109
void operator()(T *)
Definition: libmwaw_internal.hxx:110

Generated on Wed Jan 19 2022 22:23:14 for libmwaw by doxygen 1.9.3