sp-tspan.cpp revision 98aa9bd733915a8e4c6ad4596e9386ac48ace79c
/*
* 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"
#include "2geom/transforms.h"
#include "sp-factory.h"
namespace {
SPObject* createTSpan() {
return new SPTSpan();
}
SPObject* createTextPath() {
return new SPTextPath();
}
}
/*#####################################################
# SPTSPAN
#####################################################*/
this->role = SP_TSPAN_ROLE_UNSPECIFIED;
}
}
this->readAttr( "x" );
this->readAttr( "y" );
this->readAttr( "dx" );
this->readAttr( "dy" );
this->readAttr( "rotate" );
this->readAttr( "sodipodi:role" );
}
}
} else {
switch (key) {
case SP_ATTR_SODIPODI_ROLE:
this->role = SP_TSPAN_ROLE_LINE;
} else {
this->role = SP_TSPAN_ROLE_UNSPECIFIED;
}
break;
default:
break;
}
}
}
unsigned childflags = flags;
if (flags & SP_OBJECT_MODIFIED_FLAG) {
}
}
}
}
// SPItem::onModified(flags);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
}
}
}
}
// find out the ancestor text which holds our layout
SPObject const *parent_text = this;
}
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, this), sp_text_get_length_upto(this, NULL) - 1);
if (!bbox) {
return bbox;
}
// Add stroke width
// FIXME this code is incorrect
}
return bbox;
}
Inkscape::XML::Node* SPTSpan::write(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;
}
const char* SPTSpan::displayName() const {
return _("Text Span");
}
/*#####################################################
# SPTEXTPATH
#####################################################*/
this->startOffset._set = false;
this->originalPath = NULL;
this->isUpdating=false;
// set up the uri reference
this->sourcePath = new SPUsePath(this);
}
SPTextPath::~SPTextPath() {
delete this->sourcePath;
}
this->readAttr( "x" );
this->readAttr( "y" );
this->readAttr( "dx" );
this->readAttr( "dy" );
this->readAttr( "rotate" );
this->readAttr( "startOffset" );
this->readAttr( "xlink:href" );
bool no_content = true;
{
no_content = false;
break;
}
}
if ( no_content ) {
}
}
void SPTextPath::release() {
//this->attributes.~TextTagAttributes();
if (this->originalPath) {
delete this->originalPath;
}
this->originalPath = NULL;
}
} else {
switch (key) {
case SP_ATTR_XLINK_HREF:
break;
case SP_ATTR_STARTOFFSET:
break;
default:
break;
}
}
}
this->isUpdating = true;
if ( this->sourcePath->sourceDirty ) {
refresh_textpath_source(this);
}
this->isUpdating = false;
if (flags & SP_OBJECT_MODIFIED_FLAG) {
}
}
}
}
{
return;
}
// finalisons
if (tp->originalPath) {
delete tp->originalPath;
}
}
}
// SPItem::onModified(flags);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
}
}
}
}
Inkscape::XML::Node* SPTextPath::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
}
if (this->startOffset._set) {
} else {
/* FIXME: This logic looks rather undesirable if e.g. startOffset is to be
in ems. */
}
}
if ( this->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;
}
{
if (SP_IS_ITEM(refobj)) {
return refobj;
}
}
return NULL;
}
{
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 (to be near where it was when on path)
/* 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 :