Commit 127cdc61 authored by Jan Hambrecht's avatar Jan Hambrecht

added saving of connection points;

notify when removing connection point and handle that in the attached connection shape
parent 8f7b58cd
......@@ -643,6 +643,13 @@ void KoConnectionShape::shapeChanged(ChangeType type, KoShape *shape)
if (shape == d->shape2)
connectSecond(0, -1);
break;
case ConnectionPointChanged:
if (shape == d->shape1 && !shape->hasConnectionPoint(d->connectionPointId1)) {
connectFirst(0, -1);
} else if( shape == d->shape2 && !shape->hasConnectionPoint(d->connectionPointId2)){
connectSecond(0, -1);
}
break;
case BackgroundChanged:
{
// connection shape should not have a background
......
......@@ -805,6 +805,7 @@ void KoShape::removeConnectionPoint(int connectionPointId)
{
Q_D(KoShape);
d->connectors.remove(connectionPointId);
d->shapeChanged(ConnectionPointChanged);
}
void KoShape::clearConnectionPoints()
......@@ -1706,7 +1707,25 @@ void KoShape::saveOdfCommonChildElements(KoShapeSavingContext &context) const
context.xmlWriter().endElement();
}
// TODO: save glue points see ODF 9.2.19 Glue Points
// save glue points see ODF 9.2.19 Glue Points
if(d->connectors.count()) {
QSizeF s = size();
KoConnectionPoints::const_iterator cp = d->connectors.constBegin();
KoConnectionPoints::const_iterator lastCp = d->connectors.constEnd();
for(; cp != lastCp; ++cp) {
// do not save default glue points
if(cp.key() < 4)
continue;
// convert to percent from center
const qreal x = cp.value().x() / s.width() * 100.0 - 50.0;
const qreal y = cp.value().y() / s.height() * 100.0 -50.0;
context.xmlWriter().startElement("draw:glue-point");
context.xmlWriter().addAttribute("draw:id", QString("%1").arg(cp.key()));
context.xmlWriter().addAttribute("svg:x", QString("%1%%").arg(x));
context.xmlWriter().addAttribute("svg:y", QString("%1%%").arg(y));
context.xmlWriter().endElement();
}
}
}
// end loading & saving methods
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment