> More comments: > > > + } else if (token == "\\use_hyperref") { > > + lex >> pdfoptions().use_hyperref; > > + } else if (token == "\\pdf_title") { > > + lex >> pdfoptions().title; > > + } else if (token == "\\pdf_author") { > > + lex >> pdfoptions().author; > > Just a suggestion: in order to keep everything in one place, what > about doing > > } else if (prefixIs(token, "\\pdf_") > pdfoptions().read(token, lex); > > and move the long string of tests to PDFOptions.cpp?
in fact, i'll be more happy to have all the code inside PDFOptions, but i have seen that all other tokens are done there, so didnt want to disturb the logic. i move it now. > > @@ -1176,6 +1223,12 @@ bool BufferParams::writeLaTeX(odocstream & os, > > LaTeXFeatures & features, > > } > > > > os << lyxpreamble; > > + > > + // 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." > > + pdfoptions().writeLatex(os); > > + > > return use_babel; > > } > > This one is wrong: you should find a way to add your code to > lyxpreamble, because as it is you break the line counting (for error > parsing) that is done a few lines above. Something like: didnt know that, now i added a comment and moved the code. look into attachment - is it ok now ? pavel
diff --git a/development/qmake/src/src.pro b/development/qmake/src/src.pro index 2c44a0a..2a5c65c 100644 --- a/development/qmake/src/src.pro +++ b/development/qmake/src/src.pro @@ -69,6 +69,7 @@ HPP += Messages.h HPP += MetricsInfo.h HPP += Mover.h HPP += OutputParams.h +HPP += PDFOptions.h HPP += PSpell.h HPP += ParIterator.h HPP += Paragraph.h @@ -178,6 +179,7 @@ CPP += Messages.cpp CPP += MetricsInfo.cpp CPP += Mover.cpp CPP += OutputParams.cpp +CPP += PDFOptions.cpp #CPP += PSpell.cpp CPP += ParIterator.cpp CPP += Paragraph.cpp diff --git a/development/scons/scons_manifest.py b/development/scons/scons_manifest.py index b7b612b..e52a0a5 100644 --- a/development/scons/scons_manifest.py +++ b/development/scons/scons_manifest.py @@ -92,6 +92,7 @@ src_header_files = Split(''' ModuleList.h Mover.h OutputParams.h + PDFOptions.h PSpell.h ParIterator.h Paragraph.h @@ -201,6 +202,7 @@ src_pre_files = Split(''' MetricsInfo.cpp Mover.cpp OutputParams.cpp + PDFOptions.cpp ParIterator.cpp Paragraph.cpp ParagraphMetrics.cpp diff --git a/lib/CREDITS b/lib/CREDITS index 33544f6..9c6df57 100644 --- a/lib/CREDITS +++ b/lib/CREDITS @@ -240,7 +240,7 @@ Support for kluwer and ijmpd document classes @bSanda Pavel @iE-mail: [EMAIL PROTECTED] !cz - Czech translation + Czech translation, pdf support @bBo Peng @iE-mail: [EMAIL PROTECTED] Conversion of all shell scripts to Python, session, view-source, auto-view features and scons build system. diff --git a/lib/lyx2lyx/lyx_1_6.py b/lib/lyx2lyx/lyx_1_6.py index 84f8ba6..3506b4f 100644 --- a/lib/lyx2lyx/lyx_1_6.py +++ b/lib/lyx2lyx/lyx_1_6.py @@ -178,6 +178,24 @@ def remove_manifest(document): "Remove the manifest section" document.manifest = None +## +# Discard PDF options for hyperref +# + +def revert_pdf_options(document): + "Revert PDF options for hyperref. " + i = 0 + while 1: + i = find_tokens(document.header, [ "\\use_hyperref", "\\pdf_title", "\\pdf_author", "\\pdf_subject", + "\\pdf_keywords", "\\pdf_bookmarks", "\\pdf_bookmarksnumbered", + "\\pdf_bookmarksopen", "\\pdf_bookmarksopenlevel", "\\pdf_breaklinks", + "\\pdf_border", "\\pdf_colorlinks", "\\pdf_backref", "\\pdf_pagebackref", + "\\pdf_fullscreen", "\\pdf_quoted_options", "\\pdf_store_options" ], i) + if i == -1: + return + document.body[i] = "" + i = i + 1 + def remove_inzip_options(document): "Remove inzipName and embed options from the Graphics inset" diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 19d479c..75799f7 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -55,6 +55,7 @@ #include "Undo.h" #include "version.h" #include "EmbeddedFiles.h" +#include "PDFOptions.h" #include "insets/InsetBibitem.h" #include "insets/InsetBibtex.h" @@ -459,6 +460,7 @@ int Buffer::readHeader(Lexer & lex) params().footskip.erase(); params().listings_params.clear(); params().clearLayoutModules(); + params().pdfoptions().clear(); for (int i = 0; i < 4; ++i) { params().user_defined_bullet(i) = ITEMIZE_DEFAULTS[i]; diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 65195e5..62fd7b6 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -37,6 +37,7 @@ #include "Spacing.h" #include "TexRow.h" #include "VSpace.h" +#include "PDFOptions.h" #include "frontends/alert.h" #include "insets/InsetListingsParams.h" @@ -44,6 +45,7 @@ #include "support/convert.h" #include "support/filetools.h" #include "support/Translator.h" +#include "support/lstrings.h" #include <boost/array.hpp> @@ -63,6 +65,7 @@ using lyx::support::libFileSearch; using lyx::support::bformat; using lyx::support::rtrim; using lyx::support::tokenPos; +using lyx::support::prefixIs; static char const * const string_paragraph_separation[] = { @@ -290,6 +293,7 @@ public: * and for detached paragraphs in "indented" documents. */ VSpace defskip; + PDFOptions pdfoptions; }; @@ -435,6 +439,16 @@ Spacing const & BufferParams::spacing() const return pimpl_->spacing; } +PDFOptions & BufferParams::pdfoptions() +{ + return pimpl_->pdfoptions; +} + + +PDFOptions const & BufferParams::pdfoptions() const +{ + return pimpl_->pdfoptions; +} VSpace const & BufferParams::getDefSkip() const { @@ -633,6 +647,15 @@ string const BufferParams::readToken(Lexer & lex, string const & token) 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; @@ -694,6 +717,7 @@ void BufferParams::writeFile(ostream & os) const os << "\\paperfontsize " << fontsize << '\n'; spacing().writeFile(os); + pdfoptions().writeFile(os); os << "\\papersize " << string_papersize[papersize] << "\n\\use_geometry " << convert<string>(use_geometry) @@ -1167,6 +1191,14 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, 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 = diff --git a/src/BufferParams.h b/src/BufferParams.h index 4ded0b7..bbcfba7 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -40,6 +40,7 @@ class Spacing; class TexRow; class VSpace; class Language; +class PDFOptions; /** Buffer parameters. * This class contains all the parameters for this buffer's use. Some @@ -290,6 +291,10 @@ public: /// void setCiteEngine(biblio::CiteEngine const); + /// options for pdf output + PDFOptions & pdfoptions(); + PDFOptions const & pdfoptions() const; + private: /// void readPreamble(Lexer &); diff --git a/src/Makefile.am b/src/Makefile.am index bf1af93..0f30115 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -233,6 +233,8 @@ liblyxcore_la_SOURCES = \ ParagraphParameters.h \ ParIterator.cpp \ ParIterator.h \ + PDFOptions.cpp \ + PDFOptions.h \ Row.cpp \ Row.h \ rowpainter.cpp \ diff --git a/src/PDFOptions.cpp b/src/PDFOptions.cpp new file mode 100644 index 0000000..3694815 --- /dev/null +++ b/src/PDFOptions.cpp @@ -0,0 +1,201 @@ +/** + * \file PDFoptions.cpp + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Pavel Sanda + * + * Full author contact details are available in file CREDITS. + */ + + +#include "PDFOptions.h" + +#include "support/convert.h" + +#include <sstream> +#include <string> +#include "support/lstrings.h" +#include "Lexer.h" + + +namespace lyx { + + +using std::ostream; +using std::ostringstream; +using std::string; + +const string PDFOptions::pagemode_fullscreen("FullScreen"); + +bool PDFOptions::empty() const +{ + return + author.empty() && + title.empty() && + subject.empty() && + keywords.empty()&& + pagemode.empty()&& + bookmarksopenlevel.empty() && + quoted_options.empty(); +} + +void PDFOptions::writeFile(ostream & os) const +{ + os << "\\use_hyperref " << convert<string>(use_hyperref) << '\n'; + os << "\\pdf_store_options " << convert<string>(store_options) << '\n'; + if (!use_hyperref && !store_options) return; + + if (!title.empty() ) + os << "\\pdf_title \"" << title << "\"\n"; + if (!author.empty()) + os << "\\pdf_author \"" << author << "\"\n"; + if (!subject.empty()) + os << "\\pdf_subject \""<< subject << "\"\n"; + if (!keywords.empty()) + os << "\\pdf_keywords \""<< keywords << "\"\n"; + + + os << "\\pdf_bookmarks " << convert<string>(bookmarks) << '\n'; + os << "\\pdf_bookmarksnumbered " << convert<string>(bookmarksnumbered) << '\n'; + os << "\\pdf_bookmarksopen " << convert<string>(bookmarksopen) << '\n'; + if (bookmarksopenlevel.empty()) + os << "\\pdf_bookmarksopenlevel \"" << bookmarksopenlevel << "\"\n"; + + os << "\\pdf_breaklinks " << convert<string>(breaklinks) << '\n'; + os << "\\pdf_pdfborder " << convert<string>(pdfborder) << '\n'; + os << "\\pdf_colorlinks " << convert<string>(colorlinks) << '\n'; + os << "\\pdf_backref " << convert<string>(backref) << '\n'; + os << "\\pdf_pagebackref " << convert<string>(pagebackref) << '\n'; + + if (!pagemode.empty()) + os << "\\pdf_pagemode " << pagemode << '\n'; + + if (!quoted_options.empty()) + os << "\\pdf_quoted_options \"" << quoted_options << "\"\n"; + +} + +void PDFOptions::writeLaTeX(odocstream &os) const +{ + if (!use_hyperref) return ; + + string opt; + + opt = "\\usepackage["; + if (!title.empty()) + opt += "pdftitle={" + title + "},\n"; + if (!author.empty()) + opt += "pdfauthor={" + author + "},\n"; + if (!subject.empty()) + opt += "pdfsubject={" + subject + "},\n"; + if (!keywords.empty()) + opt += "pdfkeywords={" + keywords + "},\n"; + + opt += "bookmarks=" + convert<string>(bookmarks) + ','; + if (bookmarks) { + opt += "bookmarksnumbered=" + + convert<string>(bookmarksnumbered) + ','; + opt += "bookmarksopen=" + + convert<string>(bookmarksopen) + ','; + + if (bookmarksopen && !bookmarksopenlevel.empty()) + opt += "bookmarksopennumbered=" + + bookmarksopenlevel + ','; + } + + opt += "breaklinks=" + convert<string>(breaklinks) + ','; + + opt += "pdfborder={0 0 " ; + opt += (pdfborder ?'1':'0'); + opt += "},\n"; + + opt += "colorlinks=" + convert<string>(colorlinks) + ','; + opt += "backref=" + convert<string>(backref) + ','; + opt += "pagebackref=" + convert<string>(pagebackref) + ','; + + if (!pagemode.empty()) + opt += "pdfpagemode=" + pagemode + ','; + opt += quoted_options_get(); + + opt = support::rtrim(opt,","); + opt += "]{hyperref}\n"; + + // FIXME UNICODE + os << from_utf8(opt); +} + +string PDFOptions::readToken(Lexer &lex, string const & token) +{ + if (token == "\\use_hyperref") { + lex >> use_hyperref; + } else if (token == "\\pdf_title") { + lex >> title; + } else if (token == "\\pdf_author") { + lex >> author; + } else if (token == "\\pdf_subject") { + lex >> subject; + } else if (token == "\\pdf_keywords") { + lex >> keywords; + } else if (token == "\\pdf_bookmarks") { + lex >> bookmarks; + } else if (token == "\\pdf_bookmarksnumbered") { + lex >> bookmarksnumbered; + } else if (token == "\\pdf_bookmarksopen") { + lex >> bookmarksopenlevel; + } else if (token == "\\pdf_bookmarksopenlevel") { + lex >> bookmarksopenlevel; + } else if (token == "\\pdf_breaklinks") { + lex >> breaklinks; + } else if (token == "\\pdf_pdfborder") { + lex >> pdfborder; + } else if (token == "\\pdf_colorlinks") { + lex >> colorlinks; + } else if (token == "\\pdf_backref") { + lex >> backref; + } else if (token == "\\pdf_pagebackref") { + lex >> pagebackref; + } else if (token == "\\pdf_pagemode") { + lex >> pagemode; + } else if (token == "\\pdf_quoted_options") { + lex >> quoted_options; + } else if (token == "\\pdf_store_options") { + lex >> store_options; + } else { + return token; + } + + return string(); + +} + +//prepared for check +string PDFOptions::quoted_options_get() const +{ + return quoted_options; +} + +// Keep implicit hyperref settings +void PDFOptions::clear() +{ + use_hyperref = false; + title.clear(); + author.clear(); + subject.clear(); + keywords.clear(); + bookmarks = true; + bookmarksnumbered = false; + bookmarksopen = false; + bookmarksopenlevel.clear(); + breaklinks = false; + pdfborder = false; + colorlinks = false; + backref = false; + pagebackref = false; + pagemode.clear(); + quoted_options.clear(); + store_options = false; + +} + +} // namespace lyx diff --git a/src/PDFOptions.h b/src/PDFOptions.h new file mode 100644 index 0000000..374beaa --- /dev/null +++ b/src/PDFOptions.h @@ -0,0 +1,136 @@ +// -*- C++ -*- +/** + * \file src/PDFOptions.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Pavel Sanda + * + * Full author contact details are available in file CREDITS. + */ + +#ifndef PDFOPTIONS_H +#define PDFOPTIONS_H + + +#include <string> +#include <debug.h> +#include "support/docstream.h" + +using std::string; + +namespace lyx { + +class Lexer; + +/// Options for PDF generation +class PDFOptions { +public: + PDFOptions() { clear(); } + /// + bool use_hyperref; + /// + string title; + /// + string author; + /// + string subject; + /// + string keywords; + /*! + * A set of Acrobat bookmarks are written, in a manner similar to the table of contents. + * bookmarks boolean true + */ + bool bookmarks; + /*! + * If Acrobat bookmarks are requested, include section numbers. + * bookmarksnumbered boolean false + */ + bool bookmarksnumbered; + /*! + * If Acrobat bookmarks are requested, show them with all the subtrees expanded. + * bookmarksopen boolean false + */ + bool bookmarksopen; + /*! + * Level (\maxdimen) to which bookmarks are open + * bookmarksopenlevel parameter + */ + string bookmarksopenlevel; + /*! + * Allows link text to break across lines. + * breaklinks boolean false + */ + bool breaklinks; + /*! + * The style of box around links; defaults to a box with lines of 1pt thickness, + * but the colorlinks option resets it to produce no border. + * pdfborder "0 0 1" / "0 0 0" + * Note that the color of link borders can be specified only as 3 numbers in the + * range 0..1, giving an RGB color. You cannot use colors defined in TEX. + * + * We represent here only the last bit, there is no semantics in the first two. + * Morover the aim is not to represent the whole pdfborder, but just to deny + * the ugly boxes around pdf links. + */ + bool pdfborder; + /*! + * colorlinks boolean false + */ + bool colorlinks; + /*! + * Adds backlink text to the end of each item in the bibliography, as a list of section numbers. + * This can only work properly if there is a blank line after each \bibitem. + * backref boolean false + */ + bool backref; + /*! + * Adds backlink text to the end of each item in the bibliography, as a list of page numbers. + * pagebackref boolean false + */ + bool pagebackref; + /*! + * Determines how the file is opening in Acrobat; + * the possibilities are None, UseThumbs (show thumbnails), UseOutlines (show bookmarks), and FullScreen. + * If no mode if explicitly chosen, but the bookmarks option is set, UseOutlines is used. + * pagemode text empty + * + * We currently implement only FullScreen, but all modes can be saved here, + * lyx format & latex writer is prepared. + * The only thing needed in such a case is wider Settings dialog -> PDFOptions.pagemode . + */ + string pagemode; + ///latex string + static const string pagemode_fullscreen; + /*! + * Additional parameters for hyperref given from user. + */ + string quoted_options; + /*! + * Possible syntax check of users additional parameters here. + */ + string quoted_options_get() const; + + + /*! + * Flag indicating whether user made some input into PDF preferences. + * We want to save options, when user decide to switch off PDF support for a while. + */ + bool store_options; + /// check for string settings + bool empty() const; + /// output to lyx header + void writeFile(std::ostream &) const; + /// output to tex header + void writeLaTeX(odocstream &) const; + /// read tokens from lyx header + string readToken(Lexer &lex, string const & token); + /// keep implicit hyperref settings + void clear(); + +}; + +} // namespace lyx + + +#endif // SPACING_H diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 7b3e9e2..d2978be 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -32,6 +32,7 @@ #include "LyXRC.h" // defaultUnit #include "TextClassList.h" #include "Spacing.h" +#include "PDFOptions.h" #include "insets/InsetListingsParams.h" @@ -612,6 +613,41 @@ GuiDocumentDialog::GuiDocumentDialog(LyXView & lv) 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; @@ -626,6 +662,7 @@ GuiDocumentDialog::GuiDocumentDialog(LyXView & lv) 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")); @@ -1196,6 +1233,34 @@ void GuiDocumentDialog::apply(BufferParams & params) params.footskip = widgetsToLength(m->footskipLE, m->footskipUnit); branchesModule->apply(params); + + // PDF support + params.pdfoptions().use_hyperref = pdfSupportModule->use_hyperrefCB->isChecked(); + params.pdfoptions().title = + fromqstr(pdfSupportModule->titleLE->text()); + params.pdfoptions().author = + fromqstr(pdfSupportModule->authorLE->text()); + params.pdfoptions().subject = + fromqstr(pdfSupportModule->subjectLE->text()); + params.pdfoptions().keywords = + fromqstr(pdfSupportModule->keywordsLE->text()); + + params.pdfoptions().bookmarks = pdfSupportModule->bookmarksGB->isChecked(); + params.pdfoptions().bookmarksnumbered = pdfSupportModule->bookmarksnumberedCB->isChecked(); + params.pdfoptions().bookmarksopen = pdfSupportModule->bookmarksopenGB->isChecked(); + params.pdfoptions().bookmarksopenlevel = + fromqstr(pdfSupportModule->bookmarksopenlevelLE->text()); + + params.pdfoptions().breaklinks = pdfSupportModule->breaklinksCB->isChecked(); + params.pdfoptions().pdfborder = pdfSupportModule->pdfborderCB->isChecked(); + params.pdfoptions().colorlinks = pdfSupportModule->colorlinksCB->isChecked(); + params.pdfoptions().backref = pdfSupportModule->backrefCB->isChecked(); + params.pdfoptions().pagebackref = pdfSupportModule->pagebackrefCB->isChecked(); + if (pdfSupportModule->fullscreenCB->isChecked()) + params.pdfoptions().pagemode = PDFOptions::pagemode_fullscreen; + params.pdfoptions().quoted_options = + fromqstr(pdfSupportModule->optionsLE->text()); + if (params.pdfoptions().use_hyperref || !params.pdfoptions().empty()) params.pdfoptions().store_options=true; } @@ -1477,6 +1542,37 @@ void GuiDocumentDialog::updateParams(BufferParams const & params) params.footskip, defaultUnit); branchesModule->update(params); + + // PDF support + pdfSupportModule->use_hyperrefCB->setChecked(params.pdfoptions().use_hyperref); + pdfSupportModule->titleLE->setText( + toqstr(params.pdfoptions().title)); + + pdfSupportModule->authorLE->setText( + toqstr(params.pdfoptions().author)); + + pdfSupportModule->subjectLE->setText( + toqstr(params.pdfoptions().subject)); + + pdfSupportModule->keywordsLE->setText( + toqstr(params.pdfoptions().keywords)); + + pdfSupportModule->bookmarksGB->setChecked(params.pdfoptions().bookmarks); + pdfSupportModule->bookmarksnumberedCB->setChecked(params.pdfoptions().bookmarksnumbered); + pdfSupportModule->bookmarksopenGB->setChecked(params.pdfoptions().bookmarksopen); + + pdfSupportModule->bookmarksopenlevelLE->setText( + toqstr(params.pdfoptions().bookmarksopenlevel)); + + pdfSupportModule->breaklinksCB->setChecked(params.pdfoptions().breaklinks); + pdfSupportModule->pdfborderCB->setChecked(params.pdfoptions().pdfborder); + pdfSupportModule->colorlinksCB->setChecked(params.pdfoptions().colorlinks); + pdfSupportModule->backrefCB->setChecked(params.pdfoptions().backref); + pdfSupportModule->pagebackrefCB->setChecked(params.pdfoptions().pagebackref); + pdfSupportModule->fullscreenCB->setChecked(params.pdfoptions().pagemode==PDFOptions::pagemode_fullscreen); + + pdfSupportModule->optionsLE->setText( + toqstr(params.pdfoptions().quoted_options)); } diff --git a/src/frontends/qt4/GuiDocument.h b/src/frontends/qt4/GuiDocument.h index bd70aad..6587715 100644 --- a/src/frontends/qt4/GuiDocument.h +++ b/src/frontends/qt4/GuiDocument.h @@ -29,6 +29,7 @@ #include "ui_NumberingUi.h" #include "ui_MarginsUi.h" #include "ui_PreambleUi.h" +#include "ui_PDFSupportUi.h" #include <QDialog> #include <QStringList> @@ -106,6 +107,7 @@ private: UiWidget<Ui::BiblioUi> *biblioModule; UiWidget<Ui::MathsUi> *mathsModule; UiWidget<Ui::LaTeXUi> *latexModule; + UiWidget<Ui::PDFSupportUi> *pdfSupportModule; PreambleModule *preambleModule; GuiBranches *branchesModule; diff --git a/src/frontends/qt4/Makefile.am b/src/frontends/qt4/Makefile.am index 6b3d7bc..e073f62 100644 --- a/src/frontends/qt4/Makefile.am +++ b/src/frontends/qt4/Makefile.am @@ -235,6 +235,7 @@ UIFILES = \ NumberingUi.ui \ PageLayoutUi.ui \ ParagraphUi.ui \ + PDFSupportUi.ui \ PreambleUi.ui \ PrefColorsUi.ui \ PrefConvertersUi.ui \ diff --git a/src/frontends/qt4/ui/PDFSupportUi.ui b/src/frontends/qt4/ui/PDFSupportUi.ui new file mode 100644 index 0000000..95be47b --- /dev/null +++ b/src/frontends/qt4/ui/PDFSupportUi.ui @@ -0,0 +1,407 @@ +<ui version="4.0" > + <class>PDFSupportUi</class> + <widget class="QWidget" name="PDFSupportUi" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>502</width> + <height>417</height> + </rect> + </property> + <widget class="QCheckBox" name="use_hyperrefCB" > + <property name="geometry" > + <rect> + <x>10</x> + <y>0</y> + <width>141</width> + <height>21</height> + </rect> + </property> + <property name="toolTip" > + <string>Enable clickable crossreferences and header informations</string> + </property> + <property name="text" > + <string>&Use hyperref support</string> + </property> + </widget> + <widget class="QCheckBox" name="fullscreenCB" > + <property name="geometry" > + <rect> + <x>14</x> + <y>310</y> + <width>161</width> + <height>21</height> + </rect> + </property> + <property name="toolTip" > + <string>Enable fullscreen PDF presentation</string> + </property> + <property name="text" > + <string>Load in &fullscreen mode</string> + </property> + </widget> + <widget class="QGroupBox" name="bookmarksGB" > + <property name="geometry" > + <rect> + <x>11</x> + <y>191</y> + <width>201</width> + <height>107</height> + </rect> + </property> + <property name="title" > + <string>Generate Bookmarks</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>true</bool> + </property> + <widget class="QCheckBox" name="bookmarksnumberedCB" > + <property name="geometry" > + <rect> + <x>10</x> + <y>19</y> + <width>151</width> + <height>21</height> + </rect> + </property> + <property name="text" > + <string>Numbered bookmarks</string> + </property> + </widget> + <widget class="QGroupBox" name="bookmarksopenGB" > + <property name="geometry" > + <rect> + <x>11</x> + <y>46</y> + <width>181</width> + <height>51</height> + </rect> + </property> + <property name="title" > + <string>Open bookmarks</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>false</bool> + </property> + <widget class="QLineEdit" name="bookmarksopenlevelLE" > + <property name="geometry" > + <rect> + <x>60</x> + <y>19</y> + <width>101</width> + <height>22</height> + </rect> + </property> + <property name="toolTip" > + <string>Number of levels</string> + </property> + </widget> + <widget class="QLabel" name="label" > + <property name="geometry" > + <rect> + <x>21</x> + <y>22</y> + <width>31</width> + <height>16</height> + </rect> + </property> + <property name="text" > + <string>&Level:</string> + </property> + <property name="buddy" > + <cstring>bookmarksopenlevelLE</cstring> + </property> + </widget> + </widget> + </widget> + <widget class="QGroupBox" name="groupBox_2" > + <property name="geometry" > + <rect> + <x>11</x> + <y>34</y> + <width>431</width> + <height>141</height> + </rect> + </property> + <property name="title" > + <string>Header Information</string> + </property> + <widget class="QLineEdit" name="titleLE" > + <property name="geometry" > + <rect> + <x>70</x> + <y>19</y> + <width>351</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QLineEdit" name="authorLE" > + <property name="geometry" > + <rect> + <x>70</x> + <y>49</y> + <width>351</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QLineEdit" name="subjectLE" > + <property name="geometry" > + <rect> + <x>70</x> + <y>79</y> + <width>351</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QLabel" name="keywordsL" > + <property name="geometry" > + <rect> + <x>8</x> + <y>113</y> + <width>71</width> + <height>16</height> + </rect> + </property> + <property name="text" > + <string>&Keywords:</string> + </property> + <property name="buddy" > + <cstring>keywordsLE</cstring> + </property> + </widget> + <widget class="QLabel" name="subjectL" > + <property name="geometry" > + <rect> + <x>8</x> + <y>83</y> + <width>52</width> + <height>16</height> + </rect> + </property> + <property name="text" > + <string>&Subject:</string> + </property> + <property name="buddy" > + <cstring>subjectLE</cstring> + </property> + </widget> + <widget class="QLabel" name="authorL" > + <property name="geometry" > + <rect> + <x>8</x> + <y>53</y> + <width>52</width> + <height>16</height> + </rect> + </property> + <property name="text" > + <string>&Author:</string> + </property> + <property name="buddy" > + <cstring>authorLE</cstring> + </property> + </widget> + <widget class="QLabel" name="titleL" > + <property name="geometry" > + <rect> + <x>8</x> + <y>23</y> + <width>52</width> + <height>16</height> + </rect> + </property> + <property name="text" > + <string>&Title:</string> + </property> + <property name="buddy" > + <cstring>titleLE</cstring> + </property> + </widget> + </widget> + <widget class="QGroupBox" name="groupBox_3" > + <property name="geometry" > + <rect> + <x>10</x> + <y>360</y> + <width>431</width> + <height>51</height> + </rect> + </property> + <property name="title" > + <string>Additional o&ptions for hyperref</string> + </property> + <property name="flat" > + <bool>true</bool> + </property> + <property name="checkable" > + <bool>false</bool> + </property> + <property name="checked" > + <bool>false</bool> + </property> + <widget class="QLineEdit" name="optionsLE" > + <property name="geometry" > + <rect> + <x>10</x> + <y>20</y> + <width>421</width> + <height>22</height> + </rect> + </property> + <property name="toolTip" > + <string>eg: pdfstartview=XYZ, plainpages=false, pdfpagelabels</string> + </property> + </widget> + </widget> + <widget class="QLineEdit" name="keywordsLE" > + <property name="geometry" > + <rect> + <x>81</x> + <y>144</y> + <width>351</width> + <height>22</height> + </rect> + </property> + </widget> + <widget class="QGroupBox" name="groupBox_4" > + <property name="geometry" > + <rect> + <x>221</x> + <y>191</y> + <width>221</width> + <height>131</height> + </rect> + </property> + <property name="title" > + <string>Links</string> + </property> + <widget class="QCheckBox" name="pdfborderCB" > + <property name="geometry" > + <rect> + <x>10</x> + <y>39</y> + <width>151</width> + <height>21</height> + </rect> + </property> + <property name="text" > + <string>No frames around links</string> + </property> + <property name="tristate" > + <bool>false</bool> + </property> + </widget> + <widget class="QCheckBox" name="pagebackrefCB" > + <property name="geometry" > + <rect> + <x>10</x> + <y>99</y> + <width>201</width> + <height>21</height> + </rect> + </property> + <property name="toolTip" > + <string>Adds "backlink" text to the end of each item in the bibliography</string> + </property> + <property name="text" > + <string>Backreference by pa&ge number</string> + </property> + </widget> + <widget class="QCheckBox" name="backrefCB" > + <property name="geometry" > + <rect> + <x>10</x> + <y>79</y> + <width>201</width> + <height>21</height> + </rect> + </property> + <property name="toolTip" > + <string>Adds "backlink" text to the end of each item in the bibliography</string> + </property> + <property name="text" > + <string>&Bibliographical backreferences</string> + </property> + </widget> + <widget class="QCheckBox" name="breaklinksCB" > + <property name="geometry" > + <rect> + <x>10</x> + <y>19</y> + <width>141</width> + <height>21</height> + </rect> + </property> + <property name="toolTip" > + <string>Allows link text to break across lines.</string> + </property> + <property name="text" > + <string>Break links over lines</string> + </property> + </widget> + <widget class="QCheckBox" name="colorlinksCB" > + <property name="geometry" > + <rect> + <x>10</x> + <y>59</y> + <width>81</width> + <height>21</height> + </rect> + </property> + <property name="text" > + <string>Color links</string> + </property> + </widget> + </widget> + </widget> + <tabstops> + <tabstop>use_hyperrefCB</tabstop> + <tabstop>titleLE</tabstop> + <tabstop>authorLE</tabstop> + <tabstop>subjectLE</tabstop> + <tabstop>keywordsLE</tabstop> + <tabstop>bookmarksGB</tabstop> + <tabstop>bookmarksnumberedCB</tabstop> + <tabstop>bookmarksopenGB</tabstop> + <tabstop>bookmarksopenlevelLE</tabstop> + <tabstop>optionsLE</tabstop> + <tabstop>breaklinksCB</tabstop> + <tabstop>pdfborderCB</tabstop> + <tabstop>colorlinksCB</tabstop> + <tabstop>backrefCB</tabstop> + <tabstop>pagebackrefCB</tabstop> + <tabstop>fullscreenCB</tabstop> + </tabstops> + <includes> + <include location="local" >qt_helpers.h</include> + </includes> + <resources/> + <connections/> + <designerdata> + <property name="gridDeltaX" > + <number>2</number> + </property> + <property name="gridDeltaY" > + <number>2</number> + </property> + <property name="gridSnapX" > + <bool>true</bool> + </property> + <property name="gridSnapY" > + <bool>true</bool> + </property> + <property name="gridVisible" > + <bool>false</bool> + </property> + </designerdata> +</ui> diff --git a/src/frontends/qt4/ui/compile_uic.sh b/src/frontends/qt4/ui/compile_uic.sh index 30e3ba6..0965774 100644 --- a/src/frontends/qt4/ui/compile_uic.sh +++ b/src/frontends/qt4/ui/compile_uic.sh @@ -6,6 +6,7 @@ uic BibtexAddUi.ui -o BibtexAddUi.h uic BibtexUi.ui -o BibtexUi.h uic BoxUi.ui -o BoxUi.h uic BranchesUi.ui -o BranchesUi.h +uic PDFSupportUi.ui -o PDFSupportUi.h uic BranchUi.ui -o BranchUi.h uic ChangesUi.ui -o ChangesUi.h uic CharacterUi.ui -o CharacterUi.h @@ -48,7 +49,7 @@ uic PrefSpellcheckerUi.ui -o PrefSpellcheckerUi.h uic PrefsUi.ui -o PrefsUi.h uic PrefUi.ui -o PrefUi.h uic PrintUi.ui -o PrintUi.h -uic reambleUi.ui -o PreambleUi.h +uic PreambleUi.ui -o PreambleUi.h uic RefUi.ui -o RefUi.h uic SearchUi.ui -o SearchUi.h uic SendtoUi.ui -o SendtoUi.h @@ -60,7 +61,7 @@ uic TexinfoUi.ui -o TexinfoUi.h uic TextLayoutUi.ui -o TextLayoutUi.h uic ThesaurusUi.ui -o ThesaurusUi.h uic TocUi.ui -o TocUi.h -uic ulletsUi.ui -o BulletsUi.h +uic BulletsUi.ui -o BulletsUi.h uic URLUi.ui -o URLUi.h uic VSpaceUi.ui -o VSpaceUi.h uic WrapUi.ui -o WrapUi.h diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index 0995a7a..e505e4a 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -23,7 +23,6 @@ #include "CoordCache.h" #include "Cursor.h" #include "debug.h" -#include "debug.h" #include "Dimension.h" #include "DispatchResult.h" #include "FuncRequest.h"