|
@ -2297,39 +2297,38 @@ bool Worksheet::loadFromXmlFile(QIODevice *device) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
validateDimension(); |
|
|
d->validateDimension(); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Worksheet::validateDimension() |
|
|
/*
|
|
|
|
|
|
* Documents imported from Google Docs does not contain dimension data. |
|
|
|
|
|
*/ |
|
|
|
|
|
void WorksheetPrivate::validateDimension() |
|
|
{ |
|
|
{ |
|
|
Q_D(Worksheet); |
|
|
if (dimension.isValid() || cellTable.isEmpty()) |
|
|
|
|
|
|
|
|
if (d->dimension.isValid() || d->cellTable.isEmpty()) |
|
|
|
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
int firstRow = d->cellTable.firstKey(); |
|
|
int firstRow = cellTable.constBegin().key(); |
|
|
int lastRow = d->cellTable.lastKey(); |
|
|
int lastRow = (cellTable.constEnd()-1).key(); |
|
|
int firstCell = -1; |
|
|
int firstColumn = -1; |
|
|
int lastCell = -1; |
|
|
int lastColumn = -1; |
|
|
|
|
|
|
|
|
for (QMap<int, QMap<int, QSharedPointer<Cell> > >::const_iterator it = d->cellTable.begin(), |
|
|
for (QMap<int, QMap<int, QSharedPointer<Cell> > >::const_iterator it = cellTable.begin(); it != cellTable.end(); ++it) |
|
|
lim = d->cellTable.end(); it != lim; ++it) |
|
|
|
|
|
{ |
|
|
{ |
|
|
if (it.value().isEmpty()) |
|
|
Q_ASSERT(!it.value().isEmpty()); |
|
|
continue; |
|
|
|
|
|
|
|
|
|
|
|
if (firstCell == -1 || it.value().firstKey() < firstCell) |
|
|
if (firstColumn == -1 || it.value().constBegin().key() < firstColumn) |
|
|
firstCell = it.value().firstKey(); |
|
|
firstColumn = it.value().constBegin().key(); |
|
|
|
|
|
|
|
|
if (lastCell == -1 || it.value().lastKey() > lastCell) |
|
|
if (lastColumn == -1 || (it.value().constEnd()-1).key() > lastColumn) |
|
|
lastCell = it.value().lastKey(); |
|
|
lastColumn = (it.value().constEnd()-1).key(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
CellRange cr(firstRow, firstCell, lastRow, lastCell); |
|
|
CellRange cr(firstRow, firstColumn, lastRow, lastColumn); |
|
|
|
|
|
|
|
|
if (cr.isValid()) |
|
|
if (cr.isValid()) |
|
|
d->dimension = cr; |
|
|
dimension = cr; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/*!
|
|
|
/*!
|
|
|