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 #include <koffice_export.h>
00029 
00030 class KAction;
00031 class KActionCollection;
00032 class QCustomEvent;
00033 class KoDocument;
00034 class KoMainWindow;
00035 class KMainWindow;
00036 class KoViewPrivate;
00037 class KoViewChild;
00038 class KoFrame;
00039 class KStatusBar;
00040 class KInstance;
00041 class KPrinter;
00042 class KoDocumentChild;
00043 class DCOPObject;
00044 
00045 namespace KParts
00046 {
00047   class PartManager;
00048   class PartActivateEvent;
00049   class PartSelectEvent;
00050 }
00051 
00057 class KOFFICECORE_EXPORT KoView : public QWidget, public KParts::PartBase
00058 {
00059   Q_OBJECT
00060 public:
00074   KoView( KoDocument *document, QWidget *parent = 0, const char *name = 0 );
00078   virtual ~KoView();
00079 
00083   KoDocument *koDocument() const;
00084 
00088   void setDocumentDeleted();
00094   bool documentDeleted() const;
00095 
00096   virtual void setPartManager( KParts::PartManager *manager );
00097   virtual KParts::PartManager *partManager() const;
00098 
00110   virtual KAction *action( const QDomElement &element ) const;
00111 
00122   virtual KoDocument *hitTest( const QPoint &pos );
00123 
00142   virtual int leftBorder() const;
00146   virtual int rightBorder() const;
00150   virtual int topBorder() const;
00154   virtual int bottomBorder() const;
00155 
00166   virtual void setZoom( double zoom );
00172   virtual double zoom() const;
00173 
00180   virtual QWidget *canvas();
00181 
00189   virtual int canvasXOffset() const;
00190 
00198   virtual int canvasYOffset() const;
00199 
00208   virtual void canvasAddChild( KoViewChild *child );
00209 
00214    virtual KoDocumentChild *selectedChild();
00215 
00220   virtual KoDocumentChild *activeChild();
00221 
00225   virtual void paintEverything( QPainter &painter, const QRect &rect, bool transparent = false );
00226 
00233   bool hasDocumentInWindow( KoDocument *doc );
00234 
00241   QWMatrix matrix() const;
00242 
00248   KoViewChild *child( KoView *view );
00253   KoViewChild *child( KoDocument *document );
00254 
00260   virtual DCOPObject * dcopObject();
00261 
00267   virtual void setupPrinter( KPrinter &printer );
00268 
00269   // BCI: make it return a bool, so that aborting doesn't still fire up the print preview afterwards
00273   virtual void print( KPrinter &printer );
00274 
00280   KoMainWindow * shell() const;
00281 
00286   KMainWindow* mainWindow() const;
00287 
00293   KStatusBar * statusBar() const;
00294 
00306   void addStatusBarItem( QWidget * widget, int stretch = 0, bool permanent = false );
00307 
00311   void removeStatusBarItem( QWidget * widget );
00312 
00316   void showAllStatusBarItems( bool show );
00317 
00322   virtual void updateReadWrite( bool readwrite ) = 0;
00323 
00329   bool isInOperation() const;
00330 
00331 public slots:
00335     virtual void newView();
00336 
00343     virtual void beginOperation();
00344 
00351     virtual void endOperation();
00352 
00357     void slotActionStatusText( const QString &text );
00358 
00363     void slotClearStatusText();
00364 
00365 protected:
00371   virtual void customEvent( QCustomEvent *ev );
00372 
00376   virtual void partActivateEvent( KParts::PartActivateEvent *event );
00380   virtual void partSelectEvent( KParts::PartSelectEvent *event );
00384   virtual void guiActivateEvent( KParts::GUIActivateEvent * );
00385 
00386 signals:
00387   void activated( bool active );
00388   void selected( bool select );
00389 
00390   void childSelected( KoDocumentChild *child );
00391   void childUnselected( KoDocumentChild *child );
00392 
00393   void childActivated( KoDocumentChild *child );
00394   void childDeactivated( KoDocumentChild *child );
00395 
00396   void regionInvalidated( const QRegion &region, bool erase );
00397 
00398   void invalidated();
00399 
00400 // KDE invents public signals :)
00401 #undef signals
00402 #define signals public
00403 signals:
00404 
00410   void embeddImage(const QString &filename);
00411 
00412 #undef signals
00413 #define signals protected
00414 
00415 protected slots:
00416   virtual void slotChildActivated( bool a );
00417   virtual void slotChildChanged( KoDocumentChild *child );
00418 
00419 private:
00420   KAction *actionNewView;
00421   virtual void setupGlobalActions( void );
00422   KoViewPrivate *d;
00423 
00424 };
00425 
00429 class KoViewChild : public KoChild
00430 {
00431   Q_OBJECT
00432 public:
00433   KoViewChild( KoDocumentChild *child, KoView *_parentView );
00434   virtual ~KoViewChild();
00435 
00436   KoDocumentChild *documentChild() const { return m_child; }
00437   KoView *parentView() const { return m_parentView; }
00438   KoFrame *frame() const { return m_frame; }
00439 
00440 private slots:
00441   void slotFrameGeometryChanged();
00442   void slotDocGeometryChanged();
00443 private:
00444   QGuardedPtr<KoDocumentChild> m_child;
00445   QGuardedPtr<KoFrame> m_frame;
00446   QGuardedPtr<KoView> m_parentView;
00447   class KoViewChildPrivate;
00448   KoViewChildPrivate *d;
00449 };
00450 
00451 #endif
KDE Logo
This file is part of the documentation for lib Library Version 1.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Feb 13 09:40:14 2006 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003