1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
// Copyright (c) 2000 Phil Thompson <phil@river-bank.demon.co.uk>
//
// This file contains the implementation of the Kugar KPart.
#include <tdeapplication.h>
#include <tdelocale.h>
#include <kstandarddirs.h>
#include <kinstance.h>
#include <tdeaboutdata.h>
#include <tdeaction.h>
#include <kstdaction.h>
#include <tdemessagebox.h>
#include <tdeio/netaccess.h>
#include <tqfile.h>
#include <tdeglobal.h>
#include <kiconloader.h>
#include <tqlayout.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, TQWidget *parent, const char *name )
: KoView( part, parent, name )
{
setInstance( KugarFactory::global() );
( new TQVBoxLayout( this ) ) ->setAutoAdd( true );
view = new Kugar::MReportViewer( part->reportEngine(), this );
view -> setFocusPolicy( TQWidget::ClickFocus );
view -> show();
// setWidget(view);
// m_extension = new KugarBrowserExtension(this);
// Define the actions.
KStdAction::prior( view, TQ_SLOT( slotPrevPage() ), actionCollection(), "kuPrevPage" );
KStdAction::next( view, TQ_SLOT( slotNextPage() ), actionCollection(), "kuNextPage" );
KStdAction::firstPage( view, TQ_SLOT( slotFirstPage() ), actionCollection(), "kuFirstPage" );
KStdAction::lastPage( view, TQ_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;
TQFile 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"
|