sp-tspan.cpp revision a4030d5ca449e7e384bc699cd249ee704faaeab0
#define __SP_TSPAN_C__
/*
* SVG <text> and <tspan> implementation
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
*
* Copyright (C) 1999-2002 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
/*
* fixme:
*
* These subcomponents should not be items, or alternately
* we have to invent set of flags to mark, whether standard
* attributes are applicable to given item (I even like this
* idea somewhat - Lauris)
*
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <cstring>
#include <string>
#include "svg/stringstream.h"
#include "attributes.h"
#include "sp-use-reference.h"
#include "sp-tspan.h"
#include "sp-tref.h"
#include "sp-textpath.h"
#include "text-editing.h"
#include "style.h"
#include "libnr/nr-matrix-fns.h"
#include "document.h"
/*#####################################################
# SPTSPAN
#####################################################*/
static void sp_tspan_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
static Inkscape::XML::Node *sp_tspan_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static SPItemClass *tspan_parent_class;
/**
*
*/
{
if (!type) {
sizeof(SPTSpanClass),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof(SPTSpan),
16, /* n_preallocs */
NULL, /* value_table */
};
}
return type;
}
static void
{
}
static void
{
}
static void
{
}
static void
{
//SPTSpan *tspan = SP_TSPAN(object);
}
static void
{
} else {
switch (key) {
case SP_ATTR_SODIPODI_ROLE:
} else {
}
break;
default:
break;
}
}
}
static void
{
}
}
}
static void
{
if (flags & SP_OBJECT_MODIFIED_FLAG)
}
}
}
static void sp_tspan_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const /*flags*/)
{
// find out the ancestor text which holds our layout
for (; parent_text != NULL && !SP_IS_TEXT(parent_text); parent_text = SP_OBJECT_PARENT (parent_text)){};
if (parent_text == NULL) return;
// get the bbox of our portion of the layout
SP_TEXT(parent_text)->layout.getBoundingBox(bbox, transform, sp_text_get_length_upto(parent_text, item), sp_text_get_length_upto(item, NULL) - 1);
// Add stroke width
}
}
}
}
sp_tspan_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
}
if ( flags&SP_OBJECT_WRITE_BUILD ) {
for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
} else if ( SP_IS_TEXTPATH(child) ) {
//c_repr = child->updateRepr(xml_doc, NULL, flags); // shouldn't happen
} else if ( SP_IS_STRING(child) ) {
}
}
while ( l ) {
l = g_slist_remove(l, l->data);
}
} else {
for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
} else if ( SP_IS_TEXTPATH(child) ) {
//c_repr = child->updateRepr(xml_doc, NULL, flags); // shouldn't happen
} else if ( SP_IS_STRING(child) ) {
}
}
}
return repr;
}
static char *
{
return g_strdup(_("<b>Text span</b>"));
}
/*#####################################################
# SPTEXTPATH
#####################################################*/
static void sp_textpath_build(SPObject * object, SPDocument * document, Inkscape::XML::Node * repr);
static Inkscape::XML::Node *sp_textpath_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static SPItemClass *textpath_parent_class;
/**
*
*/
{
if (!type) {
sizeof(SPTextPathClass),
NULL, /* base_init */
NULL, /* base_finalize */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof(SPTextPath),
16, /* n_preallocs */
NULL, /* value_table */
};
}
return type;
}
static void
{
}
static void
{
textpath->isUpdating=false;
// set up the uri reference
}
static void
{
delete textpath->sourcePath;
}
static void
{
}
static void
{
//SPTextPath *textpath = SP_TEXTPATH(object);
bool no_content=true;
}
if ( no_content ) {
}
}
static void
{
} else {
switch (key) {
case SP_ATTR_XLINK_HREF:
break;
case SP_ATTR_STARTOFFSET:
break;
default:
break;
}
}
}
static void
{
textpath->isUpdating=true;
textpath->isUpdating=false;
}
}
}
{
// finalisons
if (tp->originalPath) {
delete tp->originalPath;
}
}
}
static void
{
if (flags & SP_OBJECT_MODIFIED_FLAG)
}
}
}
sp_textpath_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
}
} else {
/* FIXME: This logic looks rather undesirable if e.g. startOffset is to be
in ems. */
}
}
if ( textpath->sourcePath->sourceHref ) repr->setAttribute("xlink:href", textpath->sourcePath->sourceHref);
if ( flags&SP_OBJECT_WRITE_BUILD ) {
for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
} else if ( SP_IS_TEXTPATH(child) ) {
//c_repr = child->updateRepr(xml_doc, NULL, flags); // shouldn't happen
} else if ( SP_IS_STRING(child) ) {
}
}
while ( l ) {
l = g_slist_remove(l, l->data);
}
} else {
for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
} else if ( SP_IS_TEXTPATH(child) ) {
//c_repr = child->updateRepr(xml_doc, NULL, flags); // shouldn't happen
} else if ( SP_IS_STRING(child) ) {
}
}
}
return repr;
}
SPItem *
{
if (SP_IS_ITEM(refobj))
}
return NULL;
}
void
{
// make a list of textpath children
}
// make a copy of each textpath child
Inkscape::XML::Node *copy = ((Inkscape::XML::Node *) i->data)->duplicate(SP_OBJECT_REPR(text)->document());
// remove the old repr from under textpath
// put its copy under text
}
//remove textpath
tp->deleteObject();
// set x/y on text
/* fixme: Yuck, is this really the right test? */
}
}
/*
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 :