0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 16:44:39 +03:00

Finish 1.4.127

# Conflicts:
#	limereport/lrpageitemdesignintf.cpp
#	limereport/lrpageitemdesignintf.h
#	limereport/lrreportrender.cpp
This commit is contained in:
Arin Alexander 2019-04-16 01:06:51 +03:00
commit 220dcc3edb
3 changed files with 66 additions and 48 deletions

View File

@ -51,7 +51,7 @@ PageItemDesignIntf::PageItemDesignIntf(QObject *owner, QGraphicsItem *parent) :
m_pageOrientaion(Portrait), m_pageSize(A4), m_sizeChainging(false),
m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false),
m_isExtendedInDesignMode(false), m_extendedHeight(1000), m_isTOC(false), m_setPageSizeToPrinter(false),
m_endlessHeight(false), m_printable(true)
m_endlessHeight(false), m_printable(true), m_pageFooter(0)
{
setFixedPos(true);
setPossibleResizeDirectionFlags(Fixed);
@ -65,7 +65,7 @@ PageItemDesignIntf::PageItemDesignIntf(const PageSize pageSize, const QRectF &re
m_pageOrientaion(Portrait), m_pageSize(pageSize), m_sizeChainging(false),
m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false),
m_isExtendedInDesignMode(false), m_extendedHeight(1000), m_isTOC(false), m_setPageSizeToPrinter(false),
m_endlessHeight(false), m_printable(true)
m_endlessHeight(false), m_printable(true), m_pageFooter(0)
{
setFixedPos(true);
setPossibleResizeDirectionFlags(Fixed);
@ -75,7 +75,8 @@ PageItemDesignIntf::PageItemDesignIntf(const PageSize pageSize, const QRectF &re
PageItemDesignIntf::~PageItemDesignIntf()
{
foreach(BandDesignIntf* band,m_bands) band->disconnect(this);
foreach(BandDesignIntf* band, m_bands)
band->disconnect(this);
m_bands.clear();
}
@ -127,8 +128,6 @@ BaseDesignIntf *PageItemDesignIntf::createSameTypeItem(QObject *owner, QGraphics
void PageItemDesignIntf::geometryChangedEvent(QRectF newRect, QRectF)
{
// if (scene())
// scene()->setSceneRect(newRect);
Q_UNUSED(newRect)
updateMarginRect();
PageSize oldSize = m_pageSize;
@ -144,13 +143,11 @@ QColor PageItemDesignIntf::selectionColor() const
QColor PageItemDesignIntf::pageBorderColor() const
{
//return QColor(180,220,150);
return QColor(100,150,50);
}
QColor PageItemDesignIntf::gridColor() const
{
//return QColor(240,240,240);
return QColor(170,200,150);
}
@ -197,7 +194,7 @@ bool PageItemDesignIntf::isBandExists(BandDesignIntf::BandsType bandType)
bool PageItemDesignIntf::isBandExists(const QString &bandType)
{
foreach(BandDesignIntf* band, m_bands){
foreach(BandDesignIntf* band, childBands()){
if (band->bandTitle()==bandType) return true;
}
return false;
@ -205,7 +202,7 @@ bool PageItemDesignIntf::isBandExists(const QString &bandType)
BandDesignIntf* PageItemDesignIntf::bandByIndex(int index)
{
foreach(BandDesignIntf* band,m_bands){
foreach(BandDesignIntf* band, childBands()){
if (band->bandIndex()==index) return band;
}
return 0;
@ -250,7 +247,7 @@ int PageItemDesignIntf::calcBandIndex(BandDesignIntf::BandsType bandType, BandDe
}
if (bandIndex == -1) {
bandIndex = (int)(bandType);
bandIndex = static_cast<int>(bandType);
increaseBandIndex = true;
}
@ -328,7 +325,6 @@ void PageItemDesignIntf::registerBand(BandDesignIntf *band)
m_bands.append(band);
else
m_bands.insert(band->bandIndex(), band);
band->setParent(this);
band->setParentItem(this);
band->setWidth(pageRect().width() / band->columnsCount());
@ -430,6 +426,32 @@ void PageItemDesignIntf::setExtendedInDesignMode(bool pageIsExtended)
update();
}
BandDesignIntf *PageItemDesignIntf::pageFooter() const
{
return m_pageFooter;
}
void PageItemDesignIntf::setPageFooter(BandDesignIntf *pageFooter)
{
m_pageFooter = pageFooter;
}
void PageItemDesignIntf::placeTearOffBand()
{
BandDesignIntf* tearOffBand = bandByType(BandDesignIntf::TearOffBand);
if (tearOffBand){
BandDesignIntf* pf = pageFooter();
if (pf){
qreal bottomSpace = pageRect().bottom() - (tearOffBand->height() + pf->height() + bottomMargin());
tearOffBand->setItemPos(pageRect().x(),
bottomSpace);
} else {
qreal bottomSpace = pageRect().bottom() - (tearOffBand->height() + bottomMargin());
tearOffBand->setItemPos(pageRect().x(), bottomSpace);
}
}
}
bool PageItemDesignIntf::resetPageNumber() const
{
return m_resetPageNumber;
@ -535,6 +557,9 @@ void PageItemDesignIntf::relocateBands()
if (band->isSelected()) band->updateBandNameLabel();
}
}
if (!(itemMode() & DesignMode))
placeTearOffBand();
}
void PageItemDesignIntf::removeBand(BandDesignIntf *band)

View File

@ -39,7 +39,7 @@
namespace LimeReport{
class ReportRender;
class PageItemDesignIntf : public LimeReport::ItemsContainerDesignInft
class PageItemDesignIntf : public ItemsContainerDesignInft
{
Q_OBJECT
Q_ENUMS(Orientation)
@ -158,6 +158,10 @@ public:
QString printerName() const;
void setPrinterName(const QString& printerName);
void placeTearOffBand();
BandDesignIntf *pageFooter() const;
void setPageFooter(BandDesignIntf *pageFooter);
signals:
void beforeFirstPageRendered();
void afterLastPageRendered();
@ -198,6 +202,7 @@ private:
bool m_endlessHeight;
bool m_printable;
QString m_printerName;
BandDesignIntf* m_pageFooter;
};
typedef QList<PageItemDesignIntf::Ptr> ReportPages;

View File

@ -666,6 +666,7 @@ void ReportRender::renderPageFooter(PageItemDesignIntf *patternPage)
bandClone->setHeight(m_pageFooterHeight);
for(int i=0;i<m_maxHeightByColumn.size();++i)
m_maxHeightByColumn[i]+=m_pageFooterHeight;
m_renderPageItem->setPageFooter(bandClone);
registerBand(bandClone);
datasources()->clearGroupFunctionValues(band->objectName());
}
@ -1412,19 +1413,6 @@ BandDesignIntf* ReportRender::findEnclosingGroup()
return result;
}
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)
{
if (m_renderPageItem->isTOC())
@ -1471,7 +1459,7 @@ void ReportRender::savePage(bool isLast)
}
}
moveTearOffBand();
m_renderPageItem->placeTearOffBand();
m_scriptEngineContext->setCurrentPage(m_renderPageItem);
emit m_patternPageItem->afterRender();
if (isLast)