X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetFoot.cpp;h=db7e1ac3314181d7c8aa3c411cec13d1ae67c161;hb=1bd422355430d4753e48eee298dafaf8c1ac458f;hp=9df6f5d590f60073648efd7bc38475951f4c3244;hpb=9b530e59c2b74828f3a68f3bb7ee3dee0365cdc0;p=lyx.git diff --git a/src/insets/InsetFoot.cpp b/src/insets/InsetFoot.cpp index 9df6f5d590..db7e1ac331 100644 --- a/src/insets/InsetFoot.cpp +++ b/src/insets/InsetFoot.cpp @@ -17,6 +17,7 @@ #include "BufferParams.h" #include "Counters.h" #include "Language.h" +#include "LaTeXFeatures.h" #include "Layout.h" #include "OutputParams.h" #include "ParIterator.h" @@ -26,19 +27,24 @@ #include "support/debug.h" #include "support/docstream.h" #include "support/gettext.h" +#include "support/lstrings.h" using namespace std; namespace lyx { InsetFoot::InsetFoot(Buffer * buf) - : InsetFootlike(buf), intitle_(false) + : InsetFootlike(buf), intitle_(false), infloattable_(false) {} docstring InsetFoot::layoutName() const { - return intitle_ ? from_ascii("Foot:InTitle") : from_ascii("Foot"); + if (intitle_) + return from_ascii("Foot:InTitle"); + else if (infloattable_) + return from_ascii("Foot:InFloatTable"); + return from_ascii("Foot"); } @@ -52,7 +58,13 @@ void InsetFoot::updateBuffer(ParIterator const & it, UpdateType utype) } intitle_ = false; - for (size_type sl = 0 ; sl < it.depth() ; ++ sl) { + infloattable_ = false; + bool intable = false; + if (it.innerInsetOfType(TABULAR_CODE) != 0) + intable = true; + if (it.innerInsetOfType(FLOAT_CODE) != 0) + infloattable_ = intable; + for (size_type sl = 0 ; sl < it.depth() ; ++sl) { if (it[sl].text() && it[sl].paragraph().layout().intitle) { intitle_ = true; break; @@ -68,31 +80,17 @@ void InsetFoot::updateBuffer(ParIterator const & it, UpdateType utype) custom_label_ += ' ' + cnts.theCounter(count, lang->code()); setLabel(custom_label_); - InsetCollapsable::updateBuffer(it, utype); + InsetCollapsible::updateBuffer(it, utype); if (utype == OutputUpdate) cnts.restoreLastCounter(); } -void InsetFoot::addToToc(DocIterator const & cpit, bool output_active) const -{ - DocIterator pit = cpit; - pit.push_back(CursorSlice(const_cast(*this))); - - Toc & toc = buffer().tocBackend().toc("footnote"); - docstring str = custom_label_ + ": "; - text().forOutliner(str, TOC_ENTRY_LENGTH); - toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60))); - // Proceed with the rest of the inset. - InsetFootlike::addToToc(cpit, output_active); -} - - docstring InsetFoot::toolTip(BufferView const & bv, int x, int y) const { if (isOpen(bv)) // this will give us something useful if there is no button - return InsetCollapsable::toolTip(bv, x, y); + return InsetCollapsible::toolTip(bv, x, y); return toolTipText(custom_label_+ ": "); } @@ -117,4 +115,18 @@ int InsetFoot::docbook(odocstream & os, OutputParams const & runparams) const return i; } + +void InsetFoot::validate(LaTeXFeatures & features) const +{ + if (!features.saveNoteEnv().empty()) { + features.require("footnote"); + features.addPreambleSnippet( + from_ascii("\\makesavenoteenv{" + + features.saveNoteEnv() + + "}\n")); + } + + InsetText::validate(features); +} + } // namespace lyx