15#include <glibmm/i18n.h>
87 this->
_size_label = value ? std::string(value) :
"";
156 if (rect.hasZeroArea())
177 if (rect.hasZeroArea()) {
220 this->
x = rect.
left();
221 this->
y = rect.
top();
306 this->
margin.
set(value, value, value, value);
398 [
this](
auto const &
obj) {
399 auto const *as_item = cast<SPItem>(&obj);
400 return as_item && itemOnPage(as_item);
492 g_warning(
"Page is already at this index. Not moving.");
573 set.applyAffine(translate,
true,
false,
true);
643 auto ret = std::string(format);
654 return std::string(
ret);
Lookup dictionary for attributes/properties.
3x3 matrix representing an affine transformation.
bool isTranslation(Coord eps=EPSILON) const
Check whether this matrix represents a pure translation.
static CRect from_xywh(Coord x, Coord y, Coord w, Coord h)
Create rectangle from origin and dimensions.
C right() const
Return rightmost coordinate of the rectangle (+X is to the right).
bool contains(GenericRect< C > const &r) const
Check whether the rectangle includes all points in the given rectangle.
bool intersects(GenericRect< C > const &r) const
Check whether the rectangles have any common points.
void setLeft(C val)
Set the minimum X coordinate of the rectangle.
C top() const
Return top coordinate of the rectangle (+Y is downwards).
void setTop(C val)
Set the minimum Y coordinate of the rectangle.
void setRight(C val)
Set the maximum X coordinate of the rectangle.
void setBottom(C val)
Set the maximum Y coordinate of the rectangle.
C left() const
Return leftmost coordinate of the rectangle (+X is to the right).
C height() const
Get the vertical extent of the rectangle.
C width() const
Get the horizontal extent of the rectangle.
C bottom() const
Return bottom coordinate of the rectangle (+Y is downwards).
CPoint corner(unsigned i) const
Return the n-th corner of the rectangle.
Two-dimensional point that doubles as a vector.
Axis aligned, non-empty rectangle.
void update(Geom::Rect size, Geom::OptRect margin, Geom::OptRect bleed, const char *txt, bool outline, bool is_yaxisdown)
Update the visual representation of a page on screen.
void add(Geom::Rect size, CanvasItemGroup *background_group, CanvasItemGroup *foreground_group)
Add the page canvas to the given canvas item groups (canvas view is implicit)
void set_guides_visible(bool show)
bool setDefaultAttributes(CanvasPage *item)
Update the canvas item with the default display attributes.
bool showDefaultLabel() const
int getPageIndex(const SPPage *page) const
Get page index, returns -1 if the page is not found in this document.
Interface for refcounted XML nodes.
virtual Node * parent()=0
Get the parent of this node.
virtual void changeOrder(Node *child, Node *after)=0
Move a given node in this node's child order.
void setAttributeOrRemoveIfEmpty(Inkscape::Util::const_char_ptr key, Inkscape::Util::const_char_ptr value)
Change an attribute of this node.
bool setAttributeSvgDouble(Util::const_char_ptr key, double val)
For attributes where an exponent is allowed.
Typed SVG document implementation.
const Geom::Affine & doc2dt() const
Document to desktop coordinate transformation.
bool removeResource(char const *key, SPObject *object)
bool addResource(char const *key, SPObject *object)
const Geom::Affine & dt2doc() const
Desktop to document coordinate transformation.
void fitToRect(Geom::Rect const &rect, bool with_margins=false)
Given a Geom::Rect that may, for example, correspond to the bbox of an object, this function fits the...
std::vector< SPItem * > getItemsPartiallyInBox(unsigned int dkey, Geom::Rect const &box, bool take_hidden=false, bool take_insensitive=false, bool take_groups=true, bool enter_groups=false, bool enter_layers=true) const
Get items whose bounding box overlaps with given area.
Geom::OptRect preferredBounds() const
Inkscape::PageManager & getPageManager()
std::vector< SPItem * > getItemsInBox(unsigned int dkey, Geom::Rect const &box, bool take_hidden=false, bool take_insensitive=false, bool take_groups=true, bool enter_groups=false, bool enter_layers=true) const
Return list of items, contained in box.
bool is_yaxisdown() const
True if the desktop Y-axis points down, false if it points up.
Geom::Scale getDocumentScale(bool computed=true) const
Returns document scale as defined by width/height (in pixels) and viewBox (real world to user-units).
Inkscape::Util::Unit const * getDisplayUnit()
guaranteed not to return nullptr
Base class for visual SVG elements.
Geom::OptRect desktopGeometricBounds() const
Get item's geometric bbox in desktop coordinate system.
SPObject is an abstract base class of all of the document nodes at the SVG document level.
char const * label() const
Gets the author-visible label property for the object or a default if no label is defined.
Inkscape::XML::Node * repr
void requestModified(unsigned int flags)
Requests that a modification notification signal be emitted later (e.g.
virtual void set(SPAttr key, const char *value)
virtual Inkscape::XML::Node * write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags)
SPObject * getPrev()
Returns previous object in sibling list or NULL.
Inkscape::XML::Node * updateRepr(unsigned int flags=SP_OBJECT_WRITE_EXT)
Updates the object's repr based on the object's state.
void readAttr(char const *key)
Read value of key attribute from XML node into object.
Inkscape::XML::Node * getRepr()
Returns the XML representation of tree.
virtual void build(SPDocument *doc, Inkscape::XML::Node *repr)
void requestDisplayUpdate(unsigned int flags)
Queues an deferred update of this object's display.
void setDesktopRect(Geom::Rect rect)
Set the page rectangle in desktop coordinates.
Geom::Rect getDesktopMargin() const
int getPageIndex() const
Returns the page number (order of pages) starting at 1.
void setRect(Geom::Rect rect)
Set the page rectangle in its native units.
bool setPageIndex(int index, bool swap_page)
Set this page to a new order in the page stack.
Geom::Translate getDesktopAffine() const
Gets the page's position as a translation in desktop units.
void setBleedSide(int side, double value)
std::string getLabel() const
void setSizeLabel(std::string label)
Geom::Rect getDesktopRect() const
Get the rectangle of the page, in desktop units.
std::string getDefaultLabel() const
void copyFrom(SPPage *page)
Copy non-size attributes from the given page.
std::string getMarginLabel() const
SPPage * getNextPage()
Returns the sibling page next to this one in the stack order.
void swapPage(SPPage *other, bool with_objects)
Swap the locations of this page with another page (see movePage)
Geom::Rect getDesktopBleed() const
std::string getSizeLabel() const
bool itemOnPage(SPItem const *item, bool contains=false, bool groups=true) const
Return true if this item is contained within the page boundary.
Geom::Rect getDocumentMargin() const
Get document rect, minus the margin amounts.
void set_guides_visible(bool show)
Geom::Rect getBleed() const
Get page rect enlarged by bleed amounts.
static void moveItems(Geom::Affine translate, std::vector< SPItem * > const &objects)
Move the given items by the given translation in document units.
bool setDefaultAttributes()
Sets the default attributes from the namedview.
Geom::Rect getDocumentBleed() const
Get document rect, plus the bleed amounts.
std::vector< SPItem * > getOverlappingItems(bool hidden=true, bool in_bleed=false, bool in_layers=true) const
Like ExcludiveItems above but get all the items which are inside or overlapping.
void setSelected(bool selected)
Set the selected high-light for this page.
std::string getBleedLabel() const
void update(SPCtx *ctx, unsigned int flags) override
SPPage * getPreviousPage()
Returns the sibling page previous to this one in the stack order.
Geom::Rect getRect() const
Gets the rectangle in document units.
bool isBarePage() const
Returns true if the only aspect to this page is its size.
Inkscape::CanvasPage * _canvas_item
Geom::Rect getDocumentRect() const
Get the rectangle of the page, scaled to the document.
double getMarginSide(int side)
Get the margin side of the box.
double getBleedSide(int side)
void setBleed(const std::string &value)
Set the page's bleed.
void setMargin(const std::string &value)
Set the page's margin.
std::vector< SPItem * > getExclusiveItems(bool hidden=true, bool in_bleed=false, bool in_layers=true) const
Get the items which are ONLY on this page and don't overlap.
void update_relatives()
Update the percentage values of the svg boxes.
Geom::Rect getSensitiveRect() const
Like getDesktopRect but returns a slightly shrunken rectangle so interactions don't confuse the borde...
bool isViewportPage() const
Returns true if this page is the same as the viewport.
void movePage(Geom::Affine translate, bool with_objects)
Move the page by the given affine, in desktop units.
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
void setDocumentRect(Geom::Rect rect, bool add_margins=false)
Set the page rectangle in document coordinates.
void set(SPAttr key, const char *value) override
int getPagePosition() const
void setSize(double width, double height)
Set just the height and width from a predefined size.
void setMarginSide(int pos, double value, bool confine=false)
Set the margin at this side of the box in user units.
Inkscape::XML::Node * write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) override
Write out the page's data into its xml structure.
void set(BoxSide side, double value, bool confine=false)
Set the value of the side, retaining it's original unit.
bool fromString(const std::string &value, const std::string &unit, const Geom::Scale &doc_scale)
Set the svg box from user input, with a default unit.
bool isZero() const
Returns true if the box is set, but all values are zero.
void readOrUnset(gchar const *str, const Geom::Scale &doc_scale)
std::string write() const
Write out the values into a compact form.
void update(double em, double ex, double width, double height)
Update box with em, ex and percentage scaling.
bool read(const std::string &value, const Geom::Scale &doc_scale)
Read in the value, may be an array of four.
std::string toString(const std::string &unit, const Geom::Scale &doc_scale, std::optional< unsigned int > precision={}, bool add_unit=true) const
Write as specific unit for user display.
double get(BoxSide side) const
std::string write() const
void readOrUnset(char const *str, Unit u=NONE, float v=0, float c=0)
static char const *const current
static cairo_user_data_key_t key
Interface for XML documents.