libmwaw_internal.hxx Source File documentation

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
57 typedef signed char int8_t;
58 typedef unsigned char uint8_t;
59 typedef signed short int16_t;
60 typedef unsigned short uint16_t;
61 typedef signed int int32_t;
62 typedef unsigned int uint32_t;
63 typedef unsigned __int64 uint64_t;
64 typedef __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>
98 using std::tr1::shared_ptr;
99 #elif defined(SHAREDPTR_STD)
100 #include <memory>
101 using std::shared_ptr;
102 #else
103 #include <boost/shared_ptr.hpp>
104 using boost::shared_ptr;
105 #endif
106
108 template <class T>
109 struct MWAW_shared_ptr_noop_deleter {
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
121 namespace libmwaw
122 {
123 void 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
130 namespace libmwaw
131 {
132 // Various exceptions:
133 class VersionException
134 {
135 };
136
137 class FileException
138 {
139 };
140
141 class ParseException
142 {
143 };
144
145 class GenericException
146 {
147 };
148
149 class WrongPasswordException
150 {
151 };
152 }
153
154 /* ---------- input ----------------- */
155 namespace libmwaw
156 {
157 uint8_t readU8(librevenge::RVNGInputStream *input);
159 void appendUnicode(uint32_t val, librevenge::RVNGString &buffer);
160 }
161
162 /* ---------- small enum/class ------------- */
163 namespace libmwaw
164 {
166 enum Position { Left = 0, Right = 1, Top = 2, Bottom = 3, HMiddle = 4, VMiddle = 5 };
168 enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08, HMiddleBit = 0x10, VMiddleBit = 0x20 };
169
170 enum NumberingType { NONE, BULLET, ARABIC, LOWERCASE, UPPERCASE, LOWERCASE_ROMAN, UPPERCASE_ROMAN };
171 std::string numberingTypeToString(NumberingType type);
172 std::string numberingValueToString(NumberingType type, int value);
173
175 enum WritingMode { WritingLeftTop, WritingLeftBottom, WritingRightTop, WritingRightBottom, WritingInherited };
177 std::string writingModeToString(WritingMode mode);
178 enum SubDocumentType { DOC_NONE, DOC_CHART, DOC_CHART_ZONE, DOC_COMMENT_ANNOTATION, DOC_GRAPHIC_GROUP, DOC_HEADER_FOOTER, DOC_NOTE, DOC_SHEET, DOC_TABLE, DOC_TEXT_BOX };
179 }
180
182 struct 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 }
226 static MWAWColor black()
227 {
228 return MWAWColor(0,0,0);
229 }
231 static MWAWColor white()
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;
308 protected:
310 uint32_t m_value;
311 };
312
314 struct MWAWBorder {
316 enum Style { None, Simple, Dot, LargeDot, Dash };
318 enum Type { Single, Double, Triple };
319
321 MWAWBorder() : m_style(Simple), m_type(Single), m_width(1), m_widthsList(), m_color(MWAWColor::black()), m_extra("") { }
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);
350 Style m_style;
351
352 // multiple borders
353
355 Type m_type;
357 double m_width;
361 std::vector<double> m_widthsList;
363 MWAWColor m_color;
365 std::string m_extra;
366 };
367
369 struct MWAWField {
371 enum Type { None, PageCount, PageNumber, Date, Time, Title, Database };
372
374 explicit MWAWField(Type type) : m_type(type), m_numberingType(libmwaw::ARABIC), m_DTFormat(""), m_data("")
375 {
376 }
378 bool addTo(librevenge::RVNGPropertyList &propList) const;
380 librevenge::RVNGString getString() const;
382 Type m_type;
384 libmwaw::NumberingType m_numberingType;
386 std::string m_DTFormat;
388 std::string m_data;
389 };
390
392 struct MWAWLink {
394 MWAWLink() : m_HRef("")
395 {
396 }
397
399 bool addTo(librevenge::RVNGPropertyList &propList) const;
400
402 std::string m_HRef;
403 };
404
406 struct MWAWNote {
408 enum Type { FootNote, EndNote };
410 explicit MWAWNote(Type type) : m_type(type), m_label(""), m_number(-1)
411 {
412 }
414 Type m_type;
416 librevenge::RVNGString m_label;
418 int m_number;
419 };
420
425 struct MWAWEmbeddedObject {
427 MWAWEmbeddedObject() : m_dataList(), m_typeList()
428 {
429 }
431 MWAWEmbeddedObject(librevenge::RVNGBinaryData const &binaryData,
432 std::string type="image/pict") : m_dataList(), m_typeList()
433 {
434 add(binaryData, type);
435 }
437 ~MWAWEmbeddedObject();
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
471 class MWAWEntry;
472 class MWAWFont;
473 class MWAWGraphicEncoder;
474 class MWAWGraphicShape;
475 class MWAWGraphicStyle;
476 class MWAWHeader;
477 class MWAWList;
478 class MWAWPageSpan;
479 class MWAWParagraph;
480 class MWAWParser;
481 class MWAWPosition;
482 class MWAWSection;
483
484 class MWAWFontConverter;
485 class MWAWFontManager;
486 class MWAWGraphicListener;
487 class MWAWInputStream;
488 class MWAWListener;
489 class MWAWListManager;
490 class MWAWParserState;
491 class MWAWPresentationListener;
492 class MWAWRSRCParser;
493 class MWAWSpreadsheetListener;
494 class MWAWSubDocument;
495 class MWAWTextListener;
497 typedef shared_ptr<MWAWFontConverter> MWAWFontConverterPtr;
499 typedef shared_ptr<MWAWFontManager> MWAWFontManagerPtr;
501 typedef shared_ptr<MWAWGraphicListener> MWAWGraphicListenerPtr;
503 typedef shared_ptr<MWAWInputStream> MWAWInputStreamPtr;
505 typedef shared_ptr<MWAWListener> MWAWListenerPtr;
507 typedef shared_ptr<MWAWListManager> MWAWListManagerPtr;
509 typedef shared_ptr<MWAWParserState> MWAWParserStatePtr;
511 typedef shared_ptr<MWAWPresentationListener> MWAWPresentationListenerPtr;
513 typedef shared_ptr<MWAWRSRCParser> MWAWRSRCParserPtr;
515 typedef shared_ptr<MWAWSpreadsheetListener> MWAWSpreadsheetListenerPtr;
517 typedef shared_ptr<MWAWSubDocument> MWAWSubDocumentPtr;
519 typedef shared_ptr<MWAWTextListener> MWAWTextListenerPtr;
520
527 template <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) {}
535 MWAWVariable &operator=(MWAWVariable const &orig)
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 }
564 T *operator->()
565 {
566 m_set = true;
567 return &m_data;
568 }
570 T const &operator*() const
571 {
572 return m_data;
573 }
575 T &operator*()
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 }
595 protected:
597 T m_data;
599 bool m_set;
600 };
601
602 /* ---------- vec2/box2f ------------- */
606 template <class T> class MWAWVec2
607 {
608 public:
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
662 MWAWVec2<T> &operator+=(MWAWVec2<T> const &p)
663 {
664 m_x += p.m_x;
665 m_y += p.m_y;
666 return *this;
667 }
669 MWAWVec2<T> &operator-=(MWAWVec2<T> const &p)
670 {
671 m_x -= p.m_x;
672 m_y -= p.m_y;
673 return *this;
674 }
676 template <class U>
677 MWAWVec2<T> &operator*=(U scale)
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;
774 protected:
775 T m_x, m_y;
776 };
777
779 typedef MWAWVec2<bool> MWAWVec2b;
781 typedef MWAWVec2<int> MWAWVec2i;
783 typedef MWAWVec2<long> MWAWVec2l;
785 typedef MWAWVec2<float> MWAWVec2f;
786
790 template <class T> class MWAWVec3
791 {
792 public:
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
866 MWAWVec3<T> &operator+=(MWAWVec3<T> const &p)
867 {
868 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]);
869 return *this;
870 }
872 MWAWVec3<T> &operator-=(MWAWVec3<T> const &p)
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>
879 MWAWVec3<T> &operator*=(U scale)
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
952 protected:
954 T m_val[3];
955 };
956
958 typedef MWAWVec3<unsigned char> MWAWVec3uc;
960 typedef MWAWVec3<int> MWAWVec3i;
962 typedef MWAWVec3<float> MWAWVec3f;
963
967 template <class T> class MWAWBox2
968 {
969 public:
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 }
990 MWAWVec2<T> &min()
991 {
992 return m_data.first;
993 }
995 MWAWVec2<T> &max()
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 }
1008 MWAWVec2<T> size() const
1009 {
1010 return m_data.second-m_data.first;
1011 }
1013 MWAWVec2<T> center() const
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
1037 void resizeFromMin(MWAWVec2<T> const &sz)
1038 {
1039 m_data.second = m_data.first+sz;
1040 }
1042 void resizeFromMax(MWAWVec2<T> const &sz)
1043 {
1044 m_data.first = m_data.second-sz;
1045 }
1047 void resizeFromCenter(MWAWVec2<T> const &sz)
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
1070 MWAWBox2<T> getUnion(MWAWBox2<T> const &box) const
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 }
1080 MWAWBox2<T> getIntersection(MWAWBox2<T> const &box) const
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
1126 protected:
1128 std::pair<MWAWVec2<T>, MWAWVec2<T> > m_data;
1129 };
1130
1132 typedef MWAWBox2<int> MWAWBox2i;
1134 typedef MWAWBox2<float> MWAWBox2f;
1136 typedef MWAWBox2<long> MWAWBox2l;
1137
1139 class MWAWTransformation
1140 {
1141 public:
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 }
1166 MWAWVec2f operator*(MWAWVec2f const &pt) const
1167 {
1168 if (m_isIdentity) return pt;
1169 return multiplyDirection(pt)+MWAWVec2f(m_data.first[2],m_data.second[2]);
1170 }
1172 MWAWVec2f multiplyDirection(MWAWVec2f const &dir) const
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 }
1186 MWAWBox2f operator*(MWAWBox2f const &box) const
1187 {
1188 if (m_isIdentity) return box;
1189 return MWAWBox2f(operator*(box.min()), operator*(box.max()));
1190 }
1192 MWAWTransformation operator*(MWAWTransformation const &mat) const
1193 {
1194 if (mat.m_isIdentity) return *this;
1195 MWAWTransformation res;
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 }
1209 MWAWTransformation &operator*=(MWAWTransformation const &mat)
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
1251 static MWAWTransformation translation(MWAWVec2f const &trans)
1252 {
1253 return MWAWTransformation(MWAWVec3f(1, 0, trans[0]), MWAWVec3f(0, 1, trans[1]));
1254 }
1256 static MWAWTransformation scale(MWAWVec2f const &trans)
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));
1267 static MWAWTransformation shear(MWAWVec2f s, 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 }
1271 protected:
1273 std::pair<MWAWVec3f, MWAWVec3f > m_data;
1275 mutable bool m_isIdentity;
1276 };
1277
1278 // some format function
1279 namespace libmwaw
1280 {
1282 bool convertDTFormat(std::string const &dtFormat, librevenge::RVNGPropertyListVector &propVect);
1283 }
1284
1285 // some geometrical function
1286 namespace libmwaw
1287 {
1289 MWAWVec2f rotatePointAroundCenter(MWAWVec2f const &point, MWAWVec2f const &center, float angle);
1291 MWAWBox2f 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:
MWAWVec3::z
T z() const
third element
Definition: libmwaw_internal.hxx:817
MWAWListenerPtr
shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:505
MWAWVec2::setY
void setY(T yy)
resets the second element
Definition: libmwaw_internal.hxx:649
MWAWNote::m_number
int m_number
the note number if defined
Definition: libmwaw_internal.hxx:418
MWAWFontManagerPtr
shared_ptr< MWAWFontManager > MWAWFontManagerPtr
a smart pointer of MWAWFontManager
Definition: libmwaw_internal.hxx:499
MWAWHeader
a function used by MWAWDocument to store the version of document
Definition: MWAWHeader.hxx:56
MWAWVec3::operator*=
MWAWVec3< T > & operator*=(U scale)
generic operator*=
Definition: libmwaw_internal.hxx:879
libmwaw::NumberingType
NumberingType
Definition: libmwaw_internal.hxx:170
MWAWColor::operator<
bool operator<(MWAWColor const &c) const
operator<
Definition: libmwaw_internal.hxx:285
MWAWVec2::operator-=
MWAWVec2< T > & operator-=(MWAWVec2< T > const &p)
operator-=
Definition: libmwaw_internal.hxx:669
libmwaw::appendUnicode
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer)
adds an unicode character to a string
Definition: libmwaw_internal.cxx:63
libmwaw::DOC_NONE
Definition: libmwaw_internal.hxx:178
MWAWColor::operator=
MWAWColor & operator=(uint32_t argb)
operator=
Definition: libmwaw_internal.hxx:193
libmwaw::LOWERCASE_ROMAN
Definition: libmwaw_internal.hxx:170
libmwaw::UPPERCASE_ROMAN
Definition: libmwaw_internal.hxx:170
MWAWVec3i
MWAWVec3< int > MWAWVec3i
MWAWVec3 of int.
Definition: libmwaw_internal.hxx:960
MWAWVec2< bool >::MapX
std::map< MWAWVec2< bool >, bool, struct PosSizeLtX > MapX
map of MWAWVec2
Definition: libmwaw_internal.hxx:758
MWAWTransformation::multiplyDirection
MWAWVec2f multiplyDirection(MWAWVec2f const &dir) const
operator* for direction
Definition: libmwaw_internal.hxx:1172
MWAWVec2::y
T y() const
second element
Definition: libmwaw_internal.hxx:620
libmwaw::DOC_GRAPHIC_GROUP
Definition: libmwaw_internal.hxx:178
libmwaw::NONE
Definition: libmwaw_internal.hxx:170
MWAWField::m_data
std::string m_data
the database/link field ( if defined )
Definition: libmwaw_internal.hxx:388
MWAWFontManager
a font manager which can be used to store fonts, ...
Definition: MWAWFont.hxx:561
MWAWColor::getRed
unsigned char getRed() const
returns the red value
Definition: libmwaw_internal.hxx:255
MWAWPresentationListener
This class contains code needed to write a presention document.
Definition: MWAWPresentationListener.hxx:59
MWAWBorder::m_type
Type m_type
the border repetition
Definition: libmwaw_internal.hxx:355
libmwaw::TopBit
Definition: libmwaw_internal.hxx:168
BeagleWksDRParserInternal::operator<<
std::ostream & operator<<(std::ostream &o, Shape const &shape)
Definition: BeagleWksDRParser.cxx:98
MWAWPageSpan
A class which defines the page properties.
Definition: MWAWPageSpan.hxx:95
MWAWBorder::isEmpty
bool isEmpty() const
returns true if the border is empty
Definition: libmwaw_internal.hxx:327
MWAWTransformation::translation
static MWAWTransformation translation(MWAWVec2f const &trans)
returns a translation transformation
Definition: libmwaw_internal.hxx:1251
libmwaw::rotateBoxFromCenter
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
MWAWVariable::operator*
T & operator*()
operator*
Definition: libmwaw_internal.hxx:575
MWAWEmbeddedObject::m_dataList
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition: libmwaw_internal.hxx:465
MWAWColor::isWhite
bool isWhite() const
return true if the color is white
Definition: libmwaw_internal.hxx:270
libmwaw::DOC_TEXT_BOX
Definition: libmwaw_internal.hxx:178
MWAWTextListener
This class contents the main functions needed to create a Word processing Document.
Definition: MWAWTextListener.hxx:64
MWAWColor::isBlack
bool isBlack() const
return true if the color is black
Definition: libmwaw_internal.hxx:265
MWAWColor::white
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:231
MWAWNote::MWAWNote
MWAWNote(Type type)
constructor
Definition: libmwaw_internal.hxx:410
MWAWVec2::MWAWVec2
MWAWVec2(T xx=0, T yy=0)
constructor
Definition: libmwaw_internal.hxx:610
libmwaw::DOC_NOTE
Definition: libmwaw_internal.hxx:178
libmwaw::numberingValueToString
std::string numberingValueToString(NumberingType type, int value)
Definition: libmwaw_internal.cxx:129
MWAWLink
a link
Definition: libmwaw_internal.hxx:392
MWAWVariable::m_data
T m_data
the value
Definition: libmwaw_internal.hxx:597
MWAWVec3::operator!=
bool operator!=(MWAWVec3< T > const &p) const
comparison!=
Definition: libmwaw_internal.hxx:911
MWAWPresentationListenerPtr
shared_ptr< MWAWPresentationListener > MWAWPresentationListenerPtr
a smart pointer of MWAWPresentationListener
Definition: libmwaw_internal.hxx:511
libmwaw::convertDTFormat
bool convertDTFormat(std::string const &dtFormat, librevenge::RVNGPropertyListVector &propVect)
convert a DTFormat in a propertyList
Definition: libmwaw_internal.cxx:315
libmwaw::VMiddleBit
Definition: libmwaw_internal.hxx:168
MWAWBox2::extend
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition: libmwaw_internal.hxx:1063
MWAWVariable::operator->
T * operator->()
operator*
Definition: libmwaw_internal.hxx:564
MWAWTransformation::MWAWTransformation
MWAWTransformation(MWAWVec3f const &xRow=MWAWVec3f(1, 0, 0), MWAWVec3f const &yRow=MWAWVec3f(0, 1, 0))
constructor
Definition: libmwaw_internal.hxx:1143
MWAWColor::MWAWColor
MWAWColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition: libmwaw_internal.hxx:188
MWAWVec3::add
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition: libmwaw_internal.hxx:858
MWAWTransformation::operator*
MWAWVec2f operator*(MWAWVec2f const &pt) const
operator* for vec2f
Definition: libmwaw_internal.hxx:1166
libmwaw::DOC_CHART
Definition: libmwaw_internal.hxx:178
MWAWVariable::MWAWVariable
MWAWVariable(T const &def)
constructor with a default value
Definition: libmwaw_internal.hxx:531
MWAWEmbeddedObject::add
void add(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
add a picture
Definition: libmwaw_internal.hxx:448
MWAWBox2::resizeFromMax
void resizeFromMax(MWAWVec2< T > const &sz)
resize the box keeping the maximum
Definition: libmwaw_internal.hxx:1042
MWAWColor::black
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:226
MWAWTransformation::m_isIdentity
bool m_isIdentity
flag to know if this matrix is an identity matrix
Definition: libmwaw_internal.hxx:1275
MWAWVec3< int >::Map
std::map< MWAWVec3< int >, int, struct PosSizeLt > Map
map of MWAWVec3
Definition: libmwaw_internal.hxx:950
MWAWGraphicStyle
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
MWAWBox2::operator==
bool operator==(MWAWBox2< T > const &mat) const
operator==
Definition: libmwaw_internal.hxx:1090
MWAWBox2::center
MWAWVec2< T > center() const
the box center
Definition: libmwaw_internal.hxx:1013
MWAWVec3::operator-=
MWAWVec3< T > & operator-=(MWAWVec3< T > const &p)
operator-=
Definition: libmwaw_internal.hxx:872
MWAWVariable::insert
void insert(MWAWVariable const &orig)
update the current value if orig is set
Definition: libmwaw_internal.hxx:551
MWAWGraphicListener
This class contains the code needed to create Graphic document.
Definition: MWAWGraphicListener.hxx:59
libmwaw::SubDocumentType
SubDocumentType
Definition: libmwaw_internal.hxx:178
MWAWVec3::operator*
friend MWAWVec3< T > operator*(U scale, MWAWVec3< T > const &p1)
generic operator*
Definition: libmwaw_internal.hxx:899
MWAWTransformation::shear
static MWAWTransformation shear(MWAWVec2f s, MWAWVec2f const &center=MWAWVec2f(0, 0))
returns a shear transformation letting center invariant, ie.
Definition: libmwaw_internal.hxx:1267
libmwaw::numberingTypeToString
std::string numberingTypeToString(NumberingType type)
Definition: libmwaw_internal.cxx:105
MWAWVec3::y
T y() const
second element
Definition: libmwaw_internal.hxx:812
MWAWTransformation::operator>
bool operator>(MWAWTransformation const &mat) const
operator>
Definition: libmwaw_internal.hxx:1236
libmwaw::VMiddle
Definition: libmwaw_internal.hxx:166
MWAWBox2::size
MWAWVec2< T > size() const
the box size
Definition: libmwaw_internal.hxx:1008
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:781
MWAWBorder::m_width
double m_width
the border total width in point
Definition: libmwaw_internal.hxx:357
MWAWTransformation::operator!=
bool operator!=(MWAWTransformation const &mat) const
operator!=
Definition: libmwaw_internal.hxx:1221
libmwaw::Bottom
Definition: libmwaw_internal.hxx:166
MWAWVec2::MWAWVec2
MWAWVec2(MWAWVec2< U > const &p)
generic copy constructor
Definition: libmwaw_internal.hxx:612
MWAWVec3::x
T x() const
first element
Definition: libmwaw_internal.hxx:807
MWAWVec2::operator-
friend MWAWVec2< T > operator-(MWAWVec2< T > const &p1, MWAWVec2< T > const &p2)
operator-
Definition: libmwaw_internal.hxx:691
libmwaw::Position
Position
basic position enum
Definition: libmwaw_internal.hxx:166
libmwaw::Top
Definition: libmwaw_internal.hxx:166
MWAWVec2::operator*=
MWAWVec2< T > & operator*=(U scale)
generic operator*=
Definition: libmwaw_internal.hxx:677
MWAWBox2i
MWAWBox2< int > MWAWBox2i
MWAWBox2 of int.
Definition: libmwaw_internal.hxx:1132
MWAWNote::m_type
Type m_type
the note type
Definition: libmwaw_internal.hxx:414
MWAWVec2::add
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition: libmwaw_internal.hxx:655
MWAWBox2::operator>
bool operator>(MWAWBox2< T > const &mat) const
operator>
Definition: libmwaw_internal.hxx:1110
libmwaw::Right
Definition: libmwaw_internal.hxx:166
MWAWVec2::operator[]
T & operator[](int c)
operator[]
Definition: libmwaw_internal.hxx:631
MWAWBox2::min
MWAWVec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:980
MWAWVec3
small class which defines a vector with 3 elements
Definition: libmwaw_internal.hxx:790
MWAWVariable::isSet
bool isSet() const
return true if the variable is set
Definition: libmwaw_internal.hxx:586
libmwaw
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition: libmwaw_internal.cxx:50
MWAWBorder::Type
Type
the line repetition
Definition: libmwaw_internal.hxx:318
MWAWVec2::cmp
int cmp(MWAWVec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libmwaw_internal.hxx:720
libmwaw::WritingRightTop
Definition: libmwaw_internal.hxx:175
MWAWTransformation::operator[]
MWAWVec3f const & operator[](int c) const
the two extremum points which defined the box
Definition: libmwaw_internal.hxx:1160
MWAWColor::colorFromCMYK
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
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:182
libmwaw::DOC_CHART_ZONE
Definition: libmwaw_internal.hxx:178
libmwaw::WrongPasswordException
Definition: libmwaw_internal.hxx:149
MWAWSubDocumentPtr
shared_ptr< MWAWSubDocument > MWAWSubDocumentPtr
a smart pointer of MWAWSubDocument
Definition: libmwaw_internal.hxx:517
MWAWVec3::operator-
friend MWAWVec3< T > operator-(MWAWVec3< T > const &p1, MWAWVec3< T > const &p2)
operator-
Definition: libmwaw_internal.hxx:892
MWAWField::MWAWField
MWAWField(Type type)
basic constructor
Definition: libmwaw_internal.hxx:374
MWAWVec3::operator[]
T & operator[](int c)
operator[]
Definition: libmwaw_internal.hxx:828
libmwaw::Left
Definition: libmwaw_internal.hxx:166
MWAWTransformation::operator<=
bool operator<=(MWAWTransformation const &mat) const
operator<=
Definition: libmwaw_internal.hxx:1231
libmwaw::WritingInherited
Definition: libmwaw_internal.hxx:175
MWAWNote::m_label
librevenge::RVNGString m_label
the note label
Definition: libmwaw_internal.hxx:416
MWAWBorder::Style
Style
the line style
Definition: libmwaw_internal.hxx:316
libmwaw::UPPERCASE
Definition: libmwaw_internal.hxx:170
MWAWVec2::x
T x() const
first element
Definition: libmwaw_internal.hxx:615
MWAWTransformation::operator*
MWAWTransformation operator*(MWAWTransformation const &mat) const
operator* for transform
Definition: libmwaw_internal.hxx:1192
MWAWInputStream
Internal class used to read the file stream Internal class used to read the file stream, this class adds some usefull functions to the basic librevenge::RVNGInputStream:
Definition: MWAWInputStream.hxx:53
MWAWNote::Type
Type
enum to define note type
Definition: libmwaw_internal.hxx:408
MWAWLink::MWAWLink
MWAWLink()
basic constructor
Definition: libmwaw_internal.hxx:394
MWAWTransformation::scale
static MWAWTransformation scale(MWAWVec2f const &trans)
returns a scaling transformation
Definition: libmwaw_internal.hxx:1256
MWAWVec2::m_y
T m_y
second element
Definition: libmwaw_internal.hxx:775
MWAWVec3::PosSizeLt::operator()
bool operator()(MWAWVec3< T > const &s1, MWAWVec3< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:942
MWAWBorder::m_widthsList
std::vector< double > m_widthsList
the different length used for each line/sep (if defined)
Definition: libmwaw_internal.hxx:361
libmwaw::rotatePointAroundCenter
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
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:43
MWAWBorder
a border
Definition: libmwaw_internal.hxx:314
MWAWBox2
small class which defines a 2D Box
Definition: libmwaw_internal.hxx:967
libmwaw::WritingLeftBottom
Definition: libmwaw_internal.hxx:175
MWAWVariable::operator=
MWAWVariable & operator=(T const &val)
set a value
Definition: libmwaw_internal.hxx:544
MWAWBox2::min
MWAWVec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:990
MWAWVec3::m_val
T m_val[3]
the values
Definition: libmwaw_internal.hxx:954
MWAWParserState
a class to define the parser state
Definition: MWAWParser.hxx:49
MWAWRSRCParserPtr
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:513
MWAWVariable::m_set
bool m_set
a flag to know if the variable is set or not
Definition: libmwaw_internal.hxx:599
libmwaw::DOC_TABLE
Definition: libmwaw_internal.hxx:178
MWAWVec3::operator==
bool operator==(MWAWVec3< T > const &p) const
comparison==
Definition: libmwaw_internal.hxx:906
MWAWVec2::setX
void setX(T xx)
resets the first element
Definition: libmwaw_internal.hxx:644
MWAWEmbeddedObject::MWAWEmbeddedObject
MWAWEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
constructor
Definition: libmwaw_internal.hxx:431
MWAWBox2::operator>=
bool operator>=(MWAWBox2< T > const &mat) const
operator>=
Definition: libmwaw_internal.hxx:1115
libmwaw::GenericException
Definition: libmwaw_internal.hxx:145
MWAWSpreadsheetListener
This class contents the main functions needed to create a spreadsheet processing Document.
Definition: MWAWSpreadsheetListener.hxx:65
MWAWField::m_type
Type m_type
the type
Definition: libmwaw_internal.hxx:382
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:785
MWAWSpreadsheetListenerPtr
shared_ptr< MWAWSpreadsheetListener > MWAWSpreadsheetListenerPtr
a smart pointer of MWAWSpreadsheetListener
Definition: libmwaw_internal.hxx:515
libmwaw::BULLET
Definition: libmwaw_internal.hxx:170
MWAWColor::operator==
bool operator==(MWAWColor const &c) const
operator==
Definition: libmwaw_internal.hxx:275
MWAWVariable::operator=
MWAWVariable & operator=(MWAWVariable const &orig)
copy operator
Definition: libmwaw_internal.hxx:535
MWAWVec3f
MWAWVec3< float > MWAWVec3f
MWAWVec3 of float.
Definition: libmwaw_internal.hxx:962
MWAWVec2::operator+=
MWAWVec2< T > & operator+=(MWAWVec2< T > const &p)
operator+=
Definition: libmwaw_internal.hxx:662
MWAWBox2::MWAWBox2
MWAWBox2(MWAWBox2< U > const &p)
generic constructor
Definition: libmwaw_internal.hxx:975
MWAWVec2b
MWAWVec2< bool > MWAWVec2b
MWAWVec2 of bool.
Definition: libmwaw_internal.hxx:779
libmwaw::LOWERCASE
Definition: libmwaw_internal.hxx:170
MWAWColor::operator>
bool operator>(MWAWColor const &c) const
operator>
Definition: libmwaw_internal.hxx:295
MWAWVec3::cmp
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
MWAWBox2::operator!=
bool operator!=(MWAWBox2< T > const &mat) const
operator!=
Definition: libmwaw_internal.hxx:1095
MWAWSubDocument
abstract class used to store a subdocument (with a comparison function)
Definition: MWAWSubDocument.hxx:41
MWAWVec2::operator==
bool operator==(MWAWVec2< T > const &p) const
comparison==
Definition: libmwaw_internal.hxx:705
MWAWTransformation::m_data
std::pair< MWAWVec3f, MWAWVec3f > m_data
the data
Definition: libmwaw_internal.hxx:1273
MWAWListManager
a manager which manages the lists, keeps the different kind of lists, to assure the unicity of each l...
Definition: MWAWList.hxx:197
libmwaw::BottomBit
Definition: libmwaw_internal.hxx:168
MWAWVec3::PosSizeLt
internal struct used to create sorted map, sorted by X, Y, Z
Definition: libmwaw_internal.hxx:940
MWAWColor::value
uint32_t value() const
return the rgba value
Definition: libmwaw_internal.hxx:240
MWAWEmbeddedObject::m_typeList
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition: libmwaw_internal.hxx:467
MWAWVec3::setX
void setX(T xx)
resets the first element
Definition: libmwaw_internal.hxx:842
libmwaw::ParseException
Definition: libmwaw_internal.hxx:141
MWAWColor::MWAWColor
MWAWColor(uint32_t argb=0)
constructor
Definition: libmwaw_internal.hxx:184
MWAWEmbeddedObject
small class use to define a embedded object
Definition: libmwaw_internal.hxx:425
MWAWBox2::resizeFromCenter
void resizeFromCenter(MWAWVec2< T > const &sz)
resize the box keeping the center
Definition: libmwaw_internal.hxx:1047
LIBMWAW_ATTRIBUTE_PRINTF
#define LIBMWAW_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libmwaw_internal.hxx:116
libmwaw::FileException
Definition: libmwaw_internal.hxx:137
libmwaw::DOC_SHEET
Definition: libmwaw_internal.hxx:178
libmwaw::WritingLeftTop
Definition: libmwaw_internal.hxx:175
MWAWColor::getGreen
unsigned char getGreen() const
returns the green value
Definition: libmwaw_internal.hxx:260
MWAWBox2::operator[]
MWAWVec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition: libmwaw_internal.hxx:1002
MWAWSection
a class which stores section properties
Definition: MWAWSection.hxx:45
MWAWBox2::getUnion
MWAWBox2< T > getUnion(MWAWBox2< T > const &box) const
returns the union between this and box
Definition: libmwaw_internal.hxx:1070
MWAWVec3::MWAWVec3
MWAWVec3(MWAWVec3< U > const &p)
generic copy constructor
Definition: libmwaw_internal.hxx:801
MWAWColor::operator>=
bool operator>=(MWAWColor const &c) const
operator>=
Definition: libmwaw_internal.hxx:300
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:503
MWAWEmbeddedObject::MWAWEmbeddedObject
MWAWEmbeddedObject()
empty constructor
Definition: libmwaw_internal.hxx:427
MWAWBox2::MWAWBox2
MWAWBox2(MWAWVec2< T > minPt=MWAWVec2< T >(), MWAWVec2< T > maxPt=MWAWVec2< T >())
constructor
Definition: libmwaw_internal.hxx:971
MWAWVec2::operator+
friend MWAWVec2< T > operator+(MWAWVec2< T > const &p1, MWAWVec2< T > const &p2)
operator+
Definition: libmwaw_internal.hxx:685
MWAWColor::operator!=
bool operator!=(MWAWColor const &c) const
operator!=
Definition: libmwaw_internal.hxx:280
libmwaw::writingModeToString
std::string writingModeToString(WritingMode mode)
a function to convert a writing mode in string lt-rb, ...
Definition: libmwaw_internal.cxx:183
libmwaw::HMiddleBit
Definition: libmwaw_internal.hxx:168
MWAWBorder::m_style
Style m_style
the border style
Definition: libmwaw_internal.hxx:350
MWAWVec3::operator+
friend MWAWVec3< T > operator+(MWAWVec3< T > const &p1, MWAWVec3< T > const &p2)
operator+
Definition: libmwaw_internal.hxx:886
MWAWFontConverter
a namespace used to convert Mac font characters in unicode
Definition: MWAWFontConverter.hxx:62
MWAWGraphicListenerPtr
shared_ptr< MWAWGraphicListener > MWAWGraphicListenerPtr
a smart pointer of MWAWGraphicListener
Definition: libmwaw_internal.hxx:501
MWAWVec3::setZ
void setZ(T zz)
resets the third element
Definition: libmwaw_internal.hxx:852
MWAWVec3uc
MWAWVec3< unsigned char > MWAWVec3uc
MWAWVec3 of unsigned char.
Definition: libmwaw_internal.hxx:958
MWAWBox2::max
MWAWVec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:995
MWAWVec3::operator[]
T operator[](int c) const
operator[]
Definition: libmwaw_internal.hxx:822
MWAWBox2::max
MWAWVec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:985
MWAW_shared_ptr_noop_deleter
an noop deleter used to transform a libwpd pointer in a false shared_ptr
Definition: libmwaw_internal.hxx:109
libmwaw::RightBit
Definition: libmwaw_internal.hxx:168
MWAWGraphicShape
a structure used to define a picture shape
Definition: MWAWGraphicShape.hxx:45
MWAWVec3::MWAWVec3
MWAWVec3(T xx=0, T yy=0, T zz=0)
constructor
Definition: libmwaw_internal.hxx:794
MWAWFontConverterPtr
shared_ptr< MWAWFontConverter > MWAWFontConverterPtr
a smart pointer of MWAWFontConverter
Definition: libmwaw_internal.hxx:495
libmwaw::ARABIC
Definition: libmwaw_internal.hxx:170
MWAWVec2::PosSizeLtY::operator()
bool operator()(MWAWVec2< T > const &s1, MWAWVec2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:765
MWAWBox2::m_data
std::pair< MWAWVec2< T >, MWAWVec2< T > > m_data
the data
Definition: libmwaw_internal.hxx:1128
MWAWVec2::PosSizeLtY
internal struct used to create sorted map, sorted by Y
Definition: libmwaw_internal.hxx:763
MWAWBox2f
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1134
MWAWColor::getBlue
unsigned char getBlue() const
returns the green value
Definition: libmwaw_internal.hxx:250
MWAWVec2::operator!=
bool operator!=(MWAWVec2< T > const &p) const
comparison!=
Definition: libmwaw_internal.hxx:710
MWAWBox2::getIntersection
MWAWBox2< T > getIntersection(MWAWBox2< T > const &box) const
returns the intersection between this and box
Definition: libmwaw_internal.hxx:1080
MWAWEmbeddedObject::isEmpty
bool isEmpty() const
return true if the picture contains no data
Definition: libmwaw_internal.hxx:439
MWAWParagraph
class to store the paragraph properties
Definition: MWAWParagraph.hxx:81
MWAWLink::m_HRef
std::string m_HRef
the href field
Definition: libmwaw_internal.hxx:402
MWAWBox2::setMax
void setMax(MWAWVec2< T > const &y)
resets the maximum point
Definition: libmwaw_internal.hxx:1031
MWAWTransformation::isIdentity
bool isIdentity() const
returns true if the matrix is an identity matrix
Definition: libmwaw_internal.hxx:1148
MWAWVariable::setSet
void setSet(bool newVal)
define if the variable is set
Definition: libmwaw_internal.hxx:591
MWAWField
a field
Definition: libmwaw_internal.hxx:369
MWAWColor::colorFromHSL
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
MWAWVec2< bool >::MapY
std::map< MWAWVec2< bool >, bool, struct PosSizeLtY > MapY
map of MWAWVec2
Definition: libmwaw_internal.hxx:773
MWAWBorder::operator==
bool operator==(MWAWBorder const &orig) const
operator==
Definition: libmwaw_internal.hxx:332
MWAWField::m_DTFormat
std::string m_DTFormat
the date/time format using strftime format if defined
Definition: libmwaw_internal.hxx:386
MWAWVariable::MWAWVariable
MWAWVariable(MWAWVariable const &orig)
copy constructor
Definition: libmwaw_internal.hxx:533
MWAWColor::getAlpha
unsigned char getAlpha() const
returns the alpha value
Definition: libmwaw_internal.hxx:245
libmwaw::DOC_HEADER_FOOTER
Definition: libmwaw_internal.hxx:178
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:509
libmwaw::readU8
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libmwaw_internal.cxx:52
MWAWBorder::m_extra
std::string m_extra
extra data ( if needed)
Definition: libmwaw_internal.hxx:365
libmwaw::WritingMode
WritingMode
the different writing mode
Definition: libmwaw_internal.hxx:175
MWAWVec2::cmpY
int cmpY(MWAWVec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:729
MWAWNote
a note
Definition: libmwaw_internal.hxx:406
MWAWParser
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:99
MWAWVariable::operator->
T const * operator->() const
operator*
Definition: libmwaw_internal.hxx:559
MWAWPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
MWAWField::Type
Type
Defines some basic type for field.
Definition: libmwaw_internal.hxx:371
MWAWListener
This class contains a virtual interface to all listener.
Definition: MWAWListener.hxx:49
MWAWVec2l
MWAWVec2< long > MWAWVec2l
MWAWVec2 of long.
Definition: libmwaw_internal.hxx:783
MWAWTransformation::operator>=
bool operator>=(MWAWTransformation const &mat) const
operator>=
Definition: libmwaw_internal.hxx:1241
MWAWBorder::MWAWBorder
MWAWBorder()
constructor
Definition: libmwaw_internal.hxx:321
MWAWEntry
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
MWAWTransformation::operator*=
MWAWTransformation & operator*=(MWAWTransformation const &mat)
operator*=
Definition: libmwaw_internal.hxx:1209
MWAWVec2::operator[]
T operator[](int c) const
operator[]
Definition: libmwaw_internal.hxx:625
MWAW_shared_ptr_noop_deleter::operator()
void operator()(T *)
Definition: libmwaw_internal.hxx:110
MWAWTransformation::operator*
MWAWBox2f operator*(MWAWBox2f const &box) const
operator* for box2f
Definition: libmwaw_internal.hxx:1186
MWAWVec2::m_x
T m_x
first element
Definition: libmwaw_internal.hxx:775
MWAWTransformation::operator==
bool operator==(MWAWTransformation const &mat) const
operator==
Definition: libmwaw_internal.hxx:1216
MWAWBox2::scale
void scale(U factor)
scales all points of the box by factor
Definition: libmwaw_internal.hxx:1056
MWAWBox2l
MWAWBox2< long > MWAWBox2l
MWAWBox2 of long.
Definition: libmwaw_internal.hxx:1136
libmwaw::WritingRightBottom
Definition: libmwaw_internal.hxx:175
MWAWList
a small structure used to store the informations about a list
Definition: MWAWList.hxx:107
MWAWTransformation::operator<
bool operator<(MWAWTransformation const &mat) const
operator<
Definition: libmwaw_internal.hxx:1226
MWAWRSRCParser
the main class to read a Mac resource fork
Definition: MWAWRSRCParser.hxx:46
libmwaw::LeftBit
Definition: libmwaw_internal.hxx:168
MWAWBorder::m_color
MWAWColor m_color
the border color
Definition: libmwaw_internal.hxx:363
MWAWColor::operator<=
bool operator<=(MWAWColor const &c) const
operator<=
Definition: libmwaw_internal.hxx:290
MWAWVec3::operator+=
MWAWVec3< T > & operator+=(MWAWVec3< T > const &p)
operator+=
Definition: libmwaw_internal.hxx:866
MWAWField::m_numberingType
libmwaw::NumberingType m_numberingType
the number type ( for number field )
Definition: libmwaw_internal.hxx:384
libmwaw::DOC_COMMENT_ANNOTATION
Definition: libmwaw_internal.hxx:178
MWAWVariable::MWAWVariable
MWAWVariable()
constructor
Definition: libmwaw_internal.hxx:529
MWAWGraphicEncoder
main class used to define store librevenge::RVNGDrawingInterface lists of command in a librevenge::RV...
Definition: MWAWGraphicEncoder.hxx:55
MWAWVec2::operator*
friend MWAWVec2< T > operator*(U scale, MWAWVec2< T > const &p1)
generic operator*
Definition: libmwaw_internal.hxx:698
MWAWVec2::PosSizeLtX
internal struct used to create sorted map, sorted by X
Definition: libmwaw_internal.hxx:748
MWAWVariable
a generic variable template: value + flag to know if the variable is set
Definition: libmwaw_internal.hxx:527
MWAWBorder::operator!=
bool operator!=(MWAWBorder const &orig) const
operator!=
Definition: libmwaw_internal.hxx:337
libmwaw::HMiddle
Definition: libmwaw_internal.hxx:166
MWAWBox2::resizeFromMin
void resizeFromMin(MWAWVec2< T > const &sz)
resize the box keeping the minimum
Definition: libmwaw_internal.hxx:1037
MWAWTextListenerPtr
shared_ptr< MWAWTextListener > MWAWTextListenerPtr
a smart pointer of MWAWTextListener
Definition: libmwaw_internal.hxx:519
MWAWColor::m_value
uint32_t m_value
the argb color
Definition: libmwaw_internal.hxx:310
MWAWVariable::operator*
T const & operator*() const
operator*
Definition: libmwaw_internal.hxx:570
MWAWTransformation
a transformation which stored the first row of a 3x3 perspective matrix
Definition: libmwaw_internal.hxx:1139
libmwaw::VersionException
Definition: libmwaw_internal.hxx:133
MWAWVec2
small class which defines a vector with 2 elements
Definition: libmwaw_internal.hxx:606
MWAWTransformation::checkIdentity
void checkIdentity() const
check if a matrix is the identity matrix
Definition: libmwaw_internal.hxx:1153
MWAWListManagerPtr
shared_ptr< MWAWListManager > MWAWListManagerPtr
a smart pointer of MWAWListManager
Definition: libmwaw_internal.hxx:507
MWAWVec3::setY
void setY(T yy)
resets the second element
Definition: libmwaw_internal.hxx:847
MWAWVec2::PosSizeLtX::operator()
bool operator()(MWAWVec2< T > const &s1, MWAWVec2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:750
MWAWBox2::setMin
void setMin(MWAWVec2< T > const &x)
resets the minimum point
Definition: libmwaw_internal.hxx:1026