libstaroffice_internal.hxx Source File documentation

libstaroffice_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/* libstaroffice
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 LIBSTAROFFICE_INTERNAL_H
35#define LIBSTAROFFICE_INTERNAL_H
36#include <assert.h>
37#ifdef DEBUG
38#include <stdio.h>
39#endif
40
41#include <cmath>
42#include <map>
43#include <ostream>
44#include <string>
45#include <math.h>
46#include <vector>
47
48#ifndef M_PI
49#define M_PI 3.14159265358979323846
50#endif
51
52#include <librevenge-stream/librevenge-stream.h>
53#include <librevenge/librevenge.h>
54
55#if defined(_MSC_VER) || defined(__DJGPP__)
56
57typedef signed char int8_t;
58typedef unsigned char uint8_t;
59typedef signed short int16_t;
60typedef unsigned short uint16_t;
61typedef signed int int32_t;
62typedef unsigned int uint32_t;
63typedef unsigned __int64 uint64_t;
64typedef __int64 int64_t;
65
66#else /* !_MSC_VER && !__DJGPP__*/
67
68# ifdef HAVE_CONFIG_H
69
70# include <config.h>
71# ifdef HAVE_STDINT_H
72# include <stdint.h>
73# endif
74# ifdef HAVE_INTTYPES_H
75# include <inttypes.h>
76# endif
77
78# else
79
80// assume that the headers are there inside LibreOffice build when no HAVE_CONFIG_H is defined
81# include <stdint.h>
82# include <inttypes.h>
83
84# endif
85
86#endif /* _MSC_VER || __DJGPP__ */
87
88// define gmtime_r and localtime_r on Windows, so that can use
89// thread-safe functions on other environments
90#ifdef _WIN32
91# define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
92# define localtime_r(tp,tmp) (localtime(tp)?(*(tmp)=*localtime(tp),(tmp)):0)
93#endif
94
95/* ---------- memory --------------- */
96#if defined(SHAREDPTR_TR1)
97#include <tr1/memory>
98using std::tr1::shared_ptr;
99#elif defined(SHAREDPTR_STD)
100#include <memory>
101using std::shared_ptr;
102#else
103#include <boost/shared_ptr.hpp>
104using boost::shared_ptr;
105#endif
106
108template <class T>
109 struct STOFF_shared_ptr_noop_deleter {
110 void operator()(T *) {}
111};
112
113#if defined(__clang__) || defined(__GNUC__)
114# define LIBSTOFF_ATTRIBUTE_PRINTF(fmt, arg) __attribute__((__format__(__printf__, fmt, arg)))
115#else
116# define LIBSTOFF_ATTRIBUTE_PRINTF(fmt, arg)
117#endif
118
119/* ---------- debug --------------- */
120#ifdef DEBUG
121namespace libstoff
122{
123void printDebugMsg(const char *format, ...) LIBSTOFF_ATTRIBUTE_PRINTF(1,2);
124}
125#define STOFF_DEBUG_MSG(M) libstoff::printDebugMsg M
126#else
127#define STOFF_DEBUG_MSG(M)
128#endif
129
130namespace libstoff
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 ----------------- */
155namespace libstoff
156{
157uint8_t readU8(librevenge::RVNGInputStream *input);
159void appendUnicode(uint32_t val, librevenge::RVNGString &buffer);
161librevenge::RVNGString getString(std::vector<uint32_t> const &unicode);
162}
163
164/* ---------- small enum/class ------------- */
165namespace libstoff
166{
168 enum Position { Left = 0, Right = 1, Top = 2, Bottom = 3, HMiddle = 4, VMiddle = 5 };
170 enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08, HMiddleBit = 0x10, VMiddleBit = 0x20 };
171
172 enum NumberingType { NONE, BULLET, ARABIC, LOWERCASE, UPPERCASE, LOWERCASE_ROMAN, UPPERCASE_ROMAN };
173std::string numberingTypeToString(NumberingType type);
174std::string numberingValueToString(NumberingType type, int value);
175 enum SubDocumentType { DOC_NONE, DOC_CHART, DOC_CHART_ZONE, DOC_COMMENT_ANNOTATION, DOC_GRAPHIC_GROUP, DOC_HEADER_FOOTER_REGION, DOC_NOTE, DOC_SHEET, DOC_TABLE, DOC_TEXT_BOX };
176}
177
179 struct STOFFColor {
181 explicit STOFFColor(uint32_t argb=0) : m_value(argb)
182 {
183 }
184
185 STOFFColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255) :
186 m_value(uint32_t((a<<24)+(r<<16)+(g<<8)+b))
187 {
188 }
189
190 STOFFColor &operator=(uint32_t argb)
191 {
192 m_value = argb;
193 return *this;
194 }
195
196 static STOFFColor colorFromCMYK(unsigned char c, unsigned char m, unsigned char y, unsigned char k)
197 {
198 double w=1.-double(k)/255.;
199 return STOFFColor
200 (static_cast<unsigned char>(255 * (1-double(c)/255) * w),
201 static_cast<unsigned char>(255 * (1-double(m)/255) * w),
202 static_cast<unsigned char>(255 * (1-double(y)/255) * w)
203 );
204 }
205
206 static STOFFColor colorFromHSL(unsigned char H, unsigned char S, unsigned char L)
207 {
208 double c=(1-((L>=128) ? (2*double(L)-255) : (255-2*double(L)))/255)*
209 double(S)/255;
210 double tmp=std::fmod((double(H)*6/255),2)-1;
211 double x=c*(1-(tmp>0 ? tmp : -tmp));
212 unsigned char C=static_cast<unsigned char>(255*c);
213 unsigned char M=static_cast<unsigned char>(double(L)-255*c/2);
214 unsigned char X=static_cast<unsigned char>(255*x);
215 if (H<=42) return STOFFColor(static_cast<unsigned char>(M+C),static_cast<unsigned char>(M+X),static_cast<unsigned char>(M));
216 if (H<=85) return STOFFColor(static_cast<unsigned char>(M+X),static_cast<unsigned char>(M+C),static_cast<unsigned char>(M));
217 if (H<=127) return STOFFColor(static_cast<unsigned char>(M),static_cast<unsigned char>(M+C),static_cast<unsigned char>(M+X));
218 if (H<=170) return STOFFColor(static_cast<unsigned char>(M),static_cast<unsigned char>(M+X),static_cast<unsigned char>(M+C));
219 if (H<=212) return STOFFColor(static_cast<unsigned char>(M+X),static_cast<unsigned char>(M),static_cast<unsigned char>(M+C));
220 return STOFFColor(static_cast<unsigned char>(M+C),static_cast<unsigned char>(M),static_cast<unsigned char>(M+X));
221 }
222
223 static STOFFColor black()
224 {
225 return STOFFColor(0,0,0);
226 }
227
228 static STOFFColor white()
229 {
230 return STOFFColor(255,255,255);
231 }
232
234 static STOFFColor barycenter(float alpha, STOFFColor const &colA,
235 float beta, STOFFColor const &colB);
237 uint32_t value() const
238 {
239 return m_value;
240 }
241
242 unsigned char getAlpha() const
243 {
244 return static_cast<unsigned char>((m_value>>24)&0xFF);
245 }
246
247 void setAlpha(unsigned char alpha)
248 {
249 m_value=(m_value&0xFFFFFF)|uint32_t(alpha<<24);
250 }
251
252 unsigned char getBlue() const
253 {
254 return static_cast<unsigned char>(m_value&0xFF);
255 }
256
257 unsigned char getRed() const
258 {
259 return static_cast<unsigned char>((m_value>>16)&0xFF);
260 }
261
262 unsigned char getGreen() const
263 {
264 return static_cast<unsigned char>((m_value>>8)&0xFF);
265 }
266
267 bool isBlack() const
268 {
269 return (m_value&0xFFFFFF)==0;
270 }
271
272 bool isWhite() const
273 {
274 return (m_value&0xFFFFFF)==0xFFFFFF;
275 }
276
277 bool operator==(STOFFColor const &c) const
278 {
279 return (c.m_value&0xFFFFFF)==(m_value&0xFFFFFF);
280 }
281
282 bool operator!=(STOFFColor const &c) const
283 {
284 return !operator==(c);
285 }
286
287 bool operator<(STOFFColor const &c) const
288 {
289 return (c.m_value&0xFFFFFF)<(m_value&0xFFFFFF);
290 }
291
292 bool operator<=(STOFFColor const &c) const
293 {
294 return (c.m_value&0xFFFFFF)<=(m_value&0xFFFFFF);
295 }
296
297 bool operator>(STOFFColor const &c) const
298 {
299 return !operator<=(c);
300 }
301
302 bool operator>=(STOFFColor const &c) const
303 {
304 return !operator<(c);
305 }
306
307 friend std::ostream &operator<< (std::ostream &o, STOFFColor const &c);
309 std::string str() const;
310protected:
312 uint32_t m_value;
313};
314
316 struct STOFFBorderLine {
318 STOFFBorderLine() : m_outWidth(0), m_inWidth(0), m_color(STOFFColor::black()), m_distance(0) { }
322 bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const;
324 bool isEmpty() const
325 {
326 return m_outWidth==0 && m_inWidth==0;
327 }
328
329 bool operator==(STOFFBorderLine const &orig) const
330 {
331 return !operator!=(orig);
332 }
333
334 bool operator!=(STOFFBorderLine const &orig) const
335 {
336 return m_outWidth != orig.m_outWidth || m_inWidth != orig.m_inWidth ||
337 m_distance != orig.m_distance || m_color != orig.m_color;
338 }
339
341 friend std::ostream &operator<< (std::ostream &o, STOFFBorderLine const &border);
343 int m_outWidth;
345 int m_inWidth;
347 STOFFColor m_color;
349 int m_distance;
350};
351
353 struct STOFFField {
355 STOFFField() : m_propertyList()
356 {
357 }
358
359 void addTo(librevenge::RVNGPropertyList &propList) const;
361 librevenge::RVNGPropertyList m_propertyList;
362};
363
365 struct STOFFLink {
367 STOFFLink() : m_HRef("")
368 {
369 }
370
372 bool addTo(librevenge::RVNGPropertyList &propList) const;
373
375 std::string m_HRef;
376};
377
379 struct STOFFNote {
381 enum Type { FootNote, EndNote };
383 explicit STOFFNote(Type type) : m_type(type), m_label(""), m_number(-1)
384 {
385 }
386
387 Type m_type;
389 librevenge::RVNGString m_label;
391 int m_number;
392};
393
398 struct STOFFEmbeddedObject {
400 STOFFEmbeddedObject() : m_dataList(), m_typeList(), m_filenameLink("")
401 {
402 }
403
404 STOFFEmbeddedObject(librevenge::RVNGBinaryData const &binaryData,
405 std::string type="image/pict") : m_dataList(), m_typeList(), m_filenameLink("")
406 {
407 add(binaryData, type);
408 }
409
410 ~STOFFEmbeddedObject();
412 bool isEmpty() const
413 {
414 if (!m_filenameLink.empty())
415 return false;
416 for (size_t i=0; i<m_dataList.size(); ++i) {
417 if (!m_dataList[i].empty())
418 return false;
419 }
420 return true;
421 }
422
423 void add(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
424 {
425 size_t pos=m_dataList.size();
426 if (pos<m_typeList.size()) pos=m_typeList.size();
427 m_dataList.resize(pos+1);
428 m_dataList[pos]=binaryData;
429 m_typeList.resize(pos+1);
430 m_typeList[pos]=type;
431 }
432
433 bool addTo(librevenge::RVNGPropertyList &propList) const;
435 bool addAsFillImageTo(librevenge::RVNGPropertyList &propList) const;
437 friend std::ostream &operator<<(std::ostream &o, STOFFEmbeddedObject const &pict);
439 int cmp(STOFFEmbeddedObject const &pict) const;
440
442 std::vector<librevenge::RVNGBinaryData> m_dataList;
444 std::vector<std::string> m_typeList;
446 librevenge::RVNGString m_filenameLink;
447};
448
449// forward declarations of basic classes and smart pointers
450class STOFFFont;
451class STOFFGraphicShape;
452class STOFFGraphicStyle;
453class STOFFList;
454class STOFFParagraph;
455class STOFFSection;
456class STOFFPageSpan;
457
458class STOFFEntry;
459class STOFFHeader;
460class STOFFParser;
461class STOFFPosition;
462
463class STOFFGraphicListener;
464class STOFFInputStream;
465class STOFFListener;
466class STOFFListManager;
467class STOFFParserState;
468class STOFFSpreadsheetListener;
469class STOFFSubDocument;
470class STOFFTextListener;
472 typedef shared_ptr<STOFFGraphicListener> STOFFGraphicListenerPtr;
474 typedef shared_ptr<STOFFInputStream> STOFFInputStreamPtr;
476 typedef shared_ptr<STOFFListener> STOFFListenerPtr;
478 typedef shared_ptr<STOFFListManager> STOFFListManagerPtr;
480 typedef shared_ptr<STOFFParserState> STOFFParserStatePtr;
482 typedef shared_ptr<STOFFSpreadsheetListener> STOFFSpreadsheetListenerPtr;
484 typedef shared_ptr<STOFFSubDocument> STOFFSubDocumentPtr;
486 typedef shared_ptr<STOFFTextListener> STOFFTextListenerPtr;
487
494 template <class T> struct STOFFVariable {
496 STOFFVariable() : m_data(), m_set(false) {}
498 explicit STOFFVariable(T const &def) : m_data(def), m_set(false) {}
500 STOFFVariable(STOFFVariable const &orig) : m_data(orig.m_data), m_set(orig.m_set) {}
502 STOFFVariable &operator=(STOFFVariable const &orig)
503 {
504 if (this != &orig) {
505 m_data = orig.m_data;
506 m_set = orig.m_set;
507 }
508 return *this;
509 }
510
511 STOFFVariable &operator=(T const &val)
512 {
513 m_data = val;
514 m_set = true;
515 return *this;
516 }
517
518 void insert(STOFFVariable const &orig)
519 {
520 if (orig.m_set) {
521 m_data = orig.m_data;
522 m_set = orig.m_set;
523 }
524 }
525
526 T const *operator->() const
527 {
528 return &m_data;
529 }
530
531 T *operator->()
532 {
533 m_set = true;
534 return &m_data;
535 }
536
537 T const &operator*() const
538 {
539 return m_data;
540 }
541
542 T &operator*()
543 {
544 m_set = true;
545 return m_data;
546 }
547
548 T const &get() const
549 {
550 return m_data;
551 }
552
553 bool isSet() const
554 {
555 return m_set;
556 }
557
558 void setSet(bool newVal)
559 {
560 m_set=newVal;
561 }
562protected:
564 T m_data;
566 bool m_set;
567};
568
569/* ---------- vec2/box2f ------------- */
573 template <class T> class STOFFVec2
574{
575public:
577 STOFFVec2(T xx=0,T yy=0) : m_x(xx), m_y(yy) { }
579 template <class U> STOFFVec2(STOFFVec2<U> const &p) : m_x(T(p.x())), m_y(T(p.y())) {}
580
582 T x() const
583 {
584 return m_x;
585 }
586
587 T y() const
588 {
589 return m_y;
590 }
591
592 T operator[](int c) const
593 {
594 if (c<0 || c>1) throw libstoff::GenericException();
595 return (c==0) ? m_x : m_y;
596 }
597
598 T &operator[](int c)
599 {
600 if (c<0 || c>1) throw libstoff::GenericException();
601 return (c==0) ? m_x : m_y;
602 }
603
605 void set(T xx, T yy)
606 {
607 m_x = xx;
608 m_y = yy;
609 }
610
611 void setX(T xx)
612 {
613 m_x = xx;
614 }
615
616 void setY(T yy)
617 {
618 m_y = yy;
619 }
620
622 void add(T dx, T dy)
623 {
624 m_x += dx;
625 m_y += dy;
626 }
627
629 STOFFVec2<T> &operator+=(STOFFVec2<T> const &p)
630 {
631 m_x += p.m_x;
632 m_y += p.m_y;
633 return *this;
634 }
635
636 STOFFVec2<T> &operator-=(STOFFVec2<T> const &p)
637 {
638 m_x -= p.m_x;
639 m_y -= p.m_y;
640 return *this;
641 }
642
643 template <class U>
644 STOFFVec2<T> &operator*=(U scale)
645 {
646 m_x = T(m_x*scale);
647 m_y = T(m_y*scale);
648 return *this;
649 }
650
652 friend STOFFVec2<T> operator+(STOFFVec2<T> const &p1, STOFFVec2<T> const &p2)
653 {
654 STOFFVec2<T> p(p1);
655 return p+=p2;
656 }
657
658 friend STOFFVec2<T> operator-(STOFFVec2<T> const &p1, STOFFVec2<T> const &p2)
659 {
660 STOFFVec2<T> p(p1);
661 return p-=p2;
662 }
663
664 template <class U>
665 friend STOFFVec2<T> operator*(U scale, STOFFVec2<T> const &p1)
666 {
667 STOFFVec2<T> p(p1);
668 return p *= scale;
669 }
670
672 bool operator==(STOFFVec2<T> const &p) const
673 {
674 return cmpY(p) == 0;
675 }
676
677 bool operator!=(STOFFVec2<T> const &p) const
678 {
679 return cmpY(p) != 0;
680 }
681
682 bool operator<(STOFFVec2<T> const &p) const
683 {
684 return cmpY(p) < 0;
685 }
686
687 int cmp(STOFFVec2<T> const &p) const
688 {
689 if (m_x < p.m_x) return -1;
690 if (m_x > p.m_x) return 1;
691 if (m_y < p.m_y) return -1;
692 if (m_y > p.m_y) return 1;
693 return 0;
694 }
695
696 int cmpY(STOFFVec2<T> const &p) const
697 {
698 if (m_y < p.m_y) return -1;
699 if (m_y > p.m_y) return 1;
700 if (m_x < p.m_x) return -1;
701 if (m_x > p.m_x) return 1;
702 return 0;
703 }
704
706 friend std::ostream &operator<< (std::ostream &o, STOFFVec2<T> const &f)
707 {
708 o << f.m_x << "x" << f.m_y;
709 return o;
710 }
711
715 struct PosSizeLtX {
717 bool operator()(STOFFVec2<T> const &s1, STOFFVec2<T> const &s2) const
718 {
719 return s1.cmp(s2) < 0;
720 }
721 };
722
725 typedef std::map<STOFFVec2<T>, T,struct PosSizeLtX> MapX;
726
730 struct PosSizeLtY {
732 bool operator()(STOFFVec2<T> const &s1, STOFFVec2<T> const &s2) const
733 {
734 return s1.cmpY(s2) < 0;
735 }
736 };
737
740 typedef std::map<STOFFVec2<T>, T,struct PosSizeLtY> MapY;
741protected:
742 T m_x, m_y;
743};
744
746 typedef STOFFVec2<bool> STOFFVec2b;
748 typedef STOFFVec2<int> STOFFVec2i;
750 typedef STOFFVec2<long> STOFFVec2l;
752 typedef STOFFVec2<float> STOFFVec2f;
753
757 template <class T> class STOFFVec3
758{
759public:
761 STOFFVec3(T xx=0,T yy=0,T zz=0)
762 {
763 m_val[0] = xx;
764 m_val[1] = yy;
765 m_val[2] = zz;
766 }
767
768 template <class U> STOFFVec3(STOFFVec3<U> const &p)
769 {
770 for (int c = 0; c < 3; c++) m_val[c] = T(p[c]);
771 }
772
774 T x() const
775 {
776 return m_val[0];
777 }
778
779 T y() const
780 {
781 return m_val[1];
782 }
783
784 T z() const
785 {
786 return m_val[2];
787 }
788
789 T operator[](int c) const
790 {
791 if (c<0 || c>2) throw libstoff::GenericException();
792 return m_val[c];
793 }
794
795 T &operator[](int c)
796 {
797 if (c<0 || c>2) throw libstoff::GenericException();
798 return m_val[c];
799 }
800
802 void set(T xx, T yy, T zz)
803 {
804 m_val[0] = xx;
805 m_val[1] = yy;
806 m_val[2] = zz;
807 }
808
809 void setX(T xx)
810 {
811 m_val[0] = xx;
812 }
813
814 void setY(T yy)
815 {
816 m_val[1] = yy;
817 }
818
819 void setZ(T zz)
820 {
821 m_val[2] = zz;
822 }
823
825 void add(T dx, T dy, T dz)
826 {
827 m_val[0] += dx;
828 m_val[1] += dy;
829 m_val[2] += dz;
830 }
831
833 STOFFVec3<T> &operator+=(STOFFVec3<T> const &p)
834 {
835 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]);
836 return *this;
837 }
838
839 STOFFVec3<T> &operator-=(STOFFVec3<T> const &p)
840 {
841 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]-p.m_val[c]);
842 return *this;
843 }
844
845 template <class U>
846 STOFFVec3<T> &operator*=(U scale)
847 {
848 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]*scale);
849 return *this;
850 }
851
853 friend STOFFVec3<T> operator+(STOFFVec3<T> const &p1, STOFFVec3<T> const &p2)
854 {
855 STOFFVec3<T> p(p1);
856 return p+=p2;
857 }
858
859 friend STOFFVec3<T> operator-(STOFFVec3<T> const &p1, STOFFVec3<T> const &p2)
860 {
861 STOFFVec3<T> p(p1);
862 return p-=p2;
863 }
864
865 template <class U>
866 friend STOFFVec3<T> operator*(U scale, STOFFVec3<T> const &p1)
867 {
868 STOFFVec3<T> p(p1);
869 return p *= scale;
870 }
871
873 bool operator==(STOFFVec3<T> const &p) const
874 {
875 return cmp(p) == 0;
876 }
877
878 bool operator!=(STOFFVec3<T> const &p) const
879 {
880 return cmp(p) != 0;
881 }
882
883 bool operator<(STOFFVec3<T> const &p) const
884 {
885 return cmp(p) < 0;
886 }
887
888 int cmp(STOFFVec3<T> const &p) const
889 {
890 for (int c = 0; c < 3; c++) {
891 if (m_val[c]<p.m_val[c]) return -1;
892 if (m_val[c]>p.m_val[c]) return 1;
893 }
894 return 0;
895 }
896
898 friend std::ostream &operator<< (std::ostream &o, STOFFVec3<T> const &f)
899 {
900 o << f.m_val[0] << "x" << f.m_val[1] << "x" << f.m_val[2];
901 return o;
902 }
903
907 struct PosSizeLt {
909 bool operator()(STOFFVec3<T> const &s1, STOFFVec3<T> const &s2) const
910 {
911 return s1.cmp(s2) < 0;
912 }
913 };
914
917 typedef std::map<STOFFVec3<T>, T,struct PosSizeLt> Map;
918
919protected:
921 T m_val[3];
922};
923
925 typedef STOFFVec3<bool> STOFFVec3b;
927 typedef STOFFVec3<unsigned char> STOFFVec3uc;
929 typedef STOFFVec3<int> STOFFVec3i;
931 typedef STOFFVec3<float> STOFFVec3f;
932
936 template <class T> class STOFFBox2
937{
938public:
940 STOFFBox2(STOFFVec2<T> minPt=STOFFVec2<T>(), STOFFVec2<T> maxPt=STOFFVec2<T>())
941 {
942 m_pt[0] = minPt;
943 m_pt[1] = maxPt;
944 }
945
946 template <class U> STOFFBox2(STOFFBox2<U> const &p)
947 {
948 for (int c=0; c < 2; c++) m_pt[c] = p[c];
949 }
950
952 STOFFVec2<T> const &min() const
953 {
954 return m_pt[0];
955 }
956
957 STOFFVec2<T> const &max() const
958 {
959 return m_pt[1];
960 }
961
962 STOFFVec2<T> &min()
963 {
964 return m_pt[0];
965 }
966
967 STOFFVec2<T> &max()
968 {
969 return m_pt[1];
970 }
971
974 STOFFVec2<T> const &operator[](int c) const
975 {
976 if (c<0 || c>1) throw libstoff::GenericException();
977 return m_pt[c];
978 }
979
980 STOFFVec2<T> size() const
981 {
982 return m_pt[1]-m_pt[0];
983 }
984
985 STOFFVec2<T> center() const
986 {
987 return STOFFVec2<T>((m_pt[0].x()+m_pt[1].x())/2,
988 (m_pt[0].y()+m_pt[1].y())/2);
989 }
990
992 void set(STOFFVec2<T> const &x, STOFFVec2<T> const &y)
993 {
994 m_pt[0] = x;
995 m_pt[1] = y;
996 }
997
998 void setMin(STOFFVec2<T> const &x)
999 {
1000 m_pt[0] = x;
1001 }
1002
1003 void setMax(STOFFVec2<T> const &y)
1004 {
1005 m_pt[1] = y;
1006 }
1007
1009 void resizeFromMin(STOFFVec2<T> const &sz)
1010 {
1011 m_pt[1] = m_pt[0]+sz;
1012 }
1013
1014 void resizeFromMax(STOFFVec2<T> const &sz)
1015 {
1016 m_pt[0] = m_pt[1]-sz;
1017 }
1018
1019 void resizeFromCenter(STOFFVec2<T> const &sz)
1020 {
1021 STOFFVec2<T> centerPt = 0.5*(m_pt[0]+m_pt[1]);
1022 m_pt[0] = centerPt - 0.5*sz;
1023 m_pt[1] = centerPt + (sz - 0.5*sz);
1024 }
1025
1027 template <class U> void scale(U factor)
1028 {
1029 m_pt[0] *= factor;
1030 m_pt[1] *= factor;
1031 }
1032
1034 void extend(T val)
1035 {
1036 m_pt[0] -= STOFFVec2<T>(val/2,val/2);
1037 m_pt[1] += STOFFVec2<T>(val-(val/2),val-(val/2));
1038 }
1039
1041 STOFFBox2<T> getUnion(STOFFBox2<T> const &box) const
1042 {
1043 STOFFBox2<T> res;
1044 res.m_pt[0]=STOFFVec2<T>(m_pt[0][0]<box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
1045 m_pt[0][1]<box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
1046 res.m_pt[1]=STOFFVec2<T>(m_pt[1][0]>box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
1047 m_pt[1][1]>box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
1048 return res;
1049 }
1050
1051 STOFFBox2<T> getIntersection(STOFFBox2<T> const &box) const
1052 {
1053 STOFFBox2<T> res;
1054 res.m_pt[0]=STOFFVec2<T>(m_pt[0][0]>box.m_pt[0][0]?m_pt[0][0] : box.m_pt[0][0],
1055 m_pt[0][1]>box.m_pt[0][1]?m_pt[0][1] : box.m_pt[0][1]);
1056 res.m_pt[1]=STOFFVec2<T>(m_pt[1][0]<box.m_pt[1][0]?m_pt[1][0] : box.m_pt[1][0],
1057 m_pt[1][1]<box.m_pt[1][1]?m_pt[1][1] : box.m_pt[1][1]);
1058 return res;
1059 }
1060
1061 bool operator==(STOFFBox2<T> const &p) const
1062 {
1063 return cmp(p) == 0;
1064 }
1065
1066 bool operator!=(STOFFBox2<T> const &p) const
1067 {
1068 return cmp(p) != 0;
1069 }
1070
1071 bool operator<(STOFFBox2<T> const &p) const
1072 {
1073 return cmp(p) < 0;
1074 }
1075
1077 int cmp(STOFFBox2<T> const &p) const
1078 {
1079 int diff = m_pt[0].cmpY(p.m_pt[0]);
1080 if (diff) return diff;
1081 diff = m_pt[1].cmpY(p.m_pt[1]);
1082 if (diff) return diff;
1083 return 0;
1084 }
1085
1087 friend std::ostream &operator<< (std::ostream &o, STOFFBox2<T> const &f)
1088 {
1089 o << "(" << f.m_pt[0] << "<->" << f.m_pt[1] << ")";
1090 return o;
1091 }
1092
1096 struct PosSizeLt {
1098 bool operator()(STOFFBox2<T> const &s1, STOFFBox2<T> const &s2) const
1099 {
1100 return s1.cmp(s2) < 0;
1101 }
1102 };
1103
1106 typedef std::map<STOFFBox2<T>, T,struct PosSizeLt> Map;
1107
1108protected:
1110 STOFFVec2<T> m_pt[2];
1111};
1112
1114 typedef STOFFBox2<int> STOFFBox2i;
1116 typedef STOFFBox2<float> STOFFBox2f;
1118 typedef STOFFBox2<long> STOFFBox2l;
1119
1120namespace libstoff
1121{
1122// some conversion function
1124template <class T>
1125 double convertMiniMToPoint(T const &value)
1126{
1127 return 0.028346457*double(value);
1128}
1129
1130template <class T>
1131 STOFFVec2f convertMiniMToPointVect(T const &value)
1132{
1133 return 0.028346457f*STOFFVec2f(value);
1134}
1135
1136bool convertToDateTime(uint32_t date, uint32_t time, std::string &dateTime);
1138void splitString(librevenge::RVNGString const &string, librevenge::RVNGString const &delim,
1139 librevenge::RVNGString &string1, librevenge::RVNGString &string2);
1143librevenge::RVNGString simplifyString(librevenge::RVNGString const &s);
1144// some geometrical function
1146float getScaleFactor(librevenge::RVNGUnit orig, librevenge::RVNGUnit dest);
1148 STOFFVec2f rotatePointAroundCenter(STOFFVec2f const &point, STOFFVec2f const &center, float angle);
1150 STOFFBox2f rotateBoxFromCenter(STOFFBox2f const &box, float angle);
1151}
1152#endif /* LIBSTAROFFICE_INTERNAL_H */
1153// vim: set filetype=cpp tabstop=2 shiftwidth=2 cindent autoindent smartindent noexpandtab:
STOFFBox2
small class which defines a 2D Box
Definition libstaroffice_internal.hxx:937
STOFFBox2::resizeFromMin
void resizeFromMin(STOFFVec2< T > const &sz)
resize the box keeping the minimum
Definition libstaroffice_internal.hxx:1009
STOFFBox2::extend
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition libstaroffice_internal.hxx:1034
STOFFBox2::getIntersection
STOFFBox2< T > getIntersection(STOFFBox2< T > const &box) const
returns the intersection between this and box
Definition libstaroffice_internal.hxx:1051
STOFFBox2::min
STOFFVec2< T > & min()
the minimum 2D point (in x and in y)
Definition libstaroffice_internal.hxx:962
STOFFBox2::STOFFBox2
STOFFBox2(STOFFBox2< U > const &p)
generic constructor
Definition libstaroffice_internal.hxx:946
STOFFBox2::operator[]
STOFFVec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition libstaroffice_internal.hxx:974
STOFFBox2::set
void set(STOFFVec2< T > const &x, STOFFVec2< T > const &y)
resets the data to minimum x and maximum y
Definition libstaroffice_internal.hxx:992
STOFFBox2::operator<
bool operator<(STOFFBox2< T > const &p) const
comparison operator< : fist sorts min by Y,X values then max extremity
Definition libstaroffice_internal.hxx:1071
STOFFBox2::min
STOFFVec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition libstaroffice_internal.hxx:952
STOFFBox2::setMin
void setMin(STOFFVec2< T > const &x)
resets the minimum point
Definition libstaroffice_internal.hxx:998
STOFFBox2::setMax
void setMax(STOFFVec2< T > const &y)
resets the maximum point
Definition libstaroffice_internal.hxx:1003
STOFFBox2::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFBox2< T > const &f)
print data in form X0xY0<->X1xY1
Definition libstaroffice_internal.hxx:1087
STOFFBox2::size
STOFFVec2< T > size() const
the box size
Definition libstaroffice_internal.hxx:980
STOFFBox2::STOFFBox2
STOFFBox2(STOFFVec2< T > minPt=STOFFVec2< T >(), STOFFVec2< T > maxPt=STOFFVec2< T >())
constructor
Definition libstaroffice_internal.hxx:940
STOFFBox2< int >::m_pt
STOFFVec2< int > m_pt[2]
Definition libstaroffice_internal.hxx:1110
STOFFBox2::scale
void scale(U factor)
scales all points of the box by factor
Definition libstaroffice_internal.hxx:1027
STOFFBox2::cmp
int cmp(STOFFBox2< T > const &p) const
comparison function : fist sorts min by Y,X values then max extremity
Definition libstaroffice_internal.hxx:1077
STOFFBox2::resizeFromCenter
void resizeFromCenter(STOFFVec2< T > const &sz)
resize the box keeping the center
Definition libstaroffice_internal.hxx:1019
STOFFBox2::operator==
bool operator==(STOFFBox2< T > const &p) const
comparison operator==
Definition libstaroffice_internal.hxx:1061
STOFFBox2::resizeFromMax
void resizeFromMax(STOFFVec2< T > const &sz)
resize the box keeping the maximum
Definition libstaroffice_internal.hxx:1014
STOFFBox2::center
STOFFVec2< T > center() const
the box center
Definition libstaroffice_internal.hxx:985
STOFFBox2::max
STOFFVec2< T > & max()
the maximum 2D point (in x and in y)
Definition libstaroffice_internal.hxx:967
STOFFBox2::operator!=
bool operator!=(STOFFBox2< T > const &p) const
comparison operator!=
Definition libstaroffice_internal.hxx:1066
STOFFBox2::max
STOFFVec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition libstaroffice_internal.hxx:957
STOFFBox2::getUnion
STOFFBox2< T > getUnion(STOFFBox2< T > const &box) const
returns the union between this and box
Definition libstaroffice_internal.hxx:1041
STOFFBox2::Map
std::map< STOFFBox2< T >, T, struct PosSizeLt > Map
map of STOFFBox2
Definition libstaroffice_internal.hxx:1106
STOFFEntry
basic class to store an entry in a file This contained :
Definition STOFFEntry.hxx:47
STOFFFont
Class to store font.
Definition STOFFFont.hxx:44
STOFFGraphicListener
This class contains the code needed to create Graphic document.
Definition STOFFGraphicListener.hxx:60
STOFFGraphicShape
a structure used to define a picture shape
Definition STOFFGraphicShape.hxx:46
STOFFGraphicStyle
Class to store a graphic style.
Definition STOFFGraphicStyle.hxx:45
STOFFHeader
a function used by STOFFDocument to store the version of document
Definition STOFFHeader.hxx:57
STOFFInputStream
Internal class used to read the file stream Internal class used to read the file stream,...
Definition STOFFInputStream.hxx:54
STOFFListManager
a manager which manages the lists, keeps the different kind of lists, to assure the unicity of each l...
Definition STOFFList.hxx:197
STOFFList
a small structure used to store the informations about a list
Definition STOFFList.hxx:103
STOFFListener
This class contains a virtual interface to all listener.
Definition STOFFListener.hxx:51
STOFFPageSpan
A class which defines the page properties.
Definition STOFFPageSpan.hxx:76
STOFFParagraph
class to store the paragraph properties
Definition STOFFParagraph.hxx:48
STOFFParserState
a class to define the parser state
Definition STOFFParser.hxx:50
STOFFParser
virtual class which defines the ancestor of all main zone parser
Definition STOFFParser.hxx:90
STOFFPosition
Class to define the position of an object (textbox, picture, ..) in the document.
Definition STOFFPosition.hxx:48
STOFFSection
a class which stores section properties
Definition STOFFSection.hxx:46
STOFFSpreadsheetListener
This class contents the main functions needed to create a spreadsheet processing Document.
Definition STOFFSpreadsheetListener.hxx:65
STOFFSubDocument
abstract class used to store a subdocument (with a comparison function)
Definition STOFFSubDocument.hxx:42
STOFFTextListener
This class contains the code needed to create Text document.
Definition STOFFTextListener.hxx:60
STOFFVec2
small class which defines a vector with 2 elements
Definition libstaroffice_internal.hxx:574
STOFFVec2::operator==
bool operator==(STOFFVec2< T > const &p) const
comparison==
Definition libstaroffice_internal.hxx:672
STOFFVec2::setX
void setX(T xx)
resets the first element
Definition libstaroffice_internal.hxx:611
STOFFVec2::operator*=
STOFFVec2< T > & operator*=(U scale)
generic operator*=
Definition libstaroffice_internal.hxx:644
STOFFVec2::operator*
friend STOFFVec2< T > operator*(U scale, STOFFVec2< T > const &p1)
generic operator*
Definition libstaroffice_internal.hxx:665
STOFFVec2::MapY
std::map< STOFFVec2< T >, T, struct PosSizeLtY > MapY
map of STOFFVec2
Definition libstaroffice_internal.hxx:740
STOFFVec2::STOFFVec2
STOFFVec2(STOFFVec2< U > const &p)
generic copy constructor
Definition libstaroffice_internal.hxx:579
STOFFVec2< bool >::m_y
bool m_y
Definition libstaroffice_internal.hxx:742
STOFFVec2::MapX
std::map< STOFFVec2< T >, T, struct PosSizeLtX > MapX
map of STOFFVec2
Definition libstaroffice_internal.hxx:725
STOFFVec2::operator+=
STOFFVec2< T > & operator+=(STOFFVec2< T > const &p)
operator+=
Definition libstaroffice_internal.hxx:629
STOFFVec2::setY
void setY(T yy)
resets the second element
Definition libstaroffice_internal.hxx:616
STOFFVec2< bool >::y
bool y() const
Definition libstaroffice_internal.hxx:587
STOFFVec2< bool >::m_x
bool m_x
Definition libstaroffice_internal.hxx:742
STOFFVec2::operator-=
STOFFVec2< T > & operator-=(STOFFVec2< T > const &p)
operator-=
Definition libstaroffice_internal.hxx:636
STOFFVec2::operator[]
T & operator[](int c)
operator[]
Definition libstaroffice_internal.hxx:598
STOFFVec2::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFVec2< T > const &f)
operator<<: prints data in form "XxY"
Definition libstaroffice_internal.hxx:706
STOFFVec2::cmpY
int cmpY(STOFFVec2< T > const &p) const
a comparison function: which first compares y then x
Definition libstaroffice_internal.hxx:696
STOFFVec2::cmp
int cmp(STOFFVec2< T > const &p) const
a comparison function: which first compares x then y
Definition libstaroffice_internal.hxx:687
STOFFVec2< bool >::x
bool x() const
Definition libstaroffice_internal.hxx:582
STOFFVec2::operator[]
T operator[](int c) const
operator[]
Definition libstaroffice_internal.hxx:592
STOFFVec2::STOFFVec2
STOFFVec2(T xx=0, T yy=0)
constructor
Definition libstaroffice_internal.hxx:577
STOFFVec2::set
void set(T xx, T yy)
resets the two elements
Definition libstaroffice_internal.hxx:605
STOFFVec2::add
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition libstaroffice_internal.hxx:622
STOFFVec2::operator-
friend STOFFVec2< T > operator-(STOFFVec2< T > const &p1, STOFFVec2< T > const &p2)
operator-
Definition libstaroffice_internal.hxx:658
STOFFVec2::operator!=
bool operator!=(STOFFVec2< T > const &p) const
comparison!=
Definition libstaroffice_internal.hxx:677
STOFFVec2::operator<
bool operator<(STOFFVec2< T > const &p) const
comparison<: sort by y
Definition libstaroffice_internal.hxx:682
STOFFVec2::operator+
friend STOFFVec2< T > operator+(STOFFVec2< T > const &p1, STOFFVec2< T > const &p2)
operator+
Definition libstaroffice_internal.hxx:652
STOFFVec3
small class which defines a vector with 3 elements
Definition libstaroffice_internal.hxx:758
STOFFVec3< bool >::m_val
bool m_val[3]
Definition libstaroffice_internal.hxx:921
STOFFVec3::operator+
friend STOFFVec3< T > operator+(STOFFVec3< T > const &p1, STOFFVec3< T > const &p2)
operator+
Definition libstaroffice_internal.hxx:853
STOFFVec3::operator-
friend STOFFVec3< T > operator-(STOFFVec3< T > const &p1, STOFFVec3< T > const &p2)
operator-
Definition libstaroffice_internal.hxx:859
STOFFVec3::setX
void setX(T xx)
resets the first element
Definition libstaroffice_internal.hxx:809
STOFFVec3::z
T z() const
third element
Definition libstaroffice_internal.hxx:784
STOFFVec3::STOFFVec3
STOFFVec3(T xx=0, T yy=0, T zz=0)
constructor
Definition libstaroffice_internal.hxx:761
STOFFVec3::y
T y() const
second element
Definition libstaroffice_internal.hxx:779
STOFFVec3::x
T x() const
first element
Definition libstaroffice_internal.hxx:774
STOFFVec3::operator*=
STOFFVec3< T > & operator*=(U scale)
generic operator*=
Definition libstaroffice_internal.hxx:846
STOFFVec3::operator+=
STOFFVec3< T > & operator+=(STOFFVec3< T > const &p)
operator+=
Definition libstaroffice_internal.hxx:833
STOFFVec3::operator*
friend STOFFVec3< T > operator*(U scale, STOFFVec3< T > const &p1)
generic operator*
Definition libstaroffice_internal.hxx:866
STOFFVec3::set
void set(T xx, T yy, T zz)
resets the three elements
Definition libstaroffice_internal.hxx:802
STOFFVec3::STOFFVec3
STOFFVec3(STOFFVec3< U > const &p)
generic copy constructor
Definition libstaroffice_internal.hxx:768
STOFFVec3::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFVec3< T > const &f)
operator<<: prints data in form "XxYxZ"
Definition libstaroffice_internal.hxx:898
STOFFVec3::setZ
void setZ(T zz)
resets the third element
Definition libstaroffice_internal.hxx:819
STOFFVec3::operator[]
T & operator[](int c)
operator[]
Definition libstaroffice_internal.hxx:795
STOFFVec3::add
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition libstaroffice_internal.hxx:825
STOFFVec3::operator!=
bool operator!=(STOFFVec3< T > const &p) const
comparison!=
Definition libstaroffice_internal.hxx:878
STOFFVec3::operator<
bool operator<(STOFFVec3< T > const &p) const
comparison<: which first compares x values, then y values then z values.
Definition libstaroffice_internal.hxx:883
STOFFVec3::Map
std::map< STOFFVec3< T >, T, struct PosSizeLt > Map
map of STOFFVec3
Definition libstaroffice_internal.hxx:917
STOFFVec3::operator-=
STOFFVec3< T > & operator-=(STOFFVec3< T > const &p)
operator-=
Definition libstaroffice_internal.hxx:839
STOFFVec3::operator==
bool operator==(STOFFVec3< T > const &p) const
comparison==
Definition libstaroffice_internal.hxx:873
STOFFVec3::setY
void setY(T yy)
resets the second element
Definition libstaroffice_internal.hxx:814
STOFFVec3::cmp
int cmp(STOFFVec3< T > const &p) const
a comparison function: which first compares x values, then y values then z values.
Definition libstaroffice_internal.hxx:888
STOFFVec3::operator[]
T operator[](int c) const
operator[]
Definition libstaroffice_internal.hxx:789
libstoff::FileException
Definition libstaroffice_internal.hxx:138
libstoff::GenericException
Definition libstaroffice_internal.hxx:146
libstoff::ParseException
Definition libstaroffice_internal.hxx:142
libstoff::VersionException
Definition libstaroffice_internal.hxx:134
libstoff::WrongPasswordException
Definition libstaroffice_internal.hxx:150
STOFFVec2l
STOFFVec2< long > STOFFVec2l
STOFFVec2 of long.
Definition libstaroffice_internal.hxx:750
LIBSTOFF_ATTRIBUTE_PRINTF
#define LIBSTOFF_ATTRIBUTE_PRINTF(fmt, arg)
Definition libstaroffice_internal.hxx:116
STOFFListManagerPtr
shared_ptr< STOFFListManager > STOFFListManagerPtr
a smart pointer of STOFFListManager
Definition libstaroffice_internal.hxx:478
STOFFBox2i
STOFFBox2< int > STOFFBox2i
STOFFBox2 of int.
Definition libstaroffice_internal.hxx:1114
STOFFTextListenerPtr
shared_ptr< STOFFTextListener > STOFFTextListenerPtr
a smart pointer of STOFFTextListener
Definition libstaroffice_internal.hxx:486
STOFFSubDocumentPtr
shared_ptr< STOFFSubDocument > STOFFSubDocumentPtr
a smart pointer of STOFFSubDocument
Definition libstaroffice_internal.hxx:484
STOFFVec2i
STOFFVec2< int > STOFFVec2i
STOFFVec2 of int.
Definition libstaroffice_internal.hxx:748
STOFFVec3f
STOFFVec3< float > STOFFVec3f
STOFFVec3 of float.
Definition libstaroffice_internal.hxx:931
STOFFVec3b
STOFFVec3< bool > STOFFVec3b
STOFFVec3 of bool.
Definition libstaroffice_internal.hxx:925
STOFFParserStatePtr
shared_ptr< STOFFParserState > STOFFParserStatePtr
a smart pointer of STOFFParserState
Definition libstaroffice_internal.hxx:480
STOFFBox2l
STOFFBox2< long > STOFFBox2l
STOFFBox2 of long.
Definition libstaroffice_internal.hxx:1118
STOFFListenerPtr
shared_ptr< STOFFListener > STOFFListenerPtr
a smart pointer of STOFFListener
Definition libstaroffice_internal.hxx:476
STOFFVec3uc
STOFFVec3< unsigned char > STOFFVec3uc
STOFFVec3 of unsigned char.
Definition libstaroffice_internal.hxx:927
STOFFInputStreamPtr
shared_ptr< STOFFInputStream > STOFFInputStreamPtr
a smart pointer of STOFFInputStream
Definition libstaroffice_internal.hxx:474
STOFFVec2b
STOFFVec2< bool > STOFFVec2b
STOFFVec2 of bool.
Definition libstaroffice_internal.hxx:746
STOFFVec2f
STOFFVec2< float > STOFFVec2f
STOFFVec2 of float.
Definition libstaroffice_internal.hxx:752
STOFFSpreadsheetListenerPtr
shared_ptr< STOFFSpreadsheetListener > STOFFSpreadsheetListenerPtr
a smart pointer of STOFFSpreadsheetListener
Definition libstaroffice_internal.hxx:482
STOFFVec3i
STOFFVec3< int > STOFFVec3i
STOFFVec3 of int.
Definition libstaroffice_internal.hxx:929
STOFFBox2f
STOFFBox2< float > STOFFBox2f
STOFFBox2 of float.
Definition libstaroffice_internal.hxx:1116
STOFFGraphicListenerPtr
shared_ptr< STOFFGraphicListener > STOFFGraphicListenerPtr
a smart pointer of STOFFGraphicListener
Definition libstaroffice_internal.hxx:472
libstoff
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition libstaroffice_internal.cxx:51
libstoff::numberingTypeToString
std::string numberingTypeToString(NumberingType type)
Definition libstaroffice_internal.cxx:123
libstoff::NumberingType
NumberingType
Definition libstaroffice_internal.hxx:172
libstoff::UPPERCASE
@ UPPERCASE
Definition libstaroffice_internal.hxx:172
libstoff::ARABIC
@ ARABIC
Definition libstaroffice_internal.hxx:172
libstoff::LOWERCASE
@ LOWERCASE
Definition libstaroffice_internal.hxx:172
libstoff::LOWERCASE_ROMAN
@ LOWERCASE_ROMAN
Definition libstaroffice_internal.hxx:172
libstoff::UPPERCASE_ROMAN
@ UPPERCASE_ROMAN
Definition libstaroffice_internal.hxx:172
libstoff::NONE
@ NONE
Definition libstaroffice_internal.hxx:172
libstoff::BULLET
@ BULLET
Definition libstaroffice_internal.hxx:172
libstoff::appendUnicode
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer)
adds an unicode character to a string
Definition libstaroffice_internal.cxx:81
libstoff::simplifyString
librevenge::RVNGString simplifyString(librevenge::RVNGString const &s)
returns a simplify version of a string.
Definition libstaroffice_internal.cxx:429
libstoff::getString
librevenge::RVNGString getString(std::vector< uint32_t > const &unicode)
transform a unicode string in a RNVGString
Definition libstaroffice_internal.cxx:63
libstoff::convertToDateTime
bool convertToDateTime(uint32_t date, uint32_t time, std::string &dateTime)
convert a date/time in a date time format
Definition libstaroffice_internal.cxx:388
libstoff::rotatePointAroundCenter
STOFFVec2f rotatePointAroundCenter(STOFFVec2f const &point, STOFFVec2f const &center, float angle)
rotate a point around center, angle is given in degree
Definition libstaroffice_internal.cxx:455
libstoff::Position
Position
basic position enum
Definition libstaroffice_internal.hxx:168
libstoff::Right
@ Right
Definition libstaroffice_internal.hxx:168
libstoff::Top
@ Top
Definition libstaroffice_internal.hxx:168
libstoff::VMiddle
@ VMiddle
Definition libstaroffice_internal.hxx:168
libstoff::HMiddle
@ HMiddle
Definition libstaroffice_internal.hxx:168
libstoff::Left
@ Left
Definition libstaroffice_internal.hxx:168
libstoff::Bottom
@ Bottom
Definition libstaroffice_internal.hxx:168
libstoff::numberingValueToString
std::string numberingValueToString(NumberingType type, int value)
Definition libstaroffice_internal.cxx:145
libstoff::convertMiniMToPoint
double convertMiniMToPoint(T const &value)
convert 1/100th millimeter to point
Definition libstaroffice_internal.hxx:1125
libstoff::convertMiniMToPointVect
STOFFVec2f convertMiniMToPointVect(T const &value)
convert 1/100th millimeter vector to point
Definition libstaroffice_internal.hxx:1131
libstoff::getScaleFactor
float getScaleFactor(librevenge::RVNGUnit orig, librevenge::RVNGUnit dest)
factor to convert from one unit to other
Definition libstaroffice_internal.cxx:483
libstoff::SubDocumentType
SubDocumentType
Definition libstaroffice_internal.hxx:175
libstoff::DOC_SHEET
@ DOC_SHEET
Definition libstaroffice_internal.hxx:175
libstoff::DOC_TEXT_BOX
@ DOC_TEXT_BOX
Definition libstaroffice_internal.hxx:175
libstoff::DOC_GRAPHIC_GROUP
@ DOC_GRAPHIC_GROUP
Definition libstaroffice_internal.hxx:175
libstoff::DOC_NONE
@ DOC_NONE
Definition libstaroffice_internal.hxx:175
libstoff::DOC_HEADER_FOOTER_REGION
@ DOC_HEADER_FOOTER_REGION
Definition libstaroffice_internal.hxx:175
libstoff::DOC_CHART
@ DOC_CHART
Definition libstaroffice_internal.hxx:175
libstoff::DOC_COMMENT_ANNOTATION
@ DOC_COMMENT_ANNOTATION
Definition libstaroffice_internal.hxx:175
libstoff::DOC_CHART_ZONE
@ DOC_CHART_ZONE
Definition libstaroffice_internal.hxx:175
libstoff::DOC_TABLE
@ DOC_TABLE
Definition libstaroffice_internal.hxx:175
libstoff::DOC_NOTE
@ DOC_NOTE
Definition libstaroffice_internal.hxx:175
libstoff::rotateBoxFromCenter
STOFFBox2f rotateBoxFromCenter(STOFFBox2f const &box, float angle)
rotate a bdox and returns the final bdbox, angle is given in degree
Definition libstaroffice_internal.cxx:463
libstoff::HMiddleBit
@ HMiddleBit
Definition libstaroffice_internal.hxx:170
libstoff::TopBit
@ TopBit
Definition libstaroffice_internal.hxx:170
libstoff::BottomBit
@ BottomBit
Definition libstaroffice_internal.hxx:170
libstoff::RightBit
@ RightBit
Definition libstaroffice_internal.hxx:170
libstoff::VMiddleBit
@ VMiddleBit
Definition libstaroffice_internal.hxx:170
libstoff::LeftBit
@ LeftBit
Definition libstaroffice_internal.hxx:170
libstoff::splitString
void splitString(librevenge::RVNGString const &string, librevenge::RVNGString const &delim, librevenge::RVNGString &string1, librevenge::RVNGString &string2)
split a string in two. If the delimiter is not present, string1=string
Definition libstaroffice_internal.cxx:413
libstoff::readU8
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition libstaroffice_internal.cxx:52
STOFFBorderLine
a border line
Definition libstaroffice_internal.hxx:316
STOFFBorderLine::m_color
STOFFColor m_color
the border color
Definition libstaroffice_internal.hxx:347
STOFFBorderLine::m_outWidth
int m_outWidth
the outline width in TWIP
Definition libstaroffice_internal.hxx:343
STOFFBorderLine::m_inWidth
int m_inWidth
the inline width in TWIP
Definition libstaroffice_internal.hxx:345
STOFFBorderLine::addTo
bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const
add the border property to proplist (if needed )
Definition libstaroffice_internal.cxx:255
STOFFBorderLine::operator==
bool operator==(STOFFBorderLine const &orig) const
operator==
Definition libstaroffice_internal.hxx:329
STOFFBorderLine::operator!=
bool operator!=(STOFFBorderLine const &orig) const
operator!=
Definition libstaroffice_internal.hxx:334
STOFFBorderLine::m_distance
int m_distance
the border distance
Definition libstaroffice_internal.hxx:349
STOFFBorderLine::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFBorderLine const &border)
operator<<
Definition libstaroffice_internal.cxx:281
STOFFBorderLine::STOFFBorderLine
STOFFBorderLine()
constructor
Definition libstaroffice_internal.hxx:318
STOFFBorderLine::isEmpty
bool isEmpty() const
returns true if the border is empty
Definition libstaroffice_internal.hxx:324
STOFFBox2::PosSizeLt
internal struct used to create sorted map, sorted first min then max
Definition libstaroffice_internal.hxx:1096
STOFFBox2::PosSizeLt::operator()
bool operator()(STOFFBox2< T > const &s1, STOFFBox2< T > const &s2) const
comparaison function
Definition libstaroffice_internal.hxx:1098
STOFFColor
the class to store a color
Definition libstaroffice_internal.hxx:179
STOFFColor::colorFromHSL
static STOFFColor colorFromHSL(unsigned char H, unsigned char S, unsigned char L)
return a color from a hsl color (basic)
Definition libstaroffice_internal.hxx:206
STOFFColor::getRed
unsigned char getRed() const
returns the red value
Definition libstaroffice_internal.hxx:257
STOFFColor::operator>=
bool operator>=(STOFFColor const &c) const
operator>=
Definition libstaroffice_internal.hxx:302
STOFFColor::operator=
STOFFColor & operator=(uint32_t argb)
operator=
Definition libstaroffice_internal.hxx:190
STOFFColor::barycenter
static STOFFColor barycenter(float alpha, STOFFColor const &colA, float beta, STOFFColor const &colB)
return alpha*colA+beta*colB
Definition libstaroffice_internal.cxx:199
STOFFColor::getBlue
unsigned char getBlue() const
returns the green value
Definition libstaroffice_internal.hxx:252
STOFFColor::operator<
bool operator<(STOFFColor const &c) const
operator<
Definition libstaroffice_internal.hxx:287
STOFFColor::getGreen
unsigned char getGreen() const
returns the green value
Definition libstaroffice_internal.hxx:262
STOFFColor::colorFromCMYK
static STOFFColor colorFromCMYK(unsigned char c, unsigned char m, unsigned char y, unsigned char k)
return a color from a cmyk color ( basic)
Definition libstaroffice_internal.hxx:196
STOFFColor::black
static STOFFColor black()
return the back color
Definition libstaroffice_internal.hxx:223
STOFFColor::str
std::string str() const
print the color in the form #rrggbb
Definition libstaroffice_internal.cxx:225
STOFFColor::m_value
uint32_t m_value
the argb color
Definition libstaroffice_internal.hxx:312
STOFFColor::isBlack
bool isBlack() const
return true if the color is black
Definition libstaroffice_internal.hxx:267
STOFFColor::operator==
bool operator==(STOFFColor const &c) const
operator==
Definition libstaroffice_internal.hxx:277
STOFFColor::operator!=
bool operator!=(STOFFColor const &c) const
operator!=
Definition libstaroffice_internal.hxx:282
STOFFColor::setAlpha
void setAlpha(unsigned char alpha)
reset the alpha value
Definition libstaroffice_internal.hxx:247
STOFFColor::isWhite
bool isWhite() const
return true if the color is white
Definition libstaroffice_internal.hxx:272
STOFFColor::STOFFColor
STOFFColor(uint32_t argb=0)
constructor
Definition libstaroffice_internal.hxx:181
STOFFColor::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFColor const &c)
operator<< in the form #rrggbb
Definition libstaroffice_internal.cxx:213
STOFFColor::operator<=
bool operator<=(STOFFColor const &c) const
operator<=
Definition libstaroffice_internal.hxx:292
STOFFColor::getAlpha
unsigned char getAlpha() const
returns the alpha value
Definition libstaroffice_internal.hxx:242
STOFFColor::STOFFColor
STOFFColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition libstaroffice_internal.hxx:185
STOFFColor::value
uint32_t value() const
return the rgba value
Definition libstaroffice_internal.hxx:237
STOFFColor::operator>
bool operator>(STOFFColor const &c) const
operator>
Definition libstaroffice_internal.hxx:297
STOFFColor::white
static STOFFColor white()
return the white color
Definition libstaroffice_internal.hxx:228
STOFFEmbeddedObject
small class use to define a embedded object
Definition libstaroffice_internal.hxx:398
STOFFEmbeddedObject::addAsFillImageTo
bool addAsFillImageTo(librevenge::RVNGPropertyList &propList) const
add the link property to a graph style as bitmap
Definition libstaroffice_internal.cxx:296
STOFFEmbeddedObject::addTo
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist
Definition libstaroffice_internal.cxx:308
STOFFEmbeddedObject::m_typeList
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition libstaroffice_internal.hxx:444
STOFFEmbeddedObject::add
void add(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
add a picture
Definition libstaroffice_internal.hxx:423
STOFFEmbeddedObject::STOFFEmbeddedObject
STOFFEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
constructor
Definition libstaroffice_internal.hxx:404
STOFFEmbeddedObject::m_filenameLink
librevenge::RVNGString m_filenameLink
a picture link
Definition libstaroffice_internal.hxx:446
STOFFEmbeddedObject::m_dataList
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition libstaroffice_internal.hxx:442
STOFFEmbeddedObject::cmp
int cmp(STOFFEmbeddedObject const &pict) const
a comparison function
Definition libstaroffice_internal.cxx:346
STOFFEmbeddedObject::~STOFFEmbeddedObject
~STOFFEmbeddedObject()
destructor
Definition libstaroffice_internal.cxx:292
STOFFEmbeddedObject::operator<<
friend std::ostream & operator<<(std::ostream &o, STOFFEmbeddedObject const &pict)
operator<<
Definition libstaroffice_internal.cxx:371
STOFFEmbeddedObject::isEmpty
bool isEmpty() const
return true if the picture contains no data
Definition libstaroffice_internal.hxx:412
STOFFEmbeddedObject::STOFFEmbeddedObject
STOFFEmbeddedObject()
empty constructor
Definition libstaroffice_internal.hxx:400
STOFFField::m_propertyList
librevenge::RVNGPropertyList m_propertyList
the property list
Definition libstaroffice_internal.hxx:361
STOFFField::addTo
void addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist (if possible)
Definition libstaroffice_internal.cxx:233
STOFFField::STOFFField
STOFFField()
basic constructor
Definition libstaroffice_internal.hxx:355
STOFFLink::m_HRef
std::string m_HRef
the href field
Definition libstaroffice_internal.hxx:375
STOFFLink::addTo
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist (if needed )
Definition libstaroffice_internal.cxx:246
STOFFLink::STOFFLink
STOFFLink()
basic constructor
Definition libstaroffice_internal.hxx:367
STOFFNote::STOFFNote
STOFFNote(Type type)
constructor
Definition libstaroffice_internal.hxx:383
STOFFNote::m_label
librevenge::RVNGString m_label
the note label
Definition libstaroffice_internal.hxx:389
STOFFNote::m_number
int m_number
the note number if defined
Definition libstaroffice_internal.hxx:391
STOFFNote::Type
Type
enum to define note type
Definition libstaroffice_internal.hxx:381
STOFFNote::FootNote
@ FootNote
Definition libstaroffice_internal.hxx:381
STOFFNote::EndNote
@ EndNote
Definition libstaroffice_internal.hxx:381
STOFFNote::m_type
Type m_type
the note type
Definition libstaroffice_internal.hxx:387
STOFFVariable::insert
void insert(STOFFVariable const &orig)
update the current value if orig is set
Definition libstaroffice_internal.hxx:518
STOFFVariable::m_data
T m_data
the value
Definition libstaroffice_internal.hxx:564
STOFFVariable::STOFFVariable
STOFFVariable()
constructor
Definition libstaroffice_internal.hxx:496
STOFFVariable::STOFFVariable
STOFFVariable(T const &def)
constructor with a default value
Definition libstaroffice_internal.hxx:498
STOFFVariable::STOFFVariable
STOFFVariable(STOFFVariable const &orig)
copy constructor
Definition libstaroffice_internal.hxx:500
STOFFVariable::operator=
STOFFVariable & operator=(STOFFVariable const &orig)
copy operator
Definition libstaroffice_internal.hxx:502
STOFFVariable::setSet
void setSet(bool newVal)
define if the variable is set
Definition libstaroffice_internal.hxx:558
STOFFVariable::operator=
STOFFVariable & operator=(T const &val)
set a value
Definition libstaroffice_internal.hxx:511
STOFFVariable::operator*
T & operator*()
operator*
Definition libstaroffice_internal.hxx:542
STOFFVariable::operator->
T const * operator->() const
operator*
Definition libstaroffice_internal.hxx:526
STOFFVariable::isSet
bool isSet() const
return true if the variable is set
Definition libstaroffice_internal.hxx:553
STOFFVariable::get
T const & get() const
return the current value
Definition libstaroffice_internal.hxx:548
STOFFVariable::operator*
T const & operator*() const
operator*
Definition libstaroffice_internal.hxx:537
STOFFVariable::operator->
T * operator->()
operator*
Definition libstaroffice_internal.hxx:531
STOFFVariable::m_set
bool m_set
a flag to know if the variable is set or not
Definition libstaroffice_internal.hxx:566
STOFFVec2::PosSizeLtX
internal struct used to create sorted map, sorted by X
Definition libstaroffice_internal.hxx:715
STOFFVec2::PosSizeLtX::operator()
bool operator()(STOFFVec2< T > const &s1, STOFFVec2< T > const &s2) const
comparaison function
Definition libstaroffice_internal.hxx:717
STOFFVec2::PosSizeLtY
internal struct used to create sorted map, sorted by Y
Definition libstaroffice_internal.hxx:730
STOFFVec2::PosSizeLtY::operator()
bool operator()(STOFFVec2< T > const &s1, STOFFVec2< T > const &s2) const
comparaison function
Definition libstaroffice_internal.hxx:732
STOFFVec3::PosSizeLt
internal struct used to create sorted map, sorted by X, Y, Z
Definition libstaroffice_internal.hxx:907
STOFFVec3::PosSizeLt::operator()
bool operator()(STOFFVec3< T > const &s1, STOFFVec3< T > const &s2) const
comparaison function
Definition libstaroffice_internal.hxx:909
STOFF_shared_ptr_noop_deleter
an noop deleter used to transform a libwpd pointer in a false shared_ptr
Definition libstaroffice_internal.hxx:109
STOFF_shared_ptr_noop_deleter::operator()
void operator()(T *)
Definition libstaroffice_internal.hxx:110