class _CT_TableCellEdge(BaseOxmlElement): """ ''<a:ln{}>'' custom element class """ w = RequiredAttribute('w', ST_Coordinate) cap = RequiredAttribute('cap', ST_CapType) cmpd = RequiredAttribute('cmpd', ST_EdgeType) algn = RequiredAttribute('algn', ST_EdgeAlignment) _tag_seq = ('a:prstDash', 'a:headEnd', 'a:tailEnd') eg_fillProperties = ZeroOrOneChoice(( Choice("a:noFill"), Choice("a:solidFill"), Choice("a:gradFill"), Choice("a:blipFill"), Choice("a:pattFill"), Choice("a:grpFill"), ), successors=_tag_seq) eg_JointProperties = ZeroOrOneChoice(( Choice("a:bevel"), Choice("a:miter"), Choice("a:round"), ), successors=_tag_seq[1:]) prstDash = ZeroOrOne('a:prstDash', successors=('a:headEnd', 'a:bevel', 'a:miter', 'a:round', 'a:tailEnd')) headEnd = ZeroOrOne('a:headEnd', successors=_tag_seq[2:]) tailEnd = ZeroOrOne('a:tailEnd') del _tag_seq
class CT_BackgroundProperties(BaseOxmlElement): """`p:bgPr` element.""" _tag_seq = ( "a:noFill", "a:solidFill", "a:gradFill", "a:blipFill", "a:pattFill", "a:grpFill", "a:effectLst", "a:effectDag", "a:extLst", ) eg_fillProperties = ZeroOrOneChoice( ( Choice("a:noFill"), Choice("a:solidFill"), Choice("a:gradFill"), Choice("a:blipFill"), Choice("a:pattFill"), Choice("a:grpFill"), ), successors=_tag_seq[6:], ) del _tag_seq def _new_gradFill(self): """Override default to add default gradient subtree.""" return CT_GradientFillProperties.new_gradFill()
class CT_TableCellProperties(BaseOxmlElement): """`a:tcPr` custom element class""" eg_fillProperties = ZeroOrOneChoice( ( Choice("a:noFill"), Choice("a:solidFill"), Choice("a:gradFill"), Choice("a:blipFill"), Choice("a:pattFill"), Choice("a:grpFill"), ), successors=("a:headers", "a:extLst"), ) _tag_seq = ('a:lnL', 'a:lnR', 'a:lnT', 'a:lnB', 'a:solidFill') lnL = ZeroOrOne(nsptagname=_tag_seq[0], successors=_tag_seq[1:]) lnR = ZeroOrOne(nsptagname=_tag_seq[1], successors=_tag_seq[2:]) lnT = ZeroOrOne(nsptagname=_tag_seq[2], successors=_tag_seq[3:]) lnB = ZeroOrOne(nsptagname=_tag_seq[3], successors=_tag_seq[4:]) del _tag_seq anchor = OptionalAttribute("anchor", MSO_VERTICAL_ANCHOR) marL = OptionalAttribute("marL", ST_Coordinate32) marR = OptionalAttribute("marR", ST_Coordinate32) marT = OptionalAttribute("marT", ST_Coordinate32) marB = OptionalAttribute("marB", ST_Coordinate32) def _new_gradFill(self): return CT_GradientFillProperties.new_gradFill()
class CT_SolidColorFillProperties(BaseOxmlElement): """`a:solidFill` custom element class.""" eg_colorChoice = ZeroOrOneChoice(( Choice('a:scrgbClr'), Choice('a:srgbClr'), Choice('a:hslClr'), Choice('a:sysClr'), Choice('a:schemeClr'), Choice('a:prstClr')), successors=() )
class CT_GradientStop(BaseOxmlElement): """`a:gs` custom element class.""" eg_colorChoice = ZeroOrOneChoice( (Choice('a:scrgbClr'), Choice('a:srgbClr'), Choice('a:hslClr'), Choice('a:sysClr'), Choice('a:schemeClr'), Choice('a:prstClr')), successors=()) pos = RequiredAttribute('pos', ST_PositiveFixedPercentage)
class CT_LineProperties(BaseOxmlElement): """Custom element class for <a:ln> element""" _tag_seq = ( "a:noFill", "a:solidFill", "a:gradFill", "a:pattFill", "a:prstDash", "a:custDash", "a:round", "a:bevel", "a:miter", "a:headEnd", "a:tailEnd", "a:extLst", ) eg_lineFillProperties = ZeroOrOneChoice( ( Choice("a:noFill"), Choice("a:solidFill"), Choice("a:gradFill"), Choice("a:pattFill"), ), successors=_tag_seq[4:], ) prstDash = ZeroOrOne("a:prstDash", successors=_tag_seq[5:]) custDash = ZeroOrOne("a:custDash", successors=_tag_seq[6:]) del _tag_seq w = OptionalAttribute("w", ST_LineWidth, default=Emu(0)) @property def eg_fillProperties(self): """ Required to fulfill the interface used by dml.fill. """ return self.eg_lineFillProperties @property def prstDash_val(self): """Return value of `val` attribute of `a:prstDash` child. Return |None| if not present. """ prstDash = self.prstDash if prstDash is None: return None return prstDash.val @prstDash_val.setter def prstDash_val(self, val): self._remove_custDash() prstDash = self.get_or_add_prstDash() prstDash.val = val
class CT_TableCellProperties(BaseOxmlElement): """`a:tcPr` custom element class""" eg_fillProperties = ZeroOrOneChoice( (Choice('a:noFill'), Choice('a:solidFill'), Choice('a:gradFill'), Choice('a:blipFill'), Choice('a:pattFill'), Choice('a:grpFill')), successors=('a:headers', 'a:extLst')) anchor = OptionalAttribute('anchor', MSO_VERTICAL_ANCHOR) marL = OptionalAttribute('marL', ST_Coordinate32) marR = OptionalAttribute('marR', ST_Coordinate32) marT = OptionalAttribute('marT', ST_Coordinate32) marB = OptionalAttribute('marB', ST_Coordinate32) def _new_gradFill(self): return CT_GradientFillProperties.new_gradFill()
class CT_Parent(BaseOxmlElement): """ ``<p:parent>`` element, an invented element for use in testing. """ eg_zooChoice = ZeroOrOneChoice( (Choice('p:choice'), Choice('p:choice2')), successors=('p:oomChild', 'p:oooChild') ) oomChild = OneOrMore('p:oomChild', successors=( 'p:oooChild', 'p:zomChild', 'p:zooChild' )) oooChild = OneAndOnlyOne('p:oooChild') zomChild = ZeroOrMore('p:zomChild', successors=('p:zooChild',)) zooChild = ZeroOrOne('p:zooChild', successors=()) optAttr = OptionalAttribute('p:optAttr', ST_IntegerType) reqAttr = RequiredAttribute('reqAttr', ST_IntegerType)
class CT_TextBodyProperties(BaseOxmlElement): """ <a:bodyPr> custom element class """ eg_textAutoFit = ZeroOrOneChoice( (Choice("a:noAutofit"), Choice("a:normAutofit"), Choice("a:spAutoFit")), successors=("a:scene3d", "a:sp3d", "a:flatTx", "a:extLst"), ) lIns = OptionalAttribute("lIns", ST_Coordinate32, default=Emu(91440)) tIns = OptionalAttribute("tIns", ST_Coordinate32, default=Emu(45720)) rIns = OptionalAttribute("rIns", ST_Coordinate32, default=Emu(91440)) bIns = OptionalAttribute("bIns", ST_Coordinate32, default=Emu(45720)) anchor = OptionalAttribute("anchor", MSO_VERTICAL_ANCHOR) wrap = OptionalAttribute("wrap", ST_TextWrappingType) @property def autofit(self): """ The autofit setting for the text frame, a member of the ``MSO_AUTO_SIZE`` enumeration. """ if self.noAutofit is not None: return MSO_AUTO_SIZE.NONE if self.normAutofit is not None: return MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE if self.spAutoFit is not None: return MSO_AUTO_SIZE.SHAPE_TO_FIT_TEXT return None @autofit.setter def autofit(self, value): if value is not None and value not in MSO_AUTO_SIZE._valid_settings: raise ValueError( "only None or a member of the MSO_AUTO_SIZE enumeration can " "be assigned to CT_TextBodyProperties.autofit, got %s" % value) self._remove_eg_textAutoFit() if value == MSO_AUTO_SIZE.NONE: self._add_noAutofit() elif value == MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE: self._add_normAutofit() elif value == MSO_AUTO_SIZE.SHAPE_TO_FIT_TEXT: self._add_spAutoFit()
class CT_TextCharacterProperties(BaseOxmlElement): """`a:rPr, a:defRPr, and `a:endParaRPr` custom element class. 'rPr' is short for 'run properties', and it corresponds to the |Font| proxy class. """ eg_fillProperties = ZeroOrOneChoice( (Choice('a:noFill'), Choice('a:solidFill'), Choice('a:gradFill'), Choice('a:blipFill'), Choice('a:pattFill'), Choice('a:grpFill')), successors=('a:effectLst', 'a:effectDag', 'a:highlight', 'a:uLnTx', 'a:uLn', 'a:uFillTx', 'a:uFill', 'a:latin', 'a:ea', 'a:cs', 'a:sym', 'a:hlinkClick', 'a:hlinkMouseOver', 'a:rtl', 'a:extLst')) latin = ZeroOrOne('a:latin', successors=('a:ea', 'a:cs', 'a:sym', 'a:hlinkClick', 'a:hlinkMouseOver', 'a:rtl', 'a:extLst')) hlinkClick = ZeroOrOne('a:hlinkClick', successors=('a:hlinkMouseOver', 'a:rtl', 'a:extLst')) lang = OptionalAttribute('lang', MSO_LANGUAGE_ID) sz = OptionalAttribute('sz', ST_TextFontSize) b = OptionalAttribute('b', XsdBoolean) i = OptionalAttribute('i', XsdBoolean) u = OptionalAttribute('u', MSO_TEXT_UNDERLINE_TYPE) baseline = OptionalAttribute('baseline', XsdInt) def _new_gradFill(self): return CT_GradientFillProperties.new_gradFill() def add_hlinkClick(self, rId): """ Add an <a:hlinkClick> child element with r:id attribute set to *rId*. """ hlinkClick = self.get_or_add_hlinkClick() hlinkClick.rId = rId return hlinkClick
class CT_TextCharacterProperties(BaseOxmlElement): """`a:rPr, a:defRPr, and `a:endParaRPr` custom element class. 'rPr' is short for 'run properties', and it corresponds to the |Font| proxy class. """ eg_fillProperties = ZeroOrOneChoice( ( Choice("a:noFill"), Choice("a:solidFill"), Choice("a:gradFill"), Choice("a:blipFill"), Choice("a:pattFill"), Choice("a:grpFill"), ), successors=( "a:effectLst", "a:effectDag", "a:highlight", "a:uLnTx", "a:uLn", "a:uFillTx", "a:uFill", "a:latin", "a:ea", "a:cs", "a:sym", "a:hlinkClick", "a:hlinkMouseOver", "a:rtl", "a:extLst", ), ) latin = ZeroOrOne( "a:latin", successors=( "a:ea", "a:cs", "a:sym", "a:hlinkClick", "a:hlinkMouseOver", "a:rtl", "a:extLst", ), ) hlinkClick = ZeroOrOne("a:hlinkClick", successors=("a:hlinkMouseOver", "a:rtl", "a:extLst")) lang = OptionalAttribute("lang", MSO_LANGUAGE_ID) sz = OptionalAttribute("sz", ST_TextFontSize) b = OptionalAttribute("b", XsdBoolean) i = OptionalAttribute("i", XsdBoolean) u = OptionalAttribute("u", MSO_TEXT_UNDERLINE_TYPE) def _new_gradFill(self): return CT_GradientFillProperties.new_gradFill() def add_hlinkClick(self, rId): """ Add an <a:hlinkClick> child element with r:id attribute set to *rId*. """ hlinkClick = self.get_or_add_hlinkClick() hlinkClick.rId = rId return hlinkClick
class CT_ShapeProperties(BaseOxmlElement): """Custom element class for `p:spPr` element. Shared by `p:sp`, `p:cxnSp`, and `p:pic` elements as well as a few more obscure ones. """ _tag_seq = ( "a:xfrm", "a:custGeom", "a:prstGeom", "a:noFill", "a:solidFill", "a:gradFill", "a:blipFill", "a:pattFill", "a:grpFill", "a:ln", "a:effectLst", "a:effectDag", "a:scene3d", "a:sp3d", "a:extLst", ) xfrm = ZeroOrOne("a:xfrm", successors=_tag_seq[1:]) custGeom = ZeroOrOne("a:custGeom", successors=_tag_seq[2:]) prstGeom = ZeroOrOne("a:prstGeom", successors=_tag_seq[3:]) eg_fillProperties = ZeroOrOneChoice( ( Choice("a:noFill"), Choice("a:solidFill"), Choice("a:gradFill"), Choice("a:blipFill"), Choice("a:pattFill"), Choice("a:grpFill"), ), successors=_tag_seq[9:], ) ln = ZeroOrOne("a:ln", successors=_tag_seq[10:]) effectLst = ZeroOrOne("a:effectLst", successors=_tag_seq[11:]) del _tag_seq @property def cx(self): """ Shape width as an instance of Emu, or None if not present. """ cx_str_lst = self.xpath("./a:xfrm/a:ext/@cx") if not cx_str_lst: return None return Emu(cx_str_lst[0]) @property def cy(self): """ Shape height as an instance of Emu, or None if not present. """ cy_str_lst = self.xpath("./a:xfrm/a:ext/@cy") if not cy_str_lst: return None return Emu(cy_str_lst[0]) @property def x(self): """ The offset of the left edge of the shape from the left edge of the slide, as an instance of Emu. Corresponds to the value of the `./xfrm/off/@x` attribute. None if not present. """ x_str_lst = self.xpath("./a:xfrm/a:off/@x") if not x_str_lst: return None return Emu(x_str_lst[0]) @property def y(self): """ The offset of the top of the shape from the top of the slide, as an instance of Emu. None if not present. """ y_str_lst = self.xpath("./a:xfrm/a:off/@y") if not y_str_lst: return None return Emu(y_str_lst[0]) def _new_gradFill(self): return CT_GradientFillProperties.new_gradFill()
class CT_ShapeProperties(BaseOxmlElement): """Custom element class for `p:spPr` element. Shared by `p:sp`, `p:cxnSp`, and `p:pic` elements as well as a few more obscure ones. """ _tag_seq = ( 'a:xfrm', 'a:custGeom', 'a:prstGeom', 'a:noFill', 'a:solidFill', 'a:gradFill', 'a:blipFill', 'a:pattFill', 'a:grpFill', 'a:ln', 'a:effectLst', 'a:effectDag', 'a:scene3d', 'a:sp3d', 'a:extLst', ) xfrm = ZeroOrOne('a:xfrm', successors=_tag_seq[1:]) eg_fillProperties = ZeroOrOneChoice( (Choice('a:noFill'), Choice('a:solidFill'), Choice('a:gradFill'), Choice('a:blipFill'), Choice('a:pattFill'), Choice('a:grpFill')), successors=_tag_seq[9:]) ln = ZeroOrOne('a:ln', successors=_tag_seq[10:]) effectLst = ZeroOrOne('a:effectLst', successors=_tag_seq[11:]) del _tag_seq @property def custGeom(self): """The `a:custGeom` child element, or None if not present.""" return self.find(qn('a:custGeom')) @property def cx(self): """ Shape width as an instance of Emu, or None if not present. """ cx_str_lst = self.xpath('./a:xfrm/a:ext/@cx') if not cx_str_lst: return None return Emu(cx_str_lst[0]) @property def cy(self): """ Shape height as an instance of Emu, or None if not present. """ cy_str_lst = self.xpath('./a:xfrm/a:ext/@cy') if not cy_str_lst: return None return Emu(cy_str_lst[0]) @property def prstGeom(self): """ The <a:prstGeom> child element, or None if not present. """ return self.find(qn('a:prstGeom')) @property def x(self): """ The offset of the left edge of the shape from the left edge of the slide, as an instance of Emu. Corresponds to the value of the `./xfrm/off/@x` attribute. None if not present. """ x_str_lst = self.xpath('./a:xfrm/a:off/@x') if not x_str_lst: return None return Emu(x_str_lst[0]) @property def y(self): """ The offset of the top of the shape from the top of the slide, as an instance of Emu. None if not present. """ y_str_lst = self.xpath('./a:xfrm/a:off/@y') if not y_str_lst: return None return Emu(y_str_lst[0])