Commit f80a91d4 authored by Thorsten Zachmann's avatar Thorsten Zachmann
Browse files

Add collection to datacenters so images are saved

If there was no image in the document the image bullets where not saved as the image collection
was not added to the data centers and therefore the images where not saved. This fixes that by
adding the image collection to the datacenters.
Reorder the way the attributes are added. They need to be added before a child element is added
therefore they are moved up.
Parts of the patch are provided by gopalK.

Is it ok to include KoImageData_p.h in a lib of our own code or should we find a different solution?

Ok to backport?

CCMAIL: calligra-devel@kde.org
BUG: 299112
parent 67295f60
......@@ -41,6 +41,7 @@
#include <KoText.h>
#include <KoImageCollection.h>
#include <KoImageData.h>
#include <KoImageData_p.h>
#include <KoOdfNumberDefinition.h>
#include <KoGenStyle.h>
#include <KoTextSharedSavingData.h>
......@@ -809,12 +810,14 @@ void KoListLevelProperties::saveOdf(KoXmlWriter *writer, KoShapeSavingContext &c
}
else if (style() == KoListStyle::ImageItem) {
KoImageData *imageData = d->stylesPrivate.value(KoListStyle::BulletImage).value<KoImageData *>();
if (imageData) {
Q_ASSERT(imageData->priv()->collection);
if (imageData && imageData->priv()->collection) {
writer->startElement("text:list-level-style-image");
writer->addAttribute("xlink:show", "embed");
writer->addAttribute("xlink:actuate", "onLoad");
writer->addAttribute("xlink:type", "simple");
writer->addAttribute("xlink:href", context.imageHref(imageData));
context.addDataCenter(imageData->priv()->collection);
}
}
else {
......@@ -849,6 +852,13 @@ void KoListLevelProperties::saveOdf(KoXmlWriter *writer, KoShapeSavingContext &c
writer->startElement("style:list-level-properties", false);
if (d->stylesPrivate.contains(KoListStyle::Width)) {
writer->addAttributePt("fo:width", width());
}
if (d->stylesPrivate.contains(KoListStyle::Height)) {
writer->addAttributePt("fo:height", height());
}
if(d->stylesPrivate.contains(KoListStyle::AlignmentMode) && alignmentMode()==false) {
writer->addAttribute("text:list-level-position-and-space-mode","label-width-and-position");
......@@ -887,13 +897,6 @@ void KoListLevelProperties::saveOdf(KoXmlWriter *writer, KoShapeSavingContext &c
writer->endElement();
}
if (d->stylesPrivate.contains(KoListStyle::Width)) {
writer->addAttributePt("fo:width", width());
}
if (d->stylesPrivate.contains(KoListStyle::Height)) {
writer->addAttributePt("fo:height", height());
}
writer->endElement(); // list-level-properties
// text properties
......
Supports Markdown
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