Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Hide KisForest.h from the public KoSvgTextShape.h header

Dmitry Kazakov92975682f8a0
diff --git a/libs/flake/text/KoSvgTextShape.cpp b/libs/flake/text/KoSvgTextShape.cpp
index 9265430b32..c149ec42a6 100644
--- a/libs/flake/text/KoSvgTextShape.cpp
+++ b/libs/flake/text/KoSvgTextShape.cpp
@@ -90,10 +90,17 @@ struct KoSvgTextNodeIndex::Private {
KisForest<KoSvgTextContentElement>::child_iterator textElement;
};
-KoSvgTextNodeIndex::KoSvgTextNodeIndex(KisForest<KoSvgTextContentElement>::child_iterator textElement)
- : d(new Private(textElement))
+// for the use in KoSvgTextShape::Private::createTextNodeIndex() only
+KoSvgTextNodeIndex::KoSvgTextNodeIndex()
+ : d() // Private is **not** initialized, to be intialized by the factory method
{
+}
+KoSvgTextNodeIndex KoSvgTextShape::Private::createTextNodeIndex(KisForest<KoSvgTextContentElement>::child_iterator textElement)
+{
+ KoSvgTextNodeIndex index;
+ index.d.reset(new KoSvgTextNodeIndex::Private(textElement));
+ return index;
}
KoSvgTextNodeIndex::KoSvgTextNodeIndex(const KoSvgTextNodeIndex &rhs)
@@ -1110,15 +1117,15 @@ KoSvgTextNodeIndex KoSvgTextShape::findNodeEditorForPropertyId(KoSvgTextProperti
{
for (auto it = d->textData.childBegin(); it != d->textData.childEnd(); it++) {
if (it->properties.hasProperty(propertyId)) {
- return KoSvgTextNodeIndex(it);
+ return Private::createTextNodeIndex(it);
} else if (KisForestDetail::childBegin(it) != KisForestDetail::childEnd(it)) {
auto found = findNodeEditorForPropertyIdImpl(it, propertyId);
if (found != it) {
- return KoSvgTextNodeIndex(found);
+ return Private::createTextNodeIndex(found);
}
}
}
- return KoSvgTextNodeIndex(d->textData.childBegin());
+ return Private::createTextNodeIndex(d->textData.childBegin());
}
QPair<int, int> KoSvgTextShape::findRangeForNodeIndex(const KoSvgTextNodeIndex &node) const
diff --git a/libs/flake/text/KoSvgTextShape.h b/libs/flake/text/KoSvgTextShape.h
index f1d2af6e8b..3dccbb9716 100644
--- a/libs/flake/text/KoSvgTextShape.h
+++ b/libs/flake/text/KoSvgTextShape.h
@@ -564,11 +564,8 @@ private:
* allow the direct editing of properties or any
* text path on the given node.
*/
-#include <KisForest.h>
-class KoSvgTextContentElement;
class KRITAFLAKE_EXPORT KoSvgTextNodeIndex {
public:
- KoSvgTextNodeIndex (KisForest<KoSvgTextContentElement>::child_iterator textElement);
KoSvgTextNodeIndex(const KoSvgTextNodeIndex &rhs);
~KoSvgTextNodeIndex();
@@ -592,6 +589,10 @@ public:
*/
KoShape *textPath();
+private:
+ // for internal factory use only
+ KoSvgTextNodeIndex();
+
private:
friend class KoSvgTextShape;
struct Private;
diff --git a/libs/flake/text/KoSvgTextShape_p.h b/libs/flake/text/KoSvgTextShape_p.h
index d37d205d04..63c575dd79 100644
--- a/libs/flake/text/KoSvgTextShape_p.h
+++ b/libs/flake/text/KoSvgTextShape_p.h
@@ -1145,6 +1145,8 @@ public:
}
return false;
}
+
+ static KoSvgTextNodeIndex createTextNodeIndex(KisForest<KoSvgTextContentElement>::child_iterator textElement);
};
#endif // KO_SVG_TEXT_SHAPE_P_H