mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-24 20:44:39 +03:00
replaceCRwithBR property has been added
This commit is contained in:
parent
8fd072c65e
commit
21b9a94168
@ -62,7 +62,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 = 78
|
LIMEREPORT_VERSION_RELEASE = 80
|
||||||
|
|
||||||
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}\"
|
||||||
|
@ -59,7 +59,8 @@ namespace LimeReport{
|
|||||||
|
|
||||||
TextItem::TextItem(QObject *owner, QGraphicsItem *parent)
|
TextItem::TextItem(QObject *owner, QGraphicsItem *parent)
|
||||||
: ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false),
|
: ContentItemDesignIntf(xmlTag,owner,parent), m_angle(Angle0), m_trimValue(true), m_allowHTML(false),
|
||||||
m_allowHTMLInFields(false), m_followTo(""), m_follower(0), m_textIndent(0), m_textLayoutDirection(Qt::LayoutDirectionAuto)
|
m_allowHTMLInFields(false), m_replaceCarriageReturns(false), m_followTo(""), m_follower(0), m_textIndent(0),
|
||||||
|
m_textLayoutDirection(Qt::LayoutDirectionAuto)
|
||||||
{
|
{
|
||||||
PageItemDesignIntf* pageItem = dynamic_cast<PageItemDesignIntf*>(parent);
|
PageItemDesignIntf* pageItem = dynamic_cast<PageItemDesignIntf*>(parent);
|
||||||
BaseDesignIntf* parentItem = dynamic_cast<BaseDesignIntf*>(parent);
|
BaseDesignIntf* parentItem = dynamic_cast<BaseDesignIntf*>(parent);
|
||||||
@ -289,8 +290,10 @@ void TextItem::setContent(const QString &value)
|
|||||||
|
|
||||||
void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight)
|
void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isNeedExpandContent())
|
if (isNeedExpandContent())
|
||||||
expandContent(dataManager, pass);
|
expandContent(dataManager, pass);
|
||||||
|
|
||||||
if (!isLoading() && (autoHeight() || autoWidth() || hasFollower()) )
|
if (!isLoading() && (autoHeight() || autoWidth() || hasFollower()) )
|
||||||
initTextSizes();
|
initTextSizes();
|
||||||
|
|
||||||
@ -331,12 +334,12 @@ bool TextItem::isNeedExpandContent() const
|
|||||||
return content().contains(rx);
|
return content().contains(rx);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TextItem::replaceBR(QString text)
|
QString TextItem::replaceBR(QString text) const
|
||||||
{
|
{
|
||||||
return text.replace("<br/>","\n");
|
return text.replace("<br/>","\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TextItem::replaceReturns(QString text)
|
QString TextItem::replaceReturns(QString text) const
|
||||||
{
|
{
|
||||||
QString result = text.replace("\r\n","<br/>");
|
QString result = text.replace("\r\n","<br/>");
|
||||||
result = result.replace("\n","<br/>");
|
result = result.replace("\n","<br/>");
|
||||||
@ -465,7 +468,11 @@ TextItem::TextPtr TextItem::textDocument() const
|
|||||||
TextPtr text(new QTextDocument);
|
TextPtr text(new QTextDocument);
|
||||||
|
|
||||||
if (allowHTML())
|
if (allowHTML())
|
||||||
|
if (isReplaceCarriageReturns()){
|
||||||
|
text->setHtml(replaceReturns(m_strText));
|
||||||
|
} else {
|
||||||
text->setHtml(m_strText);
|
text->setHtml(m_strText);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
text->setPlainText(m_strText);
|
text->setPlainText(m_strText);
|
||||||
|
|
||||||
@ -513,6 +520,21 @@ TextItem::TextPtr TextItem::textDocument() const
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TextItem::isReplaceCarriageReturns() const
|
||||||
|
{
|
||||||
|
return m_replaceCarriageReturns;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextItem::setReplaceCarriageReturns(bool replaceCarriageReturns)
|
||||||
|
{
|
||||||
|
if (replaceCarriageReturns != m_replaceCarriageReturns){
|
||||||
|
m_replaceCarriageReturns = replaceCarriageReturns;
|
||||||
|
update();
|
||||||
|
notify("replaceCRwithBR",!replaceCarriageReturns, replaceCarriageReturns);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
qreal TextItem::textIndent() const
|
qreal TextItem::textIndent() const
|
||||||
{
|
{
|
||||||
return m_textIndent;
|
return m_textIndent;
|
||||||
|
@ -72,6 +72,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit {
|
|||||||
Q_PROPERTY(qreal textIndent READ textIndent WRITE setTextIndent)
|
Q_PROPERTY(qreal textIndent READ textIndent WRITE setTextIndent)
|
||||||
Q_PROPERTY(Qt::LayoutDirection textLayoutDirection READ textLayoutDirection WRITE setTextLayoutDirection)
|
Q_PROPERTY(Qt::LayoutDirection textLayoutDirection READ textLayoutDirection WRITE setTextLayoutDirection)
|
||||||
Q_PROPERTY(bool watermark READ isWatermark WRITE setWatermark)
|
Q_PROPERTY(bool watermark READ isWatermark WRITE setWatermark)
|
||||||
|
Q_PROPERTY(bool replaceCRwithBR READ isReplaceCarriageReturns WRITE setReplaceCarriageReturns)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};
|
enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength};
|
||||||
@ -167,11 +168,14 @@ public:
|
|||||||
|
|
||||||
void setWatermark(bool watermark);
|
void setWatermark(bool watermark);
|
||||||
|
|
||||||
|
bool isReplaceCarriageReturns() const;
|
||||||
|
void setReplaceCarriageReturns(bool isReplaceCarriageReturns);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateLayout();
|
void updateLayout();
|
||||||
bool isNeedExpandContent() const;
|
bool isNeedExpandContent() const;
|
||||||
QString replaceBR(QString text);
|
QString replaceBR(QString text) const;
|
||||||
QString replaceReturns(QString text);
|
QString replaceReturns(QString text) const;
|
||||||
int fakeMarginSize() const;
|
int fakeMarginSize() const;
|
||||||
QString getTextPart(int height, int skipHeight);
|
QString getTextPart(int height, int skipHeight);
|
||||||
void restoreLinksEvent();
|
void restoreLinksEvent();
|
||||||
@ -204,6 +208,7 @@ private:
|
|||||||
int m_underlineLineSize;
|
int m_underlineLineSize;
|
||||||
bool m_allowHTML;
|
bool m_allowHTML;
|
||||||
bool m_allowHTMLInFields;
|
bool m_allowHTMLInFields;
|
||||||
|
bool m_replaceCarriageReturns;
|
||||||
|
|
||||||
QString m_format;
|
QString m_format;
|
||||||
ValueType m_valueType;
|
ValueType m_valueType;
|
||||||
|
@ -135,6 +135,7 @@ void QObjectPropertyModel::translatePropertyName()
|
|||||||
tr("groupFieldName");
|
tr("groupFieldName");
|
||||||
tr("keepGroupTogether");
|
tr("keepGroupTogether");
|
||||||
tr("watermark");
|
tr("watermark");
|
||||||
|
tr("replaceCRwithBR");
|
||||||
}
|
}
|
||||||
|
|
||||||
void QObjectPropertyModel::clearObjectsList()
|
void QObjectPropertyModel::clearObjectsList()
|
||||||
|
@ -325,15 +325,15 @@ p, li { white-space: pre-wrap; }
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Keep bottom space</source>
|
<source>Keep bottom space</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Сохранять нижний отступ</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Start from new page</source>
|
<source>Start from new page</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Начинать с новой страницы</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Start new page</source>
|
<source>Start new page</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Начинать новую станицу</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
@ -458,7 +458,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Port</source>
|
<source>Port</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Порт</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
@ -1635,6 +1635,14 @@ p, li { white-space: pre-wrap; }
|
|||||||
<source>repeatOnEachRow</source>
|
<source>repeatOnEachRow</source>
|
||||||
<translation>Печатать на каждой странице</translation>
|
<translation>Печатать на каждой странице</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>watermark</source>
|
||||||
|
<translation>Водяной знак</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>replaceCRwithBR</source>
|
||||||
|
<translation>Заменять CR на BR</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>LimeReport::RectMMPropItem</name>
|
<name>LimeReport::RectMMPropItem</name>
|
||||||
@ -1957,11 +1965,11 @@ p, li { white-space: pre-wrap; }
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Hide left panel | Alt+L</source>
|
<source>Hide left panel | Alt+L</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Скрыть левую панель | Alt+L</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Hide right panel | Alt+R</source>
|
<source>Hide right panel | Alt+R</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Скрыть правую панель | Alt+R</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
@ -2239,7 +2247,7 @@ This preview is no longer valid.</source>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Seconds</source>
|
<source>Seconds</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation>Секунды</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
Loading…
Reference in New Issue
Block a user