From 00b4f54142276b0e2272ca56e48558551ab7b2b0 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 26 Jan 2013 13:17:19 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- kcoloredit/Makefile.am | 4 +- kdvi/CMakeLists.txt | 4 +- kdvi/Makefile.am | 8 +- kdvi/kdvi_multipage.cpp | 4 +- kdvi/kdvi_multipage.h | 2 +- kdvi/main.cpp | 4 +- kfax/Makefile.am | 2 +- kfaxview/CMakeLists.txt | 4 +- kfaxview/Makefile.am | 6 +- kfaxview/faxmultipage.cpp | 6 +- kfaxview/faxmultipage.h | 4 +- kfaxview/libkfaximage/CMakeLists.txt | 2 +- kfaxview/main.cpp | 4 +- kgamma/kcmkgamma/CMakeLists.txt | 2 +- kghostview/CMakeLists.txt | 2 +- kghostview/Makefile.am | 2 +- kghostview/kgv_view.h | 2 +- kghostview/kgvfactory.cpp | 6 +- kghostview/kgvfactory.h | 6 +- kghostview/kgvshell.cpp | 2 +- kghostview/kgvshell.h | 2 +- kiconedit/Makefile.am | 2 +- kmrml/kmrml/CMakeLists.txt | 2 +- kmrml/kmrml/browser.h | 2 +- kmrml/kmrml/kcontrol/CMakeLists.txt | 2 +- kmrml/kmrml/mrml_part.cpp | 2 +- kmrml/kmrml/mrml_part.h | 4 +- kmrml/kmrml/server/CMakeLists.txt | 2 +- kolourpaint/Makefile.am | 2 +- kooka/CMakeLists.txt | 2 +- kooka/Makefile.am | 4 +- kooka/kooka.cpp | 2 +- kooka/kooka.h | 2 +- kooka/kookaview.cpp | 2 +- kooka/kookaview.h | 4 +- kooka/ksaneocr.cpp | 10 +- kooka/ksaneocr.h | 4 +- kooka/ocrword.cpp | 2 +- kpdf/CMakeLists.txt | 2 +- kpdf/core/generator_pdf/generator_pdf.cpp | 2 +- kpdf/part.cpp | 2 +- kpdf/part.h | 4 +- kpdf/shell/CMakeLists.txt | 2 +- kpdf/shell/Makefile.am | 2 +- kpdf/shell/shell.cpp | 2 +- kpdf/shell/shell.h | 2 +- kpdf/ui/pageview.cpp | 2 +- kpovmodeler/CMakeLists.txt | 2 +- kpovmodeler/Makefile.am | 2 +- kpovmodeler/kdoc.rules | 2 +- kpovmodeler/pmdockwidget.cpp | 10 +- kpovmodeler/pmdockwidget.h | 8 +- kpovmodeler/pmfactory.h | 2 +- kpovmodeler/pmpart.h | 4 +- kpovmodeler/pmpluginmanager.cpp | 2 +- kruler/Makefile.am | 2 +- ksnapshot/Makefile.am | 2 +- ksvg/CMakeLists.txt | 2 +- ksvg/core/CanvasFactory.cpp | 2 +- ksvg/ecma/ksvg_window.cpp | 6 +- ksvg/ecma/ksvg_window.h | 2 +- ksvg/impl/SVGElementImpl.cc | 2 +- ksvg/impl/SVGElementImpl.h | 2 +- ksvg/impl/SVGEventImpl.cc | 2 +- ksvg/plugin/ksvg_factory.h | 4 +- ksvg/plugin/ksvg_plugin.h | 2 +- ksvg/test/external/Makefile.am | 4 +- kview/CMakeLists.txt | 2 +- kview/config/plugins/CMakeLists.txt | 2 +- kview/kimageviewer/CMakeLists.txt | 2 +- kview/kimageviewer/viewer.h | 2 +- kview/kview.cpp | 6 +- kview/kview.h | 2 +- kview/kviewcanvas/CMakeLists.txt | 2 +- kview/kviewcanvas/test/Makefile.am | 2 +- kview/kviewcanvas/test/test.cpp | 2 +- kview/kviewcanvas/test/test.h | 2 +- kview/kviewviewer/CMakeLists.txt | 2 +- kview/kviewviewer/config/CMakeLists.txt | 2 +- kview/kviewviewer/kviewkonqextension.h | 2 +- kview/kviewviewer/kviewviewer.cpp | 8 +- kview/kviewviewer/test/Makefile.am | 2 +- kview/kviewviewer/test/test.cpp | 2 +- kview/kviewviewer/test/test.h | 2 +- kview/modules/browser/CMakeLists.txt | 2 +- kview/modules/browser/kviewbrowser.cpp | 2 +- kview/modules/browser/kviewbrowser.h | 2 +- kview/modules/effects/CMakeLists.txt | 2 +- kview/modules/effects/kvieweffects.h | 2 +- kview/modules/presenter/CMakeLists.txt | 2 +- kview/modules/presenter/config/CMakeLists.txt | 2 +- kview/modules/presenter/kviewpresenter.h | 2 +- kview/modules/scale/kview_scale.h | 2 +- kview/modules/scanner/CMakeLists.txt | 2 +- kview/modules/scanner/kviewscanner.h | 2 +- kview/modules/template/kviewtemplate.h | 2 +- kview/photobook/CMakeLists.txt | 2 +- kview/photobook/photobook.cpp | 2 +- kview/photobook/photobook.h | 6 +- kviewshell/CMakeLists.txt | 20 +- kviewshell/Makefile.am | 22 +- kviewshell/TODO | 6 +- kviewshell/empty_multipage.h | 4 +- kviewshell/kmultipage.cpp | 1976 -------------------- kviewshell/kmultipage.desktop | 41 - kviewshell/kmultipage.h | 651 ------- kviewshell/kmultipageInterface.h | 18 - kviewshell/kprintDialogPage_pageoptions.cpp | 4 +- kviewshell/kviewpart.cpp | 8 +- kviewshell/kviewpart.h | 4 +- kviewshell/kviewpart_iface.h | 2 +- kviewshell/kviewshell.cpp | 2 +- kviewshell/kviewshell.h | 2 +- kviewshell/main.cpp | 4 +- kviewshell/plugins/djvu/CMakeLists.txt | 2 +- kviewshell/plugins/djvu/Makefile.am | 2 +- kviewshell/plugins/djvu/djvumultipage.cpp | 6 +- kviewshell/plugins/djvu/djvumultipage.h | 6 +- .../djvu/kprintDialogPage_DJVUpageoptions.cpp | 4 +- kviewshell/tdemultipage.cpp | 1976 ++++++++++++++++++++ kviewshell/tdemultipage.desktop | 41 + kviewshell/tdemultipage.h | 651 +++++++ kviewshell/tdemultipageInterface.h | 18 + 123 files changed, 2880 insertions(+), 2880 deletions(-) delete mode 100644 kviewshell/kmultipage.cpp delete mode 100644 kviewshell/kmultipage.desktop delete mode 100644 kviewshell/kmultipage.h delete mode 100644 kviewshell/kmultipageInterface.h create mode 100644 kviewshell/tdemultipage.cpp create mode 100644 kviewshell/tdemultipage.desktop create mode 100644 kviewshell/tdemultipage.h create mode 100644 kviewshell/tdemultipageInterface.h diff --git a/kcoloredit/Makefile.am b/kcoloredit/Makefile.am index f45833e6..09028843 100644 --- a/kcoloredit/Makefile.am +++ b/kcoloredit/Makefile.am @@ -7,7 +7,7 @@ kcoloredit_SOURCES = kzcolorselector.cpp imageselection.cpp \ kcoloreditview.cpp kcoloreditdoc.cpp kcoloredit.cpp main.cpp kcoloredit_METASOURCES = AUTO kcoloredit_LDADD = $(LIB_TDEUI) $(LIB_KFILE) -kcoloredit_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +kcoloredit_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor rcdir = $(kde_datadir)/kcoloredit rc_DATA = kcoloreditui.rc @@ -15,7 +15,7 @@ rc_DATA = kcoloreditui.rc bin_PROGRAMS = kcoloredit kcolorchooser kcolorchooser_SOURCES = kcolorchooser.cpp kcolorchooser_LDADD = $(LIB_TDEUI) -kcolorchooser_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +kcolorchooser_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor noinst_HEADERS = color.h colorselector.h editablestreamhistory.h \ gradientselection.h imageselection.h kcoloredit.h kcoloreditdoc.h \ diff --git a/kdvi/CMakeLists.txt b/kdvi/CMakeLists.txt index e726b97f..9c1ef8da 100644 --- a/kdvi/CMakeLists.txt +++ b/kdvi/CMakeLists.txt @@ -75,7 +75,7 @@ tde_add_kpart( kdvipart AUTOMOC TeXFont_PFB.cpp TeXFont_TFM.cpp TeXFontDefinition.cpp dviWidget.cpp dvisourcesplitter.cpp prefs.kcfgc LINK - kmultipage-shared tdeprint-shared kparts-shared ${FREETYPE_LIBRARIES} + tdemultipage-shared tdeprint-shared tdeparts-shared ${FREETYPE_LIBRARIES} DESTINATION ${PLUGIN_INSTALL_DIR} ) @@ -84,7 +84,7 @@ tde_add_kpart( kdvipart AUTOMOC tde_add_executable( kdvi AUTOMOC SOURCES main.cpp - LINK kviewshell-static kparts-shared + LINK kviewshell-static tdeparts-shared DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/kdvi/Makefile.am b/kdvi/Makefile.am index 98f5e94f..ee2c8bc2 100644 --- a/kdvi/Makefile.am +++ b/kdvi/Makefile.am @@ -30,8 +30,8 @@ kdvipart_la_SOURCES = renderedDviPagePixmap.cpp dviPageCache.cpp \ kde_kcfg_DATA = kdvi.kcfg kdvipart_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module -kdvipart_la_LIBADD = $(LIBFREETYPE_LIBS) -lkparts \ - $(top_builddir)/kviewshell/libkmultipage.la +kdvipart_la_LIBADD = $(LIBFREETYPE_LIBS) -ltdeparts \ + $(top_builddir)/kviewshell/libtdemultipage.la # Which sources should be compiled for squeeze. squeeze_SOURCES = squeeze.c @@ -39,8 +39,8 @@ squeeze_SOURCES = squeeze.c KDE_OPTIONS = nofinal kdvi_SOURCES = main.cpp -kdvi_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor -kdvi_LDADD = ../kviewshell/libifaces.la ../kviewshell/libkviewshell.la -lkparts +kdvi_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor +kdvi_LDADD = ../kviewshell/libifaces.la ../kviewshell/libkviewshell.la -ltdeparts ## this option you can leave out. Just, if you use "make dist", you need it noinst_HEADERS = dvi.h dviRenderer.h xdvi.h diff --git a/kdvi/kdvi_multipage.cpp b/kdvi/kdvi_multipage.cpp index ca370a83..53a5d6df 100644 --- a/kdvi/kdvi_multipage.cpp +++ b/kdvi/kdvi_multipage.cpp @@ -15,8 +15,8 @@ #include #include -#include -#include +#include +#include #include "kdvi_multipage.h" #include "documentWidget.h" diff --git a/kdvi/kdvi_multipage.h b/kdvi/kdvi_multipage.h index dba4b3d2..812d56ce 100644 --- a/kdvi/kdvi_multipage.h +++ b/kdvi/kdvi_multipage.h @@ -2,7 +2,7 @@ #ifndef KDVIMULTIPAGE_H #define KDVIMULTIPAGE_H -#include "kmultipage.h" +#include "tdemultipage.h" #include "dviRenderer.h" #include diff --git a/kdvi/main.cpp b/kdvi/main.cpp index 6b85af9d..51dc9306 100644 --- a/kdvi/main.cpp +++ b/kdvi/main.cpp @@ -105,7 +105,7 @@ int main(int argc, char** argv) TQDataStream arg(data, IO_WriteOnly); bool result; arg << qualPath.stripWhiteSpace(); - if (!app.dcopClient()->call( *it, "kmultipage", "is_file_loaded(TQString)", data, replyType, replyData)) + if (!app.dcopClient()->call( *it, "tdemultipage", "is_file_loaded(TQString)", data, replyType, replyData)) kdError(4300) << "There was an error using DCOP." << endl; else { @@ -115,7 +115,7 @@ int main(int argc, char** argv) reply >> result; if (result == true) { - if (app.dcopClient()->send( *it, "kmultipage", "jumpToReference(TQString)", url.ref()) == true) + if (app.dcopClient()->send( *it, "tdemultipage", "jumpToReference(TQString)", url.ref()) == true) { app.dcopClient()->detach(); return 0; diff --git a/kfax/Makefile.am b/kfax/Makefile.am index c99a3d53..01888a75 100644 --- a/kfax/Makefile.am +++ b/kfax/Makefile.am @@ -1,4 +1,4 @@ -AM_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +AM_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor LDADD = $(LIB_KFILE) $(LIB_TDEPRINT) -lm INCLUDES = $(all_includes) diff --git a/kfaxview/CMakeLists.txt b/kfaxview/CMakeLists.txt index 55d83905..b01047b8 100644 --- a/kfaxview/CMakeLists.txt +++ b/kfaxview/CMakeLists.txt @@ -39,7 +39,7 @@ install( FILES kfaxmultipage.desktop kfaxmultipage_tiff.desktop DESTINATION ${SE tde_add_kpart( kfaxviewpart AUTOMOC SOURCES faxmultipage.cpp faxrenderer.cpp - LINK kmultipage-shared kfaximage-static kparts-shared + LINK tdemultipage-shared kfaximage-static tdeparts-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) @@ -48,6 +48,6 @@ tde_add_kpart( kfaxviewpart AUTOMOC tde_add_executable( kfaxview AUTOMOC SOURCES main.cpp - LINK kviewshell-static kio-shared kparts-shared + LINK kviewshell-static kio-shared tdeparts-shared DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/kfaxview/Makefile.am b/kfaxview/Makefile.am index 884c503a..d42c6ed9 100644 --- a/kfaxview/Makefile.am +++ b/kfaxview/Makefile.am @@ -12,8 +12,8 @@ METASOURCES = AUTO bin_PROGRAMS = kfaxview kfaxview_SOURCES = main.cpp -kfaxview_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor -kfaxview_LDADD = ../kviewshell/libifaces.la ../kviewshell/libkviewshell.la -lkparts +kfaxview_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor +kfaxview_LDADD = ../kviewshell/libifaces.la ../kviewshell/libkviewshell.la -ltdeparts # this is where the desktop file will go kde_services_DATA = kfaxmultipage.desktop kfaxmultipage_tiff.desktop @@ -23,7 +23,7 @@ shellrcdir = $(kde_datadir)/kfaxview kde_module_LTLIBRARIES = kfaxviewpart.la kfaxviewpart_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module -kfaxviewpart_la_LIBADD = -ltdeprint -lkparts $(top_builddir)/kviewshell/libkmultipage.la libkfaximage/libkfaximage.la +kfaxviewpart_la_LIBADD = -ltdeprint -ltdeparts $(top_builddir)/kviewshell/libtdemultipage.la libkfaximage/libkfaximage.la kfaxviewpart_la_SOURCES = faxmultipage.cpp faxrenderer.cpp partdir = $(kde_datadir)/kfaxview diff --git a/kfaxview/faxmultipage.cpp b/kfaxview/faxmultipage.cpp index d052b51b..b01d4577 100644 --- a/kfaxview/faxmultipage.cpp +++ b/kfaxview/faxmultipage.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include "faxmultipage.h" @@ -35,7 +35,7 @@ FaxMultiPage::FaxMultiPage(TQWidget *parentWidget, const char *widgetName, TQObj const char *name, const TQStringList&) : KMultiPage(parentWidget, widgetName, parent, name), faxRenderer(parentWidget) { - /* This is kparts wizardry that cannot be understood by man. Simply + /* This is tdeparts wizardry that cannot be understood by man. Simply change the names to match your implementation. */ setInstance(FaxMultiPageFactory::instance()); faxRenderer.setName("Fax renderer"); @@ -43,7 +43,7 @@ FaxMultiPage::FaxMultiPage(TQWidget *parentWidget, const char *widgetName, TQObj setXMLFile("kfaxview.rc"); /* It is very important that this method is called in the - constructor. Otherwise kmultipage does not know how to render + constructor. Otherwise tdemultipage does not know how to render files, and crashes may result. */ setRenderer(&faxRenderer); } diff --git a/kfaxview/faxmultipage.h b/kfaxview/faxmultipage.h index a6e471e8..d9888d7c 100644 --- a/kfaxview/faxmultipage.h +++ b/kfaxview/faxmultipage.h @@ -23,7 +23,7 @@ #include -#include "kmultipage.h" +#include "tdemultipage.h" #include "faxrenderer.h" @@ -87,7 +87,7 @@ public: /** Constructor The constructor needs to initialize several members of the - kmultipage. Please have a look at the constructor's source code to + tdemultipage. Please have a look at the constructor's source code to see how to adjust this for your implementation. */ FaxMultiPage(TQWidget *parentWidget, const char *widgetName, TQObject *parent, diff --git a/kfaxview/libkfaximage/CMakeLists.txt b/kfaxview/libkfaximage/CMakeLists.txt index 636eacae..f217b3b0 100644 --- a/kfaxview/libkfaximage/CMakeLists.txt +++ b/kfaxview/libkfaximage/CMakeLists.txt @@ -32,7 +32,7 @@ tde_add_library( kfaximage STATIC_PIC AUTOMOC tde_add_library( kfaximage SHARED AUTOMOC SOURCES kfaximage.cpp faxexpand.cpp faxinit.cpp VERSION 1.0.0 - LINK kparts-shared ${TQT_LIBRARIES} + LINK tdeparts-shared ${TQT_LIBRARIES} DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/kfaxview/main.cpp b/kfaxview/main.cpp index 7f4fbeee..70921c9c 100644 --- a/kfaxview/main.cpp +++ b/kfaxview/main.cpp @@ -125,7 +125,7 @@ int main(int argc, char** argv) TQDataStream arg(data, IO_WriteOnly); bool result; arg << qualPath.stripWhiteSpace(); - if (!app.dcopClient()->call( *it, "kmultipage", "is_file_loaded(TQString)", data, replyType, replyData)) + if (!app.dcopClient()->call( *it, "tdemultipage", "is_file_loaded(TQString)", data, replyType, replyData)) kdError(4300) << "There was an error using DCOP." << endl; else { @@ -135,7 +135,7 @@ int main(int argc, char** argv) reply >> result; if (result == true) { - if (app.dcopClient()->send( *it, "kmultipage", "jumpToReference(TQString)", url.ref()) == true) + if (app.dcopClient()->send( *it, "tdemultipage", "jumpToReference(TQString)", url.ref()) == true) { app.dcopClient()->detach(); return 0; diff --git a/kgamma/kcmkgamma/CMakeLists.txt b/kgamma/kcmkgamma/CMakeLists.txt index 6ec0ff8d..def674ad 100644 --- a/kgamma/kcmkgamma/CMakeLists.txt +++ b/kgamma/kcmkgamma/CMakeLists.txt @@ -38,6 +38,6 @@ tde_add_kpart( kcm_kgamma AUTOMOC SOURCES xf86configpath.cpp xvidextwrap.cpp displaynumber.cpp gammactrl.cpp kgamma.cpp - LINK kparts-shared ${XXF86VM_LIBRARIES} + LINK tdeparts-shared ${XXF86VM_LIBRARIES} DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kghostview/CMakeLists.txt b/kghostview/CMakeLists.txt index cdf00f75..316f387e 100644 --- a/kghostview/CMakeLists.txt +++ b/kghostview/CMakeLists.txt @@ -47,7 +47,7 @@ tde_add_library( kghostviewlib SHARED AUTOMOC displayoptions.cpp kpswidget.cpp fullscreenfilter.cpp kgvfactory.cpp generalsettingswidget.ui gssettingswidget.ui thumbnailservice.cpp configuration.kcfgc - LINK dscparse-static tdeprint-shared kparts-shared + LINK dscparse-static tdeprint-shared tdeparts-shared VERSION 0.0.0 DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/kghostview/Makefile.am b/kghostview/Makefile.am index 5cf5cc67..3d7faa44 100644 --- a/kghostview/Makefile.am +++ b/kghostview/Makefile.am @@ -28,7 +28,7 @@ libkghostviewlib_la_SOURCES = kgvshell.cpp kgvdocument.cpp kgv_miniwidget.cpp \ libkghostviewpart_la_SOURCES = part_init.cpp kghostview_SOURCES = main.cpp -kghostview_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +kghostview_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor kghostview_LDADD = libkghostviewlib.la libdscparse_la_LDFLAGS = $(all_libraries) -no-undefined diff --git a/kghostview/kgv_view.h b/kghostview/kgv_view.h index 8457c050..158ef0ec 100644 --- a/kghostview/kgv_view.h +++ b/kghostview/kgv_view.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include "displayoptions.h" diff --git a/kghostview/kgvfactory.cpp b/kghostview/kgvfactory.cpp index dfeea82a..738fba57 100644 --- a/kghostview/kgvfactory.cpp +++ b/kghostview/kgvfactory.cpp @@ -1,6 +1,6 @@ /** * Copyright (C) 2003, Lu韘 Pedro Coelho, - * based on tdelibs/kparts/genericfactory.h + * based on tdelibs/tdeparts/genericfactory.h * * 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 @@ -17,8 +17,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include -#include +#include +#include #include #include #include diff --git a/kghostview/kgvfactory.h b/kghostview/kgvfactory.h index 1b2e0801..d0ac9550 100644 --- a/kghostview/kgvfactory.h +++ b/kghostview/kgvfactory.h @@ -1,6 +1,6 @@ /** * Copyright (C) 2003, Lu韘 Pedro Coelho, - * based on tdelibs/kparts/genericfactory.h + * based on tdelibs/tdeparts/genericfactory.h * * 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 @@ -19,8 +19,8 @@ #ifndef KGVPart_H_INCLUDE_GUARD_ #define KGVPart_H_INCLUDE_GUARD_ -#include -#include +#include +#include class TDEInstance; class TDEAboutData; diff --git a/kghostview/kgvshell.cpp b/kghostview/kgvshell.cpp index ec2348fc..95aac5f9 100644 --- a/kghostview/kgvshell.cpp +++ b/kghostview/kgvshell.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include diff --git a/kghostview/kgvshell.h b/kghostview/kgvshell.h index ea794e35..0f1fa60f 100644 --- a/kghostview/kgvshell.h +++ b/kghostview/kgvshell.h @@ -21,7 +21,7 @@ #include -#include +#include class TQTimer; diff --git a/kiconedit/Makefile.am b/kiconedit/Makefile.am index 82783f2c..400e5446 100644 --- a/kiconedit/Makefile.am +++ b/kiconedit/Makefile.am @@ -11,7 +11,7 @@ kiconedit_SOURCES = utils.cpp main.cpp kiconedit.cpp kicongrid.cpp \ kiconedit_METASOURCES = AUTO # the library search path. -kiconedit_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +kiconedit_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor kiconedit_LDADD = $(LIB_KFILE) -ltdeprint DISTCLEANFILES = *~ .deps/* .libs/* diff --git a/kmrml/kmrml/CMakeLists.txt b/kmrml/kmrml/CMakeLists.txt index 20f6edb5..b570b684 100644 --- a/kmrml/kmrml/CMakeLists.txt +++ b/kmrml/kmrml/CMakeLists.txt @@ -49,7 +49,7 @@ tde_add_kpart( libkmrmlpart AUTOMOC mrml_part.cpp mrml_view.cpp loader.cpp mrml_elements.cpp mrml_creator.cpp browser.cpp algorithmdialog.cpp collectioncombo.cpp algorithmcombo.cpp propertysheet.cpp - LINK kmrmlstuff-static kparts-shared + LINK kmrmlstuff-static tdeparts-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kmrml/kmrml/browser.h b/kmrml/kmrml/browser.h index 1bfd3310..d19d1543 100644 --- a/kmrml/kmrml/browser.h +++ b/kmrml/kmrml/browser.h @@ -19,7 +19,7 @@ #ifndef BROWSER_H #define BROWSER_H -#include +#include namespace KMrml { diff --git a/kmrml/kmrml/kcontrol/CMakeLists.txt b/kmrml/kmrml/kcontrol/CMakeLists.txt index 6db11a40..15f85e95 100644 --- a/kmrml/kmrml/kcontrol/CMakeLists.txt +++ b/kmrml/kmrml/kcontrol/CMakeLists.txt @@ -33,6 +33,6 @@ tde_add_kpart( kcm_kmrml AUTOMOC kcmkmrml.cpp mainpage.cpp indexer.cpp serverconfigwidget.ui indexcleaner.cpp LINK - kmrmlstuff-static kparts-shared kio-shared + kmrmlstuff-static tdeparts-shared kio-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kmrml/kmrml/mrml_part.cpp b/kmrml/kmrml/mrml_part.cpp index 33b5ea30..29e633a7 100644 --- a/kmrml/kmrml/mrml_part.cpp +++ b/kmrml/kmrml/mrml_part.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include diff --git a/kmrml/kmrml/mrml_part.h b/kmrml/kmrml/mrml_part.h index 605d23e7..822ca042 100644 --- a/kmrml/kmrml/mrml_part.h +++ b/kmrml/kmrml/mrml_part.h @@ -23,8 +23,8 @@ #include #include -#include -#include +#include +#include #include diff --git a/kmrml/kmrml/server/CMakeLists.txt b/kmrml/kmrml/server/CMakeLists.txt index f51a9b80..337bede6 100644 --- a/kmrml/kmrml/server/CMakeLists.txt +++ b/kmrml/kmrml/server/CMakeLists.txt @@ -30,6 +30,6 @@ INSTALL( FILES daemonwatcher.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded ) tde_add_kpart( kded_daemonwatcher AUTOMOC SOURCES watcher.cpp watcher.skel - LINK kmrmlstuff-static kparts-shared kio-shared tdeinit_kded-shared + LINK kmrmlstuff-static tdeparts-shared kio-shared tdeinit_kded-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kolourpaint/Makefile.am b/kolourpaint/Makefile.am index 11d1ee45..7cef8ebb 100644 --- a/kolourpaint/Makefile.am +++ b/kolourpaint/Makefile.am @@ -39,7 +39,7 @@ kolourpaint_SOURCES = kolourpaint.cpp \ kpviewmanager.cpp \ kpviewscrollablecontainer.cpp \ kpwidgetmapper.cpp -kolourpaint_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +kolourpaint_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor kolourpaint_LDADD = $(LIB_TDEPRINT) \ cursors/libkolourpaintcursors.la \ pixmapfx/libkolourpaintpixmapfx.la \ diff --git a/kooka/CMakeLists.txt b/kooka/CMakeLists.txt index 37b3984b..24e3e091 100644 --- a/kooka/CMakeLists.txt +++ b/kooka/CMakeLists.txt @@ -43,6 +43,6 @@ tde_add_executable( kooka AUTOMOC dwmenuaction.cpp kocrbase.cpp kocrgocr.cpp kocrkadmos.cpp kadmosocr.cpp ocrword.cpp ocrresedit.cpp kookaprint.cpp imgprintdialog.cpp kocrocrad.cpp - LINK kscan-shared kparts-shared tdeprint-shared + LINK kscan-shared tdeparts-shared tdeprint-shared DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/kooka/Makefile.am b/kooka/Makefile.am index dfb9622d..75a457e6 100644 --- a/kooka/Makefile.am +++ b/kooka/Makefile.am @@ -16,8 +16,8 @@ kooka_SOURCES = main.cpp kooka.cpp kookaview.cpp kookapref.cpp \ kocrocrad.cpp # pagesetup.cpp -kooka_LDADD = $(LIB_KFILE) -ltdeprint -lktexteditor $(LIBTIFF) $(top_builddir)/libkscan/libkscan.la $(KADMOS_LIB) $(LIB_KSPELL) -kooka_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +kooka_LDADD = $(LIB_KFILE) -ltdeprint -ltdetexteditor $(LIBTIFF) $(top_builddir)/libkscan/libkscan.la $(KADMOS_LIB) $(LIB_KSPELL) +kooka_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor INCLUDES = -I$(top_srcdir)/libkscan $(all_includes) $(LIBSANE_INCLUDES) $(KADMOS_INC) diff --git a/kooka/kooka.cpp b/kooka/kooka.cpp index a1c183bb..30186479 100644 --- a/kooka/kooka.cpp +++ b/kooka/kooka.cpp @@ -53,7 +53,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kooka/kooka.h b/kooka/kooka.h index 634e6c53..5d8dc476 100644 --- a/kooka/kooka.h +++ b/kooka/kooka.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include #define KOOKA_STATE_GROUP "State" #define PREFERENCE_DIA_TAB "PreferencesTab" diff --git a/kooka/kookaview.cpp b/kooka/kookaview.cpp index 9be6b974..cc1c3af1 100644 --- a/kooka/kookaview.cpp +++ b/kooka/kookaview.cpp @@ -74,7 +74,7 @@ #include #include -#include +#include #include #include diff --git a/kooka/kookaview.h b/kooka/kookaview.h index 3b976fc0..aaccd74a 100644 --- a/kooka/kookaview.h +++ b/kooka/kookaview.h @@ -35,8 +35,8 @@ #include #include -#include -#include +#include +#include // application specific includes #include "kscandevice.h" diff --git a/kooka/ksaneocr.cpp b/kooka/ksaneocr.cpp index 9298aa75..f35d1057 100644 --- a/kooka/ksaneocr.cpp +++ b/kooka/ksaneocr.cpp @@ -33,8 +33,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include @@ -76,7 +76,7 @@ KSANEOCR::KSANEOCR( TQWidget*, TDEConfig *cfg ): m_imgCanvas(0L), m_spell(0L), m_wantKSpell(true), - m_kspellVisible(true), + m_tdespellVisible(true), m_hideDiaWhileSpellcheck(true), m_spellInitialConfig(0L), m_parent(0L), @@ -275,7 +275,7 @@ void KSANEOCR::finishedOCRVisible( bool success ) { m_ocrCurrLine = 0; /* - * create a new kspell object, based on the config of the base dialog + * create a new tdespell object, based on the config of the base dialog */ connect( new KSpell( m_parent, i18n("Kooka OCR Dictionary Check"), @@ -317,7 +317,7 @@ void KSANEOCR::startLineSpellCheck() // if( list.count() > 0 ) - m_spell->checkList( &m_checkStrings, m_kspellVisible ); + m_spell->checkList( &m_checkStrings, m_tdespellVisible ); kdDebug(28000)<< "Started!" << endl; /** * This call ends in three slots: diff --git a/kooka/ksaneocr.h b/kooka/ksaneocr.h index d01be364..bc6b610e 100644 --- a/kooka/ksaneocr.h +++ b/kooka/ksaneocr.h @@ -260,14 +260,14 @@ private: KSpell *m_spell; bool m_wantKSpell; - bool m_kspellVisible; + bool m_tdespellVisible; bool m_hideDiaWhileSpellcheck; KSpellConfig *m_spellInitialConfig; /* ValueVector of wordLists for every line of ocr results */ ocrBlock m_ocrPage; /* one block contains all lines of the page */ TQWidget *m_parent; - /* current processed line to speed kspell correction */ + /* current processed line to speed tdespell correction */ unsigned m_ocrCurrLine; TQStringList m_checkStrings; diff --git a/kooka/ocrword.cpp b/kooka/ocrword.cpp index e54feb6a..9ef393e9 100644 --- a/kooka/ocrword.cpp +++ b/kooka/ocrword.cpp @@ -121,7 +121,7 @@ TQRect ocrWordList::wordListRect() /* - * since kspell removes , - | / etc. from words while they remain in the words + * since tdespell removes , - | / etc. from words while they remain in the words * in the ocr wordlist. * This search goes through the wordlist and tries to find the words without caring * for special chars. It simply removes all chars from the words that are not alphanumeric. diff --git a/kpdf/CMakeLists.txt b/kpdf/CMakeLists.txt index 5b76c014..ccef1e04 100644 --- a/kpdf/CMakeLists.txt +++ b/kpdf/CMakeLists.txt @@ -45,7 +45,7 @@ tde_add_kpart( libkpdfpart AUTOMOC LINK kpdfconf-static kpdfui-static kpdfcore-static generatorkimgio-static generatorpdf-static xpdf-static goo-static splash-static fofi-static - kutils-shared tdeprint-shared kparts-shared ${PAPER_LIBRARY} ${XFT_LIBRARIES} + tdeutils-shared tdeprint-shared tdeparts-shared ${PAPER_LIBRARY} ${XFT_LIBRARIES} DEPENDENCIES kpdfconf-static DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kpdf/core/generator_pdf/generator_pdf.cpp b/kpdf/core/generator_pdf/generator_pdf.cpp index 2f1f857f..1f03d9c0 100644 --- a/kpdf/core/generator_pdf/generator_pdf.cpp +++ b/kpdf/core/generator_pdf/generator_pdf.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kpdf/part.cpp b/kpdf/part.cpp index d20498fb..f36d6ce5 100644 --- a/kpdf/part.cpp +++ b/kpdf/part.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/kpdf/part.h b/kpdf/part.h index a7a65799..426c89f4 100644 --- a/kpdf/part.h +++ b/kpdf/part.h @@ -16,8 +16,8 @@ #ifndef _KPDF_PART_H_ #define _KPDF_PART_H_ -#include -#include +#include +#include #include #include "core/document.h" #include "core/observer.h" diff --git a/kpdf/shell/CMakeLists.txt b/kpdf/shell/CMakeLists.txt index 59f84caa..74553840 100644 --- a/kpdf/shell/CMakeLists.txt +++ b/kpdf/shell/CMakeLists.txt @@ -31,6 +31,6 @@ install( FILES shell.rc DESTINATION ${DATA_INSTALL_DIR}/kpdf ) tde_add_executable( kpdf AUTOMOC SOURCES main.cpp shell.cpp - LINK kparts-shared + LINK tdeparts-shared DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/kpdf/shell/Makefile.am b/kpdf/shell/Makefile.am index ed901f6e..8ee058b4 100644 --- a/kpdf/shell/Makefile.am +++ b/kpdf/shell/Makefile.am @@ -5,7 +5,7 @@ METASOURCES = AUTO bin_PROGRAMS = kpdf kpdf_SOURCES = main.cpp shell.cpp -kpdf_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +kpdf_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor kpdf_LDADD = $(LIB_KPARTS) EXTRA_DIST = kpdf.desktop diff --git a/kpdf/shell/shell.cpp b/kpdf/shell/shell.cpp index ed0fc8fc..5491321e 100644 --- a/kpdf/shell/shell.cpp +++ b/kpdf/shell/shell.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/kpdf/shell/shell.h b/kpdf/shell/shell.h index b6bbf499..6fc2a21e 100644 --- a/kpdf/shell/shell.h +++ b/kpdf/shell/shell.h @@ -20,7 +20,7 @@ #include #endif -#include +#include namespace KPDF { diff --git a/kpdf/ui/pageview.cpp b/kpdf/ui/pageview.cpp index cc40fdb2..7b4d0e75 100644 --- a/kpdf/ui/pageview.cpp +++ b/kpdf/ui/pageview.cpp @@ -650,7 +650,7 @@ void PageView::keyPressEvent( TQKeyEvent * e ) if ( ( !d->mouseSelectionRect.isNull() && e->key() != TQt::Key_Escape ) || d->mouseMidStartY != -1 ) return; - // handle 'find as you type' (based on khtml/khtmlview.cpp) + // handle 'find as you type' (based on tdehtml/tdehtmlview.cpp) if( d->typeAheadActive ) { // backspace: remove a char and search or terminates search diff --git a/kpovmodeler/CMakeLists.txt b/kpovmodeler/CMakeLists.txt index a838d041..e264689a 100644 --- a/kpovmodeler/CMakeLists.txt +++ b/kpovmodeler/CMakeLists.txt @@ -114,7 +114,7 @@ tde_add_library( kpovmodeler SHARED AUTOMOC pmlibraryiconview.cpp pmlibraryobjectsearch.cpp pmpluginmanager.cpp pmpartiface.skel VERSION 0.0.0 - LINK kparts-shared ${GLU_LIBRARIES} ${XMU_LIBRARIES} + LINK tdeparts-shared ${GLU_LIBRARIES} ${XMU_LIBRARIES} DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/kpovmodeler/Makefile.am b/kpovmodeler/Makefile.am index 01c8a959..18f0e782 100644 --- a/kpovmodeler/Makefile.am +++ b/kpovmodeler/Makefile.am @@ -227,7 +227,7 @@ libkpovmodelerpart_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) bin_PROGRAMS = kpovmodeler kpovmodeler_SOURCES = main.cpp -kpovmodeler_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +kpovmodeler_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor kpovmodeler_LDADD = libkpovmodeler.la dummy.cpp: diff --git a/kpovmodeler/kdoc.rules b/kpovmodeler/kdoc.rules index 7a8d984d..ca8abb0d 100644 --- a/kpovmodeler/kdoc.rules +++ b/kpovmodeler/kdoc.rules @@ -6,5 +6,5 @@ kde_MODULES = kpovmodeler kpovmodeler_FILES = *.h -kpovmodeler_LIBS = -ltdeui -lkparts -ltdecore -ldcop -lkfile -lkio -lqt -p +kpovmodeler_LIBS = -ltdeui -ltdeparts -ltdecore -ldcop -lkfile -lkio -lqt -p kpovmodeler_PATH = . \ No newline at end of file diff --git a/kpovmodeler/pmdockwidget.cpp b/kpovmodeler/pmdockwidget.cpp index fb66ace6..e3e3c7b4 100644 --- a/kpovmodeler/pmdockwidget.cpp +++ b/kpovmodeler/pmdockwidget.cpp @@ -48,10 +48,10 @@ #include "pmdebug.h" -#include -#include +#include +#include #include -#include +#include #include #include #include @@ -151,7 +151,7 @@ PMDockMainWindow::~PMDockMainWindow() delete d; } -// kparts/dockmainwindow stuff +// tdeparts/dockmainwindow stuff void PMDockMainWindow::createGUI( Part * part ) { kdDebug(1000) << TQString("DockMainWindow::createGUI for %1").arg(part?part->name():"0L") << endl; @@ -245,7 +245,7 @@ void PMDockMainWindow::createShellGUI( bool create ) } accel()->setAutoUpdate( bAccelAutoUpdate ); } -// end kparts/dockmainwindow +// end tdeparts/dockmainwindow void PMDockMainWindow::setMainDockWidget( PMDockWidget* mdw ) { diff --git a/kpovmodeler/pmdockwidget.h b/kpovmodeler/pmdockwidget.h index 4378d282..18aa1db6 100644 --- a/kpovmodeler/pmdockwidget.h +++ b/kpovmodeler/pmdockwidget.h @@ -46,7 +46,7 @@ /* MODIFICATIONS (zehender) - Added kparts ability from kparts/dockmainwindow + Added tdeparts ability from tdeparts/dockmainwindow */ #define _JOWENN_EXPERIMENTAL_ @@ -74,7 +74,7 @@ #include "dummykmainwindow.h" #endif -#include +#include using namespace KParts; class PMDockSplitter; @@ -1369,7 +1369,7 @@ protected slots: */ void slotDockWidgetUndocked(); - // kparts/dockmainwindow stuff + // tdeparts/dockmainwindow stuff protected slots: /** @@ -1391,7 +1391,7 @@ protected slots: protected: virtual void createShellGUI( bool create = true ); - // end kparts/dockmainwindow stuff + // end tdeparts/dockmainwindow stuff protected: virtual void virtual_hook( int id, void* data ); diff --git a/kpovmodeler/pmfactory.h b/kpovmodeler/pmfactory.h index fd147aaa..77821f1b 100644 --- a/kpovmodeler/pmfactory.h +++ b/kpovmodeler/pmfactory.h @@ -20,7 +20,7 @@ #ifndef PMFACTORY_H #define PMFACTORY_H -#include +#include class TDEAboutData; class TDEInstance; diff --git a/kpovmodeler/pmpart.h b/kpovmodeler/pmpart.h index 7c14cbf9..9a4444bd 100644 --- a/kpovmodeler/pmpart.h +++ b/kpovmodeler/pmpart.h @@ -28,8 +28,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/kpovmodeler/pmpluginmanager.cpp b/kpovmodeler/pmpluginmanager.cpp index f3a41686..f7313675 100644 --- a/kpovmodeler/pmpluginmanager.cpp +++ b/kpovmodeler/pmpluginmanager.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/kruler/Makefile.am b/kruler/Makefile.am index bcdb32f0..72955deb 100644 --- a/kruler/Makefile.am +++ b/kruler/Makefile.am @@ -4,7 +4,7 @@ INCLUDES= $(all_includes) bin_PROGRAMS = kruler kruler_METASOURCES = AUTO -kruler_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +kruler_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor kruler_LDADD = $(LIB_TDEUI) kruler_SOURCES = klineal.cpp main.cpp diff --git a/ksnapshot/Makefile.am b/ksnapshot/Makefile.am index cb687823..50e9b672 100644 --- a/ksnapshot/Makefile.am +++ b/ksnapshot/Makefile.am @@ -2,7 +2,7 @@ bin_PROGRAMS= ksnapshot INCLUDES = -DKSNAPVERSION="\"0.7\"" $(all_includes) -ksnapshot_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +ksnapshot_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor ksnapshot_LDADD = $(LIB_TDEPRINT) ksnapshot_SOURCES = ksnapshotiface.skel main.cpp ksnapshot.cpp \ diff --git a/ksvg/CMakeLists.txt b/ksvg/CMakeLists.txt index c9cf25a9..3f1c88bc 100644 --- a/ksvg/CMakeLists.txt +++ b/ksvg/CMakeLists.txt @@ -38,6 +38,6 @@ tde_add_library( ksvg SHARED ksvgdom-static ksvgdomimpl-static ksvgcore-static ksvgecma-static ksvgxrgbrender-static text2path-static ksvgart-static LINK - khtml-shared ${LCMS_LIBRARY} ${ART_LIBRARIES} ${FRIBIDI_LIBRARIES} + tdehtml-shared ${LCMS_LIBRARY} ${ART_LIBRARIES} ${FRIBIDI_LIBRARIES} DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/ksvg/core/CanvasFactory.cpp b/ksvg/core/CanvasFactory.cpp index d1278334..3c331060 100644 --- a/ksvg/core/CanvasFactory.cpp +++ b/ksvg/core/CanvasFactory.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include "KSVGCanvas.h" #include "CanvasFactory.h" diff --git a/ksvg/ecma/ksvg_window.cpp b/ksvg/ecma/ksvg_window.cpp index a8504b80..979e7fed 100644 --- a/ksvg/ecma/ksvg_window.cpp +++ b/ksvg/ecma/ksvg_window.cpp @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include #include @@ -70,7 +70,7 @@ using namespace KSVG; navigator KSVG::Window::_Navigator DontDelete|ReadOnly printNode KSVG::Window::_PrintNode DontDelete|Function 1 -# todo navigator, status/defaultstatus, like in KJS::Window (khtml) +# todo navigator, status/defaultstatus, like in KJS::Window (tdehtml) # todo close # todo instancename # todo setsrc, getsrc, reload, focus, blur, browsereval, findinstancebyname @@ -381,7 +381,7 @@ Value WindowFunc::call(ExecState *exec, Object &thisObj, const List &args) } case KSVG::Window::_Prompt: { - // mop: from khtml. do we need that? + // mop: from tdehtml. do we need that? // part->xmlDocImpl()->updateRendering(); bool ok; TQString str2; diff --git a/ksvg/ecma/ksvg_window.h b/ksvg/ecma/ksvg_window.h index 5340dc9a..11655d7e 100644 --- a/ksvg/ecma/ksvg_window.h +++ b/ksvg/ecma/ksvg_window.h @@ -27,7 +27,7 @@ namespace KSVG { class SVGDocumentImpl; class WindowQObject; -// This is currently a fork of khtml's Window object, simplified. +// This is currently a fork of tdehtml's Window object, simplified. // However in the long run it could become a base class for it. // Author: David Faure class Window : public KJS::ObjectImp { diff --git a/ksvg/impl/SVGElementImpl.cc b/ksvg/impl/SVGElementImpl.cc index 940790f2..fe013f0a 100644 --- a/ksvg/impl/SVGElementImpl.cc +++ b/ksvg/impl/SVGElementImpl.cc @@ -325,7 +325,7 @@ TQDict &SVGElementImpl::attributes() return m_attributes; } -// khtml overrides +// tdehtml overrides void SVGElementImpl::setAttribute(const DOM::DOMString &name, const DOM::DOMString &value) { m_attributes.replace(name.string(), new DOM::DOMString(value)); diff --git a/ksvg/impl/SVGElementImpl.h b/ksvg/impl/SVGElementImpl.h index a12098ab..011b8b4b 100644 --- a/ksvg/impl/SVGElementImpl.h +++ b/ksvg/impl/SVGElementImpl.h @@ -62,7 +62,7 @@ public: virtual ~SVGElementImpl(); // Attribute setting - // "Override" khtml's functions with ours + // "Override" tdehtml's functions with ours void setAttribute(const DOM::DOMString &name, const DOM::DOMString &value); void setAttributeInternal(const DOM::DOMString &name, const DOM::DOMString &value); DOM::DOMString getAttribute(const DOM::DOMString &name) const; diff --git a/ksvg/impl/SVGEventImpl.cc b/ksvg/impl/SVGEventImpl.cc index e1252af8..b5b79fc9 100644 --- a/ksvg/impl/SVGEventImpl.cc +++ b/ksvg/impl/SVGEventImpl.cc @@ -346,7 +346,7 @@ SVGKeyEventImpl::SVGKeyEventImpl(TQKeyEvent *key, DOM::AbstractView &view, SVGEv qKeyEvent = new TQKeyEvent(key->type(), key->key(), key->ascii(), key->state(), key->text(), key->isAutoRepeat(), key->count()); // Events are supposed to be accepted by default in TQt! - // This line made TQLineEdit's keyevents be ignored, so they were sent to the khtmlview + // This line made TQLineEdit's keyevents be ignored, so they were sent to the tdehtmlview // (and e.g. space would make it scroll down) //qKeyEvent->ignore(); diff --git a/ksvg/plugin/ksvg_factory.h b/ksvg/plugin/ksvg_factory.h index 677bab38..c756bd66 100644 --- a/ksvg/plugin/ksvg_factory.h +++ b/ksvg/plugin/ksvg_factory.h @@ -21,8 +21,8 @@ #ifndef KSVGFactory_H #define KSVGFactory_H -#include -#include +#include +#include class TDEAboutData; class TDEInstance; diff --git a/ksvg/plugin/ksvg_plugin.h b/ksvg/plugin/ksvg_plugin.h index 5b9f4713..405bedaf 100644 --- a/ksvg/plugin/ksvg_plugin.h +++ b/ksvg/plugin/ksvg_plugin.h @@ -22,7 +22,7 @@ #define KSVGPlugin_H #include -#include +#include namespace KSVG { diff --git a/ksvg/test/external/Makefile.am b/ksvg/test/external/Makefile.am index bd6712ab..49648281 100644 --- a/ksvg/test/external/Makefile.am +++ b/ksvg/test/external/Makefile.am @@ -6,8 +6,8 @@ bin_PROGRAMS = svgdisplay printnodetest svgdisplay_SOURCES = SVGTestWidget.cc svgdisplay.cc svgdisplay_LDADD = $(LIB_TDECORE) ../../libksvg.la -svgdisplay_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +svgdisplay_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor printnodetest_SOURCES = printnodetest.cpp printnodetest_LDADD = $(LIB_TDECORE) ../../libksvg.la -printnodetest_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +printnodetest_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor diff --git a/kview/CMakeLists.txt b/kview/CMakeLists.txt index 1d34c3ef..c038f009 100644 --- a/kview/CMakeLists.txt +++ b/kview/CMakeLists.txt @@ -39,5 +39,5 @@ install( FILES kviewui.rc DESTINATION ${DATA_INSTALL_DIR}/kview ) tde_add_tdeinit_executable( kview AUTOMOC SOURCES kview.cpp main.cpp - LINK kparts-shared kutils-shared + LINK tdeparts-shared tdeutils-shared ) diff --git a/kview/config/plugins/CMakeLists.txt b/kview/config/plugins/CMakeLists.txt index ea2652f5..f7c4672a 100644 --- a/kview/config/plugins/CMakeLists.txt +++ b/kview/config/plugins/CMakeLists.txt @@ -29,6 +29,6 @@ install( FILES kviewpluginsconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kc tde_add_kpart( kcm_kviewpluginsconfig AUTOMOC SOURCES kviewpluginsconfig.cpp - LINK kutils-shared + LINK tdeutils-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kview/kimageviewer/CMakeLists.txt b/kview/kimageviewer/CMakeLists.txt index acf28e9b..e910c560 100644 --- a/kview/kimageviewer/CMakeLists.txt +++ b/kview/kimageviewer/CMakeLists.txt @@ -32,6 +32,6 @@ install( FILES tde_add_library( kimageviewer SHARED AUTOMOC SOURCES canvas.cpp viewer.cpp VERSION 0.0.0 - LINK kparts-shared + LINK tdeparts-shared DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/kview/kimageviewer/viewer.h b/kview/kimageviewer/viewer.h index 8920b82c..790a102c 100644 --- a/kview/kimageviewer/viewer.h +++ b/kview/kimageviewer/viewer.h @@ -21,7 +21,7 @@ #ifndef KIMAGEVIEWER_VIEWER_H #define KIMAGEVIEWER_VIEWER_H -#include +#include #include namespace KParts { diff --git a/kview/kview.cpp b/kview/kview.cpp index ee2cf3b5..9aa38524 100644 --- a/kview/kview.cpp +++ b/kview/kview.cpp @@ -25,9 +25,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/kview/kview.h b/kview/kview.h index aed0a54f..dd5bacd7 100644 --- a/kview/kview.h +++ b/kview/kview.h @@ -22,7 +22,7 @@ #include #include -#include +#include namespace KParts { class ReadWritePart; diff --git a/kview/kviewcanvas/CMakeLists.txt b/kview/kviewcanvas/CMakeLists.txt index 019496e3..3b8f4704 100644 --- a/kview/kviewcanvas/CMakeLists.txt +++ b/kview/kviewcanvas/CMakeLists.txt @@ -32,6 +32,6 @@ install( FILES kviewcanvas.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) tde_add_kpart( libkviewcanvas AUTOMOC SOURCES kimageholder.cpp kimagecanvas.cpp - LINK kimageviewer-shared kutils-shared + LINK kimageviewer-shared tdeutils-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kview/kviewcanvas/test/Makefile.am b/kview/kviewcanvas/test/Makefile.am index d00efc03..277bfd48 100644 --- a/kview/kviewcanvas/test/Makefile.am +++ b/kview/kviewcanvas/test/Makefile.am @@ -5,5 +5,5 @@ METASOURCES = AUTO check_PROGRAMS = test test_SOURCES = main.cpp test.cpp -test_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +test_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor test_LDADD = $(LIB_KPARTS) $(top_builddir)/kview/kimageviewer/libkimageviewer.la diff --git a/kview/kviewcanvas/test/test.cpp b/kview/kviewcanvas/test/test.cpp index 3d24cbce..01ac6e43 100644 --- a/kview/kviewcanvas/test/test.cpp +++ b/kview/kviewcanvas/test/test.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include diff --git a/kview/kviewcanvas/test/test.h b/kview/kviewcanvas/test/test.h index 6fe7737b..7a3f80ed 100644 --- a/kview/kviewcanvas/test/test.h +++ b/kview/kviewcanvas/test/test.h @@ -6,7 +6,7 @@ #endif #include -#include +#include namespace KImageViewer { class Canvas; }; diff --git a/kview/kviewviewer/CMakeLists.txt b/kview/kviewviewer/CMakeLists.txt index aea04495..78829f61 100644 --- a/kview/kviewviewer/CMakeLists.txt +++ b/kview/kviewviewer/CMakeLists.txt @@ -35,6 +35,6 @@ tde_add_kpart( libkviewviewer AUTOMOC SOURCES printimagesettings.ui imagesettings.cpp kviewkonqextension.cpp kviewviewer.cpp - LINK kimageviewer-shared kutils-shared tdeprint-shared + LINK kimageviewer-shared tdeutils-shared tdeprint-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kview/kviewviewer/config/CMakeLists.txt b/kview/kviewviewer/config/CMakeLists.txt index 34a7e4a6..d3640df6 100644 --- a/kview/kviewviewer/config/CMakeLists.txt +++ b/kview/kviewviewer/config/CMakeLists.txt @@ -31,6 +31,6 @@ install( FILES tde_add_kpart( kcm_kviewviewerpluginsconfig AUTOMOC SOURCES kviewviewerpluginsconfig.cpp - LINK kutils-shared + LINK tdeutils-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kview/kviewviewer/kviewkonqextension.h b/kview/kviewviewer/kviewkonqextension.h index f49f577d..e46e78f6 100644 --- a/kview/kviewviewer/kviewkonqextension.h +++ b/kview/kviewviewer/kviewkonqextension.h @@ -20,7 +20,7 @@ #ifndef __kviewkonqextension_h__ #define __kviewkonqextension_h__ -#include +#include namespace KImageViewer { class Canvas; } class KViewViewer; diff --git a/kview/kviewviewer/kviewviewer.cpp b/kview/kviewviewer/kviewviewer.cpp index 7db68102..3e3c7085 100644 --- a/kview/kviewviewer/kviewviewer.cpp +++ b/kview/kviewviewer/kviewviewer.cpp @@ -40,9 +40,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -595,7 +595,7 @@ void KViewViewer::slotData( TDEIO::Job *, const TQByteArray & data ) //show partial image XXX: is this really the way to do it? //No. :) It takes forever like this. - //OK. So I really have to look at khtml... + //OK. So I really have to look at tdehtml... //later... //m_pCanvas->setImage( TQImage( m_pBuffer->buffer() ) ); } diff --git a/kview/kviewviewer/test/Makefile.am b/kview/kviewviewer/test/Makefile.am index 65c3527f..197e9cea 100644 --- a/kview/kviewviewer/test/Makefile.am +++ b/kview/kviewviewer/test/Makefile.am @@ -5,5 +5,5 @@ METASOURCES = AUTO check_PROGRAMS = test test_SOURCES = main.cpp test.cpp -test_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +test_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor test_LDADD = $(LIB_KPARTS) diff --git a/kview/kviewviewer/test/test.cpp b/kview/kviewviewer/test/test.cpp index 2bc20372..dfcdc918 100644 --- a/kview/kviewviewer/test/test.cpp +++ b/kview/kviewviewer/test/test.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include diff --git a/kview/kviewviewer/test/test.h b/kview/kviewviewer/test/test.h index ab5d700b..b3a24c91 100644 --- a/kview/kviewviewer/test/test.h +++ b/kview/kviewviewer/test/test.h @@ -6,7 +6,7 @@ #endif #include -#include +#include namespace KParts { class ReadWritePart; } diff --git a/kview/modules/browser/CMakeLists.txt b/kview/modules/browser/CMakeLists.txt index 92be6333..efa48578 100644 --- a/kview/modules/browser/CMakeLists.txt +++ b/kview/modules/browser/CMakeLists.txt @@ -33,6 +33,6 @@ install( FILES tde_add_kpart( kview_browserplugin AUTOMOC SOURCES kmyfileitemlist.cpp kviewbrowser.cpp - LINK kparts-shared + LINK tdeparts-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kview/modules/browser/kviewbrowser.cpp b/kview/modules/browser/kviewbrowser.cpp index 936061eb..ea12d237 100644 --- a/kview/modules/browser/kviewbrowser.cpp +++ b/kview/modules/browser/kviewbrowser.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include diff --git a/kview/modules/browser/kviewbrowser.h b/kview/modules/browser/kviewbrowser.h index 74646b87..985ec564 100644 --- a/kview/modules/browser/kviewbrowser.h +++ b/kview/modules/browser/kviewbrowser.h @@ -20,7 +20,7 @@ #ifndef __kviewbrowser_h #define __kviewbrowser_h -#include +#include #include namespace KImageViewer { class Viewer; } diff --git a/kview/modules/effects/CMakeLists.txt b/kview/modules/effects/CMakeLists.txt index 1ae9d4b6..b871c6ad 100644 --- a/kview/modules/effects/CMakeLists.txt +++ b/kview/modules/effects/CMakeLists.txt @@ -32,6 +32,6 @@ install( FILES tde_add_kpart( kview_effectsplugin AUTOMOC SOURCES kvieweffects.cpp - LINK kparts-shared + LINK tdeparts-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kview/modules/effects/kvieweffects.h b/kview/modules/effects/kvieweffects.h index 711df909..461b9c0f 100644 --- a/kview/modules/effects/kvieweffects.h +++ b/kview/modules/effects/kvieweffects.h @@ -5,7 +5,7 @@ #ifndef KVIEWEFFECTS_H #define KVIEWEFFECTS_H -#include +#include #include namespace KImageViewer { class Viewer; } diff --git a/kview/modules/presenter/CMakeLists.txt b/kview/modules/presenter/CMakeLists.txt index df85ed6c..a34cc893 100644 --- a/kview/modules/presenter/CMakeLists.txt +++ b/kview/modules/presenter/CMakeLists.txt @@ -36,6 +36,6 @@ install( FILES tde_add_kpart( kview_presenterplugin AUTOMOC SOURCES imagelistitem.cpp imagelistdialog.ui kviewpresenter.cpp - LINK kio-shared kparts-shared + LINK kio-shared tdeparts-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kview/modules/presenter/config/CMakeLists.txt b/kview/modules/presenter/config/CMakeLists.txt index 28bb691f..b8dfc56a 100644 --- a/kview/modules/presenter/config/CMakeLists.txt +++ b/kview/modules/presenter/config/CMakeLists.txt @@ -31,6 +31,6 @@ install( FILES tde_add_kpart( kcm_kviewpresenterconfig AUTOMOC SOURCES kviewpresenterconfig.cpp - LINK kutils-shared + LINK tdeutils-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kview/modules/presenter/kviewpresenter.h b/kview/modules/presenter/kviewpresenter.h index fa2cb9c4..2fff82c1 100644 --- a/kview/modules/presenter/kviewpresenter.h +++ b/kview/modules/presenter/kviewpresenter.h @@ -21,7 +21,7 @@ #ifndef __kviewpresenter_h #define __kviewpresenter_h -#include +#include #include #include diff --git a/kview/modules/scale/kview_scale.h b/kview/modules/scale/kview_scale.h index 659a2270..6834cda5 100644 --- a/kview/modules/scale/kview_scale.h +++ b/kview/modules/scale/kview_scale.h @@ -21,7 +21,7 @@ #ifndef __kview_scale_h #define __kview_scale_h -#include +#include namespace KImageViewer { class Viewer; diff --git a/kview/modules/scanner/CMakeLists.txt b/kview/modules/scanner/CMakeLists.txt index aa2f0c8d..e4b4cb67 100644 --- a/kview/modules/scanner/CMakeLists.txt +++ b/kview/modules/scanner/CMakeLists.txt @@ -32,6 +32,6 @@ install( FILES tde_add_kpart( kview_scannerplugin AUTOMOC SOURCES kviewscanner.cpp - LINK kparts-shared + LINK tdeparts-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kview/modules/scanner/kviewscanner.h b/kview/modules/scanner/kviewscanner.h index 5052c591..c34bc0d3 100644 --- a/kview/modules/scanner/kviewscanner.h +++ b/kview/modules/scanner/kviewscanner.h @@ -21,7 +21,7 @@ #ifndef __kviewscanner_h #define __kviewscanner_h -#include +#include #include class KURL; diff --git a/kview/modules/template/kviewtemplate.h b/kview/modules/template/kviewtemplate.h index e8ed567b..68084058 100644 --- a/kview/modules/template/kviewtemplate.h +++ b/kview/modules/template/kviewtemplate.h @@ -5,7 +5,7 @@ #ifndef __kviewtemplate_h #define __kviewtemplate_h -#include +#include namespace KImageViewer { class Viewer; } diff --git a/kview/photobook/CMakeLists.txt b/kview/photobook/CMakeLists.txt index b5d781d8..bb7f2913 100644 --- a/kview/photobook/CMakeLists.txt +++ b/kview/photobook/CMakeLists.txt @@ -31,6 +31,6 @@ install( FILES photobookui.rc DESTINATION ${DATA_INSTALL_DIR}/photobook ) tde_add_kpart( libphotobook AUTOMOC SOURCES photobook.cpp - LINK kparts-shared + LINK tdeparts-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kview/photobook/photobook.cpp b/kview/photobook/photobook.cpp index a08f871a..f90d50dd 100644 --- a/kview/photobook/photobook.cpp +++ b/kview/photobook/photobook.cpp @@ -39,7 +39,7 @@ Copyright (c) 2004,2005 Charles Samuels #include "photobook.h" -#include +#include #include #include #include diff --git a/kview/photobook/photobook.h b/kview/photobook/photobook.h index b7c8ee63..7faaaa32 100644 --- a/kview/photobook/photobook.h +++ b/kview/photobook/photobook.h @@ -43,9 +43,9 @@ Copyright (c) 2004 Charles Samuels #include #include -#include -#include -#include +#include +#include +#include class Previews; class PhotoBookPart; diff --git a/kviewshell/CMakeLists.txt b/kviewshell/CMakeLists.txt index 8a9de930..3ad83e46 100644 --- a/kviewshell/CMakeLists.txt +++ b/kviewshell/CMakeLists.txt @@ -30,13 +30,13 @@ link_directories( ##### headers ################################### install( FILES - kmultipageInterface.h + tdemultipageInterface.h DESTINATION ${INCLUDE_INSTALL_DIR} ) install( FILES anchor.h bookmark.h pageView.h documentPageCache.h documentRenderer.h documentWidget.h history.h hyperlink.h - kmultipage.h length.h pageNumber.h pageSize.h renderedDocumentPage.h + tdemultipage.h length.h pageNumber.h pageSize.h renderedDocumentPage.h renderedDocumentPagePixmap.h renderedDocumentPagePrinter.h selection.h simplePageSize.h textBox.h zoom.h zoomlimits.h DESTINATION ${INCLUDE_INSTALL_DIR}/kviewshell ) @@ -46,7 +46,7 @@ install( FILES install( FILES kviewshell.rc DESTINATION ${DATA_INSTALL_DIR}/kviewshell ) install( FILES kviewerpart.rc DESTINATION ${DATA_INSTALL_DIR}/kviewerpart ) -install( FILES kmultipage.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) +install( FILES tdemultipage.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} ) install( FILES emptymultipage.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) install( FILES kviewshell.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) @@ -67,18 +67,18 @@ tde_add_library( kviewshell STATIC_PIC AUTOMOC ) -##### kmultipage (shared) ####################### +##### tdemultipage (shared) ####################### -tde_add_library( kmultipage SHARED AUTOMOC +tde_add_library( tdemultipage SHARED AUTOMOC SOURCES - kmultipage.cpp pageView.cpp marklist.cpp kmultipageInterface.skel + tdemultipage.cpp pageView.cpp marklist.cpp tdemultipageInterface.skel units.cpp pageSize.cpp simplePageSize.cpp renderedDocumentPage.cpp renderedDocumentPagePixmap.cpp renderedDocumentPagePrinter.cpp documentPageCache.cpp documentWidget.cpp searchWidget.cpp selection.cpp documentRenderer.cpp history.cpp kvsprefs.kcfgc tableOfContents.cpp kprintDialogPage_pageoptions.cpp VERSION 0.0.0 - LINK kparts-shared tdeprint-shared + LINK tdeparts-shared tdeprint-shared DESTINATION ${LIB_INSTALL_DIR} ) @@ -91,7 +91,7 @@ tde_add_kpart( kviewerpart AUTOMOC pageSizeDialog.cpp pageSize.cpp sizePreview.cpp zoom.cpp units.cpp kvsprefs.kcfgc optionDialogGUIWidget_base.ui optionDialogAccessibilityWidget.ui simplePageSize.cpp - LINK ifaces-static kparts-shared + LINK ifaces-static tdeparts-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) @@ -101,7 +101,7 @@ tde_add_kpart( kviewerpart AUTOMOC tde_add_executable( kviewshell AUTOMOC SOURCES main.cpp - LINK kviewshell-static kparts-shared + LINK kviewshell-static tdeparts-shared DESTINATION ${BIN_INSTALL_DIR} ) @@ -111,7 +111,7 @@ tde_add_executable( kviewshell AUTOMOC tde_add_kpart( emptymultipagepart AUTOMOC SOURCES empty_multipage.cpp emptyRenderer.cpp - LINK kmultipage-shared + LINK tdemultipage-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kviewshell/Makefile.am b/kviewshell/Makefile.am index 5be569e4..a9691440 100644 --- a/kviewshell/Makefile.am +++ b/kviewshell/Makefile.am @@ -1,12 +1,12 @@ SUBDIRS = . pics plugins INCLUDES= $(all_includes) -include_HEADERS = kmultipageInterface.h +include_HEADERS = tdemultipageInterface.h ####### Files bin_PROGRAMS = kviewshell -lib_LTLIBRARIES = libkmultipage.la +lib_LTLIBRARIES = libtdemultipage.la kde_module_LTLIBRARIES = kviewerpart.la emptymultipagepart.la noinst_LTLIBRARIES = libifaces.la libkviewshell.la @@ -18,9 +18,9 @@ kviewerpart_la_SOURCES = kviewpart.cpp pageSizeWidget_base.ui \ optionDialogGUIWidget_base.ui optionDialogAccessibilityWidget.ui simplePageSize.cpp kviewerpart_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module -kviewerpart_la_LIBADD = ./libifaces.la $(LIB_KFILE) -lkparts +kviewerpart_la_LIBADD = ./libifaces.la $(LIB_KFILE) -ltdeparts -libkmultipage_la_SOURCES = kmultipage.cpp pageView.cpp marklist.cpp kmultipageInterface.skel \ +libtdemultipage_la_SOURCES = tdemultipage.cpp pageView.cpp marklist.cpp tdemultipageInterface.skel \ units.cpp pageSize.cpp simplePageSize.cpp renderedDocumentPage.cpp renderedDocumentPagePixmap.cpp \ renderedDocumentPagePrinter.cpp documentPageCache.cpp documentWidget.cpp searchWidget.cpp \ selection.cpp documentRenderer.cpp history.cpp kvsprefs.kcfgc tableOfContents.cpp \ @@ -29,21 +29,21 @@ libkmultipage_la_SOURCES = kmultipage.cpp pageView.cpp marklist.cpp kmultipageIn kde_kcfg_DATA = kviewshell.kcfg -libkmultipage_la_LDFLAGS = $(all_libraries) -libkmultipage_la_LIBADD = $(LIB_KFILE) -ltdeprint -lkparts +libtdemultipage_la_LDFLAGS = $(all_libraries) +libtdemultipage_la_LIBADD = $(LIB_KFILE) -ltdeprint -ltdeparts emptymultipagepart_la_SOURCES = empty_multipage.cpp emptyRenderer.cpp emptymultipagepart_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module -emptymultipagepart_la_LIBADD = -lkparts libkmultipage.la +emptymultipagepart_la_LIBADD = -ltdeparts libtdemultipage.la libkviewshell_la_SOURCES = kviewshell.cpp kviewshell_SOURCES = main.cpp -kviewshell_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor -kviewshell_LDADD = libkviewshell.la ./libifaces.la -lkparts +kviewshell_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor +kviewshell_LDADD = libkviewshell.la ./libifaces.la -ltdeparts kviewshellinclude_HEADERS = anchor.h bookmark.h pageView.h documentPageCache.h documentRenderer.h documentWidget.h \ - history.h hyperlink.h kmultipage.h length.h pageNumber.h pageSize.h renderedDocumentPage.h renderedDocumentPagePixmap.h \ + history.h hyperlink.h tdemultipage.h length.h pageNumber.h pageSize.h renderedDocumentPage.h renderedDocumentPagePixmap.h \ renderedDocumentPagePrinter.h selection.h simplePageSize.h textBox.h zoom.h zoomlimits.h kviewshellincludedir = $(includedir)/kviewshell @@ -55,7 +55,7 @@ rcdir = $(kde_datadir)/kviewshell partrc_DATA = kviewerpart.rc partrcdir = $(kde_datadir)/kviewerpart -servicetype_DATA = kmultipage.desktop +servicetype_DATA = tdemultipage.desktop servicetypedir = $(kde_servicetypesdir) kde_services_DATA = emptymultipage.desktop diff --git a/kviewshell/TODO b/kviewshell/TODO index b6139962..4e587fed 100644 --- a/kviewshell/TODO +++ b/kviewshell/TODO @@ -44,7 +44,7 @@ uses that to implement inverse and forward search functionality. We must somehow make sure that even these unusual features fit well into our framework without too much of an effort. -* kmultipage +* tdemultipage - kviewshell should provide a print dialog (with the extra option that certain document formats can insert their own configuration pages). I @@ -70,7 +70,7 @@ applications that demonstrate how everything works. In particular, we should have * lots of documentation, including API documentation and a tutorial on -"How to implement a kmultipage" +"How to implement a tdemultipage" * an exteremely well-defined reference implementation for a trivial file format, either one that is actually useful (kfax, perhaps), or @@ -87,7 +87,7 @@ KVIEWSHELL APPLICATION * improve command line interface. The somewhat antique method of giving the library name in the command line should be replaced by a more modern method where kviewshell uses some kde wizardy -(e.g. 'services') so that installed kmultipage implementations can +(e.g. 'services') so that installed tdemultipage implementations can announce what mime type they are supposed to handle, and kvieshell then loads them automatically diff --git a/kviewshell/empty_multipage.h b/kviewshell/empty_multipage.h index b27fb1b6..5f425ec8 100644 --- a/kviewshell/empty_multipage.h +++ b/kviewshell/empty_multipage.h @@ -21,10 +21,10 @@ #ifndef EMPTY_MULTIPAGE_H #define EMPTY_MULTIPAGE_H -#include "kmultipage.h" +#include "tdemultipage.h" #include "emptyRenderer.h" -#include +#include class EmptyMultiPage : public KMultiPage diff --git a/kviewshell/kmultipage.cpp b/kviewshell/kmultipage.cpp deleted file mode 100644 index 4d544df9..00000000 --- a/kviewshell/kmultipage.cpp +++ /dev/null @@ -1,1976 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "documentWidget.h" -#include "marklist.h" -#include "tableOfContents.h" -#include "kprintDialogPage_pageoptions.h" -#include "kvsprefs.h" -#include "kmultipage.h" -#include "pageNumber.h" -#include "renderedDocumentPagePrinter.h" -#include "searchWidget.h" -#include "textBox.h" -#include "zoomlimits.h" - - -//#define DEBUG_KMULTIPAGE - -KMultiPage::KMultiPage(TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name) - : DCOPObject("kmultipage"), KParts::ReadOnlyPart(parent, name) -{ - // For reasons which I don't understand, the initialization of the - // DCOPObject above does not work properly, the name is ignored. It - // works fine if we repeat the name here. -- Stefan Kebekus - // This is because of the virtual inheritance. Get rid of it (but it's BC, and this is a lib...) -- DF - setObjId("kmultipage"); - - parentWdg = parentWidget; - lastCurrentPage = 0; - timer_id = -1; - searchInProgress = false; - - TQVBox* verticalBox = new TQVBox(parentWidget); - verticalBox->setFocusPolicy(TQ_StrongFocus); - setWidget(verticalBox); - - splitterWidget = new TQSplitter(verticalBox, widgetName); - splitterWidget->setOpaqueResize(false); - splitterWidget->setSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding); - - // Create SideBar - sideBar = new TQToolBox(splitterWidget, "sidebar"); - - // Create ContentsList - tableOfContents = new TableOfContents(sideBar); - sideBar->addItem(tableOfContents, TQIconSet(SmallIcon("contents")), i18n("Contents")); - - connect(tableOfContents, TQT_SIGNAL(gotoPage(const Anchor&)), this, TQT_SLOT(gotoPage(const Anchor&))); - - // Create MarkList - _markList = new MarkList(sideBar, "marklist"); - sideBar->addItem(_markList, TQIconSet(SmallIcon("thumbnail")), i18n("Thumbnails")); - - // Restore state of the sidebar - sideBar->setCurrentItem(sideBar->item(KVSPrefs::sideBarItem())); - - splitterWidget->setResizeMode(sideBar, TQSplitter::KeepSize); - - connect(_markList, TQT_SIGNAL(selected(const PageNumber&)), this, TQT_SLOT(gotoPage(const PageNumber&))); - - _scrollView = new PageView(splitterWidget, widgetName); - - // Create Search Panel - searchWidget = new SearchWidget(verticalBox); - searchWidget->hide(); - connect(searchWidget, TQT_SIGNAL(findNextText()), this, TQT_SLOT(findNextText())); - connect(searchWidget, TQT_SIGNAL(findPrevText()), this, TQT_SLOT(findPrevText())); - - sideBar->setMinimumWidth(80); - sideBar->setMaximumWidth(300); - - connect(_scrollView, TQT_SIGNAL(currentPageChanged(const PageNumber&)), this, TQT_SLOT(setCurrentPageNumber(const PageNumber&))); - connect(_scrollView, TQT_SIGNAL(viewSizeChanged(const TQSize&)), scrollView(), TQT_SLOT(calculateCurrentPageNumber())); - connect(_scrollView, TQT_SIGNAL(wheelEventReceived(TQWheelEvent *)), this, TQT_SLOT(wheelEvent(TQWheelEvent*))); - - connect(this, TQT_SIGNAL(enableMoveTool(bool)), _scrollView, TQT_SLOT(slotEnableMoveTool(bool))); - - splitterWidget->setCollapsible(sideBar, false); - splitterWidget->setSizes(KVSPrefs::guiLayout()); - - connect(searchWidget, TQT_SIGNAL(searchEnabled(bool)), this, TQT_SIGNAL(searchEnabled(bool))); - connect(searchWidget, TQT_SIGNAL(stopSearch()), this, TQT_SLOT(stopSearch())); -} - - -KMultiPage::~KMultiPage() -{ - writeSettings(); - - if (timer_id != -1) - killTimer(timer_id); - - delete pageCache; -} - -void KMultiPage::readSettings() -{ -} - -void KMultiPage::writeSettings() -{ - // Save TOC layout - tableOfContents->writeSettings(); - - KVSPrefs::setGuiLayout(splitterWidget->sizes()); - // Save state of the sidebar - KVSPrefs::setSideBarItem(sideBar->indexOf(sideBar->currentItem())); - KVSPrefs::writeConfig(); -} - -TQString KMultiPage::name_of_current_file() -{ - return m_file; -} - -bool KMultiPage::is_file_loaded(const TQString& filename) -{ - return (filename == m_file); -} - -void KMultiPage::slotSave_defaultFilename() -{ - slotSave(); -} - -void KMultiPage::slotSave() -{ - // Try to guess the proper ending... - TQString formats; - TQString ending; - int rindex = m_file.findRev("."); - if (rindex == -1) { - ending = TQString(); - formats = TQString(); - } else { - ending = m_file.mid(rindex); // e.g. ".dvi" - formats = fileFormats().grep(ending).join("\n"); - } - - TQString fileName = KFileDialog::getSaveFileName(TQString(), formats, 0, i18n("Save File As")); - - if (fileName.isEmpty()) - return; - - // Add the ending to the filename. I hope the user likes it that - // way. - if (!ending.isEmpty() && fileName.find(ending) == -1) - fileName = fileName+ending; - - if (TQFile(fileName).exists()) { - int r = KMessageBox::warningContinueCancel (0, i18n("The file %1\nexists. Shall I overwrite that file?").arg(fileName), - i18n("Overwrite File"), i18n("Overwrite")); - if (r == KMessageBox::Cancel) - return; - } - - TDEIO::Job *job = TDEIO::file_copy( KURL( m_file ), KURL( fileName ), 0600, true, false, true ); - connect( job, TQT_SIGNAL( result( TDEIO::Job * ) ), this, TQT_SLOT( slotIOJobFinished ( TDEIO::Job * ) ) ); - - return; -} - - -void KMultiPage::setFile(bool) -{ - return; -} - - -bool KMultiPage::closeURL() -{ -#ifdef DEBUG_KMULTIPAGE - kdDebug(1233) << "KMultiPage::closeURL()" << endl; -#endif - - if (renderer.isNull()) - return false; - - // Clear navigation history. - document_history.clear(); - - // Close the file. - renderer->setFile(TQString(), KURL()); - renderer->clear(); - - // Delete Page Widgets. - widgetList.setAutoDelete(true); - widgetList.resize(0); - widgetList.setAutoDelete(false); - - // Update ScrollView. - scrollView()->layoutPages(); - enableActions(false); - - // Clear Thumbnail List. - markList()->clear(); - - // Clear Table of Contents - tableOfContents->clear(); - - // Clear Status Bar - emit setStatusBarText(TQString()); - - return true; -} - -void KMultiPage::slotIOJobFinished ( TDEIO::Job *job ) -{ - if ( job->error() ) - job->showErrorDialog( 0L ); -} - -void KMultiPage::slotShowScrollbars(bool status) -{ - _scrollView->slotShowScrollbars(status); -} - -void KMultiPage::slotShowSidebar(bool show) -{ - if (show) - sideBar->show(); - else - sideBar->hide(); -} - -void KMultiPage::slotShowThumbnails(bool show) -{ - markList()->slotShowThumbnails(show); -} - -void KMultiPage::slotSetFullPage(bool fullpage) -{ - _scrollView->setFullScreenMode(fullpage); - if (fullpage) - slotShowSidebar(false); -} - -void KMultiPage::preferencesChanged() -{ - // We need to read the config options otherwise the KVSPrefs-object would - // not be syncronized between the kviewpart and the kmultipage. - KVSPrefs::self()->readConfig(); - - slotShowThumbnails(KVSPrefs::showThumbnails()); - - // if we are in overviewmode and the number of columns or rows has changed - if (scrollView()->overviewMode() && - (scrollView()->getNrColumns() != KVSPrefs::overviewModeColumns() || - scrollView()->getNrRows() != KVSPrefs::overviewModeRows())) - { - setViewMode(KVSPrefs::EnumViewMode::Overview); - } - - if (KVSPrefs::changeColors() && KVSPrefs::renderMode() == KVSPrefs::EnumRenderMode::Paper) - renderer->setAccessibleBackground(true, KVSPrefs::paperColor()); - else - renderer->setAccessibleBackground(false); - - renderModeChanged(); -} - -void KMultiPage::setViewMode(int mode) -{ -#ifdef DEBUG_KMULTIPAGE - kdDebug(1233) << "KMultiPage::setViewMode(" << mode << ")" << endl; -#endif - // Save the current page number because when we are changing the columns - // and rows in the scrollview the currently shown Page probably out of view. - PageNumber currentPage = currentPageNumber(); - - // Save viewMode for future uses of KViewShell - switch (mode) - { - case KVSPrefs::EnumViewMode::SinglePage: - KVSPrefs::setViewMode(KVSPrefs::EnumViewMode::SinglePage); - - // Don't do anything if the view mode is already set - if ((scrollView()->getNrColumns() == 1) && (scrollView()->getNrRows() == 1) && (scrollView()->isContinuous() == false)) - return; - - scrollView()->setNrColumns(1); - scrollView()->setNrRows(1); - scrollView()->setContinuousViewMode(false); - // We scroll the view to the top, so that top and not the bottom - // of the visible page is shown. - scrollView()->scrollTop(); - break; - case KVSPrefs::EnumViewMode::ContinuousFacing: - KVSPrefs::setViewMode(KVSPrefs::EnumViewMode::ContinuousFacing); - - // Don't do anything if the view mode is already set - if ((scrollView()->getNrColumns() == 2) && (scrollView()->getNrRows() == 1) && (scrollView()->isContinuous() == true)) - return; - - scrollView()->setNrColumns(2); - scrollView()->setNrRows(1); - scrollView()->setContinuousViewMode(true); - break; - case KVSPrefs::EnumViewMode::Overview: - KVSPrefs::setViewMode(KVSPrefs::EnumViewMode::Overview); - - // Don't do anything if the view mode is already set - if ((scrollView()->getNrColumns() == KVSPrefs::overviewModeColumns()) && (scrollView()->getNrRows() == KVSPrefs::overviewModeRows()) && (scrollView()->isContinuous() == false)) - return; - - scrollView()->setNrColumns(KVSPrefs::overviewModeColumns()); - scrollView()->setNrRows(KVSPrefs::overviewModeRows()); - scrollView()->setContinuousViewMode(false); - // We scroll the view to the top, so that top and not the bottom - // of the visible tableau is shown. - scrollView()->scrollTop(); - break; - default: //KVSPrefs::EnumViewMode::Continuous - KVSPrefs::setViewMode(KVSPrefs::EnumViewMode::Continuous); - - // Don't do anything if the view mode is already set - if ((scrollView()->getNrColumns() == 1) && (scrollView()->getNrRows() == 1) && (scrollView()->isContinuous() == true)) - return; - - scrollView()->setNrColumns(1); - scrollView()->setNrRows(1); - scrollView()->setContinuousViewMode(true); - } - generateDocumentWidgets(currentPage); - KVSPrefs::writeConfig(); - emit viewModeChanged(); -} - -void KMultiPage::initializePageCache() -{ - pageCache = new DocumentPageCache(); -} - -DocumentWidget* KMultiPage::createDocumentWidget() -{ - DocumentWidget* documentWidget = new DocumentWidget(scrollView()->viewport(), scrollView(), pageCache, "singlePageWidget"); - connect(documentWidget, TQT_SIGNAL(clearSelection()), this, TQT_SLOT(clearSelection())); - connect(this, TQT_SIGNAL(enableMoveTool(bool)), documentWidget, TQT_SLOT(slotEnableMoveTool(bool))); - return documentWidget; -} - - -void KMultiPage::generateDocumentWidgets(const PageNumber& _startPage) -{ - PageNumber startPage = _startPage; -#ifdef DEBUG_KMULTIPAGE - kdDebug(1233) << "KMultiPage::generateDocumentWidgets(" << startPage << ")" << endl; -#endif - - // Do nothing if no document is loaded. - if (getRenderer().isNull() || getRenderer()->isEmpty()) - return; - - // This function is only called with an invalid pagenumber, when - // the file has been loaded or reloaded. - bool reload = !startPage.isValid(); - - if (reload) - { - // Find the number of the current page, for later use. - startPage = currentPageNumber(); - } - - // Make sure that startPage is in the permissible range. - if (startPage < 1) - startPage = 1; - if (startPage > numberOfPages()) - startPage = numberOfPages(); - - unsigned int tableauStartPage = startPage; - - // Find out how many widgets are needed, and resize the widgetList accordingly. - widgetList.setAutoDelete(true); - TQ_UINT16 oldwidgetListSize = widgetList.size(); - if (numberOfPages() == 0) - widgetList.resize(0); - else - { - switch (KVSPrefs::viewMode()) - { - case KVSPrefs::EnumViewMode::SinglePage: - widgetList.resize(1); - break; - case KVSPrefs::EnumViewMode::Overview: - { - // Calculate the number of pages shown in overview mode. - unsigned int visiblePages = KVSPrefs::overviewModeColumns() * KVSPrefs::overviewModeRows(); - // Calculate the number of the first page in the tableau. - tableauStartPage = startPage - ((startPage - 1) % visiblePages); - // We cannot have more widgets then pages in the document. - visiblePages = TQMIN(visiblePages, numberOfPages() - tableauStartPage + 1); - if (widgetList.size() != visiblePages) - widgetList.resize(visiblePages); - break; - } - default: - // In KVS_Continuous and KVS_ContinuousFacing all pages in the document are shown. - widgetList.resize(numberOfPages()); - } - } - bool isWidgetListResized = (widgetList.size() != oldwidgetListSize); - widgetList.setAutoDelete(false); - - // If the widgetList is empty, there is nothing left to do. - if (widgetList.size() == 0) { - scrollView()->addChild(&widgetList); - return; - } - - // Allocate DocumentWidget structures so that all entries of - // widgetList point to a valid DocumentWidget. - DocumentWidget *documentWidget; - for(TQ_UINT16 i=0; ishow(); - - connect(documentWidget, TQT_SIGNAL(localLink(const TQString &)), this, TQT_SLOT(handleLocalLink(const TQString &))); - connect(documentWidget, TQT_SIGNAL(setStatusBarText(const TQString&)), this, TQT_SIGNAL(setStatusBarText(const TQString&)) ); - } - } - - // Set the page numbers for the newly allocated widgets. How this is - // done depends on the viewMode. - if (KVSPrefs::viewMode() == KVSPrefs::EnumViewMode::SinglePage) { - // In KVS_SinglePage mode, any number between 1 and the maximum - // number of pages is acceptable. If an acceptable value is found, - // nothing is done, and otherwise '1' is set as a default. - documentWidget = widgetList[0]; - if (documentWidget != 0) { // Paranoia safety check - documentWidget->setPageNumber(startPage); - documentWidget->update(); - } else - kdError(4300) << "Zero-Pointer in widgetList in KMultiPage::generateDocumentWidgets()" << endl; - } else { - // In all other modes, the widgets will be numbered continuously, - // starting from firstShownPage. - for(TQ_UINT16 i=0; isetPageNumber(i+tableauStartPage); - else - documentWidget->setPageNumber(i+1); - } - else - kdError(4300) << "Zero-Pointer in widgetList in KMultiPage::generateDocumentWidgets()" << endl; - } - } - - // Make the changes in the widgetList known to the scrollview. so - // that the scrollview may update its contents. - scrollView()->addChild(&widgetList); - - // If the number of widgets has changed, or the viewmode has been changed the widget - // that displays the current page may not be visible anymore. Bring it back into focus. - if (isWidgetListResized || !reload) - gotoPage(startPage); -} - - -bool KMultiPage::gotoPage(const PageNumber& page) -{ - return gotoPage(page, 0, true); -} - - -bool KMultiPage::gotoPage(const PageNumber& page, int y, bool isLink) -{ -#ifdef DEBUG_KMULTIPAGE - kdDebug(1233) << "KMultiPage::gotoPage()" << endl; -#endif - - if (widgetList.size() == 0) { - kdError(4300) << "KMultiPage::gotoPage(" << page << ", y) called, but widgetList is empty" << endl; - return false; - } - - if (!page.isValid()) - { - kdDebug(1223) << "KMultiPage::gotoPage(" << page << ") invalid pageNumber." << endl; - return false; - } - - if (isLink) - document_history.add(page, y); - - DocumentWidget* pageWidget; - - // If we are in overview viewmode - if (KVSPrefs::viewMode() == KVSPrefs::EnumViewMode::Overview) - { - unsigned int visiblePages = KVSPrefs::overviewModeColumns() * KVSPrefs::overviewModeRows(); - // Pagenumber of the first visibile Page in the current tableau - unsigned int firstPage = ((DocumentWidget*)widgetList[0])->getPageNumber(); - // Pagenumber of the first page in the new tableau. - unsigned int tableauStartPage = page + 1 - (page % visiblePages); - // If these numbers arn't equal "page" is not in the current tableu. - if (firstPage != tableauStartPage) // widgets need to be updated - { - if ((numberOfPages() - tableauStartPage + 1 < visiblePages) || (widgetList.size() < visiblePages)) - { - // resize widgetList - // the pages are also set correctly by "generateDocumentWidgets" - generateDocumentWidgets(tableauStartPage); - } - else - { - // "page" is not shown in the scrollview, so we have to switch widgets. - // Here we don't need to resize the widgetList. - for (unsigned int i = 0; i < widgetList.size(); i++) - { - pageWidget = (DocumentWidget*)(widgetList[i]); - if (pageWidget != 0) - pageWidget->setPageNumber(tableauStartPage + i); - } - scrollView()->layoutPages(); - } - } - // move scrollview to "page". - // Make the widget pageWidget visible in the scrollview. Somehow this - // doesn't seem to trigger the signal contentsMoved in the - // TQScrollview, so that we better call setCurrentPage() ourselves. - pageWidget = (DocumentWidget*)(widgetList[page % visiblePages]); - - scrollView()->moveViewportToWidget(pageWidget, y); - - // Set current page number. - setCurrentPageNumber(page); - - return true; - } - else if (widgetList.size() == 1) - { - // If the widget list contains only a single element, then either - // the document contains only one page, or we are in "single page" - // view mode. In either case, we set the page number of the single - // widget to 'page' - pageWidget = (DocumentWidget*)(widgetList[0]); - - // Paranoia security check - if (pageWidget == 0) { - kdError(4300) << "KMultiPage::goto_Page() called with widgetList.size() == 1, but widgetList[0] == 0" << endl; - return false; - } - - if (pageCache->sizeOfPageInPixel(currentPageNumber()) == pageCache->sizeOfPageInPixel(page)) - { - // We are rendering the page before we switch the widget to the new page. - // To make a smooth transition. We only do this if the size of the current and new page are equal, - // otherwise we would have to render the page twice, if autozoom is enabled. - pageCache->getPage(page); - } - - pageWidget->setPageNumber(page); - scrollView()->layoutPages(); - scrollView()->moveViewportToWidget(pageWidget, y); - } else { - // There are multiple widgets, then we are either in the - // "Continuous" or in the "Continouous-Facing" view mode. In that - // case, we find the widget which is supposed to display page - // 'page' and move the scrollview to make it visible - - // Paranoia security checks - if (widgetList.size() < page) { - kdError(4300) << "KMultiPage::goto_Page(page,y ) called with widgetList.size()=" << widgetList.size() << ", and page=" << page << endl; - return false; - } - pageWidget = (DocumentWidget*)(widgetList[page-1]); - if (pageWidget == 0) { - kdError(4300) << "KMultiPage::goto_Page() called with widgetList.size() > 1, but widgetList[page] == 0" << endl; - return false; - } - - scrollView()->moveViewportToWidget(pageWidget, y); - } - - if (isLink && y != 0) - pageWidget->flash(y); - - // Set current page number. - setCurrentPageNumber(page); - return true; -} - - -void KMultiPage::handleLocalLink(const TQString &linkText) -{ -#ifdef DEBUG_SPECIAL - kdDebug(4300) << "hit: local link to " << linkText << endl; -#endif - - if (renderer.isNull()) { - kdError(4300) << "KMultiPage::handleLocalLink( " << linkText << " ) called, but renderer==0" << endl; - return; - } - - TQString locallink; - if (linkText[0] == '#' ) - locallink = linkText.mid(1); // Drop the '#' at the beginning - else - locallink = linkText; - - Anchor anch = renderer->findAnchor(locallink); - - if (anch.isValid()) - gotoPage(anch); - else { - if (linkText[0] != '#' ) { - // We could in principle use TDEIO::Netaccess::run() here, but - // it is perhaps not a very good idea to allow a DVI-file to - // specify arbitrary commands, such as "rm -rvf /". Using - // the kfmclient seems to be MUCH safer. - TQUrl DVI_Url(m_file); - TQUrl Link_Url(DVI_Url, linkText, true); - - TQStringList args; - args << "openURL"; - args << Link_Url.toString(); - kapp->tdeinitExec("kfmclient", args); - } - } -} - -void KMultiPage::setCurrentPageNumber(const PageNumber& page) -{ -#ifdef DEBUG_KMULTIPAGE - kdDebug(1233) << "KMultiPage::setCurrentPageNumber()" << endl; -#endif - - if (page != currentPageNumber()) - { - markList()->setCurrentPageNumber(page); - emit pageInfo(numberOfPages(), currentPageNumber()); - } -} - -PageNumber KMultiPage::currentPageNumber() -{ - return markList()->currentPageNumber(); -} - -void KMultiPage::doGoBack() -{ - HistoryItem *it = document_history.back(); - if (it != 0) - gotoPage(it->page, it->ypos, false); // Do not add a history item. - else - kdDebug(4300) << "Faulty return -- bad history buffer" << endl; - return; -} - - -void KMultiPage::doGoForward() -{ - HistoryItem *it = document_history.forward(); - if (it != 0) - gotoPage(it->page, it->ypos, false); // Do not add a history item. - else - kdDebug(4300) << "Faulty return -- bad history buffer" << endl; - return; -} - - -void KMultiPage::renderModeChanged() -{ - pageCache->clear(); - - generateDocumentWidgets(); - scrollView()->layoutPages(); - - for (TQ_UINT16 i=0; i < widgetList.size(); i++) - { - DocumentWidget* documentWidget = widgetList[i]; - if (documentWidget == 0) - continue; - - documentWidget->update(); - } - - markList()->repaintThumbnails(); -} - - -void KMultiPage::repaintAllVisibleWidgets() -{ -#ifdef DEBUG_KMULTIPAGE - kdDebug(1233) << "KMultiPage::repaintAllVisibleWidgets()" << endl; -#endif - - bool everResized = false; - - // Go through the list of widgets and resize them, if necessary - for(TQ_UINT16 i=0; isizeOfPageInPixel(documentWidget->getPageNumber()); - if (pageSize != documentWidget->pageSize()) - { - documentWidget->setPageSize(pageSize); - everResized = true; - } - } - - // If at least one widget was resized, all widgets should be - // re-aligned. This will automatically update all necessary - // widgets. - if (everResized == true) - scrollView()->layoutPages(true); -} - - -double KMultiPage::setZoom(double zoom) -{ -#ifdef DEBUG_KMULTIPAGE - kdDebug(1233) << "KMultiPage::setZoom(" << zoom << ")" << endl; -#endif - - if (zoom < ZoomLimits::MinZoom/1000.0) - zoom = ZoomLimits::MinZoom/1000.0; - if (zoom > ZoomLimits::MaxZoom/1000.0) - zoom = ZoomLimits::MaxZoom/1000.0; - - pageCache->setResolution(TQPaintDevice::x11AppDpiX()*zoom); - emit zoomChanged(); - return zoom; -} - - -void KMultiPage::print() -{ - // Paranoid safety checks - if (renderer.isNull()) - return; - if (renderer->isEmpty()) - return; - - // Allocate the printer structure - KPrinter *printer = getPrinter(); - if (printer == 0) - return; - - // initialize the printer using the print dialog - if ( printer->setup(parentWdg, i18n("Print %1").arg(m_file.section('/', -1))) ) { - // Now do the printing. - TQValueList pageList = printer->pageList(); - if (pageList.isEmpty()) - printer->abort(); - else { - printer->setCreator("kviewshell"); - printer->setDocName(m_file); - RenderedDocumentPagePrinter rdpp(printer); - - // Obtain papersize information that is required to perform - // the resizing and centering, if this is wanted by the user. - Length paperWidth, paperHeight; - TQPaintDeviceMetrics pdm(printer); - paperWidth.setLength_in_mm(pdm.widthMM()); - paperHeight.setLength_in_mm(pdm.heightMM()); - - TQValueList::ConstIterator it = pageList.begin(); - while (true) { - SimplePageSize paper_s(paperWidth, paperHeight); - - // Printing usually takes a while. This is to keep the GUI - // updated. - tqApp->processEvents(); - - TQPainter *paint = rdpp.getPainter(); - if (paint != 0) { - // Before drawing the page, we figure out the zoom-value, - // taking the "page sizes and placement" options from the - // printer dialog into account - double factual_zoom = 1.0; - - // Obtain pagesize information that is required to perform the - // resizing and centering, if this is wanted by the user. - SimplePageSize page_s = sizeOfPage(*it); - - paint->save(); - - // Rotate the page, if appropriate. By default, page - // rotation is enabled. This is also hardcoded into - // KPrintDialogPage_PageOptions.cpp - if ((page_s.isPortrait() != paper_s.isPortrait()) && (printer->option( "kde-kviewshell-rotatepage" ) != "false")) { - paint->rotate(-90); - paint->translate(-printer->resolution()*paperHeight.getLength_in_inch(), 0.0); - paper_s = paper_s.rotate90(); - } - - double suggested_zoom = page_s.zoomToFitInto(paper_s); - - // By default, "shrink page" and "expand page" are off. This - // is also hardcoded into KPrintDialogPage_PageOptions.cpp - if ((suggested_zoom < 1.0) && (printer->option( "kde-kviewshell-shrinkpage" ) == "true")) - factual_zoom = suggested_zoom; - if ((suggested_zoom > 1.0) && (printer->option( "kde-kviewshell-expandpage" ) == "true")) - factual_zoom = suggested_zoom; - - Length delX, delY; - // By default, "center page" is on. This is also hardcoded - // into KPrintDialogPage_PageOptions.cpp - if (printer->option( "kde-kviewshell-centerpage" ) != "false") { - delX = (paper_s.width() - page_s.width()*factual_zoom)/2.0; - delY = (paper_s.height() - page_s.height()*factual_zoom)/2.0; - } - - // Now draw the page. - rdpp.setPageNumber(*it); - - double resolution = factual_zoom*printer->resolution(); - - paint->translate(resolution*delX.getLength_in_inch(), resolution*delY.getLength_in_inch()); - renderer->drawPage(resolution, &rdpp); - paint->restore(); - } - ++it; - if ((it == pageList.end()) || (printer->aborted() == true)) - break; - - printer->newPage(); - } - // At this point the rdpp is destructed. The last page is then - // printed. - } - } - delete printer; -} - - -void KMultiPage::setRenderer(DocumentRenderer* _renderer) -{ - renderer = _renderer; - - // Initialize documentPageCache. - initializePageCache(); - pageCache->setRenderer(renderer); - - _markList->setPageCache(pageCache); - - // Clear widget list. - widgetList.resize(0); - - // Relay signals. - connect(renderer, TQT_SIGNAL(setStatusBarText(const TQString&)), this, TQT_SIGNAL(setStatusBarText(const TQString&))); - connect(pageCache, TQT_SIGNAL(paperSizeChanged()), this, TQT_SLOT(renderModeChanged())); - connect(pageCache, TQT_SIGNAL(textSelected(bool)), this, TQT_SIGNAL(textSelected(bool))); - connect(renderer, TQT_SIGNAL(documentIsChanged()), this, TQT_SLOT(renderModeChanged())); - connect(this, TQT_SIGNAL(zoomChanged()), this, TQT_SLOT(repaintAllVisibleWidgets())); -} - - -void KMultiPage::updateWidgetSize(const PageNumber& pageNumber) -{ - for(TQ_UINT16 i=0; igetPageNumber() == pageNumber) - { - // Resize, if necessary - TQSize pageSize = pageCache->sizeOfPageInPixel(documentWidget->getPageNumber()); - if (pageSize != documentWidget->pageSize()) - { - documentWidget->setPageSize(pageSize); - scrollView()->layoutPages(); - } - // We have just one widget per page. - break; - } - } - - // Update marklist - markList()->updateWidgetSize(pageNumber); -} - - -PageNumber KMultiPage::widestPage() const -{ - Length maxWidth; - PageNumber pageNumber = 1; - - for (int i = 1; i <= numberOfPages(); i++) - { - Length width = pageCache->sizeOfPage(i).width(); - - if (width > maxWidth) - { - maxWidth = width; - pageNumber = i; - } - } - - return pageNumber; -} - -double KMultiPage::zoomForWidthColumns(unsigned int viewportWidth) const -{ - Length maxLeftColumnWidth; - Length maxRightColumnWidth; - Length maxWidth; - - PageNumber widestPageLeft; - PageNumber widestPageRight; - - for (int i = 1; i <= numberOfPages(); i++) - { - Length width = pageCache->sizeOfPage(i).width(); - - if ( i % 2 == 0) // page is in left column - { - if (width > maxLeftColumnWidth) - { - maxLeftColumnWidth = width; - widestPageLeft = i; - } - } - - if ( i % 2 == 1) // page is in right column - { - if (width > maxRightColumnWidth) - maxRightColumnWidth = width; - widestPageRight = i; - } - } - - double ratio = maxLeftColumnWidth / (maxLeftColumnWidth + maxRightColumnWidth); - - // This number is the amount of space the left column should occupy in the viewport. - unsigned int leftTargetWidth = (unsigned int)(ratio * viewportWidth); - - return pageCache->sizeOfPage(widestPageLeft).zoomForWidth(leftTargetWidth); -} - -double KMultiPage::calculateFitToHeightZoomValue() -{ - PageNumber pageNumber = 1; - - // See below, in the documentation of the method "calculatefitToWidthZoomLevel" - // for an explanation of the complicated calculation we are doing here. - int columns = scrollView()->getNrColumns(); - int rows = scrollView()->getNrRows(); - int continuousViewmode = scrollView()->isContinuous(); - bool fullScreenMode = scrollView()->fullScreenMode(); - - if (columns == 1 && rows == 1 && !continuousViewmode) // single page mode - { - pageNumber = currentPageNumber(); - if (!pageNumber.isValid()) - pageNumber = 1; - } - - int pageDistance = scrollView()->distanceBetweenPages(); - if (columns == 1 && rows == 1 && !continuousViewmode && fullScreenMode) - { - // In Single Page Fullscreen Mode we want to fit the page to the - // window without a margin around it. - pageDistance = 0; - } - - int targetViewportHeight = scrollView()->viewportSize(0,0).height(); - int targetPageHeight = (targetViewportHeight - rows*pageDistance)/rows; - int targetPageWidth = (int)(targetPageHeight * pageCache->sizeOfPage(pageNumber).aspectRatio() ); - int targetViewportWidth = targetPageWidth * columns + (columns+1)*pageDistance; - targetViewportHeight = scrollView()->viewportSize(targetViewportWidth, targetViewportHeight).height(); - targetPageHeight = (targetViewportHeight - rows*pageDistance)/rows; - - return pageCache->sizeOfPage(pageNumber).zoomForHeight(targetPageHeight); -} - - -double KMultiPage::calculateFitToWidthZoomValue() -{ - PageNumber pageNumber = 1; - - int columns = scrollView()->getNrColumns(); - int rows = scrollView()->getNrRows(); - int continuousViewmode = scrollView()->isContinuous(); - bool fullScreenMode = scrollView()->fullScreenMode(); - - if (columns == 1 && rows == 1 && !continuousViewmode) // single page mode - { - // To calculate the zoom level in single page mode we need the size - // of the current page. When a new document is opened this function - // is called while the currentPageNumber is invalid. We use the size - // of the first page of the document in this case. - pageNumber = currentPageNumber(); - if (!pageNumber.isValid()) - pageNumber = 1; - } - - if (columns == 1 && rows == 1 && continuousViewmode) // continuous viewmode - { - pageNumber = widestPage(); - if (!pageNumber.isValid()) - pageNumber = 1; - } - - // rows should be 1 for Single Page Viewmode, - // the number of Pages in Continuous Viewmode - // and number of Pages/2 in Continuous-Facing Viewmode - if (continuousViewmode) - rows = (int)(ceil(numberOfPages() / (double)columns)); - - int pageDistance = scrollView()->distanceBetweenPages(); - if (columns == 1 && rows == 1 && !continuousViewmode && fullScreenMode) - { - // In Single Page Fullscreen Mode we want to fit the page to the - // window without a margin around it. - pageDistance = 0; - } - // There is a slight complication here... if we just take the width - // of the viewport and scale the contents by a factor x so that it - // fits the viewport exactly, then, depending on chosen papersize - // (landscape, etc.), the contents may be higher than the viewport - // and the TQScrollview may or may not insert a scrollbar at the - // right. If the scrollbar appears, then the usable width of the - // viewport becomes smaller, and scaling by x does not really fit - // the (now smaller page) anymore. - - // Calculate the width and height of the view, disregarding the - // possible complications with scrollbars, e.g. assuming the maximal - // space is available. - - // width of the widget excluding possible scrollbars - int targetViewportWidth = scrollView()->viewportSize(0,0).width(); - - // maximal width of a single page - int targetPageWidth = (targetViewportWidth - (columns+1) * pageDistance) / columns; - - // maximal height of a single page - int targetPageHeight = (int)(targetPageWidth/pageCache->sizeOfPage(pageNumber).aspectRatio()); - // FIXME: this is only correct if all pages in the document have the same height - int targetViewportHeight = rows * targetPageHeight + (rows+1) * pageDistance; - - // Think again, this time use only the area which is really - // acessible (which, in case that targetWidth targetHeight don't fit - // the viewport, is really smaller because of the scrollbars). - targetViewportWidth = scrollView()->viewportSize(targetViewportWidth, targetViewportHeight).width(); - - if (columns == 2 && continuousViewmode) // continuous facing - { - // TODO Generalize this for more than 2 columns - return zoomForWidthColumns(targetViewportWidth - (columns+1) * pageDistance); - } - - // maximal width of a single page (now the scrollbars are taken into account) - targetPageWidth = (targetViewportWidth - (columns+1) * pageDistance) / columns; - - return pageCache->sizeOfPage(pageNumber).zoomForWidth(targetPageWidth); -} - - -void KMultiPage::prevPage() -{ - TQ_UINT8 cols = scrollView()->getNrColumns(); - TQ_UINT8 rows = scrollView()->getNrRows(); - - PageNumber np = 1; - if (cols*rows < currentPageNumber()) - { - np = currentPageNumber() - cols*rows; - } - - gotoPage(np); -} - - -void KMultiPage::nextPage() -{ - TQ_UINT8 cols = scrollView()->getNrColumns(); - TQ_UINT8 rows = scrollView()->getNrRows(); - - PageNumber np = TQMIN(currentPageNumber() + cols*rows, (TQ_UINT16)numberOfPages()); - - gotoPage(np); -} - - -void KMultiPage::firstPage() -{ - gotoPage(1); -} - - -void KMultiPage::lastPage() -{ - gotoPage(numberOfPages()); -} - - -void KMultiPage::scroll(TQ_INT32 deltaInPixel) -{ - TQScrollBar* scrollBar = scrollView()->verticalScrollBar(); - if (scrollBar == 0) { - kdError(4300) << "KMultiPage::scroll called without scrollBar" << endl; - return; - } - - if (deltaInPixel < 0) { - if (scrollBar->value() == scrollBar->minValue()) { - if ( (currentPageNumber() == 1) || (changePageDelayTimer.isActive()) ) - return; - - if (scrollView()->isContinuous()) - return; - - changePageDelayTimer.stop(); - prevPage(); - - scrollView()->setContentsPos(scrollView()->contentsX(), scrollBar->maxValue()); - return; - } - } - - if (deltaInPixel > 0) { - if (scrollBar->value() == scrollBar->maxValue()) { - if ( (currentPageNumber() == numberOfPages()) || (changePageDelayTimer.isActive()) ) - return; - - if (scrollView()->isContinuous()) - return; - - changePageDelayTimer.stop(); - nextPage(); - - scrollView()->setContentsPos(scrollView()->contentsX(), 0); - return; - } - } - - scrollBar->setValue(scrollBar->value() + deltaInPixel); - - if ( (scrollBar->value() == scrollBar->maxValue()) || (scrollBar->value() == scrollBar->minValue()) ) - changePageDelayTimer.start(200,true); - else - changePageDelayTimer.stop(); -} - - -void KMultiPage::scrollUp() -{ - TQScrollBar* scrollBar = scrollView()->verticalScrollBar(); - if (scrollBar == 0) - return; - - scroll(-scrollBar->lineStep()); -} - - -void KMultiPage::scrollDown() -{ - TQScrollBar* scrollBar = scrollView()->verticalScrollBar(); - if (scrollBar == 0) - return; - - scroll(scrollBar->lineStep()); -} - -void KMultiPage::scrollLeft() -{ - TQScrollBar* scrollBar = scrollView()->horizontalScrollBar(); - if (scrollBar) - scrollBar->subtractLine(); -} - - -void KMultiPage::scrollRight() -{ - TQScrollBar* scrollBar = scrollView()->horizontalScrollBar(); - if (scrollBar) - scrollBar->addLine(); -} - - -void KMultiPage::scrollUpPage() -{ - TQScrollBar* scrollBar = scrollView()->verticalScrollBar(); - if (scrollBar) - scrollBar->subtractPage(); -} - - -void KMultiPage::scrollDownPage() -{ - TQScrollBar* scrollBar = scrollView()->verticalScrollBar(); - if (scrollBar) - scrollBar->addPage(); -} - - -void KMultiPage::scrollLeftPage() -{ - TQScrollBar* scrollBar = scrollView()->horizontalScrollBar(); - if (scrollBar) - scrollBar->subtractPage(); -} - - -void KMultiPage::scrollRightPage() -{ - TQScrollBar* scrollBar = scrollView()->horizontalScrollBar(); - if (scrollBar) - scrollBar->addPage(); -} - - -void KMultiPage::readDown() -{ - PageView* sv = scrollView(); - - if (sv->atBottom()) - { - if (sv->isContinuous()) - return; - - if (currentPageNumber() == numberOfPages()) - return; - - nextPage(); - sv->setContentsPos(sv->contentsX(), 0); - } - else - sv->readDown(); -} - - -void KMultiPage::readUp() -{ - PageView* sv = scrollView(); - - if (sv->atTop()) - { - if (sv->isContinuous()) - return; - - if (currentPageNumber() == 1) - return; - - prevPage(); - sv->setContentsPos(sv->contentsX(), sv->contentsHeight()); - } - else - sv->readUp(); -} - - -void KMultiPage::jumpToReference(const TQString& reference) -{ - if (renderer.isNull()) - return; - - gotoPage(renderer->parseReference(reference)); -} - - -void KMultiPage::gotoPage(const Anchor &a) -{ - if (!a.page.isValid() || (renderer.isNull())) - return; - - gotoPage(a.page, (int)(a.distance_from_top.getLength_in_inch()*pageCache->getResolution() + 0.5), true); -} - - -void KMultiPage::gotoPage(const TextSelection& selection) -{ - if (selection.isEmpty()) - { - kdError(4300) << "KMultiPage::gotoPage(...) called with empty TextSelection." << endl; - return; - } - - RenderedDocumentPage* pageData = pageCache->getPage(selection.getPageNumber()); - - if (pageData == 0) { -#ifdef DEBUG_DOCUMENTWIDGET - kdDebug(4300) << "DocumentWidget::paintEvent: no documentPage generated" << endl; -#endif - return; - } - - switch (widgetList.size()) - { - case 0: - kdError(4300) << "KMultiPage::select() while widgetList is empty" << endl; - break; - case 1: - ((DocumentWidget*)widgetList[0])->select(selection); - break; - default: - if (widgetList.size() < currentPageNumber()) - kdError(4300) << "KMultiPage::select() while widgetList.size()=" << widgetList.size() << "and currentPageNumber()=" << currentPageNumber() << endl; - else - ((DocumentWidget*)widgetList[selection.getPageNumber() - 1])->select(selection); - } - - unsigned int y = pageData->textBoxList[selection.getSelectedTextStart()].box.top(); - gotoPage(selection.getPageNumber(), y, false); -} - - -void KMultiPage::doSelectAll() -{ - switch( widgetList.size() ) { - case 0: - kdError(4300) << "KMultiPage::doSelectAll() while widgetList is empty" << endl; - break; - case 1: - ((DocumentWidget *)widgetList[0])->selectAll(); - break; - default: - if (widgetList.size() < currentPageNumber()) - kdError(4300) << "KMultiPage::doSelectAll() while widgetList.size()=" << widgetList.size() << "and currentPageNumber()=" << currentPageNumber() << endl; - else - ((DocumentWidget *)widgetList[currentPageNumber()-1])->selectAll(); - } -} - - - -void KMultiPage::showFindTextDialog() -{ - if ((renderer.isNull()) || (renderer->supportsTextSearch() == false)) - return; - - searchWidget->show(); - searchWidget->setFocus(); -} - -void KMultiPage::stopSearch() -{ - if (searchInProgress) - { - // stop the search - searchInProgress = false; - } - else - searchWidget->hide(); -} - -void KMultiPage::findNextText() -{ -#ifdef KDVI_MULTIPAGE_DEBUG - kdDebug(4300) << "KMultiPage::findNextText() called" << endl; -#endif - - searchInProgress = true; - - // Used to remember if the documentPage we use is from the cache. - // If not we need to delete it manually to avoid a memory leak. - bool cachedPage = false; - - TQString searchText = searchWidget->getText(); - - if (searchText.isEmpty()) - { - kdError(4300) << "KMultiPage::findNextText() called when search text was empty" << endl; - return; - } - - bool case_sensitive = searchWidget->caseSensitive(); - - // Find the page and text position on the page where the search will - // start. If nothing is selected, we start at the beginning of the - // current page. Otherwise, start after the selected text. TODO: - // Optimize this to get a better 'user feeling' - TQ_UINT16 startingPage; - TQ_UINT16 startingTextItem; - - TextSelection userSelection = pageCache->selectedText(); - if (userSelection.isEmpty()) - { - startingPage = currentPageNumber(); - startingTextItem = 0; - } - else - { - startingPage = userSelection.getPageNumber(); - startingTextItem = userSelection.getSelectedTextEnd()+1; - } - - TextSelection foundSelection; - - RenderedDocumentPagePixmap* searchPage = 0; - - for(unsigned int i = 0; i < numberOfPages(); i++) - { - unsigned int pageNumber = (i + startingPage - 1) % numberOfPages() + 1; - - if (!searchInProgress) - { - // Interrupt the search - setStatusBarText(i18n("Search interrupted")); - if (!cachedPage) - delete searchPage; - return; - } - - if (i != 0) - { - setStatusBarText(i18n("Search page %1 of %2").arg(pageNumber).arg(numberOfPages())); - kapp->processEvents(); - } - - // Check if we already have a rendered version of the page in the cache. As we are only interested in the - // text we don't care about the page size. - if (pageCache->isPageCached(pageNumber)) - { - // If the last search page used was created locally, we need to destroy it - if (!cachedPage) - delete searchPage; - - searchPage = pageCache->getPage(pageNumber); - cachedPage = true; - } - else - { - // If the page is not in the cache we draw a small version of it, since this is faster. - - // We only create a new searchPage if we need to, otherwise reuse the existing one. - if (!searchPage || cachedPage) - searchPage = new RenderedDocumentPagePixmap(); - - cachedPage = false; - - searchPage->resize(1,1); - searchPage->setPageNumber(pageNumber); - renderer->getText(searchPage); - } - - // If there is no text in the current page, try the next one. - if (searchPage->textBoxList.size() == 0) - continue; - - foundSelection = searchPage->find(searchText, startingTextItem, case_sensitive); - - if (foundSelection.isEmpty()) - { - // In the next page, start search again at the beginning. - startingTextItem = 0; - clearSelection(); - - if (pageNumber == numberOfPages()) - { - int answ = KMessageBox::questionYesNo(scrollView(), - i18n("The search string %1 could not be found by the " - "end of the document. Should the search be restarted from the beginning " - "of the document?").arg(searchText), - i18n("Text Not Found"), KStdGuiItem::cont(), KStdGuiItem::cancel()); - - if (answ != KMessageBox::Yes) - { - setStatusBarText(TQString()); - searchInProgress = false; - if (!cachedPage) - delete searchPage; - return; - } - } - } - else - { - pageCache->selectText(foundSelection); - gotoPage(pageCache->selectedText()); - setStatusBarText(TQString()); - searchInProgress = false; - if (!cachedPage) - delete searchPage; - return; - } - } - - KMessageBox::sorry(scrollView(), i18n("The search string %1 could not be found.").arg(searchText)); - setStatusBarText(TQString()); - searchInProgress = false; - if (!cachedPage) - delete searchPage; -} - - -void KMultiPage::findPrevText() -{ -#ifdef KDVI_MULTIPAGE_DEBUG - kdDebug(4300) << "KMultiPage::findPrevText() called" << endl; -#endif - - searchInProgress = true; - - // Used to remember if the documentPage we use is from the cache. - // If not we need to delete it manually to avoid a memory leak. - bool cachedPage = false; - - TQString searchText = searchWidget->getText(); - - if (searchText.isEmpty()) - { - kdError(4300) << "KMultiPage::findPrevText() called when search text was empty" << endl; - return; - } - - bool case_sensitive = searchWidget->caseSensitive(); - - // Find the page and text position on the page where the search will - // start. If nothing is selected, we start at the beginning of the - // current page. Otherwise, start after the selected text. TODO: - // Optimize this to get a better 'user feeling' - unsigned int startingPage; - int startingTextItem; - - TextSelection userSelection = pageCache->selectedText(); - if (userSelection.isEmpty()) - { - startingPage = currentPageNumber(); - startingTextItem = -1; - } - else - { - startingPage = userSelection.getPageNumber(); - startingTextItem = userSelection.getSelectedTextStart()-1; - } - - TextSelection foundSelection; - - RenderedDocumentPagePixmap* searchPage = 0; - - for(unsigned int i = 0; i < numberOfPages(); i++) - { - int pageNumber = startingPage - i; - if (pageNumber <= 0) - pageNumber += numberOfPages(); - - if (!searchInProgress) - { - // Interrupt the search - setStatusBarText(i18n("Search interrupted")); - if (!cachedPage) - delete searchPage; - return; - } - - if (i != 0) - { - setStatusBarText(i18n("Search page %1 of %2").arg(pageNumber).arg(numberOfPages())); - kapp->processEvents(); - } - - // Check if we already have a rendered version of the page in the cache. As we are only interested in the - // text we don't care about the page size. - if (pageCache->isPageCached(pageNumber)) - { - // If the last search page used was created locally, we need to destroy it - if (!cachedPage) - delete searchPage; - - searchPage = pageCache->getPage(pageNumber); - cachedPage = true; - } - else - { - // If the page is not in the cache we draw a small version of it, since this is faster. - - // We only create a new searchPage if we need to, otherwise reuse the existing one. - if (!searchPage || cachedPage) - searchPage = new RenderedDocumentPagePixmap(); - - cachedPage = false; - - searchPage->resize(1,1); - searchPage->setPageNumber(pageNumber); - renderer->getText(searchPage); - } - - // If there is no text in the current page, try the next one. - if (searchPage->textBoxList.size() == 0) - continue; - - foundSelection = searchPage->findRev(searchText, startingTextItem, case_sensitive); - - if (foundSelection.isEmpty()) - { - // In the next page, start search again at the beginning. - startingTextItem = -1; - clearSelection(); - - if (pageNumber == 1) - { - int answ = KMessageBox::questionYesNo(scrollView(), - i18n("The search string %1 could not be found by the " - "beginning of the document. Should the search be restarted from the end " - "of the document?").arg(searchText), - i18n("Text Not Found"), KStdGuiItem::cont(), KStdGuiItem::cancel()); - - if (answ != KMessageBox::Yes) - { - setStatusBarText(TQString()); - searchInProgress = false; - if (!cachedPage) - delete searchPage; - return; - } - } - } - else - { - pageCache->selectText(foundSelection); - gotoPage(pageCache->selectedText()); - setStatusBarText(TQString()); - searchInProgress = false; - if (!cachedPage) - delete searchPage; - return; - } - } - - KMessageBox::sorry(scrollView(), i18n("The search string %1 could not be found.").arg(searchText)); - setStatusBarText(TQString()); - searchInProgress = false; - if (!cachedPage) - delete searchPage; -} - - -void KMultiPage::clearSelection() -{ - PageNumber page = pageCache->selectedText().getPageNumber(); - - if (!page.isValid()) - return; - - // Clear selection - pageCache->deselectText(); - - // Now we need to update the widget which contained the selection - switch(widgetList.size()) - { - case 0: - kdError(4300) << "KMultiPage::clearSelection() while widgetList is empty" << endl; - break; - case 1: - widgetList[0]->update(); - break; - default: - for (unsigned int i = 0; i < widgetList.size(); i++) - { - DocumentWidget* pageWidget = (DocumentWidget*)widgetList[i]; - if (pageWidget->getPageNumber() == page) - { - pageWidget->update(); - break; - } - } - } -} - -void KMultiPage::copyText() -{ - pageCache->selectedText().copyText(); -} - -void KMultiPage::timerEvent( TQTimerEvent * ) -{ -#ifdef KMULTIPAGE_DEBUG - kdDebug(4300) << "Timer Event " << endl; -#endif - reload(); -} - - -void KMultiPage::reload() -{ -#ifdef KMULTIPAGE_DEBUG - kdDebug(4300) << "Reload file " << m_file << endl; -#endif - - if (renderer.isNull()) { - kdError() << "KMultiPage::reload() called, but no renderer was set" << endl; - return; - } - - if (renderer->isValidFile(m_file)) { - pageCache->clear(); - pageCache->deselectText(); - document_history.clear(); - emit setStatusBarText(i18n("Reloading file %1").arg(m_file)); - TQ_INT32 pg = currentPageNumber(); - - killTimer(timer_id); - timer_id = -1; - bool r = renderer->setFile(m_file, m_url); - - generateDocumentWidgets(); - - // Set Table of Contents - tableOfContents->setContents(renderer->getBookmarks()); - - // Adjust number of widgets in the thumbnail sidebar - markList()->clear(); - markList()->setNumberOfPages(numberOfPages(), KVSPrefs::showThumbnails()); - - setCurrentPageNumber(pg); - setFile(r); - emit setStatusBarText(TQString()); - } else { - if (timer_id == -1) - timer_id = startTimer(1000); - } -} - - -bool KMultiPage::openFile() -{ - if (renderer.isNull()) { - kdError(4300) << "KMultiPage::openFile() called when no renderer was set" << endl; - return false; - } - - pageCache->deselectText(); - document_history.clear(); - pageCache->clear(); - emit setStatusBarText(i18n("Loading file %1").arg(m_file)); - - bool r = renderer->setFile(m_file, m_url); - - if (r) { - setCurrentPageNumber(1); - generateDocumentWidgets(); - - // Set number of widgets in the thumbnail sidebar - markList()->clear(); - markList()->setNumberOfPages(numberOfPages(), KVSPrefs::showThumbnails()); - - TQString reference = url().ref(); - if (!reference.isEmpty()) - gotoPage(renderer->parseReference(reference)); - - // Set Table of Contents - tableOfContents->setContents(renderer->getBookmarks()); - } else - m_file = TQString(); - - - setFile(r); - - // Clear Statusbar - emit setStatusBarText(TQString()); - return r; -} - - -bool KMultiPage::openURL(const TQString &filename, const KURL &base_url) -{ - m_file = filename; - m_url = base_url; - - bool success = openFile(); - if (success) - setCurrentPageNumber(1); - - return success; -} - - -void KMultiPage::enableActions(bool fileLoaded) -{ - Q_UNUSED(fileLoaded); -} - -void KMultiPage::wheelEvent(TQWheelEvent *e) -{ - TQScrollBar *sb = scrollView()->verticalScrollBar(); - if (sb == 0) - return; - - // Zoom in/out - if (e->state() & ControlButton) - { - if (e->delta() < 0) - emit zoomOut(); - else - emit zoomIn(); - return; - } - - TQ_INT32 pxl = -(e->delta()*sb->lineStep())/60; - if (pxl == 0) - { - if (e->delta() > 0) - pxl = -1; - else - pxl = 1; - } - - // Faster scrolling - if (e->state() & ShiftButton) - pxl *= 10; - - scroll(pxl); -} - - -KPrinter *KMultiPage::getPrinter(bool enablePageSizeFeatures) -{ - // Allocate a new KPrinter structure, if necessary - KPrinter *printer = new KPrinter(true); - if (printer == 0) { - kdError(1223) << "KMultiPage::getPrinter(..): Cannot allocate new KPrinter structure" << endl; - return 0; - } - - // Allocate a new KPrintDialogPage structure and add it to the - // printer, if the kmultipage implementation requests that - if (enablePageSizeFeatures == true) { - KPrintDialogPage_PageOptions *pageOptions = new KPrintDialogPage_PageOptions(); - if (pageOptions == 0) { - kdError(1223) << "KMultiPage::getPrinter(..): Cannot allocate new KPrintDialogPage_PageOptions structure" << endl; - delete printer; - return 0; - } - printer->addDialogPage( pageOptions ); - } - - // Feed the printer with useful defaults and information. - printer->setPageSelection( KPrinter::ApplicationSide ); - printer->setCurrentPage( currentPageNumber() ); - printer->setMinMax( 1, numberOfPages() ); - printer->setFullPage( true ); - - // If pages are marked, give a list of marked pages to the - // printer. We try to be smart and optimize the list by using ranges - // ("5-11") wherever possible. The user will be tankful for - // that. Complicated? Yeah, but that's life. - TQValueList selectedPageNo = selectedPages(); - if (selectedPageNo.isEmpty() == true) - printer->setOption( "kde-range", "" ); - else { - int commaflag = 0; - TQString range; - TQValueList::ConstIterator it = selectedPageNo.begin(); - do{ - int val = *it; - if (commaflag == 1) - range += TQString(", "); - else - commaflag = 1; - int endval = val; - if (it != selectedPageNo.end()) { - TQValueList::ConstIterator jt = it; - jt++; - do{ - int val2 = *jt; - if (val2 == endval+1) - endval++; - else - break; - jt++; - } while( jt != selectedPageNo.end() ); - it = jt; - } else - it++; - if (endval == val) - range += TQString("%1").arg(val); - else - range += TQString("%1-%2").arg(val).arg(endval); - } while (it != selectedPageNo.end() ); - printer->setOption( "kde-range", range ); - } - - return printer; -} - -void KMultiPage::doExportText() -{ - // Generate a suggestion for a reasonable file name - TQString suggestedName = url().filename(); - suggestedName = suggestedName.left(suggestedName.find(".")) + ".txt"; - - TQString fileName = KFileDialog::getSaveFileName(suggestedName, i18n("*.txt|Plain Text (Latin 1) (*.txt)"), scrollView(), i18n("Export File As")); - - if (fileName.isEmpty()) - return; - - TQFileInfo finfo(fileName); - if (finfo.exists()) - { - int r = KMessageBox::warningContinueCancel (scrollView(), - i18n("The file %1\nexists. Do you want to overwrite that file?").arg(fileName), - i18n("Overwrite File"), i18n("Overwrite")); - - if (r == KMessageBox::Cancel) - return; - } - - TQFile textFile(fileName); - textFile.open(IO_WriteOnly); - TQTextStream stream(&textFile); - - TQProgressDialog progress(i18n("Exporting to text..."), i18n("Abort"), renderer->totalPages(), - scrollView(), "export_text_progress", true); - progress.setMinimumDuration(300); - - RenderedDocumentPagePixmap dummyPage; - dummyPage.resize(1, 1); - - for(unsigned int page = 1; page <= renderer->totalPages(); page++) - { - progress.setProgress(page); - tqApp->processEvents(); - - if (progress.wasCancelled()) - break; - - dummyPage.setPageNumber(page); - // We gracefully ignore any errors (bad file, etc.) - renderer->getText(&dummyPage); - - for(unsigned int i = 0; i < dummyPage.textBoxList.size(); i++) - { - // We try to detect newlines - if (i > 0) - { - // Like all our textalgorithmns this currently assumes left to right text. - // TODO: make this more generic. But we first would need to guess the corrent - // orientation. - if (dummyPage.textBoxList[i].box.top() > dummyPage.textBoxList[i-1].box.bottom() && - dummyPage.textBoxList[i].box.x() < dummyPage.textBoxList[i-1].box.x()) - { - stream << "\n"; - } - } - stream << dummyPage.textBoxList[i].text; - } - - // Send newline after each page. - stream << "\n"; - } - - // Switch off the progress dialog, etc. - progress.setProgress(renderer->totalPages()); - return; -} - -void KMultiPage::slotEnableMoveTool(bool enable) -{ - emit enableMoveTool(enable); -} - -#include "kmultipage.moc" diff --git a/kviewshell/kmultipage.desktop b/kviewshell/kmultipage.desktop deleted file mode 100644 index 0ef915a9..00000000 --- a/kviewshell/kmultipage.desktop +++ /dev/null @@ -1,41 +0,0 @@ -[Desktop Entry] -Type=Service -X-TDE-ServiceType=KViewShell/MultiPage -Name=KViewShell MultiPage -Name[da]=KViewShell Multiside -Name[de]=KViewShell Mehrfachseiten -Name[el]=螤慰位位伪蟺位萎 蟽蔚位委未伪 KViewShell -Name[es]=Multip谩gina KViewShell -Name[fi]=KViewShell MoniSivu -Name[fr]=Multi-page KViewShell -Name[gl]=KViewShell Multip谩xina -Name[hu]=KViewShell t枚bboldalas -Name[it]=MultiPagina KViewShell -Name[kk]=袣萤锌斜械褌褌褨 KViewShell -Name[ms]=PelbagaiMuka KViewShell -Name[nb]=KViewShell Flerside -Name[nds]=KViewShell f枚r Mehrfachsieden -Name[ne]=啶曕 啶︵啶多啶 啶多啶 啶す啷佮お啷冟し啷嵿 -Name[nl]=KViewShell MultiPagina -Name[nn]=KViewShell-fleirside -Name[pl]=Wielostronicowe dla KViewShell -Name[pt]=KViewShell MultiP谩gina -Name[pt_BR]=KViewShell - M煤ltiplas P谩ginas -Name[ro]=KViewShell Pagini Multiple -Name[ru]=袣芯屑锌芯薪械薪褌 MultiPage -Name[sr]=KViewShell 胁懈褕械褋褌褉邪薪懈 -Name[sr@Latn]=KViewShell vi拧estrani -Name[sv]=Kviewshell flera sidor -Name[ta]=喈曕瘒喈曕喈熰瘝喈氞喈撪疅喁 喈喈畷喁嵿畷喈瘝 -Name[tr]=KViewShell 脟okluSayfa -Name[zh_CN]=KViewShell 澶氶〉 -Name[zh_HK]=KViewShell 澶氶爜 - -[PropertyDef::X-TDE-MimeTypes] -Type=TQString - -[PropertyDef::X-TDE-MultiPageVersion] -Type=int - -[PropertyDef::X-TDE-EmptyMultiPage] -Type=int diff --git a/kviewshell/kmultipage.h b/kviewshell/kmultipage.h deleted file mode 100644 index 8dbd8247..00000000 --- a/kviewshell/kmultipage.h +++ /dev/null @@ -1,651 +0,0 @@ -// -*- C++ -*- -#ifndef _KMULTIPAGE_H -#define _KMULTIPAGE_H - -#include "pageView.h" -#include "documentPageCache.h" -#include "documentRenderer.h" -#include "history.h" -#include "kmultipageInterface.h" -#include "marklist.h" - -#include -#include - -class Anchor; -class DocumentWidget; -class TDEConfigDialog; -class KPrintDialogPage_PageOptions; -class KPrinter; -class PageView; -class TQPainter; -class TQSplitter; -class TQToolBox; -class simplePageSize; -class TableOfContents; -class PageNumber; -class SearchWidget; - - -/** \brief This class provides plugin-specific GUI elements for kviewshell plugins - -@author Wilfried Huss, Stefan Kebekus - - */ - -// TODO remove virtual inheritance for KDE 4. It's the reason for the strange DCOPObject construction -class KMultiPage : public KParts::ReadOnlyPart, virtual public kmultipageInterface -{ - Q_OBJECT - - -public: - KMultiPage(TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name); - virtual ~KMultiPage(); - - /* returns the scrollview used for the display */ - virtual TQWidget* mainWidget() {return _scrollView;} - - /* Methods which are associated with the DCOP functionality of the - kmultipage. This method returns the file name (not the URL) of - the currently loaded file. */ - TQString name_of_current_file(); - - /* 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. */ - virtual ASYNC jumpToReference(const TQString& /*reference*/); - - /* Methods which are associated with the DCOP functionality of the - kmultipage. This method checks if a given file is loaded. */ - bool is_file_loaded(const TQString& filename); - - /* Opens file and sets URL - - This method does the same as openFile, but sets the m_url of the - kmultipage. This can be important, for the following reason: - assume that a DVI is or DJVU-file is located on a web server at - baseURL=http://www.x.x/x.dvi The file may refer to external - graphic files using relative links. - - The file is downloaded by the kviewpart to a temporary file on - the hard disk, say /tmp/t.dvi. The kviewpart would then call this - method with filename=/tmp/t.dvi and baseURL=http://www.x.x/x.dvi, - so the DVI-renderer knows to interpret the link to t.jpg as - http://www.x.x/t.jpg, and will download the file from there. - - @warning This method is virtual only for technical reasons. Do - not re-implement this method - - @returns true on success, false on failure - */ - virtual bool openURL(const TQString &filename, const KURL &base_url); - - /** 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: - @code - // 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; - } - - ... pageList() gives a list of pages to be printed, where "1" - denotes the first page, "2" the second, etc.> ... - - printer->printFiles( TQStringList(tmpPSFile), true ); - delete printer; - @endcode - - 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: - @code - // 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") - - if (printer->option( "kde-kviewshell-expandpage" ) == "true") - - if (printer->option( "kde-kviewshell-centerpage" ) != "false") -
- if (printer->option( "kde-kviewshell-rotatepage" ) != "false") - - - ... pageList() gives a list of pages to be printed, where "1" - denotes the first page, "2" the second, etc.> ... - - printer->printFiles( TQStringList(tmpPSFile), true ); - delete printer; - @endcode - - For more information, see the default implementation in the source - file kmultipage.cpp. You might also look at the documentation to - getPrinter(). - */ - virtual void print(); - - - /* Returns true if the document specifies page sizes, and false - otherwise. NOTE: the information returned by this method is not - always 100% reliable. Although unlikely, it is theoretically - possible that this method returns 'true', but still some of the - sizes returned by sizeOfPage() are invalid. */ - virtual bool hasSpecifiedPageSizes() const {return renderer && renderer->hasSpecifiedPageSizes();} - - /* This methos is similar to openFile(). It is used when the "Watch - file" option is activated, and the file has changed on disk. It - differs from openFile() in two aspects: first, the file is - checked for validity with DVIRenderer.isValidFile(m_file) if the - file is invalid, a timer event is used to call the method again - after a brief pause. Secondly, when the GUI is updated, the - implementation does not jump to the first page, but tries to keep - the current page. */ - virtual void reload(); - -// Interface definition start ------------------------------------------------ - - /** 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. - */ - virtual TQStringList fileFormats() const = 0; - - /// closes a file - virtual bool closeURL(); - - /* sets a zoom factor. The multipage implementation might refuse to - use a given zoom factor, even if it falls within the bounds given - by the constants MinZoom and MaxZoom which are defined in - zoomlimits.h. In that case, the multipage implementation chooses a - different zomm factor. The implementation returns the factor which - has actually been used. A default implementation is provided. */ - virtual double setZoom(double z); - - /** reads in settings. Reimplementations must call this. */ - virtual void readSettings(); - - /** writes settings. Reimplementations must call this. */ - virtual void writeSettings(); - - /** Flag to indicate that this implementation has support for textserach and selection */ - virtual bool supportsTextSearch() const { return getRenderer() && getRenderer()->supportsTextSearch(); } - - /** 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 - */ - virtual bool isModified() const {return false;} - - /* Returns the number of the first (i.e. top-left) page in the - display. Such a number cannot be reasonably assigned - (e.g. because the current document is empty, or because no - document has been loaded yet), the method returns "invalid page", - i.e. 0. */ - virtual PageNumber currentPageNumber(); - - /* Returns the number of pages in the currently loaded document or - 0, if no document is loaded or if the document is empty */ - PageNumber numberOfPages() const {return renderer.isNull() ? (PageNumber)0 : renderer->totalPages();} - - /* List of pages selected in the sidebar - - @returns a list with the numbers of the currently selected - pages. */ - virtual TQValueList selectedPages() {return markList()->selectedPages();} - - virtual History* history() { return &document_history; } - - /** 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 TDEConfigDialog explains how to do that. - - The default implementation does nothing. - - @param configDialog a pointer to the TDEConfigDialog the dialog to - add pages to - */ - virtual void addConfigDialogs(TDEConfigDialog* configDialog) { Q_UNUSED(configDialog); } - - - /* These methods calculate the Zoomfactor needed to fit the pages - into the current viewport. Note that the return value need *not* - be within the limits defined in "zoomLimits.h". If they are not, - this indicates that fitting to width or height is currently not - possible (e.g. because no document is loaded). The return value - should then be ignored and any operation that relies on the - return value should be aborted. */ - virtual double calculateFitToWidthZoomValue(); - virtual double calculateFitToHeightZoomValue(); - - /* Returns the number of columns into which the widgets are aligned. */ - virtual TQ_UINT8 getNrColumns() const { return _scrollView->getNrColumns(); } - virtual TQ_UINT8 getNrRows() const { return _scrollView->getNrRows(); } - - virtual bool overviewMode() const { return _scrollView->overviewMode(); } - - // =========== Interface definition ends - - /* --------------------------------------------------------------------- - The following methods export functions of the DocumentPageCache which - are currently needed by KViewPart. TODO: Clean this up again without - directly linking DocumentPageCache to the KViewPart. */ - - /* Returns the size of page 'page'. If the document does not - specify a size (which happens, e.g., for some DVI-files), then - the userPreferredSize is returned. */ - virtual SimplePageSize sizeOfPage(const PageNumber& page = 1) const { return pageCache->sizeOfPage(page); } - -public slots: - /* Sets the userPreferredSize, which is explained below */ - virtual void setUserPreferredSize(const SimplePageSize& t) { pageCache->setUserPreferredSize(t); } - virtual void setUseDocumentSpecifiedSize(bool b) { pageCache->setUseDocumentSpecifiedSize(b); } - // -------------------------------------------------------------------- - -protected: - /** 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. - - @param 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. */ - virtual void setFile(bool success); - - /* Creates new instances of DocumentWidget. If you need special - functionality and reimplement the DocumentWidget class, then you - should also reimplement this method to ensure that your new - DocumentWidgets will be used. This function is also the right - place to connect to signals emitted by DocumentWidget. */ - virtual DocumentWidget* createDocumentWidget(); - - /* Used to enable/disable KActions of multiPage implementations. - enableActions(true) should be called whenever a file is - successfully loaded. enableActions(false) is called when the - file is closed. */ - virtual void enableActions(bool); - - /* Initializes all data structures that need to know the renderer. - This function must be called in the constructor of multipage - implementations. */ - void setRenderer(DocumentRenderer*); - - /** 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. - */ - virtual void initializePageCache(); - - /* Returns a pointer to the renderer. */ - virtual TQGuardedPtr getRenderer() const { return renderer; } - - PageView* scrollView() { return _scrollView; } - - MarkList* markList() { return _markList; } - - // The next two functions are used for the autozoom feature - // TODO optimize (the calculation of the widest page needs to be done only once - // per document, not everytime calculateFitToWidthZoomValue() is called) - PageNumber widestPage() const; - - // TODO Generalize this for more than 2 columns - double zoomForWidthColumns(unsigned int viewportWidth) const; - -public slots: - virtual void doSelectAll(); - - virtual void clearSelection(); - - virtual void copyText(); - - /** Exports the document to a plain text file. */ - virtual void doExportText(); - - /* Shows the "text search" dialog, if text search is supported by - the renderer. Otherwise, the method returns immediately. */ - virtual void showFindTextDialog(); - - - /* 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. */ - virtual void findNextText(); - - /* 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. */ - virtual void findPrevText(); - - /** 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. */ - virtual void slotSave(); - - /* The standard implementation just calls slotSave. */ - virtual void slotSave_defaultFilename(); - - /* Initialize/Update PageWidgets, thumbnail list and bookmark list - - This slot is called after a document was loaded, when the - document was modified (e.g. when pages were deleted), or the - rendering mode is changed (e.g. when a different accessibility - viewmode is selected). The following is done - - - The page cache is cleared - - - all page widgets as well as the thumbnails are updated. - */ - void renderModeChanged(); - - /* Empties the page cache and --as the name suggests-- repaints all - visible widgets. */ - void repaintAllVisibleWidgets(); - - /* Tells the multipage if scrollbars should be used. */ - virtual void slotShowScrollbars(bool); - - /* Show or hide the sidebar widget. */ - virtual void slotShowSidebar(bool); - - /* Show or hide thumbnails. */ - virtual void slotShowThumbnails(bool); - - /* Used internally. */ - void slotIOJobFinished ( TDEIO::Job *job ); - - /* Switches to fullscreen mode and back. */ - virtual void slotSetFullPage(bool fullpage); - - virtual void setViewMode(int); - - /* Is called if settings are changed in the configuration dialog. - If this method is reimplemented in a child class, it needs to be - called from there. */ - virtual void preferencesChanged(); - - /* Page Navigation. */ - 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(); - - /* Scrolls the main scrollview by deltaInPixel (positive values - scroll DOWN). If the user tries to scroll past the beginning or - the end of a page, then the method either returns without doing - anything (if the current page is the first or last page, resp, or - if the method is called within 200ms after the beg. or end of the - page was reached), or goes the the next/previous page. The delay - makes it a little easier for the user to scroll with the mouse - wheel or the keyboard without involuntarily moving to another - page. */ - virtual void scroll(TQ_INT32 deltaInPixel); - - virtual void slotEnableMoveTool(bool enable); - -protected slots: - virtual bool gotoPage(const PageNumber& page, int y, bool isLink = true); - - /* Make the selection visible */ - void gotoPage(const TextSelection&); - -private slots: - void handleLocalLink(const TQString &linkText); - -signals: - /** Emitted with argument "true" when the move tool is selected, and - with argument "false" if selection tool is selected. */ - void enableMoveTool(bool enable); - - /* Emitted when a page has been selected in the MarkList. */ - void selected(const PageNumber& pageNumber); - - /* Emitted to indicate the number of pages in the file and the - current page. The receiver will not change or update the display, - nor call the gotoPage()-method. */ - void pageInfo(int nr, int currpg); - - void askingToCheckActions(); - - /* emitted when a new preview is available */ - void previewChanged(bool previewAvailable); - - void viewModeChanged(); - - /* Emitted when the zoom of the pageview changes. */ - void zoomChanged(); - - void zoomOut(); - void zoomIn(); - - /* Emitted it the status of the text selection changes. */ - void textSelected(bool); - - void searchEnabled(bool); - -// Interface definition end -------------------------------------------------- - -public slots: - virtual void generateDocumentWidgets(const PageNumber& startPage = PageNumber::invalidPage); - - protected slots: - /* This is the slot where mouseWheel events are processed that come - from the multipage/scrollview. This method calles scroll, a - delta-value of 120 (i.e. one notch on a standard wheel mouse) - scrolls by two 'lines'. */ - void wheelEvent(TQWheelEvent *); - -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. - - @param 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. - */ - KPrinter *getPrinter(bool enablePageSizeFeatures=true); - - - /** Pointer to the parent widget - - This pointer is automatically set by the constructor. - */ - TQGuardedPtr parentWdg; - - TQPtrVector widgetList; - - History document_history; - - /* Variable which is used internally by the method - currentPageNumber() to provide 'lazy' page numbers. */ - PageNumber lastCurrentPage; - - /* The pageCache caches already drawn "documentPages" and invokes - the renderer if the needed page is not available in the cache. */ - DocumentPageCache* pageCache; - -private slots: - void setCurrentPageNumber(const PageNumber&); - void updateWidgetSize(const PageNumber&); - - /* Interrupts a search if one is currently performed, otherwise - hide the search panel */ - void stopSearch(); - -private: - /* For internal use by the reload()-method. See the comments in - kmultipage.cpp, right before the timerEvent function. */ - int timer_id; - - /* For internal use the reload()-method. This is a dreadful - hack. The problem we adress with this timer event is the - following: the kviewshell has a KDirWatch object which looks at - the DVI file and calls reload() when the object has changed. That - works very nicely in principle, but in practise, when TeX runs - for several seconds over a complicated file, this does not work - at all. First, most of the time, while TeX is still writing, the - file is invalid. Thus, reload() is very often called when the DVI - file is bad. We solve this problem by checking the file first. If - the file is bad, we do not reload. Second, when the file finally - becomes good, it very often happens that KDirWatch does not - notify us anymore. Whether this is a bug or a side effect of a - feature of KDirWatch, I dare not say. We remedy that problem by - using a timer: when reload() was called on a bad file, we - automatically come back (via the timerEvent() function) every - second and check if the file became good. If so, we stop the - timer. It may well happen that KDirWatch calls us several times - while we are waiting for the file to become good, but that does - not do any harm. */ - void timerEvent( TQTimerEvent *e ); - - /* This method opens a file and sets up the GUI when the file is - loaded. It calls setFile() so that implementations of kmultipage - can update their own GUI. DO NOT REIMPLEMENT THIS METHOD. */ - bool openFile(); - - /* Is set by setRenderer. */ - TQGuardedPtr renderer; - - PageView *_scrollView; - SearchWidget* searchWidget; - TQToolBox* sideBar; - - MarkList* _markList; - TableOfContents* tableOfContents; - - TQSplitter* splitterWidget; - - /* This timer is used to implement a brief delay when the user - scrolls past the beginning or the end of the page before a the - program moves to a new page. That way, it is a little easier for - the user to scroll with the mouse wheel or the keyboard without - involuntarily moving to another page. The timer is used in the - scroll() method. */ - TQTimer changePageDelayTimer; - - // This is set to true while a text search is performed. - // If set to false the search is interrupted. - bool searchInProgress; -}; - - -#endif diff --git a/kviewshell/kmultipageInterface.h b/kviewshell/kmultipageInterface.h deleted file mode 100644 index 4c498900..00000000 --- a/kviewshell/kmultipageInterface.h +++ /dev/null @@ -1,18 +0,0 @@ -// -*- C++ -*- -#ifndef kmultipageINTERFACE_H -#define kmultipageINTERFACE_H - -#include - -class kmultipageInterface : virtual public DCOPObject -{ - K_DCOP - - k_dcop: - virtual ASYNC jumpToReference(const TQString& reference) = 0; - virtual TQString name_of_current_file() = 0; - virtual bool is_file_loaded(const TQString& filename) = 0; -}; - -#endif - diff --git a/kviewshell/kprintDialogPage_pageoptions.cpp b/kviewshell/kprintDialogPage_pageoptions.cpp index c0c4b15e..1086b83f 100644 --- a/kviewshell/kprintDialogPage_pageoptions.cpp +++ b/kviewshell/kprintDialogPage_pageoptions.cpp @@ -102,7 +102,7 @@ void KPrintDialogPage_PageOptions::getOptions( TQMap& opts, b // Save options, taking default values into consideration: by // default "center" is checked, "expand" and "shrink" are // not. Warning: The default values are also coded into setOptions() - // and kmultipage::print(..). + // and tdemultipage::print(..). if (checkBox_center != 0) if ( incldef || !checkBox_center->isChecked() ) @@ -138,7 +138,7 @@ void KPrintDialogPage_PageOptions::setOptions( const TQMap& o { // Sets the centering option. By default, this option is // checked. Warning: All default values are also coded into - // getOptions() and kmultipage::print(..). + // getOptions() and tdemultipage::print(..). TQString op = opts[ "kde-kviewshell-centerpage" ]; if (checkBox_center != 0) checkBox_center->setChecked( op != "false" ); diff --git a/kviewshell/kviewpart.cpp b/kviewshell/kviewpart.cpp index 847a8ff8..f76c5dd2 100644 --- a/kviewshell/kviewpart.cpp +++ b/kviewshell/kviewpart.cpp @@ -26,9 +26,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -41,7 +41,7 @@ #include #include "kviewpart.h" -#include "kmultipage.h" +#include "tdemultipage.h" #include "pageSize.h" #include "pageSizeDialog.h" #include "zoomlimits.h" diff --git a/kviewshell/kviewpart.h b/kviewshell/kviewpart.h index 1ea8aafd..cf66e69d 100644 --- a/kviewshell/kviewpart.h +++ b/kviewshell/kviewpart.h @@ -6,7 +6,7 @@ #include "pageSize.h" #include "zoom.h" -#include +#include #include class TDEAboutData; @@ -71,7 +71,7 @@ public slots: virtual TQStringList fileFormats() const; void setStatusBarTextFromMultiPage(const TQString &); - /** Calling this slot will cause the kmultipage to reload the file */ + /** Calling this slot will cause the tdemultipage to reload the file */ void reload(); void restoreDocument(const KURL &url, int page); diff --git a/kviewshell/kviewpart_iface.h b/kviewshell/kviewpart_iface.h index bef0d233..009552f1 100644 --- a/kviewshell/kviewpart_iface.h +++ b/kviewshell/kviewpart_iface.h @@ -2,7 +2,7 @@ #ifndef KVIEWPART_IFACE_H #define KVIEWPART_IFACE_H -#include +#include class TQStringList; diff --git a/kviewshell/kviewshell.cpp b/kviewshell/kviewshell.cpp index 26f1e20b..b155e73e 100644 --- a/kviewshell/kviewshell.cpp +++ b/kviewshell/kviewshell.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include diff --git a/kviewshell/kviewshell.h b/kviewshell/kviewshell.h index 064c4da1..40cf3244 100644 --- a/kviewshell/kviewshell.h +++ b/kviewshell/kviewshell.h @@ -4,7 +4,7 @@ #include -#include +#include class KRecentFilesAction; class KURL; diff --git a/kviewshell/main.cpp b/kviewshell/main.cpp index 132cbfda..a78f3620 100644 --- a/kviewshell/main.cpp +++ b/kviewshell/main.cpp @@ -114,7 +114,7 @@ int main(int argc, char **argv) TQDataStream arg(data, IO_WriteOnly); bool result; arg << qualPath.stripWhiteSpace(); - if (!app.dcopClient()->call( *it, "kmultipage", "is_file_loaded(TQString)", data, replyType, replyData)) + if (!app.dcopClient()->call( *it, "tdemultipage", "is_file_loaded(TQString)", data, replyType, replyData)) kdError(1223) << "There was an error using DCOP." << endl; else { @@ -124,7 +124,7 @@ int main(int argc, char **argv) reply >> result; if (result == true) { - if (app.dcopClient()->send(*it, "kmultipage", "jumpToReference(TQString)", args->url(0).ref()) == true) + if (app.dcopClient()->send(*it, "tdemultipage", "jumpToReference(TQString)", args->url(0).ref()) == true) { app.dcopClient()->detach(); return 0; diff --git a/kviewshell/plugins/djvu/CMakeLists.txt b/kviewshell/plugins/djvu/CMakeLists.txt index 9a1bfce9..fe9d4ef9 100644 --- a/kviewshell/plugins/djvu/CMakeLists.txt +++ b/kviewshell/plugins/djvu/CMakeLists.txt @@ -42,6 +42,6 @@ tde_add_kpart( djvuviewpart AUTOMOC kprintDialogPage_DJVUconversionoptions.cpp kprintDialogPage_DJVUconversionoptions_basewidget.ui pageRangeWidget_base.ui pageRangeWidget.cpp prefs.kcfgc - LINK djvu-shared kmultipage-shared + LINK djvu-shared tdemultipage-shared DESTINATION ${PLUGIN_INSTALL_DIR} ) diff --git a/kviewshell/plugins/djvu/Makefile.am b/kviewshell/plugins/djvu/Makefile.am index 1dba2502..3f980a6d 100644 --- a/kviewshell/plugins/djvu/Makefile.am +++ b/kviewshell/plugins/djvu/Makefile.am @@ -18,7 +18,7 @@ shellrcdir = $(kde_datadir)/kviewshell/plugins/djvu kde_module_LTLIBRARIES = djvuviewpart.la djvuviewpart_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module -djvuviewpart_la_LIBADD = -ltdeprint -lkparts $(top_builddir)/kviewshell/libkmultipage.la libdjvu/libdjvu.la +djvuviewpart_la_LIBADD = -ltdeprint -ltdeparts $(top_builddir)/kviewshell/libtdemultipage.la libdjvu/libdjvu.la djvuviewpart_la_SOURCES = djvumultipage.cpp djvurenderer.cpp kprintDialogPage_DJVUpageoptions.cpp \ kprintDialogPage_DJVUconversionoptions.cpp kprintDialogPage_DJVUconversionoptions_basewidget.ui \ pageRangeWidget_base.ui pageRangeWidget.cpp \ diff --git a/kviewshell/plugins/djvu/djvumultipage.cpp b/kviewshell/plugins/djvu/djvumultipage.cpp index 591447db..dd6d08b1 100644 --- a/kviewshell/plugins/djvu/djvumultipage.cpp +++ b/kviewshell/plugins/djvu/djvumultipage.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include "kvsprefs.h" @@ -51,7 +51,7 @@ DjVuMultiPage::DjVuMultiPage(TQWidget *parentWidget, const char *widgetName, TQO const char *name, const TQStringList&) : KMultiPage(parentWidget, widgetName, parent, name), djvuRenderer(parentWidget) { - /* This is kparts wizardry that cannot be understood by man. Simply + /* This is tdeparts wizardry that cannot be understood by man. Simply change the names to match your implementation. */ setInstance(DjVuMultiPageFactory::instance()); djvuRenderer.setName("DjVu renderer"); @@ -73,7 +73,7 @@ DjVuMultiPage::DjVuMultiPage(TQWidget *parentWidget, const char *widgetName, TQO connect(renderModeAction, TQT_SIGNAL(activated(int)), this, TQT_SLOT(setRenderMode(int))); /* It is very important that this method is called in the - constructor. Otherwise kmultipage does not know how to render + constructor. Otherwise tdemultipage does not know how to render files, and crashes may result. */ setRenderer(&djvuRenderer); diff --git a/kviewshell/plugins/djvu/djvumultipage.h b/kviewshell/plugins/djvu/djvumultipage.h index 163bf474..e6c47b14 100644 --- a/kviewshell/plugins/djvu/djvumultipage.h +++ b/kviewshell/plugins/djvu/djvumultipage.h @@ -26,7 +26,7 @@ #include -#include "kmultipage.h" +#include "tdemultipage.h" #include "djvurenderer.h" #include "DjVuToPS.h" @@ -53,7 +53,7 @@ Only the two classes that are absolutely necessary for a working plugin are implemented. The only other file that is installed is a desktop file, which tells kviewhshell to use the plugin. -- kvsdemo_multipage, an implementation of a kmultipage. In a real +- kvsdemo_multipage, an implementation of a tdemultipage. In a real application, this class would create and manage the GUI elements that the plugin adds to the GUI of the kviewshell. This implementation adds nothing, and does only the minimal initialization required.. @@ -93,7 +93,7 @@ public: /** Constructor The constructor needs to initialize several members of the - kmultipage. Please have a look at the constructor's source code to + tdemultipage. Please have a look at the constructor's source code to see how to adjust this for your implementation. */ DjVuMultiPage(TQWidget *parentWidget, const char *widgetName, TQObject *parent, diff --git a/kviewshell/plugins/djvu/kprintDialogPage_DJVUpageoptions.cpp b/kviewshell/plugins/djvu/kprintDialogPage_DJVUpageoptions.cpp index e6872648..cb932048 100644 --- a/kviewshell/plugins/djvu/kprintDialogPage_DJVUpageoptions.cpp +++ b/kviewshell/plugins/djvu/kprintDialogPage_DJVUpageoptions.cpp @@ -80,7 +80,7 @@ void KPrintDialogPage_DJVUPageOptions::getOptions( TQMap& opt { // Save options, taking default values into consideration. Warning: // The default values are also coded into setOptions() and - // kmultipage::print(..). + // tdemultipage::print(..). if (checkBox_rotate != 0) if (checkBox_rotate->isChecked()) @@ -99,7 +99,7 @@ void KPrintDialogPage_DJVUPageOptions::getOptions( TQMap& opt void KPrintDialogPage_DJVUPageOptions::setOptions( const TQMap& opts ) { // Warning: All default values are also coded into getOptions() and - // kmultipage::print(..). + // tdemultipage::print(..). // same for rotation TQString op = opts[ "kde-kviewshell-rotatepage" ]; diff --git a/kviewshell/tdemultipage.cpp b/kviewshell/tdemultipage.cpp new file mode 100644 index 00000000..b6b98855 --- /dev/null +++ b/kviewshell/tdemultipage.cpp @@ -0,0 +1,1976 @@ +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "documentWidget.h" +#include "marklist.h" +#include "tableOfContents.h" +#include "kprintDialogPage_pageoptions.h" +#include "kvsprefs.h" +#include "tdemultipage.h" +#include "pageNumber.h" +#include "renderedDocumentPagePrinter.h" +#include "searchWidget.h" +#include "textBox.h" +#include "zoomlimits.h" + + +//#define DEBUG_KMULTIPAGE + +KMultiPage::KMultiPage(TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name) + : DCOPObject("tdemultipage"), KParts::ReadOnlyPart(parent, name) +{ + // For reasons which I don't understand, the initialization of the + // DCOPObject above does not work properly, the name is ignored. It + // works fine if we repeat the name here. -- Stefan Kebekus + // This is because of the virtual inheritance. Get rid of it (but it's BC, and this is a lib...) -- DF + setObjId("tdemultipage"); + + parentWdg = parentWidget; + lastCurrentPage = 0; + timer_id = -1; + searchInProgress = false; + + TQVBox* verticalBox = new TQVBox(parentWidget); + verticalBox->setFocusPolicy(TQ_StrongFocus); + setWidget(verticalBox); + + splitterWidget = new TQSplitter(verticalBox, widgetName); + splitterWidget->setOpaqueResize(false); + splitterWidget->setSizePolicy(TQSizePolicy::MinimumExpanding, TQSizePolicy::MinimumExpanding); + + // Create SideBar + sideBar = new TQToolBox(splitterWidget, "sidebar"); + + // Create ContentsList + tableOfContents = new TableOfContents(sideBar); + sideBar->addItem(tableOfContents, TQIconSet(SmallIcon("contents")), i18n("Contents")); + + connect(tableOfContents, TQT_SIGNAL(gotoPage(const Anchor&)), this, TQT_SLOT(gotoPage(const Anchor&))); + + // Create MarkList + _markList = new MarkList(sideBar, "marklist"); + sideBar->addItem(_markList, TQIconSet(SmallIcon("thumbnail")), i18n("Thumbnails")); + + // Restore state of the sidebar + sideBar->setCurrentItem(sideBar->item(KVSPrefs::sideBarItem())); + + splitterWidget->setResizeMode(sideBar, TQSplitter::KeepSize); + + connect(_markList, TQT_SIGNAL(selected(const PageNumber&)), this, TQT_SLOT(gotoPage(const PageNumber&))); + + _scrollView = new PageView(splitterWidget, widgetName); + + // Create Search Panel + searchWidget = new SearchWidget(verticalBox); + searchWidget->hide(); + connect(searchWidget, TQT_SIGNAL(findNextText()), this, TQT_SLOT(findNextText())); + connect(searchWidget, TQT_SIGNAL(findPrevText()), this, TQT_SLOT(findPrevText())); + + sideBar->setMinimumWidth(80); + sideBar->setMaximumWidth(300); + + connect(_scrollView, TQT_SIGNAL(currentPageChanged(const PageNumber&)), this, TQT_SLOT(setCurrentPageNumber(const PageNumber&))); + connect(_scrollView, TQT_SIGNAL(viewSizeChanged(const TQSize&)), scrollView(), TQT_SLOT(calculateCurrentPageNumber())); + connect(_scrollView, TQT_SIGNAL(wheelEventReceived(TQWheelEvent *)), this, TQT_SLOT(wheelEvent(TQWheelEvent*))); + + connect(this, TQT_SIGNAL(enableMoveTool(bool)), _scrollView, TQT_SLOT(slotEnableMoveTool(bool))); + + splitterWidget->setCollapsible(sideBar, false); + splitterWidget->setSizes(KVSPrefs::guiLayout()); + + connect(searchWidget, TQT_SIGNAL(searchEnabled(bool)), this, TQT_SIGNAL(searchEnabled(bool))); + connect(searchWidget, TQT_SIGNAL(stopSearch()), this, TQT_SLOT(stopSearch())); +} + + +KMultiPage::~KMultiPage() +{ + writeSettings(); + + if (timer_id != -1) + killTimer(timer_id); + + delete pageCache; +} + +void KMultiPage::readSettings() +{ +} + +void KMultiPage::writeSettings() +{ + // Save TOC layout + tableOfContents->writeSettings(); + + KVSPrefs::setGuiLayout(splitterWidget->sizes()); + // Save state of the sidebar + KVSPrefs::setSideBarItem(sideBar->indexOf(sideBar->currentItem())); + KVSPrefs::writeConfig(); +} + +TQString KMultiPage::name_of_current_file() +{ + return m_file; +} + +bool KMultiPage::is_file_loaded(const TQString& filename) +{ + return (filename == m_file); +} + +void KMultiPage::slotSave_defaultFilename() +{ + slotSave(); +} + +void KMultiPage::slotSave() +{ + // Try to guess the proper ending... + TQString formats; + TQString ending; + int rindex = m_file.findRev("."); + if (rindex == -1) { + ending = TQString(); + formats = TQString(); + } else { + ending = m_file.mid(rindex); // e.g. ".dvi" + formats = fileFormats().grep(ending).join("\n"); + } + + TQString fileName = KFileDialog::getSaveFileName(TQString(), formats, 0, i18n("Save File As")); + + if (fileName.isEmpty()) + return; + + // Add the ending to the filename. I hope the user likes it that + // way. + if (!ending.isEmpty() && fileName.find(ending) == -1) + fileName = fileName+ending; + + if (TQFile(fileName).exists()) { + int r = KMessageBox::warningContinueCancel (0, i18n("The file %1\nexists. Shall I overwrite that file?").arg(fileName), + i18n("Overwrite File"), i18n("Overwrite")); + if (r == KMessageBox::Cancel) + return; + } + + TDEIO::Job *job = TDEIO::file_copy( KURL( m_file ), KURL( fileName ), 0600, true, false, true ); + connect( job, TQT_SIGNAL( result( TDEIO::Job * ) ), this, TQT_SLOT( slotIOJobFinished ( TDEIO::Job * ) ) ); + + return; +} + + +void KMultiPage::setFile(bool) +{ + return; +} + + +bool KMultiPage::closeURL() +{ +#ifdef DEBUG_KMULTIPAGE + kdDebug(1233) << "KMultiPage::closeURL()" << endl; +#endif + + if (renderer.isNull()) + return false; + + // Clear navigation history. + document_history.clear(); + + // Close the file. + renderer->setFile(TQString(), KURL()); + renderer->clear(); + + // Delete Page Widgets. + widgetList.setAutoDelete(true); + widgetList.resize(0); + widgetList.setAutoDelete(false); + + // Update ScrollView. + scrollView()->layoutPages(); + enableActions(false); + + // Clear Thumbnail List. + markList()->clear(); + + // Clear Table of Contents + tableOfContents->clear(); + + // Clear Status Bar + emit setStatusBarText(TQString()); + + return true; +} + +void KMultiPage::slotIOJobFinished ( TDEIO::Job *job ) +{ + if ( job->error() ) + job->showErrorDialog( 0L ); +} + +void KMultiPage::slotShowScrollbars(bool status) +{ + _scrollView->slotShowScrollbars(status); +} + +void KMultiPage::slotShowSidebar(bool show) +{ + if (show) + sideBar->show(); + else + sideBar->hide(); +} + +void KMultiPage::slotShowThumbnails(bool show) +{ + markList()->slotShowThumbnails(show); +} + +void KMultiPage::slotSetFullPage(bool fullpage) +{ + _scrollView->setFullScreenMode(fullpage); + if (fullpage) + slotShowSidebar(false); +} + +void KMultiPage::preferencesChanged() +{ + // We need to read the config options otherwise the KVSPrefs-object would + // not be syncronized between the kviewpart and the tdemultipage. + KVSPrefs::self()->readConfig(); + + slotShowThumbnails(KVSPrefs::showThumbnails()); + + // if we are in overviewmode and the number of columns or rows has changed + if (scrollView()->overviewMode() && + (scrollView()->getNrColumns() != KVSPrefs::overviewModeColumns() || + scrollView()->getNrRows() != KVSPrefs::overviewModeRows())) + { + setViewMode(KVSPrefs::EnumViewMode::Overview); + } + + if (KVSPrefs::changeColors() && KVSPrefs::renderMode() == KVSPrefs::EnumRenderMode::Paper) + renderer->setAccessibleBackground(true, KVSPrefs::paperColor()); + else + renderer->setAccessibleBackground(false); + + renderModeChanged(); +} + +void KMultiPage::setViewMode(int mode) +{ +#ifdef DEBUG_KMULTIPAGE + kdDebug(1233) << "KMultiPage::setViewMode(" << mode << ")" << endl; +#endif + // Save the current page number because when we are changing the columns + // and rows in the scrollview the currently shown Page probably out of view. + PageNumber currentPage = currentPageNumber(); + + // Save viewMode for future uses of KViewShell + switch (mode) + { + case KVSPrefs::EnumViewMode::SinglePage: + KVSPrefs::setViewMode(KVSPrefs::EnumViewMode::SinglePage); + + // Don't do anything if the view mode is already set + if ((scrollView()->getNrColumns() == 1) && (scrollView()->getNrRows() == 1) && (scrollView()->isContinuous() == false)) + return; + + scrollView()->setNrColumns(1); + scrollView()->setNrRows(1); + scrollView()->setContinuousViewMode(false); + // We scroll the view to the top, so that top and not the bottom + // of the visible page is shown. + scrollView()->scrollTop(); + break; + case KVSPrefs::EnumViewMode::ContinuousFacing: + KVSPrefs::setViewMode(KVSPrefs::EnumViewMode::ContinuousFacing); + + // Don't do anything if the view mode is already set + if ((scrollView()->getNrColumns() == 2) && (scrollView()->getNrRows() == 1) && (scrollView()->isContinuous() == true)) + return; + + scrollView()->setNrColumns(2); + scrollView()->setNrRows(1); + scrollView()->setContinuousViewMode(true); + break; + case KVSPrefs::EnumViewMode::Overview: + KVSPrefs::setViewMode(KVSPrefs::EnumViewMode::Overview); + + // Don't do anything if the view mode is already set + if ((scrollView()->getNrColumns() == KVSPrefs::overviewModeColumns()) && (scrollView()->getNrRows() == KVSPrefs::overviewModeRows()) && (scrollView()->isContinuous() == false)) + return; + + scrollView()->setNrColumns(KVSPrefs::overviewModeColumns()); + scrollView()->setNrRows(KVSPrefs::overviewModeRows()); + scrollView()->setContinuousViewMode(false); + // We scroll the view to the top, so that top and not the bottom + // of the visible tableau is shown. + scrollView()->scrollTop(); + break; + default: //KVSPrefs::EnumViewMode::Continuous + KVSPrefs::setViewMode(KVSPrefs::EnumViewMode::Continuous); + + // Don't do anything if the view mode is already set + if ((scrollView()->getNrColumns() == 1) && (scrollView()->getNrRows() == 1) && (scrollView()->isContinuous() == true)) + return; + + scrollView()->setNrColumns(1); + scrollView()->setNrRows(1); + scrollView()->setContinuousViewMode(true); + } + generateDocumentWidgets(currentPage); + KVSPrefs::writeConfig(); + emit viewModeChanged(); +} + +void KMultiPage::initializePageCache() +{ + pageCache = new DocumentPageCache(); +} + +DocumentWidget* KMultiPage::createDocumentWidget() +{ + DocumentWidget* documentWidget = new DocumentWidget(scrollView()->viewport(), scrollView(), pageCache, "singlePageWidget"); + connect(documentWidget, TQT_SIGNAL(clearSelection()), this, TQT_SLOT(clearSelection())); + connect(this, TQT_SIGNAL(enableMoveTool(bool)), documentWidget, TQT_SLOT(slotEnableMoveTool(bool))); + return documentWidget; +} + + +void KMultiPage::generateDocumentWidgets(const PageNumber& _startPage) +{ + PageNumber startPage = _startPage; +#ifdef DEBUG_KMULTIPAGE + kdDebug(1233) << "KMultiPage::generateDocumentWidgets(" << startPage << ")" << endl; +#endif + + // Do nothing if no document is loaded. + if (getRenderer().isNull() || getRenderer()->isEmpty()) + return; + + // This function is only called with an invalid pagenumber, when + // the file has been loaded or reloaded. + bool reload = !startPage.isValid(); + + if (reload) + { + // Find the number of the current page, for later use. + startPage = currentPageNumber(); + } + + // Make sure that startPage is in the permissible range. + if (startPage < 1) + startPage = 1; + if (startPage > numberOfPages()) + startPage = numberOfPages(); + + unsigned int tableauStartPage = startPage; + + // Find out how many widgets are needed, and resize the widgetList accordingly. + widgetList.setAutoDelete(true); + TQ_UINT16 oldwidgetListSize = widgetList.size(); + if (numberOfPages() == 0) + widgetList.resize(0); + else + { + switch (KVSPrefs::viewMode()) + { + case KVSPrefs::EnumViewMode::SinglePage: + widgetList.resize(1); + break; + case KVSPrefs::EnumViewMode::Overview: + { + // Calculate the number of pages shown in overview mode. + unsigned int visiblePages = KVSPrefs::overviewModeColumns() * KVSPrefs::overviewModeRows(); + // Calculate the number of the first page in the tableau. + tableauStartPage = startPage - ((startPage - 1) % visiblePages); + // We cannot have more widgets then pages in the document. + visiblePages = TQMIN(visiblePages, numberOfPages() - tableauStartPage + 1); + if (widgetList.size() != visiblePages) + widgetList.resize(visiblePages); + break; + } + default: + // In KVS_Continuous and KVS_ContinuousFacing all pages in the document are shown. + widgetList.resize(numberOfPages()); + } + } + bool isWidgetListResized = (widgetList.size() != oldwidgetListSize); + widgetList.setAutoDelete(false); + + // If the widgetList is empty, there is nothing left to do. + if (widgetList.size() == 0) { + scrollView()->addChild(&widgetList); + return; + } + + // Allocate DocumentWidget structures so that all entries of + // widgetList point to a valid DocumentWidget. + DocumentWidget *documentWidget; + for(TQ_UINT16 i=0; ishow(); + + connect(documentWidget, TQT_SIGNAL(localLink(const TQString &)), this, TQT_SLOT(handleLocalLink(const TQString &))); + connect(documentWidget, TQT_SIGNAL(setStatusBarText(const TQString&)), this, TQT_SIGNAL(setStatusBarText(const TQString&)) ); + } + } + + // Set the page numbers for the newly allocated widgets. How this is + // done depends on the viewMode. + if (KVSPrefs::viewMode() == KVSPrefs::EnumViewMode::SinglePage) { + // In KVS_SinglePage mode, any number between 1 and the maximum + // number of pages is acceptable. If an acceptable value is found, + // nothing is done, and otherwise '1' is set as a default. + documentWidget = widgetList[0]; + if (documentWidget != 0) { // Paranoia safety check + documentWidget->setPageNumber(startPage); + documentWidget->update(); + } else + kdError(4300) << "Zero-Pointer in widgetList in KMultiPage::generateDocumentWidgets()" << endl; + } else { + // In all other modes, the widgets will be numbered continuously, + // starting from firstShownPage. + for(TQ_UINT16 i=0; isetPageNumber(i+tableauStartPage); + else + documentWidget->setPageNumber(i+1); + } + else + kdError(4300) << "Zero-Pointer in widgetList in KMultiPage::generateDocumentWidgets()" << endl; + } + } + + // Make the changes in the widgetList known to the scrollview. so + // that the scrollview may update its contents. + scrollView()->addChild(&widgetList); + + // If the number of widgets has changed, or the viewmode has been changed the widget + // that displays the current page may not be visible anymore. Bring it back into focus. + if (isWidgetListResized || !reload) + gotoPage(startPage); +} + + +bool KMultiPage::gotoPage(const PageNumber& page) +{ + return gotoPage(page, 0, true); +} + + +bool KMultiPage::gotoPage(const PageNumber& page, int y, bool isLink) +{ +#ifdef DEBUG_KMULTIPAGE + kdDebug(1233) << "KMultiPage::gotoPage()" << endl; +#endif + + if (widgetList.size() == 0) { + kdError(4300) << "KMultiPage::gotoPage(" << page << ", y) called, but widgetList is empty" << endl; + return false; + } + + if (!page.isValid()) + { + kdDebug(1223) << "KMultiPage::gotoPage(" << page << ") invalid pageNumber." << endl; + return false; + } + + if (isLink) + document_history.add(page, y); + + DocumentWidget* pageWidget; + + // If we are in overview viewmode + if (KVSPrefs::viewMode() == KVSPrefs::EnumViewMode::Overview) + { + unsigned int visiblePages = KVSPrefs::overviewModeColumns() * KVSPrefs::overviewModeRows(); + // Pagenumber of the first visibile Page in the current tableau + unsigned int firstPage = ((DocumentWidget*)widgetList[0])->getPageNumber(); + // Pagenumber of the first page in the new tableau. + unsigned int tableauStartPage = page + 1 - (page % visiblePages); + // If these numbers arn't equal "page" is not in the current tableu. + if (firstPage != tableauStartPage) // widgets need to be updated + { + if ((numberOfPages() - tableauStartPage + 1 < visiblePages) || (widgetList.size() < visiblePages)) + { + // resize widgetList + // the pages are also set correctly by "generateDocumentWidgets" + generateDocumentWidgets(tableauStartPage); + } + else + { + // "page" is not shown in the scrollview, so we have to switch widgets. + // Here we don't need to resize the widgetList. + for (unsigned int i = 0; i < widgetList.size(); i++) + { + pageWidget = (DocumentWidget*)(widgetList[i]); + if (pageWidget != 0) + pageWidget->setPageNumber(tableauStartPage + i); + } + scrollView()->layoutPages(); + } + } + // move scrollview to "page". + // Make the widget pageWidget visible in the scrollview. Somehow this + // doesn't seem to trigger the signal contentsMoved in the + // TQScrollview, so that we better call setCurrentPage() ourselves. + pageWidget = (DocumentWidget*)(widgetList[page % visiblePages]); + + scrollView()->moveViewportToWidget(pageWidget, y); + + // Set current page number. + setCurrentPageNumber(page); + + return true; + } + else if (widgetList.size() == 1) + { + // If the widget list contains only a single element, then either + // the document contains only one page, or we are in "single page" + // view mode. In either case, we set the page number of the single + // widget to 'page' + pageWidget = (DocumentWidget*)(widgetList[0]); + + // Paranoia security check + if (pageWidget == 0) { + kdError(4300) << "KMultiPage::goto_Page() called with widgetList.size() == 1, but widgetList[0] == 0" << endl; + return false; + } + + if (pageCache->sizeOfPageInPixel(currentPageNumber()) == pageCache->sizeOfPageInPixel(page)) + { + // We are rendering the page before we switch the widget to the new page. + // To make a smooth transition. We only do this if the size of the current and new page are equal, + // otherwise we would have to render the page twice, if autozoom is enabled. + pageCache->getPage(page); + } + + pageWidget->setPageNumber(page); + scrollView()->layoutPages(); + scrollView()->moveViewportToWidget(pageWidget, y); + } else { + // There are multiple widgets, then we are either in the + // "Continuous" or in the "Continouous-Facing" view mode. In that + // case, we find the widget which is supposed to display page + // 'page' and move the scrollview to make it visible + + // Paranoia security checks + if (widgetList.size() < page) { + kdError(4300) << "KMultiPage::goto_Page(page,y ) called with widgetList.size()=" << widgetList.size() << ", and page=" << page << endl; + return false; + } + pageWidget = (DocumentWidget*)(widgetList[page-1]); + if (pageWidget == 0) { + kdError(4300) << "KMultiPage::goto_Page() called with widgetList.size() > 1, but widgetList[page] == 0" << endl; + return false; + } + + scrollView()->moveViewportToWidget(pageWidget, y); + } + + if (isLink && y != 0) + pageWidget->flash(y); + + // Set current page number. + setCurrentPageNumber(page); + return true; +} + + +void KMultiPage::handleLocalLink(const TQString &linkText) +{ +#ifdef DEBUG_SPECIAL + kdDebug(4300) << "hit: local link to " << linkText << endl; +#endif + + if (renderer.isNull()) { + kdError(4300) << "KMultiPage::handleLocalLink( " << linkText << " ) called, but renderer==0" << endl; + return; + } + + TQString locallink; + if (linkText[0] == '#' ) + locallink = linkText.mid(1); // Drop the '#' at the beginning + else + locallink = linkText; + + Anchor anch = renderer->findAnchor(locallink); + + if (anch.isValid()) + gotoPage(anch); + else { + if (linkText[0] != '#' ) { + // We could in principle use TDEIO::Netaccess::run() here, but + // it is perhaps not a very good idea to allow a DVI-file to + // specify arbitrary commands, such as "rm -rvf /". Using + // the kfmclient seems to be MUCH safer. + TQUrl DVI_Url(m_file); + TQUrl Link_Url(DVI_Url, linkText, true); + + TQStringList args; + args << "openURL"; + args << Link_Url.toString(); + kapp->tdeinitExec("kfmclient", args); + } + } +} + +void KMultiPage::setCurrentPageNumber(const PageNumber& page) +{ +#ifdef DEBUG_KMULTIPAGE + kdDebug(1233) << "KMultiPage::setCurrentPageNumber()" << endl; +#endif + + if (page != currentPageNumber()) + { + markList()->setCurrentPageNumber(page); + emit pageInfo(numberOfPages(), currentPageNumber()); + } +} + +PageNumber KMultiPage::currentPageNumber() +{ + return markList()->currentPageNumber(); +} + +void KMultiPage::doGoBack() +{ + HistoryItem *it = document_history.back(); + if (it != 0) + gotoPage(it->page, it->ypos, false); // Do not add a history item. + else + kdDebug(4300) << "Faulty return -- bad history buffer" << endl; + return; +} + + +void KMultiPage::doGoForward() +{ + HistoryItem *it = document_history.forward(); + if (it != 0) + gotoPage(it->page, it->ypos, false); // Do not add a history item. + else + kdDebug(4300) << "Faulty return -- bad history buffer" << endl; + return; +} + + +void KMultiPage::renderModeChanged() +{ + pageCache->clear(); + + generateDocumentWidgets(); + scrollView()->layoutPages(); + + for (TQ_UINT16 i=0; i < widgetList.size(); i++) + { + DocumentWidget* documentWidget = widgetList[i]; + if (documentWidget == 0) + continue; + + documentWidget->update(); + } + + markList()->repaintThumbnails(); +} + + +void KMultiPage::repaintAllVisibleWidgets() +{ +#ifdef DEBUG_KMULTIPAGE + kdDebug(1233) << "KMultiPage::repaintAllVisibleWidgets()" << endl; +#endif + + bool everResized = false; + + // Go through the list of widgets and resize them, if necessary + for(TQ_UINT16 i=0; isizeOfPageInPixel(documentWidget->getPageNumber()); + if (pageSize != documentWidget->pageSize()) + { + documentWidget->setPageSize(pageSize); + everResized = true; + } + } + + // If at least one widget was resized, all widgets should be + // re-aligned. This will automatically update all necessary + // widgets. + if (everResized == true) + scrollView()->layoutPages(true); +} + + +double KMultiPage::setZoom(double zoom) +{ +#ifdef DEBUG_KMULTIPAGE + kdDebug(1233) << "KMultiPage::setZoom(" << zoom << ")" << endl; +#endif + + if (zoom < ZoomLimits::MinZoom/1000.0) + zoom = ZoomLimits::MinZoom/1000.0; + if (zoom > ZoomLimits::MaxZoom/1000.0) + zoom = ZoomLimits::MaxZoom/1000.0; + + pageCache->setResolution(TQPaintDevice::x11AppDpiX()*zoom); + emit zoomChanged(); + return zoom; +} + + +void KMultiPage::print() +{ + // Paranoid safety checks + if (renderer.isNull()) + return; + if (renderer->isEmpty()) + return; + + // Allocate the printer structure + KPrinter *printer = getPrinter(); + if (printer == 0) + return; + + // initialize the printer using the print dialog + if ( printer->setup(parentWdg, i18n("Print %1").arg(m_file.section('/', -1))) ) { + // Now do the printing. + TQValueList pageList = printer->pageList(); + if (pageList.isEmpty()) + printer->abort(); + else { + printer->setCreator("kviewshell"); + printer->setDocName(m_file); + RenderedDocumentPagePrinter rdpp(printer); + + // Obtain papersize information that is required to perform + // the resizing and centering, if this is wanted by the user. + Length paperWidth, paperHeight; + TQPaintDeviceMetrics pdm(printer); + paperWidth.setLength_in_mm(pdm.widthMM()); + paperHeight.setLength_in_mm(pdm.heightMM()); + + TQValueList::ConstIterator it = pageList.begin(); + while (true) { + SimplePageSize paper_s(paperWidth, paperHeight); + + // Printing usually takes a while. This is to keep the GUI + // updated. + tqApp->processEvents(); + + TQPainter *paint = rdpp.getPainter(); + if (paint != 0) { + // Before drawing the page, we figure out the zoom-value, + // taking the "page sizes and placement" options from the + // printer dialog into account + double factual_zoom = 1.0; + + // Obtain pagesize information that is required to perform the + // resizing and centering, if this is wanted by the user. + SimplePageSize page_s = sizeOfPage(*it); + + paint->save(); + + // Rotate the page, if appropriate. By default, page + // rotation is enabled. This is also hardcoded into + // KPrintDialogPage_PageOptions.cpp + if ((page_s.isPortrait() != paper_s.isPortrait()) && (printer->option( "kde-kviewshell-rotatepage" ) != "false")) { + paint->rotate(-90); + paint->translate(-printer->resolution()*paperHeight.getLength_in_inch(), 0.0); + paper_s = paper_s.rotate90(); + } + + double suggested_zoom = page_s.zoomToFitInto(paper_s); + + // By default, "shrink page" and "expand page" are off. This + // is also hardcoded into KPrintDialogPage_PageOptions.cpp + if ((suggested_zoom < 1.0) && (printer->option( "kde-kviewshell-shrinkpage" ) == "true")) + factual_zoom = suggested_zoom; + if ((suggested_zoom > 1.0) && (printer->option( "kde-kviewshell-expandpage" ) == "true")) + factual_zoom = suggested_zoom; + + Length delX, delY; + // By default, "center page" is on. This is also hardcoded + // into KPrintDialogPage_PageOptions.cpp + if (printer->option( "kde-kviewshell-centerpage" ) != "false") { + delX = (paper_s.width() - page_s.width()*factual_zoom)/2.0; + delY = (paper_s.height() - page_s.height()*factual_zoom)/2.0; + } + + // Now draw the page. + rdpp.setPageNumber(*it); + + double resolution = factual_zoom*printer->resolution(); + + paint->translate(resolution*delX.getLength_in_inch(), resolution*delY.getLength_in_inch()); + renderer->drawPage(resolution, &rdpp); + paint->restore(); + } + ++it; + if ((it == pageList.end()) || (printer->aborted() == true)) + break; + + printer->newPage(); + } + // At this point the rdpp is destructed. The last page is then + // printed. + } + } + delete printer; +} + + +void KMultiPage::setRenderer(DocumentRenderer* _renderer) +{ + renderer = _renderer; + + // Initialize documentPageCache. + initializePageCache(); + pageCache->setRenderer(renderer); + + _markList->setPageCache(pageCache); + + // Clear widget list. + widgetList.resize(0); + + // Relay signals. + connect(renderer, TQT_SIGNAL(setStatusBarText(const TQString&)), this, TQT_SIGNAL(setStatusBarText(const TQString&))); + connect(pageCache, TQT_SIGNAL(paperSizeChanged()), this, TQT_SLOT(renderModeChanged())); + connect(pageCache, TQT_SIGNAL(textSelected(bool)), this, TQT_SIGNAL(textSelected(bool))); + connect(renderer, TQT_SIGNAL(documentIsChanged()), this, TQT_SLOT(renderModeChanged())); + connect(this, TQT_SIGNAL(zoomChanged()), this, TQT_SLOT(repaintAllVisibleWidgets())); +} + + +void KMultiPage::updateWidgetSize(const PageNumber& pageNumber) +{ + for(TQ_UINT16 i=0; igetPageNumber() == pageNumber) + { + // Resize, if necessary + TQSize pageSize = pageCache->sizeOfPageInPixel(documentWidget->getPageNumber()); + if (pageSize != documentWidget->pageSize()) + { + documentWidget->setPageSize(pageSize); + scrollView()->layoutPages(); + } + // We have just one widget per page. + break; + } + } + + // Update marklist + markList()->updateWidgetSize(pageNumber); +} + + +PageNumber KMultiPage::widestPage() const +{ + Length maxWidth; + PageNumber pageNumber = 1; + + for (int i = 1; i <= numberOfPages(); i++) + { + Length width = pageCache->sizeOfPage(i).width(); + + if (width > maxWidth) + { + maxWidth = width; + pageNumber = i; + } + } + + return pageNumber; +} + +double KMultiPage::zoomForWidthColumns(unsigned int viewportWidth) const +{ + Length maxLeftColumnWidth; + Length maxRightColumnWidth; + Length maxWidth; + + PageNumber widestPageLeft; + PageNumber widestPageRight; + + for (int i = 1; i <= numberOfPages(); i++) + { + Length width = pageCache->sizeOfPage(i).width(); + + if ( i % 2 == 0) // page is in left column + { + if (width > maxLeftColumnWidth) + { + maxLeftColumnWidth = width; + widestPageLeft = i; + } + } + + if ( i % 2 == 1) // page is in right column + { + if (width > maxRightColumnWidth) + maxRightColumnWidth = width; + widestPageRight = i; + } + } + + double ratio = maxLeftColumnWidth / (maxLeftColumnWidth + maxRightColumnWidth); + + // This number is the amount of space the left column should occupy in the viewport. + unsigned int leftTargetWidth = (unsigned int)(ratio * viewportWidth); + + return pageCache->sizeOfPage(widestPageLeft).zoomForWidth(leftTargetWidth); +} + +double KMultiPage::calculateFitToHeightZoomValue() +{ + PageNumber pageNumber = 1; + + // See below, in the documentation of the method "calculatefitToWidthZoomLevel" + // for an explanation of the complicated calculation we are doing here. + int columns = scrollView()->getNrColumns(); + int rows = scrollView()->getNrRows(); + int continuousViewmode = scrollView()->isContinuous(); + bool fullScreenMode = scrollView()->fullScreenMode(); + + if (columns == 1 && rows == 1 && !continuousViewmode) // single page mode + { + pageNumber = currentPageNumber(); + if (!pageNumber.isValid()) + pageNumber = 1; + } + + int pageDistance = scrollView()->distanceBetweenPages(); + if (columns == 1 && rows == 1 && !continuousViewmode && fullScreenMode) + { + // In Single Page Fullscreen Mode we want to fit the page to the + // window without a margin around it. + pageDistance = 0; + } + + int targetViewportHeight = scrollView()->viewportSize(0,0).height(); + int targetPageHeight = (targetViewportHeight - rows*pageDistance)/rows; + int targetPageWidth = (int)(targetPageHeight * pageCache->sizeOfPage(pageNumber).aspectRatio() ); + int targetViewportWidth = targetPageWidth * columns + (columns+1)*pageDistance; + targetViewportHeight = scrollView()->viewportSize(targetViewportWidth, targetViewportHeight).height(); + targetPageHeight = (targetViewportHeight - rows*pageDistance)/rows; + + return pageCache->sizeOfPage(pageNumber).zoomForHeight(targetPageHeight); +} + + +double KMultiPage::calculateFitToWidthZoomValue() +{ + PageNumber pageNumber = 1; + + int columns = scrollView()->getNrColumns(); + int rows = scrollView()->getNrRows(); + int continuousViewmode = scrollView()->isContinuous(); + bool fullScreenMode = scrollView()->fullScreenMode(); + + if (columns == 1 && rows == 1 && !continuousViewmode) // single page mode + { + // To calculate the zoom level in single page mode we need the size + // of the current page. When a new document is opened this function + // is called while the currentPageNumber is invalid. We use the size + // of the first page of the document in this case. + pageNumber = currentPageNumber(); + if (!pageNumber.isValid()) + pageNumber = 1; + } + + if (columns == 1 && rows == 1 && continuousViewmode) // continuous viewmode + { + pageNumber = widestPage(); + if (!pageNumber.isValid()) + pageNumber = 1; + } + + // rows should be 1 for Single Page Viewmode, + // the number of Pages in Continuous Viewmode + // and number of Pages/2 in Continuous-Facing Viewmode + if (continuousViewmode) + rows = (int)(ceil(numberOfPages() / (double)columns)); + + int pageDistance = scrollView()->distanceBetweenPages(); + if (columns == 1 && rows == 1 && !continuousViewmode && fullScreenMode) + { + // In Single Page Fullscreen Mode we want to fit the page to the + // window without a margin around it. + pageDistance = 0; + } + // There is a slight complication here... if we just take the width + // of the viewport and scale the contents by a factor x so that it + // fits the viewport exactly, then, depending on chosen papersize + // (landscape, etc.), the contents may be higher than the viewport + // and the TQScrollview may or may not insert a scrollbar at the + // right. If the scrollbar appears, then the usable width of the + // viewport becomes smaller, and scaling by x does not really fit + // the (now smaller page) anymore. + + // Calculate the width and height of the view, disregarding the + // possible complications with scrollbars, e.g. assuming the maximal + // space is available. + + // width of the widget excluding possible scrollbars + int targetViewportWidth = scrollView()->viewportSize(0,0).width(); + + // maximal width of a single page + int targetPageWidth = (targetViewportWidth - (columns+1) * pageDistance) / columns; + + // maximal height of a single page + int targetPageHeight = (int)(targetPageWidth/pageCache->sizeOfPage(pageNumber).aspectRatio()); + // FIXME: this is only correct if all pages in the document have the same height + int targetViewportHeight = rows * targetPageHeight + (rows+1) * pageDistance; + + // Think again, this time use only the area which is really + // acessible (which, in case that targetWidth targetHeight don't fit + // the viewport, is really smaller because of the scrollbars). + targetViewportWidth = scrollView()->viewportSize(targetViewportWidth, targetViewportHeight).width(); + + if (columns == 2 && continuousViewmode) // continuous facing + { + // TODO Generalize this for more than 2 columns + return zoomForWidthColumns(targetViewportWidth - (columns+1) * pageDistance); + } + + // maximal width of a single page (now the scrollbars are taken into account) + targetPageWidth = (targetViewportWidth - (columns+1) * pageDistance) / columns; + + return pageCache->sizeOfPage(pageNumber).zoomForWidth(targetPageWidth); +} + + +void KMultiPage::prevPage() +{ + TQ_UINT8 cols = scrollView()->getNrColumns(); + TQ_UINT8 rows = scrollView()->getNrRows(); + + PageNumber np = 1; + if (cols*rows < currentPageNumber()) + { + np = currentPageNumber() - cols*rows; + } + + gotoPage(np); +} + + +void KMultiPage::nextPage() +{ + TQ_UINT8 cols = scrollView()->getNrColumns(); + TQ_UINT8 rows = scrollView()->getNrRows(); + + PageNumber np = TQMIN(currentPageNumber() + cols*rows, (TQ_UINT16)numberOfPages()); + + gotoPage(np); +} + + +void KMultiPage::firstPage() +{ + gotoPage(1); +} + + +void KMultiPage::lastPage() +{ + gotoPage(numberOfPages()); +} + + +void KMultiPage::scroll(TQ_INT32 deltaInPixel) +{ + TQScrollBar* scrollBar = scrollView()->verticalScrollBar(); + if (scrollBar == 0) { + kdError(4300) << "KMultiPage::scroll called without scrollBar" << endl; + return; + } + + if (deltaInPixel < 0) { + if (scrollBar->value() == scrollBar->minValue()) { + if ( (currentPageNumber() == 1) || (changePageDelayTimer.isActive()) ) + return; + + if (scrollView()->isContinuous()) + return; + + changePageDelayTimer.stop(); + prevPage(); + + scrollView()->setContentsPos(scrollView()->contentsX(), scrollBar->maxValue()); + return; + } + } + + if (deltaInPixel > 0) { + if (scrollBar->value() == scrollBar->maxValue()) { + if ( (currentPageNumber() == numberOfPages()) || (changePageDelayTimer.isActive()) ) + return; + + if (scrollView()->isContinuous()) + return; + + changePageDelayTimer.stop(); + nextPage(); + + scrollView()->setContentsPos(scrollView()->contentsX(), 0); + return; + } + } + + scrollBar->setValue(scrollBar->value() + deltaInPixel); + + if ( (scrollBar->value() == scrollBar->maxValue()) || (scrollBar->value() == scrollBar->minValue()) ) + changePageDelayTimer.start(200,true); + else + changePageDelayTimer.stop(); +} + + +void KMultiPage::scrollUp() +{ + TQScrollBar* scrollBar = scrollView()->verticalScrollBar(); + if (scrollBar == 0) + return; + + scroll(-scrollBar->lineStep()); +} + + +void KMultiPage::scrollDown() +{ + TQScrollBar* scrollBar = scrollView()->verticalScrollBar(); + if (scrollBar == 0) + return; + + scroll(scrollBar->lineStep()); +} + +void KMultiPage::scrollLeft() +{ + TQScrollBar* scrollBar = scrollView()->horizontalScrollBar(); + if (scrollBar) + scrollBar->subtractLine(); +} + + +void KMultiPage::scrollRight() +{ + TQScrollBar* scrollBar = scrollView()->horizontalScrollBar(); + if (scrollBar) + scrollBar->addLine(); +} + + +void KMultiPage::scrollUpPage() +{ + TQScrollBar* scrollBar = scrollView()->verticalScrollBar(); + if (scrollBar) + scrollBar->subtractPage(); +} + + +void KMultiPage::scrollDownPage() +{ + TQScrollBar* scrollBar = scrollView()->verticalScrollBar(); + if (scrollBar) + scrollBar->addPage(); +} + + +void KMultiPage::scrollLeftPage() +{ + TQScrollBar* scrollBar = scrollView()->horizontalScrollBar(); + if (scrollBar) + scrollBar->subtractPage(); +} + + +void KMultiPage::scrollRightPage() +{ + TQScrollBar* scrollBar = scrollView()->horizontalScrollBar(); + if (scrollBar) + scrollBar->addPage(); +} + + +void KMultiPage::readDown() +{ + PageView* sv = scrollView(); + + if (sv->atBottom()) + { + if (sv->isContinuous()) + return; + + if (currentPageNumber() == numberOfPages()) + return; + + nextPage(); + sv->setContentsPos(sv->contentsX(), 0); + } + else + sv->readDown(); +} + + +void KMultiPage::readUp() +{ + PageView* sv = scrollView(); + + if (sv->atTop()) + { + if (sv->isContinuous()) + return; + + if (currentPageNumber() == 1) + return; + + prevPage(); + sv->setContentsPos(sv->contentsX(), sv->contentsHeight()); + } + else + sv->readUp(); +} + + +void KMultiPage::jumpToReference(const TQString& reference) +{ + if (renderer.isNull()) + return; + + gotoPage(renderer->parseReference(reference)); +} + + +void KMultiPage::gotoPage(const Anchor &a) +{ + if (!a.page.isValid() || (renderer.isNull())) + return; + + gotoPage(a.page, (int)(a.distance_from_top.getLength_in_inch()*pageCache->getResolution() + 0.5), true); +} + + +void KMultiPage::gotoPage(const TextSelection& selection) +{ + if (selection.isEmpty()) + { + kdError(4300) << "KMultiPage::gotoPage(...) called with empty TextSelection." << endl; + return; + } + + RenderedDocumentPage* pageData = pageCache->getPage(selection.getPageNumber()); + + if (pageData == 0) { +#ifdef DEBUG_DOCUMENTWIDGET + kdDebug(4300) << "DocumentWidget::paintEvent: no documentPage generated" << endl; +#endif + return; + } + + switch (widgetList.size()) + { + case 0: + kdError(4300) << "KMultiPage::select() while widgetList is empty" << endl; + break; + case 1: + ((DocumentWidget*)widgetList[0])->select(selection); + break; + default: + if (widgetList.size() < currentPageNumber()) + kdError(4300) << "KMultiPage::select() while widgetList.size()=" << widgetList.size() << "and currentPageNumber()=" << currentPageNumber() << endl; + else + ((DocumentWidget*)widgetList[selection.getPageNumber() - 1])->select(selection); + } + + unsigned int y = pageData->textBoxList[selection.getSelectedTextStart()].box.top(); + gotoPage(selection.getPageNumber(), y, false); +} + + +void KMultiPage::doSelectAll() +{ + switch( widgetList.size() ) { + case 0: + kdError(4300) << "KMultiPage::doSelectAll() while widgetList is empty" << endl; + break; + case 1: + ((DocumentWidget *)widgetList[0])->selectAll(); + break; + default: + if (widgetList.size() < currentPageNumber()) + kdError(4300) << "KMultiPage::doSelectAll() while widgetList.size()=" << widgetList.size() << "and currentPageNumber()=" << currentPageNumber() << endl; + else + ((DocumentWidget *)widgetList[currentPageNumber()-1])->selectAll(); + } +} + + + +void KMultiPage::showFindTextDialog() +{ + if ((renderer.isNull()) || (renderer->supportsTextSearch() == false)) + return; + + searchWidget->show(); + searchWidget->setFocus(); +} + +void KMultiPage::stopSearch() +{ + if (searchInProgress) + { + // stop the search + searchInProgress = false; + } + else + searchWidget->hide(); +} + +void KMultiPage::findNextText() +{ +#ifdef KDVI_MULTIPAGE_DEBUG + kdDebug(4300) << "KMultiPage::findNextText() called" << endl; +#endif + + searchInProgress = true; + + // Used to remember if the documentPage we use is from the cache. + // If not we need to delete it manually to avoid a memory leak. + bool cachedPage = false; + + TQString searchText = searchWidget->getText(); + + if (searchText.isEmpty()) + { + kdError(4300) << "KMultiPage::findNextText() called when search text was empty" << endl; + return; + } + + bool case_sensitive = searchWidget->caseSensitive(); + + // Find the page and text position on the page where the search will + // start. If nothing is selected, we start at the beginning of the + // current page. Otherwise, start after the selected text. TODO: + // Optimize this to get a better 'user feeling' + TQ_UINT16 startingPage; + TQ_UINT16 startingTextItem; + + TextSelection userSelection = pageCache->selectedText(); + if (userSelection.isEmpty()) + { + startingPage = currentPageNumber(); + startingTextItem = 0; + } + else + { + startingPage = userSelection.getPageNumber(); + startingTextItem = userSelection.getSelectedTextEnd()+1; + } + + TextSelection foundSelection; + + RenderedDocumentPagePixmap* searchPage = 0; + + for(unsigned int i = 0; i < numberOfPages(); i++) + { + unsigned int pageNumber = (i + startingPage - 1) % numberOfPages() + 1; + + if (!searchInProgress) + { + // Interrupt the search + setStatusBarText(i18n("Search interrupted")); + if (!cachedPage) + delete searchPage; + return; + } + + if (i != 0) + { + setStatusBarText(i18n("Search page %1 of %2").arg(pageNumber).arg(numberOfPages())); + kapp->processEvents(); + } + + // Check if we already have a rendered version of the page in the cache. As we are only interested in the + // text we don't care about the page size. + if (pageCache->isPageCached(pageNumber)) + { + // If the last search page used was created locally, we need to destroy it + if (!cachedPage) + delete searchPage; + + searchPage = pageCache->getPage(pageNumber); + cachedPage = true; + } + else + { + // If the page is not in the cache we draw a small version of it, since this is faster. + + // We only create a new searchPage if we need to, otherwise reuse the existing one. + if (!searchPage || cachedPage) + searchPage = new RenderedDocumentPagePixmap(); + + cachedPage = false; + + searchPage->resize(1,1); + searchPage->setPageNumber(pageNumber); + renderer->getText(searchPage); + } + + // If there is no text in the current page, try the next one. + if (searchPage->textBoxList.size() == 0) + continue; + + foundSelection = searchPage->find(searchText, startingTextItem, case_sensitive); + + if (foundSelection.isEmpty()) + { + // In the next page, start search again at the beginning. + startingTextItem = 0; + clearSelection(); + + if (pageNumber == numberOfPages()) + { + int answ = KMessageBox::questionYesNo(scrollView(), + i18n("The search string %1 could not be found by the " + "end of the document. Should the search be restarted from the beginning " + "of the document?").arg(searchText), + i18n("Text Not Found"), KStdGuiItem::cont(), KStdGuiItem::cancel()); + + if (answ != KMessageBox::Yes) + { + setStatusBarText(TQString()); + searchInProgress = false; + if (!cachedPage) + delete searchPage; + return; + } + } + } + else + { + pageCache->selectText(foundSelection); + gotoPage(pageCache->selectedText()); + setStatusBarText(TQString()); + searchInProgress = false; + if (!cachedPage) + delete searchPage; + return; + } + } + + KMessageBox::sorry(scrollView(), i18n("The search string %1 could not be found.").arg(searchText)); + setStatusBarText(TQString()); + searchInProgress = false; + if (!cachedPage) + delete searchPage; +} + + +void KMultiPage::findPrevText() +{ +#ifdef KDVI_MULTIPAGE_DEBUG + kdDebug(4300) << "KMultiPage::findPrevText() called" << endl; +#endif + + searchInProgress = true; + + // Used to remember if the documentPage we use is from the cache. + // If not we need to delete it manually to avoid a memory leak. + bool cachedPage = false; + + TQString searchText = searchWidget->getText(); + + if (searchText.isEmpty()) + { + kdError(4300) << "KMultiPage::findPrevText() called when search text was empty" << endl; + return; + } + + bool case_sensitive = searchWidget->caseSensitive(); + + // Find the page and text position on the page where the search will + // start. If nothing is selected, we start at the beginning of the + // current page. Otherwise, start after the selected text. TODO: + // Optimize this to get a better 'user feeling' + unsigned int startingPage; + int startingTextItem; + + TextSelection userSelection = pageCache->selectedText(); + if (userSelection.isEmpty()) + { + startingPage = currentPageNumber(); + startingTextItem = -1; + } + else + { + startingPage = userSelection.getPageNumber(); + startingTextItem = userSelection.getSelectedTextStart()-1; + } + + TextSelection foundSelection; + + RenderedDocumentPagePixmap* searchPage = 0; + + for(unsigned int i = 0; i < numberOfPages(); i++) + { + int pageNumber = startingPage - i; + if (pageNumber <= 0) + pageNumber += numberOfPages(); + + if (!searchInProgress) + { + // Interrupt the search + setStatusBarText(i18n("Search interrupted")); + if (!cachedPage) + delete searchPage; + return; + } + + if (i != 0) + { + setStatusBarText(i18n("Search page %1 of %2").arg(pageNumber).arg(numberOfPages())); + kapp->processEvents(); + } + + // Check if we already have a rendered version of the page in the cache. As we are only interested in the + // text we don't care about the page size. + if (pageCache->isPageCached(pageNumber)) + { + // If the last search page used was created locally, we need to destroy it + if (!cachedPage) + delete searchPage; + + searchPage = pageCache->getPage(pageNumber); + cachedPage = true; + } + else + { + // If the page is not in the cache we draw a small version of it, since this is faster. + + // We only create a new searchPage if we need to, otherwise reuse the existing one. + if (!searchPage || cachedPage) + searchPage = new RenderedDocumentPagePixmap(); + + cachedPage = false; + + searchPage->resize(1,1); + searchPage->setPageNumber(pageNumber); + renderer->getText(searchPage); + } + + // If there is no text in the current page, try the next one. + if (searchPage->textBoxList.size() == 0) + continue; + + foundSelection = searchPage->findRev(searchText, startingTextItem, case_sensitive); + + if (foundSelection.isEmpty()) + { + // In the next page, start search again at the beginning. + startingTextItem = -1; + clearSelection(); + + if (pageNumber == 1) + { + int answ = KMessageBox::questionYesNo(scrollView(), + i18n("The search string %1 could not be found by the " + "beginning of the document. Should the search be restarted from the end " + "of the document?").arg(searchText), + i18n("Text Not Found"), KStdGuiItem::cont(), KStdGuiItem::cancel()); + + if (answ != KMessageBox::Yes) + { + setStatusBarText(TQString()); + searchInProgress = false; + if (!cachedPage) + delete searchPage; + return; + } + } + } + else + { + pageCache->selectText(foundSelection); + gotoPage(pageCache->selectedText()); + setStatusBarText(TQString()); + searchInProgress = false; + if (!cachedPage) + delete searchPage; + return; + } + } + + KMessageBox::sorry(scrollView(), i18n("The search string %1 could not be found.").arg(searchText)); + setStatusBarText(TQString()); + searchInProgress = false; + if (!cachedPage) + delete searchPage; +} + + +void KMultiPage::clearSelection() +{ + PageNumber page = pageCache->selectedText().getPageNumber(); + + if (!page.isValid()) + return; + + // Clear selection + pageCache->deselectText(); + + // Now we need to update the widget which contained the selection + switch(widgetList.size()) + { + case 0: + kdError(4300) << "KMultiPage::clearSelection() while widgetList is empty" << endl; + break; + case 1: + widgetList[0]->update(); + break; + default: + for (unsigned int i = 0; i < widgetList.size(); i++) + { + DocumentWidget* pageWidget = (DocumentWidget*)widgetList[i]; + if (pageWidget->getPageNumber() == page) + { + pageWidget->update(); + break; + } + } + } +} + +void KMultiPage::copyText() +{ + pageCache->selectedText().copyText(); +} + +void KMultiPage::timerEvent( TQTimerEvent * ) +{ +#ifdef KMULTIPAGE_DEBUG + kdDebug(4300) << "Timer Event " << endl; +#endif + reload(); +} + + +void KMultiPage::reload() +{ +#ifdef KMULTIPAGE_DEBUG + kdDebug(4300) << "Reload file " << m_file << endl; +#endif + + if (renderer.isNull()) { + kdError() << "KMultiPage::reload() called, but no renderer was set" << endl; + return; + } + + if (renderer->isValidFile(m_file)) { + pageCache->clear(); + pageCache->deselectText(); + document_history.clear(); + emit setStatusBarText(i18n("Reloading file %1").arg(m_file)); + TQ_INT32 pg = currentPageNumber(); + + killTimer(timer_id); + timer_id = -1; + bool r = renderer->setFile(m_file, m_url); + + generateDocumentWidgets(); + + // Set Table of Contents + tableOfContents->setContents(renderer->getBookmarks()); + + // Adjust number of widgets in the thumbnail sidebar + markList()->clear(); + markList()->setNumberOfPages(numberOfPages(), KVSPrefs::showThumbnails()); + + setCurrentPageNumber(pg); + setFile(r); + emit setStatusBarText(TQString()); + } else { + if (timer_id == -1) + timer_id = startTimer(1000); + } +} + + +bool KMultiPage::openFile() +{ + if (renderer.isNull()) { + kdError(4300) << "KMultiPage::openFile() called when no renderer was set" << endl; + return false; + } + + pageCache->deselectText(); + document_history.clear(); + pageCache->clear(); + emit setStatusBarText(i18n("Loading file %1").arg(m_file)); + + bool r = renderer->setFile(m_file, m_url); + + if (r) { + setCurrentPageNumber(1); + generateDocumentWidgets(); + + // Set number of widgets in the thumbnail sidebar + markList()->clear(); + markList()->setNumberOfPages(numberOfPages(), KVSPrefs::showThumbnails()); + + TQString reference = url().ref(); + if (!reference.isEmpty()) + gotoPage(renderer->parseReference(reference)); + + // Set Table of Contents + tableOfContents->setContents(renderer->getBookmarks()); + } else + m_file = TQString(); + + + setFile(r); + + // Clear Statusbar + emit setStatusBarText(TQString()); + return r; +} + + +bool KMultiPage::openURL(const TQString &filename, const KURL &base_url) +{ + m_file = filename; + m_url = base_url; + + bool success = openFile(); + if (success) + setCurrentPageNumber(1); + + return success; +} + + +void KMultiPage::enableActions(bool fileLoaded) +{ + Q_UNUSED(fileLoaded); +} + +void KMultiPage::wheelEvent(TQWheelEvent *e) +{ + TQScrollBar *sb = scrollView()->verticalScrollBar(); + if (sb == 0) + return; + + // Zoom in/out + if (e->state() & ControlButton) + { + if (e->delta() < 0) + emit zoomOut(); + else + emit zoomIn(); + return; + } + + TQ_INT32 pxl = -(e->delta()*sb->lineStep())/60; + if (pxl == 0) + { + if (e->delta() > 0) + pxl = -1; + else + pxl = 1; + } + + // Faster scrolling + if (e->state() & ShiftButton) + pxl *= 10; + + scroll(pxl); +} + + +KPrinter *KMultiPage::getPrinter(bool enablePageSizeFeatures) +{ + // Allocate a new KPrinter structure, if necessary + KPrinter *printer = new KPrinter(true); + if (printer == 0) { + kdError(1223) << "KMultiPage::getPrinter(..): Cannot allocate new KPrinter structure" << endl; + return 0; + } + + // Allocate a new KPrintDialogPage structure and add it to the + // printer, if the tdemultipage implementation requests that + if (enablePageSizeFeatures == true) { + KPrintDialogPage_PageOptions *pageOptions = new KPrintDialogPage_PageOptions(); + if (pageOptions == 0) { + kdError(1223) << "KMultiPage::getPrinter(..): Cannot allocate new KPrintDialogPage_PageOptions structure" << endl; + delete printer; + return 0; + } + printer->addDialogPage( pageOptions ); + } + + // Feed the printer with useful defaults and information. + printer->setPageSelection( KPrinter::ApplicationSide ); + printer->setCurrentPage( currentPageNumber() ); + printer->setMinMax( 1, numberOfPages() ); + printer->setFullPage( true ); + + // If pages are marked, give a list of marked pages to the + // printer. We try to be smart and optimize the list by using ranges + // ("5-11") wherever possible. The user will be tankful for + // that. Complicated? Yeah, but that's life. + TQValueList selectedPageNo = selectedPages(); + if (selectedPageNo.isEmpty() == true) + printer->setOption( "kde-range", "" ); + else { + int commaflag = 0; + TQString range; + TQValueList::ConstIterator it = selectedPageNo.begin(); + do{ + int val = *it; + if (commaflag == 1) + range += TQString(", "); + else + commaflag = 1; + int endval = val; + if (it != selectedPageNo.end()) { + TQValueList::ConstIterator jt = it; + jt++; + do{ + int val2 = *jt; + if (val2 == endval+1) + endval++; + else + break; + jt++; + } while( jt != selectedPageNo.end() ); + it = jt; + } else + it++; + if (endval == val) + range += TQString("%1").arg(val); + else + range += TQString("%1-%2").arg(val).arg(endval); + } while (it != selectedPageNo.end() ); + printer->setOption( "kde-range", range ); + } + + return printer; +} + +void KMultiPage::doExportText() +{ + // Generate a suggestion for a reasonable file name + TQString suggestedName = url().filename(); + suggestedName = suggestedName.left(suggestedName.find(".")) + ".txt"; + + TQString fileName = KFileDialog::getSaveFileName(suggestedName, i18n("*.txt|Plain Text (Latin 1) (*.txt)"), scrollView(), i18n("Export File As")); + + if (fileName.isEmpty()) + return; + + TQFileInfo finfo(fileName); + if (finfo.exists()) + { + int r = KMessageBox::warningContinueCancel (scrollView(), + i18n("The file %1\nexists. Do you want to overwrite that file?").arg(fileName), + i18n("Overwrite File"), i18n("Overwrite")); + + if (r == KMessageBox::Cancel) + return; + } + + TQFile textFile(fileName); + textFile.open(IO_WriteOnly); + TQTextStream stream(&textFile); + + TQProgressDialog progress(i18n("Exporting to text..."), i18n("Abort"), renderer->totalPages(), + scrollView(), "export_text_progress", true); + progress.setMinimumDuration(300); + + RenderedDocumentPagePixmap dummyPage; + dummyPage.resize(1, 1); + + for(unsigned int page = 1; page <= renderer->totalPages(); page++) + { + progress.setProgress(page); + tqApp->processEvents(); + + if (progress.wasCancelled()) + break; + + dummyPage.setPageNumber(page); + // We gracefully ignore any errors (bad file, etc.) + renderer->getText(&dummyPage); + + for(unsigned int i = 0; i < dummyPage.textBoxList.size(); i++) + { + // We try to detect newlines + if (i > 0) + { + // Like all our textalgorithmns this currently assumes left to right text. + // TODO: make this more generic. But we first would need to guess the corrent + // orientation. + if (dummyPage.textBoxList[i].box.top() > dummyPage.textBoxList[i-1].box.bottom() && + dummyPage.textBoxList[i].box.x() < dummyPage.textBoxList[i-1].box.x()) + { + stream << "\n"; + } + } + stream << dummyPage.textBoxList[i].text; + } + + // Send newline after each page. + stream << "\n"; + } + + // Switch off the progress dialog, etc. + progress.setProgress(renderer->totalPages()); + return; +} + +void KMultiPage::slotEnableMoveTool(bool enable) +{ + emit enableMoveTool(enable); +} + +#include "tdemultipage.moc" diff --git a/kviewshell/tdemultipage.desktop b/kviewshell/tdemultipage.desktop new file mode 100644 index 00000000..0ef915a9 --- /dev/null +++ b/kviewshell/tdemultipage.desktop @@ -0,0 +1,41 @@ +[Desktop Entry] +Type=Service +X-TDE-ServiceType=KViewShell/MultiPage +Name=KViewShell MultiPage +Name[da]=KViewShell Multiside +Name[de]=KViewShell Mehrfachseiten +Name[el]=螤慰位位伪蟺位萎 蟽蔚位委未伪 KViewShell +Name[es]=Multip谩gina KViewShell +Name[fi]=KViewShell MoniSivu +Name[fr]=Multi-page KViewShell +Name[gl]=KViewShell Multip谩xina +Name[hu]=KViewShell t枚bboldalas +Name[it]=MultiPagina KViewShell +Name[kk]=袣萤锌斜械褌褌褨 KViewShell +Name[ms]=PelbagaiMuka KViewShell +Name[nb]=KViewShell Flerside +Name[nds]=KViewShell f枚r Mehrfachsieden +Name[ne]=啶曕 啶︵啶多啶 啶多啶 啶す啷佮お啷冟し啷嵿 +Name[nl]=KViewShell MultiPagina +Name[nn]=KViewShell-fleirside +Name[pl]=Wielostronicowe dla KViewShell +Name[pt]=KViewShell MultiP谩gina +Name[pt_BR]=KViewShell - M煤ltiplas P谩ginas +Name[ro]=KViewShell Pagini Multiple +Name[ru]=袣芯屑锌芯薪械薪褌 MultiPage +Name[sr]=KViewShell 胁懈褕械褋褌褉邪薪懈 +Name[sr@Latn]=KViewShell vi拧estrani +Name[sv]=Kviewshell flera sidor +Name[ta]=喈曕瘒喈曕喈熰瘝喈氞喈撪疅喁 喈喈畷喁嵿畷喈瘝 +Name[tr]=KViewShell 脟okluSayfa +Name[zh_CN]=KViewShell 澶氶〉 +Name[zh_HK]=KViewShell 澶氶爜 + +[PropertyDef::X-TDE-MimeTypes] +Type=TQString + +[PropertyDef::X-TDE-MultiPageVersion] +Type=int + +[PropertyDef::X-TDE-EmptyMultiPage] +Type=int diff --git a/kviewshell/tdemultipage.h b/kviewshell/tdemultipage.h new file mode 100644 index 00000000..ac3e6b02 --- /dev/null +++ b/kviewshell/tdemultipage.h @@ -0,0 +1,651 @@ +// -*- C++ -*- +#ifndef _KMULTIPAGE_H +#define _KMULTIPAGE_H + +#include "pageView.h" +#include "documentPageCache.h" +#include "documentRenderer.h" +#include "history.h" +#include "tdemultipageInterface.h" +#include "marklist.h" + +#include +#include + +class Anchor; +class DocumentWidget; +class TDEConfigDialog; +class KPrintDialogPage_PageOptions; +class KPrinter; +class PageView; +class TQPainter; +class TQSplitter; +class TQToolBox; +class simplePageSize; +class TableOfContents; +class PageNumber; +class SearchWidget; + + +/** \brief This class provides plugin-specific GUI elements for kviewshell plugins + +@author Wilfried Huss, Stefan Kebekus + + */ + +// TODO remove virtual inheritance for KDE 4. It's the reason for the strange DCOPObject construction +class KMultiPage : public KParts::ReadOnlyPart, virtual public tdemultipageInterface +{ + Q_OBJECT + + +public: + KMultiPage(TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name); + virtual ~KMultiPage(); + + /* returns the scrollview used for the display */ + virtual TQWidget* mainWidget() {return _scrollView;} + + /* Methods which are associated with the DCOP functionality of the + tdemultipage. This method returns the file name (not the URL) of + the currently loaded file. */ + TQString name_of_current_file(); + + /* Methods which are associated with the DCOP functionality of the + tdemultipage. This method can be implemented by the multipage, + e.g. to jump to a certain location. */ + virtual ASYNC jumpToReference(const TQString& /*reference*/); + + /* Methods which are associated with the DCOP functionality of the + tdemultipage. This method checks if a given file is loaded. */ + bool is_file_loaded(const TQString& filename); + + /* Opens file and sets URL + + This method does the same as openFile, but sets the m_url of the + tdemultipage. This can be important, for the following reason: + assume that a DVI is or DJVU-file is located on a web server at + baseURL=http://www.x.x/x.dvi The file may refer to external + graphic files using relative links. + + The file is downloaded by the kviewpart to a temporary file on + the hard disk, say /tmp/t.dvi. The kviewpart would then call this + method with filename=/tmp/t.dvi and baseURL=http://www.x.x/x.dvi, + so the DVI-renderer knows to interpret the link to t.jpg as + http://www.x.x/t.jpg, and will download the file from there. + + @warning This method is virtual only for technical reasons. Do + not re-implement this method + + @returns true on success, false on failure + */ + virtual bool openURL(const TQString &filename, const KURL &base_url); + + /** 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: + @code + // 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; + } + + ... pageList() gives a list of pages to be printed, where "1" + denotes the first page, "2" the second, etc.> ... + + printer->printFiles( TQStringList(tmpPSFile), true ); + delete printer; + @endcode + + 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: + @code + // 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") + + if (printer->option( "kde-kviewshell-expandpage" ) == "true") + + if (printer->option( "kde-kviewshell-centerpage" ) != "false") +
+ if (printer->option( "kde-kviewshell-rotatepage" ) != "false") + + + ... pageList() gives a list of pages to be printed, where "1" + denotes the first page, "2" the second, etc.> ... + + printer->printFiles( TQStringList(tmpPSFile), true ); + delete printer; + @endcode + + For more information, see the default implementation in the source + file tdemultipage.cpp. You might also look at the documentation to + getPrinter(). + */ + virtual void print(); + + + /* Returns true if the document specifies page sizes, and false + otherwise. NOTE: the information returned by this method is not + always 100% reliable. Although unlikely, it is theoretically + possible that this method returns 'true', but still some of the + sizes returned by sizeOfPage() are invalid. */ + virtual bool hasSpecifiedPageSizes() const {return renderer && renderer->hasSpecifiedPageSizes();} + + /* This methos is similar to openFile(). It is used when the "Watch + file" option is activated, and the file has changed on disk. It + differs from openFile() in two aspects: first, the file is + checked for validity with DVIRenderer.isValidFile(m_file) if the + file is invalid, a timer event is used to call the method again + after a brief pause. Secondly, when the GUI is updated, the + implementation does not jump to the first page, but tries to keep + the current page. */ + virtual void reload(); + +// Interface definition start ------------------------------------------------ + + /** 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. + */ + virtual TQStringList fileFormats() const = 0; + + /// closes a file + virtual bool closeURL(); + + /* sets a zoom factor. The multipage implementation might refuse to + use a given zoom factor, even if it falls within the bounds given + by the constants MinZoom and MaxZoom which are defined in + zoomlimits.h. In that case, the multipage implementation chooses a + different zomm factor. The implementation returns the factor which + has actually been used. A default implementation is provided. */ + virtual double setZoom(double z); + + /** reads in settings. Reimplementations must call this. */ + virtual void readSettings(); + + /** writes settings. Reimplementations must call this. */ + virtual void writeSettings(); + + /** Flag to indicate that this implementation has support for textserach and selection */ + virtual bool supportsTextSearch() const { return getRenderer() && getRenderer()->supportsTextSearch(); } + + /** 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 + */ + virtual bool isModified() const {return false;} + + /* Returns the number of the first (i.e. top-left) page in the + display. Such a number cannot be reasonably assigned + (e.g. because the current document is empty, or because no + document has been loaded yet), the method returns "invalid page", + i.e. 0. */ + virtual PageNumber currentPageNumber(); + + /* Returns the number of pages in the currently loaded document or + 0, if no document is loaded or if the document is empty */ + PageNumber numberOfPages() const {return renderer.isNull() ? (PageNumber)0 : renderer->totalPages();} + + /* List of pages selected in the sidebar + + @returns a list with the numbers of the currently selected + pages. */ + virtual TQValueList selectedPages() {return markList()->selectedPages();} + + virtual History* history() { return &document_history; } + + /** 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 TDEConfigDialog explains how to do that. + + The default implementation does nothing. + + @param configDialog a pointer to the TDEConfigDialog the dialog to + add pages to + */ + virtual void addConfigDialogs(TDEConfigDialog* configDialog) { Q_UNUSED(configDialog); } + + + /* These methods calculate the Zoomfactor needed to fit the pages + into the current viewport. Note that the return value need *not* + be within the limits defined in "zoomLimits.h". If they are not, + this indicates that fitting to width or height is currently not + possible (e.g. because no document is loaded). The return value + should then be ignored and any operation that relies on the + return value should be aborted. */ + virtual double calculateFitToWidthZoomValue(); + virtual double calculateFitToHeightZoomValue(); + + /* Returns the number of columns into which the widgets are aligned. */ + virtual TQ_UINT8 getNrColumns() const { return _scrollView->getNrColumns(); } + virtual TQ_UINT8 getNrRows() const { return _scrollView->getNrRows(); } + + virtual bool overviewMode() const { return _scrollView->overviewMode(); } + + // =========== Interface definition ends + + /* --------------------------------------------------------------------- + The following methods export functions of the DocumentPageCache which + are currently needed by KViewPart. TODO: Clean this up again without + directly linking DocumentPageCache to the KViewPart. */ + + /* Returns the size of page 'page'. If the document does not + specify a size (which happens, e.g., for some DVI-files), then + the userPreferredSize is returned. */ + virtual SimplePageSize sizeOfPage(const PageNumber& page = 1) const { return pageCache->sizeOfPage(page); } + +public slots: + /* Sets the userPreferredSize, which is explained below */ + virtual void setUserPreferredSize(const SimplePageSize& t) { pageCache->setUserPreferredSize(t); } + virtual void setUseDocumentSpecifiedSize(bool b) { pageCache->setUseDocumentSpecifiedSize(b); } + // -------------------------------------------------------------------- + +protected: + /** 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 tdemultipage + 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. + + @param 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. */ + virtual void setFile(bool success); + + /* Creates new instances of DocumentWidget. If you need special + functionality and reimplement the DocumentWidget class, then you + should also reimplement this method to ensure that your new + DocumentWidgets will be used. This function is also the right + place to connect to signals emitted by DocumentWidget. */ + virtual DocumentWidget* createDocumentWidget(); + + /* Used to enable/disable KActions of multiPage implementations. + enableActions(true) should be called whenever a file is + successfully loaded. enableActions(false) is called when the + file is closed. */ + virtual void enableActions(bool); + + /* Initializes all data structures that need to know the renderer. + This function must be called in the constructor of multipage + implementations. */ + void setRenderer(DocumentRenderer*); + + /** 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. + */ + virtual void initializePageCache(); + + /* Returns a pointer to the renderer. */ + virtual TQGuardedPtr getRenderer() const { return renderer; } + + PageView* scrollView() { return _scrollView; } + + MarkList* markList() { return _markList; } + + // The next two functions are used for the autozoom feature + // TODO optimize (the calculation of the widest page needs to be done only once + // per document, not everytime calculateFitToWidthZoomValue() is called) + PageNumber widestPage() const; + + // TODO Generalize this for more than 2 columns + double zoomForWidthColumns(unsigned int viewportWidth) const; + +public slots: + virtual void doSelectAll(); + + virtual void clearSelection(); + + virtual void copyText(); + + /** Exports the document to a plain text file. */ + virtual void doExportText(); + + /* Shows the "text search" dialog, if text search is supported by + the renderer. Otherwise, the method returns immediately. */ + virtual void showFindTextDialog(); + + + /* 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. */ + virtual void findNextText(); + + /* 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. */ + virtual void findPrevText(); + + /** 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. */ + virtual void slotSave(); + + /* The standard implementation just calls slotSave. */ + virtual void slotSave_defaultFilename(); + + /* Initialize/Update PageWidgets, thumbnail list and bookmark list + + This slot is called after a document was loaded, when the + document was modified (e.g. when pages were deleted), or the + rendering mode is changed (e.g. when a different accessibility + viewmode is selected). The following is done + + - The page cache is cleared + + - all page widgets as well as the thumbnails are updated. + */ + void renderModeChanged(); + + /* Empties the page cache and --as the name suggests-- repaints all + visible widgets. */ + void repaintAllVisibleWidgets(); + + /* Tells the multipage if scrollbars should be used. */ + virtual void slotShowScrollbars(bool); + + /* Show or hide the sidebar widget. */ + virtual void slotShowSidebar(bool); + + /* Show or hide thumbnails. */ + virtual void slotShowThumbnails(bool); + + /* Used internally. */ + void slotIOJobFinished ( TDEIO::Job *job ); + + /* Switches to fullscreen mode and back. */ + virtual void slotSetFullPage(bool fullpage); + + virtual void setViewMode(int); + + /* Is called if settings are changed in the configuration dialog. + If this method is reimplemented in a child class, it needs to be + called from there. */ + virtual void preferencesChanged(); + + /* Page Navigation. */ + 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(); + + /* Scrolls the main scrollview by deltaInPixel (positive values + scroll DOWN). If the user tries to scroll past the beginning or + the end of a page, then the method either returns without doing + anything (if the current page is the first or last page, resp, or + if the method is called within 200ms after the beg. or end of the + page was reached), or goes the the next/previous page. The delay + makes it a little easier for the user to scroll with the mouse + wheel or the keyboard without involuntarily moving to another + page. */ + virtual void scroll(TQ_INT32 deltaInPixel); + + virtual void slotEnableMoveTool(bool enable); + +protected slots: + virtual bool gotoPage(const PageNumber& page, int y, bool isLink = true); + + /* Make the selection visible */ + void gotoPage(const TextSelection&); + +private slots: + void handleLocalLink(const TQString &linkText); + +signals: + /** Emitted with argument "true" when the move tool is selected, and + with argument "false" if selection tool is selected. */ + void enableMoveTool(bool enable); + + /* Emitted when a page has been selected in the MarkList. */ + void selected(const PageNumber& pageNumber); + + /* Emitted to indicate the number of pages in the file and the + current page. The receiver will not change or update the display, + nor call the gotoPage()-method. */ + void pageInfo(int nr, int currpg); + + void askingToCheckActions(); + + /* emitted when a new preview is available */ + void previewChanged(bool previewAvailable); + + void viewModeChanged(); + + /* Emitted when the zoom of the pageview changes. */ + void zoomChanged(); + + void zoomOut(); + void zoomIn(); + + /* Emitted it the status of the text selection changes. */ + void textSelected(bool); + + void searchEnabled(bool); + +// Interface definition end -------------------------------------------------- + +public slots: + virtual void generateDocumentWidgets(const PageNumber& startPage = PageNumber::invalidPage); + + protected slots: + /* This is the slot where mouseWheel events are processed that come + from the multipage/scrollview. This method calles scroll, a + delta-value of 120 (i.e. one notch on a standard wheel mouse) + scrolls by two 'lines'. */ + void wheelEvent(TQWheelEvent *); + +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. + + @param 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. + */ + KPrinter *getPrinter(bool enablePageSizeFeatures=true); + + + /** Pointer to the parent widget + + This pointer is automatically set by the constructor. + */ + TQGuardedPtr parentWdg; + + TQPtrVector widgetList; + + History document_history; + + /* Variable which is used internally by the method + currentPageNumber() to provide 'lazy' page numbers. */ + PageNumber lastCurrentPage; + + /* The pageCache caches already drawn "documentPages" and invokes + the renderer if the needed page is not available in the cache. */ + DocumentPageCache* pageCache; + +private slots: + void setCurrentPageNumber(const PageNumber&); + void updateWidgetSize(const PageNumber&); + + /* Interrupts a search if one is currently performed, otherwise + hide the search panel */ + void stopSearch(); + +private: + /* For internal use by the reload()-method. See the comments in + tdemultipage.cpp, right before the timerEvent function. */ + int timer_id; + + /* For internal use the reload()-method. This is a dreadful + hack. The problem we adress with this timer event is the + following: the kviewshell has a KDirWatch object which looks at + the DVI file and calls reload() when the object has changed. That + works very nicely in principle, but in practise, when TeX runs + for several seconds over a complicated file, this does not work + at all. First, most of the time, while TeX is still writing, the + file is invalid. Thus, reload() is very often called when the DVI + file is bad. We solve this problem by checking the file first. If + the file is bad, we do not reload. Second, when the file finally + becomes good, it very often happens that KDirWatch does not + notify us anymore. Whether this is a bug or a side effect of a + feature of KDirWatch, I dare not say. We remedy that problem by + using a timer: when reload() was called on a bad file, we + automatically come back (via the timerEvent() function) every + second and check if the file became good. If so, we stop the + timer. It may well happen that KDirWatch calls us several times + while we are waiting for the file to become good, but that does + not do any harm. */ + void timerEvent( TQTimerEvent *e ); + + /* This method opens a file and sets up the GUI when the file is + loaded. It calls setFile() so that implementations of tdemultipage + can update their own GUI. DO NOT REIMPLEMENT THIS METHOD. */ + bool openFile(); + + /* Is set by setRenderer. */ + TQGuardedPtr renderer; + + PageView *_scrollView; + SearchWidget* searchWidget; + TQToolBox* sideBar; + + MarkList* _markList; + TableOfContents* tableOfContents; + + TQSplitter* splitterWidget; + + /* This timer is used to implement a brief delay when the user + scrolls past the beginning or the end of the page before a the + program moves to a new page. That way, it is a little easier for + the user to scroll with the mouse wheel or the keyboard without + involuntarily moving to another page. The timer is used in the + scroll() method. */ + TQTimer changePageDelayTimer; + + // This is set to true while a text search is performed. + // If set to false the search is interrupted. + bool searchInProgress; +}; + + +#endif diff --git a/kviewshell/tdemultipageInterface.h b/kviewshell/tdemultipageInterface.h new file mode 100644 index 00000000..e9dabf0f --- /dev/null +++ b/kviewshell/tdemultipageInterface.h @@ -0,0 +1,18 @@ +// -*- C++ -*- +#ifndef tdemultipageINTERFACE_H +#define tdemultipageINTERFACE_H + +#include + +class tdemultipageInterface : virtual public DCOPObject +{ + K_DCOP + + k_dcop: + virtual ASYNC jumpToReference(const TQString& reference) = 0; + virtual TQString name_of_current_file() = 0; + virtual bool is_file_loaded(const TQString& filename) = 0; +}; + +#endif + -- cgit v1.2.3