0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-09-26 17:59:08 +03:00

Finish 1.4.90

# Conflicts:
#	limereport/lrpagedesignintf.cpp
This commit is contained in:
Arin Alexander
2018-07-13 17:50:26 +03:00
5 changed files with 81 additions and 32 deletions

View File

@@ -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);
}
}