Commit 09e08d65 authored by Inge Wallin's avatar Inge Wallin

Rename KoShapeBorderModel.cpp -> KoShapeStrokeModel.cpp

As written in the review request:

There are 2 reasons for this change:

 1. It increases the way the name describes what it actually is
    for. There are many places in the code that looks like:
      KoShapeBorderModel *stroke = ...
    so naming it "...Stroke..." is both closer to the odf tags and
    also to the rest of the code.
 2. It reduces the confusion between KoShapeBorderModel and KoBorder
    which don't have anything to do with each other.

REVIEW: 104405
parent baf07c69
...@@ -76,7 +76,7 @@ set(flake_SRCS ...@@ -76,7 +76,7 @@ set(flake_SRCS
KoLoadingShapeUpdater.cpp KoLoadingShapeUpdater.cpp
KoPathShapeLoader.cpp KoPathShapeLoader.cpp
ShapeDeleter_p.cpp ShapeDeleter_p.cpp
KoShapeBorderModel.cpp KoShapeStrokeModel.cpp
KoShapeBorderFactoryBase.cpp KoShapeBorderFactoryBase.cpp
KoShapeBorderRegistry.cpp KoShapeBorderRegistry.cpp
KoLineBorder.cpp KoLineBorder.cpp
...@@ -129,7 +129,6 @@ set(flake_SRCS ...@@ -129,7 +129,6 @@ set(flake_SRCS
commands/KoShapeGroupCommand.cpp commands/KoShapeGroupCommand.cpp
commands/KoShapeAlignCommand.cpp commands/KoShapeAlignCommand.cpp
commands/KoShapeBackgroundCommand.cpp commands/KoShapeBackgroundCommand.cpp
commands/KoShapeBorderCommand.cpp
commands/KoShapeCreateCommand.cpp commands/KoShapeCreateCommand.cpp
commands/KoShapeDeleteCommand.cpp commands/KoShapeDeleteCommand.cpp
commands/KoShapeDistributeCommand.cpp commands/KoShapeDistributeCommand.cpp
...@@ -137,6 +136,7 @@ set(flake_SRCS ...@@ -137,6 +136,7 @@ set(flake_SRCS
commands/KoShapeMoveCommand.cpp commands/KoShapeMoveCommand.cpp
commands/KoShapeShearCommand.cpp commands/KoShapeShearCommand.cpp
commands/KoShapeSizeCommand.cpp commands/KoShapeSizeCommand.cpp
commands/KoShapeStrokeCommand.cpp
commands/KoShapeUngroupCommand.cpp commands/KoShapeUngroupCommand.cpp
commands/KoShapeReorderCommand.cpp commands/KoShapeReorderCommand.cpp
commands/KoShapeKeepAspectRatioCommand.cpp commands/KoShapeKeepAspectRatioCommand.cpp
...@@ -279,7 +279,7 @@ install( ...@@ -279,7 +279,7 @@ install(
KoRTree.h KoRTree.h
KoSelection.h KoSelection.h
KoShape.h KoShape.h
KoShapeBorderModel.h KoShapeStrokeModel.h
KoToolSelection.h KoToolSelection.h
KoShapeContainer.h KoShapeContainer.h
KoShapeContainerModel.h KoShapeContainerModel.h
...@@ -330,7 +330,7 @@ install( ...@@ -330,7 +330,7 @@ install(
commands/KoPathSeparateCommand.h commands/KoPathSeparateCommand.h
commands/KoShapeAlignCommand.h commands/KoShapeAlignCommand.h
commands/KoShapeBackgroundCommand.h commands/KoShapeBackgroundCommand.h
commands/KoShapeBorderCommand.h commands/KoShapeStrokeCommand.h
commands/KoShapeCreateCommand.h commands/KoShapeCreateCommand.h
commands/KoShapeDeleteCommand.h commands/KoShapeDeleteCommand.h
commands/KoShapeDistributeCommand.h commands/KoShapeDistributeCommand.h
......
...@@ -114,20 +114,20 @@ KoUnit KoCanvasResourceManager::unitResource(int key) const ...@@ -114,20 +114,20 @@ KoUnit KoCanvasResourceManager::unitResource(int key) const
} }
void KoCanvasResourceManager::setActiveBorder(const KoLineBorder &border) void KoCanvasResourceManager::setActiveStroke(const KoLineBorder &stroke)
{ {
QVariant v; QVariant v;
v.setValue(border); v.setValue(stroke);
setResource(ActiveBorder, v); setResource(ActiveStroke, v);
} }
KoLineBorder KoCanvasResourceManager::activeBorder() const KoLineBorder KoCanvasResourceManager::activeStroke() const
{ {
if (!d->manager.hasResource(ActiveBorder)) { if (!d->manager.hasResource(ActiveStroke)) {
KoLineBorder empty; KoLineBorder empty;
return empty; return empty;
} }
return resource(ActiveBorder).value<KoLineBorder>(); return resource(ActiveStroke).value<KoLineBorder>();
} }
bool KoCanvasResourceManager::boolResource(int key) const bool KoCanvasResourceManager::boolResource(int key) const
......
...@@ -70,7 +70,7 @@ public: ...@@ -70,7 +70,7 @@ public:
enum CanvasResource { enum CanvasResource {
ForegroundColor, ///< The active forground color selected for this canvas. ForegroundColor, ///< The active forground color selected for this canvas.
BackgroundColor, ///< The active background color selected for this canvas. BackgroundColor, ///< The active background color selected for this canvas.
ActiveBorder, ///< The active border selected for this canvas ActiveStroke, ///< The active stroke selected for this canvas
PageSize, ///< The size of the (current) page in postscript points. PageSize, ///< The size of the (current) page in postscript points.
Unit, ///< The unit of this canvas Unit, ///< The unit of this canvas
CurrentPage, ///< The current page number CurrentPage, ///< The current page number
...@@ -158,11 +158,11 @@ public: ...@@ -158,11 +158,11 @@ public:
*/ */
KoColor backgroundColor() const; KoColor backgroundColor() const;
/// Sets the border resource /// Sets the stroke resource
void setActiveBorder(const KoLineBorder &border); void setActiveStroke(const KoLineBorder &stroke);
/// Returns the border resource /// Returns the stroke resource
KoLineBorder activeBorder() const; KoLineBorder activeStroke() const;
/** /**
* Return the resource determined by param key as a boolean. * Return the resource determined by param key as a boolean.
......
...@@ -42,7 +42,7 @@ KoConnectionShapeFactory::KoConnectionShapeFactory() ...@@ -42,7 +42,7 @@ KoConnectionShapeFactory::KoConnectionShapeFactory()
KoShape* KoConnectionShapeFactory::createDefaultShape(KoDocumentResourceManager *) const KoShape* KoConnectionShapeFactory::createDefaultShape(KoDocumentResourceManager *) const
{ {
KoConnectionShape * shape = new KoConnectionShape(); KoConnectionShape * shape = new KoConnectionShape();
shape->setBorder(new KoLineBorder()); shape->setStroke(new KoLineBorder());
shape->setShapeId(KoPathShapeId); shape->setShapeId(KoPathShapeId);
return shape; return shape;
} }
......
...@@ -78,7 +78,7 @@ namespace KoFlake ...@@ -78,7 +78,7 @@ namespace KoFlake
*/ */
enum StyleType { enum StyleType {
Background, ///< the background / fill style is active Background, ///< the background / fill style is active
Foreground ///< the foreground / border style is active Foreground ///< the foreground / stroke style is active
}; };
/// clones the given gradient /// clones the given gradient
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <QDebug> #include <QDebug>
/** /**
* An Insets object is a representation of the borders of a shape. * An Insets object is a representation of the strokes of a shape.
*/ */
struct FLAKE_EXPORT KoInsets struct FLAKE_EXPORT KoInsets
{ {
......
...@@ -68,7 +68,7 @@ KoLineBorder::KoLineBorder() ...@@ -68,7 +68,7 @@ KoLineBorder::KoLineBorder()
} }
KoLineBorder::KoLineBorder(const KoLineBorder &other) KoLineBorder::KoLineBorder(const KoLineBorder &other)
: KoShapeBorderModel(), d(new Private()) : KoShapeStrokeModel(), d(new Private())
{ {
d->color = other.d->color; d->color = other.d->color;
d->pen = other.d->pen; d->pen = other.d->pen;
...@@ -110,7 +110,7 @@ void KoLineBorder::fillStyle(KoGenStyle &style, KoShapeSavingContext &context) c ...@@ -110,7 +110,7 @@ void KoLineBorder::fillStyle(KoGenStyle &style, KoShapeSavingContext &context) c
KoOdfGraphicStyles::saveOdfStrokeStyle(style, context.mainStyles(), pen); KoOdfGraphicStyles::saveOdfStrokeStyle(style, context.mainStyles(), pen);
} }
void KoLineBorder::borderInsets(const KoShape *shape, KoInsets &insets) const void KoLineBorder::strokeInsets(const KoShape *shape, KoInsets &insets) const
{ {
Q_UNUSED(shape); Q_UNUSED(shape);
qreal lineWidth = d->pen.widthF(); qreal lineWidth = d->pen.widthF();
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#define KOLINEBORDER_H #define KOLINEBORDER_H
#include "KoInsets.h" #include "KoInsets.h"
#include "KoShapeBorderModel.h" #include "KoShapeStrokeModel.h"
#include "flake_export.h" #include "flake_export.h"
...@@ -35,7 +35,7 @@ class KoViewConverter; ...@@ -35,7 +35,7 @@ class KoViewConverter;
/** /**
* A border for shapes that draws a single line around the object. * A border for shapes that draws a single line around the object.
*/ */
class FLAKE_EXPORT KoLineBorder : public KoShapeBorderModel class FLAKE_EXPORT KoLineBorder : public KoShapeStrokeModel
{ {
public: public:
/// Constructor for a thin line in black /// Constructor for a thin line in black
...@@ -92,10 +92,10 @@ public: ...@@ -92,10 +92,10 @@ public:
/// Returns the strokes brush /// Returns the strokes brush
QBrush lineBrush() const; QBrush lineBrush() const;
// pure virtuals from KoShapeStrokeModel implemented here.
virtual void fillStyle(KoGenStyle &style, KoShapeSavingContext &context) const; virtual void fillStyle(KoGenStyle &style, KoShapeSavingContext &context) const;
virtual void borderInsets(const KoShape *shape, KoInsets &insets) const; virtual void strokeInsets(const KoShape *shape, KoInsets &insets) const;
virtual bool hasTransparency() const; virtual bool hasTransparency() const;
virtual void paint(KoShape *shape, QPainter &painter, const KoViewConverter &converter); virtual void paint(KoShape *shape, QPainter &painter, const KoViewConverter &converter);
virtual void paint(KoShape *shape, QPainter &painter, const KoViewConverter &converter, const QColor &color); virtual void paint(KoShape *shape, QPainter &painter, const KoViewConverter &converter, const QColor &color);
......
...@@ -26,7 +26,7 @@ KoLineBorderFactory::KoLineBorderFactory() ...@@ -26,7 +26,7 @@ KoLineBorderFactory::KoLineBorderFactory()
{ {
} }
KoShapeBorderModel * KoLineBorderFactory::createBorder() const KoShapeStrokeModel * KoLineBorderFactory::createStroke() const
{ {
return new KoLineBorder(); return new KoLineBorder();
} }
......
...@@ -27,7 +27,7 @@ public: ...@@ -27,7 +27,7 @@ public:
KoLineBorderFactory(); KoLineBorderFactory();
/// reimplemented /// reimplemented
virtual KoShapeBorderModel *createBorder() const; virtual KoShapeStrokeModel *createStroke() const;
}; };
#endif #endif
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "KoPathShape.h" #include "KoPathShape.h"
#include "KoPathShape_p.h" #include "KoPathShape_p.h"
#include "KoPathPoint.h" #include "KoPathPoint.h"
#include "KoShapeBorderModel.h" #include "KoShapeStrokeModel.h"
#include "KoViewConverter.h" #include "KoViewConverter.h"
#include "KoPathShapeLoader.h" #include "KoPathShapeLoader.h"
#include "KoShapeSavingContext.h" #include "KoShapeSavingContext.h"
...@@ -199,7 +199,7 @@ QString KoPathShape::saveStyle(KoGenStyle &style, KoShapeSavingContext &context) ...@@ -199,7 +199,7 @@ QString KoPathShape::saveStyle(KoGenStyle &style, KoShapeSavingContext &context)
style.addProperty("svg:fill-rule", d->fillRule == Qt::OddEvenFill ? "evenodd" : "nonzero"); style.addProperty("svg:fill-rule", d->fillRule == Qt::OddEvenFill ? "evenodd" : "nonzero");
KoLineBorder *lineBorder = dynamic_cast<KoLineBorder*>(border()); KoLineBorder *lineBorder = dynamic_cast<KoLineBorder*>(stroke());
qreal lineWidth = 0; qreal lineWidth = 0;
if (lineBorder) { if (lineBorder) {
lineWidth = lineBorder->lineWidth(); lineWidth = lineBorder->lineWidth();
...@@ -228,7 +228,7 @@ void KoPathShape::loadStyle(const KoXmlElement & element, KoShapeLoadingContext ...@@ -228,7 +228,7 @@ void KoPathShape::loadStyle(const KoXmlElement & element, KoShapeLoadingContext
#endif #endif
} }
KoLineBorder *lineBorder = dynamic_cast<KoLineBorder*>(border()); KoLineBorder *lineBorder = dynamic_cast<KoLineBorder*>(stroke());
qreal lineWidth = 0; qreal lineWidth = 0;
if (lineBorder) { if (lineBorder) {
lineWidth = lineBorder->lineWidth(); lineWidth = lineBorder->lineWidth();
...@@ -411,7 +411,7 @@ QRectF KoPathShape::boundingRect() const ...@@ -411,7 +411,7 @@ QRectF KoPathShape::boundingRect() const
// calculate the bounding rect of the transformed outline // calculate the bounding rect of the transformed outline
QRectF bb; QRectF bb;
if (d->startMarker.marker() || d->endMarker.marker()) { if (d->startMarker.marker() || d->endMarker.marker()) {
KoLineBorder *lineBorder = dynamic_cast<KoLineBorder*>(border()); KoLineBorder *lineBorder = dynamic_cast<KoLineBorder*>(stroke());
QPen pen; QPen pen;
if (lineBorder) { if (lineBorder) {
pen.setWidthF(lineBorder->lineWidth()); pen.setWidthF(lineBorder->lineWidth());
...@@ -421,9 +421,9 @@ QRectF KoPathShape::boundingRect() const ...@@ -421,9 +421,9 @@ QRectF KoPathShape::boundingRect() const
else { else {
bb = transform.map(outline()).boundingRect(); bb = transform.map(outline()).boundingRect();
} }
if (border()) { if (stroke()) {
KoInsets inset; KoInsets inset;
border()->borderInsets(this, inset); stroke()->strokeInsets(this, inset);
// calculate transformed border insets // calculate transformed border insets
QPointF center = transform.map(QPointF()); QPointF center = transform.map(QPointF());
...@@ -1114,7 +1114,7 @@ bool KoPathShape::separate(QList<KoPathShape*> & separatedPaths) ...@@ -1114,7 +1114,7 @@ bool KoPathShape::separate(QList<KoPathShape*> & separatedPaths)
KoPathShape *shape = new KoPathShape(); KoPathShape *shape = new KoPathShape();
if (! shape) continue; if (! shape) continue;
shape->setBorder(border()); shape->setStroke(stroke());
shape->setShapeId(shapeId()); shape->setShapeId(shapeId());
KoSubpath *newSubpath = new KoSubpath(); KoSubpath *newSubpath = new KoSubpath();
...@@ -1379,9 +1379,9 @@ bool KoPathShape::hitTest(const QPointF &position) const ...@@ -1379,9 +1379,9 @@ bool KoPathShape::hitTest(const QPointF &position) const
QPointF point = absoluteTransformation(0).inverted().map(position); QPointF point = absoluteTransformation(0).inverted().map(position);
const QPainterPath outlinePath = outline(); const QPainterPath outlinePath = outline();
if (border()) { if (stroke()) {
KoInsets insets; KoInsets insets;
border()->borderInsets(this, insets); stroke()->strokeInsets(this, insets);
QRectF roi(QPointF(-insets.left, -insets.top), QPointF(insets.right, insets.bottom)); QRectF roi(QPointF(-insets.left, -insets.top), QPointF(insets.right, insets.bottom));
roi.moveCenter(point); roi.moveCenter(point);
if (outlinePath.intersects(roi) || outlinePath.contains(roi)) if (outlinePath.intersects(roi) || outlinePath.contains(roi))
......
...@@ -48,7 +48,7 @@ KoShape *KoPathShapeFactory::createDefaultShape(KoDocumentResourceManager *) con ...@@ -48,7 +48,7 @@ KoShape *KoPathShapeFactory::createDefaultShape(KoDocumentResourceManager *) con
path->curveTo(QPointF(0, 120), QPointF(50, 120), QPointF(50, 50)); path->curveTo(QPointF(0, 120), QPointF(50, 120), QPointF(50, 50));
path->curveTo(QPointF(50, -20), QPointF(100, -20), QPointF(100, 50)); path->curveTo(QPointF(50, -20), QPointF(100, -20), QPointF(100, 50));
path->normalize(); path->normalize();
path->setBorder(new KoLineBorder(1.0)); path->setStroke(new KoLineBorder(1.0));
return path; return path;
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "KoSelection.h" #include "KoSelection.h"
#include "KoPointerEvent.h" #include "KoPointerEvent.h"
#include "KoInsets.h" #include "KoInsets.h"
#include "KoShapeBorderModel.h" #include "KoShapeStrokeModel.h"
#include "KoShapeBackground.h" #include "KoShapeBackground.h"
#include "KoColorBackground.h" #include "KoColorBackground.h"
#include "KoGradientBackground.h" #include "KoGradientBackground.h"
...@@ -75,13 +75,13 @@ ...@@ -75,13 +75,13 @@
// KoShapePrivate // KoShapePrivate
KoShapePrivate::KoShapePrivate(KoShape *shape) KoShapePrivate::KoShapePrivate(KoShape *shape)
: size(50, 50), : q_ptr(shape),
size(50, 50),
parent(0), parent(0),
userData(0), userData(0),
appData(0), appData(0),
stroke(0),
fill(0), fill(0),
border(0),
q_ptr(shape),
shadow(0), shadow(0),
clipPath(0), clipPath(0),
filterEffectStack(0), filterEffectStack(0),
...@@ -116,8 +116,8 @@ KoShapePrivate::~KoShapePrivate() ...@@ -116,8 +116,8 @@ KoShapePrivate::~KoShapePrivate()
} }
delete userData; delete userData;
delete appData; delete appData;
if (border && !border->deref()) if (stroke && !stroke->deref())
delete border; delete stroke;
if (shadow && !shadow->deref()) if (shadow && !shadow->deref())
delete shadow; delete shadow;
if (fill && !fill->deref()) if (fill && !fill->deref())
...@@ -138,13 +138,13 @@ void KoShapePrivate::shapeChanged(KoShape::ChangeType type) ...@@ -138,13 +138,13 @@ void KoShapePrivate::shapeChanged(KoShape::ChangeType type)
shape->shapeChanged(type, q); shape->shapeChanged(type, q);
} }
void KoShapePrivate::updateBorder() void KoShapePrivate::updateStroke()
{ {
Q_Q(KoShape); Q_Q(KoShape);
if (border == 0) if (stroke == 0)
return; return;
KoInsets insets; KoInsets insets;
border->borderInsets(q, insets); stroke->strokeInsets(q, insets);
QSizeF inner = q->size(); QSizeF inner = q->size();
// update left // update left
q->update(QRectF(-insets.left, -insets.top, insets.left, q->update(QRectF(-insets.left, -insets.top, insets.left,
...@@ -357,9 +357,9 @@ bool KoShape::hitTest(const QPointF &position) const ...@@ -357,9 +357,9 @@ bool KoShape::hitTest(const QPointF &position) const
QPointF point = absoluteTransformation(0).inverted().map(position); QPointF point = absoluteTransformation(0).inverted().map(position);
QRectF bb(QPointF(), size()); QRectF bb(QPointF(), size());
if (d->border) { if (d->stroke) {
KoInsets insets; KoInsets insets;
d->border->borderInsets(this, insets); d->stroke->strokeInsets(this, insets);
bb.adjust(-insets.left, -insets.top, insets.right, insets.bottom); bb.adjust(-insets.left, -insets.top, insets.right, insets.bottom);
} }
if (bb.contains(point)) if (bb.contains(point))
...@@ -382,9 +382,9 @@ QRectF KoShape::boundingRect() const ...@@ -382,9 +382,9 @@ QRectF KoShape::boundingRect() const
QTransform transform = absoluteTransformation(0); QTransform transform = absoluteTransformation(0);
QRectF bb = outlineRect(); QRectF bb = outlineRect();
if (d->border) { if (d->stroke) {
KoInsets insets; KoInsets insets;
d->border->borderInsets(this, insets); d->stroke->strokeInsets(this, insets);
bb.adjust(-insets.left, -insets.top, insets.right, insets.bottom); bb.adjust(-insets.left, -insets.top, insets.right, insets.bottom);
} }
bb = transform.mapRect(bb); bb = transform.mapRect(bb);
...@@ -721,12 +721,12 @@ qreal KoShape::transparency(bool recursive) const ...@@ -721,12 +721,12 @@ qreal KoShape::transparency(bool recursive) const
} }
} }
KoInsets KoShape::borderInsets() const KoInsets KoShape::strokeInsets() const
{ {
Q_D(const KoShape); Q_D(const KoShape);
KoInsets answer; KoInsets answer;
if (d->border) if (d->stroke)
d->border->borderInsets(this, answer); d->stroke->strokeInsets(this, answer);
return answer; return answer;
} }
...@@ -1083,23 +1083,23 @@ bool KoShape::collisionDetection() ...@@ -1083,23 +1083,23 @@ bool KoShape::collisionDetection()
return d->detectCollision; return d->detectCollision;
} }
KoShapeBorderModel *KoShape::border() const KoShapeStrokeModel *KoShape::stroke() const
{ {
Q_D(const KoShape); Q_D(const KoShape);
return d->border; return d->stroke;
} }
void KoShape::setBorder(KoShapeBorderModel *border) void KoShape::setStroke(KoShapeStrokeModel *stroke)
{ {
Q_D(KoShape); Q_D(KoShape);
if (border) if (stroke)
border->ref(); stroke->ref();
d->updateBorder(); d->updateStroke();
if (d->border) if (d->stroke)
d->border->deref(); d->stroke->deref();
d->border = border; d->stroke = stroke;
d->updateBorder(); d->updateStroke();
d->shapeChanged(BorderChanged); d->shapeChanged(StrokeChanged);
notifyChanged(); notifyChanged();
} }
...@@ -1187,7 +1187,7 @@ QString KoShape::saveStyle(KoGenStyle &style, KoShapeSavingContext &context) con ...@@ -1187,7 +1187,7 @@ QString KoShape::saveStyle(KoGenStyle &style, KoShapeSavingContext &context) con
{ {
Q_D(const KoShape); Q_D(const KoShape);
// and fill the style // and fill the style
KoShapeBorderModel *b = border(); KoShapeStrokeModel *b = stroke();
if (b) { if (b) {
b->fillStyle(style, context); b->fillStyle(style, context);
} }
...@@ -1287,16 +1287,16 @@ void KoShape::loadStyle(const KoXmlElement &element, KoShapeLoadingContext &cont ...@@ -1287,16 +1287,16 @@ void KoShape::loadStyle(const KoXmlElement &element, KoShapeLoadingContext &cont
delete d->fill; delete d->fill;
d->fill = 0; d->fill = 0;
} }
if (d->border && !d->border->deref()) { if (d->stroke && !d->stroke->deref()) {
delete d->border; delete d->stroke;
d->border = 0; d->stroke = 0;
} }
if (d->shadow && !d->shadow->deref()) { if (d->shadow && !d->shadow->deref()) {
delete d->shadow; delete d->shadow;
d->shadow = 0; d->shadow = 0;
} }
setBackground(loadOdfFill(context)); setBackground(loadOdfFill(context));
setBorder(loadOdfStroke(element, context)); setStroke(loadOdfStroke(element, context));
setShadow(d->loadOdfShadow(context)); setShadow(d->loadOdfShadow(context));
QString protect(styleStack.property(KoXmlNS::style, "protect")); QString protect(styleStack.property(KoXmlNS::style, "protect"));
...@@ -1485,7 +1485,7 @@ KoShapeBackground *KoShape::loadOdfFill(KoShapeLoadingContext &context) const ...@@ -1485,7 +1485,7 @@ KoShapeBackground *KoShape::loadOdfFill(KoShapeLoadingContext &context) const
return bg; return bg;
} }
KoShapeBorderModel *KoShape::loadOdfStroke(const KoXmlElement &element, KoShapeLoadingContext &context) const KoShapeStrokeModel *KoShape::loadOdfStroke(const KoXmlElement &element, KoShapeLoadingContext &context) const
{ {
KoStyleStack &styleStack = context.odfLoadingContext().styleStack(); KoStyleStack &styleStack = context.odfLoadingContext().styleStack();
KoOdfStylesReader &stylesReader = context.odfLoadingContext().stylesReader(); KoOdfStylesReader &stylesReader = context.odfLoadingContext().stylesReader();
...@@ -1494,41 +1494,41 @@ KoShapeBorderModel *KoShape::loadOdfStroke(const KoXmlElement &element, KoShapeL ...@@ -1494,41 +1494,41 @@ KoShapeBorderModel *KoShape::loadOdfStroke(const KoXmlElement &element, KoShapeL
if (stroke == "solid" || stroke == "dash") { if (stroke == "solid" || stroke == "dash") {
QPen pen = KoOdfGraphicStyles::loadOdfStrokeStyle(styleStack, stroke, stylesReader); QPen pen = KoOdfGraphicStyles::loadOdfStrokeStyle(styleStack, stroke, stylesReader);
KoLineBorder *border = new KoLineBorder(); KoLineBorder *stroke = new KoLineBorder();
if (styleStack.hasProperty(KoXmlNS::calligra, "stroke-gradient")) { if (styleStack.hasProperty(KoXmlNS::calligra, "stroke-gradient")) {
QString gradientName = styleStack.property(KoXmlNS::calligra, "stroke-gradient"); QString gradientName = styleStack.property(KoXmlNS::calligra, "stroke-gradient");
QBrush brush = KoOdfGraphicStyles::loadOdfGradientStyleByName(stylesReader, gradientName, size()); QBrush brush = KoOdfGraphicStyles::loadOdfGradientStyleByName(stylesReader, gradientName, size());
border->setLineBrush(brush); stroke->setLineBrush(brush);
} else { } else {
border->setColor(pen.color()); stroke->setColor(pen.color());
} }
#ifndef NWORKAROUND_ODF_BUGS #ifndef NWORKAROUND_ODF_BUGS
KoOdfWorkaround::fixPenWidth(pen, context); KoOdfWorkaround::fixPenWidth(pen, context);
#endif #endif
border->setLineWidth(pen.widthF()); stroke->setLineWidth(pen.widthF());
border->setJoinStyle(pen.joinStyle()); stroke->setJoinStyle(pen.joinStyle());
border->setLineStyle(pen.style(), pen.dashPattern()); stroke->setLineStyle(pen.style(), pen.dashPattern());
border->setCapStyle(pen.capStyle()); stroke->setCapStyle(pen.capStyle());
return border; return stroke;
#ifndef NWORKAROUND_ODF_BUGS #ifndef NWORKAROUND_ODF_BUGS
} else if (stroke.isEmpty()) { } else if (stroke.isEmpty()) {
QPen pen = KoOdfGraphicStyles::loadOdfStrokeStyle(styleStack, "solid", stylesReader); QPen pen = KoOdfGraphicStyles::loadOdfStrokeStyle(styleStack, "solid", stylesReader);
if (KoOdfWorkaround::fixMissingStroke(pen, element, context, this)) { if (KoOdfWorkaround::fixMissingStroke(pen, element, context, this)) {
KoLineBorder *border = new KoLineBorder(); KoLineBorder *stroke = new KoLineBorder();
#ifndef NWORKAROUND_ODF_BUGS #ifndef NWORKAROUND_ODF_BUGS
KoOdfWorkaround::fixPenWidth(pen, context); KoOdfWorkaround::fixPenWidth(pen, context);
#endif #endif
border->setLineWidth(pen.widthF()); stroke->setLineWidth(pen.widthF());
border->setJoinStyle(pen.joinStyle()); stroke->setJoinStyle(pen.joinStyle());
border->setLineStyle(pen.style(), pen.dashPattern()); stroke->setLineStyle(pen.style(), pen.dashPattern());
border->setCapStyle(pen.capStyle()); stroke->setCapStyle(pen.capStyle());
border->setColor(pen.color()); stroke->setColor(pen.color());