25#include "vobject_iface.h"
29#include <KoGenStyles.h>
30#include <KoStyleStack.h>
31#include <KoXmlWriter.h>
33#include <KoOasisLoadingContext.h>
34#include <KoOasisStyles.h>
52 m_parent = obj.m_parent;
59 if( srcDoc && !srcDoc->
objectName( &obj ).isEmpty() )
78 m_dcop =
new VObjectIface(
this );
111 if( doc && !doc->
objectName(
this ).isEmpty() )
112 element.setAttribute(
"ID", TQString( doc->
objectName(
this ) ) );
118 if( !
name().isEmpty() )
119 docWriter->addAttribute(
"draw:name",
name() );
123 mat.translate( 0, -
document()->height() );
125 KoGenStyle styleobjectauto( VDocument::STYLE_GRAPHICAUTO,
"graphic" );
126 saveOasisFill( mainStyles, styleobjectauto );
132 stroke.saveOasis( styleobjectauto );
134 TQString st = mainStyles.lookup( styleobjectauto,
"st" );
136 docWriter->addAttribute(
"draw:id",
"obj" + TQString::number( index ) );
137 docWriter->addAttribute(
"draw:style-name", st );
141VObject::saveOasisFill( KoGenStyles &mainStyles, KoGenStyle &stylesobjectauto )
const
147 mat.translate( 0, -
document()->height() );
151 fill.transform( mat );
152 fill.saveOasis( mainStyles, stylesobjectauto );
166 if( element.tagName() ==
"STROKE" )
170 else if( element.tagName() ==
"FILL" )
176 if( doc && !element.attribute(
"ID" ).isEmpty() )
189 if(
object.hasAttributeNS( KoXmlNS::draw,
"style-name" ) )
190 context.fillStyleStack(
object, KoXmlNS::draw,
"style-name",
"graphic" );
192 KoStyleStack &styleStack = context.styleStack();
193 styleStack.setTypeProperties(
"graphic" );
195 m_fill->loadOasis(
object, context,
this );
197 if(
object.hasAttributeNS( KoXmlNS::draw,
"name" ) )
198 setName(
object.attributeNS( KoXmlNS::draw,
"name", TQString() ) );
209 if( style->hasAttributeNS( KoXmlNS::style,
"parent-style-name" ) )
210 addStyles( context.oasisStyles().findStyle( style->attributeNS( KoXmlNS::style,
"parent-style-name", TQString() ) ), context );
211 context.addStyles( style,
"style-name" );
All non-visual, static doc info is in here.
void setObjectName(const VObject *obj, const TQString name)
Sets custom name of specified object.
TQString objectName(const VObject *obj) const
Returns custom name of specified object.
Manages the fill of shapes.
DCOPObject * m_dcop
the object's DCOP object
VObject(VObject *parent, VState state=edit)
Constructs a new object that is child of parent and has the given state.
VObject * parent() const
Returns pointer to current parent object.
virtual void saveOasis(KoStore *store, KoXmlWriter *docWriter, KoGenStyles &mainStyles, int &index) const
Save this object's state to OpenDocument.
VState m_state
the object's state
virtual TQString name() const
Returns the name of the object.
virtual DCOPObject * dcopObject()
Returns pointer to internal DCOP object.
VStroke * m_stroke
the object's stroke
virtual void setStroke(const VStroke &stroke)
Sets the stroke to a given new stroke.
void addStyles(const TQDomElement *style, KoOasisLoadingContext &context)
Adds a new given style to the specified OASIS context.
VFill * m_fill
the object's fill
void invalidateBoundingBox()
Invalidates the bounding box, so it has to be recalculated.
virtual VFill * fill() const
Gets the object's actual fill.
void setName(const TQString &s)
Sets the object's name to a given new name.
virtual void load(const TQDomElement &element)
Load this object's state from xml and initialize this object accordingly.
virtual VStroke * stroke() const
Gets the object's actual stroke.
virtual void save(TQDomElement &element) const
Save this object's state to xml.
virtual ~VObject()
Destroys the object and deletes the stroke, fill and DCOP-object.
virtual void setFill(const VFill &fill)
Sets the fill to a given new fill.
VDocument * document() const
Return document the object belongs to.
virtual bool loadOasis(const TQDomElement &element, KoOasisLoadingContext &context)
Load this object's state from OpenDocument and initialize this object accordingly.
VState state() const
Get the state the object is in.
Manages stroke properties.