#include "Spacing.h"
#include "TexRow.h"
#include "VSpace.h"
+#include "PDFOptions.h"
#include "frontends/alert.h"
#include "insets/InsetListingsParams.h"
#include "support/convert.h"
#include "support/filetools.h"
#include "support/Translator.h"
+#include "support/lstrings.h"
#include <boost/array.hpp>
using lyx::support::bformat;
using lyx::support::rtrim;
using lyx::support::tokenPos;
+using lyx::support::prefixIs;
static char const * const string_paragraph_separation[] = {
* and for detached paragraphs in "indented" documents.
*/
VSpace defskip;
+ PDFOptions pdfoptions;
};
return pimpl_->spacing;
}
+PDFOptions & BufferParams::pdfoptions()
+{
+ return pimpl_->pdfoptions;
+}
+
+
+PDFOptions const & BufferParams::pdfoptions() const
+{
+ return pimpl_->pdfoptions;
+}
VSpace const & BufferParams::getDefSkip() const
{
spacing().set(spacetranslator().find(nspacing), tmp_val);
} else if (token == "\\float_placement") {
lex >> float_placement;
+
+ } else if (prefixIs(token, "\\pdf_") || token == "\\use_hyperref") {
+ string toktmp;
+ toktmp = pdfoptions().readToken(lex, token);
+ if (!toktmp.empty()) {
+ lyxerr << "PDFOptions::readToken(): Unknown token: " <<
+ toktmp << endl;
+ return toktmp;
+ }
} else {
lyxerr << "BufferParams::readToken(): Unknown token: " <<
token << endl;
os << "\\paperfontsize " << fontsize << '\n';
spacing().writeFile(os);
+ pdfoptions().writeFile(os);
os << "\\papersize " << string_papersize[papersize]
<< "\n\\use_geometry " << convert<string>(use_geometry)
lyxpreamble += from_utf8(features.getBabelOptions());
}
+ // PDF support. Hypreref manual: "Make sure it comes last of your loaded
+ // packages, to give it a fighting chance of not being over-written,
+ // since its job is to redefine many LATEX commands."
+ // Has to be put into lyxpreamble (preserving line-counting for error
+ // parsing).
+ odocstringstream oss;
+ pdfoptions().writeLaTeX(oss);
+ lyxpreamble += oss.str();
+
lyxpreamble += "\\makeatother\n\n";
int const nlines =
#include "LyXRC.h" // defaultUnit
#include "TextClassList.h"
#include "Spacing.h"
+#include "PDFOptions.h"
#include "insets/InsetListingsParams.h"
connect(bulletsModule, SIGNAL(changed()),
this, SLOT(change_adaptor()));
+ // PDF support
+ pdfSupportModule = new UiWidget<Ui::PDFSupportUi>;
+
+ connect(pdfSupportModule->use_hyperrefCB, SIGNAL(toggled(bool)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->titleLE, SIGNAL(textChanged(const QString &)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->authorLE, SIGNAL(textChanged(const QString &)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->subjectLE, SIGNAL(textChanged(const QString &)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->keywordsLE, SIGNAL(textChanged(const QString &)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->bookmarksGB, SIGNAL(toggled(bool)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->bookmarksnumberedCB, SIGNAL(toggled(bool)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->bookmarksopenGB, SIGNAL(toggled(bool)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->bookmarksopenlevelLE, SIGNAL(textChanged(const QString &)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->breaklinksCB, SIGNAL(toggled(bool)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->pdfborderCB, SIGNAL(toggled(bool)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->colorlinksCB, SIGNAL(toggled(bool)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->backrefCB, SIGNAL(toggled(bool)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->pagebackrefCB, SIGNAL(toggled(bool)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->fullscreenCB, SIGNAL(toggled(bool)),
+ this, SLOT(change_adaptor()));
+ connect(pdfSupportModule->optionsLE, SIGNAL(textChanged(const QString &)),
+ this, SLOT(change_adaptor()));
// float
floatModule = new FloatPlacement;
docPS->addPanel(langModule, _("Language"));
docPS->addPanel(numberingModule, _("Numbering & TOC"));
docPS->addPanel(biblioModule, _("Bibliography"));
+ docPS->addPanel(pdfSupportModule, _("PDF Properties"));
docPS->addPanel(mathsModule, _("Math Options"));
docPS->addPanel(floatModule, _("Float Placement"));
docPS->addPanel(bulletsModule, _("Bullets"));
numberingModule->tocTW->update();
}
+
void GuiDocumentDialog::apply(BufferParams & params)
{
// preamble
Ui::MarginsUi const * m(marginsModule);
params.leftmargin = widgetsToLength(m->innerLE, m->innerUnit);
-
params.topmargin = widgetsToLength(m->topLE, m->topUnit);
-
params.rightmargin = widgetsToLength(m->outerLE, m->outerUnit);
-
params.bottommargin = widgetsToLength(m->bottomLE, m->bottomUnit);
-
params.headheight = widgetsToLength(m->headheightLE, m->headheightUnit);
-
params.headsep = widgetsToLength(m->headsepLE, m->headsepUnit);
-
params.footskip = widgetsToLength(m->footskipLE, m->footskipUnit);
branchesModule->apply(params);
+
+ // PDF support
+ PDFOptions & pdf = params.pdfoptions();
+ pdf.use_hyperref_ = pdfSupportModule->use_hyperrefCB->isChecked();
+ pdf.title_ = fromqstr(pdfSupportModule->titleLE->text());
+ pdf.author_ = fromqstr(pdfSupportModule->authorLE->text());
+ pdf.subject_ = fromqstr(pdfSupportModule->subjectLE->text());
+ pdf.keywords_ = fromqstr(pdfSupportModule->keywordsLE->text());
+
+ pdf.bookmarks_ = pdfSupportModule->bookmarksGB->isChecked();
+ pdf.bookmarksnumbered_ = pdfSupportModule->bookmarksnumberedCB->isChecked();
+ pdf.bookmarksopen_ = pdfSupportModule->bookmarksopenGB->isChecked();
+ pdf.bookmarksopenlevel_ =
+ fromqstr(pdfSupportModule->bookmarksopenlevelLE->text());
+
+ pdf.breaklinks_ = pdfSupportModule->breaklinksCB->isChecked();
+ pdf.pdfborder_ = pdfSupportModule->pdfborderCB->isChecked();
+ pdf.colorlinks_ = pdfSupportModule->colorlinksCB->isChecked();
+ pdf.backref_ = pdfSupportModule->backrefCB->isChecked();
+ pdf.pagebackref_ = pdfSupportModule->pagebackrefCB->isChecked();
+ if (pdfSupportModule->fullscreenCB->isChecked())
+ pdf.pagemode_ = pdf.pagemode_fullscreen_;
+ pdf.quoted_options_ = fromqstr(pdfSupportModule->optionsLE->text());
+ if (pdf.use_hyperref_ || !pdf.empty())
+ pdf.store_options_ = true;
}
params.footskip, defaultUnit);
branchesModule->update(params);
+
+ // PDF support
+ PDFOptions const & pdf = params.pdfoptions();
+ pdfSupportModule->use_hyperrefCB->setChecked(pdf.use_hyperref_);
+ pdfSupportModule->titleLE->setText(toqstr(pdf.title_));
+ pdfSupportModule->authorLE->setText(toqstr(pdf.author_));
+ pdfSupportModule->subjectLE->setText(toqstr(pdf.subject_));
+ pdfSupportModule->keywordsLE->setText(toqstr(pdf.keywords_));
+
+ pdfSupportModule->bookmarksGB->setChecked(pdf.bookmarks_);
+ pdfSupportModule->bookmarksnumberedCB->setChecked(pdf.bookmarksnumbered_);
+ pdfSupportModule->bookmarksopenGB->setChecked(pdf.bookmarksopen_);
+
+ pdfSupportModule->bookmarksopenlevelLE->setText(
+ toqstr(pdf.bookmarksopenlevel_));
+
+ pdfSupportModule->breaklinksCB->setChecked(pdf.breaklinks_);
+ pdfSupportModule->pdfborderCB->setChecked(pdf.pdfborder_);
+ pdfSupportModule->colorlinksCB->setChecked(pdf.colorlinks_);
+ pdfSupportModule->backrefCB->setChecked(pdf.backref_);
+ pdfSupportModule->pagebackrefCB->setChecked(pdf.pagebackref_);
+ pdfSupportModule->fullscreenCB->setChecked
+ (pdf.pagemode_ == pdf.pagemode_fullscreen_);
+
+ pdfSupportModule->optionsLE->setText(
+ toqstr(pdf.quoted_options_));
}