34#ifndef MWAW_POSITION_H
35#define MWAW_POSITION_H
39#include <librevenge/librevenge.h>
86 o <<
"Pos=(" << pos.
m_orig <<
")x(" << dest <<
")";
88 case librevenge::RVNG_INCH:
91 case librevenge::RVNG_POINT:
94 case librevenge::RVNG_TWIP:
97 case librevenge::RVNG_PERCENT:
98 case librevenge::RVNG_GENERIC:
99 case librevenge::RVNG_UNIT_ERROR:
100#if !defined(__clang__)
105 if (pos.
page()>0) o <<
", page=" << pos.
page();
155 librevenge::RVNGUnit
unit()
const
159 static float getScaleFactor(librevenge::RVNGUnit orig, librevenge::RVNGUnit dest)
161 float actSc = 1.0, newSc = 1.0;
163 case librevenge::RVNG_TWIP:
165 case librevenge::RVNG_POINT:
168 case librevenge::RVNG_INCH:
171 case librevenge::RVNG_PERCENT:
172 case librevenge::RVNG_GENERIC:
173 case librevenge::RVNG_UNIT_ERROR:
174#if !defined(__clang__)
177 MWAW_DEBUG_MSG((
"MWAWPosition::getScaleFactor %d unit must not appear\n",
int(orig)));
180 case librevenge::RVNG_TWIP:
182 case librevenge::RVNG_POINT:
185 case librevenge::RVNG_INCH:
188 case librevenge::RVNG_PERCENT:
189 case librevenge::RVNG_GENERIC:
190 case librevenge::RVNG_UNIT_ERROR:
191#if !defined(__clang__)
194 MWAW_DEBUG_MSG((
"MWAWPosition::getScaleFactor %d unit must not appear\n",
int(dest)));
285 if (diff)
return diff < 0 ? -1 : 1;
289 if (diff)
return diff < 0 ? -1 : 1;
291 if (diff)
return diff < 0 ? -1 : 1;
293 if (diff)
return diff < 0 ? -1 : 1;
295 if (diff)
return diff < 0 ? -1 : 1;
297 if (diff)
return diff;
299 if (diff)
return diff;
301 if (diff)
return diff;
303 if (diff)
return diff;
305 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:312
int cmp(MWAWPosition const &f) const
basic function to compare two positions
Definition: MWAWPosition.hxx:282
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:278
void setRelativePosition(AnchorTo anchor, XPos X=XLeft, YPos Y=YTop)
sets the relative position
Definition: MWAWPosition.hxx:237
int m_order
background/foward order
Definition: MWAWPosition.hxx:317
bool operator==(MWAWPosition const &f) const
basic operator==
Definition: MWAWPosition.hxx:109
MWAWPosition & operator=(MWAWPosition const &)=default
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:140
MWAWVec2f const & origin() const
return the frame origin
Definition: MWAWPosition.hxx:130
void setAnchorToCell(librevenge::RVNGString const &cellName)
sets the anchor to a cell position
Definition: MWAWPosition.hxx:244
bool operator!=(MWAWPosition const &f) const
basic operator!=
Definition: MWAWPosition.hxx:114
void setUnit(librevenge::RVNGUnit newUnit)
sets the dimension unit
Definition: MWAWPosition.hxx:225
MWAWVec2f m_orig
the origin position in a page
Definition: MWAWPosition.hxx:312
friend std::ostream & operator<<(std::ostream &o, MWAWPosition const &pos)
operator<<
Definition: MWAWPosition.hxx:83
void setOrigin(MWAWVec2f const &orig)
sets the frame origin
Definition: MWAWPosition.hxx:210
int page() const
returns the frame page
Definition: MWAWPosition.hxx:125
MWAWVec2f const & leftTopClipping() const
returns the left top clipping
Definition: MWAWPosition.hxx:145
void setPagePos(int pg, MWAWVec2f const &newOrig) const
sets/resets the page and the origin
Definition: MWAWPosition.hxx:230
void setPage(int pg) const
sets the page
Definition: MWAWPosition.hxx:205
MWAWVec2f const & size() const
returns the frame size
Definition: MWAWPosition.hxx:135
MWAWVec2f m_LTClip
the left top clip position
Definition: MWAWPosition.hxx:313
static float getScaleFactor(librevenge::RVNGUnit orig, librevenge::RVNGUnit dest)
Definition: MWAWPosition.hxx:159
void setSize(MWAWVec2f const &sz)
sets the frame size
Definition: MWAWPosition.hxx:215
librevenge::RVNGUnit unit() const
returns the unit
Definition: MWAWPosition.hxx:155
int m_page
the page
Definition: MWAWPosition.hxx:311
XPos m_xPos
X relative position.
Definition: MWAWPosition.hxx:274
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
MWAWPosition & operator=(MWAWPosition &&)=default
float getInvUnitScale(librevenge::RVNGUnit fromUnit) const
returns a float which can be used to scale some data in object unit
Definition: MWAWPosition.hxx:199
~MWAWPosition()
destructor
Definition: MWAWPosition.cxx:36
MWAWVec2f m_RBClip
Definition: MWAWPosition.hxx:313
AnchorTo m_anchorTo
anchor position
Definition: MWAWPosition.hxx:270
int order() const
returns background/foward order
Definition: MWAWPosition.hxx:259
librevenge::RVNGUnit m_unit
the unit used in orig, in m_size and in m_LTClip , .... Default: in inches
Definition: MWAWPosition.hxx:315
void setOrder(int ord) const
set background/foward order
Definition: MWAWPosition.hxx:264
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:119
YPos m_yPos
Y relative position.
Definition: MWAWPosition.hxx:276
librevenge::RVNGString m_anchorCellName
the anchor cell name
Definition: MWAWPosition.hxx:272
void setClippingPosition(MWAWVec2f lTop, MWAWVec2f rBottom)
sets the clipping position
Definition: MWAWPosition.hxx:252
MWAWVec2f m_size
Definition: MWAWPosition.hxx:312
MWAWVec2f const & rightBottomClipping() const
returns the right bottom clipping
Definition: MWAWPosition.hxx:150
void setNaturalSize(MWAWVec2f const &naturalSz)
sets the natural size (if known)
Definition: MWAWPosition.hxx:220
MWAWPosition(MWAWPosition const &)=default
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:786
MWAWVec2< float > MWAWVec2f
MWAWVec2 of float.
Definition: libmwaw_internal.hxx:842
#define MWAW_DEBUG_MSG(M)
Definition: libmwaw_internal.hxx:129