20#ifndef KSPREAD_OBJECT_H
21#define KSPREAD_OBJECT_H
23#include "kspread_sheet.h"
29#include <KoOasisLoadingContext.h>
31#include <KoPictureCollection.h>
35#include <KoStoreDevice.h>
66enum PictureMirrorType {
70 PM_HORIZONTALANDVERTICAL = 3
75 IE_CHANNEL_INTENSITY = 0,
111 EmbeddedObject( Sheet *_sheet, const KoRect& _geometry );
112 virtual ~EmbeddedObject();
113 virtual ObjType getType() const { return OBJECT_GENERAL; }
114 virtual TQString getTypeString() const
115 { return TQString(); }
118 void setGeometry( const KoRect &rect );
119 virtual void moveBy( const KoPoint &_point );
120 virtual void moveBy( double _dx, double _dy );
121 virtual void resizeBy( const KoSize & _size );
122 virtual void resizeBy( double _dx, double _dy );
124 Sheet* sheet() const { return m_sheet; }
126 void setSelected( bool s) { m_selected = s; }
127 bool isSelected() const { return m_selected; }
129 void setObjectName( const TQString &_objectName )
130 { m_objectName = _objectName; }
131 TQString getObjectName() const
132 { return m_objectName; }
134 virtual void setProtect( bool b ) { m_protect = b; }
135 bool isProtect() const { return m_protect; }
137 virtual void setKeepRatio( bool b ) { m_keepRatio = b; }
138 bool isKeepRatio() const { return m_keepRatio; }
140 virtual void rotate( float _angle ) { angle = _angle; }
141 virtual float getAngle() const { return angle; }
143 struct KSpreadOasisSaveContext
145 KSpreadOasisSaveContext( KoXmlWriter &_xmlWriter, KoGenStyles &_context,
146 int &_indexObj, int &_partIndexObj )
147 : xmlWriter( _xmlWriter )
148 , context( _context )
149 , indexObj( _indexObj )
150 , partIndexObj( _partIndexObj )
153 KoXmlWriter &xmlWriter;
154 KoGenStyles &context;
159 virtual bool load( const TQDomElement& element );
160 virtual void loadOasis( const TQDomElement &element, KoOasisLoadingContext & context );
161 virtual TQDomElement save( TQDomDocument& doc );
162 virtual bool saveOasisObject( KSpreadOasisSaveContext &sc ) const;
163 virtual void draw( TQPainter *_painter );
182 virtual TQPixmap toPixmap( double xZoom , double yZoom );
185 void paintSelection( TQPainter *_painter, SelectionMode selectionMode );
186 virtual TQCursor getCursor( const TQPoint &_point, ModifyType &_modType, TQRect &geometry ) const;
188 virtual void removeFromObjList()
189 { inObjList = false; }
190 virtual void addToObjList()
191 { inObjList = true; }
192 virtual void incCmdRef()
194 virtual void decCmdRef()
195 { cmds--; doDelete(); }
198 virtual TQBrush getBrush() const { return m_brush.getBrush(); }
206 virtual void saveOasisPosObject( KoXmlWriter &xmlWriter, int indexObj ) const;
207 virtual bool saveOasisObjectAttributes( KSpreadOasisSaveContext &sc ) const;
209 virtual void doDelete();
223 TQString m_objectName;
238class EmbeddedKOfficeObject : public EmbeddedObject
241 EmbeddedKOfficeObject( Doc *parent, Sheet *_sheet, KoDocument* doc, const KoRect& geometry );
242 EmbeddedKOfficeObject( Doc *parent, Sheet *_sheet );
243 virtual ~EmbeddedKOfficeObject();
244 virtual ObjType getType() const { return OBJECT_KOFFICE_PART; }
245 virtual TQString getTypeString() const
246 { return i18n( "Embedded Object"); }
249 KoDocumentChild *embeddedObject();
251 bool load( const TQDomElement& element );
252 virtual void loadOasis( const TQDomElement &element, KoOasisLoadingContext & context );
253 TQDomElement save( TQDomDocument& doc );
254 virtual void draw( TQPainter *_painter );
259 virtual TQPixmap toPixmap( double xZoom , double yZoom);
261 void activate( View *_view, Canvas *_canvas );
265 void updateChildGeometry();
267 virtual bool saveOasisObjectAttributes( KSpreadOasisSaveContext &sc ) const;
269 KoDocumentChild *m_embeddedObject;
277class EmbeddedChart : public EmbeddedKOfficeObject
280 EmbeddedChart( Doc *_spread, Sheet *_sheet, KoDocument* doc, const KoRect& _rect );
281 EmbeddedChart( Doc *_spread, Sheet *_sheet );
282 virtual ~EmbeddedChart();
283 virtual ObjType getType() const { return OBJECT_CHART; }
284 virtual TQString getTypeString() const
285 { return i18n( "Chart"); }
287 void setDataArea( const TQRect& _data );
290 bool load( const TQDomElement& element );
291 virtual void loadOasis( const TQDomElement &element, KoOasisLoadingContext & context );
292 TQDomElement save( TQDomDocument& doc );
293 virtual void draw( TQPainter *_painter );
300 KoChart::Part* chart();
304 virtual bool saveOasisObjectAttributes( KSpreadOasisSaveContext &sc ) const;
307 ChartBinding *m_pBinding;
314class EmbeddedPictureObject : public EmbeddedObject
317 EmbeddedPictureObject(Sheet *_sheet, const KoRect& _geometry, KoPictureCollection *_imageCollection );
318 EmbeddedPictureObject(Sheet *_sheet, const KoRect& _geometry, KoPictureCollection *_imageCollection, const KoPictureKey & key );
319 EmbeddedPictureObject( Sheet *_sheet, KoPictureCollection *_imageCollection );
320 virtual ~EmbeddedPictureObject();
321 EmbeddedPictureObject &operator=( const EmbeddedPictureObject & );
323 virtual ObjType getType() const { return OBJECT_PICTURE; }
324 virtual TQString getTypeString() const
325 { return i18n( "Picture"); }
326 bool load( const TQDomElement& element );
327 virtual void loadOasis( const TQDomElement &element, KoOasisLoadingContext & context );
328 TQDomElement save( TQDomDocument& doc );
329 virtual void draw( TQPainter *_painter );
334 virtual TQPixmap toPixmap( double xZoom , double yZoom);
341 { return image.getKey().filename(); }
343 KoPictureKey getKey() const
344 { return image.getKey(); }
346 TQSize originalSize() const
347 { return image.getOriginalSize(); }
349 void setPicture( const KoPictureKey & key );
361 TQPixmap getOriginalPixmap();
362 PictureMirrorType getPictureMirrorType() const { return mirrorType; }
363 int getPictureDepth() const { return depth; }
364 bool getPictureSwapRGB() const { return swapRGB; }
365 bool getPictureGrayscal() const { return grayscal; }
366 int getPictureBright() const { return bright; }
368 ImageEffect getImageEffect() const { return m_effect;}
369 TQVariant getIEParam1() const { return m_ie_par1;}
370 TQVariant getIEParam2() const { return m_ie_par2;}
371 TQVariant getIEParam3() const { return m_ie_par3;}
372 void setImageEffect(ImageEffect eff) { m_effect = eff; }
373 void setIEParams(TQVariant p1, TQVariant p2, TQVariant p3) {
379 void setPictureMirrorType( const PictureMirrorType &_mirrorType) { mirrorType = _mirrorType; }
380 void setPictureDepth( int _depth) { depth = _depth; }
381 void setPictureSwapRGB( bool _swapRGB) { swapRGB = _swapRGB; }
382 void setPictureGrayscal( bool _grayscal) { grayscal = _grayscal; }
383 void setPictureBright( int _bright) { bright = _bright; }
385 KoPicture picture() const { return image;}
387 void loadPicture( const TQString & fileName );
389 virtual void flip( bool horizontal );
393 virtual bool saveOasisObjectAttributes( KSpreadOasisSaveContext &sc ) const;
395 TQPixmap changePictureSettings( TQPixmap _tmpPixmap );
396 virtual void saveOasisPictureElement( KoGenStyle &styleobjectauto ) const;
397 void loadOasisPictureEffect(KoOasisLoadingContext & context );
398 virtual void fillStyle( KoGenStyle& styleObjectAuto, KoGenStyles& mainStyles ) const;
404 void drawShadow( TQPainter* _painter, KoZoomHandler* _zoomHandler);
406 TQPixmap generatePixmap(KoZoomHandler*_zoomHandler);
407 TQString convertValueToPercent( int val ) const;
409 KoPictureCollection *imageCollection;
412 PictureMirrorType mirrorType, m_cachedMirrorType;
413 int depth, m_cachedDepth;
414 bool swapRGB, m_cachedSwapRGB;
415 bool grayscal, m_cachedGrayscal;
416 int bright, m_cachedBright;
419 ImageEffect m_effect, m_cachedEffect;
420 TQVariant m_ie_par1, m_cachedPar1;
421 TQVariant m_ie_par2, m_cachedPar2;
422 TQVariant m_ie_par3, m_cachedPar3;
424 TQPixmap m_cachedPixmap;
The canvas builds a part of the GUI of KSpread.
This class holds the data that makes up a spreadsheet.
virtual const char * getOasisElementName() const Get the element name for saving the object.
bool loadDocument(KoStore *_store)
Holds an embedded koffice object.
virtual const char * getOasisElementName() const Get the element name for saving the object.
Contains basic information for every object.
TQPixmap toPixmap() Renders the embedded object to a pixmap at 100% scale.
virtual const char * getOasisElementName() const =0 Get the element name for saving the object.
void calculateRequiredZoom(TQSize desiredSize, double &xZoom, double &yZoom) Calculates the X and Y zoom factors required to render the embedded object at the given size.
virtual const char * getOasisElementName() const Get the element name for saving the object.
TQString getFileName() const Only used as a default value in the filedialog, in changePicture.
The View class displays a KSpread document.
|