Fix a bug that allowed setting of layouts inside optional arguments.

There is more that could be done here.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26303 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-09-04 21:50:14 +00:00
parent 827f28a1b1
commit 2807761e65
2 changed files with 18 additions and 7 deletions

View File

@ -615,7 +615,10 @@ bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const
{
switch (cmd.action) {
// suppress these
// FIXME At present, these are being enabled and disabled according to
// whether PASSTHRU has been set in the InsetLayout. This makes some
// sense, but there are other checks that should really be done. E.g.,
// one should not be able to inset IndexPrint inside an optional argument!!
case LFUN_ACCENT_ACUTE:
case LFUN_ACCENT_BREVE:
case LFUN_ACCENT_CARON:
@ -668,8 +671,6 @@ bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_LABEL_INSERT:
case LFUN_LINE_INSERT:
case LFUN_NEWPAGE_INSERT:
case LFUN_LAYOUT:
case LFUN_LAYOUT_PARAGRAPH:
case LFUN_LAYOUT_TABULAR:
case LFUN_MARGINALNOTE_INSERT:
case LFUN_MATH_DISPLAY:
@ -683,10 +684,6 @@ bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_NOTE_INSERT:
case LFUN_NOTE_NEXT:
case LFUN_OPTIONAL_INSERT:
case LFUN_PARAGRAPH_PARAMS:
case LFUN_PARAGRAPH_PARAMS_APPLY:
case LFUN_PARAGRAPH_SPACING:
case LFUN_PARAGRAPH_UPDATE:
case LFUN_REFERENCE_NEXT:
case LFUN_SERVER_GOTO_FILE_ROW:
case LFUN_SERVER_NOTIFY:
@ -702,6 +699,18 @@ bool InsetCollapsable::getStatus(Cursor & cur, FuncRequest const & cmd,
}
return InsetText::getStatus(cur, cmd, flag);
case LFUN_LAYOUT:
flag.setEnabled(!forcePlainLayout());
return true;
case LFUN_LAYOUT_PARAGRAPH:
case LFUN_PARAGRAPH_PARAMS:
case LFUN_PARAGRAPH_PARAMS_APPLY:
case LFUN_PARAGRAPH_SPACING:
case LFUN_PARAGRAPH_UPDATE:
flag.setEnabled(allowParagraphCustomization());
return true;
case LFUN_INSET_TOGGLE:
if (cmd.argument() == "open")
flag.setEnabled(status_ != Open);

View File

@ -46,6 +46,8 @@ private:
int plaintext(odocstream &, OutputParams const &) const;
/// Standard DocBook output -- short-circuited
int docbook(odocstream &, OutputParams const &) const;
///
virtual bool forcePlainLayout(idx_type = 0) const { return true; }
/// Write out to the .lyx file
void write(std::ostream & os) const;