pub struct DeckSession { /* private fields */ }Implementations§
Source§impl DeckSession
impl DeckSession
Sourcepub fn validate_edits(
&self,
request: &EditRequest,
) -> EditResult<ValidationOutcome>
pub fn validate_edits( &self, request: &EditRequest, ) -> EditResult<ValidationOutcome>
Resolves, stages and rehearses a batch like DeckSession::apply_edits, then discards
it: nothing changes and no ids are reserved. Err means an internal failure.
Sourcepub fn apply_edits(&self, request: &EditRequest) -> EditResult<EditOutcome>
pub fn apply_edits(&self, request: &EditRequest) -> EditResult<EditOutcome>
Applies every step or none, resolving all targets against expect_version. Policy
failures come back as an EditRefusal with the deck, history and id allocation
untouched; Err means an internal failure. An applied batch commits one transaction.
Source§impl DeckSession
impl DeckSession
pub fn add_comment( &self, context: &EditCtx, slide_id: &str, author: &str, initials: &str, text: &str, created: &str, x_emu: i64, y_emu: i64, ) -> EditResult<CommentReceipt>
pub fn reply_to_comment( &self, context: &EditCtx, comment_id: &str, author: &str, initials: &str, text: &str, created: &str, ) -> EditResult<CommentReceipt>
pub fn set_comment_position( &self, context: &EditCtx, comment_id: &str, x_emu: i64, y_emu: i64, ) -> EditResult<CommentReceipt>
pub fn set_comment_status( &self, context: &EditCtx, comment_id: &str, resolved: bool, ) -> EditResult<CommentReceipt>
pub fn remove_comment( &self, context: &EditCtx, comment_id: &str, ) -> EditResult<CommentReceipt>
pub fn set_comment_flavor( &self, context: &EditCtx, flavor: CommentFlavor, ) -> EditResult<CommentFlavor>
pub fn comments(&self) -> EditResult<Vec<CommentSnapshot>>
pub fn comment_flavor(&self) -> EditResult<CommentFlavor>
Source§impl DeckSession
impl DeckSession
pub fn snapshot(&self) -> EditResult<DeckSnapshot>
Sourcepub fn slide_ids(&self) -> EditResult<Vec<String>>
pub fn slide_ids(&self) -> EditResult<Vec<String>>
Slide ids in deck order, matching snapshot().slides without walking shapes.
Sourcepub fn slide_scope(&self, slide_index: usize) -> EditResult<SlideScope>
pub fn slide_scope(&self, slide_index: usize) -> EditResult<SlideScope>
Snapshot one slide without materializing the rest of the deck.
pub fn insert_slide( &self, context: &EditCtx, index: u32, layout_part_path: Option<&str>, ) -> EditResult<SlideReceipt>
pub fn set_slide_layout( &self, context: &EditCtx, slide_id: &str, layout_part_path: &str, mapping: &[(String, u32)], ) -> EditResult<()>
pub fn duplicate_slide( &self, context: &EditCtx, slide_id: &str, index: u32, ) -> EditResult<SlideReceipt>
pub fn set_slide_notes( &self, context: &EditCtx, slide_id: &str, text: &str, ) -> EditResult<()>
Sourcepub fn set_slide_background(
&self,
context: &EditCtx,
slide_id: &str,
background: Option<&ShapeFill>,
) -> EditResult<SlideBackgroundReceipt>
pub fn set_slide_background( &self, context: &EditCtx, slide_id: &str, background: Option<&ShapeFill>, ) -> EditResult<SlideBackgroundReceipt>
Replaces a slide’s background; None removes the declaration so the
layout or master background shows.
pub fn delete_slide( &self, context: &EditCtx, slide_id: &str, ) -> EditResult<SlideReceipt>
pub fn move_slide( &self, context: &EditCtx, slide_id: &str, to_index: u32, ) -> EditResult<SlideReceipt>
pub fn add_text_box( &self, context: &EditCtx, slide_id: &str, draft: &ShapeDraft, ) -> EditResult<ShapeReceipt>
pub fn add_shape( &self, context: &EditCtx, slide_id: &str, draft: &PresetShapeDraft, ) -> EditResult<ShapeReceipt>
Sourcepub fn media_bytes(&self, asset_id: &str) -> EditResult<Vec<u8>>
pub fn media_bytes(&self, asset_id: &str) -> EditResult<Vec<u8>>
Resolves a display-list image from the source package or shared edits.
Sourcepub fn add_picture(
&self,
context: &EditCtx,
slide_id: &str,
draft: &PictureDraft,
) -> EditResult<ShapeReceipt>
pub fn add_picture( &self, context: &EditCtx, slide_id: &str, draft: &PictureDraft, ) -> EditResult<ShapeReceipt>
save mints the media part, content-type default and relationship.
pub fn set_shape_fill( &self, context: &EditCtx, slide_id: &str, shape_id: &str, color: Option<&str>, ) -> EditResult<ShapeFillReceipt>
pub fn set_shape_stroke( &self, context: &EditCtx, slide_id: &str, shape_id: &str, stroke: &ShapeStroke, ) -> EditResult<ShapeStrokeReceipt>
pub fn set_shape_adjust( &self, context: &EditCtx, slide_id: &str, shape_id: &str, adjustments: &BTreeMap<String, f64>, ) -> EditResult<ShapeAdjustReceipt>
pub fn remove_shape( &self, context: &EditCtx, slide_id: &str, shape_id: &str, ) -> EditResult<ShapeReceipt>
pub fn move_shape( &self, context: &EditCtx, slide_id: &str, shape_id: &str, x: i64, y: i64, ) -> EditResult<TransformReceipt>
Sourcepub fn bring_to_front(
&self,
context: &EditCtx,
slide_id: &str,
shape_id: &str,
) -> EditResult<ShapeZOrderReceipt>
pub fn bring_to_front( &self, context: &EditCtx, slide_id: &str, shape_id: &str, ) -> EditResult<ShapeZOrderReceipt>
Moves a shape to the top of its slide’s paint order (drawn last).
Sourcepub fn send_to_back(
&self,
context: &EditCtx,
slide_id: &str,
shape_id: &str,
) -> EditResult<ShapeZOrderReceipt>
pub fn send_to_back( &self, context: &EditCtx, slide_id: &str, shape_id: &str, ) -> EditResult<ShapeZOrderReceipt>
Moves a shape to the bottom of its slide’s paint order (drawn first).
Sourcepub fn bring_forward(
&self,
context: &EditCtx,
slide_id: &str,
shape_id: &str,
) -> EditResult<ShapeZOrderReceipt>
pub fn bring_forward( &self, context: &EditCtx, slide_id: &str, shape_id: &str, ) -> EditResult<ShapeZOrderReceipt>
Swaps a shape one step later in its slide’s paint order.
Sourcepub fn send_backward(
&self,
context: &EditCtx,
slide_id: &str,
shape_id: &str,
) -> EditResult<ShapeZOrderReceipt>
pub fn send_backward( &self, context: &EditCtx, slide_id: &str, shape_id: &str, ) -> EditResult<ShapeZOrderReceipt>
Swaps a shape one step earlier in its slide’s paint order.
pub fn resize_shape( &self, context: &EditCtx, slide_id: &str, shape_id: &str, width: i64, height: i64, ) -> EditResult<TransformReceipt>
pub fn set_shape_rect( &self, context: &EditCtx, slide_id: &str, shape_id: &str, rect: ShapeRect, ) -> EditResult<TransformReceipt>
Source§impl DeckSession
impl DeckSession
pub fn story_formatting( &self, slide_id: &str, shape_id: &str, story_id: &str, ) -> EditResult<StorySnapshot>
Source§impl DeckSession
impl DeckSession
Sourcepub fn preview_proposal_diff_slide(
&self,
id: &str,
slide_index: usize,
) -> ProposalResult<ProposalSlideDiff>
pub fn preview_proposal_diff_slide( &self, id: &str, slide_index: usize, ) -> ProposalResult<ProposalSlideDiff>
Slide-scoped preview_proposal_diff.
Sourcepub fn preview_proposal_diff(
&self,
id: &str,
) -> ProposalResult<ProposalDiffPreview>
pub fn preview_proposal_diff( &self, id: &str, ) -> ProposalResult<ProposalDiffPreview>
Builds a render-only snapshot whose offsets are not editable.
Source§impl DeckSession
impl DeckSession
pub fn propose(&self, request: ProposalRequest) -> ProposalResult<Proposal>
pub fn proposals(&self) -> ProposalResult<Vec<Proposal>>
pub fn preview_proposal(&self, id: &str) -> ProposalResult<ProposalPreview>
pub fn proposal_preview_session(&self, id: &str) -> ProposalResult<DeckSession>
pub fn accept_proposal( &self, id: &str, force: bool, ) -> ProposalResult<ProposalAcceptance>
pub fn reject_proposal(&self, id: &str) -> bool
Source§impl DeckSession
impl DeckSession
Sourcepub fn save(&self) -> EditResult<Vec<u8>>
pub fn save(&self) -> EditResult<Vec<u8>>
Serializes the deck with all edits applied. Untouched slides keep their exact source part bytes; edited slides are patched at the XML level.
Source§impl DeckSession
impl DeckSession
Sourcepub fn search_text(
&self,
query: &str,
case_sensitive: bool,
limit: Option<usize>,
) -> EditResult<Vec<TextSearchMatch>>
pub fn search_text( &self, query: &str, case_sensitive: bool, limit: Option<usize>, ) -> EditResult<Vec<TextSearchMatch>>
Searches slides, shapes, and table cells in document order.
Source§impl DeckSession
impl DeckSession
pub fn story(&self, story_id: &str) -> EditResult<StorySnapshot>
pub fn anchor_caret( &self, story_id: &str, index: u32, ) -> EditResult<CaretAnchor>
pub fn resolve_caret_anchor(&self, anchor: &CaretAnchor) -> Option<u32>
pub fn set_story_paragraphs( &self, context: &EditCtx, story_id: &str, paragraphs: &[TextParagraphDraft], ) -> EditResult<StorySnapshot>
pub fn insert_text( &self, context: &EditCtx, story_id: &str, index: u32, text: &str, style: &TextStyle, ) -> EditResult<TextReceipt>
pub fn delete_text( &self, context: &EditCtx, story_id: &str, start: u32, end: u32, ) -> EditResult<TextReceipt>
pub fn delete_text_joining_paragraphs( &self, context: &EditCtx, story_id: &str, start: u32, end: u32, ) -> EditResult<TextReceipt>
pub fn format_text( &self, context: &EditCtx, story_id: &str, start: u32, end: u32, patch: &TextStylePatch, ) -> EditResult<TextReceipt>
Sourcepub fn set_paragraph_alignment(
&self,
context: &EditCtx,
story_id: &str,
start: u32,
end: u32,
alignment: Option<&str>,
) -> EditResult<TextReceipt>
pub fn set_paragraph_alignment( &self, context: &EditCtx, story_id: &str, start: u32, end: u32, alignment: Option<&str>, ) -> EditResult<TextReceipt>
Sets a:pPr@algn on every paragraph the range touches; None clears
the value so the placeholder cascade applies again.
pub fn insert_paragraph_break( &self, context: &EditCtx, story_id: &str, index: u32, ) -> EditResult<TextReceipt>
pub fn delete_paragraph_break( &self, context: &EditCtx, story_id: &str, index: u32, ) -> EditResult<TextReceipt>
Source§impl DeckSession
impl DeckSession
Sourcepub fn export_structured(
&self,
options: &PptxExportOptions,
) -> EditResult<PptxExportResult<PptxStructuredContent>>
pub fn export_structured( &self, options: &PptxExportOptions, ) -> EditResult<PptxExportResult<PptxStructuredContent>>
Exports the committed deck with the version it was read at; anchors are scoped to that
version. Nothing is mutated, minted, published or laid out, and pending input is not
flushed. Refusals are the inner Err.
Sourcepub fn export_markdown(
&self,
options: &PptxExportOptions,
) -> EditResult<PptxExportResult<PptxMarkdownContent>>
pub fn export_markdown( &self, options: &PptxExportOptions, ) -> EditResult<PptxExportResult<PptxMarkdownContent>>
DeckSession::export_structured rendered as Markdown from that one read.
Source§impl DeckSession
impl DeckSession
pub fn insert_table_row( &self, context: &EditCtx, slide_id: &str, shape_id: &str, index: u32, position: TableInsertPosition, cells: &[String], ) -> EditResult<TableReceipt>
pub fn delete_table_row( &self, context: &EditCtx, slide_id: &str, shape_id: &str, index: u32, ) -> EditResult<TableReceipt>
pub fn insert_table_column( &self, context: &EditCtx, slide_id: &str, shape_id: &str, index: u32, position: TableInsertPosition, cells: &[String], ) -> EditResult<TableReceipt>
pub fn delete_table_column( &self, context: &EditCtx, slide_id: &str, shape_id: &str, index: u32, ) -> EditResult<TableReceipt>
Sourcepub fn check_table_edit(
&self,
edit: TableEdit,
slide_id: &str,
shape_id: &str,
index: u32,
position: TableInsertPosition,
cells: &[String],
) -> EditResult<()>
pub fn check_table_edit( &self, edit: TableEdit, slide_id: &str, shape_id: &str, index: u32, position: TableInsertPosition, cells: &[String], ) -> EditResult<()>
Runs every check of a table structure edit without changing the deck.
Source§impl DeckSession
impl DeckSession
Sourcepub fn read_content(&self, request: &ReadRequest) -> EditResult<ReadOutcome>
pub fn read_content(&self, request: &ReadRequest) -> EditResult<ReadOutcome>
Slides and the projected text of their stories, with the version they were read at.
Sourcepub fn find_text(&self, request: &FindRequest) -> EditResult<FindOutcome>
pub fn find_text(&self, request: &FindRequest) -> EditResult<FindOutcome>
Exact, case-sensitive, paragraph-local matches; overlapping occurrences count separately.
Source§impl DeckSession
impl DeckSession
pub fn open(bytes: &[u8], client_id: u64) -> EditResult<Self>
Sourcepub fn from_package(package: PptxPackage, client_id: u64) -> EditResult<Self>
pub fn from_package(package: PptxPackage, client_id: u64) -> EditResult<Self>
Opens an edit session from an already parsed package. The fingerprint
is taken from a re-zip of the package; prefer
Self::from_package_with_source when the file bytes are at hand, so
peers can match them against the update.
Sourcepub fn from_package_with_source(
package: PptxPackage,
source: &[u8],
client_id: u64,
) -> EditResult<Self>
pub fn from_package_with_source( package: PptxPackage, source: &[u8], client_id: u64, ) -> EditResult<Self>
Opens an edit session from a parsed package, fingerprinting the file bytes it was parsed from.
pub fn open_from_update(update: &[u8], client_id: u64) -> EditResult<Self>
Sourcepub fn open_from_update_with_source(
update: &[u8],
source: &[u8],
client_id: u64,
) -> EditResult<Self>
pub fn open_from_update_with_source( update: &[u8], source: &[u8], client_id: u64, ) -> EditResult<Self>
Like Self::open_from_update, but re-attaches the source file the
update was seeded from, so the session can save. The bytes must hash to
the fingerprint recorded in the update.
pub fn client_id(&self) -> u64
pub fn package(&self) -> &PptxPackage
pub fn yrs_doc(&self) -> &Doc
pub fn encode_state_vector_v1(&self) -> Vec<u8> ⓘ
pub fn encode_state_as_update_v1(&self) -> Vec<u8> ⓘ
Sourcepub fn version(&self) -> DocumentVersion
pub fn version(&self) -> DocumentVersion
The optimistic-concurrency token of the committed deck state.
It changes with every committed change, local or remote, undo and redo included. It is scoped to this session: a token from another session, even of the same file, never matches.
pub fn encode_diff_v1(&self, remote_state_vector: &[u8]) -> EditResult<Vec<u8>>
pub fn apply_update_v1(&self, bytes: &[u8]) -> EditResult<DeckSnapshot>
Sourcepub fn observe_update_v1<F>(&self, callback: F) -> EditResult<Subscription>where
F: Fn(UpdateEvent) + 'static,
pub fn observe_update_v1<F>(&self, callback: F) -> EditResult<Subscription>where
F: Fn(UpdateEvent) + 'static,
A remote update whose integration also deleted formatting it did not carry is followed by a local delete-only update with those deletions, for peers.
pub fn undo(&self) -> bool
pub fn redo(&self) -> bool
Sourcepub fn clear_undo_history(&self)
pub fn clear_undo_history(&self)
Clears local undo and redo history.
Sourcepub fn set_collaborative(&self) -> EditResult<()>
pub fn set_collaborative(&self) -> EditResult<()>
Marks this session as part of a shared session: structural table operations are refused from now on, and local structural table undo and redo items are dropped.
pub fn is_collaborative(&self) -> bool
Sourcepub fn take_discarded_table_edits(&self) -> Vec<String>
pub fn take_discarded_table_edits(&self) -> Vec<String>
Shape ids of tables whose local structural edit lost to a concurrent remote structural edit since the last call. The remote structure is kept and the local edit is discarded.