Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
page-manager.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Inkscape::PageManager - Multi-Page management.
4 *
5 * Copyright 2021 Martin Owens <doctormo@geek-2.com>
6 *
7 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
8 */
9
10#include "page-manager.h"
11
12#include <glibmm/i18n.h>
13#include "attributes.h"
14#include "colors/manager.h"
15#include "desktop.h"
17#include "document.h"
18#include "extension/template.h"
19#include "object/object-set.h"
20#include "object/sp-item.h"
21#include "object/sp-namedview.h"
22#include "object/sp-page.h"
23#include "object/sp-root.h"
24#include "preferences.h"
25#include "selection-chemistry.h"
28
29namespace Inkscape {
30
31static auto const default_background_color = Colors::Color{0xffffff00};
32static auto const default_margin_color = Colors::Color{0x1699d751};
33static auto const default_bleed_color = Colors::Color{0xbe310e31};
34static auto const default_border_color = Colors::Color{0x0000003f};
35
37{
39 return prefs->getBool("/tools/pages/move_objects", true);
40}
41
43 : border_show(true)
44 , border_on_top(true)
45 , shadow_show(true)
46 , checkerboard(false)
47 , background_color{default_background_color}
48 , margin_color{default_margin_color}
49 , bleed_color{default_bleed_color}
50 , border_color{default_border_color}
51{
52 _document = document;
53}
54
56{
57 pages.clear();
58 _selected_page = nullptr;
59 _document = nullptr;
60}
61
66{
67 g_assert(page->document == _document);
68 if (std::find(pages.begin(), pages.end(), page) != pages.end()) {
69 // Refuse to double add pages to list.
70 return;
71 }
72 if (auto next = page->getNextPage()) {
73 // Inserted in the middle, probably an undo.
74 auto it = std::find(pages.begin(), pages.end(), next);
75 if (it != pages.end()) {
76 pages.insert(it, page);
77 } else {
78 // This means the next page is not yet added either
79 pages.push_back(page);
80 }
81 } else {
82 pages.push_back(page);
83 }
85}
86
91{
92 for (auto it = pages.begin(); it != pages.end(); ++it) {
93 SPPage *page = *it;
94 if (page->getRepr() == child) {
95 pages.erase(it);
96
97 if (hasPages() && page->isViewportPage()) {
99 }
100
101 // Reselect because this page is gone.
102 if (_selected_page == page) {
103 if (auto next = page->getNextPage()) {
104 selectPage(next);
105 } else if (auto prev = page->getPreviousPage()) {
106 selectPage(prev);
107 } else {
108 selectPage(nullptr);
109 }
110 }
111
112 pagesChanged();
113 break;
114 }
115 }
116}
117
122{
123 auto nv = _document->getNamedView();
124 pages.clear();
125 for (auto &child : nv->children) {
126 if (auto page = cast<SPPage>(&child)) {
127 pages.push_back(page);
128 }
129 }
130 pagesChanged();
131}
132
138{
139 if (!hasPages()) {
141 }
142}
143
150{
151 enablePages();
152 auto rect = _selected_page->getRect();
153 auto new_page = newPage(rect.width(), rect.height());
154 new_page->copyFrom(_selected_page);
155 return new_page;
156}
157
162{
163 auto loc = nextPageLocation();
165}
166
171{
172 // Get a new location for the page.
173 double top = 0.0;
174 double left = 0.0;
175 for (auto &page : pages) {
176 auto rect = page->getRect();
177 if (rect.right() > left) {
178 left = rect.right() + 10;
179 }
180 }
181 return Geom::Point(left, top);
182}
183
188{
189 // This turns on pages support, which will make two pages if none exist yet.
190 // The first is the ViewBox page, and the second is made below as the "second"
191 if (!hasPages() && !first_page) {
192 enablePages();
193 }
194
195 auto xml_doc = _document->getReprDoc();
196 auto repr = xml_doc->createElement("inkscape:page");
197 repr->setAttributeSvgDouble("x", rect.left());
198 repr->setAttributeSvgDouble("y", rect.top());
199 repr->setAttributeSvgDouble("width", rect.width());
200 repr->setAttributeSvgDouble("height", rect.height());
201 if (auto nv = _document->getNamedView()) {
202 if (auto page = cast<SPPage>(nv->appendChildRepr(repr))) {
204 return page;
205 }
206 }
207 return nullptr;
208}
209
214{
215 rect *= _document->dt2doc();
216 return newDocumentPage(rect, first_page);
217}
218
223{
224 return newPage(rect * _document->getDocumentScale().inverse(), first_page);
225}
226
234{
235 if (page) {
236 if (content) {
237 for (auto &item : page->getExclusiveItems()) {
239 }
240 for (auto &item : page->getOverlappingItems()) {
241 // Only delete objects when they rest on one page.
242 if (getPagesFor(item, false).size() == 1) {
244 }
245 }
246 }
247 // Only adjust if there will be a page after viewport page is deleted
248 bool fit_viewport = page->isViewportPage() && getPageCount() > 2;
249
250 // Removal from pages is done automatically via signals.
251 page->deleteObject();
252
253 if (fit_viewport) {
255 }
256 }
257
258 // As above with the viewbox shadowing, we need go back to a single page
259 // (which is zero pages) when needed.
260 if (auto page = getFirstPage()) {
261 if (getPageCount() == 1) {
262 auto rect = page->getDesktopRect();
263 // We delete the page, only if it's bare (no margins etc)
264 if (page->isBarePage())
265 deletePage(page, false);
266 _document->fitToRect(rect, false);
267 }
268 }
269}
270
276void PageManager::deletePage(bool content)
277{
278 deletePage(_selected_page, content);
279}
280
285{
286 while (hasPages()) {
287 deletePage(getLastPage(), false);
288 }
289}
290
291
296{
297 if (page) {
298 auto it = std::find(pages.begin(), pages.end(), page);
299 if (it != pages.end()) {
300 return it - pages.begin();
301 }
302 g_warning("Can't get page index for %s", page->getId());
303 }
304 return -1;
305}
306
314
322
327
333{
334 if (pages.empty() || getSelectedPageIndex() == -1) {
335 selectPage(nullptr);
336 }
337
339
340 if (!_selected_page) {
341 for (auto &page : pages) {
343 break;
344 }
345 }
346}
347
354{
355 if (!page || getPageIndex(page) >= 0) {
356 if (_selected_page != page) {
359
360 // Modified signal for when the attributes themselves are modified.
361 _page_modified_connection.disconnect();
362 if (page) {
363 _page_modified_connection = page->connectModified([this](SPObject *, unsigned int) {
365 });
366 }
367
368 return true;
369 }
370 }
371 return false;
372}
373
381{
382 if (_selected_page && _selected_page->itemOnPage(item, contains)) {
383 return true;
384 }
385 for (auto &page : getPagesFor(item, contains)) {
386 return selectPage(page);
387 }
388 return false;
389}
390
397{
398 if (index < 0 || index >= pages.size()) {
399 return nullptr;
400 }
401 return pages[index];
402}
403
412std::vector<SPPage *> PageManager::getPages(const std::string &pages, bool inverse) const
413{
414 return getPages(parseIntRange(pages, 1, getPageCount()), inverse);
415}
416
425std::vector<SPPage *> PageManager::getPages(std::set<unsigned int> page_pos, bool inverse) const
426{
427 std::vector<SPPage *> ret;
428 for (auto page : pages) {
429 bool contains = page_pos.find(page->getPagePosition()) != page_pos.end();
430 if (contains != inverse) {
431 ret.push_back(page);
432 }
433 }
434 return ret;
435}
436
440std::vector<SPPage *> PageManager::getPagesFor(SPItem *item, bool contains) const
441{
442 std::vector<SPPage *> ret;
443 for (auto &page : pages) {
444 if (page->itemOnPage(item, contains)) {
445 ret.push_back(page);
446 }
447 }
448 return ret;
449}
450
455{
456 for (auto &page : pages) {
457 if (page->itemOnPage(item, contains))
458 return page;
459 }
460 return nullptr;
461}
462
467{
468 for (auto &page : pages) {
469 if (page->getDesktopRect().corner(0) == pos) {
470 return page;
471 }
472 }
473 return nullptr;
474}
475
482{
483 SPPage* ret = nullptr;
484 for (auto &page : getPages()) {
485 auto rect = page->getSensitiveRect();
486 // If the point is inside the page boundry
487 if (rect.contains(pos)) {
488 // If we don't have a page yet, or the new page is inside the old one.
489 if (!ret || ret->getSensitiveRect().contains(rect)) {
490 ret = page;
491 }
492 }
493 }
494 return ret;
495}
496
502{
503 for (auto &page : pages) {
504 if (page->isViewportPage()) {
505 return page;
506 }
507 }
508 return nullptr;
509}
510
515{
516 Geom::OptRect total_area;
517 for (auto &page : pages) {
518 if (total_area) {
519 total_area->unionWith(page->getDesktopRect());
520 } else {
521 total_area = page->getDesktopRect();
522 }
523 }
524 return total_area;
525}
526
531{
532 Geom::Rect rect = page ? page->getDesktopRect() : *(_document->preferredBounds());
533 if (rect.minExtent() < 1.0)
534 return;
535 if (width_only) {
536 desktop->set_display_width(rect, 10);
537 } else {
538 desktop->set_display_area(rect, 10);
539 }
540}
541
546{
547 Geom::Rect rect = page ? page->getDesktopRect() : *(_document->preferredBounds());
549}
550
555{
556 for (auto &page : pages) {
557 page->setRect(page->getRect() * scale);
558 for (int side = 0; side < 4; side++) {
559 page->setMarginSide(side, page->getMarginSide(side) * scale.vector()[0]);
560 page->setBleedSide(side, page->getBleedSide(side) * scale.vector()[0]);
561 }
562 }
563}
564
569
571{
572 if (pages.empty() || page) {
573 // Resizing the Viewport, means the page gets updated automatically
574 if (pages.empty() || (page && page->isViewportPage())) {
575 auto rect = Geom::Rect(Geom::Point(0, 0), Geom::Point(width, height));
576 _document->fitToRect(rect, false);
577 } else if (page) {
578 page->setSize(width, height);
579 }
580 }
581}
582
587{
588 Geom::Rect page_size = getSelectedPageRect();
589 Geom::Translate const center(page_size.midpoint());
590 Geom::Rotate const rotate(Geom::Rotate::from_degrees(turns * 90));
591 Geom::Affine const tr(center.inverse() * rotate * center);
592
593 auto contents = ObjectSet();
594 if (_selected_page) {
595 contents.setList(_selected_page->getOverlappingItems());
596 } else {
597 contents.setList(_document->getRoot()->item_list());
598 }
599 contents.applyAffine(tr);
600
601 auto new_box = Geom::Rect(page_size.min() * tr, page_size.max() * tr);
602 fitToRect(new_box, _selected_page);
603}
604
609{
610 auto rect = getSelectedPageRect();
611 resizePage(rect.height(), rect.width());
612}
613
618void PageManager::fitToSelection(ObjectSet *selection, bool add_margins)
619{
620 auto desktop = selection->desktop();
621
622 if (!selection || selection->isEmpty()) {
623 // This means there aren't any pages, so revert to the default assumption
624 // that the viewport is resized around ALL objects.
625 if (!_selected_page) {
627 } else {
628 // This allows the pages to be resized around the items related to the page only.
629 auto contents = ObjectSet();
630 contents.setList(getOverlappingItems(desktop, _selected_page));
631 if (contents.isEmpty()) {
633 } else {
634 fitToSelection(&contents, add_margins);
635 }
636 }
637 } else if (auto rect = selection->documentPreferredBounds()) {
638 fitToRect(rect, _selected_page, add_margins);
639 }
640}
641
645void PageManager::fitToRect(Geom::OptRect rect, SPPage *page, bool add_margins)
646{
647 if (!rect) return;
648 bool viewport = true;
649 if (page) {
650 viewport = page->isViewportPage();
651 page->setDocumentRect(*rect, add_margins);
652 rect = page->getDocumentRect();
653 }
654 if (viewport) {
655 _document->fitToRect(*rect);
656 if (page && !page->isViewportPage()) {
657 // The document's fitToRect has slightly mangled the page rect, fix it.
658 page->setDocumentRect(Geom::Rect(Geom::Point(0, 0), rect->dimensions()));
659 }
660 }
661}
662
663
667std::vector<SPItem *> PageManager::getOverlappingItems(SPDesktop *desktop, SPPage *page, bool hidden, bool in_bleed, bool in_layers)
668{
669 if (page) {
670 return page->getOverlappingItems(hidden, in_bleed, in_layers);
671 }
672 auto doc_rect = _document->preferredBounds();
673 return _document->getItemsPartiallyInBox(desktop->dkey, *doc_rect, true, true, true, false, in_layers);
674}
675
679bool PageManager::subset(SPAttr key, const gchar *value)
680{
681 switch (key) {
683 this->border_show.readOrUnset(value);
684 break;
686 this->border_on_top.readOrUnset(value);
687 break;
688 case SPAttr::BORDERCOLOR: {
689 auto const old_opacity = border_color.getOpacity();
690 border_color = Colors::Color::parse(value).value_or(default_border_color);
691 border_color.setOpacity(old_opacity);
692 break;
693 }
695 border_color.setOpacity(value ? g_ascii_strtod(value, nullptr) : 1.0);
696 break;
698 background_color = Colors::Color::parse(value).value_or(default_background_color);
699 break;
700 case SPAttr::SHOWPAGESHADOW: // Deprecated
701 this->shadow_show.readOrUnset(value);
702 break;
705 return false; // propagate further
707 label_style = value ? value : "default";
708
709 // Update user action button
710 if (auto action = _document->getActionGroup()->lookup_action("page-label-style")) {
711 action->change_state(label_style == "below");
712 }
713 break;
714 default:
715 return false;
716 }
717 return true;
718}
719
724{
725 auto bdcolor = getBorderColor();
726
727 if (!border_show) {
728 bdcolor.setOpacity(0.0);
729 }
730
731 auto bgcolor = getBackgroundColor();
732
733 // note: page background color doesn't have configurable transparency; it is considered to be opaque;
734 // here alpha gets manipulated to reveal checkerboard pattern, if needed
735 if (checkerboard) {
736 bgcolor.setOpacity(0.0);
737 } else {
738 bgcolor.setOpacity(1.0);
739 }
740
741 auto dkcolor = _document->getNamedView()->getDeskColor();
742
743 bool ret = item->setOnTop(border_on_top);
744 // fixed shadow size, not configurable; shadow changes size with zoom
745 ret |= item->setShadow(border_show && shadow_show ? 2 : 0);
746 ret |= item->setPageColor(bdcolor, bgcolor, dkcolor, getMarginColor(), getBleedColor());
747 ret |= item->setLabelStyle(label_style);
748 return ret;
749}
750
755{
756 auto box = *_document->preferredBounds();
757 if (page) {
758 box = page->getDesktopRect();
759 auto label = page->getSizeLabel();
760 if (!label.empty())
761 return _(label.c_str());
762 }
763 return getSizeLabel(box.width(), box.height());
764}
765
772std::string PageManager::getSizeLabel(double width, double height)
773{
774 using namespace Inkscape::Util;
775
777 return _(preset->get_name().c_str());
778 }
779
780 static auto px = Inkscape::Util::UnitTable::get().getUnit("px");
781 auto unit = _document->getDisplayUnit();
782 return format_number(Quantity::convert(width, px, unit), 2)
783 + " × " +
784 format_number(Quantity::convert(height, px, unit), 2)
785 + " " + unit->abbr;
786}
787
792{
793 // Adjust each page against the change in position of the viewbox.
794 for (auto &page : pages) {
795 page->movePage(tr, false);
796 }
797}
798
799}; // namespace Inkscape
800
801/*
802 Local Variables:
803 mode:c++
804 c-file-style:"stroustrup"
805 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
806 indent-tabs-mode:nil
807 fill-column:99
808 End:
809*/
810// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
double scale
Definition aa.cpp:228
Lookup dictionary for attributes/properties.
SPAttr
Definition attributes.h:27
@ BORDERCOLOR
@ INKSCAPE_DESK_CHECKERBOARD
@ SHOWPAGESHADOW
@ BORDEROPACITY
@ SHOWBORDER
@ BORDERLAYER
@ PAGELABELSTYLE
uint64_t page
Definition canvas.cpp:171
3x3 matrix representing an affine transformation.
Definition affine.h:70
void unionWith(CRect const &b)
Enlarge the rectangle to contain the argument.
static CRect from_xywh(Coord x, Coord y, Coord w, Coord h)
Create rectangle from origin and dimensions.
bool contains(GenericRect< C > const &r) const
Check whether the rectangle includes all points in the given rectangle.
C top() const
Return top coordinate of the rectangle (+Y is downwards).
CPoint midpoint() const
Get the point in the geometric center 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 minExtent() const
Get the smaller extent (width or height) of the rectangle.
C width() const
Get the horizontal extent of the rectangle.
CPoint min() const
Get the corner of the rectangle with smallest coordinate values.
CPoint max() const
Get the corner of the rectangle with largest coordinate values.
Axis-aligned rectangle that can be empty.
Definition rect.h:203
Two-dimensional point that doubles as a vector.
Definition point.h:66
Axis aligned, non-empty rectangle.
Definition rect.h:92
Rotation around the origin.
Definition transforms.h:187
static Rotate from_degrees(Coord deg)
Construct a rotation from its angle in degrees.
Definition transforms.h:218
Scaling from the origin.
Definition transforms.h:150
Scale inverse() const
Definition transforms.h:172
Translation by a vector.
Definition transforms.h:115
Translate inverse() const
Get the inverse translation.
Definition transforms.h:133
bool setOpacity(double opacity)
Set the opacity of this color object.
Definition color.cpp:444
double getOpacity() const
Get the opacity in this color, if it's stored.
Definition color.cpp:407
static std::shared_ptr< TemplatePreset > get_any_preset(const std::string &key)
Return the template preset based on the key from any template class (static method).
Definition template.cpp:352
SPDesktop * desktop()
Returns the desktop the selection is bound to.
Definition object-set.h:390
Geom::OptRect documentPreferredBounds() const
Returns either the visual or geometric bounding rectangle of selection in document coordinates based ...
bool isEmpty()
Returns true if no items are selected.
Colors::Color const & getMarginColor() const
bool setDefaultAttributes(CanvasPage *item)
Update the canvas item with the default display attributes.
void disablePages()
Disables multi page supply by removing all the page objects.
void changeOrientation()
Change page orientation, landscape to portrait and back.
Geom::Affine getSelectedPageAffine() const
sigc::signal< void(SPPage *)> _page_selected_signal
void centerToPage(SPDesktop *desktop, SPPage *page)
Center without zooming on the given page.
Colors::Color const & getBorderColor() const
SPPage * getFirstPage() const
void scalePages(Geom::Scale const &scale)
Change page size, margins and bleeds by a set amount.
std::vector< SPPage * > getPagesFor(SPItem *item, bool contains) const
Return a list of pages this item is on.
sigc::signal< void()> _pages_changed_signal
void enablePages()
Enables multi page support by turning the document viewBox into the first page.
Colors::Color border_color
void zoomToPage(SPDesktop *desktop, SPPage *page, bool width_only=false)
Center/zoom on the given page.
SPPage * getLastPage() const
void fitToSelection(ObjectSet *selection, bool add_margins=true)
Resize the page to the given selection.
int getPageCount() const
SPPage * findPageAt(Geom::Point pos) const
This provides a simple way of selecting a page based on their layering Pages which are entirely conta...
SPPage * getPageFor(SPItem *item, bool contains) const
Return the first page that contains the given item.
SPPage * newPage()
Add a new page of the default size, this will be either the size of the viewBox if no pages exist,...
void reorderPage(Inkscape::XML::Node *child)
Reorder page within the internal list to keep it up to date.
Colors::Color background_color
void addPage(SPPage *page)
Add a page to this manager, called from namedview parent.
bool subset(SPAttr key, const gchar *value)
Manage the page subset of attributes from sp-namedview and store them.
std::string getSizeLabel(SPPage *page=nullptr)
Return a page's size label, or match via width and height.
sigc::signal< void(SPPage *)> _page_modified_signal
const std::vector< SPPage * > & getPages() const
Colors::Color const & getBleedColor() const
bool selectPage(SPPage *page)
Set the given page as the selected page.
PageManager(SPDocument *document)
SPPage * getPage(int index) const
Get the page at the given position or return nullptr if out of range.
Geom::Rect getSelectedPageRect() const
Returns the selected page rect, OR the viewbox rect.
SPPage * getPageAt(Geom::Point pos) const
Get a page at a specific starting location.
Geom::Point nextPageLocation() const
Return the location of the next created page.
int getSelectedPageIndex() const
Return the index of the page in the index.
void movePages(Geom::Affine tr)
Called when the viewbox is resized.
void deletePage(SPPage *page, bool contents=false)
Delete the given page.
Colors::Color const & getBackgroundColor() const
SPPage * newDesktopPage(Geom::Rect rect, bool first_page=false)
Create a new page, resizing the rectangle from desktop coordinates.
SPPage * getViewportPage() const
Returns the page attached to the viewport, or nullptr if no pages or none of the pages are the viewpo...
void fitToRect(Geom::OptRect box, SPPage *page, bool add_margins=false)
Fit the selected page to the given rectangle.
void rotatePage(int turns)
Rotate the selected page by the given number of 90 degree rotations.
std::vector< SPItem * > getOverlappingItems(SPDesktop *desktop, SPPage *page, bool hidden=true, bool in_bleed=false, bool in_layers=true)
Return a list of objects touching this page, or viewbox (of single page document)
sigc::connection _page_modified_connection
static bool move_objects()
bool hasPages() const
void removePage(Inkscape::XML::Node *child)
Remove a page from this manager, called from namedview parent.
void pagesChanged()
Called when the pages vector is updated, either page deleted or page created (but not if the page is ...
int getPageIndex(const SPPage *page) const
Get page index, returns -1 if the page is not found in this document.
void resizePage(double width, double height)
std::vector< SPPage * > pages
Geom::OptRect getDesktopRect() const
Returns the total area of all the pages in desktop units.
SPPage * newDocumentPage(Geom::Rect rect, bool first_page=false)
Create a new page, using document coordinates.
Preference storage class.
Definition preferences.h:66
bool getBool(Glib::ustring const &pref_path, bool def=false)
Retrieve a Boolean value.
static Preferences * get()
Access the singleton Preferences object.
static UnitTable & get()
Definition units.cpp:410
Unit const * getUnit(Glib::ustring const &name) const
Retrieve a given unit based on its string identifier.
Definition units.cpp:285
Interface for refcounted XML nodes.
Definition node.h:80
bool setAttributeSvgDouble(Util::const_char_ptr key, double val)
For attributes where an exponent is allowed.
Definition node.cpp:111
To do: update description of desktop.
Definition desktop.h:149
unsigned dkey
Definition desktop.h:229
void set_display_area(bool log=true)
Does all the dirty work in setting the display area.
Definition desktop.cpp:448
void set_display_center(Geom::Rect const &a)
Centre Rect, without zooming.
Definition desktop.cpp:593
void set_display_width(Geom::Rect const &a, Geom::Coord border)
Set display area in only the width dimension.
Definition desktop.cpp:580
Typed SVG document implementation.
Definition document.h:103
Glib::RefPtr< Gio::SimpleActionGroup > getActionGroup()
Definition document.h:373
SPRoot * getRoot()
Returns our SPRoot.
Definition document.h:202
const Geom::Affine & dt2doc() const
Desktop to document coordinate transformation.
Definition document.h:270
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
Definition document.cpp:978
Inkscape::XML::Document * getReprDoc()
Our Inkscape::XML::Document.
Definition document.h:213
SPNamedView * getNamedView()
Get the namedview for this document, creates it if it's not found.
Definition document.cpp:233
Geom::Scale getDocumentScale(bool computed=true) const
Returns document scale as defined by width/height (in pixels) and viewBox (real world to user-units).
Definition document.cpp:773
Inkscape::Util::Unit const * getDisplayUnit()
guaranteed not to return nullptr
Definition document.cpp:741
std::vector< SPItem * > item_list()
Base class for visual SVG elements.
Definition sp-item.h:109
Geom::OptRect documentPreferredBounds() const
Definition sp-item.cpp:1004
Colors::Color getDeskColor() const
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Definition sp-object.h:160
void deleteObject(bool propagate, bool propagate_descendants)
Deletes an object, unparenting it from its parent.
sigc::connection connectModified(sigc::slot< void(SPObject *, unsigned int)> slot)
Connects to the modification notification signal.
Definition sp-object.h:705
Geom::Translate getDesktopAffine() const
Gets the page's position as a translation in desktop units.
Definition sp-page.cpp:140
Geom::Rect getDesktopRect() const
Get the rectangle of the page, in desktop units.
Definition sp-page.cpp:132
bool itemOnPage(SPItem const *item, bool contains=false, bool groups=true) const
Return true if this item is contained within the page boundary.
Definition sp-page.cpp:393
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.
Definition sp-page.cpp:379
Geom::Rect getRect() const
Gets the rectangle in document units.
Definition sp-page.cpp:124
Geom::Rect getSensitiveRect() const
Like getDesktopRect but returns a slightly shrunken rectangle so interactions don't confuse the borde...
Definition sp-page.cpp:208
void readOrUnset(gchar const *str)
Definition svg-bool.cpp:42
Utility functions to convert ascii representations to numbers.
Editable view implementation.
SPItem * item
Glib::ustring label
Affine identity()
Create an identity matrix.
Definition affine.h:210
static R & release(R &r)
Decrements the reference count of a anchored object.
Miscellaneous supporting code.
Definition document.h:95
Helper class to stream background task notifications as a series of messages.
static auto const default_background_color
static auto const default_bleed_color
static auto const default_margin_color
std::set< unsigned > parseIntRange(std::string const &input, unsigned start, unsigned end)
Parse integer ranges out of a string.
static auto const default_border_color
static cairo_user_data_key_t key
Singleton class to access the preferences file in a convenient way.
Ocnode * child[8]
Definition quantize.cpp:33
Some things pertinent to all visible shapes: SPItem, SPItemView, SPItemCtx.
SPPage – a page object.
SPRoot: SVG <svg> implementation.
virtual Node * createElement(char const *name)=0
int index
SPDesktop * desktop
double height
double width