21#include "KoPictureBase.h"
23#include <KoXmlWriter.h>
33#include <tqdragobject.h>
35static int s_useSlowResizeMode = -1;
37KoPictureBase::KoPictureBase(
void)
40 if ( s_useSlowResizeMode == -1 )
42 TDEConfigGroup group( TDEGlobal::config(),
"KOfficeImage" );
43 s_useSlowResizeMode = group.readNumEntry(
"HighResolution", 1 );
44 kdDebug(30003) <<
"HighResolution = " << s_useSlowResizeMode << endl;
48KoPictureBase::~KoPictureBase(
void)
52KoPictureBase* KoPictureBase::newCopy(
void)
const
54 return new KoPictureBase(*
this);
57KoPictureType::Type KoPictureBase::getType(
void)
const
59 return KoPictureType::TypeUnknown;
62bool KoPictureBase::isNull(
void)
const
67void KoPictureBase::draw(TQPainter& painter,
int x,
int y,
int width,
int height,
int,
int,
int,
int,
bool )
70 kdWarning(30003) <<
"Drawing light red rectangle! (KoPictureBase::draw)" << endl;
72 painter.setBrush(TQColor(128,0,0));
73 painter.drawRect(x,y,width,height);
77bool KoPictureBase::load(TQIODevice* io,
const TQString& extension)
79 return loadData(io->readAll(), extension);
82bool KoPictureBase::loadData(
const TQByteArray&,
const TQString&)
88bool KoPictureBase::save(TQIODevice*)
const
94bool KoPictureBase::saveAsBase64(
KoXmlWriter& writer )
const
97 buffer.open(IO_ReadWrite);
98 if ( !save( &buffer ) )
100 TQCString encoded = KCodecs::base64Encode( buffer.buffer() );
105TQSize KoPictureBase::getOriginalSize(
void)
const
110TQPixmap KoPictureBase::generatePixmap(
const TQSize&,
bool )
115TQString KoPictureBase::getMimeType(
const TQString&)
const
117 return TQString(NULL_MIME_TYPE);
120bool KoPictureBase::isSlowResizeModeAllowed(
void)
const
122 return s_useSlowResizeMode != 0;
125TQDragObject* KoPictureBase::dragObject( TQWidget * dragSource,
const char * name )
127 TQImage image (generateImage(getOriginalSize()));
131 return new TQImageDrag( image, dragSource, name );
134TQImage KoPictureBase::generateImage(
const TQSize& size)
136 return generatePixmap(size,
true).convertToImage();
139void KoPictureBase::clearCache(
void)
A class for writing out XML (to any TQIODevice), with a special attention on performance.
void addTextNode(const TQString &str)
Overloaded version of addTextNode( const char* ), which is a bit slower because it needs to convert s...