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>
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:
134{
135};
136
138{
139};
140
142{
143};
144
146{
147};
148
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{
168enum Position { Left = 0, Right = 1, Top = 2, Bottom = 3, HMiddle = 4, VMiddle = 5 };
170enum { LeftBit = 0x01, RightBit = 0x02, TopBit=0x4, BottomBit = 0x08, HMiddleBit = 0x10, VMiddleBit = 0x20 };
171
173std::string numberingTypeToString(NumberingType type);
174std::string numberingValueToString(NumberingType type, int value);
176}
177
181 explicit STOFFColor(uint32_t argb=0) : m_value(argb)
182 {
183 }
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 }
190 STOFFColor &operator=(uint32_t argb)
191 {
192 m_value = argb;
193 return *this;
194 }
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 }
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 }
224 {
225 return STOFFColor(0,0,0);
226 }
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 }
242 unsigned char getAlpha() const
243 {
244 return static_cast<unsigned char>((m_value>>24)&0xFF);
245 }
247 void setAlpha(unsigned char alpha)
248 {
249 m_value=(m_value&0xFFFFFF)|uint32_t(alpha<<24);
250 }
252 unsigned char getBlue() const
253 {
254 return static_cast<unsigned char>(m_value&0xFF);
255 }
257 unsigned char getRed() const
258 {
259 return static_cast<unsigned char>((m_value>>16)&0xFF);
260 }
262 unsigned char getGreen() const
263 {
264 return static_cast<unsigned char>((m_value>>8)&0xFF);
265 }
267 bool isBlack() const
268 {
269 return (m_value&0xFFFFFF)==0;
270 }
272 bool isWhite() const
273 {
274 return (m_value&0xFFFFFF)==0xFFFFFF;
275 }
277 bool operator==(STOFFColor const &c) const
278 {
279 return (c.m_value&0xFFFFFF)==(m_value&0xFFFFFF);
280 }
282 bool operator!=(STOFFColor const &c) const
283 {
284 return !operator==(c);
285 }
287 bool operator<(STOFFColor const &c) const
288 {
289 return (c.m_value&0xFFFFFF)<(m_value&0xFFFFFF);
290 }
292 bool operator<=(STOFFColor const &c) const
293 {
294 return (c.m_value&0xFFFFFF)<=(m_value&0xFFFFFF);
295 }
297 bool operator>(STOFFColor const &c) const
298 {
299 return !operator<=(c);
300 }
302 bool operator>=(STOFFColor const &c) const
303 {
304 return !operator<(c);
305 }
307 friend std::ostream &operator<< (std::ostream &o, STOFFColor const &c);
309 std::string str() const;
310protected:
312 uint32_t m_value;
313};
314
322 bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const;
324 bool isEmpty() const
325 {
326 return m_outWidth==0 && m_inWidth==0;
327 }
329 bool operator==(STOFFBorderLine const &orig) const
330 {
331 return !operator!=(orig);
332 }
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);
350};
351
356 {
357 }
359 void addTo(librevenge::RVNGPropertyList &propList) const;
361 librevenge::RVNGPropertyList m_propertyList;
362};
363
365struct STOFFLink {
368 {
369 }
370
372 bool addTo(librevenge::RVNGPropertyList &propList) const;
373
375 std::string m_HRef;
376};
377
379struct STOFFNote {
383 explicit STOFFNote(Type type) : m_type(type), m_label(""), m_number(-1)
384 {
385 }
389 librevenge::RVNGString m_label;
392};
393
401 {
402 }
404 STOFFEmbeddedObject(librevenge::RVNGBinaryData const &binaryData,
405 std::string type="image/pict") : m_dataList(), m_typeList(), m_filenameLink("")
406 {
407 add(binaryData, type);
408 }
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 }
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 }
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;
453class STOFFList;
454class STOFFParagraph;
455class STOFFSection;
456class STOFFPageSpan;
457
458class STOFFEntry;
459class STOFFHeader;
460class STOFFParser;
461class STOFFPosition;
462
464class STOFFInputStream;
465class STOFFListener;
466class STOFFListManager;
467class STOFFParserState;
469class STOFFSubDocument;
472typedef shared_ptr<STOFFGraphicListener> STOFFGraphicListenerPtr;
474typedef shared_ptr<STOFFInputStream> STOFFInputStreamPtr;
476typedef shared_ptr<STOFFListener> STOFFListenerPtr;
478typedef shared_ptr<STOFFListManager> STOFFListManagerPtr;
480typedef shared_ptr<STOFFParserState> STOFFParserStatePtr;
482typedef shared_ptr<STOFFSpreadsheetListener> STOFFSpreadsheetListenerPtr;
484typedef shared_ptr<STOFFSubDocument> STOFFSubDocumentPtr;
486typedef shared_ptr<STOFFTextListener> STOFFTextListenerPtr;
487
494template <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) {}
503 {
504 if (this != &orig) {
505 m_data = orig.m_data;
506 m_set = orig.m_set;
507 }
508 return *this;
509 }
512 {
513 m_data = val;
514 m_set = true;
515 return *this;
516 }
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 }
526 T const *operator->() const
527 {
528 return &m_data;
529 }
532 {
533 m_set = true;
534 return &m_data;
535 }
537 T const &operator*() const
538 {
539 return m_data;
540 }
543 {
544 m_set = true;
545 return m_data;
546 }
548 T const &get() const
549 {
550 return m_data;
551 }
553 bool isSet() const
554 {
555 return m_set;
556 }
558 void setSet(bool newVal)
559 {
560 m_set=newVal;
561 }
562protected:
566 bool m_set;
567};
568
569/* ---------- vec2/box2f ------------- */
573template <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 }
587 T y() const
588 {
589 return m_y;
590 }
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 }
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 }
611 void setX(T xx)
612 {
613 m_x = xx;
614 }
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
630 {
631 m_x += p.m_x;
632 m_y += p.m_y;
633 return *this;
634 }
637 {
638 m_x -= p.m_x;
639 m_y -= p.m_y;
640 return *this;
641 }
643 template <class U>
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 }
658 friend STOFFVec2<T> operator-(STOFFVec2<T> const &p1, STOFFVec2<T> const &p2)
659 {
660 STOFFVec2<T> p(p1);
661 return p-=p2;
662 }
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 }
677 bool operator!=(STOFFVec2<T> const &p) const
678 {
679 return cmpY(p) != 0;
680 }
682 bool operator<(STOFFVec2<T> const &p) const
683 {
684 return cmpY(p) < 0;
685 }
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 }
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 };
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 };
740 typedef std::map<STOFFVec2<T>, T,struct PosSizeLtY> MapY;
741protected:
743};
744
753
757template <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 }
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 }
779 T y() const
780 {
781 return m_val[1];
782 }
784 T z() const
785 {
786 return m_val[2];
787 }
789 T operator[](int c) const
790 {
791 if (c<0 || c>2) throw libstoff::GenericException();
792 return m_val[c];
793 }
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 }
809 void setX(T xx)
810 {
811 m_val[0] = xx;
812 }
814 void setY(T yy)
815 {
816 m_val[1] = yy;
817 }
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
834 {
835 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]+p.m_val[c]);
836 return *this;
837 }
840 {
841 for (int c = 0; c < 3; c++) m_val[c] = T(m_val[c]-p.m_val[c]);
842 return *this;
843 }
845 template <class U>
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 }
859 friend STOFFVec3<T> operator-(STOFFVec3<T> const &p1, STOFFVec3<T> const &p2)
860 {
861 STOFFVec3<T> p(p1);
862 return p-=p2;
863 }
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 }
878 bool operator!=(STOFFVec3<T> const &p) const
879 {
880 return cmp(p) != 0;
881 }
883 bool operator<(STOFFVec3<T> const &p) const
884 {
885 return cmp(p) < 0;
886 }
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 };
917 typedef std::map<STOFFVec3<T>, T,struct PosSizeLt> Map;
918
919protected:
921 T m_val[3];
922};
923
932
936template <class T> class STOFFBox2
937{
938public:
941 {
942 m_pt[0] = minPt;
943 m_pt[1] = maxPt;
944 }
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 }
957 STOFFVec2<T> const &max() const
958 {
959 return m_pt[1];
960 }
963 {
964 return m_pt[0];
965 }
968 {
969 return m_pt[1];
970 }
974 STOFFVec2<T> const &operator[](int c) const
975 {
976 if (c<0 || c>1) throw libstoff::GenericException();
977 return m_pt[c];
978 }
981 {
982 return m_pt[1]-m_pt[0];
983 }
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 }
998 void setMin(STOFFVec2<T> const &x)
999 {
1000 m_pt[0] = x;
1001 }
1003 void setMax(STOFFVec2<T> const &y)
1004 {
1005 m_pt[1] = y;
1006 }
1007
1010 {
1011 m_pt[1] = m_pt[0]+sz;
1012 }
1015 {
1016 m_pt[0] = m_pt[1]-sz;
1017 }
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
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 }
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 }
1061 bool operator==(STOFFBox2<T> const &p) const
1062 {
1063 return cmp(p) == 0;
1064 }
1066 bool operator!=(STOFFBox2<T> const &p) const
1067 {
1068 return cmp(p) != 0;
1069 }
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 };
1106 typedef std::map<STOFFBox2<T>, T,struct PosSizeLt> Map;
1107
1108protected:
1111};
1112
1119
1120namespace libstoff
1121{
1122// some conversion function
1124template <class T>
1125double convertMiniMToPoint(T const &value)
1126{
1127 return 0.028346457*double(value);
1128}
1130template <class T>
1132{
1133 return 0.028346457f*STOFFVec2f(value);
1134}
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);
1148STOFFVec2f rotatePointAroundCenter(STOFFVec2f const &point, STOFFVec2f const &center, float angle);
1150STOFFBox2f 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:
small class which defines a 2D Box
Definition: libstaroffice_internal.hxx:937
void resizeFromMin(STOFFVec2< T > const &sz)
resize the box keeping the minimum
Definition: libstaroffice_internal.hxx:1009
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition: libstaroffice_internal.hxx:1034
STOFFBox2< T > getIntersection(STOFFBox2< T > const &box) const
returns the intersection between this and box
Definition: libstaroffice_internal.hxx:1051
STOFFVec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libstaroffice_internal.hxx:962
STOFFBox2(STOFFBox2< U > const &p)
generic constructor
Definition: libstaroffice_internal.hxx:946
STOFFVec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition: libstaroffice_internal.hxx:974
void set(STOFFVec2< T > const &x, STOFFVec2< T > const &y)
resets the data to minimum x and maximum y
Definition: libstaroffice_internal.hxx:992
bool operator<(STOFFBox2< T > const &p) const
comparison operator< : fist sorts min by Y,X values then max extremity
Definition: libstaroffice_internal.hxx:1071
STOFFVec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libstaroffice_internal.hxx:952
void setMin(STOFFVec2< T > const &x)
resets the minimum point
Definition: libstaroffice_internal.hxx:998
void setMax(STOFFVec2< T > const &y)
resets the maximum point
Definition: libstaroffice_internal.hxx:1003
friend std::ostream & operator<<(std::ostream &o, STOFFBox2< T > const &f)
print data in form X0xY0<->X1xY1
Definition: libstaroffice_internal.hxx:1087
STOFFVec2< T > size() const
the box size
Definition: libstaroffice_internal.hxx:980
STOFFBox2(STOFFVec2< T > minPt=STOFFVec2< T >(), STOFFVec2< T > maxPt=STOFFVec2< T >())
constructor
Definition: libstaroffice_internal.hxx:940
STOFFVec2< T > m_pt[2]
the two extremities
Definition: libstaroffice_internal.hxx:1110
void scale(U factor)
scales all points of the box by factor
Definition: libstaroffice_internal.hxx:1027
int cmp(STOFFBox2< T > const &p) const
comparison function : fist sorts min by Y,X values then max extremity
Definition: libstaroffice_internal.hxx:1077
std::map< STOFFBox2< T >, T, struct PosSizeLt > Map
map of STOFFBox2
Definition: libstaroffice_internal.hxx:1106
void resizeFromCenter(STOFFVec2< T > const &sz)
resize the box keeping the center
Definition: libstaroffice_internal.hxx:1019
bool operator==(STOFFBox2< T > const &p) const
comparison operator==
Definition: libstaroffice_internal.hxx:1061
void resizeFromMax(STOFFVec2< T > const &sz)
resize the box keeping the maximum
Definition: libstaroffice_internal.hxx:1014
STOFFVec2< T > center() const
the box center
Definition: libstaroffice_internal.hxx:985
STOFFVec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libstaroffice_internal.hxx:967
bool operator!=(STOFFBox2< T > const &p) const
comparison operator!=
Definition: libstaroffice_internal.hxx:1066
STOFFVec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition: libstaroffice_internal.hxx:957
STOFFBox2< T > getUnion(STOFFBox2< T > const &box) const
returns the union between this and box
Definition: libstaroffice_internal.hxx:1041
basic class to store an entry in a file This contained :
Definition: STOFFEntry.hxx:47
Class to store font.
Definition: STOFFFont.hxx:44
This class contains the code needed to create Graphic document.
Definition: STOFFGraphicListener.hxx:60
a structure used to define a picture shape
Definition: STOFFGraphicShape.hxx:46
Class to store a graphic style.
Definition: STOFFGraphicStyle.hxx:45
a function used by STOFFDocument to store the version of document
Definition: STOFFHeader.hxx:57
Internal class used to read the file stream Internal class used to read the file stream,...
Definition: STOFFInputStream.hxx:54
a manager which manages the lists, keeps the different kind of lists, to assure the unicity of each l...
Definition: STOFFList.hxx:197
a small structure used to store the informations about a list
Definition: STOFFList.hxx:103
This class contains a virtual interface to all listener.
Definition: STOFFListener.hxx:51
A class which defines the page properties.
Definition: STOFFPageSpan.hxx:76
class to store the paragraph properties
Definition: STOFFParagraph.hxx:48
a class to define the parser state
Definition: STOFFParser.hxx:50
virtual class which defines the ancestor of all main zone parser
Definition: STOFFParser.hxx:90
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: STOFFPosition.hxx:48
a class which stores section properties
Definition: STOFFSection.hxx:46
This class contents the main functions needed to create a spreadsheet processing Document.
Definition: STOFFSpreadsheetListener.hxx:65
abstract class used to store a subdocument (with a comparison function)
Definition: STOFFSubDocument.hxx:42
This class contains the code needed to create Text document.
Definition: STOFFTextListener.hxx:60
small class which defines a vector with 2 elements
Definition: libstaroffice_internal.hxx:574
bool operator==(STOFFVec2< T > const &p) const
comparison==
Definition: libstaroffice_internal.hxx:672
void setX(T xx)
resets the first element
Definition: libstaroffice_internal.hxx:611
STOFFVec2< T > & operator*=(U scale)
generic operator*=
Definition: libstaroffice_internal.hxx:644
friend STOFFVec2< T > operator*(U scale, STOFFVec2< T > const &p1)
generic operator*
Definition: libstaroffice_internal.hxx:665
std::map< STOFFVec2< T >, T, struct PosSizeLtX > MapX
map of STOFFVec2
Definition: libstaroffice_internal.hxx:725
STOFFVec2(STOFFVec2< U > const &p)
generic copy constructor
Definition: libstaroffice_internal.hxx:579
T m_y
second element
Definition: libstaroffice_internal.hxx:742
std::map< STOFFVec2< T >, T, struct PosSizeLtY > MapY
map of STOFFVec2
Definition: libstaroffice_internal.hxx:740
STOFFVec2< T > & operator+=(STOFFVec2< T > const &p)
operator+=
Definition: libstaroffice_internal.hxx:629
void setY(T yy)
resets the second element
Definition: libstaroffice_internal.hxx:616
T y() const
second element
Definition: libstaroffice_internal.hxx:587
T m_x
first element
Definition: libstaroffice_internal.hxx:742
STOFFVec2< T > & operator-=(STOFFVec2< T > const &p)
operator-=
Definition: libstaroffice_internal.hxx:636
T & operator[](int c)
operator[]
Definition: libstaroffice_internal.hxx:598
friend std::ostream & operator<<(std::ostream &o, STOFFVec2< T > const &f)
operator<<: prints data in form "XxY"
Definition: libstaroffice_internal.hxx:706
int cmpY(STOFFVec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libstaroffice_internal.hxx:696
int cmp(STOFFVec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libstaroffice_internal.hxx:687
T x() const
first element
Definition: libstaroffice_internal.hxx:582
T operator[](int c) const
operator[]
Definition: libstaroffice_internal.hxx:592
STOFFVec2(T xx=0, T yy=0)
constructor
Definition: libstaroffice_internal.hxx:577
void set(T xx, T yy)
resets the two elements
Definition: libstaroffice_internal.hxx:605
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition: libstaroffice_internal.hxx:622
friend STOFFVec2< T > operator-(STOFFVec2< T > const &p1, STOFFVec2< T > const &p2)
operator-
Definition: libstaroffice_internal.hxx:658
bool operator!=(STOFFVec2< T > const &p) const
comparison!=
Definition: libstaroffice_internal.hxx:677
bool operator<(STOFFVec2< T > const &p) const
comparison<: sort by y
Definition: libstaroffice_internal.hxx:682
friend STOFFVec2< T > operator+(STOFFVec2< T > const &p1, STOFFVec2< T > const &p2)
operator+
Definition: libstaroffice_internal.hxx:652
small class which defines a vector with 3 elements
Definition: libstaroffice_internal.hxx:758
T m_val[3]
the values
Definition: libstaroffice_internal.hxx:921
friend STOFFVec3< T > operator+(STOFFVec3< T > const &p1, STOFFVec3< T > const &p2)
operator+
Definition: libstaroffice_internal.hxx:853
friend STOFFVec3< T > operator-(STOFFVec3< T > const &p1, STOFFVec3< T > const &p2)
operator-
Definition: libstaroffice_internal.hxx:859
void setX(T xx)
resets the first element
Definition: libstaroffice_internal.hxx:809
T z() const
third element
Definition: libstaroffice_internal.hxx:784
std::map< STOFFVec3< T >, T, struct PosSizeLt > Map
map of STOFFVec3
Definition: libstaroffice_internal.hxx:917
STOFFVec3(T xx=0, T yy=0, T zz=0)
constructor
Definition: libstaroffice_internal.hxx:761
T y() const
second element
Definition: libstaroffice_internal.hxx:779
T x() const
first element
Definition: libstaroffice_internal.hxx:774
STOFFVec3< T > & operator*=(U scale)
generic operator*=
Definition: libstaroffice_internal.hxx:846
STOFFVec3< T > & operator+=(STOFFVec3< T > const &p)
operator+=
Definition: libstaroffice_internal.hxx:833
friend STOFFVec3< T > operator*(U scale, STOFFVec3< T > const &p1)
generic operator*
Definition: libstaroffice_internal.hxx:866
void set(T xx, T yy, T zz)
resets the three elements
Definition: libstaroffice_internal.hxx:802
STOFFVec3(STOFFVec3< U > const &p)
generic copy constructor
Definition: libstaroffice_internal.hxx:768
friend std::ostream & operator<<(std::ostream &o, STOFFVec3< T > const &f)
operator<<: prints data in form "XxYxZ"
Definition: libstaroffice_internal.hxx:898
void setZ(T zz)
resets the third element
Definition: libstaroffice_internal.hxx:819
T & operator[](int c)
operator[]
Definition: libstaroffice_internal.hxx:795
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition: libstaroffice_internal.hxx:825
bool operator!=(STOFFVec3< T > const &p) const
comparison!=
Definition: libstaroffice_internal.hxx:878
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< T > & operator-=(STOFFVec3< T > const &p)
operator-=
Definition: libstaroffice_internal.hxx:839
bool operator==(STOFFVec3< T > const &p) const
comparison==
Definition: libstaroffice_internal.hxx:873
void setY(T yy)
resets the second element
Definition: libstaroffice_internal.hxx:814
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
T operator[](int c) const
operator[]
Definition: libstaroffice_internal.hxx:789
Definition: libstaroffice_internal.hxx:138
Definition: libstaroffice_internal.hxx:146
Definition: libstaroffice_internal.hxx:142
Definition: libstaroffice_internal.hxx:134
Definition: libstaroffice_internal.hxx:150
STOFFVec2< long > STOFFVec2l
STOFFVec2 of long.
Definition: libstaroffice_internal.hxx:750
#define LIBSTOFF_ATTRIBUTE_PRINTF(fmt, arg)
Definition: libstaroffice_internal.hxx:116
shared_ptr< STOFFListManager > STOFFListManagerPtr
a smart pointer of STOFFListManager
Definition: libstaroffice_internal.hxx:478
STOFFBox2< int > STOFFBox2i
STOFFBox2 of int.
Definition: libstaroffice_internal.hxx:1114
shared_ptr< STOFFTextListener > STOFFTextListenerPtr
a smart pointer of STOFFTextListener
Definition: libstaroffice_internal.hxx:486
shared_ptr< STOFFSubDocument > STOFFSubDocumentPtr
a smart pointer of STOFFSubDocument
Definition: libstaroffice_internal.hxx:484
STOFFVec2< int > STOFFVec2i
STOFFVec2 of int.
Definition: libstaroffice_internal.hxx:748
STOFFVec3< float > STOFFVec3f
STOFFVec3 of float.
Definition: libstaroffice_internal.hxx:931
STOFFVec3< bool > STOFFVec3b
STOFFVec3 of bool.
Definition: libstaroffice_internal.hxx:925
shared_ptr< STOFFParserState > STOFFParserStatePtr
a smart pointer of STOFFParserState
Definition: libstaroffice_internal.hxx:480
STOFFBox2< long > STOFFBox2l
STOFFBox2 of long.
Definition: libstaroffice_internal.hxx:1118
shared_ptr< STOFFListener > STOFFListenerPtr
a smart pointer of STOFFListener
Definition: libstaroffice_internal.hxx:476
STOFFVec3< unsigned char > STOFFVec3uc
STOFFVec3 of unsigned char.
Definition: libstaroffice_internal.hxx:927
shared_ptr< STOFFInputStream > STOFFInputStreamPtr
a smart pointer of STOFFInputStream
Definition: libstaroffice_internal.hxx:474
STOFFVec2< bool > STOFFVec2b
STOFFVec2 of bool.
Definition: libstaroffice_internal.hxx:746
STOFFVec2< float > STOFFVec2f
STOFFVec2 of float.
Definition: libstaroffice_internal.hxx:752
shared_ptr< STOFFSpreadsheetListener > STOFFSpreadsheetListenerPtr
a smart pointer of STOFFSpreadsheetListener
Definition: libstaroffice_internal.hxx:482
STOFFVec3< int > STOFFVec3i
STOFFVec3 of int.
Definition: libstaroffice_internal.hxx:929
STOFFBox2< float > STOFFBox2f
STOFFBox2 of float.
Definition: libstaroffice_internal.hxx:1116
shared_ptr< STOFFGraphicListener > STOFFGraphicListenerPtr
a smart pointer of STOFFGraphicListener
Definition: libstaroffice_internal.hxx:472
namespace used to regroup all libwpd functions, enumerations which we have redefined for internal usa...
Definition: libstaroffice_internal.cxx:51
std::string numberingTypeToString(NumberingType type)
Definition: libstaroffice_internal.cxx:123
NumberingType
Definition: libstaroffice_internal.hxx:172
@ UPPERCASE
Definition: libstaroffice_internal.hxx:172
@ ARABIC
Definition: libstaroffice_internal.hxx:172
@ LOWERCASE
Definition: libstaroffice_internal.hxx:172
@ LOWERCASE_ROMAN
Definition: libstaroffice_internal.hxx:172
@ UPPERCASE_ROMAN
Definition: libstaroffice_internal.hxx:172
@ NONE
Definition: libstaroffice_internal.hxx:172
@ BULLET
Definition: libstaroffice_internal.hxx:172
void appendUnicode(uint32_t val, librevenge::RVNGString &buffer)
adds an unicode character to a string
Definition: libstaroffice_internal.cxx:81
librevenge::RVNGString simplifyString(librevenge::RVNGString const &s)
returns a simplify version of a string.
Definition: libstaroffice_internal.cxx:429
librevenge::RVNGString getString(std::vector< uint32_t > const &unicode)
transform a unicode string in a RNVGString
Definition: libstaroffice_internal.cxx:63
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
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
Position
basic position enum
Definition: libstaroffice_internal.hxx:168
@ Right
Definition: libstaroffice_internal.hxx:168
@ Top
Definition: libstaroffice_internal.hxx:168
@ VMiddle
Definition: libstaroffice_internal.hxx:168
@ HMiddle
Definition: libstaroffice_internal.hxx:168
@ Left
Definition: libstaroffice_internal.hxx:168
@ Bottom
Definition: libstaroffice_internal.hxx:168
std::string numberingValueToString(NumberingType type, int value)
Definition: libstaroffice_internal.cxx:145
double convertMiniMToPoint(T const &value)
convert 1/100th millimeter to point
Definition: libstaroffice_internal.hxx:1125
STOFFVec2f convertMiniMToPointVect(T const &value)
convert 1/100th millimeter vector to point
Definition: libstaroffice_internal.hxx:1131
float getScaleFactor(librevenge::RVNGUnit orig, librevenge::RVNGUnit dest)
factor to convert from one unit to other
Definition: libstaroffice_internal.cxx:483
SubDocumentType
Definition: libstaroffice_internal.hxx:175
@ DOC_SHEET
Definition: libstaroffice_internal.hxx:175
@ DOC_TEXT_BOX
Definition: libstaroffice_internal.hxx:175
@ DOC_GRAPHIC_GROUP
Definition: libstaroffice_internal.hxx:175
@ DOC_NONE
Definition: libstaroffice_internal.hxx:175
@ DOC_HEADER_FOOTER_REGION
Definition: libstaroffice_internal.hxx:175
@ DOC_CHART
Definition: libstaroffice_internal.hxx:175
@ DOC_COMMENT_ANNOTATION
Definition: libstaroffice_internal.hxx:175
@ DOC_CHART_ZONE
Definition: libstaroffice_internal.hxx:175
@ DOC_TABLE
Definition: libstaroffice_internal.hxx:175
@ DOC_NOTE
Definition: libstaroffice_internal.hxx:175
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
@ HMiddleBit
Definition: libstaroffice_internal.hxx:170
@ TopBit
Definition: libstaroffice_internal.hxx:170
@ BottomBit
Definition: libstaroffice_internal.hxx:170
@ RightBit
Definition: libstaroffice_internal.hxx:170
@ VMiddleBit
Definition: libstaroffice_internal.hxx:170
@ LeftBit
Definition: libstaroffice_internal.hxx:170
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
uint8_t readU8(librevenge::RVNGInputStream *input)
Definition: libstaroffice_internal.cxx:52
a border line
Definition: libstaroffice_internal.hxx:316
STOFFColor m_color
the border color
Definition: libstaroffice_internal.hxx:347
int m_outWidth
the outline width in TWIP
Definition: libstaroffice_internal.hxx:343
int m_inWidth
the inline width in TWIP
Definition: libstaroffice_internal.hxx:345
bool addTo(librevenge::RVNGPropertyList &propList, std::string which="") const
add the border property to proplist (if needed )
Definition: libstaroffice_internal.cxx:255
bool operator==(STOFFBorderLine const &orig) const
operator==
Definition: libstaroffice_internal.hxx:329
bool operator!=(STOFFBorderLine const &orig) const
operator!=
Definition: libstaroffice_internal.hxx:334
int m_distance
the border distance
Definition: libstaroffice_internal.hxx:349
friend std::ostream & operator<<(std::ostream &o, STOFFBorderLine const &border)
operator<<
Definition: libstaroffice_internal.cxx:281
STOFFBorderLine()
constructor
Definition: libstaroffice_internal.hxx:318
bool isEmpty() const
returns true if the border is empty
Definition: libstaroffice_internal.hxx:324
internal struct used to create sorted map, sorted first min then max
Definition: libstaroffice_internal.hxx:1096
bool operator()(STOFFBox2< T > const &s1, STOFFBox2< T > const &s2) const
comparaison function
Definition: libstaroffice_internal.hxx:1098
the class to store a color
Definition: libstaroffice_internal.hxx:179
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
unsigned char getRed() const
returns the red value
Definition: libstaroffice_internal.hxx:257
bool operator>=(STOFFColor const &c) const
operator>=
Definition: libstaroffice_internal.hxx:302
STOFFColor & operator=(uint32_t argb)
operator=
Definition: libstaroffice_internal.hxx:190
static STOFFColor barycenter(float alpha, STOFFColor const &colA, float beta, STOFFColor const &colB)
return alpha*colA+beta*colB
Definition: libstaroffice_internal.cxx:199
unsigned char getBlue() const
returns the green value
Definition: libstaroffice_internal.hxx:252
bool operator<(STOFFColor const &c) const
operator<
Definition: libstaroffice_internal.hxx:287
unsigned char getGreen() const
returns the green value
Definition: libstaroffice_internal.hxx:262
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
static STOFFColor black()
return the back color
Definition: libstaroffice_internal.hxx:223
std::string str() const
print the color in the form #rrggbb
Definition: libstaroffice_internal.cxx:225
uint32_t m_value
the argb color
Definition: libstaroffice_internal.hxx:312
bool isBlack() const
return true if the color is black
Definition: libstaroffice_internal.hxx:267
bool operator==(STOFFColor const &c) const
operator==
Definition: libstaroffice_internal.hxx:277
bool operator!=(STOFFColor const &c) const
operator!=
Definition: libstaroffice_internal.hxx:282
void setAlpha(unsigned char alpha)
reset the alpha value
Definition: libstaroffice_internal.hxx:247
bool isWhite() const
return true if the color is white
Definition: libstaroffice_internal.hxx:272
STOFFColor(uint32_t argb=0)
constructor
Definition: libstaroffice_internal.hxx:181
friend std::ostream & operator<<(std::ostream &o, STOFFColor const &c)
operator<< in the form #rrggbb
Definition: libstaroffice_internal.cxx:213
bool operator<=(STOFFColor const &c) const
operator<=
Definition: libstaroffice_internal.hxx:292
unsigned char getAlpha() const
returns the alpha value
Definition: libstaroffice_internal.hxx:242
STOFFColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
constructor from color
Definition: libstaroffice_internal.hxx:185
uint32_t value() const
return the rgba value
Definition: libstaroffice_internal.hxx:237
bool operator>(STOFFColor const &c) const
operator>
Definition: libstaroffice_internal.hxx:297
static STOFFColor white()
return the white color
Definition: libstaroffice_internal.hxx:228
small class use to define a embedded object
Definition: libstaroffice_internal.hxx:398
bool addAsFillImageTo(librevenge::RVNGPropertyList &propList) const
add the link property to a graph style as bitmap
Definition: libstaroffice_internal.cxx:296
bool addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist
Definition: libstaroffice_internal.cxx:308
std::vector< std::string > m_typeList
the picture type: one type by representation
Definition: libstaroffice_internal.hxx:444
void add(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
add a picture
Definition: libstaroffice_internal.hxx:423
STOFFEmbeddedObject(librevenge::RVNGBinaryData const &binaryData, std::string type="image/pict")
constructor
Definition: libstaroffice_internal.hxx:404
librevenge::RVNGString m_filenameLink
a picture link
Definition: libstaroffice_internal.hxx:446
std::vector< librevenge::RVNGBinaryData > m_dataList
the picture content: one data by representation
Definition: libstaroffice_internal.hxx:442
int cmp(STOFFEmbeddedObject const &pict) const
a comparison function
Definition: libstaroffice_internal.cxx:346
~STOFFEmbeddedObject()
destructor
Definition: libstaroffice_internal.cxx:292
friend std::ostream & operator<<(std::ostream &o, STOFFEmbeddedObject const &pict)
operator<<
Definition: libstaroffice_internal.cxx:371
bool isEmpty() const
return true if the picture contains no data
Definition: libstaroffice_internal.hxx:412
STOFFEmbeddedObject()
empty constructor
Definition: libstaroffice_internal.hxx:400
a field
Definition: libstaroffice_internal.hxx:353
librevenge::RVNGPropertyList m_propertyList
the property list
Definition: libstaroffice_internal.hxx:361
void addTo(librevenge::RVNGPropertyList &propList) const
add the link property to proplist (if possible)
Definition: libstaroffice_internal.cxx:233
STOFFField()
basic constructor
Definition: libstaroffice_internal.hxx:355
a note
Definition: libstaroffice_internal.hxx:379
STOFFNote(Type type)
constructor
Definition: libstaroffice_internal.hxx:383
librevenge::RVNGString m_label
the note label
Definition: libstaroffice_internal.hxx:389
int m_number
the note number if defined
Definition: libstaroffice_internal.hxx:391
Type
enum to define note type
Definition: libstaroffice_internal.hxx:381
@ FootNote
Definition: libstaroffice_internal.hxx:381
@ EndNote
Definition: libstaroffice_internal.hxx:381
Type m_type
the note type
Definition: libstaroffice_internal.hxx:387
a generic variable template: value + flag to know if the variable is set
Definition: libstaroffice_internal.hxx:494
void insert(STOFFVariable const &orig)
update the current value if orig is set
Definition: libstaroffice_internal.hxx:518
T m_data
the value
Definition: libstaroffice_internal.hxx:564
STOFFVariable()
constructor
Definition: libstaroffice_internal.hxx:496
STOFFVariable(T const &def)
constructor with a default value
Definition: libstaroffice_internal.hxx:498
STOFFVariable(STOFFVariable const &orig)
copy constructor
Definition: libstaroffice_internal.hxx:500
STOFFVariable & operator=(STOFFVariable const &orig)
copy operator
Definition: libstaroffice_internal.hxx:502
void setSet(bool newVal)
define if the variable is set
Definition: libstaroffice_internal.hxx:558
STOFFVariable & operator=(T const &val)
set a value
Definition: libstaroffice_internal.hxx:511
T & operator*()
operator*
Definition: libstaroffice_internal.hxx:542
T const * operator->() const
operator*
Definition: libstaroffice_internal.hxx:526
bool isSet() const
return true if the variable is set
Definition: libstaroffice_internal.hxx:553
T const & get() const
return the current value
Definition: libstaroffice_internal.hxx:548
T const & operator*() const
operator*
Definition: libstaroffice_internal.hxx:537
T * operator->()
operator*
Definition: libstaroffice_internal.hxx:531
bool m_set
a flag to know if the variable is set or not
Definition: libstaroffice_internal.hxx:566
internal struct used to create sorted map, sorted by X
Definition: libstaroffice_internal.hxx:715
bool operator()(STOFFVec2< T > const &s1, STOFFVec2< T > const &s2) const
comparaison function
Definition: libstaroffice_internal.hxx:717
internal struct used to create sorted map, sorted by Y
Definition: libstaroffice_internal.hxx:730
bool operator()(STOFFVec2< T > const &s1, STOFFVec2< T > const &s2) const
comparaison function
Definition: libstaroffice_internal.hxx:732
internal struct used to create sorted map, sorted by X, Y, Z
Definition: libstaroffice_internal.hxx:907
bool operator()(STOFFVec3< T > const &s1, STOFFVec3< T > const &s2) const
comparaison function
Definition: libstaroffice_internal.hxx:909
an noop deleter used to transform a libwpd pointer in a false shared_ptr
Definition: libstaroffice_internal.hxx:109
void operator()(T *)
Definition: libstaroffice_internal.hxx:110

Generated on Fri Sep 30 2022 11:47:04 for libstaroffice by doxygen 1.9.5