sp-tspan.cpp revision 5f084735ad258ffdad7f4f7f48d603c32043aea9
/*
* SVG <text> and <tspan> implementation
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Jon A. Cruz <jon@joncruz.org>
* Abhishek Sharma
*
* 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 "document.h"
/*#####################################################
# SPTSPAN
#####################################################*/
static Geom::OptRect sp_tspan_bbox(SPItem const *item, Geom::Affine const &transform, SPItem::BBoxType type);
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
{
}
} else {
switch (key) {
case SP_ATTR_SODIPODI_ROLE:
} else {
}
break;
default:
break;
}
}
}
static void
{
}
if (flags & SP_OBJECT_MODIFIED_FLAG) {
}
}
}
}
{
}
// CPPIFY: This doesn't make no sense.
// CObject::onModified is pure and CItem doesn't override this method. What was the idea behind these lines?
// if (((SPObjectClass *) tspan_parent_class)->modified) {
// ((SPObjectClass *) tspan_parent_class)->modified(object, flags);
// }
// CItem::onModified(flags);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
}
}
}
}
{
}
// find out the ancestor text which holds our layout
}
if (parent_text == NULL) {
return bbox;
}
// get the bbox of our portion of the layout
bbox = SP_TEXT(parent_text)->layout.bounds(transform, sp_text_get_length_upto(parent_text, item), sp_text_get_length_upto(item, NULL) - 1);
// Add stroke width
// FIXME this code is incorrect
}
return bbox;
}
{
}
Inkscape::XML::Node* CTSpan::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
}
if ( flags&SP_OBJECT_WRITE_BUILD ) {
} else if ( SP_IS_TEXTPATH(child) ) {
//c_repr = child->updateRepr(xml_doc, NULL, flags); // shouldn't happen
} else if ( SP_IS_STRING(child) ) {
}
if ( c_repr ) {
l = g_slist_prepend(l, c_repr);
}
}
while ( l ) {
l = g_slist_remove(l, l->data);
}
} else {
} 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;
}
sp_tspan_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
}
return g_strdup(_("<b>Text span</b>"));
}
static char *
{
}
/*#####################################################
# 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;
}
{
}
this->sptextpath = textpath;
}
}
static void
{
textpath->isUpdating=false;
// set up the uri reference
}
static void
{
delete textpath->sourcePath;
}
}
static void
{
}
bool no_content = true;
{
no_content = false;
break;
}
}
if ( no_content ) {
}
}
{
}
} else {
switch (key) {
case SP_ATTR_XLINK_HREF:
break;
case SP_ATTR_STARTOFFSET:
break;
default:
break;
}
}
}
static void
{
}
textpath->isUpdating = true;
}
textpath->isUpdating = false;
if (flags & SP_OBJECT_MODIFIED_FLAG) {
}
}
}
}
{
}
{
// finalisons
if (tp->originalPath) {
delete tp->originalPath;
}
}
}
// CPPIFY: This doesn't make no sense.
// CObject::onModified is pure and CItem doesn't override this method. What was the idea behind these lines?
// if (((SPObjectClass *) textpath_parent_class)->modified) {
// ((SPObjectClass *) textpath_parent_class)->modified(object, flags);
// }
// CItem::onModified(flags);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
}
}
}
}
{
}
Inkscape::XML::Node* CTextPath::onWrite(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 ) {
} else if ( SP_IS_TEXTPATH(child) ) {
//c_repr = child->updateRepr(xml_doc, NULL, flags); // shouldn't happen
} else if ( SP_IS_STRING(child) ) {
}
if ( c_repr ) {
l = g_slist_prepend(l, c_repr);
}
}
while ( l ) {
l = g_slist_remove(l, l->data);
}
} else {
} 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;
}
sp_textpath_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
}
SPItem *
{
if (SP_IS_ITEM(refobj))
}
return NULL;
}
void
{
if (!bbox) return;
// make a list of textpath children
}
// make a copy of each textpath child
Inkscape::XML::Node *copy = ((Inkscape::XML::Node *) i->data)->duplicate(text->getRepr()->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 :