]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetcite.C
prevent crash when inserting minipage in table cell,
[lyx.git] / src / insets / insetcite.C
index 419cf6f21958eb1613de8510f1b2a9d9919cbe7d..e7437b480436623e10b3a651da53316a9ba576fe 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <map>
 
+using namespace lyx::support;
+
 using std::ostream;
 using std::vector;
 using std::map;
@@ -221,11 +223,16 @@ string const getBasicLabel(string const & keyList, string const & after)
 } // anon namespace
 
 
-InsetCitation::InsetCitation(InsetCommandParams const & p, bool)
+InsetCitation::InsetCitation(InsetCommandParams const & p)
        : InsetCommand(p)
 {}
 
 
+// InsetCitation::InsetCitation(InsetCommandParams const & p, bool)
+//     : InsetCommand(p, false)
+// {}
+
+
 InsetCitation::~InsetCitation()
 {
        InsetCommandMailer mailer("citation", *this);
@@ -321,30 +328,25 @@ void InsetCitation::setLoadingBuffer(Buffer const * buffer, bool state) const
 dispatch_result InsetCitation::localDispatch(FuncRequest const & cmd)
 {
        switch (cmd.action) {
-               case LFUN_INSET_EDIT:
-                       // A call to edit indicates that we're no longer loading the
-                       // buffer but doing some real work.
-                       setLoadingBuffer(cmd.view()->buffer(), false);
-                       InsetCommandMailer("citation", *this).showDialog(cmd.view());
-                       break;
-
-               default:
-                       return UNDISPATCHED;
+       case LFUN_INSET_EDIT:
+               // A call to edit indicates that we're no longer loading the
+               // buffer but doing some real work.
+               setLoadingBuffer(cmd.view()->buffer(), false);
+               InsetCommandMailer("citation", *this).showDialog(cmd.view());
+               return DISPATCHED;
+
+       default:
+               return InsetCommand::localDispatch(cmd);
        }
-       return DISPATCHED;
 }
 
 
 int InsetCitation::ascii(Buffer const * buffer, ostream & os, int) const
 {
-       string label;
-
        if (cache.params == params() && cache.style == getStyle(buffer))
-               label = cache.generated_label;
+               os << cache.generated_label;
        else
-               label = generateLabel(buffer);
-
-       os << label;
+               os << generateLabel(buffer);
        return 0;
 }
 
@@ -354,7 +356,7 @@ int InsetCitation::ascii(Buffer const * buffer, ostream & os, int) const
 // citations and then changes his mind, turning natbib support off. The output
 // should revert to \cite[]{}
 int InsetCitation::latex(Buffer const * buffer, ostream & os,
-                       bool /*fragile*/, bool/*fs*/) const
+                        LatexRunParams const &) const
 {
        os << "\\";
        if (buffer->params.use_natbib)