0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-09-23 08:29:07 +03:00

Tear-off band has been added

Tear-off band has been added

Tear-off band has been added
This commit is contained in:
Arin Alexander
2016-10-04 04:21:22 +04:00
parent 46e89b8e9d
commit dc41959d52
17 changed files with 228 additions and 26 deletions

View File

@@ -95,7 +95,7 @@ void GroupBandHeader::startGroup(DataSourceManager* dataManager)
QString datasourceName = findDataSourceName(parentBand());
if (dataManager->containsDatasource(datasourceName)){
IDataSource* ds = dataManager->dataSource(datasourceName);
if (ds->columnIndexByName(m_groupFiledName)!=-1)
if (ds && ds->columnIndexByName(m_groupFiledName)!=-1)
m_groupFieldValue=ds->data(m_groupFiledName);
}
}
@@ -122,8 +122,10 @@ bool GroupBandHeader::isNeedToClose(DataSourceManager* dataManager)
QString datasourceName = findDataSourceName(parentBand());
if (dataManager->containsDatasource(datasourceName)){
IDataSource* ds = dataManager->dataSource(datasourceName);
if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false;
return ds->data(m_groupFiledName)!=m_groupFieldValue;
if (ds){
if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false;
return ds->data(m_groupFiledName)!=m_groupFieldValue;
}
} else {
dataManager->putError(tr("Datasource \"%1\" not found !!!").arg(datasourceName));
}

View File

@@ -48,7 +48,9 @@ bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
namespace LimeReport{
PageFooter::PageFooter(QObject *owner, QGraphicsItem *parent)
: BandDesignIntf(LimeReport::BandDesignIntf::PageFooter,xmlTag,owner,parent) {
: BandDesignIntf(LimeReport::BandDesignIntf::PageFooter,xmlTag,owner,parent),
m_printOnFirstPage(true), m_printOnLastPage(true)
{
setBandTypeText( tr("Page Footer") );
setMarkerColor(bandColor());
}
@@ -63,4 +65,24 @@ QColor PageFooter::bandColor() const
return QColor(246,120,12);
}
bool PageFooter::printOnFirstPage() const
{
return m_printOnFirstPage;
}
void PageFooter::setPrintOnFirstPage(bool printOnFirstPage)
{
m_printOnFirstPage = printOnFirstPage;
}
bool PageFooter::printOnLastPage() const
{
return m_printOnLastPage;
}
void PageFooter::setPrintOnLastPage(bool printOnLastPage)
{
m_printOnLastPage = printOnLastPage;
}
} // namespace LimeReport

View File

@@ -38,12 +38,22 @@ namespace LimeReport{
class PageFooter : public LimeReport::BandDesignIntf
{
Q_OBJECT
Q_PROPERTY(bool printOnFirstPage READ printOnFirstPage WRITE setPrintOnFirstPage)
Q_PROPERTY(bool printOnLastPage READ printOnLastPage WRITE setPrintOnLastPage)
public:
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;
void setPrintOnFirstPage(bool printOnFirstPage);
protected:
QColor bandColor() const;
private:
bool m_printOnLastPage;
bool m_printOnFirstPage;
};
}

View File

@@ -52,7 +52,8 @@ bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
namespace LimeReport{
PageHeader::PageHeader(QObject* owner, QGraphicsItem *parent)
: BandDesignIntf(LimeReport::BandDesignIntf::PageHeader,xmlTag,owner,parent) {
: BandDesignIntf(LimeReport::BandDesignIntf::PageHeader,xmlTag,owner,parent),
m_printOnFirstPage(true), m_printOnLastPage(true) {
setBandTypeText(tr("Page Header"));
setMarkerColor(bandColor());
}
@@ -67,4 +68,24 @@ QColor PageHeader::bandColor() const
return QColor(246,120,12);
}
bool PageHeader::printOnLastPage() const
{
return m_printOnLastPage;
}
void PageHeader::setPrintOnLastPage(bool printOnLastPage)
{
m_printOnLastPage = printOnLastPage;
}
bool PageHeader::printOnFirstPage() const
{
return m_printOnFirstPage;
}
void PageHeader::setPrintOnFirstPage(bool printOnFirstPage)
{
m_printOnFirstPage = printOnFirstPage;
}
}

View File

@@ -38,11 +38,20 @@ namespace LimeReport {
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);
bool printOnFirstPage() const;
void setPrintOnFirstPage(bool printOnFirstPage);
bool printOnLastPage() const;
void setPrintOnLastPage(bool printOnLastPage);
protected:
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
QColor bandColor() const;
private:
bool m_printOnFirstPage;
bool m_printOnLastPage;
};
}
#endif // LRPAGEHEADER_H

View File

@@ -41,6 +41,7 @@ class SubDetailBand : public DataBandDesignIntf
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(bool keepFooterTogether READ keepFooterTogether WRITE setKeepFooterTogether)
public:
SubDetailBand(QObject* owner = 0, QGraphicsItem* parent=0);
bool isUnique() const {return false;}
@@ -55,7 +56,7 @@ protected:
class SubDetailHeaderBand : public BandDesignIntf
{
Q_OBJECT
Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways())
Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways)
public:
SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0);
bool isUnique() const;

View File

@@ -0,0 +1,37 @@
#include "lrtearoffband.h"
#include "lrdesignelementsfactory.h"
#include "lrglobal.h"
const QString xmlTag ="TearOffBand";
namespace{
LimeReport::BaseDesignIntf * createBand(QObject* owner, LimeReport::BaseDesignIntf* parent){
return new LimeReport::TearOffBand(owner,parent);
}
bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
xmlTag,
LimeReport::ItemAttribs(QObject::tr("Tear-off Band"),LimeReport::Const::bandTAG),
createBand
);
}
namespace LimeReport{
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)
{
return new TearOffBand(owner,parent);
}
QColor TearOffBand::bandColor() const
{
return QColor(200,200,200);
}
} // namedpace LimeReport

View File

@@ -0,0 +1,20 @@
#ifndef TEAROFFBAND_H
#define TEAROFFBAND_H
#include "lrbanddesignintf.h"
namespace LimeReport {
class TearOffBand : public BandDesignIntf
{
Q_OBJECT
public:
TearOffBand(QObject* owner = 0, QGraphicsItem *parent=0);
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
protected:
QColor bandColor() const;
bool isUnique(){ return true;}
};
} // namespace LimeReport
#endif // TEAROFFBAND_H