Krita Source Code Documentation
Loading...
Searching...
No Matches
SvgTextChangeCommand.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2
3 SPDX-FileCopyrightText: 2017 Boudewijn Rempt <boud@valdyas.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
8
9#include <math.h>
10#include <klocalizedstring.h>
11
12#include "KoSvgTextShape.h"
14
16 const QString &svg,
17 const QString &defs,
18 KUndo2Command *parent)
19 : KUndo2Command(parent)
20 , m_shape(shape)
21 , m_svg(svg)
22 , m_defs(defs)
23{
24 Q_ASSERT(shape);
25 setText(kundo2_i18n("Change SvgTextTool"));
27 converter.convertToSvg(&m_oldSvg, &m_oldDefs);
28}
29
33
35{
36 m_shape->update();
38 // Hardcoded resolution?
39 converter.convertFromSvg(m_svg, m_defs, m_shape->boundingRect(), 72.0);
40 m_shape->update();
41}
42
44{
45 m_shape->update();
47 // Hardcoded resolution?
49 m_shape->update();
50}
void setText(const KUndo2MagicString &text)
virtual void update() const
Definition KoShape.cpp:605
bool convertToSvg(QString *svgText, QString *stylesText)
bool convertFromSvg(const QString &svgText, const QString &stylesText, const QRectF &boundsInPixels, qreal pixelsPerInch)
upload the svg representation of text into the shape
QRectF boundingRect() const override
Get the bounding box of the shape.
void undo() override
revert the actions done in redo
void redo() override
redo the command
SvgTextChangeCommand(KoSvgTextShape *shape, const QString &svg, const QString &defs, KUndo2Command *parent=0)
KUndo2MagicString kundo2_i18n(const char *text)