( root: SafeXmlNode, index: number, rels: Map<string, RelEntry>, slidePath = '', diagramDrawings?: Map<string, string> )
| 287 | * @param slidePath Full path to the slide file (e.g. "ppt/slides/slide1.xml") |
| 288 | */ |
| 289 | export function parseSlide( |
| 290 | root: SafeXmlNode, |
| 291 | index: number, |
| 292 | rels: Map<string, RelEntry>, |
| 293 | slidePath = '', |
| 294 | diagramDrawings?: Map<string, string> |
| 295 | ): SlideData { |
| 296 | const cSld = root.child('cSld') |
| 297 | |
| 298 | // --- Background --- |
| 299 | const bg = cSld.child('bg') |
| 300 | const background = bg.exists() ? bg : undefined |
| 301 | |
| 302 | // --- Parse shape tree children --- |
| 303 | const spTree = cSld.child('spTree') |
| 304 | const nodes: SlideNode[] = [] |
| 305 | |
| 306 | for (const child of spTree.allChildren()) { |
| 307 | const node = parseChildNode(child, rels, slidePath, diagramDrawings) |
| 308 | if (node) { |
| 309 | nodes.push(node) |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | // --- Layout relationship --- |
| 314 | const layoutIndex = findLayoutRel(rels) |
| 315 | |
| 316 | // --- showMasterSp: if "0", layout/master shapes should not be rendered on this slide --- |
| 317 | const showMasterSpAttr = root.attr('showMasterSp') |
| 318 | const showMasterSp = showMasterSpAttr !== '0' |
| 319 | |
| 320 | return { |
| 321 | index, |
| 322 | nodes, |
| 323 | background, |
| 324 | layoutIndex, |
| 325 | rels, |
| 326 | slidePath, |
| 327 | showMasterSp, |
| 328 | } |
| 329 | } |
no test coverage detected