break;
case LFUN_LAYOUT:
+ flag.enabled(!cur.inset().forceEmptyLayout(cur.idx()));
+ break;
+
case LFUN_LAYOUT_PARAGRAPH:
flag.enabled(cur.inset().allowParagraphCustomization(cur.idx()));
break;
bool Paragraph::forceEmptyLayout() const
{
Inset const * const inset = inInset();
- return inset && inInset()->forceEmptyLayout();
+ if (!inset)
+ return true;
+ // FIXME At present, this is wrong for table cells
+ return inset->forceEmptyLayout();
}
bool Paragraph::allowParagraphCustomization() const
{
- return inInset() && inInset()->allowParagraphCustomization(0);
+ Inset const * const inset = inInset();
+ if (!inset)
+ return true;
+ // FIXME At present, this is wrong for table cells
+ return inset->allowParagraphCustomization();
}
namespace {
+ // FIXME
// 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.
+ // viz: InsetTableCell::useEmptyLayout() should return true, and
+ // InsetTableCell::forceEmptyLayout() should still return true
+ // unless the width has been set.
//
// The #include "insets/InsetText.h" can also be removed then.
bool inTableCell(Inset const * inset)
{
Inset const * const inset = inInset();
return inset &&
- (inTableCell(inset) || inInset()->useEmptyLayout());
+ (inTableCell(inset) || inset->useEmptyLayout());
}
virtual bool useEmptyLayout() const { return forceEmptyLayout(); }
/// if this inset has paragraphs should they be forced to use the
/// empty layout?
- virtual bool forceEmptyLayout() const { return false; }
+ virtual bool forceEmptyLayout(idx_type = 0) const { return false; }
/// if this inset has paragraphs should the user be allowed to
/// customize alignment, etc?
- virtual bool allowParagraphCustomization(idx_type) const { return true; }
+ virtual bool allowParagraphCustomization(idx_type = 0) const { return true; }
/// Is the width forced to some value?
virtual bool hasFixedWidth() const { return false; }
}
-bool InsetBox::forceEmptyLayout() const
+bool InsetBox::forceEmptyLayout(idx_type) const
{
return !params_.inner_box;
}
bool showInsetDialog(BufferView * bv) const;
///
DisplayType display() const { return Inline; }
- //FIXME Is this the one we want? or is it:
- //allowParagraphCustomization(idx_type)?
///
- bool forceEmptyLayout() const;
+ virtual bool allowParagraphCustomization(idx_type = 0)
+ { return forceEmptyLayout(); }
+ ///
+ virtual bool forceEmptyLayout(idx_type = 0) const;
///
bool neverIndent() const { return true; }
///
///
void addToToc(ParConstIterator const &) const;
///
- bool forceEmptyLayout() const { return true; }
+ virtual bool forceEmptyLayout(idx_type = 0) const { return true; }
/// Captions don't accept alignment, spacing, etc.
- bool allowParagraphCustomization(idx_type) const { return false; }
+ virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
///
Inset * clone() const { return new InsetCaption(*this); }
///
bool showInsetDialog(BufferView *) const;
///
- bool forceEmptyLayout() const { return true; }
+ virtual bool forceEmptyLayout(idx_type = 0) const { return true; }
///
- bool allowParagraphCustomization(idx_type) const { return false; }
+ virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
/// should paragraph indendation be omitted in any case?
bool neverIndent() const { return true; }
///
///
void read(Lexer & lex);
///
- virtual bool allowParagraphCustomization(idx_type) const { return false; }
+ virtual bool allowParagraphCustomization(idx_type = 0) const { return false; }
///
int plaintext(odocstream &, OutputParams const &) const;
}
+bool InsetTabular::forceEmptyLayout(idx_type cell) const
+{
+ return !tabular.getPWidth(cell).zero();
+}
+
+
bool InsetTabular::insertPlaintextString(BufferView & bv, docstring const & buf,
bool usePaste)
{
/// should all paragraphs be output with "Standard" layout?
virtual bool allowParagraphCustomization(idx_type cell = 0) const;
///
- virtual bool forceEmptyLayout() { return true; }
+ virtual bool forceEmptyLayout(idx_type cell = 0) const;
+ ///
+ virtual bool useEmptyLayout() { return true; }
///
void addPreview(graphics::PreviewLoader &) const;