Changeset View
Changeset View
Standalone View
Standalone View
src/part/simpleprintingengine.h
Show All 24 Lines | 19 | /* This file was part of the KDE project | |||
---|---|---|---|---|---|
25 | version 2 of the License, or (at your option) any later version. | 25 | version 2 of the License, or (at your option) any later version. | ||
26 | */ | 26 | */ | ||
27 | 27 | | |||
28 | #ifndef KGVSIMPLEPRINTINGENGINE_H | 28 | #ifndef KGVSIMPLEPRINTINGENGINE_H | ||
29 | #define KGVSIMPLEPRINTINGENGINE_H | 29 | #define KGVSIMPLEPRINTINGENGINE_H | ||
30 | 30 | | |||
31 | #include "KgvPageLayoutDia.h" | 31 | #include "KgvPageLayoutDia.h" | ||
32 | 32 | | |||
33 | #include <qfontmetrics.h> | | |||
34 | #include <qfont.h> | 33 | #include <qfont.h> | ||
34 | #include <qfontmetrics.h> | ||||
35 | //Added by qt3to4: | 35 | // Added by qt3to4: | ||
36 | #include <QPixmap> | 36 | #include <QPixmap> | ||
37 | 37 | | |||
38 | class QPaintDevice; | 38 | class QPaintDevice; | ||
39 | 39 | | |||
40 | #include "dotgraphview.h" | 40 | #include "dotgraphview.h" | ||
41 | 41 | | |||
42 | namespace KGraphViewer | 42 | namespace KGraphViewer | ||
43 | { | 43 | { | ||
44 | class KGVSimplePrintingSettings; | 44 | class KGVSimplePrintingSettings; | ||
45 | 45 | | |||
46 | /*! @short An engine painting data on pages using QPainter. | 46 | /*! @short An engine painting data on pages using QPainter. | ||
47 | The engine allows for random access to any page. */ | 47 | The engine allows for random access to any page. */ | ||
48 | class KGVSimplePrintingEngine : public QObject | 48 | class KGVSimplePrintingEngine : public QObject | ||
49 | { | 49 | { | ||
50 | Q_OBJECT | 50 | Q_OBJECT | ||
51 | 51 | | |||
52 | public: | 52 | public: | ||
53 | KGVSimplePrintingEngine( KGVSimplePrintingSettings* settings, QObject* parent ); | 53 | KGVSimplePrintingEngine(KGVSimplePrintingSettings *settings, QObject *parent); | ||
54 | ~KGVSimplePrintingEngine(); | 54 | ~KGVSimplePrintingEngine(); | ||
55 | 55 | | |||
56 | bool init(DotGraphView& data, | 56 | bool init(DotGraphView &data, const QString &titleText, QString &errorMessage); | ||
57 | const QString& titleText, QString& errorMessage); | | |||
58 | 57 | | |||
59 | void setTitleText(const QString& titleText); | 58 | void setTitleText(const QString &titleText); | ||
60 | 59 | | |||
61 | //! Calculates page count that can be later obtained using pagesCount(). | 60 | //! Calculates page count that can be later obtained using pagesCount(). | ||
62 | //! Page count can depend on \a painter (printer/screen) and on printing settings. | 61 | //! Page count can depend on \a painter (printer/screen) and on printing settings. | ||
63 | void calculatePagesCount(QPainter& painter); | 62 | void calculatePagesCount(QPainter &painter); | ||
64 | 63 | | |||
65 | bool done(); | 64 | bool done(); | ||
66 | void clear(); | 65 | void clear(); | ||
67 | KGVSimplePrintingSettings* settings() { return m_settings; } | 66 | KGVSimplePrintingSettings *settings() | ||
67 | { | ||||
68 | return m_settings; | ||||
69 | } | ||||
68 | 70 | | |||
69 | //! \return true when all records has been painted | 71 | //! \return true when all records has been painted | ||
70 | bool eof() const { return m_eof; } | 72 | bool eof() const | ||
73 | { | ||||
74 | return m_eof; | ||||
75 | } | ||||
71 | 76 | | |||
72 | //! \return number of pages. Can be used after calculatePagesCount(). | 77 | //! \return number of pages. Can be used after calculatePagesCount(). | ||
73 | uint pagesCount() { return m_pagesCount; } | 78 | uint pagesCount() | ||
79 | { | ||||
80 | return m_pagesCount; | ||||
81 | } | ||||
74 | 82 | | |||
75 | uint maxHorizFit() const; | 83 | uint maxHorizFit() const; | ||
76 | uint maxVertFit() const; | 84 | uint maxVertFit() const; | ||
77 | 85 | | |||
78 | inline DotGraphView* data() {return m_data;} | 86 | inline DotGraphView *data() | ||
79 | 87 | { | |||
88 | return m_data; | ||||
89 | } | ||||
80 | 90 | | |||
81 | public Q_SLOTS: | 91 | public Q_SLOTS: | ||
82 | /*! Paints a page number \a pageNumber (counted from 0) on \a painter. | 92 | /*! Paints a page number \a pageNumber (counted from 0) on \a painter. | ||
83 | If \a paint is false, drawings are only computed but not painted, | 93 | If \a paint is false, drawings are only computed but not painted, | ||
84 | so this can be used for calculating page number before printing or previewing. */ | 94 | so this can be used for calculating page number before printing or previewing. */ | ||
85 | void paintPage(int pageNumber, QPainter& painter, bool paint = true); | 95 | void paintPage(int pageNumber, QPainter &painter, bool paint = true); | ||
86 | 96 | | |||
87 | protected: | 97 | protected: | ||
88 | KGVSimplePrintingSettings* m_settings; | 98 | KGVSimplePrintingSettings *m_settings; | ||
89 | 99 | | |||
90 | QFont m_mainFont; | 100 | QFont m_mainFont; | ||
91 | int m_dpiX, m_dpiY; | 101 | int m_dpiX, m_dpiY; | ||
92 | uint m_pageWidth, m_pageHeight; | 102 | uint m_pageWidth, m_pageHeight; | ||
93 | //QFontMetrics m_headerFM, m_mainFM; | 103 | // QFontMetrics m_headerFM, m_mainFM; | ||
94 | DotGraphView* m_data; | 104 | DotGraphView *m_data; | ||
95 | QString m_headerText; | 105 | QString m_headerText; | ||
96 | QString m_dateTimeText; | 106 | QString m_dateTimeText; | ||
97 | uint m_dateTimeWidth; | 107 | uint m_dateTimeWidth; | ||
98 | QRect m_headerTextRect; | 108 | QRect m_headerTextRect; | ||
99 | int m_mainLineSpacing; | 109 | int m_mainLineSpacing; | ||
100 | uint m_pagesCount; | 110 | uint m_pagesCount; | ||
101 | bool m_eof; | 111 | bool m_eof; | ||
102 | bool m_paintInitialized; //!< used by paintPage() | 112 | bool m_paintInitialized; //!< used by paintPage() | ||
Show All 12 Lines |