]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_decorationinset.C
Fix math cursor positioning bug
[lyx.git] / src / mathed / math_decorationinset.C
index d824ba585de89981c42a8aadcd4a1315c1a8461a..3019710a6e31292f9de9ed229f711323b100ea70 100644 (file)
 #include "math_mathmlstream.h"
 #include "math_streamstr.h"
 
+#include "LaTeXFeatures.h"
 #include "debug.h"
 
 #include "support/std_ostream.h"
 
-using std::auto_ptr;
-
 
 MathDecorationInset::MathDecorationInset(latexkeys const * key)
        : MathNestInset(1), key_(key)
@@ -32,9 +31,9 @@ MathDecorationInset::MathDecorationInset(latexkeys const * key)
 }
 
 
-auto_ptr<InsetBase> MathDecorationInset::doClone() const
+std::auto_ptr<InsetBase> MathDecorationInset::doClone() const
 {
-       return auto_ptr<InsetBase>(new MathDecorationInset(*this));
+       return std::auto_ptr<InsetBase>(new MathDecorationInset(*this));
 }
 
 
@@ -90,6 +89,16 @@ bool MathDecorationInset::wide() const
 }
 
 
+bool MathDecorationInset::ams() const
+{
+       return
+                       key_->name == "overleftrightarrow" ||
+                       key_->name == "underleftarrow" ||
+                       key_->name == "underrightarrow" ||
+                       key_->name == "underleftrightarrow";
+}
+
+
 void MathDecorationInset::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        cell(0).metrics(mi, dim);
@@ -140,3 +149,11 @@ void MathDecorationInset::infoize(std::ostream & os) const
 {
        os << "Deco: " << key_->name;
 }
+
+
+void MathDecorationInset::validate(LaTeXFeatures & features) const
+{
+       if (ams())
+               features.require("amsmath");
+       MathNestInset::validate(features);
+}