]> git.lyx.org Git - lyx.git/blobdiff - src/Text.cpp
support for the Iwona fonts
[lyx.git] / src / Text.cpp
index baa9c3f1f82d6e6f055941b2c7315cb525fe753d..932a3929d79bb4da2965b8cad4e1d8d671d9abe5 100644 (file)
@@ -30,7 +30,6 @@
 #include "Cursor.h"
 #include "CutAndPaste.h"
 #include "DispatchResult.h"
-#include "Encoding.h"
 #include "ErrorList.h"
 #include "FuncRequest.h"
 #include "factory.h"
 #include "insets/InsetNewline.h"
 #include "insets/InsetNewpage.h"
 #include "insets/InsetArgument.h"
+#include "insets/InsetIPAMacro.h"
 #include "insets/InsetSpace.h"
 #include "insets/InsetSpecialChar.h"
 #include "insets/InsetTabular.h"
 
+#include "support/convert.h"
 #include "support/debug.h"
 #include "support/docstream.h"
 #include "support/gettext.h"
@@ -263,6 +264,17 @@ bool Text::isFirstInSequence(pit_type par_offset) const
 }
 
 
+int Text::getTocLevel(pit_type par_offset) const
+{
+       Paragraph const & par = pars_[par_offset];
+
+       if (par.layout().isEnvironment() && !isFirstInSequence(par_offset))
+               return Layout::NOT_IN_TOC;
+
+       return par.layout().toclevel;
+}
+
+
 Font const Text::outerFont(pit_type par_offset) const
 {
        depth_type par_depth = pars_[par_offset].getDepth();
@@ -479,6 +491,12 @@ void Text::readParToken(Paragraph & par, Lexer & lex,
                inset->read(lex);
                inset->setBuffer(*buf);
                par.insertInset(par.size(), inset.release(), font, change);
+       } else if (token == "\\IPAChar") {
+               auto_ptr<Inset> inset;
+               inset.reset(new InsetIPAChar);
+               inset->read(lex);
+               inset->setBuffer(*buf);
+               par.insertInset(par.size(), inset.release(), font, change);
        } else if (token == "\\backslash") {
                par.appendChar('\\', font, change);
        } else if (token == "\\LyXTable") {
@@ -1804,6 +1822,7 @@ bool Text::read(Lexer & lex,
        return res;
 }
 
+
 // Returns the current font and depth as a message.
 docstring Text::currentState(Cursor const & cur) const
 {
@@ -1929,7 +1948,7 @@ docstring Text::getPossibleLabel(Cursor const & cur) const
        // For captions, we just take the caption type
        Inset * caption_inset = cur.innerInsetOfType(CAPTION_CODE);
        if (caption_inset) {
-               string const & ftype = static_cast<InsetCaption *>(caption_inset)->type();
+               string const & ftype = static_cast<InsetCaption *>(caption_inset)->floattype();
                FloatList const & fl = cur.buffer()->params().documentClass().floats();
                if (fl.typeExist(ftype)) {
                        Floating const & flt = fl.getType(ftype);
@@ -1948,7 +1967,15 @@ docstring Text::getPossibleLabel(Cursor const & cur) const
        if (!name.empty())
                text = name + ':' + text;
 
-       return text;
+       // We need a unique label
+       docstring label = text;
+       int i = 1;
+       while (cur.buffer()->insetLabel(label)) {
+                       label = text + '-' + convert<docstring>(i);
+                       ++i;
+               }
+
+       return label;
 }