Commit 2e955cfc authored by jan.koester's avatar jan.koester
Browse files

test

parent 08415bcd
Loading
Loading
Loading
Loading
+41 −11
Changes for src/webedit/table/table.cpp: 41 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -638,24 +638,54 @@ extern "C" {
                    el.appendChild(cssStyle);
                }

                // Recursively render children
                const EditPlugin *cur = child;
                while (cur) {
                    cur->Render(el);
                    cur = cur->nextElement();
                }

                el.appendChild(table);
            }

            // --- Element Management (Table is a leaf widget — content-managed internally) ---
            bool canHaveChildren() const override { return false; }
            bool haveChilds() override { return false; }
            // --- Element Management ---
            bool canHaveChildren() const override { return true; }
            bool haveChilds() override { return child != nullptr; }

            void setChildElement(const EditPlugin &) override {
                logError("Table manages its own cells; cannot set child elements.");
            void setChildElement(const EditPlugin &el) override {
                child = const_cast<EditPlugin*>(&el);
            }
            void unsetChildElement(const EditPlugin &el) override {
                if (child == &el) {
                    child = const_cast<EditPlugin*>(el.nextElement());
                }
            }
            void addNextElement(const EditPlugin &el) override {
                EditPlugin *newEl = const_cast<EditPlugin*>(&el);
                if (!child) {
                    setChildElement(el);
                    return;
                }
            void unsetChildElement(const EditPlugin &) override {
                logError("Table manages its own cells; cannot unset child elements.");
                EditPlugin *cur = child;
                while (cur->nextElement() != nullptr) {
                    cur = const_cast<EditPlugin*>(cur->nextElement());
                }
                cur->setNextEl(newEl);
            }
            void remNextElement(const EditPlugin &el) override {
                if (!child) return;
                if (child == &el) {
                    unsetChildElement(el);
                    return;
                }
                EditPlugin *cur = child;
                while (cur->nextElement() != nullptr) {
                    if (cur->nextElement() == &el) {
                        cur->setNextEl(const_cast<EditPlugin*>(el.nextElement()));
                        return;
                    }
            void addNextElement(const EditPlugin &) override {
                logError("Table does not support addNextElement.");
                    cur = const_cast<EditPlugin*>(cur->nextElement());
                }
            void remNextElement(const EditPlugin &) override {
                logError("Table does not support remNextElement.");
            }
        };
    };