MCPcopy
hub / github.com/THU-MAIC/OpenMAIC / spHasVisibleFillOrLine

Function spHasVisibleFillOrLine

packages/@openmaic/importer/src/model/Slide.ts:340–364  ·  view source on GitHub ↗

* True when an sp is a visible "box" — has an explicit fill or a visible border * (either directly in spPr or via a non-zero p:style fillRef/lnRef). Such a box * whose only label is an inline formula (e.g. slide 26 的彩色 x / W₁ / σ 方框, * 标签是 a14:m 公式而非文本 run) must be parsed as a SHAPE so its背景色/边框得

(sp: SafeXmlNode)

Source from the content-addressed store, hash-verified

338 * 无边框)仍走 parseMathNode 以获得正确的块级排版与缩放。
339 */
340function spHasVisibleFillOrLine(sp: SafeXmlNode): boolean {
341 const spPr = sp.child('spPr');
342 const spPrHasNoFill = spPr.exists() && spPr.child('noFill').exists();
343 if (spPr.exists()) {
344 for (const tag of ['solidFill', 'gradFill', 'blipFill', 'pattFill']) {
345 if (spPr.child(tag).exists()) return true;
346 }
347 const ln = spPr.child('ln');
348 if (ln.exists() && !ln.child('noFill').exists()) {
349 for (const tag of ['solidFill', 'gradFill', 'pattFill']) {
350 if (ln.child(tag).exists()) return true;
351 }
352 }
353 }
354 const style = sp.child('style');
355 if (style.exists()) {
356 if (!spPrHasNoFill) {
357 const fillRef = style.child('fillRef');
358 if (fillRef.exists() && (fillRef.attr('idx') ?? '0') !== '0') return true;
359 }
360 const lnRef = style.child('lnRef');
361 if (lnRef.exists() && (lnRef.attr('idx') ?? '0') !== '0') return true;
362 }
363 return false;
364}
365
366/**
367 * Parse a single child node from spTree, dispatching to the appropriate parser.

Callers 1

parseChildNodeFunction · 0.85

Calls 3

childMethod · 0.80
attrMethod · 0.80
existsMethod · 0.65

Tested by

no test coverage detected