// we have to provide all the optional arguments here, even though
// the last one is the only one we care about.
// Separate handling of optional argument inset.
- if (!layout_->latexargs().empty())
- latexArgInsets(*owner_, os, features.runparams(),
- layout_->latexargs());
+ if (!layout_->latexargs().empty()) {
+ OutputParams rp = features.runparams();
+ rp.local_font = &owner_->getFirstFontSettings(bp);
+ latexArgInsets(*owner_, os, rp, layout_->latexargs());
+ }
os << from_ascii(layout_->latexparam());
}
docstring::size_type const length = ods.str().length();
bool Paragraph::isPassThru() const
{
- return inInset().getLayout().isPassThru() || d->layout_->pass_thru;
+ return inInset().isPassThru() || d->layout_->pass_thru;
}
namespace {
#include "ColorCode.h"
#include "InsetCode.h"
+#include "InsetLayout.h"
#include "LayoutEnums.h"
#include "OutputEnums.h"
virtual docstring layoutName() const;
///
virtual InsetLayout const & getLayout() const;
+ ///
+ virtual bool isPassThru() const { return getLayout().isPassThru(); }
/// Is this inset's layout defined in the document's textclass?
bool undefined() const;
/// should this inset be handled like a normal character?
#include "InsetArgument.h"
+#include "Buffer.h"
+#include "BufferParams.h"
#include "Cursor.h"
#include "FuncStatus.h"
#include "FuncRequest.h"
#include "InsetList.h"
+#include "Language.h"
#include "Layout.h"
#include "Lexer.h"
#include "OutputParams.h"
InsetArgument::InsetArgument(Buffer * buf, string const & name)
: InsetCollapsable(buf), name_(name), labelstring_(docstring()),
- font_(inherit_font), labelfont_(inherit_font), decoration_(string())
+ font_(inherit_font), labelfont_(inherit_font), decoration_(string()),
+ pass_thru_(false)
{}
{
Layout::LaTeXArgMap args;
bool const insetlayout = &it.inset() && it.paragraph().layout().latexargs().empty();
- if (insetlayout)
+ if (insetlayout) {
args = it.inset().getLayout().latexargs();
- else
+ pass_thru_ = it.inset().getLayout().isPassThru();
+ } else {
args = it.paragraph().layout().latexargs();
-
+ pass_thru_ = it.paragraph().layout().pass_thru;
+ }
+
// Handle pre 2.1 ArgInsets (lyx2lyx cannot classify them)
if (name_ == "999") {
- unsigned int const req = insetlayout ? it.inset().getLayout().numRequiredArgs()
+ unsigned int const req = insetlayout ? it.inset().getLayout().requiredArgs()
: it.paragraph().layout().requiredArgs();
- unsigned int const opts = insetlayout ? it.inset().getLayout().numOptArgs()
+ unsigned int const opts = insetlayout ? it.inset().getLayout().optArgs()
: it.paragraph().layout().optArgs();
unsigned int nr = 0;
unsigned int ours = 0;
odocstringstream ss;
otexstream ots(ss, texrow);
OutputParams runparams = runparams_in;
- if (getLayout().isPassThru())
- runparams.pass_thru = true;
InsetText::latex(ots, runparams);
docstring str = ss.str();
if (ldelim != "{" && support::contains(str, rdelim))
bool neverIndent() const { return true; }
///
std::string contextMenuName() const;
+ ///
+ bool isPassThru() const { return pass_thru_; }
//@}
/// \name Public functions inherited from InsetCollapsable class
//@{
FontInfo labelfont_;
///
std::string decoration_;
+ ///
+ bool pass_thru_;
protected:
/// \name Protected functions inherited from Inset class
latexargs_[nr] = arg;
}
-unsigned int InsetLayout::numOptArgs() const
+unsigned int InsetLayout::optArgs() const
{
unsigned int nr = 0;
Layout::LaTeXArgMap::const_iterator it = latexargs_.begin();
}
-unsigned int InsetLayout::numRequiredArgs() const
+unsigned int InsetLayout::requiredArgs() const
{
unsigned int nr = 0;
Layout::LaTeXArgMap::const_iterator it = latexargs_.begin();
///
Layout::LaTeXArgMap latexargs() const { return latexargs_; }
///
- unsigned int numOptArgs() const;
+ unsigned int optArgs() const;
///
- unsigned int numRequiredArgs() const;
+ unsigned int requiredArgs() const;
///
docstring preamble() const { return preamble_; }
/// Get language dependent macro definitions needed for this inset
{
LYXERR(Debug::ACTION, "InsetText::doDispatch(): cmd: " << cmd);
- if (getLayout().isPassThru()) {
+ if (isPassThru()) {
// Force any new text to latex_language FIXME: This
// should only be necessary in constructor, but new
// paragraphs that are created by pressing enter at
if (runparams.moving_arg)
os << "\\protect";
os << '\\' << from_utf8(il.latexname());
- getOptArg(os, runparams);
+ if (!il.latexargs().empty())
+ getOptArg(os, runparams);
if (!il.latexparam().empty())
os << from_utf8(il.latexparam());
os << '{';
os.texrow().start(runparams.lastid,
runparams.lastpos);
os << "\\begin{" << from_utf8(il.latexname()) << "}";
- getOptArg(os, runparams);
+ if (!il.latexargs().empty())
+ getOptArg(os, runparams);
if (!il.latexparam().empty())
os << from_utf8(il.latexparam());
os << '\n';
}
} else {
- getOptArg(os, runparams);
+ if (!il.latexargs().empty())
+ getOptArg(os, runparams);
if (!il.latexparam().empty())
os << from_utf8(il.latexparam());
}
os << il.leftdelim();
OutputParams rp = runparams;
- if (il.isPassThru())
+ if (isPassThru())
rp.pass_thru = true;
if (il.isNeedProtect())
rp.moving_arg = true;
}
void InsetText::getOptArg(otexstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams_in) const
{
+ OutputParams runparams = runparams_in;
+ runparams.local_font =
+ ¶graphs()[0].getFirstFontSettings(buffer().masterBuffer()->params());
+ if (isPassThru())
+ runparams.pass_thru = true;
latexArgInsets(paragraphs()[0], os, runparams, getLayout().latexargs());
}
case ARG_CODE:
return true;
default:
- return !getLayout().isPassThru();
+ return !isPassThru();
}
}
if (style.isEnvironment()) {
os << "\\begin{" << from_ascii(style.latexname()) << '}';
- if (!style.latexargs().empty())
- latexArgInsets(*pit, os, runparams, style.latexargs());
+ if (!style.latexargs().empty()) {
+ OutputParams rp = runparams;
+ rp.local_font = &pit->getFirstFontSettings(bparams);
+ latexArgInsets(*pit, os, rp, style.latexargs());
+ }
if (style.latextype == LATEX_LIST_ENVIRONMENT) {
os << '{'
<< pit->params().labelWidthString()
open_encoding_ = none;
}
- if (text.inset().getLayout().isPassThru()) {
+ if (text.inset().isPassThru()) {
Font const outerfont = text.outerFont(pit);
// No newline before first paragraph in this lyxtext
if (style.pass_thru) {
Font const outerfont = text.outerFont(pit);
+ runparams.local_font = &par.getFirstFontSettings(bparams);
parStartCommand(par, os, runparams, style);
par.latex(bparams, outerfont, os, runparams, start_pos, end_pos);
}
}
+ runparams.local_font = &par.getFirstFontSettings(bparams);
parStartCommand(par, os, runparams, style);
-
Font const outerfont = text.outerFont(pit);
// FIXME UNICODE