Skip to content

Feat/move duplicate copy shape#1140

Open
ska-sleepy wants to merge 3 commits into
scanny:masterfrom
ska-sleepy:feat/move-duplicate-copy-shape
Open

Feat/move duplicate copy shape#1140
ska-sleepy wants to merge 3 commits into
scanny:masterfrom
ska-sleepy:feat/move-duplicate-copy-shape

Conversation

@ska-sleepy

Copy link
Copy Markdown

Implemented these while building a project that needed them. Sharing back since they've come up repeatedly in issues and users currently work around the gaps by poking _sldIdLst and _spTree directly.

Changes

Slides.move_slide(slide, position)

Reorders a slide to a 0-based position in the preses shift to accommodate. Implemented viaCT_SlideIdList manipulation, the same pattern used internally by the existing codebase.

Slides.duplicate_slide(slide, position=None)

Creates a clone of a slide and inserts it immediate explicit position). Related OPC parts images,charts, embedded objects are shared with the source rather than deep-copied, which avoids bloating the package with duplicate binaries.

Internally adds SlidePart.clone(source, package) XML element and reproduces the source'srelationships in ascending rId order. Preserving rId order is required because the slide XML embeds rId strings directly (e.g. r:embed="rId2" on picture shapes).

PresentationPart.duplicate_slide() delegates to rs the new part with the presentation.

Known limitation: notes slides attached to the

SlideShapes.add_copy_of(source_shape)

Appends a deep copy of a shape element from any slide onto this slide's shape tree. For picture and chart shapes the underlying OPC parts are shared with the source.

Tests

Unit tests added for all three methods. Full suite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant