Line format

Intial scope

  • Shape.line, Connector.line to follow, then Cell.border(s).line, possibly text underline and font.line (character outline)

Protocol

>>> shape.line
<pptx.dml.line.LineFormat instance at x123456789>
>>> shape.fore_color
<pptx.dml.line.LineFormat instance at x123456789>

Notes

definitely spike on this one.

start with line.color, first an object to hang members off of

Issue: How to accommodate these competing requirements:

  • Polymorphism in parent shape. More than one type of shape can have a line and possibly several (table cell border, Run/text, and text underline use the same CT_LineProperties element, and perhaps others).
  • The line object cannot hold onto a <a:ln> element, even if that was a good idea, because it is an optional child; not having an <a:ln> element is a legitimate and common situation, indicating line formatting should be inherited from the theme or perhaps a layout placeholder.
  • Needing to accommodate XML changing might not be important, could make that operation immutable, such that changing the shape XML returns a new shape, not changing the existing one in-place.
  • maybe having the following ‘line_format_owner_interface’, delegating create, read, and delete of the <a:ln> element to the parent, and allowing LineFormat to take responsibility for update.
    • line.parent has the shape having the line format
    • parent.ln has the <a:ln> element or None, delegating access to the parent
    • ln = parent.add_ln()
    • parent.remove_ln()

MS API

Specimen XML

solid line color:

<p:spPr>
  <a:xfrm>
    <a:off x="950964" y="2925277"/>
    <a:ext cx="1257921" cy="619967"/>
  </a:xfrm>
  <a:prstGeom prst="curvedConnector3">
    <a:avLst/>
  </a:prstGeom>
  <a:ln>
    <a:solidFill>
      <a:schemeClr val="accent2"/>
    </a:solidFill>
  </a:ln>
</p:spPr>

little bit of everything:

<p:spPr>
  <a:xfrm>
    <a:off x="950964" y="1101493"/>
    <a:ext cx="1257921" cy="0"/>
  </a:xfrm>
  <a:prstGeom prst="line">
    <a:avLst/>
  </a:prstGeom>
  <a:ln w="57150" cap="rnd" cmpd="thickThin">
    <a:gradFill flip="none" rotWithShape="1">
      <a:gsLst>
        <a:gs pos="0">
          <a:schemeClr val="accent1"/>
        </a:gs>
        <a:gs pos="100000">
          <a:srgbClr val="FFFFFF"/>
        </a:gs>
      </a:gsLst>
      <a:lin ang="0" scaled="1"/>
      <a:tileRect/>
    </a:gradFill>
    <a:prstDash val="sysDash"/>
    <a:bevel/>
    <a:headEnd type="oval"/>
    <a:tailEnd type="diamond"/>
  </a:ln>
</p:spPr>