karbon
vobject.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __VOBJECT_H__
00022 #define __VOBJECT_H__
00023
00024
00025 #include <KoRect.h>
00026 #include <dcopobject.h>
00027 #include <koffice_export.h>
00028
00029 class QDomElement;
00030 class VDocument;
00031 class VFill;
00032 class VPainter;
00033 class VStroke;
00034 class VVisitor;
00035 class DCOPObject;
00036 class KoStore;
00037 class KoXmlWriter;
00038 class KoOasisLoadingContext;
00039 class KoGenStyles;
00040 class KoGenStyle;
00041
00049 class KARBONBASE_EXPORT VObject
00050 {
00051 public:
00052 enum VState
00053 {
00054 normal = 0,
00055 normal_locked = 1,
00056 hidden = 2,
00057 hidden_locked = 3,
00058 deleted = 4,
00060
00061 selected = 5,
00062 edit = 6
00063 };
00064
00071 VObject( VObject* parent, VState state = edit );
00072
00079 VObject( const VObject& obj );
00080
00084 virtual ~VObject();
00085
00091 virtual DCOPObject* dcopObject();
00092
00100 virtual void draw( VPainter* painter, const KoRect* rect = 0L ) const
00101 {
00102 Q_UNUSED( painter );
00103 Q_UNUSED( rect );
00104 }
00105
00111 virtual const KoRect& boundingBox() const
00112 { return m_boundingBox; }
00113
00119 bool boundingBoxIsInvalid() const
00120 { return m_boundingBoxIsInvalid; }
00121
00127 void invalidateBoundingBox()
00128 {
00129 m_boundingBoxIsInvalid = true;
00130
00131 if( m_parent )
00132 m_parent->invalidateBoundingBox();
00133 }
00134
00140 void setParent( VObject* parent ) { m_parent = parent; }
00141
00147 VObject* parent() const { return m_parent; }
00148
00154 VState state() const { return m_state; }
00155
00163 virtual void setState( const VState state ) { m_state = state; }
00164
00170 virtual VStroke* stroke() const { return m_stroke; }
00171
00177 virtual VFill* fill() const { return m_fill; }
00178
00184 virtual void setStroke( const VStroke& stroke );
00185
00191 virtual void setFill( const VFill& fill );
00192
00198 virtual void save( QDomElement& element ) const;
00199
00207 virtual void saveOasis( KoStore *store, KoXmlWriter *docWriter, KoGenStyles &mainStyles, int &index ) const;
00208
00215 virtual void load( const QDomElement& element );
00216
00224 virtual bool loadOasis( const QDomElement &element, KoOasisLoadingContext &context );
00225
00231 virtual VObject* clone() const = 0;
00232
00236 virtual void accept( VVisitor& )
00237 { }
00238
00246 virtual void insertInfrontOf( VObject* newObject, VObject* oldObject )
00247 {
00248 Q_UNUSED( newObject );
00249 Q_UNUSED( oldObject );
00250 }
00251
00257 virtual QString name() const;
00258
00264 void setName( const QString &s );
00265
00271 VDocument *document() const;
00272
00273 protected:
00280 void addStyles( const QDomElement* style, KoOasisLoadingContext & context );
00281
00282 virtual void saveOasisFill( KoGenStyles &mainStyles, KoGenStyle &stylesojectauto ) const;
00283
00284 protected:
00285 mutable KoRect m_boundingBox;
00286 mutable VState m_state : 8;
00287 mutable bool m_boundingBoxIsInvalid : 1;
00289 VStroke* m_stroke;
00290 VFill* m_fill;
00292 DCOPObject *m_dcop;
00294 private:
00295 VObject* m_parent;
00296 };
00297
00298 #endif
00299
|