Add layout support via GridLayoutBase #58
Draft
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.
This adds support for layouting slides using GridLayoutBase as suggested in #48 with the big disclaimer that I don't think I'm even close to groking everything the package is capable of.
Fwiw, I asked if using GridLayoutBase outside of Makie here and got a reply from the maintainer.
I have tried to make as few changes as possible to existing codebase to make reviewing easier for now.
The API is basically identical to the suggestion in #48 (comment).
Example
Produces the following slide:
![image.png](https://private-user-images.githubusercontent.com/36208552/350649469-dd40d1aa-c8d8-45f8-92c4-4e90fdf01e36.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNjY2OTIsIm5iZiI6MTczOTA2NjM5MiwicGF0aCI6Ii8zNjIwODU1Mi8zNTA2NDk0NjktZGQ0MGQxYWEtYzhkOC00NWY4LTkyYzQtNGU5MGZkZjAxZTM2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA5VDAxNTk1MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQwMjBlNjJlMmRjMWZmNDk1YjM2ZThiNzg5YzIwYTNkMzcyYzcxNDMxNzQwMDcxODZiMTE2ZjA1OWEwOTVmNWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.SZ9GKbWqDPuJ-8-oPf1-0EJPsPcUg6qPQC0yYK2UkHU)
I would have preferred and API where the
ShapeLayout
does not implicitly modify theSlide
and instead was added as just another shape.The reason this does not fly here is that
make_slide
assumes that each element of shape is one single unique shape. Rewritingmake_xml
so it returns a next shape id and an array of arrays with xml would allow for the shapes inSlide.shapes
to be aShapeLayout
(which may contain otherShapeLayout
s).I'm also not sure how much users are expected to interact with the
GridLayout
. The current implementation has some gottchas for such users, mainly that all units are in EMU (just to make things consistent with the rest of PPTX) and that top and bottom use negative values since the y-axis is pointing from top of the slide to the bottom in PPTX while GridLayoutBase assumes the opposite. This is somewhat protected against by wrapping theGridLayout
inShapeLayout
so that accessing it becomes accessing package internals.I realized when I was implementing that PPTX.jl does not seem to have functionality for importing/interpreting the slide layout integer given to power point. If it did, it would be much easier to give reasonable defaults for the
ShapeLayout
bounding box.