Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShapeRunAroundCommand.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2008 Thorsten Zachmann <zachmann@kde.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
8
9#include <klocalizedstring.h>
10#include "KoShape.h"
11
12class Q_DECL_HIDDEN KoShapeRunAroundCommand::Private
13{
14public:
15 Private(KoShape *s, KoShape::TextRunAroundSide side, int runThrough, qreal distanceLeft, qreal distanceTop, qreal distanceRight, qreal distanceBottom, qreal threshold, KoShape::TextRunAroundContour contour)
16 : shape(s)
17 , newSide(side)
18 , newRunThrough(runThrough)
19 , newDistanceLeft(distanceLeft)
20 , newDistanceTop(distanceTop)
21 , newDistanceRight(distanceRight)
22 , newDistanceBottom(distanceBottom)
23 , newThreshold(threshold)
24 , newContour(contour)
25 , oldSide(shape->textRunAroundSide())
26 , oldRunThrough(shape->runThrough())
27 , oldDistanceLeft(shape->textRunAroundDistanceLeft())
28 , oldDistanceTop(shape->textRunAroundDistanceTop())
29 , oldDistanceRight(shape->textRunAroundDistanceRight())
30 , oldDistanceBottom(shape->textRunAroundDistanceBottom())
31 , oldThreshold(shape->textRunAroundThreshold())
32 , oldContour(shape->textRunAroundContour())
33 {}
34
52};
53
54KoShapeRunAroundCommand::KoShapeRunAroundCommand(KoShape *shape, KoShape::TextRunAroundSide side, int runThrough, qreal distanceLeft, qreal distanceTop, qreal distanceRight, qreal distanceBottom, qreal threshold, KoShape::TextRunAroundContour contour, KUndo2Command *parent)
55: KUndo2Command(parent)
56, d(new Private(shape, side, runThrough, distanceLeft, distanceTop, distanceRight, distanceBottom, threshold, contour))
57{
58 setText(kundo2_i18n("Change Shape RunAround"));
59}
60
65
67{
69 d->shape->setTextRunAroundSide(d->newSide, KoShape::Background);
70 d->shape->setRunThrough(d->newRunThrough);
71 d->shape->setTextRunAroundDistanceLeft(d->newDistanceLeft);
72 d->shape->setTextRunAroundDistanceTop(d->newDistanceTop);
73 d->shape->setTextRunAroundDistanceRight(d->newDistanceRight);
74 d->shape->setTextRunAroundDistanceBottom(d->newDistanceBottom);
75 d->shape->setTextRunAroundThreshold(d->newThreshold);
76 d->shape->setTextRunAroundContour(d->newContour);
77 d->shape->notifyChanged();
78}
79
81{
83 d->shape->setTextRunAroundSide(d->oldSide, KoShape::Background);
84 d->shape->setRunThrough(d->oldRunThrough);
85 d->shape->setTextRunAroundDistanceLeft(d->oldDistanceLeft);
86 d->shape->setTextRunAroundDistanceTop(d->oldDistanceTop);
87 d->shape->setTextRunAroundDistanceRight(d->oldDistanceRight);
88 d->shape->setTextRunAroundDistanceBottom(d->oldDistanceBottom);
89 d->shape->setTextRunAroundThreshold(d->oldThreshold);
90 d->shape->setTextRunAroundContour(d->oldContour);
91 d->shape->notifyChanged();
92}
virtual void undo()
void setText(const KUndo2MagicString &text)
virtual void redo()
KoShape::TextRunAroundSide oldSide
Private(KoShape *s, KoShape::TextRunAroundSide side, int runThrough, qreal distanceLeft, qreal distanceTop, qreal distanceRight, qreal distanceBottom, qreal threshold, KoShape::TextRunAroundContour contour)
void undo() override
revert the actions done in redo
KoShape::TextRunAroundContour newContour
KoShapeRunAroundCommand(KoShape *shape, KoShape::TextRunAroundSide side, int runThrough, qreal distanceLeft, qreal distanceTop, qreal distanceRight, qreal distanceBottom, qreal threshold, KoShape::TextRunAroundContour contour, KUndo2Command *parent=0)
void redo() override
redo the command
KoShape::TextRunAroundContour oldContour
KoShape::TextRunAroundSide newSide
TextRunAroundContour
The behavior text should do when intersecting this shape.
Definition KoShape.h:131
@ Background
Definition KoShape.h:141
TextRunAroundSide
The behavior text should do when intersecting this shape.
Definition KoShape.h:120
KUndo2MagicString kundo2_i18n(const char *text)