Back to index

scribus-ng  1.3.4.dfsg+svn20071115
reformdoc.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 "reformdoc.h"
00008 #include "reformdoc.moc"
00009 
00010 #include <qcolordialog.h>
00011 #include <qcursor.h>
00012 #include <qspinbox.h>
00013 #include <qtooltip.h>
00014 
00015 #include "docsections.h"
00016 #include "tabtypography.h"
00017 #include "docinfo.h"
00018 #include "tabguides.h"
00019 #include "tabtools.h"
00020 #include "tabcheckdoc.h"
00021 #include "hysettings.h"
00022 #include "cmsprefs.h"
00023 #include "units.h"
00024 #include "mpalette.h"
00025 #include "mspinbox.h"
00026 #include "scribus.h"
00027 #include "scribuscore.h"
00028 #include "tabpdfoptions.h"
00029 #include "fontprefs.h"
00030 #include "units.h"
00031 #include "pagesize.h"
00032 #include "docitemattrprefs.h"
00033 #include "tocindexprefs.h"
00034 #include "marginWidget.h"
00035 #include "page.h"
00036 #include "prefsmanager.h"
00037 #include "pagelayout.h"
00038 #include "colorcombo.h"
00039 #include "fontcombo.h"
00040 #include "linecombo.h"
00041 #include "arrowchooser.h"
00042 #include "polygonwidget.h"
00043 #include "hyphenator.h"
00044 #include "sccombobox.h"
00045 #include "commonstrings.h"
00046 #include "tabdisplay.h"
00047 #include "tabdocument.h"
00048 
00049 extern QPixmap loadIcon(QString nam);
00050 
00051 
00052 ReformDoc::ReformDoc( QWidget* parent, ScribusDoc* doc ) : PrefsDialogBase( parent )
00053 {
00054        saveButton->hide();
00055        docUnitIndex = doc->unitIndex();
00056        currDoc = doc;
00057        ScMW = (ScribusMainWindow*)parent;
00058        unitRatio = doc->unitRatio();
00059        QString ein = unitGetSuffixFromIndex(docUnitIndex);
00060        decimals = unitGetDecimalsFromIndex(docUnitIndex);
00061 
00062        setCaption( tr( "Document Setup" ) );
00063        tabPage = new TabDocument( prefsWidgets, "tab", true );
00064        tabPage->hideReform();
00065        addItem( tr("Document"), loadIcon("scribusdoc.png"), tabPage);
00066 
00067        docInfos = new DocInfos(prefsWidgets, doc->documentInfo);
00068        addItem( tr("Document Information"), loadIcon("documentinfo32.png"), docInfos);
00069 
00070        tabGuides = new TabGuides(prefsWidgets, &doc->guidesSettings, &doc->typographicSettings, docUnitIndex);
00071        addItem( tr("Guides"), loadIcon("guides.png"), tabGuides);
00072 
00073        tabView = new TabDisplay( prefsWidgets, "tabView" );
00074        tabView->setDocSetupMode();
00075        addItem( tr("Display"), loadIcon("screen.png"), tabView);
00076 
00077        tabTypo = new TabTypograpy(  prefsWidgets, &doc->typographicSettings);
00078        addItem( tr("Typography"), loadIcon("typography.png"), tabTypo);
00079 
00080        tabTools = new TabTools(  prefsWidgets, &doc->toolSettings, docUnitIndex, doc);
00081        addItem( tr("Tools"), loadIcon("tools.png"), tabTools);
00082 
00083        tabHyphenator = new HySettings(prefsWidgets, &ScMW->LangTransl);
00084        addItem( tr("Hyphenator"), loadIcon("hyphenate.png"), tabHyphenator);
00085 
00086        tabFonts = new FontPrefs(prefsWidgets, true, PrefsManager::instance()->preferencesLocation(), doc);
00087        addItem( tr("Fonts"), loadIcon("font.png"), tabFonts);
00088 
00089        tabDocChecker = new TabCheckDoc(  prefsWidgets, doc->checkerProfiles, doc->curCheckProfile);
00090        addItem( tr("Preflight Verifier"), loadIcon("checkdoc.png"), tabDocChecker);
00091 
00092        tabPDF = new TabPDFOptions( prefsWidgets, doc->PDF_Options, PrefsManager::instance()->appPrefs.AvailFonts,
00093                                                         ScCore->PDFXProfiles, doc->UsedFonts, doc->PDF_Options.PresentVals,
00094                                                         docUnitIndex, doc->pageHeight, doc->pageWidth, doc );
00095        addItem( tr("PDF Export"), loadIcon("acroread32.png"), tabPDF);
00096 
00097        tabDocItemAttributes = new DocumentItemAttributes( prefsWidgets);
00098        docAttributesList=tabDocItemAttributes->getDocAttributesNames();
00099        tabDocItemAttributes->setup(&doc->docItemAttributes);
00100        addItem( tr("Document Item Attributes"), loadIcon("docattributes.png"), tabDocItemAttributes);
00101 
00102        tabTOCIndexPrefs = new TOCIndexPrefs( prefsWidgets );
00103        tabTOCIndexPrefs->setupItemAttrs( docAttributesList );
00104        tabTOCIndexPrefs->setup(&(currDoc->docToCSetups), currDoc);
00105        addItem( tr("Table of Contents and Indexes"), loadIcon("tabtocindex.png"), tabTOCIndexPrefs);
00106 
00107        tabDocSections = new DocSections(prefsWidgets);
00108        tabDocSections->setup(currDoc->sections, currDoc->DocPages.count()-1);
00109        addItem( tr("Sections"), loadIcon("tabtocindex.png"), tabDocSections);
00110 
00111        int cmsTab = 0;
00112        if (ScCore->haveCMS())
00113        {
00114               tabColorManagement = new CMSPrefs(prefsWidgets, &doc->CMSSettings, &ScCore->InputProfiles, &ScCore->InputProfilesCMYK, &ScCore->PrinterProfiles, &ScCore->MonitorProfiles);
00115               cmsTab = addItem( tr("Color Management"), loadIcon("blend.png"), tabColorManagement);
00116        }
00117 
00118        setDS(doc->currentPageLayout);
00119 
00120        // signals and slots connections
00121        connect(tabPage->docLayout, SIGNAL( selectedLayout(int) ), this, SLOT( setDS(int) ) );
00122        connect(tabPage->unitCombo, SIGNAL(activated(int)), this, SLOT(unitChange()));
00123        connect(backToDefaults, SIGNAL(clicked()), this, SLOT(restoreDefaults()));
00124        connect(applyChangesButton, SIGNAL(clicked()), this, SLOT(applyChangesButton_clicked()));
00125        connect(prefsWidgets, SIGNAL(aboutToShow(QWidget *)), this, SLOT(showWidgetInStack(QWidget *)));
00126 
00127        if (ScCore->haveCMS())
00128        {
00129               prefsWidgets->raiseWidget(cmsTab);
00130               connect(tabColorManagement, SIGNAL(cmsOn(bool )), this, SLOT(switchCMS(bool )));
00131        }
00132 
00133        arrangeIcons();
00134        resize( minimumSizeHint() );
00135        clearWState( WState_Polished );
00136        prefsSelection->setSelected(prefsSelection->firstItem(), true);
00137        itemSelected(prefsSelection->firstItem());
00138        restoreDefaults();
00139 }
00140 
00141 void ReformDoc::restoreDefaults()
00142 {
00143        ApplicationPrefs* prefsData=&(PrefsManager::instance()->appPrefs);
00144        tabPage->restoreDefaults(currDoc);
00145        tabView->restoreDefaults(prefsData, currDoc->guidesSettings, currDoc->pageSets, currDoc->currentPageLayout, currDoc->scratch);
00146        tabView->setPaperColor(currDoc->papColor);
00147        tabHyphenator->restoreDefaults(currDoc);
00148        tabGuides->restoreDefaults(&currDoc->guidesSettings, &currDoc->typographicSettings, docUnitIndex);
00149        tabTypo->restoreDefaults(&currDoc->typographicSettings);
00150        tabTools->restoreDefaults(&currDoc->toolSettings, docUnitIndex);
00151        tabFonts->restoreDefaults();
00152        tabDocChecker->restoreDefaults(&currDoc->checkerProfiles, currDoc->curCheckProfile);
00153        tabPDF->restoreDefaults(currDoc->PDF_Options, PrefsManager::instance()->appPrefs.AvailFonts,
00154                                                  ScCore->PDFXProfiles, currDoc->UsedFonts, currDoc->PDF_Options.PresentVals,
00155                                                  docUnitIndex, currDoc->pageHeight, currDoc->pageWidth, currDoc, false);
00156        if (ScCore->haveCMS())
00157               tabColorManagement->restoreDefaults(&currDoc->CMSSettings, &ScCore->InputProfiles,
00158                                                                              &ScCore->InputProfilesCMYK,
00159                                                                              &ScCore->PrinterProfiles, &ScCore->MonitorProfiles);
00160        docInfos->restoreDefaults();
00161 
00162        unitChange();
00163 }
00164 
00165 void ReformDoc::unitChange()
00166 {
00167        double oldUnitRatio = unitRatio;
00168        docUnitIndex = tabPage->unitCombo->currentItem();
00169        unitRatio = unitGetRatioFromIndex(docUnitIndex);
00170        int decimals = unitGetDecimalsFromIndex(docUnitIndex);
00171        QString suffix = unitGetSuffixFromIndex(docUnitIndex);
00172        double invUnitConversion = 1.0 / oldUnitRatio * unitRatio;
00173        tabPage->unitChange();
00174        tabGuides->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
00175        tabView->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
00176        tabTools->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
00177        tabPDF->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
00178 }
00179 
00180 void ReformDoc::setDS(int layout)
00181 {
00182        tabPage->marginGroup->setFacingPages(!(layout == singlePage));
00183        tabPage->choosenLayout = layout;
00184        tabPage->docLayout->firstPage->setCurrentItem(currDoc->pageSets[tabPage->choosenLayout].FirstPage);
00185        tabView->gapHorizontal->setValue(currDoc->pageSets[tabPage->choosenLayout].GapHorizontal * unitRatio);
00186        tabView->gapVertical->setValue(currDoc->pageSets[tabPage->choosenLayout].GapBelow * unitRatio);
00187 }
00188 
00189 void ReformDoc::switchCMS(bool enable)
00190 {
00191        tabPDF->enableCMS(enable);
00192 }
00193 
00194 void ReformDoc::showWidgetInStack(QWidget *widgetToShow)
00195 {
00196        //Update the attributes list in TOC setup
00197        if (widgetToShow==tabTOCIndexPrefs)
00198               tabTOCIndexPrefs->setupItemAttrs( tabDocItemAttributes->getDocAttributesNames() );
00199        if (widgetToShow == tabTools)
00200               tabTools->enableFontPreview(true);
00201 }
00202 
00203 const int ReformDoc::getSelectedUnit()
00204 {
00205        return tabPage->unitCombo->currentItem();
00206 }
00207 
00208 const bool ReformDoc::colorManagementSettingsChanged()
00209 {
00210        return ScCore->haveCMS() && tabColorManagement->changed;
00211 }
00212 
00213 const bool ReformDoc::imageResolutionChanged()
00214 {
00215        return viewToRecalcPictureRes;
00216 }
00217 
00218 void ReformDoc::updateDocumentSettings()
00219 {
00220        double tpr2, lr2, rr2, br2;
00221        tpr2 = tabPage->marginGroup->top();
00222        br2 = tabPage->marginGroup->bottom();
00223        lr2 = tabPage->marginGroup->left();
00224        rr2 = tabPage->marginGroup->right();
00225        int fp = tabPage->choosenLayout;
00226        currDoc->pageSets[fp].FirstPage = tabPage->docLayout->firstPage->currentItem();
00227        currDoc->pageSets[fp].GapHorizontal = tabView->gapHorizontal->value() / currDoc->unitRatio();
00228        currDoc->pageSets[fp].GapBelow = tabView->gapVertical->value() / currDoc->unitRatio();
00229        //currDoc->FirstPnum = pageNumber->value();
00230        currDoc->resetPage(tpr2, lr2, rr2, br2, fp);
00231        currDoc->PageOri = tabPage->pageOrientationComboBox->currentItem();
00232        currDoc->m_pageSize = tabPage->prefsPageSizeName;
00233        currDoc->pageWidth = tabPage->pageW;
00234        currDoc->pageHeight = tabPage->pageH;
00235        double TopD = tabView->topScratch->value() / currDoc->unitRatio() - currDoc->scratch.Top;
00236        double LeftD = tabView->leftScratch->value() / currDoc->unitRatio() - currDoc->scratch.Left;
00237        currDoc->scratch.Bottom = tabView->bottomScratch->value() / currDoc->unitRatio();
00238        currDoc->scratch.Left = tabView->leftScratch->value() / currDoc->unitRatio();
00239        currDoc->scratch.Right = tabView->rightScratch->value() / currDoc->unitRatio();
00240        currDoc->scratch.Top = tabView->topScratch->value() / currDoc->unitRatio();
00241        currDoc->bleeds.Bottom = tabPage->marginGroup->bottomBleed();
00242        currDoc->bleeds.Top = tabPage->marginGroup->topBleed();
00243        currDoc->bleeds.Left = tabPage->marginGroup->leftBleed();
00244        currDoc->bleeds.Right = tabPage->marginGroup->rightBleed();
00245        for (uint p = 0; p < currDoc->Pages->count(); ++p)
00246        {
00247               Page *pp = currDoc->Pages->at(p);
00248               if (tabPage->sizeAllPages->isChecked())
00249               {
00250                      pp->setInitialWidth(currDoc->pageWidth);
00251                      pp->setInitialHeight(currDoc->pageHeight);
00252                      pp->setHeight(currDoc->pageHeight);
00253                      pp->setWidth(currDoc->pageWidth);
00254                      pp->m_pageSize = currDoc->m_pageSize;
00255                      pp->PageOri = currDoc->PageOri;
00256               }
00257               if (tabPage->marginGroup->getMarginsForAllPages())
00258               {
00259                      pp->initialMargins.Left = lr2;
00260                      pp->initialMargins.Right = rr2;
00261                      pp->initialMargins.Top = tpr2;
00262                      pp->initialMargins.Bottom = br2;
00263               }
00264        }
00265        for (uint p = 0; p < currDoc->MasterPages.count(); ++p)
00266        {
00267               Page *pp = currDoc->MasterPages.at(p);
00268               if (tabPage->sizeAllMasterPages->isChecked())
00269               {
00270                      pp->setInitialWidth(currDoc->pageWidth);
00271                      pp->setInitialHeight(currDoc->pageHeight);
00272                      pp->setHeight(currDoc->pageHeight);
00273                      pp->setWidth(currDoc->pageWidth);
00274                      pp->m_pageSize = currDoc->m_pageSize;
00275                      pp->PageOri = currDoc->PageOri;
00276               }
00277               if (tabPage->marginGroup->getMarginsForAllMasterPages())
00278               {
00279                      pp->initialMargins.Left = lr2;
00280                      pp->initialMargins.Right = rr2;
00281                      pp->initialMargins.Top = tpr2;
00282                      pp->initialMargins.Bottom = br2;
00283               }
00284               pp->setXOffset(currDoc->scratch.Left);
00285               pp->setYOffset(currDoc->scratch.Top);
00286        }
00287        uint docItemsCount = currDoc->MasterItems.count();
00288        for (uint ite = 0; ite < docItemsCount; ++ite)
00289        {
00290               PageItem *item = currDoc->MasterItems.at(ite);
00291               item->moveBy(LeftD, TopD);
00292               item->setRedrawBounding();
00293        }
00294        currDoc->guidesSettings.before = tabGuides->inBackground->isChecked();
00295        currDoc->marginColored = tabView->checkUnprintable->isChecked();
00296        currDoc->papColor = tabView->colorPaper;
00297        currDoc->guidesSettings.marginsShown = tabGuides->marginBox->isChecked();
00298        currDoc->guidesSettings.showBleed = tabView->checkBleed->isChecked();
00299        currDoc->guidesSettings.framesShown = tabView->checkFrame->isChecked();
00300        currDoc->guidesSettings.layerMarkersShown = tabView->checkLayerM->isChecked();
00301        currDoc->guidesSettings.gridShown = tabGuides->checkGrid->isChecked();
00302        currDoc->guidesSettings.guidesShown = tabGuides->guideBox->isChecked();
00303        currDoc->guidesSettings.baseShown = tabGuides->baselineBox->isChecked();
00304        currDoc->guidesSettings.showPic = tabView->checkPictures->isChecked();
00305        currDoc->guidesSettings.linkShown = tabView->checkLink->isChecked();
00306        currDoc->guidesSettings.showControls = tabView->checkControl->isChecked();
00307        currDoc->guidesSettings.rulerMode = tabView->checkRuler->isChecked();
00308        currDoc->guidesSettings.grabRad = tabGuides->grabDistance->value();
00309        currDoc->guidesSettings.guideRad = tabGuides->snapDistance->value();
00310        currDoc->guidesSettings.minorGrid = tabGuides->minorSpace->value() / currDoc->unitRatio();
00311        currDoc->guidesSettings.majorGrid = tabGuides->majorSpace->value() / currDoc->unitRatio();
00312        currDoc->guidesSettings.minorColor = tabGuides->colorMinorGrid;
00313        currDoc->guidesSettings.majorColor = tabGuides->colorMajorGrid;
00314        currDoc->guidesSettings.margColor = tabGuides->colorMargin;
00315        currDoc->guidesSettings.guideColor = tabGuides->colorGuides;
00316        currDoc->guidesSettings.baseColor = tabGuides->colorBaselineGrid;
00317        currDoc->checkerProfiles = tabDocChecker->checkerProfile;
00318        currDoc->curCheckProfile = tabDocChecker->curCheckProfile->currentText();
00319        currDoc->typographicSettings.valueSuperScript = tabTypo->superDisplacement->value();
00320        currDoc->typographicSettings.scalingSuperScript = tabTypo->superScaling->value();
00321        currDoc->typographicSettings.valueSubScript = tabTypo->subDisplacement->value();
00322        currDoc->typographicSettings.scalingSubScript = tabTypo->subScaling->value();
00323        currDoc->typographicSettings.valueSmallCaps = tabTypo->capsScaling->value();
00324        currDoc->typographicSettings.autoLineSpacing = tabTypo->autoLine->value();
00325        currDoc->typographicSettings.valueBaseGrid = tabGuides->baseGrid->value() / currDoc->unitRatio();
00326        currDoc->typographicSettings.offsetBaseGrid = tabGuides->baseOffset->value() / currDoc->unitRatio();
00327        currDoc->typographicSettings.valueUnderlinePos = qRound(tabTypo->underlinePos->value() * 10);
00328        currDoc->typographicSettings.valueUnderlineWidth = qRound(tabTypo->underlineWidth->value() * 10);
00329        currDoc->typographicSettings.valueStrikeThruPos = qRound(tabTypo->strikethruPos->value() * 10);
00330        currDoc->typographicSettings.valueStrikeThruWidth = qRound(tabTypo->strikethruWidth->value() * 10);
00331        currDoc->toolSettings.defFont = tabTools->fontComboText->currentText();
00332        currDoc->toolSettings.defSize = tabTools->sizeComboText->currentText().left(2).toInt() * 10;
00333        currDoc->toolSettings.dStrokeText = tabTools->colorComboStrokeText->currentText();
00334        switch (tabTools->tabFillCombo->currentItem())
00335        {
00336               case 0:
00337                      currDoc->toolSettings.tabFillChar = "";
00338                      break;
00339               case 1:
00340                      currDoc->toolSettings.tabFillChar = ".";
00341                      break;
00342               case 2:
00343                      currDoc->toolSettings.tabFillChar = "-";
00344                      break;
00345               case 3:
00346                      currDoc->toolSettings.tabFillChar = "_";
00347                      break;
00348               case 4:
00349                      currDoc->toolSettings.tabFillChar = tabTools->tabFillCombo->currentText().right(1);
00350                      break;
00351        }
00352        if (currDoc->toolSettings.dStrokeText == CommonStrings::tr_NoneColor)
00353               currDoc->toolSettings.dStrokeText = CommonStrings::None;
00354        currDoc->toolSettings.dPenText = tabTools->colorComboText->currentText();
00355        if (currDoc->toolSettings.dPenText == CommonStrings::tr_NoneColor)
00356               currDoc->toolSettings.dPenText = CommonStrings::None;
00357        currDoc->toolSettings.dTextBackGround = tabTools->colorComboTextBackground->currentText();
00358        if (currDoc->toolSettings.dTextBackGround == CommonStrings::tr_NoneColor)
00359               currDoc->toolSettings.dTextBackGround = CommonStrings::None;
00360        currDoc->toolSettings.dTextLineColor = tabTools->colorComboTextLine->currentText();
00361        if (currDoc->toolSettings.dTextLineColor == CommonStrings::tr_NoneColor)
00362               currDoc->toolSettings.dTextLineColor = CommonStrings::None;
00363        currDoc->toolSettings.dTextBackGroundShade = tabTools->shadingTextBack->value();
00364        currDoc->toolSettings.dTextLineShade = tabTools->shadingTextLine->value();
00365        currDoc->toolSettings.dTextPenShade = tabTools->shadingText->value();
00366        currDoc->toolSettings.dTextStrokeShade = tabTools->shadingTextStroke->value();
00367        currDoc->toolSettings.dCols = tabTools->columnsText->value();
00368        currDoc->toolSettings.dGap = tabTools->gapText->value() / currDoc->unitRatio();
00369        currDoc->toolSettings.dTabWidth = tabTools->gapTab->value() / currDoc->unitRatio();
00370        currDoc->toolSettings.dPen = tabTools->colorComboLineShape->currentText();
00371        if (currDoc->toolSettings.dPen == CommonStrings::tr_NoneColor)
00372               currDoc->toolSettings.dPen = CommonStrings::None;
00373        currDoc->toolSettings.dBrush = tabTools->comboFillShape->currentText();
00374        if (currDoc->toolSettings.dBrush == CommonStrings::tr_NoneColor)
00375               currDoc->toolSettings.dBrush = CommonStrings::None;
00376        currDoc->toolSettings.dShade = tabTools->shadingFillShape->value();
00377        currDoc->toolSettings.dShade2 = tabTools->shadingLineShape->value();
00378        switch (tabTools->comboStyleShape->currentItem())
00379        {
00380        case 0:
00381               currDoc->toolSettings.dLineArt = SolidLine;
00382               break;
00383        case 1:
00384               currDoc->toolSettings.dLineArt = DashLine;
00385               break;
00386        case 2:
00387               currDoc->toolSettings.dLineArt = DotLine;
00388               break;
00389        case 3:
00390               currDoc->toolSettings.dLineArt = DashDotLine;
00391               break;
00392        case 4:
00393               currDoc->toolSettings.dLineArt = DashDotDotLine;
00394               break;
00395        }
00396        currDoc->toolSettings.dWidth = tabTools->lineWidthShape->value();
00397        currDoc->toolSettings.dStartArrow = tabTools->startArrow->currentItem();
00398        currDoc->toolSettings.dEndArrow = tabTools->endArrow->currentItem();
00399        currDoc->toolSettings.magMin = tabTools->minimumZoom->value();
00400        currDoc->toolSettings.magMax = tabTools->maximumZoom->value();
00401        currDoc->toolSettings.magStep = tabTools->zoomStep->value();
00402        currDoc->toolSettings.dPenLine = tabTools->colorComboLine->currentText();
00403        if (currDoc->toolSettings.dPenLine == CommonStrings::tr_NoneColor)
00404               currDoc->toolSettings.dPenLine = CommonStrings::None;
00405        currDoc->toolSettings.dShadeLine = tabTools->shadingLine->value();
00406        switch (tabTools->comboStyleLine->currentItem())
00407        {
00408        case 0:
00409               currDoc->toolSettings.dLstyleLine = SolidLine;
00410               break;
00411        case 1:
00412               currDoc->toolSettings.dLstyleLine = DashLine;
00413               break;
00414        case 2:
00415               currDoc->toolSettings.dLstyleLine = DotLine;
00416               break;
00417        case 3:
00418               currDoc->toolSettings.dLstyleLine = DashDotLine;
00419               break;
00420        case 4:
00421               currDoc->toolSettings.dLstyleLine = DashDotDotLine;
00422               break;
00423        }
00424        currDoc->toolSettings.dWidthLine = tabTools->lineWidthLine->value();
00425        currDoc->toolSettings.dBrushPict = tabTools->comboFillImage->currentText();
00426        if (currDoc->toolSettings.dBrushPict == CommonStrings::tr_NoneColor)
00427               currDoc->toolSettings.dBrushPict = CommonStrings::None;
00428        currDoc->toolSettings.shadePict = tabTools->shadingFillImage->value();
00429        currDoc->toolSettings.scaleX = static_cast<double>(tabTools->scalingHorizontal->value()) / 100.0;
00430        currDoc->toolSettings.scaleY = static_cast<double>(tabTools->scalingVertical->value()) / 100.0;
00431        currDoc->toolSettings.scaleType = tabTools->buttonGroup3->isChecked();
00432        currDoc->toolSettings.aspectRatio = tabTools->checkRatioImage->isChecked();
00433        currDoc->toolSettings.useEmbeddedPath = tabTools->embeddedPath->isChecked();
00434        int haRes = 0;
00435        if (tabTools->checkFullRes->isChecked())
00436               haRes = 0;
00437        if (tabTools->checkNormalRes->isChecked())
00438               haRes = 1;
00439        if (tabTools->checkHalfRes->isChecked())
00440               haRes = 2;
00441        if (currDoc->toolSettings.lowResType != haRes)
00442        {
00443               currDoc->toolSettings.lowResType = haRes;
00444               viewToRecalcPictureRes=true;
00445        }
00446        else
00447               viewToRecalcPictureRes=false;
00448        currDoc->toolSettings.dispX = tabTools->genDispX->value();
00449        currDoc->toolSettings.dispY = tabTools->genDispY->value();
00450        currDoc->toolSettings.constrain = tabTools->genRot->value();
00451        tabTools->polyWidget->getValues(&currDoc->toolSettings.polyC, &currDoc->toolSettings.polyFd, &currDoc->toolSettings.polyF, &currDoc->toolSettings.polyS, &currDoc->toolSettings.polyR);
00452        currDoc->AutoSave = tabPage->GroupAS->isChecked();
00453        currDoc->AutoSaveTime = tabPage->ASTime->value() * 60 * 1000;
00454        if (currDoc->AutoSave)
00455        {
00456               currDoc->autoSaveTimer->stop();
00457               currDoc->autoSaveTimer->start(currDoc->AutoSaveTime);
00458        }
00459 /*     FIXME: scribus determines dict by charstyle now, so this setting should go into the doc's default charstyle
00460               currDoc->docHyphenator->slotNewDict(ScMW->GetLang(tabHyphenator->language->currentText()));
00461 */
00462        currDoc->docHyphenator->slotNewSettings(tabHyphenator->wordLen->value(),
00463                                                                                                                 !tabHyphenator->verbose->isChecked(),
00464                                                                                                                 tabHyphenator->input->isChecked(),
00465                                                                                                                 tabHyphenator->maxCount->value());
00466        if (ScCore->haveCMS())
00467        {
00468               bool oldCM = currDoc->CMSSettings.CMSinUse;
00469               tabColorManagement->updateDocSettings(currDoc);
00470               if (tabColorManagement->changed)
00471               {
00472                      ScMW->setStatusBarInfoText( tr("Adjusting Colors"));
00473                      ScMW->mainWindowProgressBar->reset();
00474                      int cc = currDoc->PageColors.count() + currDoc->Items->count();
00475                      ScMW->mainWindowProgressBar->setTotalSteps(cc);
00476                      currDoc->HasCMS = currDoc->CMSSettings.CMSinUse;
00477                      currDoc->SoftProofing = currDoc->CMSSettings.SoftProofOn;
00478                      currDoc->Gamut = currDoc->CMSSettings.GamutCheck;
00479                      currDoc->IntentColors = currDoc->CMSSettings.DefaultIntentColors;
00480                      currDoc->IntentImages = currDoc->CMSSettings.DefaultIntentImages;
00481                      qApp->setOverrideCursor(QCursor(waitCursor), true);
00482                      bool newCM = currDoc->CMSSettings.CMSinUse;
00483                      currDoc->CMSSettings.CMSinUse = oldCM;
00484                      currDoc->CloseCMSProfiles();
00485                      currDoc->CMSSettings.CMSinUse = newCM;
00486                      if (!currDoc->CMSSettings.CMSinUse)
00487                      {
00488                             currDoc->HasCMS = false;
00489                             if     (oldCM)
00490                             {
00491                                    ScMW->recalcColors(ScMW->mainWindowProgressBar);
00492                                    currDoc->RecalcPictures(&ScCore->InputProfiles, &ScCore->InputProfilesCMYK, ScMW->mainWindowProgressBar);
00493                             }
00494                      }
00495                      else if ( currDoc->OpenCMSProfiles(ScCore->InputProfiles, ScCore->InputProfilesCMYK, ScCore->MonitorProfiles, ScCore->PrinterProfiles) )
00496                      {
00497                             currDoc->HasCMS = true;
00498                             currDoc->PDF_Options.SComp = currDoc->CMSSettings.ComponentsInput2;
00499                             currDoc->PDF_Options.SolidProf = currDoc->CMSSettings.DefaultSolidColorRGBProfile;
00500                             currDoc->PDF_Options.ImageProf = currDoc->CMSSettings.DefaultImageRGBProfile;
00501                             currDoc->PDF_Options.PrintProf = currDoc->CMSSettings.DefaultPrinterProfile;
00502                             currDoc->PDF_Options.Intent = currDoc->CMSSettings.DefaultIntentColors;
00503                             ScMW->recalcColors(ScMW->mainWindowProgressBar);
00504                             currDoc->RecalcPictures(&ScCore->InputProfiles, &ScCore->InputProfilesCMYK, ScMW->mainWindowProgressBar);
00505                      }
00506                      else
00507                             currDoc->HasCMS = false;
00508                      ScMW->mainWindowProgressBar->setProgress(cc);
00509                      qApp->setOverrideCursor(QCursor(arrowCursor), true);
00510                      ScMW->setStatusBarInfoText("");
00511                      ScMW->mainWindowProgressBar->reset();
00512               }
00513        }
00514        PrefsManager* prefsManager=PrefsManager::instance();
00515        SCFontsIterator it(prefsManager->appPrefs.AvailFonts);
00516        for ( ; it.hasNext() ; it.next())
00517        {
00518               it.current().embedPs(tabFonts->fontFlags[it.currentKey()].FlagPS);
00519               it.current().usable(tabFonts->fontFlags[it.currentKey()].FlagUse);
00520               it.current().subset(tabFonts->fontFlags[it.currentKey()].FlagSub);
00521        }
00522        uint a = 0;
00523        prefsManager->appPrefs.GFontSub.clear();
00524        QMap<QString,QString>::Iterator itfsu;
00525        QMap<QString,QString>::Iterator itfsuend=tabFonts->RList.end();
00526        for (itfsu = tabFonts->RList.begin(); itfsu != itfsuend; ++itfsu)
00527               prefsManager->appPrefs.GFontSub[itfsu.key()] = tabFonts->FlagsRepl.at(a++)->currentText();
00528        QStringList uf = currDoc->UsedFonts.keys();
00529        QMap<QString,int>::Iterator it3;
00530 //     for (it3 = currDoc->UsedFonts.begin(); it3 != currDoc->UsedFonts.end(); ++it3)
00531 //            FT_Done_Face(currDoc->FFonts[it3.key()]);
00532        currDoc->UsedFonts.clear();
00533        QStringList::Iterator it3a;
00534        QStringList::Iterator it3aend=uf.end();
00535        for (it3a = uf.begin(); it3a != it3aend; ++it3a)
00536               currDoc->AddFont(*it3a);
00537 
00538        currDoc->PDF_Options.Thumbnails = tabPDF->CheckBox1->isChecked();
00539        currDoc->PDF_Options.Compress = tabPDF->Compression->isChecked();
00540        currDoc->PDF_Options.CompressMethod = tabPDF->CMethod->currentItem();
00541        currDoc->PDF_Options.Quality = tabPDF->CQuality->currentItem();
00542        currDoc->PDF_Options.Resolution = tabPDF->Resolution->value();
00543        currDoc->PDF_Options.RecalcPic = tabPDF->DSColor->isChecked();
00544        currDoc->PDF_Options.PicRes = tabPDF->ValC->value();
00545        currDoc->PDF_Options.Bookmarks = tabPDF->CheckBM->isChecked();
00546        currDoc->PDF_Options.Binding = tabPDF->ComboBind->currentItem();
00547        currDoc->PDF_Options.MirrorH = tabPDF->MirrorH->isOn();
00548        currDoc->PDF_Options.MirrorV = tabPDF->MirrorV->isOn();
00549        currDoc->PDF_Options.RotateDeg = tabPDF->RotateDeg->currentItem() * 90;
00550        currDoc->PDF_Options.Articles = tabPDF->Article->isChecked();
00551        currDoc->PDF_Options.Encrypt = tabPDF->Encry->isChecked();
00552        currDoc->PDF_Options.UseLPI = tabPDF->UseLPI->isChecked();
00553        currDoc->PDF_Options.useLayers = tabPDF->useLayers->isChecked();
00554        currDoc->PDF_Options.UseSpotColors = !tabPDF->useSpot->isChecked();
00555        currDoc->PDF_Options.doOverprint = tabPDF->overprintMode->isChecked();
00556        currDoc->PDF_Options.doMultiFile = false;
00557        currDoc->PDF_Options.bleeds.Bottom = tabPDF->BleedBottom->value() / currDoc->unitRatio();
00558        currDoc->PDF_Options.bleeds.Top = tabPDF->BleedTop->value() / currDoc->unitRatio();
00559        currDoc->PDF_Options.bleeds.Left = tabPDF->BleedLeft->value() / currDoc->unitRatio();
00560        currDoc->PDF_Options.bleeds.Right = tabPDF->BleedRight->value() / currDoc->unitRatio();
00561        currDoc->PDF_Options.doClip = tabPDF->ClipMarg->isChecked();
00562        /* DISABLED CR 2006-12-07 Work around #2964
00563        currDoc->PDF_Options.displayBookmarks = tabPDF->useBookmarks->isChecked();
00564        currDoc->PDF_Options.displayFullscreen = tabPDF->useFullScreen->isChecked();
00565        currDoc->PDF_Options.displayLayers = tabPDF->useLayers2->isChecked();
00566        currDoc->PDF_Options.displayThumbs = tabPDF->useThumbnails->isChecked();
00567        int pgl = PDFOptions::SinglePage;
00568        if (tabPDF->singlePage->isChecked())
00569               pgl = PDFOptions::SinglePage;
00570        else if (tabPDF->continuousPages->isChecked())
00571               pgl = PDFOptions::OneColumn;
00572        else if (tabPDF->doublePageLeft->isChecked())
00573               pgl = PDFOptions::TwoColumnLeft;
00574        else if (tabPDF->doublePageRight->isChecked())
00575               pgl = PDFOptions::TwoColumnRight;
00576        currDoc->PDF_Options.PageLayout = pgl;
00577        */
00578        currDoc->PDF_Options.openAction = "";
00579        if (tabPDF->Encry->isChecked())
00580        {
00581               int Perm = -64;
00582               if (tabPDF->PDFVersionCombo->currentItem() == 1)
00583                      Perm &= ~0x00240000;
00584               if (tabPDF->PrintSec->isChecked())
00585                      Perm += 4;
00586               if (tabPDF->ModifySec->isChecked())
00587                      Perm += 8;
00588               if (tabPDF->CopySec->isChecked())
00589                      Perm += 16;
00590               if (tabPDF->AddSec->isChecked())
00591                      Perm += 32;
00592               currDoc->PDF_Options.Permissions = Perm;
00593               currDoc->PDF_Options.PassOwner = tabPDF->PassOwner->text();
00594               currDoc->PDF_Options.PassUser = tabPDF->PassUser->text();
00595        }
00596        if (tabPDF->PDFVersionCombo->currentItem() == 0)
00597               currDoc->PDF_Options.Version = PDFOptions::PDFVersion_13;
00598        if (tabPDF->PDFVersionCombo->currentItem() == 1)
00599               currDoc->PDF_Options.Version = PDFOptions::PDFVersion_14;
00600        if (tabPDF->PDFVersionCombo->currentItem() == 2)
00601               currDoc->PDF_Options.Version = PDFOptions::PDFVersion_15;
00602        if (tabPDF->PDFVersionCombo->currentItem() == 3)
00603               currDoc->PDF_Options.Version = PDFOptions::PDFVersion_X3;
00604        if (tabPDF->OutCombo->currentItem() == 0)
00605        {
00606               currDoc->PDF_Options.isGrayscale = false;
00607               currDoc->PDF_Options.UseRGB = true;
00608               currDoc->PDF_Options.UseProfiles = false;
00609               currDoc->PDF_Options.UseProfiles2 = false;
00610        }
00611        else
00612        {
00613               if (tabPDF->OutCombo->currentItem() == 3)
00614               {
00615                      currDoc->PDF_Options.isGrayscale = true;
00616                      currDoc->PDF_Options.UseRGB = false;
00617                      currDoc->PDF_Options.UseProfiles = false;
00618                      currDoc->PDF_Options.UseProfiles2 = false;
00619               }
00620               else
00621               {
00622                      currDoc->PDF_Options.isGrayscale = false;
00623                      currDoc->PDF_Options.UseRGB = false;
00624                      if (currDoc->HasCMS)
00625                      {
00626                             currDoc->PDF_Options.UseProfiles = tabPDF->EmbedProfs->isChecked();
00627                             currDoc->PDF_Options.UseProfiles2 = tabPDF->EmbedProfs2->isChecked();
00628                             currDoc->PDF_Options.Intent = tabPDF->IntendS->currentItem();
00629                             currDoc->PDF_Options.Intent2 = tabPDF->IntendI->currentItem();
00630                             currDoc->PDF_Options.EmbeddedI = tabPDF->NoEmbedded->isChecked();
00631                             currDoc->PDF_Options.SolidProf = tabPDF->SolidPr->currentText();
00632                             currDoc->PDF_Options.ImageProf = tabPDF->ImageP->currentText();
00633                             currDoc->PDF_Options.PrintProf = tabPDF->PrintProfC->currentText();
00634                      }
00635               }
00636        }
00637 
00638        currDoc->documentInfo = docInfos->getDocInfo();
00639        currDoc->docItemAttributes = *(tabDocItemAttributes->getNewAttributes());
00640        currDoc->docToCSetups = *(tabTOCIndexPrefs->getNewToCs());
00641        currDoc->sections = tabDocSections->getNewSections();
00642 
00643        uint itemCount=currDoc->Items->count();
00644        for (uint b=0; b<itemCount; ++b)
00645        {
00646               if (currDoc->Items->at(b)->itemType() == PageItem::ImageFrame)
00647                      currDoc->Items->at(b)->setImageShown(currDoc->guidesSettings.showPic);
00648        }
00649 }
00650 
00651 void ReformDoc::applyChangesButton_clicked()
00652 {
00653        ScMW->docSetup(this);
00654 }