2000-05-15 04:53:53 +00:00
|
|
|
#ifndef __KDVIMULTIPAGE_H
|
|
|
|
#define __KDVIMULTIPAGE_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <qstringlist.h>
|
|
|
|
#include <kparts/part.h>
|
|
|
|
#include <kparts/browserextension.h>
|
2000-06-27 09:14:42 +00:00
|
|
|
#include <kparts/factory.h>
|
2000-05-15 04:53:53 +00:00
|
|
|
|
2004-04-14 07:45:04 +00:00
|
|
|
class documentWidget;
|
2001-06-04 09:44:47 +00:00
|
|
|
class KPrinter;
|
2000-05-15 04:53:53 +00:00
|
|
|
class QLabel;
|
2000-05-16 14:13:41 +00:00
|
|
|
class QPainter;
|
2000-05-15 04:53:53 +00:00
|
|
|
|
|
|
|
|
2001-07-06 10:14:01 +00:00
|
|
|
#include "../kviewshell/kmultipage.h"
|
2000-05-15 04:53:53 +00:00
|
|
|
#include "dviwin.h"
|
|
|
|
|
|
|
|
|
2000-06-27 09:14:42 +00:00
|
|
|
class KDVIMultiPageFactory : public KParts::Factory
|
2000-05-15 04:53:53 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
KDVIMultiPageFactory();
|
|
|
|
virtual ~KDVIMultiPageFactory();
|
2000-06-27 09:14:42 +00:00
|
|
|
|
2001-09-12 17:35:46 +00:00
|
|
|
virtual KParts::Part *createPartObject( QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name, const char *, const QStringList & );
|
2000-06-27 09:14:42 +00:00
|
|
|
|
2000-05-15 04:53:53 +00:00
|
|
|
static KInstance *instance();
|
2000-06-27 09:14:42 +00:00
|
|
|
|
2000-05-15 04:53:53 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
static KInstance *s_instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class KDVIMultiPage : public KMultiPage
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2000-06-27 09:14:42 +00:00
|
|
|
KDVIMultiPage(QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name);
|
2000-05-15 04:53:53 +00:00
|
|
|
virtual ~KDVIMultiPage();
|
2001-11-20 12:46:54 +00:00
|
|
|
// Methods which are associated with the DCOP functionality of the
|
|
|
|
// kmultipage. This method can be implemented by the multipage,
|
|
|
|
// e.g. to jump to a certain location.
|
|
|
|
void jumpToReference(QString reference);
|
2000-05-15 04:53:53 +00:00
|
|
|
|
|
|
|
// Interface definition start ------------------------------------------------
|
|
|
|
|
|
|
|
/// returns the list of supported file formats
|
|
|
|
virtual QStringList fileFormats();
|
|
|
|
|
|
|
|
/// opens a file
|
2000-06-27 09:14:42 +00:00
|
|
|
virtual bool openFile();
|
2000-05-15 04:53:53 +00:00
|
|
|
|
2000-05-17 08:50:57 +00:00
|
|
|
/// close a file
|
|
|
|
virtual bool closeURL();
|
|
|
|
|
2000-05-15 04:53:53 +00:00
|
|
|
/// sets a zoom factor
|
2000-06-27 09:14:42 +00:00
|
|
|
virtual double setZoom(double z);
|
2000-05-15 04:53:53 +00:00
|
|
|
|
|
|
|
/// calculates the zoom needed to fit into a given width
|
2000-06-27 09:14:42 +00:00
|
|
|
virtual double zoomForWidth(int width);
|
|
|
|
|
2000-05-15 04:53:53 +00:00
|
|
|
/// calculates the zoom needed to fit into a given height
|
2000-06-27 09:14:42 +00:00
|
|
|
virtual double zoomForHeight(int height);
|
2000-05-15 04:53:53 +00:00
|
|
|
|
2000-05-16 14:13:41 +00:00
|
|
|
virtual void setPaperSize(double, double);
|
|
|
|
|
2000-08-06 10:25:11 +00:00
|
|
|
virtual bool print(const QStringList &pages, int current);
|
2000-06-27 09:14:42 +00:00
|
|
|
|
2003-10-01 08:08:38 +00:00
|
|
|
/// KDVI offers read- and write functionality must re-implement this
|
|
|
|
/// method and return true here.
|
|
|
|
virtual bool isReadWrite() {return true;};
|
|
|
|
|
|
|
|
/// multipage implementations that offer read- and write
|
|
|
|
/// functionality should re-implement this method.
|
|
|
|
virtual bool isModified();
|
2004-10-25 18:07:53 +00:00
|
|
|
|
|
|
|
virtual void addConfigDialogs(KConfigDialog* configDialog);
|
2003-10-01 08:08:38 +00:00
|
|
|
|
2004-10-23 12:00:07 +00:00
|
|
|
private:
|
|
|
|
virtual DocumentWidget* createDocumentWidget();
|
|
|
|
|
2003-09-05 08:57:37 +00:00
|
|
|
public slots:
|
2003-10-01 08:08:38 +00:00
|
|
|
/** Opens a file requestor and saves. This really saves the content
|
|
|
|
of the DVI-file, and does not just start a copy job */
|
2003-09-05 08:57:37 +00:00
|
|
|
virtual void slotSave();
|
2003-10-01 08:08:38 +00:00
|
|
|
|
|
|
|
/** Similar to slotSave, but does not ask for a filename. */
|
|
|
|
virtual void slotSave_defaultFilename();
|
|
|
|
|
|
|
|
void setEmbedPostScriptAction(void);
|
|
|
|
|
|
|
|
void slotEmbedPostScript(void);
|
2003-09-05 08:57:37 +00:00
|
|
|
|
2004-05-02 14:40:29 +00:00
|
|
|
/** Shows the "text search" dialog, if text search is supported by
|
|
|
|
the renderer. Otherwise, the method returns immediately. */
|
|
|
|
void showFindTextDialog(void);
|
|
|
|
|
|
|
|
/** Starts the text search functionality. The text to search, and the
|
|
|
|
direction in which to search is read off the 'findDialog'
|
|
|
|
member, which must not be NULL. */
|
|
|
|
void findText(void);
|
|
|
|
|
|
|
|
/** This method may be called after the text search dialog
|
|
|
|
'findDialog' has been set up, and the user has entered a search
|
|
|
|
phrase. The method searches for the next occurence of the text,
|
|
|
|
starting from the beginning of the current page, or after the
|
|
|
|
currently selected text, if there is any. */
|
|
|
|
void findNextText(void);
|
|
|
|
|
|
|
|
/** This method may be called after the text search dialog
|
|
|
|
'findDialog' has been set up, and the user has entered a search
|
|
|
|
phrase. The method searches for the next occurence of the text,
|
|
|
|
starting from the end of the current page, or before the
|
|
|
|
currently selected text, if there is any. */
|
|
|
|
void findPrevText(void);
|
|
|
|
|
2000-06-30 06:41:47 +00:00
|
|
|
protected:
|
|
|
|
/// For internal use only. See the comments in kdvi_multipage.cpp, right
|
|
|
|
//before the timerEvent function.
|
|
|
|
int timer_id;
|
|
|
|
/// For internal use only. See the comments in kdvi_multipage.cpp, right
|
|
|
|
//before the timerEvent function.
|
|
|
|
void timerEvent( QTimerEvent *e );
|
|
|
|
|
2002-12-07 11:39:54 +00:00
|
|
|
// Set initial window caption
|
|
|
|
void guiActivateEvent( KParts::GUIActivateEvent * event );
|
2000-05-18 10:51:08 +00:00
|
|
|
|
2002-12-07 11:39:54 +00:00
|
|
|
virtual void reload();
|
2000-06-30 06:41:47 +00:00
|
|
|
|
2000-05-17 10:09:01 +00:00
|
|
|
protected slots:
|
2001-05-03 08:45:04 +00:00
|
|
|
void doExportPS();
|
|
|
|
void doExportPDF();
|
2001-10-27 11:38:16 +00:00
|
|
|
void doExportText();
|
2001-11-23 15:26:13 +00:00
|
|
|
void doSelectAll();
|
2001-11-26 12:32:34 +00:00
|
|
|
void doEnableWarnings();
|
2000-06-30 06:41:47 +00:00
|
|
|
void about();
|
|
|
|
void helpme();
|
2000-07-05 10:44:59 +00:00
|
|
|
void bugform();
|
2000-05-17 10:09:01 +00:00
|
|
|
void preferencesChanged();
|
2004-10-23 12:00:07 +00:00
|
|
|
|
2004-06-12 17:20:17 +00:00
|
|
|
void contentsMovingInScrollView(int x, int y);
|
|
|
|
|
2004-05-02 14:40:29 +00:00
|
|
|
/** Makes page # pageNr visible, selects the text Elements
|
|
|
|
beginSelection-endSelection, and draws the users attention to
|
|
|
|
this place with an animated frame */
|
|
|
|
void gotoPage(int pageNr, int beginSelection, int endSelection );
|
2002-01-03 12:33:14 +00:00
|
|
|
void showTip(void);
|
|
|
|
void showTipOnStart(void);
|
2000-06-30 06:41:47 +00:00
|
|
|
|
2000-05-15 04:53:53 +00:00
|
|
|
private:
|
2004-10-23 12:00:07 +00:00
|
|
|
// Points to the same object as renderer to avoid downcasting.
|
|
|
|
// FIXME: Remove when the API of the Renderer-class is finished.
|
2004-08-22 17:39:15 +00:00
|
|
|
dviWindow *window;
|
|
|
|
KPrinter *printer;
|
2000-05-15 04:53:53 +00:00
|
|
|
|
2004-05-02 14:40:29 +00:00
|
|
|
/*************************************************************
|
|
|
|
* Methods and classes concerned with the find functionality *
|
|
|
|
*************************************************************/
|
|
|
|
|
|
|
|
/** Pointer to the text search dialog. This dialog is generally set
|
|
|
|
up when the method 'showFindTextDialog(void)' is first
|
|
|
|
called. */
|
|
|
|
class KEdFind *findDialog;
|
|
|
|
|
|
|
|
|
2001-05-03 08:45:04 +00:00
|
|
|
/** Pointers to several actions which are disabled if no file is
|
|
|
|
loaded. */
|
|
|
|
KAction *docInfoAction;
|
2003-09-05 08:57:37 +00:00
|
|
|
KAction *embedPSAction;
|
2001-11-23 15:26:13 +00:00
|
|
|
KAction *copyTextAction;
|
|
|
|
KAction *selectAllAction;
|
2004-11-04 07:32:03 +00:00
|
|
|
KAction *deselectAction;
|
2001-10-27 11:38:16 +00:00
|
|
|
KAction *findTextAction;
|
2001-11-26 12:32:34 +00:00
|
|
|
KAction *findNextTextAction;
|
2004-05-02 14:40:29 +00:00
|
|
|
KAction *findPrevAction;
|
2001-05-03 08:45:04 +00:00
|
|
|
KAction *exportPDFAction;
|
2001-10-27 11:38:16 +00:00
|
|
|
KAction *exportTextAction;
|
2004-05-02 14:40:29 +00:00
|
|
|
KAction *findNextAction;
|
|
|
|
KAction *exportPSAction;
|
2001-05-03 08:45:04 +00:00
|
|
|
|
|
|
|
/** Used to enable the export menu when a file is successfully
|
|
|
|
loaded. */
|
|
|
|
void enableActions(bool);
|
2000-05-15 04:53:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|