LibreOffice Module tools (master) 1
|
#include <gen.hxx>
Public Member Functions | |
constexpr | Rectangle ()=default |
constexpr | Rectangle (const Point &rLT, const Point &rRB) |
constexpr | Rectangle (tools::Long mnLeft, tools::Long mnTop, tools::Long mnRight, tools::Long mnBottom) |
constexpr | Rectangle (tools::Long mnLeft, tools::Long mnTop) |
Constructs an empty Rectangle, with top/left at the specified params. More... | |
constexpr | Rectangle (const Point &rLT, const Size &rSize) |
Constructs a closed interval rectangle. More... | |
constexpr tools::Long | Left () const |
constexpr tools::Long | Right () const |
constexpr tools::Long | Top () const |
constexpr tools::Long | Bottom () const |
constexpr void | SetLeft (tools::Long v) |
constexpr void | SetRight (tools::Long v) |
constexpr void | SetTop (tools::Long v) |
constexpr void | SetBottom (tools::Long v) |
constexpr Point | TopLeft () const |
constexpr Point | TopRight () const |
constexpr Point | TopCenter () const |
constexpr Point | BottomLeft () const |
constexpr Point | BottomRight () const |
constexpr Point | BottomCenter () const |
constexpr Point | LeftCenter () const |
constexpr Point | RightCenter () const |
constexpr Point | Center () const |
void | Move (tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta) |
Move the top and left edges by a delta, preserving width and height. More... | |
void | Move (Size const &s) |
tools::Long | AdjustLeft (tools::Long nHorzMoveDelta) |
tools::Long | AdjustRight (tools::Long nHorzMoveDelta) |
tools::Long | AdjustTop (tools::Long nVertMoveDelta) |
tools::Long | AdjustBottom (tools::Long nVertMoveDelta) |
void | SetPosX (tools::Long x) |
Set the left edge of the rectangle to x, preserving the width. More... | |
void | SetPosY (tools::Long y) |
Set the top edge of the rectangle to y, preserving the height. More... | |
void | SetPos (const Point &rPoint) |
void | SetWidth (tools::Long) |
void | SetHeight (tools::Long) |
void | SetSize (const Size &) |
constexpr Point | GetPos () const |
constexpr Size | GetSize () const |
constexpr tools::Long | GetWidth () const |
Returns the difference between right and left, assuming the range is inclusive. More... | |
constexpr tools::Long | GetHeight () const |
Returns the difference between bottom and top, assuming the range is inclusive. More... | |
tools::Rectangle & | Union (const tools::Rectangle &rRect) |
tools::Rectangle & | Intersection (const tools::Rectangle &rRect) |
tools::Rectangle | GetUnion (const tools::Rectangle &rRect) const |
tools::Rectangle | GetIntersection (const tools::Rectangle &rRect) const |
void | Normalize () |
bool | Contains (const Point &rPOINT) const |
bool | Contains (const tools::Rectangle &rRect) const |
bool | Overlaps (const tools::Rectangle &rRect) const |
void | SetEmpty () |
void | SetWidthEmpty () |
void | SetHeightEmpty () |
constexpr bool | IsEmpty () const |
constexpr bool | IsWidthEmpty () const |
constexpr bool | IsHeightEmpty () const |
bool | operator== (const tools::Rectangle &rRect) const |
bool | operator!= (const tools::Rectangle &rRect) const |
tools::Rectangle & | operator+= (const Point &rPt) |
tools::Rectangle & | operator-= (const Point &rPt) |
tools::Long | getX () const |
tools::Long | getY () const |
tools::Long | getOpenWidth () const |
Returns the difference between right and left, assuming the range includes one end, but not the other. More... | |
tools::Long | getOpenHeight () const |
Returns the difference between bottom and top, assuming the range includes one end, but not the other. More... | |
void | setWidth (tools::Long n) |
void | setHeight (tools::Long n) |
rtl::OString | toString () const |
Returns the string representation of the rectangle, format is "x, y, width, height". More... | |
void | expand (tools::Long nExpandBy) |
Expands the rectangle in all directions by the input value. More... | |
void | shrink (tools::Long nShrinkBy) |
void | SaturatingSetSize (const Size &rSize) |
Sanitizing variants for handling data from the outside. More... | |
void | SaturatingSetPosX (tools::Long x) |
void | SaturatingSetPosY (tools::Long y) |
constexpr tools::Rectangle | scale (sal_Int64 nMulX, sal_Int64 nDivX, sal_Int64 nMulY, sal_Int64 nDivY) const |
Static Public Member Functions | |
static constexpr Rectangle | Normalize (const Point &rLT, const Point &rRB) |
Private Attributes | |
tools::Long | mnLeft = 0 |
tools::Long | mnTop = 0 |
tools::Long | mnRight = RECT_EMPTY |
tools::Long | mnBottom = RECT_EMPTY |
Static Private Attributes | |
static constexpr short | RECT_EMPTY = -32767 |
Friends | |
tools::Rectangle | operator+ (const tools::Rectangle &rRect, const Point &rPt) |
tools::Rectangle | operator- (const tools::Rectangle &rRect, const Point &rPt) |
|
constexprdefault |
|
inlineconstexpr |
|
inlineconstexpr |
tools::Long tools::Rectangle::AdjustBottom | ( | tools::Long | nVertMoveDelta | ) |
|
inline |
tools::Long tools::Rectangle::AdjustRight | ( | tools::Long | nHorzMoveDelta | ) |
|
inline |
|
inlineconstexpr |
Definition at line 503 of file gen.hxx.
References mnBottom, and mnTop.
Referenced by tools::Polygon::Clip(), tools::PolyPolygon::Clip(), ImplPolygon::ImplPolygon(), and tools::GenericTypeSerializer::writeRectangle().
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 513 of file gen.hxx.
Referenced by ImplPolygon::ImplPolygon().
|
inlineconstexpr |
Definition at line 514 of file gen.hxx.
Referenced by Contains(), and ImplPolygon::ImplPolygon().
|
inlineconstexpr |
bool tools::Rectangle::Contains | ( | const Point & | rPOINT | ) | const |
Definition at line 133 of file gen.cxx.
References mnBottom, mnLeft, mnRight, mnTop, Point::X(), and Point::Y().
Referenced by tools::Polygon::Contains().
bool tools::Rectangle::Contains | ( | const tools::Rectangle & | rRect | ) | const |
Definition at line 161 of file gen.cxx.
References BottomRight(), and TopLeft().
void tools::Rectangle::expand | ( | tools::Long | nExpandBy | ) |
Expands the rectangle in all directions by the input value.
Definition at line 183 of file gen.cxx.
References AdjustLeft, and AdjustRight.
|
inlineconstexpr |
Returns the difference between bottom and top, assuming the range is inclusive.
Definition at line 710 of file gen.hxx.
References mnBottom, mnTop, and n.
Referenced by B3dTransformationSet::CalcViewport(), ImplPolygon::ImplPolygon(), tools::Polygon::Optimize(), and tools::PolyPolygon::Optimize().
|
inline |
Definition at line 732 of file gen.hxx.
References Intersection().
|
inline |
|
inline |
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 537 of file gen.hxx.
Referenced by operator+=().
|
inline |
|
inlineconstexpr |
Returns the difference between right and left, assuming the range is inclusive.
Definition at line 694 of file gen.hxx.
References mnLeft, mnRight, and n.
Referenced by B3dTransformationSet::CalcViewport(), ImplPolygon::ImplPolygon(), tools::Polygon::Optimize(), and tools::PolyPolygon::Optimize().
|
inline |
|
inline |
tools::Rectangle & tools::Rectangle::Intersection | ( | const tools::Rectangle & | rRect | ) |
|
inlineconstexpr |
Definition at line 558 of file gen.hxx.
Referenced by ImplPolygon::ImplPolygon(), Intersection(), Union(), and tools::GenericTypeSerializer::writeRectangle().
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 500 of file gen.hxx.
References mnLeft.
Referenced by B3dTransformationSet::CalcViewport(), tools::Polygon::Clip(), tools::PolyPolygon::Clip(), ImplPolygon::ImplPolygon(), and tools::GenericTypeSerializer::writeRectangle().
|
inlineconstexpr |
|
inline |
Definition at line 522 of file gen.hxx.
References Size::Height(), Move(), and Size::Width().
Referenced by Move().
|
inline |
void tools::Rectangle::Normalize | ( | ) |
|
inlinestaticconstexpr |
Definition at line 631 of file gen.hxx.
References Point::X(), and Point::Y().
Referenced by tools::Polygon::Clip(), ImplPolygon::ImplPolygon(), and Intersection().
|
inline |
|
inline |
Definition at line 754 of file gen.hxx.
References Move, Point::X(), and Point::Y().
|
inline |
Definition at line 760 of file gen.hxx.
References Move, Point::X(), and Point::Y().
|
inline |
bool tools::Rectangle::Overlaps | ( | const tools::Rectangle & | rRect | ) | const |
|
inlineconstexpr |
Definition at line 501 of file gen.hxx.
References mnLeft, and mnRight.
Referenced by tools::Polygon::Clip(), tools::PolyPolygon::Clip(), tools::Polygon::Contains(), ImplPolygon::ImplPolygon(), and tools::GenericTypeSerializer::writeRectangle().
|
inlineconstexpr |
void tools::Rectangle::SaturatingSetPosX | ( | tools::Long | x | ) |
void tools::Rectangle::SaturatingSetPosY | ( | tools::Long | y | ) |
void tools::Rectangle::SaturatingSetSize | ( | const Size & | rSize | ) |
Sanitizing variants for handling data from the outside.
Definition at line 45 of file gen.cxx.
References mnLeft, mnRight, o3tl::saturating_add(), SetWidthEmpty(), and Size::Width().
|
inlineconstexpr |
Definition at line 780 of file gen.hxx.
References Bottom, o3tl::convert(), Left, Right, SetBottom(), SetRight(), and Top.
Referenced by o3tl::convert().
|
inlineconstexpr |
|
inline |
Definition at line 555 of file gen.hxx.
References mnBottom, and mnRight.
Referenced by tools::GenericTypeSerializer::readRectangle().
|
inline |
|
inline |
|
inline |
|
inlineconstexpr |
Definition at line 505 of file gen.hxx.
Referenced by tools::GenericTypeSerializer::readRectangle().
|
inline |
Definition at line 662 of file gen.hxx.
References Point::X(), and Point::Y().
|
inline |
|
inline |
|
inlineconstexpr |
|
inline |
Definition at line 688 of file gen.hxx.
References Size::Height(), and Size::Width().
Referenced by operator+=().
|
inlineconstexpr |
Definition at line 507 of file gen.hxx.
Referenced by tools::GenericTypeSerializer::readRectangle().
|
inline |
|
inline |
|
inline |
void tools::Rectangle::shrink | ( | tools::Long | nShrinkBy | ) |
|
inlineconstexpr |
Definition at line 502 of file gen.hxx.
References mnTop.
Referenced by B3dTransformationSet::CalcViewport(), tools::Polygon::Clip(), tools::PolyPolygon::Clip(), ImplPolygon::ImplPolygon(), and tools::GenericTypeSerializer::writeRectangle().
|
inlineconstexpr |
|
inlineconstexpr |
Definition at line 510 of file gen.hxx.
Referenced by Contains(), and ImplPolygon::ImplPolygon().
|
inlineconstexpr |
Definition at line 511 of file gen.hxx.
Referenced by ImplPolygon::ImplPolygon().
OString tools::Rectangle::toString | ( | ) | const |
tools::Rectangle & tools::Rectangle::Union | ( | const tools::Rectangle & | rRect | ) |
|
friend |
|
friend |
|
private |
Definition at line 603 of file gen.hxx.
Referenced by Intersection(), operator!=(), operator==(), and Union().
|
private |
Definition at line 600 of file gen.hxx.
Referenced by Intersection(), operator!=(), operator==(), SaturatingSetSize(), and Union().
|
private |
Definition at line 602 of file gen.hxx.
Referenced by Intersection(), operator!=(), operator==(), SaturatingSetSize(), and Union().
|
private |
Definition at line 601 of file gen.hxx.
Referenced by Intersection(), operator!=(), operator==(), and Union().
|
staticconstexprprivate |