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

Method readBorder

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

Source from the content-addressed store, hash-verified

1002}
1003
1004bool Styles::readBorder(QXmlStreamReader &reader, Format &border)
1005{
1006 Q_ASSERT(reader.name() == QLatin1String("border"));
1007
1008 const auto& attributes = reader.attributes();
1009 const auto isUp = attributes.hasAttribute(QLatin1String("diagonalUp"));
1010 const auto isDown = attributes.hasAttribute(QLatin1String("diagonalDown"));
1011 if (isUp && isDown)
1012 border.setDiagonalBorderType(Format::DiagnoalBorderBoth);
1013 else if (isUp)
1014 border.setDiagonalBorderType(Format::DiagonalBorderUp);
1015 else if (isDown)
1016 border.setDiagonalBorderType(Format::DiagonalBorderDown);
1017
1018 while (!reader.atEnd() && !(reader.tokenType() == QXmlStreamReader::EndElement && reader.name() == QLatin1String("border"))) {
1019 reader.readNextStartElement();
1020 if (reader.tokenType() == QXmlStreamReader::StartElement) {
1021 if (reader.name() == QLatin1String("left") || reader.name() == QLatin1String("right")
1022 || reader.name() == QLatin1String("top") || reader.name() == QLatin1String("bottom")
1023 || reader.name() == QLatin1String("diagonal") ) {
1024 Format::BorderStyle style(Format::BorderNone);
1025 XlsxColor color;
1026 readSubBorder(reader, reader.name().toString(), style, color);
1027
1028 if (reader.name() == QLatin1String("left")) {
1029 border.setLeftBorderStyle(style);
1030 if (!color.isInvalid())
1031 border.setProperty(FormatPrivate::P_Border_LeftColor, color);
1032 } else if (reader.name() == QLatin1String("right")) {
1033 border.setRightBorderStyle(style);
1034 if (!color.isInvalid())
1035 border.setProperty(FormatPrivate::P_Border_RightColor, color);
1036 } else if (reader.name() == QLatin1String("top")) {
1037 border.setTopBorderStyle(style);
1038 if (!color.isInvalid())
1039 border.setProperty(FormatPrivate::P_Border_TopColor, color);
1040 } else if (reader.name() == QLatin1String("bottom")) {
1041 border.setBottomBorderStyle(style);
1042 if (!color.isInvalid())
1043 border.setProperty(FormatPrivate::P_Border_BottomColor, color);
1044 } else if (reader.name() == QLatin1String("diagonal")) {
1045 border.setDiagonalBorderStyle(style);
1046 if (!color.isInvalid())
1047 border.setProperty(FormatPrivate::P_Border_DiagonalColor, color);
1048 }
1049 }
1050 }
1051
1052 if (reader.tokenType() == QXmlStreamReader::EndElement && reader.name() == QLatin1String("border"))
1053 break;
1054 }
1055
1056 return true;
1057}
1058
1059bool Styles::readCellStyleXfs(QXmlStreamReader &reader)
1060{

Callers

nothing calls this directly

Calls 11

setDiagonalBorderTypeMethod · 0.80
atEndMethod · 0.80
setLeftBorderStyleMethod · 0.80
isInvalidMethod · 0.80
setRightBorderStyleMethod · 0.80
setTopBorderStyleMethod · 0.80
setBottomBorderStyleMethod · 0.80
nameMethod · 0.45
toStringMethod · 0.45
setPropertyMethod · 0.45

Tested by

no test coverage detected