34#ifndef MWAW_POSITION_H
35#define MWAW_POSITION_H
39#include <librevenge/librevenge.h>
70 o <<
"Pos=(" << pos.
m_orig <<
")x(" << dest <<
")";
72 case librevenge::RVNG_INCH:
75 case librevenge::RVNG_POINT:
78 case librevenge::RVNG_TWIP:
81 case librevenge::RVNG_PERCENT:
82 case librevenge::RVNG_GENERIC:
83 case librevenge::RVNG_UNIT_ERROR:
84#if !defined(__clang__)
89 if (pos.
page()>0) o <<
", page=" << pos.
page();
139 librevenge::RVNGUnit
unit()
const
143 static float getScaleFactor(librevenge::RVNGUnit orig, librevenge::RVNGUnit dest)
145 float actSc = 1.0, newSc = 1.0;
147 case librevenge::RVNG_TWIP:
149 case librevenge::RVNG_POINT:
152 case librevenge::RVNG_INCH:
155 case librevenge::RVNG_PERCENT:
156 case librevenge::RVNG_GENERIC:
157 case librevenge::RVNG_UNIT_ERROR:
158#if !defined(__clang__)
161 MWAW_DEBUG_MSG((
"MWAWPosition::getScaleFactor %d unit must not appear\n",
int(orig)));
164 case librevenge::RVNG_TWIP:
166 case librevenge::RVNG_POINT:
169 case librevenge::RVNG_INCH:
172 case librevenge::RVNG_PERCENT:
173 case librevenge::RVNG_GENERIC:
174 case librevenge::RVNG_UNIT_ERROR:
175#if !defined(__clang__)
178 MWAW_DEBUG_MSG((
"MWAWPosition::getScaleFactor %d unit must not appear\n",
int(dest)));
269 if (diff)
return diff < 0 ? -1 : 1;
271 if (diff)
return diff < 0 ? -1 : 1;
273 if (diff)
return diff < 0 ? -1 : 1;
275 if (diff)
return diff < 0 ? -1 : 1;
277 if (diff)
return diff < 0 ? -1 : 1;
279 if (diff)
return diff;
281 if (diff)
return diff;
283 if (diff)
return diff;
285 if (diff)
return diff;
287 if (diff)
return diff;
Class to define the position of an object (textbox, picture, ..) in the document.
Definition: MWAWPosition.hxx:48
MWAWVec2f m_naturalSize
the natural size of the data (if known)
Definition: MWAWPosition.hxx:294
int cmp(MWAWPosition const &f) const
basic function to compare two positions
Definition: MWAWPosition.hxx:266
XPos
an enum used to define the relative X position
Definition: MWAWPosition.hxx:55
@ XRight
Definition: MWAWPosition.hxx:55
@ XFull
Definition: MWAWPosition.hxx:55
@ XLeft
Definition: MWAWPosition.hxx:55
@ XCenter
Definition: MWAWPosition.hxx:55
Wrapping m_wrapping
Wrapping.
Definition: MWAWPosition.hxx:262
void setRelativePosition(AnchorTo anchor, XPos X=XLeft, YPos Y=YTop)
sets the relative position
Definition: MWAWPosition.hxx:221
int m_order
background/foward order
Definition: MWAWPosition.hxx:299
bool operator==(MWAWPosition const &f) const
basic operator==
Definition: MWAWPosition.hxx:93
MWAWPosition(MWAWVec2f const &orig=MWAWVec2f(), MWAWVec2f const &sz=MWAWVec2f(), librevenge::RVNGUnit theUnit=librevenge::RVNG_INCH)
constructor
Definition: MWAWPosition.hxx:61
MWAWVec2f const & naturalSize() const
returns the natural size (if known)
Definition: MWAWPosition.hxx:124
MWAWVec2f const & origin() const
return the frame origin
Definition: MWAWPosition.hxx:114
void setAnchorToCell(librevenge::RVNGString const &cellName)
sets the anchor to a cell position
Definition: MWAWPosition.hxx:228
bool operator!=(MWAWPosition const &f) const
basic operator!=
Definition: MWAWPosition.hxx:98
void setUnit(librevenge::RVNGUnit newUnit)
sets the dimension unit
Definition: MWAWPosition.hxx:209
MWAWVec2f m_orig
the origin position in a page
Definition: MWAWPosition.hxx:294
friend std::ostream & operator<<(std::ostream &o, MWAWPosition const &pos)
operator<<
Definition: MWAWPosition.hxx:67
void setOrigin(MWAWVec2f const &orig)
sets the frame origin
Definition: MWAWPosition.hxx:194
int page() const
returns the frame page
Definition: MWAWPosition.hxx:109
MWAWVec2f const & leftTopClipping() const
returns the left top clipping
Definition: MWAWPosition.hxx:129
void setPagePos(int pg, MWAWVec2f const &newOrig) const
sets/resets the page and the origin
Definition: MWAWPosition.hxx:214
void setPage(int pg) const
sets the page
Definition: MWAWPosition.hxx:189
MWAWVec2f const & size() const
returns the frame size
Definition: MWAWPosition.hxx:119
MWAWVec2f m_LTClip
the left top clip position
Definition: MWAWPosition.hxx:295
static float getScaleFactor(librevenge::RVNGUnit orig, librevenge::RVNGUnit dest)
Definition: MWAWPosition.hxx:143
void setSize(MWAWVec2f const &sz)
sets the frame size
Definition: MWAWPosition.hxx:199
librevenge::RVNGUnit unit() const
returns the unit
Definition: MWAWPosition.hxx:139
int m_page
the page
Definition: MWAWPosition.hxx:293
XPos m_xPos
X relative position.
Definition: MWAWPosition.hxx:258
YPos
an enum used to define the relative Y position
Definition: MWAWPosition.hxx:57
@ YTop
Definition: MWAWPosition.hxx:57
@ YFull
Definition: MWAWPosition.hxx:57
@ YBottom
Definition: MWAWPosition.hxx:57
@ YCenter
Definition: MWAWPosition.hxx:57
float getInvUnitScale(librevenge::RVNGUnit fromUnit) const
returns a float which can be used to scale some data in object unit
Definition: MWAWPosition.hxx:183
~MWAWPosition()
destructor
Definition: MWAWPosition.cxx:36
MWAWVec2f m_RBClip
Definition: MWAWPosition.hxx:295
AnchorTo m_anchorTo
anchor position
Definition: MWAWPosition.hxx:254
int order() const
returns background/foward order
Definition: MWAWPosition.hxx:243
librevenge::RVNGUnit m_unit
the unit used in orig, in m_size and in m_LTClip , .... Default: in inches
Definition: MWAWPosition.hxx:297
void setOrder(int ord) const
set background/foward order
Definition: MWAWPosition.hxx:248
AnchorTo
a list of enum used to defined the anchor
Definition: MWAWPosition.hxx:51
@ Frame
Definition: MWAWPosition.hxx:51
@ Paragraph
Definition: MWAWPosition.hxx:51
@ Unknown
Definition: MWAWPosition.hxx:51
@ Char
Definition: MWAWPosition.hxx:51
@ Page
Definition: MWAWPosition.hxx:51
@ CharBaseLine
Definition: MWAWPosition.hxx:51
@ Cell
Definition: MWAWPosition.hxx:51
bool operator<(MWAWPosition const &f) const
basic operator<
Definition: MWAWPosition.hxx:103
YPos m_yPos
Y relative position.
Definition: MWAWPosition.hxx:260
librevenge::RVNGString m_anchorCellName
the anchor cell name
Definition: MWAWPosition.hxx:256
void setClippingPosition(MWAWVec2f lTop, MWAWVec2f rBottom)
sets the clipping position
Definition: MWAWPosition.hxx:236
MWAWVec2f m_size
Definition: MWAWPosition.hxx:294
MWAWVec2f const & rightBottomClipping() const
returns the right bottom clipping
Definition: MWAWPosition.hxx:134
void setNaturalSize(MWAWVec2f const &naturalSz)
sets the natural size (if known)
Definition: MWAWPosition.hxx:204
Wrapping
an enum used to define the wrapping: none, ...
Definition: MWAWPosition.hxx:53
@ WBackground
Definition: MWAWPosition.hxx:53
@ WForeground
Definition: MWAWPosition.hxx:53
@ WDynamic
Definition: MWAWPosition.hxx:53
@ WRunThrough
Definition: MWAWPosition.hxx:53
@ WParallel
Definition: MWAWPosition.hxx:53
@ WNone
Definition: MWAWPosition.hxx:53
int cmpY(MWAWVec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:729
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:785
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:127