libmwaw_internal.hxx Source File documentation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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 virtual ~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 MWAWGraphicListener;
486 class MWAWInputStream;
487 class MWAWListener;
488 class MWAWListManager;
489 class MWAWParserState;
490 class MWAWPresentationListener;
491 class MWAWRSRCParser;
492 class MWAWSpreadsheetListener;
493 class MWAWSubDocument;
494 class MWAWTextListener;
496 typedef shared_ptr<MWAWFontConverter> MWAWFontConverterPtr;
498 typedef shared_ptr<MWAWGraphicListener> MWAWGraphicListenerPtr;
500 typedef shared_ptr<MWAWInputStream> MWAWInputStreamPtr;
502 typedef shared_ptr<MWAWListener> MWAWListenerPtr;
504 typedef shared_ptr<MWAWListManager> MWAWListManagerPtr;
506 typedef shared_ptr<MWAWParserState> MWAWParserStatePtr;
508 typedef shared_ptr<MWAWPresentationListener> MWAWPresentationListenerPtr;
510 typedef shared_ptr<MWAWRSRCParser> MWAWRSRCParserPtr;
512 typedef shared_ptr<MWAWSpreadsheetListener> MWAWSpreadsheetListenerPtr;
514 typedef shared_ptr<MWAWSubDocument> MWAWSubDocumentPtr;
516 typedef shared_ptr<MWAWTextListener> MWAWTextListenerPtr;
517
524 template <class T> struct MWAWVariable {
526 MWAWVariable() : m_data(), m_set(false) {}
528 explicit MWAWVariable(T const &def) : m_data(def), m_set(false) {}
530 MWAWVariable(MWAWVariable const &orig) : m_data(orig.m_data), m_set(orig.m_set) {}
532 MWAWVariable &operator=(MWAWVariable const &orig)
533 {
534 if (this != &orig) {
535 m_data = orig.m_data;
536 m_set = orig.m_set;
537 }
538 return *this;
539 }
541 MWAWVariable &operator=(T const &val)
542 {
543 m_data = val;
544 m_set = true;
545 return *this;
546 }
548 void insert(MWAWVariable const &orig)
549 {
550 if (orig.m_set) {
551 m_data = orig.m_data;
552 m_set = orig.m_set;
553 }
554 }
556 T const *operator->() const
557 {
558 return &m_data;
559 }
561 T *operator->()
562 {
563 m_set = true;
564 return &m_data;
565 }
567 T const &operator*() const
568 {
569 return m_data;
570 }
572 T &operator*()
573 {
574 m_set = true;
575 return m_data;
576 }
578 T const &get() const
579 {
580 return m_data;
581 }
583 bool isSet() const
584 {
585 return m_set;
586 }
588 void setSet(bool newVal)
589 {
590 m_set=newVal;
591 }
592 protected:
594 T m_data;
596 bool m_set;
597 };
598
599 /* ---------- vec2/box2f ------------- */
603 template <class T> class MWAWVec2
604 {
605 public:
607 explicit MWAWVec2(T xx=0,T yy=0) : m_x(xx), m_y(yy) { }
609 template <class U> MWAWVec2(MWAWVec2<U> const &p) : m_x(T(p.x())), m_y(T(p.y())) {}
610
612 T x() const
613 {
614 return m_x;
615 }
617 T y() const
618 {
619 return m_y;
620 }
622 T operator[](int c) const
623 {
624 if (c<0 || c>1) throw libmwaw::GenericException();
625 return (c==0) ? m_x : m_y;
626 }
628 T &operator[](int c)
629 {
630 if (c<0 || c>1) throw libmwaw::GenericException();
631 return (c==0) ? m_x : m_y;
632 }
633
635 void set(T xx, T yy)
636 {
637 m_x = xx;
638 m_y = yy;
639 }
641 void setX(T xx)
642 {
643 m_x = xx;
644 }
646 void setY(T yy)
647 {
648 m_y = yy;
649 }
650
652 void add(T dx, T dy)
653 {
654 m_x += dx;
655 m_y += dy;
656 }
657
659 MWAWVec2<T> &operator+=(MWAWVec2<T> const &p)
660 {
661 m_x += p.m_x;
662 m_y += p.m_y;
663 return *this;
664 }
666 MWAWVec2<T> &operator-=(MWAWVec2<T> const &p)
667 {
668 m_x -= p.m_x;
669 m_y -= p.m_y;
670 return *this;
671 }
673 template <class U>
674 MWAWVec2<T> &operator*=(U scale)
675 {
676 m_x = T(m_x*scale);
677 m_y = T(m_y*scale);
678 return *this;
679 }
680
682 friend MWAWVec2<T> operator+(MWAWVec2<T> const &p1, MWAWVec2<T> const &p2)
683 {
684 MWAWVec2<T> p(p1);
685 return p+=p2;
686 }
688 friend MWAWVec2<T> operator-(MWAWVec2<T> const &p1, MWAWVec2<T> const &p2)
689 {
690 MWAWVec2<T> p(p1);
691 return p-=p2;
692 }
694 template <class U>
695 friend MWAWVec2<T> operator*(U scale, MWAWVec2<T> const &p1)
696 {
697 MWAWVec2<T> p(p1);
698 return p *= scale;
699 }
700
702 bool operator==(MWAWVec2<T> const &p) const
703 {
704 return cmpY(p) == 0;
705 }
707 bool operator!=(MWAWVec2<T> const &p) const
708 {
709 return cmpY(p) != 0;
710 }
712 bool operator<(MWAWVec2<T> const &p) const
713 {
714 return cmpY(p) < 0;
715 }
717 int cmp(MWAWVec2<T> const &p) const
718 {
719 if (m_x < p.m_x) return -1;
720 if (m_x > p.m_x) return 1;
721 if (m_y < p.m_y) return -1;
722 if (m_y > p.m_y) return 1;
723 return 0;
724 }
726 int cmpY(MWAWVec2<T> const &p) const
727 {
728 if (m_y < p.m_y) return -1;
729 if (m_y > p.m_y) return 1;
730 if (m_x < p.m_x) return -1;
731 if (m_x > p.m_x) return 1;
732 return 0;
733 }
734
736 friend std::ostream &operator<< (std::ostream &o, MWAWVec2<T> const &f)
737 {
738 o << f.m_x << "x" << f.m_y;
739 return o;
740 }
741
745 struct PosSizeLtX {
747 bool operator()(MWAWVec2<T> const &s1, MWAWVec2<T> const &s2) const
748 {
749 return s1.cmp(s2) < 0;
750 }
751 };
755 typedef std::map<MWAWVec2<T>, T,struct PosSizeLtX> MapX;
756
760 struct PosSizeLtY {
762 bool operator()(MWAWVec2<T> const &s1, MWAWVec2<T> const &s2) const
763 {
764 return s1.cmpY(s2) < 0;
765 }
766 };
770 typedef std::map<MWAWVec2<T>, T,struct PosSizeLtY> MapY;
771 protected:
772 T m_x, m_y;
773 };
774
776 typedef MWAWVec2<bool> MWAWVec2b;
778 typedef MWAWVec2<int> MWAWVec2i;
780 typedef MWAWVec2<long> MWAWVec2l;
782 typedef MWAWVec2<float> MWAWVec2f;
783
787 template <class T> class MWAWVec3
788 {
789 public:
791 explicit MWAWVec3(T xx=0,T yy=0,T zz=0)
792 {
793 m_val[0] = xx;
794 m_val[1] = yy;
795 m_val[2] = zz;
796 }
798 template <class U> MWAWVec3(MWAWVec3<U> const &p)
799 {
800 for (int c = 0; c < 3; c++) m_val[c] = T(p[c]);
801 }
802
804 T x() const
805 {
806 return m_val[0];
807 }
809 T y() const
810 {
811 return m_val[1];
812 }
814 T z() const
815 {
816 return m_val[2];
817 }
819 T operator[](int c) const
820 {
821 if (c<0 || c>2) throw libmwaw::GenericException();
822 return m_val[c];
823 }
825 T &operator[](int c)
826 {
827 if (c<0 || c>2) throw libmwaw::GenericException();
828 return m_val[c];
829 }
830
832 void set(T xx, T yy, T zz)
833 {
834 m_val[0] = xx;
835 m_val[1] = yy;
836 m_val[2] = zz;
837 }
839 void setX(T xx)
840 {
841 m_val[0] = xx;
842 }
844 void setY(T yy)
845 {
846 m_val[1] = yy;
847 }
849 void setZ(T zz)
850 {
851 m_val[2] = zz;
852 }
853
855 void add(T dx, T dy, T dz)
856 {
857 m_val[0] += dx;
858 m_val[1] += dy;
859 m_val[2] += dz;
860 }
861
863 MWAWVec3<T> &operator+=(MWAWVec3<T> const &p)
864 {
865 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]);
866 return *this;
867 }
869 MWAWVec3<T> &operator-=(MWAWVec3<T> const &p)
870 {
871 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]-p.m_val[c]);
872 return *this;
873 }
875 template <class U>
876 MWAWVec3<T> &operator*=(U scale)
877 {
878 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]*scale);
879 return *this;
880 }
881
883 friend MWAWVec3<T> operator+(MWAWVec3<T> const &p1, MWAWVec3<T> const &p2)
884 {
885 MWAWVec3<T> p(p1);
886 return p+=p2;
887 }
889 friend MWAWVec3<T> operator-(MWAWVec3<T> const &p1, MWAWVec3<T> const &p2)
890 {
891 MWAWVec3<T> p(p1);
892 return p-=p2;
893 }
895 template <class U>
896 friend MWAWVec3<T> operator*(U scale, MWAWVec3<T> const &p1)
897 {
898 MWAWVec3<T> p(p1);
899 return p *= scale;
900 }
901
903 bool operator==(MWAWVec3<T> const &p) const
904 {
905 return cmp(p) == 0;
906 }
908 bool operator!=(MWAWVec3<T> const &p) const
909 {
910 return cmp(p) != 0;
911 }
913 bool operator<(MWAWVec3<T> const &p) const
914 {
915 return cmp(p) < 0;
916 }
918 int cmp(MWAWVec3<T> const &p) const
919 {
920 for (int c = 0; c < 3; c++) {
921 if (m_val[c]<p.m_val[c]) return -1;
922 if (m_val[c]>p.m_val[c]) return 1;
923 }
924 return 0;
925 }
926
928 friend std::ostream &operator<< (std::ostream &o, MWAWVec3<T> const &f)
929 {
930 o << f.m_val[0] << "x" << f.m_val[1] << "x" << f.m_val[2];
931 return o;
932 }
933
937 struct PosSizeLt {
939 bool operator()(MWAWVec3<T> const &s1, MWAWVec3<T> const &s2) const
940 {
941 return s1.cmp(s2) < 0;
942 }
943 };
947 typedef std::map<MWAWVec3<T>, T,struct PosSizeLt> Map;
948
949 protected:
951 T m_val[3];
952 };
953
955 typedef MWAWVec3<unsigned char> MWAWVec3uc;
957 typedef MWAWVec3<int> MWAWVec3i;
959 typedef MWAWVec3<float> MWAWVec3f;
960
964 template <class T> class MWAWBox2
965 {
966 public:
968 explicit MWAWBox2(MWAWVec2<T> minPt=MWAWVec2<T>(), MWAWVec2<T> maxPt=MWAWVec2<T>()) : m_data(minPt, maxPt)
969 {
970 }
972 template <class U> MWAWBox2(MWAWBox2<U> const &p) : m_data(p.min(), p.max())
973 {
974 }
975
977 MWAWVec2<T> const &min() const
978 {
979 return m_data.first;
980 }
982 MWAWVec2<T> const &max() const
983 {
984 return m_data.second;
985 }
987 MWAWVec2<T> &min()
988 {
989 return m_data.first;
990 }
992 MWAWVec2<T> &max()
993 {
994 return m_data.second;
995 }
999 MWAWVec2<T> const &operator[](int c) const
1000 {
1001 if (c<0 || c>1) throw libmwaw::GenericException();
1002 return c==0 ? m_data.first : m_data.second;
1003 }
1005 MWAWVec2<T> size() const
1006 {
1007 return m_data.second-m_data.first;
1008 }
1010 MWAWVec2<T> center() const
1011 {
1012 return MWAWVec2<T>((m_data.first.x()+m_data.second.x())/2,
1013 (m_data.first.y()+m_data.second.y())/2);
1014 }
1015
1017 void set(MWAWVec2<T> const &x, MWAWVec2<T> const &y)
1018 {
1019 m_data.first = x;
1020 m_data.second = y;
1021 }
1023 void setMin(MWAWVec2<T> const &x)
1024 {
1025 m_data.first = x;
1026 }
1028 void setMax(MWAWVec2<T> const &y)
1029 {
1030 m_data.second = y;
1031 }
1032
1034 void resizeFromMin(MWAWVec2<T> const &sz)
1035 {
1036 m_data.second = m_data.first+sz;
1037 }
1039 void resizeFromMax(MWAWVec2<T> const &sz)
1040 {
1041 m_data.first = m_data.second-sz;
1042 }
1044 void resizeFromCenter(MWAWVec2<T> const &sz)
1045 {
1046 MWAWVec2<T> centerPt = center();
1047 MWAWVec2<T> decal(sz.x()/2,sz.y()/2);
1048 m_data.first = centerPt - decal;
1049 m_data.second = centerPt + (sz - decal);
1050 }
1051
1053 template <class U> void scale(U factor)
1054 {
1055 m_data.first *= factor;
1056 m_data.second *= factor;
1057 }
1058
1060 void extend(T val)
1061 {
1062 m_data.first -= MWAWVec2<T>(val/2,val/2);
1063 m_data.second += MWAWVec2<T>(val-(val/2),val-(val/2));
1064 }
1065
1067 MWAWBox2<T> getUnion(MWAWBox2<T> const &box) const
1068 {
1069 MWAWBox2<T> res;
1070 res.m_data.first=MWAWVec2<T>(m_data.first[0]<box.m_data.first[0]?m_data.first[0] : box.m_data.first[0],
1071 m_data.first[1]<box.m_data.first[1]?m_data.first[1] : box.m_data.first[1]);
1072 res.m_data.second=MWAWVec2<T>(m_data.second[0]>box.m_data.second[0]?m_data.second[0] : box.m_data.second[0],
1073 m_data.second[1]>box.m_data.second[1]?m_data.second[1] : box.m_data.second[1]);
1074 return res;
1075 }
1077 MWAWBox2<T> getIntersection(MWAWBox2<T> const &box) const
1078 {
1079 MWAWBox2<T> res;
1080 res.m_data.first=MWAWVec2<T>(m_data.first[0]>box.m_data.first[0]?m_data.first[0] : box.m_data.first[0],
1081 m_data.first[1]>box.m_data.first[1]?m_data.first[1] : box.m_data.first[1]);
1082 res.m_data.second=MWAWVec2<T>(m_data.second[0]<box.m_data.second[0]?m_data.second[0] : box.m_data.second[0],
1083 m_data.second[1]<box.m_data.second[1]?m_data.second[1] : box.m_data.second[1]);
1084 return res;
1085 }
1087 bool operator==(MWAWBox2<T> const &mat) const
1088 {
1089 return m_data==mat.m_data;
1090 }
1092 bool operator!=(MWAWBox2<T> const &mat) const
1093 {
1094 return m_data!=mat.m_data;
1095 }
1097 bool operator<(MWAWBox2<T> const &mat) const
1098 {
1099 return m_data<mat.m_data;
1100 }
1102 bool operator<=(MWAWBox2<T> const &mat) const
1103 {
1104 return m_data<=mat.m_data;
1105 }
1107 bool operator>(MWAWBox2<T> const &mat) const
1108 {
1109 return m_data>mat.m_data;
1110 }
1112 bool operator>=(MWAWBox2<T> const &mat) const
1113 {
1114 return m_data>=mat.m_data;
1115 }
1117 friend std::ostream &operator<< (std::ostream &o, MWAWBox2<T> const &f)
1118 {
1119 o << "(" << f.min() << "<->" << f.max() << ")";
1120 return o;
1121 }
1122
1123 protected:
1125 std::pair<MWAWVec2<T>, MWAWVec2<T> > m_data;
1126 };
1127
1129 typedef MWAWBox2<int> MWAWBox2i;
1131 typedef MWAWBox2<float> MWAWBox2f;
1133 typedef MWAWBox2<long> MWAWBox2l;
1134
1136 class MWAWTransformation
1137 {
1138 public:
1140 explicit MWAWTransformation(MWAWVec3f const &xRow=MWAWVec3f(1,0,0), MWAWVec3f const &yRow=MWAWVec3f(0,1,0)) : m_data(xRow, yRow), m_isIdentity(false)
1141 {
1142 checkIdentity();
1143 }
1145 bool isIdentity() const
1146 {
1147 return m_isIdentity;
1148 }
1150 void checkIdentity() const
1151 {
1152 m_isIdentity= m_data.first==MWAWVec3f(1,0,0) && m_data.second==MWAWVec3f(0,1,0);
1153 }
1157 MWAWVec3f const &operator[](int c) const
1158 {
1159 if (c<0 || c>1) throw libmwaw::GenericException();
1160 return c==0 ? m_data.first : m_data.second;
1161 }
1163 MWAWVec2f operator*(MWAWVec2f const &pt) const
1164 {
1165 if (m_isIdentity) return pt;
1166 return multiplyDirection(pt)+MWAWVec2f(m_data.first[2],m_data.second[2]);
1167 }
1169 MWAWVec2f multiplyDirection(MWAWVec2f const &dir) const
1170 {
1171 if (m_isIdentity) return dir;
1172 MWAWVec2f res;
1173 for (int coord=0; coord<2; ++coord) {
1174 MWAWVec3f const &row=coord==0 ? m_data.first : m_data.second;
1175 float value=0;
1176 for (int i=0; i<2; ++i)
1177 value+=row[i]*dir[i];
1178 res[coord]=value;
1179 }
1180 return res;
1181 }
1183 MWAWBox2f operator*(MWAWBox2f const &box) const
1184 {
1185 if (m_isIdentity) return box;
1186 return MWAWBox2f(operator*(box.min()), operator*(box.max()));
1187 }
1189 MWAWTransformation operator*(MWAWTransformation const &mat) const
1190 {
1191 if (mat.m_isIdentity) return *this;
1192 MWAWTransformation res;
1193 for (int row=0; row<2; ++row) {
1194 MWAWVec3f &resRow=row==0 ? res.m_data.first : res.m_data.second;
1195 for (int col=0; col<3; ++col) {
1196 float value=0;
1197 for (int i=0; i<3; ++i)
1198 value+=(*this)[row][i]*(i==2 ? (col==2 ? 1.f : 0.f) : mat[i][col]);
1199 resRow[col]=value;
1200 }
1201 }
1202 res.checkIdentity();
1203 return res;
1204 }
1206 MWAWTransformation &operator*=(MWAWTransformation const &mat)
1207 {
1208 if (!mat.m_isIdentity)
1209 *this=(*this)*mat;
1210 return *this;
1211 }
1213 bool operator==(MWAWTransformation const &mat) const
1214 {
1215 return m_data==mat.m_data;
1216 }
1218 bool operator!=(MWAWTransformation const &mat) const
1219 {
1220 return m_data!=mat.m_data;
1221 }
1223 bool operator<(MWAWTransformation const &mat) const
1224 {
1225 return m_data<mat.m_data;
1226 }
1228 bool operator<=(MWAWTransformation const &mat) const
1229 {
1230 return m_data<=mat.m_data;
1231 }
1233 bool operator>(MWAWTransformation const &mat) const
1234 {
1235 return m_data>mat.m_data;
1236 }
1238 bool operator>=(MWAWTransformation const &mat) const
1239 {
1240 return m_data>=mat.m_data;
1241 }
1245 bool decompose(float &rotation, MWAWVec2f &shearing, MWAWTransformation &transform, MWAWVec2f const &center) const;
1246
1248 static MWAWTransformation translation(MWAWVec2f const &trans)
1249 {
1250 return MWAWTransformation(MWAWVec3f(1, 0, trans[0]), MWAWVec3f(0, 1, trans[1]));
1251 }
1253 static MWAWTransformation scale(MWAWVec2f const &trans)
1254 {
1255 return MWAWTransformation(MWAWVec3f(trans[0], 0, 0), MWAWVec3f(0, trans[1], 0));
1256 }
1260 static MWAWTransformation rotation(float angle, MWAWVec2f const &center=MWAWVec2f(0,0));
1264 static MWAWTransformation shear(MWAWVec2f s, MWAWVec2f const &center=MWAWVec2f(0,0))
1265 {
1266 return MWAWTransformation(MWAWVec3f(1, s[0], -s[0]*center[1]), MWAWVec3f(s[1], 1, -s[1]*center[0]));
1267 }
1268 protected:
1270 std::pair<MWAWVec3f, MWAWVec3f > m_data;
1272 mutable bool m_isIdentity;
1273 };
1274
1275 // some format function
1276 namespace libmwaw
1277 {
1279 bool convertDTFormat(std::string const &dtFormat, librevenge::RVNGPropertyListVector &propVect);
1280 }
1281
1282 // some geometrical function
1283 namespace libmwaw
1284 {
1286 MWAWVec2f rotatePointAroundCenter(MWAWVec2f const &point, MWAWVec2f const &center, float angle);
1288 MWAWBox2f rotateBoxFromCenter(MWAWBox2f const &box, float angle);
1289 }
1290 #endif /* LIBMWAW_INTERNAL_H */
1291 // vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
MWAWListenerPtr
shared_ptr< MWAWListener > MWAWListenerPtr
a smart pointer of MWAWListener
Definition: libmwaw_internal.hxx:502
MWAWVec2::setY
void setY(T yy)
resets the second element
Definition: libmwaw_internal.hxx:646
MWAWNote::m_number
int m_number
the note number if defined
Definition: libmwaw_internal.hxx:418
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:876
MWAWEmbeddedObject::isEmpty
bool isEmpty() const
return true if the picture contains no data
Definition: libmwaw_internal.hxx:439
libmwaw::NumberingType
NumberingType
Definition: libmwaw_internal.hxx:170
MWAWVec3::operator!=
bool operator!=(MWAWVec3< T > const &p) const
comparison!=
Definition: libmwaw_internal.hxx:908
MWAWVariable::operator*
T const & operator*() const
operator*
Definition: libmwaw_internal.hxx:567
MWAWVec2::operator-=
MWAWVec2< T > & operator-=(MWAWVec2< T > const &p)
operator-=
Definition: libmwaw_internal.hxx:666
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
MWAWVec3::PosSizeLt::operator()
bool operator()(MWAWVec3< T > const &s1, MWAWVec3< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:939
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:957
MWAWVec2< bool >::MapX
std::map< MWAWVec2< bool >, bool, struct PosSizeLtX > MapX
Definition: libmwaw_internal.hxx:755
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
MWAWTransformation::operator!=
bool operator!=(MWAWTransformation const &mat) const
operator!=
Definition: libmwaw_internal.hxx:1218
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
MWAWBorder::operator==
bool operator==(MWAWBorder const &orig) const
operator==
Definition: libmwaw_internal.hxx:332
libmwaw::TopBit
Definition: libmwaw_internal.hxx:168
MWAWVec2::operator==
bool operator==(MWAWVec2< T > const &p) const
comparison==
Definition: libmwaw_internal.hxx:702
BeagleWksDRParserInternal::operator<<
std::ostream & operator<<(std::ostream &o, Shape const &shape)
Definition: BeagleWksDRParser.cxx:98
MWAWVec2::cmp
int cmp(MWAWVec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libmwaw_internal.hxx:717
MWAWPageSpan
A class which defines the page properties.
Definition: MWAWPageSpan.hxx:95
MWAWTransformation::translation
static MWAWTransformation translation(MWAWVec2f const &trans)
returns a translation transformation
Definition: libmwaw_internal.hxx:1248
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:572
MWAWEmbeddedObject::m_dataList
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition: libmwaw_internal.hxx:465
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
MWAWBox2::operator[]
MWAWVec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition: libmwaw_internal.hxx:999
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
MWAWBox2::operator>
bool operator>(MWAWBox2< T > const &mat) const
operator>
Definition: libmwaw_internal.hxx:1107
MWAWColor::operator>
bool operator>(MWAWColor const &c) const
operator>
Definition: libmwaw_internal.hxx:295
MWAWColor::operator<
bool operator<(MWAWColor const &c) const
operator<
Definition: libmwaw_internal.hxx:285
MWAWVec2::MWAWVec2
MWAWVec2(T xx=0, T yy=0)
constructor
Definition: libmwaw_internal.hxx:607
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:594
MWAWPresentationListenerPtr
shared_ptr< MWAWPresentationListener > MWAWPresentationListenerPtr
a smart pointer of MWAWPresentationListener
Definition: libmwaw_internal.hxx:508
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:1060
MWAWVec2::operator[]
T operator[](int c) const
operator[]
Definition: libmwaw_internal.hxx:622
MWAWVariable::operator->
T * operator->()
operator*
Definition: libmwaw_internal.hxx:561
MWAWTransformation::MWAWTransformation
MWAWTransformation(MWAWVec3f const &xRow=MWAWVec3f(1, 0, 0), MWAWVec3f const &yRow=MWAWVec3f(0, 1, 0))
constructor
Definition: libmwaw_internal.hxx:1140
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::z
T z() const
third element
Definition: libmwaw_internal.hxx:814
MWAWVec3::add
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition: libmwaw_internal.hxx:855
libmwaw::DOC_CHART
Definition: libmwaw_internal.hxx:178
MWAWColor::getRed
unsigned char getRed() const
returns the red value
Definition: libmwaw_internal.hxx:255
MWAWVariable::MWAWVariable
MWAWVariable(T const &def)
constructor with a default value
Definition: libmwaw_internal.hxx:528
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:1039
MWAWColor::operator==
bool operator==(MWAWColor const &c) const
operator==
Definition: libmwaw_internal.hxx:275
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:1272
MWAWVec3< int >::Map
std::map< MWAWVec3< int >, int, struct PosSizeLt > Map
Definition: libmwaw_internal.hxx:947
MWAWGraphicStyle
a structure used to define a picture style
Definition: MWAWGraphicStyle.hxx:47
MWAWVec3::operator-=
MWAWVec3< T > & operator-=(MWAWVec3< T > const &p)
operator-=
Definition: libmwaw_internal.hxx:869
MWAWVariable::insert
void insert(MWAWVariable const &orig)
update the current value if orig is set
Definition: libmwaw_internal.hxx:548
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:896
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:1264
libmwaw::numberingTypeToString
std::string numberingTypeToString(NumberingType type)
Definition: libmwaw_internal.cxx:105
MWAWTransformation::operator>=
bool operator>=(MWAWTransformation const &mat) const
operator>=
Definition: libmwaw_internal.hxx:1238
libmwaw::VMiddle
Definition: libmwaw_internal.hxx:166
MWAWBox2::operator==
bool operator==(MWAWBox2< T > const &mat) const
operator==
Definition: libmwaw_internal.hxx:1087
MWAWVec2i
MWAWVec2< int > MWAWVec2i
MWAWVec2 of int.
Definition: libmwaw_internal.hxx:778
MWAWBorder::m_width
double m_width
the border total width in point
Definition: libmwaw_internal.hxx:357
libmwaw::Bottom
Definition: libmwaw_internal.hxx:166
MWAWVec2::MWAWVec2
MWAWVec2(MWAWVec2< U > const &p)
generic copy constructor
Definition: libmwaw_internal.hxx:609
MWAWVec2::operator-
friend MWAWVec2< T > operator-(MWAWVec2< T > const &p1, MWAWVec2< T > const &p2)
operator-
Definition: libmwaw_internal.hxx:688
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:674
MWAWBox2i
MWAWBox2< int > MWAWBox2i
MWAWBox2 of int.
Definition: libmwaw_internal.hxx:1129
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:652
libmwaw::Right
Definition: libmwaw_internal.hxx:166
MWAWVec2::operator[]
T & operator[](int c)
operator[]
Definition: libmwaw_internal.hxx:628
MWAWBox2::operator!=
bool operator!=(MWAWBox2< T > const &mat) const
operator!=
Definition: libmwaw_internal.hxx:1092
MWAWColor::getAlpha
unsigned char getAlpha() const
returns the alpha value
Definition: libmwaw_internal.hxx:245
MWAWVec3
small class which defines a vector with 3 elements
Definition: libmwaw_internal.hxx:787
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
libmwaw::WritingRightTop
Definition: libmwaw_internal.hxx:175
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
MWAWBox2::operator>=
bool operator>=(MWAWBox2< T > const &mat) const
operator>=
Definition: libmwaw_internal.hxx:1112
libmwaw::WrongPasswordException
Definition: libmwaw_internal.hxx:149
MWAWSubDocumentPtr
shared_ptr< MWAWSubDocument > MWAWSubDocumentPtr
a smart pointer of MWAWSubDocument
Definition: libmwaw_internal.hxx:514
MWAWVec3::operator-
friend MWAWVec3< T > operator-(MWAWVec3< T > const &p1, MWAWVec3< T > const &p2)
operator-
Definition: libmwaw_internal.hxx:889
MWAWField::MWAWField
MWAWField(Type type)
basic constructor
Definition: libmwaw_internal.hxx:374
MWAWTransformation::operator>
bool operator>(MWAWTransformation const &mat) const
operator>
Definition: libmwaw_internal.hxx:1233
MWAWVec3::operator[]
T & operator[](int c)
operator[]
Definition: libmwaw_internal.hxx:825
libmwaw::Left
Definition: libmwaw_internal.hxx:166
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
MWAWVec2::x
T x() const
first element
Definition: libmwaw_internal.hxx:612
libmwaw::UPPERCASE
Definition: libmwaw_internal.hxx:170
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:1253
MWAWVec2::m_y
T m_y
second element
Definition: libmwaw_internal.hxx:772
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
MWAWVec2::y
T y() const
second element
Definition: libmwaw_internal.hxx:617
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:964
libmwaw::WritingLeftBottom
Definition: libmwaw_internal.hxx:175
MWAWVariable::operator=
MWAWVariable & operator=(T const &val)
set a value
Definition: libmwaw_internal.hxx:541
MWAWTransformation::operator*
MWAWTransformation operator*(MWAWTransformation const &mat) const
operator* for transform
Definition: libmwaw_internal.hxx:1189
MWAWBox2::min
MWAWVec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:987
MWAWVec3::m_val
T m_val[3]
the values
Definition: libmwaw_internal.hxx:951
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:510
MWAWVariable::m_set
bool m_set
a flag to know if the variable is set or not
Definition: libmwaw_internal.hxx:596
libmwaw::DOC_TABLE
Definition: libmwaw_internal.hxx:178
MWAWVec2::cmpY
int cmpY(MWAWVec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:726
MWAWTransformation::isIdentity
bool isIdentity() const
returns true if the matrix is an identity matrix
Definition: libmwaw_internal.hxx:1145
MWAWBox2::size
MWAWVec2< T > size() const
the box size
Definition: libmwaw_internal.hxx:1005
MWAWVec2::setX
void setX(T xx)
resets the first element
Definition: libmwaw_internal.hxx:641
MWAWVec3::operator==
bool operator==(MWAWVec3< T > const &p) const
comparison==
Definition: libmwaw_internal.hxx:903
MWAWBox2::min
MWAWVec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:977
MWAWEmbeddedObject::MWAWEmbeddedObject
MWAWEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
constructor
Definition: libmwaw_internal.hxx:431
MWAWTransformation::operator<
bool operator<(MWAWTransformation const &mat) const
operator<
Definition: libmwaw_internal.hxx:1223
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:782
MWAWSpreadsheetListenerPtr
shared_ptr< MWAWSpreadsheetListener > MWAWSpreadsheetListenerPtr
a smart pointer of MWAWSpreadsheetListener
Definition: libmwaw_internal.hxx:512
libmwaw::BULLET
Definition: libmwaw_internal.hxx:170
MWAWVariable::operator=
MWAWVariable & operator=(MWAWVariable const &orig)
copy operator
Definition: libmwaw_internal.hxx:532
MWAWVec3f
MWAWVec3< float > MWAWVec3f
MWAWVec3 of float.
Definition: libmwaw_internal.hxx:959
MWAWVec2::operator!=
bool operator!=(MWAWVec2< T > const &p) const
comparison!=
Definition: libmwaw_internal.hxx:707
MWAWVec2::operator+=
MWAWVec2< T > & operator+=(MWAWVec2< T > const &p)
operator+=
Definition: libmwaw_internal.hxx:659
MWAWBox2::MWAWBox2
MWAWBox2(MWAWBox2< U > const &p)
generic constructor
Definition: libmwaw_internal.hxx:972
MWAWVec2b
MWAWVec2< bool > MWAWVec2b
MWAWVec2 of bool.
Definition: libmwaw_internal.hxx:776
libmwaw::LOWERCASE
Definition: libmwaw_internal.hxx:170
MWAWSubDocument
abstract class used to store a subdocument (with a comparison function)
Definition: MWAWSubDocument.hxx:41
MWAWVec3::x
T x() const
first element
Definition: libmwaw_internal.hxx:804
MWAWColor::operator!=
bool operator!=(MWAWColor const &c) const
operator!=
Definition: libmwaw_internal.hxx:280
MWAWTransformation::operator*
MWAWVec2f operator*(MWAWVec2f const &pt) const
operator* for vec2f
Definition: libmwaw_internal.hxx:1163
MWAWTransformation::m_data
std::pair< MWAWVec3f, MWAWVec3f > m_data
the data
Definition: libmwaw_internal.hxx:1270
MWAWColor::operator>=
bool operator>=(MWAWColor const &c) const
operator>=
Definition: libmwaw_internal.hxx:300
MWAWListManager
a manager which manages the lists, keeps the different kind of lists, to assure the unicity of each l...
Definition: MWAWList.hxx:195
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:937
MWAWEmbeddedObject::m_typeList
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition: libmwaw_internal.hxx:467
MWAWBox2::getUnion
MWAWBox2< T > getUnion(MWAWBox2< T > const &box) const
returns the union between this and box
Definition: libmwaw_internal.hxx:1067
MWAWVec3::setX
void setX(T xx)
resets the first element
Definition: libmwaw_internal.hxx:839
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:1044
LIBMWAW_ATTRIBUTE_PRINTF
#define LIBMWAW_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libmwaw_internal.hxx:116
MWAWTransformation::operator==
bool operator==(MWAWTransformation const &mat) const
operator==
Definition: libmwaw_internal.hxx:1213
libmwaw::FileException
Definition: libmwaw_internal.hxx:137
libmwaw::DOC_SHEET
Definition: libmwaw_internal.hxx:178
libmwaw::WritingLeftTop
Definition: libmwaw_internal.hxx:175
MWAWTransformation::checkIdentity
void checkIdentity() const
check if a matrix is the identity matrix
Definition: libmwaw_internal.hxx:1150
MWAWBox2::getIntersection
MWAWBox2< T > getIntersection(MWAWBox2< T > const &box) const
returns the intersection between this and box
Definition: libmwaw_internal.hxx:1077
MWAWSection
a class which stores section properties
Definition: MWAWSection.hxx:45
MWAWColor::getBlue
unsigned char getBlue() const
returns the green value
Definition: libmwaw_internal.hxx:250
MWAWVec3::MWAWVec3
MWAWVec3(MWAWVec3< U > const &p)
generic copy constructor
Definition: libmwaw_internal.hxx:798
MWAWInputStreamPtr
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:500
MWAWTransformation::operator*
MWAWBox2f operator*(MWAWBox2f const &box) const
operator* for box2f
Definition: libmwaw_internal.hxx:1183
MWAWBorder::operator!=
bool operator!=(MWAWBorder const &orig) const
operator!=
Definition: libmwaw_internal.hxx:337
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:968
MWAWVec2::operator+
friend MWAWVec2< T > operator+(MWAWVec2< T > const &p1, MWAWVec2< T > const &p2)
operator+
Definition: libmwaw_internal.hxx:682
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:883
MWAWFontConverter
a namespace used to convert Mac font characters in unicode
Definition: MWAWFontConverter.hxx:62
MWAWColor::getGreen
unsigned char getGreen() const
returns the green value
Definition: libmwaw_internal.hxx:260
MWAWGraphicListenerPtr
shared_ptr< MWAWGraphicListener > MWAWGraphicListenerPtr
a smart pointer of MWAWGraphicListener
Definition: libmwaw_internal.hxx:498
MWAWVec3::setZ
void setZ(T zz)
resets the third element
Definition: libmwaw_internal.hxx:849
MWAWVec3uc
MWAWVec3< unsigned char > MWAWVec3uc
MWAWVec3 of unsigned char.
Definition: libmwaw_internal.hxx:955
MWAWBox2::max
MWAWVec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:992
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:791
MWAWFontConverterPtr
shared_ptr< MWAWFontConverter > MWAWFontConverterPtr
a smart pointer of MWAWFontConverter
Definition: libmwaw_internal.hxx:494
libmwaw::ARABIC
Definition: libmwaw_internal.hxx:170
MWAWBox2::m_data
std::pair< MWAWVec2< T >, MWAWVec2< T > > m_data
the data
Definition: libmwaw_internal.hxx:1125
MWAWVec2::PosSizeLtY
internal struct used to create sorted map, sorted by Y
Definition: libmwaw_internal.hxx:760
MWAWBox2f
MWAWBox2< float > MWAWBox2f
MWAWBox2 of float.
Definition: libmwaw_internal.hxx:1131
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
MWAWTransformation::operator<=
bool operator<=(MWAWTransformation const &mat) const
operator<=
Definition: libmwaw_internal.hxx:1228
MWAWBox2::setMax
void setMax(MWAWVec2< T > const &y)
resets the maximum point
Definition: libmwaw_internal.hxx:1028
MWAWVariable::setSet
void setSet(bool newVal)
define if the variable is set
Definition: libmwaw_internal.hxx:588
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
MWAWBox2::max
MWAWVec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:982
MWAWVec2< bool >::MapY
std::map< MWAWVec2< bool >, bool, struct PosSizeLtY > MapY
Definition: libmwaw_internal.hxx:770
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:530
MWAWColor::operator<=
bool operator<=(MWAWColor const &c) const
operator<=
Definition: libmwaw_internal.hxx:290
libmwaw::DOC_HEADER_FOOTER
Definition: libmwaw_internal.hxx:178
MWAWParserStatePtr
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:506
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
MWAWColor::isWhite
bool isWhite() const
return true if the color is white
Definition: libmwaw_internal.hxx:270
MWAWNote
a note
Definition: libmwaw_internal.hxx:406
MWAWParser
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:97
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
MWAWColor::isBlack
bool isBlack() const
return true if the color is black
Definition: libmwaw_internal.hxx:265
MWAWVec2l
MWAWVec2< long > MWAWVec2l
MWAWVec2 of long.
Definition: libmwaw_internal.hxx:780
MWAWVec2::PosSizeLtY::operator()
bool operator()(MWAWVec2< T > const &s1, MWAWVec2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:762
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:1206
MWAW_shared_ptr_noop_deleter::operator()
void operator()(T *)
Definition: libmwaw_internal.hxx:110
MWAWVec2::m_x
T m_x
first element
Definition: libmwaw_internal.hxx:772
MWAWBox2::scale
void scale(U factor)
scales all points of the box by factor
Definition: libmwaw_internal.hxx:1053
MWAWBox2l
MWAWBox2< long > MWAWBox2l
MWAWBox2 of long.
Definition: libmwaw_internal.hxx:1133
libmwaw::WritingRightBottom
Definition: libmwaw_internal.hxx:175
MWAWList
a small structure used to store the informations about a list
Definition: MWAWList.hxx:105
MWAWTransformation::multiplyDirection
MWAWVec2f multiplyDirection(MWAWVec2f const &dir) const
operator* for direction
Definition: libmwaw_internal.hxx:1169
MWAWRSRCParser
the main class to read a Mac resource fork
Definition: MWAWRSRCParser.hxx:46
libmwaw::LeftBit
Definition: libmwaw_internal.hxx:168
MWAWColor::value
uint32_t value() const
return the rgba value
Definition: libmwaw_internal.hxx:240
MWAWBorder::m_color
MWAWColor m_color
the border color
Definition: libmwaw_internal.hxx:363
MWAWVec3::operator+=
MWAWVec3< T > & operator+=(MWAWVec3< T > const &p)
operator+=
Definition: libmwaw_internal.hxx:863
MWAWField::m_numberingType
libmwaw::NumberingType m_numberingType
the number type ( for number field )
Definition: libmwaw_internal.hxx:384
MWAWVariable::isSet
bool isSet() const
return true if the variable is set
Definition: libmwaw_internal.hxx:583
libmwaw::DOC_COMMENT_ANNOTATION
Definition: libmwaw_internal.hxx:178
MWAWVec3::operator[]
T operator[](int c) const
operator[]
Definition: libmwaw_internal.hxx:819
MWAWTransformation::operator[]
MWAWVec3f const & operator[](int c) const
the two extremum points which defined the box
Definition: libmwaw_internal.hxx:1157
MWAWVariable::MWAWVariable
MWAWVariable()
constructor
Definition: libmwaw_internal.hxx:526
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:695
MWAWVec2::PosSizeLtX
internal struct used to create sorted map, sorted by X
Definition: libmwaw_internal.hxx:745
MWAWVariable
a generic variable template: value + flag to know if the variable is set
Definition: libmwaw_internal.hxx:524
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:918
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:1034
MWAWTextListenerPtr
shared_ptr< MWAWTextListener > MWAWTextListenerPtr
a smart pointer of MWAWTextListener
Definition: libmwaw_internal.hxx:516
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:556
MWAWTransformation
a transformation which stored the first row of a 3x3 perspective matrix
Definition: libmwaw_internal.hxx:1136
MWAWVec2::PosSizeLtX::operator()
bool operator()(MWAWVec2< T > const &s1, MWAWVec2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:747
libmwaw::VersionException
Definition: libmwaw_internal.hxx:133
MWAWVec2
small class which defines a vector with 2 elements
Definition: libmwaw_internal.hxx:603
MWAWBox2::center
MWAWVec2< T > center() const
the box center
Definition: libmwaw_internal.hxx:1010
MWAWListManagerPtr
shared_ptr< MWAWListManager > MWAWListManagerPtr
a smart pointer of MWAWListManager
Definition: libmwaw_internal.hxx:504
MWAWVec3::setY
void setY(T yy)
resets the second element
Definition: libmwaw_internal.hxx:844
MWAWBox2::setMin
void setMin(MWAWVec2< T > const &x)
resets the minimum point
Definition: libmwaw_internal.hxx:1023
MWAWVec3::y
T y() const
second element
Definition: libmwaw_internal.hxx:809
MWAWBorder::isEmpty
bool isEmpty() const
returns true if the border is empty
Definition: libmwaw_internal.hxx:327