| 2548 | } |
| 2549 | |
| 2550 | void WorksheetPrivate::loadXmlColumnsInfo(QXmlStreamReader &reader) |
| 2551 | { |
| 2552 | Q_ASSERT(reader.name() == QLatin1String("cols")); |
| 2553 | |
| 2554 | while (!reader.atEnd() && |
| 2555 | !(reader.name() == QLatin1String("cols") && |
| 2556 | reader.tokenType() == QXmlStreamReader::EndElement)) |
| 2557 | { |
| 2558 | reader.readNextStartElement(); |
| 2559 | if (reader.tokenType() == QXmlStreamReader::StartElement) |
| 2560 | { |
| 2561 | if (reader.name() == QLatin1String("col")) |
| 2562 | { |
| 2563 | QSharedPointer<XlsxColumnInfo> info(new XlsxColumnInfo(0, 1, false)); |
| 2564 | |
| 2565 | QXmlStreamAttributes colAttrs = reader.attributes(); |
| 2566 | int min = colAttrs.value(QLatin1String("min")).toInt(); |
| 2567 | int max = colAttrs.value(QLatin1String("max")).toInt(); |
| 2568 | info->firstColumn = min; |
| 2569 | info->lastColumn = max; |
| 2570 | |
| 2571 | //Flag indicating that the column width for the affected column(s) is different from the |
| 2572 | // default or has been manually set |
| 2573 | if(colAttrs.hasAttribute(QLatin1String("customWidth"))) |
| 2574 | { |
| 2575 | info->customWidth = colAttrs.value(QLatin1String("customWidth")) == QLatin1String("1"); |
| 2576 | } |
| 2577 | |
| 2578 | //Note, node may have "width" without "customWidth" |
| 2579 | // [dev54] |
| 2580 | if (colAttrs.hasAttribute(QLatin1String("width"))) |
| 2581 | { |
| 2582 | double width = colAttrs.value(QLatin1String("width")).toDouble(); |
| 2583 | info->width = width; |
| 2584 | info->isSetWidth = true; // [dev54] |
| 2585 | } |
| 2586 | |
| 2587 | info->hidden = colAttrs.value(QLatin1String("hidden")) == QLatin1String("1"); |
| 2588 | info->collapsed = colAttrs.value(QLatin1String("collapsed")) == QLatin1String("1"); |
| 2589 | |
| 2590 | if (colAttrs.hasAttribute(QLatin1String("style"))) |
| 2591 | { |
| 2592 | int idx = colAttrs.value(QLatin1String("style")).toInt(); |
| 2593 | info->format = workbook->styles()->xfFormat(idx); |
| 2594 | } |
| 2595 | |
| 2596 | if (colAttrs.hasAttribute(QLatin1String("outlineLevel"))) |
| 2597 | { |
| 2598 | info->outlineLevel = colAttrs.value(QLatin1String("outlineLevel")).toInt(); |
| 2599 | } |
| 2600 | |
| 2601 | // qDebug() << "[debug] " << __FUNCTION__ << min << max << info->width << hasWidth; |
| 2602 | |
| 2603 | colsInfo.insert(min, info); |
| 2604 | for (int col = min ; col <= max ; ++col) |
| 2605 | { |
| 2606 | colsInfoHelper[col] = info; |
| 2607 | } |