Changeset View
Changeset View
Standalone View
Standalone View
libs/flake/text/KoSvgTextChunkShape.cpp
Show First 20 Lines • Show All 412 Lines • ▼ Show 20 Line(s) | 407 | for (int i = 0; i < d->localTransformations.size(); i++) { | |||
---|---|---|---|---|---|
413 | appendLazy(&dyPos, t.dyPos, i); | 413 | appendLazy(&dyPos, t.dyPos, i); | ||
414 | } | 414 | } | ||
415 | 415 | | |||
416 | qDebug() << "saveHTML" << this << d->text << xPos << yPos << dxPos << dyPos; | 416 | qDebug() << "saveHTML" << this << d->text << xPos << yPos << dxPos << dyPos; | ||
417 | 417 | | |||
418 | if (!dyPos.isEmpty()) { | 418 | if (!dyPos.isEmpty()) { | ||
419 | context.shapeWriter().startElement("br"); | 419 | context.shapeWriter().startElement("br"); | ||
420 | context.shapeWriter().endElement(); | 420 | context.shapeWriter().endElement(); | ||
421 | //we can't store the following attributes in the br, so store them in a span | ||||
422 | context.shapeWriter().startElement("span"); | ||||
421 | } | 423 | } | ||
422 | 424 | | |||
423 | KoSvgTextProperties parentProperties = | 425 | KoSvgTextProperties parentProperties = | ||
424 | parent ? parent->textProperties() : KoSvgTextProperties::defaultProperties(); | 426 | parent ? parent->textProperties() : KoSvgTextProperties::defaultProperties(); | ||
425 | 427 | | |||
426 | // XXX: we don't save fill, stroke, text length, length adjust or spacing and glyphs. | 428 | // XXX: we don't save fill, stroke, text length, length adjust or spacing and glyphs. | ||
427 | KoSvgTextProperties ownProperties = textProperties().ownProperties(parentProperties); | 429 | KoSvgTextProperties ownProperties = textProperties().ownProperties(parentProperties); | ||
428 | QMap<QString, QString> attributes = ownProperties.convertToSvgTextAttributes(); | 430 | QMap<QString, QString> attributes = ownProperties.convertToSvgTextAttributes(); | ||
429 | 431 | | |||
430 | if (attributes.count() > 0) { | 432 | if (attributes.count() > 0) { | ||
431 | QString styleString; | 433 | QString styleString; | ||
432 | for (auto it = attributes.constBegin(); it != attributes.constEnd(); ++it) { | 434 | for (auto it = attributes.constBegin(); it != attributes.constEnd(); ++it) { | ||
433 | styleString.append(it.key().toLatin1().data()) | 435 | styleString.append(it.key().toLatin1().data()) | ||
434 | .append(": ") | 436 | .append(": ") | ||
435 | .append(it.value()) | 437 | .append(it.value()) | ||
436 | .append(";" ); | 438 | .append(";" ); | ||
437 | } | 439 | } | ||
438 | context.shapeWriter().addAttribute("style", styleString); | 440 | context.shapeWriter().addAttribute("style", styleString); | ||
439 | } | 441 | } | ||
440 | 442 | | |||
441 | // After adding all the styling to the <p> element, add the text | 443 | // After adding all the styling to the <p> element, add the text | ||
442 | context.shapeWriter().addTextNode(d->text); | 444 | context.shapeWriter().addTextNode(d->text); | ||
443 | 445 | | |||
446 | if (!dyPos.isEmpty()) { | ||||
447 | //end span that was put after br | ||||
448 | context.shapeWriter().endElement(); | ||||
449 | } | ||||
450 | | ||||
444 | 451 | | |||
445 | } | 452 | } | ||
446 | else { | 453 | else { | ||
447 | Q_FOREACH (KoShape *child, this->shapes()) { | 454 | Q_FOREACH (KoShape *child, this->shapes()) { | ||
448 | KoSvgTextChunkShape *childText = dynamic_cast<KoSvgTextChunkShape*>(child); | 455 | KoSvgTextChunkShape *childText = dynamic_cast<KoSvgTextChunkShape*>(child); | ||
449 | KIS_SAFE_ASSERT_RECOVER(childText) { continue; } | 456 | KIS_SAFE_ASSERT_RECOVER(childText) { continue; } | ||
450 | childText->saveHtml(context); | 457 | childText->saveHtml(context); | ||
451 | } | 458 | } | ||
▲ Show 20 Lines • Show All 466 Lines • Show Last 20 Lines |