karbon

VObject Class Reference

#include <vobject.h>

Inheritance diagram for VObject:

VDocument VGroup VImage VPath VSelection VShadowDecorator VSubpath VText List of all members.

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.


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)
VObjectparent () const
VState state () const
virtual void setState (const VState state)
virtual VStrokestroke () const
virtual VFillfill () const
virtual void setStroke (const VStroke &stroke)
virtual void setFill (const VFill &fill)
virtual void save (QDomElement &element) const
virtual void saveOasis (KoStore *store, KoXmlWriter *docWriter, KoGenStyles &mainStyles, int &index) const
virtual void load (const QDomElement &element)
virtual bool loadOasis (const QDomElement &element, KoOasisLoadingContext &context)
virtual VObjectclone () const =0
virtual void accept (VVisitor &)
virtual void insertInfrontOf (VObject *newObject, VObject *oldObject)
virtual QString name () const
void setName (const QString &s)
VDocumentdocument () const

Protected Member Functions

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

Protected Attributes

KoRect m_boundingBox
VState m_state: 8
bool m_boundingBoxIsInvalid: 1
VStrokem_stroke
VFillm_fill
DCOPObject * m_dcop

Member Enumeration Documentation

enum VObject::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::VObject VObject parent,
VState  state = edit
 

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

Parameters:
parent the new object's parent
state the new object's state

Definition at line 36 of file vobject.cc.

VObject::VObject const VObject obj  ) 
 

Copy constructor.

Copies parent, state and name of given object.

Parameters:
obj the object to copy properties from

Definition at line 47 of file vobject.cc.

VObject::~VObject  )  [virtual]
 

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

Definition at line 67 of file vobject.cc.


Member Function Documentation

virtual void VObject::accept VVisitor  )  [inline, virtual]
 

Accept a VVisitor.

Reimplemented in VPath, VDocument, VGroup, VImage, VLayer, VSubpath, VSelection, VText, and VShadowDecorator.

Definition at line 236 of file vobject.h.

void VObject::addStyles const QDomElement *  style,
KoOasisLoadingContext &  context
[protected]
 

Adds a new given style to the specified OASIS context.

Parameters:
style FIXME
context FIXME

Definition at line 204 of file vobject.cc.

virtual const KoRect& VObject::boundingBox  )  const [inline, virtual]
 

Calculates the tightest bounding box around the object.

Returns:
the bounding box.

Reimplemented in VPath, VGroup, VSubpath, VSelection, VText, and VShadowDecorator.

Definition at line 111 of file vobject.h.

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.

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, VImage, VLayer, VSubpath, VSelection, VText, VShadowDecorator, VEllipse, VPolygon, VPolyline, VRectangle, VSinus, VSpiral, and VStar.

DCOPObject * VObject::dcopObject  )  [virtual]
 

Returns pointer to internal DCOP object.

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

Reimplemented in VPath, VLayer, and VText.

Definition at line 75 of file vobject.cc.

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.cc.

virtual void VObject::draw VPainter painter,
const KoRect *  rect = 0L
const [inline, virtual]
 

Draw the object to a painting device.

Parameters:
painter abstraction that is used to render to a painting device.
rect represents the visible rectangular area. If this object doesn't intersect with this area it is not drawn.

Reimplemented in VClipGroup, VPath, VDocument, VGroup, VImage, VLayer, VText, and VShadowDecorator.

Definition at line 100 of file vobject.h.

virtual VFill* VObject::fill  )  const [inline, virtual]
 

Gets the object's actual fill.

Returns:
pointer to the object's fill

Reimplemented in VShadowDecorator.

Definition at line 177 of file vobject.h.

virtual void VObject::insertInfrontOf VObject newObject,
VObject oldObject
[inline, virtual]
 

This function is important for undo/redo.

It inserts newObject in front of oldObject.

Parameters:
newObject the new object to insert
oldObject the old object the new object is inserted in front of

Reimplemented in VGroup.

Definition at line 246 of file vobject.h.

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.

void VObject::load const QDomElement &  element  )  [virtual]
 

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

Parameters:
element the DOM element from which the attributes are read

Reimplemented in VClipGroup, VPath, VDocument, VGroup, VImage, VLayer, VSubpath, VText, VShadowDecorator, VEllipse, VPolygon, VPolyline, VRectangle, VSinus, VSpiral, and VStar.

Definition at line 157 of file vobject.cc.

bool VObject::loadOasis const QDomElement &  element,
KoOasisLoadingContext &  context
[virtual]
 

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

Parameters:
element the DOM element to read attributes from
context FIXME

Reimplemented in VPath, VDocument, VGroup, VEllipse, VPolygon, VPolyline, and VRectangle.

Definition at line 181 of file vobject.cc.

QString VObject::name  )  const [virtual]
 

Returns the name of the object.

Returns:
the object's name

Reimplemented in VEllipse, VPolygon, VPolyline, VRectangle, VSinus, VSpiral, and VStar.

Definition at line 225 of file vobject.cc.

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.

void VObject::save QDomElement &  element  )  const [virtual]
 

Save this object's state to xml.

Parameters:
element the DOM element to which the attributes are saved

Reimplemented in VClipGroup, VPath, VDocument, VGroup, VImage, VLayer, VSubpath, VText, VShadowDecorator, VEllipse, VPolygon, VPolyline, VRectangle, VSinus, VSpiral, and VStar.

Definition at line 102 of file vobject.cc.

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

Save this object's state to OpenDocument.

Parameters:
store FIXME
docWriter FIXME
mainStyles FIXME

Reimplemented in VPath, VGroup, VLayer, VEllipse, VPolygon, VPolyline, and VRectangle.

Definition at line 116 of file vobject.cc.

void VObject::setFill const VFill fill  )  [virtual]
 

Sets the fill to a given new fill.

Parameters:
fill the new fill

Reimplemented in VGroup, and VShadowDecorator.

Definition at line 93 of file vobject.cc.

void VObject::setName const QString &  s  ) 
 

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

Parameters:
s the new object name

Definition at line 231 of file vobject.cc.

void VObject::setParent VObject parent  )  [inline]
 

Sets a new parent object.

Parameters:
parent the new parent object

Definition at line 140 of file vobject.h.

virtual void VObject::setState const VState  state  )  [inline, virtual]
 

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:
state the new state.

Reimplemented in VGroup, VText, and VShadowDecorator.

Definition at line 163 of file vobject.h.

void VObject::setStroke const VStroke stroke  )  [virtual]
 

Sets the stroke to a given new stroke.

Parameters:
stroke the new stroke

Reimplemented in VGroup, and VShadowDecorator.

Definition at line 84 of file vobject.cc.

VState VObject::state  )  const [inline]
 

Get the state the object is in.

Returns:
the object state at time of calling.

Reimplemented in VShadowDecorator.

Definition at line 154 of file vobject.h.

virtual VStroke* VObject::stroke  )  const [inline, virtual]
 

Gets the object's actual stroke.

Returns:
pointer to the object's stroke

Reimplemented in VShadowDecorator.

Definition at line 170 of file vobject.h.


Member Data Documentation

KoRect VObject::m_boundingBox [mutable, protected]
 

the object's bounding box

Definition at line 285 of file vobject.h.

bool VObject::m_boundingBoxIsInvalid [mutable, protected]
 

the flag stating if the bounding box is valid

Definition at line 287 of file vobject.h.

DCOPObject* VObject::m_dcop [protected]
 

the object's DCOP object

Definition at line 292 of file vobject.h.

VFill* VObject::m_fill [protected]
 

the object's fill

Definition at line 290 of file vobject.h.

VState VObject::m_state [mutable, protected]
 

the object's state

Definition at line 286 of file vobject.h.

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:
KDE Home | KDE Accessibility Home | Description of Access Keys