Commit f07c23bb authored by Thorsten Zachmann's avatar Thorsten Zachmann

o Added code for loading draw:id, size and position

svn path=/trunk/koffice/; revision=664285
parent 74907586
......@@ -40,6 +40,7 @@
#include <KoXmlNS.h>
#include <KoGenStyles.h>
#include <KoGenStyle.h>
#include <KoUnit.h>
#include <QPainter>
#include <QVariant>
......@@ -659,8 +660,24 @@ bool KoShape::loadOdfAttributes( const KoXmlElement & element, KoShapeLoadingCon
if ( layer ) {
setParent( layer );
}
}
if ( element.hasAttributeNS( KoXmlNS::draw, "id" ) ) {
QString id = element.attributeNS( KoXmlNS::draw, "id" );
if ( !id.isNull() ) {
context.addShapeId( this, id );
}
}
}
if ( attributes & OdfSize ) {
QPointF pos;
pos.setX( KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "x", QString::null ) ) );
pos.setY( KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "y", QString::null ) ) );
setPosition( pos );
QSizeF size;
size.setWidth( KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "width", QString::null ) ) );
size.setHeight( KoUnit::parseValue( element.attributeNS( KoXmlNS::svg, "height", QString::null ) ) );
resize( size );
}
return true;
......
......@@ -33,3 +33,14 @@ KoShapeLayer * KoShapeLoadingContext::layer( const QString & layerName )
{
return m_layers.value( layerName, 0 );
}
void KoShapeLoadingContext::addShapeId( KoShape * shape, const QString & id )
{
m_drawIds.insert( id, shape );
}
KoShape * KoShapeLoadingContext::shapeById( const QString & id )
{
return m_drawIds.value( id, 0 );
}
......@@ -42,11 +42,12 @@ public:
KoShapeLayer * layer( const QString & layerName );
void addShapeId( KoShape * shape, const QString & id );
KoShape * shapeById( const QString & id );
private:
KoOasisLoadingContext &m_context;
QMap<QString, KoShapeLayer*> m_layers;
QMap<int, KoShape*> m_drawIds;
QMap<QString, KoShape*> m_drawIds;
};
#endif /* KOSHAPELOADINGCONTEXT_H */
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