MCPcopy Create free account
hub / github.com/KDE/labplot / writeCellXfs

Method writeCellXfs

src/3rdparty/QXlsx/source/xlsxstyles.cpp:620–704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

618}
619
620void Styles::writeCellXfs(QXmlStreamWriter &writer) const
621{
622 writer.writeStartElement(QStringLiteral("cellXfs"));
623 writer.writeAttribute(QStringLiteral("count"), QString::number(m_xf_formatsList.size()));
624 for (const Format &format : m_xf_formatsList) {
625 int xf_id = 0;
626 writer.writeStartElement(QStringLiteral("xf"));
627 writer.writeAttribute(QStringLiteral("numFmtId"), QString::number(format.numberFormatIndex()));
628 writer.writeAttribute(QStringLiteral("fontId"), QString::number(format.fontIndex()));
629 writer.writeAttribute(QStringLiteral("fillId"), QString::number(format.fillIndex()));
630 writer.writeAttribute(QStringLiteral("borderId"), QString::number(format.borderIndex()));
631 writer.writeAttribute(QStringLiteral("xfId"), QString::number(xf_id));
632 if (format.hasNumFmtData())
633 writer.writeAttribute(QStringLiteral("applyNumberFormat"), QStringLiteral("1"));
634 if (format.hasFontData())
635 writer.writeAttribute(QStringLiteral("applyFont"), QStringLiteral("1"));
636 if (format.hasFillData())
637 writer.writeAttribute(QStringLiteral("applyFill"), QStringLiteral("1"));
638 if (format.hasBorderData())
639 writer.writeAttribute(QStringLiteral("applyBorder"), QStringLiteral("1"));
640 if (format.hasAlignmentData())
641 writer.writeAttribute(QStringLiteral("applyAlignment"), QStringLiteral("1"));
642
643 if (format.hasAlignmentData()) {
644 writer.writeEmptyElement(QStringLiteral("alignment"));
645 if (format.hasProperty(FormatPrivate::P_Alignment_AlignH)) {
646 switch (format.horizontalAlignment()) {
647 case Format::AlignLeft:
648 writer.writeAttribute(QStringLiteral("horizontal"), QStringLiteral("left"));
649 break;
650 case Format::AlignHCenter:
651 writer.writeAttribute(QStringLiteral("horizontal"), QStringLiteral("center"));
652 break;
653 case Format::AlignRight:
654 writer.writeAttribute(QStringLiteral("horizontal"), QStringLiteral("right"));
655 break;
656 case Format::AlignHFill:
657 writer.writeAttribute(QStringLiteral("horizontal"), QStringLiteral("fill"));
658 break;
659 case Format::AlignHJustify:
660 writer.writeAttribute(QStringLiteral("horizontal"), QStringLiteral("justify"));
661 break;
662 case Format::AlignHMerge:
663 writer.writeAttribute(QStringLiteral("horizontal"), QStringLiteral("centerContinuous"));
664 break;
665 case Format::AlignHDistributed:
666 writer.writeAttribute(QStringLiteral("horizontal"), QStringLiteral("distributed"));
667 break;
668 default:
669 break;
670 }
671 }
672
673 if (format.hasProperty(FormatPrivate::P_Alignment_AlignV)) {
674 switch (format.verticalAlignment()) {
675 case Format::AlignTop:
676 writer.writeAttribute(QStringLiteral("vertical"), QStringLiteral("top"));
677 break;

Callers

nothing calls this directly

Calls 15

numberFormatIndexMethod · 0.80
fontIndexMethod · 0.80
fillIndexMethod · 0.80
borderIndexMethod · 0.80
hasNumFmtDataMethod · 0.80
hasFontDataMethod · 0.80
hasFillDataMethod · 0.80
hasBorderDataMethod · 0.80
hasAlignmentDataMethod · 0.80
hasPropertyMethod · 0.80
horizontalAlignmentMethod · 0.80
verticalAlignmentMethod · 0.80

Tested by

no test coverage detected