mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-24 00:33:02 +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:
parent
46e89b8e9d
commit
dc41959d52
@ -95,7 +95,7 @@ void GroupBandHeader::startGroup(DataSourceManager* dataManager)
|
|||||||
QString datasourceName = findDataSourceName(parentBand());
|
QString datasourceName = findDataSourceName(parentBand());
|
||||||
if (dataManager->containsDatasource(datasourceName)){
|
if (dataManager->containsDatasource(datasourceName)){
|
||||||
IDataSource* ds = dataManager->dataSource(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);
|
m_groupFieldValue=ds->data(m_groupFiledName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,8 +122,10 @@ bool GroupBandHeader::isNeedToClose(DataSourceManager* dataManager)
|
|||||||
QString datasourceName = findDataSourceName(parentBand());
|
QString datasourceName = findDataSourceName(parentBand());
|
||||||
if (dataManager->containsDatasource(datasourceName)){
|
if (dataManager->containsDatasource(datasourceName)){
|
||||||
IDataSource* ds = dataManager->dataSource(datasourceName);
|
IDataSource* ds = dataManager->dataSource(datasourceName);
|
||||||
if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false;
|
if (ds){
|
||||||
return ds->data(m_groupFiledName)!=m_groupFieldValue;
|
if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false;
|
||||||
|
return ds->data(m_groupFiledName)!=m_groupFieldValue;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dataManager->putError(tr("Datasource \"%1\" not found !!!").arg(datasourceName));
|
dataManager->putError(tr("Datasource \"%1\" not found !!!").arg(datasourceName));
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,9 @@ bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
|
|||||||
namespace LimeReport{
|
namespace LimeReport{
|
||||||
|
|
||||||
PageFooter::PageFooter(QObject *owner, QGraphicsItem *parent)
|
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") );
|
setBandTypeText( tr("Page Footer") );
|
||||||
setMarkerColor(bandColor());
|
setMarkerColor(bandColor());
|
||||||
}
|
}
|
||||||
@ -63,4 +65,24 @@ QColor PageFooter::bandColor() const
|
|||||||
return QColor(246,120,12);
|
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
|
} // namespace LimeReport
|
||||||
|
@ -38,12 +38,22 @@ namespace LimeReport{
|
|||||||
class PageFooter : public LimeReport::BandDesignIntf
|
class PageFooter : public LimeReport::BandDesignIntf
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(bool printOnFirstPage READ printOnFirstPage WRITE setPrintOnFirstPage)
|
||||||
|
Q_PROPERTY(bool printOnLastPage READ printOnLastPage WRITE setPrintOnLastPage)
|
||||||
public:
|
public:
|
||||||
PageFooter(QObject* owner = 0, QGraphicsItem* parent=0);
|
PageFooter(QObject* owner = 0, QGraphicsItem* parent=0);
|
||||||
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||||
virtual bool isFooter() const {return true;}
|
virtual bool isFooter() const {return true;}
|
||||||
|
bool printOnLastPage() const;
|
||||||
|
void setPrintOnLastPage(bool printOnLastPage);
|
||||||
|
bool printOnFirstPage() const;
|
||||||
|
void setPrintOnFirstPage(bool printOnFirstPage);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QColor bandColor() const;
|
QColor bandColor() const;
|
||||||
|
private:
|
||||||
|
bool m_printOnLastPage;
|
||||||
|
bool m_printOnFirstPage;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,8 @@ bool registred = LimeReport::DesignElementsFactory::instance().registerCreator(
|
|||||||
namespace LimeReport{
|
namespace LimeReport{
|
||||||
|
|
||||||
PageHeader::PageHeader(QObject* owner, QGraphicsItem *parent)
|
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"));
|
setBandTypeText(tr("Page Header"));
|
||||||
setMarkerColor(bandColor());
|
setMarkerColor(bandColor());
|
||||||
}
|
}
|
||||||
@ -67,4 +68,24 @@ QColor PageHeader::bandColor() const
|
|||||||
return QColor(246,120,12);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,11 +38,20 @@ namespace LimeReport {
|
|||||||
class PageHeader : public LimeReport::BandDesignIntf
|
class PageHeader : public LimeReport::BandDesignIntf
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(bool printOnFirstPage READ printOnFirstPage WRITE setPrintOnFirstPage)
|
||||||
|
Q_PROPERTY(bool printOnLastPage READ printOnLastPage WRITE setPrintOnLastPage)
|
||||||
public:
|
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);
|
||||||
protected:
|
protected:
|
||||||
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||||
QColor bandColor() const;
|
QColor bandColor() const;
|
||||||
|
private:
|
||||||
|
bool m_printOnFirstPage;
|
||||||
|
bool m_printOnLastPage;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // LRPAGEHEADER_H
|
#endif // LRPAGEHEADER_H
|
||||||
|
@ -41,6 +41,7 @@ class SubDetailBand : public DataBandDesignIntf
|
|||||||
Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable)
|
Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable)
|
||||||
Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount)
|
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)
|
||||||
public:
|
public:
|
||||||
SubDetailBand(QObject* owner = 0, QGraphicsItem* parent=0);
|
SubDetailBand(QObject* owner = 0, QGraphicsItem* parent=0);
|
||||||
bool isUnique() const {return false;}
|
bool isUnique() const {return false;}
|
||||||
@ -55,7 +56,7 @@ protected:
|
|||||||
class SubDetailHeaderBand : public BandDesignIntf
|
class SubDetailHeaderBand : public BandDesignIntf
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways())
|
Q_PROPERTY(bool printAlways READ printAlways WRITE setPrintAlways)
|
||||||
public:
|
public:
|
||||||
SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0);
|
SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0);
|
||||||
bool isUnique() const;
|
bool isUnique() const;
|
||||||
|
37
limereport/bands/lrtearoffband.cpp
Normal file
37
limereport/bands/lrtearoffband.cpp
Normal 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
|
20
limereport/bands/lrtearoffband.h
Normal file
20
limereport/bands/lrtearoffband.h
Normal 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
|
@ -19,6 +19,7 @@ SOURCES += \
|
|||||||
$$REPORT_PATH/bands/lrdataband.cpp \
|
$$REPORT_PATH/bands/lrdataband.cpp \
|
||||||
$$REPORT_PATH/bands/lrgroupbands.cpp \
|
$$REPORT_PATH/bands/lrgroupbands.cpp \
|
||||||
$$REPORT_PATH/bands/lrsubdetailband.cpp \
|
$$REPORT_PATH/bands/lrsubdetailband.cpp \
|
||||||
|
$$REPORT_PATH/bands/lrtearoffband.cpp \
|
||||||
$$REPORT_PATH/objectinspector/lrobjectinspectorwidget.cpp \
|
$$REPORT_PATH/objectinspector/lrobjectinspectorwidget.cpp \
|
||||||
$$REPORT_PATH/objectinspector/lrobjectitemmodel.cpp \
|
$$REPORT_PATH/objectinspector/lrobjectitemmodel.cpp \
|
||||||
$$REPORT_PATH/objectinspector/lrobjectpropitem.cpp \
|
$$REPORT_PATH/objectinspector/lrobjectpropitem.cpp \
|
||||||
@ -88,6 +89,7 @@ SOURCES += \
|
|||||||
$$REPORT_PATH/lrsimplecrypt.cpp \
|
$$REPORT_PATH/lrsimplecrypt.cpp \
|
||||||
$$REPORT_PATH/lraboutdialog.cpp \
|
$$REPORT_PATH/lraboutdialog.cpp \
|
||||||
$$REPORT_PATH/lrsettingdialog.cpp
|
$$REPORT_PATH/lrsettingdialog.cpp
|
||||||
|
|
||||||
|
|
||||||
contains(CONFIG, zint){
|
contains(CONFIG, zint){
|
||||||
SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp
|
SOURCES += $$REPORT_PATH/items/lrbarcodeitem.cpp
|
||||||
@ -100,6 +102,7 @@ HEADERS += \
|
|||||||
$$REPORT_PATH/bands/lrreportheader.h \
|
$$REPORT_PATH/bands/lrreportheader.h \
|
||||||
$$REPORT_PATH/bands/lrreportfooter.h \
|
$$REPORT_PATH/bands/lrreportfooter.h \
|
||||||
$$REPORT_PATH/bands/lrdataband.h \
|
$$REPORT_PATH/bands/lrdataband.h \
|
||||||
|
$$REPORT_PATH/bands/lrtearoffband.h \
|
||||||
$$REPORT_PATH/objectinspector/lrobjectinspectorwidget.h \
|
$$REPORT_PATH/objectinspector/lrobjectinspectorwidget.h \
|
||||||
$$REPORT_PATH/objectinspector/lrobjectitemmodel.h \
|
$$REPORT_PATH/objectinspector/lrobjectitemmodel.h \
|
||||||
$$REPORT_PATH/objectinspector/lrobjectpropitem.h \
|
$$REPORT_PATH/objectinspector/lrobjectpropitem.h \
|
||||||
@ -160,6 +163,7 @@ HEADERS += \
|
|||||||
$$REPORT_PATH/lrreportrender.h \
|
$$REPORT_PATH/lrreportrender.h \
|
||||||
$$REPORT_PATH/lrpreviewreportwindow.h \
|
$$REPORT_PATH/lrpreviewreportwindow.h \
|
||||||
$$REPORT_PATH/lrpreviewreportwidget.h \
|
$$REPORT_PATH/lrpreviewreportwidget.h \
|
||||||
|
$$REPORT_PATH/lrpreviewreportwidget_p.h \
|
||||||
$$REPORT_PATH/lrgraphicsviewzoom.h \
|
$$REPORT_PATH/lrgraphicsviewzoom.h \
|
||||||
$$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.h \
|
$$REPORT_PATH/objectinspector/propertyItems/lrfontpropitem.h \
|
||||||
$$REPORT_PATH/objectinspector/editors/lrfonteditor.h \
|
$$REPORT_PATH/objectinspector/editors/lrfonteditor.h \
|
||||||
@ -182,9 +186,8 @@ HEADERS += \
|
|||||||
$$REPORT_PATH/lrsimplecrypt.h \
|
$$REPORT_PATH/lrsimplecrypt.h \
|
||||||
$$REPORT_PATH/lraboutdialog.h \
|
$$REPORT_PATH/lraboutdialog.h \
|
||||||
$$REPORT_PATH/lrcallbackdatasourceintf.h \
|
$$REPORT_PATH/lrcallbackdatasourceintf.h \
|
||||||
$$REPORT_PATH/lrsettingdialog.h \
|
$$REPORT_PATH/lrsettingdialog.h
|
||||||
$$PWD/lrpreviewreportwidget_p.h
|
|
||||||
|
|
||||||
contains(CONFIG,zint){
|
contains(CONFIG,zint){
|
||||||
HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h
|
HEADERS += $$REPORT_PATH/items/lrbarcodeitem.h
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,8 @@ public:
|
|||||||
GroupFooter=8,
|
GroupFooter=8,
|
||||||
DataFooter=9,
|
DataFooter=9,
|
||||||
ReportFooter=10,
|
ReportFooter=10,
|
||||||
PageFooter=11
|
TearOffBand=11,
|
||||||
|
PageFooter=12
|
||||||
};
|
};
|
||||||
|
|
||||||
enum BandColumnsLayoutType{
|
enum BandColumnsLayoutType{
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "lrdataband.h"
|
#include "lrdataband.h"
|
||||||
#include "lrsubdetailband.h"
|
#include "lrsubdetailband.h"
|
||||||
#include "lrgroupbands.h"
|
#include "lrgroupbands.h"
|
||||||
|
#include "lrtearoffband.h"
|
||||||
|
|
||||||
namespace LimeReport{
|
namespace LimeReport{
|
||||||
|
|
||||||
@ -90,6 +91,8 @@ BandDesignIntf *BandsManager::createBand(BandDesignIntf::BandsType bandType, QOb
|
|||||||
return new DataHeaderBand(owner, parent);
|
return new DataHeaderBand(owner, parent);
|
||||||
case BandDesignIntf::DataFooter:
|
case BandDesignIntf::DataFooter:
|
||||||
return new DataFooterBand(owner, parent);
|
return new DataFooterBand(owner, parent);
|
||||||
|
case BandDesignIntf::TearOffBand:
|
||||||
|
return new TearOffBand(owner, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -336,14 +336,26 @@ void PageItemDesignIntf::relocateBands()
|
|||||||
|
|
||||||
qSort(m_bands.begin(),m_bands.end(),bandSortBandLessThenByIndex);
|
qSort(m_bands.begin(),m_bands.end(),bandSortBandLessThenByIndex);
|
||||||
|
|
||||||
if (m_bands.count()>0) {
|
int bandIndex = 0;
|
||||||
initColumnsPos(posByColumn,pageRect().y(),m_bands[0]->columnsCount());
|
if (!(itemMode() & DesignMode)){
|
||||||
m_bands[0]->setPos(pageRect().x(),pageRect().y());
|
while ( (bandIndex < m_bands.count()) &&
|
||||||
posByColumn[0]+=m_bands[0]->height()+bandSpace;
|
((m_bands[bandIndex]->bandType() == BandDesignIntf::TearOffBand) ||
|
||||||
|
(m_bands[bandIndex]->bandType() == BandDesignIntf::PageFooter))
|
||||||
|
){
|
||||||
|
bandIndex++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( (m_bands.count()>0) && (bandIndex<m_bands.count()) ) {
|
||||||
|
initColumnsPos(posByColumn,pageRect().y(),m_bands[bandIndex]->columnsCount());
|
||||||
|
m_bands[bandIndex]->setPos(pageRect().x(),pageRect().y());
|
||||||
|
posByColumn[0]+=m_bands[bandIndex]->height()+bandSpace;
|
||||||
|
}
|
||||||
|
|
||||||
if(m_bands.count()>1){
|
if(m_bands.count()>1){
|
||||||
for(int i=0;i<(m_bands.count()-1);i++){
|
for(int i=0;i<(m_bands.count()-1);i++){
|
||||||
if ((m_bands[i+1]->bandType()!=BandDesignIntf::PageFooter) || (itemMode() & DesignMode)){
|
if (((m_bands[i+1]->bandType()!=BandDesignIntf::PageFooter) &&
|
||||||
|
(m_bands[i+1]->bandType()!=BandDesignIntf::TearOffBand)) || (itemMode() & DesignMode)){
|
||||||
if (m_bands[i+1]->columnsCount()>1 &&
|
if (m_bands[i+1]->columnsCount()>1 &&
|
||||||
m_bands[i]->columnsCount() != m_bands[i+1]->columnsCount())
|
m_bands[i]->columnsCount() != m_bands[i+1]->columnsCount())
|
||||||
{
|
{
|
||||||
|
@ -164,7 +164,7 @@ QSettings*PreviewReportWindow::settings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewReportWindow::setReportReader(ItemsReaderIntf::Ptr reader)
|
void PreviewReportWindow::setReportReader(ItemsReaderIntf::Ptr /*reader*/)
|
||||||
{
|
{
|
||||||
// m_reader=reader;
|
// m_reader=reader;
|
||||||
// if (!reader.isNull()){
|
// if (!reader.isNull()){
|
||||||
|
@ -390,6 +390,11 @@ void ReportDesignWindow::createBandsButton()
|
|||||||
m_bandsAddSignalsMap->setMapping(m_newGroupFooter,BandDesignIntf::GroupFooter);
|
m_bandsAddSignalsMap->setMapping(m_newGroupFooter,BandDesignIntf::GroupFooter);
|
||||||
m_newBandButton->addAction(m_newGroupFooter);
|
m_newBandButton->addAction(m_newGroupFooter);
|
||||||
|
|
||||||
|
m_newTearOffBand=new QAction(QIcon(),tr("Tear-off Band"),this);
|
||||||
|
connect(m_newTearOffBand,SIGNAL(triggered()),m_bandsAddSignalsMap,SLOT(map()));
|
||||||
|
m_bandsAddSignalsMap->setMapping(m_newTearOffBand,BandDesignIntf::TearOffBand);
|
||||||
|
m_newBandButton->addAction(m_newTearOffBand);
|
||||||
|
|
||||||
connect(m_bandsAddSignalsMap,SIGNAL(mapped(int)),this,SLOT(slotNewBand(int)));
|
connect(m_bandsAddSignalsMap,SIGNAL(mapped(int)),this,SLOT(slotNewBand(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -983,6 +988,8 @@ void ReportDesignWindow::slotBandAdded(PageDesignIntf *, BandDesignIntf * band)
|
|||||||
break;
|
break;
|
||||||
case BandDesignIntf::ReportFooter:
|
case BandDesignIntf::ReportFooter:
|
||||||
m_newReportFooter->setDisabled(true);
|
m_newReportFooter->setDisabled(true);
|
||||||
|
case BandDesignIntf::TearOffBand:
|
||||||
|
m_newTearOffBand->setDisabled(true);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1004,6 +1011,8 @@ void ReportDesignWindow::slotBandDeleted(PageDesignIntf *, BandDesignIntf *band)
|
|||||||
break;
|
break;
|
||||||
case BandDesignIntf::ReportFooter:
|
case BandDesignIntf::ReportFooter:
|
||||||
m_newReportFooter->setEnabled(true);
|
m_newReportFooter->setEnabled(true);
|
||||||
|
case BandDesignIntf::TearOffBand:
|
||||||
|
m_newTearOffBand->setEnabled(true);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -187,6 +187,7 @@ private:
|
|||||||
QAction* m_newSubDetailFooter;
|
QAction* m_newSubDetailFooter;
|
||||||
QAction* m_newGroupHeader;
|
QAction* m_newGroupHeader;
|
||||||
QAction* m_newGroupFooter;
|
QAction* m_newGroupFooter;
|
||||||
|
QAction* m_newTearOffBand;
|
||||||
QAction* m_aboutAction;
|
QAction* m_aboutAction;
|
||||||
QAction* m_editLayoutMode;
|
QAction* m_editLayoutMode;
|
||||||
QAction* m_addHLayout;
|
QAction* m_addHLayout;
|
||||||
|
@ -170,8 +170,11 @@ void ReportRender::initDatasources(){
|
|||||||
|
|
||||||
void ReportRender::initDatasource(const QString& name){
|
void ReportRender::initDatasource(const QString& name){
|
||||||
try{
|
try{
|
||||||
if (datasources()->containsDatasource(name))
|
if (datasources()->containsDatasource(name)){
|
||||||
datasources()->dataSource(name)->first();
|
IDataSource* ds = datasources()->dataSource(name);
|
||||||
|
if (ds)
|
||||||
|
ds->first();
|
||||||
|
}
|
||||||
} catch(ReportError &exception){
|
} catch(ReportError &exception){
|
||||||
QMessageBox::critical(0,tr("Error"),exception.what());
|
QMessageBox::critical(0,tr("Error"),exception.what());
|
||||||
return;
|
return;
|
||||||
@ -211,7 +214,11 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
|
|||||||
if (lastRenderedBand && lastRenderedBand->keepFooterTogether())
|
if (lastRenderedBand && lastRenderedBand->keepFooterTogether())
|
||||||
closeFooterGroup(lastRenderedBand);
|
closeFooterGroup(lastRenderedBand);
|
||||||
|
|
||||||
savePage();
|
BandDesignIntf* tearOffBand = m_patternPageItem->bandByType(BandDesignIntf::TearOffBand);
|
||||||
|
if (tearOffBand)
|
||||||
|
renderBand(tearOffBand,StartNewPageAsNeeded);
|
||||||
|
|
||||||
|
savePage(true);
|
||||||
if (!m_renderCanceled)
|
if (!m_renderCanceled)
|
||||||
secondRenderPass();
|
secondRenderPass();
|
||||||
}
|
}
|
||||||
@ -461,7 +468,12 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand)
|
|||||||
void ReportRender::renderPageHeader(PageItemDesignIntf *patternPage)
|
void ReportRender::renderPageHeader(PageItemDesignIntf *patternPage)
|
||||||
{
|
{
|
||||||
BandDesignIntf* band = patternPage->bandByType(BandDesignIntf::PageHeader);
|
BandDesignIntf* band = patternPage->bandByType(BandDesignIntf::PageHeader);
|
||||||
if (band) renderBand(band);
|
if (band){
|
||||||
|
if (m_datasources->variable("#PAGE").toInt()!=1 ||
|
||||||
|
band->property("printOnFirstPage").toBool()
|
||||||
|
)
|
||||||
|
renderBand(band);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportRender::renderPageFooter(PageItemDesignIntf *patternPage)
|
void ReportRender::renderPageFooter(PageItemDesignIntf *patternPage)
|
||||||
@ -497,7 +509,10 @@ qreal ReportRender::calcPageFooterHeight(PageItemDesignIntf *patternPage)
|
|||||||
{
|
{
|
||||||
BandDesignIntf* band = patternPage->bandByType(BandDesignIntf::PageFooter);
|
BandDesignIntf* band = patternPage->bandByType(BandDesignIntf::PageFooter);
|
||||||
if (band){
|
if (band){
|
||||||
return band->height();
|
if (m_datasources->variable("#PAGE")!=1)
|
||||||
|
return band->height();
|
||||||
|
else if (band->property("printOnFirstPage").toBool())
|
||||||
|
return band->height();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -988,10 +1003,12 @@ void ReportRender::checkLostHeadersOnPrevPage()
|
|||||||
QMutableListIterator<BandDesignIntf*>it(page->bands());
|
QMutableListIterator<BandDesignIntf*>it(page->bands());
|
||||||
|
|
||||||
it.toBack();
|
it.toBack();
|
||||||
if (it.hasPrevious())
|
if (it.hasPrevious()){
|
||||||
if (it.previous()->isFooter())
|
if (it.previous()->isFooter()){
|
||||||
if (it.hasPrevious()) it.previous();
|
if (it.hasPrevious()) it.previous();
|
||||||
else return;
|
else return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (it.hasPrevious()){
|
while (it.hasPrevious()){
|
||||||
if (it.value()->isHeader()){
|
if (it.value()->isHeader()){
|
||||||
@ -1022,13 +1039,36 @@ BandDesignIntf* ReportRender::findEnclosingGroup()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportRender::savePage()
|
void ReportRender::moveTearOffBand(){
|
||||||
|
BandDesignIntf* tearOffBand = m_renderPageItem->bandByType(BandDesignIntf::TearOffBand);
|
||||||
|
if (tearOffBand){
|
||||||
|
BandDesignIntf* pageFooter = m_renderPageItem->bandByType(BandDesignIntf::PageFooter);
|
||||||
|
if (pageFooter){
|
||||||
|
tearOffBand->setItemPos(m_patternPageItem->pageRect().x(),
|
||||||
|
m_patternPageItem->pageRect().bottom()-(tearOffBand->height()+pageFooter->height()));
|
||||||
|
} else {
|
||||||
|
tearOffBand->setItemPos(m_patternPageItem->pageRect().x(),m_patternPageItem->pageRect().bottom()-tearOffBand->height());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReportRender::savePage(bool isLast)
|
||||||
{
|
{
|
||||||
checkFooterGroup(m_lastDataBand);
|
checkFooterGroup(m_lastDataBand);
|
||||||
cutGroups();
|
cutGroups();
|
||||||
rearrangeColumnsItems();
|
rearrangeColumnsItems();
|
||||||
m_columnedBandItems.clear();
|
m_columnedBandItems.clear();
|
||||||
renderPageFooter(m_patternPageItem);
|
|
||||||
|
BandDesignIntf* pf = m_patternPageItem->bandByType(BandDesignIntf::PageFooter);
|
||||||
|
if (pf && m_datasources->variable("#PAGE").toInt()!=1 && !isLast){
|
||||||
|
renderPageFooter(m_patternPageItem);
|
||||||
|
} else {
|
||||||
|
if (pf && pf->property("printOnFirstPage").toBool() && m_datasources->variable("#PAGE").toInt()==1){
|
||||||
|
renderPageFooter(m_patternPageItem);
|
||||||
|
} else if(pf && pf->property("printOnLastPage").toBool() && isLast){
|
||||||
|
renderPageFooter(m_patternPageItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_ranges.last().lastPage==0 && m_ranges.count()>1) {
|
if (m_ranges.last().lastPage==0 && m_ranges.count()>1) {
|
||||||
m_datasources->setReportVariable("#PAGE",1);
|
m_datasources->setReportVariable("#PAGE",1);
|
||||||
@ -1043,6 +1083,15 @@ void ReportRender::savePage()
|
|||||||
m_renderedPages.append(PageItemDesignIntf::Ptr(m_renderPageItem));
|
m_renderedPages.append(PageItemDesignIntf::Ptr(m_renderPageItem));
|
||||||
emit pageRendered(m_pageCount);
|
emit pageRendered(m_pageCount);
|
||||||
m_pageCount++;
|
m_pageCount++;
|
||||||
|
|
||||||
|
if (isLast){
|
||||||
|
BandDesignIntf* ph = m_renderPageItem->bandByType(BandDesignIntf::PageHeader);
|
||||||
|
if (ph && !ph->property("printOnLastPage").toBool()){
|
||||||
|
delete ph;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
moveTearOffBand();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ReportRender::toString()
|
QString ReportRender::toString()
|
||||||
|
@ -93,6 +93,7 @@ private:
|
|||||||
void renderDataBand(BandDesignIntf* dataBand);
|
void renderDataBand(BandDesignIntf* dataBand);
|
||||||
void renderPageHeader(PageItemDesignIntf* patternPage);
|
void renderPageHeader(PageItemDesignIntf* patternPage);
|
||||||
void renderPageFooter(PageItemDesignIntf* patternPage);
|
void renderPageFooter(PageItemDesignIntf* patternPage);
|
||||||
|
void moveTearOffBand();
|
||||||
void renderPageItems(PageItemDesignIntf* patternPage);
|
void renderPageItems(PageItemDesignIntf* patternPage);
|
||||||
qreal calcPageFooterHeight(PageItemDesignIntf* patternPage);
|
qreal calcPageFooterHeight(PageItemDesignIntf* patternPage);
|
||||||
qreal calcSlicePercent(qreal height);
|
qreal calcSlicePercent(qreal height);
|
||||||
@ -130,7 +131,7 @@ private:
|
|||||||
void startNewPage();
|
void startNewPage();
|
||||||
void resetPageNumber();
|
void resetPageNumber();
|
||||||
int findLastPageNumber(int currentPage);
|
int findLastPageNumber(int currentPage);
|
||||||
void savePage();
|
void savePage(bool isLast = false);
|
||||||
QString toString();
|
QString toString();
|
||||||
void initColumns();
|
void initColumns();
|
||||||
bool isNeedToRearrangeColumnsItems();
|
bool isNeedToRearrangeColumnsItems();
|
||||||
@ -171,6 +172,7 @@ private:
|
|||||||
QVector<BandDesignIntf*> m_columnedBandItems;
|
QVector<BandDesignIntf*> m_columnedBandItems;
|
||||||
unsigned long long m_curentNameIndex;
|
unsigned long long m_curentNameIndex;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace LimeReport
|
} // namespace LimeReport
|
||||||
#endif // LRREPORTRENDER_H
|
#endif // LRREPORTRENDER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user