Feat/move duplicate copy shape#1140
Open
ska-sleepy wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
_sldIdLstand_spTreedirectly.Changes
Slides.move_slide(slide, position)Reorders a slide to a 0-based position in the preses shift to accommodate. Implemented via
CT_SlideIdListmanipulation, 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.