| 971 | } |
| 972 | |
| 973 | bool Styles::readBorders(QXmlStreamReader &reader) |
| 974 | { |
| 975 | Q_ASSERT(reader.name() == QLatin1String("borders")); |
| 976 | |
| 977 | const auto& attributes = reader.attributes(); |
| 978 | const auto hasCount = attributes.hasAttribute(QLatin1String("count")); |
| 979 | const auto count = hasCount ? attributes.value(QLatin1String("count")).toInt() : -1; |
| 980 | while (!reader.atEnd() && !(reader.tokenType() == QXmlStreamReader::EndElement |
| 981 | && reader.name() == QLatin1String("borders"))) { |
| 982 | reader.readNextStartElement(); |
| 983 | if (reader.tokenType() == QXmlStreamReader::StartElement) { |
| 984 | if (reader.name() == QLatin1String("border")) { |
| 985 | Format border; |
| 986 | readBorder(reader, border); |
| 987 | m_bordersList.append(border); |
| 988 | m_bordersHash.insert(border.borderKey(), border); |
| 989 | if (border.isValid()) |
| 990 | border.setBorderIndex(m_bordersList.size()-1); |
| 991 | } |
| 992 | } |
| 993 | } |
| 994 | |
| 995 | if (reader.hasError()) |
| 996 | qWarning()<<reader.errorString(); |
| 997 | |
| 998 | if (hasCount && (count != m_bordersList.size())) |
| 999 | qWarning("error read borders"); |
| 1000 | |
| 1001 | return true; |
| 1002 | } |
| 1003 | |
| 1004 | bool Styles::readBorder(QXmlStreamReader &reader, Format &border) |
| 1005 | { |