]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insetspecialchar.C
prevent crash when inserting minipage in table cell,
[lyx.git] / src / insets / insetspecialchar.C
index 8a67a6214110647ee00be3e469618a0f2bd50927..21f59106a29935e38e8cf177e07f95c90d631294 100644 (file)
@@ -26,6 +26,7 @@
 
 using std::ostream;
 using std::max;
+using std::auto_ptr;
 
 
 InsetSpecialChar::InsetSpecialChar(Kind k)
@@ -39,9 +40,9 @@ InsetSpecialChar::Kind InsetSpecialChar::kind() const
 }
 
 
-void InsetSpecialChar::dimension(BufferView *, LyXFont const & font,
-       Dimension & dim) const
+void InsetSpecialChar::metrics(MetricsInfo & mi, Dimension & dim) const
 {
+       LyXFont & font = mi.base.font;
        dim.asc = font_metrics::maxAscent(font);
        dim.des = font_metrics::maxDescent(font);
 
@@ -56,6 +57,7 @@ void InsetSpecialChar::dimension(BufferView *, LyXFont const & font,
        dim.wid = font_metrics::width(s, font);
        if (kind_ == HYPHENATION && dim.wid > 5)
                dim.wid -= 2; // to make it look shorter
+       dim_ = dim;
 }
 
 
@@ -238,18 +240,12 @@ int InsetSpecialChar::docbook(Buffer const *, ostream & os, bool) const
 }
 
 
-Inset * InsetSpecialChar::clone(Buffer const &) const
+auto_ptr<InsetBase> InsetSpecialChar::clone() const
 {
-       return new InsetSpecialChar(kind_);
+       return auto_ptr<InsetBase>(new InsetSpecialChar(kind_));
 }
 
 
-// Inset * InsetSpecialChar::clone(Buffer const &, bool) const
-// {
-//     return new InsetSpecialChar(kind_);
-// }
-
-
 void InsetSpecialChar::validate(LaTeXFeatures & features) const
 {
        if (kind_ == MENU_SEPARATOR) {