Loading...
Searching...
No Matches
calcwriterinterface.cpp
Go to the documentation of this file.
/**
* \file odsstream/odsdochandlerinterface.cpp
* \date 10/03/2015
* \author Olivier Langella
* \brief interface to use as a wildcard to writer in either TSV, ODS
* TSVdirectory writers any kind of writer can be created in your program :
* OdsDocWriter, TsvDirectoryWriter, TsvOutputStream
* All of them implements this interface :
* it allows to use the same code to write in these different formats.
*/
/*******************************************************************************
* Copyright (c) 2013 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of the libodsstream library.
*
* libodsstream is a library to read and write ODS documents as streams
* Copyright (C) 2013 Olivier Langella <Olivier.Langella@u-psud.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
*by the Free Software Foundation, either version 3 of the License, or (at your
*option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and
*implementation
******************************************************************************/
#include "calcwriterinterface.h"
CalcWriterInterface::~CalcWriterInterface()
{
}
/**
* build table cell style reference with a style definition
*
* \param style OdsTableCellStyle
* \return OdsTableCellStyleRef pointer on a style reference
*/
OdsTableCellStyleRef
CalcWriterInterface::getTableCellStyleRef(
[[maybe_unused]] const OdsTableCellStyle &style)
{
return nullptr;
}
/**
* set the cell table style. This is applied to in the stream to following
* cells. This ends by using an other style reference or by using
* setTableCellStyleRef function
*
* \param style_ref OdsTableCellStyleRef
*/
void
CalcWriterInterface::setTableCellStyleRef(
[[maybe_unused]] OdsTableCellStyleRef style_ref)
{
}
/**
* clear cell style definition in the stream. the default style will be
* applied.
*
*/
void
CalcWriterInterface::clearTableCellStyleRef()
{
setTableCellStyleRef(nullptr);
}
/** \brief apply solor scale conditional format on a cell range
*
*/
void
CalcWriterInterface::addColorScale(
[[maybe_unused]] const OdsColorScale &ods_color_scale)
{
}
/** @brief get the last written cell coordinate in ODS coordinate format
* get the coordinate of the last written cell or an empty string if the
* writer is not an OdsDocWriter
*
* @return QString with ODS cell coordinate of the form : "classeur.A5"
*/
QString
CalcWriterInterface::getOdsCellCoordinate()
{
return QString();
}
/** @brief set ODS table settings of the current sheet (table)
*/
void
CalcWriterInterface::setCurrentOdsTableSettings(
[[maybe_unused]] const OdsTableSettings &settings)
{
}
/**
* \brief write a cell for a given QVariant
* \param QVariant variable to write
*/
void
CalcWriterInterface::writeCellVariant(const QVariant &var)
{
int type = var.metaType().id();
switch(type)
{
case QMetaType::Void:
writeEmptyCell();
break;
case QMetaType::Bool:
writeCell(var.toBool());
break;
case QMetaType::Double:
case QMetaType::Float:
writeCell(var.toDouble());
break;
case QMetaType::Int:
writeCell(var.toInt());
break;
case QMetaType::QDate:
writeCell(var.toDate());
break;
case QMetaType::QDateTime:
writeCell(var.toDateTime());
break;
case QMetaType::QString:
writeCell(var.toString());
break;
case QMetaType::QUrl:
writeCell(var.toUrl(), var.toUrl().toString());
break;
default:
writeCell(var.toString());
}
}
calcwriterinterface.h
CalcWriterInterface::writeEmptyCell
virtual void writeEmptyCell()=0
write an empty cell
CalcWriterInterface::writeCell
virtual void writeCell(const char *cell_text)=0
write a text cell
CalcWriterInterface::writeCellVariant
virtual void writeCellVariant(const QVariant &var)
write a cell for a given QVariant
Definition calcwriterinterface.cpp:117
CalcWriterInterface::clearTableCellStyleRef
void clearTableCellStyleRef()
Definition calcwriterinterface.cpp:78
CalcWriterInterface::setTableCellStyleRef
virtual void setTableCellStyleRef(OdsTableCellStyleRef style_ref)
Definition calcwriterinterface.cpp:67
CalcWriterInterface::addColorScale
virtual void addColorScale(const OdsColorScale &ods_color_scale)
apply solor scale conditional format on a cell range
Definition calcwriterinterface.cpp:87
CalcWriterInterface::getOdsCellCoordinate
virtual QString getOdsCellCoordinate()
get the last written cell coordinate in ODS coordinate format get the coordinate of the last written ...
Definition calcwriterinterface.cpp:99
CalcWriterInterface::getTableCellStyleRef
virtual OdsTableCellStyleRef getTableCellStyleRef(const OdsTableCellStyle &style)
Definition calcwriterinterface.cpp:53
CalcWriterInterface::~CalcWriterInterface
virtual ~CalcWriterInterface()
Definition calcwriterinterface.cpp:41
CalcWriterInterface::setCurrentOdsTableSettings
virtual void setCurrentOdsTableSettings(const OdsTableSettings &settings)
set ODS table settings of the current sheet (table)
Definition calcwriterinterface.cpp:107
OdsColorScale
Definition odscolorscale.h:44
OdsTableCellStyle
Definition odstablecellstyle.h:34
OdsTableSettings
Definition odstablesettings.h:43
OdsTableCellStyleRef
OdsTableCellStyleRefInternal * OdsTableCellStyleRef
Definition odstablecellstyleref.h:35