]> git.lyx.org Git - lyx.git/blob - src/output_latex.h
Fix #10778 (issue with CJK and language nesting)
[lyx.git] / src / output_latex.h
1 // -*- C++ -*-
2 /**
3  * \file output_latex.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef OUTPUT_LATEX_H
13 #define OUTPUT_LATEX_H
14
15 #include <utility>
16
17 #include "support/docstream.h"
18 #include "Layout.h"
19 #include "ParagraphList.h"
20
21
22 namespace lyx {
23
24 class Buffer;
25 class BufferParams;
26 class Encoding;
27 class Layout;
28 class Paragraph;
29 class OutputParams;
30 class Text;
31
32 /** Register a language switch when using polyglossia or begin/end commands.
33     Set \p localswitch to true if a local command switch is used.
34  */
35 void pushLanguageName(std::string const & lang, bool localswitch = false);
36
37 /** Unregister the last language switch when using polyglossia
38     or begin/end commands.
39  */
40 void popLanguageName();
41
42 /** Return a reference to the last active language opened with
43     polyglossia or when using begin/end commands. If none or when
44     using babel with only a begin command, return a reference to
45     an empty string.
46  */
47 std::string const & openLanguageName();
48
49 /** Export optional and required arguments of the paragraph \p par.
50     Non-existing required arguments are output empty: {}.
51  */
52 void latexArgInsets(Paragraph const & par,
53                     otexstream & os, OutputParams const & runparams,
54                     Layout::LaTeXArgMap const & latexargs,
55                     std::string const & prefix = std::string());
56 /// Same for merged environments
57 void latexArgInsets(ParagraphList const & pars,
58                     ParagraphList::const_iterator pit,
59                     otexstream & os, OutputParams const & runparams,
60                     Layout::LaTeXArgMap const & latexargs,
61                     std::string const & prefix = std::string());
62 /// Same for InsetLayouts
63 void latexArgInsetsForParent(ParagraphList const & pars, otexstream & os,
64                              OutputParams const & runparams,
65                              Layout::LaTeXArgMap const & latexargs,
66                              std::string const & prefix = std::string());
67 /** Export \p paragraphs of buffer \p buf to LaTeX.
68     Don't use a temporary stringstream for \p os if the final output is
69     supposed to go to a file.
70     \sa Buffer::writeLaTeXSource for the reason.
71  */
72 void latexParagraphs(Buffer const & buf,
73                      Text const & text,
74                      otexstream & ofs,
75                      OutputParams const &,
76                      std::string const & everypar = std::string());
77
78 /** Switch the encoding of \p os from runparams.encoding to \p newEnc if needed.
79     \p force forces this also within non-default or -auto encodings.
80     \return (did the encoding change?, number of characters written to \p os)
81  */
82 std::pair<bool, int> switchEncoding(odocstream & os,
83                      BufferParams const & bparams,
84                      OutputParams const &, Encoding const & newEnc,
85                      bool force = false);
86
87 /// FIXME: this should not be visible.
88 void TeXOnePar(Buffer const & buf,
89                    Text const & text,
90                    pit_type pit,
91                    otexstream & os,
92                    OutputParams const & runparams,
93                    std::string const & everypar = std::string(),
94                    int start_pos = -1, int end_pos = -1);
95
96 } // namespace lyx
97
98 #endif