karbon

#include <vobject.h>

Inheritance diagram for VObject:
VDocument VGroup VPath VSelection VSubpath VClipGroup VLayer VStar

Public Types

enum  VState {
  normal = 0 , normal_locked = 1 , hidden = 2 , hidden_locked = 3 ,
  deleted = 4 , selected = 5 , edit = 6
}
 

Public Member Functions

 VObject (VObject *parent, VState state=edit)
 
 VObject (const VObject &obj)
 
virtual ~VObject ()
 
virtual DCOPObject * dcopObject ()
 
virtual void draw (VPainter *painter, const KoRect *rect=0L) const
 
virtual const KoRect & boundingBox () const
 
bool boundingBoxIsInvalid () const
 
void invalidateBoundingBox ()
 
void setParent (VObject *parent)
 
VObject * parent () const
 
VState state () const
 
virtual void setState (const VState state)
 
virtual VStroke * stroke () const
 
virtual VFill * fill () const
 
virtual void setStroke (const VStroke &stroke)
 
virtual void setFill (const VFill &fill)
 
virtual void save (TQDomElement &element) const
 
virtual void saveOasis (KoStore *store, KoXmlWriter *docWriter, KoGenStyles &mainStyles, int &index) const
 
virtual void load (const TQDomElement &element)
 
virtual bool loadOasis (const TQDomElement &element, KoOasisLoadingContext &context)
 
virtual VObject * clone () const =0
 
virtual void accept (VVisitor &)
 
virtual void insertInfrontOf (VObject *newObject, VObject *oldObject)
 
virtual TQString name () const
 
void setName (const TQString &s)
 
VDocument * document () const
 

Protected Member Functions

void addStyles (const TQDomElement *style, KoOasisLoadingContext &context)
 
virtual void saveOasisFill (KoGenStyles &mainStyles, KoGenStyle &stylesojectauto) const
 

Protected Attributes

KoRect m_boundingBox
 
VState m_state: 8
 
bool m_boundingBoxIsInvalid: 1
 
VStroke * m_stroke
 
VFill * m_fill
 
DCOPObject * m_dcop
 

Detailed Description

The base class for all karbon objects.

Every object should have the ability to draw itself using a painter, perform hit detection, transform on demand, clone and load/save itself. Also each object manages its own bounding box and keeps track of its parent object.

Definition at line 49 of file vobject.h.

Member Enumeration Documentation

◆ VState

Enumerator
normal 

visible, not active

normal_locked 

visible, but locked (r/o)

hidden 

hidden

hidden_locked 

hidden and locked (r/o)

deleted 

deleted, nearly dead

selected 

visible, active and can be manipulated by tools

edit 

visible, active and is currently manipulated by a tool

Definition at line 52 of file vobject.h.

Constructor & Destructor Documentation

◆ VObject() [1/2]

VObject::VObject ( VObject *  parent,
VState  state = edit 
)

Constructs a new object that is child of parent and has the given state.

Parameters
parentthe new object's parent
statethe new object's state

Definition at line 36 of file vobject.cpp.

◆ VObject() [2/2]

VObject::VObject ( const VObject &  obj)

Copy constructor.

Copies parent, state and name of given object.

Parameters
objthe object to copy properties from

Definition at line 47 of file vobject.cpp.

◆ ~VObject()

VObject::~VObject ( )
virtual

Destroys the object and deletes the stroke, fill and DCOP-object.

Definition at line 67 of file vobject.cpp.

Member Function Documentation

◆ accept()

virtual void VObject::accept ( VVisitor &  )
inlinevirtual

Accept a VVisitor.

Reimplemented in VPath, VDocument, VGroup, VLayer, VSubpath, and VSelection.

Definition at line 236 of file vobject.h.

◆ addStyles()

void VObject::addStyles ( const TQDomElement *  style,
KoOasisLoadingContext &  context 
)
protected

Adds a new given style to the specified OASIS context.

Parameters
styleFIXME
contextFIXME

Definition at line 204 of file vobject.cpp.

◆ boundingBox()

virtual const KoRect & VObject::boundingBox ( ) const
inlinevirtual

Calculates the tightest bounding box around the object.

Returns
the bounding box.

Reimplemented in VPath, VGroup, VSubpath, and VSelection.

Definition at line 111 of file vobject.h.

◆ boundingBoxIsInvalid()

bool VObject::boundingBoxIsInvalid ( ) const
inline

Checks if the bounding box is invalid and needs to be recalculated.

Returns
true if bounding box is invalid.

Definition at line 119 of file vobject.h.

◆ clone()

virtual VObject * VObject::clone ( ) const
pure virtual

Create an exact copy of this object.

Returns
the exact object copy

Implemented in VClipGroup, VPath, VDocument, VGroup, VLayer, VSubpath, VSelection, and VStar.

◆ dcopObject()

DCOPObject * VObject::dcopObject ( )
virtual

Returns pointer to internal DCOP object.

If no internal DCOP object exist yet, it is created.

Reimplemented in VPath, and VLayer.

Definition at line 75 of file vobject.cpp.

◆ document()

VDocument * VObject::document ( ) const

Return document the object belongs to.

Returns
pointer to parent document or 0 if object does not belong to a document

Definition at line 216 of file vobject.cpp.

◆ draw()

virtual void VObject::draw ( VPainter *  painter,
const KoRect *  rect = 0L 
) const
inlinevirtual

Draw the object to a painting device.

Parameters
painterabstraction that is used to render to a painting device.
rectrepresents the visible rectangular area. If this object doesn't intersect with this area it is not drawn.

Reimplemented in VDocument, VClipGroup, VPath, VGroup, and VLayer.

Definition at line 100 of file vobject.h.

◆ fill()

virtual VFill * VObject::fill ( ) const
inlinevirtual

Gets the object's actual fill.

Returns
pointer to the object's fill

Definition at line 177 of file vobject.h.

◆ insertInfrontOf()

virtual void VObject::insertInfrontOf ( VObject *  newObject,
VObject *  oldObject 
)
inlinevirtual

This function is important for undo/redo.

It inserts newObject in front of oldObject.

Parameters
newObjectthe new object to insert
oldObjectthe old object the new object is inserted in front of

Reimplemented in VGroup.

Definition at line 246 of file vobject.h.

◆ invalidateBoundingBox()

void VObject::invalidateBoundingBox ( )
inline

Invalidates the bounding box, so it has to be recalculated.

This function is public so visitors can access it themself at the right time when they manipulate many VSegments.

Definition at line 127 of file vobject.h.

◆ load()

void VObject::load ( const TQDomElement &  element)
virtual

Load this object's state from xml and initialize this object accordingly.

Parameters
elementthe DOM element from which the attributes are read

Reimplemented in VClipGroup, VPath, VDocument, VGroup, VLayer, VSubpath, and VStar.

Definition at line 157 of file vobject.cpp.

◆ loadOasis()

bool VObject::loadOasis ( const TQDomElement &  element,
KoOasisLoadingContext &  context 
)
virtual

Load this object's state from OpenDocument and initialize this object accordingly.

Parameters
elementthe DOM element to read attributes from
contextFIXME

Reimplemented in VPath, VDocument, and VGroup.

Definition at line 181 of file vobject.cpp.

◆ name()

TQString VObject::name ( ) const
virtual

Returns the name of the object.

Returns
the object's name

Reimplemented in VStar.

Definition at line 225 of file vobject.cpp.

◆ parent()

VObject * VObject::parent ( ) const
inline

Returns pointer to current parent object.

Returns
pointer to current parent object or 0 if no parent object is set

Definition at line 147 of file vobject.h.

◆ save()

void VObject::save ( TQDomElement &  element) const
virtual

Save this object's state to xml.

Parameters
elementthe DOM element to which the attributes are saved

Reimplemented in VSubpath, VClipGroup, VPath, VDocument, VGroup, VLayer, and VStar.

Definition at line 102 of file vobject.cpp.

◆ saveOasis()

void VObject::saveOasis ( KoStore *  store,
KoXmlWriter *  docWriter,
KoGenStyles &  mainStyles,
int &  index 
) const
virtual

Save this object's state to OpenDocument.

Parameters
storeFIXME
docWriterFIXME
mainStylesFIXME

Reimplemented in VPath, VGroup, and VLayer.

Definition at line 116 of file vobject.cpp.

◆ saveOasisFill()

void VObject::saveOasisFill ( KoGenStyles &  mainStyles,
KoGenStyle &  stylesojectauto 
) const
protectedvirtual

Definition at line 141 of file vobject.cpp.

◆ setFill()

void VObject::setFill ( const VFill &  fill)
virtual

Sets the fill to a given new fill.

Parameters
fillthe new fill

Reimplemented in VGroup.

Definition at line 93 of file vobject.cpp.

◆ setName()

void VObject::setName ( const TQString &  s)

Sets the object's name to a given new name.

Parameters
sthe new object name

Definition at line 231 of file vobject.cpp.

◆ setParent()

void VObject::setParent ( VObject *  parent)
inline

Sets a new parent object.

Parameters
parentthe new parent object

Definition at line 140 of file vobject.h.

◆ setState()

virtual void VObject::setState ( const VState  state)
inlinevirtual

Sets the state to a specified new state.

Note that this will not have any visual effect until draw() is called on this object.

Parameters
statethe new state.

Reimplemented in VGroup.

Definition at line 163 of file vobject.h.

◆ setStroke()

void VObject::setStroke ( const VStroke &  stroke)
virtual

Sets the stroke to a given new stroke.

Parameters
strokethe new stroke

Reimplemented in VGroup.

Definition at line 84 of file vobject.cpp.

◆ state()

VState VObject::state ( ) const
inline

Get the state the object is in.

Returns
the object state at time of calling.

Definition at line 154 of file vobject.h.

◆ stroke()

virtual VStroke * VObject::stroke ( ) const
inlinevirtual

Gets the object's actual stroke.

Returns
pointer to the object's stroke

Definition at line 170 of file vobject.h.

Member Data Documentation

◆ m_boundingBox

KoRect VObject::m_boundingBox
mutableprotected

the object's bounding box

Definition at line 285 of file vobject.h.

◆ m_boundingBoxIsInvalid

bool VObject::m_boundingBoxIsInvalid
mutableprotected

the flag stating if the bounding box is valid

Definition at line 287 of file vobject.h.

◆ m_dcop

DCOPObject* VObject::m_dcop
protected

the object's DCOP object

Definition at line 292 of file vobject.h.

◆ m_fill

VFill* VObject::m_fill
protected

the object's fill

Definition at line 290 of file vobject.h.

◆ m_state

VState VObject::m_state
mutableprotected

the object's state

Definition at line 286 of file vobject.h.

◆ m_stroke

VStroke* VObject::m_stroke
protected

the object's stroke

Definition at line 289 of file vobject.h.


The documentation for this class was generated from the following files: