mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-24 08:34:38 +03:00
printBeforePageHeader property has been added to "ReportHeader" band
This commit is contained in:
parent
1cb6c1f02e
commit
0505801e3a
@ -46,7 +46,7 @@ bool VARIABLE_IS_NOT_USED registred = LimeReport::DesignElementsFactory::instanc
|
||||
namespace LimeReport {
|
||||
|
||||
ReportHeader::ReportHeader(QObject *owner, QGraphicsItem *parent)
|
||||
: BandDesignIntf(LimeReport::BandDesignIntf::ReportHeader,xmlTag,owner,parent) {
|
||||
: BandDesignIntf(LimeReport::BandDesignIntf::ReportHeader,xmlTag,owner,parent), m_printBeforePageHeader(false) {
|
||||
setBandTypeText(tr("Report Header"));
|
||||
setMarkerColor(bandColor());
|
||||
}
|
||||
@ -60,5 +60,18 @@ QColor ReportHeader::bandColor() const
|
||||
return QColor(152,69,167);
|
||||
}
|
||||
|
||||
bool ReportHeader::printBeforePageHeader() const
|
||||
{
|
||||
return m_printBeforePageHeader;
|
||||
}
|
||||
|
||||
void ReportHeader::setPrintBeforePageHeader(bool printBeforePageHeader)
|
||||
{
|
||||
if (m_printBeforePageHeader != printBeforePageHeader){
|
||||
m_printBeforePageHeader = printBeforePageHeader;
|
||||
notify("printBeforePageHeader",!m_printBeforePageHeader,m_printBeforePageHeader);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -39,11 +39,15 @@ 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);
|
||||
bool printBeforePageHeader() const;
|
||||
void setPrintBeforePageHeader(bool printBeforePageHeader);
|
||||
protected:
|
||||
QColor bandColor() const;
|
||||
bool m_printBeforePageHeader;
|
||||
};
|
||||
}
|
||||
#endif // LRREPORTHEADER_H
|
||||
|
@ -257,11 +257,12 @@ void ReportRender::renderPage(PageDesignIntf* patternPage)
|
||||
}
|
||||
|
||||
clearPageMap();
|
||||
startNewPage();
|
||||
startNewPage(true);
|
||||
|
||||
|
||||
renderReportHeader(m_patternPageItem, AfterPageHeader);
|
||||
|
||||
renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader), 0, StartNewPageAsNeeded);
|
||||
// renderBand(m_patternPageItem->bandByType(BandDesignIntf::ReportHeader), 0, StartNewPageAsNeeded);
|
||||
|
||||
BandDesignIntf* lastRenderedBand = 0;
|
||||
for (int i=0;i<m_patternPageItem->dataBandCount() && !m_renderCanceled;i++){
|
||||
@ -605,6 +606,17 @@ void ReportRender::renderPageHeader(PageItemDesignIntf *patternPage)
|
||||
}
|
||||
}
|
||||
|
||||
void ReportRender::renderReportHeader(PageItemDesignIntf *patternPage, PageRenderStage stage)
|
||||
{
|
||||
BandDesignIntf* band = patternPage->bandByType(BandDesignIntf::ReportHeader);
|
||||
if (band){
|
||||
if (band->property("printBeforePageHeader").toBool() && stage == BeforePageHeader )
|
||||
renderBand(band, 0, StartNewPageAsNeeded);
|
||||
if (!band->property("printBeforePageHeader").toBool() && stage == AfterPageHeader )
|
||||
renderBand(band, 0, StartNewPageAsNeeded);
|
||||
}
|
||||
}
|
||||
|
||||
void ReportRender::renderPageFooter(PageItemDesignIntf *patternPage)
|
||||
{
|
||||
BandDesignIntf* band = patternPage->bandByType(BandDesignIntf::PageFooter);
|
||||
@ -897,7 +909,7 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren)
|
||||
|
||||
}
|
||||
|
||||
if (band->height()<=m_maxHeightByColumn[m_currentColumn]){
|
||||
if (band->height() <= m_maxHeightByColumn[m_currentColumn]){
|
||||
|
||||
if (band->bandType()==BandDesignIntf::PageFooter){
|
||||
for (int i=0;i<m_maxHeightByColumn.size();++i)
|
||||
@ -1061,7 +1073,7 @@ void ReportRender::startNewColumn(){
|
||||
}
|
||||
}
|
||||
|
||||
void ReportRender::startNewPage()
|
||||
void ReportRender::startNewPage(bool isFirst)
|
||||
{
|
||||
m_renderPageItem=0;
|
||||
m_currentColumn=0;
|
||||
@ -1078,6 +1090,7 @@ void ReportRender::startNewPage()
|
||||
|
||||
emit m_patternPageItem->beforeRender();
|
||||
|
||||
if (isFirst) renderReportHeader(m_patternPageItem, BeforePageHeader);
|
||||
renderPageHeader(m_patternPageItem);
|
||||
|
||||
m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem);
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
enum DataRenderMode {StartNewPageAsNeeded, NotStartNewPage, ForcedStartPage};
|
||||
enum BandPrintMode {PrintAlwaysPrintable, PrintNotAlwaysPrintable };
|
||||
enum ResetPageNuberType{BandReset, PageReset};
|
||||
enum PageRenderStage{BeforePageHeader, AfterPageHeader};
|
||||
typedef QSharedPointer<ReportRender> Ptr;
|
||||
~ReportRender();
|
||||
ReportRender(QObject *parent = 0);
|
||||
@ -102,6 +103,7 @@ private:
|
||||
BandDesignIntf* renderBand(BandDesignIntf *patternBand, BandDesignIntf *bandData, DataRenderMode mode = NotStartNewPage, bool isLast = false);
|
||||
void renderDataBand(BandDesignIntf* dataBand);
|
||||
void renderPageHeader(PageItemDesignIntf* patternPage);
|
||||
void renderReportHeader(PageItemDesignIntf* patternPage, PageRenderStage stage);
|
||||
void renderPageFooter(PageItemDesignIntf* patternPage);
|
||||
void moveTearOffBand();
|
||||
void renderPageItems(PageItemDesignIntf* patternPage);
|
||||
@ -138,7 +140,7 @@ private:
|
||||
BandDesignIntf* saveUppperPartReturnBottom(BandDesignIntf *band, int height, BandDesignIntf *patternBand);
|
||||
BandDesignIntf* renderData(BandDesignIntf* patternBand);
|
||||
void startNewColumn();
|
||||
void startNewPage();
|
||||
void startNewPage(bool isFirst = false);
|
||||
void resetPageNumber(ResetPageNuberType resetType);
|
||||
int findLastPageNumber(int currentPage);
|
||||
void savePage(bool isLast = false);
|
||||
|
Loading…
Reference in New Issue
Block a user