document.h revision ba0842a4240ac9f46ab11d856227468237284186
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef __SP_DOCUMENT_H__
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define __SP_DOCUMENT_H__
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/** \file
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * SPDocument: Typed SVG document implementation
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Authors:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Lauris Kaplinski <lauris@kaplinski.com>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * MenTaLguY <mental@rydia.net>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
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 *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Released under GNU GPL, read the file 'COPYING' for more information
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <glib-object.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <gtk/gtksignal.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sigc++/sigc++.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sigc++/class_slot.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "libcroco/cr-cascade.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <2geom/forward.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "gc-managed.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "gc-finalized.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "gc-anchored.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <glibmm/ustring.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include "verbs.h"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <vector>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <set>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortenamespace Avoid {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteclass Router;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct NRRect;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct SPDesktop;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct SPItem;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct SPObject;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct SPGroup;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortenamespace Inkscape {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct Application;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte class Selection;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte class UndoStackObserver;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte class EventLog;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte class ProfileManager;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte namespace XML {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte class Document;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte class Node;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteclass SP3DBox;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteclass Persp3D;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteclass Persp3DImpl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortenamespace Proj {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte class TransfMat3x4;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteclass SPDocumentPrivate;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/// Typed SVG document implementation.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct SPDocument : public Inkscape::GC::Managed<>,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte public Inkscape::GC::Finalized,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte public Inkscape::GC::Anchored
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
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 typedef sigc::signal<void> ReconstructionStart;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typedef sigc::signal<void> ReconstructionFinish;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte typedef sigc::signal<void> CommitSignal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SPDocument();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte virtual ~SPDocument();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int keepalive : 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int virgin : 1; ///< Has the document never been touched?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int modified_since_save : 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Inkscape::XML::Document *rdoc; ///< Our Inkscape::XML::Document
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Inkscape::XML::Node *rroot; ///< Root element of Inkscape::XML::Document
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SPObject *root; ///< Our SPRoot
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte CRCascade *style_cascade;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
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
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SPDocumentPrivate *priv;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /// Last action key
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const gchar *actionkey;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /// Handler ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte guint modified_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /// Connector rerouting handler ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte guint rerouting_handler_id;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Inkscape::ProfileManager* profileManager;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte // Instance of the connector router
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Avoid::Router *router;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte GSList *_collection_queue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bool oldSignalsConnected;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void setCurrentPersp3D(Persp3D * const persp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte inline void setCurrentPersp3DImpl(Persp3DImpl * const persp_impl) { current_persp3d_impl = persp_impl; }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
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 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Persp3D * getCurrentPersp3D();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Persp3DImpl * getCurrentPersp3DImpl();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void getPerspectivesInDefs(std::vector<Persp3D*> &list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int numPerspectivesInDefs() {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte std::vector<Persp3D*> list;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getPerspectivesInDefs(list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return list.size();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte //void initialize_current_persp3d();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
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
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void bindObjectToId(gchar const *id, SPObject *object);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SPObject *getObjectById(gchar const *id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sigc::connection connectIdChanged(const gchar *id, IDChangedSignal::slot_type slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void bindObjectToRepr(Inkscape::XML::Node *repr, SPObject *object);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SPObject *getObjectByRepr(Inkscape::XML::Node *repr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Glib::ustring getLanguage();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void queueForOrphanCollection(SPObject *object);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void collectOrphans();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void _emitModified();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void addUndoObserver(Inkscape::UndoStackObserver& observer);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void removeUndoObserver(Inkscape::UndoStackObserver& observer);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bool _updateDocument();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /// Are we currently in a transition between two "known good" states of the document?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bool isSeeking() const;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bool isModifiedSinceSave() const { return modified_since_save; }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void setModifiedSinceSave(bool modified = true) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte modified_since_save = modified;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteprivate:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SPDocument(SPDocument const &); // no copy
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void operator=(SPDocument const &); // no assign
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Persp3D *current_persp3d; /**< Currently 'active' perspective (to which, e.g., newly created boxes are attached) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Persp3DImpl *current_persp3d_impl;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepublic:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sigc::connection connectReconstructionStart(ReconstructionStart::slot_type slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sigc::connection connectReconstructionFinish(ReconstructionFinish::slot_type slot);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void emitReconstructionStart(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void emitReconstructionFinish(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned long serial() const;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void reset_key(void *dummy);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sigc::connection _selection_changed_connection;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sigc::connection _desktop_activated_connection;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void fitToRect(Geom::Rect const &rect, bool with_margins = false);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
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 Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteSPDocument *sp_document_ref(SPDocument *doc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteSPDocument *sp_document_unref(SPDocument *doc);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteSPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Access methods
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define sp_document_repr_doc(d) (d->rdoc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define sp_document_repr_root(d) (d->rroot)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define sp_document_root(d) (d->root)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SP_DOCUMENT_ROOT(d) (d->root)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegdouble sp_document_width(SPDocument *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegdouble sp_document_height(SPDocument *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteGeom::Point sp_document_dimensions(SPDocument *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct SPUnit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
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
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SP_DOCUMENT_URI(d) (d->uri)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SP_DOCUMENT_NAME(d) (d->name)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SP_DOCUMENT_BASE(d) (d->base)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Dictionary
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Undo & redo
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_set_undo_sensitive(SPDocument *document, bool sensitive);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortebool sp_document_get_undo_sensitive(SPDocument const *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_clear_undo(SPDocument *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_clear_redo(SPDocument *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
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
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
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
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Cancel (and revert) current unsaved actions */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_cancel(SPDocument *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Undo and redo */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegboolean sp_document_undo(SPDocument *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortegboolean sp_document_redo(SPDocument *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
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
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Ideas: How to overcome style invalidation nightmare
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
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 *
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 Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Misc
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
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 Forte
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 Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid sp_document_resized_signal_emit(SPDocument *doc, gdouble width, gdouble height);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteunsigned int vacuum_document(SPDocument *document);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Local Variables:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mode:c++
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 End:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte