123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- // xlsxabstractsheet.cpp
- #include <QtGlobal>
- #include "xlsxabstractsheet.h"
- #include "xlsxabstractsheet_p.h"
- #include "xlsxworkbook.h"
- QT_BEGIN_NAMESPACE_XLSX
- AbstractSheetPrivate::AbstractSheetPrivate(AbstractSheet *p, AbstractSheet::CreateFlag flag)
- : AbstractOOXmlFilePrivate(p, flag)
- {
- type = AbstractSheet::ST_WorkSheet;
- sheetState = AbstractSheet::SS_Visible;
- }
- AbstractSheetPrivate::~AbstractSheetPrivate()
- {
- }
- /*!
- \class AbstractSheet
- \inmodule QtXlsx
- \brief Base class for worksheet, chartsheet, etc.
- */
- /*!
- \enum AbstractSheet::SheetType
- \value ST_WorkSheet
- \value ST_ChartSheet
- \omitvalue ST_DialogSheet
- \omitvalue ST_MacroSheet
- */
- /*!
- \enum AbstractSheet::SheetState
- \value SS_Visible
- \value SS_Hidden
- \value SS_VeryHidden User cann't make a veryHidden sheet visible in normal way.
- */
- /*!
- \fn AbstractSheet::copy(const QString &distName, int distId) const
- Copies the current sheet to a sheet called \a distName with \a distId.
- Returns the new sheet.
- */
- /*!
- * \internal
- */
- AbstractSheet::AbstractSheet(const QString &name, int id, Workbook *workbook, AbstractSheetPrivate *d) :
- AbstractOOXmlFile(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;
- }
- /*!
- * Returns the state of the sheet.
- *
- * \sa isHidden(), isVisible(), setSheetState()
- */
- AbstractSheet::SheetState AbstractSheet::sheetState() const
- {
- Q_D(const AbstractSheet);
- return d->sheetState;
- }
- /*!
- * Set the state of the sheet to \a state.
- */
- void AbstractSheet::setSheetState(SheetState state)
- {
- Q_D(AbstractSheet);
- d->sheetState = state;
- }
- /*!
- * Returns true if the sheet is not visible, otherwise false will be returned.
- *
- * \sa sheetState(), setHidden()
- */
- bool AbstractSheet::isHidden() const
- {
- Q_D(const AbstractSheet);
- return d->sheetState != SS_Visible;
- }
- /*!
- * Returns true if the sheet is visible.
- */
- bool AbstractSheet::isVisible() const
- {
- return !isHidden();
- }
- /*!
- * Make the sheet hiden or visible based on \a hidden.
- */
- void AbstractSheet::setHidden(bool hidden)
- {
- Q_D(AbstractSheet);
- if (hidden == isHidden())
- return;
- d->sheetState = hidden ? SS_Hidden : SS_Visible;
- }
- /*!
- * Convenience function, equivalent to setHidden(! \a visible).
- */
- void AbstractSheet::setVisible(bool visible)
- {
- setHidden(!visible);
- }
- /*!
- * \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
|