KoView.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19#ifndef __koView_h__
20#define __koView_h__
21
22#include <tqwidget.h>
23#include <tqguardedptr.h>
24
25#include <tdeparts/part.h>
26
27#include <KoChild.h>
28#include <koffice_export.h>
29
30class TDEAction;
32class TQCustomEvent;
33class KoDocument;
34class KoMainWindow;
35class TDEMainWindow;
36class KoViewPrivate;
37class KoViewChild;
38class KoFrame;
39class KStatusBar;
40class TDEInstance;
41class KPrinter;
42class KoDocumentChild;
43class DCOPObject;
44
45namespace KParts
46{
47 class PartManager;
48 class PartActivateEvent;
49 class PartSelectEvent;
50}
51
57class KOFFICECORE_EXPORT KoView : public TQWidget, public KParts::PartBase
58{
59 TQ_OBJECT
60
61public:
76 KoView( KoDocument *document, TQWidget *parent = 0, const char *name = 0 );
80 virtual ~KoView();
81
85 KoDocument *koDocument() const;
86
90 void setDocumentDeleted();
96 bool documentDeleted() const;
97
98 virtual void setPartManager( KParts::PartManager *manager );
99 virtual KParts::PartManager *partManager() const;
100
112 virtual TDEAction *action( const TQDomElement &element ) const;
113
124 virtual KoDocument *hitTest( const TQPoint &pos );
125
144 virtual int leftBorder() const;
148 virtual int rightBorder() const;
152 virtual int topBorder() const;
156 virtual int bottomBorder() const;
157
168 virtual void setZoom( double zoom );
174 virtual double zoom() const;
175
182 virtual TQWidget *canvas() const;
183
191 virtual int canvasXOffset() const;
192
200 virtual int canvasYOffset() const;
201
210 virtual void canvasAddChild( KoViewChild *child );
211
216 virtual KoDocumentChild *selectedChild();
217
222 virtual KoDocumentChild *activeChild();
223
227 void enableAutoScroll();
228
232 void disableAutoScroll();
233
237 virtual void paintEverything( TQPainter &painter, const TQRect &rect, bool transparent = false );
238
245 bool hasDocumentInWindow( KoDocument *doc );
246
255 virtual TQWMatrix matrix() const TDE_DEPRECATED;
256
263 virtual TQPoint applyViewTransformations( const TQPoint& ) const;
264
272 virtual TQPoint reverseViewTransformations( const TQPoint& ) const;
273
277 virtual TQRect applyViewTransformations( const TQRect& ) const;
278
282 virtual TQRect reverseViewTransformations( const TQRect& ) const;
283
289 KoViewChild *child( KoView *view );
294 KoViewChild *child( KoDocument *document );
295
301 virtual DCOPObject * dcopObject();
302
308 virtual void setupPrinter( KPrinter &printer );
309
310 // BCI: make it return a bool, so that aborting doesn't still fire up the print preview afterwards
314 virtual void print( KPrinter &printer );
315
321 KoMainWindow * shell() const;
322
327 TDEMainWindow* mainWindow() const;
328
334 KStatusBar * statusBar() const;
335
347 void addStatusBarItem( TQWidget * widget, int stretch = 0, bool permanent = false );
348
352 void removeStatusBarItem( TQWidget * widget );
353
357 void showAllStatusBarItems( bool show );
358
363 virtual void updateReadWrite( bool readwrite ) = 0;
364
370 bool isInOperation() const;
371
372public slots:
376 virtual void newView();
377
384 virtual void beginOperation();
385
392 virtual void endOperation();
393
398 void slotActionStatusText( const TQString &text );
399
404 void slotClearStatusText();
405
406protected:
412 virtual void customEvent( TQCustomEvent *ev );
413
417 virtual void partActivateEvent( KParts::PartActivateEvent *event );
421 virtual void partSelectEvent( KParts::PartSelectEvent *event );
425 virtual void guiActivateEvent( KParts::GUIActivateEvent * );
426
427signals:
428 void activated( bool active );
429 void selected( bool select );
430
431 void autoScroll(const TQPoint &scrollDistance);
432
433 void childSelected( KoDocumentChild *child );
434 void childUnselected( KoDocumentChild *child );
435
436 void childActivated( KoDocumentChild *child );
437 void childDeactivated( KoDocumentChild *child );
438
439 void regionInvalidated( const TQRegion &region, bool erase );
440
441 void invalidated();
442
443// KDE invents public signals :)
444#undef signals
445#define signals public
446signals:
447
453 void embeddImage(const TQString &filename);
454
455#undef signals
456#define signals protected
457
458protected slots:
459 virtual void slotChildActivated( bool a );
460 virtual void slotChildChanged( KoDocumentChild *child );
461 virtual void slotAutoScroll( );
462
463private:
464 TDEAction *actionNewView;
465 virtual void setupGlobalActions( void );
466 KoViewPrivate *d;
467 int autoScrollAcceleration( int offset ) const;
468};
469
473class KoViewChild : public KoChild
474{
475 TQ_OBJECT
476
477public:
478 KoViewChild( KoDocumentChild *child, KoView *_parentView );
479 virtual ~KoViewChild();
480
481 KoDocumentChild *documentChild() const { return m_child; }
482 KoView *parentView() const { return m_parentView; }
483 KoFrame *frame() const { return m_frame; }
484
485 void setInitialFrameGeometry();
486
487public slots:
488
489 // Call this when the view transformations change
490 void reposition() { slotDocGeometryChanged(); }
491
492private slots:
493 void slotFrameGeometryChanged();
494 void slotDocGeometryChanged();
495
496private:
497 TQGuardedPtr<KoDocumentChild> m_child;
498 TQGuardedPtr<KoFrame> m_frame;
499 TQGuardedPtr<KoView> m_parentView;
500 class KoViewChildPrivate;
501 KoViewChildPrivate *d;
502};
503
504#endif
TDEAction * action(const char *name) const
KoChild is an abstract base class that represents the geometry associated with an embedded document.
Definition KoChild.h:42
Holds an embedded object.
The KOffice document class.
Definition KoDocument.h:61
Main window for a KOffice application.
This class represents an active embedded document.
Definition KoView.h:474
This class is used to display a KoDocument.
Definition KoView.h:58
void embeddImage(const TQString &filename)
Make it possible for plugins to request the embedding of an image into the current document.
virtual void updateReadWrite(bool readwrite)=0
You have to implement this method and disable/enable certain functionality (actions for example) in y...