Flip is refused on a SmartArt graphic instead of turning it into a plain group

PowerPoint greys Flip out for a SmartArt graphic (SmartArt Design ▸ Right to
Left is the way to mirror it), also inside a group, as ungrouping would hand
the flip to the graphic. Before, a flip turned it into a plain group that the
smartArt.* commands then refused. arrange.flipHorizontal and flipVertical
reach the check through shape.flip. Split out of the SmartArt PR at review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Zach Berry
2026-11-04 20:09:40 -06:00
co-authored by Claude Opus 5.5
parent 52f87aca13
commit fe35df948c
2 changed files with 34 additions and 0 deletions
+10
View File
@@ -191,6 +191,16 @@ pub(super) fn rotate(s: &mut Session, p: &Value) -> Result<Value> {
pub(super) fn flip(s: &mut Session, p: &Value) -> Result<Value> {
let v = str_param(p, "axis").unwrap_or("horizontal").starts_with('v');
edit_geometry(s, p, "shape.flip", |sh| {
// PowerPoint greys Flip out for a SmartArt graphic (SmartArt Design > Right to Left mirrors it),
// also inside a group: ungrouping would hand the flip to the graphic.
let mut graphic = false;
deckcraft_model::walk(std::slice::from_ref(&*sh), &mut |x, _| graphic |= x.diagram.is_some());
if graphic {
return Err(bad(
"shape.flip",
"Flip is not available for a SmartArt graphic (it would turn it into a plain group); use `smartArt.layout` to change how it is laid out",
));
}
if let Some(x) = sh.xfrm.as_mut() {
if v {
x.flip_v = !x.flip_v;