3
$Id: EPSExport.cc,v 1.23 2001/05/21 13:12:48 neundorf Exp $
5
This file is part of KIllustrator.
6
Copyright (C) 1998 Kai-Uwe Sattler (kus@iti.cs.uni-magdeburg.de)
8
This program is free software; you can redistribute it and/or modify
9
it under the terms of the GNU Library General Public License as
11
the Free Software Foundation; either version 2 of the License, or
12
(at your option) any later version.
14
This program is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU General Public License for more details.
19
You should have received a copy of the GNU Library General Public License
20
along with this program; if not, write to the Free Software
21
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33
#include <koprinter.h>
36
#include "GDocument.h"
38
#include "EPSExport.h"
40
EPSExport::EPSExport () {
43
EPSExport::~EPSExport () {
46
bool EPSExport::setup (GDocument *, const char* ) {
50
bool EPSExport::exportToFile (GDocument* doc) {
51
// compute bounding box
52
Rect box = doc->activePage()->boundingBoxForAllObjects ();
55
printer.setDocName (doc->fileName ());
56
printer.setCreator ("KIllustrator");
57
printer.setOutputFileName (outputFileName ());
58
printer.setOutputToFile (true);
59
printer.setFullPage (true);
60
switch (doc->activePage()->pageLayout ().format) {
62
printer.setPageSize (KPrinter::A4);
65
printer.setPageSize (KPrinter::B5);
68
printer.setPageSize (KPrinter::Letter);
71
printer.setPageSize (KPrinter::Legal);
76
printer.setOrientation (doc->activePage()->pageLayout().orientation == PG_PORTRAIT ?
77
KPrinter::Portrait : KPrinter::Landscape);
80
paint.begin (&printer);
82
// define the bounding box as clipping region
83
paint.setClipRect (0, 0, static_cast<int>(box.width ()) + 2, static_cast<int>(box.height ()) + 2);
84
// and move the objects to the origin
85
paint.translate (-box.left () + 1, -box.top () + 1);
86
// force update of cliping regions (only for gradient pixmaps)
88
paint.setClipRect (box.left (), box.top (),
89
box.width () + 2 + box.left (),
90
box.height () + 2 + box.top ());
92
doc->activePage()->invalidateClipRegions ();
93
doc->activePage()->drawContents (paint,false,false,true);
94
doc->activePage()->invalidateClipRegions ();