Load from XML
| 540 | |
| 541 | //! Load from XML |
| 542 | bool ReferenceRange::load(XmlStreamReader* reader, bool preview) { |
| 543 | Q_D(ReferenceRange); |
| 544 | |
| 545 | if (!readBasicAttributes(reader)) |
| 546 | return false; |
| 547 | |
| 548 | QXmlStreamAttributes attribs; |
| 549 | QString str; |
| 550 | |
| 551 | while (!reader->atEnd()) { |
| 552 | reader->readNext(); |
| 553 | if (reader->isEndElement() && reader->name() == QStringLiteral("referenceRange")) |
| 554 | break; |
| 555 | |
| 556 | if (!reader->isStartElement()) |
| 557 | continue; |
| 558 | |
| 559 | if (!preview && reader->name() == QStringLiteral("comment")) { |
| 560 | if (!readCommentElement(reader)) |
| 561 | return false; |
| 562 | } else if (!preview && reader->name() == QStringLiteral("geometry")) { |
| 563 | attribs = reader->attributes(); |
| 564 | READ_INT_VALUE("orientation", orientation, Orientation); |
| 565 | d->updatePositionLimit(); // set the position limit after the orientation was set |
| 566 | WorksheetElement::load(reader, preview); |
| 567 | |
| 568 | str = attribs.value(QStringLiteral("logicalPosStartX")).toString(); |
| 569 | if (str.isEmpty()) |
| 570 | reader->raiseMissingAttributeWarning(QStringLiteral("logicalPosStartX")); |
| 571 | else |
| 572 | d->positionLogicalStart.setX(str.toDouble()); |
| 573 | |
| 574 | str = attribs.value(QStringLiteral("logicalPosStartY")).toString(); |
| 575 | if (str.isEmpty()) |
| 576 | reader->raiseMissingAttributeWarning(QStringLiteral("logicalPosStartY")); |
| 577 | else |
| 578 | d->positionLogicalStart.setY(str.toDouble()); |
| 579 | |
| 580 | str = attribs.value(QStringLiteral("logicalPosEndX")).toString(); |
| 581 | if (str.isEmpty()) |
| 582 | reader->raiseMissingAttributeWarning(QStringLiteral("logicalPosEndX")); |
| 583 | else |
| 584 | d->positionLogicalEnd.setX(str.toDouble()); |
| 585 | |
| 586 | str = attribs.value(QStringLiteral("logicalPosEndY")).toString(); |
| 587 | if (str.isEmpty()) |
| 588 | reader->raiseMissingAttributeWarning(QStringLiteral("logicalPosEndY")); |
| 589 | else |
| 590 | d->positionLogicalEnd.setY(str.toDouble()); |
| 591 | } else if (!preview && reader->name() == QStringLiteral("background")) |
| 592 | d->background->load(reader, preview); |
| 593 | else if (!preview && reader->name() == QStringLiteral("line")) |
| 594 | d->line->load(reader, preview); |
| 595 | else { // unknown element |
| 596 | reader->raiseUnknownElementWarning(); |
| 597 | if (!reader->skipToEndElement()) |
| 598 | return false; |
| 599 | } |
nothing calls this directly
no test coverage detected