- case LFUN_BREAK_PARAGRAPH:
- status.setEnabled(false);
- return true;
-
- case LFUN_ARGUMENT_INSERT:
- status.setEnabled(cur.paragraph().insetList().find(ARG_CODE) == -1);
- return true;
+ case LFUN_INSET_MODIFY: {
+ string const first_arg = cmd.getArg(0);
+ if (first_arg == "changetype") {
+ string const type = cmd.getArg(1);
+ status.setOnOff(type == type_);
+ bool varia = type != "Unnumbered";
+ // check if the immediate parent inset allows caption variation
+ if (cur.depth() > 1) {
+ varia = cur[cur.depth() - 2].inset().allowsCaptionVariation(type);
+ }
+ status.setEnabled(varia
+ && buffer().params().documentClass().hasInsetLayout(
+ from_ascii("Caption:" + type)));
+ return true;
+ }
+ return InsetText::getStatus(cur, cmd, status);
+ }