Try again to fix bug 2178.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23662 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-03-11 15:16:58 +00:00
parent 94ff60ec7e
commit 7a5576c13b
3 changed files with 33 additions and 3 deletions

View File

@ -48,6 +48,8 @@
#include "insets/InsetBibitem.h" #include "insets/InsetBibitem.h"
#include "insets/InsetLabel.h" #include "insets/InsetLabel.h"
// needed only for inTableCell()
#include "insets/InsetText.h"
#include "support/convert.h" #include "support/convert.h"
#include "support/debug.h" #include "support/debug.h"
@ -1614,9 +1616,26 @@ 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 bool Paragraph::forceEmptyLayout() const
{ {
return inInset() && inInset()->forceEmptyLayout(); Inset * inset = inInset();
return inset &&
(inTableCell(inset) || inInset()->forceEmptyLayout());
} }
@ -1628,7 +1647,9 @@ bool Paragraph::allowParagraphCustomization() const
bool Paragraph::useEmptyLayout() const bool Paragraph::useEmptyLayout() const
{ {
return inInset() && inInset()->useEmptyLayout(); Inset * inset = inInset();
return inset &&
(inTableCell(inset) || inInset()->useEmptyLayout());
} }

View File

@ -445,13 +445,20 @@ void InsetText::addPreview(PreviewLoader & loader) const
// FIXME: instead of this hack, which only works by chance, // FIXME: instead of this hack, which only works by chance,
// cells should have their own insetcell type, which returns CELL_CODE! // cells should have their own insetcell type, which returns CELL_CODE!
bool InsetText::neverIndent() const bool InsetText::isTableCell() const
{ {
// this is only true for tabular cells // this is only true for tabular cells
return !text_.isMainText(buffer()) && lyxCode() == TEXT_CODE; return !text_.isMainText(buffer()) && lyxCode() == TEXT_CODE;
} }
bool InsetText::neverIndent() const
{
return isTableCell();
}
ParagraphList const & InsetText::paragraphs() const ParagraphList const & InsetText::paragraphs() const
{ {
return text_.paragraphs(); return text_.paragraphs();

View File

@ -128,6 +128,8 @@ public:
bool insetAllowed(InsetCode) const { return true; } bool insetAllowed(InsetCode) const { return true; }
/// ///
bool allowSpellCheck() const { return true; } bool allowSpellCheck() const { return true; }
///
bool isTableCell() const;
/// should paragraph indendation be ommitted in any case? /// should paragraph indendation be ommitted in any case?
bool neverIndent() const; bool neverIndent() const;
/// ///