mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-24 08:34:38 +03:00
Finish 1.4.96
This commit is contained in:
commit
0fa2896fa0
@ -105,7 +105,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
|
|||||||
|
|
||||||
LIMEREPORT_VERSION_MAJOR = 1
|
LIMEREPORT_VERSION_MAJOR = 1
|
||||||
LIMEREPORT_VERSION_MINOR = 4
|
LIMEREPORT_VERSION_MINOR = 4
|
||||||
LIMEREPORT_VERSION_RELEASE = 95
|
LIMEREPORT_VERSION_RELEASE = 96
|
||||||
|
|
||||||
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
|
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
|
||||||
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"
|
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"
|
||||||
|
@ -2398,7 +2398,7 @@ bool BandSwapCommand::doIt()
|
|||||||
{
|
{
|
||||||
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(page()->reportItemByName(bandName));
|
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(page()->reportItemByName(bandName));
|
||||||
BandDesignIntf* bandToSwap = dynamic_cast<BandDesignIntf*>(page()->reportItemByName(bandToSwapName));
|
BandDesignIntf* bandToSwap = dynamic_cast<BandDesignIntf*>(page()->reportItemByName(bandToSwapName));
|
||||||
if (band && bandToSwap){
|
if (page() && band && bandToSwap){
|
||||||
page()->pageItem()->swapBands(band, bandToSwap);
|
page()->pageItem()->swapBands(band, bandToSwap);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2409,9 +2409,32 @@ void BandSwapCommand::undoIt()
|
|||||||
{
|
{
|
||||||
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(page()->reportItemByName(bandName));
|
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(page()->reportItemByName(bandName));
|
||||||
BandDesignIntf* bandToSwap = dynamic_cast<BandDesignIntf*>(page()->reportItemByName(bandToSwapName));
|
BandDesignIntf* bandToSwap = dynamic_cast<BandDesignIntf*>(page()->reportItemByName(bandToSwapName));
|
||||||
if (band && bandToSwap)
|
if (page() && band && bandToSwap)
|
||||||
page()->pageItem()->swapBands(bandToSwap, band);
|
page()->pageItem()->swapBands(bandToSwap, band);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CommandIf::Ptr BandMoveFromToCommand::create(PageDesignIntf* page, int from, int to)
|
||||||
|
{
|
||||||
|
BandMoveFromToCommand* command = new BandMoveFromToCommand();
|
||||||
|
command->setPage(page);
|
||||||
|
command->from = from;
|
||||||
|
command->to = to;
|
||||||
|
return CommandIf::Ptr(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool BandMoveFromToCommand::doIt()
|
||||||
|
{
|
||||||
|
if (page() && from != to) {
|
||||||
|
page()->pageItem()->moveBandFromTo(from, to);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BandMoveFromToCommand::undoIt()
|
||||||
|
{
|
||||||
|
if (page()) page()->pageItem()->moveBandFromTo(to, from);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,6 +462,17 @@ namespace LimeReport {
|
|||||||
QString bandToSwapName;
|
QString bandToSwapName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class BandMoveFromToCommand : public AbstractPageCommand{
|
||||||
|
public:
|
||||||
|
static CommandIf::Ptr create(PageDesignIntf* page, int from, int to);
|
||||||
|
bool doIt();
|
||||||
|
void undoIt();
|
||||||
|
private:
|
||||||
|
int from;
|
||||||
|
int to;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class SizeChangedCommand : public AbstractPageCommand{
|
class SizeChangedCommand : public AbstractPageCommand{
|
||||||
public:
|
public:
|
||||||
static CommandIf::Ptr create(PageDesignIntf* page, QVector<ReportItemSize>& oldSize, QVector<ReportItemSize>& newSize);
|
static CommandIf::Ptr create(PageDesignIntf* page, QVector<ReportItemSize>& oldSize, QVector<ReportItemSize>& newSize);
|
||||||
|
@ -711,7 +711,7 @@ void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToS
|
|||||||
QList<BandDesignIntf*> bandToMove;
|
QList<BandDesignIntf*> bandToMove;
|
||||||
foreach(BandDesignIntf* curBand, m_bands){
|
foreach(BandDesignIntf* curBand, m_bands){
|
||||||
if ( curBand->bandIndex() > moveIndex && curBand->bandIndex() < secondIndex &&
|
if ( curBand->bandIndex() > moveIndex && curBand->bandIndex() < secondIndex &&
|
||||||
curBand->bandType() == BandDesignIntf::Data &&
|
curBand->bandType() == band->bandType() &&
|
||||||
curBand != band && curBand != bandToSwap
|
curBand != band && curBand != bandToSwap
|
||||||
)
|
)
|
||||||
bandToMove.append(curBand);
|
bandToMove.append(curBand);
|
||||||
@ -721,7 +721,9 @@ void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToS
|
|||||||
|
|
||||||
firstMoveBand->changeBandIndex(firstIndex, true);
|
firstMoveBand->changeBandIndex(firstIndex, true);
|
||||||
moveIndex = firstMoveBand->maxChildIndex() + 1;
|
moveIndex = firstMoveBand->maxChildIndex() + 1;
|
||||||
|
moveIndex = firstIndex;
|
||||||
qSort(bandToMove.begin(), bandToMove.end(), bandIndexLessThen);
|
qSort(bandToMove.begin(), bandToMove.end(), bandIndexLessThen);
|
||||||
|
|
||||||
foreach(BandDesignIntf* curBand, bandToMove){
|
foreach(BandDesignIntf* curBand, bandToMove){
|
||||||
curBand->changeBandIndex(moveIndex,true);
|
curBand->changeBandIndex(moveIndex,true);
|
||||||
moveIndex = curBand->maxChildIndex() + 1;
|
moveIndex = curBand->maxChildIndex() + 1;
|
||||||
@ -736,16 +738,63 @@ void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToS
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PageItemDesignIntf::moveBandFromTo(int from, int to)
|
||||||
|
{
|
||||||
|
BandDesignIntf* firstBand = 0;
|
||||||
|
BandDesignIntf* secondBand = 0;
|
||||||
|
|
||||||
|
int firstIndex = std::min(from,to);
|
||||||
|
int secondIndex = std::max(from,to);
|
||||||
|
QList<BandDesignIntf*> bandsToMove;
|
||||||
|
int moveIndex = 0;
|
||||||
|
|
||||||
|
foreach(BandDesignIntf* band, bands()){
|
||||||
|
if (band->bandIndex() == from){
|
||||||
|
firstBand = band;
|
||||||
|
}
|
||||||
|
if (band->bandIndex() == to){
|
||||||
|
secondBand = band;
|
||||||
|
bandsToMove.append(band);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(BandDesignIntf* curBand, m_bands){
|
||||||
|
if ( curBand->bandIndex() > firstIndex && curBand->bandIndex() < secondIndex &&
|
||||||
|
curBand->bandType() == firstBand->bandType() &&
|
||||||
|
curBand != firstBand
|
||||||
|
)
|
||||||
|
bandsToMove.append(curBand);
|
||||||
|
}
|
||||||
|
qSort(bandsToMove.begin(), bandsToMove.end(), bandIndexLessThen);
|
||||||
|
|
||||||
|
|
||||||
|
if (from > to){
|
||||||
|
firstBand->changeBandIndex(secondBand->minChildIndex(), true);
|
||||||
|
moveIndex = firstBand->maxChildIndex()+1;
|
||||||
|
} else {
|
||||||
|
moveIndex = firstBand->minChildIndex();
|
||||||
|
firstBand->changeBandIndex(secondBand->minChildIndex(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(BandDesignIntf* curBand, bandsToMove){
|
||||||
|
curBand->changeBandIndex(moveIndex,true);
|
||||||
|
moveIndex = curBand->maxChildIndex() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
relocateBands();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry)
|
void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry)
|
||||||
{
|
{
|
||||||
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(object);
|
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(object);
|
||||||
int curIndex = band->bandIndex();
|
int curIndex = band->bandIndex();
|
||||||
BandDesignIntf* bandToSwap = 0;
|
BandDesignIntf* bandToSwap = 0;
|
||||||
foreach(BandDesignIntf* curBand, bands()){
|
foreach(BandDesignIntf* curBand, bands()){
|
||||||
if (newGeometry.y()>oldGeometry.y()) {
|
if (newGeometry.y() > oldGeometry.y()) {
|
||||||
if (curBand->bandType() == band->bandType()
|
if (curBand->bandType() == band->bandType()
|
||||||
&& curIndex<curBand->bandIndex()
|
&& curIndex < curBand->bandIndex()
|
||||||
&& (curBand->pos().y()+(curBand->height()/2))<newGeometry.y()
|
&& (curBand->pos().y() + (curBand->height()/2)) < newGeometry.y()
|
||||||
&& curBand->parentBand() == band->parentBand())
|
&& curBand->parentBand() == band->parentBand())
|
||||||
{
|
{
|
||||||
curIndex = curBand->bandIndex();
|
curIndex = curBand->bandIndex();
|
||||||
@ -754,7 +803,7 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry
|
|||||||
} else {
|
} else {
|
||||||
if (curBand->bandType() == band->bandType()
|
if (curBand->bandType() == band->bandType()
|
||||||
&& curIndex>curBand->bandIndex()
|
&& curIndex>curBand->bandIndex()
|
||||||
&& (curBand->pos().y()+(curBand->height()/2))>newGeometry.y()
|
&& (curBand->pos().y() + (curBand->height()/2)) > newGeometry.y()
|
||||||
&& curBand->parentBand() == band->parentBand())
|
&& curBand->parentBand() == band->parentBand())
|
||||||
{
|
{
|
||||||
curIndex = curBand->bandIndex();
|
curIndex = curBand->bandIndex();
|
||||||
@ -763,10 +812,9 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (curIndex != band->bandIndex()){
|
if (curIndex != band->bandIndex()){
|
||||||
|
|
||||||
//swapBands(band, bandToSwap);
|
//swapBands(band, bandToSwap);
|
||||||
page()->saveCommand(BandSwapCommand::create(page(), band->objectName(), bandToSwap->objectName()), true);
|
//page()->saveCommand(BandSwapCommand::create(page(), band->objectName(), bandToSwap->objectName()), true);
|
||||||
|
page()->saveCommand(BandMoveFromToCommand::create(page(), band->bandIndex(), bandToSwap->bandIndex()), true);
|
||||||
}
|
}
|
||||||
relocateBands();
|
relocateBands();
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,8 @@ public:
|
|||||||
bool resetPageNumber() const;
|
bool resetPageNumber() const;
|
||||||
void setResetPageNumber(bool resetPageNumber);
|
void setResetPageNumber(bool resetPageNumber);
|
||||||
void updateSubItemsSize(RenderPass pass, DataSourceManager *dataManager);
|
void updateSubItemsSize(RenderPass pass, DataSourceManager *dataManager);
|
||||||
void swapBands(BandDesignIntf *band, BandDesignIntf *bandToSwap);
|
void swapBands(BandDesignIntf *band, BandDesignIntf *bandToSwap);
|
||||||
|
void moveBandFromTo(int from, int to);
|
||||||
|
|
||||||
bool isExtendedInDesignMode() const;
|
bool isExtendedInDesignMode() const;
|
||||||
void setExtendedInDesignMode(bool isExtendedInDesignMode);
|
void setExtendedInDesignMode(bool isExtendedInDesignMode);
|
||||||
|
Loading…
Reference in New Issue
Block a user