kword

KWPictureFrameSet.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999, 2000 Reginald Stadlbauer <reggie@kde.org>
00003    Copyright (C) 2005 Thomas Zander <zander@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef frame_picture_frame_set_h
00022 #define frame_picture_frame_set_h
00023 
00024 #include "KWFrameSet.h"
00025 #include <KoPicture.h>
00026 
00027 class KWPictureFrameSet : public KWFrameSet
00028 {
00029 public:
00030     KWPictureFrameSet( KWDocument *_doc, const QString & name );
00032     KWPictureFrameSet( KWDocument* doc, const QDomElement& frame, const QDomElement& imageTag, KoOasisContext& context );
00033     virtual ~KWPictureFrameSet();
00034 
00035     virtual KWordFrameSetIface* dcopObject();
00036 
00041     virtual FrameSetType type() const;
00042 
00043     void setPicture( const KoPicture &picture ) { m_picture = picture; }
00044     KoPicture picture() const { return m_picture; }
00045 
00046     KoPictureKey key() const { return m_picture.getKey(); }
00047 
00048     void loadPicture( const QString &fileName );
00049     void insertPicture( const KoPicture& picture );
00050 
00055     void reloadPicture( const KoPictureKey& key );
00056 
00057     virtual QDomElement save( QDomElement &parentElem, bool saveFrames = true );
00058     virtual void load( QDomElement &attributes, bool loadFrames = true );
00059     virtual void saveOasis( KoXmlWriter& writer, KoSavingContext& context, bool saveFrames ) const;
00060 
00061     virtual void drawFrameContents( KWFrame * frame, QPainter *painter, const QRect & crect,
00062                                     const QColorGroup &cg, bool onlyChanged, bool resetChanged,
00063                                     KWFrameSetEdit * edit, KWViewMode *viewMode );
00064 
00066     virtual void createEmptyRegion( const QRect &, QRegion &, KWViewMode * ) { }
00067 
00068 #ifndef NDEBUG
00069     virtual void printDebug( KWFrame* frame );
00070 #endif
00071 
00072     bool keepAspectRatio() const;
00073     void setKeepAspectRatio( bool b );
00074 
00079     virtual void setProtectContent ( bool ) { };
00084     virtual bool protectContent() const { return false; }
00085 
00086 protected:
00087     void loadOasis( const QDomElement& frame, const QDomElement& imageTag, KoOasisContext& context );
00088 
00090     KoPicture m_picture;
00091     bool m_keepAspectRatio;
00093     bool m_finalSize;
00094 };
00095 
00096 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys