]> git.lyx.org Git - lyx.git/blobdiff - src/Paragraph.cpp
Allow using \binom without amsmath and add support for \brace and \brack
[lyx.git] / src / Paragraph.cpp
index d4f5d0dc1affd2c38b54d5f3e36c3055f390757f..ce45db9bfe55362dfee95898a107a57fb253eb88 100644 (file)
@@ -48,8 +48,6 @@
 
 #include "insets/InsetBibitem.h"
 #include "insets/InsetLabel.h"
-// needed only for inTableCell()
-#include "insets/InsetText.h"
 
 #include "support/convert.h"
 #include "support/debug.h"
@@ -1616,40 +1614,30 @@ void Paragraph::setBeginOfBody()
 }
 
 
-namespace {
-       // This is a hack based upon one in InsetText::neverIndent().
-       // When we have a real InsetTableCell, then we won't need this
-       // method, because InsetTableCell will return the right values.
-       // The #include "insets/InsetText.h" can also be removed then.
-       bool inTableCell(Inset const * inset)
-       {
-               InsetText const * txt = inset->asInsetText();
-               if (!txt)
-                       return false;
-               return txt->isTableCell();
-       }
-}
-
-
 bool Paragraph::forceEmptyLayout() const
 {
-       Inset * inset = inInset();
-       return inset && 
-               (inTableCell(inset) || inInset()->forceEmptyLayout());
+       Inset const * const inset = inInset();
+       if (!inset)
+               return true;
+       return inset->forceEmptyLayout();
 }
 
 
 bool Paragraph::allowParagraphCustomization() const
 {
-       return inInset() && inInset()->allowParagraphCustomization(0);
+       Inset const * const inset = inInset();
+       if (!inset)
+               return true;
+       return inset->allowParagraphCustomization();
 }
 
 
 bool Paragraph::useEmptyLayout() const
 {
-       Inset * inset = inInset();
-       return inset && 
-               (inTableCell(inset) || inInset()->useEmptyLayout());
+       Inset const * const inset = inInset();
+       if (!inset)
+               return false;
+       return inset->useEmptyLayout();
 }
 
 
@@ -2237,7 +2225,8 @@ void Paragraph::simpleDocBookOnePar(Buffer const & buf,
 bool Paragraph::isHfill(pos_type pos) const
 {
        Inset const * inset = getInset(pos);
-       return inset && inset->lyxCode() == HFILL_CODE;
+       return inset && (inset->lyxCode() == SPACE_CODE &&
+                        inset->isStretchableSpace());
 }
 
 
@@ -2417,7 +2406,7 @@ bool Paragraph::allowEmpty() const
 
 char_type Paragraph::transformChar(char_type c, pos_type pos) const
 {
-       if (!Encodings::is_arabic(c))
+       if (!Encodings::isArabicChar(c))
                return c;
 
        char_type prev_char = ' ';
@@ -2425,7 +2414,7 @@ char_type Paragraph::transformChar(char_type c, pos_type pos) const
 
        for (pos_type i = pos - 1; i >= 0; --i) {
                char_type const par_char = d->text_[i];
-               if (!Encodings::isComposeChar_arabic(par_char)) {
+               if (!Encodings::isArabicComposeChar(par_char)) {
                        prev_char = par_char;
                        break;
                }
@@ -2433,21 +2422,21 @@ char_type Paragraph::transformChar(char_type c, pos_type pos) const
 
        for (pos_type i = pos + 1, end = size(); i < end; ++i) {
                char_type const par_char = d->text_[i];
-               if (!Encodings::isComposeChar_arabic(par_char)) {
+               if (!Encodings::isArabicComposeChar(par_char)) {
                        next_char = par_char;
                        break;
                }
        }
 
-       if (Encodings::is_arabic(next_char)) {
-               if (Encodings::is_arabic(prev_char) &&
-                       !Encodings::is_arabic_special(prev_char))
+       if (Encodings::isArabicChar(next_char)) {
+               if (Encodings::isArabicChar(prev_char) &&
+                       !Encodings::isArabicSpecialChar(prev_char))
                        return Encodings::transformChar(c, Encodings::FORM_MEDIAL);
                else
                        return Encodings::transformChar(c, Encodings::FORM_INITIAL);
        } else {
-               if (Encodings::is_arabic(prev_char) &&
-                       !Encodings::is_arabic_special(prev_char))
+               if (Encodings::isArabicChar(prev_char) &&
+                       !Encodings::isArabicSpecialChar(prev_char))
                        return Encodings::transformChar(c, Encodings::FORM_FINAL);
                else
                        return Encodings::transformChar(c, Encodings::FORM_ISOLATED);