1010from .ns import nsdecls , qn
1111from .shared import CT_String
1212from .simpletypes import ST_BrClear , ST_BrType
13- from .xmlchemy import BaseOxmlElement , OptionalAttribute , ZeroOrMore
13+ from .xmlchemy import (
14+ BaseOxmlElement , OptionalAttribute , ZeroOrMore , ZeroOrOne
15+ )
1416
1517
1618class CT_Br (BaseOxmlElement ):
@@ -25,37 +27,13 @@ class CT_P(BaseOxmlElement):
2527 """
2628 ``<w:p>`` element, containing the properties and text for a paragraph.
2729 """
28- def add_r (self ):
29- """
30- Return a newly added CT_R (<w:r>) element.
31- """
32- r = CT_R .new ()
33- self .append (r )
34- return r
30+ pPr = ZeroOrOne ('w:pPr' )
31+ r = ZeroOrMore ('w:r' )
3532
36- def get_or_add_pPr (self ):
37- """
38- Return the pPr child element, newly added if not present.
39- """
40- pPr = self .pPr
41- if pPr is None :
42- pPr = self ._add_pPr ()
33+ def _insert_pPr (self , pPr ):
34+ self .insert (0 , pPr )
4335 return pPr
4436
45- @property
46- def pPr (self ):
47- """
48- ``<w:pPr>`` child element or None if not present.
49- """
50- return self .find (qn ('w:pPr' ))
51-
52- @property
53- def r_lst (self ):
54- """
55- Sequence containing a reference to each run element in this paragraph.
56- """
57- return self .findall (qn ('w:r' ))
58-
5937 @property
6038 def style (self ):
6139 """
@@ -76,14 +54,6 @@ def style(self, style):
7654 pPr = self .get_or_add_pPr ()
7755 pPr .style = style
7856
79- def _add_pPr (self ):
80- """
81- Return a newly added pPr child element. Assumes one is not present.
82- """
83- pPr = CT_PPr .new ()
84- self .insert (0 , pPr )
85- return pPr
86-
8757
8858class CT_PPr (BaseOxmlElement ):
8959 """
0 commit comments