Debao Zhang
11 years ago
9 changed files with 298 additions and 104 deletions
@ -0,0 +1,149 @@ |
|||
/****************************************************************************
|
|||
** Copyright (c) 2013-2014 Debao Zhang <hello@debao.me> |
|||
** All right reserved. |
|||
** |
|||
** Permission is hereby granted, free of charge, to any person obtaining |
|||
** a copy of this software and associated documentation files (the |
|||
** "Software"), to deal in the Software without restriction, including |
|||
** without limitation the rights to use, copy, modify, merge, publish, |
|||
** distribute, sublicense, and/or sell copies of the Software, and to |
|||
** permit persons to whom the Software is furnished to do so, subject to |
|||
** the following conditions: |
|||
** |
|||
** The above copyright notice and this permission notice shall be |
|||
** included in all copies or substantial portions of the Software. |
|||
** |
|||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|||
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
|||
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
|||
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|||
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|||
** |
|||
****************************************************************************/ |
|||
#include "xlsxabstractsheet.h" |
|||
#include "xlsxabstractsheet_p.h" |
|||
#include "xlsxworkbook.h" |
|||
|
|||
QT_BEGIN_NAMESPACE_XLSX |
|||
|
|||
AbstractSheetPrivate::AbstractSheetPrivate(AbstractSheet *p) |
|||
: OOXmlFilePrivate(p) |
|||
{ |
|||
hidden = false; |
|||
type = AbstractSheet::ST_WorkSheet; |
|||
} |
|||
|
|||
AbstractSheetPrivate::~AbstractSheetPrivate() |
|||
{ |
|||
} |
|||
|
|||
/*!
|
|||
\class AbstractSheet |
|||
\inmodule QtXlsx |
|||
\brief Base class for worksheet, chartsheet, etc. |
|||
*/ |
|||
|
|||
/*!
|
|||
\enum AbstractSheet::SheetType |
|||
|
|||
\value ST_WorkSheet, |
|||
\omitvalue ST_ChartSheet, |
|||
\omitvalue ST_DialogSheet, |
|||
\omitvalue ST_MacroSheet |
|||
*/ |
|||
|
|||
/*!
|
|||
* \internal |
|||
*/ |
|||
AbstractSheet::AbstractSheet(const QString &name, int id, Workbook *workbook, AbstractSheetPrivate *d) : |
|||
OOXmlFile(d) |
|||
{ |
|||
d_func()->name = name; |
|||
d_func()->id = id; |
|||
d_func()->workbook = workbook; |
|||
} |
|||
|
|||
|
|||
/*!
|
|||
* Returns the name of the sheet. |
|||
*/ |
|||
QString AbstractSheet::sheetName() const |
|||
{ |
|||
Q_D(const AbstractSheet); |
|||
return d->name; |
|||
} |
|||
|
|||
/*!
|
|||
* \internal |
|||
*/ |
|||
void AbstractSheet::setSheetName(const QString &sheetName) |
|||
{ |
|||
Q_D(AbstractSheet); |
|||
d->name = sheetName; |
|||
} |
|||
|
|||
/*!
|
|||
* Returns the type of the sheet. |
|||
*/ |
|||
AbstractSheet::SheetType AbstractSheet::sheetType() const |
|||
{ |
|||
Q_D(const AbstractSheet); |
|||
return d->type; |
|||
} |
|||
|
|||
/*!
|
|||
* \internal |
|||
*/ |
|||
void AbstractSheet::setSheetType(SheetType type) |
|||
{ |
|||
Q_D(AbstractSheet); |
|||
d->type = type; |
|||
} |
|||
|
|||
/*!
|
|||
* \internal |
|||
*/ |
|||
bool AbstractSheet::isHidden() const |
|||
{ |
|||
Q_D(const AbstractSheet); |
|||
return d->hidden; |
|||
} |
|||
|
|||
/*!
|
|||
* \internal |
|||
*/ |
|||
void AbstractSheet::setHidden(bool hidden) |
|||
{ |
|||
Q_D(AbstractSheet); |
|||
d->hidden = hidden; |
|||
} |
|||
|
|||
/*!
|
|||
* \internal |
|||
*/ |
|||
int AbstractSheet::sheetId() const |
|||
{ |
|||
Q_D(const AbstractSheet); |
|||
return d->id; |
|||
} |
|||
|
|||
/*!
|
|||
* \internal |
|||
*/ |
|||
Drawing *AbstractSheet::drawing() const |
|||
{ |
|||
Q_D(const AbstractSheet); |
|||
return d->drawing.data(); |
|||
} |
|||
|
|||
/*!
|
|||
* Return the workbook |
|||
*/ |
|||
Workbook *AbstractSheet::workbook() const |
|||
{ |
|||
Q_D(const AbstractSheet); |
|||
return d->workbook; |
|||
} |
|||
QT_END_NAMESPACE_XLSX |
@ -0,0 +1,66 @@ |
|||
/****************************************************************************
|
|||
** Copyright (c) 2013-2014 Debao Zhang <hello@debao.me> |
|||
** All right reserved. |
|||
** |
|||
** Permission is hereby granted, free of charge, to any person obtaining |
|||
** a copy of this software and associated documentation files (the |
|||
** "Software"), to deal in the Software without restriction, including |
|||
** without limitation the rights to use, copy, modify, merge, publish, |
|||
** distribute, sublicense, and/or sell copies of the Software, and to |
|||
** permit persons to whom the Software is furnished to do so, subject to |
|||
** the following conditions: |
|||
** |
|||
** The above copyright notice and this permission notice shall be |
|||
** included in all copies or substantial portions of the Software. |
|||
** |
|||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|||
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
|||
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
|||
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|||
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|||
** |
|||
****************************************************************************/ |
|||
#ifndef XLSXABSTRACTSHEET_H |
|||
#define XLSXABSTRACTSHEET_H |
|||
|
|||
#include "xlsxooxmlfile.h" |
|||
#include <QStringList> |
|||
#include <QSharedPointer> |
|||
|
|||
QT_BEGIN_NAMESPACE_XLSX |
|||
class Workbook; |
|||
class Drawing; |
|||
class AbstractSheetPrivate; |
|||
class Q_XLSX_EXPORT AbstractSheet : public OOXmlFile |
|||
{ |
|||
Q_DECLARE_PRIVATE(AbstractSheet) |
|||
public: |
|||
enum SheetType |
|||
{ |
|||
ST_WorkSheet, |
|||
ST_ChartSheet, |
|||
ST_DialogSheet, |
|||
ST_MacroSheet |
|||
}; |
|||
|
|||
SheetType sheetType() const; |
|||
QString sheetName() const; |
|||
bool isHidden() const; |
|||
Workbook *workbook() const; |
|||
//Relationships &relationships();
|
|||
|
|||
protected: |
|||
AbstractSheet(const QString &sheetName, int sheetId, Workbook *book, AbstractSheetPrivate *d); |
|||
//QSharedPointer<AbstractSheet> copy(const QString &distName, int distId) const;
|
|||
void setSheetName(const QString &sheetName); |
|||
void setHidden(bool hidden); |
|||
void setSheetType(SheetType type); |
|||
int sheetId() const; |
|||
|
|||
Drawing *drawing() const; |
|||
}; |
|||
|
|||
QT_END_NAMESPACE_XLSX |
|||
#endif // XLSXABSTRACTSHEET_H
|
@ -0,0 +1,65 @@ |
|||
/****************************************************************************
|
|||
** Copyright (c) 2013-2014 Debao Zhang <hello@debao.me> |
|||
** All right reserved. |
|||
** |
|||
** Permission is hereby granted, free of charge, to any person obtaining |
|||
** a copy of this software and associated documentation files (the |
|||
** "Software"), to deal in the Software without restriction, including |
|||
** without limitation the rights to use, copy, modify, merge, publish, |
|||
** distribute, sublicense, and/or sell copies of the Software, and to |
|||
** permit persons to whom the Software is furnished to do so, subject to |
|||
** the following conditions: |
|||
** |
|||
** The above copyright notice and this permission notice shall be |
|||
** included in all copies or substantial portions of the Software. |
|||
** |
|||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|||
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
|||
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
|||
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
|||
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|||
** |
|||
****************************************************************************/ |
|||
#ifndef XLSXABSTRACTSHEET_P_H |
|||
#define XLSXABSTRACTSHEET_P_H |
|||
|
|||
//
|
|||
// W A R N I N G
|
|||
// -------------
|
|||
//
|
|||
// This file is not part of the Qt Xlsx API. It exists for the convenience
|
|||
// of the Qt Xlsx. This header file may change from
|
|||
// version to version without notice, or even be removed.
|
|||
//
|
|||
// We mean it.
|
|||
//
|
|||
|
|||
#include "xlsxglobal.h" |
|||
#include "xlsxabstractsheet.h" |
|||
#include "xlsxooxmlfile_p.h" |
|||
#include "xlsxrelationships_p.h" |
|||
|
|||
#include <QSharedPointer> |
|||
|
|||
namespace QXlsx { |
|||
|
|||
class XLSX_AUTOTEST_EXPORT AbstractSheetPrivate : public OOXmlFilePrivate |
|||
{ |
|||
Q_DECLARE_PUBLIC(AbstractSheet) |
|||
public: |
|||
AbstractSheetPrivate(AbstractSheet *p); |
|||
~AbstractSheetPrivate(); |
|||
|
|||
Workbook *workbook; |
|||
QSharedPointer<Drawing> drawing; |
|||
|
|||
QString name; |
|||
int id; |
|||
bool hidden; |
|||
AbstractSheet::SheetType type; |
|||
}; |
|||
|
|||
} |
|||
#endif // XLSXABSTRACTSHEET_P_H
|
Loading…
Reference in new issue