diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 75cd41c..cea1052 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -98,8 +98,8 @@ private: class LIMEREPORT_EXPORT WatermarkSetting{ public: WatermarkSetting(const QString& text, const ItemGeometry& geometry, const QFont& font) - : m_text(text), m_font(font), m_opacity(50), m_geomerty(geometry), m_color(QColor(Qt::black)){} - WatermarkSetting(): m_font(QFont()), m_opacity(50), m_geomerty(ItemGeometry()){} + : m_text(text), m_font(font), m_opacity(50), m_geometry(geometry), m_color(QColor(Qt::black)){} + WatermarkSetting(): m_font(QFont()), m_opacity(50), m_geometry(ItemGeometry()){} QString text() const; void setText(const QString &text); @@ -109,8 +109,8 @@ public: int opacity() const; void setOpacity(const int &opacity); - ItemGeometry geomerty() const; - void setGeomerty(const ItemGeometry &geomerty); + ItemGeometry geometry() const; + void setGeometry(const ItemGeometry &geometry); QColor color() const; void setColor(const QColor &color); @@ -119,7 +119,7 @@ private: QString m_text; QFont m_font; int m_opacity; - ItemGeometry m_geomerty; + ItemGeometry m_geometry; QColor m_color; }; diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index ee7473d..a8dabb4 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -1165,9 +1165,9 @@ void ReportEnginePrivate::paintByExternalPainter(const QString& objectName, QPai BaseDesignIntf* ReportEnginePrivate::createWatermark(PageDesignIntf* page, WatermarkSetting watermarkSetting) { - ItemGeometryHelper geometry(watermarkSetting.geomerty()); + WatermarkHelper watermarkHelper(watermarkSetting); - BaseDesignIntf* watermark = page->addReportItem("TextItem", geometry.mapToPage(*page->pageItem()), geometry.sceneSize()); + BaseDesignIntf* watermark = page->addReportItem("TextItem", watermarkHelper.mapToPage(*page->pageItem()), watermarkHelper.sceneSize()); if (watermark){ watermark->setProperty("content", watermarkSetting.text()); watermark->setProperty("font",watermarkSetting.font()); @@ -1794,14 +1794,14 @@ void WatermarkSetting::setOpacity(const int &opacity) m_opacity = opacity; } -ItemGeometry WatermarkSetting::geomerty() const +ItemGeometry WatermarkSetting::geometry() const { - return m_geomerty; + return m_geometry; } -void WatermarkSetting::setGeomerty(const ItemGeometry &geomerty) +void WatermarkSetting::setGeometry(const ItemGeometry &geometry) { - m_geomerty = geomerty; + m_geometry = geometry; } QColor WatermarkSetting::color() const @@ -1814,52 +1814,52 @@ void WatermarkSetting::setColor(const QColor &color) m_color = color; } -qreal ItemGeometryHelper::sceneX() +qreal WatermarkHelper::sceneX() { - return valueToPixels(m_geometry.x()); + return valueToPixels(m_watermark.geometry().x()); } -qreal ItemGeometryHelper::sceneY() +qreal WatermarkHelper::sceneY() { - return valueToPixels(m_geometry.y()); + return valueToPixels(m_watermark.geometry().y()); } -qreal ItemGeometryHelper::sceneWidth() +qreal WatermarkHelper::sceneWidth() { - return valueToPixels(m_geometry.width()); + return valueToPixels(m_watermark.geometry().width()); } -qreal ItemGeometryHelper::sceneHeight() +qreal WatermarkHelper::sceneHeight() { - return valueToPixels(m_geometry.height()); + return valueToPixels(m_watermark.geometry().height()); } -QPointF ItemGeometryHelper::scenePos() +QPointF WatermarkHelper::scenePos() { return (QPointF(sceneX(), sceneY())); } -QSizeF ItemGeometryHelper::sceneSize() +QSizeF WatermarkHelper::sceneSize() { return (QSizeF(sceneWidth(), sceneHeight())); } -QPointF ItemGeometryHelper::mapToPage(const PageItemDesignIntf &page) +QPointF WatermarkHelper::mapToPage(const PageItemDesignIntf &page) { qreal startX = 0; qreal startY = 0; - if ( m_geometry.anchor() & Qt::AlignLeft){ + if ( m_watermark.geometry().anchor() & Qt::AlignLeft){ startX = 0; - } else if (m_geometry.anchor() & Qt::AlignRight){ + } else if ( m_watermark.geometry().anchor() & Qt::AlignRight){ startX = page.geometry().width(); } else { startX = page.geometry().width() / 2; } - if ( m_geometry.anchor() & Qt::AlignTop){ + if ( m_watermark.geometry().anchor() & Qt::AlignTop){ startY = 0; - } else if (m_geometry.anchor() & Qt::AlignBottom){ + } else if (m_watermark.geometry().anchor() & Qt::AlignBottom){ startY = page.geometry().height(); } else { startY = page.geometry().height() / 2; @@ -1868,9 +1868,9 @@ QPointF ItemGeometryHelper::mapToPage(const PageItemDesignIntf &page) return QPointF(startX + sceneX(), startY + sceneY()); } -qreal ItemGeometryHelper::valueToPixels(qreal value) +qreal WatermarkHelper::valueToPixels(qreal value) { - switch (m_geometry.type()) { + switch (m_watermark.geometry().type()) { case LimeReport::ItemGeometry::Milimeters: return value * Const::mmFACTOR; case LimeReport::ItemGeometry::Pixels: diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 75cd41c..cea1052 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -98,8 +98,8 @@ private: class LIMEREPORT_EXPORT WatermarkSetting{ public: WatermarkSetting(const QString& text, const ItemGeometry& geometry, const QFont& font) - : m_text(text), m_font(font), m_opacity(50), m_geomerty(geometry), m_color(QColor(Qt::black)){} - WatermarkSetting(): m_font(QFont()), m_opacity(50), m_geomerty(ItemGeometry()){} + : m_text(text), m_font(font), m_opacity(50), m_geometry(geometry), m_color(QColor(Qt::black)){} + WatermarkSetting(): m_font(QFont()), m_opacity(50), m_geometry(ItemGeometry()){} QString text() const; void setText(const QString &text); @@ -109,8 +109,8 @@ public: int opacity() const; void setOpacity(const int &opacity); - ItemGeometry geomerty() const; - void setGeomerty(const ItemGeometry &geomerty); + ItemGeometry geometry() const; + void setGeometry(const ItemGeometry &geometry); QColor color() const; void setColor(const QColor &color); @@ -119,7 +119,7 @@ private: QString m_text; QFont m_font; int m_opacity; - ItemGeometry m_geomerty; + ItemGeometry m_geometry; QColor m_color; }; diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 1432bd2..686a757 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -57,10 +57,10 @@ class ReportDesignWindow; class ReportExporterInterface; -class ItemGeometryHelper{ +class WatermarkHelper{ public: - ItemGeometryHelper(const ItemGeometry& geometry) - : m_geometry(geometry){} + WatermarkHelper(const WatermarkSetting& watermark) + : m_watermark(watermark){} qreal sceneX(); qreal sceneY(); qreal sceneWidth(); @@ -71,7 +71,7 @@ public: private: qreal valueToPixels(qreal value); private: - const ItemGeometry& m_geometry; + const WatermarkSetting& m_watermark; }; class ReportEnginePrivateInterface {