| 1002 | } |
| 1003 | |
| 1004 | bool 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 | |
| 1059 | bool Styles::readCellStyleXfs(QXmlStreamReader &reader) |
| 1060 | { |
nothing calls this directly
no test coverage detected