]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetCollapsable.cpp
move the the latex and validate methods from InsetCollapsable to InsetText; small...
[lyx.git] / src / insets / InsetCollapsable.cpp
index 9c75d81fee60e50cdf4dbdbf9de0fea8d7999dd1..5a2e9b67dd58c7f651b024ff23fdf77de08f0582 100644 (file)
 #include "InsetLayout.h"
 #include "InsetList.h"
 #include "Language.h"
-#include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
 #include "output_xhtml.h"
+#include "OutputParams.h"
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
 #include "sgml.h"
@@ -582,6 +582,12 @@ void InsetCollapsable::setLabel(docstring const & l)
 }
 
 
+docstring const InsetCollapsable::buttonLabel(BufferView const &) const
+{
+       return labelstring_.empty() ? getLayout().labelstring() : labelstring_;
+}
+
+
 void InsetCollapsable::setStatus(Cursor & cur, CollapseStatus status)
 {
        status_ = status;
@@ -610,46 +616,6 @@ InsetLayout::InsetDecoration InsetCollapsable::decoration() const
 }
 
 
-int InsetCollapsable::latex(odocstream & os,
-                         OutputParams const & runparams) const
-{
-       // This implements the standard way of handling the LaTeX output of
-       // a collapsable inset, either a command or an environment. Standard 
-       // collapsable insets should not redefine this, non-standard ones may
-       // call this.
-       if (!getLayout().latexname().empty()) {
-               if (getLayout().latextype() == InsetLayout::COMMAND) {
-                       // FIXME UNICODE
-                       if (runparams.moving_arg)
-                               os << "\\protect";
-                       os << '\\' << from_utf8(getLayout().latexname());
-                       if (!getLayout().latexparam().empty())
-                               os << from_utf8(getLayout().latexparam());
-                       os << '{';
-               } else if (getLayout().latextype() == InsetLayout::ENVIRONMENT) {
-                       os << "%\n\\begin{" << from_utf8(getLayout().latexname()) << "}\n";
-                       if (!getLayout().latexparam().empty())
-                               os << from_utf8(getLayout().latexparam());
-               }
-       }
-       OutputParams rp = runparams;
-       if (getLayout().isPassThru())
-               rp.verbatim = true;
-       if (getLayout().isNeedProtect())
-               rp.moving_arg = true;
-       int i = InsetText::latex(os, rp);
-       if (!getLayout().latexname().empty()) {
-               if (getLayout().latextype() == InsetLayout::COMMAND) {
-                       os << "}";
-               } else if (getLayout().latextype() == InsetLayout::ENVIRONMENT) {
-                       os << "\n\\end{" << from_utf8(getLayout().latexname()) << "}\n";
-                       i += 4;
-               }
-       }
-       return i;
-}
-
-
 // FIXME It seems as if it ought to be possible to do this more simply,
 // maybe by calling InsetText::docbook() in the middle there.
 int InsetCollapsable::docbook(odocstream & os, OutputParams const & runparams) const
@@ -702,13 +668,6 @@ docstring InsetCollapsable::xhtml(odocstream & os, OutputParams const & runparam
 }
 
 
-void InsetCollapsable::validate(LaTeXFeatures & features) const
-{
-       features.useInsetLayout(getLayout());
-       InsetText::validate(features);
-}
-
-
 bool InsetCollapsable::undefined() const
 {
        docstring const & n = getLayout().name();