commit c988183d6f5b1e1d24dda3bf0a3694fb7a65590d Author: Juergen Spitzmueller <sp...@lyx.org> Date: Sun Mar 2 09:52:37 2025 +0100
Lock deleted table cell for editing (#12799) --- src/insets/InsetTabular.cpp | 16 +++++++++++++++- src/insets/InsetTabular.h | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 2de2caa8ba..6d1556caa9 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -4795,7 +4795,7 @@ bool Tabular::hasNewlines(idx_type cell) const InsetTableCell::InsetTableCell(Buffer * buf) : InsetText(buf, InsetText::PlainLayout), isFixedWidth(false), isVarwidth(false), isMultiColumn(false), isMultiRow(false), mr_rows(1), isCaptionRow(false), - contentAlign(LYX_ALIGN_CENTER) + contentAlign(LYX_ALIGN_CENTER), isDeleted(false) {} bool InsetTableCell::allowParagraphCustomization(idx_type) const @@ -4819,9 +4819,23 @@ ColorCode InsetTableCell::backgroundColor(PainterInfo const & pi) const } +void InsetTableCell::setChange(Change const & change) +{ + // Mark cell deleted + isDeleted = change.deleted(); + + InsetText::setChange(change); +} + + bool InsetTableCell::getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const { + if (isDeleted) { + status.message(from_utf8(N_("This portion of the document is deleted."))); + status.setEnabled(false); + return true; + } bool enabled = true; switch (cmd.action()) { case LFUN_INSET_SPLIT: diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h index a24d10a845..5687e61acf 100644 --- a/src/insets/InsetTabular.h +++ b/src/insets/InsetTabular.h @@ -107,6 +107,8 @@ public: bool canPaintChange(BufferView const &) const override { return false; } /// This assures we never output \maketitle in table cells bool isInTitle() const override { return true; } + /// + void setChange(Change const & change) override; private: /// InsetTableCell() = delete; @@ -154,6 +156,8 @@ private: LyXAlignment contentAlign; /// std::string background_color; + /// + bool isDeleted; /// should paragraph indentation be omitted in any case? bool neverIndent() const override { return true; } /// -- lyx-cvs mailing list lyx-cvs@lists.lyx.org https://lists.lyx.org/mailman/listinfo/lyx-cvs