diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kugar/part/kugar_view.cpp | |
download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip |
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kugar/part/kugar_view.cpp')
-rw-r--r-- | kugar/part/kugar_view.cpp | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/kugar/part/kugar_view.cpp b/kugar/part/kugar_view.cpp new file mode 100644 index 00000000..14a32bca --- /dev/null +++ b/kugar/part/kugar_view.cpp @@ -0,0 +1,131 @@ +// Copyright (c) 2000 Phil Thompson <[email protected]> +// +// This file contains the implementation of the Kugar KPart. + + +#include <kapplication.h> +#include <klocale.h> +#include <kstandarddirs.h> +#include <kinstance.h> +#include <kaboutdata.h> +#include <kaction.h> +#include <kstdaction.h> +#include <kmessagebox.h> +#include <kio/netaccess.h> +#include <qfile.h> +#include <kglobal.h> +#include <kiconloader.h> +#include <qlayout.h> + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include "kugar_part.h" +#include "kugar_view.h" +#include "kugar_factory.h" + + +// The view ctor. + +KugarView::KugarView( KugarPart *part, QWidget *parent, const char *name ) + : KoView( part, parent, name ) +{ + setInstance( KugarFactory::global() ); + + ( new QVBoxLayout( this ) ) ->setAutoAdd( true ); + view = new Kugar::MReportViewer( part->reportEngine(), this ); + + view -> setFocusPolicy( QWidget::ClickFocus ); + view -> show(); + + // setWidget(view); + + // m_extension = new KugarBrowserExtension(this); + + + // Define the actions. + + KStdAction::prior( view, SLOT( slotPrevPage() ), actionCollection(), "kuPrevPage" ); + KStdAction::next( view, SLOT( slotNextPage() ), actionCollection(), "kuNextPage" ); + KStdAction::firstPage( view, SLOT( slotFirstPage() ), actionCollection(), "kuFirstPage" ); + KStdAction::lastPage( view, SLOT( slotLastPage() ), actionCollection(), "kuLastPage" ); + + setXMLFile( "kugarpart.rc" ); + +} + + +// The view dtor. + +KugarView::~KugarView() +{} + +void KugarView::setupPrinter( KPrinter &printer ) +{ + view->setupPrinter( printer ); +} + +void KugarView::print( KPrinter &printer ) +{ + view->printReport( printer ); +} + + + + +#if 0 +// Open a data file. + +bool KugarPart::openFile() +{ + bool ok = false; + QFile f( m_file ); + + if ( f.open( IO_ReadOnly ) ) + { + if ( view -> setReportData( &f ) ) + { + if ( view -> renderReport() ) + ok = true; + } + else + KMessageBox::sorry( this, i18n( "Invalid data file: %1" ).arg( m_file ) ); + + f.close(); + } + else + KMessageBox::sorry( this, i18n( "Unable to open data file: %1" ).arg( m_file ) ); + + return ok; +} + + +// Close the data file. + +bool KugarPart::closeURL() +{ + // Nothing to do. + + return true; +} + + +// Print the report. + +void KugarPart::print() +{ + view -> printReport(); +} + +#endif + + +bool KugarView::renderReport() +{ + return ( view -> renderReport() ); +} + + + +#include "kugar_view.moc" |