Commit 2540a602 authored by Thorsten Zachmann's avatar Thorsten Zachmann

o make it possible to add additional attributes to a shape. This is

  useful e.g. for attributes that are only needed for one application
  e.g. presentation:placeholder.
  At the moment these attributes are not saved yet. They will be saved
  by saveOdfAttributes and loaded by loadOdfAttributes later.

svn path=/trunk/koffice/; revision=803494
parent 55101856
/* 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-2007 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2006-2008 Thorsten Zachmann <zachmann@kde.org>
Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
This library is free software; you can redistribute it and/or
......@@ -52,6 +52,7 @@
#include <QVariant>
#include <QPainterPath>
#include <QList>
#include <QMap>
#include <kdebug.h>
......@@ -126,6 +127,7 @@ public:
KoShape *me;
QList<KoShape*> dependees; ///< list of shape dependent on this shape
KoShapeShadow * shadow; ///< the current shape shadow
QMap<QString,QString> additionalAttributes;
};
KoShape::KoShape()
......@@ -1072,3 +1074,23 @@ KoSnapData KoShape::snapData() const
{
return KoSnapData();
}
void KoShape::setAddtionalAttribute( const QString & name, const QString & value )
{
d->additionalAttributes.insert( name, value );
}
void KoShape::removeAddtionalAttribute( const QString & name )
{
d->additionalAttributes.remove( name );
}
bool KoShape::hasAdditionalAttribute( const QString & name )
{
return d->additionalAttributes.contains( name );
}
QString KoShape::addtionalAttribute( const QString & name )
{
return d->additionalAttributes.value( name );
}
/* This file is part of the KDE project
Copyright (C) 2006-2007 Thorsten Zachmann <zachmann@kde.org>
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) 2007 Jan Hambrecht <jaham@gmx.net>
......@@ -692,6 +692,42 @@ public:
/// Returns additional snap data the shape wants to have snapping to
virtual KoSnapData snapData() const;
/**
* Set additional attribute
*
* This can be used to attach additional attributes to a shape for attributes
* that are application specific like presentation:placeholder
*
* @param name The name of the attribute in the following form prefix:tag e.g. presentation:placeholder
* @param value The value of the attribute
*/
void setAddtionalAttribute( const QString & name, const QString & value );
/**
* Remove additional attribute
*
* @param name The name of the attribute in the following form prefix:tag e.g. presentation:placeholder
*/
void removeAddtionalAttribute( const QString & name );
/**
* Check if additional attribute is set
*
* @param name The name of the attribute in the following form prefix:tag e.g. presentation:placeholder
*
* @return true if there is a attribute with prefix:tag set, false otherwise
*/
bool hasAdditionalAttribute( const QString & name );
/**
* Get additional attribute
*
* @param name The name of the attribute in the following form prefix:tag e.g. presentation:placeholder
*
* @return The value of the attribute if it exists or a null string if not found.
*/
QString addtionalAttribute( const QString & 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