mirror of
https://github.com/fralx/LimeReport.git
synced 2025-04-02 23:43:45 +03:00
Finish 1.4.124
# Conflicts: # limereport/lrbanddesignintf.h # limereport/lrpagedesignintf.cpp # limereport/lrpageitemdesignintf.h # translations/limereport_zh.ts
This commit is contained in:
commit
c475159799
@ -120,7 +120,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 = 123
|
LIMEREPORT_VERSION_RELEASE = 124
|
||||||
|
|
||||||
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}\\\"
|
||||||
|
@ -425,10 +425,23 @@ int BandDesignIntf::maxChildIndex(QSet<BandDesignIntf::BandsType> ignoredBands)
|
|||||||
return curIndex;
|
return curIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int BandDesignIntf::rootIndex(BandDesignIntf* parentBand)
|
||||||
|
{
|
||||||
|
return rootBand(parentBand)->bandIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
BandDesignIntf *BandDesignIntf::rootBand(BandDesignIntf* parentBand)
|
||||||
|
{
|
||||||
|
BandDesignIntf* currentBand = this;
|
||||||
|
while (currentBand->parentBand() && currentBand->parentBand() != parentBand)
|
||||||
|
currentBand = currentBand->parentBand();
|
||||||
|
return currentBand;
|
||||||
|
}
|
||||||
|
|
||||||
int BandDesignIntf::minChildIndex(BandDesignIntf::BandsType bandType){
|
int BandDesignIntf::minChildIndex(BandDesignIntf::BandsType bandType){
|
||||||
int curIndex = bandIndex();
|
int curIndex = bandIndex();
|
||||||
foreach(BandDesignIntf* childBand, childBands()){
|
foreach(BandDesignIntf* childBand, childBands()){
|
||||||
if (curIndex>childBand->bandIndex() && (childBand->bandType()>bandType)){
|
if (curIndex > childBand->bandIndex() && (childBand->bandType() > bandType)){
|
||||||
curIndex = childBand->bandIndex();
|
curIndex = childBand->bandIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -440,7 +453,7 @@ int BandDesignIntf::minChildIndex(QSet<BandDesignIntf::BandsType> ignoredBands)
|
|||||||
int curIndex = bandIndex();
|
int curIndex = bandIndex();
|
||||||
foreach(BandDesignIntf* childBand, childBands()){
|
foreach(BandDesignIntf* childBand, childBands()){
|
||||||
if (!ignoredBands.contains(childBand->bandType()) && childBand->bandIndex() < bandIndex()){
|
if (!ignoredBands.contains(childBand->bandType()) && childBand->bandIndex() < bandIndex()){
|
||||||
curIndex = std::min(curIndex, childBand->maxChildIndex(ignoredBands));
|
curIndex = std::min(curIndex, childBand->minChildIndex(ignoredBands));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return curIndex;
|
return curIndex;
|
||||||
|
@ -183,6 +183,9 @@ public:
|
|||||||
int maxChildIndex(BandDesignIntf::BandsType bandType) const;
|
int maxChildIndex(BandDesignIntf::BandsType bandType) const;
|
||||||
int maxChildIndex(QSet<BandsType> ignoredBands = QSet<BandDesignIntf::BandsType>()) const;
|
int maxChildIndex(QSet<BandsType> ignoredBands = QSet<BandDesignIntf::BandsType>()) const;
|
||||||
|
|
||||||
|
int rootIndex(BandDesignIntf *parentBand);
|
||||||
|
BandDesignIntf* rootBand(BandDesignIntf *parentBand);
|
||||||
|
|
||||||
BandDesignIntf* parentBand() const {return m_parentBand;}
|
BandDesignIntf* parentBand() const {return m_parentBand;}
|
||||||
|
|
||||||
QList<BandDesignIntf*> childBands() const{return m_childBands;}
|
QList<BandDesignIntf*> childBands() const{return m_childBands;}
|
||||||
|
@ -2504,8 +2504,13 @@ CommandIf::Ptr BandMoveFromToCommand::create(PageDesignIntf* page, int from, int
|
|||||||
bool BandMoveFromToCommand::doIt()
|
bool BandMoveFromToCommand::doIt()
|
||||||
{
|
{
|
||||||
if (page() && page()->pageItem() && from != to) {
|
if (page() && page()->pageItem() && from != to) {
|
||||||
page()->pageItem()->moveBandFromTo(from, to);
|
BandDesignIntf* fromBand = page()->pageItem()->bandByIndex(from);
|
||||||
return true;
|
reverceTo = fromBand->minChildIndex();
|
||||||
|
if (fromBand){
|
||||||
|
page()->pageItem()->moveBandFromTo(from, to);
|
||||||
|
reverceFrom = fromBand->bandIndex();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2513,7 +2518,7 @@ bool BandMoveFromToCommand::doIt()
|
|||||||
void BandMoveFromToCommand::undoIt()
|
void BandMoveFromToCommand::undoIt()
|
||||||
{
|
{
|
||||||
if (page() && page()->pageItem())
|
if (page() && page()->pageItem())
|
||||||
page()->pageItem()->moveBandFromTo(to, from);
|
page()->pageItem()->moveBandFromTo(reverceFrom, reverceTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -467,6 +467,8 @@ namespace LimeReport {
|
|||||||
private:
|
private:
|
||||||
int from;
|
int from;
|
||||||
int to;
|
int to;
|
||||||
|
int reverceFrom;
|
||||||
|
int reverceTo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -771,47 +771,68 @@ void PageItemDesignIntf::swapBands(BandDesignIntf* band, BandDesignIntf* bandToS
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<BandDesignIntf*> PageItemDesignIntf::createBandGroup(int beginIndex, int endIndex)
|
||||||
|
{
|
||||||
|
QList<BandDesignIntf*> result;
|
||||||
|
foreach(BandDesignIntf* curBand, m_bands){
|
||||||
|
if ( curBand->bandIndex() >= beginIndex && curBand->bandIndex() <= endIndex)
|
||||||
|
result.append(curBand);
|
||||||
|
}
|
||||||
|
qSort(result.begin(), result.end(), bandIndexLessThen);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void PageItemDesignIntf::moveBandFromTo(int from, int to)
|
void PageItemDesignIntf::moveBandFromTo(int from, int to)
|
||||||
{
|
{
|
||||||
BandDesignIntf* firstBand = 0;
|
|
||||||
BandDesignIntf* secondBand = 0;
|
|
||||||
|
|
||||||
int firstIndex = std::min(from,to);
|
BandDesignIntf* fromBand = 0;
|
||||||
int secondIndex = std::max(from,to);
|
BandDesignIntf* toBand = 0;
|
||||||
QList<BandDesignIntf*> bandsToMove;
|
|
||||||
int moveIndex = 0;
|
|
||||||
|
|
||||||
foreach(BandDesignIntf* band, bands()){
|
foreach(BandDesignIntf* band, bands()){
|
||||||
if (band->bandIndex() == from){
|
if (band->bandIndex() == from){
|
||||||
firstBand = band;
|
fromBand = band->rootBand(band->parentBand());
|
||||||
}
|
}
|
||||||
if (band->bandIndex() == to){
|
if (band->bandIndex() == to){
|
||||||
secondBand = band;
|
toBand = band->rootBand(band->parentBand());
|
||||||
bandsToMove.append(band);
|
|
||||||
}
|
}
|
||||||
|
if (fromBand && toBand) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(BandDesignIntf* curBand, m_bands){
|
if (!fromBand || !toBand) return;
|
||||||
if ( curBand->bandIndex() > firstIndex && curBand->bandIndex() < secondIndex &&
|
|
||||||
curBand->bandType() == firstBand->bandType() &&
|
|
||||||
curBand != firstBand
|
|
||||||
)
|
|
||||||
bandsToMove.append(curBand);
|
|
||||||
}
|
|
||||||
qSort(bandsToMove.begin(), bandsToMove.end(), bandIndexLessThen);
|
|
||||||
|
|
||||||
|
int beginIndex = 0;
|
||||||
if (from > to){
|
int endIndex = 0;
|
||||||
firstBand->changeBandIndex(secondBand->minChildIndex(), true);
|
if (from < to){
|
||||||
moveIndex = firstBand->maxChildIndex()+1;
|
beginIndex = fromBand->maxChildIndex()+1;
|
||||||
|
endIndex = toBand->maxChildIndex();
|
||||||
} else {
|
} else {
|
||||||
moveIndex = firstBand->minChildIndex();
|
beginIndex = toBand->minChildIndex();
|
||||||
firstBand->changeBandIndex(secondBand->minChildIndex(), true);
|
endIndex = fromBand->minChildIndex()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(BandDesignIntf* curBand, bandsToMove){
|
QList<BandDesignIntf*> firstGroup = createBandGroup(fromBand->minChildIndex(), fromBand->maxChildIndex());
|
||||||
curBand->changeBandIndex(moveIndex,true);
|
QList<BandDesignIntf*> secondGroup = createBandGroup(beginIndex, endIndex);
|
||||||
moveIndex = curBand->maxChildIndex() + 1;
|
|
||||||
|
if (from < to){
|
||||||
|
int currentIndex = fromBand->minChildIndex();
|
||||||
|
foreach(BandDesignIntf* band, secondGroup){
|
||||||
|
band->setBandIndex(currentIndex);
|
||||||
|
currentIndex++;
|
||||||
|
}
|
||||||
|
foreach(BandDesignIntf* band, firstGroup){
|
||||||
|
band->setBandIndex(currentIndex);
|
||||||
|
currentIndex++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int currentIndex = toBand->minChildIndex();
|
||||||
|
foreach(BandDesignIntf* band, firstGroup){
|
||||||
|
band->setBandIndex(currentIndex);
|
||||||
|
currentIndex++;
|
||||||
|
}
|
||||||
|
foreach(BandDesignIntf* band, secondGroup){
|
||||||
|
band->setBandIndex(currentIndex);
|
||||||
|
currentIndex++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
relocateBands();
|
relocateBands();
|
||||||
|
@ -137,6 +137,8 @@ public:
|
|||||||
void swapBands(BandDesignIntf *band, BandDesignIntf *bandToSwap);
|
void swapBands(BandDesignIntf *band, BandDesignIntf *bandToSwap);
|
||||||
void moveBandFromTo(int from, int to);
|
void moveBandFromTo(int from, int to);
|
||||||
|
|
||||||
|
QList<BandDesignIntf *> createBandGroup(int beginIndex, int endIndex);
|
||||||
|
|
||||||
bool isExtendedInDesignMode() const;
|
bool isExtendedInDesignMode() const;
|
||||||
void setExtendedInDesignMode(bool isExtendedInDesignMode);
|
void setExtendedInDesignMode(bool isExtendedInDesignMode);
|
||||||
int extendedHeight() const;
|
int extendedHeight() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user