document.h revision 878a58a27ee9b6bae58f9f8272c33e74600d2c2f
#ifndef SEEN_SP_DOCUMENT_H
#define SEEN_SP_DOCUMENT_H
/** \file
* SPDocument: Typed SVG document implementation
*/
/* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* MenTaLguY <mental@rydia.net>
* Jon A. Cruz <jon@joncruz.org>
* Abhishek Sharma
*
* 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 <stddef.h>
#include "libcroco/cr-cascade.h"
#include "inkgc/gc-managed.h"
#include "gc-finalized.h"
#include "gc-anchored.h"
#include <vector>
}
struct Document;
}
}
}
}
struct SPDocumentPrivate;
/// Typed SVG document implementation.
{
// Note: multiple public and private sections is not a good practice, but happens
// in this class as transitional to fixing encapsulation:
SPDocument();
virtual ~SPDocument();
unsigned int keepalive : 1;
unsigned int modified_since_save : 1;
char *uri; ///< A filename (not a URI yet), or NULL
char *base; ///< To be used for resolving relative hrefs.
char *name; ///< basename(uri) or other human-readable label for the document.
/// Last action key
/// Handler ID
unsigned modified_id;
/// Connector rerouting handler ID
unsigned rerouting_handler_id;
// Instance of the connector router
bool oldSignalsConnected;
/** Returns our SPRoot */
/** Our Inkscape::XML::Document. */
/** A filename (not a URI yet), or NULL */
/** To be used for resolving relative hrefs. */
/** basename(uri) or other human-readable label for the document. */
/** Return the main defs object for the document. */
inline void setCurrentPersp3DImpl(Persp3DImpl * const persp_impl) { current_persp3d_impl = persp_impl; }
/*
* getCurrentPersp3D returns current_persp3d (if non-NULL) or the first
* perspective in the defs. If no perspective exists, returns NULL.
*/
Persp3D * getCurrentPersp3D();
unsigned int numPerspectivesInDefs() const {
}
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);
Persp3D *current_persp3d; /**< Currently 'active' perspective (to which, e.g., newly created boxes are attached) */
// A list of svg documents being used or shown within this document
// Conversely this is a parent document because this is a child.
void emitReconstructionStart(void);
void emitReconstructionFinish(void);
unsigned long serial() const;
sigc::connection connectResourcesChanged(char const *key, SPDocument::ResourcesChangedSignal::slot_type slot);
/**
* Returns the bottommost item from the list which is at the point, or NULL if none.
*/
static SPItem *getItemFromListAtPointBottom(unsigned int dkey, SPGroup *group, const std::vector<SPItem*> &list, Geom::Point const &p, bool take_insensitive = false);
SPDocument *parent);
SPDocument *doRef();
SPDocument *doUnref();
void setDocumentScale( const double scale );
void setWidthAndHeight(const Inkscape::Util::Quantity &width, const Inkscape::Util::Quantity &height, bool changeSize=true);
void requestModified();
int ensureUpToDate();
SPItem *getItemAtPoint(unsigned int key, Geom::Point const &p, bool into_groups, SPItem *upto = NULL) const;
std::vector<SPItem*> getItemsAtPoints(unsigned const key, std::vector<Geom::Point> points, bool all_layers = true, size_t limit = 0) const;
void changeUriAndHrefs(char const *uri);
unsigned int vacuumDocument();
void importDefsNode(SPDocument *source, Inkscape::XML::Node *defs, Inkscape::XML::Node *target_defs);
};
/*
* 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 ;)]
*
*/
#endif // SEEN_SP_DOCUMENT_H
/*
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:fileencoding=utf-8:textwidth=99 :