Back to index

scribus-ng  1.3.4.dfsg+svn20071115
druck.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #include "druck.h"
00008 #include "druck.moc"
00009 
00010 #include "scconfig.h"
00011 
00012 #include "scpaths.h"
00013 #include "scribusdoc.h"
00014 #include "createrange.h"
00015 #include "commonstrings.h"
00016 #include "prefsmanager.h"
00017 #include "prefscontext.h"
00018 #include "prefsfile.h"
00019 #include "customfdialog.h"
00020 #include "cupsoptions.h"
00021 #include <qtextstream.h>
00022 #include <qstringlist.h>
00023 #include <qdir.h>
00024 #include <qfileinfo.h>
00025 #include <qmap.h>
00026 #if defined( HAVE_CUPS )
00027 #include <cups/cups.h>
00028 #elif defined(_WIN32)
00029 #include <windows.h>
00030 #include <winspool.h>
00031 #endif
00032 #include "printerutil.h"
00033 #include "util.h"
00034 #include "units.h"
00035 #include "usertaskstructs.h"
00036 
00037 extern bool previewDinUse;
00038 
00039 Druck::Druck( QWidget* parent, ScribusDoc* doc, QString PDatei, QString PDev, QString PCom, QByteArray& PSettings, bool gcr, QStringList spots)
00040               : QDialog( parent, "Dr", true, 0)
00041 {
00042        cdia = 0;
00043        m_doc = doc;
00044        unit = unitGetSuffixFromIndex(doc->unitIndex());
00045        precision = unitGetPrecisionFromIndex(doc->unitIndex());
00046        unitRatio = unitGetRatioFromIndex(doc->unitIndex());
00047        prefs = PrefsManager::instance()->prefsFile->getContext("print_options");
00048        DevMode = PSettings;
00049        ToSeparation = false;
00050        PrinterOpts = "";
00051        setCaption( tr( "Setup Printer" ) );
00052        setIcon(loadIcon("AppIcon.png"));
00053        DruckLayout = new QVBoxLayout( this );
00054        DruckLayout->setSpacing( 5 );
00055        DruckLayout->setMargin( 10 );
00056 
00057        Drucker = new QGroupBox( this, "Drucker" );
00058        Drucker->setTitle( tr( "Print Destination" ) );
00059        Drucker->setColumnLayout(0, Qt::Vertical );
00060        Drucker->layout()->setSpacing( 0 );
00061        Drucker->layout()->setMargin( 0 );
00062        DruckerLayout = new QGridLayout( Drucker->layout() );
00063        DruckerLayout->setAlignment( Qt::AlignTop );
00064        DruckerLayout->setSpacing( 5 );
00065        DruckerLayout->setMargin( 10 );
00066 
00067        Layout1x = new QHBoxLayout;
00068        Layout1x->setSpacing( 5 );
00069        Layout1x->setMargin( 0 );
00070        PrintDest = new QComboBox( true, Drucker, "PrintDest" );
00071        PrintDest->setMinimumSize( QSize( 250, 22 ) );
00072        PrintDest->setMaximumSize( QSize( 260, 30 ) );
00073        PrintDest->setEditable(false);
00074        QString Pcap;
00075        QString printerName;
00076        QStringList printerNames = PrinterUtil::getPrinterNames();
00077        int numPrinters = printerNames.count();
00078        for( int i = 0; i < numPrinters; i++)
00079        {
00080               printerName = printerNames[i];
00081               PrintDest->insertItem(printerName);
00082               if( printerName == PDev )
00083               {
00084                      PrintDest->setCurrentItem(PrintDest->count()-1);
00085                      prefs->set("CurrentPrn", PrintDest->currentText());
00086                      ToFile = false;
00087               }
00088        }
00089 
00090        PrintDest->insertItem( tr("File"));
00091        if (PDev.isEmpty())
00092        {
00093               Geraet = PrintDest->text(0);
00094               ToFile = false;
00095        }
00096        else
00097               Geraet = PDev;
00098 
00099        Layout1x->addWidget( PrintDest );
00100 
00101 #if defined(HAVE_CUPS) || defined(_WIN32)
00102        OptButton = new QPushButton( tr( "&Options..." ), Drucker, "Optionen" );
00103        Layout1x->addWidget( OptButton );
00104 #endif
00105        QSpacerItem* spacerDR = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00106        Layout1x->addItem( spacerDR );
00107        DruckerLayout->addLayout( Layout1x, 0, 0);
00108        Layout1 = new QHBoxLayout;
00109        Layout1->setSpacing( 5 );
00110        Layout1->setMargin( 0 );
00111        LineEdit1 = new QLineEdit( QDir::convertSeparators(PDatei), Drucker, "LineEdit1" );
00112        LineEdit1->setMinimumSize( QSize( 240, 22 ) );
00113        LineEdit1->setEnabled(false);
00114        DateiT = new QLabel( LineEdit1, tr( "&File:" ), Drucker, "DateiT" );
00115        DateiT->setEnabled( false );
00116        Layout1->addWidget( DateiT );
00117        Layout1->addWidget( LineEdit1 );
00118        ToolButton1 = new QToolButton( Drucker, "ToolButton1" );
00119        ToolButton1->setText( tr( "C&hange..." ) );
00120        ToolButton1->setMinimumSize( QSize( 80, 22 ) );
00121        ToolButton1->setEnabled(false);
00122        ToolButton1->setFocusPolicy( QToolButton::TabFocus );
00123        Layout1->addWidget( ToolButton1 );
00124        DruckerLayout->addLayout( Layout1, 1, 0 );
00125 
00126        OtherCom = new QCheckBox( tr("A&lternative Printer Command"), Drucker, "Dc");
00127        OtherCom->setChecked(false);
00128        DruckerLayout->addWidget( OtherCom, 2, 0, Qt::AlignLeft);
00129        LayoutCC = new QHBoxLayout;
00130        LayoutCC->setSpacing( 5 );
00131        LayoutCC->setMargin( 0 );
00132        Command = new QLineEdit( PCom, Drucker, "LineEdit12" );
00133        Command->setMinimumSize( QSize( 240, 22 ) );
00134        Command->setEnabled(false);
00135        OthText = new QLabel( Command, tr( "Co&mmand:" ), Drucker, "DateiTc" );
00136        OthText->setEnabled( false );
00137        LayoutCC->addWidget( OthText );
00138        LayoutCC->addWidget( Command );
00139        DruckerLayout->addLayout( LayoutCC, 3, 0 );
00140        DruckLayout->addWidget( Drucker );
00141 
00142        rangeGroup = new QButtonGroup( tr( "Range" ), this, "rangeGroup" );
00143        rangeGroup->setColumnLayout(0, Qt::Vertical );
00144        rangeGroup->layout()->setSpacing( 5 );
00145        rangeGroup->layout()->setMargin( 10 );
00146        rangeGroupLayout = new QGridLayout( rangeGroup->layout() );
00147        rangeGroupLayout->setAlignment( Qt::AlignTop );
00148        RadioButton1 = new QRadioButton( tr( "Print &All" ), rangeGroup, "RadioButton1" );
00149        rangeGroupLayout->addMultiCellWidget( RadioButton1, 0, 0, 0, 1 );
00150        CurrentPage = new QRadioButton( tr( "Print Current Pa&ge" ), rangeGroup, "CurrentPage" );
00151        rangeGroupLayout->addMultiCellWidget( CurrentPage, 1, 1, 0, 1 );
00152        RadioButton2 = new QRadioButton( tr( "Print &Range" ), rangeGroup, "RadioButton2" );
00153        rangeGroupLayout->addWidget( RadioButton2, 2, 0 );
00154        pageNumberSelectorLayout = new QHBoxLayout( 0, 0, 5, "pageNumberSelectorLayout" );
00155        pageNr = new QLineEdit( rangeGroup, "pageNr" );
00156        pageNumberSelectorLayout->addWidget( pageNr );
00157        pageNrButton = new QPushButton( QString::fromUtf8("…"), rangeGroup, "pageNrButton" );
00158        pageNrButton->setPixmap(loadIcon("ellipsis.png"));
00159        pageNumberSelectorLayout->addWidget( pageNrButton );
00160        rangeGroupLayout->addLayout( pageNumberSelectorLayout, 2, 1 );
00161        pageNr->setEnabled(false);
00162        pageNrButton->setEnabled(false);
00163        Copies = new QSpinBox( rangeGroup, "Copies" );
00164        Copies->setEnabled( true );
00165        Copies->setMinimumSize( QSize( 70, 22 ) );
00166        Copies->setMinValue( 1 );
00167        Copies->setMaxValue(1000);
00168        Copies->setValue(1);
00169        rangeGroupLayout->addWidget( Copies, 0, 3 );
00170        TextLabel3 = new QLabel( Copies, tr( "N&umber of Copies:" ), rangeGroup, "TextLabel3" );
00171        rangeGroupLayout->addWidget( TextLabel3, 0, 2 );
00172        DruckLayout->addWidget( rangeGroup );
00173 
00174        printOptions = new QTabWidget( this, "printOptions" );
00175        tab = new QWidget( printOptions, "tab" );
00176        tabLayout = new QGridLayout( tab, 1, 1, 10, 5, "tabLayout");
00177        PrintSep = new QComboBox( true, tab, "PrintSep" );
00178        PrintSep->setEditable(false);
00179        PrintSep->insertItem( tr( "Print Normal" ) );
00180        PrintSep->insertItem( tr( "Print Separations" ) );
00181        tabLayout->addWidget( PrintSep, 0, 0 );
00182        colorType = new QComboBox( true, tab, "colorType" );
00183        colorType->setEditable(false);
00184        colorType->insertItem( tr( "Print in Color if Available" ) );
00185        colorType->insertItem( tr( "Print in Grayscale" ) );
00186        colorType->setCurrentItem(0);
00187        tabLayout->addWidget( colorType, 0, 1 );
00188        SepArt = new QComboBox( true, tab, "SepArt" );
00189        QString sep[] =
00190            {
00191                tr("All"), tr("Cyan"), tr("Magenta"), tr("Yellow"),
00192                tr("Black")
00193            };
00194        size_t sepArray = sizeof(sep) / sizeof(*sep);
00195        for (uint prop = 0; prop < sepArray; ++prop)
00196               SepArt->insertItem(sep[prop]);
00197        SepArt->insertStringList(spots);
00198        SepArt->setEnabled( false );
00199        SepArt->setEditable( false );
00200        tabLayout->addWidget( SepArt, 1, 0 );
00201        psLevel = new QComboBox( true, tab, "psLevel" );
00202        psLevel->insertItem( tr( "PostScript Level 1" ) );
00203        psLevel->insertItem( tr( "PostScript Level 2" ) );
00204        psLevel->insertItem( tr( "PostScript Level 3" ) );
00205        psLevel->setEditable( false );
00206        tabLayout->addWidget( psLevel, 1, 1 );
00207        printOptions->insertTab( tab, tr( "Options" ) );
00208        tab_2 = new QWidget( printOptions, "tab_2" );
00209        tabLayout_2 = new QHBoxLayout( tab_2, 10, 5, "tabLayout_2");
00210        pageOpts = new QGroupBox( tab_2, "pageOpts" );
00211        pageOpts->setTitle( tr( "Page" ) );
00212        pageOpts->setColumnLayout(0, Qt::Vertical );
00213        pageOpts->layout()->setSpacing( 5 );
00214        pageOpts->layout()->setMargin( 10 );
00215        pageOptsLayout = new QVBoxLayout( pageOpts->layout() );
00216        pageOptsLayout->setAlignment( Qt::AlignTop );
00217        MirrorHor = new QCheckBox( pageOpts, "MirrorH" );
00218        MirrorHor->setText( tr( "Mirror Page(s) Horizontal" ) );
00219        pageOptsLayout->addWidget( MirrorHor );
00220        MirrorVert = new QCheckBox( pageOpts, "MirrorV" );
00221        MirrorVert->setText( tr( "Mirror Page(s) Vertical" ) );
00222        pageOptsLayout->addWidget( MirrorVert );
00223        devPar = new QCheckBox( pageOpts, "devPar" );
00224        devPar->setText( tr( "Set Media Size" ) );
00225        pageOptsLayout->addWidget( devPar );
00226        ClipMarg = new QCheckBox( tr( "Clip to Page Margins" ), pageOpts, "ClipMarg" );
00227        pageOptsLayout->addWidget( ClipMarg );
00228        tabLayout_2->addWidget( pageOpts );
00229        colorOpts = new QButtonGroup( tab_2, "colorOpts" );
00230        colorOpts->setTitle( tr( "Color" ) );
00231        colorOpts->setColumnLayout(0, Qt::Vertical );
00232        colorOpts->layout()->setSpacing( 5 );
00233        colorOpts->layout()->setMargin( 10 );
00234        colorOptsLayout = new QVBoxLayout( colorOpts->layout() );
00235        colorOptsLayout->setAlignment( Qt::AlignTop );
00236        GcR = new QCheckBox( colorOpts, "GcR" );
00237        GcR->setText( tr( "Apply Under Color Removal" ) );
00238        colorOptsLayout->addWidget( GcR );
00239        spotColors = new QCheckBox( colorOpts, "spotColors" );
00240        spotColors->setText( tr( "Convert Spot Colors to Process Colors" ) );
00241        colorOptsLayout->addWidget( spotColors );
00242        overprintMode = new QCheckBox( colorOpts, "overprintMode" );
00243        overprintMode->setText( tr( "Force Overprint Mode" ) );
00244        colorOptsLayout->addWidget( overprintMode );
00245        if (m_doc->HasCMS)
00246        {
00247               UseICC = new QCheckBox( colorOpts, "UseICC" );
00248               UseICC->setText( tr( "Apply ICC Profiles" ) );
00249               colorOptsLayout->addWidget( UseICC );
00250        }
00251        tabLayout_2->addWidget( colorOpts );
00252        printOptions->insertTab( tab_2, tr( "Advanced Options" ) );
00253 
00254        tab_3 = new QWidget( printOptions, "tab_3" );
00255        tabLayout_3 = new QGridLayout( tab_3, 1, 1, 10, 5, "tabLayout_3");
00256        MarkGroup = new QGroupBox( tab_3, "MarkGroup" );
00257        MarkGroup->setTitle( tr( "Printer Marks" ) );
00258        MarkGroup->setColumnLayout(0, Qt::Vertical );
00259        MarkGroup->layout()->setSpacing( 5 );
00260        MarkGroup->layout()->setMargin( 10 );
00261        MarkGroupLayout = new QGridLayout( MarkGroup->layout() );
00262        MarkGroupLayout->setAlignment( Qt::AlignTop );
00263        cropMarks = new QCheckBox( tr( "Crop Marks" ), MarkGroup, "cropMarks" );
00264        MarkGroupLayout->addWidget( cropMarks, 0, 0 );
00265        bleedMarks = new QCheckBox( tr( "Bleed Marks" ), MarkGroup, "bleedMarks" );
00266        MarkGroupLayout->addWidget( bleedMarks, 1, 0 );
00267        registrationMarks = new QCheckBox( tr( "Registration Marks" ), MarkGroup, "registrationMarks" );
00268        MarkGroupLayout->addWidget( registrationMarks, 2, 0 );
00269        colorMarks = new QCheckBox( tr( "Color Bars" ), MarkGroup, "colorMarks" );
00270        MarkGroupLayout->addMultiCellWidget( colorMarks, 0, 0, 1, 2 );
00271        MarkTxt1 = new QLabel( MarkGroup, "MarkTxt1" );
00272        MarkTxt1->setText( tr( "Offset:" ) );
00273        MarkGroupLayout->addWidget( MarkTxt1, 1, 1 );
00274        markOffset = new MSpinBox( MarkGroup, precision );
00275        MarkGroupLayout->addWidget( markOffset, 1, 2 );
00276        markOffset->setSuffix( unit );
00277        markOffset->setMinValue(0);
00278        markOffset->setMaxValue(3000 * unitRatio);
00279        tabLayout_3->addWidget( MarkGroup, 0, 0 );
00280        printOptions->insertTab( tab_3, tr( "Marks" ) );
00281 
00282        tab_4 = new QWidget( printOptions, "tab_4" );
00283        tabLayout_4 = new QGridLayout( tab_4, 1, 1, 10, 5, "tabLayout_4");
00284        BleedGroup = new QGroupBox( tab_4, "BleedGroup" );
00285        BleedGroup->setTitle( tr( "Bleed Settings" ) );
00286        BleedGroup->setColumnLayout(0, Qt::Vertical );
00287        BleedGroup->layout()->setSpacing( 5 );
00288        BleedGroup->layout()->setMargin( 10 );
00289        BleedGroupLayout = new QGridLayout( BleedGroup->layout() );
00290        BleedGroupLayout->setAlignment( Qt::AlignTop );
00291        BleedTxt1 = new QLabel( BleedGroup, "BleedTxt1" );
00292        BleedTxt1->setText( tr( "Top:" ) );
00293        BleedGroupLayout->addWidget( BleedTxt1, 0, 0 );
00294        BleedTop = new MSpinBox( BleedGroup, precision );
00295        BleedGroupLayout->addWidget( BleedTop, 0, 1 );
00296        BleedTxt2 = new QLabel( BleedGroup, "BleedTxt2" );
00297        BleedTxt2->setText( tr( "Bottom:" ) );
00298        BleedGroupLayout->addWidget( BleedTxt2, 1, 0 );
00299        BleedBottom = new MSpinBox( BleedGroup, precision );
00300        BleedGroupLayout->addWidget( BleedBottom, 1, 1 );
00301        BleedTxt3 = new QLabel( BleedGroup, "BleedTxt3" );
00302        BleedTxt3->setText( tr( "Left:" ) );
00303        BleedGroupLayout->addWidget( BleedTxt3, 0, 2 );
00304        BleedRight = new MSpinBox( BleedGroup, precision );
00305        BleedGroupLayout->addWidget( BleedRight, 0, 3 );
00306        BleedTxt4 = new QLabel( BleedGroup, "BleedTxt4" );
00307        BleedTxt4->setText( tr( "Right:" ) );
00308        BleedGroupLayout->addWidget( BleedTxt4, 1, 2 );
00309        BleedLeft = new MSpinBox( BleedGroup, precision );
00310        BleedGroupLayout->addWidget( BleedLeft, 1, 3 );
00311        docBleeds = new QCheckBox( tr( "Use Document Bleeds" ), BleedGroup, "docBleeds" );
00312        docBleeds->setChecked(false);
00313        BleedGroupLayout->addMultiCellWidget( docBleeds, 2, 2, 0, 3 );
00314        tabLayout_4->addWidget( BleedGroup, 0, 0 );
00315        printOptions->insertTab( tab_4, tr( "Bleeds" ) );
00316        BleedTop->setSuffix( unit );
00317        BleedTop->setMinValue(0);
00318        BleedTop->setMaxValue(3000*unitRatio);
00319        BleedBottom->setSuffix( unit );
00320        BleedBottom->setMinValue(0);
00321        BleedBottom->setMaxValue(3000*unitRatio);
00322        BleedRight->setSuffix( unit );
00323        BleedRight->setMinValue(0);
00324        BleedRight->setMaxValue(3000*unitRatio);
00325        BleedLeft->setSuffix( unit );
00326        BleedLeft->setMinValue(0);
00327        BleedLeft->setMaxValue(3000*unitRatio);
00328        if (m_doc->currentPageLayout != 0)
00329        {
00330               BleedTxt3->setText( tr( "Inside:" ) );
00331               BleedTxt4->setText( tr( "Outside:" ) );
00332        }
00333 
00334        DruckLayout->addWidget( printOptions );
00335 
00336        Layout2 = new QHBoxLayout;
00337        Layout2->setSpacing( 5 );
00338        Layout2->setMargin( 0 );
00339        QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00340        Layout2->addItem( spacer );
00341        
00342        previewButton = new QPushButton( tr( "Preview..." ), this, "previewButton" );
00343        previewButton->setDefault( false );
00344        previewButton->setEnabled(!previewDinUse);
00345        Layout2->addWidget( previewButton );
00346 
00347        OKButton = new QPushButton( tr( "&Print" ), this, "OKButton" );
00348        OKButton->setDefault( true );
00349        Layout2->addWidget( OKButton );
00350        OKButton_2 = new QPushButton( CommonStrings::tr_Cancel, this, "OKButton_2" );
00351        OKButton_2->setDefault( false );
00352        Layout2->addWidget( OKButton_2 );
00353 
00354        DruckLayout->addLayout( Layout2 );
00355        if ((PDev== tr("File")) || (PrintDest->count() == 1))
00356        {
00357               PrintDest->setCurrentItem(PrintDest->count()-1);
00358               prefs->set("CurrentPrn", PrintDest->currentText());
00359               DateiT->setEnabled(true);
00360               LineEdit1->setEnabled(true);
00361               ToolButton1->setEnabled(true);
00362               ToFile = true;
00363        }
00364 
00365        setMaximumSize(sizeHint());
00366        PrintDest->setFocus();
00367        QToolTip::add( BleedTop, "<qt>" + tr( "Distance for bleed from the top of the physical page" ) + "</qt>" );
00368        QToolTip::add( BleedBottom, "<qt>" + tr( "Distance for bleed from the bottom of the physical page" ) + "</qt>" );
00369        QToolTip::add( BleedLeft, "<qt>" + tr( "Distance for bleed from the left of the physical page" ) + "</qt>" );
00370        QToolTip::add( BleedRight, "<qt>" + tr( "Distance for bleed from the right of the physical page" )  + "</qt>");
00371        QToolTip::add( ClipMarg, "<qt>" + tr( "Do not show objects outside the margins on the printed page" ) + "</qt>" );
00372        QToolTip::add( pageNr, tr( "Insert a comma separated list of tokens where\n"
00373                                          "a token can be * for all the pages, 1-5 for\n"
00374                                          "a range of pages or a single page number.") );
00375        QToolTip::add( OtherCom,"<qt>" + tr( "Use an alternative print manager, such as kprinter or gtklp, to utilize additional printing options") + "</qt>" );
00376        QToolTip::add( psLevel,"<qt>" +  tr( "Sets the PostScript Level.\n Setting to Level 1 or 2 can create huge files" ) + "</qt>" );
00377        QToolTip::add( GcR, "<qt>" + tr( "A way of switching off some of the gray shades which are composed of cyan, yellow and magenta and using black instead. UCR most affects parts of images which are neutral and/or dark tones which are close to the gray. Use of this may improve printing some images and some experimentation and testing is need on a case by case basis.UCR reduces the possibility of over saturation with CMY inks." ) + "</qt>");
00378        QToolTip::add(spotColors,"<qt>" + tr( "Enables Spot Colors to be converted to composite colors. Unless you are planning to print spot colors at a commercial printer, this is probably best left enabled." ) + "</qt>");
00379        QToolTip::add(overprintMode, "<qt>"+ tr("Enables global Overprint Mode for this document, overrides object settings") + "<qt>");
00380        if (m_doc->HasCMS)
00381               QToolTip::add(UseICC,"<qt>" + tr( "Allows you to embed ICC profiles in the print stream when color management is enabled" ) + "</qt>");
00382        QToolTip::add(devPar, "<qt>" + tr( "This enables you to explicitely set the media size of the PostScript file. Not recommended unless requested by your printer." ) + "</qt>");
00383        QToolTip::add( cropMarks, "<qt>" + tr( "This creates crop marks in the PDF indicating where the paper should be cut or trimmed after printing." ) + "</qt>" );
00384        QToolTip::add( bleedMarks, "<qt>" + tr( "This creates bleed marks which are indicated by  _ . _ and show the bleed limit" ) + "</qt>" );
00385        QToolTip::add( registrationMarks, "<qt>" + tr( "Add registration marks which are added to each separation" ) + "</qt>" );
00386        QToolTip::add( colorMarks, "<qt>" + tr( "Add color calibration bars" ) + "</qt>" );
00387        QToolTip::add( markOffset, "<qt>" + tr( "Indicate the distance offset for the registration marks" ) + "</qt>" );
00388        QToolTip::add( BleedTop, "<qt>" + tr( "Distance for bleed from the top of the physical page" ) + "</qt>" );
00389        QToolTip::add( BleedBottom, "<qt>" + tr( "Distance for bleed from the bottom of the physical page" ) + "</qt>" );
00390        QToolTip::add( BleedLeft, "<qt>" + tr( "Distance for bleed from the left of the physical page" ) + "</qt>" );
00391        QToolTip::add( BleedRight, "<qt>" + tr( "Distance for bleed from the right of the physical page" )  + "</qt>");
00392        QToolTip::add( docBleeds, "<qt>" + tr( "Use the existing bleed settings from the document preferences" ) + "</qt>" );
00393        // signals and slots connections
00394        connect( OKButton, SIGNAL( clicked() ), this, SLOT( okButtonClicked() ) );
00395        connect( OKButton_2, SIGNAL( clicked() ), this, SLOT( reject() ) );
00396        connect( PrintDest, SIGNAL(activated(const QString&)), this, SLOT(SelPrinter(const QString&)));
00397        connect( RadioButton1, SIGNAL(toggled(bool)), this, SLOT(SelRange(bool)));
00398        connect( CurrentPage, SIGNAL(toggled(bool)), this, SLOT(SelRange(bool)));
00399        connect( pageNrButton, SIGNAL(clicked()), this, SLOT(createPageNumberRange()));
00400        connect( PrintSep, SIGNAL(activated(int)), this, SLOT(SelMode(int)));
00401        connect( ToolButton1, SIGNAL(clicked()), this, SLOT(SelFile()));
00402        connect( OtherCom, SIGNAL(clicked()), this, SLOT(SelComm()));
00403        connect( previewButton, SIGNAL(clicked()), this, SLOT(previewButtonClicked()));
00404        connect(docBleeds, SIGNAL(clicked()), this, SLOT(doDocBleeds()));
00405 #if defined(HAVE_CUPS) || defined(_WIN32)
00406        connect( OptButton, SIGNAL( clicked() ), this, SLOT( SetOptions() ) );
00407 #endif
00408 
00409        setStoredValues(gcr);
00410 #if defined(_WIN32)
00411        if (!ToFile)
00412               PrinterUtil::initDeviceSettings( PrintDest->currentText(), DevMode );
00413 #endif
00414        if ( PrinterUtil::isPostscriptPrinter(PrintDest->currentText()) || ToFile )
00415               psLevel->setEnabled( true );
00416        else
00417               psLevel->setEnabled( false );
00418 }
00419 
00420 Druck::~Druck()
00421 {
00422        delete cdia;
00423        cdia = 0;
00424 }
00425 
00426 void Druck::SetOptions()
00427 {
00428 #ifdef HAVE_CUPS
00429        PrinterOpts = "";
00430        if (!cdia)
00431               cdia = new CupsOptions(this, Geraet);
00432        if (!cdia->exec())
00433        {
00434               delete cdia; // if options was canceled delete dia 
00435               cdia = 0;    // so that getoptions() in the okButtonClicked() will get 
00436                            // the default values from the last succesful run
00437        }
00438 
00439 #elif defined(_WIN32)
00440        bool done;
00441        QString  printerS;
00442        QCString printerC;
00443        HANDLE handle = NULL;
00444        // Retrieve the selected printer
00445        printerS = PrintDest->currentText(); 
00446        printerC = printerS.local8Bit();
00447        // Get a printer handle
00448        done = OpenPrinter( printerC.data(), &handle, NULL );
00449        if(!done)
00450               return;
00451        // Merge stored settings, prompt user and return user settings
00452        DocumentProperties( winId(), handle, printerC.data(), (DEVMODE*) DevMode.data(), (DEVMODE*) DevMode.data(), 
00453                                           DM_IN_BUFFER | DM_IN_PROMPT | DM_OUT_BUFFER);
00454        // Free the printer handle
00455        ClosePrinter( handle );
00456 #endif
00457 }
00458 
00459 void Druck::getOptions()
00460 {
00461 #ifdef HAVE_CUPS
00462        PrinterOpts = "";
00463        if (!cdia)
00464               cdia = new CupsOptions(this, Geraet);
00465        struct CupsOptions::OpData daten;
00466        QMap<QString,CupsOptions::OpData>::Iterator it;
00467        for (it = cdia->KeyToText.begin(); it != cdia->KeyToText.end(); ++it)
00468        {
00469               if (cdia->KeyToDefault[it.key()] != cdia->FlagsOpt.at(it.data().Cnum)->currentText())
00470               {
00471                      if (it.data().KeyW == "mirror")
00472                             PrinterOpts += " -o mirror";
00473                      else
00474                      {
00475                             if (it.data().KeyW == "page-set")
00476                             {
00477                                    PrinterOpts += " -o "+it.data().KeyW+"=";
00478                                    if (cdia->FlagsOpt.at(it.data().Cnum)->currentItem() == 1)
00479                                           PrinterOpts += "even";
00480                                    else
00481                                           PrinterOpts += "odd";
00482                             }
00483                             else
00484                             {
00485                                    if (it.data().KeyW == "number-up")
00486                                    {
00487                                           PrinterOpts += " -o "+it.data().KeyW+"=";
00488                                           switch (cdia->FlagsOpt.at(it.data().Cnum)->currentItem())
00489                                           {
00490                                                  case 1:
00491                                                         PrinterOpts += "2";
00492                                                         break;
00493                                                  case 2:
00494                                                         PrinterOpts += "4";
00495                                                         break;
00496                                                  case 3:
00497                                                         PrinterOpts += "6";
00498                                                         break;
00499                                                  case 4:
00500                                                         PrinterOpts += "9";
00501                                                         break;
00502                                                  case 5:
00503                                                         PrinterOpts += "16";
00504                                                         break;
00505                                           }
00506                                    }
00507                                    else
00508                                    {
00509                                           if (it.data().KeyW == "orientation")
00510                                                  PrinterOpts += " -o landscape";
00511                                           else
00512                                                  PrinterOpts += " -o " +
00513                                                                it.data().KeyW+"="+cdia->FlagsOpt.at(it.data().Cnum)->currentText();
00514                                    }
00515                             }
00516                      }
00517               }
00518        }
00519 #endif
00520 }
00521 
00522 void Druck::SelComm()
00523 {
00524        /* PFJ - 29.02.04 - removed OthText, Command and PrintDest from switch */
00525        bool test = OtherCom->isChecked() ? true : false;
00526        OthText->setEnabled(test);
00527        Command->setEnabled(test);
00528        PrintDest->setEnabled(!test);
00529        if (OtherCom->isChecked())
00530        {
00531               DateiT->setEnabled(false);
00532               LineEdit1->setEnabled(false);
00533               ToolButton1->setEnabled(false);
00534               ToFile = false;
00535 #if defined(HAVE_CUPS) || defined(_WIN32)
00536               OptButton->setEnabled(false);
00537 #endif
00538 
00539        }
00540        else
00541        {
00542               SelPrinter(PrintDest->currentText());
00543 #if defined(HAVE_CUPS) || defined(_WIN32)
00544               if (Geraet != tr("File"))
00545                      OptButton->setEnabled(true);
00546 #endif
00547        }
00548 }
00549 
00550 void Druck::SelPrinter(const QString& prn)
00551 {
00552        bool setter = prn == tr("File") ? true : false;
00553        DateiT->setEnabled(setter);
00554        LineEdit1->setEnabled(setter);
00555        ToolButton1->setEnabled(setter);
00556        ToFile = setter;
00557        prefs->set("CurrentPrn", prn);
00558 #if defined(HAVE_CUPS) || defined(_WIN32)
00559        OptButton->setEnabled(!setter);
00560 #endif
00561 #if defined(_WIN32)
00562        if ( !ToFile )
00563               if( !PrinterUtil::getDefaultSettings(PrintDest->currentText(), DevMode) )
00564                      qWarning( tr("Failed to retrieve printer settings"));
00565 #endif
00566        if ( ToFile || PrinterUtil::isPostscriptPrinter(PrintDest->currentText()) )
00567        {
00568               psLevel->setEnabled( true );
00569               PrintSep->setEnabled( true );
00570               if (m_doc->HasCMS)
00571                      UseICC->setEnabled( true );
00572        }
00573        else
00574        {
00575               psLevel->setEnabled( false );
00576               PrintSep->setCurrentText( tr("Print Normal") );
00577               PrintSep->setEnabled( false );
00578               SepArt->setCurrentText( tr("All") );
00579               SepArt->setEnabled( false );
00580               ToSeparation = false;
00581               if (m_doc->HasCMS)
00582               {
00583                      UseICC->setEnabled( false );
00584                      UseICC->setChecked( false );
00585               }
00586        }
00587        Geraet = prn;
00588 }
00589 
00590 void Druck::SelRange(bool e)
00591 {
00592        pageNr->setEnabled(!e);
00593        pageNrButton->setEnabled(!e);
00594 }
00595 
00596 void Druck::SelMode(int e)
00597 {
00598        if (e == 0)
00599        {
00600               SepArt->setEnabled( false );
00601               ToSeparation = false;
00602        }
00603        else
00604        {
00605               SepArt->setEnabled( true );
00606               ToSeparation = true;
00607        }
00608 }
00609 
00610 void Druck::SelFile()
00611 {
00612        PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
00613        QString wdir = dirs->get("druck", ".");
00614        CustomFDialog dia(this, wdir, tr("Save as"), tr("PostScript Files (*.ps);;All Files (*)"), fdNone);
00615        if (!LineEdit1->text().isEmpty())
00616               dia.setSelection(LineEdit1->text());
00617        if (dia.exec() == QDialog::Accepted)
00618        {
00619               QString selectedFile = dia.selectedFile();
00620               dirs->set("druck", selectedFile.left(selectedFile.findRev("/")));
00621               LineEdit1->setText( QDir::convertSeparators(selectedFile) );
00622        }
00623 }
00624 
00625 void Druck::setMinMax(int min, int max, int cur)
00626 {
00627        QString tmp, tmp2;
00628        CurrentPage->setText( tr( "Print Current Pa&ge" )+" ("+tmp.setNum(cur)+")");
00629        pageNr->setText(tmp.setNum(min)+"-"+tmp2.setNum(max));
00630 }
00631 
00632 void Druck::storeValues()
00633 {
00634        getOptions(); // options were not set get last options with this hack
00635 
00636        m_doc->Print_Options.printer = PrintDest->currentText();
00637        m_doc->Print_Options.filename = ScPaths::separatorsToSlashes(LineEdit1->text());
00638        m_doc->Print_Options.toFile = ToFile;
00639        m_doc->Print_Options.copies = numCopies();
00640        m_doc->Print_Options.outputSeparations = outputSeparations();
00641        m_doc->Print_Options.separationName = separationName();
00642        m_doc->Print_Options.allSeparations = allSeparations();
00643        if (m_doc->Print_Options.outputSeparations)
00644               m_doc->Print_Options.useSpotColors = true;
00645        else
00646               m_doc->Print_Options.useSpotColors = doSpot();
00647        m_doc->Print_Options.useColor = color();
00648        m_doc->Print_Options.mirrorH = mirrorHorizontal();
00649        m_doc->Print_Options.mirrorV = mirrorVertical();
00650        m_doc->Print_Options.useICC = ICCinUse();
00651        m_doc->Print_Options.doClip = doClip();
00652        m_doc->Print_Options.doGCR = doGCR();
00653        m_doc->Print_Options.PSLevel = PSLevel();
00654        m_doc->Print_Options.setDevParam = doDev();
00655        m_doc->Print_Options.doOverprint = doOverprint();
00656        m_doc->Print_Options.bleeds.Top = BleedTop->value() / m_doc->unitRatio();
00657        m_doc->Print_Options.bleeds.Left = BleedLeft->value() / m_doc->unitRatio();
00658        m_doc->Print_Options.bleeds.Right = BleedRight->value() / m_doc->unitRatio();
00659        m_doc->Print_Options.bleeds.Bottom = BleedBottom->value() / m_doc->unitRatio();
00660        m_doc->Print_Options.markOffset = markOffset->value() / m_doc->unitRatio();
00661        m_doc->Print_Options.cropMarks = cropMarks->isChecked();
00662        m_doc->Print_Options.bleedMarks = bleedMarks->isChecked();
00663        m_doc->Print_Options.registrationMarks = registrationMarks->isChecked();
00664        m_doc->Print_Options.colorMarks = colorMarks->isChecked();
00665        if (OtherCom->isChecked())
00666        {
00667               m_doc->Print_Options.printerCommand = Command->text();
00668               m_doc->Print_Options.useAltPrintCommand = true;
00669        }
00670        else
00671               m_doc->Print_Options.useAltPrintCommand = false;
00672 #ifdef HAVE_CUPS
00673               m_doc->Print_Options.printerOptions = PrinterOpts;
00674 #else
00675               m_doc->Print_Options.printerOptions = QString("");
00676 #endif
00677 /*
00678        prefs->set("PrintDest", PrintDest->currentItem());
00679        prefs->set("CurrentPrn", PrintDest->currentText());
00680        prefs->set("OtherCom", OtherCom->isChecked());
00681        prefs->set("PrintAll", RadioButton1->isChecked());
00682        prefs->set("CurrentPage", CurrentPage->isChecked());
00683        prefs->set("PrintRange", RadioButton2->isChecked());
00684        prefs->set("PageNr", pageNr->text());
00685        prefs->set("Copies", Copies->value());
00686        prefs->set("Separations", PrintSep->currentItem());
00687        prefs->set("PrintColor", colorType->currentItem());
00688        prefs->set("SepArt", SepArt->currentItem());
00689        prefs->set("MirrorH", MirrorHor->isChecked());
00690        prefs->set("MirrorV", MirrorVert->isChecked());
00691        prefs->set("DoGCR", GcR->isChecked());
00692        prefs->set("Clip", ClipMarg->isChecked());
00693        prefs->set("PSLevel", psLevel->currentItem() + 1);
00694        prefs->set("doDev", devPar->isChecked());
00695        prefs->set("doSpot", !spotColors->isChecked());
00696        prefs->set("doOverprint", overprintMode->isChecked());
00697        if (m_doc->HasCMS)
00698               prefs->set("ICCinUse", UseICC->isChecked());
00699        prefs->set("BleedTop", BleedTop->value() / unitRatio);
00700        prefs->set("BleedBottom", BleedBottom->value() / unitRatio);
00701        prefs->set("BleedRight", BleedRight->value() / unitRatio);
00702        prefs->set("BleedLeft", BleedLeft->value() / unitRatio);
00703        prefs->set("markOffset", markOffset->value() / unitRatio);
00704        prefs->set("cropMarks", cropMarks->isChecked());
00705        prefs->set("bleedMarks", bleedMarks->isChecked());
00706        prefs->set("registrationMarks", registrationMarks->isChecked());
00707        prefs->set("colorMarks", colorMarks->isChecked()); */
00708 }
00709 
00710 void Druck::okButtonClicked()
00711 {
00712        storeValues();
00713        accept();
00714 }
00715 
00716 void Druck::previewButtonClicked()
00717 {
00718        storeValues();
00719        emit doPreview();
00720 }
00721 
00722 void Druck::setStoredValues(bool gcr)
00723 {
00724        if (m_doc->Print_Options.firstUse)
00725        {
00726               int selectedDest = prefs->getInt("PrintDest", 0);
00727               if ((selectedDest > -1) && (selectedDest < PrintDest->count()))
00728               {
00729                      PrintDest->setCurrentItem(selectedDest);
00730                      prefs->set("CurrentPrn", PrintDest->currentText());
00731                      if (PrintDest->currentText() == tr("File"))
00732                             SelPrinter( tr("File"));
00733                      Geraet = PrintDest->currentText();
00734               }
00735               OtherCom->setChecked(prefs->getBool("OtherCom", false));
00736               if (OtherCom->isChecked())
00737               {
00738                      SelComm();
00739                      Command->setText(prefs->get("Command", ""));
00740               }
00741               RadioButton1->setChecked(prefs->getBool("PrintAll", true));
00742               CurrentPage->setChecked(prefs->getBool("CurrentPage", false));
00743               bool printRangeChecked=prefs->getBool("PrintRange", false);
00744               RadioButton2->setChecked(printRangeChecked);
00745               pageNr->setEnabled(printRangeChecked);
00746               pageNr->setText(prefs->get("PageNr", "1-1"));
00747               Copies->setValue(prefs->getInt("Copies", 1));
00748               PrintSep->setCurrentItem(prefs->getInt("Separations", 0));
00749               colorType->setCurrentItem(prefs->getInt("PrintColor", 0));
00750               int selectedSep = prefs->getInt("SepArt", 0);
00751               if ((selectedSep > -1) && (selectedSep < 5))
00752                      SepArt->setCurrentItem(selectedSep);
00753               if (PrintSep->currentItem() == 1)
00754               {
00755                      SepArt->setEnabled(true);
00756                      ToSeparation = true;
00757               }
00758               psLevel->setCurrentItem(prefs->getInt("PSLevel", 3)-1);
00759               MirrorHor->setChecked(prefs->getBool("MirrorH", false));
00760               MirrorVert->setChecked(prefs->getBool("MirrorV", false));
00761               devPar->setChecked(prefs->getBool("doDev", false));
00762               GcR->setChecked(prefs->getBool("DoGCR", gcr));
00763               ClipMarg->setChecked(prefs->getBool("Clip", false));
00764               spotColors->setChecked(!prefs->getBool("doSpot", true));
00765               overprintMode->setChecked(prefs->getBool("doOverprint", false));
00766               if (m_doc->HasCMS)
00767               {
00768                      bool iccInUse = prefs->getBool("ICCinUse", false);
00769                      bool psPrinter = PrinterUtil::isPostscriptPrinter(PrintDest->currentText()) || ToFile;
00770                      UseICC->setChecked( psPrinter ? iccInUse : false );
00771                      UseICC->setEnabled( psPrinter );
00772               }
00773               BleedTop->setValue(prefs->getDouble("BleedTop",0.0)*unitRatio);
00774               BleedBottom->setValue(prefs->getDouble("BleedBottom",0.0)*unitRatio);
00775               BleedRight->setValue(prefs->getDouble("BleedRight",0.0)*unitRatio);
00776               BleedLeft->setValue(prefs->getDouble("BleedLeft",0.0)*unitRatio);
00777               markOffset->setValue(prefs->getDouble("markOffset",0.0)*unitRatio);
00778               cropMarks->setChecked(prefs->getBool("cropMarks", false));
00779               bleedMarks->setChecked(prefs->getBool("bleedMarks", false));
00780               registrationMarks->setChecked(prefs->getBool("registrationMarks", false));
00781               colorMarks->setChecked(prefs->getBool("colorMarks", false));
00782        }
00783        else
00784        {
00785               int selectedDest = prefs->getInt("PrintDest", 0);
00786               if ((selectedDest > -1) && (selectedDest < PrintDest->count()))
00787               {
00788                      PrintDest->setCurrentItem(selectedDest);
00789                      prefs->set("CurrentPrn", PrintDest->currentText());
00790                      if (PrintDest->currentText() == tr("File"))
00791                             SelPrinter( tr("File"));
00792                      Geraet = PrintDest->currentText();
00793               }
00794               OtherCom->setChecked(m_doc->Print_Options.useAltPrintCommand);
00795               if (OtherCom->isChecked())
00796               {
00797                      SelComm();
00798                      Command->setText(m_doc->Print_Options.printerCommand);
00799               }
00800               RadioButton1->setChecked(prefs->getBool("PrintAll", true));
00801               CurrentPage->setChecked(prefs->getBool("CurrentPage", false));
00802               bool printRangeChecked=prefs->getBool("PrintRange", false);
00803               RadioButton2->setChecked(printRangeChecked);
00804               pageNr->setEnabled(printRangeChecked);
00805               pageNr->setText(prefs->get("PageNr", "1-1"));
00806               Copies->setValue(1);
00807               PrintSep->setCurrentItem(m_doc->Print_Options.outputSeparations);
00808               colorType->setCurrentItem(m_doc->Print_Options.useColor? 0 : 1);
00809               ColorList usedSpots;
00810               m_doc->getUsedColors(usedSpots, true);
00811               QStringList spots = usedSpots.keys();
00812               spots.prepend( tr("Black"));
00813               spots.prepend( tr("Yellow"));
00814               spots.prepend( tr("Magenta"));
00815               spots.prepend( tr("Cyan"));
00816               spots.prepend( tr("All"));
00817               int selectedSep = spots.findIndex(m_doc->Print_Options.separationName);
00818               if ((selectedSep > -1) && (selectedSep < SepArt->count()))
00819                      SepArt->setCurrentItem(selectedSep);
00820               if (PrintSep->currentItem() == 1)
00821               {
00822                      SepArt->setEnabled(true);
00823                      ToSeparation = true;
00824               }
00825               psLevel->setCurrentItem(m_doc->Print_Options.PSLevel-1);
00826               MirrorHor->setChecked(m_doc->Print_Options.mirrorH);
00827               MirrorVert->setChecked(m_doc->Print_Options.mirrorV);
00828               devPar->setChecked(m_doc->Print_Options.setDevParam);
00829               GcR->setChecked(m_doc->Print_Options.doGCR);
00830               ClipMarg->setChecked(m_doc->Print_Options.doClip);
00831               spotColors->setChecked(!m_doc->Print_Options.useSpotColors);
00832               overprintMode->setChecked(m_doc->Print_Options.doOverprint);
00833               if (m_doc->HasCMS)
00834               {
00835                      bool iccInUse = m_doc->Print_Options.useICC;
00836                      bool psPrinter = PrinterUtil::isPostscriptPrinter(PrintDest->currentText()) || ToFile;
00837                      UseICC->setChecked( psPrinter ? iccInUse : false );
00838                      UseICC->setEnabled( psPrinter );
00839               }
00840               BleedTop->setValue(m_doc->Print_Options.bleeds.Top*unitRatio);
00841               BleedBottom->setValue(m_doc->Print_Options.bleeds.Bottom*unitRatio);
00842               BleedRight->setValue(m_doc->Print_Options.bleeds.Right*unitRatio);
00843               BleedLeft->setValue(m_doc->Print_Options.bleeds.Left*unitRatio);
00844               markOffset->setValue(m_doc->Print_Options.markOffset*unitRatio);
00845               cropMarks->setChecked(m_doc->Print_Options.cropMarks);
00846               bleedMarks->setChecked(m_doc->Print_Options.bleedMarks);
00847               registrationMarks->setChecked(m_doc->Print_Options.registrationMarks);
00848               colorMarks->setChecked(m_doc->Print_Options.colorMarks);
00849        }
00850 }
00851 
00852 QString Druck::printerName()
00853 {
00854        return Geraet;
00855 }
00856 
00857 QString Druck::outputFileName()
00858 {
00859        return ScPaths::separatorsToSlashes(LineEdit1->text());
00860 }
00861 
00862 bool Druck::outputToFile()
00863 {
00864        return ToFile;
00865 }
00866 
00867 int Druck::numCopies()
00868 {
00869        return Copies->value();
00870 }
00871 
00872 bool Druck::outputSeparations()
00873 {
00874        return ToSeparation;
00875 }
00876 
00877 QString Druck::separationName()
00878 {
00879        return SepArt->currentText();
00880 }
00881 
00882 QStringList Druck::allSeparations()
00883 {
00884        QStringList ret;
00885        for (int a = 1; a < SepArt->count(); ++a)
00886        {
00887               ret.append(SepArt->text(a));
00888        }
00889        return ret;
00890 }
00891 
00892 bool Druck::color()
00893 {
00894        if (colorType->currentItem() == 0)
00895               return true;
00896        else
00897               return false;
00898 }
00899 
00900 bool Druck::mirrorHorizontal()
00901 {
00902        return MirrorHor->isChecked();
00903 }
00904 
00905 bool Druck::mirrorVertical()
00906 {
00907        return MirrorVert->isChecked();
00908 }
00909 
00910 bool Druck::doGCR()
00911 {
00912        return GcR->isChecked();
00913 }
00914 
00915 bool Druck::doClip()
00916 {
00917        return ClipMarg->isChecked();
00918 }
00919 
00920 int Druck::PSLevel()
00921 {
00922        return psLevel->currentItem() + 1;
00923 }
00924 
00925 bool Druck::doDev()
00926 {
00927        return devPar->isChecked();
00928 }
00929 
00930 bool Druck::doSpot()
00931 {
00932        return !spotColors->isChecked();
00933 }
00934 
00935 bool Druck::doOverprint()
00936 {
00937        return overprintMode->isChecked();
00938 }
00939 
00940 bool Druck::ICCinUse()
00941 {
00942        if (m_doc->HasCMS)
00943               return UseICC->isChecked();
00944        else
00945               return false;
00946 }
00947 
00948 void Druck::doDocBleeds()
00949 {
00950        if (docBleeds->isChecked())
00951        {
00952               prefs->set("BleedTop", BleedTop->value() / unitRatio);
00953               prefs->set("BleedBottom", BleedBottom->value() / unitRatio);
00954               prefs->set("BleedRight", BleedRight->value() / unitRatio);
00955               prefs->set("BleedLeft", BleedLeft->value() / unitRatio);
00956               BleedTop->setValue(m_doc->bleeds.Top*unitRatio);
00957               BleedBottom->setValue(m_doc->bleeds.Bottom*unitRatio);
00958               BleedRight->setValue(m_doc->bleeds.Right*unitRatio);
00959               BleedLeft->setValue(m_doc->bleeds.Left*unitRatio);
00960               BleedTop->setEnabled(false);
00961               BleedBottom->setEnabled(false);
00962               BleedRight->setEnabled(false);
00963               BleedLeft->setEnabled(false);
00964        }
00965        else
00966        {
00967               BleedTop->setValue(prefs->getDouble("BleedTop",0.0)*unitRatio);
00968               BleedBottom->setValue(prefs->getDouble("BleedBottom",0.0)*unitRatio);
00969               BleedRight->setValue(prefs->getDouble("BleedRight",0.0)*unitRatio);
00970               BleedLeft->setValue(prefs->getDouble("BleedLeft",0.0)*unitRatio);
00971               BleedTop->setEnabled(true);
00972               BleedBottom->setEnabled(true);
00973               BleedRight->setEnabled(true);
00974               BleedLeft->setEnabled(true);
00975        }
00976 }
00977 
00978 void Druck::createPageNumberRange( )
00979 {
00980        if (m_doc!=0)
00981        {
00982               CreateRange cr(pageNr->text(), m_doc->DocPages.count(), this);
00983               if (cr.exec())
00984               {
00985                      CreateRangeData crData;
00986                      cr.getCreateRangeData(crData);
00987                      pageNr->setText(crData.pageRange);
00988                      return;
00989               }
00990        }
00991        pageNr->setText(QString::null);
00992 }