KMultiPage Class Reference

#include <kmultipage.h>

Inheritance diagram for KMultiPage:

kmultipageInterface DjVuMultiPage EmptyMultiPage List of all members.

Detailed Description

This class provides plugin-specific GUI elements for kviewshell plugins.

Author:
Wilfried Huss, Stefan Kebekus

Definition at line 37 of file kmultipage.h.


Public Slots

virtual void setUserPreferredSize (const SimplePageSize &t)
virtual void setUseDocumentSpecifiedSize (bool b)
virtual void doSelectAll ()
virtual void clearSelection ()
virtual void copyText ()
virtual void doExportText ()
virtual void showFindTextDialog ()
virtual void findNextText ()
virtual void findPrevText ()
virtual void slotSave ()
virtual void slotSave_defaultFilename ()
void renderModeChanged ()
void repaintAllVisibleWidgets ()
virtual void slotShowScrollbars (bool)
virtual void slotShowSidebar (bool)
virtual void slotShowThumbnails (bool)
void slotIOJobFinished (KIO::Job *job)
virtual void slotSetFullPage (bool fullpage)
virtual void setViewMode (int)
virtual void preferencesChanged ()
virtual bool gotoPage (const PageNumber &page)
virtual void gotoPage (const Anchor &a)
virtual void prevPage ()
virtual void nextPage ()
virtual void firstPage ()
virtual void lastPage ()
virtual void scrollUp ()
virtual void scrollDown ()
virtual void scrollLeft ()
virtual void scrollRight ()
virtual void scrollUpPage ()
virtual void scrollDownPage ()
virtual void scrollLeftPage ()
virtual void scrollRightPage ()
virtual void readUp ()
virtual void readDown ()
virtual void doGoBack ()
virtual void doGoForward ()
virtual void scroll (Q_INT32 deltaInPixel)
virtual void slotEnableMoveTool (bool enable)
virtual void generateDocumentWidgets (const PageNumber &startPage=PageNumber::invalidPage)

Signals

void enableMoveTool (bool enable)
void selected (const PageNumber &pageNumber)
void pageInfo (int nr, int currpg)
void askingToCheckActions ()
void previewChanged (bool previewAvailable)
void viewModeChanged ()
void zoomChanged ()
void zoomOut ()
void zoomIn ()
void textSelected (bool)
void searchEnabled (bool)

Public Member Functions

 KMultiPage (QWidget *parentWidget, const char *widgetName, QObject *parent, const char *name)
virtual ~KMultiPage ()
virtual QWidgetmainWidget ()
QString name_of_current_file ()
virtual ASYNC jumpToReference (const QString &)
bool is_file_loaded (const QString &filename)
virtual bool openURL (const QString &filename, const KURL &base_url)
virtual void print ()
virtual bool hasSpecifiedPageSizes () const
virtual void reload ()
virtual QStringList fileFormats () const =0
virtual bool closeURL ()
virtual double setZoom (double z)
virtual void readSettings ()
virtual void writeSettings ()
virtual bool supportsTextSearch () const
virtual bool isModified () const
virtual PageNumber currentPageNumber ()
PageNumber numberOfPages () const
virtual QValueList< int > selectedPages ()
virtual Historyhistory ()
virtual void addConfigDialogs (KConfigDialog *configDialog)
virtual double calculateFitToWidthZoomValue ()
virtual double calculateFitToHeightZoomValue ()
virtual Q_UINT8 getNrColumns () const
virtual Q_UINT8 getNrRows () const
virtual bool overviewMode () const
virtual SimplePageSize sizeOfPage (const PageNumber &page=1) const

Protected Slots

virtual bool gotoPage (const PageNumber &page, int y, bool isLink=true)
void gotoPage (const TextSelection &)
void wheelEvent (QWheelEvent *)

Protected Member Functions

virtual void setFile (bool success)
virtual DocumentWidgetcreateDocumentWidget ()
virtual void enableActions (bool)
void setRenderer (DocumentRenderer *)
virtual void initializePageCache ()
virtual QGuardedPtr< DocumentRenderergetRenderer () const
PageViewscrollView ()
MarkListmarkList ()
PageNumber widestPage () const
double zoomForWidthColumns (unsigned int viewportWidth) const
KPrinter * getPrinter (bool enablePageSizeFeatures=true)

Protected Attributes

QGuardedPtr< QWidgetparentWdg
QPtrVector< DocumentWidgetwidgetList
History document_history
PageNumber lastCurrentPage
DocumentPageCachepageCache

Member Function Documentation

virtual void KMultiPage::addConfigDialogs ( KConfigDialog *  configDialog  )  [inline, virtual]

Add pages to the KViewshell's central preferences dialog.

This method can be re-implemented to add documenttype specific configuration pages to the central preferences dialog. The documentation to KConfigDialog explains how to do that.

The default implementation does nothing.

Parameters:
configDialog a pointer to the KConfigDialog the dialog to add pages to

Definition at line 280 of file kmultipage.h.

bool KMultiPage::closeURL (  )  [virtual]

closes a file

Definition at line 188 of file kmultipage.cpp.

void KMultiPage::doExportText (  )  [virtual, slot]

Exports the document to a plain text file.

Definition at line 1900 of file kmultipage.cpp.

void KMultiPage::enableMoveTool ( bool  enable  )  [signal]

Emitted with argument "true" when the move tool is selected, and with argument "false" if selection tool is selected.

virtual QStringList KMultiPage::fileFormats (  )  const [pure virtual]

list of supported file formats, for saving

This member must return the list of supported file formats for saving. These strings returned must be in the format explained in the documentation to KFileDialog::setFilter(), e.g. ""*.cpp *.cxx .c++|C++ Source Files". The use of mimetype-filters is allowed, but discouraged. Among other penalties, if a multipage gives a mimetype-filter, e.g. "application/x-dvi", the open file dialog in kviewshell will not allow the user to see and select compressed dvi-files.

Implemented in EmptyMultiPage, and DjVuMultiPage.

KPrinter * KMultiPage::getPrinter ( bool  enablePageSizeFeatures = true  )  [protected]

Allocates and initializes a KPrinter structure.

This method is used in implementations of the print() method. See the documentation of print() for more information and for example code. This method allocates and initializes a KPrinter structure. The list of pages marked in the sidebar is already set in the "kde-range" option in the KPrinter structure. In this option "1" means: first page of the document, "2" the second, etc.

Parameters:
enablePageSizeFeatures Enables or diables the entries in the "Page Size & Placement" tab of the print dialog.
Returns:
a pointer to a KPrinter, or 0 if no KPrinter could be allocated.
Warning:
The KPrinter allocated is owned by the caller must be deleted before the KMultiPage is deleted. Otherwise, a segfault will occur.

Definition at line 1830 of file kmultipage.cpp.

void KMultiPage::initializePageCache (  )  [protected, virtual]

This function creates the page cache.

If a multipage implementation needs additional functionaly from the cache overwrite this function to create a subclass of DocumentPageCache.

Warning:
This function is called by the constructor, never call it explicitly.

Definition at line 347 of file kmultipage.cpp.

virtual bool KMultiPage::isModified (  )  const [inline, virtual]

Flag to indicate the document was modified since last saved.

KMultiPage implementations that offer functionality that modifies the document (e.g. remove or insert pages) must re-implement this method to return

Returns:
'true' if the document was modified since it was last saved

Reimplemented in DjVuMultiPage.

Definition at line 248 of file kmultipage.h.

void KMultiPage::print (  )  [virtual]

Prints a document.

This method prints a document. The default implementation offers fairly good printer support, but printing with the default implementation is usually quite slow as tremendous amounts of data needs to be transferred to the printer. To limit the data sent to the printer, this default implementation prints only at low resolution and produces mediocre quality. This method can (and should) therefore be re-implemented if you have good code to convert your document to PostScript.

Example: If your document consists of a single A4 page that contains a DJVU image of 30KB, then the default implementation would render the image in 600dpi, i.e. in about 7000x5000 pixel, and then send this huge graphics uncompressed to the printer. A smart implementation, on the other hand, would send the DJVU-file directly to the printer, together with a DJVU decoder, which is implemented in PostScript and uses only a few KB of memory, making for less than 40KB of data sent to the printer.

If you decide to re-implement this method, you need to decide if your implementation will support the options offered by the "page size & placement" tab of the print dialog. If these options are set, pages that are smaller/larger than the printer's paper size will be shrunk/enlarged and optionally centered on the paper.

If your implementation does not support the options, the following code should be used:

  // Obtain a fully initialized KPrinter structure, and disable all
  // entries in the "Page Size & Placement" tab of the printer dialog.
  KPrinter *printer = getPrinter(false);
  // Abort with an error message if no KPrinter could be initialized
  if (printer == 0) {
    kdError(4300) << "KPrinter not available" << endl;
    return;
  }

  // Show the printer options dialog. Return immediately if the user
  // aborts.
  if (!printer->setup(parentWdg, i18n("Print %1").arg(m_file.section('/', -1)) )) {
    delete printer;
    return;
  }

  ...  <Produce a PostScript file, with filename, say, tmpPSFile. You
  can use all the features that KPrinter has to offer. Note that
  printer->pageList() gives a list of pages to be printed, where "1"
  denotes the first page, "2" the second, etc.> ...

  printer->printFiles( QStringList(tmpPSFile), true );
  delete printer;

If your implementation does support the options, code must be provided to support the KPrinter options "kde-kviewshell-shrinkpage", "kde-kviewshell-expandpage", "kde-kviewshell-centerpage" and "kde-kviewshell-rotatepage". It is important to note that "kde-kviewshell-rotatepage" and "kde-kviewshell-centerpage" should by default treated as "true", while the other options should be "false" by default. The following code sees to that:

  // Obtain a fully initialized KPrinter structure, and enable all
  // entries in the "Page Size & Placement" tab of the printer dialog.
  KPrinter *printer = getPrinter(true);
  // Abort with an error message if no KPrinter could be initialized
  if (printer == 0) {
    kdError(4300) << "KPrinter not available" << endl;
    return;
  }

  // Show the printer options dialog. Return immediately if the user
  // aborts.
  if (!printer->setup(parentWdg, i18n("Print %1").arg(m_file.section('/', -1)) )) {
    delete printer;
    return;
  }

  if (printer->option( "kde-kviewshell-shrinkpage" ) == "true")
    <Shrink some pages to paper size, where necessary>
  if (printer->option( "kde-kviewshell-expandpage" ) == "true")
    <Expand some pages to paper size, where necessary>
  if (printer->option( "kde-kviewshell-centerpage" ) != "false") 
    <Center pages on paper>
  if (printer->option( "kde-kviewshell-rotatepage" ) != "false") 
    <rotate pages by 90 deg. counterclockwise, if paper orientation is different from pages orientation>

  ...  <Produce a PostScript file, with filename, say, tmpPSFile. You
  can use all the features that KPrinter has to offer. Note that
  printer->pageList() gives a list of pages to be printed, where "1"
  denotes the first page, "2" the second, etc.> ...

  printer->printFiles( QStringList(tmpPSFile), true ); 
  delete printer;

For more information, see the default implementation in the source file kmultipage.cpp. You might also look at the documentation to getPrinter().

Reimplemented in DjVuMultiPage.

Definition at line 756 of file kmultipage.cpp.

void KMultiPage::readSettings (  )  [virtual]

reads in settings.

Reimplementations must call this.

Definition at line 114 of file kmultipage.cpp.

void KMultiPage::setFile ( bool  success  )  [protected, virtual]

Update GUI after loading or closing of a file.

This method is called by openFile() when a new file was loaded, and by closeURL() when a file is closed so that the kmultipage implementation can update its own GUI, enable/disable actions, prepare info texts, etc. At the time the method is executed, the file has already been loaded into the renderer using renderer.setFile(), or closed using renderer.clear() and the standard KMultiPage GUI is set up. The filename can be accessed via m_file.

The default implementation does nothing.

Parameters:
success the return value of renderer.setFile() which indicates if the file could be successfully loaded by the renderer, or not. Note that setFile() is called even if the renderer returned 'false', so that the implemtation can then disable menu items, etc.

Reimplemented in DjVuMultiPage.

Definition at line 182 of file kmultipage.cpp.

void KMultiPage::slotSave (  )  [virtual, slot]

Opens a file requestor and starts a basic copy KIO-Job.

A multipage implementation that wishes to offer saving in various formats must re-implement this slot.

Reimplemented in DjVuMultiPage.

Definition at line 144 of file kmultipage.cpp.

virtual bool KMultiPage::supportsTextSearch (  )  const [inline, virtual]

Flag to indicate that this implementation has support for textserach and selection.

Definition at line 237 of file kmultipage.h.

void KMultiPage::writeSettings (  )  [virtual]

writes settings.

Reimplementations must call this.

Definition at line 118 of file kmultipage.cpp.


Member Data Documentation

Pointer to the parent widget.

This pointer is automatically set by the constructor.

Definition at line 571 of file kmultipage.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys