dknowc-dsh 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -4
- package/package.json +2 -2
- package/skills/dknowc-official-doc-writer/SKILL.md +17 -8
- package/skills/dknowc-official-doc-writer/reference/sample_search_result.md +48 -0
- package/skills/dknowc-official-doc-writer/reference/sample_trace_report.html +75 -0
- package/skills/dknowc-official-doc-writer/reference/search_intro.md +72 -8
- package/skills/dknowc-official-doc-writer/scripts/register.mjs +1 -1
- package/skills/dknowc-ppt-assistant/README.md +54 -0
- package/skills/dknowc-ppt-assistant/SKILL.md +151 -0
- package/skills/dknowc-ppt-assistant/THIRD_PARTY_NOTICES.md +36 -0
- package/skills/dknowc-ppt-assistant/official-docs/output/.gitkeep +0 -0
- package/skills/dknowc-ppt-assistant/official-docs/search-results/.gitkeep +0 -0
- package/skills/dknowc-ppt-assistant/projects/.gitkeep +0 -0
- package/skills/dknowc-ppt-assistant/references/content-pack.md +55 -0
- package/skills/dknowc-ppt-assistant/references/material_usage.md +51 -0
- package/skills/dknowc-ppt-assistant/references/sample_effect.html +89 -0
- package/skills/dknowc-ppt-assistant/references/sample_search_result.md +48 -0
- package/skills/dknowc-ppt-assistant/references/search_intro.md +79 -0
- package/skills/dknowc-ppt-assistant/references/style-presets.md +126 -0
- package/skills/dknowc-ppt-assistant/references/svg-authoring.md +81 -0
- package/skills/dknowc-ppt-assistant/references/upstream-docs/svg-pipeline.md +842 -0
- package/skills/dknowc-ppt-assistant/references/upstream-example/01_cover.svg +28 -0
- package/skills/dknowc-ppt-assistant/references/upstream-example/02_quote.svg +38 -0
- package/skills/dknowc-ppt-assistant/references/upstream-example/03_origin.svg +96 -0
- package/skills/dknowc-ppt-assistant/references/upstream-example/README.md +15 -0
- package/skills/dknowc-ppt-assistant/references/upstream-example/design_spec.md +408 -0
- package/skills/dknowc-ppt-assistant/references/upstream-example/spec_lock.md +78 -0
- package/skills/dknowc-ppt-assistant/scripts/adapt_mcp_result.py +279 -0
- package/skills/dknowc-ppt-assistant/scripts/check_release.py +106 -0
- package/skills/dknowc-ppt-assistant/scripts/compact_svg_coordinates.py +345 -0
- package/skills/dknowc-ppt-assistant/scripts/config.py +707 -0
- package/skills/dknowc-ppt-assistant/scripts/console_encoding.py +33 -0
- package/skills/dknowc-ppt-assistant/scripts/error_helper.py +434 -0
- package/skills/dknowc-ppt-assistant/scripts/finalize_svg.py +507 -0
- package/skills/dknowc-ppt-assistant/scripts/hyperlink_contract.py +399 -0
- package/skills/dknowc-ppt-assistant/scripts/initialize.py +182 -0
- package/skills/dknowc-ppt-assistant/scripts/language_tags.py +283 -0
- package/skills/dknowc-ppt-assistant/scripts/mcp_direct.py +158 -0
- package/skills/dknowc-ppt-assistant/scripts/native_payloads.py +655 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_animation_presets.json +3440 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_animations.py +3965 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_effects.py +143 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_opc_validation.py +346 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/__init__.py +130 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/LICENSE-APACHE-2.0.txt +202 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/LICENSE-OPEN-XML-SDK-MIT.txt +23 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/NOTICE.md +54 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/presetShapeDefinitions.xml +19898 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/presetShapeSemantics.json +1217 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/data/shape_type_values.txt +187 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/errors.py +39 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/formula.py +336 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/loader.py +364 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/models.py +201 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/registry.py +270 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/semantic_hash.py +456 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/semantics.py +543 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_shapes/xml_safety.py +21 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/__init__.py +21 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/animation_import.py +287 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/chart_to_svg.py +2377 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/chartex_to_svg.py +422 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/color_resolver.py +894 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/converter.py +1143 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/custgeom_to_svg.py +165 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/effect_to_svg.py +410 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/emu_units.py +258 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/fill_to_svg.py +816 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/formula_import.py +611 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/hyperlinks.py +93 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/import_diagnostics.py +37 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/ln_to_svg.py +362 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/normalized_chart_svg.py +1217 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/ooxml_loader.py +506 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/pic_to_svg.py +653 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_authoring.py +894 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_registry_to_svg.py +216 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/preset_svg_markup.py +198 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/prstgeom_to_svg.py +162 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/shape_walker.py +556 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/slide_to_svg.py +2002 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/tbl_to_svg.py +1841 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/transition_import.py +201 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_to_svg/txbody_to_svg.py +1433 -0
- package/skills/dknowc-ppt-assistant/scripts/pptx_transitions.py +3153 -0
- package/skills/dknowc-ppt-assistant/scripts/preset_shape_svg.py +450 -0
- package/skills/dknowc-ppt-assistant/scripts/project_utils.py +645 -0
- package/skills/dknowc-ppt-assistant/scripts/register_key.mjs +183 -0
- package/skills/dknowc-ppt-assistant/scripts/register_template.py +1327 -0
- package/skills/dknowc-ppt-assistant/scripts/render_trace_html.py +1048 -0
- package/skills/dknowc-ppt-assistant/scripts/resource_paths.py +282 -0
- package/skills/dknowc-ppt-assistant/scripts/shape_boolean_svg.py +189 -0
- package/skills/dknowc-ppt-assistant/scripts/slide_roster.py +44 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/__init__.py +12 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/align_embed_images.py +672 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/crop_images.py +370 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/embed_icons.py +564 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/embed_images.py +288 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/fix_image_aspect.py +389 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/flatten_tspan.py +948 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_finalize/svg_rect_to_path.py +346 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/__init__.py +15 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/checker.py +7791 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/cli.py +193 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/svg_contracts.py +1121 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_quality/xml_support.py +35 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_quality_checker.py +59 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/__init__.py +37 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/animation_config.py +1622 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/canvas_contract.py +226 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/__init__.py +1 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/context.py +291 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/converter.py +1980 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/elements.py +5272 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/hyperlinks.py +162 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/paths.py +847 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/styles.py +752 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/text_properties.py +796 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/theme_colors.py +283 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/theme_fonts.py +330 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/drawingml/utils.py +3555 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/geometry_properties.py +140 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/__init__.py +356 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/chart_data.py +1449 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/chart_style.py +886 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/chart_xml.py +1495 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/chartex.py +272 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/fallback_hash.py +161 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula.py +243 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_ast.py +592 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_compiler.py +96 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_omml.py +1049 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_parser.py +2181 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_profile.py +739 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/formula_run_properties.py +234 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/inline_formula.py +311 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/marker_attributes.py +182 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/marker_common.py +806 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/marker_status.py +190 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/table.py +1113 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/native_objects/workbook.py +216 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/__init__.py +1 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/builder.py +6273 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/cli.py +2059 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/dimensions.py +189 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/discovery.py +120 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/media.py +160 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/narration.py +696 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/notes.py +336 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/slide_xml.py +138 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/template_structure.py +3457 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/pptx_package/template_validation.py +1536 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/semantic_markers.py +240 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/shape_boolean.py +1355 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/text_outline.py +1121 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/tspan_flattener.py +64 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx/use_expander.py +577 -0
- package/skills/dknowc-ppt-assistant/scripts/svg_to_pptx.py +21 -0
- package/skills/dknowc-ppt-assistant/scripts/trusted_search.py +336 -0
- package/skills/dknowc-ppt-assistant/scripts/update_spec.py +404 -0
- package/skills/dknowc-ppt-assistant/workflows/generate-pptx.md +142 -0
- package/skills/dknowc-ppt-assistant/workflows/routing.md +38 -0
- package/skills/dknowc-trusted-consulting/SKILL.md +21 -5
- package/skills/dknowc-trusted-consulting/reference/consult_intro.md +79 -0
- package/skills/dknowc-trusted-consulting/reference/sample_consult_answer.md +31 -0
- package/skills/dknowc-trusted-consulting/reference/sample_trace_report.html +76 -0
- package/skills/dknowc-trusted-consulting/scripts/register_key.mjs +1 -0
- package/skills/dknowc-trusted-search/SKILL.md +30 -2
- package/skills/dknowc-trusted-search/reference/sample_search_result.md +33 -0
- package/skills/dknowc-trusted-search/reference/sample_trace_report.html +450 -0
- package/skills/dknowc-trusted-search/reference/search_intro.md +79 -0
- package/skills/dknowc-trusted-search/scripts/register_key.mjs +1 -0
- package/src/index.js +7 -2
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
"""Shape tree walker.
|
|
2
|
+
|
|
3
|
+
Reads <p:spTree> from a slide / layout / master and emits a normalized
|
|
4
|
+
ShapeNode tree that downstream converters can dispatch on.
|
|
5
|
+
|
|
6
|
+
Handles:
|
|
7
|
+
- <p:sp> -> SHAPE
|
|
8
|
+
- <p:pic> -> PICTURE
|
|
9
|
+
- <p:cxnSp> -> CONNECTOR
|
|
10
|
+
- <p:grpSp> -> GROUP (recurses; resolves a:chOff/a:chExt frame)
|
|
11
|
+
- <p:graphicFrame> -> GRAPHIC (table / chart / SmartArt — emitted as opaque
|
|
12
|
+
placeholder for v1 so callers can decide a fallback)
|
|
13
|
+
- <mc:AlternateContent> -> supported Choice shape with the baked Fallback
|
|
14
|
+
preview retained for graphic frames
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
from dataclasses import dataclass, field
|
|
20
|
+
from xml.etree import ElementTree as ET
|
|
21
|
+
|
|
22
|
+
from .emu_units import NS, Xfrm, ooxml_bool, parse_xfrm
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# ---------------------------------------------------------------------------
|
|
26
|
+
# ShapeNode
|
|
27
|
+
# ---------------------------------------------------------------------------
|
|
28
|
+
|
|
29
|
+
SHAPE = "sp"
|
|
30
|
+
PICTURE = "pic"
|
|
31
|
+
CONNECTOR = "cxnSp"
|
|
32
|
+
GROUP = "grpSp"
|
|
33
|
+
GRAPHIC = "graphicFrame"
|
|
34
|
+
|
|
35
|
+
_TITLE_PLACEHOLDER_TYPES = {"title", "ctrTitle"}
|
|
36
|
+
_BODY_PLACEHOLDER_TYPES = {
|
|
37
|
+
"body",
|
|
38
|
+
"chart",
|
|
39
|
+
"clipArt",
|
|
40
|
+
"dgm",
|
|
41
|
+
"media",
|
|
42
|
+
"obj",
|
|
43
|
+
"pic",
|
|
44
|
+
"subTitle",
|
|
45
|
+
"tbl",
|
|
46
|
+
}
|
|
47
|
+
_DEFAULT_PLACEHOLDER_TYPE = "obj"
|
|
48
|
+
_DEFAULT_PLACEHOLDER_INDEX = "0"
|
|
49
|
+
_TX_STYLE_TITLE_KEY = ("__txStyleTitle", None)
|
|
50
|
+
_TX_STYLE_BODY_KEY = ("__txStyleBody", None)
|
|
51
|
+
_TX_STYLE_OTHER_KEY = ("__txStyleOther", None)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@dataclass
|
|
55
|
+
class PlaceholderInfo:
|
|
56
|
+
"""Resolved <p:ph> attributes for a shape if any."""
|
|
57
|
+
|
|
58
|
+
type: str | None = None # title / body / ctrTitle / subTitle / ftr / dt / ...
|
|
59
|
+
idx: str | None = None
|
|
60
|
+
sz: str | None = None # full / half / quarter
|
|
61
|
+
orient: str | None = None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass
|
|
65
|
+
class ShapeNode:
|
|
66
|
+
"""Normalized shape entry produced by the walker."""
|
|
67
|
+
|
|
68
|
+
kind: str # one of SHAPE / PICTURE / CONNECTOR / GROUP / GRAPHIC
|
|
69
|
+
xml: ET.Element # original element
|
|
70
|
+
xfrm: Xfrm # resolved geometry in absolute slide pixel space
|
|
71
|
+
name: str = ""
|
|
72
|
+
spid: str = ""
|
|
73
|
+
hidden: bool = False
|
|
74
|
+
hyperlink_rid: str = ""
|
|
75
|
+
hyperlink_action: str = ""
|
|
76
|
+
placeholder: PlaceholderInfo | None = None
|
|
77
|
+
inherited_lst_styles: tuple[ET.Element, ...] = ()
|
|
78
|
+
inherited_body_properties: tuple[ET.Element, ...] = ()
|
|
79
|
+
# Local plus ancestor group rotation; used for effect-fidelity decisions
|
|
80
|
+
# without applying the group transform twice to the rendered geometry.
|
|
81
|
+
effective_rotation: float = 0.0
|
|
82
|
+
# GROUP only: children, in z-order
|
|
83
|
+
children: list["ShapeNode"] = field(default_factory=list)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# ---------------------------------------------------------------------------
|
|
87
|
+
# Walker
|
|
88
|
+
# ---------------------------------------------------------------------------
|
|
89
|
+
|
|
90
|
+
def _read_nv_sp_pr(
|
|
91
|
+
parent: ET.Element,
|
|
92
|
+
nv_tag: str,
|
|
93
|
+
) -> tuple[str, str, bool, PlaceholderInfo | None, str, str]:
|
|
94
|
+
"""Extract name/id/hidden/placeholder from an nvXXXPr container.
|
|
95
|
+
|
|
96
|
+
nv_tag is one of nvSpPr / nvPicPr / nvCxnSpPr / nvGrpSpPr / nvGraphicFramePr.
|
|
97
|
+
"""
|
|
98
|
+
container = parent.find(f"p:{nv_tag}", NS)
|
|
99
|
+
name = ""
|
|
100
|
+
spid = ""
|
|
101
|
+
hidden = False
|
|
102
|
+
ph: PlaceholderInfo | None = None
|
|
103
|
+
hyperlink_rid = ""
|
|
104
|
+
hyperlink_action = ""
|
|
105
|
+
if container is None:
|
|
106
|
+
return name, spid, hidden, ph, hyperlink_rid, hyperlink_action
|
|
107
|
+
|
|
108
|
+
cnv = container.find("p:cNvPr", NS)
|
|
109
|
+
if cnv is not None:
|
|
110
|
+
name = cnv.attrib.get("name", "")
|
|
111
|
+
spid = cnv.attrib.get("id", "")
|
|
112
|
+
if ooxml_bool(cnv.attrib.get("hidden")):
|
|
113
|
+
hidden = True
|
|
114
|
+
hyperlink = cnv.find("a:hlinkClick", NS)
|
|
115
|
+
if hyperlink is not None:
|
|
116
|
+
hyperlink_rid = hyperlink.attrib.get(f"{{{NS['r']}}}id", "")
|
|
117
|
+
hyperlink_action = hyperlink.attrib.get("action", "")
|
|
118
|
+
|
|
119
|
+
nv_pr = container.find("p:nvPr", NS)
|
|
120
|
+
if nv_pr is not None:
|
|
121
|
+
ph_elem = nv_pr.find("p:ph", NS)
|
|
122
|
+
if ph_elem is not None:
|
|
123
|
+
ph = PlaceholderInfo(
|
|
124
|
+
type=ph_elem.attrib.get("type"),
|
|
125
|
+
idx=ph_elem.attrib.get("idx"),
|
|
126
|
+
sz=ph_elem.attrib.get("sz"),
|
|
127
|
+
orient=ph_elem.attrib.get("orient"),
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
return name, spid, hidden, ph, hyperlink_rid, hyperlink_action
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def _resolve_xfrm(shape: ET.Element, kind: str) -> ET.Element | None:
|
|
134
|
+
"""Find the <a:xfrm> element under the right spPr / grpSpPr container."""
|
|
135
|
+
if kind == GROUP:
|
|
136
|
+
sp_pr = shape.find("p:grpSpPr", NS)
|
|
137
|
+
elif kind == GRAPHIC:
|
|
138
|
+
# graphicFrame uses p:xfrm directly (no a: namespace)
|
|
139
|
+
return shape.find("p:xfrm", NS)
|
|
140
|
+
else:
|
|
141
|
+
sp_pr = shape.find("p:spPr", NS)
|
|
142
|
+
if sp_pr is None:
|
|
143
|
+
return None
|
|
144
|
+
return sp_pr.find("a:xfrm", NS)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def _adjust_for_group(child_xfrm: Xfrm, group_xfrm: Xfrm) -> Xfrm:
|
|
148
|
+
"""Map a child shape's xfrm from group's child coordinate space into the
|
|
149
|
+
parent (group) coordinate space.
|
|
150
|
+
|
|
151
|
+
DrawingML group rule: a child's a:off/a:ext is in the group's chOff/chExt
|
|
152
|
+
coordinate system. We map to the group's actual off/ext on the slide.
|
|
153
|
+
|
|
154
|
+
If the group has no chOff/chExt, fall back to identity translation.
|
|
155
|
+
"""
|
|
156
|
+
if (group_xfrm.ch_w is None or group_xfrm.ch_h is None
|
|
157
|
+
or group_xfrm.ch_w == 0 or group_xfrm.ch_h == 0):
|
|
158
|
+
# No child frame — children already in slide space; just translate.
|
|
159
|
+
return child_xfrm
|
|
160
|
+
|
|
161
|
+
# Linear map: child-frame -> group's (off..off+ext)
|
|
162
|
+
sx = group_xfrm.w / group_xfrm.ch_w if group_xfrm.ch_w else 1.0
|
|
163
|
+
sy = group_xfrm.h / group_xfrm.ch_h if group_xfrm.ch_h else 1.0
|
|
164
|
+
ch_x = group_xfrm.ch_x or 0.0
|
|
165
|
+
ch_y = group_xfrm.ch_y or 0.0
|
|
166
|
+
|
|
167
|
+
new_x = group_xfrm.x + (child_xfrm.x - ch_x) * sx
|
|
168
|
+
new_y = group_xfrm.y + (child_xfrm.y - ch_y) * sy
|
|
169
|
+
new_w = child_xfrm.w * sx
|
|
170
|
+
new_h = child_xfrm.h * sy
|
|
171
|
+
|
|
172
|
+
return Xfrm(
|
|
173
|
+
x=new_x, y=new_y, w=new_w, h=new_h,
|
|
174
|
+
rot=child_xfrm.rot,
|
|
175
|
+
flip_h=child_xfrm.flip_h,
|
|
176
|
+
flip_v=child_xfrm.flip_v,
|
|
177
|
+
ch_x=child_xfrm.ch_x, ch_y=child_xfrm.ch_y,
|
|
178
|
+
ch_w=child_xfrm.ch_w, ch_h=child_xfrm.ch_h,
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
# Mapping from element tag -> kind / nv tag.
|
|
183
|
+
_KIND_MAP = {
|
|
184
|
+
"sp": (SHAPE, "nvSpPr"),
|
|
185
|
+
"pic": (PICTURE, "nvPicPr"),
|
|
186
|
+
"cxnSp": (CONNECTOR, "nvCxnSpPr"),
|
|
187
|
+
"grpSp": (GROUP, "nvGrpSpPr"),
|
|
188
|
+
"graphicFrame": (GRAPHIC, "nvGraphicFramePr"),
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def _first_shape_child(container: ET.Element | None) -> ET.Element | None:
|
|
193
|
+
if container is None:
|
|
194
|
+
return None
|
|
195
|
+
for child in list(container):
|
|
196
|
+
if not isinstance(child.tag, str):
|
|
197
|
+
continue
|
|
198
|
+
if child.tag.split("}", 1)[-1] in _KIND_MAP:
|
|
199
|
+
return child
|
|
200
|
+
return None
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def _resolve_alternate_content(wrapper: ET.Element) -> ET.Element | None:
|
|
204
|
+
"""Select an AlternateContent shape while retaining its baked preview."""
|
|
205
|
+
choice = wrapper.find("mc:Choice", NS)
|
|
206
|
+
fallback = wrapper.find("mc:Fallback", NS)
|
|
207
|
+
selected = _first_shape_child(choice)
|
|
208
|
+
selected_from_choice = selected is not None
|
|
209
|
+
if selected is None:
|
|
210
|
+
selected = _first_shape_child(fallback)
|
|
211
|
+
if selected is None:
|
|
212
|
+
return None
|
|
213
|
+
|
|
214
|
+
clone = ET.fromstring(ET.tostring(selected, encoding="utf-8"))
|
|
215
|
+
if (
|
|
216
|
+
selected_from_choice
|
|
217
|
+
and clone.tag.split("}", 1)[-1] == "graphicFrame"
|
|
218
|
+
and fallback is not None
|
|
219
|
+
):
|
|
220
|
+
graphic_data = clone.find("a:graphic/a:graphicData", NS)
|
|
221
|
+
if graphic_data is not None:
|
|
222
|
+
preview = ET.Element(f"{{{NS['mc']}}}AlternateContent")
|
|
223
|
+
preview.append(
|
|
224
|
+
ET.fromstring(ET.tostring(fallback, encoding="utf-8"))
|
|
225
|
+
)
|
|
226
|
+
graphic_data.append(preview)
|
|
227
|
+
return clone
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def _walk_container(
|
|
231
|
+
container: ET.Element,
|
|
232
|
+
parent_group_xfrm: Xfrm | None,
|
|
233
|
+
ancestor_rotation: float = 0.0,
|
|
234
|
+
placeholder_xfrms: dict[tuple[str | None, str | None], Xfrm] | None = None,
|
|
235
|
+
placeholder_lst_styles: dict[
|
|
236
|
+
tuple[str | None, str | None],
|
|
237
|
+
list[ET.Element],
|
|
238
|
+
] | None = None,
|
|
239
|
+
placeholder_body_properties: dict[
|
|
240
|
+
tuple[str | None, str | None],
|
|
241
|
+
list[ET.Element],
|
|
242
|
+
] | None = None,
|
|
243
|
+
) -> list[ShapeNode]:
|
|
244
|
+
"""Walk a p:spTree or p:grpSp subtree. Children kept in document (z) order.
|
|
245
|
+
"""
|
|
246
|
+
nodes: list[ShapeNode] = []
|
|
247
|
+
for child in list(container):
|
|
248
|
+
if not isinstance(child.tag, str):
|
|
249
|
+
continue
|
|
250
|
+
local = child.tag.split("}", 1)[-1]
|
|
251
|
+
if local == "AlternateContent":
|
|
252
|
+
resolved = _resolve_alternate_content(child)
|
|
253
|
+
if resolved is None:
|
|
254
|
+
continue
|
|
255
|
+
child = resolved
|
|
256
|
+
local = child.tag.split("}", 1)[-1]
|
|
257
|
+
kind_info = _KIND_MAP.get(local)
|
|
258
|
+
if kind_info is None:
|
|
259
|
+
continue
|
|
260
|
+
kind, nv_tag = kind_info
|
|
261
|
+
|
|
262
|
+
(
|
|
263
|
+
name,
|
|
264
|
+
spid,
|
|
265
|
+
hidden,
|
|
266
|
+
ph,
|
|
267
|
+
hyperlink_rid,
|
|
268
|
+
hyperlink_action,
|
|
269
|
+
) = _read_nv_sp_pr(child, nv_tag)
|
|
270
|
+
xfrm = parse_xfrm(_resolve_xfrm(child, kind))
|
|
271
|
+
effective_rotation = (ancestor_rotation + xfrm.rot) % 360.0
|
|
272
|
+
|
|
273
|
+
# Placeholders without their own xfrm inherit geometry from a matching
|
|
274
|
+
# placeholder in the layout, then the master. This is what PowerPoint
|
|
275
|
+
# itself does when rendering the slide. Without this fallback such
|
|
276
|
+
# shapes get a 0×0 box and convert_txbody wraps every glyph onto its
|
|
277
|
+
# own line — visually a vertical strip of single characters.
|
|
278
|
+
if (ph is not None and placeholder_xfrms
|
|
279
|
+
and (xfrm.w == 0 and xfrm.h == 0)):
|
|
280
|
+
inherited = _lookup_placeholder_xfrm(ph, placeholder_xfrms)
|
|
281
|
+
if inherited is not None:
|
|
282
|
+
xfrm = Xfrm(
|
|
283
|
+
x=inherited.x, y=inherited.y,
|
|
284
|
+
w=inherited.w, h=inherited.h,
|
|
285
|
+
rot=xfrm.rot, flip_h=xfrm.flip_h, flip_v=xfrm.flip_v,
|
|
286
|
+
ch_x=xfrm.ch_x, ch_y=xfrm.ch_y,
|
|
287
|
+
ch_w=xfrm.ch_w, ch_h=xfrm.ch_h,
|
|
288
|
+
)
|
|
289
|
+
|
|
290
|
+
# If we're inside a group, remap to slide-absolute coordinates
|
|
291
|
+
if parent_group_xfrm is not None:
|
|
292
|
+
xfrm = _adjust_for_group(xfrm, parent_group_xfrm)
|
|
293
|
+
|
|
294
|
+
inherited_lst_styles: tuple[ET.Element, ...] = ()
|
|
295
|
+
if ph is not None and placeholder_lst_styles:
|
|
296
|
+
inherited_lst_styles = _lookup_placeholder_lst_styles(
|
|
297
|
+
ph, placeholder_lst_styles,
|
|
298
|
+
)
|
|
299
|
+
inherited_body_properties: tuple[ET.Element, ...] = ()
|
|
300
|
+
if ph is not None and placeholder_body_properties:
|
|
301
|
+
inherited_body_properties = _lookup_placeholder_body_properties(
|
|
302
|
+
ph,
|
|
303
|
+
placeholder_body_properties,
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
node = ShapeNode(
|
|
307
|
+
kind=kind, xml=child, xfrm=xfrm,
|
|
308
|
+
name=name, spid=spid, hidden=hidden, placeholder=ph,
|
|
309
|
+
hyperlink_rid=hyperlink_rid,
|
|
310
|
+
hyperlink_action=hyperlink_action,
|
|
311
|
+
inherited_lst_styles=inherited_lst_styles,
|
|
312
|
+
inherited_body_properties=inherited_body_properties,
|
|
313
|
+
effective_rotation=effective_rotation,
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
if kind == GROUP:
|
|
317
|
+
node.children = _walk_container(
|
|
318
|
+
child, xfrm, effective_rotation,
|
|
319
|
+
placeholder_xfrms=placeholder_xfrms,
|
|
320
|
+
placeholder_lst_styles=placeholder_lst_styles,
|
|
321
|
+
placeholder_body_properties=placeholder_body_properties,
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
nodes.append(node)
|
|
325
|
+
return nodes
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
def _lookup_placeholder_xfrm(
|
|
329
|
+
ph: PlaceholderInfo,
|
|
330
|
+
table: dict[tuple[str | None, str | None], Xfrm],
|
|
331
|
+
) -> Xfrm | None:
|
|
332
|
+
"""Find inherited geometry after applying the OOXML placeholder defaults."""
|
|
333
|
+
ph_type, ph_idx = _placeholder_identity(ph.type, ph.idx)
|
|
334
|
+
for key in (
|
|
335
|
+
(ph_type, ph_idx),
|
|
336
|
+
(ph_type, None),
|
|
337
|
+
(None, ph_idx),
|
|
338
|
+
):
|
|
339
|
+
hit = table.get(key)
|
|
340
|
+
if hit is not None and (hit.w > 0 or hit.h > 0):
|
|
341
|
+
return hit
|
|
342
|
+
return None
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
def _lookup_placeholder_lst_styles(
|
|
346
|
+
ph: PlaceholderInfo,
|
|
347
|
+
table: dict[tuple[str | None, str | None], list[ET.Element]],
|
|
348
|
+
) -> tuple[ET.Element, ...]:
|
|
349
|
+
"""Find inherited txBody/lstStyle elements for a placeholder."""
|
|
350
|
+
ph_type, ph_idx = _placeholder_identity(ph.type, ph.idx)
|
|
351
|
+
styles: list[ET.Element] = []
|
|
352
|
+
seen: set[int] = set()
|
|
353
|
+
for key in (
|
|
354
|
+
(ph_type, ph_idx),
|
|
355
|
+
(ph_type, None),
|
|
356
|
+
(None, ph_idx),
|
|
357
|
+
_placeholder_tx_style_key(ph),
|
|
358
|
+
):
|
|
359
|
+
for style in table.get(key, []):
|
|
360
|
+
marker = id(style)
|
|
361
|
+
if marker in seen:
|
|
362
|
+
continue
|
|
363
|
+
styles.append(style)
|
|
364
|
+
seen.add(marker)
|
|
365
|
+
return tuple(styles)
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
def _lookup_placeholder_body_properties(
|
|
369
|
+
ph: PlaceholderInfo,
|
|
370
|
+
table: dict[tuple[str | None, str | None], list[ET.Element]],
|
|
371
|
+
) -> tuple[ET.Element, ...]:
|
|
372
|
+
"""Find inherited txBody/bodyPr elements for a placeholder."""
|
|
373
|
+
ph_type, ph_idx = _placeholder_identity(ph.type, ph.idx)
|
|
374
|
+
exact = table.get((ph_type, ph_idx), [])
|
|
375
|
+
if exact:
|
|
376
|
+
return tuple(exact)
|
|
377
|
+
for key in ((ph_type, None), (None, ph_idx)):
|
|
378
|
+
candidates = table.get(key, [])
|
|
379
|
+
if candidates:
|
|
380
|
+
return (candidates[0],)
|
|
381
|
+
return ()
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
def _placeholder_tx_style_key(
|
|
385
|
+
ph: PlaceholderInfo,
|
|
386
|
+
) -> tuple[str | None, str | None]:
|
|
387
|
+
ph_type, _ph_idx = _placeholder_identity(ph.type, ph.idx)
|
|
388
|
+
if ph_type in _TITLE_PLACEHOLDER_TYPES:
|
|
389
|
+
return _TX_STYLE_TITLE_KEY
|
|
390
|
+
if ph_type in _BODY_PLACEHOLDER_TYPES:
|
|
391
|
+
return _TX_STYLE_BODY_KEY
|
|
392
|
+
return _TX_STYLE_OTHER_KEY
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
def _placeholder_identity(
|
|
396
|
+
ph_type: str | None,
|
|
397
|
+
ph_idx: str | None,
|
|
398
|
+
) -> tuple[str, str]:
|
|
399
|
+
"""Resolve the schema defaults used for placeholder inheritance keys."""
|
|
400
|
+
return (
|
|
401
|
+
_DEFAULT_PLACEHOLDER_TYPE if ph_type is None else ph_type,
|
|
402
|
+
_DEFAULT_PLACEHOLDER_INDEX if ph_idx is None else ph_idx,
|
|
403
|
+
)
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
def _build_placeholder_xfrm_table(
|
|
407
|
+
*parts: ET.Element | None,
|
|
408
|
+
) -> dict[tuple[str | None, str | None], Xfrm]:
|
|
409
|
+
"""Index placeholders that *do* have explicit geometry, in priority order.
|
|
410
|
+
|
|
411
|
+
Pass parts most-specific to least-specific (layout first, master second);
|
|
412
|
+
the first writer for a given key wins so layout overrides master, which is
|
|
413
|
+
what PowerPoint's inheritance chain expects.
|
|
414
|
+
"""
|
|
415
|
+
table: dict[tuple[str | None, str | None], Xfrm] = {}
|
|
416
|
+
for part_xml in parts:
|
|
417
|
+
if part_xml is None:
|
|
418
|
+
continue
|
|
419
|
+
sp_tree = part_xml.find("p:cSld/p:spTree", NS)
|
|
420
|
+
if sp_tree is None:
|
|
421
|
+
continue
|
|
422
|
+
for sp in sp_tree.iter():
|
|
423
|
+
if not isinstance(sp.tag, str) or sp.tag.split("}", 1)[-1] != "sp":
|
|
424
|
+
continue
|
|
425
|
+
ph_elem = sp.find("p:nvSpPr/p:nvPr/p:ph", NS)
|
|
426
|
+
if ph_elem is None:
|
|
427
|
+
continue
|
|
428
|
+
xfrm_elem = sp.find("p:spPr/a:xfrm", NS)
|
|
429
|
+
if xfrm_elem is None:
|
|
430
|
+
continue
|
|
431
|
+
xfrm = parse_xfrm(xfrm_elem)
|
|
432
|
+
if xfrm.w <= 0 and xfrm.h <= 0:
|
|
433
|
+
continue
|
|
434
|
+
ph_type, ph_idx = _placeholder_identity(
|
|
435
|
+
ph_elem.attrib.get("type"),
|
|
436
|
+
ph_elem.attrib.get("idx"),
|
|
437
|
+
)
|
|
438
|
+
for key in ((ph_type, ph_idx),
|
|
439
|
+
(ph_type, None),
|
|
440
|
+
(None, ph_idx)):
|
|
441
|
+
table.setdefault(key, xfrm)
|
|
442
|
+
return table
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
def _build_placeholder_lst_style_table(
|
|
446
|
+
*parts: ET.Element | None,
|
|
447
|
+
) -> dict[tuple[str | None, str | None], list[ET.Element]]:
|
|
448
|
+
"""Index placeholder txBody/lstStyle elements in priority order."""
|
|
449
|
+
table: dict[tuple[str | None, str | None], list[ET.Element]] = {}
|
|
450
|
+
for part_xml in parts:
|
|
451
|
+
if part_xml is None:
|
|
452
|
+
continue
|
|
453
|
+
sp_tree = part_xml.find("p:cSld/p:spTree", NS)
|
|
454
|
+
if sp_tree is None:
|
|
455
|
+
continue
|
|
456
|
+
for sp in sp_tree.iter():
|
|
457
|
+
if not isinstance(sp.tag, str) or sp.tag.split("}", 1)[-1] != "sp":
|
|
458
|
+
continue
|
|
459
|
+
ph_elem = sp.find("p:nvSpPr/p:nvPr/p:ph", NS)
|
|
460
|
+
if ph_elem is None:
|
|
461
|
+
continue
|
|
462
|
+
lst_style = sp.find("p:txBody/a:lstStyle", NS)
|
|
463
|
+
if lst_style is None:
|
|
464
|
+
continue
|
|
465
|
+
ph_type, ph_idx = _placeholder_identity(
|
|
466
|
+
ph_elem.attrib.get("type"),
|
|
467
|
+
ph_elem.attrib.get("idx"),
|
|
468
|
+
)
|
|
469
|
+
for key in ((ph_type, ph_idx),
|
|
470
|
+
(ph_type, None),
|
|
471
|
+
(None, ph_idx)):
|
|
472
|
+
table.setdefault(key, []).append(lst_style)
|
|
473
|
+
_append_master_tx_styles(table, part_xml)
|
|
474
|
+
return table
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
def _build_placeholder_body_property_table(
|
|
478
|
+
*parts: ET.Element | None,
|
|
479
|
+
) -> dict[tuple[str | None, str | None], list[ET.Element]]:
|
|
480
|
+
"""Index placeholder txBody/bodyPr elements in priority order."""
|
|
481
|
+
table: dict[tuple[str | None, str | None], list[ET.Element]] = {}
|
|
482
|
+
for part_xml in parts:
|
|
483
|
+
if part_xml is None:
|
|
484
|
+
continue
|
|
485
|
+
sp_tree = part_xml.find("p:cSld/p:spTree", NS)
|
|
486
|
+
if sp_tree is None:
|
|
487
|
+
continue
|
|
488
|
+
for sp in sp_tree.iter():
|
|
489
|
+
if not isinstance(sp.tag, str) or sp.tag.split("}", 1)[-1] != "sp":
|
|
490
|
+
continue
|
|
491
|
+
ph_elem = sp.find("p:nvSpPr/p:nvPr/p:ph", NS)
|
|
492
|
+
body_pr = sp.find("p:txBody/a:bodyPr", NS)
|
|
493
|
+
if ph_elem is None or body_pr is None:
|
|
494
|
+
continue
|
|
495
|
+
ph_type, ph_idx = _placeholder_identity(
|
|
496
|
+
ph_elem.attrib.get("type"),
|
|
497
|
+
ph_elem.attrib.get("idx"),
|
|
498
|
+
)
|
|
499
|
+
for key in (
|
|
500
|
+
(ph_type, ph_idx),
|
|
501
|
+
(ph_type, None),
|
|
502
|
+
(None, ph_idx),
|
|
503
|
+
):
|
|
504
|
+
table.setdefault(key, []).append(body_pr)
|
|
505
|
+
return table
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
def _append_master_tx_styles(
|
|
509
|
+
table: dict[tuple[str | None, str | None], list[ET.Element]],
|
|
510
|
+
part_xml: ET.Element,
|
|
511
|
+
) -> None:
|
|
512
|
+
for key, path in (
|
|
513
|
+
(_TX_STYLE_TITLE_KEY, "p:txStyles/p:titleStyle"),
|
|
514
|
+
(_TX_STYLE_BODY_KEY, "p:txStyles/p:bodyStyle"),
|
|
515
|
+
(_TX_STYLE_OTHER_KEY, "p:txStyles/p:otherStyle"),
|
|
516
|
+
):
|
|
517
|
+
style = part_xml.find(path, NS)
|
|
518
|
+
if style is not None:
|
|
519
|
+
table.setdefault(key, []).append(style)
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
def walk_sp_tree(
|
|
523
|
+
slide_xml: ET.Element,
|
|
524
|
+
*,
|
|
525
|
+
layout_xml: ET.Element | None = None,
|
|
526
|
+
master_xml: ET.Element | None = None,
|
|
527
|
+
) -> list[ShapeNode]:
|
|
528
|
+
"""Top-level entry: return shape nodes for a slide / layout / master XML.
|
|
529
|
+
|
|
530
|
+
When ``slide_xml`` is a regular slide, pass its ``layout_xml`` and
|
|
531
|
+
``master_xml`` so placeholders can inherit geometry, text list styles, and
|
|
532
|
+
body properties from the layout/master. Layout and master walks pass
|
|
533
|
+
neither — their own placeholders are the source of truth.
|
|
534
|
+
"""
|
|
535
|
+
sp_tree = slide_xml.find("p:cSld/p:spTree", NS)
|
|
536
|
+
if sp_tree is None:
|
|
537
|
+
return []
|
|
538
|
+
placeholder_xfrms = _build_placeholder_xfrm_table(layout_xml, master_xml)
|
|
539
|
+
placeholder_lst_styles = _build_placeholder_lst_style_table(
|
|
540
|
+
layout_xml, master_xml,
|
|
541
|
+
)
|
|
542
|
+
placeholder_body_properties = _build_placeholder_body_property_table(
|
|
543
|
+
layout_xml,
|
|
544
|
+
master_xml,
|
|
545
|
+
)
|
|
546
|
+
return _walk_container(
|
|
547
|
+
sp_tree, parent_group_xfrm=None,
|
|
548
|
+
placeholder_xfrms=placeholder_xfrms or None,
|
|
549
|
+
placeholder_lst_styles=placeholder_lst_styles or None,
|
|
550
|
+
placeholder_body_properties=placeholder_body_properties or None,
|
|
551
|
+
)
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
def get_background(slide_xml: ET.Element) -> ET.Element | None:
|
|
555
|
+
"""Return the <p:bg> element if the slide defines its own background."""
|
|
556
|
+
return slide_xml.find("p:cSld/p:bg", NS)
|