9
9
)
10
10
11
11
from ..opc .part import XmlPart
12
- from ..shape import InlineShapes
13
- from ..shared import lazyproperty
14
- from .numbering import NumberingPart
15
- from ..opc .constants import RELATIONSHIP_TYPE as RT
16
- from .settings import SettingsPart
17
- from .styles import StylesPart
18
12
from ..footer import Footer
19
13
20
14
@@ -39,107 +33,3 @@ def core_properties(self):
39
33
@property
40
34
def footer (self ):
41
35
return Footer (self ._element , self )
42
-
43
- def get_style (self , style_id , style_type ):
44
- """
45
- Return the style in this footer matching *style_id*. Returns the
46
- default style for *style_type* if *style_id* is |None| or does not
47
- match a defined style of *style_type*.
48
- """
49
- return self .styles .get_by_id (style_id , style_type )
50
-
51
- def get_style_id (self , style_or_name , style_type ):
52
- """
53
- Return the style_id (|str|) of the style of *style_type* matching
54
- *style_or_name*. Returns |None| if the style resolves to the default
55
- style for *style_type* or if *style_or_name* is itself |None|. Raises
56
- if *style_or_name* is a style of the wrong type or names a style not
57
- present in the document.
58
- """
59
- return self .styles .get_style_id (style_or_name , style_type )
60
-
61
- @lazyproperty
62
- def inline_shapes (self ):
63
- """
64
- The |InlineShapes| instance containing the inline shapes in the
65
- footer.
66
- """
67
- return InlineShapes (self ._element .body , self )
68
-
69
- @property
70
- def styles (self ):
71
- """
72
- A |Styles| object providing access to the styles in the styles part
73
- of this footer.
74
- """
75
- return self ._styles_part .styles
76
-
77
- @property
78
- def next_id (self ):
79
- """Next available positive integer id value in this footer.
80
-
81
- Calculated by incrementing maximum existing id value. Gaps in the
82
- existing id sequence are not filled. The id attribute value is unique
83
- in the document, without regard to the element type it appears on.
84
- """
85
- id_str_lst = self ._element .xpath ('//@id' )
86
- used_ids = [int (id_str ) for id_str in id_str_lst if id_str .isdigit ()]
87
- if not used_ids :
88
- return 1
89
- return max (used_ids ) + 1
90
-
91
- @lazyproperty
92
- def numbering_part (self ):
93
- """
94
- A |NumberingPart| object providing access to the numbering
95
- definitions for this document. Creates an empty numbering part if one
96
- is not present.
97
- """
98
- try :
99
- return self .part_related_by (RT .NUMBERING )
100
- except KeyError :
101
- numbering_part = NumberingPart .new ()
102
- self .relate_to (numbering_part , RT .NUMBERING )
103
- return numbering_part
104
-
105
- def save (self , path_or_stream ):
106
- """
107
- Save this document to *path_or_stream*, which can be either a path to
108
- a filesystem location (a string) or a file-like object.
109
- """
110
- self .package .save (path_or_stream )
111
-
112
- @property
113
- def settings (self ):
114
- """
115
- A |Settings| object providing access to the settings in the settings
116
- part of this footer.
117
- """
118
- return self ._settings_part .settings
119
-
120
- @property
121
- def _settings_part (self ):
122
- """
123
- A |SettingsPart| object providing access to the document-level
124
- settings for this footer. Creates a default settings part if one is
125
- not present.
126
- """
127
- try :
128
- return self .part_related_by (RT .SETTINGS )
129
- except KeyError :
130
- settings_part = SettingsPart .default (self .package )
131
- self .relate_to (settings_part , RT .SETTINGS )
132
- return settings_part
133
-
134
- @property
135
- def _styles_part (self ):
136
- """
137
- Instance of |StylesPart| for this footer. Creates an empty styles
138
- part if one is not present.
139
- """
140
- try :
141
- return self .part_related_by (RT .STYLES )
142
- except KeyError :
143
- styles_part = StylesPart .default (self .package )
144
- self .relate_to (styles_part , RT .STYLES )
145
- return styles_part
0 commit comments