0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-10-02 03:53:19 +03:00

Define code style and format all source file using clang-format-14

except those placed in 3rdparty directories.
This commit is contained in:
Андрей Лухнов
2024-09-04 17:31:16 +03:00
parent c5b9ac265d
commit 0fca7169d3
285 changed files with 19120 additions and 17875 deletions

View File

@@ -28,6 +28,7 @@
* GNU General Public License for more details. *
****************************************************************************/
#include "lrdataband.h"
#include "lrdesignelementsfactory.h"
#include "lrglobal.h"
@@ -35,56 +36,51 @@ const QString xmlTag = "Data";
const QString xmlTagHeader = "DataHeader";
const QString xmlTagFooter = "DataFooter";
namespace{
namespace {
LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::DataBand(owner,parent);
LimeReport::BaseDesignIntf* createBand(QObject* owner, LimeReport::BaseDesignIntf* parent)
{
return new LimeReport::DataBand(owner, parent);
}
LimeReport::BaseDesignIntf * createHeader(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::DataHeaderBand(owner,parent);
LimeReport::BaseDesignIntf* createHeader(QObject* owner, LimeReport::BaseDesignIntf* parent)
{
return new LimeReport::DataHeaderBand(owner, parent);
}
LimeReport::BaseDesignIntf * createFooter(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::DataFooterBand(owner,parent);
LimeReport::BaseDesignIntf* createFooter(QObject* owner, LimeReport::BaseDesignIntf* parent)
{
return new LimeReport::DataFooterBand(owner, parent);
}
bool VARIABLE_IS_NOT_USED registred = LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTag,
LimeReport::ItemAttribs(QObject::tr("Data"),LimeReport::Const::bandTAG),
createBand
);
bool VARIABLE_IS_NOT_USED registredHeader = LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTagHeader,
LimeReport::ItemAttribs(QObject::tr("DataHeader"),LimeReport::Const::bandTAG),
createHeader
);
bool VARIABLE_IS_NOT_USED registredFooter = LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTagFooter,
LimeReport::ItemAttribs(QObject::tr("DataFooter"),LimeReport::Const::bandTAG),
createFooter
);
xmlTag, LimeReport::ItemAttribs(QObject::tr("Data"), LimeReport::Const::bandTAG), createBand);
bool VARIABLE_IS_NOT_USED registredHeader
= LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTagHeader,
LimeReport::ItemAttribs(QObject::tr("DataHeader"), LimeReport::Const::bandTAG),
createHeader);
bool VARIABLE_IS_NOT_USED registredFooter
= LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTagFooter,
LimeReport::ItemAttribs(QObject::tr("DataFooter"), LimeReport::Const::bandTAG),
createFooter);
}
} // namespace
namespace LimeReport {
DataBand::DataBand(QObject *owner, QGraphicsItem *parent)
: DataBandDesignIntf(LimeReport::BandDesignIntf::Data,xmlTag,owner,parent) {
setBandTypeText(tr("Data"));
setFixedPos(false);
setMarkerColor(bandColor());
}
bool DataBand::isUnique() const
DataBand::DataBand(QObject* owner, QGraphicsItem* parent):
DataBandDesignIntf(LimeReport::BandDesignIntf::Data, xmlTag, owner, parent)
{
return false;
setBandTypeText(tr("Data"));
setFixedPos(false);
setMarkerColor(bandColor());
}
QColor DataBand::bandColor() const
{
return QColor(Qt::darkGreen);
}
bool DataBand::isUnique() const { return false; }
void DataBand::preparePopUpMenu(QMenu &menu)
QColor DataBand::bandColor() const { return QColor(Qt::darkGreen); }
void DataBand::preparePopUpMenu(QMenu& menu)
{
BandDesignIntf::preparePopUpMenu(menu);
@@ -111,52 +107,49 @@ void DataBand::preparePopUpMenu(QMenu &menu)
currAction = menu.addAction(tr("Start new page"));
currAction->setCheckable(true);
currAction->setChecked(startNewPage());
}
void DataBand::processPopUpAction(QAction *action)
void DataBand::processPopUpAction(QAction* action)
{
BandDesignIntf::processPopUpAction(action);
if (action->text().compare(tr("Keep footer together")) == 0){
setProperty("keepFooterTogether",action->isChecked());
if (action->text().compare(tr("Keep footer together")) == 0) {
setProperty("keepFooterTogether", action->isChecked());
}
if (action->text().compare(tr("Keep subdetail together")) == 0){
setProperty("keepSubdetailTogether",action->isChecked());
if (action->text().compare(tr("Keep subdetail together")) == 0) {
setProperty("keepSubdetailTogether", action->isChecked());
}
if (action->text().compare(tr("Slice last row")) == 0){
setProperty("sliceLastRow",action->isChecked());
if (action->text().compare(tr("Slice last row")) == 0) {
setProperty("sliceLastRow", action->isChecked());
}
if (action->text().compare(tr("Use alternate background color")) == 0){
setProperty("useAlternateBackgroundColor",action->isChecked());
if (action->text().compare(tr("Use alternate background color")) == 0) {
setProperty("useAlternateBackgroundColor", action->isChecked());
}
if (action->text().compare(tr("Start new page")) == 0){
setProperty("startNewPage",action->isChecked());
if (action->text().compare(tr("Start new page")) == 0) {
setProperty("startNewPage", action->isChecked());
}
if (action->text().compare(tr("Start from new page")) == 0){
setProperty("startFromNewPage",action->isChecked());
if (action->text().compare(tr("Start from new page")) == 0) {
setProperty("startFromNewPage", action->isChecked());
}
}
BaseDesignIntf *DataBand::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
BaseDesignIntf* DataBand::createSameTypeItem(QObject* owner, QGraphicsItem* parent)
{
return new DataBand(owner,parent);
return new DataBand(owner, parent);
}
DataHeaderBand::DataHeaderBand(QObject *owner, QGraphicsItem *parent)
:BandDesignIntf(BandDesignIntf::DataHeader,xmlTagHeader,owner,parent)
DataHeaderBand::DataHeaderBand(QObject* owner, QGraphicsItem* parent):
BandDesignIntf(BandDesignIntf::DataHeader, xmlTagHeader, owner, parent)
{
setBandTypeText(tr("DataHeader"));
setMarkerColor(bandColor());
}
void DataHeaderBand::preparePopUpMenu(QMenu &menu)
void DataHeaderBand::preparePopUpMenu(QMenu& menu)
{
BandDesignIntf::preparePopUpMenu(menu);
QAction* currAction = menu.addAction(tr("Reprint on each page"));
@@ -172,30 +165,30 @@ void DataHeaderBand::preparePopUpMenu(QMenu &menu)
currAction->setChecked(printAlways());
}
void DataHeaderBand::processPopUpAction(QAction *action)
void DataHeaderBand::processPopUpAction(QAction* action)
{
BandDesignIntf::processPopUpAction(action);
if (action->text().compare(tr("Reprint on each page")) == 0){
setProperty("reprintOnEachPage",action->isChecked());
if (action->text().compare(tr("Reprint on each page")) == 0) {
setProperty("reprintOnEachPage", action->isChecked());
}
if (action->text().compare(tr("Repeat on each row")) == 0){
setProperty("repeatOnEachRow",action->isChecked());
if (action->text().compare(tr("Repeat on each row")) == 0) {
setProperty("repeatOnEachRow", action->isChecked());
}
if (action->text().compare(tr("Print always")) == 0){
setProperty("printAlways",action->isChecked());
if (action->text().compare(tr("Print always")) == 0) {
setProperty("printAlways", action->isChecked());
}
}
DataFooterBand::DataFooterBand(QObject *owner, QGraphicsItem *parent)
:BandDesignIntf(BandDesignIntf::DataFooter,xmlTagFooter,owner,parent)
DataFooterBand::DataFooterBand(QObject* owner, QGraphicsItem* parent):
BandDesignIntf(BandDesignIntf::DataFooter, xmlTagFooter, owner, parent)
{
setBandTypeText(tr("DataFooter"));
setMarkerColor(bandColor());
}
void DataFooterBand::preparePopUpMenu(QMenu &menu)
void DataFooterBand::preparePopUpMenu(QMenu& menu)
{
BandDesignIntf::preparePopUpMenu(menu);
QAction* currAction = menu.addAction(tr("Print always"));
@@ -203,13 +196,12 @@ void DataFooterBand::preparePopUpMenu(QMenu &menu)
currAction->setChecked(printAlways());
}
void DataFooterBand::processPopUpAction(QAction *action)
void DataFooterBand::processPopUpAction(QAction* action)
{
BandDesignIntf::processPopUpAction(action);
if (action->text().compare(tr("Print always")) == 0){
setProperty("printAlways",action->isChecked());
if (action->text().compare(tr("Print always")) == 0) {
setProperty("printAlways", action->isChecked());
}
}
}
} // namespace LimeReport

View File

@@ -32,77 +32,88 @@
#include "lrbanddesignintf.h"
#include "lrbasedesignintf.h"
#include <QObject>
namespace LimeReport{
namespace LimeReport {
class DataBand : public DataBandDesignIntf
{
class DataBand: public DataBandDesignIntf {
Q_OBJECT
Q_PROPERTY(bool keepSubdetailTogether READ tryToKeepTogether WRITE setTryToKeepTogether)
Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable)
Q_PROPERTY(bool keepFooterTogether READ keepFooterTogether WRITE setKeepFooterTogether)
Q_PROPERTY(bool sliceLastRow READ sliceLastRow WRITE setSliceLastRow)
Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount)
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE
setColumnsFillDirection)
Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage)
Q_PROPERTY(bool startFromNewPage READ startFromNewPage WRITE setStartFromNewPage)
Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor)
Q_PROPERTY(bool useAlternateBackgroundColor READ useAlternateBackgroundColor WRITE setUseAlternateBackgroundColor)
Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE
setAlternateBackgroundColor)
Q_PROPERTY(bool useAlternateBackgroundColor READ useAlternateBackgroundColor WRITE
setUseAlternateBackgroundColor)
public:
DataBand(QObject* owner = 0, QGraphicsItem* parent=0);
DataBand(QObject* owner = 0, QGraphicsItem* parent = 0);
bool isUnique() const;
bool isData() const {return true;}
bool isData() const { return true; }
protected:
QColor bandColor() const;
void preparePopUpMenu(QMenu &menu);
void processPopUpAction(QAction *action);
void preparePopUpMenu(QMenu& menu);
void processPopUpAction(QAction* action);
private:
BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
BaseDesignIntf* createSameTypeItem(QObject* owner = 0, QGraphicsItem* parent = 0);
};
class DataHeaderBand : public BandDesignIntf
{
class DataHeaderBand: public BandDesignIntf {
Q_OBJECT
Q_PROPERTY(bool reprintOnEachPage READ reprintOnEachPage WRITE setReprintOnEachPage)
Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount)
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE
setColumnsFillDirection)
Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways)
Q_PROPERTY(bool repeatOnEachRow READ repeatOnEachRow WRITE setRepeatOnEachRow)
public:
DataHeaderBand(QObject* owner=0, QGraphicsItem* parent=0);
bool isUnique() const {return false;}
bool isHeader() const {return true;}
QColor bandColor() const {return QColor(Qt::darkGreen);}
DataHeaderBand(QObject* owner = 0, QGraphicsItem* parent = 0);
bool isUnique() const { return false; }
bool isHeader() const { return true; }
QColor bandColor() const { return QColor(Qt::darkGreen); }
protected:
void preparePopUpMenu(QMenu &menu);
void processPopUpAction(QAction *action);
void preparePopUpMenu(QMenu& menu);
void processPopUpAction(QAction* action);
private:
BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0){
return new DataHeaderBand(owner,parent);
BaseDesignIntf* createSameTypeItem(QObject* owner = 0, QGraphicsItem* parent = 0)
{
return new DataHeaderBand(owner, parent);
}
};
class DataFooterBand : public BandDesignIntf
{
class DataFooterBand: public BandDesignIntf {
Q_OBJECT
Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount)
Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable)
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE
setColumnsFillDirection)
Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways)
public:
DataFooterBand(QObject* owner=0, QGraphicsItem* parent=0);
bool isUnique() const {return false;}
bool isFooter() const {return true;}
QColor bandColor() const{return QColor(Qt::darkGreen);}
DataFooterBand(QObject* owner = 0, QGraphicsItem* parent = 0);
bool isUnique() const { return false; }
bool isFooter() const { return true; }
QColor bandColor() const { return QColor(Qt::darkGreen); }
protected:
void preparePopUpMenu(QMenu &menu);
void processPopUpAction(QAction *action);
void preparePopUpMenu(QMenu& menu);
void processPopUpAction(QAction* action);
private:
BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0){
return new DataFooterBand(owner,parent);
BaseDesignIntf* createSameTypeItem(QObject* owner = 0, QGraphicsItem* parent = 0)
{
return new DataFooterBand(owner, parent);
}
};
}
} // namespace LimeReport
#endif // LRDATABAND_H

View File

@@ -28,131 +28,130 @@
* GNU General Public License for more details. *
****************************************************************************/
#include "lrgroupbands.h"
#include "lrglobal.h"
#include "lrdatasourcemanager.h"
#include "lrglobal.h"
const QString xmlTagHeader = QLatin1String("GroupHeader");
const QString xmlTagFooter = QLatin1String("GroupFooter");
namespace{
namespace {
LimeReport::BaseDesignIntf* createHeader(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::GroupBandHeader(owner,parent);
LimeReport::BaseDesignIntf* createHeader(QObject* owner, LimeReport::BaseDesignIntf* parent)
{
return new LimeReport::GroupBandHeader(owner, parent);
}
bool VARIABLE_IS_NOT_USED registredHeader = LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTagHeader,
LimeReport::ItemAttribs(QObject::tr("GroupHeader"),LimeReport::Const::bandTAG),
createHeader
);
bool VARIABLE_IS_NOT_USED registredHeader
= LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTagHeader,
LimeReport::ItemAttribs(QObject::tr("GroupHeader"), LimeReport::Const::bandTAG),
createHeader);
LimeReport::BaseDesignIntf * createFooter(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::GroupBandFooter(owner,parent);
LimeReport::BaseDesignIntf* createFooter(QObject* owner, LimeReport::BaseDesignIntf* parent)
{
return new LimeReport::GroupBandFooter(owner, parent);
}
bool VARIABLE_IS_NOT_USED registredFooter = LimeReport::DesignElementsFactory::instance().registerCreator(
bool VARIABLE_IS_NOT_USED registredFooter
= LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTagFooter,
LimeReport::ItemAttribs(QObject::tr("GroupFooter"),LimeReport::Const::bandTAG),
createFooter
);
LimeReport::ItemAttribs(QObject::tr("GroupFooter"), LimeReport::Const::bandTAG),
createFooter);
}
} // namespace
namespace LimeReport{
namespace LimeReport {
GroupBandHeader::GroupBandHeader(QObject *owner, QGraphicsItem *parent)
: BandDesignIntf(BandDesignIntf::GroupHeader, xmlTagHeader, owner,parent),
m_groupFiledName(""), m_groupStarted(false), m_resetPageNumber(false)
GroupBandHeader::GroupBandHeader(QObject* owner, QGraphicsItem* parent):
BandDesignIntf(BandDesignIntf::GroupHeader, xmlTagHeader, owner, parent),
m_groupFiledName(""),
m_groupStarted(false),
m_resetPageNumber(false)
{
setBandTypeText(tr("GroupHeader"));
setFixedPos(false);
setMarkerColor(bandColor());
}
bool GroupBandHeader::isUnique() const
{
return false;
}
bool GroupBandHeader::isUnique() const { return false; }
//bool GroupBandHeader::tryToKeepTogether()
// bool GroupBandHeader::tryToKeepTogether()
//{
// return m_tryToKeepTogether;
//}
BaseDesignIntf *GroupBandHeader::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
BaseDesignIntf* GroupBandHeader::createSameTypeItem(QObject* owner, QGraphicsItem* parent)
{
return new GroupBandHeader(owner, parent);
}
void GroupBandHeader::startGroup(DataSourceManager* dataManager)
{
m_groupStarted=true;
m_groupStarted = true;
QString lineVar = QLatin1String("line_")+objectName().toLower();
dataManager->setReportVariable(lineVar,1);
QString lineVar = QLatin1String("line_") + objectName().toLower();
dataManager->setReportVariable(lineVar, 1);
QString datasourceName = findDataSourceName(parentBand());
if (dataManager->containsDatasource(datasourceName)){
if (dataManager->containsDatasource(datasourceName)) {
IDataSource* ds = dataManager->dataSource(datasourceName);
if (ds && ds->columnIndexByName(m_groupFiledName)!=-1)
m_groupFieldValue=ds->data(m_groupFiledName);
if (ds && ds->columnIndexByName(m_groupFiledName) != -1)
m_groupFieldValue = ds->data(m_groupFiledName);
}
if (!m_condition.isEmpty()) m_conditionValue = calcCondition(dataManager);
if (!m_condition.isEmpty())
m_conditionValue = calcCondition(dataManager);
}
QColor GroupBandHeader::bandColor() const
QColor GroupBandHeader::bandColor() const { return QColor(Qt::darkBlue); }
QString GroupBandHeader::findDataSourceName(BandDesignIntf* parentBand)
{
return QColor(Qt::darkBlue);
}
QString GroupBandHeader::findDataSourceName(BandDesignIntf* parentBand){
if (!parentBand) return "";
if (!parentBand)
return "";
if (!parentBand->datasourceName().isEmpty())
return parentBand->datasourceName();
else
return findDataSourceName(parentBand->parentBand());
}
QString GroupBandHeader::condition() const
QString GroupBandHeader::condition() const { return m_condition; }
void GroupBandHeader::setCondition(const QString& condition) { m_condition = condition; }
QString GroupBandHeader::calcCondition(DataSourceManager* dataManager)
{
return m_condition;
}
void GroupBandHeader::setCondition(const QString &condition)
{
m_condition = condition;
}
QString GroupBandHeader::calcCondition(DataSourceManager* dataManager){
QString result = m_condition;
if (!m_condition.isEmpty()){
result=expandUserVariables(result, FirstPass, NoEscapeSymbols, dataManager);
result=expandScripts(result, dataManager);
result=expandDataFields(result, NoEscapeSymbols, dataManager);
if (!m_condition.isEmpty()) {
result = expandUserVariables(result, FirstPass, NoEscapeSymbols, dataManager);
result = expandScripts(result, dataManager);
result = expandDataFields(result, NoEscapeSymbols, dataManager);
}
return result;
}
bool GroupBandHeader::isNeedToClose(DataSourceManager* dataManager)
{
if (!m_groupStarted) return false;
if ((m_groupFiledName.isNull() || m_groupFiledName.isEmpty()) && condition().isEmpty()){
if (!m_groupStarted)
return false;
if ((m_groupFiledName.isNull() || m_groupFiledName.isEmpty()) && condition().isEmpty()) {
dataManager->putError(tr("Group field not found"));
return false;
}
if (!m_condition.isEmpty()){
if (!m_condition.isEmpty()) {
return m_conditionValue != calcCondition(dataManager);
} else {
QString datasourceName = findDataSourceName(parentBand());
if (dataManager->containsDatasource(datasourceName)){
if (dataManager->containsDatasource(datasourceName)) {
IDataSource* ds = dataManager->dataSource(datasourceName);
if (ds){
if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false;
if (!ds->data(m_groupFiledName).isValid()) return false;
return ds->data(m_groupFiledName)!=m_groupFieldValue;
if (ds) {
if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull())
return false;
if (!ds->data(m_groupFiledName).isValid())
return false;
return ds->data(m_groupFiledName) != m_groupFieldValue;
}
} else {
dataManager->putError(tr("Datasource \"%1\" not found!").arg(datasourceName));
@@ -164,62 +163,47 @@ bool GroupBandHeader::isNeedToClose(DataSourceManager* dataManager)
bool GroupBandHeader::isStarted()
{
return m_groupStarted;//!m_groupFieldValue.isNull();
return m_groupStarted; //! m_groupFieldValue.isNull();
}
void GroupBandHeader::closeGroup()
{
m_groupFieldValue=QVariant();
m_conditionValue="";
m_groupStarted=false;
m_groupFieldValue = QVariant();
m_conditionValue = "";
m_groupStarted = false;
}
int GroupBandHeader::index()
{
return bandIndex();
}
int GroupBandHeader::index() { return bandIndex(); }
bool GroupBandHeader::startNewPage() const
{
return BandDesignIntf::startNewPage();
}
bool GroupBandHeader::startNewPage() const { return BandDesignIntf::startNewPage(); }
void GroupBandHeader::setStartNewPage(bool startNewPage)
{
BandDesignIntf::setStartNewPage(startNewPage);
}
bool GroupBandHeader::resetPageNumber() const
{
return m_resetPageNumber;
}
bool GroupBandHeader::resetPageNumber() const { return m_resetPageNumber; }
void GroupBandHeader::setResetPageNumber(bool resetPageNumber)
{
m_resetPageNumber = resetPageNumber;
}
GroupBandFooter::GroupBandFooter(QObject *owner, QGraphicsItem *parent)
:BandDesignIntf(BandDesignIntf::GroupFooter, xmlTagFooter, owner,parent)
GroupBandFooter::GroupBandFooter(QObject* owner, QGraphicsItem* parent):
BandDesignIntf(BandDesignIntf::GroupFooter, xmlTagFooter, owner, parent)
{
setBandTypeText(tr("GroupFooter"));
setFixedPos(false);
setMarkerColor(bandColor());
}
bool GroupBandFooter::isUnique() const
bool GroupBandFooter::isUnique() const { return false; }
QColor GroupBandFooter::bandColor() const { return QColor(Qt::darkBlue); }
BaseDesignIntf* GroupBandFooter::createSameTypeItem(QObject* owner, QGraphicsItem* parent)
{
return false;
return new GroupBandFooter(owner, parent);
}
QColor GroupBandFooter::bandColor() const
{
return QColor(Qt::darkBlue);
}
BaseDesignIntf *GroupBandFooter::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
{
return new GroupBandFooter(owner,parent);
}
} //namespace LimeReport
} // namespace LimeReport

View File

@@ -33,61 +33,64 @@
#include "lrbanddesignintf.h"
#include "lrdesignelementsfactory.h"
namespace LimeReport{
namespace LimeReport {
class GroupBandHeader : public BandDesignIntf, public IGroupBand{
class GroupBandHeader: public BandDesignIntf, public IGroupBand {
Q_OBJECT
Q_PROPERTY(QString groupFieldName READ groupFieldName WRITE setGroupFieldName)
Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable )
Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable)
Q_PROPERTY(bool keepGroupTogether READ tryToKeepTogether WRITE setTryToKeepTogether)
Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage)
Q_PROPERTY(bool resetPageNumber READ resetPageNumber WRITE setResetPageNumber)
Q_PROPERTY(bool reprintOnEachPage READ reprintOnEachPage WRITE setReprintOnEachPage)
Q_PROPERTY(QString condition READ condition WRITE setCondition)
public:
GroupBandHeader(QObject* owner = 0, QGraphicsItem* parent=0);
GroupBandHeader(QObject* owner = 0, QGraphicsItem* parent = 0);
virtual bool isUnique() const;
QVariant groupFieldValue(){return m_groupFieldValue;}
void setGroupFieldValue(QVariant value){m_groupFieldValue=value;}
QString groupFieldName(){return m_groupFiledName;}
void setGroupFieldName(QString fieldName){m_groupFiledName=fieldName;}
QVariant groupFieldValue() { return m_groupFieldValue; }
void setGroupFieldValue(QVariant value) { m_groupFieldValue = value; }
QString groupFieldName() { return m_groupFiledName; }
void setGroupFieldName(QString fieldName) { m_groupFiledName = fieldName; }
QColor bandColor() const;
bool startNewPage() const;
void setStartNewPage(bool startNewPage);
bool resetPageNumber() const;
void setResetPageNumber(bool resetPageNumber);
bool isHeader() const{return true;}
bool isGroupHeader() const {return true;}
bool isHeader() const { return true; }
bool isGroupHeader() const { return true; }
QString condition() const;
void setCondition(const QString &condition);
void setCondition(const QString& condition);
private:
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner = 0, QGraphicsItem* parent = 0);
void startGroup(DataSourceManager* dataManager);
bool isNeedToClose(DataSourceManager *dataManager);
bool isNeedToClose(DataSourceManager* dataManager);
bool isStarted();
void closeGroup();
int index();
QString findDataSourceName(BandDesignIntf *parentBand);
QString calcCondition(DataSourceManager *dataManager);
QString findDataSourceName(BandDesignIntf* parentBand);
QString calcCondition(DataSourceManager* dataManager);
private:
QVariant m_groupFieldValue;
QString m_groupFiledName;
bool m_groupStarted;
//bool m_startNewPage;
// bool m_startNewPage;
bool m_resetPageNumber;
QString m_condition;
QString m_conditionValue;
};
class GroupBandFooter : public BandDesignIntf{
class GroupBandFooter: public BandDesignIntf {
Q_OBJECT
public:
GroupBandFooter(QObject* owner = 0, QGraphicsItem* parent=0);
GroupBandFooter(QObject* owner = 0, QGraphicsItem* parent = 0);
virtual bool isUnique() const;
QColor bandColor() const;
virtual bool isFooter() const{return true;}
virtual bool isFooter() const { return true; }
private:
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner = 0, QGraphicsItem* parent = 0);
};
} // namespace LimeReport

View File

@@ -28,46 +28,45 @@
* GNU General Public License for more details. *
****************************************************************************/
#include "lrpagefooter.h"
#include "lrdesignelementsfactory.h"
#include "lrglobal.h"
#include "lrpagedesignintf.h"
const QString xmlTag ="PageFooter";
const QString xmlTag = "PageFooter";
namespace{
LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::PageFooter(owner,parent);
namespace {
LimeReport::BaseDesignIntf* createBand(QObject* owner, LimeReport::BaseDesignIntf* parent)
{
return new LimeReport::PageFooter(owner, parent);
}
bool VARIABLE_IS_NOT_USED registred = LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTag,
LimeReport::ItemAttribs(QObject::tr("Page Footer"),LimeReport::Const::bandTAG),
createBand
);
}
xmlTag, LimeReport::ItemAttribs(QObject::tr("Page Footer"), LimeReport::Const::bandTAG),
createBand);
} // namespace
namespace LimeReport{
namespace LimeReport {
PageFooter::PageFooter(QObject *owner, QGraphicsItem *parent)
: BandDesignIntf(LimeReport::BandDesignIntf::PageFooter,xmlTag,owner,parent),
m_printOnFirstPage(true), m_printOnLastPage(true), m_removeGap(false)
PageFooter::PageFooter(QObject* owner, QGraphicsItem* parent):
BandDesignIntf(LimeReport::BandDesignIntf::PageFooter, xmlTag, owner, parent),
m_printOnFirstPage(true),
m_printOnLastPage(true),
m_removeGap(false)
{
setBandTypeText( tr("Page Footer") );
setMarkerColor(bandColor());
setAutoHeight(false);
setBandTypeText(tr("Page Footer"));
setMarkerColor(bandColor());
setAutoHeight(false);
}
BaseDesignIntf *PageFooter::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
BaseDesignIntf* PageFooter::createSameTypeItem(QObject* owner, QGraphicsItem* parent)
{
return new PageFooter(owner,parent);
return new PageFooter(owner, parent);
}
QColor PageFooter::bandColor() const
{
return QColor(246,120,12);
}
QColor PageFooter::bandColor() const { return QColor(246, 120, 12); }
void PageFooter::preparePopUpMenu(QMenu &menu)
void PageFooter::preparePopUpMenu(QMenu& menu)
{
QAction* action = menu.addAction(tr("Print on first page"));
action->setCheckable(true);
@@ -76,57 +75,44 @@ void PageFooter::preparePopUpMenu(QMenu &menu)
action = menu.addAction(tr("Print on last page"));
action->setCheckable(true);
action->setChecked(printOnLastPage());
}
void PageFooter::processPopUpAction(QAction *action)
void PageFooter::processPopUpAction(QAction* action)
{
if (action->text().compare(tr("Print on first page")) == 0){
page()->setPropertyToSelectedItems("printOnFirstPage",action->isChecked());
if (action->text().compare(tr("Print on first page")) == 0) {
page()->setPropertyToSelectedItems("printOnFirstPage", action->isChecked());
}
if (action->text().compare(tr("Print on last page")) == 0){
page()->setPropertyToSelectedItems("printOnLastPage",action->isChecked());
if (action->text().compare(tr("Print on last page")) == 0) {
page()->setPropertyToSelectedItems("printOnLastPage", action->isChecked());
}
BandDesignIntf::processPopUpAction(action);
}
bool PageFooter::removeGap() const
{
return m_removeGap;
}
bool PageFooter::removeGap() const { return m_removeGap; }
void PageFooter::setRemoveGap(bool removeGap)
{
m_removeGap = removeGap;
}
void PageFooter::setRemoveGap(bool removeGap) { m_removeGap = removeGap; }
bool PageFooter::printOnFirstPage() const
{
return m_printOnFirstPage;
}
bool PageFooter::printOnFirstPage() const { return m_printOnFirstPage; }
void PageFooter::setPrintOnFirstPage(bool printOnFirstPage)
{
if (m_printOnFirstPage != printOnFirstPage){
if (m_printOnFirstPage != printOnFirstPage) {
bool oldValue = m_printOnFirstPage;
m_printOnFirstPage = printOnFirstPage;
update();
notify("printOnFirstPage",oldValue,printOnFirstPage);
notify("printOnFirstPage", oldValue, printOnFirstPage);
}
}
bool PageFooter::printOnLastPage() const
{
return m_printOnLastPage;
}
bool PageFooter::printOnLastPage() const { return m_printOnLastPage; }
void PageFooter::setPrintOnLastPage(bool printOnLastPage)
{
if (m_printOnLastPage != printOnLastPage){
if (m_printOnLastPage != printOnLastPage) {
bool oldValue = m_printOnLastPage;
m_printOnLastPage = printOnLastPage;
update();
notify("printOnLastPage",oldValue,printOnLastPage);
notify("printOnLastPage", oldValue, printOnLastPage);
}
}

View File

@@ -32,19 +32,19 @@
#include "lrbanddesignintf.h"
#include "lrbasedesignintf.h"
#include <QObject>
namespace LimeReport{
class PageFooter : public BandDesignIntf
{
namespace LimeReport {
class PageFooter: public BandDesignIntf {
Q_OBJECT
Q_PROPERTY(bool printOnFirstPage READ printOnFirstPage WRITE setPrintOnFirstPage)
Q_PROPERTY(bool printOnLastPage READ printOnLastPage WRITE setPrintOnLastPage)
Q_PROPERTY(bool removeGap READ removeGap WRITE setRemoveGap)
public:
PageFooter(QObject* owner = 0, QGraphicsItem* parent=0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
virtual bool isFooter() const {return true;}
PageFooter(QObject* owner = 0, QGraphicsItem* parent = 0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner = 0, QGraphicsItem* parent = 0);
virtual bool isFooter() const { return true; }
bool printOnLastPage() const;
void setPrintOnLastPage(bool printOnLastPage);
bool printOnFirstPage() const;
@@ -53,14 +53,15 @@ public:
void setRemoveGap(bool removeGap);
protected:
QColor bandColor() const;
void preparePopUpMenu(QMenu &menu);
void processPopUpAction(QAction *action);
QColor bandColor() const;
void preparePopUpMenu(QMenu& menu);
void processPopUpAction(QAction* action);
private:
bool m_printOnFirstPage;
bool m_printOnLastPage;
bool m_removeGap;
};
}
} // namespace LimeReport
#endif // LRPAGEFOOTER_H

View File

@@ -28,64 +28,54 @@
* GNU General Public License for more details. *
****************************************************************************/
#include "lrpageheader.h"
#include "lrdesignelementsfactory.h"
#include "lrbanddesignintf.h"
#include "lrbasedesignintf.h"
#include "lrpageitemdesignintf.h"
#include "lrdesignelementsfactory.h"
#include "lrglobal.h"
#include "lrpageitemdesignintf.h"
const QString xmlTag ="PageHeader";
const QString xmlTag = "PageHeader";
namespace{
namespace {
LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::PageHeader(owner,parent);
LimeReport::BaseDesignIntf* createBand(QObject* owner, LimeReport::BaseDesignIntf* parent)
{
return new LimeReport::PageHeader(owner, parent);
}
bool VARIABLE_IS_NOT_USED registred = LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTag,
LimeReport::ItemAttribs(QObject::tr("Page Header"),LimeReport::Const::bandTAG),
createBand
);
}
xmlTag, LimeReport::ItemAttribs(QObject::tr("Page Header"), LimeReport::Const::bandTAG),
createBand);
} // namespace
namespace LimeReport{
namespace LimeReport {
PageHeader::PageHeader(QObject* owner, QGraphicsItem *parent)
: BandDesignIntf(LimeReport::BandDesignIntf::PageHeader,xmlTag,owner,parent),
m_printOnFirstPage(true), m_printOnLastPage(true) {
PageHeader::PageHeader(QObject* owner, QGraphicsItem* parent):
BandDesignIntf(LimeReport::BandDesignIntf::PageHeader, xmlTag, owner, parent),
m_printOnFirstPage(true),
m_printOnLastPage(true)
{
setBandTypeText(tr("Page Header"));
setMarkerColor(bandColor());
}
BaseDesignIntf *PageHeader::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
BaseDesignIntf* PageHeader::createSameTypeItem(QObject* owner, QGraphicsItem* parent)
{
return new PageHeader(owner,parent);
return new PageHeader(owner, parent);
}
QColor PageHeader::bandColor() const
{
return QColor(246,120,12);
}
QColor PageHeader::bandColor() const { return QColor(246, 120, 12); }
bool PageHeader::printOnLastPage() const
{
return m_printOnLastPage;
}
bool PageHeader::printOnLastPage() const { return m_printOnLastPage; }
void PageHeader::setPrintOnLastPage(bool printOnLastPage)
{
m_printOnLastPage = printOnLastPage;
}
void PageHeader::setPrintOnLastPage(bool printOnLastPage) { m_printOnLastPage = printOnLastPage; }
bool PageHeader::printOnFirstPage() const
{
return m_printOnFirstPage;
}
bool PageHeader::printOnFirstPage() const { return m_printOnFirstPage; }
void PageHeader::setPrintOnFirstPage(bool printOnFirstPage)
{
m_printOnFirstPage = printOnFirstPage;
}
}
} // namespace LimeReport

View File

@@ -30,29 +30,31 @@
#ifndef LRPAGEHEADER_H
#define LRPAGEHEADER_H
#include <QObject>
#include "lrbanddesignintf.h"
#include "lrbasedesignintf.h"
#include <QObject>
namespace LimeReport {
class PageHeader : public LimeReport::BandDesignIntf
{
class PageHeader: public LimeReport::BandDesignIntf {
Q_OBJECT
Q_PROPERTY(bool printOnFirstPage READ printOnFirstPage WRITE setPrintOnFirstPage)
Q_PROPERTY(bool printOnLastPage READ printOnLastPage WRITE setPrintOnLastPage)
public:
PageHeader(QObject* owner = 0, QGraphicsItem* parent=0);
PageHeader(QObject* owner = 0, QGraphicsItem* parent = 0);
bool printOnFirstPage() const;
void setPrintOnFirstPage(bool printOnFirstPage);
bool printOnLastPage() const;
void setPrintOnLastPage(bool printOnLastPage);
bool isHeader() const{return true;}
bool isHeader() const { return true; }
protected:
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner = 0, QGraphicsItem* parent = 0);
QColor bandColor() const;
private:
bool m_printOnFirstPage;
bool m_printOnLastPage;
};
}
} // namespace LimeReport
#endif // LRPAGEHEADER_H

View File

@@ -28,44 +28,39 @@
* GNU General Public License for more details. *
****************************************************************************/
#include "lrreportfooter.h"
#include "lrdesignelementsfactory.h"
#include "lrglobal.h"
const QString xmlTag ="ReportFooter";
const QString xmlTag = "ReportFooter";
namespace{
namespace {
LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::ReportFooter(owner,parent);
LimeReport::BaseDesignIntf* createBand(QObject* owner, LimeReport::BaseDesignIntf* parent)
{
return new LimeReport::ReportFooter(owner, parent);
}
bool VARIABLE_IS_NOT_USED registred = LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTag,
LimeReport::ItemAttribs(QObject::tr("Report Footer"),LimeReport::Const::bandTAG),
createBand
);
}
xmlTag, LimeReport::ItemAttribs(QObject::tr("Report Footer"), LimeReport::Const::bandTAG),
createBand);
} // namespace
namespace LimeReport{
namespace LimeReport {
ReportFooter::ReportFooter(QObject *owner, QGraphicsItem *parent)
: BandDesignIntf(LimeReport::BandDesignIntf::ReportFooter,xmlTag,owner,parent) {
ReportFooter::ReportFooter(QObject* owner, QGraphicsItem* parent):
BandDesignIntf(LimeReport::BandDesignIntf::ReportFooter, xmlTag, owner, parent)
{
setBandTypeText(tr("Report Footer"));
setMarkerColor(bandColor());
}
BaseDesignIntf *ReportFooter::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
BaseDesignIntf* ReportFooter::createSameTypeItem(QObject* owner, QGraphicsItem* parent)
{
return new ReportFooter(owner,parent);
return new ReportFooter(owner, parent);
}
QColor ReportFooter::bandColor() const
{
return QColor(152,69,167);
}
QColor ReportFooter::bandColor() const { return QColor(152, 69, 167); }
bool ReportFooter::isFooter() const
{
return true;
}
bool ReportFooter::isFooter() const { return true; }
}
} // namespace LimeReport

View File

@@ -30,22 +30,23 @@
#ifndef LRREPORTFOOTER_H
#define LRREPORTFOOTER_H
#include <QObject>
#include "lrbanddesignintf.h"
#include "lrbasedesignintf.h"
namespace LimeReport{
class ReportFooter : public BandDesignIntf
{
#include <QObject>
namespace LimeReport {
class ReportFooter: public BandDesignIntf {
Q_OBJECT
Q_PROPERTY(int maxScalePercent READ maxScalePercent WRITE setMaxScalePercent)
Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable)
public:
ReportFooter(QObject* owner=0, QGraphicsItem* parent=0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
ReportFooter(QObject* owner = 0, QGraphicsItem* parent = 0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner = 0, QGraphicsItem* parent = 0);
protected:
QColor bandColor() const;
bool isFooter() const;
};
}
} // namespace LimeReport
#endif // LRREPORTFOOTER_H

View File

@@ -28,50 +28,45 @@
* GNU General Public License for more details. *
****************************************************************************/
#include "lrreportheader.h"
#include "lrdesignelementsfactory.h"
#include "lrglobal.h"
const QString xmlTag ="ReportHeader";
const QString xmlTag = "ReportHeader";
namespace{
LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::ReportHeader(owner,parent);
namespace {
LimeReport::BaseDesignIntf* createBand(QObject* owner, LimeReport::BaseDesignIntf* parent)
{
return new LimeReport::ReportHeader(owner, parent);
}
bool VARIABLE_IS_NOT_USED registred = LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTag,
LimeReport::ItemAttribs(QObject::tr("Report Header"),LimeReport::Const::bandTAG),
createBand
);
}
xmlTag, LimeReport::ItemAttribs(QObject::tr("Report Header"), LimeReport::Const::bandTAG),
createBand);
} // namespace
namespace LimeReport {
ReportHeader::ReportHeader(QObject *owner, QGraphicsItem *parent)
: BandDesignIntf(LimeReport::BandDesignIntf::ReportHeader,xmlTag,owner,parent), m_printBeforePageHeader(false) {
setBandTypeText(tr("Report Header"));
setMarkerColor(bandColor());
}
BaseDesignIntf *ReportHeader::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
ReportHeader::ReportHeader(QObject* owner, QGraphicsItem* parent):
BandDesignIntf(LimeReport::BandDesignIntf::ReportHeader, xmlTag, owner, parent),
m_printBeforePageHeader(false)
{
return new ReportHeader(owner,parent);
setBandTypeText(tr("Report Header"));
setMarkerColor(bandColor());
}
BaseDesignIntf* ReportHeader::createSameTypeItem(QObject* owner, QGraphicsItem* parent)
{
return new ReportHeader(owner, parent);
}
QColor ReportHeader::bandColor() const
{
return QColor(152,69,167);
}
QColor ReportHeader::bandColor() const { return QColor(152, 69, 167); }
bool ReportHeader::printBeforePageHeader() const
{
return m_printBeforePageHeader;
}
bool ReportHeader::printBeforePageHeader() const { return m_printBeforePageHeader; }
void ReportHeader::setPrintBeforePageHeader(bool printBeforePageHeader)
{
if (m_printBeforePageHeader != printBeforePageHeader){
if (m_printBeforePageHeader != printBeforePageHeader) {
m_printBeforePageHeader = printBeforePageHeader;
notify("printBeforePageHeader",!m_printBeforePageHeader,m_printBeforePageHeader);
notify("printBeforePageHeader", !m_printBeforePageHeader, m_printBeforePageHeader);
}
}
}
} // namespace LimeReport

View File

@@ -30,25 +30,26 @@
#ifndef LRREPORTHEADER_H
#define LRREPORTHEADER_H
#include <QObject>
#include "lrbanddesignintf.h"
#include "lrbasedesignintf.h"
namespace LimeReport{
class ReportHeader : public LimeReport::BandDesignIntf
{
#include <QObject>
namespace LimeReport {
class ReportHeader: public LimeReport::BandDesignIntf {
Q_OBJECT
Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable)
Q_PROPERTY(bool printBeforePageHeader READ printBeforePageHeader WRITE setPrintBeforePageHeader)
public:
ReportHeader(QObject* owner = 0, QGraphicsItem *parent=0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
ReportHeader(QObject* owner = 0, QGraphicsItem* parent = 0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner = 0, QGraphicsItem* parent = 0);
bool printBeforePageHeader() const;
void setPrintBeforePageHeader(bool printBeforePageHeader);
bool isHeader() const {return true;}
bool isHeader() const { return true; }
protected:
QColor bandColor() const;
bool m_printBeforePageHeader;
};
}
} // namespace LimeReport
#endif // LRREPORTHEADER_H

View File

@@ -28,55 +28,56 @@
* GNU General Public License for more details. *
****************************************************************************/
#include "lrsubdetailband.h"
#include "lrdesignelementsfactory.h"
#include "lrglobal.h"
const QString xmlTagBand = QLatin1String("SubDetail");
const QString xmlTagHeader = QLatin1String("SubDetailHeader");
const QString xmlTagFooter = QLatin1String("SubDetailFooter");
const QColor BAND_COLOR = Qt::red;
namespace{
namespace {
LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::SubDetailBand(owner,parent);
LimeReport::BaseDesignIntf* createBand(QObject* owner, LimeReport::BaseDesignIntf* parent)
{
return new LimeReport::SubDetailBand(owner, parent);
}
bool VARIABLE_IS_NOT_USED registred = LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTagBand,
LimeReport::ItemAttribs(QObject::tr("SubDetail"),LimeReport::Const::bandTAG),
createBand
);
xmlTagBand, LimeReport::ItemAttribs(QObject::tr("SubDetail"), LimeReport::Const::bandTAG),
createBand);
LimeReport::BaseDesignIntf * createHeader(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::SubDetailHeaderBand(owner,parent);
LimeReport::BaseDesignIntf* createHeader(QObject* owner, LimeReport::BaseDesignIntf* parent)
{
return new LimeReport::SubDetailHeaderBand(owner, parent);
}
bool VARIABLE_IS_NOT_USED registredHeader = LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTagHeader,
LimeReport::ItemAttribs(QObject::tr("SubDetailHeader"),LimeReport::Const::bandTAG),
createHeader
);
bool VARIABLE_IS_NOT_USED registredHeader
= LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTagHeader,
LimeReport::ItemAttribs(QObject::tr("SubDetailHeader"), LimeReport::Const::bandTAG),
createHeader);
LimeReport::BaseDesignIntf * createFooter(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::SubDetailFooterBand(owner,parent);
LimeReport::BaseDesignIntf* createFooter(QObject* owner, LimeReport::BaseDesignIntf* parent)
{
return new LimeReport::SubDetailFooterBand(owner, parent);
}
bool VARIABLE_IS_NOT_USED registredFooter = LimeReport::DesignElementsFactory::instance().registerCreator(
bool VARIABLE_IS_NOT_USED registredFooter
= LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTagFooter,
LimeReport::ItemAttribs(QObject::tr("SubDetailFooter"),LimeReport::Const::bandTAG),
createFooter
);
LimeReport::ItemAttribs(QObject::tr("SubDetailFooter"), LimeReport::Const::bandTAG),
createFooter);
} // namespace
namespace LimeReport{
namespace LimeReport {
//SubDetailBand
// SubDetailBand
SubDetailBand::SubDetailBand(QObject *owner, QGraphicsItem *parent)
: DataBandDesignIntf(BandDesignIntf::SubDetailBand, xmlTagBand, owner,parent)
SubDetailBand::SubDetailBand(QObject* owner, QGraphicsItem* parent):
DataBandDesignIntf(BandDesignIntf::SubDetailBand, xmlTagBand, owner, parent)
{
setBandTypeText(tr("SubDetail"));
setFixedPos(false);
@@ -93,62 +94,46 @@ bool SubDetailBand::isHasFooter() const
return isConnectedToBand(BandDesignIntf::SubDetailFooter);
}
BaseDesignIntf *SubDetailBand::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
BaseDesignIntf* SubDetailBand::createSameTypeItem(QObject* owner, QGraphicsItem* parent)
{
return new SubDetailBand(owner,parent);
return new SubDetailBand(owner, parent);
}
QColor SubDetailBand::bandColor() const
{
return BAND_COLOR;
}
QColor SubDetailBand::bandColor() const { return BAND_COLOR; }
//SubDetailHeaderBand
// SubDetailHeaderBand
SubDetailHeaderBand::SubDetailHeaderBand(QObject *owner, QGraphicsItem *parent)
:BandDesignIntf(BandDesignIntf::SubDetailHeader,xmlTagHeader,owner,parent)
SubDetailHeaderBand::SubDetailHeaderBand(QObject* owner, QGraphicsItem* parent):
BandDesignIntf(BandDesignIntf::SubDetailHeader, xmlTagHeader, owner, parent)
{
setBandTypeText(tr("SubDetailHeader"));
setMarkerColor(bandColor());
}
bool SubDetailHeaderBand::isUnique() const
bool SubDetailHeaderBand::isUnique() const { return false; }
QColor SubDetailHeaderBand::bandColor() const { return BAND_COLOR; }
BaseDesignIntf* SubDetailHeaderBand::createSameTypeItem(QObject* owner, QGraphicsItem* parent)
{
return false;
return new SubDetailHeaderBand(owner, parent);
}
QColor SubDetailHeaderBand::bandColor() const
{
return BAND_COLOR;
}
// SubDetailFooterBand
BaseDesignIntf *SubDetailHeaderBand::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
{
return new SubDetailHeaderBand(owner,parent);
}
//SubDetailFooterBand
SubDetailFooterBand::SubDetailFooterBand(QObject *owner, QGraphicsItem *parent)
: BandDesignIntf(BandDesignIntf::SubDetailFooter,xmlTagFooter,owner,parent)
SubDetailFooterBand::SubDetailFooterBand(QObject* owner, QGraphicsItem* parent):
BandDesignIntf(BandDesignIntf::SubDetailFooter, xmlTagFooter, owner, parent)
{
setMarkerColor(bandColor());
}
bool SubDetailFooterBand::isUnique() const
bool SubDetailFooterBand::isUnique() const { return false; }
QColor SubDetailFooterBand::bandColor() const { return BAND_COLOR; }
BaseDesignIntf* SubDetailFooterBand::createSameTypeItem(QObject* owner, QGraphicsItem* parent)
{
return false;
return new SubDetailFooterBand(owner, parent);
}
QColor SubDetailFooterBand::bandColor() const
{
return BAND_COLOR;
}
BaseDesignIntf *SubDetailFooterBand::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
{
return new SubDetailFooterBand(owner,parent);
}
}
} // namespace LimeReport

View File

@@ -33,64 +33,73 @@
#include "lrbanddesignintf.h"
#include "lrbasedesignintf.h"
namespace LimeReport{
namespace LimeReport {
class SubDetailBand : public DataBandDesignIntf
{
class SubDetailBand: public DataBandDesignIntf {
Q_OBJECT
Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable)
Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount)
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE
setColumnsFillDirection)
Q_PROPERTY(bool keepFooterTogether READ keepFooterTogether WRITE setKeepFooterTogether)
Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE setAlternateBackgroundColor)
Q_PROPERTY(bool useAlternateBackgroundColor READ useAlternateBackgroundColor WRITE setUseAlternateBackgroundColor)
Q_PROPERTY(QColor alternateBackgroundColor READ alternateBackgroundColor WRITE
setAlternateBackgroundColor)
Q_PROPERTY(bool useAlternateBackgroundColor READ useAlternateBackgroundColor WRITE
setUseAlternateBackgroundColor)
public:
SubDetailBand(QObject* owner = 0, QGraphicsItem* parent=0);
bool isUnique() const {return false;}
int bandNestingLevel(){ return 1;}
SubDetailBand(QObject* owner = 0, QGraphicsItem* parent = 0);
bool isUnique() const { return false; }
int bandNestingLevel() { return 1; }
bool isHasHeader() const;
bool isHasFooter() const;
private:
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner = 0, QGraphicsItem* parent = 0);
protected:
virtual QColor bandColor() const;
};
class SubDetailHeaderBand : public BandDesignIntf
{
class SubDetailHeaderBand: public BandDesignIntf {
Q_OBJECT
Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount)
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE
setColumnsFillDirection)
Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways)
public:
SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0);
SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent = 0);
bool isUnique() const;
bool isHeader() const {return true;}
int bandNestingLevel(){ return 1;}
bool isHeader() const { return true; }
int bandNestingLevel() { return 1; }
protected:
QColor bandColor() const;
private:
BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
BaseDesignIntf* createSameTypeItem(QObject* owner = 0, QGraphicsItem* parent = 0);
};
class SubDetailFooterBand : public BandDesignIntf
{
class SubDetailFooterBand: public BandDesignIntf {
Q_OBJECT
Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount)
Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable)
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE setColumnsFillDirection)
Q_PROPERTY(BandColumnsLayoutType columnsFillDirection READ columnsFillDirection WRITE
setColumnsFillDirection)
Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways)
public:
SubDetailFooterBand(QObject* owner = 0, QGraphicsItem* parent=0);
SubDetailFooterBand(QObject* owner = 0, QGraphicsItem* parent = 0);
virtual bool isUnique() const;
bool isFooter() const{return true;}
int bandNestingLevel(){ return 1;}
bool isFooter() const { return true; }
int bandNestingLevel() { return 1; }
protected:
QColor bandColor() const;
private:
BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
BaseDesignIntf* createSameTypeItem(QObject* owner = 0, QGraphicsItem* parent = 0);
private:
};
}
} // namespace LimeReport
#endif // LRSUBDETAILBAND_H

View File

@@ -1,37 +1,34 @@
#include "lrtearoffband.h"
#include "lrdesignelementsfactory.h"
#include "lrglobal.h"
const QString xmlTag ="TearOffBand";
const QString xmlTag = "TearOffBand";
namespace{
LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::TearOffBand(owner,parent);
namespace {
LimeReport::BaseDesignIntf* createBand(QObject* owner, LimeReport::BaseDesignIntf* parent)
{
return new LimeReport::TearOffBand(owner, parent);
}
bool VARIABLE_IS_NOT_USED registred = LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTag,
LimeReport::ItemAttribs(QObject::tr("Tear-off Band"),LimeReport::Const::bandTAG),
createBand
);
}
xmlTag, LimeReport::ItemAttribs(QObject::tr("Tear-off Band"), LimeReport::Const::bandTAG),
createBand);
} // namespace
namespace LimeReport{
namespace LimeReport {
TearOffBand::TearOffBand(QObject *owner, QGraphicsItem *parent)
:BandDesignIntf(LimeReport::BandDesignIntf::TearOffBand,xmlTag,owner,parent)
TearOffBand::TearOffBand(QObject* owner, QGraphicsItem* parent):
BandDesignIntf(LimeReport::BandDesignIntf::TearOffBand, xmlTag, owner, parent)
{
setBandTypeText(tr("Tear-off Band"));
setMarkerColor(bandColor());
}
BaseDesignIntf *TearOffBand::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
BaseDesignIntf* TearOffBand::createSameTypeItem(QObject* owner, QGraphicsItem* parent)
{
return new TearOffBand(owner,parent);
return new TearOffBand(owner, parent);
}
QColor TearOffBand::bandColor() const
{
return QColor(200,200,200);
}
QColor TearOffBand::bandColor() const { return QColor(200, 200, 200); }
} // namedpace LimeReport
} // namespace LimeReport

View File

@@ -4,16 +4,16 @@
namespace LimeReport {
class TearOffBand : public BandDesignIntf
{
class TearOffBand: public BandDesignIntf {
Q_OBJECT
public:
TearOffBand(QObject* owner = 0, QGraphicsItem *parent=0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
TearOffBand(QObject* owner = 0, QGraphicsItem* parent = 0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner = 0, QGraphicsItem* parent = 0);
protected:
QColor bandColor() const;
bool isUnique() const {return true;}
bool isFooter() const{ return true;}
bool isUnique() const { return true; }
bool isFooter() const { return true; }
};
} // namespace LimeReport