blob: 50be072f2ee3582c2807857a89de6e0a289a6f26 (
plain)
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
|
/***************************************************************************
* Copyright (C) 2002 by Wilco Greven <greven@kde.org> *
* Copyright (C) 2003-2004 by Christophe Devriese *
* <Christophe.Devriese@student.kuleuven.ac.be> *
* Copyright (C) 2003 by Andy Goossens <andygoossens@telenet.be> *
* Copyright (C) 2003 by Laurent Montel <montel@kde.org> *
* Copyright (C) 2004 by Dominique Devriese <devriese@kde.org> *
* Copyright (C) 2004-2006 by Albert Astals Cid <tsdgeos@terra.es> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#ifndef _KPDF_PART_H_
#define _KPDF_PART_H_
#include <tdeparts/browserextension.h>
#include <tdeparts/part.h>
#include <tqguardedptr.h>
#include "core/document.h"
#include "core/observer.h"
#include "dcop.h"
class TQWidget;
class TQSplitter;
class TQToolBox;
class KURL;
class TDEAction;
class TDEConfig;
class KDirWatch;
class TDEToggleAction;
class TDESelectAction;
class TDEAboutData;
class KPrinter;
class ThumbnailList;
class ThumbnailController;
class PageView;
class PresentationWidget;
class SearchWidget;
class TOC;
class MiniBar;
namespace KPDF {
class BrowserExtension;
/**
* This is a "Part". It that does all the real work in a KPart
* application.
*
* @short Main Part
* @author Wilco Greven <greven@kde.org>
* @version 0.2
*/
class Part : public KParts::ReadOnlyPart, public DocumentObserver, virtual public kpdf_dcop
{
Q_OBJECT
public:
// Default constructor
Part(TQWidget* parentWidget, const char* widgetName,
TQObject* parent, const char* name, const TQStringList& args);
// Destructor
~Part();
// inherited from DocumentObserver
uint observerId() const { return PART_ID; }
void notifyViewportChanged( bool smoothMove );
static TDEAboutData* createAboutData();
ASYNC goToPage(uint page);
ASYNC openDocument(KURL doc);
uint pages();
uint currentPage();
KURL currentDocument();
signals:
void enablePrintAction(bool enable);
protected:
// reimplemented from KParts::ReadOnlyPart
bool openFile();
bool openURL(const KURL &url);
bool closeURL();
// filter that watches for splitter size changes
bool eventFilter( TQObject * watched, TQEvent * e );
protected slots:
void openURLFromDocument(const KURL &url);
// connected to actions
void slotGoToPage();
void slotPreviousPage();
void slotNextPage();
void slotGotoFirst();
void slotGotoLast();
void slotHistoryBack();
void slotHistoryNext();
void slotFind();
void slotFindNext();
void slotSaveFileAs();
void slotPreferences();
void slotNewConfig();
void slotPrintPreview();
void slotShowMenu(const KPDFPage *page, const TQPoint &point);
void slotShowProperties();
void slotShowLeftPanel();
void slotShowPresentation();
void slotHidePresentation();
void slotTogglePresentation();
void close();
// can be connected to widget elements
void updateViewActions();
void enableTOC(bool enable);
void psTransformEnded();
void cannotQuit();
void saveSplitterSize();
void setMimeTypes(TDEIO::Job *job);
void readMimeType(TDEIO::Job *job, const TQString &mime);
void emitWindowCaption();
public slots:
// connected to Shell action (and browserExtension), not local one
void slotPrint();
void restoreDocument(TDEConfig* config);
void saveDocumentRestoreInfo(TDEConfig* config);
void slotFileDirty( const TQString& );
void slotDoFileDirty();
private:
void doPrint( KPrinter& printer );
// the document
KPDFDocument * m_document;
TQString m_temporaryLocalFile;
// main widgets
TQSplitter *m_splitter;
TQWidget *m_leftPanel;
TQToolBox *m_toolBox;
SearchWidget *m_searchWidget;
TQGuardedPtr<ThumbnailList> m_thumbnailList;
TQGuardedPtr<PageView> m_pageView;
TQGuardedPtr<TOC> m_tocFrame;
TQGuardedPtr<MiniBar> m_miniBar;
TQGuardedPtr<PresentationWidget> m_presentationWidget;
// static instances counter
static unsigned int m_count;
// this is a hack because we can not use writeConfig on part destructor
// and we don't want to writeconfig every time someone moves the splitter
// so we use a TQTimer each 500 ms
TQTimer *m_saveSplitterSizeTimer;
KDirWatch *m_watcher;
TQTimer *m_dirtyHandler;
DocumentViewport m_viewportDirty;
bool m_wasPresentationOpen;
int m_dirtyToolboxIndex;
// Remember the search history
TQStringList m_searchHistory;
// mimetype got from the job
TQString m_jobMime;
// actions
TDEAction *m_gotoPage;
TDEAction *m_prevPage;
TDEAction *m_nextPage;
TDEAction *m_firstPage;
TDEAction *m_lastPage;
TDEAction *m_historyBack;
TDEAction *m_historyNext;
TDEAction *m_find;
TDEAction *m_findNext;
TDEAction *m_saveAs;
TDEAction *m_printPreview;
TDEAction *m_showProperties;
TDEAction *m_showPresentation;
TDEToggleAction* m_showMenuBarAction;
TDEToggleAction* m_showLeftPanel;
TDEToggleAction* m_showFullScreenAction;
bool m_actionsSearched;
bool m_searchStarted;
BrowserExtension *m_bExtension;
};
class BrowserExtension : public KParts::BrowserExtension
{
Q_OBJECT
public:
BrowserExtension(Part*);
public slots:
// Automatically detected by the host.
void print();
};
}
#endif
// vim:ts=2:sw=2:tw=78:et
|