mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 11:08:41 +00:00
Disable CAPTION_INSERT in tables except for longtable caption cells (bug #5777)
This commit is contained in:
parent
56ece75ad9
commit
3f0bf02cc7
@ -32,6 +32,7 @@
|
|||||||
#include "DispatchResult.h"
|
#include "DispatchResult.h"
|
||||||
#include "FuncRequest.h"
|
#include "FuncRequest.h"
|
||||||
#include "FuncStatus.h"
|
#include "FuncStatus.h"
|
||||||
|
#include "InsetList.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
#include "LaTeXFeatures.h"
|
#include "LaTeXFeatures.h"
|
||||||
#include "Lexer.h"
|
#include "Lexer.h"
|
||||||
@ -4698,6 +4699,31 @@ bool InsetTabular::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case LFUN_CAPTION_INSERT: {
|
||||||
|
// caption is only allowed in caption cell of longtable
|
||||||
|
if (!tabular.ltCaption(tabular.cellRow(cur.idx()))) {
|
||||||
|
status.setEnabled(false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// check if there is already a caption
|
||||||
|
bool have_caption = false;
|
||||||
|
InsetTableCell itc = InsetTableCell(*tabular.cellInset(cur.idx()).get());
|
||||||
|
ParagraphList::const_iterator pit = itc.paragraphs().begin();
|
||||||
|
ParagraphList::const_iterator pend = itc.paragraphs().end();
|
||||||
|
for (; pit != pend; ++pit) {
|
||||||
|
InsetList::const_iterator it = pit->insetList().begin();
|
||||||
|
InsetList::const_iterator end = pit->insetList().end();
|
||||||
|
for (; it != end; ++it) {
|
||||||
|
if (it->inset->lyxCode() == CAPTION_CODE) {
|
||||||
|
have_caption = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
status.setEnabled(!have_caption);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// These are only enabled inside tabular
|
// These are only enabled inside tabular
|
||||||
case LFUN_CELL_BACKWARD:
|
case LFUN_CELL_BACKWARD:
|
||||||
case LFUN_CELL_FORWARD:
|
case LFUN_CELL_FORWARD:
|
||||||
|
Loading…
Reference in New Issue
Block a user