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
120 #define MWAW_FALLTHROUGH
121 #if defined(__clang__)
122 # if defined(__has_cpp_attribute) && __has_cpp_attribute(clang::fallthrough)
123 # undef MWAW_FALLTHROUGH
124 # define MWAW_FALLTHROUGH [[clang::fallthrough]]
125 # endif
126 #elif defined(__GNUC__)
127 # if __GNUC__>=7
128 # undef MWAW_FALLTHROUGH
129 # define MWAW_FALLTHROUGH __attribute__ ((fallthrough))
130 # endif
131 #endif
132
133 /* ---------- debug --------------- */
134 #ifdef DEBUG
135 namespace libmwaw
136 {
137 void printDebugMsg(const char *format, ...) LIBMWAW_ATTRIBUTE_PRINTF(1,2);
138 }
139 #define MWAW_DEBUG_MSG(M) libmwaw::printDebugMsg M
140 #else
141 #define MWAW_DEBUG_MSG(M)
142 #endif
143
144 namespace libmwaw
145 {
146 // Various exceptions:
147 class VersionException
148 {
149 };
150
151 class FileException
152 {
153 };
154
155 class ParseException
156 {
157 };
158
159 class GenericException
160 {
161 };
162
163 class WrongPasswordException
164 {
165 };
166 }
167
168 /* ---------- input ----------------- */
169 namespace libmwaw
170 {
171 uint8_t readU8(librevenge::RVNGInputStream *input);
173 void appendUnicode(uint32_t val, librevenge::RVNGString &buffer);
174 }
175
176 /* ---------- small enum/class ------------- */
177 namespace libmwaw
178 {
180 enum Position { Left = 0, Right = 1, Top = 2, Bottom = 3, HMiddle = 4, VMiddle = 5 };
182 enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08, HMiddleBit = 0x10, VMiddleBit = 0x20 };
183
184 enum NumberingType { NONE, BULLET, ARABIC, LOWERCASE, UPPERCASE, LOWERCASE_ROMAN, UPPERCASE_ROMAN };
185 std::string numberingTypeToString(NumberingType type);
186 std::string numberingValueToString(NumberingType type, int value);
187
189 enum WritingMode { WritingLeftTop, WritingLeftBottom, WritingRightTop, WritingRightBottom, WritingInherited };
191 std::string writingModeToString(WritingMode mode);
192 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 };
193 }
194
196 struct MWAWColor {
198 explicit MWAWColor(uint32_t argb=0) : m_value(argb)
199 {
200 }
202 MWAWColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) :
203 m_value(uint32_t((a<<24)+(r<<16)+(g<<8)+b))
204 {
205 }
207 MWAWColor &operator=(uint32_t argb)
208 {
209 m_value = argb;
210 return *this;
211 }
213 static MWAWColor colorFromCMYK(unsigned char c, unsigned char m, unsigned char y, unsigned char k)
214 {
215 double w=1.-static_cast<double>(k)/255.;
216 return MWAWColor
217 (static_cast<unsigned char>(255 * (1-static_cast<double>(c)/255) * w),
218 static_cast<unsigned char>(255 * (1-static_cast<double>(m)/255) * w),
219 static_cast<unsigned char>(255 * (1-static_cast<double>(y)/255) * w)
220 );
221 }
223 static MWAWColor colorFromHSL(unsigned char H, unsigned char S, unsigned char L)
224 {
225 double c=(1-((L>=128) ? (2*static_cast<double>(L)-255) : (255-2*static_cast<double>(L)))/255)*
226 static_cast<double>(S)/255;
227 double tmp=std::fmod((static_cast<double>(H)*6/255),2)-1;
228 double x=c*(1-(tmp>0 ? tmp : -tmp));
229 unsigned char C=static_cast<unsigned char>(255*c);
230 unsigned char M=static_cast<unsigned char>(static_cast<double>(L)-255*c/2);
231 unsigned char X=static_cast<unsigned char>(255*x);
232 if (H<=42) return MWAWColor(static_cast<unsigned char>(M+C),static_cast<unsigned char>(M+X),static_cast<unsigned char>(M));
233 if (H<=85) return MWAWColor(static_cast<unsigned char>(M+X),static_cast<unsigned char>(M+C),static_cast<unsigned char>(M));
234 if (H<=127) return MWAWColor(static_cast<unsigned char>(M),static_cast<unsigned char>(M+C),static_cast<unsigned char>(M+X));
235 if (H<=170) return MWAWColor(static_cast<unsigned char>(M),static_cast<unsigned char>(M+X),static_cast<unsigned char>(M+C));
236 if (H<=212) return MWAWColor(static_cast<unsigned char>(M+X),static_cast<unsigned char>(M),static_cast<unsigned char>(M+C));
237 return MWAWColor(static_cast<unsigned char>(M+C),static_cast<unsigned char>(M),static_cast<unsigned char>(M+X));
238 }
240 static MWAWColor black()
241 {
242 return MWAWColor(0,0,0);
243 }
245 static MWAWColor white()
246 {
247 return MWAWColor(255,255,255);
248 }
249
251 static MWAWColor barycenter(float alpha, MWAWColor const &colA,
252 float beta, MWAWColor const &colB);
254 uint32_t value() const
255 {
256 return m_value;
257 }
259 unsigned char getAlpha() const
260 {
261 return static_cast<unsigned char>((m_value>>24)&0xFF);
262 }
264 unsigned char getBlue() const
265 {
266 return static_cast<unsigned char>(m_value&0xFF);
267 }
269 unsigned char getRed() const
270 {
271 return static_cast<unsigned char>((m_value>>16)&0xFF);
272 }
274 unsigned char getGreen() const
275 {
276 return static_cast<unsigned char>((m_value>>8)&0xFF);
277 }
279 bool isBlack() const
280 {
281 return (m_value&0xFFFFFF)==0;
282 }
284 bool isWhite() const
285 {
286 return (m_value&0xFFFFFF)==0xFFFFFF;
287 }
289 bool operator==(MWAWColor const &c) const
290 {
291 return (c.m_value&0xFFFFFF)==(m_value&0xFFFFFF);
292 }
294 bool operator!=(MWAWColor const &c) const
295 {
296 return !operator==(c);
297 }
299 bool operator<(MWAWColor const &c) const
300 {
301 return (c.m_value&0xFFFFFF)<(m_value&0xFFFFFF);
302 }
304 bool operator<=(MWAWColor const &c) const
305 {
306 return (c.m_value&0xFFFFFF)<=(m_value&0xFFFFFF);
307 }
309 bool operator>(MWAWColor const &c) const
310 {
311 return !operator<=(c);
312 }
314 bool operator>=(MWAWColor const &c) const
315 {
316 return !operator<(c);
317 }
319 friend std::ostream &operator<< (std::ostream &o, MWAWColor const &c);
321 std::string str() const;
322 protected:
324 uint32_t m_value;
325 };
326
328 struct MWAWBorder {
330 enum Style { None, Simple, Dot, LargeDot, Dash };
332 enum Type { Single, Double, Triple };
333
335 MWAWBorder() : m_style(Simple), m_type(Single), m_width(1), m_widthsList(), m_color(MWAWColor::black()), m_extra("") { }
339 bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const;
341 bool isEmpty() const
342 {
343 return m_style==None || m_width <= 0;
344 }
346 bool operator==(MWAWBorder const &orig) const
347 {
348 return !operator!=(orig);
349 }
351 bool operator!=(MWAWBorder const &orig) const
352 {
353 return m_style != orig.m_style || m_type != orig.m_type ||
354 m_width < orig.m_width || m_width > orig.m_width || m_color != orig.m_color;
355 }
357 int compare(MWAWBorder const &orig) const;
358
360 friend std::ostream &operator<< (std::ostream &o, MWAWBorder const &border);
362 friend std::ostream &operator<< (std::ostream &o, MWAWBorder::Style const &style);
364 Style m_style;
365
366 // multiple borders
367
369 Type m_type;
371 double m_width;
375 std::vector<double> m_widthsList;
377 MWAWColor m_color;
379 std::string m_extra;
380 };
381
383 struct MWAWField {
385 enum Type { None, PageCount, PageNumber, Date, Time, Title, Database };
386
388 explicit MWAWField(Type type) : m_type(type), m_numberingType(libmwaw::ARABIC), m_DTFormat(""), m_data("")
389 {
390 }
392 bool addTo(librevenge::RVNGPropertyList &propList) const;
394 librevenge::RVNGString getString() const;
396 Type m_type;
398 libmwaw::NumberingType m_numberingType;
400 std::string m_DTFormat;
402 std::string m_data;
403 };
404
406 struct MWAWLink {
408 MWAWLink() : m_HRef("")
409 {
410 }
411
413 bool addTo(librevenge::RVNGPropertyList &propList) const;
414
416 std::string m_HRef;
417 };
418
420 struct MWAWNote {
422 enum Type { FootNote, EndNote };
424 explicit MWAWNote(Type type) : m_type(type), m_label(""), m_number(-1)
425 {
426 }
428 Type m_type;
430 librevenge::RVNGString m_label;
432 int m_number;
433 };
434
439 struct MWAWEmbeddedObject {
441 MWAWEmbeddedObject() : m_dataList(), m_typeList()
442 {
443 }
445 MWAWEmbeddedObject(librevenge::RVNGBinaryData const &binaryData,
446 std::string type="image/pict") : m_dataList(), m_typeList()
447 {
448 add(binaryData, type);
449 }
451 ~MWAWEmbeddedObject();
453 bool isEmpty() const
454 {
455 for (size_t i=0; i<m_dataList.size(); ++i) {
456 if (!m_dataList[i].empty())
457 return false;
458 }
459 return true;
460 }
462 void add(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
463 {
464 size_t pos=m_dataList.size();
465 if (pos<m_typeList.size()) pos=m_typeList.size();
466 m_dataList.resize(pos+1);
467 m_dataList[pos]=binaryData;
468 m_typeList.resize(pos+1);
469 m_typeList[pos]=type;
470 }
472 bool addTo(librevenge::RVNGPropertyList &propList) const;
474 friend std::ostream &operator<<(std::ostream &o, MWAWEmbeddedObject const &pict);
476 int cmp(MWAWEmbeddedObject const &pict) const;
477
479 std::vector<librevenge::RVNGBinaryData> m_dataList;
481 std::vector<std::string> m_typeList;
482 };
483
484 // forward declarations of basic classes and smart pointers
485 class MWAWEntry;
486 class MWAWFont;
487 class MWAWGraphicEncoder;
488 class MWAWGraphicShape;
489 class MWAWGraphicStyle;
490 class MWAWHeader;
491 class MWAWList;
492 class MWAWPageSpan;
493 class MWAWParagraph;
494 class MWAWParser;
495 class MWAWPosition;
496 class MWAWSection;
497
498 class MWAWFontConverter;
499 class MWAWFontManager;
500 class MWAWGraphicListener;
501 class MWAWInputStream;
502 class MWAWListener;
503 class MWAWListManager;
504 class MWAWParserState;
505 class MWAWPresentationListener;
506 class MWAWRSRCParser;
507 class MWAWSpreadsheetListener;
508 class MWAWSubDocument;
509 class MWAWTextListener;
511 typedef shared_ptr<MWAWFontConverter> MWAWFontConverterPtr;
513 typedef shared_ptr<MWAWFontManager> MWAWFontManagerPtr;
515 typedef shared_ptr<MWAWGraphicListener> MWAWGraphicListenerPtr;
517 typedef shared_ptr<MWAWInputStream> MWAWInputStreamPtr;
519 typedef shared_ptr<MWAWListener> MWAWListenerPtr;
521 typedef shared_ptr<MWAWListManager> MWAWListManagerPtr;
523 typedef shared_ptr<MWAWParserState> MWAWParserStatePtr;
525 typedef shared_ptr<MWAWPresentationListener> MWAWPresentationListenerPtr;
527 typedef shared_ptr<MWAWRSRCParser> MWAWRSRCParserPtr;
529 typedef shared_ptr<MWAWSpreadsheetListener> MWAWSpreadsheetListenerPtr;
531 typedef shared_ptr<MWAWSubDocument> MWAWSubDocumentPtr;
533 typedef shared_ptr<MWAWTextListener> MWAWTextListenerPtr;
534
541 template <class T> struct MWAWVariable {
543 MWAWVariable() : m_data(), m_set(false) {}
545 explicit MWAWVariable(T const &def) : m_data(def), m_set(false) {}
547 MWAWVariable(MWAWVariable const &orig) : m_data(orig.m_data), m_set(orig.m_set) {}
549 MWAWVariable &operator=(MWAWVariable const &orig)
550 {
551 if (this != &orig) {
552 m_data = orig.m_data;
553 m_set = orig.m_set;
554 }
555 return *this;
556 }
558 MWAWVariable &operator=(T const &val)
559 {
560 m_data = val;
561 m_set = true;
562 return *this;
563 }
565 void insert(MWAWVariable const &orig)
566 {
567 if (orig.m_set) {
568 m_data = orig.m_data;
569 m_set = orig.m_set;
570 }
571 }
573 T const *operator->() const
574 {
575 return &m_data;
576 }
578 T *operator->()
579 {
580 m_set = true;
581 return &m_data;
582 }
584 T const &operator*() const
585 {
586 return m_data;
587 }
589 T &operator*()
590 {
591 m_set = true;
592 return m_data;
593 }
595 T const &get() const
596 {
597 return m_data;
598 }
600 bool isSet() const
601 {
602 return m_set;
603 }
605 void setSet(bool newVal)
606 {
607 m_set=newVal;
608 }
609 protected:
611 T m_data;
613 bool m_set;
614 };
615
616 /* ---------- vec2/box2f ------------- */
620 template <class T> class MWAWVec2
621 {
622 public:
624 explicit MWAWVec2(T xx=0,T yy=0) : m_x(xx), m_y(yy) { }
626 template <class U> MWAWVec2(MWAWVec2<U> const &p) : m_x(T(p.x())), m_y(T(p.y())) {}
627
629 T x() const
630 {
631 return m_x;
632 }
634 T y() const
635 {
636 return m_y;
637 }
639 T operator[](int c) const
640 {
641 if (c<0 || c>1) throw libmwaw::GenericException();
642 return (c==0) ? m_x : m_y;
643 }
645 T &operator[](int c)
646 {
647 if (c<0 || c>1) throw libmwaw::GenericException();
648 return (c==0) ? m_x : m_y;
649 }
650
652 void set(T xx, T yy)
653 {
654 m_x = xx;
655 m_y = yy;
656 }
658 void setX(T xx)
659 {
660 m_x = xx;
661 }
663 void setY(T yy)
664 {
665 m_y = yy;
666 }
667
669 void add(T dx, T dy)
670 {
671 m_x += dx;
672 m_y += dy;
673 }
674
676 MWAWVec2<T> &operator+=(MWAWVec2<T> const &p)
677 {
678 m_x += p.m_x;
679 m_y += p.m_y;
680 return *this;
681 }
683 MWAWVec2<T> &operator-=(MWAWVec2<T> const &p)
684 {
685 m_x -= p.m_x;
686 m_y -= p.m_y;
687 return *this;
688 }
690 template <class U>
691 MWAWVec2<T> &operator*=(U scale)
692 {
693 m_x = T(m_x*scale);
694 m_y = T(m_y*scale);
695 return *this;
696 }
697
699 friend MWAWVec2<T> operator+(MWAWVec2<T> const &p1, MWAWVec2<T> const &p2)
700 {
701 MWAWVec2<T> p(p1);
702 return p+=p2;
703 }
705 friend MWAWVec2<T> operator-(MWAWVec2<T> const &p1, MWAWVec2<T> const &p2)
706 {
707 MWAWVec2<T> p(p1);
708 return p-=p2;
709 }
711 template <class U>
712 friend MWAWVec2<T> operator*(U scale, MWAWVec2<T> const &p1)
713 {
714 MWAWVec2<T> p(p1);
715 return p *= scale;
716 }
717
719 bool operator==(MWAWVec2<T> const &p) const
720 {
721 return cmpY(p) == 0;
722 }
724 bool operator!=(MWAWVec2<T> const &p) const
725 {
726 return cmpY(p) != 0;
727 }
729 bool operator<(MWAWVec2<T> const &p) const
730 {
731 return cmpY(p) < 0;
732 }
734 int cmp(MWAWVec2<T> const &p) const
735 {
736 if (m_x < p.m_x) return -1;
737 if (m_x > p.m_x) return 1;
738 if (m_y < p.m_y) return -1;
739 if (m_y > p.m_y) return 1;
740 return 0;
741 }
743 int cmpY(MWAWVec2<T> const &p) const
744 {
745 if (m_y < p.m_y) return -1;
746 if (m_y > p.m_y) return 1;
747 if (m_x < p.m_x) return -1;
748 if (m_x > p.m_x) return 1;
749 return 0;
750 }
751
753 friend std::ostream &operator<< (std::ostream &o, MWAWVec2<T> const &f)
754 {
755 o << f.m_x << "x" << f.m_y;
756 return o;
757 }
758
762 struct PosSizeLtX {
764 bool operator()(MWAWVec2<T> const &s1, MWAWVec2<T> const &s2) const
765 {
766 return s1.cmp(s2) < 0;
767 }
768 };
772 typedef std::map<MWAWVec2<T>, T,struct PosSizeLtX> MapX;
773
777 struct PosSizeLtY {
779 bool operator()(MWAWVec2<T> const &s1, MWAWVec2<T> const &s2) const
780 {
781 return s1.cmpY(s2) < 0;
782 }
783 };
787 typedef std::map<MWAWVec2<T>, T,struct PosSizeLtY> MapY;
788 protected:
789 T m_x, m_y;
790 };
791
793 typedef MWAWVec2<bool> MWAWVec2b;
795 typedef MWAWVec2<int> MWAWVec2i;
797 typedef MWAWVec2<long> MWAWVec2l;
799 typedef MWAWVec2<float> MWAWVec2f;
800
804 template <class T> class MWAWVec3
805 {
806 public:
808 explicit MWAWVec3(T xx=0,T yy=0,T zz=0)
809 {
810 m_val[0] = xx;
811 m_val[1] = yy;
812 m_val[2] = zz;
813 }
815 template <class U> MWAWVec3(MWAWVec3<U> const &p)
816 {
817 for (int c = 0; c < 3; c++) m_val[c] = T(p[c]);
818 }
819
821 T x() const
822 {
823 return m_val[0];
824 }
826 T y() const
827 {
828 return m_val[1];
829 }
831 T z() const
832 {
833 return m_val[2];
834 }
836 T operator[](int c) const
837 {
838 if (c<0 || c>2) throw libmwaw::GenericException();
839 return m_val[c];
840 }
842 T &operator[](int c)
843 {
844 if (c<0 || c>2) throw libmwaw::GenericException();
845 return m_val[c];
846 }
847
849 void set(T xx, T yy, T zz)
850 {
851 m_val[0] = xx;
852 m_val[1] = yy;
853 m_val[2] = zz;
854 }
856 void setX(T xx)
857 {
858 m_val[0] = xx;
859 }
861 void setY(T yy)
862 {
863 m_val[1] = yy;
864 }
866 void setZ(T zz)
867 {
868 m_val[2] = zz;
869 }
870
872 void add(T dx, T dy, T dz)
873 {
874 m_val[0] += dx;
875 m_val[1] += dy;
876 m_val[2] += dz;
877 }
878
880 MWAWVec3<T> &operator+=(MWAWVec3<T> const &p)
881 {
882 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]);
883 return *this;
884 }
886 MWAWVec3<T> &operator-=(MWAWVec3<T> const &p)
887 {
888 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]-p.m_val[c]);
889 return *this;
890 }
892 template <class U>
893 MWAWVec3<T> &operator*=(U scale)
894 {
895 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]*scale);
896 return *this;
897 }
898
900 friend MWAWVec3<T> operator+(MWAWVec3<T> const &p1, MWAWVec3<T> const &p2)
901 {
902 MWAWVec3<T> p(p1);
903 return p+=p2;
904 }
906 friend MWAWVec3<T> operator-(MWAWVec3<T> const &p1, MWAWVec3<T> const &p2)
907 {
908 MWAWVec3<T> p(p1);
909 return p-=p2;
910 }
912 template <class U>
913 friend MWAWVec3<T> operator*(U scale, MWAWVec3<T> const &p1)
914 {
915 MWAWVec3<T> p(p1);
916 return p *= scale;
917 }
918
920 bool operator==(MWAWVec3<T> const &p) const
921 {
922 return cmp(p) == 0;
923 }
925 bool operator!=(MWAWVec3<T> const &p) const
926 {
927 return cmp(p) != 0;
928 }
930 bool operator<(MWAWVec3<T> const &p) const
931 {
932 return cmp(p) < 0;
933 }
935 int cmp(MWAWVec3<T> const &p) const
936 {
937 for (int c = 0; c < 3; c++) {
938 if (m_val[c]<p.m_val[c]) return -1;
939 if (m_val[c]>p.m_val[c]) return 1;
940 }
941 return 0;
942 }
943
945 friend std::ostream &operator<< (std::ostream &o, MWAWVec3<T> const &f)
946 {
947 o << f.m_val[0] << "x" << f.m_val[1] << "x" << f.m_val[2];
948 return o;
949 }
950
954 struct PosSizeLt {
956 bool operator()(MWAWVec3<T> const &s1, MWAWVec3<T> const &s2) const
957 {
958 return s1.cmp(s2) < 0;
959 }
960 };
964 typedef std::map<MWAWVec3<T>, T,struct PosSizeLt> Map;
965
966 protected:
968 T m_val[3];
969 };
970
972 typedef MWAWVec3<unsigned char> MWAWVec3uc;
974 typedef MWAWVec3<int> MWAWVec3i;
976 typedef MWAWVec3<float> MWAWVec3f;
977
981 template <class T> class MWAWBox2
982 {
983 public:
985 explicit MWAWBox2(MWAWVec2<T> minPt=MWAWVec2<T>(), MWAWVec2<T> maxPt=MWAWVec2<T>()) : m_data(minPt, maxPt)
986 {
987 }
989 template <class U> MWAWBox2(MWAWBox2<U> const &p) : m_data(p.min(), p.max())
990 {
991 }
992
994 MWAWVec2<T> const &min() const
995 {
996 return m_data.first;
997 }
999 MWAWVec2<T> const &max() const
1000 {
1001 return m_data.second;
1002 }
1004 MWAWVec2<T> &min()
1005 {
1006 return m_data.first;
1007 }
1009 MWAWVec2<T> &max()
1010 {
1011 return m_data.second;
1012 }
1016 MWAWVec2<T> const &operator[](int c) const
1017 {
1018 if (c<0 || c>1) throw libmwaw::GenericException();
1019 return c==0 ? m_data.first : m_data.second;
1020 }
1022 MWAWVec2<T> size() const
1023 {
1024 return m_data.second-m_data.first;
1025 }
1027 MWAWVec2<T> center() const
1028 {
1029 return MWAWVec2<T>((m_data.first.x()+m_data.second.x())/2,
1030 (m_data.first.y()+m_data.second.y())/2);
1031 }
1032
1034 void set(MWAWVec2<T> const &x, MWAWVec2<T> const &y)
1035 {
1036 m_data.first = x;
1037 m_data.second = y;
1038 }
1040 void setMin(MWAWVec2<T> const &x)
1041 {
1042 m_data.first = x;
1043 }
1045 void setMax(MWAWVec2<T> const &y)
1046 {
1047 m_data.second = y;
1048 }
1049
1051 void resizeFromMin(MWAWVec2<T> const &sz)
1052 {
1053 m_data.second = m_data.first+sz;
1054 }
1056 void resizeFromMax(MWAWVec2<T> const &sz)
1057 {
1058 m_data.first = m_data.second-sz;
1059 }
1061 void resizeFromCenter(MWAWVec2<T> const &sz)
1062 {
1063 MWAWVec2<T> centerPt = center();
1064 MWAWVec2<T> decal(sz.x()/2,sz.y()/2);
1065 m_data.first = centerPt - decal;
1066 m_data.second = centerPt + (sz - decal);
1067 }
1068
1070 template <class U> void scale(U factor)
1071 {
1072 m_data.first *= factor;
1073 m_data.second *= factor;
1074 }
1075
1077 void extend(T val)
1078 {
1079 m_data.first -= MWAWVec2<T>(val/2,val/2);
1080 m_data.second += MWAWVec2<T>(val-(val/2),val-(val/2));
1081 }
1082
1084 MWAWBox2<T> getUnion(MWAWBox2<T> const &box) const
1085 {
1086 MWAWBox2<T> res;
1087 res.m_data.first=MWAWVec2<T>(m_data.first[0]<box.m_data.first[0]?m_data.first[0] : box.m_data.first[0],
1088 m_data.first[1]<box.m_data.first[1]?m_data.first[1] : box.m_data.first[1]);
1089 res.m_data.second=MWAWVec2<T>(m_data.second[0]>box.m_data.second[0]?m_data.second[0] : box.m_data.second[0],
1090 m_data.second[1]>box.m_data.second[1]?m_data.second[1] : box.m_data.second[1]);
1091 return res;
1092 }
1094 MWAWBox2<T> getIntersection(MWAWBox2<T> const &box) const
1095 {
1096 MWAWBox2<T> res;
1097 res.m_data.first=MWAWVec2<T>(m_data.first[0]>box.m_data.first[0]?m_data.first[0] : box.m_data.first[0],
1098 m_data.first[1]>box.m_data.first[1]?m_data.first[1] : box.m_data.first[1]);
1099 res.m_data.second=MWAWVec2<T>(m_data.second[0]<box.m_data.second[0]?m_data.second[0] : box.m_data.second[0],
1100 m_data.second[1]<box.m_data.second[1]?m_data.second[1] : box.m_data.second[1]);
1101 return res;
1102 }
1104 bool operator==(MWAWBox2<T> const &mat) const
1105 {
1106 return m_data==mat.m_data;
1107 }
1109 bool operator!=(MWAWBox2<T> const &mat) const
1110 {
1111 return m_data!=mat.m_data;
1112 }
1114 bool operator<(MWAWBox2<T> const &mat) const
1115 {
1116 return m_data<mat.m_data;
1117 }
1119 bool operator<=(MWAWBox2<T> const &mat) const
1120 {
1121 return m_data<=mat.m_data;
1122 }
1124 bool operator>(MWAWBox2<T> const &mat) const
1125 {
1126 return m_data>mat.m_data;
1127 }
1129 bool operator>=(MWAWBox2<T> const &mat) const
1130 {
1131 return m_data>=mat.m_data;
1132 }
1134 friend std::ostream &operator<< (std::ostream &o, MWAWBox2<T> const &f)
1135 {
1136 o << "(" << f.min() << "<->" << f.max() << ")";
1137 return o;
1138 }
1139
1140 protected:
1142 std::pair<MWAWVec2<T>, MWAWVec2<T> > m_data;
1143 };
1144
1146 typedef MWAWBox2<int> MWAWBox2i;
1148 typedef MWAWBox2<float> MWAWBox2f;
1150 typedef MWAWBox2<long> MWAWBox2l;
1151
1153 class MWAWTransformation
1154 {
1155 public:
1157 explicit MWAWTransformation(MWAWVec3f const &xRow=MWAWVec3f(1,0,0), MWAWVec3f const &yRow=MWAWVec3f(0,1,0)) : m_data(xRow, yRow), m_isIdentity(false)
1158 {
1159 checkIdentity();
1160 }
1162 bool isIdentity() const
1163 {
1164 return m_isIdentity;
1165 }
1167 void checkIdentity() const
1168 {
1169 m_isIdentity= m_data.first==MWAWVec3f(1,0,0) && m_data.second==MWAWVec3f(0,1,0);
1170 }
1174 MWAWVec3f const &operator[](int c) const
1175 {
1176 if (c<0 || c>1) throw libmwaw::GenericException();
1177 return c==0 ? m_data.first : m_data.second;
1178 }
1180 MWAWVec2f operator*(MWAWVec2f const &pt) const
1181 {
1182 if (m_isIdentity) return pt;
1183 return multiplyDirection(pt)+MWAWVec2f(m_data.first[2],m_data.second[2]);
1184 }
1186 MWAWVec2f multiplyDirection(MWAWVec2f const &dir) const
1187 {
1188 if (m_isIdentity) return dir;
1189 MWAWVec2f res;
1190 for (int coord=0; coord<2; ++coord) {
1191 MWAWVec3f const &row=coord==0 ? m_data.first : m_data.second;
1192 float value=0;
1193 for (int i=0; i<2; ++i)
1194 value+=row[i]*dir[i];
1195 res[coord]=value;
1196 }
1197 return res;
1198 }
1200 MWAWBox2f operator*(MWAWBox2f const &box) const
1201 {
1202 if (m_isIdentity) return box;
1203 return MWAWBox2f(operator*(box.min()), operator*(box.max()));
1204 }
1206 MWAWTransformation operator*(MWAWTransformation const &mat) const
1207 {
1208 if (mat.m_isIdentity) return *this;
1209 MWAWTransformation res;
1210 for (int row=0; row<2; ++row) {
1211 MWAWVec3f &resRow=row==0 ? res.m_data.first : res.m_data.second;
1212 for (int col=0; col<3; ++col) {
1213 float value=0;
1214 for (int i=0; i<3; ++i)
1215 value+=(*this)[row][i]*(i==2 ? (col==2 ? 1.f : 0.f) : mat[i][col]);
1216 resRow[col]=value;
1217 }
1218 }
1219 res.checkIdentity();
1220 return res;
1221 }
1223 MWAWTransformation &operator*=(MWAWTransformation const &mat)
1224 {
1225 if (!mat.m_isIdentity)
1226 *this=(*this)*mat;
1227 return *this;
1228 }
1230 bool operator==(MWAWTransformation const &mat) const
1231 {
1232 return m_data==mat.m_data;
1233 }
1235 bool operator!=(MWAWTransformation const &mat) const
1236 {
1237 return m_data!=mat.m_data;
1238 }
1240 bool operator<(MWAWTransformation const &mat) const
1241 {
1242 return m_data<mat.m_data;
1243 }
1245 bool operator<=(MWAWTransformation const &mat) const
1246 {
1247 return m_data<=mat.m_data;
1248 }
1250 bool operator>(MWAWTransformation const &mat) const
1251 {
1252 return m_data>mat.m_data;
1253 }
1255 bool operator>=(MWAWTransformation const &mat) const
1256 {
1257 return m_data>=mat.m_data;
1258 }
1262 bool decompose(float &rotation, MWAWVec2f &shearing, MWAWTransformation &transform, MWAWVec2f const &center) const;
1263
1265 static MWAWTransformation translation(MWAWVec2f const &trans)
1266 {
1267 return MWAWTransformation(MWAWVec3f(1, 0, trans[0]), MWAWVec3f(0, 1, trans[1]));
1268 }
1270 static MWAWTransformation scale(MWAWVec2f const &trans)
1271 {
1272 return MWAWTransformation(MWAWVec3f(trans[0], 0, 0), MWAWVec3f(0, trans[1], 0));
1273 }
1277 static MWAWTransformation rotation(float angle, MWAWVec2f const &center=MWAWVec2f(0,0));
1281 static MWAWTransformation shear(MWAWVec2f s, MWAWVec2f const &center=MWAWVec2f(0,0))
1282 {
1283 return MWAWTransformation(MWAWVec3f(1, s[0], -s[0]*center[1]), MWAWVec3f(s[1], 1, -s[1]*center[0]));
1284 }
1285 protected:
1287 std::pair<MWAWVec3f, MWAWVec3f > m_data;
1289 mutable bool m_isIdentity;
1290 };
1291
1292 // some format function
1293 namespace libmwaw
1294 {
1296 bool convertDTFormat(std::string const &dtFormat, librevenge::RVNGPropertyListVector &propVect);
1297 }
1298
1299 // some geometrical function
1300 namespace libmwaw
1301 {
1303 MWAWVec2f rotatePointAroundCenter(MWAWVec2f const &point, MWAWVec2f const &center, float angle);
1305 MWAWBox2f rotateBoxFromCenter(MWAWBox2f const &box, float angle);
1306 }
1307 #endif /* LIBMWAW_INTERNAL_H */
1308 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWVec3::z
T z() const
third element
Definition: libmwaw_internal.hxx:831
MWAWListenerPtr
shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:519
MWAWVec2::setY
void setY(T yy)
resets the second element
Definition: libmwaw_internal.hxx:663
MWAWNote::m_number
int m_number
the note number if defined
Definition: libmwaw_internal.hxx:432
MWAWFontManagerPtr
shared_ptr< MWAWFontManager > MWAWFontManagerPtr
a smart pointer of MWAWFontManager
Definition: libmwaw_internal.hxx:513
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:893
libmwaw::NumberingType
NumberingType
Definition: libmwaw_internal.hxx:184
MWAWColor::operator<
bool operator<(MWAWColor const &c) const
operator<
Definition: libmwaw_internal.hxx:299
MWAWVec2::operator-=
MWAWVec2< T > & operator-=(MWAWVec2< T > const &p)
operator-=
Definition: libmwaw_internal.hxx:683
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:192
MWAWColor::operator=
MWAWColor & operator=(uint32_t argb)
operator=
Definition: libmwaw_internal.hxx:207
libmwaw::LOWERCASE_ROMAN
Definition: libmwaw_internal.hxx:184
libmwaw::UPPERCASE_ROMAN
Definition: libmwaw_internal.hxx:184
MWAWVec3i
MWAWVec3< int > MWAWVec3i
MWAWVec3 of int.
Definition: libmwaw_internal.hxx:974
MWAWVec2< bool >::MapX
std::map< MWAWVec2< bool >, bool, struct PosSizeLtX > MapX
map of MWAWVec2
Definition: libmwaw_internal.hxx:772
MWAWTransformation::multiplyDirection
MWAWVec2f multiplyDirection(MWAWVec2f const &dir) const
operator* for direction
Definition: libmwaw_internal.hxx:1186
MWAWVec2::y
T y() const
second element
Definition: libmwaw_internal.hxx:634
libmwaw::DOC_GRAPHIC_GROUP
Definition: libmwaw_internal.hxx:192
libmwaw::NONE
Definition: libmwaw_internal.hxx:184
MWAWField::m_data
std::string m_data
the database/link field ( if defined )
Definition: libmwaw_internal.hxx:402
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:269
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:369
libmwaw::TopBit
Definition: libmwaw_internal.hxx:182
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:341
MWAWTransformation::translation
static MWAWTransformation translation(MWAWVec2f const &trans)
returns a translation transformation
Definition: libmwaw_internal.hxx:1265
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:700
MWAWVariable::operator*
T & operator*()
operator*
Definition: libmwaw_internal.hxx:589
MWAWEmbeddedObject::m_dataList
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition: libmwaw_internal.hxx:479
MWAWColor::isWhite
bool isWhite() const
return true if the color is white
Definition: libmwaw_internal.hxx:284
libmwaw::DOC_TEXT_BOX
Definition: libmwaw_internal.hxx:192
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:279
MWAWColor::white
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:245
MWAWNote::MWAWNote
MWAWNote(Type type)
constructor
Definition: libmwaw_internal.hxx:424
MWAWVec2::MWAWVec2
MWAWVec2(T xx=0, T yy=0)
constructor
Definition: libmwaw_internal.hxx:624
libmwaw::DOC_NOTE
Definition: libmwaw_internal.hxx:192
libmwaw::numberingValueToString
std::string numberingValueToString(NumberingType type, int value)
Definition: libmwaw_internal.cxx:129
MWAWLink
a link
Definition: libmwaw_internal.hxx:406
MWAWVariable::m_data
T m_data
the value
Definition: libmwaw_internal.hxx:611
MWAWVec3::operator!=
bool operator!=(MWAWVec3< T > const &p) const
comparison!=
Definition: libmwaw_internal.hxx:925
MWAWPresentationListenerPtr
shared_ptr< MWAWPresentationListener > MWAWPresentationListenerPtr
a smart pointer of MWAWPresentationListener
Definition: libmwaw_internal.hxx:525
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:182
MWAWBox2::extend
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition: libmwaw_internal.hxx:1077
MWAWVariable::operator->
T * operator->()
operator*
Definition: libmwaw_internal.hxx:578
MWAWTransformation::MWAWTransformation
MWAWTransformation(MWAWVec3f const &xRow=MWAWVec3f(1, 0, 0), MWAWVec3f const &yRow=MWAWVec3f(0, 1, 0))
constructor
Definition: libmwaw_internal.hxx:1157
MWAWColor::MWAWColor
MWAWColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition: libmwaw_internal.hxx:202
MWAWVec3::add
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition: libmwaw_internal.hxx:872
MWAWTransformation::operator*
MWAWVec2f operator*(MWAWVec2f const &pt) const
operator* for vec2f
Definition: libmwaw_internal.hxx:1180
libmwaw::DOC_CHART
Definition: libmwaw_internal.hxx:192
MWAWVariable::MWAWVariable
MWAWVariable(T const &def)
constructor with a default value
Definition: libmwaw_internal.hxx:545
MWAWEmbeddedObject::add
void add(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
add a picture
Definition: libmwaw_internal.hxx:462
MWAWBox2::resizeFromMax
void resizeFromMax(MWAWVec2< T > const &sz)
resize the box keeping the maximum
Definition: libmwaw_internal.hxx:1056
MWAWColor::black
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:240
MWAWTransformation::m_isIdentity
bool m_isIdentity
flag to know if this matrix is an identity matrix
Definition: libmwaw_internal.hxx:1289
MWAWVec3< int >::Map
std::map< MWAWVec3< int >, int, struct PosSizeLt > Map
map of MWAWVec3
Definition: libmwaw_internal.hxx:964
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:1104
MWAWBox2::center
MWAWVec2< T > center() const
the box center
Definition: libmwaw_internal.hxx:1027
MWAWVec3::operator-=
MWAWVec3< T > & operator-=(MWAWVec3< T > const &p)
operator-=
Definition: libmwaw_internal.hxx:886
MWAWVariable::insert
void insert(MWAWVariable const &orig)
update the current value if orig is set
Definition: libmwaw_internal.hxx:565
MWAWGraphicListener
This class contains the code needed to create Graphic document.
Definition: MWAWGraphicListener.hxx:59
libmwaw::SubDocumentType
SubDocumentType
Definition: libmwaw_internal.hxx:192
MWAWVec3::operator*
friend MWAWVec3< T > operator*(U scale, MWAWVec3< T > const &p1)
generic operator*
Definition: libmwaw_internal.hxx:913
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:1281
libmwaw::numberingTypeToString
std::string numberingTypeToString(NumberingType type)
Definition: libmwaw_internal.cxx:105
MWAWVec3::y
T y() const
second element
Definition: libmwaw_internal.hxx:826
MWAWTransformation::operator>
bool operator>(MWAWTransformation const &mat) const
operator>
Definition: libmwaw_internal.hxx:1250
libmwaw::VMiddle
Definition: libmwaw_internal.hxx:180
MWAWBox2::size
MWAWVec2< T > size() const
the box size
Definition: libmwaw_internal.hxx:1022
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:795
MWAWBorder::m_width
double m_width
the border total width in point
Definition: libmwaw_internal.hxx:371
MWAWTransformation::operator!=
bool operator!=(MWAWTransformation const &mat) const
operator!=
Definition: libmwaw_internal.hxx:1235
libmwaw::Bottom
Definition: libmwaw_internal.hxx:180
MWAWVec2::MWAWVec2
MWAWVec2(MWAWVec2< U > const &p)
generic copy constructor
Definition: libmwaw_internal.hxx:626
MWAWVec3::x
T x() const
first element
Definition: libmwaw_internal.hxx:821
MWAWVec2::operator-
friend MWAWVec2< T > operator-(MWAWVec2< T > const &p1, MWAWVec2< T > const &p2)
operator-
Definition: libmwaw_internal.hxx:705
libmwaw::Position
Position
basic position enum
Definition: libmwaw_internal.hxx:180
libmwaw::Top
Definition: libmwaw_internal.hxx:180
MWAWVec2::operator*=
MWAWVec2< T > & operator*=(U scale)
generic operator*=
Definition: libmwaw_internal.hxx:691
MWAWBox2i
MWAWBox2< int > MWAWBox2i
MWAWBox2 of int.
Definition: libmwaw_internal.hxx:1146
MWAWNote::m_type
Type m_type
the note type
Definition: libmwaw_internal.hxx:428
MWAWVec2::add
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition: libmwaw_internal.hxx:669
MWAWBox2::operator>
bool operator>(MWAWBox2< T > const &mat) const
operator>
Definition: libmwaw_internal.hxx:1124
libmwaw::Right
Definition: libmwaw_internal.hxx:180
MWAWVec2::operator[]
T & operator[](int c)
operator[]
Definition: libmwaw_internal.hxx:645
MWAWBox2::min
MWAWVec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:994
MWAWVec3
small class which defines a vector with 3 elements
Definition: libmwaw_internal.hxx:804
MWAWVariable::isSet
bool isSet() const
return true if the variable is set
Definition: libmwaw_internal.hxx:600
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:332
MWAWVec2::cmp
int cmp(MWAWVec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libmwaw_internal.hxx:734
libmwaw::WritingRightTop
Definition: libmwaw_internal.hxx:189
MWAWTransformation::operator[]
MWAWVec3f const & operator[](int c) const
the two extremum points which defined the box
Definition: libmwaw_internal.hxx:1174
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:213
MWAWColor
the class to store a color
Definition: libmwaw_internal.hxx:196
libmwaw::DOC_CHART_ZONE
Definition: libmwaw_internal.hxx:192
libmwaw::WrongPasswordException
Definition: libmwaw_internal.hxx:163
MWAWSubDocumentPtr
shared_ptr< MWAWSubDocument > MWAWSubDocumentPtr
a smart pointer of MWAWSubDocument
Definition: libmwaw_internal.hxx:531
MWAWVec3::operator-
friend MWAWVec3< T > operator-(MWAWVec3< T > const &p1, MWAWVec3< T > const &p2)
operator-
Definition: libmwaw_internal.hxx:906
MWAWField::MWAWField
MWAWField(Type type)
basic constructor
Definition: libmwaw_internal.hxx:388
MWAWVec3::operator[]
T & operator[](int c)
operator[]
Definition: libmwaw_internal.hxx:842
libmwaw::Left
Definition: libmwaw_internal.hxx:180
MWAWTransformation::operator<=
bool operator<=(MWAWTransformation const &mat) const
operator<=
Definition: libmwaw_internal.hxx:1245
libmwaw::WritingInherited
Definition: libmwaw_internal.hxx:189
MWAWNote::m_label
librevenge::RVNGString m_label
the note label
Definition: libmwaw_internal.hxx:430
MWAWBorder::Style
Style
the line style
Definition: libmwaw_internal.hxx:330
libmwaw::UPPERCASE
Definition: libmwaw_internal.hxx:184
MWAWVec2::x
T x() const
first element
Definition: libmwaw_internal.hxx:629
MWAWTransformation::operator*
MWAWTransformation operator*(MWAWTransformation const &mat) const
operator* for transform
Definition: libmwaw_internal.hxx:1206
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:422
MWAWLink::MWAWLink
MWAWLink()
basic constructor
Definition: libmwaw_internal.hxx:408
MWAWTransformation::scale
static MWAWTransformation scale(MWAWVec2f const &trans)
returns a scaling transformation
Definition: libmwaw_internal.hxx:1270
MWAWVec2::m_y
T m_y
second element
Definition: libmwaw_internal.hxx:789
MWAWVec3::PosSizeLt::operator()
bool operator()(MWAWVec3< T > const &s1, MWAWVec3< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:956
MWAWBorder::m_widthsList
std::vector< double > m_widthsList
the different length used for each line/sep (if defined)
Definition: libmwaw_internal.hxx:375
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:692
MWAWFont
Class to store font.
Definition: MWAWFont.hxx:43
MWAWBorder
a border
Definition: libmwaw_internal.hxx:328
MWAWBox2
small class which defines a 2D Box
Definition: libmwaw_internal.hxx:981
libmwaw::WritingLeftBottom
Definition: libmwaw_internal.hxx:189
MWAWVariable::operator=
MWAWVariable & operator=(T const &val)
set a value
Definition: libmwaw_internal.hxx:558
MWAWBox2::min
MWAWVec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:1004
MWAWVec3::m_val
T m_val[3]
the values
Definition: libmwaw_internal.hxx:968
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:527
MWAWVariable::m_set
bool m_set
a flag to know if the variable is set or not
Definition: libmwaw_internal.hxx:613
libmwaw::DOC_TABLE
Definition: libmwaw_internal.hxx:192
MWAWVec3::operator==
bool operator==(MWAWVec3< T > const &p) const
comparison==
Definition: libmwaw_internal.hxx:920
MWAWVec2::setX
void setX(T xx)
resets the first element
Definition: libmwaw_internal.hxx:658
MWAWEmbeddedObject::MWAWEmbeddedObject
MWAWEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
constructor
Definition: libmwaw_internal.hxx:445
MWAWBox2::operator>=
bool operator>=(MWAWBox2< T > const &mat) const
operator>=
Definition: libmwaw_internal.hxx:1129
libmwaw::GenericException
Definition: libmwaw_internal.hxx:159
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:396
MWAWVec2f
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:799
MWAWSpreadsheetListenerPtr
shared_ptr< MWAWSpreadsheetListener > MWAWSpreadsheetListenerPtr
a smart pointer of MWAWSpreadsheetListener
Definition: libmwaw_internal.hxx:529
libmwaw::BULLET
Definition: libmwaw_internal.hxx:184
MWAWColor::operator==
bool operator==(MWAWColor const &c) const
operator==
Definition: libmwaw_internal.hxx:289
MWAWVariable::operator=
MWAWVariable & operator=(MWAWVariable const &orig)
copy operator
Definition: libmwaw_internal.hxx:549
MWAWVec3f
MWAWVec3< float > MWAWVec3f
MWAWVec3 of float.
Definition: libmwaw_internal.hxx:976
MWAWVec2::operator+=
MWAWVec2< T > & operator+=(MWAWVec2< T > const &p)
operator+=
Definition: libmwaw_internal.hxx:676
MWAWBox2::MWAWBox2
MWAWBox2(MWAWBox2< U > const &p)
generic constructor
Definition: libmwaw_internal.hxx:989
MWAWVec2b
MWAWVec2< bool > MWAWVec2b
MWAWVec2 of bool.
Definition: libmwaw_internal.hxx:793
libmwaw::LOWERCASE
Definition: libmwaw_internal.hxx:184
MWAWColor::operator>
bool operator>(MWAWColor const &c) const
operator>
Definition: libmwaw_internal.hxx:309
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:935
MWAWBox2::operator!=
bool operator!=(MWAWBox2< T > const &mat) const
operator!=
Definition: libmwaw_internal.hxx:1109
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:719
MWAWTransformation::m_data
std::pair< MWAWVec3f, MWAWVec3f > m_data
the data
Definition: libmwaw_internal.hxx:1287
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:182
MWAWVec3::PosSizeLt
internal struct used to create sorted map, sorted by X, Y, Z
Definition: libmwaw_internal.hxx:954
MWAWColor::value
uint32_t value() const
return the rgba value
Definition: libmwaw_internal.hxx:254
MWAWEmbeddedObject::m_typeList
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition: libmwaw_internal.hxx:481
MWAWVec3::setX
void setX(T xx)
resets the first element
Definition: libmwaw_internal.hxx:856
libmwaw::ParseException
Definition: libmwaw_internal.hxx:155
MWAWColor::MWAWColor
MWAWColor(uint32_t argb=0)
constructor
Definition: libmwaw_internal.hxx:198
MWAWEmbeddedObject
small class use to define a embedded object
Definition: libmwaw_internal.hxx:439
MWAWBox2::resizeFromCenter
void resizeFromCenter(MWAWVec2< T > const &sz)
resize the box keeping the center
Definition: libmwaw_internal.hxx:1061
LIBMWAW_ATTRIBUTE_PRINTF
#define LIBMWAW_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libmwaw_internal.hxx:116
libmwaw::FileException
Definition: libmwaw_internal.hxx:151
libmwaw::DOC_SHEET
Definition: libmwaw_internal.hxx:192
libmwaw::WritingLeftTop
Definition: libmwaw_internal.hxx:189
MWAWColor::getGreen
unsigned char getGreen() const
returns the green value
Definition: libmwaw_internal.hxx:274
MWAWBox2::operator[]
MWAWVec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition: libmwaw_internal.hxx:1016
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:1084
MWAWVec3::MWAWVec3
MWAWVec3(MWAWVec3< U > const &p)
generic copy constructor
Definition: libmwaw_internal.hxx:815
MWAWColor::operator>=
bool operator>=(MWAWColor const &c) const
operator>=
Definition: libmwaw_internal.hxx:314
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:517
MWAWEmbeddedObject::MWAWEmbeddedObject
MWAWEmbeddedObject()
empty constructor
Definition: libmwaw_internal.hxx:441
MWAWBox2::MWAWBox2
MWAWBox2(MWAWVec2< T > minPt=MWAWVec2< T >(), MWAWVec2< T > maxPt=MWAWVec2< T >())
constructor
Definition: libmwaw_internal.hxx:985
MWAWVec2::operator+
friend MWAWVec2< T > operator+(MWAWVec2< T > const &p1, MWAWVec2< T > const &p2)
operator+
Definition: libmwaw_internal.hxx:699
MWAWColor::operator!=
bool operator!=(MWAWColor const &c) const
operator!=
Definition: libmwaw_internal.hxx:294
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:182
MWAWBorder::m_style
Style m_style
the border style
Definition: libmwaw_internal.hxx:364
MWAWVec3::operator+
friend MWAWVec3< T > operator+(MWAWVec3< T > const &p1, MWAWVec3< T > const &p2)
operator+
Definition: libmwaw_internal.hxx:900
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:515
MWAWVec3::setZ
void setZ(T zz)
resets the third element
Definition: libmwaw_internal.hxx:866
MWAWVec3uc
MWAWVec3< unsigned char > MWAWVec3uc
MWAWVec3 of unsigned char.
Definition: libmwaw_internal.hxx:972
MWAWBox2::max
MWAWVec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:1009
MWAWVec3::operator[]
T operator[](int c) const
operator[]
Definition: libmwaw_internal.hxx:836
MWAWBox2::max
MWAWVec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:999
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:182
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:808
MWAWFontConverterPtr
shared_ptr< MWAWFontConverter > MWAWFontConverterPtr
a smart pointer of MWAWFontConverter
Definition: libmwaw_internal.hxx:509
libmwaw::ARABIC
Definition: libmwaw_internal.hxx:184
MWAWVec2::PosSizeLtY::operator()
bool operator()(MWAWVec2< T > const &s1, MWAWVec2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:779
MWAWBox2::m_data
std::pair< MWAWVec2< T >, MWAWVec2< T > > m_data
the data
Definition: libmwaw_internal.hxx:1142
MWAWVec2::PosSizeLtY
internal struct used to create sorted map, sorted by Y
Definition: libmwaw_internal.hxx:777
MWAWBox2f
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1148
MWAWColor::getBlue
unsigned char getBlue() const
returns the green value
Definition: libmwaw_internal.hxx:264
MWAWVec2::operator!=
bool operator!=(MWAWVec2< T > const &p) const
comparison!=
Definition: libmwaw_internal.hxx:724
MWAWBox2::getIntersection
MWAWBox2< T > getIntersection(MWAWBox2< T > const &box) const
returns the intersection between this and box
Definition: libmwaw_internal.hxx:1094
MWAWEmbeddedObject::isEmpty
bool isEmpty() const
return true if the picture contains no data
Definition: libmwaw_internal.hxx:453
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:416
MWAWBox2::setMax
void setMax(MWAWVec2< T > const &y)
resets the maximum point
Definition: libmwaw_internal.hxx:1045
MWAWTransformation::isIdentity
bool isIdentity() const
returns true if the matrix is an identity matrix
Definition: libmwaw_internal.hxx:1162
MWAWVariable::setSet
void setSet(bool newVal)
define if the variable is set
Definition: libmwaw_internal.hxx:605
MWAWField
a field
Definition: libmwaw_internal.hxx:383
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:223
MWAWVec2< bool >::MapY
std::map< MWAWVec2< bool >, bool, struct PosSizeLtY > MapY
map of MWAWVec2
Definition: libmwaw_internal.hxx:787
MWAWBorder::operator==
bool operator==(MWAWBorder const &orig) const
operator==
Definition: libmwaw_internal.hxx:346
MWAWField::m_DTFormat
std::string m_DTFormat
the date/time format using strftime format if defined
Definition: libmwaw_internal.hxx:400
MWAWVariable::MWAWVariable
MWAWVariable(MWAWVariable const &orig)
copy constructor
Definition: libmwaw_internal.hxx:547
MWAWColor::getAlpha
unsigned char getAlpha() const
returns the alpha value
Definition: libmwaw_internal.hxx:259
libmwaw::DOC_HEADER_FOOTER
Definition: libmwaw_internal.hxx:192
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:523
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:379
libmwaw::WritingMode
WritingMode
the different writing mode
Definition: libmwaw_internal.hxx:189
MWAWVec2::cmpY
int cmpY(MWAWVec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:743
MWAWNote
a note
Definition: libmwaw_internal.hxx:420
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:573
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:385
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:797
MWAWTransformation::operator>=
bool operator>=(MWAWTransformation const &mat) const
operator>=
Definition: libmwaw_internal.hxx:1255
MWAWBorder::MWAWBorder
MWAWBorder()
constructor
Definition: libmwaw_internal.hxx:335
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:1223
MWAWVec2::operator[]
T operator[](int c) const
operator[]
Definition: libmwaw_internal.hxx:639
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:1200
MWAWVec2::m_x
T m_x
first element
Definition: libmwaw_internal.hxx:789
MWAWTransformation::operator==
bool operator==(MWAWTransformation const &mat) const
operator==
Definition: libmwaw_internal.hxx:1230
MWAWBox2::scale
void scale(U factor)
scales all points of the box by factor
Definition: libmwaw_internal.hxx:1070
MWAWBox2l
MWAWBox2< long > MWAWBox2l
MWAWBox2 of long.
Definition: libmwaw_internal.hxx:1150
libmwaw::WritingRightBottom
Definition: libmwaw_internal.hxx:189
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:1240
MWAWRSRCParser
the main class to read a Mac resource fork
Definition: MWAWRSRCParser.hxx:46
libmwaw::LeftBit
Definition: libmwaw_internal.hxx:182
MWAWBorder::m_color
MWAWColor m_color
the border color
Definition: libmwaw_internal.hxx:377
MWAWColor::operator<=
bool operator<=(MWAWColor const &c) const
operator<=
Definition: libmwaw_internal.hxx:304
MWAWVec3::operator+=
MWAWVec3< T > & operator+=(MWAWVec3< T > const &p)
operator+=
Definition: libmwaw_internal.hxx:880
MWAWField::m_numberingType
libmwaw::NumberingType m_numberingType
the number type ( for number field )
Definition: libmwaw_internal.hxx:398
libmwaw::DOC_COMMENT_ANNOTATION
Definition: libmwaw_internal.hxx:192
MWAWVariable::MWAWVariable
MWAWVariable()
constructor
Definition: libmwaw_internal.hxx:543
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:712
MWAWVec2::PosSizeLtX
internal struct used to create sorted map, sorted by X
Definition: libmwaw_internal.hxx:762
MWAWVariable
a generic variable template: value + flag to know if the variable is set
Definition: libmwaw_internal.hxx:541
MWAWBorder::operator!=
bool operator!=(MWAWBorder const &orig) const
operator!=
Definition: libmwaw_internal.hxx:351
libmwaw::HMiddle
Definition: libmwaw_internal.hxx:180
MWAWBox2::resizeFromMin
void resizeFromMin(MWAWVec2< T > const &sz)
resize the box keeping the minimum
Definition: libmwaw_internal.hxx:1051
MWAWTextListenerPtr
shared_ptr< MWAWTextListener > MWAWTextListenerPtr
a smart pointer of MWAWTextListener
Definition: libmwaw_internal.hxx:533
MWAWColor::m_value
uint32_t m_value
the argb color
Definition: libmwaw_internal.hxx:324
MWAWVariable::operator*
T const & operator*() const
operator*
Definition: libmwaw_internal.hxx:584
MWAWTransformation
a transformation which stored the first row of a 3x3 perspective matrix
Definition: libmwaw_internal.hxx:1153
libmwaw::VersionException
Definition: libmwaw_internal.hxx:147
MWAWVec2
small class which defines a vector with 2 elements
Definition: libmwaw_internal.hxx:620
MWAWTransformation::checkIdentity
void checkIdentity() const
check if a matrix is the identity matrix
Definition: libmwaw_internal.hxx:1167
MWAWListManagerPtr
shared_ptr< MWAWListManager > MWAWListManagerPtr
a smart pointer of MWAWListManager
Definition: libmwaw_internal.hxx:521
MWAWVec3::setY
void setY(T yy)
resets the second element
Definition: libmwaw_internal.hxx:861
MWAWVec2::PosSizeLtX::operator()
bool operator()(MWAWVec2< T > const &s1, MWAWVec2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:764
MWAWBox2::setMin
void setMin(MWAWVec2< T > const &x)
resets the minimum point
Definition: libmwaw_internal.hxx:1040