Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
document.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#ifndef SEEN_SP_DOCUMENT_H
3#define SEEN_SP_DOCUMENT_H
4
8/* Authors:
9 * Lauris Kaplinski <lauris@kaplinski.com>
10 * MenTaLguY <mental@rydia.net>
11 * Jon A. Cruz <jon@joncruz.org>
12 * Abhishek Sharma
13 *
14 * Copyright (C) 2004-2005 MenTaLguY
15 * Copyright (C) 1999-2002 Lauris Kaplinski
16 * Copyright (C) 2000-2001 Ximian, Inc.
17 *
18 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
19 */
20
21#include <cstddef> // for size_t
22#include <deque> // for deque
23#include <map> // for map
24#include <memory> // for unique_ptr, default_de...
25#include <queue> // for queue
26#include <span>
27#include <string> // for string
28#include <vector> // for vector
29
30#include <boost/ptr_container/ptr_list.hpp> // for ptr_list
31
32#include <giomm/simpleactiongroup.h> // for SimpleActionGroup
33#include <glib.h> // for GQuark, gboolean, gchar
34#include <glibmm/refptr.h> // for RefPtr
35#include <glibmm/timer.h>
36#include <glibmm/ustring.h> // for ustring
37#include <sigc++/connection.h> // for connection
38#include <sigc++/signal.h> // for signal
39
40#include <2geom/affine.h> // for Affine
41#include <2geom/rect.h> // for Rect, OptRect
42#include <2geom/transforms.h> // for Scale
43
44#include "3rdparty/libcroco/src/cr-cascade.h" // for CRCascade
45
47// XXX only for testing!
49
50// This variable is introduced with 0.92.1
51// with the introduction of automatic fix
52// for files detected to have been created
53// with previous versions to have a similar
54// look in 0.92+.
56
57
58// This variable is introduced with 0.92.1
59// with the introduction of automatic fix
60// for files detected to have been created
61// with previous versions to have a similar
62// look in 0.92+.
63extern bool sp_do_not_fix_pre_92;
64
65
66namespace Avoid {
67class Router;
68}
69
70class Persp3D;
71class Persp3DImpl;
72class SPDefs;
73class SPGroup;
74class SPItem;
75class SPItemCtx;
76class SPNamedView;
77class SPObject;
78class SPRoot;
79
80namespace Inkscape {
81 class DocumentUndo;
82 class Event;
83 class EventLog;
84 class PageManager;
85 namespace Colors {
86 class DocumentCMS;
87 }
88 class Selection;
89 class UndoStackObserver;
90 namespace XML {
91 struct Document;
92 class Event;
93 class Node;
94 } // namespace XML
95 namespace Util {
96 class Unit;
97 class Quantity;
98 } // namespace Util
99} // namespace Inkscape
100
103{
104public:
106 unsigned update_in_progress = 0;
107
108 SPDocument();
109 ~SPDocument();
110 SPDocument(SPDocument const &) = delete;
111 SPDocument &operator=(SPDocument const &) = delete;
112
113 static int get_new_doc_number();
114
115 // Document creation ------------------
116 static std::unique_ptr<SPDocument> createDoc(Inkscape::XML::Document *rdoc, char const *filename,
117 char const *base, char const *name, bool keepalive, SPDocument *parent = nullptr);
118 static std::unique_ptr<SPDocument> createNewDoc(char const *filename, bool keepalive,
119 bool make_new = false, SPDocument *parent = nullptr);
120 static std::unique_ptr<SPDocument> createNewDocFromMem(std::span<char const> buffer, bool keepalive,
121 std::string const &filename = "");
122 SPDocument *createChildDoc(std::string const &filename);
123
124 void setPages(bool enabled);
125 void prunePages(const std::string &page_nums, bool invert = false);
126
127 // Make a deep copy.
128 std::unique_ptr<SPDocument> copy() const;
129 // Substitute doc root
130 void rebase(Inkscape::XML::Document * new_xmldoc, bool keep_namedview = true);
131 // Substitute doc root with a file
132 void rebase(const gchar * file, bool keep_namedview = true);
133 // Substitute doc root with file in disk
134 void rebase(bool keep_namedview = true);
135 // Document status --------------------
136 void setVirgin(bool Virgin) { virgin = Virgin; }
137 bool getVirgin() { return virgin; }
139
142 void setModifiedSinceSave(bool const modified = true);
144
145 bool idle_handler();
146 bool rerouting_handler();
147
148 void requestModified();
149 bool _updateDocument(int flags, unsigned int object_modified_tag = 0); // Used by stand-alone sp_document_idle_handler
150 int ensureUpToDate(unsigned int object_modified_tag = 0);
151
152 bool addResource(char const *key, SPObject *object);
153 bool removeResource(char const *key, SPObject *object);
154 std::vector<SPObject *> const getResourceList(char const *key);
156
157 void do_change_filename(char const *const filename, bool const rebase);
158 void changeFilenameAndHrefs(char const *filename);
159 void setXMLDialogSelectedObject(SPObject *activexmltree) { _activexmltree = activexmltree; }
161
163
166
169
170private:
171 void _importDefsNode(SPDocument *source, Inkscape::XML::Node *defs, Inkscape::XML::Node *target_defs);
173
174 std::unique_ptr<Inkscape::PageManager> _page_manager;
175 std::unique_ptr<Inkscape::Colors::DocumentCMS> _cms_manager;
176
177 std::queue<GQuark> pending_resource_changes;
178
179 // Find items by geometry --------------------
180 std::deque<SPItem*> const &get_flat_item_list(unsigned int dkey, bool into_groups, bool active_only) const;
181
182 SPDocument *_searchForChild(std::string const &filename, SPDocument const *avoid = nullptr);
188 double update_desktop_affine();
189
190public:
191 void clearNodeCache() { _node_cache.clear(); }
192 void importDefs(SPDocument *source);
193
194 unsigned int vacuumDocument();
195
196 /******** Getters and Setters **********/
197
198 // Document structure -----------------
199 Avoid::Router* getRouter() const { return _router.get(); }
200
202 SPRoot *getRoot() { return root; }
203 SPRoot const *getRoot() const { return root; }
204
206 SPDefs *getDefs();
207
211
214 Inkscape::XML::Document const *getReprDoc() const { return rdoc; }
215
216
217 std::vector<Glib::ustring> getLanguages() const;
218
220 SPDocument const *getParent() const { return _parent_document; }
221
223
224 // Styling
226
227 // File information --------------------
228
230 void setDocumentFilename(char const *filename);
231 char const *getDocumentFilename() const { return document_filename; }
232
234 void setDocumentBase( char const* document_base );
235 char const *getDocumentBase() const { return document_base; };
236
238 char const* getDocumentName() const { return document_name; }
239
240
241 // Document geometry ------------------------
243
244 void setDocumentScale( const double scaleX, const double scaleY );
245 void setDocumentScale( const double scale );
246 Geom::Scale getDocumentScale(bool computed = true) const;
247 void scaleContentBy(Geom::Scale const &delta);
248
249 void setWidthAndHeight(const Inkscape::Util::Quantity &width, const Inkscape::Util::Quantity &height, bool changeSize=true);
251
252 void setWidth(const Inkscape::Util::Quantity &width, bool changeSize=true);
253 void setHeight(const Inkscape::Util::Quantity &height, bool changeSize=true);
256
257 void setViewBox();
258 void setViewBox(const Geom::Rect &viewBox);
259 Geom::Rect getViewBox() const;
260
263 void fitToRect(Geom::Rect const &rect, bool with_margins = false);
264 void setupViewport(SPItemCtx *ctx);
265
266 // Desktop geometry ------------------------
268 const Geom::Affine &doc2dt() const;
270 const Geom::Affine &dt2doc() const
271 {
272 // Note: doc2dt().inverse() happens to be identical to doc2dt()
273 return doc2dt();
274 }
276 bool is_yaxisdown() const { return yaxisdir() > 0; }
278 double yaxisdir() const { return _doc2dt[3]; }
279 // return true if coordinate system origin needs to move to current page
281 void set_origin_follows_page(bool on);
282 // signal emitted when Y-axis orientation gets flipped
283 sigc::signal<void (double)> get_y_axis_flipped() { return _y_axis_flipped; }
284
285 // Find items -----------------------------
286 void bindObjectToId(char const *id, SPObject *object);
287 SPObject *getObjectById(std::string const &id) const;
288 SPObject *getObjectById(char const *id) const;
289 SPObject *getObjectByHref(std::string const &href) const;
290 SPObject *getObjectByHref(char const *href) const;
291
292 void bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object);
294
295 std::vector<SPObject *> getObjectsByClass(Glib::ustring const &klass) const;
296 std::vector<SPObject *> getObjectsByElement(Glib::ustring const &element, bool custom = false) const;
297 std::vector<SPObject *> getObjectsBySelector(Glib::ustring const &selector) const;
298
305 std::string generate_unique_id(char const *prefix);
306
315 void set_reference_document(SPDocument* document);
317
327
328 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;
329 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;
330 SPItem *getItemAtPoint(unsigned int key, Geom::Point const &p, bool into_groups, SPItem *upto = nullptr) const;
331 std::vector<SPItem*> getItemsAtPoints(unsigned const key, std::vector<Geom::Point> points, bool all_layers = true, bool topmost_only = true, size_t limit = 0, bool active_only = true) const;
332 SPItem *getGroupAtPoint(unsigned int key, Geom::Point const &p) const;
333
337 static SPItem *getItemFromListAtPointBottom(unsigned int dkey, SPGroup *group, const std::vector<SPItem*> &list, Geom::Point const &p, bool take_insensitive = false);
338
339
340 // Box tool -------------------------------
341 void setCurrentPersp3D(Persp3D * const persp);
342 /*
343 * getCurrentPersp3D returns current_persp3d (if non-NULL) or the first
344 * perspective in the defs. If no perspective exists, returns NULL.
345 */
347 void update_lpobjs();
348 void setCurrentPersp3DImpl(Persp3DImpl * const persp_impl) { current_persp3d_impl = persp_impl; }
350
351 void getPerspectivesInDefs(std::vector<Persp3D*> &list) const;
352 unsigned int numPerspectivesInDefs() const {
353 std::vector<Persp3D*> list;
355 return list.size();
356 }
357
358
359 // Document undo/redo ----------------------
360 unsigned long serial() const { return _serial; } // Returns document's unique number.
361 bool isSeeking() const {return seeking;} // In a transition between two "good" states of document?
362 bool isPartial() const {return partial != nullptr;} // In partianl undo/redo transaction
363 void reset_key(void *dummy) { actionkey.clear(); }
364 Glib::ustring const &action_key() const { return actionkey; }
365 bool isSensitive() const { return sensitive; }
366
367 // Garbage collecting ----------------------
369 void collectOrphans();
370
371
372 // Actions ---------------------------------
373 Glib::RefPtr<Gio::SimpleActionGroup> getActionGroup() { return action_group; }
374
375 /************* Data ***************/
376private:
377
378 // Document ------------------------------
379 std::unique_ptr<Avoid::Router> _router; // Instance of the connector router
380 std::unique_ptr<Inkscape::Selection> _selection;
381
382 // Document status -----------------------
383
385 bool virgin ;
388 sigc::connection modified_connection;
389 sigc::connection rerouting_connection;
390
391 // Document structure --------------------
394
396
397 // A list of svg documents being used or shown within this document
398 std::vector<std::unique_ptr<SPDocument>> _child_documents;
399 // Conversely this is a parent document because this is a child.
401 // When copying documents, this can refer to its original
403 // Reference document to fall back to when getObjectById cannot find element in '*this' document
405
406 // Styling
408
409 // Desktop geometry
411
412 // File information ----------------------
416
417 // Find items ----------------------------
418 std::map<std::string, SPObject *> iddef;
419 std::map<Inkscape::XML::Node *, SPObject *> reprdef;
420
421 // Find items by geometry --------------------
422 mutable std::map<unsigned long, std::deque<SPItem*>> _node_cache; // Used to speed up search.
423
424 // Box tool ----------------------------
427
428 // Document undo/redo ----------------------
430 std::unique_ptr<Inkscape::EventLog> _event_log;
431
432 /* Undo/Redo state */
433 bool sensitive; /* If we save actions to undo stack */
434 Inkscape::XML::Event * partial; /* partial undo log when interrupted */
435 std::deque<Inkscape::Event *> undo; /* Undo stack of reprs */
436 std::deque<Inkscape::Event *> redo; /* Redo stack of reprs */
437 /* Undo listener */
439
440 // XXX only for testing!
442
443 bool seeking; // Related to undo/redo/unique id
444 unsigned long _serial; // Unique document number (used by undo/redo).
445 Glib::ustring actionkey; // Last action key, used to combine actions in undo.
446 double action_expires; // Expire time for last action key
447 Glib::Timer undo_timer; // Timer for last action key
448 unsigned long object_id_counter; // Steadily-incrementing counter used to assign unique ids to objects.
449
450 // Garbage collecting ----------------------
451
452 std::vector<SPObject *> _collection_queue;
453
454 // Actions ---------------------------------
455 Glib::RefPtr<Gio::SimpleActionGroup> action_group;
456
457 /*********** Signals **************/
458
459 typedef sigc::signal<void (SPObject *)> IDChangedSignal;
460 typedef sigc::signal<void ()> ResourcesChangedSignal;
461 typedef sigc::signal<void (unsigned)> ModifiedSignal;
462 typedef sigc::signal<void (char const *)> FilenameSetSignal;
463 typedef sigc::signal<void (double, double)> ResizedSignal;
464 typedef sigc::signal<void ()> ReconstructionStart;
465 typedef sigc::signal<void ()> ReconstructionFinish;
466 typedef sigc::signal<void ()> CommitSignal;
467 typedef sigc::signal<void ()> BeforeCommitSignal; // allow to add actions berfore commit to include in undo
468
469 typedef std::map<GQuark, SPDocument::IDChangedSignal> IDChangedSignalMap;
470 typedef std::map<GQuark, SPDocument::ResourcesChangedSignal> ResourcesChangedSignalMap;
471
474
479 SPDocument::CommitSignal commit_signal; // Used by friend Inkscape::DocumentUndo
480 SPDocument::BeforeCommitSignal before_commit_signal; // Used by friend Inkscape::DocumentUndo
481
483
484 sigc::signal<void ()> destroySignal;
485 sigc::signal<void ()> _saved_or_modified_signal;
486 sigc::signal<void (double)> _y_axis_flipped;
487
488public:
496
497 sigc::connection connectDestroy(sigc::signal<void ()>::slot_type slot);
498 sigc::connection connectModified(ModifiedSignal::slot_type slot);
499 sigc::connection connectFilenameSet(FilenameSetSignal::slot_type slot);
500 sigc::connection connectCommit(CommitSignal::slot_type slot);
501 sigc::connection connectBeforeCommit(BeforeCommitSignal::slot_type slot);
502 sigc::connection connectIdChanged(const char *id, IDChangedSignal::slot_type slot);
503 sigc::connection connectResourcesChanged(char const *key, SPDocument::ResourcesChangedSignal::slot_type slot);
504 sigc::connection connectReconstructionStart(ReconstructionStart::slot_type slot, bool first = false);
505 sigc::connection connectReconstructionFinish(ReconstructionFinish::slot_type slot);
506 sigc::connection connectSavedOrModified(sigc::slot<void ()> &&slot);
507
508 /* Resources */
509 std::map<std::string, std::vector<SPObject *> > resources;
510 ResourcesChangedSignalMap resources_changed_signals; // Used by Extension::Internal::Filter
511
512 void _emitModified(unsigned int object_modified_tag = 0); // Used by SPItem
515};
516
517/*
518 * Ideas: How to overcome style invalidation nightmare
519 *
520 * 1. There is reference request dictionary, that contains
521 * objects (styles) needing certain id. Object::build checks
522 * final id against it, and invokes necessary methods
523 *
524 * 2. Removing referenced object is simply prohibited -
525 * needs analyse, how we can deal with situations, where
526 * we simply want to ungroup etc. - probably we need
527 * Repr::reparent method :( [Or was it ;)]
528 *
529 */
530
531#endif // SEEN_SP_DOCUMENT_H
532
533/*
534 Local Variables:
535 mode:c++
536 c-file-style:"stroustrup"
537 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
538 indent-tabs-mode:nil
539 fill-column:99
540 End:
541*/
542// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
3x3 affine transformation matrix.
The Router class represents a libavoid router instance.
Definition router.h:386
3x3 matrix representing an affine transformation.
Definition affine.h:70
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
Scaling from the origin.
Definition transforms.h:150
Aggregates UndoStackObservers for management and triggering in an SPDocument's undo/redo system.
Inkscape::ConsoleOutputUndoObserver - observer for tracing calls to SPDocumentUndo::undo,...
A simple log for maintaining a history of committed, undone and redone events along with their type.
Definition event-log.h:44
The set of selected SPObjects for a given document and layer model.
Definition selection.h:80
Observes changes made to the undo and redo stacks.
Enumeration of all XML event types.
Definition event.h:53
Interface for refcounted XML nodes.
Definition node.h:80
Typed SVG document implementation.
Definition document.h:103
bool get_origin_follows_page()
std::vector< SPObject * > _collection_queue
Orphans.
Definition document.h:452
Inkscape::Selection * getSelection()
Definition document.h:222
void scaleContentBy(Geom::Scale const &delta)
Scale the content, used by file-update and document properties when modifying the the document's view...
Definition document.cpp:795
void setDocumentFilename(char const *filename)
A filename, or NULL.
CRCascade * style_cascade
Definition document.h:407
Glib::RefPtr< Gio::SimpleActionGroup > getActionGroup()
Definition document.h:373
void setCurrentPersp3DImpl(Persp3DImpl *const persp_impl)
Definition document.h:348
Avoid::Router * getRouter() const
Definition document.h:199
static std::unique_ptr< SPDocument > createDoc(Inkscape::XML::Document *rdoc, char const *filename, char const *base, char const *name, bool keepalive, SPDocument *parent=nullptr)
Definition document.cpp:340
void collectOrphans()
Definition document.cpp:329
std::vector< SPObject * > getObjectsByClass(Glib::ustring const &klass) const
bool isPartial() const
Definition document.h:362
void prunePages(const std::string &page_nums, bool invert=false)
Remove pages in bulk using the integer range format "1,2,3-4" etc.
Definition document.cpp:310
std::vector< std::unique_ptr< SPDocument > > _child_documents
Definition document.h:398
void setCurrentPersp3D(Persp3D *const persp)
Definition document.cpp:268
Inkscape::XML::Document * rdoc
Our Inkscape::XML::Document.
Definition document.h:392
const Geom::Affine & doc2dt() const
Document to desktop coordinate transformation.
Definition document.cpp:935
bool isSeeking() const
Definition document.h:361
void importDefs(SPDocument *source)
Paste SVG defs from the document retrieved from the clipboard or imported document into the active do...
bool removeResource(char const *key, SPObject *object)
Inkscape::XML::Event * partial
Definition document.h:434
void setModifiedSinceAutoSaveFalse()
Definition document.h:143
SPDocument::ModifiedSignal modified_signal
Definition document.h:475
std::map< GQuark, SPDocument::ResourcesChangedSignal > ResourcesChangedSignalMap
Definition document.h:470
sigc::signal< void(unsigned)> ModifiedSignal
Definition document.h:461
std::vector< SPItem * > getItemsAtPoints(unsigned const key, std::vector< Geom::Point > points, bool all_layers=true, bool topmost_only=true, size_t limit=0, bool active_only=true) const
Inkscape::XML::Document const * getReprDoc() const
Definition document.h:214
Glib::RefPtr< Gio::SimpleActionGroup > action_group
Definition document.h:455
std::map< std::string, std::vector< SPObject * > > resources
Definition document.h:509
static int get_new_doc_number()
Definition document.cpp:218
void _emitModified(unsigned int object_modified_tag=0)
static std::unique_ptr< SPDocument > createNewDocFromMem(std::span< char const > buffer, bool keepalive, std::string const &filename="")
Definition document.cpp:718
sigc::signal< void()> BeforeCommitSignal
Definition document.h:467
void setWidthAndHeight(const Inkscape::Util::Quantity &width, const Inkscape::Util::Quantity &height, bool changeSize=true)
Definition document.cpp:819
SPRoot * getRoot()
Returns our SPRoot.
Definition document.h:202
static SPItem * getItemFromListAtPointBottom(unsigned int dkey, SPGroup *group, const std::vector< SPItem * > &list, Geom::Point const &p, bool take_insensitive=false)
Returns the bottommost item from the list which is at the point, or NULL if none.
SPDocument::CommitSignal commit_signal
Definition document.h:479
char const * getDocumentBase() const
Definition document.h:235
double update_desktop_affine()
Update desktop transform after Y-axis orientation change.
std::unique_ptr< SPDocument > copy() const
Create a copy of the document, useful for modifying during save & export.
Definition document.cpp:508
SPDocument * get_reference_document()
sigc::connection connectResourcesChanged(char const *key, SPDocument::ResourcesChangedSignal::slot_type slot)
char const * getDocumentFilename() const
Definition document.h:231
void update_lpobjs()
Definition document.cpp:659
sigc::signal< void(char const *)> FilenameSetSignal
Definition document.h:462
std::string generate_unique_id(char const *prefix)
Generate a document-wide unique id.
unsigned update_in_progress
For sanity check in SPObject::requestDisplayUpdate.
Definition document.h:106
bool addResource(char const *key, SPObject *object)
bool idle_handler()
An idle handler to update the document.
std::unique_ptr< Inkscape::Colors::DocumentCMS > _cms_manager
Definition document.h:175
void setXMLDialogSelectedObject(SPObject *activexmltree)
Definition document.h:159
const Geom::Affine & dt2doc() const
Desktop to document coordinate transformation.
Definition document.h:270
SPObject * getObjectById(std::string const &id) const
sigc::signal< void()> destroySignal
Definition document.h:484
unsigned long _serial
Definition document.h:444
void setWidth(const Inkscape::Util::Quantity &width, bool changeSize=true)
Definition document.cpp:874
void _importDefsNode(SPDocument *source, Inkscape::XML::Node *defs, Inkscape::XML::Node *target_defs)
Glib::ustring const & action_key() const
Definition document.h:364
char * document_base
To be used for resolving relative hrefs.
Definition document.h:414
SPDocument * _parent_document
Definition document.h:400
SPDocument::FilenameSetSignal filename_set_signal
Definition document.h:476
bool isModifiedSinceSave() const
Definition document.h:140
Inkscape::CompositeUndoStackObserver undoStackObservers
Definition document.h:438
void setModifiedSinceSave(bool const modified=true)
Indicate to the user if the document has been modified since the last save by displaying a "*" in fro...
void setupViewport(SPItemCtx *ctx)
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...
Inkscape::Util::Quantity getWidth() const
Definition document.cpp:857
SPDocument const * getParent() const
Definition document.h:220
void process_pending_resource_changes()
Inkscape::EventLog * get_event_log()
Definition document.h:162
char const * getDocumentName() const
basename or other human-readable label for the document.
Definition document.h:238
void addUndoObserver(Inkscape::UndoStackObserver &observer)
Add the observer to the document's undo listener The caller is in charge of freeing any memory alloca...
sigc::connection connectSavedOrModified(sigc::slot< void()> &&slot)
std::deque< SPItem * > const & get_flat_item_list(unsigned int dkey, bool into_groups, bool active_only) const
Turn the SVG DOM into a cached flat list of nodes that can be searched from top-down.
std::unique_ptr< Inkscape::PageManager > _page_manager
Definition document.h:174
std::vector< SPObject * > const getResourceList(char const *key)
bool seeking
Definition document.h:443
bool sensitive
Definition document.h:433
Geom::Affine _doc2dt
Definition document.h:410
Geom::Point getDimensions() const
Definition document.cpp:973
bool modified_since_save
Definition document.h:386
sigc::connection _desktop_activated_connection
Definition document.h:482
SPRoot * root
Our SPRoot.
Definition document.h:395
bool rerouting_handler()
An idle handler to reroute connectors in the document.
Persp3D * current_persp3d
Currently 'active' perspective (to which, e.g., newly created boxes are attached)
Definition document.h:425
sigc::connection connectBeforeCommit(BeforeCommitSignal::slot_type slot)
Persp3DImpl * getCurrentPersp3DImpl()
Definition document.h:349
void requestModified()
void reset_key(void *dummy)
Definition document.h:363
Geom::Rect getViewBox() const
Definition document.cpp:944
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.
Inkscape::XML::Node * getReprRoot()
Definition document.h:208
Geom::OptRect preferredBounds() const
Definition document.cpp:978
std::unique_ptr< Inkscape::Selection > _selection
Definition document.h:380
Geom::OptRect pageBounds()
Returns the position of the selected page or the preferredBounds()
Definition document.cpp:986
sigc::signal< void(double)> get_y_axis_flipped()
Definition document.h:283
CRCascade * getStyleCascade()
Definition document.h:225
SPDocument::BeforeCommitSignal before_commit_signal
Definition document.h:480
SPDocument::ReconstructionStart _reconstruction_start_signal
Definition document.h:477
sigc::signal< void()> ReconstructionStart
Definition document.h:464
unsigned long serial() const
Definition document.h:360
sigc::connection connectModified(ModifiedSignal::slot_type slot)
sigc::signal< void(double)> _y_axis_flipped
Definition document.h:486
unsigned int vacuumDocument()
Remove unused definitions etc.
unsigned int numPerspectivesInDefs() const
Definition document.h:352
std::deque< Inkscape::Event * > redo
Definition document.h:436
bool virgin
Has the document never been touched?
Definition document.h:385
void setHeight(const Inkscape::Util::Quantity &height, bool changeSize=true)
Definition document.cpp:913
sigc::connection modified_connection
Definition document.h:388
void getPerspectivesInDefs(std::vector< Persp3D * > &list) const
Definition document.cpp:273
Inkscape::PageManager & getPageManager()
Definition document.h:164
void setDocumentBase(char const *document_base)
To be used for resolving relative hrefs.
ResourcesChangedSignalMap resources_changed_signals
Definition document.h:510
const SPDocument * getOriginalDocument() const
Definition document.h:138
sigc::signal< void()> CommitSignal
Definition document.h:466
void emitReconstructionFinish()
bool has_yaxis_orientation_changed()
Detect Y-axis orientation change.
double yaxisdir() const
"1" if the desktop Y-axis points down, "-1" if it points up.
Definition document.h:278
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.
double action_expires
Definition document.h:446
void bindObjectToId(char const *id, SPObject *object)
SPDocument const * _original_document
Definition document.h:402
std::queue< GQuark > pending_resource_changes
Definition document.h:177
bool modified_since_autosave
Definition document.h:387
std::deque< Inkscape::Event * > undo
Definition document.h:435
void removeUndoObserver(Inkscape::UndoStackObserver &observer)
bool _updateDocument(int flags, unsigned int object_modified_tag=0)
Tries to update the document state based on the modified and "update required" flags,...
bool keepalive
false if temporary document (e.g. to generate a PNG for display in a dialog).
Definition document.h:384
SPDefs * getDefs()
Return the main defs object for the document.
Definition document.cpp:245
SPDocument * createChildDoc(std::string const &filename)
Fetches a document and attaches it to the current document as a child href.
Definition document.cpp:619
bool isModifiedSinceAutoSave() const
Definition document.h:141
std::map< unsigned long, std::deque< SPItem * > > _node_cache
Definition document.h:422
void clearNodeCache()
Definition document.h:191
const Inkscape::PageManager & getPageManager() const
Definition document.h:165
sigc::signal< void(SPObject *)> IDChangedSignal
Definition document.h:459
void set_origin_follows_page(bool on)
std::vector< SPObject * > getObjectsByElement(Glib::ustring const &element, bool custom=false) const
char * document_filename
A filename, or NULL.
Definition document.h:413
SPObject * _activexmltree
Definition document.h:172
sigc::signal< void(double, double)> ResizedSignal
Definition document.h:463
static std::unique_ptr< SPDocument > createNewDoc(char const *filename, bool keepalive, bool make_new=false, SPDocument *parent=nullptr)
Fetches document from filename, or creates new, if NULL; public document appears in document list.
Definition document.cpp:668
Inkscape::XML::Document * getReprDoc()
Our Inkscape::XML::Document.
Definition document.h:213
sigc::connection connectReconstructionFinish(ReconstructionFinish::slot_type slot)
SPDocument * _searchForChild(std::string const &filename, SPDocument const *avoid=nullptr)
Definition document.cpp:640
sigc::signal< void()> _saved_or_modified_signal
Definition document.h:485
std::map< GQuark, SPDocument::IDChangedSignal > IDChangedSignalMap
Definition document.h:469
unsigned long object_id_counter
Definition document.h:448
void rebase(Inkscape::XML::Document *new_xmldoc, bool keep_namedview=true)
Definition document.cpp:565
SPDocument::ReconstructionFinish _reconstruction_finish_signal
Definition document.h:478
Inkscape::ConsoleOutputUndoObserver console_output_undo_observer
Definition document.h:441
sigc::signal< void()> ReconstructionFinish
Definition document.h:465
void bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object)
Glib::Timer undo_timer
Definition document.h:447
Glib::ustring actionkey
Definition document.h:445
void setDocumentScale(const double scaleX, const double scaleY)
Sets document scale (by changing viewBox)
Definition document.cpp:750
char * document_name
basename or other human-readable label for the document.
Definition document.h:415
void setVirgin(bool Virgin)
Definition document.h:136
std::vector< Glib::ustring > getLanguages() const
Returns preferred document languages (from most to least preferred)
std::unique_ptr< Inkscape::EventLog > _event_log
Definition document.h:430
bool isSensitive() const
Definition document.h:365
void queueForOrphanCollection(SPObject *object)
Definition document.cpp:321
sigc::connection connectFilenameSet(FilenameSetSignal::slot_type slot)
SPRoot const * getRoot() const
Definition document.h:203
void do_change_filename(char const *const filename, bool const rebase)
int ensureUpToDate(unsigned int object_modified_tag=0)
Repeatedly works on getting the document updated, since sometimes it takes more than one pass to get ...
std::unique_ptr< Avoid::Router > _router
Definition document.h:379
SPDocument * _ref_document
Definition document.h:404
bool is_yaxisdown() const
True if the desktop Y-axis points down, false if it points up.
Definition document.h:276
SPObject * getObjectByHref(std::string const &href) const
SPDocument(SPDocument const &)=delete
SPObject * getObjectByRepr(Inkscape::XML::Node *repr) const
void set_reference_document(SPDocument *document)
Set the reference document object.
IDChangedSignalMap id_changed_signals
Dictionary of signals for id changes.
Definition document.h:473
sigc::signal< void()> ResourcesChangedSignal
Definition document.h:460
sigc::connection connectIdChanged(const char *id, IDChangedSignal::slot_type slot)
sigc::connection connectReconstructionStart(ReconstructionStart::slot_type slot, bool first=false)
SPObject * getXMLDialogSelectedObject()
Definition document.h:160
SPNamedView * getNamedView()
Get the namedview for this document, creates it if it's not found.
Definition document.cpp:233
void changeFilenameAndHrefs(char const *filename)
Changes the base, name and filename members of document, and updates any relative hrefs in the docume...
Persp3D * getCurrentPersp3D()
Definition document.cpp:253
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
void setViewBox()
Set default viewbox calculated from document properties.
Definition document.cpp:958
SPItem * getGroupAtPoint(unsigned int key, Geom::Point const &p) const
Inkscape::Colors::DocumentCMS & getDocumentCMS()
Definition document.h:167
Inkscape::Util::Quantity getHeight() const
Definition document.cpp:896
void setPages(bool enabled)
void SPDocument::initialize_current_persp3d() { this->current_persp3d = Persp3D::document_first_persp...
Definition document.cpp:295
void emitReconstructionStart()
std::map< std::string, SPObject * > iddef
Definition document.h:418
sigc::connection connectCommit(CommitSignal::slot_type slot)
SPDocument * getParent()
Definition document.h:219
Inkscape::XML::Node * rroot
Root element of Inkscape::XML::Document.
Definition document.h:393
bool getVirgin()
Definition document.h:137
sigc::connection connectDestroy(sigc::signal< void()>::slot_type slot)
SPDocument & operator=(SPDocument const &)=delete
Inkscape::XML::Node * getReprNamedView()
Definition document.cpp:223
SPItem * getItemAtPoint(unsigned int key, Geom::Point const &p, bool into_groups, SPItem *upto=nullptr) const
sigc::connection rerouting_connection
Definition document.h:389
Inkscape::Util::Unit const * getDisplayUnit()
guaranteed not to return nullptr
Definition document.cpp:741
Persp3DImpl * current_persp3d_impl
Definition document.h:426
const Inkscape::Colors::DocumentCMS & getDocumentCMS() const
Definition document.h:168
std::vector< SPObject * > getObjectsBySelector(Glib::ustring const &selector) const
std::map< Inkscape::XML::Node *, SPObject * > reprdef
Definition document.h:419
Base class for visual SVG elements.
Definition sp-item.h:109
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Definition sp-object.h:160
<svg> element
Definition sp-root.h:33
NodeObserver const * observer
the declaration of the CRCascade class.
bool custom
static char const *const parent
Definition dir-util.cpp:70
bool sp_do_not_fix_pre_92
bool sp_no_convert_text_baseline_spacing
Definition document.cpp:99
libavoid: Object-avoiding orthogonal and polyline connector routing library.
Miscellaneous supporting code.
Definition document.h:95
Helper class to stream background task notifications as a series of messages.
static cairo_user_data_key_t key
Axis-aligned rectangle.
void invert(const double v[16], double alpha[16])
Interface for XML documents.
Definition document.h:43
Object used to temporarily set and then automatically clear reference document.
Definition document.h:321
Contains transformations to document/viewport and the viewport size.
Definition sp-item.h:92
int delta
double height
double width
Glib::ustring name
Definition toolbars.cpp:55
Affine transformation classes.