diff --git a/common.pri b/common.pri index 6a8f275..3020408 100644 --- a/common.pri +++ b/common.pri @@ -62,7 +62,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 4 -LIMEREPORT_VERSION_RELEASE = 78 +LIMEREPORT_VERSION_RELEASE = 80 LIMEREPORT_VERSION = '\\"$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}\\"' DEFINES += LIMEREPORT_VERSION_STR=\"$${LIMEREPORT_VERSION}\" diff --git a/limereport/items/lrtextitem.cpp b/limereport/items/lrtextitem.cpp index 15e5809..a4384b0 100644 --- a/limereport/items/lrtextitem.cpp +++ b/limereport/items/lrtextitem.cpp @@ -59,7 +59,8 @@ namespace LimeReport{ TextItem::TextItem(QObject *owner, QGraphicsItem *parent) : 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(parent); BaseDesignIntf* parentItem = dynamic_cast(parent); @@ -289,8 +290,10 @@ void TextItem::setContent(const QString &value) void TextItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass, int maxHeight) { + if (isNeedExpandContent()) expandContent(dataManager, pass); + if (!isLoading() && (autoHeight() || autoWidth() || hasFollower()) ) initTextSizes(); @@ -331,12 +334,12 @@ bool TextItem::isNeedExpandContent() const return content().contains(rx); } -QString TextItem::replaceBR(QString text) +QString TextItem::replaceBR(QString text) const { return text.replace("
","\n"); } -QString TextItem::replaceReturns(QString text) +QString TextItem::replaceReturns(QString text) const { QString result = text.replace("\r\n","
"); result = result.replace("\n","
"); @@ -465,7 +468,11 @@ TextItem::TextPtr TextItem::textDocument() const TextPtr text(new QTextDocument); if (allowHTML()) - text->setHtml(m_strText); + if (isReplaceCarriageReturns()){ + text->setHtml(replaceReturns(m_strText)); + } else { + text->setHtml(m_strText); + } else 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 { return m_textIndent; diff --git a/limereport/items/lrtextitem.h b/limereport/items/lrtextitem.h index 5bc82fb..d8fa8cc 100644 --- a/limereport/items/lrtextitem.h +++ b/limereport/items/lrtextitem.h @@ -72,6 +72,7 @@ class TextItem : public LimeReport::ContentItemDesignIntf, IPageInit { Q_PROPERTY(qreal textIndent READ textIndent WRITE setTextIndent) Q_PROPERTY(Qt::LayoutDirection textLayoutDirection READ textLayoutDirection WRITE setTextLayoutDirection) Q_PROPERTY(bool watermark READ isWatermark WRITE setWatermark) + Q_PROPERTY(bool replaceCRwithBR READ isReplaceCarriageReturns WRITE setReplaceCarriageReturns) public: enum AutoWidth{NoneAutoWidth,MaxWordLength,MaxStringLength}; @@ -167,11 +168,14 @@ public: void setWatermark(bool watermark); + bool isReplaceCarriageReturns() const; + void setReplaceCarriageReturns(bool isReplaceCarriageReturns); + protected: void updateLayout(); bool isNeedExpandContent() const; - QString replaceBR(QString text); - QString replaceReturns(QString text); + QString replaceBR(QString text) const; + QString replaceReturns(QString text) const; int fakeMarginSize() const; QString getTextPart(int height, int skipHeight); void restoreLinksEvent(); @@ -204,6 +208,7 @@ private: int m_underlineLineSize; bool m_allowHTML; bool m_allowHTMLInFields; + bool m_replaceCarriageReturns; QString m_format; ValueType m_valueType; diff --git a/limereport/objectinspector/lrobjectitemmodel.cpp b/limereport/objectinspector/lrobjectitemmodel.cpp index 71b3adb..42b52fa 100644 --- a/limereport/objectinspector/lrobjectitemmodel.cpp +++ b/limereport/objectinspector/lrobjectitemmodel.cpp @@ -135,6 +135,7 @@ void QObjectPropertyModel::translatePropertyName() tr("groupFieldName"); tr("keepGroupTogether"); tr("watermark"); + tr("replaceCRwithBR"); } void QObjectPropertyModel::clearObjectsList() diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index 7fbb600..df9e655 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -325,15 +325,15 @@ p, li { white-space: pre-wrap; } Keep bottom space - + Сохранять нижний отступ Start from new page - + Начинать с новой страницы Start new page - + Начинать новую станицу @@ -458,7 +458,7 @@ p, li { white-space: pre-wrap; } Port - + Порт @@ -1635,6 +1635,14 @@ p, li { white-space: pre-wrap; } repeatOnEachRow Печатать на каждой странице + + watermark + Водяной знак + + + replaceCRwithBR + Заменять CR на BR + LimeReport::RectMMPropItem @@ -1957,11 +1965,11 @@ p, li { white-space: pre-wrap; } Hide left panel | Alt+L - + Скрыть левую панель | Alt+L Hide right panel | Alt+R - + Скрыть правую панель | Alt+R @@ -2239,7 +2247,7 @@ This preview is no longer valid. Seconds - + Секунды