MoveDocumentCommand.h header

#include <ew/core/MoveDocumentCommand.h>

Namespace ew::core

MoveDocumentCommand class

class ew::core::MoveDocumentCommand

Command that moves a document within the manuscript tree: it becomes a child of a new parent (a null id makes it top-level) and is inserted at a target position among that parent's children. Affected siblings are renumbered so their sort indices stay contiguous. A move that would place a document inside its own subtree is rejected and applied as a no-op. Undo restores the parent and position of every document the move touched.

Members

ew::core::document::MoveDocumentCommand::MoveDocumentCommand(ew::core::project::Project &project, ew::core::foundation::ContentId documentId, ew::core::foundation::ContentId newParentId, int targetIndex)

Creates a command that, when applied, moves documentId under newParentId at targetIndex (clamped to the destination sibling count) within project.

ew::core::document::MoveDocumentCommand::~MoveDocumentCommand() override

Destroys the command.

void ew::core::document::MoveDocumentCommand::apply() override

Applies the move, recording the previous placement of every touched document.

void ew::core::document::MoveDocumentCommand::undo() override

Restores the parent and position of every document the move touched.

QString ew::core::document::MoveDocumentCommand::description() const override

Returns a short description for the undo/redo UI.

Placement struct

struct ew::core::Placement

The parent and position a document had before the move, captured for undo.

Members

ew::core::foundation::ContentId ew::core::document::MoveDocumentCommand::Placement::parentId

The parent the document had before the move.

int ew::core::document::MoveDocumentCommand::Placement::sortIndex

The document's position among its siblings before the move.