]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QDocumentDialog.C
* src/frontends/qt4/GuiSelection.C
[lyx.git] / src / frontends / qt4 / QDocumentDialog.C
1 /**
2  * \file QDocumentDialog.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Edwin Leuven
7  * \author Abdelrazak Younes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #include <config.h>
13
14 #include "QDocument.h"
15 #include "QDocumentDialog.h"
16
17 #include <QCloseEvent>
18
19 #include "FloatPlacement.h"
20 #include "lengthcombo.h"
21 #include "validators.h"
22 #include "panelstack.h"
23 #include "Qt2BC.h"
24 #include "checkedwidgets.h"
25 #include "qt_helpers.h"
26
27 #include "bufferparams.h"
28 #include "encoding.h"
29 #include "gettext.h"
30 #include "helper_funcs.h" // getSecond()
31 #include "language.h"
32 #include "lyxrc.h" // defaultUnit
33 #include "lyxtextclasslist.h"
34 #include "tex-strings.h" // tex_graphics
35 #include "Spacing.h"
36
37 #include "controllers/ControlDocument.h"
38 #include "controllers/frnt_lang.h"
39
40 #include "support/lstrings.h"
41
42 #include "controllers/ControlDocument.h"
43 #include "controllers/frnt_lang.h"
44
45
46 using lyx::support::token;
47 using lyx::support::bformat;
48 using lyx::support::findToken;
49 using lyx::support::getVectorFromString;
50
51 using std::distance;
52 using std::vector;
53 using std::string;
54
55
56 namespace lyx {
57 namespace frontend {
58
59
60 QDocumentDialog::QDocumentDialog(QDocument * form)
61         : form_(form),
62         lang_(getSecond(getLanguageData(false)))
63 {
64         setupUi(this);
65
66         connect(okPB, SIGNAL(clicked()),
67                 form, SLOT(slotOK()));
68         connect(applyPB, SIGNAL(clicked()),
69                 form, SLOT(slotApply()));
70         connect(closePB, SIGNAL(clicked()),
71                 form, SLOT(slotClose()));
72         connect(restorePB, SIGNAL(clicked()),
73                 form, SLOT(slotRestore()));
74
75
76         connect(savePB, SIGNAL( clicked() ), 
77                 this, SLOT( saveDefaultClicked() ) );
78         connect(defaultPB, SIGNAL( clicked() ), 
79                 this, SLOT( useDefaultsClicked() ) );
80
81         // Manage the restore, ok, apply, restore and cancel/close buttons
82         form_->bcview().setOK(okPB);
83         form_->bcview().setApply(applyPB);
84         form_->bcview().setCancel(closePB);
85         form_->bcview().setRestore(restorePB);
86
87
88         textLayoutModule = new UiWidget<Ui::TextLayoutUi>;
89         // text layout
90         connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
91         connect(textLayoutModule->lspacingCO, SIGNAL(activated(int)), this, SLOT(setLSpacing(int)));
92         connect(textLayoutModule->lspacingLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
93         connect(textLayoutModule->skipRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
94         connect(textLayoutModule->indentRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
95         connect(textLayoutModule->skipCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
96         connect(textLayoutModule->skipLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
97         connect(textLayoutModule->skipLengthCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
98         connect(textLayoutModule->skipCO, SIGNAL(activated(int)), this, SLOT(setSkip(int)));
99         connect(textLayoutModule->skipRB, SIGNAL(toggled(bool)), this, SLOT(enableSkip(bool)));
100         connect(textLayoutModule->twoColumnCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
101         textLayoutModule->lspacingLE->setValidator(new QDoubleValidator(
102                 textLayoutModule->lspacingLE));
103         textLayoutModule->skipLE->setValidator(unsignedLengthValidator(
104                 textLayoutModule->skipLE));
105
106         textLayoutModule->skipCO->addItem(qt_("SmallSkip"));
107         textLayoutModule->skipCO->addItem(qt_("MedSkip"));
108         textLayoutModule->skipCO->addItem(qt_("BigSkip"));
109         textLayoutModule->skipCO->addItem(qt_("Length"));
110         // remove the %-items from the unit choice
111         textLayoutModule->skipLengthCO->noPercents();
112         textLayoutModule->lspacingCO->insertItem(
113                 Spacing::Single, qt_("Single"));
114         textLayoutModule->lspacingCO->insertItem(
115                 Spacing::Onehalf, qt_("OneHalf"));
116         textLayoutModule->lspacingCO->insertItem(
117                 Spacing::Double, qt_("Double"));
118         textLayoutModule->lspacingCO->insertItem(
119                 Spacing::Other, qt_("Custom"));
120
121         // initialize the length validator
122         addCheckedLineEdit(form_->bcview(), textLayoutModule->skipLE);
123
124
125
126
127         fontModule = new UiWidget<Ui::FontUi>;
128         // fonts
129         connect(fontModule->fontsRomanCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
130         connect(fontModule->fontsRomanCO, SIGNAL(activated(int)), this, SLOT(romanChanged(int)));
131         connect(fontModule->fontsSansCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
132         connect(fontModule->fontsSansCO, SIGNAL(activated(int)), this, SLOT(sansChanged(int)));
133         connect(fontModule->fontsTypewriterCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
134         connect(fontModule->fontsTypewriterCO, SIGNAL(activated(int)), this, SLOT(ttChanged(int)));
135         connect(fontModule->fontsDefaultCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
136         connect(fontModule->fontsizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
137         connect(fontModule->scaleSansSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
138         connect(fontModule->scaleTypewriterSB, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
139         connect(fontModule->fontScCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
140         connect(fontModule->fontOsfCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
141
142         for (int n = 0; tex_fonts_roman[n][0]; ++n) {
143                 QString font = toqstr(tex_fonts_roman_gui[n]);
144                 if (!form_->controller().isFontAvailable(tex_fonts_roman[n]))
145                         font += qt_(" (not installed)");
146                 fontModule->fontsRomanCO->addItem(font);
147         }
148         for (int n = 0; tex_fonts_sans[n][0]; ++n) {
149                 QString font = toqstr(tex_fonts_sans_gui[n]);
150                 if (!form_->controller().isFontAvailable(tex_fonts_sans[n]))
151                         font += qt_(" (not installed)");
152                 fontModule->fontsSansCO->addItem(font);
153         }
154         for (int n = 0; tex_fonts_monospaced[n][0]; ++n) {
155                 QString font = toqstr(tex_fonts_monospaced_gui[n]);
156                 if (!form_->controller().isFontAvailable(tex_fonts_monospaced[n]))
157                         font += qt_(" (not installed)");
158                 fontModule->fontsTypewriterCO->addItem(font);
159         }
160
161         fontModule->fontsizeCO->addItem(qt_("default"));
162         fontModule->fontsizeCO->addItem(qt_("10"));
163         fontModule->fontsizeCO->addItem(qt_("11"));
164         fontModule->fontsizeCO->addItem(qt_("12"));
165
166         for (int n = 0; ControlDocument::fontfamilies_gui[n][0]; ++n)
167                 fontModule->fontsDefaultCO->addItem(
168                         qt_(ControlDocument::fontfamilies_gui[n]));
169
170
171
172
173         pageLayoutModule = new UiWidget<Ui::PageLayoutUi>;
174         // page layout
175         connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setCustomPapersize(int)));
176         connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(setCustomPapersize(int)));
177         connect(pageLayoutModule->portraitRB, SIGNAL(toggled(bool)), this, SLOT(portraitChanged()));
178         connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
179         connect(pageLayoutModule->paperheightLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
180         connect(pageLayoutModule->paperwidthLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
181         connect(pageLayoutModule->paperwidthUnitCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
182         connect(pageLayoutModule->paperheightUnitCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
183         connect(pageLayoutModule->portraitRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
184         connect(pageLayoutModule->landscapeRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
185         connect(pageLayoutModule->facingPagesCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
186         connect(pageLayoutModule->pagestyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
187         pageLayoutModule->pagestyleCO->addItem(qt_("default"));
188         pageLayoutModule->pagestyleCO->addItem(qt_("empty"));
189         pageLayoutModule->pagestyleCO->addItem(qt_("plain"));
190         pageLayoutModule->pagestyleCO->addItem(qt_("headings"));
191         pageLayoutModule->pagestyleCO->addItem(qt_("fancy"));
192         addCheckedLineEdit(form_->bcview(), pageLayoutModule->paperheightLE,
193                 pageLayoutModule->paperheightL);
194         addCheckedLineEdit(form_->bcview(), pageLayoutModule->paperwidthLE,
195                 pageLayoutModule->paperwidthL);
196
197         // paper
198         QComboBox * cb = pageLayoutModule->papersizeCO;
199         cb->addItem(qt_("Default"));
200         cb->addItem(qt_("Custom"));
201         cb->addItem(qt_("US letter"));
202         cb->addItem(qt_("US legal"));
203         cb->addItem(qt_("US executive"));
204         cb->addItem(qt_("A3"));
205         cb->addItem(qt_("A4"));
206         cb->addItem(qt_("A5"));
207         cb->addItem(qt_("B3"));
208         cb->addItem(qt_("B4"));
209         cb->addItem(qt_("B5"));
210         // remove the %-items from the unit choice
211         pageLayoutModule->paperwidthUnitCO->noPercents();
212         pageLayoutModule->paperheightUnitCO->noPercents();
213         pageLayoutModule->paperheightLE->setValidator(unsignedLengthValidator(
214                 pageLayoutModule->paperheightLE));
215         pageLayoutModule->paperwidthLE->setValidator(unsignedLengthValidator(
216                 pageLayoutModule->paperwidthLE));
217
218
219
220
221         marginsModule = new UiWidget<Ui::MarginsUi>;
222         // margins
223         connect(marginsModule->marginCB, SIGNAL(toggled(bool)), this, SLOT(setCustomMargins(bool)));
224         connect(marginsModule->marginCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
225         connect(marginsModule->topLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
226         connect(marginsModule->topUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
227         connect(marginsModule->bottomLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
228         connect(marginsModule->bottomUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
229         connect(marginsModule->innerLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
230         connect(marginsModule->innerUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
231         connect(marginsModule->outerLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
232         connect(marginsModule->outerUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
233         connect(marginsModule->headheightLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
234         connect(marginsModule->headheightUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
235         connect(marginsModule->headsepLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
236         connect(marginsModule->headsepUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
237         connect(marginsModule->footskipLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
238         connect(marginsModule->footskipUnit, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
239         marginsModule->topLE->setValidator(unsignedLengthValidator(
240                 marginsModule->topLE));
241         marginsModule->bottomLE->setValidator(unsignedLengthValidator(
242                 marginsModule->bottomLE));
243         marginsModule->innerLE->setValidator(unsignedLengthValidator(
244                 marginsModule->innerLE));
245         marginsModule->outerLE->setValidator(unsignedLengthValidator(
246                 marginsModule->outerLE));
247         marginsModule->headsepLE->setValidator(unsignedLengthValidator(
248                 marginsModule->headsepLE));
249         marginsModule->headheightLE->setValidator(unsignedLengthValidator(
250                 marginsModule->headheightLE));
251         marginsModule->footskipLE->setValidator(unsignedLengthValidator(
252                 marginsModule->footskipLE));
253
254         addCheckedLineEdit(form_->bcview(), marginsModule->topLE,
255                 marginsModule->topL);
256         addCheckedLineEdit(form_->bcview(), marginsModule->bottomLE,
257                 marginsModule->bottomL);
258         addCheckedLineEdit(form_->bcview(), marginsModule->innerLE,
259                 marginsModule->innerL);
260         addCheckedLineEdit(form_->bcview(), marginsModule->outerLE,
261                 marginsModule->outerL);
262         addCheckedLineEdit(form_->bcview(), marginsModule->headsepLE,
263                 marginsModule->headsepL);
264         addCheckedLineEdit(form_->bcview(), marginsModule->headheightLE,
265                 marginsModule->headheightL);
266         addCheckedLineEdit(form_->bcview(), marginsModule->footskipLE,
267                 marginsModule->footskipL);
268
269
270
271
272
273         langModule = new UiWidget<Ui::LanguageUi>;
274         connect(langModule->defaultencodingCB, SIGNAL(toggled(bool)), langModule->encodingL, SLOT(setDisabled(bool)));
275         connect(langModule->defaultencodingCB, SIGNAL(toggled(bool)), langModule->encodingCO, SLOT(setDisabled(bool)));
276         // language & quote
277         connect(langModule->languageCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
278         connect(langModule->defaultencodingCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
279         connect(langModule->encodingCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
280         connect(langModule->quoteStyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
281         // language & quotes
282         vector<LanguagePair> const langs = getLanguageData(false);
283         vector<LanguagePair>::const_iterator lit  = langs.begin();
284         vector<LanguagePair>::const_iterator lend = langs.end();
285         for (; lit != lend; ++lit) {
286                 langModule->languageCO->addItem(
287                         toqstr(lit->first));
288         }
289
290         // Always put the default encoding in the first position.
291         // It is special because the displayed text is translated.
292         langModule->encodingCO->addItem(qt_("LaTeX default"));
293         Encodings::const_iterator it = encodings.begin();
294         Encodings::const_iterator const end = encodings.end();
295         for (; it != end; ++it)
296                 langModule->encodingCO->addItem(toqstr(it->latexName()));
297
298         langModule->quoteStyleCO->addItem(qt_("``text''"));
299         langModule->quoteStyleCO->addItem(qt_("''text''"));
300         langModule->quoteStyleCO->addItem(qt_(",,text``"));
301         langModule->quoteStyleCO->addItem(qt_(",,text''"));
302         langModule->quoteStyleCO->addItem(qt_("<<text>>"));
303         langModule->quoteStyleCO->addItem(qt_(">>text<<"));
304
305
306
307         numberingModule = new UiWidget<Ui::NumberingUi>;
308         // numbering
309         connect(numberingModule->depthSL, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
310         connect(numberingModule->tocSL, SIGNAL(valueChanged(int)), this, SLOT(change_adaptor()));
311         connect(numberingModule->depthSL, SIGNAL(valueChanged(int)), this, SLOT(updateNumbering()));
312         connect(numberingModule->tocSL, SIGNAL(valueChanged(int)), this, SLOT(updateNumbering()));
313         numberingModule->tocTW->setColumnCount(3);
314         numberingModule->tocTW->headerItem()->setText(0, qt_("Example"));
315         numberingModule->tocTW->headerItem()->setText(1, qt_("Numbered"));
316         numberingModule->tocTW->headerItem()->setText(2, qt_("Appears in TOC"));
317
318
319         biblioModule = new UiWidget<Ui::BiblioUi>;
320         connect( biblioModule->citeNatbibRB, SIGNAL( toggled(bool) ), biblioModule->citationStyleL, SLOT( setEnabled(bool) ) );
321         connect( biblioModule->citeNatbibRB, SIGNAL( toggled(bool) ), biblioModule->citeStyleCO, SLOT( setEnabled(bool) ) );
322         // biblio
323         connect(biblioModule->citeDefaultRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
324         connect(biblioModule->citeNatbibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
325         connect(biblioModule->citeStyleCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
326         connect(biblioModule->citeJurabibRB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
327         connect(biblioModule->bibtopicCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
328         // biblio
329         biblioModule->citeStyleCO->addItem(qt_("Author-year"));
330         biblioModule->citeStyleCO->addItem(qt_("Numerical"));
331         biblioModule->citeStyleCO->setCurrentIndex(0);
332
333
334
335         mathsModule = new UiWidget<Ui::MathsUi>;
336         connect(mathsModule->amsautoCB, SIGNAL(toggled(bool)), mathsModule->amsCB, SLOT(setDisabled(bool)));
337         connect(mathsModule->esintautoCB, SIGNAL(toggled(bool)), mathsModule->esintCB, SLOT(setDisabled(bool)));
338         // maths
339         connect(mathsModule->amsCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
340         connect(mathsModule->amsautoCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
341         connect(mathsModule->esintCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
342         connect(mathsModule->esintautoCB, SIGNAL(toggled(bool)), this, SLOT(change_adaptor()));
343
344         latexModule = new UiWidget<Ui::LaTeXUi>;
345         // latex class
346         connect(latexModule->classCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
347         connect(latexModule->optionsLE, SIGNAL(textChanged(const QString&)), this, SLOT(change_adaptor()));
348         connect(latexModule->psdriverCO, SIGNAL(activated(int)), this, SLOT(change_adaptor()));
349         connect(latexModule->classCO, SIGNAL(activated(int)), this, SLOT(classChanged()));
350         // packages
351         for (int n = 0; tex_graphics[n][0]; ++n) {
352                 QString enc = tex_graphics[n];
353                 latexModule->psdriverCO->addItem(enc);
354         }
355         // latex
356         for (LyXTextClassList::const_iterator cit = textclasslist.begin();
357              cit != textclasslist.end(); ++cit) {
358                 if (cit->isTeXClassAvailable()) {
359                         latexModule->classCO->addItem(toqstr(cit->description()));
360                 } else {
361                         docstring item =
362                                 bformat(_("Unavailable: %1$s"), lyx::from_utf8(cit->description()));
363                         latexModule->classCO->addItem(toqstr(item));
364                 }
365         }
366
367         // branches
368         branchesModule = new QBranches;
369         connect(branchesModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
370
371         // preamble
372         preambleModule = new UiWidget<Ui::PreambleUi>;
373         connect(preambleModule->preambleTE, SIGNAL(textChanged()), this, SLOT(change_adaptor()));
374
375
376         // bullets
377         bulletsModule = new BulletsModule;
378         connect(bulletsModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
379
380
381         // float
382         floatModule = new FloatPlacement;
383         connect(floatModule, SIGNAL(changed()), this, SLOT(change_adaptor()));
384
385         docPS->addPanel(latexModule, _("Document Class"));
386         docPS->addPanel(fontModule, _("Fonts"));
387         docPS->addPanel(textLayoutModule, _("Text Layout"));
388         docPS->addPanel(pageLayoutModule, _("Page Layout"));
389         docPS->addPanel(marginsModule, _("Page Margins"));
390         docPS->addPanel(langModule, _("Language"));
391         docPS->addPanel(numberingModule, _("Numbering & TOC"));
392         docPS->addPanel(biblioModule, _("Bibliography"));
393         docPS->addPanel(mathsModule, _("Math Options"));
394         docPS->addPanel(floatModule, _("Float Placement"));
395         docPS->addPanel(bulletsModule, _("Bullets"));
396         docPS->addPanel(branchesModule, _("Branches"));
397         docPS->addPanel(preambleModule, _("LaTeX Preamble"));
398         docPS->setCurrentPanel(_("Document Class"));
399 // FIXME: hack to work around resizing bug in Qt >= 4.2
400 #if QT_VERSION >= 0x040200
401         docPS->updateGeometry();
402 #endif
403 }
404
405
406 QDocumentDialog::~QDocumentDialog()
407 {
408 }
409
410
411 void QDocumentDialog::showPreamble()
412 {
413         docPS->setCurrentPanel(_("LaTeX Preamble"));
414 }
415
416
417 void QDocumentDialog::saveDefaultClicked()
418 {
419         form_->saveDocDefault();
420 }
421
422
423 void QDocumentDialog::useDefaultsClicked()
424 {
425         form_->useClassDefaults();
426 }
427
428
429 void QDocumentDialog::change_adaptor()
430 {
431         form_->changed();
432 }
433
434
435 void QDocumentDialog::closeEvent(QCloseEvent * e)
436 {
437         form_->slotWMHide();
438         e->accept();
439 }
440
441
442 void QDocumentDialog::setLSpacing(int item)
443 {
444         textLayoutModule->lspacingLE->setEnabled(item == 3);
445 }
446
447
448 void QDocumentDialog::setSkip(int item)
449 {
450         bool const enable = (item == 3);
451         textLayoutModule->skipLE->setEnabled(enable);
452         textLayoutModule->skipLengthCO->setEnabled(enable);
453 }
454
455
456 void QDocumentDialog::enableSkip(bool skip)
457 {
458         textLayoutModule->skipCO->setEnabled(skip);
459         textLayoutModule->skipLE->setEnabled(skip);
460         textLayoutModule->skipLengthCO->setEnabled(skip);
461         if (skip)
462                 setSkip(textLayoutModule->skipCO->currentIndex());
463 }
464
465 void QDocumentDialog::portraitChanged()
466 {
467         setMargins(pageLayoutModule->papersizeCO->currentIndex());
468 }
469
470 void QDocumentDialog::setMargins(bool custom)
471 {
472         marginsModule->marginCB->setChecked(custom);
473         setCustomMargins(custom);
474 }
475
476
477 void QDocumentDialog::setCustomPapersize(int papersize)
478 {
479         bool const custom = (papersize == 1);
480
481         pageLayoutModule->paperwidthL->setEnabled(custom);
482         pageLayoutModule->paperwidthLE->setEnabled(custom);
483         pageLayoutModule->paperwidthUnitCO->setEnabled(custom);
484         pageLayoutModule->paperheightL->setEnabled(custom);
485         pageLayoutModule->paperheightLE->setEnabled(custom);
486         pageLayoutModule->paperheightLE->setFocus();
487         pageLayoutModule->paperheightUnitCO->setEnabled(custom);
488 }
489
490
491 void QDocumentDialog::setCustomMargins(bool custom)
492 {
493         marginsModule->topL->setEnabled(!custom);
494         marginsModule->topLE->setEnabled(!custom);
495         marginsModule->topUnit->setEnabled(!custom);
496
497         marginsModule->bottomL->setEnabled(!custom);
498         marginsModule->bottomLE->setEnabled(!custom);
499         marginsModule->bottomUnit->setEnabled(!custom);
500
501         marginsModule->innerL->setEnabled(!custom);
502         marginsModule->innerLE->setEnabled(!custom);
503         marginsModule->innerUnit->setEnabled(!custom);
504
505         marginsModule->outerL->setEnabled(!custom);
506         marginsModule->outerLE->setEnabled(!custom);
507         marginsModule->outerUnit->setEnabled(!custom);
508
509         marginsModule->headheightL->setEnabled(!custom);
510         marginsModule->headheightLE->setEnabled(!custom);
511         marginsModule->headheightUnit->setEnabled(!custom);
512
513         marginsModule->headsepL->setEnabled(!custom);
514         marginsModule->headsepLE->setEnabled(!custom);
515         marginsModule->headsepUnit->setEnabled(!custom);
516
517         marginsModule->footskipL->setEnabled(!custom);
518         marginsModule->footskipLE->setEnabled(!custom);
519         marginsModule->footskipUnit->setEnabled(!custom);
520 }
521
522
523 void QDocumentDialog::updateFontsize(string const & items, string const & sel)
524 {
525         fontModule->fontsizeCO->clear();
526         fontModule->fontsizeCO->addItem(qt_("default"));
527
528         for (int n = 0; !token(items,'|',n).empty(); ++n)
529                 fontModule->fontsizeCO->
530                         addItem(toqstr(token(items,'|',n)));
531
532         for (int n = 0; n < fontModule->fontsizeCO->count(); ++n) {
533                 if (fromqstr(fontModule->fontsizeCO->itemText(n)) == sel) {
534                         fontModule->fontsizeCO->setCurrentIndex(n);
535                         break;
536                 }
537         }
538 }
539
540
541 void QDocumentDialog::romanChanged(int item)
542 {
543         string const font = tex_fonts_roman[item];
544         
545         fontModule->fontScCB->setEnabled(
546                 form_->controller().providesSC(font));
547         fontModule->fontOsfCB->setEnabled(
548                 form_->controller().providesOSF(font));
549 }
550
551
552 void QDocumentDialog::sansChanged(int item)
553 {
554         string const font = tex_fonts_sans[item];
555         bool scaleable = form_->controller().providesScale(font);
556         fontModule->scaleSansSB->setEnabled(scaleable);
557         fontModule->scaleSansLA->setEnabled(scaleable);
558 }
559
560
561 void QDocumentDialog::ttChanged(int item)
562 {
563         string const font = tex_fonts_monospaced[item];
564         bool scaleable = form_->controller().providesScale(font);
565         fontModule->scaleTypewriterSB->setEnabled(scaleable);
566         fontModule->scaleTypewriterLA->setEnabled(scaleable);
567 }
568
569
570 void QDocumentDialog::updatePagestyle(string const & items, string const & sel)
571 {
572         pageLayoutModule->pagestyleCO->clear();
573         pageLayoutModule->pagestyleCO->addItem("default");
574
575         for (int n=0; !token(items,'|',n).empty(); ++n)
576                 pageLayoutModule->pagestyleCO->
577                         addItem(toqstr(token(items,'|',n)));
578
579         for (int n = 0; n<pageLayoutModule->pagestyleCO->count(); ++n) {
580                 if (fromqstr(pageLayoutModule->pagestyleCO->itemText(n))==sel) {
581                         pageLayoutModule->pagestyleCO->setCurrentIndex(n);
582                         break;
583                 }
584         }
585 }
586
587
588 void QDocumentDialog::classChanged()
589 {
590         ControlDocument & cntrl = form_->controller();
591         BufferParams & params = cntrl.params();
592
593         lyx::textclass_type const tc = latexModule->classCO->currentIndex();
594
595         if (form_->controller().loadTextclass(tc)) {
596                 params.textclass = tc;
597                 if (lyxrc.auto_reset_options)
598                         params.useClassDefaults();
599                 form_->update_contents();
600         } else {
601                 latexModule->classCO->setCurrentIndex(params.textclass);
602         }
603 }
604
605
606 void QDocumentDialog::updateNumbering()
607 {
608         LyXTextClass const & tclass =
609                 form_->controller().params().getLyXTextClass();
610
611         numberingModule->tocTW->setUpdatesEnabled(false);
612         numberingModule->tocTW->clear();
613
614         int const depth = numberingModule->depthSL->value();
615         int const toc = numberingModule->tocSL->value();
616         QString const no = qt_("No");
617         QString const yes = qt_("Yes");
618         LyXTextClass::const_iterator end = tclass.end();
619         LyXTextClass::const_iterator cit = tclass.begin();
620         QTreeWidgetItem * item = 0;
621         for ( ; cit != end ; ++cit) {
622                 int const toclevel = (*cit)->toclevel;
623                 if (toclevel != LyXLayout::NOT_IN_TOC 
624                     && (*cit)->labeltype == LABEL_COUNTER) {
625                         item = new QTreeWidgetItem(numberingModule->tocTW);
626                         item->setText(0, qt_((*cit)->name()));
627                         item->setText(1, (toclevel <= depth) ? yes : no);
628                         item->setText(2, (toclevel <= toc) ? yes : no);
629                 }
630         }
631
632         numberingModule->tocTW->setUpdatesEnabled(true);
633         numberingModule->tocTW->update();
634 }
635
636 void QDocumentDialog::apply(BufferParams & params)
637 {
638         // preamble
639         params.preamble =
640                 fromqstr(preambleModule->preambleTE->document()->toPlainText());
641
642         // biblio
643         params.cite_engine = biblio::ENGINE_BASIC;
644
645         if (biblioModule->citeNatbibRB->isChecked()) {
646                 bool const use_numerical_citations =
647                         biblioModule->citeStyleCO->currentIndex();
648                 if (use_numerical_citations)
649                         params.cite_engine = biblio::ENGINE_NATBIB_NUMERICAL;
650                 else
651                         params.cite_engine = biblio::ENGINE_NATBIB_AUTHORYEAR;
652
653         } else if (biblioModule->citeJurabibRB->isChecked())
654                 params.cite_engine = biblio::ENGINE_JURABIB;
655
656         params.use_bibtopic =
657                 biblioModule->bibtopicCB->isChecked();
658
659         // language & quotes
660         if (langModule->defaultencodingCB->isChecked()) {
661                 params.inputenc = "auto";
662         } else {
663                 int i = langModule->encodingCO->currentIndex();
664                 if (i == 0)
665                         params.inputenc = "default";
666                 else
667                         params.inputenc =
668                                 fromqstr(langModule->encodingCO->currentText());
669         }
670
671         InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
672         switch (langModule->quoteStyleCO->currentIndex()) {
673         case 0:
674                 lga = InsetQuotes::EnglishQ;
675                 break;
676         case 1:
677                 lga = InsetQuotes::SwedishQ;
678                 break;
679         case 2:
680                 lga = InsetQuotes::GermanQ;
681                 break;
682         case 3:
683                 lga = InsetQuotes::PolishQ;
684                 break;
685         case 4:
686                 lga = InsetQuotes::FrenchQ;
687                 break;
688         case 5:
689                 lga = InsetQuotes::DanishQ;
690                 break;
691         }
692         params.quotes_language = lga;
693
694         int const pos = langModule->languageCO->currentIndex();
695         params.language = languages.getLanguage(lang_[pos]);
696
697         // numbering
698         if (params.getLyXTextClass().hasTocLevels()) {
699                 params.tocdepth = numberingModule->tocSL->value();
700                 params.secnumdepth = numberingModule->depthSL->value();
701         }
702
703         // bullets
704         params.user_defined_bullet(0) = bulletsModule->getBullet(0);
705         params.user_defined_bullet(1) = bulletsModule->getBullet(1);
706         params.user_defined_bullet(2) = bulletsModule->getBullet(2);
707         params.user_defined_bullet(3) = bulletsModule->getBullet(3);
708
709         // packages
710         params.graphicsDriver =
711                 fromqstr(latexModule->psdriverCO->currentText());
712
713         if (mathsModule->amsautoCB->isChecked()) {
714                 params.use_amsmath = BufferParams::package_auto;
715         } else {
716                 if (mathsModule->amsCB->isChecked())
717                         params.use_amsmath = BufferParams::package_on;
718                 else
719                         params.use_amsmath = BufferParams::package_off;
720         }
721
722         if (mathsModule->esintautoCB->isChecked())
723                 params.use_esint = BufferParams::package_auto;
724         else {
725                 if (mathsModule->esintCB->isChecked())
726                         params.use_esint = BufferParams::package_on;
727                 else
728                         params.use_esint = BufferParams::package_off;
729         }
730
731         // text layout
732         params.textclass =
733                 latexModule->classCO->currentIndex();
734
735         params.pagestyle =
736                 fromqstr(pageLayoutModule->pagestyleCO->currentText());
737
738         switch (textLayoutModule->lspacingCO->currentIndex()) {
739         case 0:
740                 params.spacing().set(Spacing::Single);
741                 break;
742         case 1:
743                 params.spacing().set(Spacing::Onehalf);
744                 break;
745         case 2:
746                 params.spacing().set(Spacing::Double);
747                 break;
748         case 3:
749                 params.spacing().set(Spacing::Other,
750                         fromqstr(textLayoutModule->lspacingLE->text()));
751                 break;
752         }
753
754         if (textLayoutModule->twoColumnCB->isChecked())
755                 params.columns = 2;
756         else
757                 params.columns = 1;
758
759         if (textLayoutModule->indentRB->isChecked())
760                 params.paragraph_separation = BufferParams::PARSEP_INDENT;
761         else
762                 params.paragraph_separation = BufferParams::PARSEP_SKIP;
763
764         switch (textLayoutModule->skipCO->currentIndex()) {
765         case 0:
766                 params.setDefSkip(VSpace(VSpace::SMALLSKIP));
767                 break;
768         case 1:
769                 params.setDefSkip(VSpace(VSpace::MEDSKIP));
770                 break;
771         case 2:
772                 params.setDefSkip(VSpace(VSpace::BIGSKIP));
773                 break;
774         case 3:
775         {
776                 VSpace vs = VSpace(
777                         widgetsToLength(textLayoutModule->skipLE,
778                                 textLayoutModule->skipLengthCO)
779                         );
780                 params.setDefSkip(vs);
781                 break;
782         }
783         default:
784                 // DocumentDefskipCB assures that this never happens
785                 // so Assert then !!!  - jbl
786                 params.setDefSkip(VSpace(VSpace::MEDSKIP));
787                 break;
788         }
789
790         params.options =
791                 fromqstr(latexModule->optionsLE->text());
792
793         params.float_placement = floatModule->get();
794
795         // fonts
796         params.fontsRoman =
797                 tex_fonts_roman[fontModule->fontsRomanCO->currentIndex()];
798
799         params.fontsSans =
800                 tex_fonts_sans[fontModule->fontsSansCO->currentIndex()];
801
802         params.fontsTypewriter =
803                 tex_fonts_monospaced[fontModule->fontsTypewriterCO->currentIndex()];
804
805         params.fontsSansScale = fontModule->scaleSansSB->value();
806
807         params.fontsTypewriterScale = fontModule->scaleTypewriterSB->value();
808
809         params.fontsSC = fontModule->fontScCB->isChecked();
810
811         params.fontsOSF = fontModule->fontOsfCB->isChecked();
812
813         params.fontsDefaultFamily = ControlDocument::fontfamilies[
814                 fontModule->fontsDefaultCO->currentIndex()];
815
816         if (fontModule->fontsizeCO->currentIndex() == 0)
817                 params.fontsize = "default";
818         else
819                 params.fontsize =
820                         fromqstr(fontModule->fontsizeCO->currentText());
821
822         // paper
823         params.papersize = PAPER_SIZE(
824                 pageLayoutModule->papersizeCO->currentIndex());
825
826         // custom, A3, B3 and B4 paper sizes need geometry
827         int psize = pageLayoutModule->papersizeCO->currentIndex();
828         bool geom_papersize = (psize == 1 || psize == 5 || psize == 8 || psize == 9);
829
830         params.paperwidth = widgetsToLength(pageLayoutModule->paperwidthLE,
831                 pageLayoutModule->paperwidthUnitCO);
832
833         params.paperheight = widgetsToLength(pageLayoutModule->paperheightLE,
834                 pageLayoutModule->paperheightUnitCO);
835
836         if (pageLayoutModule->facingPagesCB->isChecked())
837                 params.sides = LyXTextClass::TwoSides;
838         else
839                 params.sides = LyXTextClass::OneSide;
840
841         if (pageLayoutModule->landscapeRB->isChecked())
842                 params.orientation = ORIENTATION_LANDSCAPE;
843         else
844                 params.orientation = ORIENTATION_PORTRAIT;
845
846         // margins
847         params.use_geometry =
848                 (!marginsModule->marginCB->isChecked()
849                 || geom_papersize);
850
851         Ui::MarginsUi const * m(marginsModule);
852
853         params.leftmargin = widgetsToLength(m->innerLE, m->innerUnit);
854
855         params.topmargin = widgetsToLength(m->topLE, m->topUnit);
856
857         params.rightmargin = widgetsToLength(m->outerLE, m->outerUnit);
858
859         params.bottommargin = widgetsToLength(m->bottomLE, m->bottomUnit);
860
861         params.headheight = widgetsToLength(m->headheightLE, m->headheightUnit);
862
863         params.headsep = widgetsToLength(m->headsepLE, m->headsepUnit);
864
865         params.footskip = widgetsToLength(m->footskipLE, m->footskipUnit);
866
867         branchesModule->apply(params);
868 }
869
870 namespace {
871
872 /** Return the position of val in the vector if found.
873     If not found, return 0.
874  */
875 template<class A>
876 typename std::vector<A>::size_type
877 findPos(std::vector<A> const & vec, A const & val)
878 {
879         typename std::vector<A>::const_iterator it =
880                 std::find(vec.begin(), vec.end(), val);
881         if (it == vec.end())
882                 return 0;
883         return distance(vec.begin(), it);
884 }
885
886 } // namespace anom
887
888
889 void QDocumentDialog::update(BufferParams const & params)
890 {
891         // set the default unit
892         // FIXME: move to controller
893         LyXLength::UNIT defaultUnit = LyXLength::CM;
894         switch (lyxrc.default_papersize) {
895                 case PAPER_DEFAULT: break;
896
897                 case PAPER_USLETTER:
898                 case PAPER_USLEGAL:
899                 case PAPER_USEXECUTIVE:
900                         defaultUnit = LyXLength::IN;
901                         break;
902
903                 case PAPER_A3:
904                 case PAPER_A4:
905                 case PAPER_A5:
906                 case PAPER_B3:
907                 case PAPER_B4:
908                 case PAPER_B5:
909                         defaultUnit = LyXLength::CM;
910                         break;
911                 case PAPER_CUSTOM:
912                         break;
913         }
914
915         // preamble
916         QString preamble = toqstr(params.preamble);
917         preambleModule->preambleTE->document()->setPlainText(preamble);
918
919         // biblio
920         biblioModule->citeDefaultRB->setChecked(
921                 params.cite_engine == biblio::ENGINE_BASIC);
922
923         biblioModule->citeNatbibRB->setChecked(
924                 params.cite_engine == biblio::ENGINE_NATBIB_NUMERICAL ||
925                 params.cite_engine == biblio::ENGINE_NATBIB_AUTHORYEAR);
926
927         biblioModule->citeStyleCO->setCurrentIndex(
928                 params.cite_engine == biblio::ENGINE_NATBIB_NUMERICAL);
929
930         biblioModule->citeJurabibRB->setChecked(
931                 params.cite_engine == biblio::ENGINE_JURABIB);
932
933         biblioModule->bibtopicCB->setChecked(
934                 params.use_bibtopic);
935
936         // language & quotes
937         int const pos = int(findPos(lang_,
938                                     params.language->lang()));
939         langModule->languageCO->setCurrentIndex(pos);
940
941         langModule->quoteStyleCO->setCurrentIndex(
942                 params.quotes_language);
943
944         langModule->defaultencodingCB->setChecked(true);
945
946         if (params.inputenc != "auto") {
947                 langModule->defaultencodingCB->setChecked(false);
948                 if (params.inputenc == "default") {
949                         langModule->encodingCO->setCurrentIndex(0);
950                 } else {
951                         int const i = langModule->encodingCO->findText(
952                                         toqstr(params.inputenc));
953                         if (i >= 0)
954                                 langModule->encodingCO->setCurrentIndex(i);
955                         else
956                                 // unknown encoding. Set to default.
957                                 langModule->defaultencodingCB->setChecked(true);
958                 }
959         }
960
961         // numbering
962         int const min_toclevel = form_->controller().textClass().min_toclevel();
963         int const max_toclevel = form_->controller().textClass().max_toclevel();
964         if (form_->controller().textClass().hasTocLevels()) {
965                 numberingModule->setEnabled(true);
966                 numberingModule->depthSL->setMinimum(min_toclevel - 1);
967                 numberingModule->depthSL->setMaximum(max_toclevel);
968                 numberingModule->depthSL->setValue(params.secnumdepth);
969                 numberingModule->tocSL->setMaximum(min_toclevel - 1);
970                 numberingModule->tocSL->setMaximum(max_toclevel);
971                 numberingModule->tocSL->setValue(params.tocdepth);
972                 updateNumbering();
973         } else {
974                 numberingModule->setEnabled(false);
975                 numberingModule->tocTW->clear();
976         }
977
978         // bullets
979         bulletsModule->setBullet(0, params.user_defined_bullet(0));
980         bulletsModule->setBullet(1, params.user_defined_bullet(1));
981         bulletsModule->setBullet(2, params.user_defined_bullet(2));
982         bulletsModule->setBullet(3, params.user_defined_bullet(3));
983         bulletsModule->init();
984
985         // packages
986         QString text = toqstr(params.graphicsDriver);
987         int nitem = latexModule->psdriverCO->count();
988         for (int n = 0; n < nitem ; ++n) {
989                 QString enc = tex_graphics[n];
990                 if (enc == text) {
991                         latexModule->psdriverCO->setCurrentIndex(n);
992                 }
993         }
994
995
996         mathsModule->amsCB->setChecked(
997                 params.use_amsmath == BufferParams::package_on);
998         mathsModule->amsautoCB->setChecked(
999                 params.use_amsmath == BufferParams::package_auto);
1000
1001         mathsModule->esintCB->setChecked(
1002                 params.use_esint == BufferParams::package_on);
1003         mathsModule->esintautoCB->setChecked(
1004                 params.use_esint == BufferParams::package_auto);
1005
1006         switch (params.spacing().getSpace()) {
1007                 case Spacing::Other: nitem = 3; break;
1008                 case Spacing::Double: nitem = 2; break;
1009                 case Spacing::Onehalf: nitem = 1; break;
1010                 case Spacing::Default: case Spacing::Single: nitem = 0; break;
1011         }
1012
1013         // text layout
1014         latexModule->classCO->setCurrentIndex(params.textclass);
1015
1016         updatePagestyle(form_->controller().textClass().opt_pagestyle(),
1017                                  params.pagestyle);
1018
1019         textLayoutModule->lspacingCO->setCurrentIndex(nitem);
1020         if (params.spacing().getSpace() == Spacing::Other) {
1021                 textLayoutModule->lspacingLE->setText(
1022                         toqstr(params.spacing().getValueAsString()));
1023         }
1024         setLSpacing(nitem);
1025
1026         if (params.paragraph_separation
1027             == BufferParams::PARSEP_INDENT) {
1028                 textLayoutModule->indentRB->setChecked(true);
1029         } else {
1030                 textLayoutModule->skipRB->setChecked(true);
1031         }
1032
1033         int skip = 0;
1034         switch (params.getDefSkip().kind()) {
1035         case VSpace::SMALLSKIP:
1036                 skip = 0;
1037                 break;
1038         case VSpace::MEDSKIP:
1039                 skip = 1;
1040                 break;
1041         case VSpace::BIGSKIP:
1042                 skip = 2;
1043                 break;
1044         case VSpace::LENGTH:
1045         {
1046                 skip = 3;
1047                 string const length = params.getDefSkip().asLyXCommand();
1048                 lengthToWidgets(textLayoutModule->skipLE,
1049                         textLayoutModule->skipLengthCO,
1050                         length, defaultUnit);
1051                 break;
1052         }
1053         default:
1054                 skip = 0;
1055                 break;
1056         }
1057         textLayoutModule->skipCO->setCurrentIndex(skip);
1058         setSkip(skip);
1059
1060         textLayoutModule->twoColumnCB->setChecked(
1061                 params.columns == 2);
1062
1063         if (!params.options.empty()) {
1064                 latexModule->optionsLE->setText(
1065                         toqstr(params.options));
1066         } else {
1067                 latexModule->optionsLE->setText("");
1068         }
1069
1070         floatModule->set(params.float_placement);
1071
1072         //fonts
1073         updateFontsize(form_->controller().textClass().opt_fontsize(),
1074                         params.fontsize);
1075
1076         int n = findToken(tex_fonts_roman, params.fontsRoman);
1077         if (n >= 0) {
1078                 fontModule->fontsRomanCO->setCurrentIndex(n);
1079                 romanChanged(n);
1080         }
1081
1082         n = findToken(tex_fonts_sans, params.fontsSans);
1083         if (n >= 0)     {
1084                 fontModule->fontsSansCO->setCurrentIndex(n);
1085                 sansChanged(n);
1086         }
1087
1088         n = findToken(tex_fonts_monospaced, params.fontsTypewriter);
1089         if (n >= 0) {
1090                 fontModule->fontsTypewriterCO->setCurrentIndex(n);
1091                 ttChanged(n);
1092         }
1093
1094         fontModule->fontScCB->setChecked(params.fontsSC);
1095         fontModule->fontOsfCB->setChecked(params.fontsOSF);
1096         fontModule->scaleSansSB->setValue(params.fontsSansScale);
1097         fontModule->scaleTypewriterSB->setValue(params.fontsTypewriterScale);
1098         n = findToken(ControlDocument::fontfamilies, params.fontsDefaultFamily);
1099         if (n >= 0)
1100                 fontModule->fontsDefaultCO->setCurrentIndex(n);
1101
1102         // paper
1103         int const psize = params.papersize;
1104         pageLayoutModule->papersizeCO->setCurrentIndex(psize);
1105         setCustomPapersize(psize);
1106
1107         bool const landscape =
1108                 params.orientation == ORIENTATION_LANDSCAPE;
1109         pageLayoutModule->landscapeRB->setChecked(landscape);
1110         pageLayoutModule->portraitRB->setChecked(!landscape);
1111
1112         pageLayoutModule->facingPagesCB->setChecked(
1113                 params.sides == LyXTextClass::TwoSides);
1114
1115
1116         lengthToWidgets(pageLayoutModule->paperwidthLE,
1117                 pageLayoutModule->paperwidthUnitCO, params.paperwidth, defaultUnit);
1118
1119         lengthToWidgets(pageLayoutModule->paperheightLE,
1120                 pageLayoutModule->paperheightUnitCO, params.paperheight, defaultUnit);
1121
1122         // margins
1123         Ui::MarginsUi * m = marginsModule;
1124
1125         setMargins(!params.use_geometry);
1126
1127         lengthToWidgets(m->topLE, m->topUnit,
1128                 params.topmargin, defaultUnit);
1129
1130         lengthToWidgets(m->bottomLE, m->bottomUnit,
1131                 params.bottommargin, defaultUnit);
1132
1133         lengthToWidgets(m->innerLE, m->innerUnit,
1134                 params.leftmargin, defaultUnit);
1135
1136         lengthToWidgets(m->outerLE, m->outerUnit,
1137                 params.rightmargin, defaultUnit);
1138
1139         lengthToWidgets(m->headheightLE, m->headheightUnit,
1140                 params.headheight, defaultUnit);
1141
1142         lengthToWidgets(m->headsepLE, m->headsepUnit,
1143                 params.headsep, defaultUnit);
1144
1145         lengthToWidgets(m->footskipLE, m->footskipUnit,
1146                 params.footskip, defaultUnit);
1147
1148         branchesModule->update(params);
1149 }
1150
1151
1152
1153
1154 } // namespace frontend
1155 } // namespace lyx
1156
1157 #include "QDocumentDialog_moc.cpp"