|
| 1 | +# encoding: utf-8 |
| 2 | + |
| 3 | +"""Custom element classes related to document settings""" |
| 4 | + |
| 5 | +from __future__ import absolute_import, division, print_function, unicode_literals |
| 6 | + |
| 7 | +from docx.oxml.xmlchemy import BaseOxmlElement, ZeroOrOne |
| 8 | + |
| 9 | + |
| 10 | +class CT_Settings(BaseOxmlElement): |
| 11 | + """`w:settings` element, root element for the settings part""" |
| 12 | + |
| 13 | + _tag_seq = ( |
| 14 | + "w:writeProtection", "w:view", "w:zoom", "w:removePersonalInformation", |
| 15 | + "w:removeDateAndTime", "w:doNotDisplayPageBoundaries", |
| 16 | + "w:displayBackgroundShape", "w:printPostScriptOverText", |
| 17 | + "w:printFractionalCharacterWidth", "w:printFormsData", "w:embedTrueTypeFonts", |
| 18 | + "w:embedSystemFonts", "w:saveSubsetFonts", "w:saveFormsData", "w:mirrorMargins", |
| 19 | + "w:alignBordersAndEdges", "w:bordersDoNotSurroundHeader", |
| 20 | + "w:bordersDoNotSurroundFooter", "w:gutterAtTop", "w:hideSpellingErrors", |
| 21 | + "w:hideGrammaticalErrors", "w:activeWritingStyle", "w:proofState", |
| 22 | + "w:formsDesign", "w:attachedTemplate", "w:linkStyles", |
| 23 | + "w:stylePaneFormatFilter", "w:stylePaneSortMethod", "w:documentType", |
| 24 | + "w:mailMerge", "w:revisionView", "w:trackRevisions", "w:doNotTrackMoves", |
| 25 | + "w:doNotTrackFormatting", "w:documentProtection", "w:autoFormatOverride", |
| 26 | + "w:styleLockTheme", "w:styleLockQFSet", "w:defaultTabStop", "w:autoHyphenation", |
| 27 | + "w:consecutiveHyphenLimit", "w:hyphenationZone", "w:doNotHyphenateCaps", |
| 28 | + "w:showEnvelope", "w:summaryLength", "w:clickAndTypeStyle", |
| 29 | + "w:defaultTableStyle", "w:evenAndOddHeaders", "w:bookFoldRevPrinting", |
| 30 | + "w:bookFoldPrinting", "w:bookFoldPrintingSheets", |
| 31 | + "w:drawingGridHorizontalSpacing", "w:drawingGridVerticalSpacing", |
| 32 | + "w:displayHorizontalDrawingGridEvery", "w:displayVerticalDrawingGridEvery", |
| 33 | + "w:doNotUseMarginsForDrawingGridOrigin", "w:drawingGridHorizontalOrigin", |
| 34 | + "w:drawingGridVerticalOrigin", "w:doNotShadeFormData", "w:noPunctuationKerning", |
| 35 | + "w:characterSpacingControl", "w:printTwoOnOne", "w:strictFirstAndLastChars", |
| 36 | + "w:noLineBreaksAfter", "w:noLineBreaksBefore", "w:savePreviewPicture", |
| 37 | + "w:doNotValidateAgainstSchema", "w:saveInvalidXml", "w:ignoreMixedContent", |
| 38 | + "w:alwaysShowPlaceholderText", "w:doNotDemarcateInvalidXml", |
| 39 | + "w:saveXmlDataOnly", "w:useXSLTWhenSaving", "w:saveThroughXslt", |
| 40 | + "w:showXMLTags", "w:alwaysMergeEmptyNamespace", "w:updateFields", |
| 41 | + "w:hdrShapeDefaults", "w:footnotePr", "w:endnotePr", "w:compat", "w:docVars", |
| 42 | + "w:rsids", "m:mathPr", "w:attachedSchema", "w:themeFontLang", |
| 43 | + "w:clrSchemeMapping", "w:doNotIncludeSubdocsInStats", |
| 44 | + "w:doNotAutoCompressPictures", "w:forceUpgrade", "w:captions", |
| 45 | + "w:readModeInkLockDown", "w:smartTagType", "sl:schemaLibrary", |
| 46 | + "w:shapeDefaults", "w:doNotEmbedSmartTags", "w:decimalSymbol", "w:listSeparator" |
| 47 | + ) |
| 48 | + evenAndOddHeaders = ZeroOrOne("w:evenAndOddHeaders", successors=_tag_seq[48:]) |
| 49 | + del _tag_seq |
| 50 | + |
| 51 | + @property |
| 52 | + def evenAndOddHeaders_val(self): |
| 53 | + """value of `w:evenAndOddHeaders/@w:val` or |None| if not present.""" |
| 54 | + evenAndOddHeaders = self.evenAndOddHeaders |
| 55 | + if evenAndOddHeaders is None: |
| 56 | + return False |
| 57 | + return evenAndOddHeaders.val |
0 commit comments