384
forEachElement(child, element) {
385
if (child.localName() == "enhanced-geometry" && child.namespaceURI() == KoXmlNS::draw) {
387
QRectF viewBox = loadOdfViewbox(child);
388
if (! viewBox.isEmpty())
391
// load the modifiers
392
QString modifiers = child.attributeNS(KoXmlNS::draw, "modifiers", "");
393
if (! modifiers.isEmpty()) {
394
addModifiers(modifiers);
397
KoXmlElement grandChild;
398
forEachElement(grandChild, child) {
399
if (grandChild.namespaceURI() != KoXmlNS::draw)
401
if (grandChild.localName() == "equation") {
402
QString name = grandChild.attributeNS(KoXmlNS::draw, "name");
403
QString formula = grandChild.attributeNS(KoXmlNS::draw, "formula");
404
addFormula(name, formula);
405
} else if (grandChild.localName() == "handle") {
406
EnhancedPathHandle * handle = new EnhancedPathHandle(this);
407
if (handle->loadOdf(grandChild, context)) {
408
m_enhancedHandles.append(handle);
386
const KoXmlElement enhancedGeometry(KoXml::namedItemNS(element, KoXmlNS::draw, "enhanced-geometry" ) );
387
if (!enhancedGeometry.isNull() ) {
388
// load the modifiers
389
QString modifiers = enhancedGeometry.attributeNS(KoXmlNS::draw, "modifiers", "");
390
if (! modifiers.isEmpty()) {
391
addModifiers(modifiers);
394
KoXmlElement grandChild;
395
forEachElement(grandChild, enhancedGeometry) {
396
if (grandChild.namespaceURI() != KoXmlNS::draw)
398
if (grandChild.localName() == "equation") {
399
QString name = grandChild.attributeNS(KoXmlNS::draw, "name");
400
QString formula = grandChild.attributeNS(KoXmlNS::draw, "formula");
401
addFormula(name, formula);
402
} else if (grandChild.localName() == "handle") {
403
EnhancedPathHandle * handle = new EnhancedPathHandle(this);
404
if (handle->loadOdf(grandChild, context)) {
405
m_enhancedHandles.append(handle);
416
// load the enhanced path data
417
QString path = child.attributeNS(KoXmlNS::draw, "enhanced-path", "");
413
// load the enhanced path data
414
QString path = enhancedGeometry.attributeNS(KoXmlNS::draw, "enhanced-path", "");
418
415
#ifndef NWORKAROUND_ODF_BUGS
419
KoOdfWorkaround::fixEnhancedPath(path, child, context);
416
KoOdfWorkaround::fixEnhancedPath(path, enhancedGeometry, context);
421
if (!path.isEmpty()) {
425
setMirrorHorizontally( child.attributeNS(KoXmlNS::draw, "mirror-horizontal") == "true");
426
setMirrorVertically( child.attributeNS(KoXmlNS::draw, "mirror-vertical") == "true");
418
if (!path.isEmpty()) {
423
QRectF viewBox = loadOdfViewbox(enhancedGeometry);
424
if (! viewBox.isEmpty()) {
428
// if there is no view box defined make it is big as the path.
429
m_viewBox = m_viewBound;
432
setMirrorHorizontally(enhancedGeometry.attributeNS(KoXmlNS::draw, "mirror-horizontal") == "true");
433
setMirrorVertically(enhancedGeometry.attributeNS(KoXmlNS::draw, "mirror-vertical") == "true");
440
446
pos.setX(KoUnit::parseValue(element.attributeNS(KoXmlNS::svg, "x", QString())));
441
447
pos.setY(KoUnit::parseValue(element.attributeNS(KoXmlNS::svg, "y", QString())));
448
setPosition(pos - m_viewMatrix.map(QPointF(0, 0)) - m_viewBoxOffset);
444
450
loadOdfAttributes(element, context, OdfMandatories | OdfTransformation | OdfAdditionalAttributes | OdfCommonChildElements);
452
KoTextOnShapeContainer::tryWrapShape(this, element, context);
455
463
bool separator = true;
456
464
for (int i = 0; i < data.length(); ++i) {
457
465
QChar ch = data.at(i);
458
if (separator && (ch.unicode() == 'M' || ch.unicode() == 'L'
459
|| ch.unicode() == 'C' || ch.unicode() == 'Z'
460
|| ch.unicode() == 'N' || ch.unicode() == 'F'
461
|| ch.unicode() == 'S' || ch.unicode() == 'T'
462
|| ch.unicode() == 'U' || ch.unicode() == 'A'
463
|| ch.unicode() == 'B' || ch.unicode() == 'W'
464
|| ch.unicode() == 'V' || ch.unicode() == 'X'
465
|| ch.unicode() == 'Y' || ch.unicode() == 'Q')) {
466
ushort uni_ch = ch.unicode();
467
if (separator && (uni_ch == 'M' || uni_ch == 'L'
468
|| uni_ch == 'C' || uni_ch == 'Z'
469
|| uni_ch == 'N' || uni_ch == 'F'
470
|| uni_ch == 'S' || uni_ch == 'T'
471
|| uni_ch == 'U' || uni_ch == 'A'
472
|| uni_ch == 'B' || uni_ch == 'W'
473
|| uni_ch == 'V' || uni_ch == 'X'
474
|| uni_ch == 'Y' || uni_ch == 'Q')) {
466
475
if (start != -1) { // process last chars
467
addCommand(data.mid(start, i - start));
476
addCommand(data.mid(start, i - start), false);