mirror of
				https://github.com/python-LimeReport/LimeReport.git
				synced 2025-11-04 07:31:23 +03:00 
			
		
		
		
	Finish 1.4.90
# Conflicts: # limereport/lrpagedesignintf.cpp
This commit is contained in:
		@@ -105,7 +105,7 @@ RCC_DIR        = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
 | 
			
		||||
 | 
			
		||||
LIMEREPORT_VERSION_MAJOR = 1
 | 
			
		||||
LIMEREPORT_VERSION_MINOR = 4
 | 
			
		||||
LIMEREPORT_VERSION_RELEASE = 89
 | 
			
		||||
LIMEREPORT_VERSION_RELEASE = 90
 | 
			
		||||
 | 
			
		||||
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
 | 
			
		||||
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"
 | 
			
		||||
 
 | 
			
		||||
@@ -871,10 +871,17 @@ void PageDesignIntf::saveSelectedItemsGeometry()
 | 
			
		||||
 | 
			
		||||
void PageDesignIntf::checkSizeOrPosChanges()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    CommandIf::Ptr posCommand;
 | 
			
		||||
    if ((selectedItems().count() > 0) && (m_positionStamp.count() > 0)) {
 | 
			
		||||
        if (m_positionStamp[0].pos != selectedItems().at(0)->pos()) {
 | 
			
		||||
        bool bandFound = false;
 | 
			
		||||
        foreach(QGraphicsItem* item, selectedItems()){
 | 
			
		||||
            BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(item);
 | 
			
		||||
            if (band){
 | 
			
		||||
                bandFound = true;
 | 
			
		||||
                break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (!bandFound && (m_positionStamp[0].pos != selectedItems().at(0)->pos())) {
 | 
			
		||||
            posCommand = createChangePosCommand();
 | 
			
		||||
        }
 | 
			
		||||
        m_positionStamp.clear();
 | 
			
		||||
@@ -910,16 +917,14 @@ CommandIf::Ptr PageDesignIntf::createChangePosCommand()
 | 
			
		||||
    QVector<ReportItemPos> newPoses;
 | 
			
		||||
    foreach(ReportItemPos itemPos, m_positionStamp) {
 | 
			
		||||
        BaseDesignIntf *reportItem = reportItemByName(itemPos.objectName);
 | 
			
		||||
 | 
			
		||||
        if (reportItem) {
 | 
			
		||||
            ReportItemPos newPos;
 | 
			
		||||
            newPos.objectName = reportItem->objectName();
 | 
			
		||||
            newPos.pos = reportItem->pos();
 | 
			
		||||
            newPoses.append(newPos);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    }    
 | 
			
		||||
    return PosChangedCommand::create(this, m_positionStamp, newPoses);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
CommandIf::Ptr PageDesignIntf::createChangeSizeCommand()
 | 
			
		||||
@@ -2380,5 +2385,33 @@ void InsertVLayoutCommand::undoIt()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
CommandIf::Ptr BandSwapCommand::create(PageDesignIntf *page, const QString &bandName, const QString &bandToSwapName)
 | 
			
		||||
{
 | 
			
		||||
    BandSwapCommand *command = new BandSwapCommand();
 | 
			
		||||
    command->setPage(page);
 | 
			
		||||
    command->bandName = bandName;
 | 
			
		||||
    command->bandToSwapName = bandToSwapName;
 | 
			
		||||
    return CommandIf::Ptr(command);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool BandSwapCommand::doIt()
 | 
			
		||||
{
 | 
			
		||||
    BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(page()->reportItemByName(bandName));
 | 
			
		||||
    BandDesignIntf* bandToSwap = dynamic_cast<BandDesignIntf*>(page()->reportItemByName(bandToSwapName));
 | 
			
		||||
    if (band && bandToSwap){
 | 
			
		||||
        page()->pageItem()->swapBands(band, bandToSwap);
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BandSwapCommand::undoIt()
 | 
			
		||||
{
 | 
			
		||||
    BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(page()->reportItemByName(bandName));
 | 
			
		||||
    BandDesignIntf* bandToSwap = dynamic_cast<BandDesignIntf*>(page()->reportItemByName(bandToSwapName));
 | 
			
		||||
    if (band && bandToSwap)
 | 
			
		||||
        page()->pageItem()->swapBands(bandToSwap, band);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -452,6 +452,16 @@ namespace LimeReport {
 | 
			
		||||
        QVector<ReportItemPos> m_newPos;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    class BandSwapCommand : public AbstractPageCommand{
 | 
			
		||||
    public:
 | 
			
		||||
        static CommandIf::Ptr create(PageDesignIntf* page, const QString& bandName, const QString& bandToSwapName);
 | 
			
		||||
        bool doIt();
 | 
			
		||||
        void undoIt();
 | 
			
		||||
    private:
 | 
			
		||||
        QString bandName;
 | 
			
		||||
        QString bandToSwapName;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    class SizeChangedCommand : public AbstractPageCommand{
 | 
			
		||||
    public:
 | 
			
		||||
        static CommandIf::Ptr create(PageDesignIntf* page, QVector<ReportItemSize>& oldSize, QVector<ReportItemSize>& newSize);
 | 
			
		||||
 
 | 
			
		||||
@@ -702,6 +702,34 @@ void PageItemDesignIntf::bandDeleted(QObject *band)
 | 
			
		||||
    relocateBands();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToSwap){
 | 
			
		||||
    int startIndex = std::min(band->minChildIndex(), bandToSwap->minChildIndex());
 | 
			
		||||
 | 
			
		||||
//        int endIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex());
 | 
			
		||||
//        QList<BandDesignIntf*> bandToMove;
 | 
			
		||||
//        foreach(BandDesignIntf* curBand, m_bands){
 | 
			
		||||
//            if (curBand->bandIndex() > endIndex)
 | 
			
		||||
//                bandToMove.append(curBand);
 | 
			
		||||
//        }
 | 
			
		||||
 | 
			
		||||
    BandDesignIntf* firstMoveBand = (bandToSwap->bandIndex() > band->bandIndex()) ? bandToSwap: band;
 | 
			
		||||
 | 
			
		||||
    firstMoveBand->changeBandIndex(startIndex, true);
 | 
			
		||||
    if (firstMoveBand == band){
 | 
			
		||||
        bandToSwap->changeBandIndex(firstMoveBand->maxChildIndex()+1,true);
 | 
			
		||||
    } else {
 | 
			
		||||
        band->changeBandIndex(firstMoveBand->maxChildIndex()+1, true);
 | 
			
		||||
    }
 | 
			
		||||
    relocateBands();
 | 
			
		||||
 | 
			
		||||
//        int maxNewIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex());
 | 
			
		||||
//        if (maxNewIndex > endIndex){
 | 
			
		||||
//            foreach(BandDesignIntf* curBand, bandToMove){
 | 
			
		||||
//                curBand->setBandIndex(curBand->bandIndex()+(maxNewIndex - endIndex));
 | 
			
		||||
//            }
 | 
			
		||||
//        }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry)
 | 
			
		||||
{
 | 
			
		||||
    BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(object);
 | 
			
		||||
@@ -730,33 +758,10 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry
 | 
			
		||||
    }
 | 
			
		||||
    if (curIndex != band->bandIndex()){
 | 
			
		||||
 | 
			
		||||
        int startIndex = std::min(band->minChildIndex(), bandToSwap->minChildIndex());
 | 
			
		||||
 | 
			
		||||
//        int endIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex());
 | 
			
		||||
//        QList<BandDesignIntf*> bandToMove;
 | 
			
		||||
//        foreach(BandDesignIntf* curBand, m_bands){
 | 
			
		||||
//            if (curBand->bandIndex() > endIndex)
 | 
			
		||||
//                bandToMove.append(curBand);
 | 
			
		||||
//        }
 | 
			
		||||
 | 
			
		||||
        BandDesignIntf* firstMoveBand = (bandToSwap->bandIndex() > band->bandIndex()) ? bandToSwap: band;
 | 
			
		||||
 | 
			
		||||
        firstMoveBand->changeBandIndex(startIndex, true);
 | 
			
		||||
        if (firstMoveBand == band){
 | 
			
		||||
            bandToSwap->changeBandIndex(firstMoveBand->maxChildIndex()+1,true);
 | 
			
		||||
        } else {
 | 
			
		||||
            band->changeBandIndex(firstMoveBand->maxChildIndex()+1, true);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
//        int maxNewIndex = std::max(band->maxChildIndex(), bandToSwap->maxChildIndex());
 | 
			
		||||
//        if (maxNewIndex > endIndex){
 | 
			
		||||
//            foreach(BandDesignIntf* curBand, bandToMove){
 | 
			
		||||
//                curBand->setBandIndex(curBand->bandIndex()+(maxNewIndex - endIndex));
 | 
			
		||||
//            }
 | 
			
		||||
//        }
 | 
			
		||||
        //swapBands(band, bandToSwap);
 | 
			
		||||
        page()->saveCommand(BandSwapCommand::create(page(), band->objectName(), bandToSwap->objectName()), true);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    relocateBands();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -123,7 +123,8 @@ public:
 | 
			
		||||
    bool canContainChildren() const{ return true;}
 | 
			
		||||
    bool resetPageNumber() const;
 | 
			
		||||
    void setResetPageNumber(bool resetPageNumber);
 | 
			
		||||
    void updateSubItemsSize(RenderPass pass, DataSourceManager *dataManager);
 | 
			
		||||
    void updateSubItemsSize(RenderPass pass, DataSourceManager *dataManager);    
 | 
			
		||||
    void swapBands(BandDesignIntf *band, BandDesignIntf *bandToSwap);
 | 
			
		||||
 | 
			
		||||
    bool isExtendedInDesignMode() const;
 | 
			
		||||
    void setExtendedInDesignMode(bool isExtendedInDesignMode);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user