]> 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 c81e472cdca7fa7648b027f616105b52f6b1a60f..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"
@@ -1619,39 +1617,27 @@ void Paragraph::setBeginOfBody()
 bool Paragraph::forceEmptyLayout() const
 {
        Inset const * const inset = inInset();
-       return inset && inInset()->forceEmptyLayout();
+       if (!inset)
+               return true;
+       return inset->forceEmptyLayout();
 }
 
 
 bool Paragraph::allowParagraphCustomization() const
 {
-       return inInset() && inInset()->allowParagraphCustomization(0);
-}
-
-
-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,
-       // viz: InsetTableCell::useEmptyLayout() should return true, but
-       // InsetTableCell::forceEmptyLayout() should still return false.
-       //
-       // 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();
-       }
+       Inset const * const inset = inInset();
+       if (!inset)
+               return true;
+       return inset->allowParagraphCustomization();
 }
 
 
 bool Paragraph::useEmptyLayout() const
 {
        Inset const * const inset = inInset();
-       return inset && 
-               (inTableCell(inset) || inInset()->useEmptyLayout());
+       if (!inset)
+               return false;
+       return inset->useEmptyLayout();
 }
 
 
@@ -2420,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 = ' ';
@@ -2428,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;
                }
@@ -2436,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);