~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to karbon/widgets/vcanvas.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2001, 2002, 2003 The Karbon Developers
 
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., 59 Temple Place - Suite 330,
 
17
   Boston, MA 02111-1307, USA.
 
18
*/
 
19
 
 
20
#ifndef __VCANVAS_H__
 
21
#define __VCANVAS_H__
 
22
 
 
23
 
 
24
#include <qscrollview.h>
 
25
 
 
26
class KarbonPartBase;
 
27
class KarbonViewBase;
 
28
class KoRect;
 
29
class KoPoint;
 
30
class VPainter;
 
31
 
 
32
// The canvas is a QScrollView.
 
33
 
 
34
class VCanvas : public QScrollView
 
35
{
 
36
        Q_OBJECT
 
37
public:
 
38
        VCanvas( QWidget *parent, KarbonViewBase* view, KarbonPartBase* part );
 
39
        virtual ~VCanvas();
 
40
 
 
41
        void repaintAll( const KoRect & );
 
42
        void repaintAll( bool drawVObjects = true );
 
43
 
 
44
        QPixmap *pixmap() { return m_pixmap; }
 
45
 
 
46
        /**
 
47
         * Sets mouse position to point p.
 
48
         */
 
49
        void setPos( const KoPoint& p );
 
50
 
 
51
        KoPoint toViewport( const KoPoint & ) const;
 
52
        KoPoint toContents( const KoPoint & ) const;
 
53
        KoRect boundingBox() const;
 
54
 
 
55
        /**
 
56
         * Adjusts the viewport top-left position. This doesn't change the zoom level.
 
57
         * Note that centerX and centerY is a value between 0.0 and 1.0, indicating a
 
58
         * percentage of the total width/height. Thus centerX/centerY indicates the
 
59
         * center of the viewport.
 
60
         */
 
61
        void setViewport( double centerX, double centerY );
 
62
 
 
63
        /**
 
64
         * Sets the canvas viewport rectangle to rect. The zoom level is adjusted for this, if
 
65
         * needed.
 
66
         */
 
67
        void setViewportRect( const KoRect &rect );
 
68
 
 
69
        int pageOffsetX() const;
 
70
        int pageOffsetY() const;
 
71
 
 
72
protected:
 
73
        virtual void dragEnterEvent( QDragEnterEvent * );
 
74
        virtual void dropEvent( QDropEvent * );
 
75
        virtual void focusInEvent( QFocusEvent * );
 
76
        virtual void viewportPaintEvent( QPaintEvent* );
 
77
        virtual void drawContents( QPainter* painter, int clipx, int clipy,
 
78
                int clipw, int cliph  );
 
79
        void drawDocument( QPainter* painter, const KoRect& rect, bool drawVObjects = true );
 
80
 
 
81
        virtual void resizeEvent( QResizeEvent* event );
 
82
 
 
83
        virtual bool eventFilter( QObject* object, QEvent* event );
 
84
 
 
85
        void setYMirroring( VPainter * );
 
86
 
 
87
private slots:
 
88
        void slotContentsMoving( int , int );
 
89
 
 
90
signals:
 
91
        void viewportChanged();
 
92
 
 
93
private:
 
94
        QPixmap *m_pixmap;
 
95
        KarbonPartBase* m_part;
 
96
        KarbonViewBase* m_view;
 
97
 
 
98
        bool m_bScrolling;
 
99
        int     m_scrollX;
 
100
        int     m_scrollY;
 
101
};
 
102
 
 
103
#endif