2
* This file is part of Office 2007 Filters for KOffice
4
* Copyright (C) 2010 Sebastian Sauer <sebsauer@kdab.com>
5
* Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
7
* Contact: Suresh Chande suresh.chande@nokia.com
9
* This library is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU Lesser General Public License
11
* version 2.1 as published by the Free Software Foundation.
13
* This library is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this library; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25
#ifndef XLSXXMLWORKSHEETREADER_P_H
26
#define XLSXXMLWORKSHEETREADER_P_H
28
//! @todo the workboot was designed after filters/kspread/excel/sidewinder to allow to shared as much
29
//! logic as possible. Goal is to let them both share the same structures and OpenDocument logic
32
#include <MsooXmlGlobal.h>
33
#include "XlsxXmlDrawingReader.h"
42
int rowsMerged, columnsMerged;
44
QString charStyleName;
49
QString valueAttrValue;
52
QList<XlsxDrawingObject*> drawings;
54
//QPair< oleObjectFile, imageReplacementFile>
55
QList< QPair<QString,QString> > oleObjects;
57
Cell(Sheet* s, int columnIndex, int rowIndex) : sheet(s), column(columnIndex), row(rowIndex), rowsMerged(1), columnsMerged(1), isPlainText(true) {}
58
~Cell() { qDeleteAll(drawings); }
69
Row(Sheet* s, int index) : sheet(s), rowIndex(index), hidden(false) {}
80
Column(Sheet* s, int index) : sheet(s), columnIndex(index), hidden(false) {}
88
double m_defaultRowHeight, m_defaultColWidth, m_baseColWidth;
89
explicit Sheet(const QString &name) : m_name(name), m_defaultRowHeight(-1.0), m_defaultColWidth(-1.0), m_baseColWidth(-1.0), m_maxRow(0), m_maxColumn(0), m_visible(true) {}
90
~Sheet() { qDeleteAll(m_rows); qDeleteAll(m_columns); qDeleteAll(m_cells); }
92
Row* row(int rowIndex, bool autoCreate)
94
Row* r = m_rows[ rowIndex ];
95
if (!r && autoCreate) {
96
r = new Row(this, rowIndex);
97
m_rows[ rowIndex ] = r;
98
if (rowIndex > m_maxRow) m_maxRow = rowIndex;
103
Column* column(int columnIndex, bool autoCreate)
105
Column* c = m_columns[ columnIndex ];
106
if (!c && autoCreate) {
107
c = new Column(this, columnIndex);
108
m_columns[ columnIndex ] = c;
109
if (columnIndex > m_maxColumn) m_maxColumn = columnIndex;
114
Cell* cell(int columnIndex, int rowIndex, bool autoCreate)
116
const unsigned hashed = (rowIndex + 1) * MSOOXML::maximumSpreadsheetColumns() + columnIndex + 1;
117
Cell* c = m_cells[ hashed ];
118
if (!c && autoCreate) {
119
c = new Cell(this, columnIndex, rowIndex);
120
m_cells[ hashed ] = c;
121
this->column(columnIndex, true);
122
this->row(rowIndex, true);
123
if (rowIndex > m_maxRow) m_maxRow = rowIndex;
124
if (columnIndex > m_maxColumn) m_maxColumn = columnIndex;
125
if (!m_maxCellsInRow.contains(rowIndex) || columnIndex > m_maxCellsInRow[rowIndex])
126
m_maxCellsInRow[rowIndex] = columnIndex;
131
int maxRow() const { return m_maxRow; }
132
int maxColumn() const { return m_maxColumn; }
133
int maxCellsInRow(int rowIndex) const { return m_maxCellsInRow[rowIndex]; }
135
bool visible() { return m_visible; }
136
void setVisible(bool visible) { m_visible = visible; }
138
QString pictureBackgroundPath() { return m_pictureBackgroundPath; }
139
void setPictureBackgroundPath(const QString& path) { m_pictureBackgroundPath = path; }
142
QHash<int, Row*> m_rows;
143
QHash<int, Column*> m_columns;
144
QHash<unsigned, Cell*> m_cells;
147
QHash<int, int> m_maxCellsInRow;
149
QString m_pictureBackgroundPath;