hi,
this is iteration #2. i guess that #3 will be needed still :)
any comments to code welcomed. i have tested it on the few cases
i usually use and seems to work.
sum of TODOS & screenshot added to wiki:
http://wiki.lyx.org/Devel/PDFSupport
TODOs & (my) questions
- does the ending ',' in \usepackage[options,]{hyperref} break latex syntax
(latex seems no problem with that) ?
- backref - Manual:This can only work properly if there is a blank line after
each \bibitem.
is this fulfiled in our output ? i currently have no doc using this to check...
- what can be done with encoded characters in title, authors etc.
- lyx2lyx has to be checked, binding to file format needed.
>I have a quick look at the patch, and have one question though: why do
>you use separate file for PDFOptions.h|cpp? I guess it can be merged
>to BufferParams.
i dont see any other class defined in BufferParams.h, and it seems
that many files around include this file, so the smaller the better;
the PDFOptions.h header is also bigger now. If you still think
its better to merge, i will do it.
>I guess I also want 'fullscreen' mode for presentation.
done
>Probably there should just be a "use hyperref" checkbox to turn this on
>and off. You could then check that and get basic hyperref support
>without actually having to fill out any of the fields. That is: You'd
done.
>just get \usepackage{hyperref}. As for other checkboxes, we should have
>ones for backref and pagebackref, etc.
done
>And if you're working on this....the URL inset should become an \href
>inset. (There are a billion bugs about this.) This would be very easy to
>do, and it's probably what people really want from hyperref.
i fear this will bring many troubles and i rather wont touch it.
so adding to TODO section in wiki.
> 2. This page should be put before preamble, which means the *last* and
> ultimate method of customization. I am thinking of "Document
> Properties" after "Document class" or "Hyperref Support" after
> Bibliography.
done
> 3. pagebackref, pageref, bookmark etc should be more verbal.
done
>>1. "PDF support" may not be the best name. I am thinking of "Document
>>Properties", but "Hyperref Support" may be clearer.
>> > 1. "PDF support" may not be the best name. I am thinking of "Document
>> > Properties", but "Hyperref Support" may be clearer.
>>
>> users with a little knowledge of latex will not understand Hyperref Support.
>> Document Properties is too general. we can change the naming, but still
>> i think that the keyword "pdf" should be incorporated somehow.
>PDF Properties?
done
>- bookmarksopen opens all bookmark levels, what is missing is a box to
>adjust the level number. This box should only be activated when
>bookmarksopen is checked, because otherwise the level has no effect
done
>- hyperref creates by default thin red frames around every link. Nobody
>really likes this, see various questions about this in the comp.text.tex
>usegroup. To avoid the frames, you can set it to a zero width using the
>option "pdfborder={0 0 0}". So there should be an option "no frames around
>links" that does this.
done
>When LyX creates latex code, you know if it is creating for
>pdflatex or plain latex. So you can generate different latex code for
>these two cases. Assume that "latex" code may hit ps2pdf, while
>"pdflatex" code will not.
TODO in case we encounter problems.
i expect we will ;)
(add them also to wiki plz in such a case)
>Hyperref has some known incompatibilites, for example
>the "language in section heading" problem I describe in bug 3527.
>Using the \textorpdfstring construct as described shouldn't be that hard.
TODO
> This is how I use hyperref currently:
> \usepackage[breaklinks=true,colorlinks=true,bookmarks=true,
> bookmarksopen=true,bookmarksnumbered=true]{hyperref}
>
> So obviously I'll find it nice if these options are supported,
> possibly in the form of checkboxes. Ability to set the link colors
> would be nice also.
done
>Options like pdftitle, pdfauthor and pdflang can probably be set
>automatic from title, author and the document language.
TODO
>Another way is to just have the most interesting options, and
>a text entry field for the rest. Much cleaner, but with the
already done.
>Some simple syntex checking can be done, it seems that these
>options always is a comma-separated list of key=value pairs,
>with the value possibly containing balanced braces.
added some example in tooltip. imho if somebody enters wrong options,
its should be his responsibility, not lyx.
however, i added simple interface for check (but it currently does nothing),
so anybody is free to change it :)
pavel
diff --git a/lib/lyx2lyx/lyx_1_6.py b/lib/lyx2lyx/lyx_1_6.py
index 30c3421..848f1a3 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
+
##
# Conversion hub
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 9115877..60abd48 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 e566cdd..2d297e2 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"
@@ -290,6 +291,7 @@ public:
* and for detached paragraphs in "indented" documents.
*/
VSpace defskip;
+ PDFOptions pdfoptions;
};
@@ -435,6 +437,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 +645,40 @@ 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 (token == "\\use_hyperref") {
+ lex >> pdfoptions().use_hyperref;
+ } else if (token == "\\pdf_title") {
+ lex >> pdfoptions().title;
+ } else if (token == "\\pdf_author") {
+ lex >> pdfoptions().author;
+ } else if (token == "\\pdf_subject") {
+ lex >> pdfoptions().subject;
+ } else if (token == "\\pdf_keywords") {
+ lex >> pdfoptions().keywords;
+ } else if (token == "\\pdf_bookmarks") {
+ lex >> pdfoptions().bookmarks;
+ } else if (token == "\\pdf_bookmarksnumbered") {
+ lex >> pdfoptions().bookmarksnumbered;
+ } else if (token == "\\pdf_bookmarksopen") {
+ lex >> pdfoptions().bookmarksopenlevel;
+ } else if (token == "\\pdf_bookmarksopenlevel") {
+ lex >> pdfoptions().bookmarksopenlevel;
+ } else if (token == "\\pdf_breaklinks") {
+ lex >> pdfoptions().breaklinks;
+ } else if (token == "\\pdf_pdfborder") {
+ lex >> pdfoptions().pdfborder;
+ } else if (token == "\\pdf_colorlinks") {
+ lex >> pdfoptions().colorlinks;
+ } else if (token == "\\pdf_backref") {
+ lex >> pdfoptions().backref;
+ } else if (token == "\\pdf_pagebackref") {
+ lex >> pdfoptions().pagebackref;
+ } else if (token == "\\pdf_pagemode") {
+ lex >> pdfoptions().pagemode;
+ } else if (token == "\\pdf_quoted_options") {
+ lex >> pdfoptions().quoted_options;
+ } else if (token == "\\pdf_store_options") {
+ lex >> pdfoptions().store_options;
} else {
lyxerr << "BufferParams::readToken(): Unknown token: " <<
token << endl;
@@ -694,6 +740,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)
@@ -939,6 +986,7 @@ bool BufferParams::writeLaTeX(odocstream & os,
LaTeXFeatures & features,
os << "}\n";
texrow.newline();
}
+
if (use_geometry || nonstandard_papersize) {
os << "\\usepackage{geometry}\n";
texrow.newline();
@@ -1123,6 +1171,52 @@ bool BufferParams::writeLaTeX(odocstream & os,
LaTeXFeatures & features,
+ from_utf8(preamble) + '\n';
}
+ // PDF support. 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."
+ //TODO does the ending ',' hurt ?
+ if (pdfoptions().use_hyperref) {
+ os << "\\usepackage[\n";
+ if (!pdfoptions().title.empty())
+ os << "pdftitle={" << from_utf8(pdfoptions().title) <<
"},\n";
+ if (!pdfoptions().author.empty())
+ os << "pdfauthor={" << from_utf8(pdfoptions().author)
<< "},\n";
+ if (!pdfoptions().subject.empty())
+ os << "pdfsubject={" << from_utf8(pdfoptions().subject)
<< "},\n";
+ if (!pdfoptions().keywords.empty())
+ os << "pdfkeywords={" <<
from_utf8(pdfoptions().keywords) << "},\n";
+
+ os << "bookmarks=" <<
+ from_utf8(convert<string>(pdfoptions().bookmarks)) <<
',';
+ if (pdfoptions().bookmarks) {
+ os << "bookmarksnumbered=" <<
+
from_utf8(convert<string>(pdfoptions().bookmarksnumbered)) << ',';
+ os << "bookmarksopen=" <<
+
from_utf8(convert<string>(pdfoptions().bookmarksopen)) << ',';
+
+ if (pdfoptions().bookmarksopen &&
!pdfoptions().bookmarksopenlevel.empty())
+ os << "bookmarksopennumbered=" <<
+
from_utf8(pdfoptions().bookmarksopenlevel) << ',';
+ }
+
+ os << "breaklinks=" <<
+ from_utf8(convert<string>(pdfoptions().breaklinks)) <<
',';
+ os << "pdfborder={0 0 " <<
+ pdfoptions().pdfborder << "},\n";
+ os << "colorlinks=" <<
+ from_utf8(convert<string>(pdfoptions().colorlinks)) <<
',';
+ os << "backref=" <<
+ from_utf8(convert<string>(pdfoptions().backref)) << ',';
+ os << "pagebackref=" <<
+ from_utf8(convert<string>(pdfoptions().pagebackref)) <<
',';
+
+ if (!pdfoptions().pagemode.empty())
+ os << "pdfpagemode=" <<
from_utf8(pdfoptions().pagemode) << ',';
+ os << from_utf8(pdfoptions().quoted_options_get());
+
+ os << "]{hyperref}";
+ }
+
// Itemize bullet settings need to be last in case the user
// defines their own bullets that use a package included
// in the user-defined preamble -- ARRae
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..2faf987
--- /dev/null
+++ b/src/PDFOptions.cpp
@@ -0,0 +1,94 @@
+#include "PDFOptions.h"
+
+#include "support/convert.h"
+
+#include <sstream>
+#include <string>
+
+
+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";
+
+}
+
+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..a2fed42
--- /dev/null
+++ b/src/PDFOptions.h
@@ -0,0 +1,120 @@
+#ifndef PDFOPTIONS_H
+#define PDFOPTIONS_H
+
+
+#include <string>
+#include <debug.h>
+
+using std::string;
+
+namespace lyx {
+
+/// 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.
+ TODO
^^^^^^^^^^
+ Is this
fulfiled ?
+ * 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;
+ ///
+ void clear();
+
+};
+
+} // namespace lyx
+
+
+#endif // SPACING_H
diff --git a/src/frontends/qt4/GuiDocument.cpp
b/src/frontends/qt4/GuiDocument.cpp
index 2fb693e..24a3bec 100644
--- a/src/frontends/qt4/GuiDocument.cpp
+++ b/src/frontends/qt4/GuiDocument.cpp
@@ -31,6 +31,7 @@
#include "LyXRC.h" // defaultUnit
#include "TextClassList.h"
#include "Spacing.h"
+#include "PDFOptions.h"
#include "insets/InsetListingsParams.h"
@@ -597,6 +598,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;
@@ -611,6 +647,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"));
@@ -1136,6 +1173,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;
}
@@ -1411,6 +1476,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 f94ad62..a984b1c 100644
--- a/src/frontends/qt4/GuiDocument.h
+++ b/src/frontends/qt4/GuiDocument.h
@@ -27,6 +27,7 @@
#include "ui_NumberingUi.h"
#include "ui_MarginsUi.h"
#include "ui_PreambleUi.h"
+#include "ui_PDFSupportUi.h"
#include <QDialog>
@@ -103,6 +104,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 6cf26d3..077cee3 100644
--- a/src/frontends/qt4/Makefile.am
+++ b/src/frontends/qt4/Makefile.am
@@ -237,6 +237,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 0806939..5144a7a 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
@@ -49,7 +50,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
@@ -61,7 +62,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