Commit bdb339e0 authored by Thomas Zander's avatar Thomas Zander

Fixes: KWord doesn't save core frame properties to ODF.

Details: Add the ability to set style properties on the shape.
    I guess we should consider moving that to the context together with the shapeProperties
    Next write out the style properties for each frame.

svn path=/trunk/koffice/; revision=941795
parent bb375962
/* This file is part of the KDE project
Copyright (C) 2006 Casper Boemann Rasmussen <cbr@boemann.dk>
Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
Copyright (C) 2006-2008 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
......@@ -139,6 +139,7 @@ public:
QList<KoShape*> dependees; ///< list of shape dependent on this shape
KoShapeShadow * shadow; ///< the current shape shadow
QMap<QByteArray, QString> additionalAttributes;
QMap<QByteArray, QString> additionalStyleAttributes;
QList<KoEventAction *> eventActions; ///< list of event actions the shape has
};
......@@ -789,6 +790,11 @@ QString KoShape::saveStyle(KoGenStyle &style, KoShapeSavingContext &context) con
style.setAutoStyleInStylesDotXml(true);
}
QMap<QByteArray, QString>::const_iterator it(d->additionalStyleAttributes.constBegin());
for (; it != d->additionalStyleAttributes.constEnd(); ++it) {
style.addProperty(it.key(), it.value());
}
return context.mainStyles().lookup(style, context.isSet(KoShapeSavingContext::PresentationShape) ? "pr" : "gr");
}
......@@ -861,7 +867,6 @@ bool KoShape::loadOdfAttributes(const KoXmlElement & element, KoShapeLoadingCont
}
if (attributes & OdfName) {
if (element.hasAttributeNS(KoXmlNS::draw, "name")) {
setName(element.attributeNS(KoXmlNS::draw, "name"));
}
......@@ -1220,3 +1225,14 @@ QString KoShape::additionalAttribute(const char * name)
{
return d->additionalAttributes.value(name);
}
void KoShape::setAdditionalStyleAttribute(const char * name, const QString & value)
{
d->additionalStyleAttributes.insert(name, value);
}
void KoShape::removeAdditionalStyleAttribute(const char * name)
{
d->additionalStyleAttributes.remove(name);
}
/* This file is part of the KDE project
Copyright (C) 2006-2008 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2006, 2008 Casper Boemann <cbr@boemann.dk>
Copyright (C) 2006 Thomas Zander <zander@kde.org>
Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
This library is free software; you can redistribute it and/or
......@@ -753,6 +753,10 @@ public:
*/
QString additionalAttribute(const char * name);
void setAdditionalStyleAttribute(const char * name, const QString & value);
void removeAdditionalStyleAttribute(const char * name);
protected:
/* ** loading saving helper 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