]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetIPAMacro.cpp
Rename LATEX debug level to OUTFILE and use it for DocBook, HTML, and XML messages.
[lyx.git] / src / insets / InsetIPAMacro.cpp
index 91c5c88176438ac6e473aac22634aaa4b99459bc..a529d04b08ddfbf92078592dfec1bdf09f71ab87 100644 (file)
 #include "BufferParams.h"
 #include "Dimension.h"
 #include "Encoding.h"
-#include "Font.h"
+#include "FontInfo.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
+#include "InsetLayout.h"
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "MetricsInfo.h"
-#include "output_xhtml.h"
+#include "xml.h"
 #include "texstream.h"
 
 #include "frontends/FontMetrics.h"
@@ -286,7 +287,7 @@ int InsetIPADeco::plaintext(odocstringstream & os,
                            OutputParams const & runparams, size_t max_length) const
 {
        odocstringstream ods;
-       int h = (int)(InsetCollapsible::plaintext(ods, runparams, max_length) / 2);
+       int h = 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());
@@ -305,10 +306,22 @@ int InsetIPADeco::plaintext(odocstringstream & os,
 }
 
 
-int InsetIPADeco::docbook(odocstream & os, OutputParams const & runparams) const
+void InsetIPADeco::docbook(XMLStream & xs, OutputParams const & runparams) const
 {
-       // FIXME: Any docbook option here?
-       return InsetCollapsible::docbook(os, runparams);
+       // The special combining character must be put in the middle, between the two other characters.
+       // It will not work if there is anything else than two pure characters, so going back to plaintext.
+       odocstringstream ods;
+       int h = InsetText::plaintext(ods, runparams) / 2;
+       docstring result = ods.str();
+       docstring const before = result.substr(0, h);
+       docstring const after = result.substr(h, result.size());
+
+       xs << XMLStream::ESCAPE_NONE << before;
+       if (params_.type == InsetIPADecoParams::Toptiebar)
+               xs << XMLStream::ESCAPE_NONE << "&#x0361;";
+       else if (params_.type == InsetIPADecoParams::Bottomtiebar)
+               xs << XMLStream::ESCAPE_NONE << "&#x035c;";
+       xs << XMLStream::ESCAPE_NONE << after;
 }
 
 
@@ -381,7 +394,7 @@ bool InsetIPADeco::insetAllowed(InsetCode code) const
 
 
 InsetIPAChar::InsetIPAChar(Kind k)
-       : Inset(0), kind_(k)
+       : Inset(nullptr), kind_(k)
 {}
 
 
@@ -540,19 +553,31 @@ int InsetIPAChar::plaintext(odocstringstream & os, OutputParams const &, size_t)
 }
 
 
-int InsetIPAChar::docbook(odocstream & /*os*/, OutputParams const &) const
+void InsetIPAChar::docbook(XMLStream & xs, OutputParams const &) const
 {
        switch (kind_) {
        case TONE_FALLING:
+               xs << XMLStream::ESCAPE_NONE << "&#x2e5;";
+               xs << XMLStream::ESCAPE_NONE << "&#x2e9;";
+               break;
        case TONE_RISING:
+               xs << XMLStream::ESCAPE_NONE << "&#x2e9;";
+               xs << XMLStream::ESCAPE_NONE << "&#x2e5;";
+               break;
        case TONE_HIGH_RISING:
+               xs << XMLStream::ESCAPE_NONE << "&#x2e7;";
+               xs << XMLStream::ESCAPE_NONE << "&#x2e5;";
+               break;
        case TONE_LOW_RISING:
+               xs << XMLStream::ESCAPE_NONE << "&#x2e9;";
+               xs << XMLStream::ESCAPE_NONE << "&#x2e7;";
+               break;
        case TONE_HIGH_RISING_FALLING:
-               // FIXME
-               LYXERR0("IPA tone macros not yet implemented with DocBook!");
+               xs << XMLStream::ESCAPE_NONE << "&#x2e8;";
+               xs << XMLStream::ESCAPE_NONE << "&#x2e5;";
+               xs << XMLStream::ESCAPE_NONE << "&#x2e8;";
                break;
        }
-       return 0;
 }