kviewshell
kviewpart.h
Go to the documentation of this file.00001
00002 #ifndef KVIEWPART_H
00003 #define KVIEWPART_H
00004
00005 #include "kviewpart_iface.h"
00006 #include "pageSize.h"
00007 #include "zoom.h"
00008
00009 #include <kparts/browserextension.h>
00010 #include <qtimer.h>
00011
00012 class KAboutData;
00013 class KAboutDialog;
00014 class KAccel;
00015 class KAction;
00016 class KConfig;
00017 class KDirWatch;
00018 class KInstance;
00019 class KMultiPage;
00020 class KRadioAction;
00021 class KSelectAction;
00022 class KTempFile;
00023 class KToggleAction;
00024 class KURL;
00025 class KViewPartExtension;
00026 class QHBoxLayout;
00027 class pageSizeDialog;
00028 class QSize;
00029
00030
00031 class KViewPart : public KViewPart_Iface
00032 {
00033 Q_OBJECT
00034
00035 public:
00036 KViewPart(QWidget *parentWidget, const char *widgetName, QObject *parent,
00037 const char *name, const QStringList& args);
00038 virtual ~KViewPart();
00039
00040 static KAboutData* createAboutData();
00041
00042 bool isValid() { return multiPage; }
00043
00044
00045
00046
00047 virtual bool closeURL_ask();
00048
00049
00050
00051 QString pageSizeDescription();
00052
00054 virtual QStringList supportedMimeTypes();
00055
00056 signals:
00057 void zoomChanged(const QString &);
00058 void pageChanged(const QString &);
00059 void sizeChanged(const QString &);
00060 void scrollbarStatusChanged(bool);
00061 void fileOpened();
00062
00063 void pluginChanged(KParts::Part*);
00064
00065 public slots:
00066 void slotSetFullPage(bool fullpage);
00067
00068 virtual void slotFileOpen();
00069 virtual bool closeURL();
00070 virtual QStringList fileFormats() const;
00071 void setStatusBarTextFromMultiPage(const QString &);
00072
00074 void reload();
00075
00076 void restoreDocument(const KURL &url, int page);
00077 void saveDocumentRestoreInfo(KConfig* config);
00078
00079 protected slots:
00080 void slotShowSidebar();
00081 void slotMedia (int);
00082
00083 void goToPage();
00084
00085 void zoomIn();
00086 void zoomOut();
00087
00088 void disableZoomFit();
00089 void updateZoomLevel();
00090
00091 void enableFitToPage(bool);
00092 void enableFitToHeight(bool);
00093 void enableFitToWidth(bool);
00094
00095 void fitToPage();
00096 void fitToHeight();
00097 void fitToWidth();
00098
00099 void slotPrint();
00100
00101 void fileChanged(const QString&);
00102
00103
00104 void setZoomValue(const QString &);
00105
00106
00107 protected:
00108 KToggleAction *showSidebar, *scrollbarHandling;
00109 KSelectAction *orientation, *media, *zoom_action;
00110
00111 virtual bool openFile();
00112
00113 void connectNotify ( const char * );
00114
00115 void partActivateEvent( KParts::PartActivateEvent *ev );
00116 void guiActivateEvent( KParts::GUIActivateEvent *ev );
00117
00118 private slots:
00119 void pageInfo(int numpages, int currentpage);
00120 void checkActions();
00121
00122 void slotStartFitTimer();
00123
00124 void doSettings();
00125 void preferencesChanged();
00126
00127 void aboutKViewShell();
00128
00129 void slotEnableMoveTool(bool enable);
00130
00131
00132
00133
00134 void mp_prevPage();
00135 void mp_nextPage();
00136 void mp_firstPage();
00137 void mp_lastPage();
00138
00139 void mp_readUp();
00140 void mp_readDown();
00141
00142 void mp_scrollUp();
00143 void mp_scrollDown();
00144 void mp_scrollLeft();
00145 void mp_scrollRight();
00146 void mp_scrollUpPage();
00147 void mp_scrollDownPage();
00148 void mp_scrollLeftPage();
00149 void mp_scrollRightPage();
00150
00151 void mp_slotSave();
00152 void mp_slotSave_defaultFilename();
00153
00154 void mp_doGoBack();
00155 void mp_doGoForward();
00156
00157 void mp_showFindTextDialog();
00158 void mp_findNextText();
00159 void mp_findPrevText();
00160
00161 void mp_doSelectAll();
00162 void mp_clearSelection();
00163
00164 void mp_copyText();
00165
00166 void mp_exportText();
00167
00168 private:
00169 void initializeMultiPage();
00170
00171
00172
00173 void readSettings();
00174 void writeSettings();
00175
00176
00177
00178
00179
00180 KTempFile *tmpUnzipped;
00181
00182 KDirWatch *watch;
00183 KAccel *accel;
00184 KAction *zoomInAct, *zoomOutAct, *backAct, *forwardAct,
00185 *startAct, *endAct, *gotoAct,
00186 *saveAction, *saveAsAction, *printAction, *readUpAct, *readDownAct;
00187 KAction *backAction;
00188 KAction *forwardAction;
00189 KAction *settingsAction;
00190 KAction* aboutAction;
00191 KToggleAction *watchAct,*useDocumentSpecifiedSize,
00192 *fitPageAct, *fitHeightAct, *fitWidthAct;
00193 KSelectAction* viewModeAction;
00194
00195 KRadioAction* moveModeAction;
00196 KRadioAction* selectionModeAction;
00197
00198 KAction* exportTextAction;
00199
00200 KAction* copyTextAction;
00201 KAction* selectAllAction;
00202 KAction* deselectAction;
00203 KAction* findTextAction;
00204 KAction* findNextTextAction;
00205 KAction* findPrevAction;
00206 KAction* findNextAction;
00207
00208 KParts::PartManager* partManager;
00209
00210 QGuardedPtr<KMultiPage> multiPage;
00211
00212
00213 QString multiPageLibrary;
00214
00215 KViewPartExtension *m_extension;
00216
00217 bool pageChangeIsConnected;
00218
00219 QWidget *mainWidget;
00220 QHBoxLayout* mainLayout;
00221
00227 pageSize userRequestedPaperSize;
00228
00230 Zoom _zoomVal;
00231 pageSizeDialog *_pageSizeDialog;
00232
00233 QTimer fitTimer;
00234
00235 KAboutDialog* aboutDialog;
00236 };
00237
00238
00239 class KViewPartExtension : public KParts::BrowserExtension
00240 {
00241 Q_OBJECT
00242 friend class KViewPart;
00243
00244 public:
00245
00246 KViewPartExtension(KViewPart *parent);
00247 virtual ~KViewPartExtension() {}
00248
00249 };
00250
00251
00252 #endif