document.h revision ba0842a4240ac9f46ab11d856227468237284186
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * SPDocument: Typed SVG document implementation
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Lauris Kaplinski <lauris@kaplinski.com>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * MenTaLguY <mental@rydia.net>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright (C) 2004-2005 MenTaLguY
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright (C) 1999-2002 Lauris Kaplinski
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright (C) 2000-2001 Ximian, Inc.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Released under GNU GPL, read the file 'COPYING' for more information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/// Typed SVG document implementation.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct SPDocument : public Inkscape::GC::Managed<>,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typedef sigc::signal<void, SPObject *> IDChangedSignal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typedef sigc::signal<void> ResourcesChangedSignal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typedef sigc::signal<void, guint> ModifiedSignal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typedef sigc::signal<void, gchar const *> URISetSignal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typedef sigc::signal<void, double, double> ResizedSignal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int virgin : 1; ///< Has the document never been touched?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Inkscape::XML::Document *rdoc; ///< Our Inkscape::XML::Document
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Inkscape::XML::Node *rroot; ///< Root element of Inkscape::XML::Document
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gchar *uri; ///< A filename (not a URI yet), or NULL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gchar *base; ///< To be used for resolving relative hrefs.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gchar *name; ///< basename(uri) or other human-readable label for the document.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /// Last action key
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /// Handler ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /// Connector rerouting handler ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // Instance of the connector router
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inline void setCurrentPersp3DImpl(Persp3DImpl * const persp_impl) { current_persp3d_impl = persp_impl; }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * getCurrentPersp3D returns current_persp3d (if non-NULL) or the first
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * perspective in the defs. If no perspective exists, returns NULL.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void getPerspectivesInDefs(std::vector<Persp3D*> &list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int numPerspectivesInDefs() {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte //void initialize_current_persp3d();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sigc::connection connectModified(ModifiedSignal::slot_type slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sigc::connection connectURISet(URISetSignal::slot_type slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sigc::connection connectResized(ResizedSignal::slot_type slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesigc::connection connectCommit(CommitSignal::slot_type slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void bindObjectToId(gchar const *id, SPObject *object);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sigc::connection connectIdChanged(const gchar *id, IDChangedSignal::slot_type slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SPObject *getObjectByRepr(Inkscape::XML::Node *repr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void addUndoObserver(Inkscape::UndoStackObserver& observer);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void removeUndoObserver(Inkscape::UndoStackObserver& observer);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /// Are we currently in a transition between two "known good" states of the document?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bool isSeeking() const;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bool isModifiedSinceSave() const { return modified_since_save; }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void setModifiedSinceSave(bool modified = true) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Persp3D *current_persp3d; /**< Currently 'active' perspective (to which, e.g., newly created boxes are attached) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sigc::connection connectReconstructionStart(ReconstructionStart::slot_type slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sigc::connection connectReconstructionFinish(ReconstructionFinish::slot_type slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned long serial() const;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void fitToRect(Geom::Rect const &rect, bool with_margins = false);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteSPDocument *sp_document_new(const gchar *uri, unsigned int keepalive, bool make_new = false);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteSPDocument *sp_document_new_from_mem(const gchar *buffer, gint length, unsigned int keepalive);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteSPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Access methods
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteGeom::Point sp_document_dimensions(SPDocument *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_set_width(SPDocument *document, gdouble width, const SPUnit *unit);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_set_height(SPDocument *document, gdouble height, const SPUnit *unit);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dictionary
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Undo & redo
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_set_undo_sensitive(SPDocument *document, bool sensitive);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortebool sp_document_get_undo_sensitive(SPDocument const *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_clear_undo(SPDocument *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_clear_redo(SPDocument *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_child_added(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_child_removed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_attr_changed(SPDocument *doc, SPObject *object, const gchar *key, const gchar *oldval, const gchar *newval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_content_changed(SPDocument *doc, SPObject *object, const gchar *oldcontent, const gchar *newcontent);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_order_changed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *oldref, Inkscape::XML::Node *newref);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Object modification root handler */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_request_modified(SPDocument *doc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegint sp_document_ensure_up_to_date(SPDocument *doc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Save all previous actions to stack, as one undo step */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_done(SPDocument *document, unsigned int event_type, Glib::ustring event_description);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_maybe_done(SPDocument *document, const gchar *keyconst, unsigned int event_type, Glib::ustring event_description);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_reset_key(Inkscape::Application *inkscape, SPDesktop *desktop, GtkObject *base);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Cancel (and revert) current unsaved actions */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Undo and redo */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Resource management */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegboolean sp_document_add_resource(SPDocument *document, const gchar *key, SPObject *object);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegboolean sp_document_remove_resource(SPDocument *document, const gchar *key, SPObject *object);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst GSList *sp_document_get_resource_list(SPDocument *document, const gchar *key);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesigc::connection sp_document_resources_changed_connect(SPDocument *document, const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Ideas: How to overcome style invalidation nightmare
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 1. There is reference request dictionary, that contains
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * objects (styles) needing certain id. Object::build checks
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * final id against it, and invokes necesary methods
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 2. Removing referenced object is simply prohibited -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * needs analyse, how we can deal with situations, where
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * we simply want to ungroup etc. - probably we need
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Repr::reparent method :( [Or was it ;)]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteGSList *sp_document_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteGSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteSPItem *sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteSPItem *sp_document_item_at_point (SPDocument *document, unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteGSList *sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector<Geom::Point> points);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteSPItem *sp_document_group_at_point (SPDocument *document, unsigned int key, Geom::Point const p);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_set_uri(SPDocument *document, gchar const *uri);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_change_uri_and_hrefs(SPDocument *document, gchar const *uri);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteunsigned int vacuum_document(SPDocument *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Local Variables:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c-file-style:"stroustrup"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte indent-tabs-mode:nil
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fill-column:99
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :