mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-25 04:54:40 +03:00
Merge branch 'develop' into feature/Extract_Designer_to_plugin
This commit is contained in:
commit
0a51aaff63
@ -75,7 +75,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 = 52
|
LIMEREPORT_VERSION_RELEASE = 54
|
||||||
|
|
||||||
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}\\\"
|
||||||
|
@ -803,46 +803,48 @@ bool TextItem::canBeSplitted(int height) const
|
|||||||
return height > m_firstLineSize;
|
return height > m_firstLineSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TextItem::getTextPart(int height, int skipHeight){
|
QString TextItem::extractText(QTextBlock& curBlock, int height){
|
||||||
int linesHeight = 0;
|
|
||||||
int curLine = 0;
|
int curLine = 0;
|
||||||
int textPos = 0;
|
int linesHeight = 0;
|
||||||
|
QString resultText;
|
||||||
|
for (;curBlock != curBlock.document()->end() || curLine<=curBlock.lineCount(); curBlock = curBlock.next(), curLine = 0, resultText += '\n' ){
|
||||||
|
linesHeight+=curBlock.blockFormat().topMargin();
|
||||||
|
for (;curLine < curBlock.layout()->lineCount(); curLine++){
|
||||||
|
linesHeight += curBlock.layout()->lineAt(curLine).height() + lineSpacing();
|
||||||
|
if (height > 0 && linesHeight > (height-borderLineSize() * 2)) {goto loop_exit;}
|
||||||
|
resultText += curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(),
|
||||||
|
curBlock.layout()->lineAt(curLine).textLength());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
loop_exit: return resultText;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString TextItem::getTextPart(int height, int skipHeight){
|
||||||
|
|
||||||
TextPtr text = textDocument();
|
|
||||||
text->documentLayout();
|
|
||||||
QTextBlock curBlock = text->begin();
|
|
||||||
QString resultText = "";
|
QString resultText = "";
|
||||||
|
TextPtr text = textDocument();
|
||||||
|
text->size().height();
|
||||||
|
QTextBlock curBlock = text->begin();
|
||||||
|
QTextCursor cursor(text.data());
|
||||||
|
cursor.movePosition(QTextCursor::Start);
|
||||||
|
|
||||||
if (skipHeight > 0){
|
if (skipHeight > 0){
|
||||||
for (;curBlock != text->end(); curBlock=curBlock.next()){
|
resultText = extractText(curBlock, skipHeight);
|
||||||
for (curLine = 0; curLine < curBlock.layout()->lineCount(); curLine++){
|
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, resultText.length());
|
||||||
linesHeight += curBlock.layout()->lineAt(curLine).height() + lineSpacing();
|
|
||||||
if (linesHeight > (skipHeight-(/*fakeMarginSize()*2+*/borderLineSize() * 2))) {goto loop_exit;}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
loop_exit:;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
linesHeight = 0;
|
resultText = extractText(curBlock, height);
|
||||||
|
cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, resultText.length());
|
||||||
|
|
||||||
for (;curBlock != text->end() || curLine<curBlock.lineCount(); curBlock = curBlock.next(), curLine = 0, resultText += '\n'){
|
if (allowHTML()){
|
||||||
for (; curLine<curBlock.layout()->lineCount(); curLine++){
|
resultText = cursor.selection().toHtml();
|
||||||
if (resultText == "") textPos= curBlock.layout()->lineAt(curLine).textStart();
|
resultText.remove("<!--StartFragment-->");
|
||||||
linesHeight += curBlock.layout()->lineAt(curLine).height() + lineSpacing();
|
resultText.remove("<!--EndFragment-->");
|
||||||
if ( (height>0) && (linesHeight>(height-(/*fakeMarginSize()*2+*/borderLineSize()*2))) ) {
|
} else {
|
||||||
linesHeight-=curBlock.layout()->lineAt(curLine).height();
|
resultText = cursor.selection().toPlainText();
|
||||||
goto loop_exit1;
|
|
||||||
}
|
|
||||||
resultText+=curBlock.text().mid(curBlock.layout()->lineAt(curLine).textStart(),
|
|
||||||
curBlock.layout()->lineAt(curLine).textLength());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
loop_exit1:;
|
|
||||||
|
|
||||||
resultText.chop(1);
|
return resultText;
|
||||||
|
|
||||||
QScopedPointer<HtmlContext> context(new HtmlContext(m_strText));
|
|
||||||
return context->extendTextByTags(resultText,textPos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextItem::restoreLinksEvent()
|
void TextItem::restoreLinksEvent()
|
||||||
|
@ -182,7 +182,7 @@ private:
|
|||||||
QString formatDateTime(const QDateTime &value);
|
QString formatDateTime(const QDateTime &value);
|
||||||
QString formatNumber(const double value);
|
QString formatNumber(const double value);
|
||||||
QString formatFieldValue();
|
QString formatFieldValue();
|
||||||
|
QString extractText(QTextBlock& curBlock, int height);
|
||||||
TextPtr textDocument() const;
|
TextPtr textDocument() const;
|
||||||
private:
|
private:
|
||||||
QString m_strText;
|
QString m_strText;
|
||||||
@ -209,6 +209,7 @@ private:
|
|||||||
TextItem* m_follower;
|
TextItem* m_follower;
|
||||||
qreal m_textIndent;
|
qreal m_textIndent;
|
||||||
Qt::LayoutDirection m_textLayoutDirection;
|
Qt::LayoutDirection m_textLayoutDirection;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user