bool Inset::forceLTR() const
{
- return getLayout().isForceLtr();
+ return getLayout().forceLTR();
}
void Inset::initView()
}
-docstring InsetCollapsable::xhtml(odocstream & os, OutputParams const & runparams) const
-{
- InsetLayout const & il = getLayout();
- if (undefined())
- return InsetText::xhtml(os, runparams);
-
- bool const opened = html::openTag(os, il.htmltag(), il.htmlattr());
- if (!il.counter().empty()) {
- BufferParams const & bp = buffer().masterBuffer()->params();
- Counters & cntrs = bp.documentClass().counters();
- cntrs.step(il.counter());
- // FIXME: translate to paragraph language
- if (!il.htmllabel().empty())
- os << cntrs.counterLabel(from_utf8(il.htmllabel()), bp.language->code());
- }
- bool innertag_opened = false;
- if (!il.htmlinnertag().empty())
- innertag_opened = html::openTag(os, il.htmlinnertag(), il.htmlinnerattr());
- docstring deferred = InsetText::xhtml(os, runparams);
- if (innertag_opened)
- html::closeTag(os, il.htmlinnertag());
- if (opened)
- html::closeTag(os, il.htmltag());
- return deferred;
-}
-
-
docstring InsetCollapsable::contextMenu(BufferView const & bv, int x,
int y) const
{
return InsetText::contextMenu(bv, x, y);
}
-void InsetCollapsable::tocString(odocstream & os) const
-{
- if (!getLayout().isInToc())
- return;
- os << text().asString(0, 1, AS_STR_LABEL | AS_STR_INSETS);
-}
-
-
} // namespace lyx
ColorCode backgroundColor() const { return getLayout().bgcolor(); }
///
ColorCode labelColor() const { return getLayout().labelfont().color(); }
- /// It will rarely be right to call this from subclasses, due
- /// to the fact that it steps counters, etc. Instead, call
- /// InsetText::xhtml().
- docstring xhtml(odocstream &, OutputParams const &) const;
///
InsetCode lyxCode() const { return COLLAPSABLE_CODE; }
///
virtual bool usePlainLayout() const { return true; }
- /// the string that is passed to the TOC
- void tocString(odocstream &) const;
///
virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
protected:
///
Dimension dimensionCollapsed(BufferView const & bv) const;
///
- /// should paragraphs be forced to use the empty layout?
- virtual bool forcePlainLayout(idx_type = 0) const
- { return getLayout().forcePlainLayout(); }
- /// should the user be allowed to customize alignment, etc.?
- virtual bool allowParagraphCustomization(idx_type = 0) const
- { return getLayout().allowParagraphCustomization(); }
docstring labelstring_;
///
mutable Box button_dim;
///
bool isKeepEmpty() const { return keepempty_; };
///
- bool isForceLtr() const { return forceltr_; };
+ bool forceLTR() const { return forceltr_; };
///
bool isInToc() const { return intoc_; };
private:
LYXERR(Debug::ACTION, "InsetText::doDispatch()"
<< " [ cmd.action = " << cmd.action << ']');
- // FIXME this use of forceLTR is dubious
- // introduced in http://www.lyx.org/trac/changeset/21285
- if (forceLTR()) {
+ if (getLayout().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
void InsetText::fixParagraphsFont()
{
Font font(inherit_font, buffer().params().language);
- if (getLayout().isForceLtr())
- font.setLanguage(latex_language);
if (getLayout().isPassThru()) {
+ font.setLanguage(latex_language);
ParagraphList::iterator par = paragraphs().begin();
ParagraphList::iterator const end = paragraphs().end();
while (par != end) {
}
+void InsetText::validate(LaTeXFeatures & features) const
+{
+ features.useInsetLayout(getLayout());
+ for_each(paragraphs().begin(), paragraphs().end(),
+ bind(&Paragraph::validate, _1, ref(features)));
+}
+
+
int InsetText::latex(odocstream & os, OutputParams const & runparams) const
{
// This implements the standard way of handling the LaTeX
docstring InsetText::xhtml(odocstream & os, OutputParams const & runparams) const
{
- xhtmlParagraphs(paragraphs(), buffer(), os, runparams);
- return docstring();
-}
+ InsetLayout const & il = getLayout();
+ if (undefined()) {
+ xhtmlParagraphs(paragraphs(), buffer(), os, runparams);
+ return docstring();
+ }
+ bool const opened = html::openTag(os, il.htmltag(), il.htmlattr());
+ if (!il.counter().empty()) {
+ BufferParams const & bp = buffer().masterBuffer()->params();
+ Counters & cntrs = bp.documentClass().counters();
+ cntrs.step(il.counter());
+ // FIXME: translate to paragraph language
+ if (!il.htmllabel().empty())
+ os << cntrs.counterLabel(from_utf8(il.htmllabel()), bp.language->code());
+ }
+ bool innertag_opened = false;
+ if (!il.htmlinnertag().empty())
+ innertag_opened = html::openTag(os, il.htmlinnertag(), il.htmlinnerattr());
-void InsetText::validate(LaTeXFeatures & features) const
-{
- features.useInsetLayout(getLayout());
- for_each(paragraphs().begin(), paragraphs().end(),
- bind(&Paragraph::validate, _1, ref(features)));
+ xhtmlParagraphs(paragraphs(), buffer(), os, runparams);
+
+ if (innertag_opened)
+ html::closeTag(os, il.htmlinnertag());
+ if (opened)
+ html::closeTag(os, il.htmltag());
+ return docstring();
}
}
+void InsetText::tocString(odocstream & os) const
+{
+ if (!getLayout().isInToc())
+ return;
+ os << text().asString(0, 1, AS_STR_LABEL | AS_STR_INSETS);
+}
+
+
+
void InsetText::addToToc(DocIterator const & cdit)
{
DocIterator dit = cdit;
///
bool insetAllowed(InsetCode) const { return true; }
/// Allow spellchecking, except for insets with latex_language
- bool allowSpellCheck() const { return !forceLTR(); }
+ bool allowSpellCheck() const { return !getLayout().isPassThru(); }
///
virtual bool isMacroScope() const { return false; }
///
virtual bool allowMultiPar() const { return getLayout().isMultiPar(); }
+ ///
+ /// should paragraphs be forced to use the empty layout?
+ virtual bool forcePlainLayout(idx_type = 0) const
+ { return getLayout().forcePlainLayout(); }
+ /// should the user be allowed to customize alignment, etc.?
+ virtual bool allowParagraphCustomization(idx_type = 0) const
+ { return getLayout().allowParagraphCustomization(); }
/// Update the counters of this inset and of its contents
virtual void updateLabels(ParIterator const &);
+ /// the string that is passed to the TOC
+ void tocString(odocstream &) const;
///
void addToToc(DocIterator const &);
///