39 , d(new
Private(textShape, shape, startPos, endPos))
44 if (
d->textShape->shapesInside().contains(shape)) {
46 }
else if (
d->textShape->shapesSubtract().contains(shape)) {
48 }
else if (
d->textShape->shapeInContours(shape)){
52 d->startPos = range.first;
53 d->endPos = range.second;
70 if (
d->removeCommand) {
71 d->memento =
d->textShape->getMemento();
72 d->oldTextPaths =
d->textShape->textPathsAtRange(
d->startPos,
d->endPos);
77 KoShapeContainer *newParent =
d->originalShapeParent.has_value() ?
d->originalShapeParent.value() :
d->textShape->
parent();
79 const QTransform absoluteTf = newParentTransform.inverted() *
d->textShape->absoluteTransformation();
81 d->textShape->removeShapesFromContours({
d->shape},
true);
86 d->shape->setParent(newParent);
89 if (!
d->removeCommand) {
90 Q_FOREACH(
KoShape *path,
d->oldTextPaths) {
91 if (!
d->textShape->shapeInContours(path)) {
92 d->textShape->addTextPathAtEnd(path);
95 d->textShape->setMemento(
d->memento);
97 d->textShape->relayout();
99 d->shape->applyAbsoluteTransformation(absoluteTf);
107 if (!
d->removeCommand) {
108 d->memento =
d->textShape->getMemento();
109 d->oldTextPaths =
d->textShape->textPathsAtRange(
d->startPos,
d->endPos);
110 d->originalShapeParent =
d->shape->parent();
117 const QTransform absoluteTf =
d->textShape->absoluteTransformation().inverted() * oldParentTransform;
120 d->textShape->addShapeContours({
d->shape},
true);
122 d->textShape->addShapeContours({
d->shape},
false);
124 d->textShape->setTextPathOnRange(
d->shape,
d->startPos,
d->endPos);
127 if (
d->removeCommand) {
128 Q_FOREACH(
KoShape *path,
d->oldTextPaths) {
129 if (!
d->textShape->shapeInContours(path)) {
130 d->textShape->addTextPathAtEnd(path);
133 d->textShape->setMemento(
d->memento);
135 d->textShape->relayout();
137 d->shape->applyAbsoluteTransformation(absoluteTf);
181 Q_FOREACH(
KoShape *shape, shapes) {
static void bulkShapesUpdate(const UpdatesList &updates)
KoShapeContainer * parent() const
QTransform absoluteTransformation() const
~KoSvgTextAddRemoveShapeCommandImpl()
QScopedPointer< Private > d
KoSvgTextAddRemoveShapeCommandImpl(KoSvgTextShape *textShape, KoShape *shape, ContourType type, State state, int startPos, int endPos, KUndo2Command *parent=nullptr)
~KoSvgTextAddShapeCommand()
KoSvgTextAddShapeCommand(KoSvgTextShape *textShape, KoShape *shape, bool inside, KUndo2Command *parentCommand=0)
The KoSvgTextNodeIndex class.
static void removeContourShapesFromFlow(KoSvgTextShape *textShape, KUndo2Command *parent, bool textInShape, bool textPaths)
removeContourShapesFromFlow Create a command to remove all contour shapes of a certain type from the ...
KoSvgTextRemoveShapeCommand(KoSvgTextShape *textShape, KoShape *shape, KUndo2Command *parentCommand=0)
~KoSvgTextRemoveShapeCommand()
~KoSvgTextSetTextPathOnRangeCommand()
KoSvgTextSetTextPathOnRangeCommand(KoSvgTextShape *textShape, KoShape *shape, int startPos, int endPos, KUndo2Command *parentCommand=0)
QPair< int, int > findRangeForNodeIndex(const KoSvgTextNodeIndex &node) const
findRangeForNodeIndex Find the start and end cursor position for a given nodeIndex.
QList< KoShape * > shapesInside
bool shapeInContours(KoShape *shape)
shapeInContours
int posForIndex(int index, bool firstIndex=false, bool skipSynthetic=false) const
posForIndex Get the cursor position for a given index in a string.
KoSvgTextNodeIndex nodeForTextPath(KoShape *textPath) const
nodeForTextPath TextPaths are set on toplevel content elements. This function allows for searching wh...
QList< KoShape * > textPathsAtRange(const int startPos=-1, const int endPos=-1)
textPathsAtRange Get a list of textPaths at the given range. This includes textPaths whose node is on...
QList< KoShape * > shapesSubtract
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Private(KoSvgTextShape *_text, KoShape *_shape, int _startPos, int _endPos)
KoSvgTextShapeMementoSP memento
QList< KoShape * > oldTextPaths
KoSvgTextAddRemoveShapeCommandImpl::ContourType type
KoSvgTextShape * textShape
std::optional< KoShapeContainer * > originalShapeParent