]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetIPAMacro.cpp
Dispay pre- and posttext widgets if non-empty also if unapplied
[lyx.git] / src / insets / InsetIPAMacro.cpp
index 21f2d114601cde4680031af70f4a932b9ebbe883..4b2369b3796741fb6177bd1f876da9313146f893 100644 (file)
@@ -23,6 +23,7 @@
 #include "Lexer.h"
 #include "MetricsInfo.h"
 #include "output_xhtml.h"
+#include "texstream.h"
 
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
@@ -93,7 +94,7 @@ IPACharTranslator const & ipachartranslator()
        return chartranslator;
 }
 
-} // anon
+} // namespace
 
 
 InsetIPADecoParams::InsetIPADecoParams()
@@ -124,7 +125,7 @@ void InsetIPADecoParams::read(Lexer & lex)
 /////////////////////////////////////////////////////////////////////
 
 InsetIPADeco::InsetIPADeco(Buffer * buf, string const & label)
-       : InsetCollapsable(buf)
+       : InsetCollapsible(buf)
 {
        setDrawFrame(true);
        setFrameColor(Color_insetframe);
@@ -145,7 +146,7 @@ docstring InsetIPADeco::layoutName() const
 void InsetIPADeco::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        InsetText::metrics(mi, dim);
-       
+
        if (params_.type == InsetIPADecoParams::Toptiebar) {
                // consider width of the inset label
                FontInfo font(getLayout().labelfont());
@@ -172,21 +173,18 @@ void InsetIPADeco::metrics(MetricsInfo & mi, Dimension & dim) const
                theFontMetrics(font).rectText(label, w, a, d);
                dim.des += int(d * 1.5);
        }
-
-       // cache the inset dimension
-       setDimCache(mi, dim);
 }
 
 
 void InsetIPADeco::draw(PainterInfo & pi, int x, int y) const
 {
        // draw the text
-       InsetCollapsable::draw(pi, x, y);
+       InsetCollapsible::draw(pi, x, y);
 
        // draw the inset marker
        drawMarkers(pi, x, y);
 
-       Dimension const dim = Inset::dimension(*pi.base.bv);
+       Dimension const dim = dimension(*pi.base.bv);
 
        if (params_.type == InsetIPADecoParams::Toptiebar) {
                FontInfo font(getLayout().labelfont());
@@ -225,14 +223,14 @@ void InsetIPADeco::draw(PainterInfo & pi, int x, int y) const
 void InsetIPADeco::write(ostream & os) const
 {
        params_.write(os);
-       InsetCollapsable::write(os);
+       InsetCollapsible::write(os);
 }
 
 
 void InsetIPADeco::read(Lexer & lex)
 {
        params_.read(lex);
-       InsetCollapsable::read(lex);
+       InsetCollapsible::read(lex);
 }
 
 
@@ -279,7 +277,7 @@ void InsetIPADeco::latex(otexstream & os, OutputParams const & runparams) const
                os << "\\texttoptiebar{";
        else if (params_.type == InsetIPADecoParams::Bottomtiebar)
                os << "\\textbottomtiebar{";
-       InsetCollapsable::latex(os, runparams);
+       InsetCollapsible::latex(os, runparams);
        os << "}";
 }
 
@@ -288,11 +286,11 @@ int InsetIPADeco::plaintext(odocstringstream & os,
                            OutputParams const & runparams, size_t max_length) const
 {
        odocstringstream ods;
-       int h = (int)(InsetCollapsable::plaintext(ods, runparams, max_length) / 2);
+       int h = (int)(InsetCollapsible::plaintext(ods, runparams, max_length) / 2);
        docstring result = ods.str();
        docstring const before = result.substr(0, h);
        docstring const after = result.substr(h, result.size());
-       
+
        if (params_.type == InsetIPADecoParams::Toptiebar) {
                os << before;
                os.put(0x0361);
@@ -310,7 +308,7 @@ int InsetIPADeco::plaintext(odocstringstream & os,
 int InsetIPADeco::docbook(odocstream & os, OutputParams const & runparams) const
 {
        // FIXME: Any docbook option here?
-       return InsetCollapsable::docbook(os, runparams);
+       return InsetCollapsible::docbook(os, runparams);
 }
 
 
@@ -319,7 +317,7 @@ docstring InsetIPADeco::xhtml(XHTMLStream & xs, OutputParams const & runparams)
        // FIXME: Like in plaintext, the combining characters "&#x361;" (toptiebar)
        // or "&#x35c;" (bottomtiebar) would need to be inserted just in the mid
        // of the text string. (How) can this be done with the xhtml stream?
-       return InsetCollapsable::xhtml(xs, runparams);
+       return InsetCollapsible::xhtml(xs, runparams);
 }
 
 
@@ -412,7 +410,6 @@ void InsetIPAChar::metrics(MetricsInfo & mi, Dimension & dim) const
        }
        docstring ds(s.begin(), s.end());
        dim.wid = fm.width(ds);
-       setDimCache(mi, dim);
 }
 
 
@@ -546,13 +543,13 @@ int InsetIPAChar::plaintext(odocstringstream & os, OutputParams const &, size_t)
 int InsetIPAChar::docbook(odocstream & /*os*/, OutputParams const &) const
 {
        switch (kind_) {
-       // FIXME
-       LYXERR0("IPA tone macros not yet implemented with DocBook!");
        case TONE_FALLING:
        case TONE_RISING:
        case TONE_HIGH_RISING:
        case TONE_LOW_RISING:
        case TONE_HIGH_RISING_FALLING:
+               // FIXME
+               LYXERR0("IPA tone macros not yet implemented with DocBook!");
                break;
        }
        return 0;
@@ -596,7 +593,7 @@ void InsetIPAChar::toString(odocstream & os) const
 }
 
 
-void InsetIPAChar::forToc(docstring & os, size_t) const
+void InsetIPAChar::forOutliner(docstring & os, size_t const, bool const) const
 {
        odocstringstream ods;
        plaintext(ods, OutputParams(0));
@@ -620,16 +617,4 @@ void InsetIPAChar::validate(LaTeXFeatures & features) const
 }
 
 
-bool InsetIPAChar::isLetter() const
-{
-       return true;
-}
-
-
-bool InsetIPAChar::isLineSeparator() const
-{
-       return false;
-}
-
-
 } // namespace lyx