Commit 5cd08da7 authored by Tusooa Zhu's avatar Tusooa Zhu

Rid KoShapeBackground hierarchy of derived d-pointers and KisSharedDescendent

The class KisSharedDescendent used to be employed to wrap up
derived d-pointers, but since we have already refactored them
out, there is no reason to keep them now.
parent 04897836
......@@ -18,9 +18,7 @@
*/
#include "KoColorBackground.h"
#include "KoColorBackground_p.h"
#include "KoShapeSavingContext.h"
#include "KisSharedDescendent.h"
#include <KoOdfGraphicStyles.h>
#include <KoOdfLoadingContext.h>
#include <KoXmlNS.h>
......@@ -29,22 +27,33 @@
#include <QColor>
#include <QPainter>
KoColorBackground::KoColorBackground()
: KoShapeBackground(KisSharedDescendent<KoShapeBackgroundPrivate>::of(KoColorBackgroundPrivate()))
class KoColorBackground::Private : public QSharedData
{
}
public:
Private()
: QSharedData()
, color(Qt::black)
, style(Qt::SolidPattern)
{}
KoColorBackground::KoColorBackground(KisSharedDescendent<KoShapeBackgroundPrivate> &dd)
: KoShapeBackground(dd)
QColor color;
Qt::BrushStyle style;
};
KoColorBackground::KoColorBackground()
: KoShapeBackground()
, d(new Private)
{
}
KoColorBackground::KoColorBackground(const QColor &color, Qt::BrushStyle style)
: KoShapeBackground(KisSharedDescendent<KoShapeBackgroundPrivate>::of(KoColorBackgroundPrivate()))
: KoShapeBackground()
, d(new Private)
{
SHARED_D(KoColorBackground);
if (style < Qt::SolidPattern || style >= Qt::LinearGradientPattern)
if (style < Qt::SolidPattern || style >= Qt::LinearGradientPattern) {
style = Qt::SolidPattern;
}
d->style = style;
d->color = color;
}
......@@ -55,33 +64,27 @@ KoColorBackground::~KoColorBackground()
bool KoColorBackground::compareTo(const KoShapeBackground *other) const
{
CONST_SHARED_D(KoColorBackground);
const KoColorBackground *bg = dynamic_cast<const KoColorBackground*>(other);
return bg && bg->color() == d->color;
}
QColor KoColorBackground::color() const
{
CONST_SHARED_D(KoColorBackground);
return d->color;
}
void KoColorBackground::setColor(const QColor &color)
{
SHARED_D(KoColorBackground);
d->color = color;
}
Qt::BrushStyle KoColorBackground::style() const
{
CONST_SHARED_D(KoColorBackground);
return d->style;
}
QBrush KoColorBackground::brush() const
{
CONST_SHARED_D(KoColorBackground);
return QBrush(d->color, d->style);
}
......@@ -93,13 +96,11 @@ void KoColorBackground::paint(QPainter &painter, const KoViewConverter &/*conver
void KoColorBackground::fillStyle(KoGenStyle &style, KoShapeSavingContext &context)
{
SHARED_D(KoColorBackground);
KoOdfGraphicStyles::saveOdfFillStyle(style, context.mainStyles(), QBrush(d->color, d->style));
}
bool KoColorBackground::loadStyle(KoOdfLoadingContext & context, const QSizeF &)
{
SHARED_D(KoColorBackground);
KoStyleStack &styleStack = context.styleStack();
if (! styleStack.hasProperty(KoXmlNS::draw, "fill"))
return false;
......
......@@ -23,6 +23,7 @@
#include "KoShapeBackground.h"
#include "kritaflake_export.h"
#include <Qt>
#include <QSharedDataPointer>
class KoColorBackgroundPrivate;
class QColor;
......@@ -58,10 +59,9 @@ public:
void fillStyle(KoGenStyle &style, KoShapeSavingContext &context) override;
// reimplemented from KoShapeBackground
bool loadStyle(KoOdfLoadingContext & context, const QSizeF &shapeSize) override;
protected:
KoColorBackground(KisSharedDescendent<KoShapeBackgroundPrivate> &dd);
private:
SHARED_DECLARE_PRIVATE(KoColorBackground)
struct Private;
QSharedDataPointer<Private> d;
};
#endif // KOCOLORBACKGROUND_H
/* This file is part of the KDE project
* Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KOCOLORBACKGROUND_P_H
#define KOCOLORBACKGROUND_P_H
#include "KoShapeBackground_p.h"
#include <QColor>
class KoColorBackgroundPrivate : public KoShapeBackgroundPrivate
{
public:
KoColorBackgroundPrivate()
: color(Qt::black)
, style(Qt::SolidPattern)
{}
QColor color;
Qt::BrushStyle style;
};
#endif // KOCOLORBACKGROUND_P_H
......@@ -18,7 +18,6 @@
*/
#include "KoGradientBackground.h"
#include "KoShapeBackground_p.h"
#include "KoFlake.h"
#include <KoStyleStack.h>
#include <KoXmlNS.h>
......@@ -31,12 +30,14 @@
#include <QSharedPointer>
#include <QBrush>
#include <QPainter>
#include <QSharedData>
class KoGradientBackgroundPrivate : public KoShapeBackgroundPrivate
class KoGradientBackground::Private : public QSharedData
{
public:
KoGradientBackgroundPrivate()
: gradient(0)
Private()
: QSharedData()
, gradient(0)
{}
QGradient *gradient;
......@@ -44,18 +45,18 @@ public:
};
KoGradientBackground::KoGradientBackground(QGradient * gradient, const QTransform &matrix)
: KoShapeBackground(KisSharedDescendent<KoShapeBackgroundPrivate>::of(KoGradientBackgroundPrivate()))
: KoShapeBackground()
, d(new Private)
{
SHARED_D(KoGradientBackground);
d->gradient = gradient;
d->matrix = matrix;
Q_ASSERT(d->gradient);
}
KoGradientBackground::KoGradientBackground(const QGradient & gradient, const QTransform &matrix)
: KoShapeBackground(KisSharedDescendent<KoShapeBackgroundPrivate>::of(KoGradientBackgroundPrivate()))
: KoShapeBackground()
, d(new Private)
{
SHARED_D(KoGradientBackground);
d->gradient = KoFlake::cloneGradient(&gradient);
d->matrix = matrix;
Q_ASSERT(d->gradient);
......@@ -63,35 +64,30 @@ KoGradientBackground::KoGradientBackground(const QGradient & gradient, const QTr
KoGradientBackground::~KoGradientBackground()
{
SHARED_D(KoGradientBackground);
delete d->gradient;
}
bool KoGradientBackground::compareTo(const KoShapeBackground *other) const
{
CONST_SHARED_D(KoGradientBackground);
const KoGradientBackground *otherGradient = dynamic_cast<const KoGradientBackground*>(other);
return otherGradient &&
d->matrix == otherGradient->d_func()->matrix &&
*d->gradient == *otherGradient->d_func()->gradient;
d->matrix == otherGradient->d->matrix &&
*d->gradient == *otherGradient->d->gradient;
}
void KoGradientBackground::setTransform(const QTransform &matrix)
{
SHARED_D(KoGradientBackground);
d->matrix = matrix;
}
QTransform KoGradientBackground::transform() const
{
CONST_SHARED_D(KoGradientBackground);
return d->matrix;
}
void KoGradientBackground::setGradient(const QGradient &gradient)
{
SHARED_D(KoGradientBackground);
delete d->gradient;
d->gradient = KoFlake::cloneGradient(&gradient);
......@@ -100,13 +96,11 @@ void KoGradientBackground::setGradient(const QGradient &gradient)
const QGradient * KoGradientBackground::gradient() const
{
CONST_SHARED_D(KoGradientBackground);
return d->gradient;
}
void KoGradientBackground::paint(QPainter &painter, const KoViewConverter &/*converter*/, KoShapePaintingContext &/*context*/, const QPainterPath &fillPath) const
{
CONST_SHARED_D(KoGradientBackground);
if (!d->gradient) return;
if (d->gradient->coordinateMode() == QGradient::ObjectBoundingMode) {
......@@ -147,7 +141,6 @@ void KoGradientBackground::paint(QPainter &painter, const KoViewConverter &/*con
void KoGradientBackground::fillStyle(KoGenStyle &style, KoShapeSavingContext &context)
{
SHARED_D(KoGradientBackground);
if (!d->gradient) return;
QBrush brush(*d->gradient);
brush.setTransform(d->matrix);
......@@ -156,7 +149,6 @@ void KoGradientBackground::fillStyle(KoGenStyle &style, KoShapeSavingContext &co
bool KoGradientBackground::loadStyle(KoOdfLoadingContext &context, const QSizeF &shapeSize)
{
SHARED_D(KoGradientBackground);
KoStyleStack &styleStack = context.styleStack();
if (! styleStack.hasProperty(KoXmlNS::draw, "fill"))
return false;
......
......@@ -24,9 +24,9 @@
#include "kritaflake_export.h"
#include <QTransform>
#include <QSharedDataPointer>
class QGradient;
class KoGradientBackgroundPrivate;
/// A gradient shape background
class KRITAFLAKE_EXPORT KoGradientBackground : public KoShapeBackground
......@@ -71,7 +71,8 @@ public:
/// reimplemented from KoShapeBackground
bool loadStyle(KoOdfLoadingContext &context, const QSizeF &shapeSize) override;
private:
SHARED_DECLARE_PRIVATE(KoGradientBackground)
class Private;
QSharedDataPointer<Private> d;
};
#endif // KOGRADIENTBACKGROUND_H
......@@ -19,7 +19,6 @@
*/
#include "KoHatchBackground.h"
#include "KoColorBackground_p.h"
#include <KoOdfLoadingContext.h>
#include <KoStyleStack.h>
......@@ -37,13 +36,14 @@
#include <QString>
#include <QPainter>
class KoHatchBackgroundPrivate : public KoColorBackgroundPrivate
class KoHatchBackground::Private : public QSharedData
{
public:
KoHatchBackgroundPrivate()
: angle(0.0)
, distance(1.0)
, style(KoHatchBackground::Single)
Private()
: QSharedData()
, angle(0.0)
, distance(1.0)
, style(KoHatchBackground::Single)
{}
QColor lineColor;
......@@ -54,14 +54,18 @@ public:
};
KoHatchBackground::KoHatchBackground()
: KoColorBackground(KisSharedDescendent<KoShapeBackgroundPrivate>::of(KoHatchBackgroundPrivate()))
: KoColorBackground()
, d(new Private)
{
}
KoHatchBackground::~KoHatchBackground()
{
}
void KoHatchBackground::paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &context, const QPainterPath &fillPath) const
{
CONST_SHARED_D(KoHatchBackground);
if (d->color.isValid()) {
if (color().isValid()) {
// paint background color if set by using the color background
KoColorBackground::paint(painter, converter, context, fillPath);
}
......@@ -127,8 +131,6 @@ void KoHatchBackground::paint(QPainter &painter, const KoViewConverter &converte
void KoHatchBackground::fillStyle(KoGenStyle &style, KoShapeSavingContext &context)
{
SHARED_D(KoHatchBackground);
KoGenStyle::Type type = style.type();
KoGenStyle::PropertyType propertyType = (type == KoGenStyle::GraphicStyle || type == KoGenStyle::GraphicAutoStyle ||
type == KoGenStyle::DrawingPageStyle || type == KoGenStyle::DrawingPageAutoStyle )
......@@ -136,16 +138,15 @@ void KoHatchBackground::fillStyle(KoGenStyle &style, KoShapeSavingContext &conte
style.addProperty("draw:fill", "hatch", propertyType);
style.addProperty("draw:fill-hatch-name", saveHatchStyle(context), propertyType);
bool fillHatchSolid = d->color.isValid();
bool fillHatchSolid = color().isValid();
style.addProperty("draw:fill-hatch-solid", fillHatchSolid, propertyType);
if (fillHatchSolid) {
style.addProperty("draw:fill-color", d->color.name(), propertyType);
style.addProperty("draw:fill-color", color().name(), propertyType);
}
}
QString KoHatchBackground::saveHatchStyle(KoShapeSavingContext &context) const
{
CONST_SHARED_D(KoHatchBackground);
KoGenStyle hatchStyle(KoGenStyle::HatchStyle /*no family name*/);
hatchStyle.addAttribute("draw:display-name", d->name);
hatchStyle.addAttribute("draw:color", d->lineColor.name());
......@@ -172,7 +173,6 @@ QString KoHatchBackground::saveHatchStyle(KoShapeSavingContext &context) const
bool KoHatchBackground::loadStyle(KoOdfLoadingContext &context, const QSizeF &shapeSize)
{
// <draw:hatch draw:name="hatchStyle3" draw:color="#000000" draw:display-name="#000000 Vertical" draw:distance="0.102cm" draw:rotation="900" draw:style="single"/>
SHARED_D(KoHatchBackground);
Q_UNUSED(shapeSize);
KoStyleStack &styleStack = context.styleStack();
......@@ -205,14 +205,16 @@ bool KoHatchBackground::loadStyle(KoOdfLoadingContext &context, const QSizeF &sh
if (fillHatchSolid) {
QString fillColor = styleStack.property(KoXmlNS::draw, "fill-color");
if (!fillColor.isEmpty()) {
d->color.setNamedColor(fillColor);
QColor c = color();
c.setNamedColor(fillColor);
setColor(c);
}
else {
d->color =QColor();
setColor(QColor());
}
}
else {
d->color = QColor();
setColor(QColor());
}
d->lineColor.setNamedColor(draw->attributeNS(KoXmlNS::draw, "color", QString("#000000")));
......
......@@ -23,8 +23,6 @@
#include "KoColorBackground.h"
class KoHatchBackgroundPrivate;
/**
* A hatch shape background
*/
......@@ -38,6 +36,7 @@ public:
};
KoHatchBackground();
~KoHatchBackground() override;
// reimplemented
void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &context, const QPainterPath &fillPath) const override;
......@@ -52,7 +51,8 @@ private:
QString saveHatchStyle(KoShapeSavingContext &context) const;
private:
SHARED_DECLARE_PRIVATE(KoHatchBackground)
class Private;
QSharedDataPointer<Private> d;
};
#endif /* KOHATCHBACKGROUND_H */
......@@ -20,7 +20,6 @@
#include "KoOdfGradientBackground.h"
#include "KoShapeBackground_p.h"
#include "KoShapeSavingContext.h"
#include <KoUnit.h>
......@@ -35,14 +34,16 @@
#include <QColor>
#include <QImage>
#include <qmath.h>
#include <QSharedData>
#include "FlakeDebug.h"
class KoOdfGradientBackgroundPrivate : public KoShapeBackgroundPrivate
class KoOdfGradientBackground::Private : public QSharedData
{
public:
KoOdfGradientBackgroundPrivate()
: style()
Private()
: QSharedData()
, style()
, cx(0)
, cy(0)
, startColor()
......@@ -51,7 +52,7 @@ public:
, border(0)
, opacity(1.0)
{}
~KoOdfGradientBackgroundPrivate() override{};
~Private() = default;
//data
QString style;
int cx;
......@@ -65,7 +66,8 @@ public:
KoOdfGradientBackground::KoOdfGradientBackground()
: KoShapeBackground(KisSharedDescendent<KoShapeBackgroundPrivate>::of(KoOdfGradientBackgroundPrivate()))
: KoShapeBackground()
, d(new Private)
{
}
......@@ -84,7 +86,6 @@ bool KoOdfGradientBackground::compareTo(const KoShapeBackground *other) const
bool KoOdfGradientBackground::loadOdf(const KoXmlElement& e)
{
SHARED_D(KoOdfGradientBackground);
d->style = e.attributeNS(KoXmlNS::draw, "style", QString());
//TODO: support ellipsoid here too
if ((d->style != "rectangular") && (d->style != "square")) {
......@@ -109,8 +110,6 @@ bool KoOdfGradientBackground::loadOdf(const KoXmlElement& e)
void KoOdfGradientBackground::saveOdf(KoGenStyle& styleFill, KoGenStyles& mainStyles) const
{
CONST_SHARED_D(KoOdfGradientBackground);
KoGenStyle::Type type = styleFill.type();
KoGenStyle::PropertyType propertyType = (type == KoGenStyle::GraphicStyle || type == KoGenStyle::GraphicAutoStyle ||
type == KoGenStyle::DrawingPageStyle || type == KoGenStyle::DrawingPageAutoStyle )
......@@ -139,8 +138,6 @@ void KoOdfGradientBackground::saveOdf(KoGenStyle& styleFill, KoGenStyles& mainSt
void KoOdfGradientBackground::paint(QPainter& painter, const KoViewConverter &/*converter*/, KoShapePaintingContext &/*context*/, const QPainterPath& fillPath) const
{
CONST_SHARED_D(KoOdfGradientBackground);
QImage buffer;
QRectF targetRect = fillPath.boundingRect();
......@@ -169,7 +166,6 @@ void KoOdfGradientBackground::fillStyle(KoGenStyle& style, KoShapeSavingContext&
bool KoOdfGradientBackground::loadStyle(KoOdfLoadingContext& context, const QSizeF& shapeSize)
{
Q_UNUSED(shapeSize);
SHARED_D(KoOdfGradientBackground);
KoStyleStack &styleStack = context.styleStack();
if (!styleStack.hasProperty(KoXmlNS::draw, "fill")) {
......@@ -197,7 +193,6 @@ bool KoOdfGradientBackground::loadStyle(KoOdfLoadingContext& context, const QSiz
void KoOdfGradientBackground::renderSquareGradient(QImage& buffer) const
{
CONST_SHARED_D(KoOdfGradientBackground);
buffer.fill(d->startColor.rgba());
QPainter painter(&buffer);
......@@ -261,7 +256,6 @@ void KoOdfGradientBackground::renderSquareGradient(QImage& buffer) const
void KoOdfGradientBackground::renderRectangleGradient(QImage& buffer) const
{
CONST_SHARED_D(KoOdfGradientBackground);
buffer.fill(d->startColor.rgba());
QPainter painter(&buffer);
......@@ -377,7 +371,6 @@ void KoOdfGradientBackground::renderRectangleGradient(QImage& buffer) const
void KoOdfGradientBackground::debug() const
{
CONST_SHARED_D(KoOdfGradientBackground);
debugFlake << "cx,cy: "<< d->cx << d->cy;
debugFlake << "style" << d->style;
debugFlake << "colors" << d->startColor << d->endColor;
......
......@@ -26,8 +26,9 @@
class QImage;
class KoOdfGradientBackgroundPrivate;
#include <KoXmlReaderForward.h>
#include <QSharedDataPointer>
class KoGenStyles;
class KoGenStyle;
......@@ -58,7 +59,8 @@ private:
private:
void debug() const;
private:
SHARED_DECLARE_PRIVATE(KoOdfGradientBackground)
class Private;
QSharedDataPointer<Private> d;
};
#endif
......@@ -18,7 +18,6 @@
*/
#include "KoPatternBackground.h"
#include "KoShapeBackground_p.h"
#include "KoShapeSavingContext.h"
#include "KoImageData.h"
#include "KoImageCollection.h"
......@@ -38,19 +37,22 @@
#include <QBrush>
#include <QPainter>
#include <QPointer>
#include <QSharedData>
class KoPatternBackgroundPrivate : public KoShapeBackgroundPrivate
class KoPatternBackground::Private : public QSharedData
{
public:
KoPatternBackgroundPrivate()
: repeat(KoPatternBackground::Tiled)
Private()
: QSharedData()
, repeat(KoPatternBackground::Tiled)
, refPoint(KoPatternBackground::TopLeft)
, imageCollection(0)
, imageData(0)
{
}
~KoPatternBackgroundPrivate() override {
~Private()
{
delete imageData;
}
......@@ -133,9 +135,9 @@ public:
KoPatternBackground::KoPatternBackground(KoImageCollection *imageCollection)
: KoShapeBackground(KisSharedDescendent<KoShapeBackgroundPrivate>::of(KoPatternBackgroundPrivate()))
: KoShapeBackground()
, d(new Private)
{
SHARED_D(KoPatternBackground);
d->imageCollection = imageCollection;
Q_ASSERT(d->imageCollection);
}
......@@ -152,19 +154,16 @@ bool KoPatternBackground::compareTo(const KoShapeBackground *other) const
void KoPatternBackground::setTransform(const QTransform &matrix)
{
SHARED_D(KoPatternBackground);
d->matrix = matrix;
}
QTransform KoPatternBackground::transform() const
{
CONST_SHARED_D(KoPatternBackground);
return d->matrix;
}
void KoPatternBackground::setPattern(const QImage &pattern)
{
SHARED_D(KoPatternBackground);
delete d->imageData;
if (d->imageCollection) {
d->imageData = d->imageCollection->createImageData(pattern);
......@@ -173,7 +172,6 @@ void KoPatternBackground::setPattern(const QImage &pattern)
void KoPatternBackground::setPattern(KoImageData *imageData)
{
SHARED_D(KoPatternBackground);
delete d->imageData;
d->imageData = imageData;
......@@ -181,7 +179,6 @@ void KoPatternBackground::setPattern(KoImageData *imageData)
QImage KoPatternBackground::pattern() const
{
CONST_SHARED_D(KoPatternBackground);
if (d->imageData)
return d->imageData->image();
return QImage();
......@@ -189,37 +186,31 @@ QImage KoPatternBackground::pattern() const
void KoPatternBackground::setRepeat(PatternRepeat repeat)
{
SHARED_D(KoPatternBackground);
d->repeat = repeat;
}
KoPatternBackground::PatternRepeat KoPatternBackground::repeat() const
{
CONST_SHARED_D(KoPatternBackground);
return d->repeat;
}
KoPatternBackground::ReferencePoint KoPatternBackground::referencePoint() const
{
CONST_SHARED_D(KoPatternBackground);
return d->refPoint;
}
void KoPatternBackground::setReferencePoint(ReferencePoint referencePoint)
{
SHARED_D(KoPatternBackground);
d->refPoint = referencePoint;
}
QPointF KoPatternBackground::referencePointOffset() const
{
CONST_SHARED_D(KoPatternBackground);
return d->refPointOffsetPercent;
}
void KoPatternBackground::setReferencePointOffset(const QPointF &offset)
{
SHARED_D(KoPatternBackground);
qreal ox = qMax(qreal(0.0), qMin(qreal(100.0), offset.x()));
qreal oy = qMax(qreal(0.0), qMin(qreal(100.0), offset.y()));
......@@ -228,38 +219,32 @@ void KoPatternBackground::setReferencePointOffset(const QPointF &offset)
QPointF KoPatternBackground::tileRepeatOffset() const
{
CONST_SHARED_D(KoPatternBackground);
return d->tileRepeatOffsetPercent;
}
void KoPatternBackground::setTileRepeatOffset(const QPointF &offset)
{
SHARED_D(KoPatternBackground);
d->tileRepeatOffsetPercent = offset;
}
QSizeF KoPatternBackground::patternDisplaySize() const
{
CONST_SHARED_D(KoPatternBackground);
return d->targetSize();
}
void KoPatternBackground::setPatternDisplaySize(const QSizeF &size)
{
SHARED_D(KoPatternBackground);
d->targetImageSizePercent = QSizeF();
d->targetImageSize = size;
}
QSizeF KoPatternBackground::patternOriginalSize() const
{
CONST_SHARED_D(KoPatternBackground);
return d->imageData->imageSize();
}
void KoPatternBackground::paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &/*context*/, const QPainterPath &fillPath) const
{
CONST_SHARED_D(KoPatternBackground);
if (! d->imageData)
return;
......@@ -311,7 +296,6 @@ void KoPatternBackground::paint(QPainter &painter, const KoViewConverter &conver
void KoPatternBackground::fillStyle(KoGenStyle &style, KoShapeSavingContext &context)
{
SHARED_D(KoPatternBackground);
if (! d->imageData)
return;
......@@ -373,7 +357,6 @@ void KoPatternBackground::fillStyle(KoGenStyle &style, KoShapeSavingContext &con
bool KoPatternBackground::loadStyle(KoOdfLoadingContext &context, const QSizeF &)
{
SHARED_D(KoPatternBackground);
KoStyleStack &styleStack = context.styleStack();
if (! styleStack.hasProperty(KoXmlNS::draw, "fill"))
return false;
......@@ -477,7 +460,6 @@ bool KoPatternBackground::loadStyle(KoOdfLoadingContext &context, const QSizeF &
QRectF KoPatternBackground::patternRectFromFillSize(const QSizeF &size)
{
SHARED_D(KoPatternBackground);
QRectF rect;
switch (d->repeat) {
......
......@@ -23,6 +23,8 @@
#include "KoShapeBackground.h"
#include "kritaflake_export.h"
#include <QSharedDataPointer>
class KoImageCollection;
class KoOdfLoadingContext;
class KoPatternBackgroundPrivate;
......@@ -121,7 +123,8 @@ public:
/// Returns the bounding rect of the pattern image based on the given fill size
QRectF patternRectFromFillSize(const QSizeF &size);
private:
SHARED_DECLARE_PRIVATE(KoPatternBackground)
class Private;
QSharedDataPointer<Private> d;