34 #ifndef LIBMWAW_INTERNAL_H
35 #define LIBMWAW_INTERNAL_H
48 #define M_PI 3.14159265358979323846
51 #include <libwpd-stream/libwpd-stream.h>
52 #include <libwpd/libwpd.h>
54 #if defined(_MSC_VER) || defined(__DJGPP__)
56 typedef signed char int8_t;
57 typedef unsigned char uint8_t;
58 typedef signed short int16_t;
59 typedef unsigned short uint16_t;
60 typedef signed int int32_t;
61 typedef unsigned int uint32_t;
62 typedef unsigned __int64 uint64_t;
63 typedef __int64 int64_t;
75 #ifdef HAVE_INTTYPES_H
90 #if defined(SHAREDPTR_TR1)
92 using std::tr1::shared_ptr;
93 #elif defined(SHAREDPTR_STD)
95 using std::shared_ptr;
97 #include <boost/shared_ptr.hpp>
98 using boost::shared_ptr;
109 #define MWAW_DEBUG_MSG(M) printf M
111 #define MWAW_DEBUG_MSG(M)
141 uint8_t
readU8(WPXInputStream *input);
166 MWAWColor(
unsigned char r,
unsigned char g,
unsigned char b,
unsigned char a=0) :
167 m_value(uint32_t((a<<24)+(r<<16)+(g<<8)+b)) {
196 return (
m_value&0xFFFFFF)==0xFFFFFF;
225 std::string
str()
const;
243 bool addTo(WPXPropertyList &propList, std::string which=
"")
const;
399 T
const &
get()
const {
439 assert(c >= 0 && c <= 1);
440 return (c==0) ?
m_x :
m_y;
444 assert(c >= 0 && c <= 1);
445 return (c==0) ?
m_x :
m_y;
514 bool operator<(Vec2<T>
const &p)
const {
520 if (diff < 0)
return -1;
521 if (diff > 0)
return 1;
523 if (diff < 0)
return -1;
524 if (diff > 0)
return 1;
530 if (diff < 0)
return -1;
531 if (diff > 0)
return 1;
533 if (diff < 0)
return -1;
534 if (diff > 0)
return 1;
539 friend std::ostream &operator<< (std::ostream &o, Vec2<T>
const &f) {
540 o << f.m_x <<
"x" << f.m_y;
550 return s1.
cmp(s2) < 0;
556 typedef std::map<Vec2<T>, T,
struct PosSizeLtX>
MapX;
564 return s1.
cmpY(s2) < 0;
570 typedef std::map<Vec2<T>, T,
struct PosSizeLtY>
MapY;
598 for (
int c = 0; c < 3; c++)
m_val[c] = T(p[c]);
615 assert(c >= 0 && c <= 2);
620 assert(c >= 0 && c <= 2);
625 void set(T xx, T yy, T zz) {
644 void add(T dx, T dy, T dz) {
663 for (
int c = 0; c < 3; c++)
m_val[c] = T(
m_val[c]*scale);
693 bool operator<(Vec3<T>
const &p)
const {
698 for (
int c = 0; c < 3; c++) {
700 if (diff)
return (diff < 0) ? -1 : 1;
706 friend std::ostream &operator<< (std::ostream &o, Vec3<T>
const &f) {
707 o << f.m_val[0] <<
"x" << f.m_val[1] <<
"x" << f.m_val[2];
717 return s1.
cmp(s2) < 0;
750 for (
int c=0; c < 2; c++)
m_pt[c] = p[c];
774 assert(c >= 0 && c <= 1);
811 m_pt[0] = centerPt - 0.5*sz;
812 m_pt[1] = centerPt + (sz - 0.5*sz);
816 template <
class U>
void scale(U factor) {
836 bool operator<(Box2<T>
const &p)
const {
843 if (diff)
return diff;
845 if (diff)
return diff;
850 friend std::ostream &operator<< (std::ostream &o, Box2<T>
const &f) {
851 o <<
"(" << f.m_pt[0] <<
"<->" << f.m_pt[1] <<
")";
861 return s1.
cmp(s2) < 0;
867 typedef std::map<Box2<T>, T,
struct PosSizeLt>
Map;
Box2< long > Box2l
Box2 of long.
Definition: libmwaw_internal.hxx:879
internal struct used to create sorted map, sorted by X, Y, Z
Definition: libmwaw_internal.hxx:714
void setSet(bool newVal)
define if the variable is set
Definition: libmwaw_internal.hxx:407
Definition: libmwaw_internal.hxx:236
int m_number
the note number if defined
Definition: libmwaw_internal.hxx:310
NumberingType
Definition: libmwaw_internal.hxx:154
void set(Vec2< T > const &x, Vec2< T > const &y)
resets the data to minimum x and maximum y
Definition: libmwaw_internal.hxx:787
void setY(T yy)
resets the second element
Definition: libmwaw_internal.hxx:458
Definition: libmwaw_internal.hxx:157
MWAWColor & operator=(uint32_t argb)
operator=
Definition: libmwaw_internal.hxx:170
Definition: libmwaw_internal.hxx:154
Definition: libmwaw_internal.hxx:234
Vec3< int > Vec3i
Vec3 of int.
Definition: libmwaw_internal.hxx:733
std::string str() const
print the color in the form #rrggbb
Definition: libmwaw_internal.cxx:199
Definition: libmwaw_internal.hxx:154
T m_x
first element
Definition: libmwaw_internal.hxx:572
void add(T dx, T dy, T dz)
increases the actuals values by dx, dy, dz
Definition: libmwaw_internal.hxx:644
Definition: libmwaw_internal.hxx:154
std::string m_data
the database/link field ( if defined )
Definition: libmwaw_internal.hxx:295
bool operator!=(Vec3< T > const &p) const
comparison!=
Definition: libmwaw_internal.hxx:689
small class which defines a vector with 3 elements
Definition: libmwaw_internal.hxx:587
Vec2< T > const & operator[](int c) const
the two extremum points which defined the box
Definition: libmwaw_internal.hxx:773
Definition: libmwaw_internal.hxx:283
Vec2< T > const & min() const
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:754
void appendUnicode(uint32_t val, WPXString &buffer)
adds an unicode character to a string
Definition: libmwaw_internal.cxx:59
Type m_type
the border repetition
Definition: libmwaw_internal.hxx:267
bool operator==(MWAWBorder const &orig) const
operator==
Definition: libmwaw_internal.hxx:249
Definition: libmwaw_internal.hxx:152
bool operator!=(Box2< T > const &p) const
comparison operator!=
Definition: libmwaw_internal.hxx:832
A class which defines the page properties.
Definition: MWAWPageSpan.hxx:95
int cmp(Box2< T > const &p) const
comparison function : fist sorts min by Y,X values then max extremity
Definition: libmwaw_internal.hxx:841
Definition: libmwaw_internal.hxx:157
void insert(Variable const &orig)
update the current value if orig is set
Definition: libmwaw_internal.hxx:374
Vec3< T > & operator*=(U scale)
generic operator*=
Definition: libmwaw_internal.hxx:662
friend Vec2< T > operator-(Vec2< T > const &p1, Vec2< T > const &p2)
operator-
Definition: libmwaw_internal.hxx:494
Vec2< float > Vec2f
Vec2 of float.
Definition: libmwaw_internal.hxx:582
Definition: libmwaw_internal.hxx:283
Variable & operator=(Variable const &orig)
copy operator
Definition: libmwaw_internal.hxx:360
static MWAWColor white()
return the white color
Definition: libmwaw_internal.hxx:179
MWAWNote(Type type)
constructor
Definition: libmwaw_internal.hxx:303
bool operator>(MWAWColor const &c) const
operator>
Definition: libmwaw_internal.hxx:215
bool operator<(MWAWColor const &c) const
operator<
Definition: libmwaw_internal.hxx:207
friend Vec3< T > operator+(Vec3< T > const &p1, Vec3< T > const &p2)
operator+
Definition: libmwaw_internal.hxx:668
Definition: libmwaw_internal.hxx:157
std::string numberingValueToString(NumberingType type, int value)
Definition: libmwaw_internal.cxx:118
T & operator[](int c)
operator[]
Definition: libmwaw_internal.hxx:443
Vec3< T > & operator+=(Vec3< T > const &p)
operator+=
Definition: libmwaw_internal.hxx:651
small class which defines a 2D Box
Definition: libmwaw_internal.hxx:740
void set(T xx, T yy, T zz)
resets the three elements
Definition: libmwaw_internal.hxx:625
internal struct used to create sorted map, sorted first min then max
Definition: libmwaw_internal.hxx:858
void resizeFromMin(Vec2< T > const &sz)
resize the box keeping the minimum
Definition: libmwaw_internal.hxx:801
Definition: libmwaw_internal.hxx:152
uint8_t readU8(WPXInputStream *input)
Definition: libmwaw_internal.cxx:48
Definition: libmwaw_internal.hxx:283
internal struct used to create sorted map, sorted by X
Definition: libmwaw_internal.hxx:547
std::map< Vec2< int >, int, struct PosSizeLtY > MapY
Definition: libmwaw_internal.hxx:570
bool operator==(MWAWColor const &c) const
operator==
Definition: libmwaw_internal.hxx:199
static MWAWColor black()
return the back color
Definition: libmwaw_internal.hxx:175
bool isSet() const
return true if the variable is set
Definition: libmwaw_internal.hxx:403
T & operator[](int c)
operator[]
Definition: libmwaw_internal.hxx:619
SubDocumentType
Definition: libmwaw_internal.hxx:157
Vec2< T > & operator+=(Vec2< T > const &p)
operator+=
Definition: libmwaw_internal.hxx:469
Vec2< bool > Vec2b
Vec2 of bool.
Definition: libmwaw_internal.hxx:576
void set(T xx, T yy)
resets the two elements
Definition: libmwaw_internal.hxx:449
std::string numberingTypeToString(NumberingType type)
Definition: libmwaw_internal.cxx:96
void extend(T val)
extends the bdbox by (val, val) keeping the center
Definition: libmwaw_internal.hxx:822
Definition: libmwaw_internal.hxx:150
double m_width
the border total width in point
Definition: libmwaw_internal.hxx:269
Definition: libmwaw_internal.hxx:150
Vec3< unsigned char > Vec3uc
Vec3 of unsigned char.
Definition: libmwaw_internal.hxx:731
Position
basic position enum
Definition: libmwaw_internal.hxx:150
Definition: libmwaw_internal.hxx:150
friend Vec3< T > operator-(Vec3< T > const &p1, Vec3< T > const &p2)
operator-
Definition: libmwaw_internal.hxx:673
Type m_type
the note type
Definition: libmwaw_internal.hxx:306
Definition: libmwaw_internal.hxx:150
Box2< float > Box2f
Box2 of float.
Definition: libmwaw_internal.hxx:877
Vec2< T > & max()
the maximum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:766
Definition: libmwaw_internal.hxx:301
Type
the line repetition
Definition: libmwaw_internal.hxx:236
friend std::ostream & operator<<(std::ostream &o, MWAWColor const &c)
operator<< in the form #rrggbb
Definition: libmwaw_internal.cxx:187
Vec2< T > center() const
the box center
Definition: libmwaw_internal.hxx:782
friend std::ostream & operator<<(std::ostream &o, MWAWBorder const &border)
operator<<
Definition: libmwaw_internal.cxx:311
the class to store a color
Definition: libmwaw_internal.hxx:161
Definition: libmwaw_internal.hxx:133
Vec2< int > Vec2i
Vec2 of int.
Definition: libmwaw_internal.hxx:578
shared_ptr< MWAWSubDocument > MWAWSubDocumentPtr
a smart pointer of MWAWSubDocument
Definition: libmwaw_internal.hxx:344
bool operator==(Vec2< T > const &p) const
comparison==
Definition: libmwaw_internal.hxx:506
Definition: libmwaw_internal.hxx:283
MWAWField(Type type)
basic constructor
Definition: libmwaw_internal.hxx:286
MWAWColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a=0)
constructor from color
Definition: libmwaw_internal.hxx:166
Vec3< float > Vec3f
Vec3 of float.
Definition: libmwaw_internal.hxx:735
Definition: libmwaw_internal.hxx:150
Style
the line style
Definition: libmwaw_internal.hxx:234
bool operator!=(Vec2< T > const &p) const
comparison!=
Definition: libmwaw_internal.hxx:510
Definition: libmwaw_internal.hxx:154
T y() const
second element
Definition: libmwaw_internal.hxx:434
Vec2(T xx=0, T yy=0)
constructor
Definition: libmwaw_internal.hxx:425
Vec3(T xx=0, T yy=0, T zz=0)
constructor
Definition: libmwaw_internal.hxx:591
Type
enum to define note type
Definition: libmwaw_internal.hxx:301
void setX(T xx)
resets the first element
Definition: libmwaw_internal.hxx:454
int cmp(Vec3< T > const &p) const
a comparison function: which first compares x values, then y values then z values.
Definition: libmwaw_internal.hxx:697
bool operator==(Vec3< T > const &p) const
comparison==
Definition: libmwaw_internal.hxx:685
std::vector< double > m_widthsList
the different length used for each line/sep (if defined)
Definition: libmwaw_internal.hxx:273
int compare(MWAWBorder const &orig) const
compare two cell
Definition: libmwaw_internal.cxx:207
std::map< Box2< int >, int, struct PosSizeLt > Map
Definition: libmwaw_internal.hxx:867
a border
Definition: libmwaw_internal.hxx:232
a class to define the parser state
Definition: MWAWParser.hxx:51
shared_ptr< MWAWRSRCParser > MWAWRSRCParserPtr
a smart pointer of MWAWRSRCParser
Definition: libmwaw_internal.hxx:340
Definition: libmwaw_internal.hxx:157
WPXString m_label
the note label
Definition: libmwaw_internal.hxx:308
Definition: libmwaw_internal.hxx:234
Definition: libmwaw_internal.hxx:283
Variable(Variable const &orig)
copy constructor
Definition: libmwaw_internal.hxx:358
Vec3< T > & operator-=(Vec3< T > const &p)
operator-=
Definition: libmwaw_internal.hxx:656
Definition: libmwaw_internal.hxx:129
Variable(T def)
constructor with a default value
Definition: libmwaw_internal.hxx:356
T const * operator->() const
operator*
Definition: libmwaw_internal.hxx:381
Variable()
constructor
Definition: libmwaw_internal.hxx:354
Type m_type
the type
Definition: libmwaw_internal.hxx:289
Definition: libmwaw_internal.hxx:154
Vec2< T > const & max() const
the maximum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:758
Definition: libmwaw_internal.hxx:154
bool m_set
a flag to know if the variable is set or not
Definition: libmwaw_internal.hxx:414
abstract class used to store a subdocument (with a comparison function)
Definition: MWAWSubDocument.hxx:41
Box2(Box2< U > const &p)
generic constructor
Definition: libmwaw_internal.hxx:749
Box2< int > Box2i
Box2 of int.
Definition: libmwaw_internal.hxx:875
internal struct used to create sorted map, sorted by Y
Definition: libmwaw_internal.hxx:561
bool operator!=(MWAWColor const &c) const
operator!=
Definition: libmwaw_internal.hxx:203
Vec2< T > m_pt[2]
the two extremities
Definition: libmwaw_internal.hxx:871
T x() const
first element
Definition: libmwaw_internal.hxx:430
Definition: libmwaw_internal.hxx:234
bool operator>=(MWAWColor const &c) const
operator>=
Definition: libmwaw_internal.hxx:219
a manager which manages the lists, keeps the different kind of lists, to assure the unicity of each l...
Definition: MWAWList.hxx:182
Definition: libmwaw_internal.hxx:152
void add(T dx, T dy)
increases the actuals values by dx and dy
Definition: libmwaw_internal.hxx:463
T operator[](int c) const
operator[]
Definition: libmwaw_internal.hxx:614
Definition: libmwaw_internal.hxx:125
std::map< Vec3< T >, T, struct PosSizeLt > Map
map of Vec3
Definition: libmwaw_internal.hxx:723
MWAWColor(uint32_t argb=0)
constructor
Definition: libmwaw_internal.hxx:163
bool operator()(Vec2< T > const &s1, Vec2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:563
Definition: libmwaw_internal.hxx:236
Vec2< T > & operator-=(Vec2< T > const &p)
operator-=
Definition: libmwaw_internal.hxx:475
Definition: libmwaw_internal.hxx:121
Vec2< T > & operator*=(U scale)
generic operator*=
Definition: libmwaw_internal.hxx:482
T & operator*()
operator*
Definition: libmwaw_internal.hxx:394
Definition: libmwaw_internal.hxx:283
static MWAWColor barycenter(float alpha, MWAWColor const &colA, float beta, MWAWColor const &colB)
return alpha*colA+beta*colB
Definition: libmwaw_internal.cxx:173
int cmpY(Vec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:528
a class which stores section properties
Definition: MWAWSection.hxx:45
shared_ptr< MWAWInputStream > MWAWInputStreamPtr
a smart pointer of MWAWInputStream
Definition: libmwaw_internal.hxx:336
void setZ(T zz)
resets the third element
Definition: libmwaw_internal.hxx:639
bool operator!=(MWAWBorder const &orig) const
operator!=
Definition: libmwaw_internal.hxx:253
std::map< Vec2< int >, int, struct PosSizeLtX > MapX
Definition: libmwaw_internal.hxx:556
Definition: libmwaw_internal.hxx:152
Style m_style
the border style
Definition: libmwaw_internal.hxx:265
a namespace used to convert Mac font characters in unicode
Definition: MWAWFontConverter.hxx:63
Definition: libmwaw_internal.hxx:283
Definition: libmwaw_internal.hxx:301
an noop deleter used to transform a libwpd pointer in a false shared_ptr
Definition: libmwaw_internal.hxx:103
Vec2(Vec2< U > const &p)
generic copy constructor
Definition: libmwaw_internal.hxx:427
Definition: libmwaw_internal.hxx:152
bool operator==(Box2< T > const &p) const
comparison operator==
Definition: libmwaw_internal.hxx:828
T y() const
second element
Definition: libmwaw_internal.hxx:606
shared_ptr< MWAWFontConverter > MWAWFontConverterPtr
a smart pointer of MWAWFontConverter
Definition: libmwaw_internal.hxx:334
T operator[](int c) const
operator[]
Definition: libmwaw_internal.hxx:438
bool operator()(Vec3< T > const &s1, Vec3< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:716
Definition: libmwaw_internal.hxx:154
T * operator->()
operator*
Definition: libmwaw_internal.hxx:385
Definition: libmwaw_internal.hxx:283
T m_data
the value
Definition: libmwaw_internal.hxx:412
class to store the paragraph properties
Definition: MWAWParagraph.hxx:83
void resizeFromMax(Vec2< T > const &sz)
resize the box keeping the maximum
Definition: libmwaw_internal.hxx:805
shared_ptr< MWAWContentListener > MWAWContentListenerPtr
a smart pointer of MWAWContentListener
Definition: libmwaw_internal.hxx:330
Definition: libmwaw_internal.hxx:234
void scale(U factor)
scales all points of the box by factor
Definition: libmwaw_internal.hxx:816
a field
Definition: libmwaw_internal.hxx:281
void setMax(Vec2< T > const &y)
resets the maximum point
Definition: libmwaw_internal.hxx:796
std::string m_DTFormat
the date/time format using strftime format if defined
Definition: libmwaw_internal.hxx:291
void setY(T yy)
resets the second element
Definition: libmwaw_internal.hxx:635
void setMin(Vec2< T > const &x)
resets the minimum point
Definition: libmwaw_internal.hxx:792
T z() const
third element
Definition: libmwaw_internal.hxx:610
bool operator<=(MWAWColor const &c) const
operator<=
Definition: libmwaw_internal.hxx:211
Definition: libmwaw_internal.hxx:236
Definition: libmwaw_internal.hxx:157
shared_ptr< MWAWParserState > MWAWParserStatePtr
a smart pointer of MWAWParserState
Definition: libmwaw_internal.hxx:342
std::string m_extra
extra data ( if needed)
Definition: libmwaw_internal.hxx:277
Box2(Vec2< T > minPt=Vec2< T >(), Vec2< T > maxPt=Vec2< T >())
constructor
Definition: libmwaw_internal.hxx:744
bool isWhite() const
return true if the color is white
Definition: libmwaw_internal.hxx:195
T m_val[3]
the values
Definition: libmwaw_internal.hxx:727
a note
Definition: libmwaw_internal.hxx:299
virtual class which defines the ancestor of all main zone parser
Definition: MWAWParser.hxx:87
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
Type
Defines some basic type for field.
Definition: libmwaw_internal.hxx:283
bool isBlack() const
return true if the color is black
Definition: libmwaw_internal.hxx:191
MWAWBorder()
constructor
Definition: libmwaw_internal.hxx:239
basic class to store an entry in a file This contained :
Definition: MWAWEntry.hxx:46
bool addTo(WPXPropertyList &propList, std::string which="") const
add the border property to proplist (if needed )
Definition: libmwaw_internal.cxx:219
small class which defines a vector with 2 elements
Definition: libmwaw_internal.hxx:421
bool operator()(Vec2< T > const &s1, Vec2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:549
void operator()(T *)
Definition: libmwaw_internal.hxx:104
Definition: MWAWContentListener.hxx:52
friend Vec2< T > operator*(U scale, Vec2< T > const &p1)
generic operator*
Definition: libmwaw_internal.hxx:500
T const & operator*() const
operator*
Definition: libmwaw_internal.hxx:390
Vec2< T > size() const
the box size
Definition: libmwaw_internal.hxx:778
void setX(T xx)
resets the first element
Definition: libmwaw_internal.hxx:631
a small structure used to store the informations about a list
Definition: MWAWList.hxx:104
Definition: libmwaw_internal.hxx:234
the main class to read a Mac resource fork
Definition: MWAWRSRCParser.hxx:48
Definition: libmwaw_internal.hxx:152
uint32_t value() const
return the rgba value
Definition: libmwaw_internal.hxx:187
MWAWColor m_color
the border color
Definition: libmwaw_internal.hxx:275
libmwaw::NumberingType m_numberingType
the number type ( for number field )
Definition: libmwaw_internal.hxx:293
T x() const
first element
Definition: libmwaw_internal.hxx:602
T m_y
second element
Definition: libmwaw_internal.hxx:572
Vec2< long > Vec2l
Vec2 of long.
Definition: libmwaw_internal.hxx:580
bool operator()(Box2< T > const &s1, Box2< T > const &s2) const
comparaison function
Definition: libmwaw_internal.hxx:860
Definition: libmwaw_internal.hxx:157
a generic variable template: value + flag to know if the variable is set
Definition: libmwaw_internal.hxx:352
Definition: libmwaw_internal.hxx:150
int cmp(Vec2< T > const &p) const
a comparison function: which first compares x then y
Definition: libmwaw_internal.hxx:518
uint32_t m_value
the argb color
Definition: libmwaw_internal.hxx:228
Variable & operator=(T val)
set a value
Definition: libmwaw_internal.hxx:368
Definition: libmwaw_internal.hxx:117
Vec3(Vec3< U > const &p)
generic copy constructor
Definition: libmwaw_internal.hxx:597
friend Vec3< T > operator*(U scale, Vec3< T > const &p1)
generic operator*
Definition: libmwaw_internal.hxx:679
void resizeFromCenter(Vec2< T > const &sz)
resize the box keeping the center
Definition: libmwaw_internal.hxx:809
shared_ptr< MWAWListManager > MWAWListManagerPtr
a smart pointer of MWAWListManager
Definition: libmwaw_internal.hxx:338
Vec2< T > & min()
the minimum 2D point (in x and in y)
Definition: libmwaw_internal.hxx:762
bool isEmpty() const
returns true if the border is empty
Definition: libmwaw_internal.hxx:245
friend Vec2< T > operator+(Vec2< T > const &p1, Vec2< T > const &p2)
operator+
Definition: libmwaw_internal.hxx:489