document.h revision 09ba3247163582bf2e30e17c4c154aa259ce038a
#ifndef __SP_DOCUMENT_H__
#define __SP_DOCUMENT_H__
/** \file
* SPDocument: Typed SVG document implementation
*/
/* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* MenTaLguY <mental@rydia.net>
*
* Copyright (C) 2004-2005 MenTaLguY
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <glib-object.h>
#include <gtk/gtksignal.h>
#include <sigc++/class_slot.h>
#include "libcroco/cr-cascade.h"
#include "gc-managed.h"
#include "gc-finalized.h"
#include "gc-anchored.h"
#include "verbs.h"
#include <vector>
#include <set>
}
struct NRRect;
struct SPDesktop;
struct SPItem;
struct SPObject;
struct SPGroup;
struct Application;
}
}
}
/// Typed SVG document implementation.
{
SPDocument();
virtual ~SPDocument();
unsigned int keepalive : 1;
unsigned int modified_since_save : 1;
/// Last action key
/// Handler ID
// Instance of the connector router
Persp3D *current_persp3d; // "currently active" perspective (e.g., newly created boxes are attached to this one)
bool oldSignalsConnected;
void collectOrphans();
void _emitModified();
bool _updateDocument();
/// Are we currently in a transition between two "known good" states of the document?
bool isSeeking() const;
bool isModifiedSinceSave() const { return modified_since_save; }
void setModifiedSinceSave(bool modified = true) {
}
void emitReconstructionStart(void);
void emitReconstructionFinish(void);
unsigned long serial() const;
};
SPDocument *sp_document_create(Inkscape::XML::Document *rdoc, gchar const *uri, gchar const *base, gchar const *name, unsigned int keepalive);
/*
* Access methods
*/
#define sp_document_repr_doc(d) (d->rdoc)
#define sp_document_repr_root(d) (d->rroot)
#define sp_document_root(d) (d->root)
#define SP_DOCUMENT_ROOT(d) (d->root)
struct SPUnit;
#define SP_DOCUMENT_URI(d) (d->uri)
#define SP_DOCUMENT_NAME(d) (d->name)
#define SP_DOCUMENT_BASE(d) (d->base)
/*
* Dictionary
*/
/*
* Undo & redo
*/
void sp_document_child_added(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
void sp_document_child_removed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref);
void sp_document_attr_changed(SPDocument *doc, SPObject *object, const gchar *key, const gchar *oldval, const gchar *newval);
void sp_document_content_changed(SPDocument *doc, SPObject *object, const gchar *oldcontent, const gchar *newcontent);
void sp_document_order_changed(SPDocument *doc, SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *oldref, Inkscape::XML::Node *newref);
/* Object modification root handler */
/* Save all previous actions to stack, as one undo step */
void sp_document_done(SPDocument *document, unsigned int event_type, Glib::ustring event_description);
void sp_document_maybe_done(SPDocument *document, const gchar *keyconst, unsigned int event_type, Glib::ustring event_description);
/* Cancel (and revert) current unsaved actions */
/* Undo and redo */
/* Resource management */
sigc::connection sp_document_resources_changed_connect(SPDocument *document, const gchar *key, SPDocument::ResourcesChangedSignal::slot_type slot);
/*
* Ideas: How to overcome style invalidation nightmare
*
* 1. There is reference request dictionary, that contains
* objects (styles) needing certain id. Object::build checks
* final id against it, and invokes necesary methods
*
* 2. Removing referenced object is simply prohibited -
* needs analyse, how we can deal with situations, where
* we simply want to ungroup etc. - probably we need
* Repr::reparent method :( [Or was it ;)]
*
*/
/*
* Misc
*/
GSList *sp_document_partial_items_in_box(SPDocument *document, unsigned int dkey, Geom::Rect const &box);
SPItem *sp_document_item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, const GSList *list, Geom::Point const p, bool take_insensitive = false);
SPItem *sp_document_item_at_point (SPDocument *document, unsigned int key, Geom::Point const p, gboolean into_groups, SPItem *upto = NULL);
GSList *sp_document_items_at_points(SPDocument *document, unsigned const key, std::vector<Geom::Point> points);
#endif
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :