]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathUnknown.cpp
Account for old versions of Pygments
[lyx.git] / src / mathed / InsetMathUnknown.cpp
index a50ac259ec60d82fc31672692769cdf49b2dfef9..926e7dd5d5ced43f457f79a3585bf8d0c866eae9 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
 #include <config.h>
 
 #include "InsetMathUnknown.h"
+
 #include "MathSupport.h"
 #include "MathAtom.h"
 #include "MathStream.h"
-#include "MathStream.h"
 
+#include "MetricsInfo.h"
 
-namespace lyx {
+#include "frontends/Painter.h"
 
-using std::string;
-using std::auto_ptr;
-using std::vector;
 
+namespace lyx {
 
-InsetMathUnknown::InsetMathUnknown(docstring const & nm, bool final, bool black)
-       : name_(nm), final_(final), black_(black)
+InsetMathUnknown::InsetMathUnknown(docstring const & nm,
+       docstring const & selection, bool final, bool black)
+       : name_(nm), final_(final), black_(black), kerning_(0),
+         selection_(selection)
 {}
 
 
-auto_ptr<Inset> InsetMathUnknown::doClone() const
-{
-       return auto_ptr<Inset>(new InsetMathUnknown(*this));
-}
-
-
 docstring InsetMathUnknown::name() const
 {
        return name_;
@@ -53,15 +48,11 @@ void InsetMathUnknown::normalize(NormalStream & os) const
 }
 
 
-bool InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       mathed_string_dim(mi.base.font, name_, dim);
+       metricsStrRedBlack(mi, dim, name_);
        docstring::const_reverse_iterator rit = name_.rbegin();
        kerning_ = mathed_char_kerning(mi.base.font, *rit);
-       if (dim_ == dim)
-               return false;
-       dim_ = dim;
-       return true;
 }
 
 
@@ -71,7 +62,6 @@ void InsetMathUnknown::draw(PainterInfo & pi, int x, int y) const
                drawStrBlack(pi, x, y, name_);
        else
                drawStrRed(pi, x, y, name_);
-       setPosCache(pi, x, y);
 }
 
 
@@ -99,9 +89,15 @@ void InsetMathUnknown::mathematica(MathematicaStream & os) const
 }
 
 
-void InsetMathUnknown::mathmlize(MathStream & os) const
+void InsetMathUnknown::mathmlize(MathStream &) const
+{
+       throw MathExportException();
+}
+
+
+void InsetMathUnknown::htmlize(HtmlStream &) const
 {
-       os << MTag("mi") << name_ << ETag("mi");
+       throw MathExportException();
 }