lib Library API Documentation

koView.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017    Boston, MA 02111-1307, USA.
00018 */
00019 #ifndef __koView_h__
00020 #define __koView_h__
00021 
00022 #include <qwidget.h>
00023 #include <qguardedptr.h>
00024 
00025 #include <kparts/part.h>
00026 
00027 #include <koChild.h>
00028 
00029 class KAction;
00030 class KActionCollection;
00031 class QCustomEvent;
00032 class KoDocument;
00033 class KoMainWindow;
00034 class KMainWindow;
00035 class KoViewPrivate;
00036 class KoViewChild;
00037 class KoFrame;
00038 class KStatusBar;
00039 class KInstance;
00040 class KPrinter;
00041 class KoDocumentChild;
00042 class DCOPObject;
00043 
00044 namespace KParts
00045 {
00046   class PartManager;
00047   class PartActivateEvent;
00048   class PartSelectEvent;
00049 }
00050 
00056 class KoView : public QWidget, public KParts::PartBase
00057 {
00058   Q_OBJECT
00059 public:
00073   KoView( KoDocument *document, QWidget *parent = 0, const char *name = 0 );
00077   virtual ~KoView();
00078 
00082   KoDocument *koDocument() const;
00083 
00087   void setDocumentDeleted();
00093   bool documentDeleted() const;
00094 
00095   virtual void setPartManager( KParts::PartManager *manager );
00096   virtual KParts::PartManager *partManager() const;
00097 
00109   virtual KAction *action( const QDomElement &element ) const;
00110 
00121   virtual KoDocument *hitTest( const QPoint &pos );
00122 
00141   virtual int leftBorder() const;
00145   virtual int rightBorder() const;
00149   virtual int topBorder() const;
00153   virtual int bottomBorder() const;
00154 
00165   virtual void setZoom( double zoom );
00171   virtual double zoom() const;
00172 
00179   virtual QWidget *canvas();
00180 
00188   virtual int canvasXOffset() const;
00189 
00197   virtual int canvasYOffset() const;
00198 
00207   virtual void canvasAddChild( KoViewChild *child );
00208 
00213    virtual KoDocumentChild *selectedChild();
00214 
00219   virtual KoDocumentChild *activeChild();
00220 
00224   virtual void paintEverything( QPainter &painter, const QRect &rect, bool transparent = false );
00225 
00232   bool hasDocumentInWindow( KoDocument *doc );
00233 
00240   QWMatrix matrix() const;
00241 
00247   KoViewChild *child( KoView *view );
00252   KoViewChild *child( KoDocument *document );
00253 
00259   virtual DCOPObject * dcopObject();
00260 
00266   virtual void setupPrinter( KPrinter &printer );
00267 
00268   // BCI: make it return a bool, so that aborting doesn't still fire up the print preview afterwards
00272   virtual void print( KPrinter &printer );
00273 
00279   KoMainWindow * shell() const;
00280 
00285   KMainWindow* mainWindow() const;
00286 
00292   KStatusBar * statusBar() const;
00293 
00305   void addStatusBarItem( QWidget * widget, int stretch = 0, bool permanent = false );
00306 
00310   void removeStatusBarItem( QWidget * widget );
00311 
00315   void showAllStatusBarItems( bool show );
00316 
00321   virtual void updateReadWrite( bool readwrite ) = 0;
00322 
00328   bool isInOperation() const;
00329 
00330 public slots:
00334     virtual void newView();
00335 
00342     virtual void beginOperation();
00343 
00350     virtual void endOperation();
00351 
00356     void slotActionStatusText( const QString &text );
00357 
00362     void slotClearStatusText();
00363 
00364 protected:
00370   virtual void customEvent( QCustomEvent *ev );
00371 
00375   virtual void partActivateEvent( KParts::PartActivateEvent *event );
00379   virtual void partSelectEvent( KParts::PartSelectEvent *event );
00383   virtual void guiActivateEvent( KParts::GUIActivateEvent * );
00384 
00385 signals:
00386   void activated( bool active );
00387   void selected( bool select );
00388 
00389   void childSelected( KoDocumentChild *child );
00390   void childUnselected( KoDocumentChild *child );
00391 
00392   void childActivated( KoDocumentChild *child );
00393   void childDeactivated( KoDocumentChild *child );
00394 
00395   void regionInvalidated( const QRegion &region, bool erase );
00396 
00397   void invalidated();
00398 
00399 // KDE invents public signals :)
00400 #undef signals
00401 #define signals public
00402 signals:
00403 
00409   void embeddImage(const QString &filename);
00410 
00411 #undef signals
00412 #define signals protected
00413 
00414 protected slots:
00415   virtual void slotChildActivated( bool a );
00416   virtual void slotChildChanged( KoDocumentChild *child );
00417 
00418 private:
00419   KAction *actionNewView;
00420   virtual void setupGlobalActions( void );
00421   KoViewPrivate *d;
00422 
00423 };
00424 
00428 class KoViewChild : public KoChild
00429 {
00430   Q_OBJECT
00431 public:
00432   KoViewChild( KoDocumentChild *child, KoView *_parentView );
00433   virtual ~KoViewChild();
00434 
00435   KoDocumentChild *documentChild() const { return m_child; }
00436   KoView *parentView() const { return m_parentView; }
00437   KoFrame *frame() const { return m_frame; }
00438 
00439 private slots:
00440   void slotFrameGeometryChanged();
00441   void slotDocGeometryChanged();
00442 private:
00443   QGuardedPtr<KoDocumentChild> m_child;
00444   QGuardedPtr<KoFrame> m_frame;
00445   QGuardedPtr<KoView> m_parentView;
00446   class KoViewChildPrivate;
00447   KoViewChildPrivate *d;
00448 };
00449 
00450 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Nov 17 13:19:27 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2003