1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
#ifndef KVIEWPART_H
#define KVIEWPART_H
#include "kviewpart_iface.h"
#include "pageSize.h"
#include "zoom.h"
#include <tdeparts/browserextension.h>
#include <tqtimer.h>
class TDEAboutData;
class TDEAboutDialog;
class TDEAccel;
class TDEAction;
class TDEConfig;
class KDirWatch;
class TDEInstance;
class KMultiPage;
class TDERadioAction;
class TDESelectAction;
class KTempFile;
class TDEToggleAction;
class KURL;
class KViewPartExtension;
class TQHBoxLayout;
class pageSizeDialog;
class TQSize;
class KViewPart : public KViewPart_Iface
{
Q_OBJECT
public:
KViewPart(TQWidget *parentWidget, const char *widgetName, TQObject *parent,
const char *name, const TQStringList& args);
virtual ~KViewPart();
static TDEAboutData* createAboutData();
bool isValid() { return multiPage; }
/* This method calls closeURL(), but asks first ("The document was
modified. Do you really want to close?") if the document has been
modified after it has been loaded. */
virtual bool closeURL_ask();
/* Returns a description of the current page size, for use in the
statusbar of the kviewshell that embeds this KViewPart. */
TQString pageSizeDescription();
/** Returns a list of mimetypes supported by the installed KViewShell plugins. */
virtual TQStringList supportedMimeTypes();
signals:
void zoomChanged(const TQString &);
void pageChanged(const TQString &);
void sizeChanged(const TQString &);
void scrollbarStatusChanged(bool);
void fileOpened();
void pluginChanged(KParts::Part*);
public slots:
void slotSetFullPage(bool fullpage);
virtual void slotFileOpen();
virtual bool closeURL();
virtual TQStringList fileFormats() const;
void setStatusBarTextFromMultiPage(const TQString &);
/** Calling this slot will cause the tdemultipage to reload the file */
void reload();
void restoreDocument(const KURL &url, int page);
void saveDocumentRestoreInfo(TDEConfig* config);
protected slots:
void slotShowSidebar();
void slotMedia (int);
void goToPage();
void zoomIn();
void zoomOut();
void disableZoomFit();
void updateZoomLevel();
void enableFitToPage(bool);
void enableFitToHeight(bool);
void enableFitToWidth(bool);
void fitToPage();
void fitToHeight();
void fitToWidth();
void slotPrint();
void fileChanged(const TQString&);
// Connected to the TQLineEdit in the toolbar.
void setZoomValue(const TQString &);
protected:
TDEToggleAction *showSidebar, *scrollbarHandling;
TDESelectAction *orientation, *media, *zoom_action;
virtual bool openFile();
void connectNotify ( const char * );
void partActivateEvent( KParts::PartActivateEvent *ev );
void guiActivateEvent( KParts::GUIActivateEvent *ev );
private slots:
void pageInfo(int numpages, int currentpage);
void checkActions();
void slotStartFitTimer();
void doSettings();
void preferencesChanged();
void aboutKViewShell();
void slotEnableMoveTool(bool enable);
// Relay signals to the multipage. We cannot connect to the
// slots of the multipage directly because than we would have
// to recreate the whole interface whenever a new multipage is loaded.
void mp_prevPage();
void mp_nextPage();
void mp_firstPage();
void mp_lastPage();
void mp_readUp();
void mp_readDown();
void mp_scrollUp();
void mp_scrollDown();
void mp_scrollLeft();
void mp_scrollRight();
void mp_scrollUpPage();
void mp_scrollDownPage();
void mp_scrollLeftPage();
void mp_scrollRightPage();
void mp_slotSave();
void mp_slotSave_defaultFilename();
void mp_doGoBack();
void mp_doGoForward();
void mp_showFindTextDialog();
void mp_findNextText();
void mp_findPrevText();
void mp_doSelectAll();
void mp_clearSelection();
void mp_copyText();
void mp_exportText();
private:
void initializeMultiPage();
// This method reads the configuration file. It should only be
// called when no document is loaded.
void readSettings();
void writeSettings();
// The method openFile of this kviewpart can be called even if
// m_file points to a compressed file. In that case, the temporary
// file tmpUnzipped will be created and a decompressed copy of the
// file stored there.
KTempFile *tmpUnzipped;
KDirWatch *watch;
TDEAccel *accel;
TDEAction *zoomInAct, *zoomOutAct, *backAct, *forwardAct,
*startAct, *endAct, *gotoAct,
*saveAction, *saveAsAction, *printAction, *readUpAct, *readDownAct;
TDEAction *backAction;
TDEAction *forwardAction;
TDEAction *settingsAction;
TDEAction* aboutAction;
TDEToggleAction *watchAct,*useDocumentSpecifiedSize,
*fitPageAct, *fitHeightAct, *fitWidthAct;
TDESelectAction* viewModeAction;
TDERadioAction* moveModeAction;
TDERadioAction* selectionModeAction;
TDEAction* exportTextAction;
TDEAction* copyTextAction;
TDEAction* selectAllAction;
TDEAction* deselectAction;
TDEAction* findTextAction;
TDEAction* findNextTextAction;
TDEAction* findPrevAction;
TDEAction* findNextAction;
KParts::PartManager* partManager;
TQGuardedPtr<KMultiPage> multiPage;
// Name of the library of the currently loaded multiPage.
// Is used to check if it is really necessary to load a new MultiPage.
TQString multiPageLibrary;
KViewPartExtension *m_extension;
bool pageChangeIsConnected;
TQWidget *mainWidget;
TQHBoxLayout* mainLayout;
/** This entry stores the paper size that the user has requested in
the preferences dialog. If that paper size is actually used or
not, depends on if the document specifies a paper size of its
own and if the user has chosen the option "use document
specified paper size if available" */
pageSize userRequestedPaperSize;
/** stores the current zoom value */
Zoom _zoomVal;
pageSizeDialog *_pageSizeDialog;
TQTimer fitTimer;
TDEAboutDialog* aboutDialog;
};
class KViewPartExtension : public KParts::BrowserExtension
{
Q_OBJECT
friend class KViewPart;
public:
KViewPartExtension(KViewPart *parent);
virtual ~KViewPartExtension() {}
};
#endif
|