34 #ifndef MWAW_POSITION_H
35 #define MWAW_POSITION_H
39 #include <librevenge/librevenge.h>
85 o <<
"Pos=(" << pos.
m_orig <<
")x(" << dest <<
")";
87 case librevenge::RVNG_INCH:
90 case librevenge::RVNG_POINT:
93 case librevenge::RVNG_TWIP:
96 case librevenge::RVNG_PERCENT:
97 case librevenge::RVNG_GENERIC:
98 case librevenge::RVNG_UNIT_ERROR:
99 #if !defined(__clang__)
104 if (pos.
page()>0) o <<
", page=" << pos.
page();
154 librevenge::RVNGUnit
unit()
const
158 static float getScaleFactor(librevenge::RVNGUnit orig, librevenge::RVNGUnit dest)
160 float actSc = 1.0, newSc = 1.0;
162 case librevenge::RVNG_TWIP:
164 case librevenge::RVNG_POINT:
167 case librevenge::RVNG_INCH:
170 case librevenge::RVNG_PERCENT:
171 case librevenge::RVNG_GENERIC:
172 case librevenge::RVNG_UNIT_ERROR:
173 #if !defined(__clang__)
176 MWAW_DEBUG_MSG((
"MWAWPosition::getScaleFactor %d unit must not appear\n",
int(orig)));
179 case librevenge::RVNG_TWIP:
181 case librevenge::RVNG_POINT:
184 case librevenge::RVNG_INCH:
187 case librevenge::RVNG_PERCENT:
188 case librevenge::RVNG_GENERIC:
189 case librevenge::RVNG_UNIT_ERROR:
190 #if !defined(__clang__)
193 MWAW_DEBUG_MSG((
"MWAWPosition::getScaleFactor %d unit must not appear\n",
int(dest)));
283 int diff = int(m_anchorTo) - int(f.
m_anchorTo);
284 if (diff)
return diff < 0 ? -1 : 1;
287 diff = int(m_xPos) - int(f.
m_xPos);
288 if (diff)
return diff < 0 ? -1 : 1;
289 diff = int(m_yPos) - int(f.
m_yPos);
290 if (diff)
return diff < 0 ? -1 : 1;
292 if (diff)
return diff < 0 ? -1 : 1;
294 if (diff)
return diff < 0 ? -1 : 1;
296 if (diff)
return diff;
298 if (diff)
return diff;
300 if (diff)
return diff;
302 if (diff)
return diff;
304 if (diff)
return diff;
Definition: MWAWPosition.hxx:51
MWAWVec2f m_orig
the origin position in a page
Definition: MWAWPosition.hxx:311
librevenge::RVNGUnit m_unit
the unit used in orig, in m_size and in m_LTClip , .... Default: in inches
Definition: MWAWPosition.hxx:314
Definition: MWAWPosition.hxx:55
MWAWVec2f const & size() const
returns the frame size
Definition: MWAWPosition.hxx:134
Definition: MWAWPosition.hxx:53
void setOrigin(MWAWVec2f const &orig)
sets the frame origin
Definition: MWAWPosition.hxx:209
MWAWVec2f const & leftTopClipping() const
returns the left top clipping
Definition: MWAWPosition.hxx:144
void setPage(int pg) const
sets the page
Definition: MWAWPosition.hxx:204
int m_order
background/foward order
Definition: MWAWPosition.hxx:316
Definition: MWAWPosition.hxx:51
Definition: MWAWPosition.hxx:53
Definition: MWAWPosition.hxx:55
YPos
an enum used to define the relative Y position
Definition: MWAWPosition.hxx:57
MWAWVec2f m_naturalSize
the natural size of the data (if known)
Definition: MWAWPosition.hxx:311
void setNaturalSize(MWAWVec2f const &naturalSz)
sets the natural size (if known)
Definition: MWAWPosition.hxx:219
MWAWVec2f const & origin() const
return the frame origin
Definition: MWAWPosition.hxx:129
Definition: MWAWPosition.hxx:55
XPos
an enum used to define the relative X position
Definition: MWAWPosition.hxx:55
librevenge::RVNGString m_anchorCellName
the anchor cell name
Definition: MWAWPosition.hxx:271
bool operator<(MWAWPosition const &f) const
basic operator<
Definition: MWAWPosition.hxx:118
bool operator!=(MWAWPosition const &f) const
basic operator!=
Definition: MWAWPosition.hxx:113
void setPagePos(int pg, MWAWVec2f const &newOrig) const
sets/resets the page and the origin
Definition: MWAWPosition.hxx:229
static float getScaleFactor(librevenge::RVNGUnit orig, librevenge::RVNGUnit dest)
Definition: MWAWPosition.hxx:158
AnchorTo m_anchorTo
anchor position
Definition: MWAWPosition.hxx:269
Definition: MWAWPosition.hxx:57
Definition: MWAWPosition.hxx:57
friend std::ostream & operator<<(std::ostream &o, MWAWPosition const &pos)
operator<<
Definition: MWAWPosition.hxx:82
Definition: MWAWPosition.hxx:51
Definition: MWAWPosition.hxx:55
Definition: MWAWPosition.hxx:53
void setOrder(int ord) const
set background/foward order
Definition: MWAWPosition.hxx:263
MWAWVec2f const & rightBottomClipping() const
returns the right bottom clipping
Definition: MWAWPosition.hxx:149
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:129
int cmpY(MWAWVec2< T > const &p) const
a comparison function: which first compares y then x
Definition: libmwaw_internal.hxx:784
Definition: MWAWPosition.hxx:53
bool operator==(MWAWPosition const &f) const
basic operator==
Definition: MWAWPosition.hxx:108
AnchorTo
a list of enum used to defined the anchor
Definition: MWAWPosition.hxx:51
Definition: MWAWPosition.hxx:57
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:840
MWAWVec2f m_RBClip
Definition: MWAWPosition.hxx:312
YPos m_yPos
Y relative position.
Definition: MWAWPosition.hxx:275
~MWAWPosition()
destructor
Definition: MWAWPosition.cxx:36
void setRelativePosition(AnchorTo anchor, XPos X=XLeft, YPos Y=YTop)
sets the relative position
Definition: MWAWPosition.hxx:236
MWAWVec2f m_size
Definition: MWAWPosition.hxx:311
void setSize(MWAWVec2f const &sz)
sets the frame size
Definition: MWAWPosition.hxx:214
XPos m_xPos
X relative position.
Definition: MWAWPosition.hxx:273
Definition: MWAWPosition.hxx:51
Definition: MWAWPosition.hxx:51
MWAWVec2f const & naturalSize() const
returns the natural size (if known)
Definition: MWAWPosition.hxx:139
MWAWVec2f m_LTClip
the left top clip position
Definition: MWAWPosition.hxx:312
void setAnchorToCell(librevenge::RVNGString const &cellName)
sets the anchor to a cell position
Definition: MWAWPosition.hxx:243
int cmp(MWAWPosition const &f) const
basic function to compare two positions
Definition: MWAWPosition.hxx:281
MWAWPosition(MWAWVec2f const &orig=MWAWVec2f(), MWAWVec2f const &sz=MWAWVec2f(), librevenge::RVNGUnit theUnit=librevenge::RVNG_INCH)
constructor
Definition: MWAWPosition.hxx:61
Definition: MWAWPosition.hxx:53
Wrapping
an enum used to define the wrapping: none, ...
Definition: MWAWPosition.hxx:53
librevenge::RVNGUnit unit() const
returns the unit
Definition: MWAWPosition.hxx:154
Definition: MWAWPosition.hxx:53
Class to define the position of an object (textbox, picture, ..) in the document. ...
Definition: MWAWPosition.hxx:47
void setUnit(librevenge::RVNGUnit newUnit)
sets the dimension unit
Definition: MWAWPosition.hxx:224
int page() const
returns the frame page
Definition: MWAWPosition.hxx:124
MWAWPosition & operator=(MWAWPosition const &)=default
void setClippingPosition(MWAWVec2f lTop, MWAWVec2f rBottom)
sets the clipping position
Definition: MWAWPosition.hxx:251
Definition: MWAWPosition.hxx:51
Definition: MWAWPosition.hxx:51
Wrapping m_wrapping
Wrapping.
Definition: MWAWPosition.hxx:277
int m_page
the page
Definition: MWAWPosition.hxx:310
Definition: MWAWPosition.hxx:57
int order() const
returns background/foward order
Definition: MWAWPosition.hxx:258
float getInvUnitScale(librevenge::RVNGUnit fromUnit) const
returns a float which can be used to scale some data in object unit
Definition: MWAWPosition.hxx:198