summaryrefslogtreecommitdiffstats
path: root/kugar
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kugar
downloadkoffice-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')
-rw-r--r--kugar/AUTHORS8
-rw-r--r--kugar/CHANGES116
-rw-r--r--kugar/ChangeLog108
-rw-r--r--kugar/Makefile.am8
-rw-r--r--kugar/README85
-rw-r--r--kugar/TODO46
-rw-r--r--kugar/cr16-mime-kugardata.pngbin0 -> 1315 bytes
-rw-r--r--kugar/cr32-mime-kugardata.pngbin0 -> 1963 bytes
-rw-r--r--kugar/hi16-app-kugar.pngbin0 -> 1139 bytes
-rw-r--r--kugar/hi22-app-kugar.pngbin0 -> 1542 bytes
-rw-r--r--kugar/hi32-app-kugar.pngbin0 -> 2545 bytes
-rw-r--r--kugar/hi48-app-kugar.pngbin0 -> 4030 bytes
-rw-r--r--kugar/kudesigner/Makefile.am42
-rw-r--r--kugar/kudesigner/kudesigner.desktop159
-rw-r--r--kugar/kudesigner/kudesigner_aboutdata.h56
-rw-r--r--kugar/kudesigner/kudesigner_doc.cpp294
-rw-r--r--kugar/kudesigner/kudesigner_doc.h97
-rw-r--r--kugar/kudesigner/kudesigner_factory.cpp99
-rw-r--r--kugar/kudesigner/kudesigner_factory.h47
-rw-r--r--kugar/kudesigner/kudesigner_part.cpp22
-rw-r--r--kugar/kudesigner/kudesigner_readonly.rc8
-rw-r--r--kugar/kudesigner/kudesigner_view.cpp411
-rw-r--r--kugar/kudesigner/kudesigner_view.h140
-rw-r--r--kugar/kudesigner/kudesignerui.rc68
-rw-r--r--kugar/kudesigner/main.cpp46
-rw-r--r--kugar/kudesigner/pics/Makefile.am1
-rw-r--r--kugar/kudesigner/pics/lo16-app-kudesigner.pngbin0 -> 376 bytes
-rw-r--r--kugar/kudesigner/pics/lo32-app-kudesigner.pngbin0 -> 575 bytes
-rw-r--r--kugar/kudesigner/templates/General/.directory55
-rw-r--r--kugar/kudesigner/templates/General/A0.desktop7
-rw-r--r--kugar/kudesigner/templates/General/A0.ktm9
-rw-r--r--kugar/kudesigner/templates/General/A1.desktop7
-rw-r--r--kugar/kudesigner/templates/General/A1.ktm9
-rw-r--r--kugar/kudesigner/templates/General/A2.desktop7
-rw-r--r--kugar/kudesigner/templates/General/A2.ktm9
-rw-r--r--kugar/kudesigner/templates/General/A3.desktop7
-rw-r--r--kugar/kudesigner/templates/General/A3.ktm9
-rw-r--r--kugar/kudesigner/templates/General/A4.desktop9
-rw-r--r--kugar/kudesigner/templates/General/A4.ktm9
-rw-r--r--kugar/kudesigner/templates/General/A5.desktop6
-rw-r--r--kugar/kudesigner/templates/General/A5.ktm9
-rw-r--r--kugar/kudesigner/templates/General/A6.desktop7
-rw-r--r--kugar/kudesigner/templates/General/A6.ktm9
-rw-r--r--kugar/kudesigner/templates/General/A7.desktop7
-rw-r--r--kugar/kudesigner/templates/General/A7.ktm9
-rw-r--r--kugar/kudesigner/templates/General/A8.desktop7
-rw-r--r--kugar/kudesigner/templates/General/A8.ktm9
-rw-r--r--kugar/kudesigner/templates/General/A9.desktop7
-rw-r--r--kugar/kudesigner/templates/General/A9.ktm9
-rw-r--r--kugar/kudesigner/templates/General/B0.desktop8
-rw-r--r--kugar/kudesigner/templates/General/B0.ktm9
-rw-r--r--kugar/kudesigner/templates/General/B1.desktop8
-rw-r--r--kugar/kudesigner/templates/General/B1.ktm9
-rw-r--r--kugar/kudesigner/templates/General/B10.desktop8
-rw-r--r--kugar/kudesigner/templates/General/B10.ktm9
-rw-r--r--kugar/kudesigner/templates/General/B2.desktop8
-rw-r--r--kugar/kudesigner/templates/General/B2.ktm9
-rw-r--r--kugar/kudesigner/templates/General/B3.desktop8
-rw-r--r--kugar/kudesigner/templates/General/B3.ktm9
-rw-r--r--kugar/kudesigner/templates/General/B4.desktop7
-rw-r--r--kugar/kudesigner/templates/General/B4.ktm9
-rw-r--r--kugar/kudesigner/templates/General/B5.desktop8
-rw-r--r--kugar/kudesigner/templates/General/B5.ktm9
-rw-r--r--kugar/kudesigner/templates/General/B6.desktop8
-rw-r--r--kugar/kudesigner/templates/General/B6.ktm9
-rw-r--r--kugar/kudesigner/templates/General/B7.desktop8
-rw-r--r--kugar/kudesigner/templates/General/B7.ktm9
-rw-r--r--kugar/kudesigner/templates/General/B8.desktop8
-rw-r--r--kugar/kudesigner/templates/General/B8.ktm9
-rw-r--r--kugar/kudesigner/templates/General/B9.desktop8
-rw-r--r--kugar/kudesigner/templates/General/B9.ktm9
-rw-r--r--kugar/kudesigner/templates/General/C5E.desktop8
-rw-r--r--kugar/kudesigner/templates/General/C5E.ktm9
-rw-r--r--kugar/kudesigner/templates/General/Comm10E.desktop8
-rw-r--r--kugar/kudesigner/templates/General/Comm10E.ktm9
-rw-r--r--kugar/kudesigner/templates/General/DLE.desktop7
-rw-r--r--kugar/kudesigner/templates/General/DLE.ktm9
-rw-r--r--kugar/kudesigner/templates/General/Executive.desktop24
-rw-r--r--kugar/kudesigner/templates/General/Executive.ktm9
-rw-r--r--kugar/kudesigner/templates/General/Folio.desktop21
-rw-r--r--kugar/kudesigner/templates/General/Folio.ktm9
-rw-r--r--kugar/kudesigner/templates/General/Ledger.desktop24
-rw-r--r--kugar/kudesigner/templates/General/Ledger.ktm9
-rw-r--r--kugar/kudesigner/templates/General/Legal.desktop26
-rw-r--r--kugar/kudesigner/templates/General/Legal.ktm9
-rw-r--r--kugar/kudesigner/templates/General/Letter.desktop33
-rw-r--r--kugar/kudesigner/templates/General/Letter.ktm9
-rw-r--r--kugar/kudesigner/templates/General/Makefile.am15
-rw-r--r--kugar/kudesigner/templates/General/NPageSize.desktop2
-rw-r--r--kugar/kudesigner/templates/General/Tabloid.desktop28
-rw-r--r--kugar/kudesigner/templates/General/Tabloid.ktm9
-rw-r--r--kugar/kudesigner/templates/General/cr48-action-template_iso.pngbin0 -> 1078 bytes
-rw-r--r--kugar/kudesigner/templates/General/cr48-action-template_us.pngbin0 -> 1095 bytes
-rw-r--r--kugar/kudesigner/templates/General/crsc-action-template_iso.svgzbin0 -> 1639 bytes
-rw-r--r--kugar/kudesigner/templates/General/crsc-action-template_us.svgzbin0 -> 1640 bytes
-rw-r--r--kugar/kudesigner/templates/Makefile.am1
-rw-r--r--kugar/kudesigner/toolbar/Makefile.am2
-rw-r--r--kugar/kudesigner/toolbar/cr22-action-frame_field.pngbin0 -> 406 bytes
-rw-r--r--kugar/kudesigner/toolbar/cr22-action-id.pngbin0 -> 1278 bytes
-rw-r--r--kugar/kudesigner/toolbar/cr22-action-idf.pngbin0 -> 1410 bytes
-rw-r--r--kugar/kudesigner/toolbar/cr22-action-idh.pngbin0 -> 1385 bytes
-rw-r--r--kugar/kudesigner/toolbar/cr22-action-ipf.pngbin0 -> 1345 bytes
-rw-r--r--kugar/kudesigner/toolbar/cr22-action-iph.pngbin0 -> 1360 bytes
-rw-r--r--kugar/kudesigner/toolbar/cr22-action-irf.pngbin0 -> 1436 bytes
-rw-r--r--kugar/kudesigner/toolbar/cr22-action-irh.pngbin0 -> 1431 bytes
-rw-r--r--kugar/kudesigner_lib/Makefile.am17
-rw-r--r--kugar/kudesigner_lib/band.cpp127
-rw-r--r--kugar/kudesigner_lib/band.h62
-rw-r--r--kugar/kudesigner_lib/box.cpp43
-rw-r--r--kugar/kudesigner_lib/box.h80
-rw-r--r--kugar/kudesigner_lib/calcfield.cpp56
-rw-r--r--kugar/kudesigner_lib/calcfield.h46
-rw-r--r--kugar/kudesigner_lib/canvas.cpp386
-rw-r--r--kugar/kudesigner_lib/canvas.h96
-rw-r--r--kugar/kudesigner_lib/command.cpp301
-rw-r--r--kugar/kudesigner_lib/command.h183
-rw-r--r--kugar/kudesigner_lib/commdefs.cpp71
-rw-r--r--kugar/kudesigner_lib/commdefs.h79
-rw-r--r--kugar/kudesigner_lib/detail.cpp52
-rw-r--r--kugar/kudesigner_lib/detail.h43
-rw-r--r--kugar/kudesigner_lib/detailbase.cpp45
-rw-r--r--kugar/kudesigner_lib/detailbase.h44
-rw-r--r--kugar/kudesigner_lib/detailfooter.cpp49
-rw-r--r--kugar/kudesigner_lib/detailfooter.h43
-rw-r--r--kugar/kudesigner_lib/detailheader.cpp49
-rw-r--r--kugar/kudesigner_lib/detailheader.h43
-rw-r--r--kugar/kudesigner_lib/field.cpp104
-rw-r--r--kugar/kudesigner_lib/field.h47
-rw-r--r--kugar/kudesigner_lib/kugartemplate.cpp411
-rw-r--r--kugar/kudesigner_lib/kugartemplate.h88
-rw-r--r--kugar/kudesigner_lib/label.cpp256
-rw-r--r--kugar/kudesigner_lib/label.h57
-rw-r--r--kugar/kudesigner_lib/line.cpp129
-rw-r--r--kugar/kudesigner_lib/line.h48
-rw-r--r--kugar/kudesigner_lib/pagefooter.cpp54
-rw-r--r--kugar/kudesigner_lib/pagefooter.h43
-rw-r--r--kugar/kudesigner_lib/pageheader.cpp55
-rw-r--r--kugar/kudesigner_lib/pageheader.h44
-rw-r--r--kugar/kudesigner_lib/plugin.cpp28
-rw-r--r--kugar/kudesigner_lib/plugin.h74
-rw-r--r--kugar/kudesigner_lib/propertyserializer.cpp76
-rw-r--r--kugar/kudesigner_lib/propertyserializer.h46
-rw-r--r--kugar/kudesigner_lib/reportfooter.cpp56
-rw-r--r--kugar/kudesigner_lib/reportfooter.h43
-rw-r--r--kugar/kudesigner_lib/reportheader.cpp54
-rw-r--r--kugar/kudesigner_lib/reportheader.h44
-rw-r--r--kugar/kudesigner_lib/reportitem.cpp247
-rw-r--r--kugar/kudesigner_lib/reportitem.h82
-rw-r--r--kugar/kudesigner_lib/section.cpp37
-rw-r--r--kugar/kudesigner_lib/section.h48
-rw-r--r--kugar/kudesigner_lib/specialfield.cpp69
-rw-r--r--kugar/kudesigner_lib/specialfield.h49
-rw-r--r--kugar/kudesigner_lib/structurewidget.cpp239
-rw-r--r--kugar/kudesigner_lib/structurewidget.h62
-rw-r--r--kugar/kudesigner_lib/view.cpp841
-rw-r--r--kugar/kudesigner_lib/view.h149
-rw-r--r--kugar/lib/Makefile.am19
-rw-r--r--kugar/lib/inputmask.cpp359
-rw-r--r--kugar/lib/inputmask.h61
-rw-r--r--kugar/lib/mcalcobject.cpp66
-rw-r--r--kugar/lib/mcalcobject.h56
-rw-r--r--kugar/lib/mfieldobject.cpp261
-rw-r--r--kugar/lib/mfieldobject.h102
-rw-r--r--kugar/lib/mlabelobject.cpp174
-rw-r--r--kugar/lib/mlabelobject.h92
-rw-r--r--kugar/lib/mlineobject.cpp119
-rw-r--r--kugar/lib/mlineobject.h83
-rw-r--r--kugar/lib/mpagecollection.cpp190
-rw-r--r--kugar/lib/mpagecollection.h108
-rw-r--r--kugar/lib/mpagedisplay.cpp63
-rw-r--r--kugar/lib/mpagedisplay.h55
-rw-r--r--kugar/lib/mreportdetail.cpp123
-rw-r--r--kugar/lib/mreportdetail.h89
-rw-r--r--kugar/lib/mreportengine.cpp1081
-rw-r--r--kugar/lib/mreportengine.h210
-rw-r--r--kugar/lib/mreportobject.cpp225
-rw-r--r--kugar/lib/mreportobject.h127
-rw-r--r--kugar/lib/mreportsection.cpp326
-rw-r--r--kugar/lib/mreportsection.h190
-rw-r--r--kugar/lib/mreportviewer.cpp411
-rw-r--r--kugar/lib/mreportviewer.h94
-rw-r--r--kugar/lib/mspecialobject.cpp86
-rw-r--r--kugar/lib/mspecialobject.h91
-rw-r--r--kugar/lib/mutil.cpp127
-rw-r--r--kugar/lib/mutil.h59
-rw-r--r--kugar/part/Makefile.am35
-rw-r--r--kugar/part/kugar.desktop76
-rw-r--r--kugar/part/kugar_about.h53
-rw-r--r--kugar/part/kugar_factory.cpp92
-rw-r--r--kugar/part/kugar_factory.h36
-rw-r--r--kugar/part/kugar_part.cpp259
-rw-r--r--kugar/part/kugar_part.h68
-rw-r--r--kugar/part/kugar_view.cpp131
-rw-r--r--kugar/part/kugar_view.h53
-rw-r--r--kugar/part/kugarpart.desktop118
-rw-r--r--kugar/part/kugarpart.rc21
-rw-r--r--kugar/part/kugartemplate.dtd155
-rw-r--r--kugar/part/main.cpp44
-rw-r--r--kugar/samples/Makefile.am4
-rw-r--r--kugar/samples/sample1.kdf33
-rw-r--r--kugar/samples/sample1.ktf152
-rw-r--r--kugar/samples/sample2.kdf49
-rw-r--r--kugar/samples/sample2.ktf240
-rw-r--r--kugar/samples/sample3.kdf36
-rw-r--r--kugar/samples/sample3.ktf165
205 files changed, 14905 insertions, 0 deletions
diff --git a/kugar/AUTHORS b/kugar/AUTHORS
new file mode 100644
index 00000000..00e61c38
--- /dev/null
+++ b/kugar/AUTHORS
@@ -0,0 +1,8 @@
+Phil Thompson <[email protected]>, previous maintainer
+Alexander Dymo <[email protected]>, previous maintainer
+Adam Treat <[email protected]>, current maintainer
+Joseph Wenninger <[email protected]>
+Joris Marcillac <[email protected]>
+
+Original author: Mutiny Bay Software <[email protected]>
+Original name: Metaphrast
diff --git a/kugar/CHANGES b/kugar/CHANGES
new file mode 100644
index 00000000..18f0c053
--- /dev/null
+++ b/kugar/CHANGES
@@ -0,0 +1,116 @@
+*************************
+VERSION 1.3
+*************************
+
+Changes:
+
+ 1. Kugar and Kugar Designer are now pure KOffice applications.
+ Partification was made and KOffice zipped xml format is used.
+
+ 2. Kugar and Kugar Designer are available in Qt-only versions.
+ They are included in the source tree but not compiled by default.
+ To compile run:
+ qmake kugar.pro
+ make -f Makefile.qt
+
+ 3. Direct database support in Kugar.
+
+
+*************************
+VERSION 1.2
+*************************
+
+Changes:
+
+ 1. GUI Report Designer is added (kudesigner)
+ Qt version of designer can be found in maintainer's web site
+ http://www.cloudtemple.mksat.net
+
+ 2. Users can add as many detail bands to the report as needed,
+ this can be useful if we print report with data, arranged according
+ the master-detail relationship.
+ For example, now Kugar's
+ Detail Level="0" -> Detail Level="1" -> Detail Level="2"
+ corresponds to many commertial report engines'
+ Master -> Detail -> Subdetail
+
+ 3. Any detail of any level can now have detail header and detail footer
+
+ 4. Added DDMMYY_PERIOD (e.g. 25.02.02)
+ and DDMMYYYY_PERIOD (e.g. 25.02.2002) date type output formats
+ for Fields, Specials and CalculatedFields.
+ They have numbers 11 and 12 to use in a report template.
+
+ 5. Report engine is now completely Qt-based. Any use of KDE classes were
+ removed and replaced with their Qt analogs (KPrinter -> QPrinter,
+ KMessageBox -> QMessageBox)
+
+ 6. KReportViewer class is added to Kugar lib - it uses KMessageBox and
+ KPrinter classes.
+ kugar.h now references to kreportviewer.h
+ Qt users should include kugarqt.h that references to mreportviewr.h
+
+
+*************************
+VERSION 1.0
+*************************
+
+Changes:
+
+ 1. Change the documentation to reflect the new maintainer and web site.
+ 2. Renamed the whole package.
+ 3. Switched from the Apache Xerces XML Parser to the parser included with Qt
+ v2.2.0.
+ 4. Converted the reportviewer to being a KPart.
+ 5. Extended the data DTD to include a prefered template.
+ 6. The template can be specified as a URL.
+
+
+*************************
+VERSION 0.2
+*************************
+
+Changes:
+
+ 1. Added new class MLineObject for drawing simple lines on a report.
+ 2. Moved metaphrast code to a seperate dir and added code to create a shared
+ library.
+ 3. Switched from IBM XML4C to Apache Xerces XML Parser. Not using ICU, just
+ native transcoding.
+ 4. Added command line switches to the viewer utility.
+ 5. Added support for formatting negative numbers with a user defined color.
+ 6. Added currency data type to field and calc objects.
+ 7. Added support for formatting numbers.
+ 8. Added support for formatting dates. To format dates, the field type must be
+ defined as a date and the date string in the data file must be in
+ mm/dd/yyyy or mm-dd-yyyy format.
+ 9. Fixed bug that added an empty page to the end of a report.
+10. Added a progress dialog to MReportViewer for printing. User can now cancel
+ a print job.
+11. Added code to MReportViewer to allow printing of selected pages.
+12. Added code to MReportViewer to print multiple copies. QPrinter does not
+ appear to handle this correctly.
+13. Added code to MReportViewer to print reverse page order.
+14. Added method getRenderSteps() to MReportEngine, returns count of rendering
+ steps required to process the report. Convenience funtion for UI progress
+ indicators.
+15. Added signal signalRenderStatus(int) to MReportEngine to track rendering
+ progress. Convenience funtion for UI progress indicators.
+16. Added public slot cancelRendering() to MReportEngine to cancel report
+ rendering.
+17. Added a progress dialog for report rendering to MReportViewer. User can
+ now cancel report processing.
+18. Changed rendering code to draw at absolute y position. Previous version
+ used to subtract 1 from the y pos so that bordered fields would not have
+ double borders on one side. Existing reports that used bordered fields in
+ this way will need to be modified, shrink the height of the report section
+ by one - the bordered fields will still form a grid (see samplereport1.xml).
+19. Added clear functions to report sections so the report engine can clear
+ existing formatting data before setting a new report template.
+
+
+*************************
+VERSION 0.1
+*************************
+
+First release
diff --git a/kugar/ChangeLog b/kugar/ChangeLog
new file mode 100644
index 00000000..df47a25b
--- /dev/null
+++ b/kugar/ChangeLog
@@ -0,0 +1,108 @@
+2003-05-28 Alexander Dymo <[email protected]>
+ * kudesigner:
+ Kudesigner rework:
+ most functionality is moved to kudesigner_lib and made platform-independant (qt only or necessary #ifdefs)
+ only document-view-application arch implementation remains.
+ Main goal: to create qt version of kugar designer with minimal effort (common/shared code will be in kudesigner_lib).
+
+ * kudesigner_lib:
+ Common kugar designer library created. Compiles with qt only (qt only compile should utilize PURE_QT define).
+
+ * kudesigner_qt2:
+ Alternate Qt only Kugar Designer created (uses kudesigner_lib).
+
+ * shell_qt2:
+ Alternate Qt only Kugar shell created.
+
+ * kudesigner:
+ Undo/Redo for report items works now without crashes if their parent section was undone.
+
+2003-05-01 Joris Marcillac <[email protected]>
+ * lib:
+ Direct database support. Databases and queries can be specified withing template
+ file and then the data file can be generated
+ * samplesdb:
+ Example program that shows usage of the direct database support in Kugar.
+
+2003-04-05 Alexander Dymo <[email protected]>
+ * kudesigner:
+ Undo/Redo implemented for all insert actions
+
+2003-04-01 Per Winkvist <[email protected]>
+ * kudesigner:
+ Add check in DoubleClickEvent that we used LeftButton
+ Allow + and - keys to be used to change FontSize
+ Allow Del key to be used to delete an item
+
+2003-03-31 Alexander Dymo <[email protected]>
+ * kudesigner:
+ Applied patch from Per Winkvist <[email protected]>:
+ Fast property editing (name, fieldname) like in Qt Designer
+
+2003-03-22 Alexander Dymo <[email protected]>
+ * kugar:
+ Qt only version of the designer and preliminary version of shell added to the repository.
+ Qt only versions aren't compiled with kde. They should be compiled by hand using
+ qmake kugar.pro
+ make -f Makefile.qt (on unix)
+ QMake and automake coexist normally;)
+ Qt only Kugar Designer and shell do not support KOffice zipped xml files
+ Preliminary qt-shell is written by Joris Marcillac <[email protected]>
+ * lib:
+ Fixes for qt-only compilation, thanks to Joris Marcillac <[email protected]>
+
+2003-03-16 Alexander Dymo <[email protected]>
+ * kudesigner:
+ Code reorganization to make it more modular
+
+2003-02-25 Joseph Wenninger <[email protected]>
+ * part:
+ 1) Don't crash anymore if a template file can't be loaded
+ 2) Support kudesigner koStore template files (That's a littlebit hacky.
+ Once ku{gar|designer} supports images the loading has to be redone a littlebit, but for now it works
+ 3) Relative template pathes are now relative to the data file, not to the current working directory
+
+2003-01-25 Joseph Wenninger <[email protected]>
+ * kudesigner:
+ Canvas Bands can now be resized with the mouse
+ Changed resizehandle paint code. They are painted above all items now.
+ Changed mouse <-> resize handle interaction.
+ If the resizehandle is displayed partly above an item which has a higher z-order
+ than the item they belong too, a resize operation is still triggerd.
+ That makes section resizeable, if they have a report item in the middle which fills the whole height
+
+2003-01-21 Joseph Wenninger <[email protected]>
+ * kudesigner:
+ 1) Let a plugin access the property, it should create a editor for.
+ There is a new type enum UserDefined, which should mark the beginning of user defineable property types.
+ If there is no custom editor created, user defined types will show a lineedit.
+ 2) Now all resize grips works for report items.
+ 3) Support for properties, which should not be saved into the kugar template file
+
+2003-01-19 Joseph Wenninger <[email protected]>
+ * kudesigner:
+ Pluggable property editors, bands are now resizable with the property editor
+
+2003-01-16 Joseph Wenninger <[email protected]>
+ * kudesigner:
+ Now it is ensured, that items can't be moved out of ther section or resized to be larger than a section.
+
+2003-01-03 Alexander Dymo <[email protected]>
+ * kudesigner:
+ Many visual editors for properties created - font and color combos, etc.
+
+2002-12-29 Alexander Dymo <[email protected]>
+ * kudesigner:
+ Property editing in designer is coming back with the new Property Editor widget
+
+2002-11-23 Joseph Wenninger <[email protected]>
+ * part:
+ Part is now a KOffice part, old shell disabled, new part-based shell is ready to use
+
+2002-09-22 Alexander Dymo <[email protected]>
+ * kudesigner:
+ Porting to KoDocument/KoFactory/KoView/KoAcclication started
+
+2002-09-20 Alexander Dymo <[email protected]>
+ * lib: Transparency for labels/fields/specials/calcfields added (gui property does not exists yet)
+
diff --git a/kugar/Makefile.am b/kugar/Makefile.am
new file mode 100644
index 00000000..3809a00e
--- /dev/null
+++ b/kugar/Makefile.am
@@ -0,0 +1,8 @@
+#SUBDIRS = lib part shell samples kudesigner
+SUBDIRS = lib part samples kudesigner_lib kudesigner
+
+KDE_ICON = kugar kugardata
+
+messages:
+ $(EXTRACTRC) lib/*.ui part/*.ui kudesigner/*.ui */*.rc > rc.cpp
+ $(XGETTEXT) -ktr lib/*.cpp part/*.cpp kudesigner/*.cpp kudesigner_lib/*.cpp kudesigner_lib/*.h part/kugar_about.h kudesigner/kudesigner_aboutdata.h rc.cpp -o $(podir)/kugar.pot
diff --git a/kugar/README b/kugar/README
new file mode 100644
index 00000000..6c6372a9
--- /dev/null
+++ b/kugar/README
@@ -0,0 +1,85 @@
+Kugar - A report creation tool for KDE.
+
+Current version: 1.3
+
+The current maintainer
+can be reached via Email: [email protected]
+or visit http://www.koffice.org/kugar/
+
+The former maintainer and the author of Kugar Report Designer
+part can be reached via Email: [email protected]
+
+The former maintainer and author of Kugar report viewer and konqueror
+part can be reached via Email: [email protected]
+
+The original author can be reached via Email: [email protected]
+or visit http://www.mutinybaysoftware.com. The original name of the package
+was Metaphrast.
+
+
+ABOUT KUGAR:
+
+Current features:
+
+* KDE GUI report designer.
+* Qt report viewer widget for previewing reports from within a Qt application
+ (WYSIWYG).
+* KDE report viewer widget that utilizes KDE print dialog
+* KDE report viewer utility.
+* KPart report viewer component - view reports from within Konqueror.
+* Report printing in Postscript.
+* Database/datasource neutral, data is supplied to the report engine in XML.
+* Open report definition files, report layout is stored in XML.
+* Report Header/Footer.
+* Page Header/Footer.
+* Detail Section.
+* Detail Header/Footer.
+* Multiple Detail levels (unlimited).
+* Grand totals: count, sum, average, variance and standard deviation.
+* Report print progress and cancellation.
+* Report rendering progress and cancellation.
+* Complete implementation of (Qt) printer setup options.
+* Additional formatting (negative numbers, currency, commas for numbers and
+ dates).
+* Direct database support.
+
+
+DOCUMENTATION:
+
+Included in docbook-xml format among with the koffice package.
+Docs include tutorial, user documentation and developer documentation.
+
+REQUIREMENTS:
+
+The following items must be installed prior to building Kugar:
+
+1. Qt version 3.1+ - http://www.trolltech.com
+2. KDE 3.1.0+ - http://www.kde.org
+
+
+BUILDING KUGAR:
+
+Basically:
+
+ ./configure
+ make
+ make install
+
+See the INSTALL file for details.
+
+
+RUNNING A SAMPLE REPORT WITH KUGAR:
+
+There are three sample templates and matching datafiles in ./samples.
+
+The kugar program takes one or more data files on the commandline.
+
+Example: kugar samples/sample1.kdf
+
+To use Konqueror to display a sample, just click on the data file (with the
+.kdf extension) from within Konqueror.
+
+To create template file run Kugar Report Designer program (kudesigner).
+To add report items and sections use toolbuttons and menus,
+to edit their properties just right-click on them,
+to delete - middle-click.
diff --git a/kugar/TODO b/kugar/TODO
new file mode 100644
index 00000000..456acce7
--- /dev/null
+++ b/kugar/TODO
@@ -0,0 +1,46 @@
+All components:
+- set positions and dimensions in real dpi-independent units like santimeters, inches
+ and get rid of all other dpi dependecies
+
+Kudesigner:
+- Z-Ordering (right-click menu) for report items
+ default: all items are created with the same z-position
+- print and print preview
+- open x-kugarmixed files ???
+- do not allow to move report items out of their section (Works, except when moved/resized with the property editor or during placing of new items)
+- make a grid for element placing
+- implement "smart" moving of elements (stick to borders)
+- automatic resize of property editor
+- save position and size of the property editor
+- undo / redo
+ redo items don't work afrer undo section!
+- cut / copy / paste
+- DCOP interface
+- more flexible uncompressed file save (maybe export filter)
+
+- optimizations:
+-- create property editor widgets only once
+-- do not repaint selected items during selection (review algo if (selectionStarted) in ReportCanvas::contentsMouseMoveEvent())
+-- remove unnesesary canvas_item->hide() and show() | code review
+-- same for canvas()->update() | nesessary
+
+- CRUSHES
+-- undo item, undo section, redo item --> crush
+
+Kugar engine:
+- More work on direct database support in the engine:
+ Allow merging existing data files and generated ones by MDatabaseReportEngine
+- Review the progress updating in the engine - use either percentages or Page
+ n of m. Integrate properly with the Konqueror status bar.
+- The engine should also report (through signals) the current page and the
+ total number of pages so that the GUI can display them on the status line.
+- Look at adding some chart types.
+- For some template elements we want the user (ie. the data DTD) to be able
+ to optionally override them to give them some local control over the
+ format, eg. paper size (dont forget Vishakan's wishes).
+- Improve the error reporting - particularly about bad XML.
+
+
+Kugar shell(part):
+- --print --from <number> --to <number> --copies <number> --printer <name>
+ AD: I have some pathes for kugar/lib and kugar/shell (deprecated shell)
diff --git a/kugar/cr16-mime-kugardata.png b/kugar/cr16-mime-kugardata.png
new file mode 100644
index 00000000..ff44498b
--- /dev/null
+++ b/kugar/cr16-mime-kugardata.png
Binary files differ
diff --git a/kugar/cr32-mime-kugardata.png b/kugar/cr32-mime-kugardata.png
new file mode 100644
index 00000000..a60c91cc
--- /dev/null
+++ b/kugar/cr32-mime-kugardata.png
Binary files differ
diff --git a/kugar/hi16-app-kugar.png b/kugar/hi16-app-kugar.png
new file mode 100644
index 00000000..d7a863a8
--- /dev/null
+++ b/kugar/hi16-app-kugar.png
Binary files differ
diff --git a/kugar/hi22-app-kugar.png b/kugar/hi22-app-kugar.png
new file mode 100644
index 00000000..42eeb08b
--- /dev/null
+++ b/kugar/hi22-app-kugar.png
Binary files differ
diff --git a/kugar/hi32-app-kugar.png b/kugar/hi32-app-kugar.png
new file mode 100644
index 00000000..f3ba18b9
--- /dev/null
+++ b/kugar/hi32-app-kugar.png
Binary files differ
diff --git a/kugar/hi48-app-kugar.png b/kugar/hi48-app-kugar.png
new file mode 100644
index 00000000..00c9d439
--- /dev/null
+++ b/kugar/hi48-app-kugar.png
Binary files differ
diff --git a/kugar/kudesigner/Makefile.am b/kugar/kudesigner/Makefile.am
new file mode 100644
index 00000000..24d4380e
--- /dev/null
+++ b/kugar/kudesigner/Makefile.am
@@ -0,0 +1,42 @@
+SUBDIRS = toolbar pics templates
+
+INCLUDES = -I$(srcdir)/../kudesigner_lib -I$(srcdir)/../lib \
+ $(KOPROPERTY_INCLUDES) $(KOFFICE_INCLUDES) $(all_includes)
+
+bin_PROGRAMS =
+
+lib_LTLIBRARIES = libkudesignercore.la
+libkudesignercore_la_SOURCES = kudesigner_view.cpp kudesigner_factory.cpp \
+ kudesigner_doc.cpp
+libkudesignercore_la_LDFLAGS = -avoid-version $(all_libraries) $(KDE_RPATH) -no-undefined
+libkudesignercore_la_LIBADD = ../kudesigner_lib/libkudesignercommon.la $(LIB_KOFFICEUI) $(LIB_KPARTS) $(LIB_KOFFICECORE) $(LIB_KOPROPERTY) $(LIB_KIO) $(LIB_KDEPRINT)
+
+## The part
+kde_module_LTLIBRARIES = libkudesignerpart.la
+libkudesignerpart_la_SOURCES = kudesigner_part.cpp
+libkudesignerpart_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) $(KDE_RPATH)
+libkudesignerpart_la_LIBADD = libkudesignercore.la $(LIB_KOFFICEUI) $(LIB_KPARTS) $(LIB_KOFFICECORE)
+
+## The kdeinit loadable module
+kdeinit_LTLIBRARIES = kudesigner.la
+kudesigner_la_SOURCES = main.cpp
+kudesigner_la_LDFLAGS = $(all_libraries) -module -avoid-version
+kudesigner_la_LIBADD = $(LIB_KOFFICECORE)
+
+xdg_apps_DATA = kudesigner.desktop
+
+METASOURCES = AUTO
+
+rcdir = $(kde_datadir)/kudesigner
+rc_DATA = kudesignerui.rc kudesigner_readonly.rc
+
+EXTRA_DIST = \
+ kudesigner_aboutdata.h \
+ kudesigner_factory.h \
+ kudesigner_part.h \
+ kudesigner_view.h \
+ $(rc_DATA) \
+ $(xdg_apps_DATA)
+
+KDE_CXXFLAGS = $(USE_EXCEPTIONS) -DKPROPERTY_EXPORT=
+
diff --git a/kugar/kudesigner/kudesigner.desktop b/kugar/kudesigner/kudesigner.desktop
new file mode 100644
index 00000000..0636987f
--- /dev/null
+++ b/kugar/kudesigner/kudesigner.desktop
@@ -0,0 +1,159 @@
+# KDE Config File
+[Desktop Entry]
+Type=Application
+Exec=kudesigner %u
+Icon=kudesigner
+DocPath=kugar/index.html
+Terminal=false
+Name=Kugar Designer
+Name[af]=Kugar Ontwerper
+Name[ar]=مُصَمِّم Kugar
+Name[bg]=Дизайнер за Kugar
+Name[br]=Ergrafer Kugar
+Name[ca]=Dissenyador Kugar
+Name[cy]=Dylunydd Kugar
+Name[de]=Kugar-Designer
+Name[el]=Σχεδιαστής Kugar
+Name[eo]=Kugar Kreilo
+Name[es]=Diseñador Kugar
+Name[eu]=Kugar diseinatzailea
+Name[fa]=طراح Kugar
+Name[fr]=Concepteur Kugar
+Name[fy]=Kugar ûntwerp
+Name[gl]=Deseñados de Kugar
+Name[hi]=कुगर डिज़ाइनर
+Name[hr]=Kugar dizajner
+Name[is]=Kugar hönnuður
+Name[ja]=Kugar デザイナー
+Name[km]=កម្មវិធី​រចនា Kugar
+Name[lo]=ອອກແບບລາຍງານ K
+Name[lv]=Kugar dizainers
+Name[ms]=Pereka Bentuk Kugar
+Name[mt]=Diżinjatur Kugar
+Name[nb]=Kugar designer
+Name[nds]=Kugar-Maker
+Name[ne]=कुगर डिजाइनर
+Name[pl]=Projektant Kugar
+Name[sk]=Návrhár Kugar
+Name[sl]=Snovalnik Kugar
+Name[sr]=Kugar дизајнер
+Name[sr@Latn]=Kugar dizajner
+Name[sv]=Kugar designer
+Name[ta]=Kugar வடிவமைப்பாளர்
+Name[tg]=Дизайнгари Kugar
+Name[th]=ออกแบบรายงาน K
+Name[tr]=Kugar Tasarım Programı
+Name[uk]=Дизайнер Kugar
+Name[uz]=Kugar dizayner
+Name[uz@cyrillic]=Kugar дизайнер
+Name[xh]=Umyili we Kugar
+Name[zh_CN]=Kugar 设计器
+Name[zh_TW]=Kugar 設計家
+GenericName=Report Template
+GenericName[bg]=Шаблон за отчети
+GenericName[ca]=Plantilla d'informe
+GenericName[cy]=Patrymlun Adroddiad
+GenericName[da]=Rapport-skabelon
+GenericName[de]=Berichtvorlage
+GenericName[el]=Πρότυπο αναφοράς
+GenericName[eo]=Raportŝablono
+GenericName[es]=Plantillas de informes
+GenericName[et]=Aruandemall
+GenericName[eu]=Txosten-txantiloia
+GenericName[fa]=قالب گزارش
+GenericName[fi]=Raporttipohja
+GenericName[fr]=Modèle de rapport
+GenericName[fy]=Rapportsjabloan
+GenericName[gl]=Modelo de informe
+GenericName[he]=תבנית דו"ח
+GenericName[hu]=Jelentéstervező
+GenericName[is]=Skýrslusnið
+GenericName[it]=Modello di rapporto
+GenericName[ja]=レポートテンプレート
+GenericName[km]=ពុម្ព​របាយការណ៍
+GenericName[lt]=Ataskaitos šablonas
+GenericName[lv]=Atskaites šablons
+GenericName[ms]=Templat Laporan
+GenericName[nb]=Utforming av rapportmaler
+GenericName[nds]=Berichtvörlaag
+GenericName[ne]=प्रतिवेदन टेम्प्लेट
+GenericName[nl]=Rapportsjabloon
+GenericName[nn]=Rapportmal
+GenericName[pl]=Szablon raportu
+GenericName[pt]=Modelo de Relatório
+GenericName[pt_BR]=Modelo de Relatório
+GenericName[ru]=Шаблон отчёта
+GenericName[se]=Raportamálle
+GenericName[sk]=Šablóna správ
+GenericName[sl]=Predloga za poročila
+GenericName[sr]=Шаблон за извештаје
+GenericName[sr@Latn]=Šablon za izveštaje
+GenericName[sv]=Rapportmall
+GenericName[uk]=Шаблон звіту
+GenericName[uz]=Hisobot namunasi
+GenericName[uz@cyrillic]=Ҳисобот намунаси
+GenericName[zh_CN]=报告模板
+GenericName[zh_TW]=報告範本
+Comment=Report Designer
+Comment[af]=Raporteer Ontwerper
+Comment[ar]=مُصَمِّم التَّقارير
+Comment[bg]=Създаване на отчети
+Comment[bs]=Dizajner izvještaja
+Comment[ca]=Dissenyador d'informes
+Comment[cs]=Návrhář reportů
+Comment[cy]=Dylunydd Adroddiad
+Comment[da]=Rapportdesigner
+Comment[de]=Bericht-Designer
+Comment[el]=Σχεδιαστής αναφορών
+Comment[eo]=Raporto-kreilo
+Comment[es]=Diseñador de informes
+Comment[et]=Aruandedisainer
+Comment[eu]=Txosten-diseinatzailea
+Comment[fa]=طراح گزارش
+Comment[fi]=Raporttisuunittelija
+Comment[fr]=Générateur de rapports
+Comment[fy]=Rapportengenerator
+Comment[gl]=Deseñador de informes
+Comment[he]=מעצב דו"חות
+Comment[hi]=रपट डिज़ाइनर
+Comment[hr]=Dizajner izvještaja
+Comment[hu]=Jelentéskészítő
+Comment[is]=Skýrsluhönnuður
+Comment[it]=Progettazione di rapporti
+Comment[ja]=レポートデザイナー
+Comment[km]=កម្មវិធី​រចនា​របាយការណ៍
+Comment[lo]=ຕົວອອກແບບລາຍງານ
+Comment[lv]=Reporta Dizainers
+Comment[ms]=Pereka Bentuk Laporan
+Comment[mt]=Diżinjatur tar-rapporti
+Comment[nb]=Formgivingsprogram for rapporter
+Comment[nds]=Bericht-Maker
+Comment[ne]=प्रतिवेदन डिजाइनर
+Comment[nl]=Rapportengenerator
+Comment[nn]=Rapportformgjevar
+Comment[pl]=Projektant raportów
+Comment[pt]=Desenhador de Relatórios
+Comment[pt_BR]=Gerador de Relatórios
+Comment[ru]=Дизайнер отчётов
+Comment[se]=Raportahápmejeaddji
+Comment[sk]=Návrhár reportov
+Comment[sl]=Snovalnik poročil
+Comment[sr]=Дизајнер извештаја
+Comment[sr@Latn]=Dizajner izveštaja
+Comment[sv]=Rapportdesign
+Comment[ta]=Report வடிவமைப்பலர்
+Comment[tg]=Ахборот барои Дизайнгар
+Comment[th]=ตัวออกแบบรายงาน
+Comment[tr]=Rapor Tasarım Programı
+Comment[uk]=Генератор звітів
+Comment[uz]=Hisobot dizayneri
+Comment[uz@cyrillic]=Ҳисобот дизайнери
+Comment[xh]=Umyili Wengxelo
+Comment[zh_CN]=报告设计器
+Comment[zh_TW]=簡報設計家
+MimeType=application/x-kudesigner
+X-KDE-NativeMimeType=application/x-kudesigner
+X-KDE-Library=libkudesignerpart
+ServiceTypes=KOfficePart,KParts/ReadOnlyPart,KParts/ReadWritePart
+
+Categories=Qt;KDE;Office;X-KDE-More;
diff --git a/kugar/kudesigner/kudesigner_aboutdata.h b/kugar/kudesigner/kudesigner_aboutdata.h
new file mode 100644
index 00000000..9be6a2de
--- /dev/null
+++ b/kugar/kudesigner/kudesigner_aboutdata.h
@@ -0,0 +1,56 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KUDESIGNER_ABOUTDATA
+#define KUDESIGNER_ABOUTDATA
+
+#include <kaboutdata.h>
+#include <klocale.h>
+#include <kofficeversion.h>
+
+static const char* description = I18N_NOOP( "GUI report template designer for Kugar report engine" );
+static const char* version = KOFFICE_VERSION_STRING;
+
+KAboutData * newKudesignerAboutData()
+{
+ // Change this, of course
+ // The first argument of the KAboutData constructor is the instance name.
+ // It is very important, it's what's used for many things, like the subdir in share/apps, etc.
+ // It must also match the name of the application's .desktop file.
+ KAboutData * aboutData = new KAboutData( "kudesigner", I18N_NOOP( "Kugar Report Designer" ),
+ version, description, KAboutData::License_LGPL,
+ "(c) 2002,2003, Alexander Dymo (and the Kugar Team)" );
+ aboutData->addAuthor( "Alexander Dymo",
+ I18N_NOOP( "Maintainer, Report Designer, Kugar library enhancements" ),
+ "http://www.cloudtemple.mksat.net" );
+ aboutData->addAuthor( "Joseph Wenninger",
+ I18N_NOOP( "Major bugfixes, additional features and Kexi integration" ),
+ "" );
+ aboutData->addCredit( "Per Winkvist",
+ I18N_NOOP( "Fast property editing for report items" ),
+ "" );
+ aboutData->setTranslator( I18N_NOOP( "_: NAME OF TRANSLATORS\nYour names" ),
+ I18N_NOOP( "_: EMAIL OF TRANSLATORS\nYour emails" ) );
+ return aboutData;
+}
+
+#endif
diff --git a/kugar/kudesigner/kudesigner_doc.cpp b/kugar/kudesigner/kudesigner_doc.cpp
new file mode 100644
index 00000000..eb240a88
--- /dev/null
+++ b/kugar/kudesigner/kudesigner_doc.cpp
@@ -0,0 +1,294 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "kudesigner_doc.h"
+#include "kudesigner_factory.h"
+#include "kudesigner_view.h"
+
+#include <KoTemplateChooseDia.h>
+#include <kparts/componentfactory.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kcommand.h>
+
+#include <qpainter.h>
+#include <qprinter.h>
+#include <qpaintdevicemetrics.h>
+#include <qfileinfo.h>
+#include <qdockwindow.h>
+#include <qdom.h>
+#include <qtextstream.h>
+#include <qtextcodec.h>
+
+#include <canvas.h>
+#include <kugartemplate.h>
+
+#include "kudesigner_view.h"
+
+KudesignerDoc::KudesignerDoc( QWidget *parentWidget, const char *widgetName, QObject* parent, const char* name, bool singleViewMode )
+ : KoDocument( parentWidget, widgetName, parent, name, singleViewMode ), m_plugin( 0 ), m_propPos( DockRight ), m_modified( false )
+{
+ setInstance( KudesignerFactory::global(), false );
+ setTemplateType("kudesigner_template");
+ history = new KoCommandHistory( actionCollection() );
+
+ // connect( history, SIGNAL( documentRestored() ), this, SLOT( slotDocumentRestored() ) );
+ // connect( history, SIGNAL( commandExecuted() ), this, SLOT( slotCommandExecuted() ) );
+ docCanvas = new Kudesigner::Canvas( 100, 100 );
+ emit canvasChanged( docCanvas );
+}
+
+KudesignerDoc::~KudesignerDoc()
+{
+ delete history;
+}
+
+void KudesignerDoc::addCommand( KCommand *cmd )
+{
+ cmd->execute();
+ setModified( true );
+ /* history->addCommand(cmd);*/
+}
+
+bool KudesignerDoc::initDoc( InitDocFlags flags, QWidget* parentWidget )
+{
+ // If nothing is loaded, do initialize here
+ bool ok = FALSE;
+
+ // TODO if (flags==KoDocument::InitDocEmpty)
+
+ QString file;
+ KoTemplateChooseDia::DialogType dlgtype;
+ if ( flags != KoDocument::InitDocFileNew )
+ dlgtype = KoTemplateChooseDia::Everything;
+ else
+ dlgtype = KoTemplateChooseDia::OnlyTemplates;
+
+ KoTemplateChooseDia::ReturnType ret = KoTemplateChooseDia::choose(
+ KudesignerFactory::global(), file,
+ dlgtype, "kudesigner_template", parentWidget );
+ if ( ret == KoTemplateChooseDia::Template )
+ {
+ resetURL();
+ ok = loadNativeFormat( file );
+ if ( !ok )
+ showLoadingErrorDialog();
+ setEmpty();
+ }
+ else if ( ret == KoTemplateChooseDia::File )
+ {
+ KURL url( file );
+ ok = openURL( url );
+ }
+ else if ( ret == KoTemplateChooseDia::Empty )
+ {
+ QString fileName( locate( "kudesigner_template", "General/.source/A4.ktm", KudesignerFactory::global() ) );
+ resetURL();
+ ok = loadNativeFormat( fileName );
+ if ( !ok )
+ showLoadingErrorDialog();
+ setEmpty();
+ }
+ setModified( FALSE );
+
+ return ok;
+}
+
+void KudesignerDoc::initEmpty()
+{
+ QString fileName( locate( "kudesigner_template", "General/.source/A4.ktm", KudesignerFactory::global() ) );
+ bool ok = loadNativeFormat( fileName );
+ if ( !ok )
+ showLoadingErrorDialog();
+ setEmpty();
+ resetURL();
+ setModified(false);
+}
+
+KoView* KudesignerDoc::createViewInstance( QWidget* parent, const char* name )
+{
+ return new KudesignerView( this, parent, name );
+}
+
+bool KudesignerDoc::loadOasis( const QDomDocument&, KoOasisStyles&, const QDomDocument&, KoStore* )
+{
+ return false;
+}
+
+bool KudesignerDoc::saveOasis( KoStore*, KoXmlWriter* )
+{
+ return false;
+}
+
+void KudesignerDoc::paintContent( QPainter& painter, const QRect& rect, bool /*transparent*/,
+ double /*zoomX*/, double /*zoomY*/ )
+{
+ // ####### handle transparency
+
+ // Need to draw only the document rectangle described in the parameter rect.
+
+ canvas() ->drawArea( rect, &painter, TRUE );
+
+}
+
+void KudesignerDoc::commandExecuted()
+{
+ setModified( true );
+}
+
+void KudesignerDoc::documentRestored()
+{
+ setModified( false );
+}
+
+Kudesigner::Canvas *KudesignerDoc::canvas()
+{
+ return docCanvas;
+}
+
+int KudesignerDoc::supportedSpecialFormats() const
+{
+ return SaveAsDirectoryStore | SaveAsFlatXML;
+}
+
+QDomDocument KudesignerDoc::saveXML()
+{
+ QDomDocument doc;
+ doc.setContent( docCanvas->kugarTemplate() ->getXml() );
+ return doc;
+}
+
+bool KudesignerDoc::saveToStream( QIODevice * dev )
+{
+ QTextStream ts( dev );
+ ts.setCodec( QTextCodec::codecForName( "UTF-8" ) );
+ ts << docCanvas->kugarTemplate() ->getXml();
+ return true;
+}
+
+void KudesignerDoc::loadPlugin( const QString &name )
+{
+ kdDebug() << "Trying to load plugin: " << name << endl;
+ KuDesignerPlugin *plug = KParts::ComponentFactory::createInstanceFromLibrary<KuDesignerPlugin>( name.utf8(), this );
+ m_plugin = plug;
+ if ( m_plugin )
+ kdDebug() << "plugin has been loaded" << endl;
+ else
+ kdDebug() << "plugin couldn't be loaded :(" << endl;
+}
+
+bool KudesignerDoc::completeSaving( KoStore* store )
+{
+ if ( m_plugin )
+ return m_plugin->store( store );
+ return true;
+}
+
+bool KudesignerDoc::completeLoading( KoStore* store )
+{
+ if ( m_plugin )
+ return m_plugin->load( store );
+ return true;
+}
+
+KuDesignerPlugin *KudesignerDoc::plugin()
+{
+ return canvas() ->plugin();
+}
+
+Qt::Dock KudesignerDoc::propertyPosition()
+{
+ return m_propPos;
+}
+
+void KudesignerDoc::setForcedPropertyEditorPosition( Dock d )
+{
+ m_propPos = d;
+}
+
+void KudesignerDoc::setModified( const bool val )
+{
+ m_modified = val;
+ emit modificationMade( val );
+}
+
+bool KudesignerDoc::modified( ) const
+{
+ return m_modified;
+}
+
+bool KudesignerDoc::loadXML( QIODevice *, const QDomDocument &rt )
+{
+ QDomNode report, rep;
+ for ( QDomNode report = rt.firstChild(); !report.isNull(); report = report.nextSibling() )
+ {
+ if ( report.nodeName() == "KugarTemplate" )
+ {
+ rep = report;
+ break;
+ }
+ }
+ report = rep;
+
+ QDomNamedNodeMap attributes = report.attributes();
+ //getting the page width and height
+ int height = 297;
+ int width = 210;
+
+ if ( attributes.namedItem( "PageOrientation" ).nodeValue().toInt() )
+ {
+ int temp = height;
+ height = width;
+ width = temp;
+ }
+
+ //zooming canvas according to screen resolution
+ QPrinter* printer;
+
+ // Set the page size
+ printer = new QPrinter();
+ printer->setFullPage( true );
+ printer->setPageSize( ( QPrinter::PageSize ) attributes.namedItem( "PageSize" ).nodeValue().toInt() );
+ printer->setOrientation( ( QPrinter::Orientation ) attributes.namedItem( "PageOrientation" ).nodeValue().toInt() );
+
+ // Get the page metrics and set appropriate wigth and height
+ QPaintDeviceMetrics pdm( printer );
+ width = pdm.width();
+ height = pdm.height();
+
+ //this is not needed anymore
+ delete printer;
+
+ //creating canvas
+ if ( docCanvas )
+ delete docCanvas;
+ docCanvas = new Kudesigner::Canvas( width, height );
+ emit canvasChanged( docCanvas );
+
+ docCanvas->setAdvancePeriod( 30 );
+
+ return docCanvas->loadXML( report );
+}
+
+void KudesignerDoc::setModified()
+{
+ setModified( true );
+}
+
+#include "kudesigner_doc.moc"
diff --git a/kugar/kudesigner/kudesigner_doc.h b/kugar/kudesigner/kudesigner_doc.h
new file mode 100644
index 00000000..71fdde3c
--- /dev/null
+++ b/kugar/kudesigner/kudesigner_doc.h
@@ -0,0 +1,97 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef KUDESIGNER_DOC_H
+#define KUDESIGNER_DOC_H
+
+#include <KoDocument.h>
+#include <kcommand.h>
+#include <KoCommandHistory.h>
+#include "plugin.h"
+
+class QCanvas;
+class QDomNode;
+class QIODevice;
+class QDomDocument;
+
+namespace Kudesigner
+{
+class Canvas;
+}
+
+class KudesignerDoc: public KoDocument
+{
+ Q_OBJECT
+public:
+ KudesignerDoc( QWidget *parentWidget = 0, const char *widgetName = 0, QObject* parent = 0, const char* name = 0, bool singleViewMode = false );
+
+ ~KudesignerDoc();
+
+ virtual void paintContent( QPainter& painter, const QRect& rect, bool transparent = FALSE, double zoomX = 1.0, double zoomY = 1.0 );
+
+ virtual bool initDoc( InitDocFlags flags, QWidget* parentWidget );
+
+ virtual bool loadOasis( const QDomDocument&, KoOasisStyles&, const QDomDocument&, KoStore* );
+ virtual bool saveOasis( KoStore*, KoXmlWriter* );
+
+ virtual bool loadXML( QIODevice *, const QDomDocument & );
+ virtual QDomDocument saveXML();
+
+ virtual int supportedSpecialFormats() const;
+ virtual bool saveToStream( QIODevice * dev );
+
+ Kudesigner::Canvas *canvas();
+
+ void loadPlugin( const QString& name );
+ KuDesignerPlugin *plugin();
+ Dock propertyPosition();
+ void setForcedPropertyEditorPosition( Dock );
+
+ void addCommand( KCommand *cmd );
+
+ virtual bool modified() const;
+
+signals:
+ void canvasChanged( Kudesigner::Canvas * );
+ void modificationMade( bool );
+
+public slots:
+ virtual void setModified( const bool val );
+ virtual void setModified();
+ virtual void initEmpty();
+
+protected:
+ virtual KoView* createViewInstance( QWidget* parent, const char* name );
+ virtual bool completeSaving( KoStore* store );
+ virtual bool completeLoading( KoStore* store );
+
+protected slots:
+ void commandExecuted();
+ void documentRestored();
+
+private:
+ KoCommandHistory *history;
+
+ Kudesigner::Canvas *docCanvas;
+
+ KuDesignerPlugin *m_plugin;
+ Dock m_propPos;
+ bool m_modified;
+};
+
+#endif
diff --git a/kugar/kudesigner/kudesigner_factory.cpp b/kugar/kudesigner/kudesigner_factory.cpp
new file mode 100644
index 00000000..c83cedbf
--- /dev/null
+++ b/kugar/kudesigner/kudesigner_factory.cpp
@@ -0,0 +1,99 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include <kudesigner_factory.h>
+#include <kudesigner_doc.h>
+#include <kudesigner_aboutdata.h>
+#include <kinstance.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kstandarddirs.h>
+
+KInstance* KudesignerFactory::s_global = 0L;
+KAboutData* KudesignerFactory::s_aboutData = 0L;
+
+KudesignerFactory::KudesignerFactory( QObject* parent, const char* name )
+ : KoFactory( parent, name )
+{
+ global();
+}
+
+KudesignerFactory::~KudesignerFactory()
+{
+ delete s_aboutData;
+ s_aboutData = 0L;
+ delete s_global;
+ s_global = 0L;
+}
+
+KParts::Part* KudesignerFactory::createPartObject( QWidget *parentWidget, const char *widgetName, QObject* parent, const char* name, const char* classname, const QStringList & data )
+{
+ // If classname is "KoDocument", our host is a koffice application
+ // otherwise, the host wants us as a simple part, so switch to readonly and single view.
+ bool bWantKoDocument = ( strcmp( classname, "KoDocument" ) == 0 );
+ // parentWidget and widgetName are used by KoDocument for the "readonly+singleView" case.
+ KudesignerDoc *part = new KudesignerDoc( parentWidget, widgetName, parent, name, !bWantKoDocument );
+
+ if ( !bWantKoDocument )
+ part->setReadWrite( false );
+
+ if ( bWantKoDocument && ( data.count() > 0 ) )
+ {
+ for ( QStringList::const_iterator it = data.begin();it != data.end();++it )
+ {
+ if ( ( *it ).startsWith( "plugin=" ) )
+ {
+ part->loadPlugin( ( *it ).right( ( *it ).length() - 7 ) );
+ }
+ else if ( ( *it ).startsWith( "forcePropertyEditorPosition=" ) )
+ {
+ QString tmp = ( *it ).right( ( *it ).length() - 28 ).upper();
+ kdDebug() << "forced property editor position: " << tmp << endl;
+ part->setForcedPropertyEditorPosition( tmp == "LEFT" ? DockLeft : DockRight );
+ }
+ }
+ }
+
+ return part;
+}
+
+KAboutData* KudesignerFactory::aboutData()
+{
+ if ( !s_aboutData )
+ s_aboutData = newKudesignerAboutData();
+ return s_aboutData;
+}
+
+KInstance* KudesignerFactory::global()
+{
+ if ( !s_global )
+ {
+ s_global = new KInstance( aboutData() );
+ // Add any application-specific resource directories here
+ s_global->dirs() ->addResourceType( "kudesigner_template",
+ KStandardDirs::kde_default( "data" ) + "kudesigner/templates/" );
+
+ // Tell the iconloader about share/apps/koffice/icons
+ s_global->iconLoader() ->addAppDir( "koffice" );
+ }
+ return s_global;
+}
+
+#include <kudesigner_factory.moc>
diff --git a/kugar/kudesigner/kudesigner_factory.h b/kugar/kudesigner/kudesigner_factory.h
new file mode 100644
index 00000000..ae660eb5
--- /dev/null
+++ b/kugar/kudesigner/kudesigner_factory.h
@@ -0,0 +1,47 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KUDESIGNER_FACTORY_H
+#define KUDESIGNER_FACTORY_H
+
+#include <KoFactory.h>
+#include <koffice_export.h>
+class KInstance;
+class KAboutData;
+
+class KUGARDESIGNER_EXPORT KudesignerFactory : public KoFactory
+{
+ Q_OBJECT
+public:
+ KudesignerFactory( QObject* parent = 0, const char* name = 0 );
+ ~KudesignerFactory();
+
+ virtual KParts::Part *createPartObject( QWidget *parentWidget = 0, const char *widgetName = 0, QObject *parent = 0, const char *name = 0, const char *classname = "KoDocument", const QStringList &args = QStringList() );
+
+ static KInstance* global();
+
+ // _Creates_ a KAboutData but doesn't keep ownership
+ static KAboutData* aboutData();
+
+private:
+ static KInstance* s_global;
+ static KAboutData* s_aboutData;
+};
+
+#endif
diff --git a/kugar/kudesigner/kudesigner_part.cpp b/kugar/kudesigner/kudesigner_part.cpp
new file mode 100644
index 00000000..bf0fe2ba
--- /dev/null
+++ b/kugar/kudesigner/kudesigner_part.cpp
@@ -0,0 +1,22 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Joseph Wenninger <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include <kudesigner_factory.h>
+
+K_EXPORT_COMPONENT_FACTORY( libkudesignerpart, KudesignerFactory )
diff --git a/kugar/kudesigner/kudesigner_readonly.rc b/kugar/kudesigner/kudesigner_readonly.rc
new file mode 100644
index 00000000..a1d9a375
--- /dev/null
+++ b/kugar/kudesigner/kudesigner_readonly.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd" >
+<kpartgui name="kudesigner" version="1">
+<MenuBar>
+ <Menu name="edit"><text>&amp;Edit</text>
+ <Action name="copy"/>
+ </Menu>
+</MenuBar>
+</kpartgui>
diff --git a/kugar/kudesigner/kudesigner_view.cpp b/kugar/kudesigner/kudesigner_view.cpp
new file mode 100644
index 00000000..713b8521
--- /dev/null
+++ b/kugar/kudesigner/kudesigner_view.cpp
@@ -0,0 +1,411 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MEm_viewHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "kudesigner_view.h"
+#include "kudesigner_factory.h"
+#include "kudesigner_doc.h"
+
+#include <map>
+
+#include <qpainter.h>
+#include <qiconset.h>
+#include <qinputdialog.h>
+#include <qevent.h>
+#include <qmainwindow.h>
+#include <qaction.h>
+#include <qlayout.h>
+#include <qdockwindow.h>
+#include <qmenubar.h>
+#include <qmessagebox.h>
+#include <qspinbox.h>
+#include <qlabel.h>
+
+#include <kaction.h>
+#include <kstdaction.h>
+#include <klocale.h>
+#include <kdebug.h>
+
+#include <KoMainWindow.h>
+
+#include <commdefs.h>
+#include <view.h>
+#include <structurewidget.h>
+#include <canvas.h>
+#include <command.h>
+
+#include <field.h>
+#include <calcfield.h>
+#include <label.h>
+#include <line.h>
+#include <specialfield.h>
+
+#include <kugartemplate.h>
+#include <reportheader.h>
+#include <reportfooter.h>
+#include <pageheader.h>
+#include <pagefooter.h>
+#include <detailheader.h>
+#include <detailfooter.h>
+#include <detail.h>
+
+#include <koproperty/editor.h>
+#include <koproperty/property.h>
+
+using namespace Kudesigner;
+
+KudesignerView::KudesignerView( KudesignerDoc* part, QWidget* parent, const char* name )
+ : KoView( part, parent, name ), m_propertyEditor( 0 ), m_doc( part )
+{
+ setInstance( KudesignerFactory::global() );
+ if ( !part->isReadWrite() ) // readonly case, e.g. when embedded into konqueror
+ setXMLFile( "kudesigner_readonly.rc" ); // simplified GUI
+ else
+ setXMLFile( "kudesignerui.rc" );
+
+ QVBoxLayout *l = new QVBoxLayout( this, 0, 0 );
+ m_view = new Kudesigner::View( part->canvas(), this );
+ if ( part->plugin() )
+ {
+ m_view->setAcceptDrops( part->plugin() ->acceptsDrops() );
+ m_view->viewport() ->setAcceptDrops( part->plugin() ->acceptsDrops() );
+ m_view->setPlugin( part->plugin() );
+ }
+ l->addWidget( m_view );
+
+ m_view->viewport() ->setFocusProxy( m_view );
+ m_view->viewport() ->setFocusPolicy( WheelFocus );
+ m_view->setFocus();
+
+ m_view->itemToInsert = 0;
+
+ QDockWindow *dw1 = new QDockWindow( QDockWindow::OutsideDock, shell() );
+ QDockWindow *dw2 = new QDockWindow( QDockWindow::OutsideDock, shell() );
+ m_structure = new Kudesigner::StructureWidget( dw1 );
+ m_propertyEditor = new Editor( dw2 );
+ dw1->boxLayout() ->addWidget( m_structure, 1 );
+ dw2->boxLayout() ->addWidget( m_propertyEditor, 1 );
+ dw1->setFixedExtentWidth( 400 );
+ dw1->setResizeEnabled( true );
+ dw2->setFixedExtentWidth( 400 );
+ dw2->setResizeEnabled( true );
+
+ if ( m_doc->plugin() )
+ {
+ // connect( m_propertyEditor, SIGNAL(createPluggedInEditor(QWidget*&, Editor *, Property*, Box *)),
+ // m_doc->plugin(), SLOT(createPluggedInEditor(QWidget*&, Editor *, Property*, Box *)));
+
+ kdDebug() << "*************Property and plugin have been connected" << endl;
+ }
+
+ shell() ->addDockWindow( dw1, m_doc->propertyPosition() );
+ shell() ->addDockWindow( dw2, m_doc->propertyPosition() );
+
+ m_structure->setDocument( m_doc->canvas() );
+
+ connect( m_doc, SIGNAL( canvasChanged( Kudesigner::Canvas * ) ),
+ m_structure, SLOT( setDocument( Kudesigner::Canvas * ) ) );
+ connect( m_doc->canvas(), SIGNAL( structureModified() ),
+ m_structure, SLOT( refresh() ) );
+
+ connect( m_view, SIGNAL( selectionMade( Buffer* ) ),
+ this, SLOT( populateProperties( Buffer* ) ) );
+
+ connect( m_view, SIGNAL( selectionClear() ),
+ m_propertyEditor, SLOT( clear() ) );
+
+ connect( m_view, SIGNAL( changed() ),
+ m_doc, SLOT( setModified() ) );
+
+ connect( m_view, SIGNAL( selectionMade( Buffer* ) ),
+ m_structure, SLOT( selectionMade() ) );
+ connect( m_view, SIGNAL( selectionClear() ),
+ m_structure, SLOT( selectionClear() ) );
+
+ connect( m_view, SIGNAL( selectedActionProcessed() ), this, SLOT( unselectItemAction() ) );
+ connect( m_view, SIGNAL( modificationPerformed() ), part, SLOT( setModified() ) );
+ connect( m_view, SIGNAL( itemPlaced( int, int, int, int ) ), this, SLOT( placeItem( int, int, int, int ) ) );
+
+ gridLabel = new QLabel( i18n( "Grid size:" ), shell() );
+ gridBox = new QSpinBox( 1, 100, 1, shell() );
+ gridBox->setValue( 10 );
+ connect( gridBox, SIGNAL( valueChanged( int ) ), m_view, SLOT( setGridSize( int ) ) );
+
+ initActions();
+
+ show();
+ m_view->show();
+ m_structure->refresh();
+}
+
+KudesignerView::~KudesignerView()
+{
+ delete gridLabel;
+ delete gridBox;
+}
+
+void KudesignerView::paintEvent( QPaintEvent* ev )
+{
+ QPainter painter;
+ painter.begin( this );
+
+ // ### TODO: Scaling
+
+ // Let the document do the drawing
+ koDocument() ->paintEverything( painter, ev->rect(), FALSE, this );
+
+ painter.end();
+}
+
+void KudesignerView::resizeEvent( QResizeEvent* /*_ev*/ )
+{
+ m_view->setGeometry( 0, 0, width(), height() );
+}
+
+void KudesignerView::initActions()
+{
+ cutAction = KStdAction::cut( this, SLOT( cut() ), actionCollection() );
+ copyAction = KStdAction::copy( this, SLOT( copy() ), actionCollection() );
+ pasteAction = KStdAction::paste( this, SLOT( paste() ), actionCollection() );
+ selectAllAction = KStdAction::selectAll( this, SLOT( selectAll() ), actionCollection() );
+ deleteAction = new KAction( i18n( "Delete" ), "editdelete", 0, this,
+ SLOT( deleteItems() ), actionCollection(), "edit_delete" );
+ cutAction->setEnabled( false );
+ copyAction->setEnabled( false );
+ pasteAction->setEnabled( false );
+ // deleteAction->setEnabled(false);
+
+ sectionsReportHeader = new KAction( i18n( "Report Header" ), "irh", 0, this,
+ SLOT( slotAddReportHeader() ), actionCollection(), "rheader" );
+ sectionsReportFooter = new KAction( i18n( "Report Footer" ), "irf", 0, this,
+ SLOT( slotAddReportFooter() ), actionCollection(), "rfooter" );
+ sectionsPageHeader = new KAction( i18n( "Page Header" ), "iph", 0, this,
+ SLOT( slotAddPageHeader() ), actionCollection(), "pheader" );
+ sectionsPageFooter = new KAction( i18n( "Page Footer" ), "ipf", 0, this,
+ SLOT( slotAddPageFooter() ), actionCollection(), "pfooter" );
+ sectionsDetailHeader = new KAction( i18n( "Detail Header" ), "idh", 0, this,
+ SLOT( slotAddDetailHeader() ), actionCollection(), "dheader" );
+ sectionsDetail = new KAction( i18n( "Detail" ), "id", 0, this,
+ SLOT( slotAddDetail() ), actionCollection(), "detail" );
+ sectionsDetailFooter = new KAction( i18n( "Detail Footer" ), "idf", 0, this,
+ SLOT( slotAddDetailFooter() ), actionCollection(), "dfooter" );
+
+ itemsNothing = new KRadioAction( i18n( "Clear Selection" ), "frame_edit", 0, this,
+ SLOT( slotAddItemNothing() ), actionCollection(), "nothing" );
+ itemsNothing->setExclusiveGroup( "itemsToolBar" );
+ itemsNothing->setChecked( true );
+ itemsLabel = new KRadioAction( i18n( "Label" ), "frame_text", 0, this,
+ SLOT( slotAddItemLabel() ), actionCollection(), "label" );
+ itemsLabel->setExclusiveGroup( "itemsToolBar" );
+ itemsField = new KRadioAction( i18n( "Field" ), "frame_field", 0, this,
+ SLOT( slotAddItemField() ), actionCollection(), "field" );
+ itemsField->setExclusiveGroup( "itemsToolBar" );
+ itemsSpecial = new KRadioAction( i18n( "Special Field" ), "frame_query", 0, this,
+ SLOT( slotAddItemSpecial() ), actionCollection(), "special" );
+ itemsSpecial->setExclusiveGroup( "itemsToolBar" );
+ itemsCalculated = new KRadioAction( i18n( "Calculated Field" ), "frame_formula", 0, this,
+ SLOT( slotAddItemCalculated() ), actionCollection(), "calcfield" );
+ itemsCalculated->setExclusiveGroup( "itemsToolBar" );
+ itemsLine = new KRadioAction( i18n( "Line" ), "frame_chart", 0, this,
+ SLOT( slotAddItemLine() ), actionCollection(), "line" );
+ itemsLine->setExclusiveGroup( "itemsToolBar" );
+
+ gridActionLabel = new KWidgetAction( gridLabel, i18n( "Grid Label" ), 0, this,
+ 0, actionCollection(), "gridlabel" );
+
+ gridAction = new KWidgetAction( gridBox, i18n( "Grid Size" ), 0, this,
+ 0, actionCollection(), "gridaction" );
+}
+
+void KudesignerView::updateReadWrite( bool /*readwrite*/ )
+{
+}
+
+void KudesignerView::guiActivateEvent( KParts::GUIActivateEvent *ev )
+{
+ if ( ev->activated() )
+ m_propertyEditor->show();
+ else
+ m_propertyEditor->hide();
+ KoView::guiActivateEvent( ev );
+}
+
+void KudesignerView::populateProperties( Buffer *buf )
+{
+ connect( buf, SIGNAL( propertyChanged() ), m_doc->canvas(), SLOT( changed() ) );
+ m_propertyEditor->changeSet( buf );
+}
+
+void KudesignerView::cut()
+{
+ // kdDebug(31000) << "KudesignerView::cut(): CUT called" << endl;
+}
+
+void KudesignerView::copy()
+{
+ // kdDebug(31000) << "KudesignerView::copy(): COPY called" << endl;
+}
+
+void KudesignerView::paste( )
+{}
+
+void KudesignerView::deleteItems( )
+{
+ if ( m_doc->canvas() ->selected.count() > 0 )
+ m_doc->addCommand( new DeleteReportItemsCommand( m_doc->canvas(), m_doc->canvas() ->selected ) );
+}
+
+void KudesignerView::selectAll( )
+{
+ m_doc->canvas() ->selectAll();
+}
+
+void KudesignerView::slotAddReportHeader()
+{
+ if ( !( ( ( KudesignerDoc * ) ( koDocument() ) ) ) ->canvas() ->kugarTemplate() ->reportHeader )
+ {
+ m_doc->addCommand( new AddReportHeaderCommand( m_doc->canvas() ) );
+ }
+}
+
+void KudesignerView::slotAddReportFooter()
+{
+ if ( !( ( ( KudesignerDoc * ) ( koDocument() ) ) ) ->canvas() ->kugarTemplate() ->reportFooter )
+ {
+ m_doc->addCommand( new AddReportFooterCommand( m_doc->canvas() ) );
+ }
+}
+
+void KudesignerView::slotAddPageHeader()
+{
+ if ( !( ( ( KudesignerDoc * ) ( koDocument() ) ) ) ->canvas() ->kugarTemplate() ->pageHeader )
+ {
+ m_doc->addCommand( new AddPageHeaderCommand( m_doc->canvas() ) );
+ }
+}
+
+void KudesignerView::slotAddPageFooter()
+{
+ if ( !( ( ( KudesignerDoc * ) ( koDocument() ) ) ) ->canvas() ->kugarTemplate() ->pageFooter )
+ {
+ m_doc->addCommand( new AddPageFooterCommand( m_doc->canvas() ) );
+ }
+}
+
+void KudesignerView::slotAddDetailHeader()
+{
+ bool Ok = false;
+ unsigned int level = QInputDialog::getInteger( tr( "Add Detail Header" ), tr( "Enter detail level:" ),
+ 0, 0, 100, 1, &Ok, this );
+ if ( !Ok )
+ return ;
+ if ( m_doc->canvas() ->kugarTemplate() ->detailsCount >= level )
+ {
+ m_doc->addCommand( new AddDetailHeaderCommand( level, m_doc->canvas() ) );
+ }
+}
+
+void KudesignerView::slotAddDetail()
+{
+ bool Ok = false;
+ unsigned int level = QInputDialog::getInteger( tr( "Add Detail" ), tr( "Enter detail level:" ),
+ 0, 0, 100, 1, &Ok, this );
+ if ( !Ok )
+ return ;
+ if ( ( ( level == 0 ) && ( m_doc->canvas() ->kugarTemplate() ->detailsCount == 0 ) )
+ || ( m_doc->canvas() ->kugarTemplate() ->detailsCount == level ) )
+ {
+ m_doc->addCommand( new AddDetailCommand( level, m_doc->canvas() ) );
+ }
+}
+
+void KudesignerView::slotAddDetailFooter()
+{
+ bool Ok = false;
+ unsigned int level = QInputDialog::getInteger( tr( "Add Detail Footer" ), tr( "Enter detail level:" ),
+ 0, 0, 100, 1, &Ok, this );
+ if ( !Ok )
+ return ;
+
+ if ( m_doc->canvas() ->kugarTemplate() ->detailsCount >= level )
+ {
+ m_doc->addCommand( new AddDetailFooterCommand( level, m_doc->canvas() ) );
+ }
+}
+
+void KudesignerView::slotAddItemNothing()
+{
+ if ( m_doc->canvas() )
+ {
+ if ( m_view->itemToInsert )
+ {
+ m_view->itemToInsert = 0;
+ }
+ }
+}
+
+void KudesignerView::slotAddItemLabel()
+{
+ if ( m_doc->canvas() )
+ {
+ m_view->itemToInsert = Rtti_Label;
+ }
+}
+
+void KudesignerView::slotAddItemField()
+{
+ if ( m_doc->canvas() )
+ {
+ m_view->itemToInsert = Rtti_Field;
+ }
+}
+
+void KudesignerView::slotAddItemSpecial()
+{
+ if ( m_doc->canvas() )
+ {
+ m_view->itemToInsert = Rtti_Special;
+ }
+}
+
+void KudesignerView::slotAddItemCalculated()
+{
+ if ( m_doc->canvas() )
+ {
+ m_view->itemToInsert = Rtti_Calculated;
+ }
+}
+
+void KudesignerView::slotAddItemLine()
+{
+ if ( m_doc->canvas() )
+ {
+ m_view->itemToInsert = Rtti_Line;
+ }
+}
+
+void KudesignerView::unselectItemAction()
+{
+ /* itemsNothing->setOn(true);*/
+}
+
+void KudesignerView::placeItem( int x, int y, int band, int bandLevel )
+{
+ m_doc->addCommand( new AddReportItemCommand( m_doc->canvas(), m_view, x, y, ( Kudesigner::RttiValues ) band, bandLevel ) );
+}
+
+#include "kudesigner_view.moc"
diff --git a/kugar/kudesigner/kudesigner_view.h b/kugar/kudesigner/kudesigner_view.h
new file mode 100644
index 00000000..e2cd9ed0
--- /dev/null
+++ b/kugar/kudesigner/kudesigner_view.h
@@ -0,0 +1,140 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MEm_viewHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef KUDESIGNER_VIEW_H
+#define KUDESIGNER_VIEW_H
+
+#include <KoView.h>
+#include <kparts/event.h>
+
+#include <qdom.h>
+
+#include <set>
+
+class QLabel;
+class QSpinBox;
+class QAction;
+class QPaintEvent;
+class QDockWindow;
+class QToolBar;
+
+class KAction;
+class KRadioAction;
+class KWidgetAction;
+
+class KudesignerDoc;
+
+
+namespace KoProperty
+{
+class Editor;
+class Buffer;
+}
+using namespace KoProperty;
+
+namespace Kudesigner
+{
+class View;
+class StructureWidget;
+class ReportItem;
+}
+
+class KudesignerView: public KoView
+{
+ Q_OBJECT
+ friend class Kudesigner::View;
+
+public:
+ KudesignerView( KudesignerDoc* part, QWidget* parent = 0, const char* name = 0 );
+ virtual ~KudesignerView();
+
+ Kudesigner::View *view()
+ {
+ return m_view;
+ }
+
+protected slots:
+ void populateProperties( Buffer *buf );
+ void cut();
+ void copy();
+ void paste();
+ void deleteItems();
+ void selectAll();
+ void slotAddItemNothing();
+ void slotAddDetailFooter();
+ void slotAddDetail();
+ void slotAddDetailHeader();
+ void slotAddPageFooter();
+ void slotAddPageHeader();
+ void slotAddReportFooter();
+ void slotAddReportHeader();
+ void slotAddItemLine();
+ void slotAddItemCalculated();
+ void slotAddItemSpecial();
+ void slotAddItemField();
+ void slotAddItemLabel();
+ void unselectItemAction();
+ void placeItem( int x, int y, int band, int bandLevel );
+
+protected:
+ void initActions();
+
+ void paintEvent( QPaintEvent* );
+ virtual void resizeEvent( QResizeEvent* _ev );
+ virtual void updateReadWrite( bool readwrite );
+ virtual void guiActivateEvent( KParts::GUIActivateEvent *ev );
+
+private:
+ Kudesigner::View *m_view;
+ Kudesigner::StructureWidget *m_structure;
+ KoProperty::Editor *m_propertyEditor;
+ KoProperty::Buffer *m_buffer;
+
+ KudesignerDoc *m_doc;
+
+ KAction* sectionsReportHeader;
+ KAction* sectionsReportFooter;
+ KAction* sectionsPageFooter;
+ KAction* sectionsPageHeader;
+ KAction* sectionsDetailHeader;
+ KAction* sectionsDetail;
+ KAction* sectionsDetailFooter;
+
+ KRadioAction* itemsNothing;
+ KRadioAction* itemsLabel;
+ KRadioAction* itemsField;
+ KRadioAction* itemsSpecial;
+ KRadioAction* itemsCalculated;
+ KRadioAction* itemsLine;
+
+ KAction* cutAction;
+ KAction* copyAction;
+ KAction* pasteAction;
+ KAction* selectAllAction;
+ KAction* deleteAction;
+
+ KWidgetAction *gridActionLabel;
+ KWidgetAction *gridAction;
+ QLabel *gridLabel;
+ QSpinBox *gridBox;
+
+ KActionCollection *itemsCollection;
+ KActionCollection *sectionsCollection;
+};
+
+#endif
diff --git a/kugar/kudesigner/kudesignerui.rc b/kugar/kudesigner/kudesignerui.rc
new file mode 100644
index 00000000..5c01758d
--- /dev/null
+++ b/kugar/kudesigner/kudesignerui.rc
@@ -0,0 +1,68 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="kudesigner" version="2">
+<MenuBar>
+ <Menu name="Edit"><text>&amp;Edit</text>
+<!-- <Action name="koffice_undo"/>
+ <Action name="koffice_redo"/>
+ <Separator/>
+ <Action name="edit_cut"/>
+ <Action name="edit_copy"/>
+ <Action name="edit_paste"/>
+ <Separator/>
+ <Action name="edit_select_all"/>
+ <Separator/> -->
+ <Action name="edit_delete"/>
+ </Menu>
+ <Menu name="sections"><text>Sec&amp;tions</text>
+ <Action name="rheader"/>
+ <Action name="pheader"/>
+ <Action name="dheader"/>
+ <Action name="detail"/>
+ <Action name="dfooter"/>
+ <Action name="pfooter"/>
+ <Action name="rfooter"/>
+ </Menu>
+ <Menu name="items"><text>&amp;Items</text>
+ <Action name="nothing"/>
+ <Separator/>
+ <Action name="label"/>
+ <Action name="field"/>
+ <Action name="calcfield"/>
+ <Action name="special"/>
+ <Separator/>
+ <Action name="line"/>
+ </Menu>
+</MenuBar>
+<ToolBar fullWidth="false" name="edit_toolbar" position="top"><Text>Edit</Text>
+<!-- <Action name="koffice_undo"/>
+ <Action name="koffice_redo"/>
+ <Separator/>
+ <Action name="edit_cut"/>
+ <Action name="edit_copy"/>
+ <Action name="edit_paste"/>
+ <Separator/> -->
+ <Action name="edit_delete"/>
+ <Separator/>
+ <Action name="gridlabel"/>
+ <Action name="gridaction"/>
+ </ToolBar>
+<ToolBar name="sectionsToolBar" position="bottom" noMerge="1"><text>Sections</text>
+ <Action name="rheader"/>
+ <Action name="pheader"/>
+ <Action name="dheader"/>
+ <Action name="detail"/>
+ <Action name="dfooter"/>
+ <Action name="pfooter"/>
+ <Action name="rfooter"/>
+</ToolBar>
+<ToolBar name="itemsToolBar" position="left" noMerge="1"><text>Items</text>
+ <Action name="nothing" group="item operations"/>
+ <Separator/>
+ <Action name="label" group="item operations"/>
+ <Action name="field" group="item operations"/>
+ <Action name="calcfield" group="item operations"/>
+ <Action name="special" group="item operations"/>
+ <Separator/>
+ <Action name="line" group="item operations"/>
+</ToolBar>
+</kpartgui>
diff --git a/kugar/kudesigner/main.cpp b/kugar/kudesigner/main.cpp
new file mode 100644
index 00000000..6a8435a2
--- /dev/null
+++ b/kugar/kudesigner/main.cpp
@@ -0,0 +1,46 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include <KoApplication.h>
+#include <KoDocument.h>
+#include <KoMainWindow.h>
+#include <kcmdlineargs.h>
+#include <klocale.h>
+#include <dcopclient.h>
+#include "kudesigner_aboutdata.h"
+
+
+static const KCmdLineOptions options[] =
+ {
+ {"+[file]", I18N_NOOP( "File to open" ), 0
+ },
+ KCmdLineLastOption
+ };
+
+extern "C" KUGARDESIGNER_EXPORT int kdemain( int argc, char **argv )
+{
+ KLocale::setMainCatalogue( "kugar" );
+ KCmdLineArgs::init( argc, argv, newKudesignerAboutData() );
+ KCmdLineArgs::addCmdLineOptions( options );
+ KoApplication app;
+
+ if ( !app.start() ) // parses command line args, create initial docs and shells
+ return 1;
+ return app.exec();
+}
diff --git a/kugar/kudesigner/pics/Makefile.am b/kugar/kudesigner/pics/Makefile.am
new file mode 100644
index 00000000..d4466288
--- /dev/null
+++ b/kugar/kudesigner/pics/Makefile.am
@@ -0,0 +1 @@
+KDE_ICON = kudesigner \ No newline at end of file
diff --git a/kugar/kudesigner/pics/lo16-app-kudesigner.png b/kugar/kudesigner/pics/lo16-app-kudesigner.png
new file mode 100644
index 00000000..b4b302b0
--- /dev/null
+++ b/kugar/kudesigner/pics/lo16-app-kudesigner.png
Binary files differ
diff --git a/kugar/kudesigner/pics/lo32-app-kudesigner.png b/kugar/kudesigner/pics/lo32-app-kudesigner.png
new file mode 100644
index 00000000..3a566751
--- /dev/null
+++ b/kugar/kudesigner/pics/lo32-app-kudesigner.png
Binary files differ
diff --git a/kugar/kudesigner/templates/General/.directory b/kugar/kudesigner/templates/General/.directory
new file mode 100644
index 00000000..15190ef7
--- /dev/null
+++ b/kugar/kudesigner/templates/General/.directory
@@ -0,0 +1,55 @@
+[Desktop Entry]
+Name=General
+Name[af]=Algemeen
+Name[ar]=عام
+Name[bg]=Основен
+Name[br]=Pennañ
+Name[bs]=Općenito
+Name[cy]=Cyffredinol
+Name[da]=Generelt
+Name[de]=Allgemein
+Name[el]=Γενικά
+Name[eo]=Ĝenerala
+Name[et]=Üldine
+Name[fa]=عمومی
+Name[fo]=Alment
+Name[fr]=Général
+Name[fy]=Algemien
+Name[ga]=Ginearálta
+Name[gl]=Xeral
+Name[he]=כללי
+Name[hi]=सामान्य
+Name[hr]=Općenito
+Name[hu]=Általános
+Name[is]=Almennt
+Name[it]=Generale
+Name[ja]=一般
+Name[km]=ទូទៅ
+Name[lo]=ທົ່ວໄປ
+Name[lv]=Pamata
+Name[mt]=Ġenerali
+Name[nb]=Generelt
+Name[nds]=Allgemeen
+Name[ne]=साधारण
+Name[nl]=Algemeen
+Name[pl]=Ogólny
+Name[pt]=Geral
+Name[pt_BR]=Geral
+Name[ru]=Общие
+Name[se]=Oppalaš
+Name[sk]=Všeobecná
+Name[sl]=Splošno
+Name[sr]=Опште
+Name[sr@Latn]=Opšte
+Name[sv]=Allmänt
+Name[ta]= பொதுவான
+Name[tg]=Умумӣ
+Name[th]=ทั่วไป
+Name[tr]=Genel
+Name[uk]=Загальне
+Name[uz]=Umumiy
+Name[uz@cyrillic]=Умумий
+Name[wa]=Djenerå
+Name[xh]=Ngokubanzi
+Name[zh_CN]=常规
+Name[zh_TW]=一般的
diff --git a/kugar/kudesigner/templates/General/A0.desktop b/kugar/kudesigner/templates/General/A0.desktop
new file mode 100644
index 00000000..572cf70f
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A0.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Link
+URL=.source/A0.ktm
+Name=A0
+Name[hi]=ए0
+Name[sr]=А0
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/A0.ktm b/kugar/kudesigner/templates/General/A0.ktm
new file mode 100644
index 00000000..6831e87a
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A0.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="5" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/A1.desktop b/kugar/kudesigner/templates/General/A1.desktop
new file mode 100644
index 00000000..443f487d
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A1.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Link
+URL=.source/A1.ktm
+Name=A1
+Name[hi]=ए1
+Name[sr]=А1
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/A1.ktm b/kugar/kudesigner/templates/General/A1.ktm
new file mode 100644
index 00000000..908b2f03
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A1.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="6" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/A2.desktop b/kugar/kudesigner/templates/General/A2.desktop
new file mode 100644
index 00000000..c94e0aa6
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A2.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Link
+URL=.source/A2.ktm
+Name=A2
+Name[hi]=ए2
+Name[sr]=А2
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/A2.ktm b/kugar/kudesigner/templates/General/A2.ktm
new file mode 100644
index 00000000..4ce84d05
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A2.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="7" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/A3.desktop b/kugar/kudesigner/templates/General/A3.desktop
new file mode 100644
index 00000000..85ccc526
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A3.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Link
+URL=.source/A3.ktm
+Name=A3
+Name[hi]=ए3
+Name[sr]=А3
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/A3.ktm b/kugar/kudesigner/templates/General/A3.ktm
new file mode 100644
index 00000000..725e7ef6
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A3.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="8" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/A4.desktop b/kugar/kudesigner/templates/General/A4.desktop
new file mode 100644
index 00000000..49fe464b
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A4.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Link
+URL=.source/A4.ktm
+Name=A4
+Name[hi]=ए4
+Name[ru]=А4
+Name[sr]=А4
+Name[zu]=u-A4
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/A4.ktm b/kugar/kudesigner/templates/General/A4.ktm
new file mode 100644
index 00000000..17c2ff4e
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A4.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="0" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/A5.desktop b/kugar/kudesigner/templates/General/A5.desktop
new file mode 100644
index 00000000..32bd6df9
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A5.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Type=Link
+URL=.source/A5.ktm
+Name=A5
+Name[sr]=А5
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/A5.ktm b/kugar/kudesigner/templates/General/A5.ktm
new file mode 100644
index 00000000..64b65b52
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A5.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="9" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/A6.desktop b/kugar/kudesigner/templates/General/A6.desktop
new file mode 100644
index 00000000..1771ebfd
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A6.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Link
+URL=.source/A6.ktm
+Name=A6
+Name[hi]=ए6
+Name[sr]=А6
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/A6.ktm b/kugar/kudesigner/templates/General/A6.ktm
new file mode 100644
index 00000000..e69da18e
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A6.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="10" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/A7.desktop b/kugar/kudesigner/templates/General/A7.desktop
new file mode 100644
index 00000000..d39d93f2
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A7.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Link
+URL=.source/A7.ktm
+Name=A7
+Name[hi]=ए7
+Name[sr]=А7
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/A7.ktm b/kugar/kudesigner/templates/General/A7.ktm
new file mode 100644
index 00000000..c62e8489
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A7.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="11" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/A8.desktop b/kugar/kudesigner/templates/General/A8.desktop
new file mode 100644
index 00000000..89a0308f
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A8.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Link
+URL=.source/A8.ktm
+Name=A8
+Name[hi]=ए8
+Name[sr]=А8
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/A8.ktm b/kugar/kudesigner/templates/General/A8.ktm
new file mode 100644
index 00000000..6cbd58d4
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A8.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="12" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/A9.desktop b/kugar/kudesigner/templates/General/A9.desktop
new file mode 100644
index 00000000..7bc343ac
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A9.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Link
+URL=.source/A9.ktm
+Name=A9
+Name[hi]=ए9
+Name[sr]=А9
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/A9.ktm b/kugar/kudesigner/templates/General/A9.ktm
new file mode 100644
index 00000000..f819153f
--- /dev/null
+++ b/kugar/kudesigner/templates/General/A9.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="13" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/B0.desktop b/kugar/kudesigner/templates/General/B0.desktop
new file mode 100644
index 00000000..04899b4c
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B0.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Link
+URL=.source/B0.ktm
+Name=B0
+Name[hi]=बी0
+Name[lo]=ຮອຍເປື້້້້້້້້້້້້ອນ
+Name[sr]=Б0
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/B0.ktm b/kugar/kudesigner/templates/General/B0.ktm
new file mode 100644
index 00000000..93bb7e00
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B0.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="14" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/B1.desktop b/kugar/kudesigner/templates/General/B1.desktop
new file mode 100644
index 00000000..af075cc6
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B1.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Link
+URL=.source/B1.ktm
+Name=B1
+Name[hi]=बी1
+Name[lo]=ຮອຍເປືອນ
+Name[sr]=Б1
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/B1.ktm b/kugar/kudesigner/templates/General/B1.ktm
new file mode 100644
index 00000000..00512408
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B1.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="15" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/B10.desktop b/kugar/kudesigner/templates/General/B10.desktop
new file mode 100644
index 00000000..006b8359
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B10.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Link
+URL=.source/B10.ktm
+Name=B10
+Name[hi]=बी10
+Name[lo]=ຖະຫນົນ
+Name[sr]=Б10
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/B10.ktm b/kugar/kudesigner/templates/General/B10.ktm
new file mode 100644
index 00000000..99070c77
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B10.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="16" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/B2.desktop b/kugar/kudesigner/templates/General/B2.desktop
new file mode 100644
index 00000000..8164d68c
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B2.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Link
+URL=.source/B2.ktm
+Name=B2
+Name[hi]=बी2
+Name[lo]=ຮອຍເປືອນ
+Name[sr]=Б2
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/B2.ktm b/kugar/kudesigner/templates/General/B2.ktm
new file mode 100644
index 00000000..c31af4ce
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B2.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="17" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/B3.desktop b/kugar/kudesigner/templates/General/B3.desktop
new file mode 100644
index 00000000..afedc22d
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B3.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Link
+URL=.source/B3.ktm
+Name=B3
+Name[hi]=बी3
+Name[lo]=ຫນອນຜືງ
+Name[sr]=Б3
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/B3.ktm b/kugar/kudesigner/templates/General/B3.ktm
new file mode 100644
index 00000000..31bf80db
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B3.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="18" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/B4.desktop b/kugar/kudesigner/templates/General/B4.desktop
new file mode 100644
index 00000000..3d99217b
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B4.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Link
+URL=.source/B4.ktm
+Name=B4
+Name[hi]=बी4
+Name[sr]=Б4
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/B4.ktm b/kugar/kudesigner/templates/General/B4.ktm
new file mode 100644
index 00000000..aeac2cfa
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B4.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="19" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/B5.desktop b/kugar/kudesigner/templates/General/B5.desktop
new file mode 100644
index 00000000..bb6d533a
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B5.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Link
+URL=.source/B5.ktm
+Name=B5
+Name[hi]=बी5
+Name[lo]=ຮອຍເປືອນ
+Name[sr]=Б5
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/B5.ktm b/kugar/kudesigner/templates/General/B5.ktm
new file mode 100644
index 00000000..9de7d62b
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B5.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="1" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/B6.desktop b/kugar/kudesigner/templates/General/B6.desktop
new file mode 100644
index 00000000..3c64ab83
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B6.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Link
+URL=.source/B6.ktm
+Name=B6
+Name[hi]=बी6
+Name[lo]=ຮອຍເປືອນ
+Name[sr]=Б6
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/B6.ktm b/kugar/kudesigner/templates/General/B6.ktm
new file mode 100644
index 00000000..48e21a22
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B6.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="20" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/B7.desktop b/kugar/kudesigner/templates/General/B7.desktop
new file mode 100644
index 00000000..03011986
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B7.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Link
+URL=.source/B7.ktm
+Name=B7
+Name[hi]=बी7
+Name[lo]=ຮອຍເປືອນ
+Name[sr]=Б7
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/B7.ktm b/kugar/kudesigner/templates/General/B7.ktm
new file mode 100644
index 00000000..61e59b66
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B7.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="21" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/B8.desktop b/kugar/kudesigner/templates/General/B8.desktop
new file mode 100644
index 00000000..928fafb9
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B8.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Link
+URL=.source/B8.ktm
+Name=B8
+Name[hi]=बी8
+Name[lo]=B8
+Name[sr]=Б8
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/B8.ktm b/kugar/kudesigner/templates/General/B8.ktm
new file mode 100644
index 00000000..b7fb2b57
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B8.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="22" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/B9.desktop b/kugar/kudesigner/templates/General/B9.desktop
new file mode 100644
index 00000000..1d4cd393
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B9.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Link
+URL=.source/B9.ktm
+Name=B9
+Name[hi]=बी9
+Name[lo]=B9
+Name[sr]=Б9
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/B9.ktm b/kugar/kudesigner/templates/General/B9.ktm
new file mode 100644
index 00000000..5c71ef55
--- /dev/null
+++ b/kugar/kudesigner/templates/General/B9.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="23" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/C5E.desktop b/kugar/kudesigner/templates/General/C5E.desktop
new file mode 100644
index 00000000..1201eb65
--- /dev/null
+++ b/kugar/kudesigner/templates/General/C5E.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Link
+URL=.source/C5E.ktm
+Name=C5E
+Name[hi]=सी5ई
+Name[lo]=C5E
+Name[sr]=Ц5Е
+Icon=template_iso
diff --git a/kugar/kudesigner/templates/General/C5E.ktm b/kugar/kudesigner/templates/General/C5E.ktm
new file mode 100644
index 00000000..5d120ec3
--- /dev/null
+++ b/kugar/kudesigner/templates/General/C5E.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="24" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/Comm10E.desktop b/kugar/kudesigner/templates/General/Comm10E.desktop
new file mode 100644
index 00000000..48fa7bef
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Comm10E.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Link
+URL=.source/Comm10E.ktm
+Name=Comm10E
+Name[hi]=कॉम10ई
+Name[lo]=ຖະຫນົນ
+Name[sr]=Comm10Е
+Icon=template_us
diff --git a/kugar/kudesigner/templates/General/Comm10E.ktm b/kugar/kudesigner/templates/General/Comm10E.ktm
new file mode 100644
index 00000000..7a6e512e
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Comm10E.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="25" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/DLE.desktop b/kugar/kudesigner/templates/General/DLE.desktop
new file mode 100644
index 00000000..8a2a0b74
--- /dev/null
+++ b/kugar/kudesigner/templates/General/DLE.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Link
+URL=.source/DLE.ktm
+Name=DLE
+Name[hi]=डीएलई
+Name[lo]=DLE
+Icon=template_us
diff --git a/kugar/kudesigner/templates/General/DLE.ktm b/kugar/kudesigner/templates/General/DLE.ktm
new file mode 100644
index 00000000..66875800
--- /dev/null
+++ b/kugar/kudesigner/templates/General/DLE.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="26" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/Executive.desktop b/kugar/kudesigner/templates/General/Executive.desktop
new file mode 100644
index 00000000..5d6ce348
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Executive.desktop
@@ -0,0 +1,24 @@
+[Desktop Entry]
+Type=Link
+URL=.source/Executive.ktm
+Name=Executive
+Name[ar]=تنفيذي
+Name[ca]=Executiu
+Name[cy]=Gweithredwr
+Name[da]=Udøvende
+Name[eu]=Betearazlea
+Name[fa]=اجرایی
+Name[hi]=एक्जीक्यूटिव
+Name[km]= ប្រតិបត្តិ​
+Name[lo]=ເອົາແຜ່ນອອກ
+Name[ms]=Eksekutif
+Name[nds]=US Executive
+Name[ne]=कार्यकारिणी
+Name[pt_BR]=Executivo
+Name[sk]=Úradnícky
+Name[ta]=நிறைவேற்று
+Name[tg]=Иҷроӣ
+Name[tr]=Yönetici
+Name[xh]=Isekela lomphathi
+Name[zh_CN]=行政
+Icon=template_us
diff --git a/kugar/kudesigner/templates/General/Executive.ktm b/kugar/kudesigner/templates/General/Executive.ktm
new file mode 100644
index 00000000..9fe71873
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Executive.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="4" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/Folio.desktop b/kugar/kudesigner/templates/General/Folio.desktop
new file mode 100644
index 00000000..64a8f65f
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Folio.desktop
@@ -0,0 +1,21 @@
+[Desktop Entry]
+Type=Link
+URL=.source/Folio.ktm
+Name=Folio
+Name[bg]=Фолио
+Name[ca]=Foli
+Name[cy]=Ffolio
+Name[et]=Foolio
+Name[eu]=Folioa
+Name[fa]=دفتر یادداشت
+Name[ga]=Fóilió
+Name[hi]=फोलियो
+Name[hr]=Portfolio
+Name[km]= សន្លឹក​ក្រដាសធំ​បត់ជាពីរ​
+Name[lo]=ສາຍນໍ້າ
+Name[lv]=Kolontituls
+Name[ne]=फोलियो
+Name[sk]=Fólia
+Name[tr]=Folyo
+Name[zh_CN]=对开
+Icon=template_us
diff --git a/kugar/kudesigner/templates/General/Folio.ktm b/kugar/kudesigner/templates/General/Folio.ktm
new file mode 100644
index 00000000..832a1d59
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Folio.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="27" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/Ledger.desktop b/kugar/kudesigner/templates/General/Ledger.desktop
new file mode 100644
index 00000000..2c2dbeab
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Ledger.desktop
@@ -0,0 +1,24 @@
+[Desktop Entry]
+Type=Link
+URL=.source/Ledger.ktm
+Name=Ledger
+Name[br]=Karger
+Name[cy]=Llyfr Cyfrifon
+Name[da]=Hovedbog
+Name[fa]=دفتر کل
+Name[ga]=Mórleabhar
+Name[hi]=लेजर
+Name[hr]=Knjiga salda
+Name[km]=បញ្ជី​កត់​ចេញ​ចូល
+Name[lo]=Ledger
+Name[lv]=Virsgrāmata
+Name[ms]=Lejar
+Name[ne]=लेजर
+Name[pt_BR]=Carta
+Name[sk]=Kniha
+Name[tg]=Гроссбух
+Name[tr]=Ana Defter
+Name[xh]=Incwadi ye akhawunti
+Name[zh_CN]=帐册
+Name[zh_TW]=分類帳
+Icon=template_us
diff --git a/kugar/kudesigner/templates/General/Ledger.ktm b/kugar/kudesigner/templates/General/Ledger.ktm
new file mode 100644
index 00000000..db605f13
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Ledger.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="28" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/Legal.desktop b/kugar/kudesigner/templates/General/Legal.desktop
new file mode 100644
index 00000000..41f49f56
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Legal.desktop
@@ -0,0 +1,26 @@
+[Desktop Entry]
+Type=Link
+URL=.source/Legal.ktm
+Name=Legal
+Name[af]=Wettig
+Name[az]=Qanuni
+Name[bg]=Юридически формат (Legal)
+Name[br]=Lisans
+Name[cy]=Cyfreithiol
+Name[eu]=Legala
+Name[fa]=مجاز
+Name[fo]=US Legal (216×356 mm, amerikansk pappírsstødd)
+Name[ga]=Dlí
+Name[hi]=लीगल
+Name[hr]=Pravno
+Name[it]=US legal
+Name[nds]=US Legal
+Name[ne]=कानूनी
+Name[pl]=Wzorce
+Name[sr]=Легал
+Name[tr]=Yasal
+Name[ven]=Zwa milayo
+Name[wa]=Legal US
+Name[xh]=Esemthethweni
+Name[zu]=Okusemthethweni
+Icon=template_us
diff --git a/kugar/kudesigner/templates/General/Legal.ktm b/kugar/kudesigner/templates/General/Legal.ktm
new file mode 100644
index 00000000..85953bb8
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Legal.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="3" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/Letter.desktop b/kugar/kudesigner/templates/General/Letter.desktop
new file mode 100644
index 00000000..04da6d49
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Letter.desktop
@@ -0,0 +1,33 @@
+[Desktop Entry]
+Type=Link
+URL=.source/Letter.ktm
+Name=US Letter
+Name[af]=Us Brief
+Name[az]=Zərf
+Name[bg]=Американско писмо
+Name[br]=Lizher US
+Name[ca]=Carta US
+Name[cy]=Llythyr US
+Name[es]=Carta de EEUU
+Name[eu]=AEBetako gutuna
+Name[fa]=حروف آمریکایی
+Name[fo]=US Letter (216×279 mm, amerikansk pappírsstødd)
+Name[ga]=Litir Mheiriceánach (US Letter)
+Name[gl]=Carta dos EUA
+Name[hi]=यूएस पत्र
+Name[hr]=US pismo
+Name[id]=Letter AS
+Name[km]=សំបុត្រ​អាមេរិក
+Name[lv]=ASV Vēstule
+Name[ne]=US अक्षर
+Name[pt]=Carta dos EUA
+Name[pt_BR]=Carta US
+Name[sk]=List
+Name[ta]=US எழுத்து
+Name[tg]=Мактуби US
+Name[tr]=Zarf
+Name[ven]=Vhurifhi ha Amerika
+Name[xh]=Ileta ye-US
+Name[zh_CN]=美式信函
+Name[zu]=Incwadi ye US
+Icon=template_us
diff --git a/kugar/kudesigner/templates/General/Letter.ktm b/kugar/kudesigner/templates/General/Letter.ktm
new file mode 100644
index 00000000..d6838210
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Letter.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="2" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/Makefile.am b/kugar/kudesigner/templates/General/Makefile.am
new file mode 100644
index 00000000..984321e5
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Makefile.am
@@ -0,0 +1,15 @@
+templates_DATA = .directory A0.desktop A5.desktop B0.desktop B4.desktop B9.desktop Folio.desktop Tabloid.desktop \
+A1.desktop A6.desktop B1.desktop B5.desktop C5E.desktop Ledger.desktop \
+A2.desktop A7.desktop B10.desktop B6.desktop Comm10E.desktop Legal.desktop \
+A3.desktop A8.desktop B2.desktop B7.desktop DLE.desktop Letter.desktop \
+A4.desktop A9.desktop B3.desktop B8.desktop Executive.desktop NPageSize.desktop
+templatesdir = $(kde_datadir)/kudesigner/templates/General
+
+templatesrc_DATA = A0.ktm A4.ktm A8.ktm B10.ktm B5.ktm B9.ktm Executive.ktm Letter.ktm \
+A1.ktm A5.ktm A9.ktm B2.ktm B6.ktm C5E.ktm Folio.ktm \
+A2.ktm A6.ktm B0.ktm B3.ktm B7.ktm Comm10E.ktm Ledger.ktm Tabloid.ktm \
+A3.ktm A7.ktm B1.ktm B4.ktm B8.ktm DLE.ktm Legal.ktm
+templatesrcdir = $(kde_datadir)/kudesigner/templates/General/.source
+
+templateicons_ICON = AUTO
+templateiconsdir = $(kde_datadir)/kudesigner/icons
diff --git a/kugar/kudesigner/templates/General/NPageSize.desktop b/kugar/kudesigner/templates/General/NPageSize.desktop
new file mode 100644
index 00000000..e1e3e173
--- /dev/null
+++ b/kugar/kudesigner/templates/General/NPageSize.desktop
@@ -0,0 +1,2 @@
+[Desktop Entry]
+Hidden=true
diff --git a/kugar/kudesigner/templates/General/Tabloid.desktop b/kugar/kudesigner/templates/General/Tabloid.desktop
new file mode 100644
index 00000000..2403bc86
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Tabloid.desktop
@@ -0,0 +1,28 @@
+[Desktop Entry]
+Type=Link
+URL=.source/Tabloid.ktm
+Name=Tabloid
+Name[ar]=صحيفة نصفيّة
+Name[bg]=Таблоид
+Name[ca]=Tabloide
+Name[da]=Infospalte
+Name[eu]=Tabloidea
+Name[fa]=چکیده
+Name[fi]=Tabloidi
+Name[fr]=Tabloïd
+Name[ga]=Tablóid
+Name[gl]=Tablóide
+Name[hi]=टेब्लॉइड
+Name[km]=ការសែត​ទំហំ​សន្លឹកតូច​តែងលំអ​ដោយ​រូបភាព​ច្រើន​
+Name[lo]=ລາຍໄມ້
+Name[lv]=Tabloīds
+Name[nds]=US Tabloid
+Name[ne]=ट्याबलोइड
+Name[pt]=Tablóide
+Name[pt_BR]=Tablóide
+Name[sk]=Noviny
+Name[wa]=Tabloyide
+Name[xh]=Iphepha ndaba lobuxoki
+Name[zh_CN]=小报
+Name[zh_TW]=文摘
+Icon=template_us
diff --git a/kugar/kudesigner/templates/General/Tabloid.ktm b/kugar/kudesigner/templates/General/Tabloid.ktm
new file mode 100644
index 00000000..5bccc107
--- /dev/null
+++ b/kugar/kudesigner/templates/General/Tabloid.ktm
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageSize="29" PageOrientation="0" TopMargin="20"
+ BottomMargin="20" LeftMargin="20" RightMargin="20">
+
+</KugarTemplate>
+ \ No newline at end of file
diff --git a/kugar/kudesigner/templates/General/cr48-action-template_iso.png b/kugar/kudesigner/templates/General/cr48-action-template_iso.png
new file mode 100644
index 00000000..6da59f12
--- /dev/null
+++ b/kugar/kudesigner/templates/General/cr48-action-template_iso.png
Binary files differ
diff --git a/kugar/kudesigner/templates/General/cr48-action-template_us.png b/kugar/kudesigner/templates/General/cr48-action-template_us.png
new file mode 100644
index 00000000..ab392628
--- /dev/null
+++ b/kugar/kudesigner/templates/General/cr48-action-template_us.png
Binary files differ
diff --git a/kugar/kudesigner/templates/General/crsc-action-template_iso.svgz b/kugar/kudesigner/templates/General/crsc-action-template_iso.svgz
new file mode 100644
index 00000000..728e0b9c
--- /dev/null
+++ b/kugar/kudesigner/templates/General/crsc-action-template_iso.svgz
Binary files differ
diff --git a/kugar/kudesigner/templates/General/crsc-action-template_us.svgz b/kugar/kudesigner/templates/General/crsc-action-template_us.svgz
new file mode 100644
index 00000000..5aab2fdf
--- /dev/null
+++ b/kugar/kudesigner/templates/General/crsc-action-template_us.svgz
Binary files differ
diff --git a/kugar/kudesigner/templates/Makefile.am b/kugar/kudesigner/templates/Makefile.am
new file mode 100644
index 00000000..ced250c7
--- /dev/null
+++ b/kugar/kudesigner/templates/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = General
diff --git a/kugar/kudesigner/toolbar/Makefile.am b/kugar/kudesigner/toolbar/Makefile.am
new file mode 100644
index 00000000..a75bd30b
--- /dev/null
+++ b/kugar/kudesigner/toolbar/Makefile.am
@@ -0,0 +1,2 @@
+kudesignericondir = $(kde_datadir)/kudesigner/icons
+kudesignericon_ICON = AUTO
diff --git a/kugar/kudesigner/toolbar/cr22-action-frame_field.png b/kugar/kudesigner/toolbar/cr22-action-frame_field.png
new file mode 100644
index 00000000..cf298d77
--- /dev/null
+++ b/kugar/kudesigner/toolbar/cr22-action-frame_field.png
Binary files differ
diff --git a/kugar/kudesigner/toolbar/cr22-action-id.png b/kugar/kudesigner/toolbar/cr22-action-id.png
new file mode 100644
index 00000000..897ed023
--- /dev/null
+++ b/kugar/kudesigner/toolbar/cr22-action-id.png
Binary files differ
diff --git a/kugar/kudesigner/toolbar/cr22-action-idf.png b/kugar/kudesigner/toolbar/cr22-action-idf.png
new file mode 100644
index 00000000..301de61d
--- /dev/null
+++ b/kugar/kudesigner/toolbar/cr22-action-idf.png
Binary files differ
diff --git a/kugar/kudesigner/toolbar/cr22-action-idh.png b/kugar/kudesigner/toolbar/cr22-action-idh.png
new file mode 100644
index 00000000..dbbc71a8
--- /dev/null
+++ b/kugar/kudesigner/toolbar/cr22-action-idh.png
Binary files differ
diff --git a/kugar/kudesigner/toolbar/cr22-action-ipf.png b/kugar/kudesigner/toolbar/cr22-action-ipf.png
new file mode 100644
index 00000000..549a5450
--- /dev/null
+++ b/kugar/kudesigner/toolbar/cr22-action-ipf.png
Binary files differ
diff --git a/kugar/kudesigner/toolbar/cr22-action-iph.png b/kugar/kudesigner/toolbar/cr22-action-iph.png
new file mode 100644
index 00000000..b3e395fb
--- /dev/null
+++ b/kugar/kudesigner/toolbar/cr22-action-iph.png
Binary files differ
diff --git a/kugar/kudesigner/toolbar/cr22-action-irf.png b/kugar/kudesigner/toolbar/cr22-action-irf.png
new file mode 100644
index 00000000..5a14a544
--- /dev/null
+++ b/kugar/kudesigner/toolbar/cr22-action-irf.png
Binary files differ
diff --git a/kugar/kudesigner/toolbar/cr22-action-irh.png b/kugar/kudesigner/toolbar/cr22-action-irh.png
new file mode 100644
index 00000000..416368ac
--- /dev/null
+++ b/kugar/kudesigner/toolbar/cr22-action-irh.png
Binary files differ
diff --git a/kugar/kudesigner_lib/Makefile.am b/kugar/kudesigner_lib/Makefile.am
new file mode 100644
index 00000000..95b8fe00
--- /dev/null
+++ b/kugar/kudesigner_lib/Makefile.am
@@ -0,0 +1,17 @@
+INCLUDES = $(KOPROPERTY_INCLUDES) $(KOFFICE_INCLUDES) $(all_includes)
+
+# Temporary hack, to work around the KColorCombo bug with --enable-final
+KDE_OPTIONS = nofinal
+
+noinst_LTLIBRARIES = libkudesignercommon.la
+libkudesignercommon_la_LDFLAGS = $(all_libraries)
+libkudesignercommon_la_METASOURCES = AUTO
+libkudesignercommon_la_SOURCES = band.cpp box.cpp calcfield.cpp canvas.cpp \
+ command.cpp commdefs.cpp detailbase.cpp detail.cpp detailfooter.cpp \
+ detailheader.cpp field.cpp kugartemplate.cpp label.cpp line.cpp pagefooter.cpp \
+ pageheader.cpp propertyserializer.cpp reportfooter.cpp reportheader.cpp reportitem.cpp \
+ section.cpp specialfield.cpp structurewidget.cpp view.cpp plugin.cpp
+libkudesignercommon_la_LIBADD = $(LIB_KOPROPERTY)
+
+KDE_CXXFLAGS = $(USE_EXCEPTIONS) -DKPROPERTY_EXPORT=
+
diff --git a/kugar/kudesigner_lib/band.cpp b/kugar/kudesigner_lib/band.cpp
new file mode 100644
index 00000000..0b3225f6
--- /dev/null
+++ b/kugar/kudesigner_lib/band.cpp
@@ -0,0 +1,127 @@
+/* This file is part of the KDE project
+Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with this library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "band.h"
+
+#include <qcanvas.h>
+#include <qrect.h>
+#include <qpainter.h>
+
+#include <kglobalsettings.h>
+
+#include "propertyserializer.h"
+#include "kugartemplate.h"
+#include "canvas.h"
+#include "reportitem.h"
+
+namespace Kudesigner
+{
+
+Band::~Band()
+{
+ for ( QCanvasItemList::Iterator it = items.begin(); it != items.end(); ++it )
+ {
+ // (*it)->hide();
+ m_canvas->selected.remove( static_cast<Box*>( *it ) );
+ ( *it ) ->setSelected( false );
+ delete ( *it );
+ }
+ items.clear();
+}
+
+void Band::draw( QPainter &painter )
+{
+ setX( m_canvas->kugarTemplate() ->props[ "LeftMargin" ].value().toInt() );
+ setSize( m_canvas->kugarTemplate() ->width()
+ - m_canvas->kugarTemplate() ->props[ "RightMargin" ].value().toInt()
+ - m_canvas->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ props[ "Height" ].value().toInt() );
+ Section::draw( painter );
+}
+
+//arrange band and all sublings (items)
+void Band::arrange( int base, bool destructive )
+{
+ int diff = base - ( int ) y();
+ setY( base );
+ if ( !destructive )
+ return ;
+ for ( QCanvasItemList::Iterator it = items.begin(); it != items.end(); ++it )
+ {
+ ( *it ) ->moveBy( 0, diff );
+ // ( (CanvasReportItem *)(*it) )->updateGeomProps();
+ m_canvas->update();
+ ( *it ) ->hide();
+ ( *it ) ->show();
+ }
+}
+
+int Band::minHeight()
+{
+ int result = static_cast<int>( y() + 10 );
+ for ( QCanvasItemList::Iterator it = items.begin(); it != items.end(); ++it )
+ {
+ result = QMAX( result, static_cast<int>( static_cast<QCanvasRectangle*>( *it ) ->y() +
+ static_cast<QCanvasRectangle*>( *it ) ->height() ) );
+ }
+ return result - static_cast<int>( y() );
+}
+
+QString Band::getXml()
+{
+ QString result = "";
+
+ for ( Set::Iterator it( props ); it.current(); ++it )
+ {
+ result += " " + QString(it.currentKey()) + "=" + "\"" + PropertySerializer::toString( it.current() ) + "\"";
+ }
+
+ result += ">\n";
+ for ( QCanvasItemList::Iterator it = items.begin(); it != items.end(); ++it )
+ {
+ result += static_cast<ReportItem*>( *it ) ->getXml();
+ }
+ return result;
+}
+
+int Band::isInHolder( const QPoint p )
+{
+ if ( bottomMiddleResizableRect().contains( p ) )
+ return ( ResizeBottom );
+ return ResizeNothing;
+}
+
+void Band::drawHolders( QPainter &painter )
+{
+ painter.setPen( QColor( 0, 0, 0 ) );
+ painter.setBrush( KGlobalSettings::highlightColor() );
+ painter.drawRect( bottomMiddleResizableRect() );
+}
+
+QRect Band::bottomMiddleResizableRect()
+{
+ return QRect( ( int ) ( x() + width() / 2 - HolderSize / 2. ), ( int ) ( y() + height() - HolderSize ), HolderSize, HolderSize );
+}
+
+void Band::updateGeomProps()
+{
+ props[ "Height" ].setValue( height() );
+ m_canvas->kugarTemplate() ->arrangeSections();
+}
+
+}
diff --git a/kugar/kudesigner_lib/band.h b/kugar/kudesigner_lib/band.h
new file mode 100644
index 00000000..6e93bb50
--- /dev/null
+++ b/kugar/kudesigner_lib/band.h
@@ -0,0 +1,62 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef BAND_H
+#define BAND_H
+
+#include "commdefs.h"
+#include "section.h"
+
+class QCanvasItemList;
+class QPainter;
+class QRect;
+class QPoint;
+
+namespace Kudesigner
+{
+
+class Band: public Section
+{
+public:
+ Band( int x, int y, int width, int height, Canvas *canvas ) :
+ Section( x, y, width, height, canvas )
+ {
+ setZ( 10 );
+ }
+ ~Band();
+
+ virtual int rtti() const
+ {
+ return Rtti_Band;
+ }
+ virtual void draw( QPainter &painter );
+ virtual QString getXml();
+ virtual int isInHolder( const QPoint );
+ virtual void drawHolders( QPainter & );
+
+ int minHeight();
+ QRect bottomMiddleResizableRect();
+ void arrange( int base, bool destructive = TRUE );
+ virtual void updateGeomProps();
+
+ QCanvasItemList items;
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/box.cpp b/kugar/kudesigner_lib/box.cpp
new file mode 100644
index 00000000..f80f9a5f
--- /dev/null
+++ b/kugar/kudesigner_lib/box.cpp
@@ -0,0 +1,43 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include <qcanvas.h>
+
+#include "box.h"
+#include "canvas.h"
+
+namespace Kudesigner
+{
+
+Box::~Box()
+{}
+
+void Box::registerAs( int /* type*/ )
+{}
+
+void Box::scale( int scale )
+{
+ setSize( width() * scale, height() * scale );
+}
+
+void Box::draw( QPainter &painter )
+{
+ QCanvasRectangle::draw( painter );
+}
+
+}
diff --git a/kugar/kudesigner_lib/box.h b/kugar/kudesigner_lib/box.h
new file mode 100644
index 00000000..38df93dd
--- /dev/null
+++ b/kugar/kudesigner_lib/box.h
@@ -0,0 +1,80 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef BOX_H
+#define BOX_H
+
+#include <koproperty/set.h>
+#include <koproperty/property.h>
+
+#include "commdefs.h"
+
+using namespace KoProperty;
+
+namespace Kudesigner
+{
+
+class Canvas;
+
+class Box: public QCanvasRectangle
+{
+public:
+ enum ResizeType {ResizeNothing = 0, ResizeLeft = 1, ResizeTop = 2, ResizeRight = 4, ResizeBottom = 8};
+
+ Box( int x, int y, int width, int height, Canvas *canvas ) :
+ QCanvasRectangle( x, y, width, height, ( QCanvas* ) canvas ), m_canvas( canvas )
+ {
+ setSelected( false );
+ }
+ virtual ~Box();
+
+ virtual int rtti() const
+ {
+ return Rtti_Box;
+ }
+ virtual void draw( QPainter &painter );
+ virtual QString getXml()
+ {
+ return "";
+ }
+
+ void scale( int scale );
+
+ virtual int isInHolder( const QPoint )
+ {
+ return ResizeNothing;
+ }
+ virtual void drawHolders( QPainter & )
+ {}
+
+ virtual void updateGeomProps()
+ {
+ ;
+ }
+
+ Set props;
+
+protected:
+ void registerAs( int type );
+
+ Canvas *m_canvas;
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/calcfield.cpp b/kugar/kudesigner_lib/calcfield.cpp
new file mode 100644
index 00000000..bccf7d96
--- /dev/null
+++ b/kugar/kudesigner_lib/calcfield.cpp
@@ -0,0 +1,56 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "calcfield.h"
+
+#include <klocale.h>
+
+#include <qmap.h>
+
+#include <koproperty/property.h>
+
+namespace Kudesigner
+{
+
+CalculatedField::CalculatedField( int x, int y, int width, int height, Canvas *canvas ) :
+ Field( x, y, width, height, canvas, false )
+{
+ QMap<QString, QString> m;
+
+ props.setGroupDescription( "Calculation", i18n( "Calculation" ) );
+ m[ i18n( "Count" ) ] = "0";
+ m[ i18n( "Sum" ) ] = "1";
+ m[ i18n( "Average" ) ] = "2";
+ m[ i18n( "Variance" ) ] = "3";
+ m[ i18n( "StandardDeviation" ) ] = "4";
+ props.addProperty( new Property( "CalculationType", m.values(), m.keys(), "1", i18n( "Type" ), i18n( "Calculation Type" ) ), "Calculation" );
+
+ registerAs( Rtti_Calculated );
+}
+
+void CalculatedField::draw( QPainter &painter )
+{
+ Field::draw( painter );
+}
+
+QString CalculatedField::getXml()
+{
+ return "\t\t<CalculatedField" + ReportItem::getXml() + " />\n";
+}
+
+}
diff --git a/kugar/kudesigner_lib/calcfield.h b/kugar/kudesigner_lib/calcfield.h
new file mode 100644
index 00000000..326e9ba4
--- /dev/null
+++ b/kugar/kudesigner_lib/calcfield.h
@@ -0,0 +1,46 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef CALCFIELD_H
+#define CALCFIELD_H
+
+#include "field.h"
+
+namespace Kudesigner
+{
+
+class CalculatedField: public Field
+{
+public:
+ CalculatedField( int x, int y, int width, int height, Canvas *canvas );
+
+ virtual int rtti() const
+ {
+ return Rtti_Calculated;
+ }
+ virtual QString getXml();
+ virtual void draw( QPainter &painter );
+ virtual void updateGeomProps()
+ {
+ Field::updateGeomProps();
+ }
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/canvas.cpp b/kugar/kudesigner_lib/canvas.cpp
new file mode 100644
index 00000000..e4cfb30f
--- /dev/null
+++ b/kugar/kudesigner_lib/canvas.cpp
@@ -0,0 +1,386 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "canvas.h"
+
+#include <qdom.h>
+#include <qstringlist.h>
+
+#include <koproperty/property.h>
+
+#include "box.h"
+#include "kugartemplate.h"
+
+#include "reportheader.h"
+#include "reportfooter.h"
+#include "pageheader.h"
+#include "pagefooter.h"
+#include "detailheader.h"
+#include "detailfooter.h"
+#include "detail.h"
+
+#include "reportitem.h"
+#include "calcfield.h"
+#include "field.h"
+#include "label.h"
+#include "line.h"
+#include "specialfield.h"
+
+#include "propertyserializer.h"
+
+#include <kdebug.h>
+
+namespace Kudesigner
+{
+
+Canvas::Canvas( int w, int h /*, Canvas *doc*/ )
+ : QCanvas( w, h ), m_plugin( 0 ), m_kugarTemplate( 0 ) //, m_doc(doc)
+{
+}
+
+Canvas::~Canvas()
+{
+ delete m_kugarTemplate;
+}
+
+void Canvas::scaleCanvas( int scale )
+{
+ resize( width() * scale, height() * scale );
+
+ //scale all child items if they are textbox's
+ /* QCanvasItemList l=this->allItems();
+ for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it)
+ {
+ if ((*it)->rtti() == Rtti_TextBox)
+ {
+ CanvasTextBox* b = (CanvasTextBox*)(*it);
+ b->scale(scale);
+ }
+ }*/
+}
+
+void Canvas::drawForeground ( QPainter & painter, const QRect & /*clip*/ )
+{
+ //kdDebug()<<"Canvas::drawForeGround"<<endl;
+ // qWarning("drawForeground ");
+ for ( BoxList::iterator it = selected.begin(); it != selected.end(); ++it )
+ {
+ // qWarning("sel:");
+ ( *it ) ->drawHolders( painter );
+ }
+}
+
+KuDesignerPlugin * Canvas::plugin( )
+{
+ return m_plugin;
+}
+
+void Canvas::setPlugin( KuDesignerPlugin * plugin )
+{
+ m_plugin = plugin;
+}
+
+void Canvas::unselectAll()
+{
+ for ( BoxList::iterator it = selected.begin(); it != selected.end(); ++it )
+ {
+ Box *b = *it;
+ b->setSelected( false );
+ setChanged( b->rect() );
+ }
+
+ selected.clear();
+ update();
+}
+
+void Canvas::selectAll()
+{
+ for ( QCanvasItemList::Iterator it = allItems().begin(); it != allItems().end(); ++it )
+ {
+ if ( ( ( *it ) ->rtti() > 2001 ) && ( ( *it ) ->isVisible() ) )
+ selectItem( static_cast<Box*>( *it ) );
+ }
+}
+
+void Canvas::selectItem( Box *it, bool addToSelection )
+{
+ if ( !it->isVisible() )
+ return ;
+ if ( !addToSelection )
+ unselectAll();
+ selected.append( it );
+ it->setSelected( true );
+
+ emit itemSelected();
+ /* if (!selectionStarted)
+ finishSelection();*/
+}
+
+void Canvas::unselectItem( Box *it )
+{
+ selected.remove( it );
+ it->setSelected( false );
+}
+
+KugarTemplate *Canvas::kugarTemplate()
+{
+ return m_kugarTemplate;
+}
+
+void Canvas::setKugarTemplate( KugarTemplate *kugarTemplate )
+{
+ m_kugarTemplate = kugarTemplate;
+}
+
+bool Canvas::loadXML( const QDomNode &report )
+{
+ QDomNamedNodeMap attributes = report.attributes();
+
+ //creating KugarTemplate object
+ KugarTemplate *templ = new KugarTemplate( 0, 0, width(), height(), this );
+ templ->show();
+ templ->props[ "PageSize" ].setValue( attributes.namedItem( "PageSize" ).nodeValue() );
+ templ->props[ "PageOrientation" ].setValue( attributes.namedItem( "PageOrientation" ).nodeValue() );
+ templ->props[ "TopMargin" ].setValue( attributes.namedItem( "TopMargin" ).nodeValue().toInt() );
+ templ->props[ "BottomMargin" ].setValue( attributes.namedItem( "BottomMargin" ).nodeValue().toInt() );
+ templ->props[ "LeftMargin" ].setValue( attributes.namedItem( "LeftMargin" ).nodeValue().toInt() );
+ templ->props[ "RightMargin" ].setValue( attributes.namedItem( "RightMargin" ).nodeValue().toInt() );
+
+ // Get all the child report elements
+ QDomNodeList children = report.childNodes();
+ int childCount = children.length();
+ for ( int j = 0; j < childCount; j++ )
+ {
+ QDomNode child = children.item( j );
+
+ if ( child.nodeType() == QDomNode::ElementNode )
+ {
+ if ( child.nodeName() == "ReportHeader" )
+ setReportHeaderAttributes( &child );
+ else if ( child.nodeName() == "PageHeader" )
+ setPageHeaderAttributes( &child );
+ else if ( child.nodeName() == "DetailHeader" )
+ setDetailHeaderAttributes( &child );
+ else if ( child.nodeName() == "Detail" )
+ {
+ templ->detailsCount++;
+ setDetailAttributes( &child );
+ }
+ else if ( child.nodeName() == "DetailFooter" )
+ setDetailFooterAttributes( &child );
+ else if ( child.nodeName() == "PageFooter" )
+ setPageFooterAttributes( &child );
+ else if ( child.nodeName() == "ReportFooter" )
+ setReportFooterAttributes( &child );
+ }
+ }
+ templ->arrangeSections( FALSE );
+ QCanvasItemList l = allItems();
+ for ( QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it )
+ {
+ ( *it ) ->show();
+ }
+ update();
+
+ return true;
+}
+
+void Canvas::setReportHeaderAttributes( QDomNode *node )
+{
+ QDomNamedNodeMap attributes = node->attributes();
+
+ ReportHeader *rh = new ReportHeader( kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 0, kugarTemplate() ->width() - kugarTemplate() ->props[ "RightMargin" ].value().toInt() -
+ kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ attributes.namedItem( "Height" ).nodeValue().toInt(), this );
+ rh->props[ "Height" ].setValue( attributes.namedItem( "Height" ).nodeValue().toInt() );
+ kugarTemplate() ->reportHeader = rh;
+ addReportItems( node, rh );
+}
+
+void Canvas::setReportFooterAttributes( QDomNode *node )
+{
+ QDomNamedNodeMap attributes = node->attributes();
+
+ ReportFooter *rf = new ReportFooter( kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 0, kugarTemplate() ->width() - kugarTemplate() ->props[ "RightMargin" ].value().toInt() -
+ kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ attributes.namedItem( "Height" ).nodeValue().toInt(), this );
+ rf->props[ "Height" ].setValue( attributes.namedItem( "Height" ).nodeValue().toInt() );
+ kugarTemplate() ->reportFooter = rf;
+ addReportItems( node, rf );
+}
+
+void Canvas::setPageHeaderAttributes( QDomNode *node )
+{
+ QDomNamedNodeMap attributes = node->attributes();
+
+ PageHeader *ph = new PageHeader( kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 0, kugarTemplate() ->width() - kugarTemplate() ->props[ "RightMargin" ].value().toInt() -
+ kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ attributes.namedItem( "Height" ).nodeValue().toInt(), this );
+ ph->props[ "Height" ].setValue( attributes.namedItem( "Height" ).nodeValue().toInt() );
+ kugarTemplate() ->pageHeader = ph;
+ addReportItems( node, ph );
+}
+
+void Canvas::setPageFooterAttributes( QDomNode *node )
+{
+ QDomNamedNodeMap attributes = node->attributes();
+
+ PageFooter *pf = new PageFooter( kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 0, kugarTemplate() ->width() - kugarTemplate() ->props[ "RightMargin" ].value().toInt() -
+ kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ attributes.namedItem( "Height" ).nodeValue().toInt(), this );
+ pf->props[ "Height" ].setValue( attributes.namedItem( "Height" ).nodeValue().toInt() );
+ kugarTemplate() ->pageFooter = pf;
+ addReportItems( node, pf );
+}
+
+void Canvas::setDetailHeaderAttributes( QDomNode *node )
+{
+ QDomNamedNodeMap attributes = node->attributes();
+
+ DetailHeader *dh = new DetailHeader( kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 0, kugarTemplate() ->width() - kugarTemplate() ->props[ "RightMargin" ].value().toInt() -
+ kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ attributes.namedItem( "Height" ).nodeValue().toInt(),
+ attributes.namedItem( "Level" ).nodeValue().toInt(), this );
+ dh->props[ "Level" ].setValue( attributes.namedItem( "Level" ).nodeValue().toInt() );
+ dh->props[ "Height" ].setValue( attributes.namedItem( "Height" ).nodeValue().toInt() );
+ kugarTemplate() ->details[ attributes.namedItem( "Level" ).nodeValue().toInt() ].first.first = dh;
+ addReportItems( node, dh );
+}
+
+void Canvas::setDetailAttributes( QDomNode *node )
+{
+ QDomNamedNodeMap attributes = node->attributes();
+
+ Detail *d = new Detail( kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 0, kugarTemplate() ->width() - kugarTemplate() ->props[ "RightMargin" ].value().toInt() -
+ kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ attributes.namedItem( "Height" ).nodeValue().toInt(),
+ attributes.namedItem( "Level" ).nodeValue().toInt(), this );
+ d->props[ "Level" ].setValue( attributes.namedItem( "Level" ).nodeValue().toInt() );
+ d->props[ "Height" ].setValue( attributes.namedItem( "Height" ).nodeValue().toInt() );
+ d->props[ "Repeat" ].setValue( QVariant( attributes.namedItem( "Repeat" ).nodeValue() == "true", 3 ) );
+ kugarTemplate() ->details[ attributes.namedItem( "Level" ).nodeValue().toInt() ].second = d;
+ addReportItems( node, d );
+}
+
+void Canvas::setDetailFooterAttributes( QDomNode *node )
+{
+ QDomNamedNodeMap attributes = node->attributes();
+
+ DetailFooter *df = new DetailFooter( kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 0, kugarTemplate() ->width() - kugarTemplate() ->props[ "RightMargin" ].value().toInt() -
+ kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ attributes.namedItem( "Height" ).nodeValue().toInt(),
+ attributes.namedItem( "Level" ).nodeValue().toInt(), this );
+ df->props[ "Level" ].setValue( attributes.namedItem( "Level" ).nodeValue().toInt() );
+ df->props[ "Height" ].setValue( attributes.namedItem( "Height" ).nodeValue().toInt() );
+ kugarTemplate() ->details[ attributes.namedItem( "Level" ).nodeValue().toInt() ].first.second = df;
+ addReportItems( node, df );
+}
+
+
+void Canvas::addReportItems( QDomNode *node, Band *section )
+{
+ QDomNodeList children = node->childNodes();
+ int childCount = children.length();
+
+ for ( int j = 0; j < childCount; j++ )
+ {
+ QDomNode child = children.item( j );
+ if ( child.nodeType() == QDomNode::ElementNode )
+ {
+ if ( child.nodeName() == "Line" )
+ {
+ Line * line = new Line( 0, 0, 50, 20, this );
+ section->items.append( line );
+
+ setReportItemAttributes( &child, line );
+ line->setSectionUndestructive( section );
+ //line->show();
+ }
+ else if ( child.nodeName() == "Label" )
+ {
+ Label * label = new Label( 0, 0, 50, 20, this );
+ section->items.append( label );
+ setReportItemAttributes( &child, label );
+ label->setSectionUndestructive( section );
+ //label->show();
+ }
+ else if ( child.nodeName() == "Special" )
+ {
+ SpecialField * special = new SpecialField( 0, 0, 50, 20, this );
+ section->items.append( special );
+ setReportItemAttributes( &child, special );
+ special->setSectionUndestructive( section );
+ //special->show();
+ }
+ else if ( child.nodeName() == "Field" )
+ {
+ Field * field = new Field( 0, 0, 50, 20, this );
+ section->items.append( field );
+ setReportItemAttributes( &child, field );
+ field->setSectionUndestructive( section );
+ //field->show();
+ }
+ else if ( child.nodeName() == "CalculatedField" )
+ {
+ CalculatedField * calcField = new CalculatedField( 0, 0, 50, 20, this );
+ section->items.append( calcField );
+ setReportItemAttributes( &child, calcField );
+ calcField->setSectionUndestructive( section );
+ //calcField->show();
+ }
+ }
+ }
+}
+
+void Canvas::setReportItemAttributes( QDomNode *node, ReportItem *item )
+{
+ QDomNamedNodeMap attributes = node->attributes();
+
+ for ( unsigned int i = 0; i < attributes.count(); i++ )
+ {
+ QString propertyName = attributes.item( i ).nodeName();
+ QString propertyValue = attributes.item( i ).nodeValue();
+
+ item->props[ propertyName.utf8() ].setValue(
+ PropertySerializer::fromString( &item->props[ propertyName.utf8() ], propertyValue ) );
+ }
+}
+
+void Canvas::changed()
+{
+ for ( Kudesigner::BoxList::iterator it = selected.begin();
+ it != selected.end(); ++it )
+ {
+ Kudesigner::Box *b = *it;
+ b->hide();
+ b->show();
+ if ( ( b->rtti() >= 1800 ) && ( b->rtti() < 2000 ) )
+ kugarTemplate() ->arrangeSections();
+ }
+}
+
+}
+
+#include "canvas.moc"
diff --git a/kugar/kudesigner_lib/canvas.h b/kugar/kudesigner_lib/canvas.h
new file mode 100644
index 00000000..fda6aa7d
--- /dev/null
+++ b/kugar/kudesigner_lib/canvas.h
@@ -0,0 +1,96 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef MYCANVAS_H
+#define MYCANVAS_H
+
+#include <qcanvas.h>
+#include <qvaluelist.h>
+
+#include "box.h"
+
+class QDomNode;
+class QIODevice;
+class KuDesignerPlugin;
+
+namespace Kudesigner
+{
+
+class KugarTemplate;
+class Band;
+class ReportItem;
+
+typedef QValueList<Box*> BoxList;
+
+class Canvas: public QCanvas
+{
+ Q_OBJECT
+public:
+ Canvas( int w, int h );
+ ~Canvas();
+
+ KugarTemplate *kugarTemplate();
+ void setKugarTemplate( KugarTemplate *kugarTemplate );
+
+ // KudesignerDoc *document(){return m_doc;}
+
+ BoxList selected;
+
+ KuDesignerPlugin *plugin();
+ void setPlugin( KuDesignerPlugin *plugin );
+
+ void unselectAll();
+ void selectAll();
+ void selectItem( Box *it, bool addToSelection = true );
+ void unselectItem( Box *it );
+ void setStructureModified() { emit structureModified(); }
+ // void deleteSelected();
+
+ virtual bool loadXML( const QDomNode &report );
+
+public slots:
+ void changed();
+
+signals:
+ void itemSelected();
+ void structureModified();
+
+protected:
+ virtual void drawForeground( QPainter &painter, const QRect &clip );
+
+ void setReportItemAttributes( QDomNode *node, ReportItem *item );
+ void addReportItems( QDomNode *node, Band *section );
+ void setReportHeaderAttributes( QDomNode *node );
+ void setReportFooterAttributes( QDomNode *node );
+ void setPageHeaderAttributes( QDomNode *node );
+ void setPageFooterAttributes( QDomNode *node );
+ void setDetailHeaderAttributes( QDomNode *node );
+ void setDetailAttributes( QDomNode *node );
+ void setDetailFooterAttributes( QDomNode *node );
+
+private:
+ // KudesignerDoc *m_doc;
+ void scaleCanvas( int scale );
+ KuDesignerPlugin *m_plugin;
+ KugarTemplate *m_kugarTemplate;
+
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/command.cpp b/kugar/kudesigner_lib/command.cpp
new file mode 100644
index 00000000..1644868a
--- /dev/null
+++ b/kugar/kudesigner_lib/command.cpp
@@ -0,0 +1,301 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "command.h"
+
+#include <klocale.h>
+#include <kdebug.h>
+
+//#include "kudesigner_doc.h"
+
+#include <koproperty/editor.h>
+#include <koproperty/property.h>
+
+#include "view.h"
+#include "canvas.h"
+
+#include "field.h"
+#include "calcfield.h"
+#include "label.h"
+#include "line.h"
+#include "specialfield.h"
+
+#include "kugartemplate.h"
+#include "reportheader.h"
+#include "reportfooter.h"
+#include "pageheader.h"
+#include "pagefooter.h"
+#include "detailheader.h"
+#include "detailfooter.h"
+#include "detail.h"
+
+
+namespace Kudesigner
+{
+
+//AddDetailFooterCommand
+
+AddDetailFooterCommand::AddDetailFooterCommand( int level, Canvas *doc )
+ : KNamedCommand( QObject::tr( "Insert Detail Footer Section" ) ), m_level( level ), m_doc( doc )
+{}
+
+void AddDetailFooterCommand::execute()
+{
+ m_section = new DetailFooter( m_doc->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 0, m_doc->kugarTemplate() ->width() - m_doc->kugarTemplate() ->props[ "RightMargin" ].value().toInt() -
+ m_doc->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 50, m_level, m_doc );
+ m_section->props[ "Level" ].setValue( m_level );
+ m_doc->kugarTemplate() ->details[ m_level ].first.second = m_section;
+ m_doc->kugarTemplate() ->arrangeSections();
+ m_doc->setStructureModified();
+}
+
+void AddDetailFooterCommand::unexecute()
+{
+ m_doc->kugarTemplate() ->removeReportItem( m_section );
+ m_doc->setStructureModified();
+}
+
+//AddDetailCommand
+
+AddDetailCommand::AddDetailCommand( int level, Canvas *doc )
+ : KNamedCommand( QObject::tr( "Insert Detail Section" ) ), m_level( level ), m_doc( doc )
+{}
+
+void AddDetailCommand::execute()
+{
+ m_section = new Detail( m_doc->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 0, m_doc->kugarTemplate() ->width() - m_doc->kugarTemplate() ->props[ "RightMargin" ].value().toInt() -
+ m_doc->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 50, m_level, m_doc );
+ m_section->props[ "Level" ].setValue( m_level );
+ m_doc->kugarTemplate() ->details[ m_level ].second = m_section;
+ m_doc->kugarTemplate() ->arrangeSections();
+ m_doc->kugarTemplate() ->detailsCount++;
+ m_doc->setStructureModified();
+}
+
+void AddDetailCommand::unexecute()
+{
+ m_doc->kugarTemplate() ->removeReportItem( m_section );
+ m_doc->setStructureModified();
+}
+
+//AddDetailHeaderCommand
+AddDetailHeaderCommand::AddDetailHeaderCommand( int level, Canvas *doc )
+ : KNamedCommand( QObject::tr( "Insert Detail Header Section" ) ), m_level( level ), m_doc( doc )
+{}
+
+void AddDetailHeaderCommand::execute()
+{
+ m_section = new DetailHeader( m_doc->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 0, m_doc->kugarTemplate() ->width() - m_doc->kugarTemplate() ->props[ "RightMargin" ].value().toInt() -
+ m_doc->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 50, m_level, m_doc );
+ m_section->props[ "Level" ].setValue( m_level );
+ m_doc->kugarTemplate() ->details[ m_level ].first.first = m_section;
+ m_doc->kugarTemplate() ->arrangeSections();
+ m_doc->setStructureModified();
+}
+
+void AddDetailHeaderCommand::unexecute()
+{
+ m_doc->kugarTemplate() ->removeReportItem( m_section );
+ m_doc->setStructureModified();
+}
+
+//AddPageFooterCommand
+
+AddPageFooterCommand::AddPageFooterCommand( Canvas *doc )
+ : KNamedCommand( QObject::tr( "Insert Page Footer Section" ) ), m_doc( doc )
+{}
+
+void AddPageFooterCommand::execute()
+{
+ m_section = new PageFooter( m_doc->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 0, m_doc->kugarTemplate() ->width() - m_doc->kugarTemplate() ->props[ "RightMargin" ].value().toInt() -
+ m_doc->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 50, m_doc );
+ m_doc->kugarTemplate() ->pageFooter = m_section;
+ m_doc->kugarTemplate() ->arrangeSections();
+ m_doc->setStructureModified();
+}
+
+void AddPageFooterCommand::unexecute()
+{
+ m_doc->kugarTemplate() ->removeReportItem( m_section );
+ m_doc->setStructureModified();
+}
+
+//AddPageHeaderCommand
+
+AddPageHeaderCommand::AddPageHeaderCommand( Canvas *doc )
+ : KNamedCommand( QObject::tr( "Insert Page Header Section" ) ), m_doc( doc )
+{}
+
+void AddPageHeaderCommand::execute()
+{
+ m_section = new PageHeader( m_doc->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 0, m_doc->kugarTemplate() ->width() - m_doc->kugarTemplate() ->props[ "RightMargin" ].value().toInt() -
+ m_doc->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 50, m_doc );
+ m_doc->kugarTemplate() ->pageHeader = m_section;
+ m_doc->kugarTemplate() ->arrangeSections();
+ m_doc->setStructureModified();
+}
+
+void AddPageHeaderCommand::unexecute()
+{
+ m_doc->kugarTemplate() ->removeReportItem( m_section );
+ m_doc->setStructureModified();
+}
+
+//AddReportFooterCommand
+
+AddReportFooterCommand::AddReportFooterCommand( Canvas *doc )
+ : KNamedCommand( QObject::tr( "Insert Report Footer Section" ) ), m_doc( doc )
+{}
+
+void AddReportFooterCommand::execute()
+{
+ m_section = new ReportFooter( m_doc->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 0, m_doc->kugarTemplate() ->width() - m_doc->kugarTemplate() ->props[ "RightMargin" ].value().toInt() -
+ m_doc->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 50, m_doc );
+ m_doc->kugarTemplate() ->reportFooter = m_section;
+ m_doc->kugarTemplate() ->arrangeSections();
+ m_doc->setStructureModified();
+}
+
+void AddReportFooterCommand::unexecute()
+{
+ m_doc->kugarTemplate() ->removeReportItem( m_section );
+ m_doc->setStructureModified();
+}
+
+//AddReportHeaderCommand
+
+AddReportHeaderCommand::AddReportHeaderCommand( Canvas *doc )
+ : KNamedCommand( QObject::tr( "Insert Report Header Section" ) ), m_doc( doc )
+{}
+
+void AddReportHeaderCommand::execute()
+{
+ m_section = new ReportHeader( m_doc->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 0, m_doc->kugarTemplate() ->width() - m_doc->kugarTemplate() ->props[ "RightMargin" ].value().toInt() -
+ m_doc->kugarTemplate() ->props[ "LeftMargin" ].value().toInt(),
+ 50, m_doc );
+ m_doc->kugarTemplate() ->reportHeader = m_section;
+ m_doc->kugarTemplate() ->arrangeSections();
+ m_doc->setStructureModified();
+}
+
+void AddReportHeaderCommand::unexecute()
+{
+ m_doc->kugarTemplate() ->removeReportItem( m_section );
+ m_doc->setStructureModified();
+}
+
+//AddReportItemCommand
+
+AddReportItemCommand::AddReportItemCommand( Canvas *doc, View *rc, int x, int y, RttiValues section, int sectionLevel ) :
+ KNamedCommand( QObject::tr( "Insert Report Item" ) ), m_doc( doc ), m_rc( rc ), m_x( x ), m_y( y ), m_section( section ), m_sectionLevel( sectionLevel )
+{
+ m_rtti = m_rc->itemToInsert;
+ setName( "Insert " + Kudesigner::rttiName( m_rc->itemToInsert ) );
+}
+
+void AddReportItemCommand::execute()
+{
+ // kdDebug() << "Execute: rtti = " << m_rtti << endl;
+ switch ( m_rtti )
+ {
+ case Rtti_Label:
+ m_item = new Label( 0, 0, DefaultItemWidth, DefaultItemHeight, m_doc );
+ break;
+ case Rtti_Field:
+ m_item = new Field( 0, 0, DefaultItemWidth, DefaultItemHeight, m_doc );
+ break;
+ case Rtti_Special:
+ m_item = new SpecialField( 0, 0, DefaultItemWidth, DefaultItemHeight, m_doc );
+ break;
+ case Rtti_Calculated:
+ m_item = new CalculatedField( 0, 0, DefaultItemWidth, DefaultItemHeight, m_doc );
+ break;
+ case Rtti_Line:
+ m_item = new Line( 0, 0, DefaultItemWidth, DefaultItemHeight, m_doc );
+ break;
+ default:
+ m_item = 0;
+ return ;
+ }
+
+ m_item->setX( m_x );
+ m_item->setY( m_y );
+ // kdDebug() << "Execute: item created" << endl;
+ m_item->setSection( m_doc->kugarTemplate() ->band( m_section, m_sectionLevel ) );
+ m_item->updateGeomProps();
+
+ m_doc->selectItem( m_item, false );
+
+ m_item->show();
+ m_doc->kugarTemplate() ->band( m_section, m_sectionLevel ) ->items.append( m_item );
+ m_doc->setStructureModified();
+}
+
+void AddReportItemCommand::unexecute()
+{
+ if ( m_item )
+ {
+ m_doc->unselectItem( m_item );
+ m_doc->kugarTemplate() ->removeReportItem( m_item );
+ m_doc->setStructureModified();
+ }
+}
+
+DeleteReportItemsCommand::DeleteReportItemsCommand( Canvas * doc, QValueList< Box* > & items )
+ : KNamedCommand( QObject::tr( "Delete Report Item(s)" ) ), m_doc( doc ), m_items( items )
+{}
+
+void DeleteReportItemsCommand::execute( )
+{
+ m_doc->unselectAll();
+
+ for ( QValueList< Box* >::iterator it = m_items.begin(); it != m_items.end(); ++it )
+ {
+ Box *b = *it;
+ m_doc->kugarTemplate() ->removeReportItem( b );
+ }
+
+ m_doc->setStructureModified();
+}
+
+void DeleteReportItemsCommand::unexecute( )
+{
+ /* Box *b;
+ for (b = m_items.first(); b; b = m_items.next())
+ {
+ b->show();*/
+ // m_doc->kugarTemplate()->removeReportItem( b );
+ // }
+
+ m_doc->setStructureModified();
+}
+
+}
diff --git a/kugar/kudesigner_lib/command.h b/kugar/kudesigner_lib/command.h
new file mode 100644
index 00000000..6c040a85
--- /dev/null
+++ b/kugar/kudesigner_lib/command.h
@@ -0,0 +1,183 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef COMMAND_H
+#define COMMAND_H
+
+#include <kcommand.h>
+#include "commdefs.h"
+
+/* void slotAddDetailFooter();
+ void slotAddDetail();
+ void slotAddDetailHeader();
+ void slotAddPageFooter();
+ void slotAddPageHeader();
+ void slotAddReportFooter();
+ void slotAddReportHeader();
+ void slotAddItemLine();
+ void slotAddItemCalculated();
+ void slotAddItemSpecial();
+ void slotAddItemField();
+ void slotAddItemLabel();*/
+
+//class KudesignerDoc;
+
+namespace Kudesigner
+{
+
+class DetailFooter;
+class Detail;
+class DetailHeader;
+class PageFooter;
+class PageHeader;
+class ReportFooter;
+class ReportHeader;
+class Band;
+class ReportItem;
+class View;
+class Canvas;
+class Box;
+
+class AddDetailFooterCommand: public KNamedCommand
+{
+public:
+ AddDetailFooterCommand( int level, Canvas *doc );
+
+ virtual void execute();
+ virtual void unexecute();
+
+private:
+ int m_level;
+ Canvas *m_doc;
+ DetailFooter *m_section;
+};
+
+class AddDetailCommand: public KNamedCommand
+{
+public:
+ AddDetailCommand( int level, Canvas *doc );
+
+ virtual void execute();
+ virtual void unexecute();
+
+private:
+ int m_level;
+ Canvas *m_doc;
+ Detail *m_section;
+};
+
+class AddDetailHeaderCommand: public KNamedCommand
+{
+public:
+ AddDetailHeaderCommand( int level, Canvas *doc );
+
+ virtual void execute();
+ virtual void unexecute();
+
+private:
+ int m_level;
+ Canvas *m_doc;
+ DetailHeader *m_section;
+};
+
+class AddPageFooterCommand: public KNamedCommand
+{
+public:
+ AddPageFooterCommand( Canvas *doc );
+
+ virtual void execute();
+ virtual void unexecute();
+
+private:
+ Canvas *m_doc;
+ PageFooter *m_section;
+};
+
+class AddPageHeaderCommand: public KNamedCommand
+{
+public:
+ AddPageHeaderCommand( Canvas *doc );
+
+ virtual void execute();
+ virtual void unexecute();
+
+private:
+ Canvas *m_doc;
+ PageHeader *m_section;
+};
+
+class AddReportFooterCommand: public KNamedCommand
+{
+public:
+ AddReportFooterCommand( Canvas *doc );
+
+ virtual void execute();
+ virtual void unexecute();
+
+private:
+ Canvas *m_doc;
+ ReportFooter *m_section;
+};
+
+class AddReportHeaderCommand: public KNamedCommand
+{
+public:
+ AddReportHeaderCommand( Canvas *doc );
+
+ virtual void execute();
+ virtual void unexecute();
+
+private:
+ Canvas *m_doc;
+ ReportHeader *m_section;
+};
+
+class AddReportItemCommand: public KNamedCommand
+{
+public:
+ AddReportItemCommand( Canvas *doc, View *rc, int x, int y, RttiValues section, int sectionLevel = -1 );
+
+ virtual void execute();
+ virtual void unexecute();
+
+private:
+ int m_rtti;
+ Canvas *m_doc;
+ View *m_rc;
+ int m_x;
+ int m_y;
+ ReportItem *m_item;
+ RttiValues m_section;
+ int m_sectionLevel;
+};
+
+class DeleteReportItemsCommand: public KNamedCommand
+{
+public:
+ DeleteReportItemsCommand( Canvas *doc, QValueList<Box*>& items );
+ virtual void execute();
+ virtual void unexecute();
+
+private:
+ Canvas *m_doc;
+ QValueList<Box*> m_items;
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/commdefs.cpp b/kugar/kudesigner_lib/commdefs.cpp
new file mode 100644
index 00000000..44a40bf9
--- /dev/null
+++ b/kugar/kudesigner_lib/commdefs.cpp
@@ -0,0 +1,71 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include <klocale.h>
+
+#include <qsettings.h>
+
+#include "commdefs.h"
+
+namespace Kudesigner
+{
+
+QString rttiName( int rtti )
+{
+ switch ( rtti )
+ {
+ case Rtti_Label:
+ return i18n( "Label" );
+ case Rtti_Field:
+ return i18n( "Field" );
+ case Rtti_Special:
+ return i18n( "Special" );
+ case Rtti_Calculated:
+ return i18n( "Calculated Field" );
+ case Rtti_Line:
+ return i18n( "Line" );
+ case Rtti_ReportItem:
+ default:
+ return i18n( "Report Item" );
+ }
+}
+
+int Config::m_holderSize = 6;
+int Config::m_gridSize = 10;
+
+void Config::setGridSize( int gridSize )
+{
+ QSettings settings;
+ settings.writeEntry( "/kudesigner/gridSize", gridSize );
+ m_gridSize = gridSize;
+}
+
+int Config::gridSize()
+{
+ static bool confRead = false;
+ if ( !confRead )
+ {
+ QSettings settings;
+ m_gridSize = settings.readNumEntry( "/kudesigner/gridSize", 10 );
+ confRead = true;
+ }
+ return m_gridSize;
+}
+
+}
diff --git a/kugar/kudesigner_lib/commdefs.h b/kugar/kudesigner_lib/commdefs.h
new file mode 100644
index 00000000..1143043d
--- /dev/null
+++ b/kugar/kudesigner_lib/commdefs.h
@@ -0,0 +1,79 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef COMMDEFS_H
+#define COMMDEFS_H
+
+#include <qapplication.h>
+#include <qcanvas.h>
+#include <qstringlist.h>
+
+namespace Kudesigner
+{
+
+enum RttiValues {
+ Rtti_Box = 1700,
+ Rtti_Section = 1701,
+ Rtti_Band = 1702,
+ Rtti_KugarTemplate = 1800,
+ Rtti_ReportHeader = 1801,
+ Rtti_PageHeader = 1802,
+ Rtti_DetailHeader = 1803,
+ Rtti_Detail = 1804,
+ Rtti_DetailFooter = 1805,
+ Rtti_PageFooter = 1806,
+ Rtti_ReportFooter = 1807,
+ Rtti_TextBox = 2000,
+ Rtti_ReportItem = 2001,
+ Rtti_Label = 2002,
+ Rtti_Field = 2003,
+ Rtti_Special = 2004,
+ Rtti_Calculated = 2005,
+ Rtti_Line = 2006
+};
+
+QString rttiName( int rtti );
+
+class Config
+{
+public:
+ static int holderSize()
+ {
+ return m_holderSize;
+ }
+ static void setHolderSize( int holderSize )
+ {
+ m_holderSize = holderSize;
+ }
+ static int gridSize();
+ static void setGridSize( int gridSize );
+
+private:
+ static int m_holderSize;
+ static int m_gridSize;
+};
+
+}
+
+//Holder size for report items. TODO: configurable
+const int HolderSize = 6;
+
+const int DefaultItemWidth = 50;
+const int DefaultItemHeight = 20;
+
+#endif
diff --git a/kugar/kudesigner_lib/detail.cpp b/kugar/kudesigner_lib/detail.cpp
new file mode 100644
index 00000000..9dbf4b62
--- /dev/null
+++ b/kugar/kudesigner_lib/detail.cpp
@@ -0,0 +1,52 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "detail.h"
+
+#include <klocale.h>
+
+#include <qpainter.h>
+
+#include <koproperty/property.h>
+
+namespace Kudesigner
+{
+
+Detail::Detail( int x, int y, int width, int height, int level, Canvas *canvas )
+ : DetailBase( x, y, width, height, level, canvas )
+{
+ props.addProperty( new Property( "Height", 50, i18n( "Height" ), i18n( "Height" ), KoProperty::Integer ), "Detail" );
+ props.addProperty( new Property( "Level", 0, i18n( "Level" ), i18n( "Detail Level" ), KoProperty::Integer ), "Detail" );
+ props.addProperty( new Property( "Repeat", QVariant( false, 3 ), i18n( "Repeat" ), i18n( "Repeat After Page Break" ), KoProperty::Boolean ), "Detail" );
+
+ registerAs( Rtti_Detail );
+}
+
+void Detail::draw( QPainter &painter )
+{
+ QString str = QString( "%1 %2" ).arg( i18n( "Detail" ) ).arg( props[ "Level" ].value().toInt() );
+ painter.drawText( rect(), AlignVCenter | AlignLeft, str );
+ Band::draw( painter );
+}
+
+QString Detail::getXml()
+{
+ return "\t<Detail" + Band::getXml() + "\t</Detail>\n\n";
+}
+
+}
diff --git a/kugar/kudesigner_lib/detail.h b/kugar/kudesigner_lib/detail.h
new file mode 100644
index 00000000..6837578c
--- /dev/null
+++ b/kugar/kudesigner_lib/detail.h
@@ -0,0 +1,43 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef DETAIL_H
+#define DETAIL_H
+
+#include "commdefs.h"
+#include "detailbase.h"
+
+namespace Kudesigner
+{
+
+class Detail: public DetailBase
+{
+public:
+ Detail( int x, int y, int width, int height, int level, Canvas *canvas );
+
+ virtual int rtti() const
+ {
+ return Rtti_Detail;
+ }
+ virtual void draw( QPainter &painter );
+ virtual QString getXml();
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/detailbase.cpp b/kugar/kudesigner_lib/detailbase.cpp
new file mode 100644
index 00000000..e338baa1
--- /dev/null
+++ b/kugar/kudesigner_lib/detailbase.cpp
@@ -0,0 +1,45 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "detailbase.h"
+
+#include "klocale.h"
+
+namespace Kudesigner
+{
+
+DetailBase::DetailBase( int x, int y, int width, int height, int level, Canvas *canvas )
+ : Band( x, y, width, height, canvas ), m_level( level )
+{
+ props.setGroupDescription( "Detail", i18n( "Detail" ) );
+}
+
+DetailBase::~DetailBase()
+{}
+
+int DetailBase::level() const
+{
+ return m_level;
+}
+
+void DetailBase::setLevel( const int level )
+{
+ m_level = level;
+}
+
+}
diff --git a/kugar/kudesigner_lib/detailbase.h b/kugar/kudesigner_lib/detailbase.h
new file mode 100644
index 00000000..6cd208da
--- /dev/null
+++ b/kugar/kudesigner_lib/detailbase.h
@@ -0,0 +1,44 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef DETAILBASE_H
+#define DETAILBASE_H
+
+#include "band.h"
+
+namespace Kudesigner
+{
+
+class DetailBase: public Band
+{
+public:
+ virtual ~DetailBase();
+
+ virtual int level() const;
+ virtual void setLevel( const int level );
+
+protected:
+ DetailBase( int x, int y, int width, int height, int level, Canvas* canvas );
+
+private:
+ int m_level;
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/detailfooter.cpp b/kugar/kudesigner_lib/detailfooter.cpp
new file mode 100644
index 00000000..0b9b041c
--- /dev/null
+++ b/kugar/kudesigner_lib/detailfooter.cpp
@@ -0,0 +1,49 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "detailfooter.h"
+
+#include <klocale.h>
+
+#include <qpainter.h>
+
+#include <koproperty/property.h>
+
+namespace Kudesigner
+{
+
+DetailFooter::DetailFooter( int x, int y, int width, int height, int level, Canvas *canvas ) :
+ DetailBase( x, y, width, height, level, canvas )
+{
+ props.addProperty( new Property( "Height", 50, i18n( "Height" ), i18n( "Height" ), KoProperty::Integer ), "Detail" );
+ props.addProperty( new Property( "Level", 0, i18n( "Level" ), i18n( "Detail Level" ), KoProperty::Integer ), "Detail" );
+}
+
+void DetailFooter::draw( QPainter &painter )
+{
+ QString str = QString( "%1 %2" ).arg( i18n( "Detail Footer" ) ).arg( props[ "Level" ].value().toInt() );
+ painter.drawText( rect(), AlignVCenter | AlignLeft, str );
+ Band::draw( painter );
+}
+
+QString DetailFooter::getXml()
+{
+ return "\t<DetailFooter" + Band::getXml() + "\t</DetailFooter>\n\n";
+}
+
+}
diff --git a/kugar/kudesigner_lib/detailfooter.h b/kugar/kudesigner_lib/detailfooter.h
new file mode 100644
index 00000000..b7815105
--- /dev/null
+++ b/kugar/kudesigner_lib/detailfooter.h
@@ -0,0 +1,43 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef DETAILFOOTER_H
+#define DETAILFOOTER_H
+
+#include "commdefs.h"
+#include "detailbase.h"
+
+namespace Kudesigner
+{
+
+class DetailFooter: public DetailBase
+{
+public:
+ DetailFooter( int x, int y, int width, int height, int level, Canvas *canvas );
+
+ virtual int rtti() const
+ {
+ return Rtti_DetailFooter;
+ }
+ virtual void draw( QPainter &painter );
+ virtual QString getXml();
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/detailheader.cpp b/kugar/kudesigner_lib/detailheader.cpp
new file mode 100644
index 00000000..89fdb42e
--- /dev/null
+++ b/kugar/kudesigner_lib/detailheader.cpp
@@ -0,0 +1,49 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "detailheader.h"
+
+#include <klocale.h>
+
+#include <qpainter.h>
+
+#include <koproperty/property.h>
+
+namespace Kudesigner
+{
+
+DetailHeader::DetailHeader( int x, int y, int width, int height, int level, Canvas *canvas )
+ : DetailBase( x, y, width, height, level, canvas )
+{
+ props.addProperty( new Property( "Height", 50, i18n( "Height" ), i18n( "Height" ), KoProperty::Integer ), "Detail" );
+ props.addProperty( new Property( "Level", 0, i18n( "Level" ), i18n( "Detail Level" ), KoProperty::Integer ), "Detail" );
+}
+
+void DetailHeader::draw( QPainter &painter )
+{
+ QString str = QString( "%1 %2" ).arg( i18n( "Detail Header" ) ).arg( props[ "Level" ].value().toInt() );
+ painter.drawText( rect(), AlignVCenter | AlignLeft, str );
+ Band::draw( painter );
+}
+
+QString DetailHeader::getXml()
+{
+ return "\t<DetailHeader" + Band::getXml() + "\t</DetailHeader>\n\n";
+}
+
+}
diff --git a/kugar/kudesigner_lib/detailheader.h b/kugar/kudesigner_lib/detailheader.h
new file mode 100644
index 00000000..f08152d5
--- /dev/null
+++ b/kugar/kudesigner_lib/detailheader.h
@@ -0,0 +1,43 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef DETAILHEADER_H
+#define DETAILHEADER_H
+
+#include "commdefs.h"
+#include "detailbase.h"
+
+namespace Kudesigner
+{
+
+class DetailHeader: public DetailBase
+{
+public:
+ DetailHeader( int x, int y, int width, int height, int level, Canvas *canvas );
+
+ virtual int rtti() const
+ {
+ return Rtti_DetailHeader;
+ }
+ virtual void draw( QPainter &painter );
+ virtual QString getXml();
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/field.cpp b/kugar/kudesigner_lib/field.cpp
new file mode 100644
index 00000000..c029f8e4
--- /dev/null
+++ b/kugar/kudesigner_lib/field.cpp
@@ -0,0 +1,104 @@
+/* This file is part of the KDE project
+Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with this library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "field.h"
+
+#include <klocale.h>
+#include <klineeditdlg.h>
+
+#include <kdebug.h>
+
+#include <koproperty/property.h>
+
+namespace Kudesigner
+{
+
+Field::Field( int x, int y, int width, int height, Canvas *canvas, bool reg )
+ : Label( x, y, width, height, canvas )
+{
+ QMap<QString, QString> m;
+
+ props.setGroupDescription( "Field", i18n( "Field" ) );
+
+ props.addProperty( new Property( "Field", "", i18n( "Name" ), i18n( "Field Name" ), KoProperty::String ), "Field" );
+
+ m[ i18n( "String" ) ] = "0";
+ m[ i18n( "Integer" ) ] = "1";
+ m[ i18n( "Float" ) ] = "2";
+ m[ i18n( "Date" ) ] = "3";
+ m[ i18n( "Currency" ) ] = "4";
+ props.addProperty( new Property( "DataType", m.values(), m.keys(), "0", i18n( "Type" ), i18n( "Data Type" ), KoProperty::String ), "Field" );
+ m.clear();
+
+ m[ i18n( "m/d/y" ) ] = "0";
+ m[ i18n( "m-d-y" ) ] = "1";
+ m[ i18n( "mm/dd/y" ) ] = "2";
+ m[ i18n( "mm-dd-y" ) ] = "3";
+ m[ i18n( "m/d/yyyy" ) ] = "4";
+ m[ i18n( "m-d-yyyy" ) ] = "5";
+ m[ i18n( "mm/dd/yyyy" ) ] = "6";
+ m[ i18n( "mm-dd-yyyy" ) ] = "7";
+ m[ i18n( "yyyy/m/d" ) ] = "8";
+ m[ i18n( "yyyy-m-d" ) ] = "9";
+ m[ i18n( "dd.mm.yy" ) ] = "10";
+ m[ i18n( "dd.mm.yyyy" ) ] = "11";
+
+ //TODO: make date format not hard-coded, use locale settings
+ props.addProperty( new Property( "DateFormat", m.values(), m.keys(), "11", i18n( "Date Format" ), i18n( "Date Format" ), KoProperty::String ), "Field" );
+ m.clear();
+
+ props.addProperty( new Property( "Precision", 2, i18n( "Precision" ), i18n( "Number of Digits After Comma" ), KoProperty::Integer ), "Field" );
+
+ //TODO: make currency locale-aware
+ props.addProperty( new Property( "Currency", 32, i18n( "Currency" ), i18n( "Currency Symbol" ), KoProperty::Symbol ), "Field" );
+
+ props.addProperty( new Property( "NegValueColor", QColor( 0, 0, 0 ), i18n( "Negative Value Color" ), i18n( "Negative Value Color" ), KoProperty::Color ), "Field" );
+
+ props.addProperty( new Property( "CommaSeparator", 44, i18n( "Comma Separator" ), i18n( "Comma Separator" ), KoProperty::Symbol ), "Field" );
+
+ props.addProperty( new Property( "InputMask", "", i18n( "InputMask" ), i18n( "InputMask" ), KoProperty::String ), "Field" );
+
+ if ( reg )
+ registerAs( Rtti_Field );
+}
+
+void Field::draw( QPainter &painter )
+{
+ props[ "Text" ].setValue( "[" + props[ "Field" ].value().toString() + "]" );
+ Label::draw( painter );
+ props[ "Text" ].setValue( "" );
+}
+
+QString Field::getXml()
+{
+ return "\t\t<Field" + ReportItem::getXml() + " />\n";
+}
+
+void Field::fastProperty()
+{
+ bool accepted;
+ QString sValue = props[ "Field" ].value().toString();
+ QString sText = KLineEditDlg::getText( i18n( "Change Field" ),
+ "Enter field name:", sValue , &accepted );
+
+ if ( accepted )
+ props[ "Field" ].setValue( sText );
+
+}
+
+}
diff --git a/kugar/kudesigner_lib/field.h b/kugar/kudesigner_lib/field.h
new file mode 100644
index 00000000..43f0d73f
--- /dev/null
+++ b/kugar/kudesigner_lib/field.h
@@ -0,0 +1,47 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef FIELD_H
+#define FIELD_H
+
+#include "label.h"
+
+namespace Kudesigner
+{
+
+class Field: public Label
+{
+public:
+ Field( int x, int y, int width, int height, Canvas *canvas, bool reg = true );
+
+ virtual int rtti() const
+ {
+ return Rtti_Field;
+ }
+ virtual QString getXml();
+ virtual void draw( QPainter &painter );
+ virtual void updateGeomProps()
+ {
+ Label::updateGeomProps();
+ }
+ virtual void fastProperty();
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/kugartemplate.cpp b/kugar/kudesigner_lib/kugartemplate.cpp
new file mode 100644
index 00000000..500bc419
--- /dev/null
+++ b/kugar/kudesigner_lib/kugartemplate.cpp
@@ -0,0 +1,411 @@
+/* This file is part of the KDE project
+Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with this library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "kugartemplate.h"
+
+#include <klocale.h>
+
+#include <qcanvas.h>
+#include <qpainter.h>
+#include <qprinter.h>
+#include <qpaintdevicemetrics.h>
+
+#include <koproperty/property.h>
+
+#include "propertyserializer.h"
+
+#include "canvas.h"
+#include "reportitem.h"
+
+#include "reportheader.h"
+#include "reportfooter.h"
+#include "pageheader.h"
+#include "pagefooter.h"
+#include "detailheader.h"
+#include "detailfooter.h"
+#include "detail.h"
+
+#include <kdebug.h>
+
+namespace Kudesigner
+{
+
+KugarTemplate::KugarTemplate( int x, int y, int width, int height, Canvas *canvas )
+ : Section( x, y, width, height, canvas )
+{
+ detailsCount = 0;
+
+ setZ( 1 );
+ m_canvas->setKugarTemplate( this );
+
+ reportHeader = 0;
+ reportFooter = 0;
+ pageHeader = 0;
+ pageFooter = 0;
+
+ props.setGroupDescription( "DocumentSettings", i18n( "Document Settings" ) );
+
+ QMap<QString, QString> m;
+ m[ "A4" ] = "0";
+ m[ "B5" ] = "1";
+ m[ "Letter" ] = "2";
+ m[ "Legal" ] = "3";
+ m[ "Executive" ] = "4";
+ m[ "A0" ] = "5";
+ m[ "A1" ] = "6";
+ m[ "A2" ] = "7";
+ m[ "A3" ] = "8";
+ m[ "A5" ] = "9";
+ m[ "A6" ] = "10";
+ m[ "A7" ] = "11";
+ m[ "A8" ] = "12";
+ m[ "A9" ] = "13";
+ m[ "B0" ] = "14";
+ m[ "B1" ] = "15";
+ m[ "B10" ] = "16";
+ m[ "B2" ] = "17";
+ m[ "B3" ] = "18";
+ m[ "B4" ] = "19";
+ m[ "B6" ] = "20";
+ m[ "B7" ] = "21";
+ m[ "B8" ] = "22";
+ m[ "B9" ] = "23";
+ m[ "C5E" ] = "24";
+ m[ "Comm10E" ] = "25";
+ m[ "DLE" ] = "26";
+ m[ "Folio" ] = "27";
+ m[ "Ledger" ] = "28";
+ m[ "Tabloid" ] = "29";
+ m[ "NPageSize" ] = "30";
+ props.addProperty( new Property( "PageSize", m.values(), m.keys(), "0", i18n( "Page Size" ), i18n( "Page Size" ) ), "DocumentSettings" );
+ m.clear();
+
+ m[ i18n( "Portrait" ) ] = "0";
+ m[ i18n( "Landscape" ) ] = "1";
+ props.addProperty( new Property( "PageOrientation", m.values(), m.keys(), "0", i18n( "Page Orientation" ), i18n( "Page Orientation" ) ), "DocumentSettings" );
+ m.clear();
+
+ props.addProperty( new Property( "TopMargin", 0, i18n( "Top Margin" ), i18n( "Top Margin" ), KoProperty::Integer ), "DocumentSettings" );
+ props.addProperty( new Property( "BottomMargin", 0, i18n( "Bottom Margin" ), i18n( "Bottom Margin" ), KoProperty::Integer ), "DocumentSettings" );
+ props.addProperty( new Property( "LeftMargin", 0, i18n( "Left Margin" ), i18n( "Left Margin" ), KoProperty::Integer ), "DocumentSettings" );
+ props.addProperty( new Property( "RightMargin", 0, i18n( "Right Margin" ), i18n( "Right Margin" ), KoProperty::Integer ), "DocumentSettings" );
+}
+
+KugarTemplate::~KugarTemplate()
+{
+ if ( reportHeader )
+ delete reportHeader;
+ if ( pageHeader )
+ delete pageHeader;
+
+ std::map<int, DetailBand>::const_iterator it;
+ for ( it = details.begin(); it != details.end(); ++it )
+ {
+ if ( it->second.first.first )
+ delete it->second.first.first;
+ if ( it->second.second )
+ delete it->second.second;
+ if ( it->second.first.second )
+ delete it->second.first.second;
+ }
+ if ( pageFooter )
+ delete pageFooter;
+ if ( reportFooter )
+ delete reportFooter;
+}
+
+void KugarTemplate::draw( QPainter &painter )
+{
+ updatePaperProps();
+ painter.setPen( QPen( QColor( 160, 160, 160 ), 0, Qt::SolidLine ) );
+ QPoint p1( ( int ) ( x() + props[ "LeftMargin" ].value().toInt() ),
+ ( int ) ( y() + props[ "TopMargin" ].value().toInt() ) );
+ QPoint p2( ( int ) ( x() + props[ "LeftMargin" ].value().toInt() ),
+ ( int ) y() + height() - props[ "BottomMargin" ].value().toInt() );
+ QPoint p3( ( int ) x() + width() - props[ "RightMargin" ].value().toInt(),
+ ( int ) y() + height() - props[ "BottomMargin" ].value().toInt() );
+ QPoint p4( ( int ) x() + width() - props[ "RightMargin" ].value().toInt(),
+ ( int ) ( y() + props[ "TopMargin" ].value().toInt() ) );
+ painter.moveTo( p1 );
+ painter.lineTo( p2 );
+ painter.lineTo( p3 );
+ painter.lineTo( p4 );
+ painter.lineTo( p1 );
+ /* painter.drawRect((int)(x()+props["LeftMargin"].first.toInt()),
+ (int)(y()+props["TopMargin"].first.toInt()),
+ width() - props["LeftMargin"].first.toInt() - props["RightMargin"].first.toInt(),
+ height() - props["TopMargin"].first.toInt() - props["BottomMargin"].first.toInt());*/
+
+ if ( Config::gridSize() > 1 )
+ {
+ int x = Config::gridSize();
+ while ( x < width() )
+ {
+ int y = Config::gridSize();
+ while ( y < height() )
+ {
+ painter.drawPoint( x, y );
+ y += Config::gridSize();
+ }
+ x += Config::gridSize();
+ }
+ }
+
+ Section::draw( painter );
+}
+
+void KugarTemplate::updatePaperProps()
+{
+ QPrinter * printer;
+
+ // Set the page size
+ printer = new QPrinter();
+ printer->setFullPage( true );
+ printer->setPageSize( ( QPrinter::PageSize ) props[ "PageSize" ].value().toInt() );
+ printer->setOrientation( ( QPrinter::Orientation ) props[ "PageOrientation" ].value().toInt() );
+
+ // Get the page metrics and set appropriate wigth and height
+ QPaintDeviceMetrics pdm( printer );
+ canvas() ->resize( pdm.width(), pdm.height() );
+ setSize( pdm.width(), pdm.height() );
+
+ //this is not needed anymore
+ delete printer;
+}
+
+/*arrange sections on page automatically*/
+void KugarTemplate::arrangeSections( bool destructive )
+{
+ int base = props[ "TopMargin" ].value().toInt();
+ if ( reportHeader )
+ {
+ reportHeader->arrange( base, destructive );
+ base += reportHeader->props[ "Height" ].value().toInt();
+ reportHeader->show();
+ }
+ if ( pageHeader )
+ {
+ pageHeader->arrange( base, destructive );
+ base += pageHeader->props[ "Height" ].value().toInt();
+ pageHeader->show();
+ }
+
+ std::map<int, DetailBand>::const_iterator it;
+ for ( it = details.begin(); it != details.end(); ++it )
+ {
+ //arranging detail header
+ if ( it->second.first.first )
+ {
+ it->second.first.first->arrange( base, destructive );
+ base += it->second.first.first->props[ "Height" ].value().toInt();
+ it->second.first.first->show();
+ }
+ //arranging detail
+ if ( it->second.second )
+ {
+ it->second.second->arrange( base, destructive );
+ base += it->second.second->props[ "Height" ].value().toInt();
+ it->second.second->show();
+ }
+ }
+ std::map<int, DetailBand>::reverse_iterator itr;
+ for ( itr = details.rbegin(); itr != details.rend(); ++itr )
+ {
+ //arranging detail footer
+ if ( itr->second.first.second )
+ {
+ itr->second.first.second->arrange( base, destructive );
+ base += itr->second.first.second->props[ "Height" ].value().toInt();
+ itr->second.first.second->show();
+ }
+ }
+
+ if ( pageFooter )
+ {
+ pageFooter->arrange( base, destructive );
+ base += pageFooter->props[ "Height" ].value().toInt();
+ pageFooter->show();
+ }
+ if ( reportFooter )
+ {
+ reportFooter->arrange( base, destructive );
+ base += reportFooter->props[ "Height" ].value().toInt();
+ reportFooter->show();
+ }
+}
+
+QString KugarTemplate::getXml()
+{
+ QString result = "";
+ result += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n";
+ result += "<!DOCTYPE KugarTemplate SYSTEM \"kugartemplate.dtd\">\n\n";
+ result += "<KugarTemplate";
+
+ for ( Set::Iterator it( props ); it.current(); ++it )
+ {
+ QString attribute = it.currentKey();
+ QString value = PropertySerializer::toString( it.current() );
+ if ( !attribute.isEmpty() && !value.isEmpty() )
+ result += " " + attribute + "=" + "\"" + value + "\"";
+ }
+
+ result += " PageWidth=\"" + QString::number( width() )
+ + "\" PageHeight=\"" + QString::number( height() ) + "\"";
+
+ result += ">\n";
+
+ if ( reportHeader )
+ result += reportHeader->getXml();
+ if ( pageHeader )
+ result += pageHeader->getXml();
+
+ std::map<int, DetailBand>::const_iterator it;
+ for ( it = details.begin(); it != details.end(); ++it )
+ {
+ //getting xml from detail header
+ if ( it->second.first.first )
+ result += it->second.first.first->getXml();
+ //getting xml from detail
+ if ( it->second.second )
+ result += it->second.second->getXml();
+ //getting xml from detail footer
+ if ( it->second.first.second )
+ result += it->second.first.second->getXml();
+ }
+ if ( pageFooter )
+ result += pageFooter->getXml();
+ if ( reportFooter )
+ result += reportFooter->getXml();
+
+ result += "</KugarTemplate>\n";
+
+ return result;
+}
+
+bool KugarTemplate::removeReportItem( QCanvasItem *item )
+{
+ if ( item->rtti() > 2000 )
+ {
+
+ item->hide();
+ ReportItem *ritem = dynamic_cast<ReportItem*>( item );
+ if ( ritem != 0 )
+ {
+ ritem->section() ->items.remove( ritem );
+ qWarning( "good" );
+ }
+ //delete item;
+ // section = 0;
+ canvas() ->update();
+
+ return true;
+ }
+ if ( item->rtti() > 1800 )
+ {
+ /* if ((*it)->rtti() == Detail)
+ {
+ CanvasDetail *det = (CanvasDetail*)(*it);
+ if ( det->props["Level"].first.toInt() <
+ ((MyCanvas*)(canvas()))->templ->detailsCount - 1)
+ return;
+ }*/
+
+ Band * section = dynamic_cast<Band *>( item );
+
+ DetailHeader *header = 0;
+ DetailFooter *footer = 0;
+ removeSection( section, &header, &footer );
+ section->hide();
+ delete section;
+
+ if ( header )
+ {
+ header->hide();
+ delete header;
+ }
+ if ( footer )
+ {
+ footer->hide();
+ delete footer;
+ }
+ arrangeSections();
+ canvas() ->update();
+
+ return true;
+ }
+
+ return false;
+}
+
+void KugarTemplate::removeSection( Band *section,
+ DetailHeader **header, DetailFooter **footer )
+{
+ *header = 0;
+ *footer = 0;
+ if ( section == reportHeader )
+ reportHeader = 0;
+ if ( section == reportFooter )
+ reportFooter = 0;
+ if ( section == pageHeader )
+ pageHeader = 0;
+ if ( section == pageFooter )
+ pageFooter = 0;
+ for ( std::map<int, DetailBand>::iterator i = details.begin(); i != details.end(); ++i )
+ {
+ if ( i->second.second == section )
+ {
+ //delete not only detail but it's header and footer
+ i->second.second = 0;
+ *header = i->second.first.first;
+ i->second.first.first = 0;
+ *footer = i->second.first.second;
+ i->second.first.second = 0;
+ detailsCount--;
+ }
+ if ( i->second.first.first == section )
+ i->second.first.first = 0;
+ if ( i->second.first.second == section )
+ i->second.first.second = 0;
+ }
+}
+
+Band *KugarTemplate::band( Kudesigner::RttiValues type, int level )
+{
+ switch ( type )
+ {
+ case Rtti_ReportHeader:
+ return reportHeader;
+ case Rtti_PageHeader:
+ return pageHeader;
+ case Rtti_DetailHeader:
+ return details[ level ].first.first;
+ case Rtti_Detail:
+ return details[ level ].second;
+ case Rtti_DetailFooter:
+ return details[ level ].first.second;
+ case Rtti_PageFooter:
+ return pageFooter;
+ case Rtti_ReportFooter:
+ return reportFooter;
+ default:
+ return 0;
+ }
+ return 0;
+}
+
+}
diff --git a/kugar/kudesigner_lib/kugartemplate.h b/kugar/kudesigner_lib/kugartemplate.h
new file mode 100644
index 00000000..baaf5206
--- /dev/null
+++ b/kugar/kudesigner_lib/kugartemplate.h
@@ -0,0 +1,88 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef KUGARTEMPLATE_H
+#define KUGARTEMPLATE_H
+
+#include <map>
+
+#include "commdefs.h"
+#include "section.h"
+
+class QPainter;
+
+namespace Kudesigner
+{
+
+class DetailHeader;
+class DetailFooter;
+class Detail;
+class Band;
+class ReportHeader;
+class ReportFooter;
+class PageHeader;
+class PageFooter;
+class Canvas;
+
+typedef QPair< QPair<DetailHeader*, DetailFooter*>, Detail*> DetailBand;
+
+class KugarTemplate: public Section
+{
+public:
+ KugarTemplate( int x, int y, int width, int height, Canvas *canvas );
+ ~KugarTemplate();
+
+ virtual int rtti() const
+ {
+ return Rtti_KugarTemplate;
+ }
+ virtual void draw( QPainter &painter );
+
+ void arrangeSections( bool destructive = true );
+ void updatePaperProps();
+
+ QString fileName() const
+ {
+ return m_reportFileName;
+ }
+ void setFileName( const QString &fName )
+ {
+ m_reportFileName = fName;
+ }
+
+ virtual QString getXml();
+
+ void removeSection( Band *section, DetailHeader **header, DetailFooter **footer );
+ bool removeReportItem( QCanvasItem *item );
+
+ Band *band( Kudesigner::RttiValues type, int level = -1 );
+
+ ReportHeader *reportHeader;
+ ReportFooter *reportFooter;
+ PageHeader *pageHeader;
+ PageFooter *pageFooter;
+ std::map<int, DetailBand> details;
+ unsigned int detailsCount;
+
+private:
+ QString m_reportFileName;
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/label.cpp b/kugar/kudesigner_lib/label.cpp
new file mode 100644
index 00000000..d77e484e
--- /dev/null
+++ b/kugar/kudesigner_lib/label.cpp
@@ -0,0 +1,256 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "label.h"
+
+#include <klocale.h>
+#include <klineeditdlg.h>
+
+#include <qmap.h>
+#include <qpainter.h>
+
+#include <kdebug.h>
+#include <klocale.h>
+
+#include <koproperty/property.h>
+
+#include "band.h"
+
+namespace Kudesigner
+{
+
+Label::Label( int x, int y, int width, int height, Canvas *canvas )
+ : ReportItem( x, y, width, height, canvas )
+{
+ QMap<QString, QString> m;
+
+ props.addProperty( new Property( "Text", i18n( "Text" ), i18n( "Text to Display" ), i18n( "Text" ), KoProperty::String ) );
+
+ props.setGroupDescription( "Geometry", i18n( "Geometry" ) );
+ props.addProperty( new Property( "X", x, i18n( "X" ), i18n( "X value" ), KoProperty::Integer ), "Geometry" );
+
+ props.addProperty( new Property( "Y", y, i18n( "Y" ), i18n( "Y value" ), KoProperty::Integer ), "Geometry" );
+
+ props.addProperty( new Property( "Width", width, i18n( "Width" ), i18n( "Width" ), KoProperty::Integer ), "Geometry" );
+
+ props.addProperty( new Property( "Height", height, i18n( "Height" ), i18n( "Height" ), KoProperty::Integer ), "Geometry" );
+
+ props.addProperty( new Property( "BackgroundColor", QColor( 255, 255, 255 ), i18n( "Background Color" ), i18n( "Background Color" ), KoProperty::Color ) );
+
+ props.addProperty( new Property( "ForegroundColor", QColor( 0, 0, 0 ), i18n( "Foreground Color" ), i18n( "Foreground Color" ), KoProperty::Color ) );
+
+ props.setGroupDescription( "BorderStyle", i18n( "Border Style" ) );
+ props.addProperty( new Property( "BorderColor", QColor( 0, 0, 0 ), i18n( "Color" ), i18n( "Border Color" ), KoProperty::Color ), "BorderStyle" );
+
+ props.addProperty( new Property( "BorderWidth", 1, i18n( "Width" ), i18n( "Border Width" ), KoProperty::Integer ), "BorderStyle" );
+
+ props.addProperty( new Property( "BorderStyle", 1, i18n( "Line" ), i18n( "Border Style" ), KoProperty::LineStyle ), "BorderStyle" );
+
+ props.setGroupDescription( "DrawBorder", i18n( "Border" ) );
+ props.addProperty( new Property( "DrawTop", QVariant( false, 3 ), i18n( "Top" ), i18n( "Draw Top Border" ), KoProperty::Boolean ), "DrawBorder" );
+ props.addProperty( new Property( "DrawBottom", QVariant( false, 3 ), i18n( "Bottom" ), i18n( "Draw Bottom Border" ), KoProperty::Boolean ), "DrawBorder" );
+ props.addProperty( new Property( "DrawLeft", QVariant( false, 3 ), i18n( "Left" ), i18n( "Draw Left Border" ), KoProperty::Boolean ), "DrawBorder" );
+ props.addProperty( new Property( "DrawRight", QVariant( false, 3 ), i18n( "Right" ), i18n( "Draw Right Border" ), KoProperty::Boolean ), "DrawBorder" );
+
+
+ props.setGroupDescription( "Font", i18n( "Font" ) );
+ props.addProperty( new Property( "FontFamily", QApplication::font(), i18n( "Family" ), i18n( "Font Family" ), KoProperty::Font ), "Font" );
+
+ props.addProperty( new Property( "FontSize", QApplication::font().pointSize(), i18n( "Size" ), i18n( "Font Size" ), KoProperty::Integer ), "Font" );
+
+ m[ i18n( "Light" ) ] = "25";
+ m[ i18n( "Normal" ) ] = "50";
+ m[ i18n( "DemiBold" ) ] = "63";
+ m[ i18n( "Bold" ) ] = "75";
+ m[ i18n( "Black" ) ] = "87";
+ props.addProperty( new Property( "FontWeight", m.values(), m.keys(), "50", i18n( "Weight" ), i18n( "Weight" ) ), "Font" );
+ m.clear();
+
+ m[ i18n( "Regular" ) ] = "0";
+ m[ i18n( "Italic" ) ] = "1";
+ props.addProperty( new Property( "FontItalic", m.values(), m.keys(), "0", i18n( "Italic" ), i18n( "Italic" ) ), "Font" );
+ m.clear();
+
+ m[ i18n( "Left" ) ] = "0";
+ m[ i18n( "Center" ) ] = "1";
+ m[ i18n( "Right" ) ] = "2";
+ props.addProperty( new Property( "HAlignment", m.values(), m.keys(),
+ QString( "" ).isRightToLeft() ? "2" : "0", i18n( "HAlignment" ), i18n( "HAlignment" ) ) );
+ m.clear();
+
+ m[ i18n( "Top" ) ] = "0";
+ m[ i18n( "Middle" ) ] = "1";
+ m[ i18n( "Bottom" ) ] = "2";
+ props.addProperty( new Property( "VAlignment", m.values(), m.keys(), "1", i18n( "VAlignment" ), i18n( "VAlignment" ) ) );
+ m.clear();
+
+ m[ i18n( "False" ) ] = "0";
+ m[ i18n( "True" ) ] = "1";
+ props.addProperty( new Property( "WordWrap", m.values(), m.keys(), "0", i18n( "Word wrap" ), i18n( "Word wrap" ) ) );
+}
+
+int Label::getTextAlignment()
+{
+ int result = 0;
+ switch ( props[ "HAlignment" ].value().toInt() )
+ {
+ case 0:
+ result = AlignLeft;
+ break;
+ case 1:
+ result = AlignHCenter;
+ break;
+ case 2:
+ result = AlignRight;
+ break;
+ default:
+ result = AlignHCenter;
+ }
+ switch ( props[ "VAlignment" ].value().toInt() )
+ {
+ case 0:
+ result = result | AlignTop;
+ break;
+ case 1:
+ result = result | AlignVCenter;
+ break;
+ case 2:
+ result = result | AlignBottom;
+ break;
+ default:
+ result = result | AlignVCenter;
+ }
+ return result;
+}
+
+int Label::getTextWrap()
+{
+ switch ( props[ "WordWrap" ].value().toInt() )
+ {
+ case 0:
+ return SingleLine;
+ break;
+ case 1:
+ return WordBreak;
+ break;
+ default:
+ return SingleLine;
+ }
+}
+
+QFont Label::getFont()
+{
+ return QFont( props[ "FontFamily" ].value().toString(),
+ props[ "FontSize" ].value().toInt(),
+ props[ "FontWeight" ].value().toInt(),
+ props[ "FontItalic" ].value().toInt() );
+}
+
+QPen Label::getPenForText()
+{
+ return QPen( QColor( props[ "ForegroundColor" ].value().toColor() ) );
+}
+
+QPen Label::getPenForShape()
+{
+ PenStyle style = SolidLine;
+ switch ( props[ "BorderStyle" ].value().toInt() )
+ {
+ case 0:
+ style = NoPen;
+ break;
+ case 1:
+ style = SolidLine;
+ break;
+ case 2:
+ style = DashLine;
+ break;
+ case 3:
+ style = DotLine;
+ break;
+ case 4:
+ style = DashDotLine;
+ break;
+ case 5:
+ style = DashDotDotLine;
+ break;
+ }
+ return QPen( QColor( props[ "BorderColor" ].value().toColor() ),
+ props[ "BorderWidth" ].value().toInt(), style );
+}
+
+QBrush Label::getBrush()
+{
+ return QBrush( QColor( props[ "BackgroundColor" ].value().toColor() ) );
+}
+
+void Label::draw( QPainter &painter )
+{
+ //update dimensions
+ if ( !section() )
+ return ;
+
+ setX( props[ "X" ].value().toInt() + section() ->x() );
+ setY( props[ "Y" ].value().toInt() + section() ->y() );
+ setSize( props[ "Width" ].value().toInt(), props[ "Height" ].value().toInt() );
+
+ //draw border and background
+ painter.setBrush( getBrush() );
+ painter.setPen( NoPen );
+ painter.drawRect( rect() );
+ painter.setPen( getPenForShape() );
+ if ( props[ "DrawLeft" ].value().toBool() )
+ painter.drawLine( rect().topLeft(), rect().bottomLeft() );
+ if ( props[ "DrawRight" ].value().toBool() )
+ painter.drawLine( rect().topRight(), rect().bottomRight() );
+ if ( props[ "DrawTop" ].value().toBool() )
+ painter.drawLine( rect().topLeft(), rect().topRight() );
+ if ( props[ "DrawBottom" ].value().toBool() )
+ painter.drawLine( rect().bottomLeft(), rect().bottomRight() );
+
+ //draw text inside
+ painter.setFont( getFont() );
+ painter.setPen( getPenForText() );
+ painter.drawText( ( int ) x(), ( int ) y(), width(), height(),
+ getTextAlignment() | getTextWrap(),
+ props[ "Text" ].value().toString() );
+
+ //draw resizable region
+ // if (isSelected())
+ // drawHolders(painter);
+ // CanvasReportItem::draw(painter);
+}
+
+QString Label::getXml()
+{
+ return "\t\t<Label" + ReportItem::getXml() + " />\n";
+}
+
+void Label::fastProperty()
+{
+ bool accepted;
+
+ QString sText = KLineEditDlg::getText( i18n( "Change Label" ),
+ "Enter label name:", props[ "Text" ].value().toString(),
+ &accepted );
+
+ if ( accepted )
+ props[ "Text" ].setValue( sText );
+}
+
+}
diff --git a/kugar/kudesigner_lib/label.h b/kugar/kudesigner_lib/label.h
new file mode 100644
index 00000000..b777353a
--- /dev/null
+++ b/kugar/kudesigner_lib/label.h
@@ -0,0 +1,57 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef LABEL_H
+#define LABEL_H
+
+#include "reportitem.h"
+
+namespace Kudesigner
+{
+
+class Label: public ReportItem
+{
+public:
+ Label( int x, int y, int width, int height, Canvas *canvas );
+
+ virtual int rtti() const
+ {
+ return Rtti_Label;
+ }
+ virtual QString getXml();
+
+ int getTextAlignment();
+ int getTextWrap();
+
+ QFont getFont();
+ QPen getPenForText();
+ QPen getPenForShape();
+ QBrush getBrush();
+
+ virtual void draw( QPainter &painter );
+ virtual void updateGeomProps()
+ {
+ ReportItem::updateGeomProps();
+ }
+
+ virtual void fastProperty();
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/line.cpp b/kugar/kudesigner_lib/line.cpp
new file mode 100644
index 00000000..75631b1b
--- /dev/null
+++ b/kugar/kudesigner_lib/line.cpp
@@ -0,0 +1,129 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "line.h"
+
+#include <klocale.h>
+
+#include <qpainter.h>
+
+#include <koproperty/property.h>
+
+#include "band.h"
+
+namespace Kudesigner
+{
+
+Line::Line( int x, int y, int width, int height, Canvas *canvas ) :
+ ReportItem( x, y, width, height, canvas )
+{
+ props.setGroupDescription( "Line", i18n( "Line" ) );
+ props.addProperty( new Property( "X1", x, i18n( "X1" ), i18n( "X1" ), KoProperty::Integer ), "Line" );
+
+ props.addProperty( new Property( "Y1", y, i18n( "Y1" ), i18n( "Y1" ), KoProperty::Integer ), "Line" );
+
+ props.addProperty( new Property( "X2", x + width, i18n( "X2" ), i18n( "X2" ), KoProperty::Integer ), "Line" );
+
+ props.addProperty( new Property( "Y2", y + height, i18n( "Y2" ), i18n( "Y2" ), KoProperty::Integer ), "Line" );
+
+ props.addProperty( new Property( "Color", QColor( 0, 0, 0 ), i18n( "Color" ), i18n( "Color" ), KoProperty::Color ), "Line" );
+
+ props.addProperty( new Property( "Width", 1, i18n( "Width" ), i18n( "Width" ), KoProperty::Integer ), "Line" );
+
+ props.addProperty( new Property( "Style", 1, i18n( "Line Style" ), i18n( "Line Style" ), KoProperty::LineStyle ), "Line" );
+}
+
+QString Line::getXml()
+{
+ return "\t\t<Line" + ReportItem::getXml() + " />\n";
+}
+
+QPen Line::getPenForShape()
+{
+ PenStyle style = SolidLine;
+ switch ( props[ "Style" ].value().toInt() )
+ {
+ case 0:
+ style = NoPen;
+ break;
+ case 1:
+ style = SolidLine;
+ break;
+ case 2:
+ style = DashLine;
+ break;
+ case 3:
+ style = DotLine;
+ break;
+ case 4:
+ style = DashDotLine;
+ break;
+ case 5:
+ style = DashDotDotLine;
+ break;
+ }
+ return QPen( QColor( props[ "Color" ].value().toColor() ),
+ props[ "Width" ].value().toInt(), style );
+}
+
+void Line::draw( QPainter &painter )
+{
+ //update dimensions
+ if ( !section() )
+ return ;
+ setX( props[ "X1" ].value().toInt() + section() ->x() );
+ setY( props[ "Y1" ].value().toInt() + section() ->y() );
+ setSize( props[ "X2" ].value().toInt() - props[ "X1" ].value().toInt(),
+ props[ "Y2" ].value().toInt() - props[ "Y1" ].value().toInt() );
+
+ //draw border and background
+ painter.setPen( getPenForShape() );
+ painter.setBrush( QColor( 0, 0, 0 ) );
+ painter.drawLine( props[ "X1" ].value().toInt() + ( int ) section() ->x(),
+ props[ "Y1" ].value().toInt() + ( int ) section() ->y(),
+ props[ "X2" ].value().toInt() + ( int ) section() ->x(),
+ props[ "Y2" ].value().toInt() + ( int ) section() ->y() );
+
+ painter.setPen( QColor( 0, 0, 0 ) );
+ painter.setBrush( QColor( 0, 0, 0 ) );
+ // painter.drawRect(topLeftResizableRect());
+ // painter.drawRect(topRightResizableRect());
+ // painter.drawRect(bottomLeftResizableRect());
+ painter.drawRect( bottomRightResizableRect() );
+
+ // drawHolders(painter);
+}
+
+void Line::setSection( Band *section )
+{
+ props[ "X1" ].setValue( ( int ) ( x() - section->x() ) );
+ props[ "Y1" ].setValue( ( int ) ( y() - section->y() ) );
+ parentSection = section;
+}
+
+void Line::updateGeomProps()
+{
+ props[ "X1" ].setValue( ( int ) ( x() - section() ->x() ) );
+ props[ "Y1" ].setValue( ( int ) ( y() - section() ->y() ) );
+ props[ "X2" ].setValue( ( int ) ( x() - section() ->x() + width() ) );
+ props[ "Y2" ].setValue( ( int ) ( y() - section() ->y() + height() ) );
+
+ // if (width() )
+}
+
+}
diff --git a/kugar/kudesigner_lib/line.h b/kugar/kudesigner_lib/line.h
new file mode 100644
index 00000000..0da1eec5
--- /dev/null
+++ b/kugar/kudesigner_lib/line.h
@@ -0,0 +1,48 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef LINE_H
+#define LINE_H
+
+#include "reportitem.h"
+
+namespace Kudesigner
+{
+
+class Line: public ReportItem
+{
+public:
+ Line( int x, int y, int width, int height, Canvas *canvas );
+
+ virtual int rtti() const
+ {
+ return Rtti_Line;
+ }
+ virtual QString getXml();
+ virtual void draw( QPainter &painter );
+
+ virtual void updateGeomProps();
+ virtual void setSection( Band *section );
+
+private:
+ QPen getPenForShape();
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/pagefooter.cpp b/kugar/kudesigner_lib/pagefooter.cpp
new file mode 100644
index 00000000..9091f31b
--- /dev/null
+++ b/kugar/kudesigner_lib/pagefooter.cpp
@@ -0,0 +1,54 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "pagefooter.h"
+
+#include <klocale.h>
+
+#include <qpainter.h>
+
+#include <koproperty/property.h>
+
+namespace Kudesigner
+{
+
+PageFooter::PageFooter( int x, int y, int width, int height, Canvas *canvas ) :
+ Band( x, y, width, height, canvas )
+{
+ props.addProperty( new Property( "Height", 50, i18n( "Height" ), i18n( "Height" ), KoProperty::Integer ), "Section" );
+ QMap<QString, QString> m;
+
+ m[ i18n( "First Page" ) ] = "0";
+ m[ i18n( "Every Page" ) ] = "1";
+ m[ i18n( "Last Page" ) ] = "2";
+
+ props.addProperty( new Property( "PrintFrequency", m.values(), m.keys(), "1", i18n( "Print Frequency" ), i18n( "Print Frequency" ) ), "Section" );
+}
+
+void PageFooter::draw( QPainter &painter )
+{
+ painter.drawText( rect(), AlignVCenter | AlignLeft, i18n( "Page Footer" ) );
+ Band::draw( painter );
+}
+
+QString PageFooter::getXml()
+{
+ return "\t<PageFooter" + Band::getXml() + "\t</PageFooter>\n\n";
+}
+
+}
diff --git a/kugar/kudesigner_lib/pagefooter.h b/kugar/kudesigner_lib/pagefooter.h
new file mode 100644
index 00000000..b24d6a77
--- /dev/null
+++ b/kugar/kudesigner_lib/pagefooter.h
@@ -0,0 +1,43 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef PAGEFOOTER_H
+#define PAGEFOOTER_H
+
+#include "commdefs.h"
+#include "band.h"
+
+namespace Kudesigner
+{
+
+class PageFooter: public Band
+{
+public:
+ PageFooter( int x, int y, int width, int height, Canvas *canvas );
+
+ virtual int rtti() const
+ {
+ return Rtti_PageFooter;
+ }
+ virtual void draw( QPainter &painter );
+ virtual QString getXml();
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/pageheader.cpp b/kugar/kudesigner_lib/pageheader.cpp
new file mode 100644
index 00000000..710dd210
--- /dev/null
+++ b/kugar/kudesigner_lib/pageheader.cpp
@@ -0,0 +1,55 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "pageheader.h"
+
+#include <klocale.h>
+
+#include <qpainter.h>
+
+#include <koproperty/property.h>
+
+namespace Kudesigner
+{
+
+PageHeader::PageHeader( int x, int y, int width, int height, Canvas *canvas ) :
+ Band( x, y, width, height, canvas )
+{
+ props.addProperty( new Property( "Height", 50, i18n( "Height" ), i18n( "Height" ), KoProperty::Integer ), "Section" );
+ QMap<QString, QString> m;
+
+ m[ i18n( "First Page" ) ] = "0";
+ m[ i18n( "Every Page" ) ] = "1";
+ m[ i18n( "Last Page" ) ] = "2";
+
+ props.addProperty( new Property( "PrintFrequency", m.values(), m.keys(), "1", i18n( "Print Frequency" ), i18n( "Print Frequency" ) ), "Section" );
+}
+
+void PageHeader::draw( QPainter &painter )
+{
+ painter.drawText( rect(), AlignVCenter | AlignLeft,
+ i18n( "Page Header" ) );
+ Band::draw( painter );
+}
+
+QString PageHeader::getXml()
+{
+ return "\t<PageHeader" + Band::getXml() + "\t</PageHeader>\n\n";
+}
+
+}
diff --git a/kugar/kudesigner_lib/pageheader.h b/kugar/kudesigner_lib/pageheader.h
new file mode 100644
index 00000000..577957b0
--- /dev/null
+++ b/kugar/kudesigner_lib/pageheader.h
@@ -0,0 +1,44 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef PAGEHEADER_H
+#define PAGEHEADER_H
+
+#include "commdefs.h"
+#include "band.h"
+
+class QPainter;
+
+namespace Kudesigner
+{
+
+class PageHeader: public Band
+{
+public:
+ PageHeader( int x, int y, int width, int height, Canvas *canvas );
+ virtual void draw( QPainter &painter );
+ virtual int rtti() const
+ {
+ return Rtti_PageHeader;
+ }
+ virtual QString getXml();
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/plugin.cpp b/kugar/kudesigner_lib/plugin.cpp
new file mode 100644
index 00000000..711c485f
--- /dev/null
+++ b/kugar/kudesigner_lib/plugin.cpp
@@ -0,0 +1,28 @@
+/***************************************************************************
+ plugin.h - description
+ -------------------
+ begin : 19.01.2003
+ copyright : (C) 2003 Joseph Wenninger
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "plugin.h"
+
+KuDesignerPlugin::KuDesignerPlugin( QObject *parent, const char *name, const QStringList& ) : QObject( parent, name )
+{}
+KuDesignerPlugin::~KuDesignerPlugin()
+{}
+void KuDesignerPlugin::createPluggedInEditor( QWidget *&/*retVal*/, Editor */*editor*/,
+ Property */*property*/, Box */*cb*/ )
+{}
+
+#include "plugin.moc"
diff --git a/kugar/kudesigner_lib/plugin.h b/kugar/kudesigner_lib/plugin.h
new file mode 100644
index 00000000..d4363cfc
--- /dev/null
+++ b/kugar/kudesigner_lib/plugin.h
@@ -0,0 +1,74 @@
+/***************************************************************************
+ plugin.h - description
+ -------------------
+ begin : 19.01.2003
+ copyright : (C) 2003 Joseph Wenninger
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Library General Public License as *
+ * published by the Free Software Foundation; either version 2 of the *
+ * License, or (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _KUGAR_DESIGNER_PLUGIN_H_
+#define _KUGAR_DESIGNER_PLUGIN_H_
+
+#include <qobject.h>
+#include <koproperty/property.h>
+#include <koproperty/editor.h>
+#include <box.h>
+
+class QString;
+class QWidget;
+class CanvasReportItem;
+class KoStore;
+
+using namespace KoProperty;
+using namespace Kudesigner;
+
+class KuDesignerPlugin: public QObject
+{
+ Q_OBJECT
+public:
+ KuDesignerPlugin( QObject *parent, const char* name, const QStringList& args );
+ virtual ~KuDesignerPlugin();
+ virtual bool acceptsDrops()
+ {
+ return false;
+ }
+ virtual bool dragMove( QDragMoveEvent *, Box */*cb*/ )
+ {
+ return false;
+ }
+ virtual void newCanvasBox( int /*type*/, Box */*cb*/ )
+ {
+ ;
+ }
+ virtual void modifyItemPropertyOnSave( CanvasReportItem */*item*/, const Property & /*p*/ , QString &/*propertyName*/, QString &/*propertyValue*/ )
+ {
+ ;
+ }
+ virtual void modifyItemPropertyOnLoad( CanvasReportItem */*item*/, const Property & /*p*/, QString &/*propertyName*/, QString &/*propertyValue*/ )
+ {
+ ;
+ }
+ virtual bool store ( KoStore* )
+ {
+ return true;
+ }
+ virtual bool load ( KoStore* )
+ {
+ return true;
+ }
+
+public slots:
+ virtual void createPluggedInEditor( QWidget *& retVal, Editor *editor,
+ Property *property, Box * );
+};
+
+#endif
diff --git a/kugar/kudesigner_lib/propertyserializer.cpp b/kugar/kudesigner_lib/propertyserializer.cpp
new file mode 100644
index 00000000..dc3e91e6
--- /dev/null
+++ b/kugar/kudesigner_lib/propertyserializer.cpp
@@ -0,0 +1,76 @@
+/***************************************************************************
+* Copyright (C) 2004 by Alexander Dymo *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU Library General Public License as *
+* published by the Free Software Foundation; either version 2 of the *
+* License, or (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU Library General Public *
+* License along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA. *
+***************************************************************************/
+#include "propertyserializer.h"
+
+#include <qcolor.h>
+#include <qfont.h>
+
+#include <kdebug.h>
+
+namespace Kudesigner
+{
+
+PropertySerializer::PropertySerializer()
+{}
+
+PropertySerializer::~PropertySerializer()
+{}
+
+QString PropertySerializer::toString( Property *prop )
+{
+ QVariant val = prop->value();
+ switch ( prop->type() )
+ {
+ case KoProperty::Color:
+ return QString( "%1,%2,%3" ).arg( val.toColor().red() ).arg( val.toColor().green() ).arg( val.toColor().blue() );
+ case KoProperty::Boolean:
+ return val.toBool() ? "true" : "false";
+ case KoProperty::Font:
+ return val.toFont().family();
+ default:
+ return val.toString();
+ }
+}
+
+QVariant PropertySerializer::fromString( Property *prop, const QString &str )
+{
+ switch ( prop->type() )
+ {
+ case KoProperty::Color:
+ return QVariant( QColor( str.section( ',', 0, 0 ).toInt(),
+ str.section( ',', 1, 1 ).toInt(),
+ str.section( ',', 2, 2 ).toInt() ) );
+ case KoProperty::Integer:
+ return QVariant( str.toInt() );
+ case KoProperty::Boolean:
+ return QVariant( str == "true", 3 );
+ case KoProperty::Font:
+ return QVariant( QFont( str ) );
+ case KoProperty::LineStyle:
+ return QVariant( str.toInt() );
+ case KoProperty::Symbol:
+ return QVariant( str.at( 0 ).latin1() );
+ default:
+ return QVariant( str );
+ }
+}
+
+}
diff --git a/kugar/kudesigner_lib/propertyserializer.h b/kugar/kudesigner_lib/propertyserializer.h
new file mode 100644
index 00000000..4851946f
--- /dev/null
+++ b/kugar/kudesigner_lib/propertyserializer.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+* Copyright (C) 2004 by Alexander Dymo *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU Library General Public License as *
+* published by the Free Software Foundation; either version 2 of the *
+* License, or (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU Library General Public *
+* License along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA. *
+***************************************************************************/
+#ifndef KUDESIGNERPROPERTYSERIALIZER_H
+#define KUDESIGNERPROPERTYSERIALIZER_H
+
+#include <koproperty/property.h>
+
+using namespace KoProperty;
+
+namespace Kudesigner
+{
+
+/**
+@short Contains functions to convert Property values to strings
+*/
+class PropertySerializer
+{
+public:
+ PropertySerializer();
+ ~PropertySerializer();
+
+ static QString toString( Property *prop );
+ static QVariant fromString( Property *prop, const QString &str );
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/reportfooter.cpp b/kugar/kudesigner_lib/reportfooter.cpp
new file mode 100644
index 00000000..222757ad
--- /dev/null
+++ b/kugar/kudesigner_lib/reportfooter.cpp
@@ -0,0 +1,56 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "reportfooter.h"
+
+#include <klocale.h>
+
+#include <qpainter.h>
+
+#include <koproperty/property.h>
+
+namespace Kudesigner
+{
+
+ReportFooter::ReportFooter( int x, int y, int width, int height, Canvas *canvas ) :
+ Band( x, y, width, height, canvas )
+{
+ props.addProperty( new Property( "Height", 50, i18n( "Height" ), i18n( "Height" ), KoProperty::Integer ), "Section" );
+
+ QMap<QString, QString> m;
+
+ m[ i18n( "First Page" ) ] = "0";
+ m[ i18n( "Every Page" ) ] = "1";
+ m[ i18n( "Last Page" ) ] = "2";
+
+ props.addProperty( new Property( "PrintFrequency", m.values(), m.keys(), "2", i18n( "Print Frequency" ), i18n( "Print Frequency" ) ), "Section" );
+}
+
+void ReportFooter::draw( QPainter &painter )
+{
+ painter.drawText( rect(), AlignVCenter | AlignLeft,
+ i18n( "Report Footer" ) );
+ Band::draw( painter );
+}
+
+QString ReportFooter::getXml()
+{
+ return "\t<ReportFooter" + Band::getXml() + "\t</ReportFooter>\n\n";
+}
+
+}
diff --git a/kugar/kudesigner_lib/reportfooter.h b/kugar/kudesigner_lib/reportfooter.h
new file mode 100644
index 00000000..d6011a65
--- /dev/null
+++ b/kugar/kudesigner_lib/reportfooter.h
@@ -0,0 +1,43 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef REPORTFOOTER_H
+#define REPORTFOOTER_H
+
+#include "commdefs.h"
+#include "band.h"
+
+namespace Kudesigner
+{
+
+class ReportFooter: public Band
+{
+public:
+ ReportFooter( int x, int y, int width, int height, Canvas *canvas );
+
+ virtual int rtti() const
+ {
+ return Rtti_ReportFooter;
+ }
+ virtual void draw( QPainter &painter );
+ virtual QString getXml();
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/reportheader.cpp b/kugar/kudesigner_lib/reportheader.cpp
new file mode 100644
index 00000000..a3311be9
--- /dev/null
+++ b/kugar/kudesigner_lib/reportheader.cpp
@@ -0,0 +1,54 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "reportheader.h"
+
+#include <klocale.h>
+
+#include <qpainter.h>
+
+#include <koproperty/property.h>
+
+namespace Kudesigner
+{
+
+ReportHeader::ReportHeader( int x, int y, int width, int height, Canvas *canvas ) :
+ Band( x, y, width, height, canvas )
+{
+ props.addProperty( new Property( "Height", 50, i18n( "Height" ), i18n( "Height" ), KoProperty::Integer ), "Section" );
+ QMap<QString, QString> m;
+
+ m[ i18n( "First Page" ) ] = "0";
+ m[ i18n( "Every Page" ) ] = "1";
+ m[ i18n( "Last Page" ) ] = "2";
+
+ props.addProperty( new Property( "PrintFrequency", m.values(), m.keys(), "0", i18n( "Print Frequency" ), i18n( "Print Frequency" ) ), "Section" );
+}
+
+void ReportHeader::draw( QPainter &painter )
+{
+ painter.drawText( rect(), AlignVCenter | AlignLeft, i18n( "Report Header" ) );
+ Band::draw( painter );
+}
+
+QString ReportHeader::getXml()
+{
+ return "\t<ReportHeader" + Band::getXml() + "\t</ReportHeader>\n\n";
+}
+
+}
diff --git a/kugar/kudesigner_lib/reportheader.h b/kugar/kudesigner_lib/reportheader.h
new file mode 100644
index 00000000..e8c4a38b
--- /dev/null
+++ b/kugar/kudesigner_lib/reportheader.h
@@ -0,0 +1,44 @@
+/* This file is part of the KDE project
+ Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef REPORTHEADER_H
+#define REPORTHEADER_H
+
+#include "commdefs.h"
+#include "band.h"
+
+class QPainter;
+
+namespace Kudesigner
+{
+
+class ReportHeader: public Band
+{
+public:
+ ReportHeader( int x, int y, int width, int height, Canvas *canvas );
+ virtual int rtti() const
+ {
+ return Rtti_ReportHeader;
+ }
+ virtual void draw( QPainter &painter );
+ virtual QString getXml();
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/reportitem.cpp b/kugar/kudesigner_lib/reportitem.cpp
new file mode 100644
index 00000000..077bc1fe
--- /dev/null
+++ b/kugar/kudesigner_lib/reportitem.cpp
@@ -0,0 +1,247 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "reportitem.h"
+
+#include <klocale.h>
+#include <kglobalsettings.h>
+
+#include <qrect.h>
+#include <qpainter.h>
+#include <qregexp.h>
+
+#include <koproperty/property.h>
+
+#include "canvas.h"
+#include "band.h"
+#include "propertyserializer.h"
+
+#include <kdebug.h>
+
+namespace Kudesigner
+{
+
+QRect ReportItem::topLeftResizableRect()
+{
+ return QRect( ( int ) x(), ( int ) y(), HolderSize, HolderSize );
+}
+
+QRect ReportItem::bottomLeftResizableRect()
+{
+ return QRect( ( int ) x(), ( int ) ( y() + height() - HolderSize ), HolderSize, HolderSize );
+}
+
+QRect ReportItem::topRightResizableRect()
+{
+ return QRect( ( int ) ( x() + width() - HolderSize ), ( int ) y(), HolderSize, HolderSize );
+}
+
+QRect ReportItem::bottomRightResizableRect()
+{
+ return QRect( ( int ) ( x() + width() - HolderSize ), ( int ) ( y() + height() - HolderSize ), HolderSize, HolderSize );
+}
+
+QRect ReportItem::topMiddleResizableRect()
+{
+ return QRect( ( int ) ( x() + width() / 2 - HolderSize / 2. ), ( int ) y(), HolderSize, HolderSize );
+}
+
+QRect ReportItem::bottomMiddleResizableRect()
+{
+ return QRect( ( int ) ( x() + width() / 2 - HolderSize / 2. ), ( int ) ( y() + height() - HolderSize ), HolderSize, HolderSize );
+}
+
+QRect ReportItem::leftMiddleResizableRect()
+{
+ return QRect( ( int ) x(), ( int ) ( y() + height() / 2 - HolderSize / 2. ), HolderSize, HolderSize );
+}
+
+QRect ReportItem::rightMiddleResizableRect()
+{
+ return QRect( ( int ) ( x() + width() - HolderSize ), ( int ) ( y() + height() / 2 - HolderSize / 2. ), HolderSize, HolderSize );
+}
+
+void ReportItem::updateGeomProps()
+{
+ if ( !section() )
+ return ;
+ props[ "X" ].setValue( ( int ) ( x() - section() ->x() ) );
+ props[ "Y" ].setValue( ( int ) ( y() - section() ->y() ) );
+ props[ "Width" ].setValue( width() );
+ props[ "Height" ].setValue( height() );
+}
+
+Band *ReportItem::section()
+{
+ return parentSection;
+}
+
+void ReportItem::setSection( Band *section )
+{
+ props[ "X" ].setValue( ( int ) ( x() - section->x() ) );
+ props[ "Y" ].setValue( ( int ) ( y() - section->y() ) );
+ parentSection = section;
+}
+
+void ReportItem::setSectionUndestructive( Band *section )
+{
+ parentSection = section;
+}
+
+QString ReportItem::getXml()
+{
+ QString result = "";
+
+ int i = 1;
+ for ( Set::Iterator it( props ); it.current(); ++it )
+ {
+ if ( !( i % 3 ) )
+ result += "\n\t\t ";
+ result += " " + QString(it.currentKey()) + "=" + "\"" + escape( PropertySerializer::toString( it.current() ) ) + "\"";
+ i++;
+ }
+
+ return result;
+}
+
+int ReportItem::isInHolder( const QPoint p )
+{
+ if ( topLeftResizableRect().contains( p ) )
+ return ( ResizeTop | ResizeLeft );
+ if ( bottomLeftResizableRect().contains( p ) )
+ return ( ResizeBottom | ResizeLeft );
+ if ( leftMiddleResizableRect().contains( p ) )
+ return ( ResizeLeft );
+ if ( bottomMiddleResizableRect().contains( p ) )
+ return ( ResizeBottom );
+ if ( topMiddleResizableRect().contains( p ) )
+ return ( ResizeTop );
+ if ( topRightResizableRect().contains( p ) )
+ return ( ResizeTop | ResizeRight );
+ if ( bottomRightResizableRect().contains( p ) )
+ return ( ResizeBottom | ResizeRight );
+ if ( rightMiddleResizableRect().contains( p ) )
+ return ( ResizeRight );
+
+ return ResizeNothing;
+}
+
+void ReportItem::drawHolders( QPainter &painter )
+{
+ painter.setPen( QColor( 0, 0, 0 ) );
+
+ painter.setBrush( KGlobalSettings::highlightColor() );
+
+ QCanvasItemList list = collisions( false );
+ QCanvasItemList::iterator it = list.begin();
+ for ( ; it != list.end(); ++it )
+ {
+ switch ( ( *it )->rtti() )
+ {
+ case Rtti_Label:
+ case Rtti_Field:
+ case Rtti_Special:
+ case Rtti_Calculated:
+ case Rtti_Line:
+ {
+ ReportItem *item = static_cast<ReportItem*>( *it );
+ if ( section() != item->section() )
+ continue;
+ if ( intersects( item ) )
+ painter.setBrush( Qt::red );
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
+ if ( props["Height"].value().toInt() > section()->props["Height"].value().toInt() )
+ painter.setBrush( Qt::red );
+
+ painter.drawRect( topLeftResizableRect() );
+ painter.drawRect( topRightResizableRect() );
+ painter.drawRect( bottomLeftResizableRect() );
+ painter.drawRect( bottomRightResizableRect() );
+ painter.drawRect( topMiddleResizableRect() );
+ painter.drawRect( bottomMiddleResizableRect() );
+ painter.drawRect( leftMiddleResizableRect() );
+ painter.drawRect( rightMiddleResizableRect() );
+}
+
+bool ReportItem::intersects( ReportItem *item )
+{
+ QRect r1;
+ QRect r2;
+
+ if ( rtti() == Rtti_Line /*line*/ )
+ {
+ int x1 = props["X1"].value().toInt();
+ int x2 = props["X2"].value().toInt();
+ int y1 = props["Y1"].value().toInt();
+ int y2 = props["Y2"].value().toInt();
+ int width = props["Width"].value().toInt();
+ //TODO I'm not sure of a good fix for this, but for now I'm assuming lines
+ // in reports are either horizontal or vertical.
+ if ( x1 == x2 )
+ r1 = QRect( x1, y1, x2 + width, y2 );
+ else if ( y1 == y2 )
+ r1 = QRect( x1, y1, x2, y2 + width );
+ }
+ else
+ r1 = QRect( props["X"].value().toInt(), props["Y"].value().toInt(),
+ props["Width"].value().toInt(), props["Height"].value().toInt() );
+
+ if ( item->rtti() == Rtti_Line /*line*/ )
+ {
+ int x1 = item->props["X1"].value().toInt();
+ int x2 = item->props["X2"].value().toInt();
+ int y1 = item->props["Y1"].value().toInt();
+ int y2 = item->props["Y2"].value().toInt();
+ int width = item->props["Width"].value().toInt();
+ //TODO I'm not sure of a good fix for this, but for now I'm assuming lines
+ // in reports are either horizontal or vertical.
+ if ( x1 == x2 )
+ r2 = QRect( x1, y1, x2 + width, y2 );
+ else if ( y1 == y2 )
+ r2 = QRect( x1, y1, x2, y2 + width );
+ }
+ else
+ r2 = QRect( item->props["X"].value().toInt(), item->props["Y"].value().toInt(),
+ item->props["Width"].value().toInt(), item->props["Height"].value().toInt() );
+
+ bool intersects = r1.intersects( r2 );
+
+ if ( intersects )
+ kdDebug(30001) << rttiName( rtti() ) << " " << r1 << "\n"
+ << "...is intersected by..." << "\n"
+ << rttiName( item->rtti() ) << " " << r2
+ << endl;
+
+ return intersects;
+}
+
+QString ReportItem::escape( QString string )
+{
+ string.replace( QRegExp( "&" ), "&amp;" );
+ string.replace( QRegExp( "<" ), "&lt;" );
+ string.replace( QRegExp( ">" ), "&gt;" );
+ return string;
+}
+
+}
diff --git a/kugar/kudesigner_lib/reportitem.h b/kugar/kudesigner_lib/reportitem.h
new file mode 100644
index 00000000..bfee4bd7
--- /dev/null
+++ b/kugar/kudesigner_lib/reportitem.h
@@ -0,0 +1,82 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef REPORTITEM_H
+#define REPORTITEM_H
+
+#include "commdefs.h"
+#include "box.h"
+
+class QString;
+class QStringList;
+
+namespace Kudesigner
+{
+
+class Band;
+
+class ReportItem: public Box
+{
+public:
+ ReportItem( int x, int y, int width, int height, Canvas *canvas )
+ : Box( x, y, width, height, canvas )
+ {
+ setZ( 20 );
+ parentSection = 0;
+ }
+ virtual int rtti() const
+ {
+ return Rtti_ReportItem;
+ }
+
+ virtual void updateGeomProps();
+ virtual void draw( QPainter &painter )
+ {
+ Box::draw( painter );
+ }
+ virtual QString getXml();
+
+ QRect topLeftResizableRect();
+ QRect bottomLeftResizableRect();
+ QRect topRightResizableRect();
+ QRect bottomRightResizableRect();
+ QRect topMiddleResizableRect();
+ QRect bottomMiddleResizableRect();
+ QRect leftMiddleResizableRect();
+ QRect rightMiddleResizableRect();
+
+ virtual Band *section();
+ virtual void setSection( Band *section );
+ virtual void setSectionUndestructive( Band *section );
+
+ virtual int isInHolder( const QPoint p );
+ virtual void drawHolders( QPainter &painter );
+ virtual void fastProperty()
+ { }
+ ;
+ bool intersects( ReportItem *item );
+ QString escape( QString string );
+
+protected:
+ friend class View;
+ Band *parentSection;
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/section.cpp b/kugar/kudesigner_lib/section.cpp
new file mode 100644
index 00000000..1ec5bc59
--- /dev/null
+++ b/kugar/kudesigner_lib/section.cpp
@@ -0,0 +1,37 @@
+/* This file is part of the KDE project
+Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with this library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "section.h"
+
+#include "klocale.h"
+
+namespace Kudesigner
+{
+
+Section::Section( int x, int y, int width, int height, Canvas *canvas )
+ : Box( x, y, width, height, canvas )
+{
+ props.setGroupDescription( "Section", i18n( "Section" ) );
+}
+
+void Section::draw( QPainter &painter )
+{
+ Box::draw( painter );
+}
+
+}
diff --git a/kugar/kudesigner_lib/section.h b/kugar/kudesigner_lib/section.h
new file mode 100644
index 00000000..e321f78f
--- /dev/null
+++ b/kugar/kudesigner_lib/section.h
@@ -0,0 +1,48 @@
+/* This file is part of the KDE project
+Copyright (C) 2003-2004 Alexander Dymo <[email protected]>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public License
+along with this library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef SECTION_H
+#define SECTION_H
+
+#include "commdefs.h"
+#include "box.h"
+
+class QPainter;
+
+namespace Kudesigner
+{
+
+class Section: public Box
+{
+public:
+ Section( int x, int y, int width, int height, Canvas *canvas );
+
+ virtual QString getXml()
+ {
+ return "";
+ }
+ virtual void draw( QPainter &painter );
+ virtual int rtti() const
+ {
+ return Rtti_Section;
+ }
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/specialfield.cpp b/kugar/kudesigner_lib/specialfield.cpp
new file mode 100644
index 00000000..5e404066
--- /dev/null
+++ b/kugar/kudesigner_lib/specialfield.cpp
@@ -0,0 +1,69 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "specialfield.h"
+
+#include <klocale.h>
+
+#include <koproperty/property.h>
+
+namespace Kudesigner
+{
+
+SpecialField::SpecialField( int x, int y, int width, int height, Canvas *canvas )
+ : Label( x, y, width, height, canvas )
+{
+ QMap<QString, QString> m;
+
+ props.setGroupDescription( "SpecialField", i18n( "Special Field" ) );
+
+ m[ i18n( "Date" ) ] = "0";
+ m[ i18n( "PageNumber" ) ] = "1";
+ props.addProperty( new Property( "Type", m.values(), m.keys(), "0", i18n( "Type" ), i18n( "Special Field Type" ) ), "SpecialField" );
+ m.clear();
+
+ m[ i18n( "m/d/y" ) ] = "0";
+ m[ i18n( "m-d-y" ) ] = "1";
+ m[ i18n( "mm/dd/y" ) ] = "2";
+ m[ i18n( "mm-dd-y" ) ] = "3";
+ m[ i18n( "m/d/yyyy" ) ] = "4";
+ m[ i18n( "m-d-yyyy" ) ] = "5";
+ m[ i18n( "mm/dd/yyyy" ) ] = "6";
+ m[ i18n( "mm-dd-yyyy" ) ] = "7";
+ m[ i18n( "yyyy/m/d" ) ] = "8";
+ m[ i18n( "yyyy-m-d" ) ] = "9";
+ m[ i18n( "dd.mm.yy" ) ] = "10";
+ m[ i18n( "dd.mm.yyyy" ) ] = "11";
+ //TODO: make date format not hard-coded, use locale settings
+ props.addProperty( new Property( "DateFormat", m.values(), m.keys(), "11", i18n( "Date Format" ), i18n( "Date Format" ) ), "SpecialField" );
+}
+
+void SpecialField::draw( QPainter &painter )
+{
+ props[ "Text" ].setValue( "[" +
+ QString( props[ "Type" ].value().toInt() ? i18n( "PageNo" ) : i18n( "Date" ) )
+ + "]" );
+ Label::draw( painter );
+}
+
+QString SpecialField::getXml()
+{
+ return "\t\t<Special" + ReportItem::getXml() + " />\n";
+}
+
+}
diff --git a/kugar/kudesigner_lib/specialfield.h b/kugar/kudesigner_lib/specialfield.h
new file mode 100644
index 00000000..d1dd2be6
--- /dev/null
+++ b/kugar/kudesigner_lib/specialfield.h
@@ -0,0 +1,49 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef SPECIALFIELD_H
+#define SPECIALFIELD_H
+
+#include "label.h"
+
+namespace Kudesigner
+{
+
+class SpecialField: public Label
+{
+public:
+ SpecialField( int x, int y, int width, int height, Canvas *canvas );
+
+ virtual int rtti() const
+ {
+ return Rtti_Special;
+ }
+ virtual QString getXml();
+ virtual void draw( QPainter &painter );
+ virtual void updateGeomProps()
+ {
+ Label::updateGeomProps();
+ }
+ virtual void fastProperty()
+ {}
+ ;
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/structurewidget.cpp b/kugar/kudesigner_lib/structurewidget.cpp
new file mode 100644
index 00000000..7f986ffb
--- /dev/null
+++ b/kugar/kudesigner_lib/structurewidget.cpp
@@ -0,0 +1,239 @@
+/***************************************************************************
+* Copyright (C) 2005 by Alexander Dymo *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU Library General Public License as *
+* published by the Free Software Foundation; either version 2 of the *
+* License, or (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU Library General Public *
+* License along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA. *
+***************************************************************************/
+#include "structurewidget.h"
+
+#include <qpainter.h>
+#include <qcanvas.h>
+
+#include <koproperty/property.h>
+
+#include "canvas.h"
+#include "kugartemplate.h"
+#include "reportheader.h"
+#include "reportfooter.h"
+#include "pageheader.h"
+#include "pagefooter.h"
+#include "detail.h"
+#include "detailfooter.h"
+#include "detailheader.h"
+
+#include <kdebug.h>
+
+namespace Kudesigner
+{
+
+using namespace KoProperty;
+
+class StructureItem: public KListViewItem
+{
+public:
+ StructureItem( KListView *parent, const QString &name )
+ : KListViewItem( parent, name ), m_bold( false )
+ {}
+ StructureItem( KListViewItem *parent, const QString &name )
+ : KListViewItem( parent, name ), m_bold( false )
+ {}
+ void setBold( bool b )
+ {
+ m_bold = b;
+ }
+ bool isBold() const
+ {
+ return m_bold;
+ }
+
+ virtual void paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int align )
+ {
+ if ( m_bold )
+ {
+ QFont f = p->font();
+ f.setWeight( 75 );
+ p->setFont( f );
+ }
+ KListViewItem::paintCell( p, cg, column, width, align );
+ }
+
+private:
+ bool m_bold;
+};
+
+StructureWidget::StructureWidget( QWidget* parent, const char* name )
+ : KListView( parent, name )
+{
+ setFullWidth( true );
+ addColumn( tr( "Report Structure" ) );
+ setSorting( -1 );
+ connect( this, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( selectItem( QListViewItem* ) ) );
+}
+
+void StructureWidget::refresh()
+{
+ if ( !m_doc )
+ return ;
+ clear();
+ m_selected.clear();
+
+ StructureItem *root = new StructureItem( this, tr( "Report Template" ) );
+ m_items[ m_doc->kugarTemplate() ] = root;
+ root->setOpen( true );
+
+ refreshSection( m_doc->kugarTemplate() ->reportFooter, root );
+ refreshSection( m_doc->kugarTemplate() ->pageFooter, root );
+
+ for ( std::map<int, DetailBand>::iterator it =
+ m_doc->kugarTemplate() ->details.begin();
+ it != m_doc->kugarTemplate() ->details.end(); ++it )
+ {
+ int level = ( *it ).first;
+ refreshSection( ( *it ).second.first.second, root, level );
+ refreshSection( ( *it ).second.second, root, level );
+ refreshSection( ( *it ).second.first.first, root, level );
+ }
+
+ refreshSection( m_doc->kugarTemplate() ->pageHeader, root );
+ refreshSection( m_doc->kugarTemplate() ->reportHeader, root );
+}
+
+void StructureWidget::refreshSection( Kudesigner::Band *section, StructureItem *root, int level )
+{
+ if ( !section )
+ return ;
+ QString name;
+ switch ( section->rtti() )
+ {
+ case Kudesigner::Rtti_ReportHeader:
+ name = tr( "Report Header" );
+ break;
+ case Kudesigner::Rtti_ReportFooter:
+ name = tr( "Report Footer" );
+ break;
+ case Kudesigner::Rtti_PageFooter:
+ name = tr( "Page Footer" );
+ break;
+ case Kudesigner::Rtti_PageHeader:
+ name = tr( "Page Header" );
+ break;
+ case Kudesigner::Rtti_Detail:
+ name = tr( "Detail" );
+ break;
+ case Kudesigner::Rtti_DetailHeader:
+ name = tr( "Detail Header" );
+ break;
+ case Kudesigner::Rtti_DetailFooter:
+ name = tr( "Detail Footer" );
+ break;
+ }
+ if ( level > 0 )
+ name += tr( " (level %1)" ).arg( level );
+ StructureItem *item = new StructureItem( root, name );
+ m_items[ section ] = item;
+
+ refreshSectionContents( section, item );
+}
+
+void StructureWidget::refreshSectionContents( Kudesigner::Band *section, StructureItem *root )
+{
+ if ( !section )
+ return ;
+
+ for ( QCanvasItemList::iterator it = section->items.begin(); it != section->items.end(); ++it )
+ {
+ Kudesigner::Box *box = static_cast<Kudesigner::Box*>( *it );
+ if ( !box )
+ continue;
+
+ QString name = tr( "<unknown>" );
+ int idx;
+ switch ( box->rtti() )
+ {
+ case Kudesigner::Rtti_Label:
+ name = tr( "Label: %1" ).arg( box->props[ "Text" ].value().toString() );
+ break;
+ case Kudesigner::Rtti_Field:
+ name = tr( "Field: %1" ).arg( box->props[ "Field" ].value().toString() );
+ break;
+ case Kudesigner::Rtti_Calculated:
+ name = tr( "Calculated Field: %1" ).arg( box->props[ "Field" ].value().toString() );
+ break;
+ case Kudesigner::Rtti_Special:
+ idx = box->props[ "Type" ].listData()->keys.findIndex(
+ box->props[ "Type" ].value().toInt() );
+ name = tr( "Special Field: %1" ).arg( box->props[ "Type" ].listData()->keys[ idx ].toString() );
+ break;
+ case Kudesigner::Rtti_Line:
+ name = tr( "Line" );
+ break;
+ }
+
+ StructureItem *item = new StructureItem( root, name );
+ m_items[ box ] = item;
+ }
+}
+
+void StructureWidget::selectionMade()
+{
+ m_selected.clear();
+ BoxList sel = m_doc->selected;
+ for ( BoxList::iterator it = sel.begin(); it != sel.end(); ++it )
+ {
+ if ( m_items.contains( *it ) )
+ {
+ StructureItem * item = static_cast<StructureItem*>( m_items[ *it ] );
+ item->setBold( true );
+ item->repaint();
+ m_selected.append( item );
+ }
+ }
+}
+
+void StructureWidget::selectionClear()
+{
+ for ( QValueList<StructureItem*>::iterator it = m_selected.begin(); it != m_selected.end(); ++it )
+ {
+ if ( ( *it ) == 0 )
+ continue;
+ ( *it ) ->setBold( false );
+ ( *it ) ->repaint();
+ }
+ m_selected.clear();
+}
+
+void StructureWidget::selectItem( QListViewItem *item )
+{
+ if ( !item )
+ return ;
+ int idx = m_items.values().findIndex( static_cast<StructureItem*>( item ) );
+ if ( idx == -1 )
+ return ;
+ Kudesigner::Box *box = m_items.keys() [ idx ];
+ if ( box )
+ m_doc->selectItem( box, false );
+}
+
+void StructureWidget::setDocument( Kudesigner::Canvas *doc )
+{
+ m_doc = doc;
+ m_items.clear();
+}
+
+}
+
+#include "structurewidget.moc"
diff --git a/kugar/kudesigner_lib/structurewidget.h b/kugar/kudesigner_lib/structurewidget.h
new file mode 100644
index 00000000..2601ac1f
--- /dev/null
+++ b/kugar/kudesigner_lib/structurewidget.h
@@ -0,0 +1,62 @@
+/***************************************************************************
+* Copyright (C) 2005 by Alexander Dymo *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU Library General Public License as *
+* published by the Free Software Foundation; either version 2 of the *
+* License, or (at your option) any later version. *
+* *
+* This program is distributed in the hope that it will be useful, *
+* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+* GNU General Public License for more details. *
+* *
+* You should have received a copy of the GNU Library General Public *
+* License along with this program; if not, write to the *
+* Free Software Foundation, Inc., *
+* 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA. *
+***************************************************************************/
+#ifndef KUDESIGNERSTRUCTUREWIDGET_H
+#define KUDESIGNERSTRUCTUREWIDGET_H
+
+#include <klistview.h>
+#include <qmap.h>
+
+class KudesignerDoc;
+
+namespace Kudesigner
+{
+
+class Box;
+class Band;
+class Canvas;
+class StructureItem;
+
+class StructureWidget: public KListView
+{
+ Q_OBJECT
+public:
+ StructureWidget( QWidget* parent = 0, const char* name = 0 );
+
+public slots:
+ void refresh();
+ void selectionMade();
+ void selectionClear();
+
+ void selectItem( QListViewItem *item );
+ void setDocument( Kudesigner::Canvas *doc );
+
+private:
+ void refreshSection( Kudesigner::Band *section, StructureItem *root, int level = -1 );
+ void refreshSectionContents( Kudesigner::Band *section, StructureItem *root );
+
+ Kudesigner::Canvas *m_doc;
+ QMap<Kudesigner::Box*, StructureItem*> m_items;
+ QValueList<StructureItem*> m_selected;
+};
+
+}
+
+#endif
diff --git a/kugar/kudesigner_lib/view.cpp b/kugar/kudesigner_lib/view.cpp
new file mode 100644
index 00000000..b2684ee1
--- /dev/null
+++ b/kugar/kudesigner_lib/view.cpp
@@ -0,0 +1,841 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#include "view.h"
+
+#include <math.h>
+
+#include <qwmatrix.h>
+#include <qevent.h>
+#include <qpoint.h>
+#include <qcanvas.h>
+#include <qaction.h>
+#include <qcursor.h>
+#include <qpainter.h>
+#include <qbitmap.h>
+#include <qimage.h>
+
+#include <qprinter.h>
+#include <kdebug.h>
+
+#include <koproperty/property.h>
+
+#include "canvas.h"
+#include "box.h"
+#include "commdefs.h"
+#include "reportitem.h"
+#include "label.h"
+#include "field.h"
+#include "specialfield.h"
+#include "calcfield.h"
+#include "line.h"
+#include "kugartemplate.h"
+#include "detailbase.h"
+#include "band.h"
+#include "command.h"
+
+#include "plugin.h"
+
+namespace Kudesigner
+{
+
+void SelectionRect::draw( QPainter & painter )
+{
+ // painter.setPen(Qt::NoPen);
+
+ /* QPrinter pr;
+ if ( pr.setup() ) {
+ QPainter p(&pr);
+ m_canvas->drawArea( m_canvas->rect(), &p );
+ } */
+
+ /* kdDebug(31000) << "creating pixmap" << endl;
+ QPixmap mp(rect().size());
+ kdDebug(31000) << "creating painter" << endl;
+ QPainter p(&mp);
+ kdDebug(31000) << "filling pixmap" << endl;
+ m_canvas->drawArea(m_canvas->rect(), &p);
+ kdDebug(31000) << "converting to image" << endl;
+ QImage im = mp.convertToImage();
+ if (!im.isNull())
+ {
+ kdDebug(31000) << "do dither" << endl;
+ mp.convertFromImage(im, Qt::OrderedAlphaDither);
+
+ kdDebug(31000) << "creating brush" << endl;
+ QBrush br(KGlobalSettings::highlightColor(),Qt::CustomPattern);
+ br.setPixmap(mp);
+ painter.setBrush(br);
+ }
+ kdDebug(31000) << "drawing" << endl;*/
+ // painter.drawRect(rect());
+ QPen pen( QColor( 0, 0, 0 ), 0, Qt::DotLine );
+ painter.setPen( pen );
+ painter.setBrush( QBrush( NoBrush ) );
+ painter.drawRect( rect() );
+ // QCanvasRectangle::draw(painter);
+}
+
+
+
+View::View( Canvas *canvas, QWidget *parent, const char *name, WFlags f ) :
+ QCanvasView( canvas, parent, name, f ), selectionBuf( 0 ), m_plugin( 0 ), m_canvas( canvas )
+{
+ itemToInsert = 0;
+ moving = 0;
+ resizing = 0;
+ selectionStarted = 0;
+ request = RequestNone;
+
+ selectionRect = new SelectionRect( 0, 0, 0, 0, canvas );
+
+ connect( m_canvas, SIGNAL( itemSelected() ), this, SLOT( selectItem() ) );
+}
+
+void View::deleteItem( QCanvasItemList &l )
+{
+ for ( QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it )
+ {
+ m_canvas->unselectItem( static_cast<Kudesigner::Box*>( *it ) );
+ if ( m_canvas->kugarTemplate() ->removeReportItem( *it ) )
+ break;
+ }
+}
+
+void View::editItem( QCanvasItemList & /* l */ )
+{
+ //display editor for report items or sections
+ /* for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it)
+ {
+ if ((*it)->rtti() >= 1800) //for my own report items
+ {
+ CanvasKudesigner::Box *l = (CanvasKudesigner::Box*)(*it);
+ dlgItemOptions *dlgOpts = new dlgItemOptions(&(l->props), this);
+ dlgOpts->exec();
+ delete dlgOpts;
+ if ((*it)->rtti() == KugarTemplate)
+ ((CanvasKugarTemplate*)(*it))->updatePaperProps();
+ (*it)->hide();
+ (*it)->show();
+ if ((*it)->rtti() < 2000)
+ ((MyCanvas *)(m_canvas))->templ->arrangeSections();
+ m_canvas->update();
+ emit modificationPerformed();
+ break;
+ }
+ }*/
+}
+
+void View::selectItemFromList( QCanvasItemList &l )
+{
+ //display editor for report items or sections
+ for ( QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it )
+ {
+ if ( ( *it ) ->rtti() >= 1800 ) //include bands and the template itself
+ {
+ Kudesigner::Box * b = static_cast<Kudesigner::Box*>( *it );
+ if ( !m_canvas->selected.contains( b ) )
+ {
+ m_canvas->unselectAll();
+ m_canvas->selectItem( b, false );
+ m_canvas->update();
+ // qWarning("selected item set");
+ // selected->drawHolders();
+ return ;
+ }
+ if ( m_canvas->selected.contains( b ) )
+ {
+ if ( m_canvas->selected.count() > 1 )
+ {
+ m_canvas->unselectAll();
+ m_canvas->selectItem( b, false );
+ m_canvas->update();
+ }
+ return ;
+ }
+ }
+ }
+ m_canvas->unselectAll();
+ // qWarning("unselect");
+}
+
+
+void View::placeItem( QCanvasItemList &l, QMouseEvent *e )
+{
+ for ( QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it )
+ {
+ if ( ( ( *it ) ->rtti() > 1800 ) && ( ( ( *it ) ->rtti() < 2000 ) ) )
+ {
+ int band = ( *it ) ->rtti();
+ int bandLevel = -1;
+ if ( ( band == Rtti_DetailHeader ) ||
+ ( band == Rtti_Detail ) ||
+ ( band == Rtti_DetailFooter ) )
+ bandLevel = static_cast<DetailBase*>( *it ) ->level();
+ emit itemPlaced( e->x(), e->y(), band, bandLevel );
+
+ // emit modificationPerformed();
+ }
+ }
+ itemToInsert = 0;
+ emit selectedActionProcessed();
+}
+
+
+bool View::startResizing( QMouseEvent * /*e*/, QPoint &p )
+{
+ if ( m_canvas->selected.count() == 0 )
+ return false;
+ for ( BoxList::iterator it = m_canvas->selected.begin();
+ it != m_canvas->selected.end(); ++it )
+ {
+ Kudesigner::Box *cbx = *it;
+ resizing_type = cbx->isInHolder( p );
+ /* qWarning("POINT: %d %d", p.x(), p.y());
+ qWarning("RESIZE: %d", resizing_type);*/
+ if ( resizing_type )
+ {
+ m_canvas->selectItem( cbx, false );
+ //kdDebug()<<"A Widget should be resized"<<endl;
+ moving = 0;
+ resizing = cbx;
+ moving_start = p;
+ moving_offsetX = 0;
+ moving_offsetY = 0;
+
+ if ( cbx->rtti() > 2001 )
+ {
+ ReportItem * item = static_cast<ReportItem*>( cbx );
+ resizing_constraint.setX( ( int ) item->section() ->x() );
+ resizing_constraint.setY( ( int ) item->section() ->y() );
+ resizing_constraint.setWidth( item->section() ->width() );
+ resizing_constraint.setHeight(
+ item->section() ->height() );
+ if ( cbx->rtti() != Rtti_Line )
+ {
+ resizing_minSize.setWidth( 10 );
+ resizing_minSize.setHeight( 10 );
+ }
+ else
+ {
+ resizing_minSize.setWidth( 0 );
+ resizing_minSize.setHeight( 0 );
+ }
+ }
+ else
+ if ( cbx->rtti() >= Rtti_ReportHeader )
+ {
+ resizing_constraint = QRect( 0, 0, 1000, 1000 );
+ resizing_minSize.setWidth( 0 );
+ resizing_minSize.setHeight( static_cast<Band*>( cbx ) ->minHeight() );
+ }
+ else
+ {
+ resizing_constraint = QRect( 0, 0, 1000, 1000 );
+ resizing_minSize.setWidth( 0 );
+ resizing_minSize.setHeight( 10 );
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+void View::startMoveOrResizeOrSelectItem( QCanvasItemList &l,
+ QMouseEvent * /*e*/, QPoint &p )
+{
+ //allow user to move any item except for page rectangle
+ for ( QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it )
+ {
+ Kudesigner::Box *cb = static_cast<Kudesigner::Box*>( *it );
+ if ( cb->rtti() >= 1700 ) //> 2001)
+ {
+ moving_start = p;
+ moving_offsetX = 0;
+ moving_offsetY = 0;
+ resizing_type = cb->isInHolder( p );
+ if ( ( *it ) ->rtti() > 2001 )
+ {
+ ReportItem * item = static_cast<ReportItem*>( *it );
+ moving = item;
+ resizing = 0;
+ return ;
+ }
+ }
+ }
+ moving = 0;
+ resizing = 0;
+ // qWarning("1");
+ selectionStarted = 1;
+ selectionRect->setX( p.x() );
+ selectionRect->setY( p.y() );
+ selectionRect->setZ( 50 );
+ // qWarning("2");
+ selectionRect->show();
+ // qWarning("3");
+}
+
+void View::contentsMousePressEvent( QMouseEvent* e )
+{
+ QPoint p = inverseWorldMatrix().QWMatrix::map( e->pos() );
+ QCanvasItemList l = m_canvas->collisions( p );
+
+ //if there is a request for properties or for delete operation
+ //perform that and do not take care about mouse buttons
+
+ // qWarning("mouse press");
+
+ switch ( request )
+ {
+ case RequestProps:
+ clearRequest();
+ editItem( l );
+ return ;
+ case RequestDelete:
+ deleteItem( l );
+ clearRequest();
+ return ;
+ case RequestNone:
+ break;
+ }
+
+ moving = 0;
+ resizing = 0;
+ selectionStarted = 0;
+
+
+
+ /* Kudesigner::Box *b;
+ qWarning("Selected items:");
+ for (b = selected.first(); b; b = selected.next())
+ qWarning("%s", b->props["Text"].first.latin1());
+
+ */
+ switch ( e->button() )
+ {
+ case LeftButton:
+ if ( itemToInsert )
+ {
+ // qWarning("placing item");
+ m_canvas->unselectAll();
+ placeItem( l, e );
+ }
+ else
+ {
+ // qWarning("starting move or resize");
+ if ( !startResizing( e, p ) )
+ {
+ selectItemFromList( l );
+ startMoveOrResizeOrSelectItem( l, e, p );
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void View::contentsMouseReleaseEvent( QMouseEvent* e )
+{
+ selectionRect->setSize( 0, 0 );
+ selectionRect->setX( 0 );
+ selectionRect->setY( 0 );
+ selectionRect->hide();
+
+ QPoint p = inverseWorldMatrix().QWMatrix::map( e->pos() );
+ QCanvasItemList l = m_canvas->collisions( p );
+
+ switch ( e->button() )
+ {
+ case LeftButton:
+ if ( selectionStarted )
+ finishSelection();
+ break;
+ /* case MidButton:
+ deleteItem(l);
+ break;
+ case RightButton:
+ editItem(l);
+ break;*/
+ default:
+ break;
+ }
+}
+
+
+void View::fixMinValues( double &pos, double minv, double &offset )
+{
+ if ( pos < minv )
+ {
+ offset = offset + pos - minv;
+ pos = minv;
+ }
+ else
+ {
+ if ( offset < 0 )
+ {
+ offset = offset + pos - minv;
+ if ( offset < 0 )
+ pos = minv;
+ else
+ {
+ pos = offset + minv;
+ offset = 0;
+ }
+ }
+ }
+}
+
+void View::fixMaxValues( double &pos, double size, double maxv, double &offset )
+{
+ double tmpMax = pos + size;
+ if ( tmpMax > maxv )
+ {
+ offset = offset + tmpMax - maxv;
+ pos = maxv - size;
+ }
+ else
+ {
+ if ( offset > 0 )
+ {
+ offset = offset + tmpMax - maxv;
+ if ( offset > 0 )
+ pos = maxv - size;
+ else
+ {
+ pos = offset + maxv - size;
+ offset = 0;
+ }
+ }
+ }
+}
+
+#ifdef Q_WS_WIN
+double rint( double x )
+{
+ if ( fabs( x - floor( x ) ) < fabs( x - ceil( x ) ) )
+ return floor( x );
+ else
+ return ceil( x );
+}
+#endif
+
+void View::stickToGrid( double &x, double &y )
+{
+ int cx = int( rint( x / Config::gridSize() ) );
+ int cy = int( rint( y / Config::gridSize() ) );
+ x = cx * Config::gridSize();
+ y = cy * Config::gridSize();
+}
+
+void View::stickDimToGrid( double x, double y, double &w, double &h )
+{
+ int rightX = int( x + w );
+ int bottomY = int( y + h );
+ int nx = int( rint( rightX /Config::gridSize() ) * Config::gridSize() );
+ int ny = int( rint( bottomY / Config::gridSize() ) * Config::gridSize() );
+ w = nx - x;
+ h = ny - y;
+}
+
+void View::contentsMouseMoveEvent( QMouseEvent* e )
+{
+ QPoint p = inverseWorldMatrix().map( e->pos() );
+
+ /* QCanvasItemList l=m_canvas->collisions(p);
+ setCursor(QCursor(Qt::ArrowCursor));
+ unsetCursor();
+ for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it)
+ {
+ if ((*it)->rtti() > 2000)
+ {
+ CanvasReportItem *item = (CanvasReportItem*)(*it);
+ if (item->bottomRightResizableRect().contains(e->pos()))
+ setCursor(QCursor(Qt::SizeFDiagCursor));
+ }
+ }*/
+
+ if ( moving )
+ {
+ double newXPos = moving->x() + p.x() - moving_start.x();
+ double newYPos = moving->y() + p.y() - moving_start.y();
+ fixMinValues( newYPos, moving->parentSection->y(), moving_offsetY );
+ fixMinValues( newXPos, moving->parentSection->x(), moving_offsetX );
+ fixMaxValues( newYPos, moving->height(), moving->parentSection->y() + moving->parentSection->height(), moving_offsetY );
+ fixMaxValues( newXPos, moving->width(), moving->parentSection->x() + moving->parentSection->width(), moving_offsetX );
+
+ double sx = newXPos;
+ double sy = newYPos;
+ if ( Config::gridSize() > 1 )
+ stickToGrid( newXPos, newYPos );
+
+ moving->move( newXPos, newYPos );
+
+ /* attempt to prevent item collisions
+ QCanvasItemList l=m_canvas->collisions(moving->rect());
+ if (l.count() > 2)
+ {
+ moving->moveBy(-(p.x() - moving_start.x()),
+ -(p.y() - moving_start.y()));
+ m_canvas->update();
+ return;
+ }*/
+ // moving_start = p;
+ moving_start = QPoint( p.x() + ( int ) ( newXPos - sx ), p.y() + ( int ) ( newYPos - sy ) );
+ moving->updateGeomProps();
+ m_canvas->update();
+ emit modificationPerformed();
+ }
+ if ( resizing )
+ {
+ QCanvasRectangle * r = ( QCanvasRectangle * ) resizing;
+ double newXPos = r->x();
+ double newYPos = r->y();
+ double h = r->height();
+ double w = r->width();
+ // kdDebug()<<"resizing"<<endl;
+
+ //vertical resizing
+ if ( resizing_type & Kudesigner::Box::ResizeBottom )
+ {
+ // kdDebug()<<"Resize bottom"<<endl;
+ h = h + p.y() - moving_start.y();
+ fixMaxValues( h, r->y(), resizing_constraint.bottom(), moving_offsetY );
+ if ( resizing->rtti() != Rtti_Line )
+ fixMinValues( h, resizing_minSize.height(), moving_offsetY );
+ }
+ else
+ if ( resizing_type & Kudesigner::Box::ResizeTop )
+ {
+ // kdDebug()<<"Resize top"<<endl;
+ newYPos = r->y() + p.y() - moving_start.y();
+ fixMinValues( newYPos, resizing_constraint.top(), moving_offsetY );
+ if ( resizing->rtti() != Rtti_Line )
+ fixMaxValues( newYPos, resizing_minSize.height(), r->y() + r->height(), moving_offsetY );
+ h = h + ( r->y() - newYPos );
+ }
+
+
+ //horizontal resizing
+ if ( resizing_type & Kudesigner::Box::ResizeRight )
+ {
+ //kdDebug()<<"Resize right"<<endl;
+ w = w + p.x() - moving_start.x();
+ fixMaxValues( w, r->x(), resizing_constraint.right(), moving_offsetX );
+ if ( resizing->rtti() != Rtti_Line )
+ fixMinValues( w, resizing_minSize.width(), moving_offsetX );
+ }
+ else
+ if ( resizing_type & Kudesigner::Box::ResizeLeft )
+ {
+ // kdDebug()<<"Resize left"<<endl;
+ newXPos = r->x() + p.x() - moving_start.x();
+ fixMinValues( newXPos, resizing_constraint.left(), moving_offsetX );
+ if ( resizing->rtti() != Rtti_Line )
+ fixMaxValues( newXPos, resizing_minSize.width(), r->x() + r->width(), moving_offsetX );
+ w = w + ( r->x() - newXPos );
+ }
+
+ //sticky stuff
+ double sx = newXPos;
+ double sy = newYPos;
+ if ( Config::gridSize() > 1 )
+ stickToGrid( newXPos, newYPos );
+
+ r->move( newXPos, newYPos );
+
+ int dx = ( int ) ( newXPos - sx );
+ int dy = ( int ) ( newYPos - sy );
+ // moving_start = QPoint(p.x() + dx, p.y() + dy);
+ w -= dx;
+ h -= dy;
+ // moving_start = p;
+
+ double sw = w;
+ double sh = h;
+ stickDimToGrid( newXPos, newYPos, w, h );
+ int dw = ( int ) ( w - sw );
+ int dh = ( int ) ( h - sh );
+
+ moving_start = QPoint( p.x() + dx + dw, p.y() + dy + dh );
+
+ r->setSize( ( int ) w, ( int ) h );
+ resizing->updateGeomProps();
+ m_canvas->update();
+ emit modificationPerformed();
+ }
+ if ( selectionStarted )
+ {
+ selectionRect->setSize( ( int ) ( e->pos().x() - selectionRect->x() ),
+ ( int ) ( e->pos().y() - selectionRect->y() ) );
+ m_canvas->unselectAll();
+ QCanvasItemList l = m_canvas->collisions( selectionRect->rect() );
+ for ( QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it )
+ {
+ QRect r;
+ int left = selectionRect->rect().left();
+ int right = selectionRect->rect().right();
+ int top = selectionRect->rect().top();
+ int bottom = selectionRect->rect().bottom();
+ r.setLeft( left < right ? left : right );
+ r.setRight( left < right ? right : left );
+ r.setTop( top < bottom ? top : bottom );
+ r.setBottom( top < bottom ? bottom : top );
+
+ if ( ( ( *it ) ->rtti() > 2001 ) &&
+ ( r.contains( static_cast<Kudesigner::Box*>( *it ) ->rect() ) ) )
+ {
+ m_canvas->selectItem( static_cast<Kudesigner::Box*>( *it ) );
+ m_canvas->update();
+ }
+ }
+
+
+ /* selectionRect->setSize(e->pos().x() - selectionRect->x(),
+ e->pos().y() - selectionRect->y());
+ unselectAll();
+ QCanvasItemList l = m_canvas->collisions(selectionRect->rect());
+ for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it)
+ {
+ if ( ((*it)->rtti() > 2001) &&
+ (selectionRect->rect().contains(((CanvasKudesigner::Box*)(*it))->rect())) )
+ {
+ selectItem((CanvasKudesigner::Box*)(*it));
+ m_canvas->update();
+ }
+ }*/
+ }
+}
+
+
+void View::contentsMouseDoubleClickEvent( QMouseEvent *e )
+{
+ ReportItem * item = 0L;
+ if ( e->button() == Qt::LeftButton && m_canvas->selected.count() == 1 )
+ item = dynamic_cast<ReportItem*>( m_canvas->selected.first() );
+ if ( item )
+ {
+ item->fastProperty();
+ emit changed();
+ item->hide();
+ item->show();
+ }
+}
+
+void View::setRequest( RequestType r )
+{
+ switch ( r )
+ {
+ case RequestProps:
+ QApplication::restoreOverrideCursor();
+ QApplication::setOverrideCursor( Qt::PointingHandCursor );
+ break;
+ case RequestDelete:
+ QApplication::restoreOverrideCursor();
+ QApplication::setOverrideCursor( Qt::ForbiddenCursor );
+ break;
+ case RequestNone:
+ QApplication::restoreOverrideCursor();
+ break;
+ }
+ request = r;
+}
+
+void View::clearRequest()
+{
+ QApplication::restoreOverrideCursor();
+ request = RequestNone;
+ emit selectedEditActionProcessed();
+}
+
+bool View::requested()
+{
+ if ( request == RequestNone )
+ return false;
+ else
+ return true;
+}
+
+void View::updateProperty()
+{
+ for ( Kudesigner::BoxList::iterator it = m_canvas->selected.begin();
+ it != m_canvas->selected.end(); ++it )
+ {
+ Kudesigner::Box *b = *it;
+ // b->props[name]->setValue(value);
+ b->hide();
+ b->show();
+ if ( ( b->rtti() >= 1800 ) && ( b->rtti() < 2000 ) )
+ m_canvas->kugarTemplate() ->arrangeSections();
+ }
+}
+
+
+void View::finishSelection()
+{
+ selectionStarted = false;
+
+ if ( !m_canvas->selected.isEmpty() )
+ {
+ Kudesigner::BoxList::const_iterator it = m_canvas->selected.begin();
+ Kudesigner::Box *b = *it;
+ Buffer *buf = new Buffer( &( b->props ) );
+ ++it;
+ // qWarning("== %d", m_canvas->selected.count());
+ // Kudesigner::BoxList::const_iterator it2 = m_canvas->selected.end();
+ // qWarning("41: %d", it != it2);
+ for ( ; it != m_canvas->selected.end(); ++it )
+ {
+ b = *it;
+ buf->intersect( &( b->props ) );
+ }
+ emit selectionClear();
+ // delete selectionBuf;
+ selectionBuf = buf;
+ emit selectionMade( selectionBuf );
+ }
+}
+
+void View::setPlugin( KuDesignerPlugin *plugin )
+{
+ m_plugin = plugin;
+}
+
+void View::contentsDragMoveEvent( QDragMoveEvent * event )
+{
+ //perhaps this could be optimized a little bit
+ if ( !m_plugin )
+ return ;
+ QCanvasItemList l = m_canvas->collisions( event->pos() );
+ /* kdDebug()<<l.count()<<endl;*/
+ if ( l.count() < 2 )
+ {
+ event->ignore();
+ return ;
+ }
+ Kudesigner::Box *b = static_cast<Kudesigner::Box*>( *( l.begin() ) );
+ event->accept();
+ if ( m_plugin->dragMove( event, b ) )
+ event->accept();
+ else
+ event->ignore();
+}
+
+void View::contentsDragEnterEvent ( QDragEnterEvent * /*event*/ )
+{
+ // event->accept();
+}
+
+void View::keyPressEvent( QKeyEvent *e )
+{
+ kdDebug(31000) << k_funcinfo << endl;
+
+ if ( m_canvas->selected.count() == 1 )
+ {
+ ReportItem * item = static_cast<ReportItem *>( m_canvas->selected.first() );
+
+ switch ( e->key() )
+ {
+ case Qt::Key_Delete:
+ kdDebug(31000) << "Deleting selection" << endl;
+ /* unselectItem(item);
+ ( (MyCanvas*) m_canvas )->templ->removeReportItem( item );
+ clearRequest();*/
+ // deleteSelected();
+ //FIXME: this disregards undo/redo
+ if ( m_canvas->selected.count() > 0 )
+ {
+ emit selectionClear();
+ DeleteReportItemsCommand *cmd = new DeleteReportItemsCommand( m_canvas,
+ m_canvas->selected );
+ cmd->execute();
+ delete cmd;
+ }
+ return ;
+
+ /* Adjust height with - and + */
+ case Qt::Key_Minus:
+ case Qt::Key_Plus:
+ {
+ int size = item->props[ "FontSize" ].value().toInt();
+
+ if ( e->key() == Qt::Key_Minus )
+ size--;
+ else
+ size++;
+
+ if ( size < 5 )
+ size = 5;
+
+ if ( size > 50 )
+ size = 50;
+
+ item->props[ "FontSize" ].setValue( size );
+ item->hide();
+ item->show();
+ return ;
+ }
+
+ default:
+ e->ignore();
+ }
+
+ }
+}
+
+void View::selectItem( )
+{
+ if ( !selectionStarted )
+ finishSelection();
+}
+
+/*void View::deleteSelected( )
+{
+ CanvasKudesigner::Box *b;
+
+ QPtrList<CanvasKudesigner::Box> list = m_canvas->selected;
+ unselectAll();
+
+ for (b = list.first(); b; b = list.next())
+ {
+ ( (MyCanvas*) m_canvas )->templ->removeReportItem( b );
+ }
+}
+*/
+
+void View::setCanvas( Canvas *canvas )
+{
+ if ( selectionRect )
+ delete selectionRect;
+ QCanvasView::setCanvas( ( QCanvas* ) canvas );
+ m_canvas = canvas;
+ selectionRect = new SelectionRect( 0, 0, 0, 0, m_canvas );
+ connect( m_canvas, SIGNAL( itemSelected() ), this, SLOT( selectItem() ) );
+ clearRequest();
+}
+
+void View::setGridSize( int size )
+{
+ Config::setGridSize( size );
+ m_canvas->setChanged( m_canvas->rect() );
+ m_canvas->update();
+}
+
+}
+
+#include "view.moc"
diff --git a/kugar/kudesigner_lib/view.h b/kugar/kudesigner_lib/view.h
new file mode 100644
index 00000000..8ca5a9d4
--- /dev/null
+++ b/kugar/kudesigner_lib/view.h
@@ -0,0 +1,149 @@
+/* This file is part of the KDE project
+ Copyright (C) 2002-2004 Alexander Dymo <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+#ifndef VIEW_H
+#define VIEW_H
+
+#include <qcanvas.h>
+#include <qpainter.h>
+#include <qptrlist.h>
+
+#include <koproperty/property.h>
+
+class KuDesignerPlugin;
+
+class QMouseEvent;
+class QCanvasItemList;
+
+namespace KoProperty
+{
+class Buffer;
+}
+
+using namespace KoProperty;
+
+namespace Kudesigner
+{
+
+class ReportItem;
+class Box;
+class Canvas;
+class Band;
+
+class SelectionRect: public QCanvasRectangle
+{
+public:
+ SelectionRect( int x, int y, int width, int height, Canvas *canvas ) :
+ QCanvasRectangle( x, y, width, height, ( QCanvas* ) canvas )
+ {}
+
+ virtual void draw( QPainter & painter );
+};
+
+class View: public QCanvasView
+{
+ Q_OBJECT
+public:
+ View( Canvas *canvas, QWidget *parent, const char *name = 0, WFlags f = 0 );
+
+ int itemToInsert;
+
+ enum RequestType {RequestNone = 0, RequestProps, RequestDelete};
+
+ void setRequest( RequestType r );
+ void clearRequest();
+ bool requested();
+
+ void finishSelection();
+
+ void setPlugin( KuDesignerPlugin *plugin );
+
+ void setCanvas( Canvas *canvas );
+
+protected:
+ void contentsMousePressEvent( QMouseEvent* );
+ void contentsMouseReleaseEvent( QMouseEvent* );
+ void contentsMouseMoveEvent( QMouseEvent* );
+ void contentsMouseDoubleClickEvent( QMouseEvent * );
+
+ void contentsDragEnterEvent ( QDragEnterEvent * );
+ void contentsDragMoveEvent ( QDragMoveEvent * );
+ // void contentsDragLeaveEvent ( QDragLeaveEvent * );
+ // void contentsDropEvent ( QDropEvent * );
+ void keyPressEvent( QKeyEvent * );
+
+ void startMoveOrResizeOrSelectItem( QCanvasItemList &l, QMouseEvent *e, QPoint &p );
+ bool startResizing( QMouseEvent *e, QPoint &p );
+ void placeItem( QCanvasItemList &l, QMouseEvent *e );
+ void editItem( QCanvasItemList &l );
+ void deleteItem( QCanvasItemList &l );
+ void selectItemFromList( QCanvasItemList &l );
+
+ void stickToGrid( double &x, double &y );
+ void stickDimToGrid( double x, double y, double &X, double &Y );
+
+private:
+ Buffer *selectionBuf;
+
+ ReportItem *moving;
+ QPoint moving_start;
+ double moving_offsetY;
+ double moving_offsetX;
+ QRect resizing_constraint;
+ QSize resizing_minSize;
+ int resizing_type;
+ class Box *resizing;
+ bool selectionStarted;
+
+ KuDesignerPlugin *m_plugin;
+
+ SelectionRect *selectionRect;
+
+ RequestType request;
+
+ Canvas *m_canvas;
+
+ void fixMinValues( double &pos, double minv, double &offset );
+ void fixMaxValues( double &pos, double size, double maxv, double &offset );
+
+signals: // Signals
+ /** Emitted when user clicks on the canvas, so a button
+ or a menu item assosiated with the selected item should
+ be unchecked. */
+ void selectedActionProcessed();
+ void selectedEditActionProcessed();
+ void modificationPerformed();
+
+ /** Emitted when selection is made, so that property editor can display properties
+ for the selected items. */
+ void selectionMade( Buffer *buf );
+ void selectionClear();
+ void changed();
+
+ void itemPlaced( int x, int y, int band, int bandLevel );
+
+public slots:
+ void updateProperty();
+
+ void selectItem();
+ void setGridSize( int size );
+};
+
+}
+
+#endif
diff --git a/kugar/lib/Makefile.am b/kugar/lib/Makefile.am
new file mode 100644
index 00000000..e6c2af0f
--- /dev/null
+++ b/kugar/lib/Makefile.am
@@ -0,0 +1,19 @@
+INCLUDES = $(KOFFICE_INCLUDES) $(all_includes)
+
+METASOURCES = AUTO
+
+libkugarlib_la_LIBADD = $(LIB_QT) $(LIB_KDEPRINT)
+
+libkugarlib_la_LDFLAGS = $(all_libraries) -version-info 1:2 -no-undefined
+
+# libkugar.la is already reserved for the kdeinit module for kugar (on some platforms),
+# so we have to call the lib differently, e.g. libkugarlib
+lib_LTLIBRARIES = libkugarlib.la
+
+libkugarlib_la_SOURCES = mcalcobject.cpp mfieldobject.cpp mlabelobject.cpp \
+ mlineobject.cpp mpagecollection.cpp mpagedisplay.cpp mreportdetail.cpp \
+ mreportengine.cpp mreportobject.cpp mreportsection.cpp mreportviewer.cpp \
+ mspecialobject.cpp mutil.cpp inputmask.cpp
+
+include_HEADERS =
+noinst_HEADERS = inputmask.h
diff --git a/kugar/lib/inputmask.cpp b/kugar/lib/inputmask.cpp
new file mode 100644
index 00000000..75a72f61
--- /dev/null
+++ b/kugar/lib/inputmask.cpp
@@ -0,0 +1,359 @@
+/***************************************************************************
+* Copyright (C) 2005 by Adam Treat *
+* *
+* Copyright (C) 2000 Trolltech AS. All rights reserved. *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU Library General Public License as *
+* published by the Free Software Foundation; either version 2 of the *
+* License, or (at your option) any later version. *
+* *
+***************************************************************************/
+
+#include "inputmask.h"
+
+namespace Kugar
+{
+
+InputMask::InputMask( QObject *parent, const char *name )
+ : QObject( parent, name ),
+ m_text( QString::null ),
+ m_maxLength( 32767 ),
+ m_blank( ' ' ),
+ m_mask( QString::null ),
+ m_maskData( 0L )
+{}
+
+InputMask::~InputMask()
+{
+ delete [] m_maskData;
+}
+
+QString InputMask::mask() const
+{
+ return ( m_maskData ? m_mask + ';' + m_blank : QString::null );
+}
+
+void InputMask::setMask( const QString &mask )
+{
+ parseInputMask( mask );
+}
+
+QString InputMask::formatText( const QString &txt )
+{
+ return maskString( 0, txt, true );
+}
+
+void InputMask::parseInputMask( const QString &maskFields )
+{
+ if ( maskFields.isEmpty() || maskFields.section( ';', 0, 0 ).isEmpty() )
+ {
+ if ( m_maskData )
+ {
+ delete [] m_maskData;
+ m_maskData = 0;
+ m_maxLength = 32767;
+ }
+ return ;
+ }
+
+ m_mask = maskFields.section( ';', 0, 0 );
+ m_blank = maskFields.section( ';', 1, 1 ).at( 0 );
+ if ( m_blank.isNull() )
+ m_blank = ' ';
+
+ // calculate m_maxLength / m_maskData length
+ m_maxLength = 0;
+ QChar c = 0;
+ uint i;
+ for ( i = 0; i < m_mask.length(); i++ )
+ {
+ c = m_mask.at( i );
+ if ( i > 0 && m_mask.at( i - 1 ) == '\\' )
+ {
+ m_maxLength++;
+ continue;
+ }
+ if ( c != '\\' && c != '!' &&
+ c != '<' && c != '>' &&
+ c != '{' && c != '}' &&
+ c != '[' && c != ']' )
+ m_maxLength++;
+ }
+
+ delete [] m_maskData;
+ m_maskData = new MaskInputData[ m_maxLength ];
+
+ MaskInputData::Casemode m = MaskInputData::NoCaseMode;
+ c = 0;
+ bool s;
+ bool escape = FALSE;
+ int index = 0;
+ for ( i = 0; i < m_mask.length(); i++ )
+ {
+ c = m_mask.at( i );
+ if ( escape )
+ {
+ s = TRUE;
+ m_maskData[ index ].maskChar = c;
+ m_maskData[ index ].separator = s;
+ m_maskData[ index ].caseMode = m;
+ index++;
+ escape = FALSE;
+ }
+ else if ( c == '<' || c == '>' || c == '!' )
+ {
+ switch ( c )
+ {
+ case '<':
+ m = MaskInputData::Lower;
+ break;
+ case '>':
+ m = MaskInputData::Upper;
+ break;
+ case '!':
+ m = MaskInputData::NoCaseMode;
+ break;
+ }
+ }
+ else if ( c != '{' && c != '}' && c != '[' && c != ']' )
+ {
+ switch ( c )
+ {
+ case 'A':
+ case 'a':
+ case 'N':
+ case 'n':
+ case 'X':
+ case 'x':
+ case '9':
+ case '0':
+ case 'D':
+ case 'd':
+ case '#':
+ s = FALSE;
+ break;
+ case '\\':
+ escape = TRUE;
+ default:
+ s = TRUE;
+ break;
+ }
+
+ if ( !escape )
+ {
+ m_maskData[ index ].maskChar = c;
+ m_maskData[ index ].separator = s;
+ m_maskData[ index ].caseMode = m;
+ index++;
+ }
+ }
+ }
+}
+
+bool InputMask::isValidInput( QChar key, QChar mask ) const
+{
+ switch ( mask )
+ {
+ case 'A':
+ if ( key.isLetter() && key != m_blank )
+ return TRUE;
+ break;
+ case 'a':
+ if ( key.isLetter() || key == m_blank )
+ return TRUE;
+ break;
+ case 'N':
+ if ( key.isLetterOrNumber() && key != m_blank )
+ return TRUE;
+ break;
+ case 'n':
+ if ( key.isLetterOrNumber() || key == m_blank )
+ return TRUE;
+ break;
+ case 'X':
+ if ( key.isPrint() && key != m_blank )
+ return TRUE;
+ break;
+ case 'x':
+ if ( key.isPrint() || key == m_blank )
+ return TRUE;
+ break;
+ case '9':
+ if ( key.isNumber() && key != m_blank )
+ return TRUE;
+ break;
+ case '0':
+ if ( key.isNumber() || key == m_blank )
+ return TRUE;
+ break;
+ case 'D':
+ if ( key.isNumber() && key.digitValue() > 0 && key != m_blank )
+ return TRUE;
+ break;
+ case 'd':
+ if ( ( key.isNumber() && key.digitValue() > 0 ) || key == m_blank )
+ return TRUE;
+ break;
+ case '#':
+ if ( key.isNumber() || key == '+' || key == '-' || key == m_blank )
+ return TRUE;
+ break;
+ default:
+ break;
+ }
+ return FALSE;
+}
+
+QString InputMask::maskString( uint pos, const QString &str, bool clear ) const
+{
+ if ( pos >= ( uint ) m_maxLength )
+ return QString::fromLatin1( "" );
+
+ QString fill;
+ fill = clear ? clearString( 0, m_maxLength ) : m_text;
+
+ uint strIndex = 0;
+ QString s = QString::fromLatin1( "" );
+ int i = pos;
+ while ( i < m_maxLength )
+ {
+ if ( strIndex < str.length() )
+ {
+ if ( m_maskData[ i ].separator )
+ {
+ s += m_maskData[ i ].maskChar;
+ if ( str[ ( int ) strIndex ] == m_maskData[ i ].maskChar )
+ strIndex++;
+ ++i;
+ }
+ else
+ {
+ if ( isValidInput( str[ ( int ) strIndex ], m_maskData[ i ].maskChar ) )
+ {
+ switch ( m_maskData[ i ].caseMode )
+ {
+ case MaskInputData::Upper:
+ s += str[ ( int ) strIndex ].upper();
+ break;
+ case MaskInputData::Lower:
+ s += str[ ( int ) strIndex ].lower();
+ break;
+ default:
+ s += str[ ( int ) strIndex ];
+ }
+ ++i;
+ }
+ else
+ {
+ // search for separator first
+ int n = findInMask( i, TRUE, TRUE, str[ ( int ) strIndex ] );
+ if ( n != -1 )
+ {
+ if ( str.length() != 1 || i == 0 || ( i > 0 && ( !m_maskData[ i - 1 ].separator || m_maskData[ i - 1 ].maskChar != str[ ( int ) strIndex ] ) ) )
+ {
+ s += fill.mid( i, n - i + 1 );
+ i = n + 1; // update i to find + 1
+ }
+ }
+ else
+ {
+ // search for valid m_blank if not
+ n = findInMask( i, TRUE, FALSE, str[ ( int ) strIndex ] );
+ if ( n != -1 )
+ {
+ s += fill.mid( i, n - i );
+ switch ( m_maskData[ n ].caseMode )
+ {
+ case MaskInputData::Upper:
+ s += str[ ( int ) strIndex ].upper();
+ break;
+ case MaskInputData::Lower:
+ s += str[ ( int ) strIndex ].lower();
+ break;
+ default:
+ s += str[ ( int ) strIndex ];
+ }
+ i = n + 1; // updates i to find + 1
+ }
+ }
+ }
+ strIndex++;
+ }
+ }
+ else
+ break;
+ }
+
+ return s;
+}
+
+QString InputMask::clearString( uint pos, uint len ) const
+{
+ if ( pos >= ( uint ) m_maxLength )
+ return QString::null;
+
+ QString s;
+ int end = QMIN( ( uint ) m_maxLength, pos + len );
+ for ( int i = pos; i < end; i++ )
+ if ( m_maskData[ i ].separator )
+ s += m_maskData[ i ].maskChar;
+ else
+ s += m_blank;
+
+ return s;
+}
+
+QString InputMask::stripString( const QString &str ) const
+{
+ if ( !m_maskData )
+ return str;
+
+ QString s;
+ int end = QMIN( m_maxLength, ( int ) str.length() );
+ for ( int i = 0; i < end; i++ )
+ if ( m_maskData[ i ].separator )
+ s += m_maskData[ i ].maskChar;
+ else
+ if ( str[ i ] != m_blank )
+ s += str[ i ];
+
+ return s;
+}
+
+int InputMask::findInMask( int pos, bool forward, bool findSeparator, QChar searchChar ) const
+{
+ if ( pos >= m_maxLength || pos < 0 )
+ return -1;
+
+ int end = forward ? m_maxLength : -1;
+ int step = forward ? 1 : -1;
+ int i = pos;
+
+ while ( i != end )
+ {
+ if ( findSeparator )
+ {
+ if ( m_maskData[ i ].separator && m_maskData[ i ].maskChar == searchChar )
+ return i;
+ }
+ else
+ {
+ if ( !m_maskData[ i ].separator )
+ {
+ if ( searchChar.isNull() )
+ return i;
+ else if ( isValidInput( searchChar, m_maskData[ i ].maskChar ) )
+ return i;
+ }
+ }
+ i += step;
+ }
+ return -1;
+}
+
+}
+
+#include "inputmask.moc"
diff --git a/kugar/lib/inputmask.h b/kugar/lib/inputmask.h
new file mode 100644
index 00000000..2668ba0c
--- /dev/null
+++ b/kugar/lib/inputmask.h
@@ -0,0 +1,61 @@
+/***************************************************************************
+* Copyright (C) 2005 by Adam Treat *
+* *
+* Copyright (C) 2000 Trolltech AS. All rights reserved. *
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU Library General Public License as *
+* published by the Free Software Foundation; either version 2 of the *
+* License, or (at your option) any later version. *
+* *
+***************************************************************************/
+
+#ifndef INPUTMASK_H
+#define INPUTMASK_H
+
+#include <qobject.h>
+
+namespace Kugar
+{
+
+class InputMask : public QObject
+{
+ Q_OBJECT
+public:
+ InputMask( QObject *parent = 0, const char *name = 0 );
+
+ ~InputMask();
+
+ QString mask() const;
+ void setMask( const QString &mask );
+
+ QString formatText( const QString &txt );
+
+private:
+ void parseInputMask( const QString &maskFields );
+ bool isValidInput( QChar key, QChar mask ) const;
+ QString maskString( uint pos, const QString &str, bool clear = FALSE ) const;
+ QString clearString( uint pos, uint len ) const;
+ QString stripString( const QString &str ) const;
+ int findInMask( int pos, bool forward, bool findSeparator, QChar searchChar = QChar() ) const;
+
+private:
+ QString m_text;
+ int m_maxLength;
+ QChar m_blank;
+ QString m_mask;
+ struct MaskInputData
+ {
+ enum Casemode { NoCaseMode, Upper, Lower };
+ QChar maskChar; // either the separator char or the inputmask
+ bool separator;
+ Casemode caseMode;
+ };
+ MaskInputData *m_maskData;
+};
+
+}
+
+#endif
diff --git a/kugar/lib/mcalcobject.cpp b/kugar/lib/mcalcobject.cpp
new file mode 100644
index 00000000..fbb7345f
--- /dev/null
+++ b/kugar/lib/mcalcobject.cpp
@@ -0,0 +1,66 @@
+/***************************************************************************
+ mcalcobject.cpp - Kugar report calculation field object
+ -------------------
+ begin : Thu Sep 2 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+***************************************************************************/
+
+#include "mcalcobject.h"
+
+namespace Kugar
+{
+
+/** Constructor */
+MCalcObject::MCalcObject() : MFieldObject()
+{
+ // Set the default calculation type
+ calcType = MCalcObject::Count;
+}
+
+/** Copy constructor */
+MCalcObject::MCalcObject( const MCalcObject& mCalcObject ) : MFieldObject( ( MFieldObject & ) mCalcObject )
+{
+ copy( &mCalcObject );
+}
+
+/** Assignment operator */
+MCalcObject MCalcObject::operator=( const MCalcObject& mCalcObject )
+{
+ if ( &mCalcObject == this )
+ return * this;
+
+ // Copy the derived class's data
+ copy( &mCalcObject );
+
+ // Copy the base class's data
+ ( ( MFieldObject & ) * this ) = mCalcObject;
+
+ return *this;
+}
+
+/** Destructor */
+MCalcObject::~MCalcObject()
+{}
+
+/** Sets the field's calculation type */
+void MCalcObject::setCalculationType( int type )
+{
+ calcType = type;
+}
+
+/** Returns the field's calculation type */
+int MCalcObject::getCalculationType()
+{
+ return calcType;
+}
+
+/** Copies member data from one object to another.
+ Used by the copy constructor and assignment operator */
+void MCalcObject::copy( const MCalcObject* mCalcObject )
+{
+ // Copy the fields's calculation type
+ calcType = mCalcObject->calcType;
+}
+
+}
diff --git a/kugar/lib/mcalcobject.h b/kugar/lib/mcalcobject.h
new file mode 100644
index 00000000..dfedb48c
--- /dev/null
+++ b/kugar/lib/mcalcobject.h
@@ -0,0 +1,56 @@
+/***************************************************************************
+ mcalcobject.h - Kugar report calculation field object
+ -------------------
+ begin : Thu Sep 2 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+***************************************************************************/
+
+#ifndef MCALCOBJECT_H
+#define MCALCOBJECT_H
+
+#include "mfieldobject.h"
+
+/**Kugar report calculation field object
+ *@author Mutiny Bay Software
+ */
+
+namespace Kugar
+{
+
+class MCalcObject : public MFieldObject
+{
+
+public:
+ /** Calculation type constants */
+ enum CalculationType { Count = 0, Sum, Average, Variance, StandardDeviation};
+
+ /** Constructor */
+ MCalcObject();
+ /** Copy constructor */
+ MCalcObject( const MCalcObject& mCalcObject );
+ /** Assignment operator */
+ MCalcObject operator=( const MCalcObject& mCalcObject );
+ /** Destructor */
+ ~MCalcObject();
+
+ /** Sets the field's calculation type */
+ void setCalculationType( int type );
+ /** Returns the field's calculation type */
+ int getCalculationType();
+
+private:
+ /** Calculation type */
+ int calcType;
+
+private:
+ /** Copies member data from one object to another.
+ * Used by the copy constructor and assignment operator
+ */
+ void copy( const MCalcObject* mCalcObject );
+
+};
+
+}
+
+#endif
diff --git a/kugar/lib/mfieldobject.cpp b/kugar/lib/mfieldobject.cpp
new file mode 100644
index 00000000..c2d60203
--- /dev/null
+++ b/kugar/lib/mfieldobject.cpp
@@ -0,0 +1,261 @@
+/***************************************************************************
+ mfieldobject.cpp - Kugar report field object
+ -------------------
+ begin : Mon Aug 23 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+***************************************************************************/
+
+#include "mfieldobject.h"
+#include "mutil.h"
+
+#include "inputmask.h"
+
+namespace Kugar
+{
+
+/** Constructor */
+MFieldObject::MFieldObject() : MLabelObject()
+{
+ // Set the defaults
+ fieldName = "";
+ dataType = MFieldObject::String;
+ format = MUtil::MDY_SLASH;
+ precision = 0;
+ currency = 36;
+ negativeValueColor.setRgb( 255, 0, 0 );
+ comma = 0;
+ m_inputMask = new InputMask();
+}
+
+/** Copy constructor */
+MFieldObject::MFieldObject( const MFieldObject& mFieldObject ) : MLabelObject( ( MLabelObject & ) mFieldObject )
+{
+ copy( &mFieldObject );
+}
+
+/** Assignment operator */
+MFieldObject MFieldObject::operator=( const MFieldObject& mFieldObject )
+{
+ if ( &mFieldObject == this )
+ return * this;
+
+ // Copy the derived class's data
+ copy( &mFieldObject );
+
+ // Copy the base class's data
+ ( ( MLabelObject & ) * this ) = mFieldObject;
+
+ return *this;
+}
+
+/** Destructor */
+MFieldObject::~MFieldObject()
+{}
+
+/** Returns the bound data field name */
+QString MFieldObject::getFieldName()
+{
+ return fieldName;
+}
+
+/** Sets the bound data field */
+void MFieldObject::setFieldName( const QString field )
+{
+ fieldName = field;
+}
+
+/** Sets the field's data string */
+void MFieldObject::setText( const QString txt )
+{
+ int ret;
+ QDate d;
+ int pos;
+ QString month, day, year;
+ QRegExp regexp( "[0-9][0-9](-|//)[0-9][0-9](-|//)[0-9][0-9][0-9][0-9]" );
+
+ // Check for empty string
+ if ( txt.isEmpty() && dataType == MFieldObject::Date )
+ {
+ text = QString::null;
+ return ;
+ }
+
+ // Set the data
+ switch ( dataType )
+ {
+ case MFieldObject::String:
+ text = txt;
+ if ( !getInputMask().isEmpty() )
+ text = m_inputMask->formatText( txt );
+ break;
+ case MFieldObject::Integer:
+ text.setNum( txt.toDouble(), 'f', 0 );
+ if ( comma )
+ formatCommas();
+ formatNegValue();
+ break;
+ case MFieldObject::Float:
+ text.setNum( txt.toDouble(), 'f', precision );
+ if ( comma )
+ formatCommas();
+ formatNegValue();
+ break;
+ case MFieldObject::Date:
+ // Check if we can read the date and if so, reformat it ...
+
+ pos = regexp.search( txt.mid( 0 ) );
+ ret = regexp.matchedLength();
+ //ret = regexp.match(txt);
+
+ if ( ret != 1 )
+ {
+ year = txt.right( 4 );
+ month = txt.left( 2 );
+ day = txt.mid( 3, 2 );
+
+ d.setYMD( year.toInt(), month.toInt(), day.toInt() );
+ // d = QDate::fromString(txt, Qt::LocalDate);
+ text = MUtil::formatDate( d, format );
+ }
+ else
+ text = txt;
+ break;
+ case MFieldObject::Currency:
+ int prec = precision < 2 ? precision : 2;
+ bool ok;
+ text.setNum( txt.toDouble( &ok ), 'f', prec );
+ if( !ok )
+ text = QString::null;
+ else
+ {
+ if ( comma )
+ formatCommas();
+ formatNegValue();
+ text = QString( currency + text );
+ }
+ break;
+ }
+}
+
+QString MFieldObject::getInputMask() const
+{
+ return m_inputMask->mask();
+}
+
+void MFieldObject::setInputMask( const QString &inputMask )
+{
+ m_inputMask->setMask( inputMask );
+}
+
+/** Sets the field's data type */
+void MFieldObject::setDataType( int t )
+{
+ dataType = t;
+ if ( dataType == MFieldObject::Integer ||
+ dataType == MFieldObject::Float ||
+ dataType == MFieldObject::Currency )
+ saveColor = foregroundColor;
+}
+
+/** Sets the field's date formatting */
+void MFieldObject::setDateFormat( int f )
+{
+ format = f;
+}
+
+/** Sets the field's precision */
+void MFieldObject::setPrecision( int p )
+{
+ precision = p;
+}
+
+/** Sets the field's currency symbol */
+void MFieldObject::setCurrency( const QChar c )
+{
+ if ( c.isNull() )
+ currency = 36;
+ else
+ currency = c;
+}
+
+/** Sets the object's negative value color - default is red*/
+void MFieldObject::setNegValueColor( int r, int g, int b )
+{
+ negativeValueColor.setRgb( r, g, b );
+}
+
+/** Sets if object should delimit numeric values with commas */
+void MFieldObject::setCommaSeparator( int c )
+{
+ comma = c;
+}
+
+/** Formats a string representation of a negative number using the negative value color */
+void MFieldObject::formatNegValue()
+{
+ if ( text.toDouble() < 0 )
+ foregroundColor = negativeValueColor;
+ else
+ foregroundColor = saveColor;
+}
+
+/** Formats the string representation of a number with comma separators */
+void MFieldObject::formatCommas()
+{
+ // text = text.replace(".", ",");
+ QString tmp;
+ int i, j;
+ int offset;
+
+ // If a neg value
+ if ( text.toDouble() < 0 )
+ offset = 1;
+ else
+ offset = 0;
+
+ // Look for decimal point
+ int pos = text.findRev( "." );
+
+ // If a decimal was not found, start at end of string
+ if ( pos == -1 )
+ pos = text.length();
+ else
+ tmp = text.mid( pos, text.length() );
+
+ // Move through the string and insert the commas
+ for ( i = pos - 1, j = 0; i >= offset; i-- )
+ {
+ tmp = text.mid( i, 1 ) + tmp;
+ j++;
+ if ( ( j == 3 ) && ( i - 1 >= offset ) )
+ {
+ tmp = tr( "," ) + tmp;
+ j = 0;
+ }
+ }
+
+ // If neg value, add back the sign
+ if ( offset )
+ tmp = "-" + tmp;
+
+ // Set the new string to the field
+ text = tmp;
+}
+
+/** Copies member data from one object to another.
+ Used by the copy constructor and assignment operator */
+void MFieldObject::copy( const MFieldObject* mFieldObject )
+{
+ // Copy the fields's data type and format
+ fieldName = mFieldObject->fieldName;
+ dataType = mFieldObject->dataType;
+ format = mFieldObject->format;
+ precision = mFieldObject->precision;
+ currency = mFieldObject->currency;
+ negativeValueColor = mFieldObject->negativeValueColor;
+ saveColor = mFieldObject->saveColor;
+ comma = mFieldObject->comma;
+}
+
+}
diff --git a/kugar/lib/mfieldobject.h b/kugar/lib/mfieldobject.h
new file mode 100644
index 00000000..8832414f
--- /dev/null
+++ b/kugar/lib/mfieldobject.h
@@ -0,0 +1,102 @@
+/***************************************************************************
+ mfieldobject.h - Kugar report field object
+ -------------------
+ begin : Mon Aug 23 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+***************************************************************************/
+
+#ifndef MFIELDOBJECT_H
+#define MFIELDOBJECT_H
+
+#include <qregexp.h>
+
+#include "mlabelobject.h"
+
+/**Kugar report field object
+ *@author Mutiny Bay Software
+ */
+
+namespace Kugar
+{
+
+class InputMask;
+
+class MFieldObject : public MLabelObject
+{
+
+public:
+ /** Data type constants */
+ enum DataType { String = 0, Integer, Float, Date, Currency};
+
+ /** Constructor */
+ MFieldObject();
+ /** Copy constructor */
+ MFieldObject( const MFieldObject& mFieldObject );
+ /** Assignment operator */
+ MFieldObject operator=( const MFieldObject& mFieldObject );
+ /** Destructor */
+ virtual ~MFieldObject();
+
+protected:
+ /** Field name */
+ QString fieldName;
+ /** Field data type */
+ int dataType;
+ /** Field date format */
+ int format;
+ /** Field precision */
+ int precision;
+ /** Field currency symbol */
+ QChar currency;
+ /** Field's negative value color */
+ QColor negativeValueColor;
+ /** Field's original color */
+ QColor saveColor;
+ /** Field's comma flag */
+ int comma;
+ /** Input mask */
+ QString inputMask;
+
+public:
+ /** Returns the bound data field name */
+ QString getFieldName();
+ /** Sets the bound data field */
+ void setFieldName( const QString field );
+ /** Sets the field's data string - default is an empty string*/
+ void setText( const QString txt );
+ /** Sets the field's data type */
+ void setDataType( int t );
+ /** Sets the field's date formatting */
+ void setDateFormat( int f );
+ /** Sets the field's precision */
+ void setPrecision( int p );
+ /** Sets the field's currency symbol */
+ void setCurrency( const QChar c );
+ /** Sets the object's negative value color - default is red*/
+ void setNegValueColor( int r, int g, int b );
+ /** Sets if object should delimit numeric values with commas */
+ void setCommaSeparator( int c );
+
+ QString getInputMask() const;
+ void setInputMask( const QString &inputMask );
+
+private:
+ /** Formats a string representation of a negative number using the negative value color */
+ void formatNegValue();
+ /** Formats a string representation of number with comma seperators */
+ void formatCommas();
+ void parseInputMask();
+
+ /** Copies member data from one object to another.
+ * Used by the copy constructor and assignment operator
+ */
+ void copy( const MFieldObject* mFieldObject );
+
+ InputMask *m_inputMask;
+
+};
+
+}
+
+#endif
diff --git a/kugar/lib/mlabelobject.cpp b/kugar/lib/mlabelobject.cpp
new file mode 100644
index 00000000..bc01c22d
--- /dev/null
+++ b/kugar/lib/mlabelobject.cpp
@@ -0,0 +1,174 @@
+/***************************************************************************
+ mlabelobject.cpp - Kugar report label object
+ -------------------
+ begin : Wed Aug 11 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+ copyright : (C) 2002 Alexander Dymo
+***************************************************************************/
+
+//#include <kglobalsettings.h>
+#include <qfont.h>
+
+#include "mlabelobject.h"
+
+namespace Kugar
+{
+
+/** Constructor */
+MLabelObject::MLabelObject() : MReportObject(), xMargin( 0 ), yMargin( 0 )
+{
+ // Set the default label text
+ text = "";
+
+ // Set the default font
+ QFont defaultFont;
+ fontFamily = defaultFont.family();
+ fontSize = 10;
+ fontWeight = MLabelObject::Normal;
+ fontItalic = false;
+
+ // Set the default alignment
+ hAlignment = MLabelObject::Left;
+ vAlignment = MLabelObject::Top;
+ wordWrap = false;
+}
+
+/** Copy constructor */
+MLabelObject::MLabelObject( const MLabelObject& mLabelObject ) :
+ MReportObject( ( MReportObject & ) mLabelObject ), xMargin( 0 ), yMargin( 0 )
+{
+ copy( &mLabelObject );
+}
+
+/** Assignment operator */
+MLabelObject MLabelObject::operator=( const MLabelObject& mLabelObject )
+{
+ if ( &mLabelObject == this )
+ return * this;
+
+ // Copy the derived class's data
+ copy( &mLabelObject );
+
+ // Copy the base class's data
+ ( ( MReportObject & ) * this ) = mLabelObject;
+
+ return *this;
+}
+
+/** Destructor */
+MLabelObject::~MLabelObject()
+{}
+
+/** Sets the label's text string */
+void MLabelObject::setText( const QString txt )
+{
+ text = txt;
+}
+
+/** Sets the label's text font */
+void MLabelObject::setFont( const QString family, int size, int weight, bool italic )
+{
+ fontFamily = family;
+ fontSize = size;
+ fontWeight = weight;
+ fontItalic = italic;
+}
+
+/** Sets the label's horizontal alignment */
+void MLabelObject::setHorizontalAlignment( int a )
+{
+ hAlignment = a;
+}
+
+/** Sets the label's vertical alignment */
+void MLabelObject::setVerticalAlignment( int a )
+{
+ vAlignment = a;
+}
+
+/** Sets the label's word wrap flag */
+void MLabelObject::setWordWrap( bool state )
+{
+ wordWrap = state;
+}
+
+/** Draws the label using the specificed painter & x/y-offsets */
+void MLabelObject::draw( QPainter* p, int xoffset, int yoffset )
+{
+ QFont font( fontFamily, fontSize, fontWeight, fontItalic );
+ QPen textPen( foregroundColor, 0, QPen::NoPen );
+
+ int tf;
+
+ // Set the offsets
+ int xcalc = xpos + xoffset;
+ int ycalc = ypos + yoffset;
+
+ // Draw the base
+ drawBase( p, xoffset, yoffset );
+
+ // Set the font
+ p->setFont( font );
+ QFontMetrics fm = p->fontMetrics();
+
+ // Set the text alignment flags
+
+ // Horizontal
+ switch ( hAlignment )
+ {
+ case MLabelObject::Left:
+ tf = QPainter::AlignLeft;
+ break;
+ case MLabelObject::Center:
+ tf = QPainter::AlignHCenter;
+ break;
+ case MLabelObject::Right:
+ tf = QPainter::AlignRight;
+ }
+
+ // Vertical
+ switch ( vAlignment )
+ {
+ case MLabelObject::Top:
+ tf = tf | QPainter::AlignTop;
+ break;
+ case MLabelObject::Bottom:
+ tf = tf | QPainter::AlignBottom;
+ break;
+ case MLabelObject::Middle:
+ tf = tf | QPainter::AlignVCenter;
+ }
+
+ // Word wrap
+ if ( wordWrap )
+ tf = tf | QPainter::WordBreak;
+
+ // Draw the text
+ p->setPen( textPen );
+ p->drawText( xcalc + xMargin, ycalc + yMargin,
+ width - xMargin, height - yMargin,
+ tf, text );
+}
+
+/** Copies member data from one object to another.
+ Used by the copy constructor and assignment operator */
+void MLabelObject::copy( const MLabelObject* mLabelObject )
+{
+ // Copy the label's text
+ text = mLabelObject->text;
+
+ // Copy the label's font data
+ fontFamily = mLabelObject->fontFamily;
+ fontSize = mLabelObject->fontSize;
+ fontWeight = mLabelObject->fontWeight;
+ fontItalic = mLabelObject->fontItalic;
+
+ // Copy the label's alignment data
+ vAlignment = mLabelObject->vAlignment;
+ hAlignment = mLabelObject->hAlignment;
+ wordWrap = mLabelObject->wordWrap;
+}
+
+}
diff --git a/kugar/lib/mlabelobject.h b/kugar/lib/mlabelobject.h
new file mode 100644
index 00000000..7f4a5164
--- /dev/null
+++ b/kugar/lib/mlabelobject.h
@@ -0,0 +1,92 @@
+/***************************************************************************
+ mlabelobject.h - Kugar report label object
+ -------------------
+ begin : Wed Aug 11 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+***************************************************************************/
+
+#ifndef MLABELOBJECT_H
+#define MLABELOBJECT_H
+
+#include <qstring.h>
+#include <qfontmetrics.h>
+
+#include "mreportobject.h"
+
+/**Kugar report label object
+ *@author Mutiny Bay Software
+ */
+
+namespace Kugar
+{
+
+class MLabelObject : public MReportObject
+{
+
+public:
+ /** Font weight constants */
+ enum FontWeight { Light = 25, Normal = 50, DemiBold = 63, Bold = 75, Black = 87 };
+ /** Horizontal alignment constants */
+ enum HAlignment { Left = 0, Center, Right };
+ /** Vertial alignment constants */
+ enum VAlignment { Top = 0, Middle, Bottom };
+
+ /** Constructor */
+ MLabelObject();
+ /** Copy constructor */
+ MLabelObject( const MLabelObject& mLabelObject );
+ /** Assignment operator */
+ MLabelObject operator=( const MLabelObject& mLabelObject );
+ /** Destructor */
+ virtual ~MLabelObject();
+
+protected:
+ /** Label text */
+ QString text;
+ /** Label text font family */
+ QString fontFamily;
+ /** Label text font size in points */
+ int fontSize;
+ /** Label text font weight */
+ int fontWeight;
+ /** Label text font italic flag */
+ bool fontItalic;
+ /** Lable text horizontal alignment */
+ int hAlignment;
+ /** Label text vertical alignment */
+ int vAlignment;
+ /** Label text word wrap flag */
+ bool wordWrap;
+
+private:
+ /** Label text horizontal margin spacing */
+ const int xMargin;
+ /** Label text vertical margin spacing */
+ const int yMargin;
+
+public:
+ /** Sets the label's text string - default is an empty string*/
+ virtual void setText( const QString txt );
+ /** Sets the label's text font - default is Times,10,Normal,false */
+ void setFont( const QString family, int size, int weight, bool italic );
+ /** Sets the label's horizontal alignment -default is Left */
+ void setHorizontalAlignment( int a );
+ /** Sets the label's vertical alignment - default is Top */
+ void setVerticalAlignment( int a );
+ /** Sets the label's word wrap flag - default is false */
+ void setWordWrap( bool state );
+ /** Draws the label using the specificed painter & x/y-offsets */
+ void draw( QPainter* p, int xoffset, int yoffset );
+
+private:
+ /** Copies member data from one object to another.
+ * Used by the copy constructor and assignment operator
+ */
+ void copy( const MLabelObject* mLabelObject );
+
+};
+
+}
+
+#endif
diff --git a/kugar/lib/mlineobject.cpp b/kugar/lib/mlineobject.cpp
new file mode 100644
index 00000000..dba41078
--- /dev/null
+++ b/kugar/lib/mlineobject.cpp
@@ -0,0 +1,119 @@
+/***************************************************************************
+ mlineobject.cpp - Kugar report line object
+ -------------------
+ begin : Wed Feb 23 2000
+ copyright : (C) 2000 by Mutiny Bay Software
+***************************************************************************/
+
+#include "mlineobject.h"
+
+namespace Kugar
+{
+
+/** Constructor */
+MLineObject::MLineObject() : QObject()
+{
+ // Set the object's default geometry
+ xpos1 = 0;
+ ypos1 = 0;
+ xpos2 = 0;
+ ypos2 = 0;
+
+ // Set the object's default attributes
+ penWidth = 1;
+ penColor.setRgb( 0, 0, 0 );
+ penStyle = MLineObject::SolidLine;
+}
+
+/** Copy constructor */
+MLineObject::MLineObject( const MLineObject& mLineObject ) /*: QObject((QObject &) mLineObject)*/
+{
+ copy( &mLineObject );
+}
+
+/** Assignment operator */
+MLineObject MLineObject::operator=( const MLineObject& mLineObject )
+{
+ if ( &mLineObject == this )
+ return * this;
+
+ // Copy the derived class's data
+ copy( &mLineObject );
+
+ // Copy the base class's data
+ //((QObject &) *this) = mLineObject;
+
+ return *this;
+}
+
+/** Destructor */
+MLineObject::~MLineObject()
+{}
+
+/** Sets the start and end points for the line */
+void MLineObject::setLine( int xStart, int yStart, int xEnd, int yEnd )
+{
+ xpos1 = xStart;
+ ypos1 = yStart;
+ xpos2 = xEnd;
+ ypos2 = yEnd;
+}
+
+/** Sets the object's color */
+void MLineObject::setColor( int r, int g, int b )
+{
+ penColor.setRgb( r, g, b );
+}
+
+/** Sets the object's style */
+void MLineObject::setStyle( int style )
+{
+ penStyle = style;
+}
+
+/** Sets the object's width */
+void MLineObject::setWidth( int width )
+{
+ penWidth = width;
+}
+
+/** Draws the object to the specified painter & x/y offsets */
+void MLineObject::draw( QPainter* p, int xoffset, int yoffset )
+{
+ drawBase( p, xoffset, yoffset );
+}
+
+/** Draws the base object to the specified painter & x/y offsets */
+void MLineObject::drawBase( QPainter* p, int xoffset, int yoffset )
+{
+ QPen linePen( penColor, penWidth, ( QPen::PenStyle ) penStyle );
+
+ // Set the offsets
+ int xcalc1 = xpos1 + xoffset;
+ int ycalc1 = ypos1 + yoffset;
+ int xcalc2 = xpos2 + xoffset;
+ int ycalc2 = ypos2 + yoffset;
+
+ // Draw the line
+ p->setPen( linePen );
+ p->drawLine( xcalc1, ycalc1, xcalc2, ycalc2 );
+}
+
+/** Copies member data from one object to another.
+ Used by the copy constructor and assignment operator */
+void MLineObject::copy( const MLineObject* mLineObject )
+{
+ // Copy the object's geometry
+ xpos1 = mLineObject->xpos1;
+ ypos1 = mLineObject->ypos1;
+ xpos2 = mLineObject->xpos2;
+ ypos2 = mLineObject->ypos2;
+
+ // copy the object's attributes
+ penWidth = mLineObject->penWidth;
+ penColor = mLineObject->penColor;
+ penStyle = mLineObject->penStyle;
+}
+
+}
diff --git a/kugar/lib/mlineobject.h b/kugar/lib/mlineobject.h
new file mode 100644
index 00000000..f3260ddd
--- /dev/null
+++ b/kugar/lib/mlineobject.h
@@ -0,0 +1,83 @@
+/***************************************************************************
+ mlineobject.h - Kugar report line object
+ -------------------
+ begin : Wed Feb 23 2000
+ copyright : (C) 2000 by Mutiny Bay Software
+***************************************************************************/
+
+#ifndef MLINEOBJECT_H
+#define MLINEOBJECT_H
+
+#include <qobject.h>
+#include <qpainter.h>
+#include <qpaintdevice.h>
+#include <qcolor.h>
+
+/**Kugar report line object
+ *@author Mutiny Bay Software
+ */
+
+namespace Kugar
+{
+
+class MLineObject : public QObject
+{
+
+public:
+ /** Line style constants */
+ enum Style { NoPen = 0, SolidLine, DashLine,
+ DotLine, DashDotLine, DashDotDotLine };
+
+ /** Constructor */
+ MLineObject();
+ /** Copy constructor */
+ MLineObject( const MLineObject& mLineObject );
+ /** Assignment operator */
+ MLineObject operator=( const MLineObject& mLineObject );
+ /** Destructor */
+ virtual ~MLineObject();
+
+protected:
+ /** Object's x start position */
+ int xpos1;
+ /** Object's y start postition */
+ int ypos1;
+ /** Object's x end position */
+ int xpos2;
+ /** Object's y end position */
+ int ypos2;
+
+ /** Object's width */
+ int penWidth;
+ /** Object's color */
+ QColor penColor;
+ /** Object's style */
+ int penStyle;
+
+public:
+ /** Sets the start and end points for the line */
+ void setLine( int xStart, int yStart, int xEnd, int yEnd );
+ /** Sets the object's width */
+ void setWidth( int width );
+ /** Sets the object's style */
+ void setStyle( int style );
+ /** Sets the object's color */
+ void setColor( int r, int g, int b );
+ /** Draws the object to the specified painter & x/y offsets */
+ virtual void draw( QPainter* p, int xoffset, int yoffset );
+
+protected:
+ /** Draws the object to the specified painter & x/y offsets */
+ void drawBase( QPainter* p, int xoffset, int yoffset );
+
+private:
+ /** Copies member data from one object to another.
+ * Used by the copy constructor and assignment operator
+ */
+ void copy( const MLineObject* mLineObject );
+};
+
+}
+
+#endif
diff --git a/kugar/lib/mpagecollection.cpp b/kugar/lib/mpagecollection.cpp
new file mode 100644
index 00000000..3359f4b4
--- /dev/null
+++ b/kugar/lib/mpagecollection.cpp
@@ -0,0 +1,190 @@
+/***************************************************************************
+ mpagecollection.cpp - Kugar report page collection
+ -------------------
+ begin : Fri Aug 20 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+***************************************************************************/
+
+#include "mpagecollection.h"
+#include "mreportengine.h"
+
+#include <kdebug.h>
+
+namespace Kugar
+{
+
+/** Constructor */
+MPageCollection::MPageCollection( QObject *parent ) : QObject( parent )
+{
+ // Set page list to AutoDelete
+ pages.setAutoDelete( true );
+
+ // Set the metrics
+ size = MReportEngine::Letter;
+ orientation = MReportEngine::Portrait;
+ dimensions.setWidth( 0 );
+ dimensions.setHeight( 0 );
+ m_ref = 1;
+}
+
+/** Copy constructor */
+MPageCollection::MPageCollection( const MPageCollection& mPageCollection ) /*: QObject((QObject &) mPageCollection)*/
+{
+ copy( &mPageCollection );
+}
+
+/** Assignment operator */
+MPageCollection MPageCollection::operator=( const MPageCollection& mPageCollection )
+{
+ if ( &mPageCollection == this )
+ return * this;
+
+ // Copy the derived class's data
+ copy( &mPageCollection );
+
+ // Copy the base class's data
+ //((QObject &) *this) = mPageCollection;
+
+ return *this;
+}
+
+/** Destructor */
+MPageCollection::~MPageCollection()
+{
+ pages.clear();
+ kdDebug(31000) << k_funcinfo << endl;
+}
+
+/** Clears the page collection */
+void MPageCollection::clear()
+{
+ pages.clear();
+}
+
+/** Appends a new page to the page collection */
+void MPageCollection::appendPage()
+{
+ pages.append( new QPicture() );
+}
+
+/** Gets the current page in the page collection,
+ * the current page may be null
+ */
+QPicture* MPageCollection::getCurrentPage()
+{
+ return pages.current();
+}
+
+/** Gets the first page in the page collection,
+ * returns NULL if the list is empty
+ */
+QPicture* MPageCollection::getFirstPage()
+{
+ return pages.first();
+}
+
+/** Gets the next page in the page collection,
+ * returns NULL if the end of the list has been reached
+ */
+QPicture* MPageCollection::getNextPage()
+{
+ return pages.next();
+}
+
+/** Get the previous page in the page collection,
+ * returns NULL if the beginning of the list has been reached
+ */
+QPicture* MPageCollection::getPreviousPage()
+{
+ return pages.prev();
+}
+
+/** Gets the last page in the page collection,
+ * returns NULL if the list is empty
+ */
+QPicture* MPageCollection::getLastPage()
+{
+ return pages.last();
+}
+
+/** Get the index of the current page */
+int MPageCollection::getCurrentIndex()
+{
+ return pages.at();
+}
+
+/** Set the current page to page at idx */
+void MPageCollection::setCurrentPage( int idx )
+{
+ pages.at( idx );
+}
+
+/** Sets the page size */
+void MPageCollection::setPageSize( int s )
+{
+ size = s;
+}
+
+/** Sets the page orientation */
+void MPageCollection::setPageOrientation( int o )
+{
+ orientation = o;
+}
+
+/** Sets the page dimensions */
+void MPageCollection::setPageDimensions( QSize dim )
+{
+ dimensions = dim;
+}
+
+/** Returns the page size */
+int MPageCollection::pageSize()
+{
+ return size;
+}
+
+/** Returns the page orientation */
+int MPageCollection::pageOrientation()
+{
+ return orientation;
+}
+
+/** Returns the page dimensions */
+QSize MPageCollection::pageDimensions()
+{
+ return dimensions;
+}
+
+/** Returns the number of pages in the page collection */
+int MPageCollection::pageCount()
+{
+ return pages.count();
+}
+
+/** Copies member data from one object to another.
+ Used by the copy constructor and assignment operator */
+void MPageCollection::copy( const MPageCollection* mPageCollection )
+{
+ // Copy the page collection
+ pages = mPageCollection->pages;
+
+ // Copy the page metrics
+ dimensions = mPageCollection->dimensions;
+ size = mPageCollection->size;
+ orientation = mPageCollection->orientation;
+ m_ref = 1;
+}
+
+void MPageCollection::addRef()
+{
+ m_ref++;
+}
+void MPageCollection::removeRef()
+{
+ m_ref--;
+ if ( !m_ref )
+ deleteLater();
+}
+
+}
diff --git a/kugar/lib/mpagecollection.h b/kugar/lib/mpagecollection.h
new file mode 100644
index 00000000..8b1c84aa
--- /dev/null
+++ b/kugar/lib/mpagecollection.h
@@ -0,0 +1,108 @@
+/***************************************************************************
+ mpagecollection.h - Kugar report page collection
+ -------------------
+ begin : Fri Aug 20 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+***************************************************************************/
+
+#ifndef MPAGECOLLECTION_H
+#define MPAGECOLLECTION_H
+
+#include <qobject.h>
+#include <qptrlist.h>
+#include <qpicture.h>
+#include <qsize.h>
+
+/**Kugar report page collection
+ *@author Mutiny Bay Software
+ */
+
+namespace Kugar
+{
+
+class MPageCollection : public QObject
+{
+
+public:
+ /** Constructor */
+ MPageCollection( QObject *parent );
+ /** Copy constructor */
+ MPageCollection( const MPageCollection& mPageCollection );
+ /** Assignment operator */
+ MPageCollection operator=( const MPageCollection& mPageCollection );
+ /** Destructor */
+ virtual ~MPageCollection();
+
+private:
+ /** The report page list */
+ QPtrList<QPicture> pages;
+ /** Page dimensions */
+ QSize dimensions;
+ /** Page size */
+ int size;
+ /** Page orientation */
+ int orientation;
+
+public:
+ /** Clears the page collection */
+ void clear();
+
+ /** Appends a new page to the page collection */
+ void appendPage();
+
+ /** Gets the current page in the page collection,
+ * the current page may be null
+ */
+ QPicture* getCurrentPage();
+ /** Gets the first page in the page collection,
+ * returns NULL if the list is empty
+ */
+ QPicture* getFirstPage();
+ /** Get the previous page in the page collection,
+ * returns NULL if the beginning of the list has been reached
+ */
+ QPicture* getPreviousPage();
+ /** Gets the next page in the page collection,
+ * returns NULL if the end of the list has been reached
+ */
+ QPicture* getNextPage();
+ /** Gets the last page in the page collection,
+ * returns NULL if the list empty
+ */
+ QPicture* getLastPage();
+
+ /** Get the index of the current page */
+ int getCurrentIndex();
+ /** Set the current page to page at idx */
+ void setCurrentPage( int idx );
+
+ /** Sets the page size */
+ void setPageSize( int s );
+ /** Sets the page orientation */
+ void setPageOrientation( int o );
+ /** Sets the page dimensions */
+ void setPageDimensions( QSize dim );
+ /** Returns the page size */
+ int pageSize();
+ /** Returns the page orientation */
+ int pageOrientation();
+ /** Returns the page dimensions */
+ QSize pageDimensions();
+ /** Returns the number of pages in the page collection */
+ int pageCount();
+
+ void addRef();
+ void removeRef();
+
+private:
+ /** Copies member data from one object to another.
+ * Used by the copy constructor and assignment operator
+ */
+ void copy( const MPageCollection* mPageCollection );
+ int m_ref;
+};
+
+}
+
+#endif
diff --git a/kugar/lib/mpagedisplay.cpp b/kugar/lib/mpagedisplay.cpp
new file mode 100644
index 00000000..c3a5d587
--- /dev/null
+++ b/kugar/lib/mpagedisplay.cpp
@@ -0,0 +1,63 @@
+/***************************************************************************
+ mpagedisplay.cpp - Kugar page display widget
+ -------------------
+ begin : Sun Aug 15 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+***************************************************************************/
+
+#include "mpagedisplay.h"
+
+namespace Kugar
+{
+
+/** Constructor */
+MPageDisplay::MPageDisplay( QWidget *parent, const char *name ) : QWidget( parent, name )
+{
+ buffer.resize( 1, 1 );
+}
+
+/** Destructor */
+MPageDisplay::~MPageDisplay()
+{}
+
+/** Sets the report page image */
+void MPageDisplay::setPage( QPicture* image )
+{
+ buffer.fill( white );
+ QPainter p( &buffer );
+ image->play( &p );
+}
+
+/** Display object's paint event */
+void MPageDisplay::paintEvent( QPaintEvent* event )
+{
+ bitBlt( this, 0, 0, &buffer );
+}
+
+/** Sets the page display dimensions */
+void MPageDisplay::setPageDimensions( QSize size )
+{
+ buffer.resize( size );
+ resize( size );
+}
+
+
+// Return the preferred size of the display.
+
+QSize MPageDisplay::sizeHint() const
+{
+ return buffer.size();
+}
+
+
+// Return the size policy.
+
+QSizePolicy MPageDisplay::sizePolicy() const
+{
+ return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
+}
+
+}
+
+#include "mpagedisplay.moc"
diff --git a/kugar/lib/mpagedisplay.h b/kugar/lib/mpagedisplay.h
new file mode 100644
index 00000000..ffaa4921
--- /dev/null
+++ b/kugar/lib/mpagedisplay.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ mpagedisplay.h - Kugar page display widget
+ -------------------
+ begin : Sun Aug 15 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+***************************************************************************/
+
+#ifndef MPAGEDISPLAY_H
+#define MPAGEDISPLAY_H
+
+#include <qwidget.h>
+#include <qpainter.h>
+#include <qpixmap.h>
+#include <qpicture.h>
+#include <qsize.h>
+
+/**Kugar page display widget
+ *@author Mutiny Bay Software
+ */
+
+namespace Kugar
+{
+
+class MPageDisplay : public QWidget
+{
+ Q_OBJECT
+public:
+ /** Constructor */
+ MPageDisplay( QWidget *parent = 0, const char *name = 0 );
+ /** Destructor */
+ virtual ~MPageDisplay();
+
+private:
+ /** Page Widget's image buffer */
+ QPixmap buffer;
+
+public:
+ /** Sets the page image */
+ void setPage( QPicture* image );
+ /** Sets the page display dimensions */
+ void setPageDimensions( QSize size );
+
+ QSize sizeHint() const;
+ QSizePolicy sizePolicy() const;
+
+protected:
+ /** Page widget's's paint event */
+ void paintEvent( QPaintEvent* event );
+
+};
+
+}
+
+#endif
diff --git a/kugar/lib/mreportdetail.cpp b/kugar/lib/mreportdetail.cpp
new file mode 100644
index 00000000..6fa4bc53
--- /dev/null
+++ b/kugar/lib/mreportdetail.cpp
@@ -0,0 +1,123 @@
+/***************************************************************************
+ mreportdetail.cpp - Kugar report detail section
+ -------------------
+ begin : Mon Aug 23 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+***************************************************************************/
+
+#include "mreportdetail.h"
+
+namespace Kugar
+{
+
+/** Constructor */
+MReportDetail::MReportDetail() : MReportSection()
+{
+ // Set the label list to AutoDelete
+ fields.setAutoDelete( true );
+}
+
+/** Copy constructor */
+MReportDetail::MReportDetail( const MReportDetail& mReportDetail ) : MReportSection( ( MReportSection & ) mReportDetail )
+{
+ copy( &mReportDetail );
+}
+
+/** Assignment operator */
+MReportDetail MReportDetail::operator=( const MReportDetail& mReportDetail )
+{
+ if ( &mReportDetail == this )
+ return * this;
+
+ // Copy the derived class's data
+ copy( &mReportDetail );
+
+ // Copy the base class's data
+ ( ( MReportSection & ) * this ) = mReportDetail;
+
+ return *this;
+}
+
+/** Destructor */
+MReportDetail::~MReportDetail()
+{
+ clear();
+}
+
+/** Frees all resources allocated by the report section */
+void MReportDetail::clear()
+{
+ // Free the base resources
+ clearBase();
+
+ // Clear the field collection
+ fields.clear();
+}
+
+void MReportDetail::setRepeat( bool b )
+{
+ repeat = b;
+}
+
+bool MReportDetail::getRepeat() const
+{
+ return repeat;
+}
+
+/** Draws the detail section to the selected painter & x/y-offsets */
+void MReportDetail::draw( QPainter* p, int xoffset, int yoffset )
+{
+ MFieldObject * field;
+
+ // Set the offsets
+ int xcalc = xoffset;
+ int ycalc = yoffset;
+
+ // Draw the base objects
+ drawObjects( p, xoffset, yoffset );
+
+ // Draw the field collection
+ for ( field = fields.first(); field != 0; field = fields.next() )
+ {
+ field->draw( p, xcalc, ycalc );
+ }
+}
+
+/** Adds a new field object to the section's field collection */
+void MReportDetail::addField( MFieldObject* field )
+{
+ fields.append( field );
+}
+
+/** Sets the data for the field at the specified index */
+void MReportDetail::setFieldData( int idx, QString data )
+{
+ MFieldObject * field = fields.at( idx );
+
+ field->setText( data );
+}
+
+/** Returns the number of fields in the detail section */
+int MReportDetail::getFieldCount()
+{
+ return fields.count();
+}
+
+/** Returns the name of the bound field for field object at the given index */
+QString MReportDetail::getFieldName( int idx )
+{
+ MFieldObject * field = fields.at( idx );
+
+ return field->getFieldName();
+}
+
+/** Copies member data from one object to another.
+ Used by the copy constructor and assignment operator */
+void MReportDetail::copy( const MReportDetail* mReportDetail )
+{
+ // Copy the field list
+ fields = mReportDetail->fields;
+}
+
+}
diff --git a/kugar/lib/mreportdetail.h b/kugar/lib/mreportdetail.h
new file mode 100644
index 00000000..ee2e9222
--- /dev/null
+++ b/kugar/lib/mreportdetail.h
@@ -0,0 +1,89 @@
+/***************************************************************************
+ mreportdetail.h - Kugar report detail section
+ -------------------
+ begin : Mon Aug 23 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+***************************************************************************/
+
+#ifndef MREPORTDETAIL_H
+#define MREPORTDETAIL_H
+
+#include "mfieldobject.h"
+#include "mreportsection.h"
+
+/**Kugar report detail section
+ *@author Mutiny Bay Software
+ */
+
+namespace Kugar
+{
+
+class MReportDetail : public MReportSection
+{
+
+public:
+ /** Constructor */
+ MReportDetail();
+ /** Copy constructor */
+ MReportDetail( const MReportDetail& mReportDetail );
+ /** Assignment operator */
+ MReportDetail operator=( const MReportDetail& mReportDetail );
+ /** Destructor */
+ virtual ~MReportDetail();
+
+protected:
+ /** Sections's repeat on new pages */
+ bool repeat;
+ /** Section's field collection */
+ QPtrList<MFieldObject> fields;
+
+public:
+ /** Sets whether to repeat the detail on new pages */
+ void setRepeat( bool b );
+ /** Sets whether to repeat the detail on new pages */
+ bool getRepeat() const;
+ /** Draws the detail section to the specified painter & x/y-offsets */
+ void draw( QPainter* p, int xoffset, int yoffset );
+ /** Adds a new field object to the section's field collection */
+ void addField( MFieldObject* field );
+ /** Sets the data for the field at the specified index */
+ void setFieldData( int idx, QString data );
+ /** Returns the number of fields in the detail section */
+ int getFieldCount();
+ /** Returns the name of the bound field for field object at the given index */
+ QString getFieldName( int idx );
+ /** Frees all resources allocated by the report section */
+ void clear();
+
+private:
+ /** Copies member data from one object to another.
+ * Used by the copy constructor and assignment operator
+ */
+ void copy( const MReportDetail* mReportDetail );
+
+};
+
+}
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kugar/lib/mreportengine.cpp b/kugar/lib/mreportengine.cpp
new file mode 100644
index 00000000..fd4a2ce2
--- /dev/null
+++ b/kugar/lib/mreportengine.cpp
@@ -0,0 +1,1081 @@
+/***************************************************************************
+ mreportengine.cpp - Kugar report engine
+ -------------------
+ begin : Sun Aug 15 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+ copyright : (C) 2002 Alexander Dymo
+***************************************************************************/
+
+#include <qfile.h>
+#include <qprinter.h>
+
+#include "mreportengine.h"
+#include "mutil.h"
+
+#include <kdebug.h>
+
+#include <math.h>
+
+namespace Kugar
+{
+
+/** Constructor */
+MReportEngine::MReportEngine() : QObject()
+{
+ // Set page params
+ m_pageCollection = 0;
+ m_needRegeneration = true;
+ m_refCount = 1;
+ pageSize = MReportEngine::Letter;
+ pageOrientation = MReportEngine::Portrait;
+ topMargin = 0;
+ bottomMargin = 0;
+ leftMargin = 0;
+ rightMargin = 0;
+ heightOfDetails = 0;
+ widthDelta = 1;
+ heightDelta = 1;
+
+ // Set cancel flag
+ cancelRender = false;
+
+ // Set the grand total list to AutoDelete
+ grandTotal.setAutoDelete( true );
+ // Set the details lists to AutoDelete
+ dHeaders.setAutoDelete( true );
+ details.setAutoDelete( true );
+ dFooters.setAutoDelete( true );
+
+ rHeader.setPrintFrequency( MReportSection::FirstPage );
+ pHeader.setPrintFrequency( MReportSection::EveryPage );
+ pFooter.setPrintFrequency( MReportSection::EveryPage );
+ rFooter.setPrintFrequency( MReportSection::LastPage );
+
+ // Set the default page metrics
+ QSize ps = getPageMetrics( pageSize, pageOrientation );
+ pageWidth = ps.width();
+ pageHeight = ps.height();
+}
+
+/** Copy constructor */
+MReportEngine::MReportEngine( const MReportEngine& mReportEngine ) /*: QObject((QObject &) mReportEngine)*/
+{
+ copy( &mReportEngine );
+}
+
+/** Assignment operator */
+MReportEngine MReportEngine::operator=( const MReportEngine& mReportEngine )
+{
+ if ( &mReportEngine == this )
+ return * this;
+
+ // Copy the derived class's data
+ copy( &mReportEngine );
+
+ // Copy the base class's data
+ //((QObject &) *this) = mReportEngine;
+
+ return *this;
+}
+
+/** Destructor */
+MReportEngine::~MReportEngine()
+{
+ // Clear the grand total data
+ grandTotal.clear();
+ kdDebug( 31000 ) << k_funcinfo << endl;
+}
+
+void MReportEngine::addRef()
+{
+ m_refCount++;
+}
+
+void MReportEngine::removeRef()
+{
+ m_refCount--;
+ if ( !m_refCount )
+ deleteLater();
+}
+
+/** Clears report formatting */
+void MReportEngine::clearFormatting()
+{
+ rHeader.clear();
+ pHeader.clear();
+ dHeaders.clear();
+ details.clear();
+ dFooters.clear();
+ pFooter.clear();
+ rFooter.clear();
+}
+
+
+//Set the report data from an existing QDomDocument
+bool MReportEngine::setReportData( const QDomDocument &data )
+{
+ rd = data.cloneNode( true ).toDocument();
+ initData();
+
+ return true;
+}
+
+
+// Set the report's data from an inline string. Return true if it was valid
+// data.
+
+bool MReportEngine::setReportData( const QString &data )
+{
+
+ if ( !rd.setContent( data ) )
+ {
+ kdDebug() << "Unable to parse report data" << endl;
+ return false;
+ }
+ initData();
+
+ return true;
+}
+
+
+// Set the report's data from an i/o device. Return true if it was valid data.
+
+bool MReportEngine::setReportData( QIODevice *dev )
+{
+ if ( !rd.setContent( dev ) )
+ {
+ kdDebug() << "Unable to parse report data" << endl;
+ return false;
+ }
+ initData();
+
+ return true;
+}
+
+
+// Initialise after reading a report's data.
+
+void MReportEngine::initData()
+{
+ m_needRegeneration = true;
+ // Get the record set (we assume there is only one).
+
+ for ( QDomNode n = rd.firstChild(); !n.isNull(); n = n.nextSibling() )
+ if ( n.nodeName() == "KugarData" )
+ {
+ // Get the records.
+
+ records = n.childNodes();
+
+ // See if there is a prefered template given.
+
+ QDomNamedNodeMap attr = n.attributes();
+ QDomNode tempattr = attr.namedItem( "Template" );
+ QString tempname = tempattr.nodeValue();
+
+ if ( !tempname.isNull() )
+ emit preferedTemplate( tempname );
+
+ break;
+ }
+}
+
+
+// Set the report's template from an inline string. Return true if it was a
+// valid template.
+
+bool MReportEngine::setReportTemplate( const QString &tpl )
+{
+ clearFormatting();
+
+ if ( !rt.setContent( tpl ) )
+ {
+ kdDebug() << "Unable to parse report template" << endl;
+ return false;
+ }
+
+ initTemplate();
+
+ return true;
+}
+
+
+// Set the report's template from an i/o device. Return true if it was a valid
+// template.
+
+bool MReportEngine::setReportTemplate( QIODevice *dev )
+{
+ clearFormatting();
+
+ if ( !rt.setContent( dev ) )
+ {
+ kdDebug() << "Unable to parse report template" << endl;
+ return false;
+ }
+
+ initTemplate();
+
+ return true;
+}
+
+
+/** Cancels rendering of a report */
+void MReportEngine::slotCancelRendering()
+{
+ cancelRender = true;
+}
+
+/** Finds the detail header object, which is apropriate for the given level */
+MReportSection *MReportEngine::findDetailHeader( int level )
+{
+ MReportSection * sec;
+ for ( sec = dHeaders.first(); sec; sec = dHeaders.next() )
+ {
+ if ( sec->getLevel() == level )
+ return sec;
+ }
+ return NULL;
+}
+
+/** Finds the detail object, which is apropriate for the given level */
+MReportDetail *MReportEngine::findDetail( int level )
+{
+ MReportDetail * sec;
+ for ( sec = details.first(); sec; sec = details.next() )
+ {
+ if ( sec->getLevel() == level )
+ return sec;
+ }
+ return NULL;
+}
+
+/** Finds the detail footer object, which is apropriate for the given level */
+MReportSection *MReportEngine::findDetailFooter( int level )
+{
+ MReportSection * sec;
+ for ( sec = dFooters.first(); sec; sec = dFooters.next() )
+ {
+ if ( sec->getLevel() == level )
+ return sec;
+ }
+ return NULL;
+}
+
+/** Renders the report as a page collection - the caller
+ * is responsible for de-allocating the returned
+ * collection
+ */
+MPageCollection* MReportEngine::renderReport()
+{
+ if ( !m_needRegeneration )
+ return m_pageCollection;
+ if ( m_pageCollection )
+ {
+ m_pageCollection->deleteLater();
+ m_pageCollection = 0;
+ }
+
+ unsigned int j;
+ unsigned int i;
+
+ // Set cancel flag
+ cancelRender = false;
+
+ // Create the page collection
+ MPageCollection* pages = new MPageCollection( this );
+
+ // Initialize the basic page data
+ currHeight = pageHeight - ( topMargin + bottomMargin + pFooter.getHeight() );
+ currPage = 0;
+ currDate = QDate::currentDate();
+
+ // Initialise global report variables
+ unsigned int rowCount = records.length();
+ for ( j = 0; j < rowCount; j++ )
+ {
+ QDomNode record = records.item( j );
+ if ( ( record.nodeType() == QDomNode::ElementNode )
+ && ( record.nodeName() == "Var" ) )
+ {
+ // Process the variable ...
+ QDomNamedNodeMap fields = record.attributes();
+ for ( int k = 0; k < fields.count(); ++k )
+ {
+ rHeader.setFieldData( fields.item( k ).nodeName(), fields.item( k ).nodeValue() );
+ rFooter.setFieldData( fields.item( k ).nodeName(), fields.item( k ).nodeValue() );
+ pHeader.setFieldData( fields.item( k ).nodeName(), fields.item( k ).nodeValue() );
+ pFooter.setFieldData( fields.item( k ).nodeName(), fields.item( k ).nodeValue() );
+ }
+ }
+ }
+
+ // Initialize the grand total array
+ grandTotal.clear();
+ for ( int i = 0; i < rFooter.getCalcFieldCount(); i++ )
+ grandTotal.append( new QMemArray<double> );
+
+ // Create the first page
+ startPage( pages );
+
+ // Draw the detail section by looping through all the records
+ int chkRow = 0;
+ int curDetailLevel = 0;
+ int prevDetailLevel = -1;
+ int curDetailHeader = -1;
+ int curDetailFooter = -1;
+
+ for ( j = 0; j < rowCount; j++ )
+ {
+ QString detailValue;
+ QDomNode record = records.item( j );
+
+ if ( ( record.nodeType() == QDomNode::ElementNode )
+ && ( record.nodeName() == "Row" ) )
+ {
+ // Update status event
+ if ( ( chkRow = ( j / 2 ) % 20 ) == 0 )
+ emit signalRenderStatus( j / 2 );
+
+ // Check for cancel action
+ if ( cancelRender )
+ {
+ p.end();
+ delete pages;
+ return 0;
+ }
+
+ // Process the record ...
+ QDomNamedNodeMap fields = record.attributes();
+
+ // Find the detail object to process with rendering
+ detailValue = fields.namedItem( "level" ).nodeValue();
+ curDetailLevel = detailValue.toInt();
+
+ // Reset the header/footer detail levels?
+ curDetailHeader = curDetailLevel > curDetailHeader ? -1 : curDetailHeader;
+ curDetailFooter = curDetailLevel > curDetailFooter ? -1 : curDetailFooter;
+
+ // Draw detail footer if appropriate
+ if ( curDetailLevel <= prevDetailLevel )
+ {
+ // Draw footer for previous detail levels
+ // from prevDetailLevel up to curDetailLevel
+ // Draw footer for current detail level
+ for ( int i = prevDetailLevel; i >= curDetailLevel; i-- )
+ {
+ MReportSection *footer = findDetailFooter( i );
+ if ( footer )
+ {
+ footer->setPageNumber( currPage );
+ footer->setReportDate( currDate );
+ footer->setCalcFieldData( &grandTotal );
+ if ( ( currY + footer->getHeight() ) > currHeight )
+ {
+ newPage( pages );
+ }
+ footer->draw( &p, leftMargin, currY );
+ currY += footer->getHeight();
+ }
+ }
+ }
+
+ MReportDetail *detail = findDetail( detailValue.toInt() );
+ detail->setPageNumber( currPage );
+ detail->setReportDate( currDate );
+
+ int headerHeight = 0;
+ MReportSection * header = findDetailHeader( curDetailLevel );
+ if ( header && curDetailHeader != curDetailLevel )
+ headerHeight = header->getHeight();
+
+ bool repeating = ( currY + detail->getHeight() + headerHeight ) > currHeight ||
+ ( detail->getRepeat() && currY + heightOfDetails > currHeight );
+ if ( repeating )
+ {
+ newPage( pages );
+
+ MReportDetail *sec;
+ for ( sec = details.first(); sec; sec = details.next() )
+ {
+ if ( sec->getLevel() != curDetailLevel && sec->getRepeat() )
+ {
+ sec->draw( &p, leftMargin, currY );
+ currY += sec->getHeight();
+ }
+ }
+ }
+
+ // Draw detail header for level curDetailLevel
+ // if it hasn't already been drawn
+ if ( curDetailHeader != curDetailLevel || repeating )
+ {
+ MReportSection * header = findDetailHeader( curDetailLevel );
+ if ( header )
+ {
+ header->setPageNumber( currPage );
+ header->setReportDate( currDate );
+ if ( ( currY + header->getHeight() ) > currHeight )
+ {
+ newPage( pages );
+ }
+ header->draw( &p, leftMargin, currY );
+ currY += header->getHeight();
+ curDetailHeader = curDetailLevel;
+ }
+ }
+
+ unsigned int fieldCount = detail->getFieldCount();
+ for ( i = 0; i < fieldCount; i++ )
+ {
+ // Get the field value
+ detailValue = fields.namedItem( detail->getFieldName( i ) ).nodeValue();
+ // Set the field
+ detail->setFieldData( i, detailValue );
+ // Set the grand total data
+ int calcIdx = rFooter.getCalcFieldIndex( detail->getFieldName( i ) );
+ if ( calcIdx != -1 )
+ {
+ int vsize = grandTotal.at( calcIdx ) ->size();
+ grandTotal.at( calcIdx ) ->resize( vsize + 1 );
+ grandTotal.at( calcIdx ) ->at( vsize ) = detailValue.toDouble();
+ }
+ }
+
+ detail->draw( &p, leftMargin, currY );
+ currY += detail->getHeight();
+ prevDetailLevel = curDetailLevel;
+ }
+ }
+
+ // Draw detail footers that were not drawn before
+ // for details from curDetailLevel up to prevDetailLevel
+ for ( int i = prevDetailLevel; i >= 0; i-- )
+ {
+ MReportSection *footer = findDetailFooter( i );
+ if ( footer )
+ {
+ footer->setPageNumber( currPage );
+ footer->setReportDate( currDate );
+ footer->setCalcFieldData( &grandTotal );
+ if ( ( currY + footer->getHeight() ) > currHeight )
+ {
+ newPage( pages );
+ }
+
+ footer->draw( &p, leftMargin, currY );
+ currY += footer->getHeight();
+ }
+ }
+
+ // Finish the last page of the report
+ endPage( pages );
+
+ // Destroy the page painter
+ p.end();
+
+ // Set the page collection attributes
+ pages->setPageDimensions( QSize( pageWidth, pageHeight ) );
+ pages->setPageSize( pageSize );
+ pages->setPageOrientation( pageOrientation );
+
+ // Send final status
+ emit signalRenderStatus( rowCount / 2 );
+ m_needRegeneration = false;
+ m_pageCollection = pages;
+ return pages;
+}
+
+/** Starts a new page of the report */
+void MReportEngine::startPage( MPageCollection* pages )
+{
+ // Set the current y pos
+ currY = topMargin;
+
+ // Create a new page
+ pages->appendPage();
+ // Increment the page count
+ currPage++;
+
+ // Set the page painter to the current page
+ p.begin( pages->getCurrentPage() );
+
+ // Draw the report header
+ drawReportHeader( pages );
+ // Draw the page header
+ drawPageHeader( pages );
+}
+
+/** Finishes the current page of the report */
+void MReportEngine::endPage( MPageCollection* pages )
+{
+ // Draw the report footer
+ drawReportFooter( pages );
+ // Draw the page footer
+ drawPageFooter( pages );
+}
+
+/** Finishes the current page and adds a new page */
+void MReportEngine::newPage( MPageCollection* pages )
+{
+ // Draw the page footer
+ drawPageFooter( pages );
+
+ // Stop the painter
+ p.end();
+
+ // Start a new page
+ startPage( pages );
+}
+
+/** Draws the report header object to the current page */
+void MReportEngine::drawReportHeader( MPageCollection* pages )
+{
+ if ( rHeader.getHeight() == 0 )
+ return ;
+
+ if ( ( rHeader.printFrequency() == MReportSection::FirstPage && currPage == 1 )
+ || ( rHeader.printFrequency() == MReportSection::EveryPage ) )
+ {
+
+ rHeader.setPageNumber( currPage );
+ rHeader.setReportDate( currDate );
+ rHeader.draw( &p, leftMargin, currY );
+ currY += rHeader.getHeight();
+ }
+}
+
+/** Draws the page header to the current page */
+void MReportEngine::drawPageHeader( MPageCollection* pages )
+{
+ if ( pHeader.getHeight() == 0 )
+ return ;
+
+ if ( ( currY + pHeader.getHeight() ) > currHeight )
+ newPage( pages );
+
+ if ( ( pHeader.printFrequency() == MReportSection::FirstPage && currPage == 1 )
+ || ( pHeader.printFrequency() == MReportSection::EveryPage ) )
+ {
+
+ pHeader.setPageNumber( currPage );
+ pHeader.setReportDate( currDate );
+ pHeader.draw( &p, leftMargin, currY );
+ currY += pHeader.getHeight();
+ }
+}
+
+/** Draws the page footer to the current page */
+void MReportEngine::drawPageFooter( MPageCollection* pages )
+{
+ if ( pFooter.getHeight() == 0 )
+ return ;
+
+ if ( ( pFooter.printFrequency() == MReportSection::FirstPage && currPage == 1 )
+ || ( pFooter.printFrequency() == MReportSection::EveryPage ) )
+ {
+
+ pFooter.setPageNumber( currPage );
+ pFooter.setReportDate( currDate );
+ pFooter.draw( &p, leftMargin, ( pageHeight - bottomMargin ) - pFooter.getHeight() );
+ currY += pFooter.getHeight();
+ }
+}
+
+/** Draws the report footer to the current page */
+void MReportEngine::drawReportFooter( MPageCollection* pages )
+{
+ if ( rFooter.getHeight() == 0 )
+ return ;
+
+ if ( ( currY + rFooter.getHeight() ) > currHeight )
+ newPage( pages );
+
+ if ( ( rFooter.printFrequency() == MReportSection::EveryPage )
+ || ( rFooter.printFrequency() == MReportSection::LastPage ) )
+ {
+
+ rFooter.setCalcFieldData( &grandTotal );
+
+ rFooter.setPageNumber( currPage );
+ rFooter.setReportDate( currDate );
+ rFooter.draw( &p, leftMargin, currY );
+ currY += rFooter.getHeight();
+ }
+}
+
+/** Gets the metrics for the selected page size & orientation */
+QSize MReportEngine::getPageMetrics( int size, int orientation )
+{
+
+ QPrinter * printer;
+ QSize ps;
+
+ // Set the page size
+ printer = new QPrinter();
+ printer->setFullPage( true );
+ printer->setPageSize( ( QPrinter::PageSize ) size );
+ printer->setOrientation( ( QPrinter::Orientation ) orientation );
+
+ // Get the page metrics
+ QPaintDeviceMetrics pdm( printer );
+
+ // Display the first page of the report
+ ps.setWidth( pdm.width() );
+ ps.setHeight( pdm.height() );
+
+ delete printer;
+
+ return ps;
+}
+
+
+/**
+This recalculates report dimensions to 96 dpi, standard on Windows
+platform.
+
+FIXME: TODO: get the proper screen resolution and not hardcode 96dpi
+FIXME: TODO: make this function work on X11 too
+*/
+void MReportEngine::recalcDimensions()
+{
+ QDomNode report;
+ QDomNode child;
+ for ( report = rt.firstChild(); !report.isNull(); report = report.nextSibling() )
+ if ( report.nodeName() == "KugarTemplate" )
+ break;
+
+ QDomNamedNodeMap rattributes = report.attributes();
+ recalcAttribute( "BottomMargin", rattributes );
+ recalcAttribute( "TopMargin", rattributes );
+ recalcAttribute( "LeftMargin", rattributes );
+ recalcAttribute( "RightMargin", rattributes );
+
+ QDomNodeList children = report.childNodes();
+ int childCount = children.length();
+
+ for ( int j = 0; j < childCount; j++ )
+ {
+ child = children.item( j );
+ QDomNamedNodeMap attributes = child.attributes();
+
+ QDomNodeList children2 = child.childNodes();
+ int childCount2 = children2.length();
+ recalcAttribute( "Height", attributes );
+
+ for ( int k = 0; k < childCount2; k++ )
+ {
+ QDomNode child2 = children2.item( k );
+ QDomNamedNodeMap attributes = child2.attributes();
+ recalcAttribute( "X", attributes );
+ recalcAttribute( "Y", attributes );
+ recalcAttribute( "Width", attributes );
+ recalcAttribute( "Height", attributes );
+ recalcAttribute( "X1", attributes );
+ recalcAttribute( "X2", attributes );
+ recalcAttribute( "Y1", attributes );
+ recalcAttribute( "Y2", attributes );
+ }
+ }
+
+}
+
+void MReportEngine::recalcAttribute( const QString& name, QDomNamedNodeMap attributes )
+{
+ if ( !attributes.namedItem( name ).isNull() )
+ {
+ attributes.namedItem( name ).setNodeValue( QString( "%1" ).arg( attributes.namedItem( name ).nodeValue().toInt() * 93 / 81 ) );
+ }
+}
+
+/** Walks the document tree, setting the report layout */
+void MReportEngine::initTemplate()
+{
+ heightOfDetails = 0;
+
+#ifdef Q_WS_WIN
+
+ recalcDimensions();
+#endif
+
+ QDomNode report;
+ QDomNode child;
+
+ m_needRegeneration = true;
+ // Get the report - assume there is only one.
+
+ for ( report = rt.firstChild(); !report.isNull(); report = report.nextSibling() )
+ if ( report.nodeName() == "KugarTemplate" )
+ break;
+
+ setReportAttributes( &report );
+
+ // Get all the child report elements
+ QDomNodeList children = report.childNodes();
+ int childCount = children.length();
+
+ for ( int j = 0; j < childCount; j++ )
+ {
+ child = children.item( j );
+
+ if ( child.nodeType() == QDomNode::ElementNode )
+ {
+ // Report Header
+ if ( child.nodeName() == "ReportHeader" )
+ setSectionAttributes( &rHeader, &child );
+ else if ( child.nodeName() == "PageHeader" )
+ setSectionAttributes( &pHeader, &child );
+ else if ( child.nodeName() == "DetailHeader" )
+ {
+ MReportSection * dHeader = new MReportSection;
+ dHeaders.append( dHeader );
+ setDetMiscAttributes( dHeader, &child );
+ }
+ else if ( child.nodeName() == "Detail" )
+ setDetailAttributes( &child );
+ else if ( child.nodeName() == "DetailFooter" )
+ {
+ MReportSection * dFooter = new MReportSection;
+ setDetMiscAttributes( dFooter, &child );
+ dFooters.append( dFooter );
+ }
+ else if ( child.nodeName() == "PageFooter" )
+ setSectionAttributes( &pFooter, &child );
+ else if ( child.nodeName() == "ReportFooter" )
+ setSectionAttributes( &rFooter, &child );
+ }
+ }
+}
+
+/** Sets the main layout attributes for the report */
+void MReportEngine::setReportAttributes( QDomNode* report )
+{
+ // Get the attributes for the report
+ QDomNamedNodeMap attributes = report->attributes();
+
+ pageSize = attributes.namedItem( "PageSize" ).nodeValue().toInt();
+ pageOrientation = attributes.namedItem( "PageOrientation" ).nodeValue().toInt();
+ int templateWidth = attributes.namedItem( "PageWidth" ).nodeValue().toInt();
+ int templateheight = attributes.namedItem( "PageHeight" ).nodeValue().toInt();
+
+ QSize ps = getPageMetrics( pageSize, pageOrientation );
+ pageWidth = ps.width();
+ pageHeight = ps.height();
+
+ widthDelta = ( float ) pageWidth / templateWidth;
+ heightDelta = ( float ) pageHeight / templateheight;
+
+ kdDebug( 30001 ) << "pagewidth: " << pageWidth
+ << " pageheight: " << pageHeight << "\n"
+ << "templateWidth: " << templateWidth
+ << " templateheight: " << templateheight << "\n"
+ << "widthDelta: " << widthDelta
+ << " heightDelta: " << heightDelta
+ << endl;
+
+ topMargin = scaleDeltaHeight( attributes.namedItem( "TopMargin" ).nodeValue().toInt() );
+ bottomMargin = scaleDeltaHeight( attributes.namedItem( "BottomMargin" ).nodeValue().toInt() );
+ leftMargin = scaleDeltaWidth( attributes.namedItem( "LeftMargin" ).nodeValue().toInt() );
+ rightMargin = scaleDeltaWidth( attributes.namedItem( "RightMargin" ).nodeValue().toInt() );
+}
+
+int MReportEngine::scaleDeltaWidth( int width ) const
+{
+ float f = width * widthDelta;
+ return f > 1 ? int( f + 0.5) : ceil( f );
+}
+
+int MReportEngine::scaleDeltaHeight( int height ) const
+{
+ float f = height * heightDelta;
+ return f > 1 ? int( f + 0.5 ) : ceil( f );
+}
+
+/** Sets the layout attributes for the given report section */
+void MReportEngine::setSectionAttributes( MReportSection* section, QDomNode* report )
+{
+ // Get the attributes for the section
+ QDomNamedNodeMap attributes = report->attributes();
+
+ // Get the section attributes
+ section->setHeight( scaleDeltaHeight( attributes.namedItem( "Height" ).nodeValue().toInt() ) );
+ section->setPrintFrequency( attributes.namedItem( "PrintFrequency" ).nodeValue().toInt() );
+
+ // Process the sections labels
+ QDomNodeList children = report->childNodes();
+ int childCount = children.length();
+
+ // For each label, extract the attr list and add the new label
+ // to the sections's label collection
+ for ( int j = 0; j < childCount; j++ )
+ {
+ QDomNode child = children.item( j );
+ if ( child.nodeType() == QDomNode::ElementNode )
+ {
+ if ( child.nodeName() == "Line" )
+ {
+ QDomNamedNodeMap attributes = child.attributes();
+ MLineObject* line = new MLineObject();
+ setLineAttributes( line, &attributes );
+ section->addLine( line );
+ }
+ else if ( child.nodeName() == "Label" )
+ {
+ QDomNamedNodeMap attributes = child.attributes();
+ MLabelObject* label = new MLabelObject();
+ setLabelAttributes( label, &attributes );
+ section->addLabel( label );
+ }
+ else if ( child.nodeName() == "Special" )
+ {
+ QDomNamedNodeMap attributes = child.attributes();
+ MSpecialObject* field = new MSpecialObject();
+ setSpecialAttributes( field, &attributes );
+ section->addSpecialField( field );
+ }
+ else if ( child.nodeName() == "CalculatedField" )
+ {
+ QDomNamedNodeMap attributes = child.attributes();
+ MCalcObject* field = new MCalcObject();
+ setCalculatedFieldAttributes( field, &attributes );
+ section->addCalculatedField( field );
+ }
+ else if ( child.nodeName() == "Field" )
+ {
+ QDomNamedNodeMap attributes = child.attributes();
+ MFieldObject* field = new MFieldObject();
+ setFieldAttributes( field, &attributes );
+ section->addField( field );
+ }
+ }
+ }
+}
+
+/** Sets the layout attributes for the detail headers and footers */
+void MReportEngine::setDetMiscAttributes( MReportSection* section, QDomNode* report )
+{
+ // Get the attributes for the section
+ QDomNamedNodeMap attributes = report->attributes();
+
+ // Get the section attributes
+ section->setLevel( attributes.namedItem( "Level" ).nodeValue().toInt() );
+
+ // Set other section attributes
+ setSectionAttributes( section, report );
+}
+
+
+/** Sets the layout attributes for the detail section */
+void MReportEngine::setDetailAttributes( QDomNode* report )
+{
+ // Get the attributes for the detail section
+ QDomNamedNodeMap attributes = report->attributes();
+
+ // Get the report detail attributes
+ MReportDetail *detail = new MReportDetail;
+ int height = scaleDeltaHeight( attributes.namedItem( "Height" ).nodeValue().toInt() );
+ heightOfDetails += height;
+ detail->setHeight( height );
+ detail->setLevel( attributes.namedItem( "Level" ).nodeValue().toInt() );
+ detail->setRepeat( attributes.namedItem( "Repeat" ).nodeValue() == "true" );
+
+ // Process the report detail labels
+ QDomNodeList children = report->childNodes();
+ int childCount = children.length();
+
+ for ( int j = 0; j < childCount; j++ )
+ {
+ QDomNode child = children.item( j );
+ if ( child.nodeType() == QDomNode::ElementNode )
+ {
+ if ( child.nodeName() == "Line" )
+ {
+ QDomNamedNodeMap attributes = child.attributes();
+ MLineObject* line = new MLineObject();
+ setLineAttributes( line, &attributes );
+ detail->addLine( line );
+ }
+ else if ( child.nodeName() == "Label" )
+ {
+ QDomNamedNodeMap attributes = child.attributes();
+ MLabelObject* label = new MLabelObject();
+ setLabelAttributes( label, &attributes );
+ detail->addLabel( label );
+ }
+ else if ( child.nodeName() == "Special" )
+ {
+ QDomNamedNodeMap attributes = child.attributes();
+ MSpecialObject* field = new MSpecialObject();
+ setSpecialAttributes( field, &attributes );
+ detail->addSpecialField( field );
+ }
+ else if ( child.nodeName() == "Field" )
+ {
+ QDomNamedNodeMap attributes = child.attributes();
+ MFieldObject* field = new MFieldObject();
+ setFieldAttributes( field, &attributes );
+ detail->addField( field );
+ }
+ }
+ }
+ // Append a newly created detail to the list
+ details.append( detail );
+}
+
+/** Sets a line's layout attributes */
+void MReportEngine::setLineAttributes( MLineObject* line, QDomNamedNodeMap* attr )
+{
+ line->setLine( scaleDeltaWidth( attr->namedItem( "X1" ).nodeValue().toInt() ),
+ scaleDeltaHeight( attr->namedItem( "Y1" ).nodeValue().toInt() ),
+ scaleDeltaWidth( attr->namedItem( "X2" ).nodeValue().toInt() ),
+ scaleDeltaHeight( attr->namedItem( "Y2" ).nodeValue().toInt() ) );
+
+ QString tmp = attr->namedItem( "Color" ).nodeValue();
+
+ line->setColor( tmp.left( tmp.find( "," ) ).toInt(),
+ tmp.mid( tmp.find( "," ) + 1, ( tmp.findRev( "," ) - tmp.find( "," ) ) - 1 ).toInt(),
+ tmp.right( tmp.length() - tmp.findRev( "," ) - 1 ).toInt() );
+
+ line->setWidth( attr->namedItem( "Width" ).nodeValue().toInt() );
+ line->setStyle( attr->namedItem( "Style" ).nodeValue().toInt() );
+}
+
+/** Sets a label's layout attributes */
+void MReportEngine::setLabelAttributes( MLabelObject* label, QDomNamedNodeMap* attr )
+{
+ QString tmp;
+
+ label->setText( attr->namedItem( "Text" ).nodeValue() );
+ label->setGeometry( scaleDeltaWidth( attr->namedItem( "X" ).nodeValue().toInt() ),
+ scaleDeltaHeight( attr->namedItem( "Y" ).nodeValue().toInt() ),
+ scaleDeltaWidth( attr->namedItem( "Width" ).nodeValue().toInt() ),
+ scaleDeltaHeight( attr->namedItem( "Height" ).nodeValue().toInt() ) );
+
+ tmp = attr->namedItem( "BackgroundColor" ).nodeValue();
+ label->setBackgroundColor( tmp.left( tmp.find( "," ) ).toInt(),
+ tmp.mid( tmp.find( "," ) + 1, ( tmp.findRev( "," ) - tmp.find( "," ) ) - 1 ).toInt(),
+ tmp.right( tmp.length() - tmp.findRev( "," ) - 1 ).toInt() );
+
+ tmp = attr->namedItem( "ForegroundColor" ).nodeValue();
+ label->setForegroundColor( tmp.left( tmp.find( "," ) ).toInt(),
+ tmp.mid( tmp.find( "," ) + 1, ( tmp.findRev( "," ) - tmp.find( "," ) ) - 1 ).toInt(),
+ tmp.right( tmp.length() - tmp.findRev( "," ) - 1 ).toInt() );
+
+ tmp = attr->namedItem( "BorderColor" ).nodeValue();
+ label->setBorderColor( tmp.left( tmp.find( "," ) ).toInt(),
+ tmp.mid( tmp.find( "," ) + 1, ( tmp.findRev( "," ) - tmp.find( "," ) ) - 1 ).toInt(),
+ tmp.right( tmp.length() - tmp.findRev( "," ) - 1 ).toInt() );
+
+ label->setBorderWidth( attr->namedItem( "BorderWidth" ).nodeValue().toInt() );
+ label->setBorderStyle( attr->namedItem( "BorderStyle" ).nodeValue().toInt() );
+ if ( !attr->namedItem( "DrawBottom" ).isNull() )
+ label->setDrawBottom( attr->namedItem( "DrawBottom" ).nodeValue() == "true" );
+ if ( !attr->namedItem( "DrawTop" ).isNull() )
+ label->setDrawTop( attr->namedItem( "DrawTop" ).nodeValue() == "true" );
+ if ( !attr->namedItem( "DrawLeft" ).isNull() )
+ label->setDrawLeft( attr->namedItem( "DrawLeft" ).nodeValue() == "true" );
+ if ( !attr->namedItem( "DrawRight" ).isNull() )
+ label->setDrawRight( attr->namedItem( "DrawRight" ).nodeValue() == "true" );
+ label->setFont( attr->namedItem( "FontFamily" ).nodeValue(),
+ attr->namedItem( "FontSize" ).nodeValue().toInt(),
+ attr->namedItem( "FontWeight" ).nodeValue().toInt(),
+ ( attr->namedItem( "FontItalic" ).nodeValue().toInt() == 0 ? false : true ) );
+ label->setHorizontalAlignment( attr->namedItem( "HAlignment" ).nodeValue().toInt() );
+ label->setVerticalAlignment( attr->namedItem( "VAlignment" ).nodeValue().toInt() );
+ label->setWordWrap( attr->namedItem( "WordWrap" ).nodeValue().toInt() == 0 ? false : true );
+}
+
+/** Sets a special field's layout attributes */
+void MReportEngine::setSpecialAttributes( MSpecialObject* field, QDomNamedNodeMap* attr )
+{
+ field->setType( attr->namedItem( "Type" ).nodeValue().toInt() );
+ field->setDateFormat( attr->namedItem( "DateFormat" ).nodeValue().toInt() );
+
+ setLabelAttributes( ( MLabelObject * ) field, attr );
+}
+
+/** Sets a field's layout attributes */
+void MReportEngine::setFieldAttributes( MFieldObject* field, QDomNamedNodeMap* attr )
+{
+ field->setFieldName( attr->namedItem( "Field" ).nodeValue() );
+ field->setDataType( attr->namedItem( "DataType" ).nodeValue().toInt() );
+ field->setDateFormat( attr->namedItem( "DateFormat" ).nodeValue().toInt() );
+ field->setPrecision( attr->namedItem( "Precision" ).nodeValue().toInt() );
+ field->setCurrency( attr->namedItem( "Currency" ).nodeValue().toInt() );
+ field->setCommaSeparator( attr->namedItem( "CommaSeparator" ).nodeValue().toInt() );
+ field->setInputMask( attr->namedItem( "InputMask" ).nodeValue() );
+
+ QString tmp = attr->namedItem( "NegValueColor" ).nodeValue();
+
+ field->setNegValueColor( tmp.left( tmp.find( "," ) ).toInt(),
+ tmp.mid( tmp.find( "," ) + 1, ( tmp.findRev( "," ) - tmp.find( "," ) ) - 1 ).toInt(),
+ tmp.right( tmp.length() - tmp.findRev( "," ) - 1 ).toInt() );
+
+ setLabelAttributes( ( MLabelObject * ) field, attr );
+}
+
+/** Sets a calculated field's layout attributes */
+void MReportEngine::setCalculatedFieldAttributes( MCalcObject* field, QDomNamedNodeMap* attr )
+{
+ field->setCalculationType( attr->namedItem( "CalculationType" ).nodeValue().toInt() );
+ setFieldAttributes( ( MFieldObject * ) field, attr );
+}
+
+/** Copies member data from one object to another.
+ Used by the copy constructor and assignment operator */
+void MReportEngine::copy( const MReportEngine* mReportEngine )
+{
+ // Copy document data
+ m_refCount = 1;
+ rd = mReportEngine->rd;
+ rt = mReportEngine->rt;
+
+ // Copy page metrics
+ pageSize = mReportEngine->pageSize;
+ pageOrientation = mReportEngine->pageOrientation;
+ topMargin = mReportEngine->topMargin;
+ bottomMargin = mReportEngine->bottomMargin;
+ leftMargin = mReportEngine->leftMargin;
+ rightMargin = mReportEngine->rightMargin;
+ pageWidth = mReportEngine->pageWidth;
+ pageHeight = mReportEngine->pageHeight;
+ heightOfDetails = mReportEngine->heightOfDetails;
+
+ // Copy the report header
+ rHeader = mReportEngine->rHeader;
+ // Copy the page header
+ pHeader = mReportEngine->pHeader;
+ // Copy the detail sections
+ MReportDetail *detail;
+ QPtrList<MReportDetail> temp = mReportEngine->details;
+ temp.setAutoDelete( false );
+ for ( detail = temp.first(); detail; detail = temp.next() )
+ {
+ MReportDetail * new_detail = new MReportDetail;
+ *new_detail = *detail;
+ details.append( new_detail );
+ }
+ // Copy the page footer
+ pFooter = mReportEngine->pFooter;
+ // Copy the report footer
+ rFooter = mReportEngine->rFooter;
+
+ // Copy the rendering state
+ currY = mReportEngine->currY;
+ currHeight = mReportEngine->currHeight;
+ currPage = mReportEngine->currPage;
+ currDate = mReportEngine->currDate;
+ cancelRender = mReportEngine->cancelRender;
+
+ // Copy grand totals list
+ grandTotal = mReportEngine->grandTotal;
+ m_pageCollection = mReportEngine->m_pageCollection;
+ m_needRegeneration = mReportEngine->m_needRegeneration;
+ if ( m_pageCollection )
+ m_pageCollection->addRef();
+}
+
+}
+
+#include "mreportengine.moc"
diff --git a/kugar/lib/mreportengine.h b/kugar/lib/mreportengine.h
new file mode 100644
index 00000000..c8280c1d
--- /dev/null
+++ b/kugar/lib/mreportengine.h
@@ -0,0 +1,210 @@
+/***************************************************************************
+ mreportengine.h - Kugar report engine
+ -------------------
+ begin : Sun Aug 15 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+ copyright : (C) 2002 Alexander Dymo
+***************************************************************************/
+
+#ifndef MREPORTENGINE_H
+#define MREPORTENGINE_H
+
+#include <qobject.h>
+#include <qpicture.h>
+#include <qpaintdevicemetrics.h>
+#include <qsize.h>
+#include <qmemarray.h>
+#include <qdom.h>
+#include <qguardedptr.h>
+
+#include "mlineobject.h"
+#include "mlabelobject.h"
+#include "mspecialobject.h"
+#include "mfieldobject.h"
+#include "mreportsection.h"
+#include "mreportdetail.h"
+#include "mpagecollection.h"
+
+/**Kugar report engine
+ *@author Mutiny Bay Software
+ */
+
+namespace Kugar
+{
+
+class MReportEngine : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum PageOrientation { Portrait, Landscape };
+
+ enum PageSize {
+ A4, B5, Letter, Legal, Executive,
+ A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1,
+ B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E,
+ DLE, Folio, Ledger, Tabloid, NPageSize
+ };
+
+ MReportEngine();
+ MReportEngine( const MReportEngine& mReportEngine );
+ MReportEngine operator=( const MReportEngine& mReportEngine );
+ virtual ~MReportEngine();
+
+ bool setReportData( const QString & );
+ bool setReportData( QIODevice * );
+ bool setReportData( const QDomDocument& );
+ bool setReportTemplate( const QString & );
+ bool setReportTemplate( QIODevice * );
+ int getRenderSteps()
+ {
+ return records.length() / 2;
+ }
+ MPageCollection* renderReport();
+
+ void addRef();
+ void removeRef();
+public slots:
+ void slotCancelRendering();
+
+signals:
+ void signalRenderStatus( int );
+ void preferedTemplate( const QString & );
+
+protected:
+ void recalcDimensions();
+ void recalcAttribute( const QString& name, QDomNamedNodeMap attributes );
+
+private:
+
+ MPageCollection *m_pageCollection;
+ bool m_needRegeneration;
+ /** Report data document */
+ QDomDocument rd;
+ /** Report template document */
+ QDomDocument rt;
+
+ /** Report painter */
+ QPainter p;
+
+ /** Report page size */
+ int pageSize;
+ /** Report page orientation */
+ int pageOrientation;
+ /** Report top margin */
+ int topMargin;
+ /** Report top margin */
+ int bottomMargin;
+ /** Report top margin */
+ int leftMargin;
+ /** Report top margin */
+ int rightMargin;
+
+ /** Report page width */
+ int pageWidth;
+ /** Report page height */
+ int pageHeight;
+
+ float widthDelta;
+ float heightDelta;
+
+ /** Report header */
+ MReportSection rHeader;
+ /** Page header */
+ MReportSection pHeader;
+ /** Detail headers */
+ QPtrList<MReportSection> dHeaders;
+ /** Detail sections */
+ QPtrList<MReportDetail> details;
+ /** Detail footers */
+ QPtrList<MReportSection> dFooters;
+ /** Page footer */
+ MReportSection pFooter;
+ /** Report footer */
+ MReportSection rFooter;
+
+ /** Stores the combined heights of the detail levels */
+ int heightOfDetails;
+
+ /** Current y position on page */
+ int currY;
+ /** Current height of page excluding margins */
+ int currHeight;
+ /** Current page number */
+ int currPage;
+ /** Current report date */
+ QDate currDate;
+
+ /** Grand total array */
+ QPtrList<QMemArray<double> > grandTotal;
+
+ /** Cancel rendering flag */
+ bool cancelRender;
+ int m_refCount;
+private:
+ // The set of records being rendered.
+ QDomNodeList records;
+ /** Clears report formatting */
+ void clearFormatting();
+ /** Starts a new page of the report */
+ void startPage( MPageCollection* pages );
+ /** Finishes the current page of the report */
+ void endPage( MPageCollection* pages );
+ /** Finishes the current page and adds a new page */
+ void newPage( MPageCollection* pages );
+ /** Draws the report header object to the current page */
+ void drawReportHeader( MPageCollection* pages );
+ /** Draws the page header to the current page */
+ void drawPageHeader( MPageCollection* pages );
+ /** Draws the page footer to the current page */
+ void drawPageFooter( MPageCollection* pages );
+ /** Draws the report footer to the current page */
+ void drawReportFooter( MPageCollection* pages );
+
+ /** Gets the metrics for the selected page size */
+ QSize getPageMetrics( int size, int orientation );
+
+ void initData();
+ void initTemplate();
+
+ /** Sets the main layout attributes for the report */
+ void setReportAttributes( QDomNode* report );
+
+ int scaleDeltaWidth( int width ) const;
+ int scaleDeltaHeight( int width ) const;
+
+ /** Sets the layout attributes for the given report section */
+ void setSectionAttributes( MReportSection* section, QDomNode* report );
+ /** Sets the layout attributes for the detail headers and footers */
+ void setDetMiscAttributes( MReportSection* section, QDomNode* report );
+ /** Sets the layout attributes for the detail section */
+ void setDetailAttributes( QDomNode* report );
+ /** Sets a line's layout attributes */
+ void setLineAttributes( MLineObject* line, QDomNamedNodeMap* attr );
+ /** Sets a label's layout attributes */
+ void setLabelAttributes( MLabelObject* label, QDomNamedNodeMap* attr );
+ /** Sets a special field's layout attributes */
+ void setSpecialAttributes( MSpecialObject* field, QDomNamedNodeMap* attr );
+ /** Sets a field's layout attributes */
+ void setFieldAttributes( MFieldObject* field, QDomNamedNodeMap* attr );
+ /** Sets a calculated field's layout attributes */
+ void setCalculatedFieldAttributes( MCalcObject* field, QDomNamedNodeMap* attr );
+
+ /** Copies member data from one object to another.
+ * Used by the copy constructor and assignment operator
+ */
+ void copy( const MReportEngine* mReportEngine );
+
+ /** Finds the detail header object, which is apropriate for the given level */
+ MReportSection *findDetailHeader( int level );
+ /** Finds the detail object, which is apropriate for the given level */
+ MReportDetail *findDetail( int level );
+ /** Finds the detail footer object, which is apropriate for the given level */
+ MReportSection *findDetailFooter( int level );
+};
+
+}
+
+#endif
diff --git a/kugar/lib/mreportobject.cpp b/kugar/lib/mreportobject.cpp
new file mode 100644
index 00000000..d7e065f5
--- /dev/null
+++ b/kugar/lib/mreportobject.cpp
@@ -0,0 +1,225 @@
+/***************************************************************************
+ mreportobject.cpp - Kugar report object baseclass
+ -------------------
+ begin : Wed Aug 11 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+ copyright : (C) 2004 Alexander Dymo
+***************************************************************************/
+
+#include "mreportobject.h"
+
+namespace Kugar
+{
+
+/** Constructor */
+MReportObject::MReportObject() : QObject()
+{
+ // Set the object's default geometry
+ xpos = 0;
+ ypos = 0;
+ width = 40;
+ height = 23;
+
+ // Set the object's default colors
+ backgroundColor.setRgb( 255, 255, 255 );
+ foregroundColor.setRgb( 0, 0, 0 );
+
+ // Set the object's default border attributes
+ borderColor.setRgb( 0, 0, 0 );
+ borderWidth = 1;
+ borderStyle = MReportObject::SolidLine;
+
+ drawLeft = true;
+ drawRight = true;
+ drawTop = true;
+ drawBottom = true;
+}
+
+/** Copy constructor */
+MReportObject::MReportObject( const MReportObject& mReportObject ) /*: QObject((QObject &) mReportObject)*/
+{
+ copy( &mReportObject );
+}
+
+/** Assignment operator */
+MReportObject MReportObject::operator=( const MReportObject& mReportObject )
+{
+ if ( &mReportObject == this )
+ return * this;
+
+ // Copy the derived class's data
+ copy( &mReportObject );
+
+ // Copy the base class's data
+ //((QObject &) *this) = mReportObject;
+
+ return *this;
+}
+
+/** Destructor */
+MReportObject::~MReportObject()
+{}
+
+/** Draws the object to the specified painter & x/y offsets */
+void MReportObject::draw( QPainter* p, int xoffset, int yoffset )
+{
+ drawBase( p, xoffset, yoffset );
+}
+
+/** Draws the base object to the specified painter & x/y offsets */
+void MReportObject::drawBase( QPainter* p, int xoffset, int yoffset )
+{
+ QBrush bgBrush( backgroundColor );
+ QPen borderPen( borderColor, borderWidth, ( QPen::PenStyle ) borderStyle );
+
+ // Set the offsets
+ int xcalc = xpos + xoffset;
+ int ycalc = ypos + yoffset;
+
+ // Set background in specified color
+ p->setBrush( bgBrush );
+ p->setPen( Qt::NoPen );
+ p->drawRect( xcalc, ycalc, width, height );
+
+ // Set border
+ if ( borderStyle != 0 )
+ {
+ p->setPen( borderPen );
+ if ( drawLeft )
+ p->drawLine( xcalc, ycalc, xcalc, ycalc + height );
+ if ( drawRight )
+ p->drawLine( xcalc + width, ycalc, xcalc + width, ycalc + height );
+ if ( drawTop )
+ p->drawLine( xcalc, ycalc, xcalc + width, ycalc );
+ if ( drawBottom )
+ p->drawLine( xcalc, ycalc + height, xcalc + width, ycalc + height );
+ // p->drawRect(xcalc, ycalc, width, height);
+ }
+ else
+ {
+ p->setPen( QPen( QColor( 255, 255, 255 ), 1, QPen::SolidLine ) );
+ p->drawRect( xcalc, ycalc, width, height );
+ }
+}
+
+/** Set the object's position and size */
+void MReportObject::setGeometry( int x, int y, int w, int h )
+{
+ xpos = x;
+ ypos = y;
+ width = w;
+ height = h;
+}
+
+/** Set the object's position */
+void MReportObject::move( int x, int y )
+{
+ xpos = x;
+ ypos = y;
+}
+
+/** Gets the object's x position */
+int MReportObject::getX()
+{
+ return xpos;
+}
+
+/** Gets the object's y position */
+int MReportObject::getY()
+{
+ return ypos;
+}
+
+/** Sets the object's background color */
+void MReportObject::setBackgroundColor( int r, int g, int b )
+{
+ backgroundColor.setRgb( r, g, b );
+}
+
+/** Sets the object's foreground color */
+void MReportObject::setForegroundColor( int r, int g, int b )
+{
+ foregroundColor.setRgb( r, g, b );
+}
+
+/** Sets the object's border color */
+void MReportObject::setBorderColor( int r, int g, int b )
+{
+ borderColor.setRgb( r, g, b );
+}
+
+/** Sets the object's border width */
+void MReportObject::setBorderWidth( int width )
+{
+ borderWidth = width;
+}
+
+/** Sets the object's border style */
+void MReportObject::setBorderStyle( int style )
+{
+ borderStyle = style;
+}
+
+/** Copies member data from one object to another.
+ Used by the copy constructor and assignment operator */
+void MReportObject::copy( const MReportObject* mReportObject )
+{
+ // Copy the object's geometry
+ xpos = mReportObject->xpos;
+ ypos = mReportObject->ypos;
+ width = mReportObject->width;
+ height = mReportObject->height;
+
+ // Copy the colors
+ backgroundColor = mReportObject->backgroundColor;
+ foregroundColor = mReportObject->foregroundColor;
+
+ // Copy the border attributes
+ borderColor = mReportObject->borderColor;
+ borderWidth = mReportObject->borderWidth;
+ borderStyle = mReportObject->borderStyle;
+}
+
+bool MReportObject::getDrawLeft( )
+{
+ return drawLeft;
+}
+
+bool MReportObject::getDrawRight( )
+{
+ return drawRight;
+}
+
+bool MReportObject::getDrawTop( )
+{
+ return drawTop;
+}
+
+bool MReportObject::getDrawBottom( )
+{
+ return drawBottom;
+}
+
+void MReportObject::setDrawLeft( bool d )
+{
+ drawLeft = d;
+}
+
+void MReportObject::setDrawRight( bool d )
+{
+ drawRight = d;
+}
+
+void MReportObject::setDrawTop( bool d )
+{
+ drawTop = d;
+}
+
+void MReportObject::setDrawBottom( bool d )
+{
+ drawBottom = d;
+}
+
+}
diff --git a/kugar/lib/mreportobject.h b/kugar/lib/mreportobject.h
new file mode 100644
index 00000000..ce28cf75
--- /dev/null
+++ b/kugar/lib/mreportobject.h
@@ -0,0 +1,127 @@
+/***************************************************************************
+ mreportobject.h - Kugar report object baseclass
+ -------------------
+ begin : Wed Aug 11 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+ copyright : (C) 2004 Alexander Dymo
+***************************************************************************/
+
+#ifndef MREPORTOBJECT_H
+#define MREPORTOBJECT_H
+
+#include <qobject.h>
+#include <qpainter.h>
+#include <qpaintdevice.h>
+#include <qcolor.h>
+
+/**Kugar report object baseclass
+ *@author Mutiny Bay Software
+ */
+
+namespace Kugar
+{
+
+class MReportObject : public QObject
+{
+
+public:
+ /** Border style constants */
+ enum BorderStyle { NoPen = 0, SolidLine, DashLine,
+ DotLine, DashDotLine, DashDotDotLine };
+
+ /** Constructor */
+ MReportObject();
+ /** Copy constructor */
+ MReportObject( const MReportObject& mReportObject );
+ /** Assignment operator */
+ MReportObject operator=( const MReportObject& mReportObject );
+ /** Destructor */
+ virtual ~MReportObject();
+
+protected:
+ /** Object's x position */
+ int xpos;
+ /** Object's y postition */
+ int ypos;
+ /** Object's width */
+ int width;
+ /** Object's height */
+ int height;
+
+ /** Object's background color */
+ QColor backgroundColor;
+ /** Object's foreground color */
+ QColor foregroundColor;
+
+ /** Object's border color */
+ QColor borderColor;
+ /** Object's border width */
+ int borderWidth;
+ /** Object's border style */
+ int borderStyle;
+ /** Draw left border */
+ bool drawLeft;
+ /** Draw right border */
+ bool drawRight;
+ /** Draw top border */
+ bool drawTop;
+ /** Draw bottom border */
+ bool drawBottom;
+
+public:
+ /** Draws the object to the specified painter & x/y offsets */
+ virtual void draw( QPainter* p, int xoffset, int yoffset );
+ /** Sets the object's position and size */
+ void setGeometry( int x, int y, int w, int h );
+ /** Sets the object's position */
+ void move( int x, int y );
+ /** Gets the object's x position */
+ int getX();
+ /** Gets the object's y position */
+ int getY();
+ /** Sets the object's background color - default is white*/
+ void setBackgroundColor( int r, int g, int b );
+ /** Sets the object's foreground color - default is black*/
+ void setForegroundColor( int r, int g, int b );
+ /** Sets the object's border color - default is black*/
+ void setBorderColor( int r, int g, int b );
+ /** Sets the object's border width - default is 1*/
+ void setBorderWidth( int width );
+ /** Sets the object's border style - default is SolidLine*/
+ void setBorderStyle( int style );
+
+ /** Gets the draw left border flag */
+ bool getDrawLeft();
+ /** Gets the draw right border flag */
+ bool getDrawRight();
+ /** Gets the draw top border flag */
+ bool getDrawTop();
+ /** Gets the draw bottom border flag */
+ bool getDrawBottom();
+
+ /** Sets the draw left border flag */
+ void setDrawLeft( bool d );
+ /** Sets the draw right border flag */
+ void setDrawRight( bool d );
+ /** Sets the draw top border flag */
+ void setDrawTop( bool d );
+ /** Sets the draw bottom border flag */
+ void setDrawBottom( bool d );
+
+protected:
+ /** Draws the base object to the specified painter & x/y offsets */
+ void drawBase( QPainter* p, int xoffset, int yoffset );
+
+private:
+ /** Copies member data from one object to another.
+ * Used by the copy constructor and assignment operator
+ */
+ void copy( const MReportObject* mReportObject );
+
+};
+
+}
+
+#endif
diff --git a/kugar/lib/mreportsection.cpp b/kugar/lib/mreportsection.cpp
new file mode 100644
index 00000000..9712407a
--- /dev/null
+++ b/kugar/lib/mreportsection.cpp
@@ -0,0 +1,326 @@
+/***************************************************************************
+ mreportsection.cpp - Kugar report section
+ -------------------
+ begin : Mon Aug 23 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+ copyright : (C) 2002 Alexander Dymo
+***************************************************************************/
+
+#include "mreportsection.h"
+#include "mutil.h"
+
+namespace Kugar
+{
+
+/** Constructor */
+MReportSection::MReportSection()
+{
+ // Set geometry
+ height = 50;
+
+ // Set print frequency
+ frequency = MReportSection::EveryPage;
+
+ // Set special field data
+ reportDate = QDate::currentDate();
+ pageNumber = 0;
+
+ // Set the line list to AutoDelete
+ lines.setAutoDelete( true );
+ // Set the label list to AutoDelete
+ labels.setAutoDelete( true );
+ // Set the field list to AutoDelete
+ fields.setAutoDelete( true );
+ // Set the special field list to AutoDelete
+ specialFields.setAutoDelete( true );
+}
+
+/** Copy constructor */
+MReportSection::MReportSection( const MReportSection& mReportSection ) /*: QObject((QObject &) mReportSection)*/
+{
+ copy( &mReportSection );
+}
+
+/** Assignment operator */
+MReportSection MReportSection::operator=( const MReportSection& mReportSection )
+{
+ if ( &mReportSection == this )
+ return * this;
+
+ // Copy the derived class's data
+ copy( &mReportSection );
+
+ // Copy the base class's data
+ //((QObject &) *this) = mReportSection;
+
+ return *this;
+}
+
+/** Destructor */
+MReportSection::~MReportSection()
+{
+ clear();
+}
+
+/** Frees all resources allocated by the report section */
+void MReportSection::clear()
+{
+ clearBase();
+}
+
+/** Frees base resources allocated by the report section */
+void MReportSection::clearBase()
+{
+ // Clear the line collection
+ lines.clear();
+ // Clear the label collection
+ labels.clear();
+ // Clear the field collection
+ fields.clear();
+ // Clear the special field collection
+ specialFields.clear();
+ // Clear the calculated field collection
+ calculatedFields.clear();
+}
+
+/** Adds a new line object to the section's line collection */
+void MReportSection::addLine( MLineObject* line )
+{
+ lines.append( line );
+}
+
+/** Adds a new label object to the section's label collection */
+void MReportSection::addLabel( MLabelObject* label )
+{
+ labels.append( label );
+}
+
+/** Adds a new field object to the section's label collection */
+void MReportSection::addField( MFieldObject * field )
+{
+ fields.append( field );
+}
+
+/** Adds a new special field object to the section's special field collection */
+void MReportSection::addSpecialField( MSpecialObject* special )
+{
+ specialFields.append( special );
+}
+
+/** Adds a new calculated field object to the section's calculated field collection */
+void MReportSection::addCalculatedField( MCalcObject* calc )
+{
+ calculatedFields.append( calc );
+}
+
+/** Gets the height of the section */
+int MReportSection::getHeight()
+{
+ return height;
+}
+
+/** Sets the height of the section */
+void MReportSection::setHeight( int h )
+{
+ height = h;
+}
+
+/** Sets the level of the section */
+void MReportSection::setLevel( int l )
+{
+ level = l;
+}
+
+/** Gets the level of the section */
+int MReportSection::getLevel()
+{
+ return level;
+}
+
+/** Set the current page number - used by special fields */
+void MReportSection::setPageNumber( int page )
+{
+ pageNumber = page;
+}
+
+/** Set the current date - used by special fields */
+void MReportSection::setReportDate( QDate date )
+{
+ reportDate = date;
+}
+
+/** Sets the print frequency of the section */
+void MReportSection::setPrintFrequency( int printFrequency )
+{
+ frequency = printFrequency;
+}
+
+/** Returns the print frequency of the section */
+int MReportSection::printFrequency()
+{
+ return frequency;
+}
+
+/** Returns the name of the bound field for the calculated field object at the given index */
+QString MReportSection::getCalcFieldName( int idx )
+{
+ MCalcObject * field = calculatedFields.at( idx );
+
+ return field->getFieldName();
+}
+
+/** Sets the data for the specified calculated field */
+void MReportSection::setCalcFieldData( int idx, QString data )
+{
+ MCalcObject * field = calculatedFields.at( idx );
+
+ field->setText( data );
+}
+
+/** Sets the data for the all calculated fields - list size must number of calculated fields */
+void MReportSection::setCalcFieldData( QPtrList<QMemArray<double> >* values )
+{
+ MCalcObject * field;
+ int i = 0;
+
+ // Calculate and set the calculated field's data
+ for ( field = calculatedFields.first(); field != 0; field = calculatedFields.next() )
+ {
+ switch ( field->getCalculationType() )
+ {
+ case MCalcObject::Count:
+ field->setText( QString::number( MUtil::count( values->at( i ) ) ) );
+ break;
+ case MCalcObject::Sum:
+ field->setText( QString::number( MUtil::sum( values->at( i ) ), 'f', 2 ) );
+ break;
+ case MCalcObject::Average:
+ field->setText( QString::number( MUtil::average( values->at( i ) ) ) );
+ break;
+ case MCalcObject::Variance:
+ field->setText( QString::number( MUtil::variance( values->at( i ) ) ) );
+ break;
+ case MCalcObject::StandardDeviation:
+ field->setText( QString::number( MUtil::stdDeviation( values->at( i ) ) ) );
+ break;
+ }
+ i++;
+ }
+}
+
+/** Returns the index of the calculated field object for the given bound field */
+int MReportSection::getCalcFieldIndex( QString field )
+{
+ MCalcObject * tmpField;
+
+ // Find the field in the calculated field collection and return the index
+ for ( tmpField = calculatedFields.first(); tmpField != 0; tmpField = calculatedFields.next() )
+ {
+ if ( tmpField->getFieldName() == field )
+ break;
+ }
+ return calculatedFields.at();
+}
+
+/** Returns the number of calculated fields in the section */
+int MReportSection::getCalcFieldCount()
+{
+ return calculatedFields.count();
+}
+
+/** Draws the section to the specified painter & x/y-offsets */
+void MReportSection::draw( QPainter* p, int xoffset, int yoffset )
+{
+ drawObjects( p, xoffset, yoffset );
+}
+
+/** Draws the section base objects to the specified painter & x/y offsets */
+void MReportSection::drawObjects( QPainter* p, int xoffset, int yoffset )
+{
+ MLineObject * line;
+ MLabelObject* label;
+ MSpecialObject* special;
+ MCalcObject* cfield;
+ MFieldObject* field;
+
+ // Set the offsets
+ int xcalc = xoffset;
+ int ycalc = yoffset;
+
+ // Draw the line collection
+ for ( line = lines.first(); line != 0; line = lines.next() )
+ {
+ line->draw( p, xcalc, ycalc );
+ }
+
+ // Draw the label collection
+ for ( label = labels.first(); label != 0; label = labels.next() )
+ {
+ label->draw( p, xcalc, ycalc );
+ }
+
+ // Draw the field collection
+ for ( field = fields.first(); field != 0; field = fields.next() )
+ {
+ field->draw( p, xcalc, ycalc );
+ }
+
+ // Draw the calculated field collection
+ for ( cfield = calculatedFields.first(); cfield != 0; cfield = calculatedFields.next() )
+ {
+ cfield->draw( p, xcalc, ycalc );
+ }
+
+ // Draw the special field collection
+ for ( special = specialFields.first(); special != 0; special = specialFields.next() )
+ {
+ switch ( special->getType() )
+ {
+ case MSpecialObject::Date:
+ special->setText( reportDate );
+ break;
+ case MSpecialObject::PageNumber:
+ special->setText( pageNumber );
+ break;
+ }
+ special->draw( p, xcalc, ycalc );
+ }
+}
+
+/** Copies member data from one object to another.
+ Used by the copy constructor and assignment operator */
+void MReportSection::copy( const MReportSection* mReportSection )
+{
+ // Copy the section's geometry
+ height = mReportSection->height;
+
+ // Copy the print frequency
+ frequency = mReportSection->frequency;
+
+ // Copy the line list
+ lines = mReportSection->lines;
+ // Copy the label list
+ labels = mReportSection->labels;
+ // Copy the field list
+ fields = mReportSection->fields;
+ // Copy the special field list
+ specialFields = mReportSection->specialFields;
+ // Copy the calculated field list
+ calculatedFields = mReportSection->calculatedFields;
+}
+
+void MReportSection::setFieldData( QString name, QString data )
+{
+ MFieldObject * field;
+ for ( field = fields.first(); field != 0; field = fields.next() )
+ {
+ qWarning( " checking field %s", field->getFieldName().ascii() );
+ if ( field->getFieldName() == name )
+ field->setText( data );
+ }
+}
+
+}
+
diff --git a/kugar/lib/mreportsection.h b/kugar/lib/mreportsection.h
new file mode 100644
index 00000000..704daf4b
--- /dev/null
+++ b/kugar/lib/mreportsection.h
@@ -0,0 +1,190 @@
+/***************************************************************************
+ mreportsection.h - Kugar report section
+ -------------------
+ begin : Mon Aug 23 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+ copyright : (C) 2002-2004 Alexander Dymo
+***************************************************************************/
+
+#ifndef MREPORTSECTION_H
+#define MREPORTSECTION_H
+
+#include <qptrlist.h>
+#include <qobject.h>
+
+#include "mlineobject.h"
+#include "mlabelobject.h"
+#include "mspecialobject.h"
+#include "mcalcobject.h"
+#include "mfieldobject.h"
+
+/**Kugar report section
+ *@author Mutiny Bay Software
+ */
+
+namespace Kugar
+{
+
+class MReportSection : public QObject
+{
+
+public:
+ /** Section print frequency constants */
+ enum PrintFrequency { FirstPage = 0, EveryPage, LastPage };
+
+ /** Constructor */
+ MReportSection();
+ /** Copy constructor */
+ MReportSection( const MReportSection& mReportSection );
+ /** Assignment operator */
+ MReportSection operator=( const MReportSection& mReportSection );
+ /** Destructor */
+ virtual ~MReportSection();
+
+protected:
+ /** Sections's height */
+ int height;
+ /** Sections's level in hierarchy */
+ int level;
+ /** Section print frequency */
+ int frequency;
+ /** Page number - used by special fields */
+ int pageNumber;
+ /** Report date - used by special fields */
+ QDate reportDate;
+
+ /** Section's line collection */
+ QPtrList<MLineObject> lines;
+ /** Section's label collection */
+ QPtrList<MLabelObject> labels;
+ /** Section's special field collection */
+ QPtrList<MSpecialObject> specialFields;
+ /** Section's calculated field collection */
+ QPtrList<MCalcObject> calculatedFields;
+ /** Section's field collection (for use as report variables) */
+ QPtrList<MFieldObject> fields;
+
+public:
+ /** Adds a new line object to the section's line collection */
+ void addLine( MLineObject* line );
+ /** Adds a new label object to the section's label collection */
+ void addLabel( MLabelObject* label );
+ /** Adds a new field object to the section's field collection */
+ void addField( MFieldObject* field );
+ /** Adds a new special field object to the section's special field collection */
+ void addSpecialField( MSpecialObject* special );
+ /** Adds a new calculated field object to the section's calculated field collection */
+ void addCalculatedField( MCalcObject* calc );
+ /** Sets the height of the section */
+ void setHeight( int h );
+ /** Gets the height of the section */
+ int getHeight();
+ /** Sets the level of the section */
+ void setLevel( int l );
+ /** Gets the level of the section */
+ int getLevel();
+ /** Set the current page number - used by special fields */
+ void setPageNumber( int page );
+ /** Set the current date - used by special fields */
+ void setReportDate( QDate date );
+ /** Sets the print frequency of the section */
+ void setPrintFrequency( int printFrequency );
+ /** Returns the print frequency of the section */
+ int printFrequency();
+ /** Returns the name of the bound field for the calculated field object at the given index */
+ QString getCalcFieldName( int idx );
+ /** Returns the index of the calculated field object for the given bound field */
+ int getCalcFieldIndex( QString field );
+ /** Sets the data for the specified calculated field */
+ void setCalcFieldData( int idx, QString data );
+ /** Sets the data for the all calculated fields - list size must match number of calculated fields */
+ void setCalcFieldData( QPtrList<QMemArray<double> >* values );
+ /** Returns the number of calculated fields in the section */
+ int getCalcFieldCount();
+ /** Sets the field data */
+ void setFieldData( QString name, QString data );
+ /** Draws the section to the specified painter & x/y-offsets */
+ virtual void draw( QPainter* p, int xoffset, int yoffset );
+ /** Frees all resources allocated by the report section */
+ virtual void clear();
+
+protected:
+ /** Frees base resources allocated by the report section */
+ void clearBase();
+ /** Draws the section base objects to the specified painter & x/y offsets */
+ void drawObjects( QPainter* p, int xoffset, int yoffset );
+
+private:
+ /** Copies member data from one object to another.
+ * Used by the copy constructor and assignment operator
+ */
+ void copy( const MReportSection* mReportSection );
+};
+
+}
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kugar/lib/mreportviewer.cpp b/kugar/lib/mreportviewer.cpp
new file mode 100644
index 00000000..da825f7a
--- /dev/null
+++ b/kugar/lib/mreportviewer.cpp
@@ -0,0 +1,411 @@
+/***************************************************************************
+ mreportviewer.cpp - Kugar QT report viewer widget
+ -------------------
+ begin : Fri Aug 13 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+ copyright : (C) 2002 Alexander Dymo
+***************************************************************************/
+
+#include <qapplication.h>
+#include <kmessagebox.h>
+#include <kprinter.h>
+#include <klocale.h>
+
+#include "mreportviewer.h"
+
+namespace Kugar
+{
+
+/** Constructor */
+MReportViewer::MReportViewer( MReportEngine *engine, QWidget *parent, const char *name ) : QWidget( parent, name ), progress( 0 )
+{
+ rptEngine = engine;
+ rptEngine->addRef();
+ init();
+}
+
+MReportViewer::MReportViewer( QWidget *parent, const char *name ) : QWidget( parent, name ), progress( 0 )
+{
+ // Create the scrollview
+ rptEngine = new MReportEngine();
+ init();
+}
+
+void MReportViewer::init()
+{
+ scroller = new QScrollView( this );
+
+ // Connect the rendering update signal and slot
+ connect( rptEngine, SIGNAL( signalRenderStatus( int ) ),
+ SLOT( slotRenderProgress( int ) ) );
+
+ connect( rptEngine, SIGNAL( preferedTemplate( const QString & ) ),
+ SIGNAL( preferedTemplate( const QString & ) ) );
+
+ // Get the current color palette
+ QPalette p = palette();
+ QColorGroup g = p.active();
+
+ // Set the scroller's background color
+ scroller->viewport() ->setBackgroundColor( g.mid() );
+
+ // Create the report display widget
+ display = new MPageDisplay( scroller->viewport() );
+
+ // Set the display's default background color
+ display->setBackgroundColor( white );
+
+ // Add the display to the scrollview
+ scroller->addChild( display );
+
+ //Hide the display, we don't have a report yet ..
+ display->hide();
+}
+
+/** Destructor */
+MReportViewer::~MReportViewer()
+{
+ clearReport();
+ rptEngine->removeRef();
+}
+
+/** Report viewer's paint event */
+void MReportViewer::paintEvent( QPaintEvent* event )
+{}
+
+/** Report viewer's resize event */
+void MReportViewer::resizeEvent( QResizeEvent* event )
+{
+ scroller->resize( event->size() );
+}
+
+// Set the report's data from an in-line string.
+
+bool MReportViewer::setReportData( const QString &data )
+{
+ return rptEngine -> setReportData( data );
+}
+
+
+// Set the report's data from an i/o device.
+
+bool MReportViewer::setReportData( QIODevice *dev )
+{
+ return rptEngine -> setReportData( dev );
+}
+
+
+// Set the report's template from an in-line string.
+
+bool MReportViewer::setReportTemplate( const QString &tpl )
+{
+ return rptEngine -> setReportTemplate( tpl );
+}
+
+
+// Set the report's template from an i/o device.
+
+bool MReportViewer::setReportTemplate( QIODevice *dev )
+{
+ return rptEngine -> setReportTemplate( dev );
+}
+
+
+/** Generates the report's page collection */
+bool MReportViewer::renderReport()
+{
+ // Render the report
+ report = rptEngine->renderReport();
+
+ // Display the first page of the report
+ if ( report && report->getFirstPage() != 0 )
+ {
+ display->setPageDimensions( report->pageDimensions() );
+ display->setPage( report->getFirstPage() );
+ display->show();
+
+ return true;
+ }
+
+ return false;
+}
+
+/** Clears the report's page collection */
+void MReportViewer::clearReport()
+{
+ // Hide the display
+ display->hide();
+}
+
+/** Prints the rendered report to the selected printer - displays KDE print dialog */
+void MReportViewer::printReport()
+{
+ // Check for a report
+ if ( !report )
+ return ;
+
+ // Get the page count
+ int cnt = report->pageCount();
+
+ // Check if there is a report or any pages to print
+ if ( cnt == 0 )
+ {
+ KMessageBox::error( this, i18n( "There are no pages in the\nreport to print." ) );
+ return ;
+ }
+
+ // Set the printer dialog
+ KPrinter printer;
+
+ setupPrinter( printer );
+ if ( printer.setup( this ) )
+ printReport( printer );
+}
+
+/** Shows the first page in the report */
+void MReportViewer::slotFirstPage()
+{
+ QPicture * page;
+
+ if ( !report )
+ return ;
+
+ if ( ( page = report->getFirstPage() ) != 0 )
+ {
+ display->setPage( page );
+ display->repaint();
+ }
+}
+
+/** Shows the next page in the report */
+void MReportViewer::slotNextPage()
+{
+ QPicture * page;
+
+ if ( !report )
+ return ;
+
+ int index = report->getCurrentIndex();
+
+ if ( ( page = report->getNextPage() ) != 0 )
+ {
+ display->setPage( page );
+ display->repaint();
+ }
+ else
+ report->setCurrentPage( index );
+}
+
+/** Shows the prevoius page in the report */
+void MReportViewer::slotPrevPage()
+{
+ QPicture * page;
+
+ if ( !report )
+ return ;
+
+ int index = report->getCurrentIndex();
+
+ if ( ( page = report->getPreviousPage() ) != 0 )
+ {
+ display->setPage( page );
+ display->repaint();
+ }
+ else
+ report->setCurrentPage( index );
+}
+
+/** Shows the last page in the report */
+void MReportViewer::slotLastPage()
+{
+ QPicture * page;
+
+ if ( !report )
+ return ;
+
+ if ( ( page = report->getLastPage() ) != 0 )
+ {
+ display->setPage( page );
+ display->repaint();
+ }
+}
+
+/** Cancel printing of the report */
+void MReportViewer::slotCancelPrinting()
+{
+ printer->abort();
+}
+
+/** Updates rendering progress */
+void MReportViewer::slotRenderProgress( int p )
+{
+
+ // Check if the dialog was created
+ if ( progress == 0 )
+ {
+ totalSteps = rptEngine->getRenderSteps();
+ progress = new QProgressDialog( i18n("Creating report..."), i18n("Cancel"),
+ totalSteps, this, "progress", true );
+ progress->setMinimumDuration( M_PROGRESS_DELAY );
+ }
+
+ // Update the dialog
+ progress->setProgress( p );
+ qApp->processEvents();
+
+ // Check if the action was canceled
+ if ( progress->wasCancelled() )
+ {
+ progress->setProgress( totalSteps );
+ rptEngine->slotCancelRendering();
+ }
+
+ // Cleanup dialog if necessary
+ if ( progress->progress() == -1 )
+ {
+ delete progress;
+ progress = 0;
+ }
+}
+
+
+// Return the preferred size.
+
+QSize MReportViewer::sizeHint() const
+{
+ return scroller -> sizeHint();
+}
+
+void MReportViewer::printReport( KPrinter &printer )
+{
+ // Check for a report
+ if ( !report )
+ return ;
+
+ // Get the page count
+ int cnt = report->pageCount();
+
+ // Check if there is a report or any pages to print
+ if ( cnt == 0 )
+ {
+ KMessageBox::error( this, i18n( "There are no pages in the\nreport to print." ) );
+ return ;
+ }
+
+
+ QPicture* page;
+ QPainter painter;
+ bool printRev;
+
+ // Save the viewer's page index
+ int viewIdx = report->getCurrentIndex();
+
+ // Check the order we are printing the pages
+ if ( printer.pageOrder() == KPrinter::FirstPageFirst )
+ printRev = false;
+ else
+ printRev = true;
+
+ // Get the count of pages and copies to print
+ int printFrom = printer.fromPage() - 1;
+ int printTo = printer.toPage();
+ int printCnt = ( printTo - printFrom );
+ int printCopies = printer.numCopies();
+ int totalSteps = printCnt * printCopies;
+ int currentStep = 1;
+
+ // Set copies to 1, KPrinter copies does not appear to work ...
+ printer.setNumCopies( 1 );
+
+ // Setup the progress dialog
+ QProgressDialog progress( i18n( "Printing report..." ),
+ i18n( "Cancel" ),
+ totalSteps, this, "progress", true );
+ progress.setMinimumDuration( M_PROGRESS_DELAY );
+ QObject::connect( &progress, SIGNAL( cancelled() ), this, SLOT( slotCancelPrinting() ) );
+ progress.setProgress( 0 );
+ qApp->processEvents();
+
+ // Start the printer
+ painter.begin( &printer );
+
+ // Print each copy
+ for ( int j = 0; j < printCopies; j++ )
+ {
+ // Print each page in the collection
+ for ( int i = printFrom ; i < printTo; i++, currentStep++ )
+ {
+ if ( !printer.aborted() )
+ {
+ progress.setProgress( currentStep );
+ qApp->processEvents();
+
+ if ( printRev )
+ report->setCurrentPage( ( printCnt == 1 ) ? i : ( printCnt - 1 ) - i );
+ else
+ report->setCurrentPage( i );
+
+ page = report->getCurrentPage();
+ page->play( &painter );
+ if ( i < printCnt - 1 )
+ printer.newPage();
+ }
+ else
+ {
+ j = printCopies;
+ break;
+ }
+ }
+ if ( j < printCopies - 1 )
+ printer.newPage();
+ }
+
+ // Cleanup printing
+ setCursor( arrowCursor );
+ painter.end();
+ report->setCurrentPage( viewIdx );
+}
+
+void MReportViewer::setupPrinter( KPrinter &printer )
+{
+ int cnt = report->pageCount();
+
+ printer.setPageSize( ( KPrinter::PageSize ) report->pageSize() );
+ printer.setOrientation( ( KPrinter::Orientation ) report->pageOrientation() );
+ printer.setMinMax( 1, cnt );
+ printer.setFromTo( 1, cnt );
+ printer.setFullPage( true );
+}
+
+void MReportViewer::printReportSilent( int printFrom, int printTo, int printCopies, QString printerName )
+{
+ int cnt = report->pageCount();
+ if ( printFrom == -1 )
+ printFrom = 1;
+ if ( printTo == -1 )
+ printTo = cnt;
+ if ( printCopies == -1 )
+ printCopies = 1;
+
+
+ printer = new KPrinter();
+
+ printer->setPageSize( ( KPrinter::PageSize ) report->pageSize() );
+ printer->setOrientation( ( KPrinter::Orientation ) report->pageOrientation() );
+ printer->setMinMax( 1, cnt );
+ printer->setFullPage( true );
+ printer->setNumCopies( printCopies );
+ printer->setFromTo( printFrom, printTo );
+ if ( !printerName.isEmpty() )
+ printer->setPrinterName( printerName );
+
+ printReport( *printer );
+
+ delete printer;
+}
+
+}
+
+#include "mreportviewer.moc"
diff --git a/kugar/lib/mreportviewer.h b/kugar/lib/mreportviewer.h
new file mode 100644
index 00000000..1c6f4c03
--- /dev/null
+++ b/kugar/lib/mreportviewer.h
@@ -0,0 +1,94 @@
+/***************************************************************************
+ mreportviewer.h - Kugar QT report viewer widget
+ -------------------
+ begin : Fri Aug 13 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+ copyright : (C) 2002 Alexander Dymo
+***************************************************************************/
+
+#ifndef MREPORTVIEWER_H
+#define MREPORTVIEWER_H
+
+#include <qapplication.h>
+#include <qwidget.h>
+#include <qscrollview.h>
+#include <qpixmap.h>
+#include <qpainter.h>
+#include <qpaintdevicemetrics.h>
+#include <qprogressdialog.h>
+#include <qguardedptr.h>
+#include <koffice_export.h>
+#include "mreportengine.h"
+#include "mpagecollection.h"
+#include "mpagedisplay.h"
+
+#define M_PROGRESS_DELAY 500 // Number of ms to delay progress dialog display
+
+class KPrinter;
+
+/** Application reference, required for event processing */
+extern QApplication *mAppRef;
+
+/**Kugar QT report viewer widget
+ *@author Mutiny Bay Software
+ */
+
+namespace Kugar
+{
+
+class KUGAR_EXPORT MReportViewer : public QWidget
+{
+ Q_OBJECT
+
+public:
+ MReportViewer( QWidget *parent = 0, const char *name = 0 );
+ MReportViewer( MReportEngine* engine, QWidget *parent = 0, const char *name = 0 );
+ virtual ~MReportViewer();
+
+ bool setReportData( const QString & );
+ bool setReportData( QIODevice * );
+ bool setReportTemplate( const QString & );
+ bool setReportTemplate( QIODevice * );
+ bool renderReport();
+ void clearReport();
+ void printReport();
+ void printReport( KPrinter &printer );
+ void setupPrinter( KPrinter &printer );
+ void printReportSilent( int printFrom = -1, int printTo = -1, int printCopies = -1, QString printerName = QString::null );
+
+ QSize sizeHint() const;
+
+public slots:
+ void slotFirstPage();
+ void slotNextPage();
+ void slotPrevPage();
+ void slotLastPage();
+
+signals:
+ void preferedTemplate( const QString & );
+
+private slots:
+ void slotCancelPrinting();
+ void slotRenderProgress( int );
+
+protected:
+ void paintEvent( QPaintEvent *event );
+ void resizeEvent( QResizeEvent *event );
+
+ QScrollView *scroller;
+ MPageDisplay *display;
+ MReportEngine *rptEngine;
+ QGuardedPtr<MPageCollection> report;
+ KPrinter *printer;
+
+private:
+ QProgressDialog* progress;
+ int totalSteps;
+ void init();
+};
+
+}
+
+#endif
diff --git a/kugar/lib/mspecialobject.cpp b/kugar/lib/mspecialobject.cpp
new file mode 100644
index 00000000..c06830fd
--- /dev/null
+++ b/kugar/lib/mspecialobject.cpp
@@ -0,0 +1,86 @@
+/***************************************************************************
+ mspecialobject.cpp - Kugar report special field object
+ -------------------
+ begin : Mon Aug 23 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+***************************************************************************/
+
+#include "mspecialobject.h"
+#include "mutil.h"
+
+namespace Kugar
+{
+
+/** Constructor */
+MSpecialObject::MSpecialObject() : MLabelObject()
+{
+ // Set the defaults
+ type = MSpecialObject::Date;
+ format = MUtil::MDY_SLASH;
+}
+
+/** Copy constructor */
+MSpecialObject::MSpecialObject( const MSpecialObject& mSpecialObject ) : MLabelObject( ( MLabelObject & ) mSpecialObject )
+{
+ copy( &mSpecialObject );
+}
+
+/** Assignment operator */
+MSpecialObject MSpecialObject::operator=( const MSpecialObject& mSpecialObject )
+{
+ if ( &mSpecialObject == this )
+ return * this;
+
+ // Copy the derived class's data
+ copy( &mSpecialObject );
+
+ // Copy the base class's data
+ ( ( MLabelObject & ) * this ) = mSpecialObject;
+
+ return *this;
+}
+
+/** Destructor */
+MSpecialObject::~MSpecialObject()
+{}
+
+/** Sets the field's data string with a date */
+void MSpecialObject::setText( QDate d )
+{
+ text = MUtil::formatDate( d, format );
+}
+
+/** Sets the field's data string with a page number */
+void MSpecialObject::setText( int page )
+{
+ text.setNum( page );
+}
+
+/** Sets the field's data type */
+void MSpecialObject::setType( int t )
+{
+ type = t;
+}
+
+/** Gets the field's type */
+int MSpecialObject::getType()
+{
+ return type;
+}
+
+/** Sets the field's date formatting */
+void MSpecialObject::setDateFormat( int f )
+{
+ format = f;
+}
+
+/** Copies member data from one object to another.
+ Used by the copy constructor and assignment operator */
+void MSpecialObject::copy( const MSpecialObject* mSpecialObject )
+{
+ // Copy the fields's data type and format
+ type = mSpecialObject->type;
+}
+
+}
diff --git a/kugar/lib/mspecialobject.h b/kugar/lib/mspecialobject.h
new file mode 100644
index 00000000..58d18ca8
--- /dev/null
+++ b/kugar/lib/mspecialobject.h
@@ -0,0 +1,91 @@
+/***************************************************************************
+ mspecialobject.h - Kugar report special field object
+ -------------------
+ begin : Mon Aug 23 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+***************************************************************************/
+
+#ifndef MSPECIALOBJECT_H
+#define MSPECIALOBJECT_H
+
+#include <qdatetime.h>
+
+#include "mlabelobject.h"
+
+/**Kugar report special field object - report date, page number, etc.
+ *@author Mutiny Bay Software
+ */
+
+namespace Kugar
+{
+
+class MSpecialObject : public MLabelObject
+{
+
+public:
+ /** Data type constants */
+ enum SpecialType { Date = 0, PageNumber };
+
+ /** Constructor */
+ MSpecialObject();
+ /** Copy constructor */
+ MSpecialObject( const MSpecialObject& mSpecialObject );
+ /** Assignment operator */
+ MSpecialObject operator=( const MSpecialObject& mSpecialObject );
+ /** Destructor */
+ virtual ~MSpecialObject();
+
+protected:
+ /** Field type */
+ int type;
+ /** Format type */
+ int format;
+public:
+ /** Sets the field's data string with a date */
+ void setText( QDate d );
+ /** Sets the field's data string with a page number */
+ void setText( int page );
+ /** Sets the field's type */
+ void setType( int t );
+ /** Gets the field's type */
+ int getType();
+ /** Sets the field's date formatting */
+ void setDateFormat( int f );
+
+private:
+ /** Copies member data from one object to another.
+ * Used by the copy constructor and assignment operator
+ */
+ void copy( const MSpecialObject* mSpecialObject );
+
+};
+
+}
+
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kugar/lib/mutil.cpp b/kugar/lib/mutil.cpp
new file mode 100644
index 00000000..158d64e1
--- /dev/null
+++ b/kugar/lib/mutil.cpp
@@ -0,0 +1,127 @@
+/***************************************************************************
+ mutil.cpp - Kugar utlity class
+ -------------------
+ begin : Tue Aug 17 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+ copyright : (C) 2002 Alexander Dymo
+***************************************************************************/
+
+#include <math.h>
+
+#include "mutil.h"
+
+
+namespace Kugar
+{
+
+/** Formats a date using one of the pre-defined formats */
+QString MUtil::formatDate( const QDate& value, int format )
+{
+ QString string;
+ QString month, day, year;
+
+ // Reformat date parts - not necessarily required
+ month.setNum( value.month() );
+ day.setNum( value.day() );
+
+ // Add leading zeros to month and day
+ if ( value.month() < 10 )
+ month = "0" + month;
+ if ( value.day() < 10 )
+ day = "0" + day;
+
+ // Create a two digit year
+ year.setNum( value.year() );
+ year = year.right( 2 );
+
+ // Create the formatted date string
+ switch ( format )
+ {
+ case MUtil::MDY_SLASH:
+ string = QString( "%1/%2/%3" ).arg( value.month() ).arg( value.day() ).arg( year );
+ break;
+ case MUtil::MDY_DASH:
+ string = QString( "%1-%2-%3" ).arg( value.month() ).arg( value.day() ).arg( year );
+ break;
+ case MUtil::MMDDY_SLASH:
+ string = QString( "%1/%2/%3" ).arg( month ).arg( day ).arg( year );
+ break;
+ case MUtil::MMDDY_DASH:
+ string = QString( "%1-%2-%3" ).arg( month ).arg( day ).arg( year );
+ break;
+ case MUtil::MDYYYY_SLASH:
+ string = QString( "%1/%2/%3" ).arg( value.month() ).arg( value.day() ).arg( value.year() );
+ break;
+ case MUtil::MDYYYY_DASH:
+ string = QString( "%1-%2-%3" ).arg( value.month() ).arg( value.day() ).arg( value.year() );
+ break;
+ case MUtil::MMDDYYYY_SLASH:
+ string = QString( "%1/%2/%3" ).arg( month ).arg( day ).arg( value.year() );
+ break;
+ case MUtil::MMDDYYYY_DASH:
+ string = QString( "%1-%2-%3" ).arg( month ).arg( day ).arg( value.year() );
+ break;
+ case MUtil::YYYYMD_SLASH:
+ string = QString( "%1/%2/%3" ).arg( value.year() ).arg( value.month() ).arg( value.day() );
+ break;
+ case MUtil::YYYYMD_DASH:
+ string = QString( "%1-%2-%3" ).arg( value.year() ).arg( value.month() ).arg( value.day() );
+ break;
+ case MUtil::DDMMYY_PERIOD:
+ string = QString( "%1.%2.%3" ).arg( day ).arg( month ).arg( year );
+ break;
+ case MUtil::DDMMYYYY_PERIOD:
+ string = QString( "%1.%2.%3" ).arg( day ).arg( month ).arg( value.year() );
+ break;
+ default:
+ string = value.toString();
+ }
+ return string;
+}
+
+/** Returns the count for an array of doubles */
+int MUtil::count( QMemArray<double>* values )
+{
+ return values->size();
+}
+
+/** Returns the sum for an array of doubles */
+double MUtil::sum( QMemArray<double>* values )
+{
+ double tmpSum = 0.0;
+ int size = count( values );
+
+ for ( int i = 0; i < size; i++ )
+ tmpSum += values->at( i );
+
+ return tmpSum;
+}
+
+/** Returns the average value for an array of doubles */
+double MUtil::average( QMemArray<double>* values )
+{
+ return sum( values ) / count( values );
+}
+
+/** Returns the variance for an array of doubles */
+double MUtil::variance( QMemArray<double>* values )
+{
+ double tmpVar = 0.0;
+ double tmpAvg = average( values );
+ int size = count( values );
+
+ for ( int i = 0; i < size; i++ )
+ tmpVar += pow( ( values->at( i ) - tmpAvg ), 2 ) / size;
+
+ return tmpVar;
+}
+
+/** Returns the standard deviation for an array of doubles */
+double MUtil::stdDeviation( QMemArray<double>* values )
+{
+ return sqrt( variance( values ) );
+}
+
+}
diff --git a/kugar/lib/mutil.h b/kugar/lib/mutil.h
new file mode 100644
index 00000000..b7aa764f
--- /dev/null
+++ b/kugar/lib/mutil.h
@@ -0,0 +1,59 @@
+/***************************************************************************
+ mutil.h - Kugar utlity class
+ -------------------
+ begin : Tue Aug 17 1999
+ copyright : (C) 1999 by Mutiny Bay Software
+ copyright : (C) 2002 Alexander Dymo
+***************************************************************************/
+
+#ifndef MUTIL_H
+#define MUTIL_H
+
+#include <qobject.h>
+#include <qstring.h>
+#include <qdatetime.h>
+#include <qmemarray.h>
+
+
+/**Kugar utlity class
+ *@author Mutiny Bay Software
+ */
+
+namespace Kugar
+{
+
+class MUtil
+{
+
+public:
+ /** Formatting constants */
+ enum DateFormatType {
+ MDY_SLASH = 0, MDY_DASH,
+ MMDDY_SLASH, MMDDY_DASH,
+ MDYYYY_SLASH, MDYYYY_DASH,
+ MMDDYYYY_SLASH, MMDDYYYY_DASH,
+ YYYYMD_SLASH, YYYYMD_DASH,
+ DDMMYY_PERIOD, DDMMYYYY_PERIOD
+ };
+
+ /** Formats a date using one of the pre-defined formats */
+ static QString formatDate( const QDate& value, int format );
+
+ /** Returns the count for an array of doubles */
+ static int count( QMemArray<double>* values );
+ /** Returns the sum for an array of doubles */
+ static double sum( QMemArray<double>* values );
+ /** Returns the average value for an array of doubles */
+ static double average( QMemArray<double>* values );
+ /** Returns the variance for an array of doubles */
+ static double variance( QMemArray<double>* values );
+ /** Returns the standard deviation for an array of doubles */
+ static double stdDeviation( QMemArray<double>* values );
+
+};
+
+}
+
+#endif
diff --git a/kugar/part/Makefile.am b/kugar/part/Makefile.am
new file mode 100644
index 00000000..65abd539
--- /dev/null
+++ b/kugar/part/Makefile.am
@@ -0,0 +1,35 @@
+INCLUDES = -I$(srcdir)/../lib $(KOFFICE_INCLUDES) $(all_includes)
+
+lib_LTLIBRARIES =
+kde_module_LTLIBRARIES = libkugarpart.la
+libkugarpart_la_SOURCES = kugar_part.cpp kugar_factory.cpp kugar_view.cpp
+libkugarpart_la_LDFLAGS = $(all_libraries) -module -avoid-version
+libkugarpart_la_LIBADD = ../lib/libkugarlib.la $(LIB_KPARTS) $(LIB_KDEPRINT) $(LIB_KOFFICECORE)
+
+libkugarpart_la_METASOURCES = AUTO
+
+xdg_apps_DATA = kugar.desktop
+
+rcdir = $(kde_datadir)/kugar
+rc_DATA = kugarpart.rc
+
+dtddir = $(kde_datadir)/kugar/dtd
+dtd_DATA = kugartemplate.dtd
+
+EXTRA_DIST = \
+ kugar_part.h \
+ $(xdg_apps_DATA) \
+ $(rc_DATA) \
+ $(dtd_DATA)
+
+CLEANFILES = kugarpart_meta_unload.cpp
+
+
+## The kdeinit loadable module and executable
+kdeinit_LTLIBRARIES = kugar.la
+bin_PROGRAMS =
+kugar_la_SOURCES = main.cpp
+kugar_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
+kugar_la_LIBADD = $(LIB_KOFFICECORE)
+
+kde_services_DATA = kugarpart.desktop
diff --git a/kugar/part/kugar.desktop b/kugar/part/kugar.desktop
new file mode 100644
index 00000000..7789ce04
--- /dev/null
+++ b/kugar/part/kugar.desktop
@@ -0,0 +1,76 @@
+[Desktop Entry]
+Name=Kugar
+Name[hi]=कुगर
+Name[lo]=ຄູການ
+Name[ne]=कुगर
+Name[th]=คูการ์
+Exec=kugar %u
+Icon=kugar
+MimeType=application/x-kugar;application/x-vnd.kde.kugar.mixed
+Type=Application
+DocPath=kugar/index.html
+GenericName=Report Generator
+GenericName[af]=Raporteer Genereerder
+GenericName[ar]=مُوَلِّد التَّقارير
+GenericName[az]=Raport Yaradıcısı
+GenericName[bg]=Генератор на отчети
+GenericName[bs]=Generator izvještaja
+GenericName[ca]=Generador d'informes
+GenericName[cs]=Generátor reportů
+GenericName[cy]=Cynhyrchydd Adroddiad
+GenericName[da]=Rapportgenerator
+GenericName[de]=Bericht-Erstellung
+GenericName[el]=Δημιουργός αναφορών
+GenericName[eo]=Raporto-kreilo
+GenericName[es]=Generador de informes
+GenericName[et]=Aruandegeneraator
+GenericName[eu]=Txosten-sortzailea
+GenericName[fa]=مولد گزارش
+GenericName[fi]=Raporttigeneraattori
+GenericName[fr]=Générateur de rapports
+GenericName[fy]=Reportgenerator
+GenericName[gl]=Xerador de informes
+GenericName[he]=יוצר דו"חות
+GenericName[hi]=रपट सृजक
+GenericName[hr]=Program za generiranje izvještaja
+GenericName[hu]=Jelentéskészítő
+GenericName[is]=Skýrsluskrifari
+GenericName[it]=Generatore di rapporti
+GenericName[ja]=レポート生成
+GenericName[km]=កម្មវិធី​បង្កើត​របាយការណ៍
+GenericName[lo]=ເຄື່ອງມືສ້າງລາຍງານ
+GenericName[lt]=Raportų generatorius
+GenericName[lv]=Atskaišu ģenerators
+GenericName[ms]=Penjana Laporan
+GenericName[mt]=Ġeneratur tar-Rapporti
+GenericName[nb]=Rapport-oppretter
+GenericName[nds]=Bericht-Maker
+GenericName[ne]=प्रतिवेदन सर्जक
+GenericName[nl]=Rapportengenerator
+GenericName[nn]=Rapportgenerator
+GenericName[pl]=Generator raportów
+GenericName[pt]=Geração de Relatórios
+GenericName[pt_BR]=Gerador de Relatórios
+GenericName[ro]=Generator de rapoarte
+GenericName[ru]=Отчёты
+GenericName[se]=Raportaráhkadeaddji
+GenericName[sk]=Generátor reportov
+GenericName[sl]=Ustvarjanje poročil
+GenericName[sr]=Програм за прављење извештаја
+GenericName[sr@Latn]=Program za pravljenje izveštaja
+GenericName[sv]=Rapportgenerator
+GenericName[tg]=Ҳисоби Тавлидкунанда
+GenericName[th]=เครื่องมือสร้างรายงาน
+GenericName[tr]=Rapor Oluşturma Programı
+GenericName[uk]=Генератор звітів
+GenericName[uz]=Hisobot yaratuvchi
+GenericName[uz@cyrillic]=Ҳисобот яратувчи
+GenericName[wa]=Djenerateu d' rapoirts
+GenericName[xh]=Umenzi we Ngxelo
+GenericName[zh_CN]=报告生成器
+GenericName[zh_TW]=報告產生器
+Terminal=false
+X-KDE-NativeMimeType=application/x-vnd.kde.kugar.mixed
+Categories=Qt;KDE;Office;X-KDE-More;
+# Not ready for public consumption, so hide it from the menus
+NoDisplay=true
diff --git a/kugar/part/kugar_about.h b/kugar/part/kugar_about.h
new file mode 100644
index 00000000..d2740fcf
--- /dev/null
+++ b/kugar/part/kugar_about.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+ kugar_about.h - description
+ -------------------
+ begin : Mon Nov 25 17:45:00 CET 2002
+ copyright : (C) 2002 by Joseph Wenninger
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef KUGAR_ABOUT_H
+#define KUGAR_ABOUT_H
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <kaboutdata.h>
+#include <klocale.h>
+
+KAboutData *newKugarAboutData()
+{
+ KAboutData * aboutData = new KAboutData( "kugar", I18N_NOOP( "Kugar" ),
+ VERSION, I18N_NOOP( "Report viewer(generator)" ), KAboutData::License_GPL,
+ I18N_NOOP( "(c) 1999-2006, The Kugar Team" ), 0, "http://www.koffice.org" );
+
+ aboutData->addAuthor( "Alexander Dymo",
+ I18N_NOOP( "Maintainer, Report Designer, Kugar library enhancements" ), "[email protected]",
+ "http://www.cloudtemple.mksat.net" );
+ aboutData->addAuthor( "Joseph Wenninger",
+ I18N_NOOP( "Smaller fixes and Kexi integration" ), "[email protected]",
+ "" );
+ aboutData->addAuthor( "Joris Marcillac",
+ I18N_NOOP( "Direct database support" ), "[email protected]",
+ "" );
+ aboutData->addAuthor( "Phil Thompson",
+ I18N_NOOP( "Former maintainer" ), "[email protected]",
+ "" );
+ aboutData->addAuthor( "Keith Davis (Mutiny Bay Software)",
+ I18N_NOOP( "Original author of Metaphrast" ), "[email protected]",
+ "http://www.mutinybaysoftware.com" );
+ aboutData->setTranslator( I18N_NOOP( "_: NAME OF TRANSLATORS\nYour names" ), I18N_NOOP( "_: EMAIL OF TRANSLATORS\nYour emails" ) );
+ return aboutData;
+}
+#endif
diff --git a/kugar/part/kugar_factory.cpp b/kugar/part/kugar_factory.cpp
new file mode 100644
index 00000000..19db5a96
--- /dev/null
+++ b/kugar/part/kugar_factory.cpp
@@ -0,0 +1,92 @@
+// Copyright (c) 2000 Phil Thompson <[email protected]>
+//
+// This file contains the implementation of the Kugar KPart.
+
+
+#include <klocale.h>
+#include <kstandarddirs.h>
+#include <kinstance.h>
+#include <kaboutdata.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include "kugar_factory.h"
+#include "kugar_part.h"
+#include "kugar_about.h"
+
+KInstance *KugarFactory::s_instance = 0L;
+KAboutData *KugarFactory::s_aboutdata = 0L;
+
+
+// The part's entry point.
+
+K_EXPORT_COMPONENT_FACTORY( libkugarpart, KugarFactory )
+
+
+// The factory ctor.
+
+KugarFactory::KugarFactory( QObject *parent, const char* name ) : KoFactory( parent, name )
+{
+ global();
+}
+
+KInstance* KugarFactory::global()
+{
+ if ( !s_instance )
+ {
+ s_instance = new KInstance( aboutData() );
+ s_instance->iconLoader() ->addAppDir( "koffice" );
+ s_instance->iconLoader() ->addAppDir( "kugar" );
+
+ }
+ return s_instance;
+}
+
+// The factory dtor.
+
+KugarFactory::~KugarFactory()
+{
+ delete s_instance;
+ s_instance = 0;
+ delete s_aboutdata;
+ s_aboutdata = 0;
+}
+
+KAboutData *KugarFactory::aboutData()
+{
+ if ( !s_aboutdata )
+ s_aboutdata = newKugarAboutData();
+ return s_aboutdata;
+}
+
+// Create a new part.
+
+KParts::Part* KugarFactory::createPartObject( QWidget *parentWidget, const char *widgetName,
+ QObject* parent, const char* name, const char* classname, const QStringList & data )
+{
+ QString forcedUserTemplate;
+ for ( QStringList::const_iterator it = data.begin();it != data.end();++it )
+ {
+ QString tmp = ( *it );
+ if ( tmp.startsWith( "template=" ) )
+ forcedUserTemplate = tmp.right( tmp.length() - 9 );
+ }
+
+ bool bWantKoDocument = ( strcmp( classname, "KoDocument" ) == 0 );
+ // parentWidget and widgetName are used by KoDocument for the "readonly+singleView" case.
+ KugarPart *part = new KugarPart( parentWidget, widgetName, parent, name, !bWantKoDocument );
+
+ // if ( !bWantKoDocument )
+ part->setReadWrite( false );
+
+ part->setForcedUserTemplate( forcedUserTemplate );
+ return part;
+ //return ( new KugarPart(parentWidget,name,forcedUserTemplate));
+}
+
+
+#include "kugar_factory.moc"
diff --git a/kugar/part/kugar_factory.h b/kugar/part/kugar_factory.h
new file mode 100644
index 00000000..70ad6317
--- /dev/null
+++ b/kugar/part/kugar_factory.h
@@ -0,0 +1,36 @@
+// Copyright (c) 2000 Phil Thompson <[email protected]>
+//
+// This file contains the definition of the interface to the Kugar KPart.
+
+
+#ifndef _KUGAR_FACTORY_H
+#define _KUGAR_FACTORY_H
+
+
+#include <KoFactory.h>
+#include <kaboutdata.h>
+
+class KInstance;
+
+
+class KugarFactory : public KoFactory
+{
+ Q_OBJECT
+public:
+ KugarFactory( QObject* parent = 0, const char* name = 0 );
+ ~KugarFactory();
+
+ virtual KParts::Part *createPartObject( QWidget *parentWidget = 0, const char *widgetName = 0,
+ QObject *parent = 0, const char *name = 0, const char *classname = "KoDocument",
+ const QStringList &args = QStringList() );
+
+ static KInstance* global();
+
+ // _Creates_ a KAboutData but doesn't keep ownership
+ static KAboutData* aboutData();
+private:
+ static KInstance* s_instance;
+ static KAboutData* s_aboutdata;
+};
+
+#endif
diff --git a/kugar/part/kugar_part.cpp b/kugar/part/kugar_part.cpp
new file mode 100644
index 00000000..158f26db
--- /dev/null
+++ b/kugar/part/kugar_part.cpp
@@ -0,0 +1,259 @@
+// 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 <qwidget.h>
+#include <kfiledialog.h>
+#include <kdebug.h>
+#include <KoStore.h>
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include "kugar_part.h"
+#include "kugar_view.h"
+#include "kugar_factory.h"
+
+#include <KoFilterManager.h>
+
+KugarPart::KugarPart( QWidget *parentWidget, const char *widgetName,
+ QObject* parent, const char* name, bool singleViewMode )
+ : KoDocument( parentWidget, widgetName, parent, name, singleViewMode ),
+ m_templateOk( false )
+{
+ setInstance( KugarFactory::global(), false );
+ m_reportEngine = new Kugar::MReportEngine();
+ connect( m_reportEngine, SIGNAL( preferedTemplate( const QString & ) ),
+ SLOT( slotPreferredTemplate( const QString & ) ) );
+}
+
+KugarPart::~KugarPart()
+{
+ m_reportEngine->removeRef();
+ // closeURL();
+}
+
+bool KugarPart::loadOasis( const QDomDocument&, KoOasisStyles&,
+ const QDomDocument&, KoStore* )
+{
+ return false;
+}
+
+bool KugarPart::saveOasis( KoStore*, KoXmlWriter* )
+{
+ return false;
+}
+
+bool KugarPart::loadXML( QIODevice *file, const QDomDocument & /*doc*/ )
+{
+ m_docURL = url();
+ bool ok = true;
+ if ( file )
+ {
+ file->reset();
+ m_reportData=QString(file->readAll());
+
+ if ( m_reportData.length() != 0 )
+ {
+ ok = m_reportEngine->setReportData( m_reportData );
+
+ if ( m_templateOk )
+ {
+ m_reportEngine->renderReport();
+ if ( ok )
+ {
+ QPtrList<KoView> vs = views();
+ if ( vs.count() )
+ {
+ for ( KoView * v = vs.first();v;v = vs.next() )
+ {
+ ok = static_cast<KugarView*>( v->qt_cast( "KugarView" ) ) ->renderReport();
+ if ( !ok )
+ break;
+ }
+ }
+ }
+ }
+ if ( !ok )
+ KMessageBox::sorry( 0, i18n( "Invalid data file %1" ).arg( m_file ) );
+ }
+ else
+ {
+ ok = false;
+ KMessageBox::sorry( 0, i18n( "The zero sized data file %1 can't be rendered" ).arg( m_file ) );
+ }
+
+ }
+ else
+ {
+ ok = false;
+ KMessageBox::sorry( 0, i18n( "Unable to open data file: %1" ).arg( m_file ) );
+ }
+
+ return ok;
+}
+
+bool KugarPart::initDoc( InitDocFlags /*flags*/, QWidget* /*parentWidget*/ )
+{
+ QString filename;
+ bool ok = false;
+
+ KFileDialog *dialog =
+ new KFileDialog( QString::null, QString::null, 0L, "file dialog", true );
+ dialog->setMimeFilter( KoFilterManager::mimeFilter( KoDocument::readNativeFormatMimeType(),
+ KoFilterManager::Import ) );
+ if ( dialog->exec() != QDialog::Accepted )
+ {
+ delete dialog;
+ return false;
+ }
+
+ KURL url( dialog->selectedURL() );
+ delete dialog;
+
+ if ( url.isEmpty() )
+ return false;
+
+ if ( url.isValid() )
+ {
+ ok = openURL( url );
+ }
+ return ok;
+
+ // If nothing is loaded, do initialize here
+ return TRUE;
+}
+
+KoView* KugarPart::createViewInstance( QWidget* parent, const char* name )
+{
+ KugarView * v = new KugarView( this, parent, name );
+ if ( m_templateOk )
+ v->renderReport();
+ return v;
+}
+
+
+void KugarPart::slotPreferredTemplate( const QString &tpl )
+{
+ KURL url( tpl );
+ QString localtpl;
+ bool isTemp = false;
+
+ if ( !url.isValid() )
+ {
+/* kdDebug() << "mailformed url" << endl;*/
+ if ( tpl.find( '/' ) >= 0 )
+ {
+ if ( tpl.startsWith( "." ) )
+ {
+ KURL tmpURL( m_docURL );
+ tmpURL.setFileName( "" );
+ tmpURL.addPath( tpl );
+ if ( KIO::NetAccess::download( tmpURL, localtpl ) )
+ isTemp = true;
+ else
+ KMessageBox::sorry( 0, i18n( "Unable to download template file: %1" ).arg( url.prettyURL() ) );
+ }
+ else
+ localtpl = tpl;
+ }
+ else
+ {
+ QString former_localtpl = localtpl;
+ localtpl = kapp -> dirs() -> findResource( "data", "kugar/templates/" + tpl );
+ if ( localtpl.isEmpty() )
+ {
+ KURL tmpURL( m_docURL );
+ tmpURL.setFileName( "" );
+ tmpURL.addPath( tpl );
+ if ( KIO::NetAccess::download( tmpURL, localtpl ) )
+ isTemp = true;
+ else
+ KMessageBox::sorry( 0, i18n( "Unable to download template file: %1" ).arg( url.prettyURL() ) );
+ }
+ }
+ }
+ else
+ {
+ if ( KIO::NetAccess::download( url, localtpl ) )
+ isTemp = true;
+ else
+ KMessageBox::sorry( 0, i18n( "Unable to download template file: %1" ).arg( url.prettyURL() ) );
+ }
+
+/* kdDebug() << "localtpl: " << localtpl.latin1() << endl;*/
+ if ( !localtpl.isEmpty() )
+ {
+ QFile f( localtpl );
+
+ if ( f.open( IO_ReadOnly ) )
+ {
+/* kdDebug() << "localtpl opened" << endl;*/
+ // Try to find out whether it is a mime multi part file
+ char buf[ 5 ];
+ if ( f.readBlock( buf, 4 ) == 4 )
+ {
+ bool isRawXML = ( strncasecmp( buf, "<?xm", 4 ) == 0 );
+ f.close();
+
+ if ( isRawXML )
+ {
+/* kdDebug() << "RawXML" << endl;*/
+ f.open( IO_ReadOnly );
+ if ( !m_reportEngine -> setReportTemplate( &f ) )
+ KMessageBox::sorry( 0, i18n( "Invalid template file: %1" ).arg( localtpl ) );
+ else
+ {
+ m_templateOk = true;
+/* kdDebug() << "Setting m_templateOk" << endl;*/
+ }
+ f.close();
+ }
+ else
+ {
+ KoStore *tmpStore = KoStore::createStore( localtpl, KoStore::Read );
+ if ( tmpStore->open( "maindoc.xml" ) )
+ {
+ if ( !m_reportEngine -> setReportTemplate( tmpStore->device() ) )
+ KMessageBox::sorry( 0, i18n( "%1 is not a valid Kugar Designer template file." ).arg( localtpl ) );
+ else
+ m_templateOk = true;
+ tmpStore->close();
+ }
+ else
+ KMessageBox::sorry( 0, i18n( "%1 is not a valid Kugar Designer template file." ).arg( localtpl ) );
+
+ delete tmpStore;
+ }
+
+ }
+ else
+ {
+ f.close();
+ KMessageBox::sorry( 0, i18n( "Couldn't read the beginning of the template file: %1" ).arg( localtpl ) );
+ }
+
+ }
+ else
+ KMessageBox::sorry( 0, i18n( "Unable to open template file: %1" ).arg( localtpl ) );
+
+ if ( isTemp )
+ KIO::NetAccess::removeTempFile( localtpl );
+ }
+}
+
+#include "kugar_part.moc"
diff --git a/kugar/part/kugar_part.h b/kugar/part/kugar_part.h
new file mode 100644
index 00000000..3f54e42c
--- /dev/null
+++ b/kugar/part/kugar_part.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2000 Phil Thompson <[email protected]>
+//
+// This file contains the definition of the interface to the Kugar KPart.
+
+
+#ifndef _KUGAR_PART_H
+#define _KUGAR_PART_H
+
+#include <KoDocument.h>
+
+#include "mpagecollection.h"
+#include "mreportengine.h"
+
+class KInstance;
+class KugarBrowserExtension;
+
+class KugarPart: public KoDocument
+{
+ Q_OBJECT
+
+public:
+ KugarPart( QWidget *parentWidget = 0, const char *widgetName = 0,
+ QObject* parent = 0,
+ const char* name = 0, bool singleViewMode = false );
+ virtual ~KugarPart();
+
+ virtual bool initDoc( InitDocFlags flags, QWidget* parentWidget = 0 );
+
+ virtual bool loadOasis( const QDomDocument&, KoOasisStyles&,
+ const QDomDocument&, KoStore* );
+ virtual bool saveOasis( KoStore*, KoXmlWriter* );
+
+ virtual bool loadXML( QIODevice *, const QDomDocument & );
+ // virtual QDomDocument saveXML();
+
+ virtual void paintContent( QPainter&, const QRect&,
+ bool /*transparent*/ = false,
+ double /*zoomX*/ = 1.0, double /*zoomY*/ = 1.0 )
+ {
+ ;
+ }
+
+ Kugar::MReportEngine *reportEngine()
+ {
+ return m_reportEngine;
+ }
+
+protected:
+ virtual KoView* createViewInstance( QWidget* parent, const char* name );
+
+public slots:
+ void setForcedUserTemplate( const QString &/*name*/ )
+ {
+ ;
+ }
+
+private slots:
+ void slotPreferredTemplate( const QString & );
+
+private:
+ QString m_reportData;
+ Kugar::MReportEngine *m_reportEngine;
+ bool m_templateOk;
+ KURL m_docURL;
+};
+
+
+#endif
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"
diff --git a/kugar/part/kugar_view.h b/kugar/part/kugar_view.h
new file mode 100644
index 00000000..a6838737
--- /dev/null
+++ b/kugar/part/kugar_view.h
@@ -0,0 +1,53 @@
+// Copyright (c) 2000 Phil Thompson <[email protected]>
+//
+// This file contains the definition of the interface to the Kugar KPart.
+
+
+#ifndef _KUGAR_VIEW_H
+#define _KUGAR_VIEW_H
+
+#include "mreportviewer.h"
+
+#include <KoView.h>
+
+class KugarPart;
+
+class KugarView: public KoView
+{
+ Q_OBJECT
+
+public:
+ KugarView( KugarPart *part, QWidget *parent, const char *name );
+ virtual ~KugarView();
+
+ void setForcedUserTemplate( const QString &name );
+
+ void updateReadWrite( bool )
+ {
+ ;
+ }
+
+ bool renderReport();
+
+ bool setReportTemplate( const QString &data )
+ {
+ return view -> setReportTemplate( data );
+ }
+
+
+ virtual void setupPrinter( KPrinter &printer );
+ virtual void print( KPrinter &printer );
+
+
+
+ //protected:
+ // virtual bool openFile();
+ // virtual bool closeURL();
+
+
+private:
+ Kugar::MReportViewer *view;
+ QString m_forcedUserTemplate;
+};
+
+#endif
diff --git a/kugar/part/kugarpart.desktop b/kugar/part/kugarpart.desktop
new file mode 100644
index 00000000..ad9f125d
--- /dev/null
+++ b/kugar/part/kugarpart.desktop
@@ -0,0 +1,118 @@
+[Desktop Entry]
+Name=KOffice Report Generator Component
+Name[bg]=Компонент за генератор на отчети в KOffice
+Name[ca]=Component generador d'informes de KOffice
+Name[cy]=Cydran Gynhyrchydd Adroddiad KOffice
+Name[da]=Koffice rapportgeneratorkomponent
+Name[de]=KOffice-Komponente für Berichterstellung
+Name[el]=Συστατικό δημιουργίας αναφορών του KOffice
+Name[eo]=KOffice raportgenera komponanto
+Name[es]=Componente de generación de informes de KOffice
+Name[et]=KOffice'i aruandegeneraatori komponent
+Name[eu]=KOffice-en txosten sortzailearen osagaia
+Name[fa]=مؤلفۀ مولد گزارش KOffice
+Name[fi]=KOfficen raporttigeneraattori
+Name[fr]=Composant générateur de rapports de KOffice
+Name[fy]=KOffice rapportgeneratorkomponint
+Name[gl]=Componente de Xeración de Informes de KOffice
+Name[he]=רכיב של KOffice ליצירת דו"חות
+Name[hi]=के-ऑफ़िस रपट सृजक अवयव
+Name[hu]=KOffice jelentéskészítő komponens
+Name[is]=Skýrsluskrifarahluti KOffice
+Name[it]=Componente per la generazione dei rapporti di KOffice
+Name[ja]=KOffice レポート生成コンポーネント
+Name[km]=សមាសភាគ​បង្កើន​របាយការណ៍ KOffice
+Name[lv]=KOffice atskaišu ģeneratora komponente
+Name[ms]=Komponen Penjana Laporan KOffice
+Name[nb]=Rapportopprettings-komponent for KOffice
+Name[nds]=Berichtopstell-Komponent för KOffice
+Name[ne]=केडीई कार्यालय प्रतिवेदन सर्जक अवयव
+Name[nl]=Koffice Rapportgeneratorcomponent
+Name[nn]=Rapportgenerator-komponent for KOffice
+Name[pl]=Komponent generowania raportów dla KOffice
+Name[pt]=Componente de Geração de Relatórios do KOffice
+Name[pt_BR]=Componente Gerador de Relatórios do KOffice
+Name[ru]=Компонент генератора отчётов KOffice
+Name[sk]=Komponent generátor správ KOffice
+Name[sl]=Komponenta ustvarjanja poročil za KOffice
+Name[sr]=KOffice-ова компонента за прављење извештаја
+Name[sr@Latn]=KOffice-ova komponenta za pravljenje izveštaja
+Name[sv]=Koffice-rapportgeneratorkomponent
+Name[tg]=Компоненти муваллиди гузоришҳои KOffice
+Name[tr]=KOffice Rapor Oluşturma Programı
+Name[uk]=Компонент створення звітів KOffice
+Name[uz]=KOffice hisobot tuzish komponenti
+Name[uz@cyrillic]=KOffice ҳисобот тузиш компоненти
+Name[wa]=Componint djenerateu d' rapoirts di KOffice
+Name[zh_CN]=KOffice 报告生成组件
+Name[zh_TW]=KOffice 報告產生元件
+MimeType=application/x-kugar;application/x-vnd.kde.kugar.mixed
+Type=Service
+Terminal=false
+ServiceTypes=KOfficePart,KParts/ReadOnlyPart,Browser/View
+X-KDE-Library=libkugarpart
+X-KDE-NativeMimeType=application/x-vnd.kde.kugar.mixed
+GenericName=Report Generator
+GenericName[af]=Raporteer Genereerder
+GenericName[ar]=مُوَلِّد التَّقارير
+GenericName[az]=Raport Yaradıcısı
+GenericName[bg]=Генератор на отчети
+GenericName[bs]=Generator izvještaja
+GenericName[ca]=Generador d'informes
+GenericName[cs]=Generátor reportů
+GenericName[cy]=Cynhyrchydd Adroddiad
+GenericName[da]=Rapportgenerator
+GenericName[de]=Bericht-Erstellung
+GenericName[el]=Δημιουργός αναφορών
+GenericName[eo]=Raporto-kreilo
+GenericName[es]=Generador de informes
+GenericName[et]=Aruandegeneraator
+GenericName[eu]=Txosten-sortzailea
+GenericName[fa]=مولد گزارش
+GenericName[fi]=Raporttigeneraattori
+GenericName[fr]=Générateur de rapports
+GenericName[fy]=Reportgenerator
+GenericName[gl]=Xerador de informes
+GenericName[he]=יוצר דו"חות
+GenericName[hi]=रपट सृजक
+GenericName[hr]=Program za generiranje izvještaja
+GenericName[hu]=Jelentéskészítő
+GenericName[is]=Skýrsluskrifari
+GenericName[it]=Generatore di rapporti
+GenericName[ja]=レポート生成
+GenericName[km]=កម្មវិធី​បង្កើត​របាយការណ៍
+GenericName[lo]=ເຄື່ອງມືສ້າງລາຍງານ
+GenericName[lt]=Raportų generatorius
+GenericName[lv]=Atskaišu ģenerators
+GenericName[ms]=Penjana Laporan
+GenericName[mt]=Ġeneratur tar-Rapporti
+GenericName[nb]=Rapport-oppretter
+GenericName[nds]=Bericht-Maker
+GenericName[ne]=प्रतिवेदन सर्जक
+GenericName[nl]=Rapportengenerator
+GenericName[nn]=Rapportgenerator
+GenericName[pl]=Generator raportów
+GenericName[pt]=Geração de Relatórios
+GenericName[pt_BR]=Gerador de Relatórios
+GenericName[ro]=Generator de rapoarte
+GenericName[ru]=Отчёты
+GenericName[se]=Raportaráhkadeaddji
+GenericName[sk]=Generátor reportov
+GenericName[sl]=Ustvarjanje poročil
+GenericName[sr]=Програм за прављење извештаја
+GenericName[sr@Latn]=Program za pravljenje izveštaja
+GenericName[sv]=Rapportgenerator
+GenericName[tg]=Ҳисоби Тавлидкунанда
+GenericName[th]=เครื่องมือสร้างรายงาน
+GenericName[tr]=Rapor Oluşturma Programı
+GenericName[uk]=Генератор звітів
+GenericName[uz]=Hisobot yaratuvchi
+GenericName[uz@cyrillic]=Ҳисобот яратувчи
+GenericName[wa]=Djenerateu d' rapoirts
+GenericName[xh]=Umenzi we Ngxelo
+GenericName[zh_CN]=报告生成器
+GenericName[zh_TW]=報告產生器
+Icon=kugar
+# Not ready for public consumption, so hide it from the menus and from koshell
+NoDisplay=true
+
diff --git a/kugar/part/kugarpart.rc b/kugar/part/kugarpart.rc
new file mode 100644
index 00000000..5f11d8f7
--- /dev/null
+++ b/kugar/part/kugarpart.rc
@@ -0,0 +1,21 @@
+<!DOCTYPE kpargui>
+<kpartgui name="kugar" >
+ <MenuBar>
+ <Menu name="view" >
+ <Text>&amp;View</Text>
+ <Separator/>
+ <Action name="kuPrevPage" />
+ <Action name="kuNextPage" />
+ <Separator/>
+ <Action name="kuFirstPage" />
+ <Action name="kuLastPage" />
+ </Menu>
+ </MenuBar>
+ <ToolBar name="Metaphrast-ToolBar" >
+ <Action name="kuPrevPage" />
+ <Action name="kuNextPage" />
+ <Action name="kuFirstPage" />
+ <Action name="kuLastPage" />
+ </ToolBar>
+<!-- <StatusBar/> -->
+</kpartgui>
diff --git a/kugar/part/kugartemplate.dtd b/kugar/part/kugartemplate.dtd
new file mode 100644
index 00000000..a91fbd61
--- /dev/null
+++ b/kugar/part/kugartemplate.dtd
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- The DTD for a Kugar template. -->
+
+
+<!ELEMENT KugarTemplate (ReportHeader, PageHeader, DetailHeader*, Detail*, DetailFooter*, PageFooter, ReportFooter)>
+<!ATTLIST KugarTemplate
+ PageSize CDATA #REQUIRED
+ PageOrientation CDATA #REQUIRED
+ TopMargin CDATA #REQUIRED
+ BottomMargin CDATA #REQUIRED
+ LeftMargin CDATA #REQUIRED
+ RightMargin CDATA #REQUIRED>
+
+<!ELEMENT ReportHeader (Line*, Label*, Special*)>
+<!ATTLIST ReportHeader
+ Height CDATA #REQUIRED
+ PrintFrequency CDATA #REQUIRED>
+
+<!ELEMENT PageHeader (Line*, Label*, Special*)>
+<!ATTLIST PageHeader
+ Height CDATA #REQUIRED
+ PrintFrequency CDATA #REQUIRED>
+
+<!ELEMENT DetailHeader (Line*, Label*, Special*)>
+<!ATTLIST DetailHeader
+ Height CDATA #REQUIRED
+ Level CDATA #REQUIRED>
+
+<!ELEMENT Detail (Line*, Label*, Special*, Field*)>
+<!ATTLIST Detail
+ Height CDATA #REQUIRED
+ Level CDATA #REQUIRED>
+
+<!ELEMENT DetailFooter (Line*, Label*, Special*)>
+<!ATTLIST DetailFooter
+ Height CDATA #REQUIRED
+ Level CDATA #REQUIRED>
+
+<!ELEMENT PageFooter (Line*, Label*, Special*)>
+<!ATTLIST PageFooter
+ Height CDATA #REQUIRED
+ PrintFrequency CDATA #REQUIRED>
+
+<!ELEMENT ReportFooter (Line*, Label*, Special*, CalculatedField*)>
+<!ATTLIST ReportFooter
+ Height CDATA #REQUIRED
+ PrintFrequency CDATA #REQUIRED>
+
+<!ELEMENT Line EMPTY>
+<!ATTLIST Line
+ X1 CDATA #REQUIRED
+ Y1 CDATA #REQUIRED
+ X2 CDATA #REQUIRED
+ Y2 CDATA #REQUIRED
+ Width CDATA #REQUIRED
+ Color CDATA #REQUIRED
+ Style CDATA #REQUIRED>
+
+<!ELEMENT Label EMPTY>
+<!ATTLIST Label
+ Text CDATA #REQUIRED
+ X CDATA #REQUIRED
+ Y CDATA #REQUIRED
+ Width CDATA #REQUIRED
+ Height CDATA #REQUIRED
+ BackgroundColor CDATA #REQUIRED
+ ForegroundColor CDATA #REQUIRED
+ BorderColor CDATA #REQUIRED
+ BorderWidth CDATA #REQUIRED
+ BorderStyle CDATA #REQUIRED
+ FontFamily CDATA #REQUIRED
+ FontSize CDATA #REQUIRED
+ FontWeight CDATA #REQUIRED
+ FontItalic CDATA #REQUIRED
+ HAlignment CDATA #REQUIRED
+ VAlignment CDATA #REQUIRED
+ WordWrap CDATA #REQUIRED>
+
+<!ELEMENT Field EMPTY>
+<!ATTLIST Field
+ Field CDATA #REQUIRED
+ Text CDATA #REQUIRED
+ X CDATA #REQUIRED
+ Y CDATA #REQUIRED
+ Width CDATA #REQUIRED
+ Height CDATA #REQUIRED
+ BackgroundColor CDATA #REQUIRED
+ ForegroundColor CDATA #REQUIRED
+ BorderColor CDATA #REQUIRED
+ BorderWidth CDATA #REQUIRED
+ BorderStyle CDATA #REQUIRED
+ FontFamily CDATA #REQUIRED
+ FontSize CDATA #REQUIRED
+ FontWeight CDATA #REQUIRED
+ FontItalic CDATA #REQUIRED
+ HAlignment CDATA #REQUIRED
+ VAlignment CDATA #REQUIRED
+ WordWrap CDATA #REQUIRED
+ DataType CDATA #REQUIRED
+ DateFormat CDATA #REQUIRED
+ Precision CDATA #REQUIRED
+ Currency CDATA #REQUIRED
+ NegValueColor CDATA #REQUIRED
+ CommaSeparator CDATA #REQUIRED>
+
+<!ELEMENT CalculatedField EMPTY>
+<!ATTLIST CalculatedField
+ CalculationType CDATA #REQUIRED
+ Field CDATA #REQUIRED
+ Text CDATA #REQUIRED
+ X CDATA #REQUIRED
+ Y CDATA #REQUIRED
+ Width CDATA #REQUIRED
+ Height CDATA #REQUIRED
+ BackgroundColor CDATA #REQUIRED
+ ForegroundColor CDATA #REQUIRED
+ BorderColor CDATA #REQUIRED
+ BorderWidth CDATA #REQUIRED
+ BorderStyle CDATA #REQUIRED
+ FontFamily CDATA #REQUIRED
+ FontSize CDATA #REQUIRED
+ FontWeight CDATA #REQUIRED
+ FontItalic CDATA #REQUIRED
+ HAlignment CDATA #REQUIRED
+ VAlignment CDATA #REQUIRED
+ WordWrap CDATA #REQUIRED
+ DataType CDATA #REQUIRED
+ DateFormat CDATA #REQUIRED
+ Precision CDATA #REQUIRED
+ Currency CDATA #REQUIRED
+ NegValueColor CDATA #REQUIRED
+ CommaSeparator CDATA #REQUIRED>
+
+<!ELEMENT Special EMPTY>
+<!ATTLIST Special
+ Type CDATA #REQUIRED
+ Text CDATA #REQUIRED
+ X CDATA #REQUIRED
+ Y CDATA #REQUIRED
+ Width CDATA #REQUIRED
+ Height CDATA #REQUIRED
+ BackgroundColor CDATA #REQUIRED
+ ForegroundColor CDATA #REQUIRED
+ BorderColor CDATA #REQUIRED
+ BorderWidth CDATA #REQUIRED
+ BorderStyle CDATA #REQUIRED
+ FontFamily CDATA #REQUIRED
+ FontSize CDATA #REQUIRED
+ FontWeight CDATA #REQUIRED
+ FontItalic CDATA #REQUIRED
+ HAlignment CDATA #REQUIRED
+ VAlignment CDATA #REQUIRED
+ WordWrap CDATA #REQUIRED
+ DateFormat CDATA #REQUIRED>
diff --git a/kugar/part/main.cpp b/kugar/part/main.cpp
new file mode 100644
index 00000000..e37c7799
--- /dev/null
+++ b/kugar/part/main.cpp
@@ -0,0 +1,44 @@
+/***************************************************************************
+ main.cpp - description
+ -------------------
+ begin : Mon Nov 25 17:45:00 CET 2002
+ copyright : (C) 2002 by Joseph Wenninger
+***************************************************************************/
+
+/***************************************************************************
+ * *
+ * 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 *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <KoApplication.h>
+#include <kcmdlineargs.h>
+#include <dcopclient.h>
+
+#include "kugar_about.h"
+
+static KCmdLineOptions options[] =
+ {
+ { "+[File]", I18N_NOOP( "File to open" ), 0 },
+ // INSERT YOUR COMMANDLINE OPTIONS HERE
+ KCmdLineLastOption
+ };
+
+extern "C" KUGAR_EXPORT int kdemain( int argc, char *argv[] )
+{
+
+ KCmdLineArgs::init( argc, argv, newKugarAboutData() );
+ KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
+
+ KoApplication app;
+
+ if ( !app.start() )
+ return 1;
+
+ app.exec();
+ return 0;
+}
diff --git a/kugar/samples/Makefile.am b/kugar/samples/Makefile.am
new file mode 100644
index 00000000..7b35233f
--- /dev/null
+++ b/kugar/samples/Makefile.am
@@ -0,0 +1,4 @@
+templatedir = $(kde_datadir)/kugar/templates
+template_DATA = sample1.ktf sample2.ktf sample3.ktf sample1.kdf sample2.kdf sample3.kdf
+
+EXTRA_DIST = $(template_DATA)
diff --git a/kugar/samples/sample1.kdf b/kugar/samples/sample1.kdf
new file mode 100644
index 00000000..c695b02b
--- /dev/null
+++ b/kugar/samples/sample1.kdf
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarData [
+ <!ELEMENT KugarData (Row* )>
+ <!ATTLIST KugarData
+ Template CDATA #REQUIRED>
+
+ <!ELEMENT Row EMPTY>
+ <!ATTLIST Row
+ level CDATA #REQUIRED
+ title CDATA #REQUIRED
+ version CDATA #REQUIRED
+ platform CDATA #REQUIRED
+ copies CDATA #REQUIRED>
+]>
+
+<KugarData Template="sample1.ktf">
+ <Row level="0" title=" BRU" version="15.0" platform="x86" copies="1"/>
+ <Row level="0" title=" Caldera Open Linux" version="2.2" platform="x86" copies="3"/>
+ <Row level="0" title=" K Desktop" version="1.1.1" platform="x86" copies="1"/>
+ <Row level="0" title=" Netscape Communicator" version="4.6" platform="x86" copies="10"/>
+ <Row level="0" title=" Redhat Linux" version="5.0" platform="x86" copies="11"/>
+ <Row level="0" title=" Redhat Linux" version="5.1" platform="x86" copies="12"/>
+ <Row level="0" title=" Redhat Linux" version="5.2" platform="x86" copies="14"/>
+ <Row level="0" title=" Redhat Linux" version="6.0" platform="x86" copies="15"/>
+ <Row level="0" title=" Star Office" version="5.0" platform="x86" copies="1"/>
+ <Row level="0" title=" Star Office" version="5.1" platform="x86" copies="3"/>
+ <Row level="0" title=" Microsoft Windows NT" version="3.1" platform="x86" copies="1"/>
+ <Row level="0" title=" Microsoft Windows NT" version="3.51" platform="x86" copies="1"/>
+ <Row level="0" title=" Microsoft Windows NT" version="4.0" platform="x86" copies="1"/>
+ <Row level="0" title=" Microsoft Windows NT" version="5.0" platform="x86" copies="1"/>
+ <Row level="0" title=" Sun Solaris" version="2.5" platform="Sparc" copies="1"/>
+</KugarData>
diff --git a/kugar/samples/sample1.ktf b/kugar/samples/sample1.ktf
new file mode 100644
index 00000000..5cba258d
--- /dev/null
+++ b/kugar/samples/sample1.ktf
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageOrientation="1" TopMargin="40" RightMargin="48" BottomMargin="40" LeftMargin="48" PageSize="2" PageWidth="1100" PageHeight="850">
+ <ReportHeader PrintFrequency="0" Height="70">
+ <Label VAlignment="1" HAlignment="0"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="0" Y="0" ForegroundColor="0,0,0"
+ Text="Mutiny Bay Software" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="31"
+ Width="255" BackgroundColor="255,255,255" FontItalic="1"
+ BorderWidth="0" DrawRight="false" DrawBottom="false"
+ FontSize="24" />
+ <Label VAlignment="1" HAlignment="0"
+ BorderStyle="1" WordWrap="0" DrawLeft="false"
+ X="0" Y="39" ForegroundColor="0,0,0"
+ Text=" Software Inventory Report" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="30"
+ Width="690" BackgroundColor="0,255,255" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="12" />
+ </ReportHeader>
+
+ <PageHeader PrintFrequency="1" Height="45">
+ <Label VAlignment="1" HAlignment="0"
+ BorderStyle="1" WordWrap="0" DrawLeft="false"
+ X="0" Y="15" ForegroundColor="255,255,255"
+ Text=" Title" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="31"
+ Width="505" BackgroundColor="128,128,128" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ <Label VAlignment="1" HAlignment="1"
+ BorderStyle="1" WordWrap="0" DrawLeft="false"
+ X="504" Y="15" ForegroundColor="0,0,0"
+ Text="Version" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="31"
+ Width="50" BackgroundColor="255,255,0" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ <Label VAlignment="1" HAlignment="1"
+ BorderStyle="1" WordWrap="0" DrawLeft="false"
+ X="553" Y="15" ForegroundColor="0,0,0"
+ Text="Platform" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="31"
+ Width="60" BackgroundColor="255,255,0" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ <Label VAlignment="1" HAlignment="1"
+ BorderStyle="1" WordWrap="0" DrawLeft="false"
+ X="612" Y="15" ForegroundColor="0,0,0"
+ Text="# of Copies" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="31"
+ Width="78" BackgroundColor="255,255,0" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ </PageHeader>
+
+ <Detail Level="0" Height="30" Repeat="false">
+ <Field VAlignment="1" HAlignment="0"
+ CommaSeparator="48" BorderStyle="1" WordWrap="0"
+ DrawLeft="false" Field="title" X="0"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="0" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="31" Width="505" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="1" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Field VAlignment="1" HAlignment="1"
+ CommaSeparator="48" BorderStyle="1" WordWrap="0"
+ DrawLeft="false" Field="version" X="504"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="0" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="31" Width="50" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Field VAlignment="1" HAlignment="1"
+ CommaSeparator="48" BorderStyle="1" WordWrap="0"
+ DrawLeft="false" Field="platform" X="553"
+ Y="0" ForegroundColor="255,0,0" NegValueColor="255,0,0"
+ Text="" DataType="0" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="31" Width="60" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Field VAlignment="1" HAlignment="1"
+ CommaSeparator="48" BorderStyle="1" WordWrap="0"
+ DrawLeft="false" Field="copies" X="612"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="1" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="31" Width="78" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ </Detail>
+
+ <PageFooter PrintFrequency="1" Height="32">
+ <Label VAlignment="1" HAlignment="1"
+ BorderStyle="1" WordWrap="0" DrawLeft="false"
+ X="0" Y="0" ForegroundColor="0,0,0"
+ Text="" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="1"
+ Width="690" BackgroundColor="255,255,255" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ <Label VAlignment="1" HAlignment="2"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="640" Y="2" ForegroundColor="0,0,0"
+ Text="Page:" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="25" Height="30"
+ Width="30" BackgroundColor="255,255,255" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ <Special VAlignment="1" HAlignment="0"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="0" Y="2" ForegroundColor="0,0,0"
+ Text="[Date]" BorderColor="0,0,0" DateFormat="2"
+ FontFamily="Helvetica" DrawTop="false" FontWeight="25"
+ Height="30" Type="0" Width="90"
+ BackgroundColor="255,255,255" FontItalic="0" BorderWidth="0"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Special VAlignment="1" HAlignment="1"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="670" Y="2" ForegroundColor="0,0,0"
+ Text="[PageNo]" BorderColor="0,0,0" DateFormat="0"
+ FontFamily="Helvetica" DrawTop="false" FontWeight="25"
+ Height="30" Type="1" Width="20"
+ BackgroundColor="255,255,255" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ </PageFooter>
+
+ <ReportFooter PrintFrequency="2" Height="32">
+ <CalculatedField VAlignment="1" HAlignment="1"
+ CommaSeparator="48" BorderStyle="1" WordWrap="0"
+ DrawLeft="false" Field="copies" X="612"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="1" BorderColor="0,0,0"
+ CalculationType="1" DateFormat="0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" InputMask=""
+ Precision="0" Height="31" Width="78"
+ BackgroundColor="255,255,255" Currency="51" FontItalic="0"
+ BorderWidth="0" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ </ReportFooter>
+
+</KugarTemplate>
diff --git a/kugar/samples/sample2.kdf b/kugar/samples/sample2.kdf
new file mode 100644
index 00000000..279cbdce
--- /dev/null
+++ b/kugar/samples/sample2.kdf
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarData [
+ <!ELEMENT KugarData (Row* )>
+ <!ATTLIST KugarData
+ Template CDATA #REQUIRED>
+
+ <!ELEMENT Row EMPTY>
+ <!ATTLIST Row
+ level CDATA #REQUIRED
+ prddesc CDATA #REQUIRED
+ prdnumber CDATA #REQUIRED
+ onsale CDATA #REQUIRED
+ price CDATA #REQUIRED
+ onhand CDATA #REQUIRED
+ reorder CDATA #REQUIRED
+ lastorder CDATA #REQUIRED>
+]>
+
+<KugarData Template="sample2.ktf">
+ <Row level="0" prddesc="Category 5 HD Jacks (Black)" prdnumber="DCO245OB" onsale="Y" price="5.99" onhand="-100" reorder="100" lastorder="02/25/2000" />
+ <Row level="0" prddesc="Category 5 HD Jacks (Blue)" prdnumber="DCO245OWB" onsale="Y" price="5.99" onhand="534" reorder="100" lastorder="02/25/2000" />
+ <Row level="0" prddesc="Category 5 HD Jacks (Gray)" prdnumber="DCO245OG" onsale="Y" price="5.99" onhand="856" reorder="100" lastorder="02/25/2000" />
+ <Row level="0" prddesc="Category 5 HD Jacks (Orange)" prdnumber="DCO245OO" onsale="Y" price="5.99" onhand="1432" reorder="100" lastorder="02/25/2000" />
+ <Row level="0" prddesc="Category 5 HD Jacks (Red)" prdnumber="DCO245OWR" onsale="Y" price="5.99" onhand="345" reorder="100" lastorder="02/25/2000" />
+ <Row level="0" prddesc="Category 5 HD Jacks (White)" prdnumber="DCO245OW" onsale="Y" price="5.99" onhand="946" reorder="100" lastorder="02/25/2000" />
+ <Row level="0" prddesc="Cisco Router 1 Ethernet/2 Serial" prdnumber="DEB1602" onsale="N" price="1659.00" onhand="74" reorder="5" lastorder="01/16/2000" />
+ <Row level="0" prddesc="Cisco Router 1 Ethernet/2 Sync Serial" prdnumber="DEB1611" onsale="N" price="2049.00" onhand="25" reorder="5" lastorder="01/16/2000" />
+ <Row level="0" prddesc="Cisco Router 2 Ethernet/2 Serial" prdnumber="DEB1609" onsale="N" price="1949.00" onhand="25" reorder="5" lastorder="01/16/2000" />
+ <Row level="0" prddesc="Datatwist 350 Patch Cable 1' (Blue)" prdnumber="DCA3153BL" onsale="N" price="6.99" onhand="2784" reorder="100" lastorder="01/27/2000" />
+ <Row level="0" prddesc="Datatwist 350 Patch Cable 1' (Green)" prdnumber="DCA3153GN" onsale="N" price="6.99" onhand="3531" reorder="100" lastorder="01/27/2000" />
+ <Row level="0" prddesc="Datatwist 350 Patch Cable 1' (Orange)" prdnumber="DCA3153OR" onsale="N" price="6.99" onhand="2674" reorder="100" lastorder="01/27/2000" />
+ <Row level="0" prddesc="Datatwist 350 Patch Cable 1' (Pink)" prdnumber="DCA3153PK" onsale="N" price="6.99" onhand="12684" reorder="100" lastorder="01/27/2000" />
+ <Row level="0" prddesc="Datatwist 350 Patch Cable 1' (Red)" prdnumber="DCA3153RD" onsale="N" price="6.99" onhand="4725" reorder="100" lastorder="01/27/2000" />
+ <Row level="0" prddesc="Etherlink 10 ISA UTP only" prdnumber="3C509BTPO" onsale="N" price="59.95" onhand="1232" reorder="25" lastorder="12/23/1999" />
+ <Row level="0" prddesc="Etherlink 10 ISA UTP/AUI" prdnumber="3C509BTP" onsale="Y" price="99.95" onhand="-5" reorder="10" lastorder="02/15/2000" />
+ <Row level="0" prddesc="Etherlink 10 ISA UTP/BNC" prdnumber="3C509BTPC" onsale="N" price="69.95" onhand="132" reorder="25" lastorder="10/11/1999" />
+ <Row level="0" prddesc="Etherlink 10 UTP 32-bit EISA" prdnumber="3C592TPO" onsale="Y" price="179.95" onhand="200" reorder="15" lastorder="09/01/1999" />
+ <Row level="0" prddesc="EZ Hub 12-port 10/100 Hub" prdnumber="DEH3889" onsale="N" price="239.99" onhand="2435" reorder="35" lastorder="10/07/1999" />
+ <Row level="0" prddesc="EZ Stack 8-port 10/100 Hub" prdnumber="DEH3693" onsale="N" price="224.99" onhand="1195" reorder="35" lastorder="11/15/1999" />
+ <Row level="0" prddesc="EZ Stack 16-port 10/100 Hub" prdnumber="DEH3694" onsale="N" price="399.99" onhand="345" reorder="25" lastorder="06/04/1999" />
+ <Row level="0" prddesc="Intel NetportExpress 10/100 1-Port" prdnumber="DEP1716" onsale="N" price="209.99" onhand="121" reorder="25" lastorder="02/12/2000" />
+ <Row level="0" prddesc="Intel NetportExpress 10/100 1-Port 3-Pack" prdnumber="DEP1717" onsale="N" price="569.99" onhand="98" reorder="25" lastorder="02/12/2000" />
+ <Row level="0" prddesc="Intel NetportExpress 10/100 3-Port" prdnumber="DEP1758" onsale="N" price="305.99" onhand="82" reorder="25" lastorder="02/12/2000" />
+ <Row level="0" prddesc="Intel NetportExpress 10/100 3-Port 3-Pack" prdnumber="DEP1759" onsale="N" price="809.99" onhand="321" reorder="25" lastorder="02/12/2000" />
+ <Row level="0" prddesc="Intel NetportExpress 10/100 1-Port 10Base-T" prdnumber="DEP1801" onsale="N" price="149.99" onhand="775" reorder="25" lastorder="02/12/2000" />
+ <Row level="0" prddesc="Intel NetportExpress 10/100 3-Port 10Base-T" prdnumber="DEP1803" onsale="N" price="249.99" onhand="121" reorder="25" lastorder="02/12/2000" />
+ <Row level="0" prddesc="Intel NetportExpress PRO 3-Port Token Ring" prdnumber="DEP1447" onsale="N" price="479.99" onhand="45" reorder="5" lastorder="02/12/2000" />
+</KugarData>
diff --git a/kugar/samples/sample2.ktf b/kugar/samples/sample2.ktf
new file mode 100644
index 00000000..5c2667c2
--- /dev/null
+++ b/kugar/samples/sample2.ktf
@@ -0,0 +1,240 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageOrientation="1" TopMargin="40" RightMargin="48" BottomMargin="40" LeftMargin="48" PageSize="2" PageWidth="1100" PageHeight="850">
+ <ReportHeader PrintFrequency="0" Height="70">
+ <Label VAlignment="2" HAlignment="0"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="0" Y="0" ForegroundColor="0,0,0"
+ Text="Networks R Us" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="31"
+ Width="255" BackgroundColor="255,255,255" FontItalic="1"
+ BorderWidth="0" DrawRight="false" DrawBottom="false"
+ FontSize="24" />
+ <Label VAlignment="2" HAlignment="2"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="435" Y="0" ForegroundColor="0,0,0"
+ Text="(Western Region)" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="50" Height="31"
+ Width="255" BackgroundColor="255,255,255" FontItalic="0"
+ BorderWidth="0" DrawRight="false" DrawBottom="false"
+ FontSize="14" />
+ <Label VAlignment="1" HAlignment="0"
+ BorderStyle="1" WordWrap="0" DrawLeft="false"
+ X="0" Y="39" ForegroundColor="0,0,0"
+ Text=" Ethernet Products Inventory" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="30"
+ Width="690" BackgroundColor="224,224,224" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="12" />
+ </ReportHeader>
+
+ <PageHeader PrintFrequency="1" Height="32">
+ <Line Color="0,0,0" Style="1"
+ X1="0" X2="263" Y1="26"
+ Y2="26" Width="1" />
+ <Line Color="0,0,0" Style="1"
+ X1="0" X2="263" Y1="28"
+ Y2="28" Width="1" />
+ <Line Color="0,0,0" Style="1"
+ X1="267" X2="339" Y1="26"
+ Y2="26" Width="1" />
+ <Line Color="0,0,0" Style="1"
+ X1="267" X2="339" Y1="28"
+ Y2="28" Width="1" />
+ <Line Color="0,0,0" Style="1"
+ X1="344" X2="388" Y1="26"
+ Y2="26" Width="1" />
+ <Line Color="0,0,0" Style="1"
+ X1="344" X2="388" Y1="28"
+ Y2="28" Width="1" />
+ <Line Color="0,0,0" Style="1"
+ X1="393" X2="462" Y1="26"
+ Y2="26" Width="1" />
+ <Line Color="0,0,0" Style="1"
+ X1="393" X2="462" Y1="28"
+ Y2="28" Width="1" />
+ <Line Color="0,0,0" Style="1"
+ X1="467" X2="536" Y1="26"
+ Y2="26" Width="1" />
+ <Line Color="0,0,0" Style="1"
+ X1="467" X2="536" Y1="28"
+ Y2="28" Width="1" />
+ <Line Color="0,0,0" Style="1"
+ X1="541" X2="610" Y1="26"
+ Y2="26" Width="1" />
+ <Line Color="0,0,0" Style="1"
+ X1="541" X2="610" Y1="28"
+ Y2="28" Width="1" />
+ <Line Color="0,0,0" Style="1"
+ X1="615" X2="690" Y1="26"
+ Y2="26" Width="1" />
+ <Line Color="0,0,0" Style="1"
+ X1="615" X2="690" Y1="28"
+ Y2="28" Width="1" />
+ <Label VAlignment="2" HAlignment="0"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="0" Y="5" ForegroundColor="0,0,0"
+ Text="Product Description" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="50" Height="20"
+ Width="268" BackgroundColor="255,255,255" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="12" />
+ <Label VAlignment="2" HAlignment="0"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="267" Y="5" ForegroundColor="0,0,0"
+ Text="Catalog #" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="50" Height="20"
+ Width="78" BackgroundColor="255,255,255" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="12" />
+ <Label VAlignment="2" HAlignment="1"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="344" Y="5" ForegroundColor="0,0,0"
+ Text="Sale" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="50" Height="20"
+ Width="50" BackgroundColor="255,255,255" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="12" />
+ <Label VAlignment="2" HAlignment="1"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="393" Y="5" ForegroundColor="0,0,0"
+ Text="Price" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="50" Height="20"
+ Width="75" BackgroundColor="255,255,255" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="12" />
+ <Label VAlignment="2" HAlignment="1"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="467" Y="5" ForegroundColor="0,0,0"
+ Text="Quantity" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="50" Height="20"
+ Width="75" BackgroundColor="255,255,255" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="12" />
+ <Label VAlignment="2" HAlignment="1"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="541" Y="5" ForegroundColor="0,0,0"
+ Text="Reorder" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="50" Height="20"
+ Width="75" BackgroundColor="255,255,255" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="12" />
+ <Label VAlignment="2" HAlignment="1"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="615" Y="5" ForegroundColor="0,0,0"
+ Text="Last Order" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="50" Height="20"
+ Width="75" BackgroundColor="255,255,255" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="12" />
+ </PageHeader>
+
+ <Detail Level="0" Height="14" Repeat="false">
+ <Field VAlignment="1" HAlignment="0"
+ CommaSeparator="48" BorderStyle="0" WordWrap="0"
+ DrawLeft="false" Field="prddesc" X="0"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="0" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="14" Width="268" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Field VAlignment="1" HAlignment="0"
+ CommaSeparator="48" BorderStyle="0" WordWrap="0"
+ DrawLeft="false" Field="prdnumber" X="267"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="0" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="14" Width="78" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Field VAlignment="1" HAlignment="1"
+ CommaSeparator="48" BorderStyle="0" WordWrap="0"
+ DrawLeft="false" Field="onsale" X="344"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="0" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="14" Width="50" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Field VAlignment="1" HAlignment="2"
+ CommaSeparator="49" BorderStyle="0" WordWrap="0"
+ DrawLeft="false" Field="price" X="393"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="4" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="14" Width="65" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Field VAlignment="1" HAlignment="2"
+ CommaSeparator="49" BorderStyle="0" WordWrap="0"
+ DrawLeft="false" Field="onhand" X="467"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="1" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="14" Width="65" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Field VAlignment="1" HAlignment="2"
+ CommaSeparator="49" BorderStyle="0" WordWrap="0"
+ DrawLeft="false" Field="reorder" X="541"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="1" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="14" Width="65" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Field VAlignment="1" HAlignment="2"
+ CommaSeparator="48" BorderStyle="0" WordWrap="0"
+ DrawLeft="false" Field="lastorder" X="615"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="3" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="14" Width="65" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ </Detail>
+
+ <PageFooter PrintFrequency="1" Height="32">
+ <Line Color="0,0,0" Style="1"
+ X1="0" X2="690" Y1="0"
+ Y2="0" Width="1" />
+ <Label VAlignment="1" HAlignment="2"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="640" Y="2" ForegroundColor="0,0,0"
+ Text="Page:" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="25" Height="30"
+ Width="30" BackgroundColor="255,255,255" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ <Special VAlignment="1" HAlignment="0"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="0" Y="2" ForegroundColor="0,0,0"
+ Text="[Date]" BorderColor="0,0,0" DateFormat="2"
+ FontFamily="Helvetica" DrawTop="false" FontWeight="25"
+ Height="30" Type="0" Width="90"
+ BackgroundColor="255,255,255" FontItalic="0" BorderWidth="0"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Special VAlignment="1" HAlignment="1"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="670" Y="2" ForegroundColor="0,0,0"
+ Text="[PageNo]" BorderColor="0,0,0" DateFormat="0"
+ FontFamily="Helvetica" DrawTop="false" FontWeight="25"
+ Height="30" Type="1" Width="20"
+ BackgroundColor="255,255,255" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ </PageFooter>
+
+ <ReportFooter PrintFrequency="2" Height="0">
+ </ReportFooter>
+
+</KugarTemplate>
diff --git a/kugar/samples/sample3.kdf b/kugar/samples/sample3.kdf
new file mode 100644
index 00000000..82a3b0ee
--- /dev/null
+++ b/kugar/samples/sample3.kdf
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarData [
+ <!ELEMENT KugarData (Row* )>
+ <!ATTLIST KugarData
+ Template CDATA #REQUIRED>
+
+ <!ELEMENT Row EMPTY>
+ <!ATTLIST Row
+ level CDATA #REQUIRED
+ title CDATA #REQUIRED
+ version CDATA #IMPLIED
+ platform CDATA #IMPLIED
+ copies CDATA #IMPLIED>
+]>
+
+<KugarData Template="sample3.ktf">
+ <Row level="1" title=" BRU" version="15.0" platform="x86" copies="1"/>
+ <Row level="1" title=" Caldera Open Linux" version="2.2" platform="x86" copies="3"/>
+ <Row level="1" title=" K Desktop" version="1.1.1" platform="x86" copies="1"/>
+ <Row level="1" title=" Netscape Communicator" version="4.6" platform="x86" copies="10"/>
+ <Row level="0" title="Redhat" />
+ <Row level="1" title=" Redhat Linux" version="5.0" platform="x86" copies="11"/>
+ <Row level="1" title=" Redhat Linux" version="5.1" platform="x86" copies="12"/>
+ <Row level="1" title=" Redhat Linux" version="5.2" platform="x86" copies="14"/>
+ <Row level="1" title=" Redhat Linux" version="6.0" platform="x86" copies="15"/>
+ <Row level="0" title="Sun" />
+ <Row level="1" title=" Star Office" version="5.0" platform="x86" copies="1"/>
+ <Row level="1" title=" Star Office" version="5.1" platform="x86" copies="3"/>
+ <Row level="1" title=" Sun Solaris" version="2.5" platform="Sparc" copies="1"/>
+ <Row level="0" title="Microsoft" />
+ <Row level="1" title=" Microsoft Windows NT" version="3.1" platform="x86" copies="1"/>
+ <Row level="1" title=" Microsoft Windows NT" version="3.51" platform="x86" copies="1"/>
+ <Row level="1" title=" Microsoft Windows NT" version="4.0" platform="x86" copies="1"/>
+ <Row level="1" title=" Microsoft Windows NT" version="5.0" platform="x86" copies="1"/>
+</KugarData>
diff --git a/kugar/samples/sample3.ktf b/kugar/samples/sample3.ktf
new file mode 100644
index 00000000..2b4fc6c6
--- /dev/null
+++ b/kugar/samples/sample3.ktf
@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE KugarTemplate SYSTEM "kugartemplate.dtd">
+
+<KugarTemplate PageOrientation="1" TopMargin="40" RightMargin="48" BottomMargin="40" LeftMargin="48" PageSize="2" PageWidth="1100" PageHeight="850">
+ <ReportHeader PrintFrequency="0" Height="70">
+ <Label VAlignment="1" HAlignment="0"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="0" Y="0" ForegroundColor="0,0,0"
+ Text="Mutiny Bay Software" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="31"
+ Width="255" BackgroundColor="255,255,255" FontItalic="1"
+ BorderWidth="0" DrawRight="false" DrawBottom="false"
+ FontSize="24" />
+ <Label VAlignment="1" HAlignment="0"
+ BorderStyle="1" WordWrap="0" DrawLeft="false"
+ X="0" Y="39" ForegroundColor="0,0,0"
+ Text=" Software Inventory Report" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="30"
+ Width="690" BackgroundColor="0,255,255" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="12" />
+ </ReportHeader>
+
+ <PageHeader PrintFrequency="1" Height="45">
+ <Label VAlignment="1" HAlignment="0"
+ BorderStyle="1" WordWrap="0" DrawLeft="false"
+ X="0" Y="15" ForegroundColor="255,255,255"
+ Text=" Title" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="31"
+ Width="505" BackgroundColor="128,128,128" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ <Label VAlignment="1" HAlignment="1"
+ BorderStyle="1" WordWrap="0" DrawLeft="false"
+ X="504" Y="15" ForegroundColor="0,0,0"
+ Text="Version" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="31"
+ Width="50" BackgroundColor="255,255,0" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ <Label VAlignment="1" HAlignment="1"
+ BorderStyle="1" WordWrap="0" DrawLeft="false"
+ X="553" Y="15" ForegroundColor="0,0,0"
+ Text="Platform" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="31"
+ Width="60" BackgroundColor="255,255,0" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ <Label VAlignment="1" HAlignment="1"
+ BorderStyle="1" WordWrap="0" DrawLeft="false"
+ X="612" Y="15" ForegroundColor="0,0,0"
+ Text="# of Copies" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="31"
+ Width="78" BackgroundColor="255,255,0" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ </PageHeader>
+
+ <Detail Level="0" Height="30" Repeat="false">
+ <Field VAlignment="1" HAlignment="1"
+ CommaSeparator="48" BorderStyle="1" WordWrap="0"
+ DrawLeft="false" Field="title" X="0"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="0" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="63" InputMask="" Precision="0"
+ Height="31" Width="690" BackgroundColor="55,155,255"
+ Currency="51" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="16" />
+ </Detail>
+
+ <Detail Level="1" Height="30" Repeat="false">
+ <Field VAlignment="1" HAlignment="0"
+ CommaSeparator="48" BorderStyle="1" WordWrap="0"
+ DrawLeft="false" Field="title" X="0"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="0" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="31" Width="505" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="1" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Field VAlignment="1" HAlignment="1"
+ CommaSeparator="48" BorderStyle="1" WordWrap="0"
+ DrawLeft="false" Field="version" X="504"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="0" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="31" Width="50" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Field VAlignment="1" HAlignment="1"
+ CommaSeparator="48" BorderStyle="1" WordWrap="0"
+ DrawLeft="false" Field="platform" X="553"
+ Y="0" ForegroundColor="255,0,0" NegValueColor="255,0,0"
+ Text="" DataType="0" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="31" Width="60" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Field VAlignment="1" HAlignment="1"
+ CommaSeparator="48" BorderStyle="1" WordWrap="0"
+ DrawLeft="false" Field="copies" X="612"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="1" BorderColor="0,0,0"
+ DateFormat="0" FontFamily="Helvetica" DrawTop="false"
+ FontWeight="25" InputMask="" Precision="0"
+ Height="31" Width="78" BackgroundColor="255,255,255"
+ Currency="51" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ </Detail>
+
+ <PageFooter PrintFrequency="1" Height="32">
+ <Label VAlignment="1" HAlignment="1"
+ BorderStyle="1" WordWrap="0" DrawLeft="false"
+ X="0" Y="0" ForegroundColor="0,0,0"
+ Text="" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" Height="1"
+ Width="690" BackgroundColor="255,255,255" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ <Label VAlignment="1" HAlignment="2"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="640" Y="2" ForegroundColor="0,0,0"
+ Text="Page:" BorderColor="0,0,0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="25" Height="30"
+ Width="30" BackgroundColor="255,255,255" FontItalic="0"
+ BorderWidth="1" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ <Special VAlignment="1" HAlignment="0"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="0" Y="2" ForegroundColor="0,0,0"
+ Text="[Date]" BorderColor="0,0,0" DateFormat="2"
+ FontFamily="Helvetica" DrawTop="false" FontWeight="25"
+ Height="30" Type="0" Width="90"
+ BackgroundColor="255,255,255" FontItalic="0" BorderWidth="0"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ <Special VAlignment="1" HAlignment="1"
+ BorderStyle="0" WordWrap="0" DrawLeft="false"
+ X="670" Y="2" ForegroundColor="0,0,0"
+ Text="[PageNo]" BorderColor="0,0,0" DateFormat="0"
+ FontFamily="Helvetica" DrawTop="false" FontWeight="25"
+ Height="30" Type="1" Width="20"
+ BackgroundColor="255,255,255" FontItalic="0" BorderWidth="1"
+ DrawRight="false" DrawBottom="false" FontSize="10" />
+ </PageFooter>
+
+ <ReportFooter PrintFrequency="2" Height="32">
+ <CalculatedField VAlignment="1" HAlignment="1"
+ CommaSeparator="48" BorderStyle="1" WordWrap="0"
+ DrawLeft="false" Field="copies" X="612"
+ Y="0" ForegroundColor="0,0,0" NegValueColor="255,0,0"
+ Text="" DataType="1" BorderColor="0,0,0"
+ CalculationType="1" DateFormat="0" FontFamily="Helvetica"
+ DrawTop="false" FontWeight="75" InputMask=""
+ Precision="0" Height="31" Width="78"
+ BackgroundColor="255,255,255" Currency="51" FontItalic="0"
+ BorderWidth="0" DrawRight="false" DrawBottom="false"
+ FontSize="10" />
+ </ReportFooter>
+
+</KugarTemplate>