libwps_internal.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* libwps
3 * Version: MPL 2.0 / LGPLv2.1+
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * Major Contributor(s):
10 * Copyright (C) 2002 William Lachance (william.lachance@sympatico.ca)
11 * Copyright (C) 2002,2004 Marc Maurer (uwog@uwog.net)
12 *
13 * For minor contributions see the git repository.
14 *
15 * Alternatively, the contents of this file may be used under the terms
16 * of the GNU Lesser General Public License Version 2.1 or later
17 * (LGPLv2.1+), in which case the provisions of the LGPLv2.1+ are
18 * applicable instead of those above.
19 *
20 * For further information visit http://libwps.sourceforge.net
21 */
22
23 #ifndef LIBWPS_INTERNAL_H
24 #define LIBWPS_INTERNAL_H
25
26 #include <assert.h>
27 #ifdef DEBUG
28 #include <stdio.h>
29 #endif
30
31 #include <algorithm>
32 #include <cmath>
33 #include <iostream>
34 #include <map>
35 #include <string>
36 #include <vector>
37
38 #include <librevenge-stream/librevenge-stream.h>
39 #include <librevenge/librevenge.h>
40
41 #ifndef M_PI
42 #define M_PI 3.14159265358979323846
43 #endif
44
45 #if defined(_MSC_VER) || defined(__DJGPP__)
46 typedef signed char int8_t;
47 typedef unsigned char uint8_t;
48 typedef signed short int16_t;
49 typedef unsigned short uint16_t;
50 typedef signed int int32_t;
51 typedef unsigned int uint32_t;
52 #else /* !_MSC_VER && !__DJGPP__*/
53 # include <inttypes.h>
54 #endif /* _MSC_VER || __DJGPP__*/
55
56 /* ---------- memory --------------- */
57 #ifdef HAVE_CONFIG_H
58 # include "config.h"
59 #endif
60
61 // define localtime_r on Windows, so that can use
62 // thread-safe functions on other environments
63 #ifdef _WIN32
64 # define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
65 # define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0)
66 #endif
67
68 #if defined(SHAREDPTR_TR1)
69 #include <tr1/memory>
70 using std::tr1::shared_ptr;
71 #elif defined(SHAREDPTR_STD)
72 #include <memory>
73 using std::shared_ptr;
74 #else
75 #include <boost/shared_ptr.hpp>
76 using boost::shared_ptr;
77 #endif
78
80 template <class T>
81 struct WPS_shared_ptr_noop_deleter
82 {
83 void operator()(T *) {}
84 };
85
86 // basic classes and autoptr
88 typedef shared_ptr<librevenge::RVNGInputStream> RVNGInputStreamPtr;
89
90 struct WPSStream;
91 class WPSCell;
92 class WPSListener;
93 class WPSContentListener;
94 class WPSEntry;
95 class WPSFont;
96 class WPSHeader;
97 class WPSPosition;
98 class WPSSubDocument;
99
100 class WKSContentListener;
101 class WKSSubDocument;
102
104 typedef shared_ptr<WPSCell> WPSCellPtr;
106 typedef shared_ptr<WPSListener> WPSListenerPtr;
108 typedef shared_ptr<WPSContentListener> WPSContentListenerPtr;
110 typedef shared_ptr<WPSHeader> WPSHeaderPtr;
112 typedef shared_ptr<WPSSubDocument> WPSSubDocumentPtr;
113
115 typedef shared_ptr<WKSContentListener> WKSContentListenerPtr;
117 typedef shared_ptr<WKSSubDocument> WKSSubDocumentPtr;
118
119 #if defined(__clang__) || defined(__GNUC__)
120 # define WPS_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((__format__(__printf__, fmt, arg)))
121 #else
122 # define WPS_ATTRIBUTE_PRINTF(fmt, arg)
123 #endif
124 /* ---------- debug --------------- */
125 #ifdef DEBUG
126 namespace libwps
127 {
128 void printDebugMsg(const char *format, ...) WPS_ATTRIBUTE_PRINTF(1, 2);
129 }
130 #define WPS_DEBUG_MSG(M) libwps::printDebugMsg M
131 #else
132 #define WPS_DEBUG_MSG(M)
133 #endif
134
135 /* ---------- exception ------------ */
136 namespace libwps
137 {
138 // Various exceptions
139 class VersionException
140 {
141 // needless to say, we could flesh this class out a bit
142 };
143
144 class FileException
145 {
146 // needless to say, we could flesh this class out a bit
147 };
148
149 class ParseException
150 {
151 // needless to say, we could flesh this class out a bit
152 };
153
154 class PasswordException
155 {
156 // needless to say, we could flesh this class out a bit
157 };
158
159 class GenericException
160 {
161 // needless to say, we could flesh this class out a bit
162 };
163 }
164
165 /* ---------- input ----------------- */
166 namespace libwps
167 {
168 uint8_t readU8(librevenge::RVNGInputStream *input);
169 uint16_t readU16(librevenge::RVNGInputStream *input);
170 uint32_t readU32(librevenge::RVNGInputStream *input);
171
172 int8_t read8(librevenge::RVNGInputStream *input);
173 int16_t read16(librevenge::RVNGInputStream *input);
174 int32_t read32(librevenge::RVNGInputStream *input);
175
176 inline uint8_t readU8(RVNGInputStreamPtr &input)
177 {
178 return readU8(input.get());
179 }
180 inline uint16_t readU16(RVNGInputStreamPtr &input)
181 {
182 return readU16(input.get());
183 }
184 inline uint32_t readU32(RVNGInputStreamPtr &input)
185 {
186 return readU32(input.get());
187 }
188
189 inline int8_t read8(RVNGInputStreamPtr &input)
190 {
191 return read8(input.get());
192 }
193 inline int16_t read16(RVNGInputStreamPtr &input)
194 {
195 return read16(input.get());
196 }
197 inline int32_t read32(RVNGInputStreamPtr &input)
198 {
199 return read32(input.get());
200 }
201
203 bool readDouble4(RVNGInputStreamPtr &input, double &res, bool &isNaN);
205 bool readDouble8(RVNGInputStreamPtr &input, double &res, bool &isNaN);
207 bool readDouble10(RVNGInputStreamPtr &input, double &res, bool &isNaN);
209 bool readDouble2Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN);
211 bool readDouble4Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN);
212
214 bool readData(RVNGInputStreamPtr &input, unsigned long sz, librevenge::RVNGBinaryData &data);
216 bool readDataToEnd(RVNGInputStreamPtr &input, librevenge::RVNGBinaryData &data);
218 void appendUnicode(uint32_t val, librevenge::RVNGString &buffer);
219 }
220
221 #define WPS_LE_GET_GUINT16(p) \
222 (uint16_t)((((uint8_t const *)(p))[0] << 0) | \
223 (((uint8_t const *)(p))[1] << 8))
224 #define WPS_LE_GET_GUINT32(p) \
225 (uint32_t)((((uint8_t const *)(p))[0] << 0) | \
226 (((uint8_t const *)(p))[1] << 8) | \
227 (((uint8_t const *)(p))[2] << 16) | \
228 (((uint8_t const *)(p))[3] << 24))
229
230 #define WPS_LE_PUT_GUINT16(p, v) \
231 *((uint8_t*)(p)) = uint8_t(v); \
232 *(((uint8_t*)(p)) + 1) = uint8_t((v) >> 8)
233
234 #define WPS_LE_PUT_GUINT32(p, v) \
235 *((uint8_t*)(p)) = uint8_t(v); \
236 *(((uint8_t*)(p)) + 1) = uint8_t((v) >> 8); \
237 *(((uint8_t*)(p)) + 2) = uint8_t((v) >> 16); \
238 *(((uint8_t*)(p)) + 3) = uint8_t((v) >> 24)
239
240 // Various helper structures for the parser..
241 /* ---------- small enum/class ------------- */
242 namespace libwps
243 {
244 enum NumberingType { NONE, BULLET, ARABIC, LOWERCASE, UPPERCASE, LOWERCASE_ROMAN, UPPERCASE_ROMAN };
245 std::string numberingTypeToString(NumberingType type);
246 enum SubDocumentType { DOC_NONE, DOC_HEADER_FOOTER, DOC_NOTE, DOC_TABLE, DOC_TEXT_BOX, DOC_COMMENT_ANNOTATION };
247 enum Justification { JustificationLeft, JustificationFull, JustificationCenter,
248 JustificationRight, JustificationFullAllLines
249 };
250 enum { NoBreakBit = 0x1, NoBreakWithNextBit=0x2};
251 }
252
253 struct WPSColumnDefinition
254 {
255 WPSColumnDefinition() : m_width(0), m_leftGutter(0), m_rightGutter(0)
256 {
257 }
258 double m_width;
259 double m_leftGutter;
260 double m_rightGutter;
261 };
262
263 struct WPSColumnProperties
264 {
265 WPSColumnProperties() : m_attributes(0), m_alignment(0)
266 {
267 }
268 uint32_t m_attributes;
269 uint8_t m_alignment;
270 };
271
273 struct WPSColor
274 {
276 explicit WPSColor(uint32_t argb=0) : m_value(argb)
277 {
278 }
280 WPSColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) :
281 m_value(uint32_t((a<<24)+(r<<16)+(g<<8)+b))
282 {
283 }
285 WPSColor &operator=(uint32_t argb)
286 {
287 m_value = argb;
288 return *this;
289 }
291 static WPSColor black()
292 {
293 return WPSColor(0,0,0);
294 }
296 static WPSColor white()
297 {
298 return WPSColor(255,255,255);
299 }
300
302 static WPSColor barycenter(float alpha, WPSColor const &colA,
303 float beta, WPSColor const &colB);
305 uint32_t value() const
306 {
307 return m_value;
308 }
310 unsigned char getAlpha() const
311 {
312 return (unsigned char)((m_value>>24)&0xFF);
313 }
315 unsigned char getBlue() const
316 {
317 return (unsigned char)(m_value&0xFF);
318 }
320 unsigned char getRed() const
321 {
322 return (unsigned char)((m_value>>16)&0xFF);
323 }
325 unsigned char getGreen() const
326 {
327 return (unsigned char)((m_value>>8)&0xFF);
328 }
330 bool isBlack() const
331 {
332 return (m_value&0xFFFFFF)==0;
333 }
335 bool isWhite() const
336 {
337 return (m_value&0xFFFFFF)==0xFFFFFF;
338 }
340 bool operator==(WPSColor const &c) const
341 {
342 return (c.m_value&0xFFFFFF)==(m_value&0xFFFFFF);
343 }
345 bool operator!=(WPSColor const &c) const
346 {
347 return !operator==(c);
348 }
350 bool operator<(WPSColor const &c) const
351 {
352 return (c.m_value&0xFFFFFF)<(m_value&0xFFFFFF);
353 }
355 bool operator<=(WPSColor const &c) const
356 {
357 return (c.m_value&0xFFFFFF)<=(m_value&0xFFFFFF);
358 }
360 bool operator>(WPSColor const &c) const
361 {
362 return !operator<=(c);
363 }
365 bool operator>=(WPSColor const &c) const
366 {
367 return !operator<(c);
368 }
370 friend std::ostream &operator<< (std::ostream &o, WPSColor const &c);
372 std::string str() const;
373 protected:
375 uint32_t m_value;
376 };
377
379 struct WPSBorder
380 {
382 enum Style { None, Simple, Dot, LargeDot, Dash };
384 enum Type { Single, Double, Triple };
385 enum Pos { Left = 0, Right = 1, Top = 2, Bottom = 3 };
386 enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08 };
387
389 WPSBorder() : m_style(Simple), m_type(Single), m_width(1), m_widthsList(), m_color(WPSColor::black()), m_extra("") { }
393 bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const;
395 bool isEmpty() const
396 {
397 return m_style==None || m_width <= 0;
398 }
399
401 bool operator==(WPSBorder const &orig) const
402 {
403 return m_style == orig.m_style && m_type == orig.m_type && m_width == orig.m_width
404 && m_color == orig.m_color;
405 }
407 bool operator!=(WPSBorder const &orig) const
408 {
409 return !operator==(orig);
410 }
412 int compare(WPSBorder const &orig) const;
413
415 friend std::ostream &operator<< (std::ostream &o, WPSBorder const &border);
417 friend std::ostream &operator<< (std::ostream &o, WPSBorder::Style const &style);
419 Style m_style;
421 Type m_type;
423 int m_width;
427 std::vector<double> m_widthsList;
429 WPSColor m_color;
431 std::string m_extra;
432 };
433
438 struct WPSEmbeddedObject
439 {
441 WPSEmbeddedObject() : m_dataList(), m_typeList()
442 {
443 }
445 WPSEmbeddedObject(librevenge::RVNGBinaryData const &binaryData,
446 std::string type="image/pict") : m_dataList(), m_typeList()
447 {
448 add(binaryData, type);
449 }
451 virtual ~WPSEmbeddedObject()
452 {
453 }
455 bool isEmpty() const
456 {
457 for (size_t i=0; i<m_dataList.size(); ++i)
458 {
459 if (!m_dataList[i].empty())
460 return false;
461 }
462 return true;
463 }
465 void add(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
466 {
467 size_t pos=m_dataList.size();
468 if (pos<m_typeList.size()) pos=m_typeList.size();
469 m_dataList.resize(pos+1);
470 m_dataList[pos]=binaryData;
471 m_typeList.resize(pos+1);
472 m_typeList[pos]=type;
473 }
475 bool addTo(librevenge::RVNGPropertyList &propList) const;
477 friend std::ostream &operator<<(std::ostream &o, WPSEmbeddedObject const &pict);
478
480 std::vector<librevenge::RVNGBinaryData> m_dataList;
482 std::vector<std::string> m_typeList;
483 };
484
486 struct WPSField
487 {
489 enum Type { None, Database, Date, Link, PageCount, PageNumber, PageNumberNext, Time, Title };
490
492 explicit WPSField(Type type) : m_type(type), m_DTFormat(""), m_numberingType(libwps::ARABIC), m_data("")
493 {
494 }
496 bool addTo(librevenge::RVNGPropertyList &propList) const;
498 librevenge::RVNGString getString() const;
500 Type m_type;
502 std::string m_DTFormat;
504 libwps::NumberingType m_numberingType;
506 std::string m_data;
507 };
508
509 // ATTRIBUTE bits
510 #define WPS_EXTRA_LARGE_BIT 1
511 #define WPS_VERY_LARGE_BIT 2
512 #define WPS_LARGE_BIT 4
513 #define WPS_SMALL_PRINT_BIT 8
514 #define WPS_FINE_PRINT_BIT 0x10
515 #define WPS_SUPERSCRIPT_BIT 0x20
516 #define WPS_SUBSCRIPT_BIT 0x40
517 #define WPS_OUTLINE_BIT 0x80
518 #define WPS_ITALICS_BIT 0x100
519 #define WPS_SHADOW_BIT 0x200
520 #define WPS_REDLINE_BIT 0x400
521 #define WPS_DOUBLE_UNDERLINE_BIT 0x800
522 #define WPS_BOLD_BIT 0x1000
523 #define WPS_STRIKEOUT_BIT 0x2000
524 #define WPS_UNDERLINE_BIT 0x4000
525 #define WPS_SMALL_CAPS_BIT 0x8000
526 #define WPS_BLINK_BIT 0x10000L
527 #define WPS_REVERSEVIDEO_BIT 0x20000L
528 #define WPS_ALL_CAPS_BIT 0x40000L
529 #define WPS_EMBOSS_BIT 0x80000L
530 #define WPS_ENGRAVE_BIT 0x100000L
531 #define WPS_OVERLINE_BIT 0x400000L
532 #define WPS_HIDDEN_BIT 0x800000L
533
534 // BREAK bits
535 #define WPS_PAGE_BREAK 0x00
536 #define WPS_SOFT_PAGE_BREAK 0x01
537 #define WPS_COLUMN_BREAK 0x02
538
539 // Generic bits
540 #define WPS_LEFT 0x00
541 #define WPS_RIGHT 0x01
542 #define WPS_CENTER 0x02
543 #define WPS_TOP 0x03
544 #define WPS_BOTTOM 0x04
545
546 /* ---------- vec2/box2f ------------- */
550 template <class T> class Vec2
551 {
552 public:
554 Vec2(T xx=0,T yy=0) : m_x(xx), m_y(yy) { }
556 template <class U> Vec2(Vec2<U> const &p) : m_x(T(p.x())), m_y(T(p.y())) {}
557
559 T x() const
560 {
561 return m_x;
562 }
564 T y() const
565 {
566 return m_y;
567 }
569 T operator[](int c) const
570 {
571 if (c<0 || c>1) throw libwps::GenericException();
572 return (c==0) ? m_x : m_y;
573 }
575 T &operator[](int c)
576 {
577 if (c<0 || c>1) throw libwps::GenericException();
578 return (c==0) ? m_x : m_y;
579 }
580
582 void set(T xx, T yy)
583 {
584 m_x = xx;
585 m_y = yy;
586 }
588 void setX(T xx)
589 {
590 m_x = xx;
591 }
593 void setY(T yy)
594 {
595 m_y = yy;
596 }
597
599 void add(T dx, T dy)
600 {
601 m_x += dx;
602 m_y += dy;
603 }
604
606 Vec2<T> &operator+=(Vec2<T> const &p)
607 {
608 m_x += p.m_x;
609 m_y += p.m_y;
610 return *this;
611 }
613 Vec2<T> &operator-=(Vec2<T> const &p)
614 {
615 m_x -= p.m_x;
616 m_y -= p.m_y;
617 return *this;
618 }
620 template <class U>
621 Vec2<T> &operator*=(U scale)
622 {
623 m_x = T(m_x*scale);
624 m_y = T(m_y*scale);
625 return *this;
626 }
627
629 friend Vec2<T> operator+(Vec2<T> const &p1, Vec2<T> const &p2)
630 {
631 Vec2<T> p(p1);
632 return p+=p2;
633 }
635 friend Vec2<T> operator-(Vec2<T> const &p1, Vec2<T> const &p2)
636 {
637 Vec2<T> p(p1);
638 return p-=p2;
639 }
641 template <class U>
642 friend Vec2<T> operator*(U scale, Vec2<T> const &p1)
643 {
644 Vec2<T> p(p1);
645 return p *= scale;
646 }
647
649 bool operator==(Vec2<T> const &p) const
650 {
651 return cmpY(p) == 0;
652 }
654 bool operator!=(Vec2<T> const &p) const
655 {
656 return cmpY(p) != 0;
657 }
659 bool operator<(Vec2<T> const &p) const
660 {
661 return cmpY(p) < 0;
662 }
664 int cmp(Vec2<T> const &p) const
665 {
666 if (m_x<p.m_x) return -1;
667 if (m_x>p.m_x) return 1;
668 if (m_y<p.m_y) return -1;
669 if (m_y>p.m_y) return 1;
670 return 0;
671 }
673 int cmpY(Vec2<T> const &p) const
674 {
675 if (m_y<p.m_y) return -1;
676 if (m_y>p.m_y) return 1;
677 if (m_x<p.m_x) return -1;
678 if (m_x>p.m_x) return 1;
679 return 0;
680 }
681
683 friend std::ostream &operator<< (std::ostream &o, Vec2<T> const &f)
684 {
685 o << f.m_x << "x" << f.m_y;
686 return o;
687 }
688
692 struct PosSizeLtX
693 {
695 bool operator()(Vec2<T> const &s1, Vec2<T> const &s2) const
696 {
697 return s1.cmp(s2) < 0;
698 }
699 };
700
704 struct PosSizeLtY
705 {
707 bool operator()(Vec2<T> const &s1, Vec2<T> const &s2) const
708 {
709 return s1.cmpY(s2) < 0;
710 }
711 };
712 protected:
713 T m_x, m_y;
714 };
715
717 typedef Vec2<bool> Vec2b;
719 typedef Vec2<int> Vec2i;
721 typedef Vec2<float> Vec2f;
722
726 template <class T> class WPSBox2
727 {
728 public:
730 WPSBox2(Vec2<T> minPt=Vec2<T>(), Vec2<T> maxPt=Vec2<T>())
731 {
732 m_pt[0] = minPt;
733 m_pt[1] = maxPt;
734 }
736 template <class U> WPSBox2(WPSBox2<U> const &p)
737 {
738 for (int c=0; c < 2; c++) m_pt[c] = p[c];
739 }
740
742 Vec2<T> const &min() const
743 {
744 return m_pt[0];
745 }
747 Vec2<T> const &max() const
748 {
749 return m_pt[1];
750 }
752 Vec2<T> &min()
753 {
754 return m_pt[0];
755 }
757 Vec2<T> &max()
758 {
759 return m_pt[1];
760 }
761
765 Vec2<T> const &operator[](int c) const
766 {
767 if (c<0 || c>1) throw libwps::GenericException();
768 return m_pt[c];
769 }
771 Vec2<T> size() const
772 {
773 return m_pt[1]-m_pt[0];
774 }
776 Vec2<T> center() const
777 {
778 return 0.5*(m_pt[0]+m_pt[1]);
779 }
780
782 void set(Vec2<T> const &x, Vec2<T> const &y)
783 {
784 m_pt[0] = x;
785 m_pt[1] = y;
786 }
788 void setMin(Vec2<T> const &x)
789 {
790 m_pt[0] = x;
791 }
793 void setMax(Vec2<T> const &y)
794 {
795 m_pt[1] = y;
796 }
797
799 void resizeFromMin(Vec2<T> const &sz)
800 {
801 m_pt[1] = m_pt[0]+sz;
802 }
804 void resizeFromMax(Vec2<T> const &sz)
805 {
806 m_pt[0] = m_pt[1]-sz;
807 }
809 void resizeFromCenter(Vec2<T> const &sz)
810 {
811 Vec2<T> ctr = 0.5*(m_pt[0]+m_pt[1]);
812 m_pt[0] = ctr - 0.5*sz;
813 m_pt[1] = ctr + (sz - 0.5*sz);
814 }
815
817 template <class U> void scale(U factor)
818 {
819 m_pt[0] *= factor;
820 m_pt[1] *= factor;
821 }
822
824 void extend(T val)
825 {
826 m_pt[0] -= Vec2<T>(val/2,val/2);
827 m_pt[1] += Vec2<T>(val-(val/2),val-(val/2));
828 }
830 WPSBox2<T> getUnion(WPSBox2<T> const &box) const
831 {
832 WPSBox2<T> res;
833 res.m_pt[0]=Vec2<T>(m_pt[0][0]<box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
834 m_pt[0][1]<box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
835 res.m_pt[1]=Vec2<T>(m_pt[1][0]>box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
836 m_pt[1][1]>box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
837 return res;
838 }
840 WPSBox2<T> getIntersection(WPSBox2<T> const &box) const
841 {
842 WPSBox2<T> res;
843 res.m_pt[0]=Vec2<T>(m_pt[0][0]>box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
844 m_pt[0][1]>box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
845 res.m_pt[1]=Vec2<T>(m_pt[1][0]<box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
846 m_pt[1][1]<box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
847 return res;
848 }
849
851 bool operator==(WPSBox2<T> const &p) const
852 {
853 return cmp(p) == 0;
854 }
856 bool operator!=(WPSBox2<T> const &p) const
857 {
858 return cmp(p) != 0;
859 }
861 bool operator<(WPSBox2<T> const &p) const
862 {
863 return cmp(p) < 0;
864 }
865
867 int cmp(WPSBox2<T> const &p) const
868 {
869 int diff = m_pt[0].cmpY(p.m_pt[0]);
870 if (diff) return diff;
871 diff = m_pt[1].cmpY(p.m_pt[1]);
872 if (diff) return diff;
873 return 0;
874 }
875
877 friend std::ostream &operator<< (std::ostream &o, WPSBox2<T> const &f)
878 {
879 o << "(" << f.m_pt[0] << "<->" << f.m_pt[1] << ")";
880 return o;
881 }
882
886 struct PosSizeLt
887 {
889 bool operator()(WPSBox2<T> const &s1, WPSBox2<T> const &s2) const
890 {
891 return s1.cmp(s2) < 0;
892 }
893 };
897 typedef std::map<WPSBox2<T>, T,struct PosSizeLt> Map;
898
899 protected:
901 Vec2<T> m_pt[2];
902 };
903
905 typedef WPSBox2<int> WPSBox2i;
907 typedef WPSBox2<float> WPSBox2f;
908
912 template <class T> class WPSVec3
913 {
914 public:
916 explicit WPSVec3(T xx=0,T yy=0,T zz=0)
917 {
918 m_val[0] = xx;
919 m_val[1] = yy;
920 m_val[2] = zz;
921 }
923 template <class U> WPSVec3(WPSVec3<U> const &p)
924 {
925 for (int c = 0; c < 3; c++) m_val[c] = T(p[c]);
926 }
927
929 T x() const
930 {
931 return m_val[0];
932 }
934 T y() const
935 {
936 return m_val[1];
937 }
939 T z() const
940 {
941 return m_val[2];
942 }
944 T operator[](int c) const
945 {
946 if (c<0 || c>2) throw libwps::GenericException();
947 return m_val[c];
948 }
950 T &operator[](int c)
951 {
952 if (c<0 || c>2) throw libwps::GenericException();
953 return m_val[c];
954 }
955
957 void set(T xx, T yy, T zz)
958 {
959 m_val[0] = xx;
960 m_val[1] = yy;
961 m_val[2] = zz;
962 }
964 void setX(T xx)
965 {
966 m_val[0] = xx;
967 }
969 void setY(T yy)
970 {
971 m_val[1] = yy;
972 }
974 void setZ(T zz)
975 {
976 m_val[2] = zz;
977 }
978
980 void add(T dx, T dy, T dz)
981 {
982 m_val[0] += dx;
983 m_val[1] += dy;
984 m_val[2] += dz;
985 }
986
988 WPSVec3<T> &operator+=(WPSVec3<T> const &p)
989 {
990 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]);
991 return *this;
992 }
994 WPSVec3<T> &operator-=(WPSVec3<T> const &p)
995 {
996 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]-p.m_val[c]);
997 return *this;
998 }
1000 template <class U>
1001 WPSVec3<T> &operator*=(U scale)
1002 {
1003 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]*scale);
1004 return *this;
1005 }
1006
1008 friend WPSVec3<T> operator+(WPSVec3<T> const &p1, WPSVec3<T> const &p2)
1009 {
1010 WPSVec3<T> p(p1);
1011 return p+=p2;
1012 }
1014 friend WPSVec3<T> operator-(WPSVec3<T> const &p1, WPSVec3<T> const &p2)
1015 {
1016 WPSVec3<T> p(p1);
1017 return p-=p2;
1018 }
1020 template <class U>
1021 friend WPSVec3<T> operator*(U scale, WPSVec3<T> const &p1)
1022 {
1023 WPSVec3<T> p(p1);
1024 return p *= scale;
1025 }
1026
1028 bool operator==(WPSVec3<T> const &p) const
1029 {
1030 return cmp(p) == 0;
1031 }
1033 bool operator!=(WPSVec3<T> const &p) const
1034 {
1035 return cmp(p) != 0;
1036 }
1038 bool operator<(WPSVec3<T> const &p) const
1039 {
1040 return cmp(p) < 0;
1041 }
1043 int cmp(WPSVec3<T> const &p) const
1044 {
1045 for (int c = 0; c < 3; c++)
1046 {
1047 if (m_val[c]<p.m_val[c]) return -1;
1048 if (m_val[c]>p.m_val[c]) return 1;
1049 }
1050 return 0;
1051 }
1052
1054 friend std::ostream &operator<< (std::ostream &o, WPSVec3<T> const &f)
1055 {
1056 o << f.m_val[0] << "x" << f.m_val[1] << "x" << f.m_val[2];
1057 return o;
1058 }
1059
1063 struct PosSizeLt
1064 {
1066 bool operator()(WPSVec3<T> const &s1, WPSVec3<T> const &s2) const
1067 {
1068 return s1.cmp(s2) < 0;
1069 }
1070 };
1074 typedef std::map<WPSVec3<T>, T,struct PosSizeLt> Map;
1075
1076 protected:
1078 T m_val[3];
1079 };
1080
1082 typedef WPSVec3<unsigned char> WPSVec3uc;
1084 typedef WPSVec3<int> WPSVec3i;
1086 typedef WPSVec3<float> WPSVec3f;
1087
1089 class WPSTransformation
1090 {
1091 public:
1093 explicit WPSTransformation(WPSVec3f const &xRow=WPSVec3f(1,0,0), WPSVec3f const &yRow=WPSVec3f(0,1,0)) : m_data(xRow, yRow), m_isIdentity(false)
1094 {
1095 checkIdentity();
1096 }
1098 bool isIdentity() const
1099 {
1100 return m_isIdentity;
1101 }
1103 void checkIdentity() const
1104 {
1105 m_isIdentity= m_data.first==WPSVec3f(1,0,0) && m_data.second==WPSVec3f(0,1,0);
1106 }
1110 WPSVec3f const &operator[](int c) const
1111 {
1112 if (c<0 || c>1) throw libwps::GenericException();
1113 return c==0 ? m_data.first : m_data.second;
1114 }
1116 Vec2f operator*(Vec2f const &pt) const
1117 {
1118 if (m_isIdentity) return pt;
1119 return multiplyDirection(pt)+Vec2f(m_data.first[2],m_data.second[2]);
1120 }
1122 Vec2f multiplyDirection(Vec2f const &dir) const
1123 {
1124 if (m_isIdentity) return dir;
1125 Vec2f res;
1126 for (int coord=0; coord<2; ++coord)
1127 {
1128 WPSVec3f const &row=coord==0 ? m_data.first : m_data.second;
1129 float value=0;
1130 for (int i=0; i<2; ++i)
1131 value+=row[i]*dir[i];
1132 res[coord]=value;
1133 }
1134 return res;
1135 }
1137 WPSBox2f operator*(WPSBox2f const &box) const
1138 {
1139 if (m_isIdentity) return box;
1140 return WPSBox2f(operator*(box.min()), operator*(box.max()));
1141 }
1143 WPSTransformation operator*(WPSTransformation const &mat) const
1144 {
1145 if (mat.m_isIdentity) return *this;
1146 WPSTransformation res;
1147 for (int row=0; row<2; ++row)
1148 {
1149 WPSVec3f &resRow=row==0 ? res.m_data.first : res.m_data.second;
1150 for (int col=0; col<3; ++col)
1151 {
1152 float value=0;
1153 for (int i=0; i<3; ++i)
1154 value+=(*this)[row][i]*(i==2 ? (col==2 ? 1.f : 0.f) : mat[i][col]);
1155 resRow[col]=value;
1156 }
1157 }
1158 res.checkIdentity();
1159 return res;
1160 }
1162 WPSTransformation &operator*=(WPSTransformation const &mat)
1163 {
1164 if (!mat.m_isIdentity)
1165 *this=(*this)*mat;
1166 return *this;
1167 }
1169 bool operator==(WPSTransformation const &mat) const
1170 {
1171 return m_data==mat.m_data;
1172 }
1174 bool operator!=(WPSTransformation const &mat) const
1175 {
1176 return m_data!=mat.m_data;
1177 }
1179 bool operator<(WPSTransformation const &mat) const
1180 {
1181 return m_data<mat.m_data;
1182 }
1184 bool operator<=(WPSTransformation const &mat) const
1185 {
1186 return m_data<=mat.m_data;
1187 }
1189 bool operator>(WPSTransformation const &mat) const
1190 {
1191 return m_data>mat.m_data;
1192 }
1194 bool operator>=(WPSTransformation const &mat) const
1195 {
1196 return m_data>=mat.m_data;
1197 }
1201 bool decompose(float &rotation, Vec2f &shearing, WPSTransformation &transform, Vec2f const &center) const;
1202
1204 static WPSTransformation translation(Vec2f const &trans)
1205 {
1206 return WPSTransformation(WPSVec3f(1, 0, trans[0]), WPSVec3f(0, 1, trans[1]));
1207 }
1209 static WPSTransformation scale(Vec2f const &trans)
1210 {
1211 return WPSTransformation(WPSVec3f(trans[0], 0, 0), WPSVec3f(0, trans[1], 0));
1212 }
1216 static WPSTransformation rotation(float angle, Vec2f const &center=Vec2f(0,0));
1220 static WPSTransformation shear(Vec2f s, Vec2f const &center=Vec2f(0,0))
1221 {
1222 return WPSTransformation(WPSVec3f(1, s[0], -s[0]*center[1]), WPSVec3f(s[1], 1, -s[1]*center[0]));
1223 }
1224 protected:
1226 std::pair<WPSVec3f, WPSVec3f > m_data;
1228 mutable bool m_isIdentity;
1229 };
1230
1231 //
1232 // password utility
1233 //
1234
1235 namespace libwps
1236 {
1238 bool encodeLotusPassword(char const *password, uint16_t &key, std::vector<uint8_t> &keys, uint8_t const(&defValues)[16]);
1239 }
1240 #endif /* LIBWPS_INTERNAL_H */
1241 /* vim:set shiftwidth=4 softtabstop=4 noexpandtab: */
Vec2::operator!=
bool operator!=(Vec2< T > const &p) const
comparison!=
Definition: libwps_internal.h:654
WPSField::m_data
std::string m_data
the database/link field ( if defined )
Definition: libwps_internal.h:506
Vec2::cmpY
int cmpY(Vec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libwps_internal.h:673
WPSEmbeddedObject::isEmpty
bool isEmpty() const
return true if the picture contains no data
Definition: libwps_internal.h:455
libwps::LOWERCASE
Definition: libwps_internal.h:244
WPSBox2::resizeFromCenter
void resizeFromCenter(Vec2< T > const &sz)
resize the box keeping the center
Definition: libwps_internal.h:809
WPSBox2::scale
void scale(U factor)
scales all points of the box by factor
Definition: libwps_internal.h:817
WPSContentListenerPtr
shared_ptr< WPSContentListener > WPSContentListenerPtr
shared pointer to WPSContentListener
Definition: libwps_internal.h:108
WPSTransformation::WPSTransformation
WPSTransformation(WPSVec3f const &xRow=WPSVec3f(1, 0, 0), WPSVec3f const &yRow=WPSVec3f(0, 1, 0))
constructor
Definition: libwps_internal.h:1093
Vec2f
Vec2< float > Vec2f
Vec2 of float.
Definition: libwps_internal.h:721
libwps::read16
int16_t read16(RVNGInputStreamPtr &input)
Definition: libwps_internal.h:193
WPSTransformation::multiplyDirection
Vec2f multiplyDirection(Vec2f const &dir) const
operator* for direction
Definition: libwps_internal.h:1122
WPSColor::WPSColor
WPSColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition: libwps_internal.h:280
Vec2::setY
void setY(T yy)
resets the second element
Definition: libwps_internal.h:593
WPSBorder
a border list
Definition: libwps_internal.h:379
WPSVec3::m_val
T m_val[3]
the values
Definition: libwps_internal.h:1078
WPSColumnProperties
Definition: libwps_internal.h:263
libwps::GenericException
Definition: libwps_internal.h:159
Vec2::m_x
T m_x
first element
Definition: libwps_internal.h:713
WPSTransformation::m_isIdentity
bool m_isIdentity
flag to know if this matrix is an identity matrix
Definition: libwps_internal.h:1228
WPSField::m_numberingType
libwps::NumberingType m_numberingType
the number type ( for number field )
Definition: libwps_internal.h:504
libwps
Definition: libwps_internal.cpp:38
WPSVec3::operator*=
WPSVec3< T > & operator*=(U scale)
generic operator*=
Definition: libwps_internal.h:1001
WPSBox2::size
Vec2< T > size() const
the box size
Definition: libwps_internal.h:771
libwps::readU8
uint8_t readU8(RVNGInputStreamPtr &input)
Definition: libwps_internal.h:176
WPSSubDocumentPtr
shared_ptr< WPSSubDocument > WPSSubDocumentPtr
shared pointer to WPSSubDocument
Definition: libwps_internal.h:112
WPSTransformation::operator<=
bool operator<=(WPSTransformation const &mat) const
operator<=
Definition: libwps_internal.h:1184
WPSBox2::getIntersection
WPSBox2< T > getIntersection(WPSBox2< T > const &box) const
returns the intersection between this and box
Definition: libwps_internal.h:840
libwps::read8
int8_t read8(RVNGInputStreamPtr &input)
Definition: libwps_internal.h:189
Vec2::PosSizeLtY::operator()
bool operator()(Vec2< T > const &s1, Vec2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:707
WPSColor::getGreen
unsigned char getGreen() const
returns the green value
Definition: libwps_internal.h:325
WPSTransformation::operator*
WPSBox2f operator*(WPSBox2f const &box) const
operator* for box2f
Definition: libwps_internal.h:1137
Vec2::operator-
friend Vec2< T > operator-(Vec2< T > const &p1, Vec2< T > const &p2)
operator-
Definition: libwps_internal.h:635
WPSBox2::WPSBox2
WPSBox2(Vec2< T > minPt=Vec2< T >(), Vec2< T > maxPt=Vec2< T >())
constructor
Definition: libwps_internal.h:730
WPSBox2::cmp
int cmp(WPSBox2< T > const &p) const
comparison function : fist sorts min by Y,X values then max extremity
Definition: libwps_internal.h:867
WPSColor::value
uint32_t value() const
return the rgba value
Definition: libwps_internal.h:305
WPSBorder::operator==
bool operator==(WPSBorder const &orig) const
operator==
Definition: libwps_internal.h:401
WPSEmbeddedObject::WPSEmbeddedObject
WPSEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
constructor
Definition: libwps_internal.h:445
Vec2::operator[]
T & operator[](int c)
operator[]
Definition: libwps_internal.h:575
Vec2::PosSizeLtX::operator()
bool operator()(Vec2< T > const &s1, Vec2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:695
libwps::readU16
uint16_t readU16(RVNGInputStreamPtr &input)
Definition: libwps_internal.h:180
WPSFont
define the font properties
Definition: WPSFont.h:36
WPSEmbeddedObject::m_typeList
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition: libwps_internal.h:482
WPSVec3::operator+=
WPSVec3< T > & operator+=(WPSVec3< T > const &p)
operator+=
Definition: libwps_internal.h:988
WPSBox2i
WPSBox2< int > WPSBox2i
WPSBox2 of int.
Definition: libwps_internal.h:905
WPSColumnDefinition::m_leftGutter
double m_leftGutter
Definition: libwps_internal.h:259
WPSField
a field
Definition: libwps_internal.h:486
WPS_ATTRIBUTE_PRINTF
#define WPS_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libwps_internal.h:122
WPSVec3::x
T x() const
first element
Definition: libwps_internal.h:929
WPSListener
virtual class for content listener
Definition: WPSListener.h:36
Vec2::PosSizeLtX
internal struct used to create sorted map, sorted by X
Definition: libwps_internal.h:692
WPSField::m_type
Type m_type
the type
Definition: libwps_internal.h:500
WPSColor::black
static WPSColor black()
return the back color
Definition: libwps_internal.h:291
WPSBorder::m_width
int m_width
the border width
Definition: libwps_internal.h:423
WPSBox2::max
Vec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition: libwps_internal.h:747
WPSColor::white
static WPSColor white()
return the white color
Definition: libwps_internal.h:296
libwps::DOC_COMMENT_ANNOTATION
Definition: libwps_internal.h:246
WPSEmbeddedObject::WPSEmbeddedObject
WPSEmbeddedObject()
empty constructor
Definition: libwps_internal.h:441
WPSVec3::setX
void setX(T xx)
resets the first element
Definition: libwps_internal.h:964
Vec2::operator+=
Vec2< T > & operator+=(Vec2< T > const &p)
operator+=
Definition: libwps_internal.h:606
libwps::LOWERCASE_ROMAN
Definition: libwps_internal.h:244
libwps::BULLET
Definition: libwps_internal.h:244
libwps::DOC_TEXT_BOX
Definition: libwps_internal.h:246
WPSContentListener
Definition: WPSContentListener.h:44
WPSColor::operator=
WPSColor & operator=(uint32_t argb)
operator=
Definition: libwps_internal.h:285
libwps::readDouble4
bool readDouble4(RVNGInputStreamPtr &input, double &res, bool &isNaN)
read a double store with 4 bytes: mantisse 2.5 bytes, exponent 1.5 bytes
Definition: libwps_internal.cpp:90
WPSVec3::operator[]
T operator[](int c) const
operator[]
Definition: libwps_internal.h:944
WPSTransformation::checkIdentity
void checkIdentity() const
check if a matrix is the identity matrix
Definition: libwps_internal.h:1103
WPSTransformation::operator>
bool operator>(WPSTransformation const &mat) const
operator>
Definition: libwps_internal.h:1189
WPSColor::isWhite
bool isWhite() const
return true if the color is white
Definition: libwps_internal.h:335
WPSColumnProperties::m_attributes
uint32_t m_attributes
Definition: libwps_internal.h:268
libwps::DOC_NOTE
Definition: libwps_internal.h:246
WPSTransformation::operator>=
bool operator>=(WPSTransformation const &mat) const
operator>=
Definition: libwps_internal.h:1194
WPSTransformation::operator[]
WPSVec3f const & operator[](int c) const
the two extremum points which defined the box
Definition: libwps_internal.h:1110
WPSBox2f
WPSBox2< float > WPSBox2f
WPSBox2 of float.
Definition: libwps_internal.h:907
WPSEmbeddedObject::add
void add(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
add a picture
Definition: libwps_internal.h:465
WPSField::Type
Type
Defines some basic type for field.
Definition: libwps_internal.h:489
WPSCell
a structure used to defined the cell position, and a format
Definition: WPSCell.h:277
WPSBox2::PosSizeLt
internal struct used to create sorted map, sorted first min then max
Definition: libwps_internal.h:886
WPSColumnDefinition::m_width
double m_width
Definition: libwps_internal.h:258
libwps::Justification
Justification
Definition: libwps_internal.h:247
Vec2::operator[]
T operator[](int c) const
operator[]
Definition: libwps_internal.h:569
WPSBox2::operator!=
bool operator!=(WPSBox2< T > const &p) const
comparison operator!=
Definition: libwps_internal.h:856
WPSColumnDefinition::m_rightGutter
double m_rightGutter
Definition: libwps_internal.h:260
WPSVec3::PosSizeLt
internal struct used to create sorted map, sorted by X, Y, Z
Definition: libwps_internal.h:1063
WPSBox2< int >::Map
std::map< WPSBox2< int >, int, struct PosSizeLt > Map
map of WPSBox2
Definition: libwps_internal.h:897
WPSSubDocument
virtual class to define a sub document
Definition: WPSSubDocument.h:33
WPSBorder::operator!=
bool operator!=(WPSBorder const &orig) const
operator!=
Definition: libwps_internal.h:407
WPSTransformation::scale
static WPSTransformation scale(Vec2f const &trans)
returns a scaling transformation
Definition: libwps_internal.h:1209
WPSField::WPSField
WPSField(Type type)
basic constructor
Definition: libwps_internal.h:492
libwps::UPPERCASE
Definition: libwps_internal.h:244
libwps::readDouble10
bool readDouble10(RVNGInputStreamPtr &input, double &res, bool &isNaN)
read a double store with 10 bytes: mantisse 8 bytes, exponent 2 bytes
Definition: libwps_internal.cpp:224
WPSBorder::isEmpty
bool isEmpty() const
returns true if the border is empty
Definition: libwps_internal.h:395
Vec2::y
T y() const
second element
Definition: libwps_internal.h:564
WPSColor::operator==
bool operator==(WPSColor const &c) const
operator==
Definition: libwps_internal.h:340
WPSHeaderPtr
shared_ptr< WPSHeader > WPSHeaderPtr
shared pointer to WPSHeader
Definition: libwps_internal.h:110
libwps::DOC_TABLE
Definition: libwps_internal.h:246
WPSBox2::setMax
void setMax(Vec2< T > const &y)
resets the maximum point
Definition: libwps_internal.h:793
Vec2::Vec2
Vec2(T xx=0, T yy=0)
constructor
Definition: libwps_internal.h:554
libwps::NoBreakWithNextBit
Definition: libwps_internal.h:250
libwps::readU32
uint32_t readU32(RVNGInputStreamPtr &input)
Definition: libwps_internal.h:184
WPSListenerPtr
shared_ptr< WPSListener > WPSListenerPtr
shared pointer to WPSListener
Definition: libwps_internal.h:106
Vec2::setX
void setX(T xx)
resets the first element
Definition: libwps_internal.h:588
WPSBorder::WPSBorder
WPSBorder()
constructor
Definition: libwps_internal.h:389
WPSColor::operator<
bool operator<(WPSColor const &c) const
operator<
Definition: libwps_internal.h:350
libwps::NoBreakBit
Definition: libwps_internal.h:250
WPSTransformation::m_data
std::pair< WPSVec3f, WPSVec3f > m_data
the data
Definition: libwps_internal.h:1226
WPSColor::isBlack
bool isBlack() const
return true if the color is black
Definition: libwps_internal.h:330
libwps::SubDocumentType
SubDocumentType
Definition: libwps_internal.h:246
libwps::NONE
Definition: libwps_internal.h:244
WPSColor::getAlpha
unsigned char getAlpha() const
returns the alpha value
Definition: libwps_internal.h:310
WPSTransformation::operator!=
bool operator!=(WPSTransformation const &mat) const
operator!=
Definition: libwps_internal.h:1174
libwps::JustificationFull
Definition: libwps_internal.h:247
libwps::DOC_HEADER_FOOTER
Definition: libwps_internal.h:246
WPSTransformation::shear
static WPSTransformation shear(Vec2f s, Vec2f const &center=Vec2f(0, 0))
returns a shear transformation letting center invariant, ie.
Definition: libwps_internal.h:1220
libwps::ParseException
Definition: libwps_internal.h:149
WPSBox2::center
Vec2< T > center() const
the box center
Definition: libwps_internal.h:776
WPSBox2::WPSBox2
WPSBox2(WPSBox2< U > const &p)
generic constructor
Definition: libwps_internal.h:736
Vec2::operator==
bool operator==(Vec2< T > const &p) const
comparison==
Definition: libwps_internal.h:649
WPSBorder::m_widthsList
std::vector< double > m_widthsList
the different length used for each line/sep (if defined)
Definition: libwps_internal.h:427
WKSSubDocument
Basic class used to store a spreadsheet sub document.
Definition: WKSSubDocument.h:35
WPSVec3::setZ
void setZ(T zz)
resets the third element
Definition: libwps_internal.h:974
libwps::JustificationFullAllLines
Definition: libwps_internal.h:248
libwps::appendUnicode
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer)
adds an unicode character to a string ( with correct encoding ).
Definition: libwps_internal.cpp:718
WPSBox2::min
Vec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libwps_internal.h:752
WKSContentListenerPtr
shared_ptr< WKSContentListener > WKSContentListenerPtr
shared pointer to WKSContentListener
Definition: libwps_internal.h:115
WPSHeader
Definition: WPSHeader.h:31
WPSBox2
small class which defines a 2D WPSBox
Definition: libwps_internal.h:726
libwps::DOC_NONE
Definition: libwps_internal.h:246
WPSVec3::add
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition: libwps_internal.h:980
libwps::VersionException
Definition: libwps_internal.h:139
WPSVec3::operator*
friend WPSVec3< T > operator*(U scale, WPSVec3< T > const &p1)
generic operator*
Definition: libwps_internal.h:1021
WPSColor::m_value
uint32_t m_value
the argb color
Definition: libwps_internal.h:375
Vec2::PosSizeLtY
internal struct used to create sorted map, sorted by Y
Definition: libwps_internal.h:704
WPSVec3::operator-=
WPSVec3< T > & operator-=(WPSVec3< T > const &p)
operator-=
Definition: libwps_internal.h:994
Vec2::cmp
int cmp(Vec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libwps_internal.h:664
WPS_shared_ptr_noop_deleter::operator()
void operator()(T *)
Definition: libwps_internal.h:83
WPSVec3::operator!=
bool operator!=(WPSVec3< T > const &p) const
comparison!=
Definition: libwps_internal.h:1033
WPSVec3uc
WPSVec3< unsigned char > WPSVec3uc
WPSVec3 of unsigned char.
Definition: libwps_internal.h:1082
WPSBorder::Type
Type
the line repetition
Definition: libwps_internal.h:384
WPSBox2::extend
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition: libwps_internal.h:824
libwps::PasswordException
Definition: libwps_internal.h:154
Vec2::add
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition: libwps_internal.h:599
WPSTransformation::operator<
bool operator<(WPSTransformation const &mat) const
operator<
Definition: libwps_internal.h:1179
WPSEmbeddedObject::m_dataList
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition: libwps_internal.h:480
WPSColumnProperties::m_alignment
uint8_t m_alignment
Definition: libwps_internal.h:269
WPSColumnDefinition
Definition: libwps_internal.h:253
WPSColor::operator>
bool operator>(WPSColor const &c) const
operator>
Definition: libwps_internal.h:360
WPSColumnProperties::WPSColumnProperties
WPSColumnProperties()
Definition: libwps_internal.h:265
Vec2::operator-=
Vec2< T > & operator-=(Vec2< T > const &p)
operator-=
Definition: libwps_internal.h:613
WPSBox2::setMin
void setMin(Vec2< T > const &x)
resets the minimum point
Definition: libwps_internal.h:788
WPSBorder::m_color
WPSColor m_color
the border color
Definition: libwps_internal.h:429
Vec2::operator*=
Vec2< T > & operator*=(U scale)
generic operator*=
Definition: libwps_internal.h:621
WPSColor::operator!=
bool operator!=(WPSColor const &c) const
operator!=
Definition: libwps_internal.h:345
libwps::NumberingType
NumberingType
Definition: libwps_internal.h:244
WPSTransformation::isIdentity
bool isIdentity() const
returns true if the matrix is an identity matrix
Definition: libwps_internal.h:1098
libwps::read32
int32_t read32(RVNGInputStreamPtr &input)
Definition: libwps_internal.h:197
WPSVec3::y
T y() const
second element
Definition: libwps_internal.h:934
WPSColor::getBlue
unsigned char getBlue() const
returns the green value
Definition: libwps_internal.h:315
WPSBox2::resizeFromMin
void resizeFromMin(Vec2< T > const &sz)
resize the box keeping the minimum
Definition: libwps_internal.h:799
RVNGInputStreamPtr
shared_ptr< librevenge::RVNGInputStream > RVNGInputStreamPtr
shared pointer to librevenge::RVNGInputStream
Definition: libwps_internal.h:88
WPSColor::operator<=
bool operator<=(WPSColor const &c) const
operator<=
Definition: libwps_internal.h:355
libwps::readDouble4Inv
bool readDouble4Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN)
read a double store with 4 bytes: exponent 3.5 bytes, mantisse 0.5 bytes
Definition: libwps_internal.cpp:303
Vec2i
Vec2< int > Vec2i
Vec2 of int.
Definition: libwps_internal.h:719
WPSColor
the class to store a color
Definition: libwps_internal.h:273
WPSEmbeddedObject::~WPSEmbeddedObject
virtual ~WPSEmbeddedObject()
destructor
Definition: libwps_internal.h:451
WPSVec3::operator==
bool operator==(WPSVec3< T > const &p) const
comparison==
Definition: libwps_internal.h:1028
WPSBorder::Pos
Pos
Definition: libwps_internal.h:385
WPSVec3::z
T z() const
third element
Definition: libwps_internal.h:939
libwps::JustificationRight
Definition: libwps_internal.h:248
Vec2::Vec2
Vec2(Vec2< U > const &p)
generic copy constructor
Definition: libwps_internal.h:556
libwps::readData
bool readData(RVNGInputStreamPtr &input, unsigned long size, librevenge::RVNGBinaryData &data)
try to read sz bytes from input and store them in a librevenge::RVNGBinaryData
Definition: libwps_internal.cpp:332
WPSTransformation::operator==
bool operator==(WPSTransformation const &mat) const
operator==
Definition: libwps_internal.h:1169
WPSTransformation::translation
static WPSTransformation translation(Vec2f const &trans)
returns a translation transformation
Definition: libwps_internal.h:1204
libwps::readDataToEnd
bool readDataToEnd(RVNGInputStreamPtr &input, librevenge::RVNGBinaryData &data)
try to read the last bytes from input and store them in a librevenge::RVNGBinaryData ...
Definition: libwps_internal.cpp:346
WPSVec3i
WPSVec3< int > WPSVec3i
WPSVec3 of int.
Definition: libwps_internal.h:1084
libwps::numberingTypeToString
std::string numberingTypeToString(NumberingType type)
Definition: libwps_internal.cpp:357
WPSVec3::PosSizeLt::operator()
bool operator()(WPSVec3< T > const &s1, WPSVec3< T > const &s2) const
comparaison function
Definition: libwps_internal.h:1066
WPSVec3::WPSVec3
WPSVec3(T xx=0, T yy=0, T zz=0)
constructor
Definition: libwps_internal.h:916
WPSBorder::Style
Style
the line style
Definition: libwps_internal.h:382
WPSTransformation::operator*=
WPSTransformation & operator*=(WPSTransformation const &mat)
operator*=
Definition: libwps_internal.h:1162
WPSBox2::getUnion
WPSBox2< T > getUnion(WPSBox2< T > const &box) const
returns the union between this and box
Definition: libwps_internal.h:830
WPSEmbeddedObject
small class use to define a embedded object
Definition: libwps_internal.h:438
WPSTransformation::operator*
Vec2f operator*(Vec2f const &pt) const
operator* for vec2f
Definition: libwps_internal.h:1116
WPSColor::getRed
unsigned char getRed() const
returns the red value
Definition: libwps_internal.h:320
WPSVec3::Map
std::map< WPSVec3< T >, T, struct PosSizeLt > Map
map of WPSVec3
Definition: libwps_internal.h:1074
libwps::encodeLotusPassword
bool encodeLotusPassword(char const *password, uint16_t &key, std::vector< uint8_t > &keys, uint8_t const(&defValues)[16])
try to encode a lotus file
Definition: libwps_internal.cpp:836
WPSVec3::setY
void setY(T yy)
resets the second element
Definition: libwps_internal.h:969
libwps::FileException
Definition: libwps_internal.h:144
WPSVec3::WPSVec3
WPSVec3(WPSVec3< U > const &p)
generic copy constructor
Definition: libwps_internal.h:923
WPSVec3::operator+
friend WPSVec3< T > operator+(WPSVec3< T > const &p1, WPSVec3< T > const &p2)
operator+
Definition: libwps_internal.h:1008
WPSColumnDefinition::WPSColumnDefinition
WPSColumnDefinition()
Definition: libwps_internal.h:255
WPSBorder::m_style
Style m_style
the border style
Definition: libwps_internal.h:419
libwps::JustificationLeft
Definition: libwps_internal.h:247
WPSVec3::cmp
int cmp(WPSVec3< T > const &p) const
a comparison function: which first compares x values, then y values then z values.
Definition: libwps_internal.h:1043
libwps::UPPERCASE_ROMAN
Definition: libwps_internal.h:244
WPSTransformation
a transformation which stored the first row of a 3x3 perspective matrix
Definition: libwps_internal.h:1089
WKSSubDocumentPtr
shared_ptr< WKSSubDocument > WKSSubDocumentPtr
shared pointer to WKSSubDocument
Definition: libwps_internal.h:117
libwps::readDouble8
bool readDouble8(RVNGInputStreamPtr &input, double &res, bool &isNaN)
read a double store with 8 bytes: mantisse 6.5 bytes, exponent 1.5 bytes
Definition: libwps_internal.cpp:173
libwps::JustificationCenter
Definition: libwps_internal.h:247
WPSBox2::operator==
bool operator==(WPSBox2< T > const &p) const
comparison operator==
Definition: libwps_internal.h:851
WPSBox2::resizeFromMax
void resizeFromMax(Vec2< T > const &sz)
resize the box keeping the maximum
Definition: libwps_internal.h:804
WPSEntry
basic class to store an entry in a file This contained :
Definition: WPSEntry.h:38
Vec2
small class which defines a vector with 2 elements
Definition: libwps_internal.h:550
libwps::ARABIC
Definition: libwps_internal.h:244
Vec2::operator*
friend Vec2< T > operator*(U scale, Vec2< T > const &p1)
generic operator*
Definition: libwps_internal.h:642
WPSPosition
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: WPSPosition.h:39
WPSColor::operator>=
bool operator>=(WPSColor const &c) const
operator>=
Definition: libwps_internal.h:365
WPSTransformation::operator*
WPSTransformation operator*(WPSTransformation const &mat) const
operator* for transform
Definition: libwps_internal.h:1143
WPSBorder::m_extra
std::string m_extra
extra data ( if needed)
Definition: libwps_internal.h:431
WPSCellPtr
shared_ptr< WPSCell > WPSCellPtr
shared pointer to WPSCell
Definition: libwps_internal.h:101
libwps::readDouble2Inv
bool readDouble2Inv(RVNGInputStreamPtr &input, double &res, bool &isNaN)
read a double store with 2 bytes: exponent 1.5 bytes, kind of mantisse 0.5 bytes
Definition: libwps_internal.cpp:273
WPSStream
small structure use to store a stream and it debug file
Definition: WPSStream.h:29
operator<<
std::ostream & operator<<(std::ostream &o, WPSColor const &c)
Definition: libwps_internal.cpp:401
WPSColor::WPSColor
WPSColor(uint32_t argb=0)
constructor
Definition: libwps_internal.h:276
WPSVec3f
WPSVec3< float > WPSVec3f
WPSVec3 of float.
Definition: libwps_internal.h:1086
WPSBox2::PosSizeLt::operator()
bool operator()(WPSBox2< T > const &s1, WPSBox2< T > const &s2) const
comparaison function
Definition: libwps_internal.h:889
Vec2::m_y
T m_y
second element
Definition: libwps_internal.h:713
WPS_shared_ptr_noop_deleter
a noop deleter used to transform a librevenge pointer in a false shared_ptr
Definition: libwps_internal.h:81
WPSVec3::operator[]
T & operator[](int c)
operator[]
Definition: libwps_internal.h:950
WPSBox2::m_pt
Vec2< T > m_pt[2]
the two extremities
Definition: libwps_internal.h:901
Vec2::x
T x() const
first element
Definition: libwps_internal.h:559
WPSBorder::m_type
Type m_type
the border repetition
Definition: libwps_internal.h:421
WPSField::m_DTFormat
std::string m_DTFormat
the date/time format using strftime format if defined (see strftime)
Definition: libwps_internal.h:502
WPSBox2::max
Vec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libwps_internal.h:757
WKSContentListener
Definition: WKSContentListener.h:52
WPSVec3
small class which defines a vector with 3 elements
Definition: libwps_internal.h:912
WPSBox2::operator[]
Vec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition: libwps_internal.h:765
WPSBox2::min
Vec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libwps_internal.h:742
Vec2b
Vec2< bool > Vec2b
Vec2 of bool.
Definition: libwps_internal.h:717
WPSVec3::operator-
friend WPSVec3< T > operator-(WPSVec3< T > const &p1, WPSVec3< T > const &p2)
operator-
Definition: libwps_internal.h:1014
Vec2::operator+
friend Vec2< T > operator+(Vec2< T > const &p1, Vec2< T > const &p2)
operator+
Definition: libwps_internal.h:629