Browse Source

Add const to the saveAs* members, step 1

master
Debao Zhang 11 years ago
parent
commit
1ca891cf8a
  1. 2
      src/xlsx/xlsxcontenttypes.cpp
  2. 2
      src/xlsx/xlsxcontenttypes_p.h
  3. 4
      src/xlsx/xlsxdocpropsapp.cpp
  4. 4
      src/xlsx/xlsxdocpropsapp_p.h
  5. 4
      src/xlsx/xlsxdocpropscore.cpp
  6. 4
      src/xlsx/xlsxdocpropscore_p.h
  7. 14
      src/xlsx/xlsxdrawing.cpp
  8. 14
      src/xlsx/xlsxdrawing_p.h
  9. 4
      src/xlsx/xlsxrelationships.cpp
  10. 4
      src/xlsx/xlsxrelationships_p.h
  11. 2
      src/xlsx/xlsxtheme.cpp
  12. 2
      src/xlsx/xlsxtheme_p.h
  13. 6
      src/xlsx/xlsxworkbook.cpp
  14. 4
      src/xlsx/xlsxworkbook.h
  15. 40
      src/xlsx/xlsxworksheet.cpp
  16. 4
      src/xlsx/xlsxworksheet.h
  17. 32
      src/xlsx/xlsxworksheet_p.h

2
src/xlsx/xlsxcontenttypes.cpp

@ -111,7 +111,7 @@ void ContentTypes::addVbaProject()
addOverride(QStringLiteral("bin"), QStringLiteral("application/vnd.ms-office.vbaProject")); addOverride(QStringLiteral("bin"), QStringLiteral("application/vnd.ms-office.vbaProject"));
} }
void ContentTypes::saveToXmlFile(QIODevice *device) void ContentTypes::saveToXmlFile(QIODevice *device) const
{ {
QXmlStreamWriter writer(device); QXmlStreamWriter writer(device);

2
src/xlsx/xlsxcontenttypes_p.h

@ -65,7 +65,7 @@ public:
void addCalcChain(); void addCalcChain();
void addVbaProject(); void addVbaProject();
void saveToXmlFile(QIODevice *device); void saveToXmlFile(QIODevice *device) const;
private: private:
QMap<QString, QString> m_defaults; QMap<QString, QString> m_defaults;

4
src/xlsx/xlsxdocpropsapp.cpp

@ -79,7 +79,7 @@ QStringList DocPropsApp::propertyNames() const
return m_properties.keys(); return m_properties.keys();
} }
void DocPropsApp::saveToXmlFile(QIODevice *device) void DocPropsApp::saveToXmlFile(QIODevice *device) const
{ {
QXmlStreamWriter writer(device); QXmlStreamWriter writer(device);
QString vt = QStringLiteral("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"); QString vt = QStringLiteral("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes");
@ -130,7 +130,7 @@ void DocPropsApp::saveToXmlFile(QIODevice *device)
writer.writeEndDocument(); writer.writeEndDocument();
} }
QByteArray DocPropsApp::saveToXmlData() QByteArray DocPropsApp::saveToXmlData() const
{ {
QByteArray data; QByteArray data;
QBuffer buffer(&data); QBuffer buffer(&data);

4
src/xlsx/xlsxdocpropsapp_p.h

@ -58,8 +58,8 @@ public:
QString property(const QString &name) const; QString property(const QString &name) const;
QStringList propertyNames() const; QStringList propertyNames() const;
QByteArray saveToXmlData(); QByteArray saveToXmlData() const;
void saveToXmlFile(QIODevice *device); void saveToXmlFile(QIODevice *device) const;
static DocPropsApp loadFromXmlFile(QIODevice *device); static DocPropsApp loadFromXmlFile(QIODevice *device);
static DocPropsApp loadFromXmlData(const QByteArray &data); static DocPropsApp loadFromXmlData(const QByteArray &data);

4
src/xlsx/xlsxdocpropscore.cpp

@ -72,7 +72,7 @@ QStringList DocPropsCore::propertyNames() const
return m_properties.keys(); return m_properties.keys();
} }
void DocPropsCore::saveToXmlFile(QIODevice *device) void DocPropsCore::saveToXmlFile(QIODevice *device) const
{ {
QXmlStreamWriter writer(device); QXmlStreamWriter writer(device);
const QString cp = QStringLiteral("http://schemas.openxmlformats.org/package/2006/metadata/core-properties"); const QString cp = QStringLiteral("http://schemas.openxmlformats.org/package/2006/metadata/core-properties");
@ -124,7 +124,7 @@ void DocPropsCore::saveToXmlFile(QIODevice *device)
writer.writeEndDocument(); writer.writeEndDocument();
} }
QByteArray DocPropsCore::saveToXmlData() QByteArray DocPropsCore::saveToXmlData() const
{ {
QByteArray data; QByteArray data;
QBuffer buffer(&data); QBuffer buffer(&data);

4
src/xlsx/xlsxdocpropscore_p.h

@ -53,8 +53,8 @@ public:
QString property(const QString &name) const; QString property(const QString &name) const;
QStringList propertyNames() const; QStringList propertyNames() const;
void saveToXmlFile(QIODevice *device); void saveToXmlFile(QIODevice *device) const;
QByteArray saveToXmlData(); QByteArray saveToXmlData() const;
static DocPropsCore loadFromXmlFile(QIODevice *device); static DocPropsCore loadFromXmlFile(QIODevice *device);
static DocPropsCore loadFromXmlData(const QByteArray &data); static DocPropsCore loadFromXmlData(const QByteArray &data);

14
src/xlsx/xlsxdrawing.cpp

@ -36,7 +36,7 @@ Drawing::Drawing()
orientation = 0; orientation = 0;
} }
void Drawing::saveToXmlFile(QIODevice *device) void Drawing::saveToXmlFile(QIODevice *device) const
{ {
QXmlStreamWriter writer(device); QXmlStreamWriter writer(device);
@ -60,7 +60,7 @@ void Drawing::saveToXmlFile(QIODevice *device)
writer.writeEndDocument(); writer.writeEndDocument();
} }
void Drawing::writeTwoCellAnchor(QXmlStreamWriter &writer, int index, XlsxDrawingDimensionData *data) void Drawing::writeTwoCellAnchor(QXmlStreamWriter &writer, int index, XlsxDrawingDimensionData *data) const
{ {
writer.writeStartElement(QStringLiteral("xdr:twoCellAnchor")); writer.writeStartElement(QStringLiteral("xdr:twoCellAnchor"));
if (data->drawing_type == 2) if (data->drawing_type == 2)
@ -96,7 +96,7 @@ void Drawing::writeTwoCellAnchor(QXmlStreamWriter &writer, int index, XlsxDrawin
writer.writeEndElement(); //xdr:twoCellAnchor writer.writeEndElement(); //xdr:twoCellAnchor
} }
void Drawing::writeAbsoluteAnchor(QXmlStreamWriter &writer, int index) void Drawing::writeAbsoluteAnchor(QXmlStreamWriter &writer, int index) const
{ {
writer.writeStartElement(QStringLiteral("xdr:absoluteAnchor")); writer.writeStartElement(QStringLiteral("xdr:absoluteAnchor"));
if (orientation == 0) { if (orientation == 0) {
@ -113,21 +113,21 @@ void Drawing::writeAbsoluteAnchor(QXmlStreamWriter &writer, int index)
writer.writeEndElement(); //xdr:absoluteAnchor writer.writeEndElement(); //xdr:absoluteAnchor
} }
void Drawing::writePos(QXmlStreamWriter &writer, int x, int y) void Drawing::writePos(QXmlStreamWriter &writer, int x, int y) const
{ {
writer.writeEmptyElement(QStringLiteral("xdr:pos")); writer.writeEmptyElement(QStringLiteral("xdr:pos"));
writer.writeAttribute(QStringLiteral("x"), QString::number(x)); writer.writeAttribute(QStringLiteral("x"), QString::number(x));
writer.writeAttribute(QStringLiteral("y"), QString::number(y)); writer.writeAttribute(QStringLiteral("y"), QString::number(y));
} }
void Drawing::writeExt(QXmlStreamWriter &writer, int cx, int cy) void Drawing::writeExt(QXmlStreamWriter &writer, int cx, int cy) const
{ {
writer.writeStartElement(QStringLiteral("xdr:ext")); writer.writeStartElement(QStringLiteral("xdr:ext"));
writer.writeAttribute(QStringLiteral("cx"), QString::number(cx)); writer.writeAttribute(QStringLiteral("cx"), QString::number(cx));
writer.writeAttribute(QStringLiteral("cy"), QString::number(cy)); writer.writeAttribute(QStringLiteral("cy"), QString::number(cy));
} }
void Drawing::writeGraphicFrame(QXmlStreamWriter &writer, int index, const QString &name) void Drawing::writeGraphicFrame(QXmlStreamWriter &writer, int index, const QString &name) const
{ {
writer.writeStartElement(QStringLiteral("xdr:graphicFrame")); writer.writeStartElement(QStringLiteral("xdr:graphicFrame"));
writer.writeAttribute(QStringLiteral("macro"), QString()); writer.writeAttribute(QStringLiteral("macro"), QString());
@ -149,7 +149,7 @@ void Drawing::writeGraphicFrame(QXmlStreamWriter &writer, int index, const QStri
writer.writeEndElement(); //xdr:graphicFrame writer.writeEndElement(); //xdr:graphicFrame
} }
void Drawing::writePicture(QXmlStreamWriter &writer, int index, double col_abs, double row_abs, int width, int height, const QString &description) void Drawing::writePicture(QXmlStreamWriter &writer, int index, double col_abs, double row_abs, int width, int height, const QString &description) const
{ {
writer.writeStartElement(QStringLiteral("xdr:pic")); writer.writeStartElement(QStringLiteral("xdr:pic"));

14
src/xlsx/xlsxdrawing_p.h

@ -68,19 +68,19 @@ class Drawing
{ {
public: public:
Drawing(); Drawing();
void saveToXmlFile(QIODevice *device); void saveToXmlFile(QIODevice *device) const;
bool embedded; bool embedded;
int orientation; int orientation;
QList <XlsxDrawingDimensionData *> dimensionList; QList <XlsxDrawingDimensionData *> dimensionList;
private: private:
void writeTwoCellAnchor(QXmlStreamWriter &writer, int index, XlsxDrawingDimensionData *data); void writeTwoCellAnchor(QXmlStreamWriter &writer, int index, XlsxDrawingDimensionData *data) const;
void writeAbsoluteAnchor(QXmlStreamWriter &writer, int index); void writeAbsoluteAnchor(QXmlStreamWriter &writer, int index) const;
void writePos(QXmlStreamWriter &writer, int x, int y); void writePos(QXmlStreamWriter &writer, int x, int y) const;
void writeExt(QXmlStreamWriter &writer, int cx, int cy); void writeExt(QXmlStreamWriter &writer, int cx, int cy) const;
void writeGraphicFrame(QXmlStreamWriter &writer, int index, const QString &name=QString()); void writeGraphicFrame(QXmlStreamWriter &writer, int index, const QString &name=QString()) const;
void writePicture(QXmlStreamWriter &writer, int index, double col_abs, double row_abs, int width, int height, const QString &description); void writePicture(QXmlStreamWriter &writer, int index, double col_abs, double row_abs, int width, int height, const QString &description) const;
}; };
} // namespace QXlsx } // namespace QXlsx

4
src/xlsx/xlsxrelationships.cpp

@ -100,7 +100,7 @@ void Relationships::addRelationship(const QString &type, const QString &target,
m_relationships.append(relation); m_relationships.append(relation);
} }
void Relationships::saveToXmlFile(QIODevice *device) void Relationships::saveToXmlFile(QIODevice *device) const
{ {
QXmlStreamWriter writer(device); QXmlStreamWriter writer(device);
@ -120,7 +120,7 @@ void Relationships::saveToXmlFile(QIODevice *device)
writer.writeEndDocument(); writer.writeEndDocument();
} }
QByteArray Relationships::saveToXmlData() QByteArray Relationships::saveToXmlData() const
{ {
QByteArray data; QByteArray data;
QBuffer buffer(&data); QBuffer buffer(&data);

4
src/xlsx/xlsxrelationships_p.h

@ -66,8 +66,8 @@ public:
void addMsPackageRelationship(const QString &relativeType, const QString &target); void addMsPackageRelationship(const QString &relativeType, const QString &target);
void addWorksheetRelationship(const QString &relativeType, const QString &target, const QString &targetMode=QString()); void addWorksheetRelationship(const QString &relativeType, const QString &target, const QString &targetMode=QString());
void saveToXmlFile(QIODevice *device); void saveToXmlFile(QIODevice *device) const;
QByteArray saveToXmlData(); QByteArray saveToXmlData() const;
bool loadFromXmlFile(QIODevice *device); bool loadFromXmlFile(QIODevice *device);
bool loadFromXmlData(const QByteArray &data); bool loadFromXmlData(const QByteArray &data);
XlsxRelationship getRelationshipById(const QString &id) const; XlsxRelationship getRelationshipById(const QString &id) const;

2
src/xlsx/xlsxtheme.cpp

@ -205,7 +205,7 @@ Theme::Theme()
{ {
} }
void Theme::saveToXmlFile(QIODevice *device) void Theme::saveToXmlFile(QIODevice *device) const
{ {
if (xmlData.isEmpty()) if (xmlData.isEmpty())
device->write(defaultXmlData); device->write(defaultXmlData);

2
src/xlsx/xlsxtheme_p.h

@ -46,7 +46,7 @@ class Theme
public: public:
Theme(); Theme();
void saveToXmlFile(QIODevice *device); void saveToXmlFile(QIODevice *device) const;
QByteArray saveToXmlData() const; QByteArray saveToXmlData() const;
void loadFromXmlData(const QByteArray &data); void loadFromXmlData(const QByteArray &data);

6
src/xlsx/xlsxworkbook.cpp

@ -395,9 +395,9 @@ void Workbook::prepareDrawings()
} }
} }
void Workbook::saveToXmlFile(QIODevice *device) void Workbook::saveToXmlFile(QIODevice *device) const
{ {
Q_D(Workbook); Q_D(const Workbook);
QXmlStreamWriter writer(device); QXmlStreamWriter writer(device);
writer.writeStartDocument(QStringLiteral("1.0"), true); writer.writeStartDocument(QStringLiteral("1.0"), true);
@ -474,7 +474,7 @@ void Workbook::saveToXmlFile(QIODevice *device)
writer.writeEndDocument(); writer.writeEndDocument();
} }
QByteArray Workbook::saveToXmlData() QByteArray Workbook::saveToXmlData() const
{ {
QByteArray data; QByteArray data;
QBuffer buffer(&data); QBuffer buffer(&data);

4
src/xlsx/xlsxworkbook.h

@ -82,8 +82,8 @@ private:
Workbook(); Workbook();
void saveToXmlFile(QIODevice *device); void saveToXmlFile(QIODevice *device) const;
QByteArray saveToXmlData(); QByteArray saveToXmlData() const;
bool loadFromXmlFile(QIODevice *device); bool loadFromXmlFile(QIODevice *device);
bool loadFromXmlData(const QByteArray &data); bool loadFromXmlData(const QByteArray &data);

40
src/xlsx/xlsxworksheet.cpp

@ -83,7 +83,7 @@ WorksheetPrivate::~WorksheetPrivate()
makes comparing files easier. The span is the same for each makes comparing files easier. The span is the same for each
block of 16 rows. block of 16 rows.
*/ */
void WorksheetPrivate::calculateSpans() void WorksheetPrivate::calculateSpans() const
{ {
row_spans.clear(); row_spans.clear();
int span_min = XLSX_COLUMN_MAX+1; int span_min = XLSX_COLUMN_MAX+1;
@ -132,7 +132,7 @@ void WorksheetPrivate::calculateSpans()
} }
QString WorksheetPrivate::generateDimensionString() QString WorksheetPrivate::generateDimensionString() const
{ {
if (!dimension.isValid()) if (!dimension.isValid())
return QStringLiteral("A1"); return QStringLiteral("A1");
@ -990,7 +990,7 @@ int Worksheet::writeHyperlink(int row, int column, const QUrl &url, const Format
d->cellTable[row][column] = QSharedPointer<Cell>(new Cell(displayString, Cell::String, fmt, this)); d->cellTable[row][column] = QSharedPointer<Cell>(new Cell(displayString, Cell::String, fmt, this));
//Store the hyperlink data in a separate table //Store the hyperlink data in a separate table
d->urlTable[row][column] = new XlsxUrlData(XlsxUrlData::External, urlString, locationString, tip); d->urlTable[row][column] = new XlsxHyperlinkData(XlsxHyperlinkData::External, urlString, locationString, tip);
return error; return error;
} }
@ -1119,9 +1119,9 @@ int Worksheet::unmergeCells(const QString &range)
return unmergeCells(CellRange(cell1.x(), cell1.y(), cell2.x(), cell2.y())); return unmergeCells(CellRange(cell1.x(), cell1.y(), cell2.x(), cell2.y()));
} }
void Worksheet::saveToXmlFile(QIODevice *device) void Worksheet::saveToXmlFile(QIODevice *device) const
{ {
Q_D(Worksheet); Q_D(const Worksheet);
d->relationships.clear(); d->relationships.clear();
QXmlStreamWriter writer(device); QXmlStreamWriter writer(device);
@ -1222,7 +1222,7 @@ void Worksheet::saveToXmlFile(QIODevice *device)
writer.writeEndDocument(); writer.writeEndDocument();
} }
void WorksheetPrivate::writeSheetData(QXmlStreamWriter &writer) void WorksheetPrivate::writeSheetData(QXmlStreamWriter &writer) const
{ {
calculateSpans(); calculateSpans();
for (int row_num = dimension.firstRow(); row_num <= dimension.lastRow(); row_num++) { for (int row_num = dimension.firstRow(); row_num <= dimension.lastRow(); row_num++) {
@ -1275,7 +1275,7 @@ void WorksheetPrivate::writeSheetData(QXmlStreamWriter &writer)
} }
} }
void WorksheetPrivate::writeCellData(QXmlStreamWriter &writer, int row, int col, QSharedPointer<Cell> cell) void WorksheetPrivate::writeCellData(QXmlStreamWriter &writer, int row, int col, QSharedPointer<Cell> cell) const
{ {
//This is the innermost loop so efficiency is important. //This is the innermost loop so efficiency is important.
QString cell_pos = xl_rowcol_to_cell_fast(row, col); QString cell_pos = xl_rowcol_to_cell_fast(row, col);
@ -1349,7 +1349,7 @@ void WorksheetPrivate::writeCellData(QXmlStreamWriter &writer, int row, int col,
writer.writeEndElement(); //c writer.writeEndElement(); //c
} }
void WorksheetPrivate::writeMergeCells(QXmlStreamWriter &writer) void WorksheetPrivate::writeMergeCells(QXmlStreamWriter &writer) const
{ {
if (merges.isEmpty()) if (merges.isEmpty())
return; return;
@ -1367,7 +1367,7 @@ void WorksheetPrivate::writeMergeCells(QXmlStreamWriter &writer)
writer.writeEndElement(); //mergeCells writer.writeEndElement(); //mergeCells
} }
void WorksheetPrivate::writeDataValidations(QXmlStreamWriter &writer) void WorksheetPrivate::writeDataValidations(QXmlStreamWriter &writer) const
{ {
if (dataValidationsList.isEmpty()) if (dataValidationsList.isEmpty())
return; return;
@ -1381,25 +1381,25 @@ void WorksheetPrivate::writeDataValidations(QXmlStreamWriter &writer)
writer.writeEndElement(); //dataValidations writer.writeEndElement(); //dataValidations
} }
void WorksheetPrivate::writeHyperlinks(QXmlStreamWriter &writer) void WorksheetPrivate::writeHyperlinks(QXmlStreamWriter &writer) const
{ {
if (urlTable.isEmpty()) if (urlTable.isEmpty())
return; return;
writer.writeStartElement(QStringLiteral("hyperlinks")); writer.writeStartElement(QStringLiteral("hyperlinks"));
QMapIterator<int, QMap<int, XlsxUrlData *> > it(urlTable); QMapIterator<int, QMap<int, XlsxHyperlinkData *> > it(urlTable);
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();
int row = it.key(); int row = it.key();
QMapIterator <int, XlsxUrlData *> it2(it.value()); QMapIterator <int, XlsxHyperlinkData *> it2(it.value());
while (it2.hasNext()) { while (it2.hasNext()) {
it2.next(); it2.next();
int col = it2.key(); int col = it2.key();
XlsxUrlData *data = it2.value(); XlsxHyperlinkData *data = it2.value();
QString ref = xl_rowcol_to_cell(row, col); QString ref = xl_rowcol_to_cell(row, col);
writer.writeEmptyElement(QStringLiteral("hyperlink")); writer.writeEmptyElement(QStringLiteral("hyperlink"));
writer.writeAttribute(QStringLiteral("ref"), ref); writer.writeAttribute(QStringLiteral("ref"), ref);
if (data->linkType == XlsxUrlData::External) { if (data->linkType == XlsxHyperlinkData::External) {
//Update relationships //Update relationships
relationships.addWorksheetRelationship(QStringLiteral("/hyperlink"), data->url, QStringLiteral("External")); relationships.addWorksheetRelationship(QStringLiteral("/hyperlink"), data->url, QStringLiteral("External"));
@ -1423,7 +1423,7 @@ void WorksheetPrivate::writeHyperlinks(QXmlStreamWriter &writer)
writer.writeEndElement();//hyperlinks writer.writeEndElement();//hyperlinks
} }
void WorksheetPrivate::writeDrawings(QXmlStreamWriter &writer) void WorksheetPrivate::writeDrawings(QXmlStreamWriter &writer) const
{ {
if (!drawing) if (!drawing)
return; return;
@ -1732,7 +1732,7 @@ void Worksheet::prepareImage(int index, int image_id)
height hasn't been set by the user we use the default value. If height hasn't been set by the user we use the default value. If
the row is hidden it has a value of zero. the row is hidden it has a value of zero.
*/ */
int WorksheetPrivate::rowPixelsSize(int row) int WorksheetPrivate::rowPixelsSize(int row) const
{ {
double height; double height;
if (row_sizes.contains(row)) if (row_sizes.contains(row))
@ -1748,7 +1748,7 @@ int WorksheetPrivate::rowPixelsSize(int row)
by the user we use the default value. If the column is hidden it by the user we use the default value. If the column is hidden it
has a value of zero. has a value of zero.
*/ */
int WorksheetPrivate::colPixelsSize(int col) int WorksheetPrivate::colPixelsSize(int col) const
{ {
double max_digit_width = 7.0; //For Calabri 11 double max_digit_width = 7.0; //For Calabri 11
double padding = 5.0; double padding = 5.0;
@ -1780,7 +1780,7 @@ int WorksheetPrivate::colPixelsSize(int col)
x_abs Absolute distance to left side of object. x_abs Absolute distance to left side of object.
y_abs Absolute distance to top side of object. y_abs Absolute distance to top side of object.
*/ */
XlsxObjectPositionData WorksheetPrivate::objectPixelsPosition(int col_start, int row_start, double x1, double y1, double width, double height) XlsxObjectPositionData WorksheetPrivate::objectPixelsPosition(int col_start, int row_start, double x1, double y1, double width, double height) const
{ {
double x_abs = 0; double x_abs = 0;
double y_abs = 0; double y_abs = 0;
@ -1841,7 +1841,7 @@ XlsxObjectPositionData WorksheetPrivate::objectPixelsPosition(int col_start, int
12,700 EMUs per point. Therefore, 12,700 * 3 /4 = 9,525 EMUs per 12,700 EMUs per point. Therefore, 12,700 * 3 /4 = 9,525 EMUs per
pixel pixel
*/ */
XlsxObjectPositionData WorksheetPrivate::pixelsToEMUs(const XlsxObjectPositionData &data) XlsxObjectPositionData WorksheetPrivate::pixelsToEMUs(const XlsxObjectPositionData &data) const
{ {
XlsxObjectPositionData result = data; XlsxObjectPositionData result = data;
result.x1 = static_cast<int>(data.x1 * 9525 + 0.5); result.x1 = static_cast<int>(data.x1 * 9525 + 0.5);
@ -1856,7 +1856,7 @@ XlsxObjectPositionData WorksheetPrivate::pixelsToEMUs(const XlsxObjectPositionDa
return result; return result;
} }
QByteArray Worksheet::saveToXmlData() QByteArray Worksheet::saveToXmlData() const
{ {
QByteArray data; QByteArray data;
QBuffer buffer(&data); QBuffer buffer(&data);

4
src/xlsx/xlsxworksheet.h

@ -139,8 +139,8 @@ private:
void setSheetName(const QString &sheetName); void setSheetName(const QString &sheetName);
Relationships &relationships(); Relationships &relationships();
void saveToXmlFile(QIODevice *device); void saveToXmlFile(QIODevice *device) const;
QByteArray saveToXmlData(); QByteArray saveToXmlData() const;
bool loadFromXmlFile(QIODevice *device); bool loadFromXmlFile(QIODevice *device);
bool loadFromXmlData(const QByteArray &data); bool loadFromXmlData(const QByteArray &data);

32
src/xlsx/xlsxworksheet_p.h

@ -57,7 +57,7 @@ const int XLSX_STRING_MAX = 32767;
class SharedStrings; class SharedStrings;
struct XlsxUrlData struct XlsxHyperlinkData
{ {
enum LinkType enum LinkType
{ {
@ -65,7 +65,7 @@ struct XlsxUrlData
Internal Internal
}; };
XlsxUrlData(LinkType linkType=External, const QString &url=QString(), const QString &location=QString(), const QString &tip=QString()) : XlsxHyperlinkData(LinkType linkType=External, const QString &url=QString(), const QString &location=QString(), const QString &tip=QString()) :
linkType(linkType), url(url), location(location), tip(tip) linkType(linkType), url(url), location(location), tip(tip)
{ {
@ -180,20 +180,20 @@ public:
~WorksheetPrivate(); ~WorksheetPrivate();
int checkDimensions(int row, int col, bool ignore_row=false, bool ignore_col=false); int checkDimensions(int row, int col, bool ignore_row=false, bool ignore_col=false);
Format cellFormat(int row, int col) const; Format cellFormat(int row, int col) const;
QString generateDimensionString(); QString generateDimensionString() const;
void calculateSpans(); void calculateSpans() const;
void splitColsInfo(int colFirst, int colLast); void splitColsInfo(int colFirst, int colLast);
void writeSheetData(QXmlStreamWriter &writer); void writeSheetData(QXmlStreamWriter &writer) const;
void writeCellData(QXmlStreamWriter &writer, int row, int col, QSharedPointer<Cell> cell); void writeCellData(QXmlStreamWriter &writer, int row, int col, QSharedPointer<Cell> cell) const;
void writeMergeCells(QXmlStreamWriter &writer); void writeMergeCells(QXmlStreamWriter &writer) const;
void writeHyperlinks(QXmlStreamWriter &writer); void writeHyperlinks(QXmlStreamWriter &writer) const;
void writeDrawings(QXmlStreamWriter &writer); void writeDrawings(QXmlStreamWriter &writer) const;
void writeDataValidations(QXmlStreamWriter &writer); void writeDataValidations(QXmlStreamWriter &writer) const;
int rowPixelsSize(int row); int rowPixelsSize(int row) const;
int colPixelsSize(int col); int colPixelsSize(int col) const;
XlsxObjectPositionData objectPixelsPosition(int col_start, int row_start, double x1, double y1, double width, double height); XlsxObjectPositionData objectPixelsPosition(int col_start, int row_start, double x1, double y1, double width, double height) const;
XlsxObjectPositionData pixelsToEMUs(const XlsxObjectPositionData &data); XlsxObjectPositionData pixelsToEMUs(const XlsxObjectPositionData &data) const;
QSharedPointer<Cell> readNumericCellData(QXmlStreamReader &reader); QSharedPointer<Cell> readNumericCellData(QXmlStreamReader &reader);
void readSheetData(QXmlStreamReader &reader); void readSheetData(QXmlStreamReader &reader);
@ -210,7 +210,7 @@ public:
Drawing *drawing; Drawing *drawing;
QMap<int, QMap<int, QSharedPointer<Cell> > > cellTable; QMap<int, QMap<int, QSharedPointer<Cell> > > cellTable;
QMap<int, QMap<int, QString> > comments; QMap<int, QMap<int, QString> > comments;
QMap<int, QMap<int, XlsxUrlData *> > urlTable; QMap<int, QMap<int, XlsxHyperlinkData *> > urlTable;
QList<CellRange> merges; QList<CellRange> merges;
QList<XlsxImageData *> imageList; QList<XlsxImageData *> imageList;
QMap<int, QSharedPointer<XlsxRowInfo> > rowsInfo; QMap<int, QSharedPointer<XlsxRowInfo> > rowsInfo;
@ -224,7 +224,7 @@ public:
CellRange dimension; CellRange dimension;
int previous_row; int previous_row;
QMap<int, QString> row_spans; mutable QMap<int, QString> row_spans;
QMap<int, double> row_sizes; QMap<int, double> row_sizes;
QMap<int, double> col_sizes; QMap<int, double> col_sizes;

Loading…
Cancel
Save