Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java 
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java Sat 
Dec 12 23:15:20 2020
@@ -24,6 +24,7 @@ import org.apache.poi.common.usermodel.f
 import org.apache.poi.common.usermodel.fonts.FontGroup;
 import org.apache.poi.common.usermodel.fonts.FontInfo;
 import org.apache.poi.common.usermodel.fonts.FontPitch;
+import org.apache.poi.ooxml.util.POIXMLUnits;
 import org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException;
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.apache.poi.sl.draw.DrawPaint;
@@ -34,6 +35,7 @@ import org.apache.poi.util.Beta;
 import org.apache.poi.util.Internal;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
+import org.apache.poi.util.Units;
 import org.apache.poi.xslf.model.CharacterPropertyFetcher;
 import org.apache.poi.xslf.model.CharacterPropertyFetcher.CharPropFetcher;
 import org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties;
@@ -182,7 +184,7 @@ public class XSLFTextRun implements Text
             if (tbp != null) {
                 CTTextNormalAutofit afit = tbp.getNormAutofit();
                 if (afit != null && afit.isSetFontScale()) {
-                    scale = afit.getFontScale() / 100000.;
+                    scale = POIXMLUnits.parsePercent(afit.xgetFontScale()) / 
100000.;
                 }
             }
         }
@@ -203,7 +205,7 @@ public class XSLFTextRun implements Text
     public double getCharacterSpacing(){
         Double d = fetchCharacterProperty((props, val) -> {
             if (props.isSetSpc()) {
-                val.accept(props.getSpc()*0.01);
+                
val.accept(Units.toPoints(POIXMLUnits.parseLength(props.xgetSpc())));
             }
         });
         return d == null ? 0 : d;
@@ -297,7 +299,7 @@ public class XSLFTextRun implements Text
     public boolean isSuperscript() {
         Boolean b = fetchCharacterProperty((props, val) -> {
             if (props.isSetBaseline()) {
-                val.accept(props.getBaseline() > 0);
+                val.accept(POIXMLUnits.parsePercent(props.xgetBaseline()) > 0);
             }
         });
         return b != null && b;
@@ -341,7 +343,7 @@ public class XSLFTextRun implements Text
     public boolean isSubscript() {
         Boolean b = fetchCharacterProperty((props, val) -> {
             if (props.isSetBaseline()) {
-                val.accept(props.getBaseline() < 0);
+                val.accept(POIXMLUnits.parsePercent(props.xgetBaseline()) < 0);
             }
         });
         return b != null && b;
@@ -565,7 +567,7 @@ public class XSLFTextRun implements Text
         @Override
         public String getTypeface() {
             CTTextFont tf = getXmlObject(false);
-            return (tf != null && tf.isSetTypeface()) ? tf.getTypeface() : 
null;
+            return (tf != null) ? tf.getTypeface() : null;
         }
 
         @Override
@@ -718,7 +720,10 @@ public class XSLFTextRun implements Text
                 return null;
             }
 
-            String typeface = font.isSetTypeface() ? font.getTypeface() : "";
+            String typeface = font.getTypeface();
+            if (typeface == null) {
+                typeface = "";
+            }
             if (typeface.startsWith("+mj-") || typeface.startsWith("+mn-")) {
                 //  "+mj-lt".equals(typeface) || "+mn-lt".equals(typeface)
                 final XSLFTheme theme = 
_p.getParentShape().getSheet().getTheme();
@@ -737,7 +742,7 @@ public class XSLFTextRun implements Text
                 }
                 // SYMBOL is missing
 
-                if (font == null || !font.isSetTypeface() || 
"".equals(font.getTypeface())) {
+                if (font == null || font.getTypeface() == null || 
"".equals(font.getTypeface())) {
                     // don't fallback to latin but bubble up in the style 
hierarchy (slide -> layout -> master -> theme)
                     return null;
 //                    font = coll.getLatin();

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java 
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java 
Sat Dec 12 23:15:20 2020
@@ -29,6 +29,7 @@ import java.util.function.Function;
 import java.util.function.Predicate;
 
 import org.apache.poi.ooxml.POIXMLException;
+import org.apache.poi.ooxml.util.POIXMLUnits;
 import org.apache.poi.sl.draw.DrawFactory;
 import org.apache.poi.sl.draw.DrawTextShape;
 import org.apache.poi.sl.usermodel.Insets2D;
@@ -277,7 +278,7 @@ public abstract class XSLFTextShape exte
             }
         };
         fetchShapeProperty(fetcher);
-        return fetcher.getValue() == null ? false : fetcher.getValue();
+        return fetcher.getValue() != null && fetcher.getValue();
     }
 
     @Override
@@ -348,7 +349,7 @@ public abstract class XSLFTextShape exte
             @Override
             public boolean fetch(CTTextBodyProperties props) {
                 if (props.isSetBIns()) {
-                    double val = Units.toPoints(props.getBIns());
+                    double val = 
Units.toPoints(POIXMLUnits.parseLength(props.xgetBIns()));
                     setValue(val);
                     return true;
                 }
@@ -372,7 +373,7 @@ public abstract class XSLFTextShape exte
             @Override
             public boolean fetch(CTTextBodyProperties props) {
                 if (props.isSetLIns()) {
-                    double val = Units.toPoints(props.getLIns());
+                    double val = 
Units.toPoints(POIXMLUnits.parseLength(props.xgetLIns()));
                     setValue(val);
                     return true;
                 }
@@ -396,7 +397,7 @@ public abstract class XSLFTextShape exte
             @Override
             public boolean fetch(CTTextBodyProperties props) {
                 if (props.isSetRIns()) {
-                    double val = Units.toPoints(props.getRIns());
+                    double val = 
Units.toPoints(POIXMLUnits.parseLength(props.xgetRIns()));
                     setValue(val);
                     return true;
                 }
@@ -419,7 +420,7 @@ public abstract class XSLFTextShape exte
             @Override
             public boolean fetch(CTTextBodyProperties props) {
                 if (props.isSetTIns()) {
-                    double val = Units.toPoints(props.getTIns());
+                    double val = 
Units.toPoints(POIXMLUnits.parseLength(props.xgetTIns()));
                     setValue(val);
                     return true;
                 }
@@ -533,7 +534,7 @@ public abstract class XSLFTextShape exte
             }
         };
         fetchShapeProperty(fetcher);
-        return fetcher.getValue() == null ? true : fetcher.getValue();
+        return fetcher.getValue() == null || fetcher.getValue();
     }
 
     @Override

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTexturePaint.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTexturePaint.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTexturePaint.java 
(original)
+++ 
poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTexturePaint.java 
Sat Dec 12 23:15:20 2020
@@ -25,6 +25,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.function.Supplier;
 
+import org.apache.poi.ooxml.util.POIXMLUnits;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.apache.poi.openxml4j.opc.PackageRelationship;
@@ -40,6 +41,7 @@ import org.openxmlformats.schemas.drawin
 import org.openxmlformats.schemas.drawingml.x2006.main.CTRelativeRect;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTileInfoProperties;
+import org.openxmlformats.schemas.drawingml.x2006.main.STPercentage;
 import org.openxmlformats.schemas.drawingml.x2006.main.STTileFlipMode;
 
 @Internal
@@ -92,7 +94,7 @@ public class XSLFTexturePaint implements
     @Override
     public int getAlpha() {
         return (blip.sizeOfAlphaModFixArray() > 0)
-                ? blip.getAlphaModFixArray(0).getAmt()
+                ? 
POIXMLUnits.parsePercent(blip.getAlphaModFixArray(0).xgetAmt())
                 : 100000;
     }
 
@@ -105,16 +107,16 @@ public class XSLFTexturePaint implements
     public Dimension2D getScale() {
         CTTileInfoProperties tile = blipFill.getTile();
         return (tile == null) ? null : new Dimension2DDouble(
-                tile.isSetSx() ? tile.getSx()/100_000. : 1,
-                tile.isSetSy() ? tile.getSy()/100_000. : 1);
+                tile.isSetSx() ? 
POIXMLUnits.parsePercent(tile.xgetSx())/100_000. : 1,
+                tile.isSetSy() ? 
POIXMLUnits.parsePercent(tile.xgetSy())/100_000. : 1);
     }
 
     @Override
     public Point2D getOffset() {
         CTTileInfoProperties tile = blipFill.getTile();
         return (tile == null) ? null : new Point2D.Double(
-                tile.isSetTx() ? Units.toPoints(tile.getTx()) : 0,
-                tile.isSetTy() ? Units.toPoints(tile.getTy()) : 0);
+                tile.isSetTx() ? 
Units.toPoints(POIXMLUnits.parseLength(tile.xgetTx())) : 0,
+                tile.isSetTy() ? 
Units.toPoints(POIXMLUnits.parseLength(tile.xgetTy())) : 0);
     }
 
     @Override
@@ -166,14 +168,14 @@ public class XSLFTexturePaint implements
 
     private static Insets2D getRectVal(CTRelativeRect rect) {
         return rect == null ? null : new Insets2D(
-            getRectVal(rect::isSetT, rect::getT),
-            getRectVal(rect::isSetL, rect::getL),
-            getRectVal(rect::isSetB, rect::getB),
-            getRectVal(rect::isSetR, rect::getR)
+            getRectVal(rect::isSetT, rect::xgetT),
+            getRectVal(rect::isSetL, rect::xgetL),
+            getRectVal(rect::isSetB, rect::xgetB),
+            getRectVal(rect::isSetR, rect::xgetR)
         );
     }
 
-    private static int getRectVal(Supplier<Boolean> isSet, Supplier<Integer> 
val) {
-        return isSet.get() ? val.get() : 0;
+    private static int getRectVal(Supplier<Boolean> isSet, 
Supplier<STPercentage> val) {
+        return isSet.get() ? POIXMLUnits.parsePercent(val.get()) : 0;
     }
 }

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFImportFromXML.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFImportFromXML.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFImportFromXML.java 
(original)
+++ 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/extractor/XSSFImportFromXML.java 
Sat Dec 12 23:15:20 2020
@@ -35,10 +35,10 @@ import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpressionException;
 
+import org.apache.poi.ooxml.util.DocumentHelper;
 import org.apache.poi.ooxml.util.XPathHelper;
 import org.apache.poi.ss.usermodel.DateUtil;
 import org.apache.poi.ss.util.CellReference;
-import org.apache.poi.ooxml.util.DocumentHelper;
 import org.apache.poi.util.LocaleUtil;
 import org.apache.poi.util.POILogFactory;
 import org.apache.poi.util.POILogger;
@@ -49,7 +49,6 @@ import org.apache.poi.xssf.usermodel.XSS
 import org.apache.poi.xssf.usermodel.XSSFTableColumn;
 import org.apache.poi.xssf.usermodel.helpers.XSSFSingleXmlCell;
 import org.apache.poi.xssf.usermodel.helpers.XSSFXmlColumnPr;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.STXmlDataType;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
@@ -104,7 +103,7 @@ public class XSSFImportFromXML {
 
         for (XSSFSingleXmlCell singleXmlCell : singleXmlCells) {
 
-            STXmlDataType.Enum xmlDataType = singleXmlCell.getXmlDataType();
+            String xmlDataType = singleXmlCell.getXmlDataType();
             String xpathString = singleXmlCell.getXpath();
             Node result = (Node) xpath.evaluate(xpathString, doc, 
XPathConstants.NODE);
             // result can be null if value is optional (xsd:minOccurs=0), see 
bugzilla 55864
@@ -166,22 +165,22 @@ public class XSSFImportFromXML {
         }
     }
 
-    
 
-    private static enum DataType {
-        BOOLEAN(STXmlDataType.BOOLEAN), //
-        DOUBLE(STXmlDataType.DOUBLE), //
-        INTEGER(STXmlDataType.INT, STXmlDataType.UNSIGNED_INT, 
STXmlDataType.INTEGER), //
-        STRING(STXmlDataType.STRING), //
-        DATE(STXmlDataType.DATE);
 
-        private Set<STXmlDataType.Enum> xmlDataTypes;
+    private enum DataType {
+        BOOLEAN("boolean"), //
+        DOUBLE("double"), //
+        INTEGER("int", "unsignedInt", "integer"), //
+        STRING("string"), //
+        DATE("date");
+
+        private Set<String> xmlDataTypes;
 
-        private DataType(STXmlDataType.Enum... xmlDataTypes) {
+        DataType(String... xmlDataTypes) {
             this.xmlDataTypes = new HashSet<>(Arrays.asList(xmlDataTypes));
         }
 
-        public static DataType getDataType(STXmlDataType.Enum xmlDataType) {
+        public static DataType getDataType(String xmlDataType) {
             for (DataType dataType : DataType.values()) {
                 if (dataType.xmlDataTypes.contains(xmlDataType)) {
                     return dataType;
@@ -191,7 +190,7 @@ public class XSSFImportFromXML {
         }
     }
 
-    private void setCellValue(String value, XSSFCell cell, STXmlDataType.Enum 
xmlDataType) {
+    private void setCellValue(String value, XSSFCell cell, String xmlDataType) 
{
         DataType type = DataType.getDataType(xmlDataType);
         try {
             if (value.isEmpty() || type == null) {

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java 
(original)
+++ 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFClientAnchor.java 
Sat Dec 12 23:15:20 2020
@@ -17,6 +17,7 @@
 
 package org.apache.poi.xssf.usermodel;
 
+import org.apache.poi.ooxml.util.POIXMLUnits;
 import org.apache.poi.ss.usermodel.ClientAnchor;
 import org.apache.poi.util.Internal;
 import org.apache.poi.util.Units;
@@ -32,15 +33,15 @@ import org.openxmlformats.schemas.drawin
  * <li>A position relative to a cell (top-left) and sized relative to another 
cell (bottom right)
  * </ol>
  *
- * which method is used is determined by the {@link AnchorType}.  
+ * which method is used is determined by the {@link AnchorType}.
  */
 public class XSSFClientAnchor extends XSSFAnchor implements ClientAnchor {
-    
+
     /**
      * placeholder for zeros when needed for dynamic position calculations
      */
     private static final CTMarker EMPTY_MARKER = 
CTMarker.Factory.newInstance();
-    
+
     private AnchorType anchorType;
 
     /**
@@ -59,18 +60,18 @@ public class XSSFClientAnchor extends XS
      * if present, fixed size of the object to use instead of cell2, which is 
inferred instead
      */
     private CTPositiveSize2D size;
-    
+
     /**
      * if present, fixed top-left position to use instead of cell1, which is 
inferred instead
      */
     private CTPoint2D position;
-    
+
     /**
      * sheet to base dynamic calculations on, if needed.  Required if size 
and/or position or set.
      * Not needed if cell1/2 are set explicitly (dynamic sizing and position 
relative to cells).
      */
     private XSSFSheet sheet;
-    
+
     /**
      * Creates a new client anchor and defaults all the anchor positions to 0.
      * Sets the type to {@link AnchorType#MOVE_AND_RESIZE} relative to cell 
range A1:A1.
@@ -134,7 +135,7 @@ public class XSSFClientAnchor extends XS
         this.cell1 = cell1;
 //        this.cell2 = calcCell(sheet, cell1, size.getCx(), size.getCy());
     }
-    
+
     /**
      * Create XSSFClientAnchor from existing xml beans, sized and positioned 
relative to a pair of cells.
      * Sets the type to {@link AnchorType#DONT_MOVE_AND_RESIZE}.
@@ -152,18 +153,18 @@ public class XSSFClientAnchor extends XS
 //        this.cell1 = calcCell(sheet, EMPTY_MARKER, position.getCx(), 
position.getCy());
 //        this.cell2 = calcCell(sheet, cell1, size.getCx(), size.getCy());
     }
-    
+
     private CTMarker calcCell(CTMarker cell, long w, long h) {
         CTMarker c2 = CTMarker.Factory.newInstance();
-        
+
         int r = cell.getRow();
         int c = cell.getCol();
-        
+
         int cw = Units.columnWidthToEMU(sheet.getColumnWidth(c));
-        
+
         // start with width - offset, then keep adding column widths until the 
next one puts us over w
-        long wPos = cw - cell.getColOff();
-        
+        long wPos = cw - POIXMLUnits.parseLength(cell.xgetColOff());
+
         while (wPos < w) {
             c++;
             cw = Units.columnWidthToEMU(sheet.getColumnWidth(c));
@@ -172,11 +173,11 @@ public class XSSFClientAnchor extends XS
         // now wPos >= w, so end column = c, now figure offset
         c2.setCol(c);
         c2.setColOff(cw - (wPos - w));
-        
+
         int rh = Units.toEMU(getRowHeight(sheet, r));
         // start with height - offset, then keep adding row heights until the 
next one puts us over h
-        long hPos = rh - cell.getRowOff();
-        
+        long hPos = rh - POIXMLUnits.parseLength(cell.xgetRowOff());
+
         while (hPos < h) {
             r++;
             rh = Units.toEMU(getRowHeight(sheet, r));
@@ -185,10 +186,10 @@ public class XSSFClientAnchor extends XS
         // now hPos >= h, so end row = r, now figure offset
         c2.setRow(r);
         c2.setRowOff(rh - (hPos - h));
-        
+
         return c2;
     }
-    
+
     /**
      * @param sheet
      * @param row
@@ -198,15 +199,15 @@ public class XSSFClientAnchor extends XS
         XSSFRow r = sheet.getRow(row);
         return r == null ? sheet.getDefaultRowHeightInPoints() : 
r.getHeightInPoints();
     }
-    
+
     private CTMarker getCell1() {
-        return cell1 != null ? cell1 : calcCell(EMPTY_MARKER, position.getX(), 
position.getY());
+        return cell1 != null ? cell1 : calcCell(EMPTY_MARKER, 
POIXMLUnits.parseLength(position.xgetX()), 
POIXMLUnits.parseLength(position.xgetY()));
     }
-    
+
     private CTMarker getCell2() {
         return cell2 != null ? cell2 : calcCell(getCell1(), size.getCx(), 
size.getCy());
     }
-    
+
     public short getCol1() {
         return (short)getCell1().getCol();
     }
@@ -256,7 +257,7 @@ public class XSSFClientAnchor extends XS
     }
 
     public int getDx1() {
-        return Math.toIntExact(getCell1().getColOff());
+        return 
Math.toIntExact(POIXMLUnits.parseLength(getCell1().xgetColOff()));
     }
 
     /**
@@ -268,7 +269,7 @@ public class XSSFClientAnchor extends XS
     }
 
     public int getDy1() {
-        return Math.toIntExact(getCell1().getRowOff());
+        return 
Math.toIntExact(POIXMLUnits.parseLength(getCell1().xgetRowOff()));
     }
 
     /**
@@ -280,7 +281,7 @@ public class XSSFClientAnchor extends XS
     }
 
     public int getDy2() {
-        return Math.toIntExact(getCell2().getRowOff());
+        return 
Math.toIntExact(POIXMLUnits.parseLength(getCell2().xgetRowOff()));
     }
 
     /**
@@ -292,7 +293,7 @@ public class XSSFClientAnchor extends XS
     }
 
     public int getDx2() {
-        return Math.toIntExact(getCell2().getColOff());
+        return 
Math.toIntExact(POIXMLUnits.parseLength(getCell2().xgetColOff()));
     }
 
     /**
@@ -365,7 +366,7 @@ public class XSSFClientAnchor extends XS
     public CTPoint2D getPosition() {
         return position;
     }
-    
+
     /**
      * Sets the top-left absolute position of the object.  To use this, "from" 
must be set to null.
      * @param position
@@ -383,7 +384,7 @@ public class XSSFClientAnchor extends XS
     public CTPositiveSize2D getSize() {
         return size;
     }
-    
+
     /**
      * Sets the size of the object.  To use this, "to" must be set to null.
      * @param size

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java 
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java Sat 
Dec 12 23:15:20 2020
@@ -29,9 +29,11 @@ import org.apache.poi.util.Internal;
 import org.apache.poi.util.Removal;
 import org.apache.poi.xssf.model.StylesTable;
 import org.apache.poi.xssf.model.ThemesTable;
+import 
org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STVerticalAlignRun;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont;
+import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFontFamily;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFontName;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFontScheme;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFontSize;
@@ -40,7 +42,6 @@ import org.openxmlformats.schemas.spread
 import 
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTVerticalAlignFontProperty;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.STFontScheme;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.STUnderlineValues;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.STVerticalAlignRun;
 
 /**
  * Represents a font used in a workbook.
@@ -618,7 +619,7 @@ public class XSSFFont implements Font {
      * @see org.apache.poi.ss.usermodel.FontFamily
      */
     public int getFamily() {
-        CTIntProperty family = _ctFont.sizeOfFamilyArray() == 0 ? null : 
_ctFont.getFamilyArray(0);
+        CTFontFamily family = _ctFont.sizeOfFamilyArray() == 0 ? null : 
_ctFont.getFamilyArray(0);
         return family == null ? FontFamily.NOT_APPLICABLE.getValue() : 
FontFamily.valueOf(family.getVal()).getValue();
     }
 
@@ -631,7 +632,7 @@ public class XSSFFont implements Font {
      * @see FontFamily
      */
     public void setFamily(int value) {
-        CTIntProperty family = _ctFont.sizeOfFamilyArray() == 0 ? 
_ctFont.addNewFamily() : _ctFont.getFamilyArray(0);
+        CTFontFamily family = _ctFont.sizeOfFamilyArray() == 0 ? 
_ctFont.addNewFamily() : _ctFont.getFamilyArray(0);
         family.setVal(value);
     }
 

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFontFormatting.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFontFormatting.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFontFormatting.java 
(original)
+++ 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFontFormatting.java 
Sat Dec 12 23:15:20 2020
@@ -22,13 +22,13 @@ import org.apache.poi.ss.usermodel.Color
 import org.apache.poi.ss.usermodel.Font;
 import org.apache.poi.ss.usermodel.FontFormatting;
 import org.apache.poi.ss.usermodel.FontUnderline;
+import 
org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STVerticalAlignRun;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFontSize;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTUnderlineProperty;
 import 
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTVerticalAlignFontProperty;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.STUnderlineValues;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.STVerticalAlignRun;
 
 
 /**

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java 
(original)
+++ 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java 
Sat Dec 12 23:15:20 2020
@@ -17,24 +17,27 @@
 
 package org.apache.poi.xssf.usermodel;
 
-import java.util.*;
-import java.util.regex.Pattern;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
 import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import javax.xml.namespace.QName;
 
 import org.apache.poi.ss.usermodel.Font;
 import org.apache.poi.ss.usermodel.RichTextString;
+import org.apache.poi.util.Internal;
 import org.apache.poi.xssf.model.StylesTable;
 import org.apache.poi.xssf.model.ThemesTable;
-import org.apache.poi.util.Internal;
 import org.apache.xmlbeans.XmlCursor;
+import org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STXstring;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRElt;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRPrElt;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.STXstring;
 
 
 /**

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSignatureLine.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSignatureLine.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSignatureLine.java 
(original)
+++ 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSignatureLine.java 
Sat Dec 12 23:15:20 2020
@@ -23,9 +23,7 @@ import java.io.OutputStream;
 import javax.xml.namespace.QName;
 
 import com.microsoft.schemas.office.excel.CTClientData;
-import com.microsoft.schemas.office.excel.STCF;
 import com.microsoft.schemas.office.excel.STObjectType;
-import com.microsoft.schemas.office.excel.STTrueFalseBlank;
 import com.microsoft.schemas.office.office.CTSignatureLine;
 import com.microsoft.schemas.vml.CTImageData;
 import com.microsoft.schemas.vml.CTShape;
@@ -38,6 +36,7 @@ import org.apache.poi.openxml4j.exceptio
 import org.apache.poi.poifs.crypt.dsig.SignatureLine;
 import org.apache.poi.schemas.vmldrawing.CTXML;
 import org.apache.xmlbeans.XmlException;
+import 
org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STTrueFalseBlank;
 
 public class XSSFSignatureLine extends SignatureLine {
     private static final String MS_VML_URN = "urn:schemas-microsoft-com:vml";
@@ -78,7 +77,7 @@ public class XSSFSignatureLine extends S
         clientData.addAnchor(anchorStr);
         clientData.setObjectType(STObjectType.PICT);
         clientData.addSizeWithCells(STTrueFalseBlank.X);
-        clientData.addCF(STCF.PICT);
+        clientData.addCF("pict");
         clientData.addAutoPict(STTrueFalseBlank.X);
     }
 

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTextParagraph.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTextParagraph.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTextParagraph.java 
(original)
+++ 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTextParagraph.java 
Sat Dec 12 23:15:20 2020
@@ -17,6 +17,12 @@
 package org.apache.poi.xssf.usermodel;
 
 
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.poi.ooxml.util.POIXMLUnits;
 import org.apache.poi.util.Internal;
 import org.apache.poi.util.Units;
 import org.apache.poi.xssf.model.ParagraphPropertyFetcher;
@@ -24,11 +30,6 @@ import org.apache.xmlbeans.XmlObject;
 import org.openxmlformats.schemas.drawingml.x2006.main.*;
 import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape;
 
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 /**
  * Represents a paragraph of text within the containing text body.
  * The paragraph is the highest level text separation mechanism.
@@ -142,7 +143,7 @@ public class XSSFTextParagraph implement
             }
         };
         fetchParagraphProperty(fetcher);
-        return fetcher.getValue() == null ? TextAlign.LEFT : 
fetcher.getValue();        
+        return fetcher.getValue() == null ? TextAlign.LEFT : 
fetcher.getValue();
     }
 
     /**
@@ -159,12 +160,12 @@ public class XSSFTextParagraph implement
         } else {
             pr.setAlgn(STTextAlignType.Enum.forInt(align.ordinal() + 1));
         }
-    }    
+    }
 
     /**
      * Returns where vertically on a line of text the actual words are 
positioned. This deals
      * with vertical placement of the characters with respect to the baselines.
-     * 
+     *
      * If this attribute is omitted, then a value of baseline is implied.
      * @return alignment that is applied to the paragraph
      */
@@ -180,7 +181,7 @@ public class XSSFTextParagraph implement
             }
         };
         fetchParagraphProperty(fetcher);
-        return fetcher.getValue() == null ? TextFontAlign.BASELINE : 
fetcher.getValue();        
+        return fetcher.getValue() == null ? TextFontAlign.BASELINE : 
fetcher.getValue();
     }
 
     /**
@@ -295,7 +296,7 @@ public class XSSFTextParagraph implement
         ParagraphPropertyFetcher<Double> fetcher = new 
ParagraphPropertyFetcher<Double>(getLevel()){
             public boolean fetch(CTTextParagraphProperties props){
                 if(props.isSetBuSzPct()){
-                    setValue(props.getBuSzPct().getVal() * 0.001);
+                    
setValue(POIXMLUnits.parsePercent(props.getBuSzPct().xgetVal()) * 0.001);
                     return true;
                 }
                 if(props.isSetBuSzPts()){
@@ -323,7 +324,7 @@ public class XSSFTextParagraph implement
         if(bulletSize >= 0) {
             // percentage
             CTTextBulletSizePercent pt = pr.isSetBuSzPct() ? pr.getBuSzPct() : 
pr.addNewBuSzPct();
-            pt.setVal((int)(bulletSize*1000));
+            pt.setVal(Integer.toString((int)(bulletSize*1000)));
             // unset points if percentage is now set
             if(pr.isSetBuSzPts()) pr.unsetBuSzPts();
         } else {
@@ -338,7 +339,7 @@ public class XSSFTextParagraph implement
     /**
      * Specifies the indent size that will be applied to the first line of 
text in the paragraph.
      *
-     * @param value the indent in points, -1 to unset indent and use the 
default of 0. 
+     * @param value the indent in points, -1 to unset indent and use the 
default of 0.
      */
     public void setIndent(double value){
         CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : 
_p.addNewPPr();
@@ -441,8 +442,8 @@ public class XSSFTextParagraph implement
         };
         fetchParagraphProperty(fetcher);
         // if the marL attribute is omitted, then a value of 347663 is implied
-        return fetcher.getValue() == null ? 0 : fetcher.getValue();        
-    }    
+        return fetcher.getValue() == null ? 0 : fetcher.getValue();
+    }
 
     /**
      *
@@ -452,7 +453,7 @@ public class XSSFTextParagraph implement
         ParagraphPropertyFetcher<Double> fetcher = new 
ParagraphPropertyFetcher<Double>(getLevel()){
             public boolean fetch(CTTextParagraphProperties props){
                 if(props.isSetDefTabSz()){
-                    double val = Units.toPoints(props.getDefTabSz());
+                    double val = 
Units.toPoints(POIXMLUnits.parseLength(props.xgetDefTabSz()));
                     setValue(val);
                     return true;
                 }
@@ -470,7 +471,7 @@ public class XSSFTextParagraph implement
                     CTTextTabStopList tabStops = props.getTabLst();
                     if(idx < tabStops.sizeOfTabArray() ) {
                         CTTextTabStop ts = tabStops.getTabArray(idx);
-                        double val = Units.toPoints(ts.getPos());
+                        double val = 
Units.toPoints(POIXMLUnits.parseLength(ts.xgetPos()));
                         setValue(val);
                         return true;
                     }
@@ -483,8 +484,8 @@ public class XSSFTextParagraph implement
     }
     /**
      * Add a single tab stop to be used on a line of text when there are one 
or more tab characters
-     * present within the text. 
-     * 
+     * present within the text.
+     *
      * @param value the position of the tab stop relative to the left margin
      */
     public void addTabStop(double value){
@@ -511,7 +512,7 @@ public class XSSFTextParagraph implement
      *      // spacing will be 48 points
      *      paragraph.setLineSpacing(-48.0);
      * </code></pre>
-     * 
+     *
      * @param linespacing the vertical line spacing
      */
     public void setLineSpacing(double linespacing){
@@ -538,7 +539,7 @@ public class XSSFTextParagraph implement
                 if(props.isSetLnSpc()){
                     CTTextSpacing spc = props.getLnSpc();
 
-                    if(spc.isSetSpcPct()) setValue( 
spc.getSpcPct().getVal()*0.001 );
+                    if(spc.isSetSpcPct()) setValue( 
POIXMLUnits.parsePercent(spc.getSpcPct().xgetVal())*0.001 );
                     else if (spc.isSetSpcPts()) setValue( 
-spc.getSpcPts().getVal()*0.01 );
                     return true;
                 }
@@ -556,7 +557,7 @@ public class XSSFTextParagraph implement
                 lnSpc *= scale;
             }
         }
-        
+
         return lnSpc;
     }
 
@@ -603,7 +604,7 @@ public class XSSFTextParagraph implement
                 if(props.isSetSpcBef()){
                     CTTextSpacing spc = props.getSpcBef();
 
-                    if(spc.isSetSpcPct()) setValue( 
spc.getSpcPct().getVal()*0.001 );
+                    if(spc.isSetSpcPct()) setValue( 
POIXMLUnits.parsePercent(spc.getSpcPct().xgetVal())*0.001 );
                     else if (spc.isSetSpcPts()) setValue( 
-spc.getSpcPts().getVal()*0.01 );
                     return true;
                 }
@@ -658,7 +659,7 @@ public class XSSFTextParagraph implement
                 if(props.isSetSpcAft()){
                     CTTextSpacing spc = props.getSpcAft();
 
-                    if(spc.isSetSpcPct()) setValue( 
spc.getSpcPct().getVal()*0.001 );
+                    if(spc.isSetSpcPct()) setValue( 
POIXMLUnits.parsePercent(spc.getSpcPct().xgetVal())*0.001 );
                     else if (spc.isSetSpcPts()) setValue( 
-spc.getSpcPts().getVal()*0.01 );
                     return true;
                 }
@@ -676,7 +677,7 @@ public class XSSFTextParagraph implement
      * that this paragraph belongs to (therefore in the parent shape).
      * <p>
      * Note that the closest properties object to the text is used, therefore 
if there is
-     * a conflict between the text paragraph properties and the list style 
properties for 
+     * a conflict between the text paragraph properties and the list style 
properties for
      * this level then the text paragraph properties will take precedence.
      * </p>
      *
@@ -690,7 +691,7 @@ public class XSSFTextParagraph implement
 
     /**
      * Returns the level of text properties that this paragraph will follow.
-     * 
+     *
      * @return the text level of this paragraph (0-based). Default is 0.
      */
     public int getLevel(){
@@ -699,7 +700,7 @@ public class XSSFTextParagraph implement
 
         return pr.getLvl();
     }
-    
+
 
     /**
      * Returns whether this paragraph has bullets
@@ -727,10 +728,10 @@ public class XSSFTextParagraph implement
         fetchParagraphProperty(fetcher);
         return fetcher.getValue() == null ? false : fetcher.getValue();
     }
-    
+
     /**
      * Set or unset this paragraph as a bullet point
-     * 
+     *
      * @param flag whether text in this paragraph has bullets
      */
     public void setBullet(boolean flag) {
@@ -739,7 +740,7 @@ public class XSSFTextParagraph implement
         CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : 
_p.addNewPPr();
         if(!flag) {
             pr.addNewBuNone();
-            
+
             if(pr.isSetBuAutoNum()) pr.unsetBuAutoNum();
             if(pr.isSetBuBlip()) pr.unsetBuBlip();
             if(pr.isSetBuChar()) pr.unsetBuChar();
@@ -767,17 +768,17 @@ public class XSSFTextParagraph implement
     public void setBullet(ListAutoNumber scheme, int startAt) {
         if(startAt < 1) throw new IllegalArgumentException("Start Number must 
be greater or equal that 1") ;
         CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : 
_p.addNewPPr();
-        CTTextAutonumberBullet lst = pr.isSetBuAutoNum() ? pr.getBuAutoNum() : 
pr.addNewBuAutoNum();        
+        CTTextAutonumberBullet lst = pr.isSetBuAutoNum() ? pr.getBuAutoNum() : 
pr.addNewBuAutoNum();
         lst.setType(STTextAutonumberScheme.Enum.forInt(scheme.ordinal() + 1));
         lst.setStartAt(startAt);
-        
+
         if(!pr.isSetBuFont()) pr.addNewBuFont().setTypeface("Arial");
-        if(pr.isSetBuNone()) pr.unsetBuNone();        
+        if(pr.isSetBuNone()) pr.unsetBuNone();
         // remove these elements if present as it results in invalid content 
when opening in Excel.
         if(pr.isSetBuBlip()) pr.unsetBuBlip();
-        if(pr.isSetBuChar()) pr.unsetBuChar();        
+        if(pr.isSetBuChar()) pr.unsetBuChar();
     }
-    
+
     /**
      * Set this paragraph as an automatic numbered bullet point
      *
@@ -787,14 +788,14 @@ public class XSSFTextParagraph implement
         CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : 
_p.addNewPPr();
         CTTextAutonumberBullet lst = pr.isSetBuAutoNum() ? pr.getBuAutoNum() : 
pr.addNewBuAutoNum();
         lst.setType(STTextAutonumberScheme.Enum.forInt(scheme.ordinal() + 1));
-        
+
         if(!pr.isSetBuFont()) pr.addNewBuFont().setTypeface("Arial");
         if(pr.isSetBuNone()) pr.unsetBuNone();
         // remove these elements if present as it results in invalid content 
when opening in Excel.
         if(pr.isSetBuBlip()) pr.unsetBuBlip();
         if(pr.isSetBuChar()) pr.unsetBuChar();
     }
-    
+
     /**
      * Returns whether this paragraph has automatic numbered bullets
      */
@@ -811,7 +812,7 @@ public class XSSFTextParagraph implement
         fetchParagraphProperty(fetcher);
         return fetcher.getValue() == null ? false : fetcher.getValue();
     }
-    
+
     /**
      * Returns the starting number if this paragraph has automatic numbered 
bullets, otherwise returns 0
      */
@@ -828,7 +829,7 @@ public class XSSFTextParagraph implement
         fetchParagraphProperty(fetcher);
         return fetcher.getValue() == null ? 0 : fetcher.getValue();
     }
-    
+
     /**
      * Returns the auto number scheme if this paragraph has automatic numbered 
bullets, otherwise returns ListAutoNumber.ARABIC_PLAIN
      */
@@ -843,12 +844,12 @@ public class XSSFTextParagraph implement
             }
         };
         fetchParagraphProperty(fetcher);
-        
+
         // Note: documentation does not define a default, return 
ListAutoNumber.ARABIC_PLAIN (1,2,3...)
         return fetcher.getValue() == null ? ListAutoNumber.ARABIC_PLAIN : 
fetcher.getValue();
-    }    
+    }
+
 
- 
     @SuppressWarnings("rawtypes")
     private boolean fetchParagraphProperty(ParagraphPropertyFetcher visitor){
         boolean ok = false;
@@ -861,7 +862,7 @@ public class XSSFTextParagraph implement
 
         return ok;
     }
-    
+
     @Override
     public String toString(){
         return "[" + getClass() + "]" + getText();

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTextRun.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTextRun.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTextRun.java 
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTextRun.java Sat 
Dec 12 23:15:20 2020
@@ -16,6 +16,10 @@
 ==================================================================== */
 package org.apache.poi.xssf.usermodel;
 
+import java.awt.Color;
+
+import org.apache.poi.ooxml.util.POIXMLUnits;
+import org.apache.poi.util.Units;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor;
 import 
org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties;
@@ -25,8 +29,6 @@ import org.openxmlformats.schemas.drawin
 import org.openxmlformats.schemas.drawingml.x2006.main.STTextStrikeType;
 import org.openxmlformats.schemas.drawingml.x2006.main.STTextUnderlineType;
 
-import java.awt.Color;
-
 /**
  * Represents a run of text within the containing text body. The run element 
is the
  * lowest level text separation mechanism within a text body.
@@ -80,7 +82,7 @@ public class XSSFTextRun {
                 CTSRgbColor clr = fill.getSrgbClr();
                 byte[] rgb = clr.getVal();
                 return new Color(0xFF & rgb[0], 0xFF & rgb[1], 0xFF & rgb[2]);
-            }  
+            }
         }
 
         return new Color(0, 0, 0);
@@ -115,7 +117,7 @@ public class XSSFTextRun {
 
         CTTextCharacterProperties rPr = getRPr();
         if(rPr.isSetSz()){
-            size = rPr.getSz()*0.01;        
+            size = rPr.getSz()*0.01;
         }
 
         return size * scale;
@@ -129,7 +131,7 @@ public class XSSFTextRun {
     public double getCharacterSpacing(){
         CTTextCharacterProperties rPr = getRPr();
         if(rPr.isSetSpc()){
-            return rPr.getSpc()*0.01;
+            return Units.toPoints(POIXMLUnits.parseLength(rPr.xgetSpc()));
         }
         return 0;
     }
@@ -229,7 +231,7 @@ public class XSSFTextRun {
     public boolean isSuperscript() {
         CTTextCharacterProperties rPr = getRPr();
         if(rPr.isSetBaseline()){
-            return rPr.getBaseline() > 0;
+            return POIXMLUnits.parsePercent(rPr.xgetBaseline()) > 0;
         }
         return false;
     }
@@ -273,7 +275,7 @@ public class XSSFTextRun {
     public boolean isSubscript() {
         CTTextCharacterProperties rPr = getRPr();
         if(rPr.isSetBaseline()){
-            return rPr.getBaseline() < 0;
+            return POIXMLUnits.parsePercent(rPr.xgetBaseline()) < 0;
         }
         return false;
     }
@@ -281,7 +283,7 @@ public class XSSFTextRun {
     /**
      * @return whether a run of text will be formatted as a superscript text. 
Default is false.
      */
-    public TextCap getTextCap() {      
+    public TextCap getTextCap() {
         CTTextCharacterProperties rPr = getRPr();
         if(rPr.isSetCap()){
             return TextCap.values()[rPr.getCap().intValue() - 1];

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java 
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java 
Sat Dec 12 23:15:20 2020
@@ -45,7 +45,6 @@ import com.microsoft.schemas.vml.CTShape
 import com.microsoft.schemas.vml.CTShapetype;
 import com.microsoft.schemas.vml.STExt;
 import com.microsoft.schemas.vml.STStrokeJoinStyle;
-import com.microsoft.schemas.vml.STTrueFalse;
 import org.apache.poi.ooxml.POIXMLDocumentPart;
 import org.apache.poi.ooxml.util.DocumentHelper;
 import org.apache.poi.openxml4j.opc.PackagePart;
@@ -55,6 +54,7 @@ import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
+import org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STTrueFalse;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFSingleXmlCell.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFSingleXmlCell.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFSingleXmlCell.java
 (original)
+++ 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFSingleXmlCell.java
 Sat Dec 12 23:15:20 2020
@@ -24,64 +24,63 @@ import org.apache.poi.xssf.usermodel.XSS
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSingleXmlCell;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXmlCellPr;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXmlPr;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.STXmlDataType.Enum;
 
 /**
- * 
+ *
  * This class is a wrapper around the CTSingleXmlCell  (Open Office XML Part 4:
- * chapter 3.5.2.1) 
- * 
+ * chapter 3.5.2.1)
+ *
 
- * 
+ *
  * @author Roberto Manicardi
  *
  */
 public class XSSFSingleXmlCell {
-       
+
        private CTSingleXmlCell singleXmlCell;
        private SingleXmlCells parent;
-       
-       
+
+
        public XSSFSingleXmlCell(CTSingleXmlCell singleXmlCell, SingleXmlCells 
parent){
                this.singleXmlCell = singleXmlCell;
                this.parent = parent;
        }
-       
+
        /**
         * Gets the XSSFCell referenced by the R attribute or creates a new one 
if cell doesn't exists
         * @return the referenced XSSFCell, null if the cell reference is 
invalid
         */
        public XSSFCell getReferencedCell(){
                XSSFCell cell = null;
-               
-               
-               CellReference cellReference =  new 
CellReference(singleXmlCell.getR()); 
-               
+
+
+               CellReference cellReference =  new 
CellReference(singleXmlCell.getR());
+
                XSSFRow row = 
parent.getXSSFSheet().getRow(cellReference.getRow());
                if(row==null){
                        row = 
parent.getXSSFSheet().createRow(cellReference.getRow());
                }
-               
-               cell = row.getCell(cellReference.getCol());  
+
+               cell = row.getCell(cellReference.getCol());
                if(cell==null){
                        cell = row.createCell(cellReference.getCol());
                }
-               
-               
+
+
                return cell;
        }
-       
+
        public String getXpath(){
                CTXmlCellPr xmlCellPr = singleXmlCell.getXmlCellPr();
                CTXmlPr xmlPr = xmlCellPr.getXmlPr();
         return xmlPr.getXpath();
        }
-       
+
        public long getMapId(){
                return singleXmlCell.getXmlCellPr().getXmlPr().getMapId();
        }
 
-       public Enum getXmlDataType() {
+       public String getXmlDataType() {
                CTXmlCellPr xmlCellPr = singleXmlCell.getXmlCellPr();
                CTXmlPr xmlPr = xmlCellPr.getXmlPr();
                return xmlPr.getXmlDataType();

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFXmlColumnPr.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFXmlColumnPr.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFXmlColumnPr.java
 (original)
+++ 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFXmlColumnPr.java
 Sat Dec 12 23:15:20 2020
@@ -21,13 +21,12 @@ import org.apache.poi.util.Internal;
 import org.apache.poi.xssf.usermodel.XSSFTable;
 import org.apache.poi.xssf.usermodel.XSSFTableColumn;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXmlColumnPr;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.STXmlDataType.Enum;
 
 /**
- * 
+ *
  * This class is a wrapper around the CTXmlColumnPr (Open Office XML Part 4:
  * chapter 3.5.1.7)
- * 
+ *
  *
  * @author Roberto Manicardi
  */
@@ -73,7 +72,7 @@ public class XSSFXmlColumnPr {
 
     /**
      * If the XPath is, for example, /Node1/Node2/Node3 and /Node1/Node2 is 
the common XPath for the table, the local XPath is /Node3
-     * 
+     *
      * @return the local XPath
      */
     public String getLocalXPath() {
@@ -87,7 +86,7 @@ public class XSSFXmlColumnPr {
         return localXPath.toString();
     }
 
-    public Enum getXmlDataType() {
+    public String getXmlDataType() {
 
         return ctXmlColumnPr.getXmlDataType();
     }

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java 
(original)
+++ 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java 
Sat Dec 12 23:15:20 2020
@@ -16,6 +16,17 @@
 ==================================================================== */
 package org.apache.poi.xwpf.model;
 
+import com.microsoft.schemas.office.office.CTLock;
+import com.microsoft.schemas.office.office.STConnectType;
+import com.microsoft.schemas.vml.CTFormulas;
+import com.microsoft.schemas.vml.CTGroup;
+import com.microsoft.schemas.vml.CTH;
+import com.microsoft.schemas.vml.CTHandles;
+import com.microsoft.schemas.vml.CTPath;
+import com.microsoft.schemas.vml.CTShape;
+import com.microsoft.schemas.vml.CTShapetype;
+import com.microsoft.schemas.vml.CTTextPath;
+import com.microsoft.schemas.vml.STExt;
 import org.apache.poi.ooxml.POIXMLDocumentPart;
 import org.apache.poi.ooxml.POIXMLDocumentPart.RelationPart;
 import org.apache.poi.xwpf.usermodel.XWPFDocument;
@@ -26,6 +37,7 @@ import org.apache.poi.xwpf.usermodel.XWP
 import org.apache.poi.xwpf.usermodel.XWPFParagraph;
 import org.apache.poi.xwpf.usermodel.XWPFRelation;
 import org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException;
+import org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STTrueFalse;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBody;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtrRef;
@@ -40,19 +52,6 @@ import org.openxmlformats.schemas.wordpr
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum;
 
-import com.microsoft.schemas.office.office.CTLock;
-import com.microsoft.schemas.office.office.STConnectType;
-import com.microsoft.schemas.vml.CTFormulas;
-import com.microsoft.schemas.vml.CTGroup;
-import com.microsoft.schemas.vml.CTH;
-import com.microsoft.schemas.vml.CTHandles;
-import com.microsoft.schemas.vml.CTPath;
-import com.microsoft.schemas.vml.CTShape;
-import com.microsoft.schemas.vml.CTShapetype;
-import com.microsoft.schemas.vml.CTTextPath;
-import com.microsoft.schemas.vml.STExt;
-import com.microsoft.schemas.vml.STTrueFalse;
-
 /**
  * A .docx file can have no headers/footers, the same header/footer
  * on each page, odd/even page footers, and optionally also
@@ -305,7 +304,7 @@ public class XWPFHeaderFooterPolicy {
         ref.setType(type);
         ref.setId(doc.getRelationId(wrapper));
     }
-    
+
     public XWPFHeader getFirstPageHeader() {
         return firstPageHeader;
     }
@@ -361,7 +360,7 @@ public class XWPFHeaderFooterPolicy {
         }
         return defaultHeader;
     }
-    
+
     /**
      * Get this section header for the given type
      *
@@ -392,7 +391,7 @@ public class XWPFHeaderFooterPolicy {
         }
         return defaultFooter;
     }
-    
+
     /**
      * Get this section footer for the given type
      *
@@ -407,7 +406,7 @@ public class XWPFHeaderFooterPolicy {
         }
         return defaultFooter;
     }
-    
+
 
     public void createWatermark(String text) {
         XWPFParagraph[] pars = new XWPFParagraph[1];

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/ParagraphAlignment.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/ParagraphAlignment.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/ParagraphAlignment.java 
(original)
+++ 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/ParagraphAlignment.java 
Sat Dec 12 23:15:20 2020
@@ -20,6 +20,8 @@ package org.apache.poi.xwpf.usermodel;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.STJc;
+
 /**
  * Specifies all types of alignment which are available to be applied to 
objects in a
  * WordprocessingML document
@@ -29,18 +31,21 @@ import java.util.Map;
 public enum ParagraphAlignment {
     //YK: TODO document each alignment option
 
-    LEFT(1),
-    CENTER(2),
-    RIGHT(3),
-    BOTH(4),
-    MEDIUM_KASHIDA(5),
-    DISTRIBUTE(6),
-    NUM_TAB(7),
-    HIGH_KASHIDA(8),
-    LOW_KASHIDA(9),
-    THAI_DISTRIBUTE(10);
+    START(STJc.INT_START), // 1
+    CENTER(STJc.INT_CENTER), // 2
+    END(STJc.INT_END), // 3
+    BOTH(STJc.INT_BOTH), // 4
+    MEDIUM_KASHIDA(STJc.INT_MEDIUM_KASHIDA), // 5
+    DISTRIBUTE(STJc.INT_DISTRIBUTE), // 6
+    NUM_TAB(STJc.INT_NUM_TAB), // 7
+    HIGH_KASHIDA(STJc.INT_HIGH_KASHIDA), // 8
+    LOW_KASHIDA(STJc.INT_LOW_KASHIDA), // 9
+    THAI_DISTRIBUTE(STJc.INT_THAI_DISTRIBUTE), // 10
+    LEFT(STJc.INT_LEFT), // 11
+    RIGHT(STJc.INT_RIGHT) // 12
+    ;
 
-    private static Map<Integer, ParagraphAlignment> imap = new HashMap<>();
+    private static final Map<Integer, ParagraphAlignment> imap = new 
HashMap<>();
 
     static {
         for (ParagraphAlignment p : values()) {

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/TOC.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/TOC.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/TOC.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/TOC.java Sat Dec 12 
23:15:20 2020
@@ -21,6 +21,7 @@ import java.math.BigInteger;
 import org.apache.poi.util.Internal;
 import org.apache.poi.util.LocaleUtil;
 import org.apache.xmlbeans.impl.xb.xmlschema.SpaceAttribute.Space;
+import org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STOnOff1;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDecimalNumber;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
@@ -35,7 +36,6 @@ import org.openxmlformats.schemas.wordpr
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTabs;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STFldCharType;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTabJc;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTabTlc;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTheme;
@@ -61,8 +61,8 @@ public class TOC {
         fonts.setEastAsiaTheme(STTheme.MINOR_H_ANSI);
         fonts.setHAnsiTheme(STTheme.MINOR_H_ANSI);
         fonts.setCstheme(STTheme.MINOR_BIDI);
-        rPr.addNewB().setVal(STOnOff.OFF);
-        rPr.addNewBCs().setVal(STOnOff.OFF);
+        rPr.addNewB().setVal(STOnOff1.OFF);
+        rPr.addNewBCs().setVal(STOnOff1.OFF);
         rPr.addNewColor().setVal("auto");
         rPr.addNewSz().setVal(BigInteger.valueOf(24));
         rPr.addNewSzCs().setVal(BigInteger.valueOf(24));

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDefaultParagraphStyle.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDefaultParagraphStyle.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDefaultParagraphStyle.java
 (original)
+++ 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDefaultParagraphStyle.java
 Sat Dec 12 23:15:20 2020
@@ -17,26 +17,26 @@
 
 package org.apache.poi.xwpf.usermodel;
 
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr;
+import org.apache.poi.ooxml.util.POIXMLUnits;
+import org.apache.poi.util.Units;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPrGeneral;
 
 /**
  * Default Paragraph style, from which other styles will override
  * TODO Share logic with {@link XWPFParagraph} which also uses CTPPr
  */
 public class XWPFDefaultParagraphStyle {
-    private CTPPr ppr;
+    private final CTPPrGeneral ppr;
 
-    public XWPFDefaultParagraphStyle(CTPPr ppr) {
+    public XWPFDefaultParagraphStyle(CTPPrGeneral ppr) {
         this.ppr = ppr;
     }
 
-    protected CTPPr getPPr() {
+    protected CTPPrGeneral getPPr() {
         return ppr;
     }
 
     public int getSpacingAfter() {
-        if (ppr.isSetSpacing())
-            return ppr.getSpacing().getAfter().intValue();
-        return -1;
+        return ppr.isSetSpacing() ? (int) 
Units.toDXA(POIXMLUnits.parseLength(ppr.getSpacing().xgetAfter())) : -1;
     }
 }

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDefaultRunStyle.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDefaultRunStyle.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDefaultRunStyle.java 
(original)
+++ 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDefaultRunStyle.java 
Sat Dec 12 23:15:20 2020
@@ -17,12 +17,14 @@
 
 package org.apache.poi.xwpf.usermodel;
 
-import org.apache.poi.util.Removal;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr;
-
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 
+import org.apache.poi.ooxml.util.POIXMLUnits;
+import org.apache.poi.util.Removal;
+import org.apache.poi.util.Units;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr;
+
 /**
  * Default Character Run style, from which other styles will override
  * TODO Share logic with {@link XWPFRun} which also uses CTRPr
@@ -64,8 +66,8 @@ public class XWPFDefaultRunStyle {
     }
 
     private BigDecimal getFontSizeAsBigDecimal(int scale) {
-        return (rpr != null && rpr.isSetSz()) ?
-                new 
BigDecimal(rpr.getSz().getVal()).divide(BigDecimal.valueOf(2)).setScale(scale, 
RoundingMode.HALF_UP) :
-                null;
+        return (rpr != null && rpr.isSetSz())
+            ? 
BigDecimal.valueOf(Units.toPoints(POIXMLUnits.parseLength(rpr.getSz().xgetVal()))).divide(BigDecimal.valueOf(4),
 scale, RoundingMode.HALF_UP)
+            : null;
     }
 }

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java 
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java 
Sat Dec 12 23:15:20 2020
@@ -64,27 +64,8 @@ import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBody;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTComment;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocument1;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtBlock;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSectPr;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyles;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CommentsDocument;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.DocumentDocument;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.EndnotesDocument;
-import 
org.openxmlformats.schemas.wordprocessingml.x2006.main.FootnotesDocument;
-import 
org.openxmlformats.schemas.wordprocessingml.x2006.main.NumberingDocument;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.StylesDocument;
+import org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STOnOff1;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
 
 /**
  * <p>High(ish) level class for working with .docx files.</p>
@@ -508,7 +489,7 @@ public class XWPFDocument extends POIXML
             CTSectPr ctSectPr = getSection();
             if (!ctSectPr.isSetTitlePg()) {
                 CTOnOff titlePg = ctSectPr.addNewTitlePg();
-                titlePg.setVal(STOnOff.ON);
+                titlePg.setVal(STOnOff1.ON);
             }
             // } else if (type == HeaderFooterType.EVEN) {
             // TODO Add support for Even/Odd headings and footers
@@ -530,7 +511,7 @@ public class XWPFDocument extends POIXML
             CTSectPr ctSectPr = getSection();
             if (!ctSectPr.isSetTitlePg()) {
                 CTOnOff titlePg = ctSectPr.addNewTitlePg();
-                titlePg.setVal(STOnOff.ON);
+                titlePg.setVal(STOnOff1.ON);
             }
             // } else if (type == HeaderFooterType.EVEN) {
             // TODO Add support for Even/Odd headings and footers

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java 
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java 
Sat Dec 12 23:15:20 2020
@@ -23,10 +23,13 @@ import java.util.List;
 import java.util.function.Function;
 
 import org.apache.poi.ooxml.POIXMLDocumentPart;
+import org.apache.poi.ooxml.util.POIXMLUnits;
 import org.apache.poi.util.Internal;
+import org.apache.poi.util.Units;
 import org.apache.poi.wp.usermodel.Paragraph;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
+import org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STOnOff1;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
 
 /**
@@ -429,7 +432,7 @@ public class XWPFParagraph implements IB
      */
     public boolean isKeepNext() {
         if (getCTP() != null && getCTP().getPPr() != null && 
getCTP().getPPr().isSetKeepNext()) {
-            return getCTP().getPPr().getKeepNext().getVal() == STOnOff.ON;
+            return 
POIXMLUnits.parseOnOff(getCTP().getPPr().getKeepNext().xgetVal());
         }
         return false;
     }
@@ -441,7 +444,7 @@ public class XWPFParagraph implements IB
      */
     public void setKeepNext(boolean keepNext) {
         CTOnOff state = CTOnOff.Factory.newInstance();
-        state.setVal(keepNext ? STOnOff.ON : STOnOff.OFF);
+        state.setVal(keepNext ? STOnOff1.ON : STOnOff1.OFF);
         getCTP().getPPr().setKeepNext(state);
     }
 
@@ -874,24 +877,7 @@ public class XWPFParagraph implements IB
         if (ctPageBreak == null) {
             return false;
         }
-        return isTruelike(ctPageBreak.getVal());
-    }
-
-    private static boolean isTruelike(final STOnOff.Enum value) {
-        if (value == null) {
-            return false;
-        }
-        switch (value.intValue()) {
-            case STOnOff.INT_TRUE:
-            case STOnOff.INT_X_1:
-            case STOnOff.INT_ON:
-                return true;
-            /*STOnOff.INT_FALSE:
-            STOnOff.INT_X_0:
-            STOnOff.INT_OFF:*/
-            default:
-                return false;
-        }
+        return POIXMLUnits.parseOnOff(ctPageBreak.xgetVal());
     }
 
     /**
@@ -914,11 +900,7 @@ public class XWPFParagraph implements IB
         CTPPr ppr = getCTPPr();
         CTOnOff ctPageBreak = ppr.isSetPageBreakBefore() ? ppr
                 .getPageBreakBefore() : ppr.addNewPageBreakBefore();
-        if (pageBreak) {
-            ctPageBreak.setVal(STOnOff.TRUE);
-        } else {
-            ctPageBreak.setVal(STOnOff.FALSE);
-        }
+        ctPageBreak.setVal(pageBreak ? STOnOff1.ON : STOnOff1.OFF);
     }
 
     /**
@@ -929,7 +911,7 @@ public class XWPFParagraph implements IB
      */
     public int getSpacingAfter() {
         CTSpacing spacing = getCTSpacing(false);
-        return (spacing != null && spacing.isSetAfter()) ? 
spacing.getAfter().intValue() : -1;
+        return (spacing != null && spacing.isSetAfter()) ? 
(int)Units.toDXA(POIXMLUnits.parseLength(spacing.xgetAfter())) : -1;
     }
 
     /**
@@ -995,7 +977,7 @@ public class XWPFParagraph implements IB
      */
     public int getSpacingBefore() {
         CTSpacing spacing = getCTSpacing(false);
-        return (spacing != null && spacing.isSetBefore()) ? 
spacing.getBefore().intValue() : -1;
+        return (spacing != null && spacing.isSetBefore()) ? 
(int)Units.toDXA(POIXMLUnits.parseLength(spacing.xgetBefore())) : -1;
     }
 
     /**
@@ -1088,12 +1070,11 @@ public class XWPFParagraph implements IB
         CTSpacing spacing = getCTSpacing(false);
         if (spacing == null || !spacing.isSetLine()) {
             return -1;
-        } else if (spacing.getLineRule() == null || spacing.getLineRule() == 
STLineSpacingRule.AUTO) {
-            BigInteger[] val = 
spacing.getLine().divideAndRemainder(BigInteger.valueOf(240L));
-            return val[0].doubleValue() + (val[1].doubleValue() / 240L);
         }
-        BigInteger[] val = 
spacing.getLine().divideAndRemainder(BigInteger.valueOf(20L));
-        return val[0].doubleValue() + (val[1].doubleValue() / 20L);
+
+        double twips = 
Units.toDXA(POIXMLUnits.parseLength(spacing.xgetLine()));
+
+        return twips / ((spacing.getLineRule() == null || 
spacing.getLineRule() == STLineSpacingRule.AUTO) ? 240 : 20);
     }
 
     /**
@@ -1143,8 +1124,9 @@ public class XWPFParagraph implements IB
      */
     public int getIndentationLeft() {
         CTInd indentation = getCTInd(false);
-        return (indentation != null && indentation.isSetLeft()) ? 
indentation.getLeft().intValue()
-                : -1;
+        return (indentation != null && indentation.isSetLeft())
+            ? (int)Units.toDXA(POIXMLUnits.parseLength(indentation.xgetLeft()))
+            : -1;
     }
 
     /**
@@ -1208,8 +1190,9 @@ public class XWPFParagraph implements IB
 
     public int getIndentationRight() {
         CTInd indentation = getCTInd(false);
-        return (indentation != null && indentation.isSetRight()) ? 
indentation.getRight().intValue()
-                : -1;
+        return (indentation != null && indentation.isSetRight())
+            ? 
(int)Units.toDXA(POIXMLUnits.parseLength(indentation.xgetRight()))
+            : -1;
     }
 
     /**
@@ -1272,7 +1255,8 @@ public class XWPFParagraph implements IB
      */
     public int getIndentationHanging() {
         CTInd indentation = getCTInd(false);
-        return (indentation != null && indentation.isSetHanging()) ? 
indentation.getHanging().intValue() : -1;
+        return (indentation != null && indentation.isSetHanging())
+            ? 
(int)Units.toDXA(POIXMLUnits.parseLength(indentation.xgetHanging())) : -1;
     }
 
     /**
@@ -1312,8 +1296,9 @@ public class XWPFParagraph implements IB
      */
     public int getIndentationFirstLine() {
         CTInd indentation = getCTInd(false);
-        return (indentation != null && indentation.isSetFirstLine()) ? 
indentation.getFirstLine().intValue()
-                : -1;
+        return (indentation != null && indentation.isSetFirstLine())
+            ? 
(int)Units.toDXA(POIXMLUnits.parseLength(indentation.xgetFirstLine()))
+            : -1;
     }
 
     /**
@@ -1376,12 +1361,7 @@ public class XWPFParagraph implements IB
      */
     @Override
     public boolean isWordWrapped() {
-        CTOnOff wordWrap = getCTPPr().isSetWordWrap() ? getCTPPr()
-                .getWordWrap() : null;
-        if (wordWrap != null) {
-            return isTruelike(wordWrap.getVal());
-        }
-        return false;
+        return getCTPPr().isSetWordWrap() && 
POIXMLUnits.parseOnOff(getCTPPr().getWordWrap());
     }
 
     /**
@@ -1394,12 +1374,14 @@ public class XWPFParagraph implements IB
      */
     @Override
     public void setWordWrapped(boolean wrap) {
-        CTOnOff wordWrap = getCTPPr().isSetWordWrap() ? getCTPPr()
-                .getWordWrap() : getCTPPr().addNewWordWrap();
+        CTPPr ppr = getCTPPr();
         if (wrap) {
-            wordWrap.setVal(STOnOff.TRUE);
+            CTOnOff wordWrap = ppr.isSetWordWrap() ? ppr.getWordWrap() : 
ppr.addNewWordWrap();
+            wordWrap.setVal(STOnOff1.ON);
         } else {
-            wordWrap.unsetVal();
+            if (ppr.isSetWordWrap()) {
+                ppr.unsetWordWrap();
+            }
         }
     }
 

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRun.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRun.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRun.java 
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRun.java Sat Dec 
12 23:15:20 2020
@@ -32,10 +32,12 @@ import javax.xml.namespace.QName;
 
 import org.apache.poi.ooxml.POIXMLException;
 import org.apache.poi.ooxml.util.DocumentHelper;
+import org.apache.poi.ooxml.util.POIXMLUnits;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.util.HexDump;
 import org.apache.poi.util.Internal;
 import org.apache.poi.util.Removal;
+import org.apache.poi.util.Units;
 import org.apache.poi.wp.usermodel.CharacterRun;
 import org.apache.xmlbeans.SimpleValue;
 import org.apache.xmlbeans.XmlCursor;
@@ -61,6 +63,9 @@ import org.openxmlformats.schemas.drawin
 import org.openxmlformats.schemas.drawingml.x2006.picture.CTPictureNonVisual;
 import 
org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTAnchor;
 import 
org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline;
+import 
org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STHexColorRGB;
+import org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STOnOff1;
+import 
org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STVerticalAlignRun;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
 import org.w3c.dom.NodeList;
 import org.w3c.dom.Text;
@@ -223,15 +228,7 @@ public class XWPFRun implements ISDTCont
      * For isBold, isItalic etc
      */
     private static boolean isCTOnOff(CTOnOff onoff) {
-        if (!onoff.isSetVal()) {
-            return true;
-        }
-        final STOnOff.Enum val = onoff.getVal();
-        return (
-                (STOnOff.TRUE == val) ||
-                        (STOnOff.X_1 == val) ||
-                        (STOnOff.ON == val)
-        );
+        return !onoff.isSetVal() || POIXMLUnits.parseOnOff(onoff);
     }
 
     /**
@@ -297,7 +294,7 @@ public class XWPFRun implements ISDTCont
     public void setBold(boolean value) {
         CTRPr pr = getRunProperties(true);
         CTOnOff bold = pr.isSetB() ? pr.getB() : pr.addNewB();
-        bold.setVal(value ? STOnOff.TRUE : STOnOff.FALSE);
+        bold.setVal(value ? STOnOff1.ON : STOnOff1.OFF);
     }
 
     /**
@@ -408,7 +405,7 @@ public class XWPFRun implements ISDTCont
     public void setItalic(boolean value) {
         CTRPr pr = getRunProperties(true);
         CTOnOff italic = pr.isSetI() ? pr.getI() : pr.addNewI();
-        italic.setVal(value ? STOnOff.TRUE : STOnOff.FALSE);
+        italic.setVal(value ? STOnOff1.ON : STOnOff1.OFF);
     }
 
     /**
@@ -573,7 +570,7 @@ public class XWPFRun implements ISDTCont
     public void setStrikeThrough(boolean value) {
         CTRPr pr = getRunProperties(true);
         CTOnOff strike = pr.isSetStrike() ? pr.getStrike() : pr.addNewStrike();
-        strike.setVal(value ? STOnOff.TRUE : STOnOff.FALSE);
+        strike.setVal(value ? STOnOff1.ON : STOnOff1.OFF);
     }
 
     @Deprecated
@@ -608,7 +605,7 @@ public class XWPFRun implements ISDTCont
     public void setDoubleStrikethrough(boolean value) {
         CTRPr pr = getRunProperties(true);
         CTOnOff dstrike = pr.isSetDstrike() ? pr.getDstrike() : 
pr.addNewDstrike();
-        dstrike.setVal(value ? STOnOff.TRUE : STOnOff.FALSE);
+        dstrike.setVal(value ? STOnOff1.ON : STOnOff1.OFF);
     }
 
     @Override
@@ -621,7 +618,7 @@ public class XWPFRun implements ISDTCont
     public void setSmallCaps(boolean value) {
         CTRPr pr = getRunProperties(true);
         CTOnOff caps = pr.isSetSmallCaps() ? pr.getSmallCaps() : 
pr.addNewSmallCaps();
-        caps.setVal(value ? STOnOff.TRUE : STOnOff.FALSE);
+        caps.setVal(value ? STOnOff1.ON : STOnOff1.OFF);
     }
 
     @Override
@@ -634,7 +631,7 @@ public class XWPFRun implements ISDTCont
     public void setCapitalized(boolean value) {
         CTRPr pr = getRunProperties(true);
         CTOnOff caps = pr.isSetCaps() ? pr.getCaps() : pr.addNewCaps();
-        caps.setVal(value ? STOnOff.TRUE : STOnOff.FALSE);
+        caps.setVal(value ? STOnOff1.ON : STOnOff1.OFF);
     }
 
     @Override
@@ -647,7 +644,7 @@ public class XWPFRun implements ISDTCont
     public void setShadow(boolean value) {
         CTRPr pr = getRunProperties(true);
         CTOnOff shadow = pr.isSetShadow() ? pr.getShadow() : pr.addNewShadow();
-        shadow.setVal(value ? STOnOff.TRUE : STOnOff.FALSE);
+        shadow.setVal(value ? STOnOff1.ON : STOnOff1.OFF);
     }
 
     @Override
@@ -660,7 +657,7 @@ public class XWPFRun implements ISDTCont
     public void setImprinted(boolean value) {
         CTRPr pr = getRunProperties(true);
         CTOnOff imprinted = pr.isSetImprint() ? pr.getImprint() : 
pr.addNewImprint();
-        imprinted.setVal(value ? STOnOff.TRUE : STOnOff.FALSE);
+        imprinted.setVal(value ? STOnOff1.ON : STOnOff1.OFF);
     }
 
     @Override
@@ -673,7 +670,7 @@ public class XWPFRun implements ISDTCont
     public void setEmbossed(boolean value) {
         CTRPr pr = getRunProperties(true);
         CTOnOff emboss = pr.isSetEmboss() ? pr.getEmboss() : pr.addNewEmboss();
-        emboss.setVal(value ? STOnOff.TRUE : STOnOff.FALSE);
+        emboss.setVal(value ? STOnOff1.ON : STOnOff1.OFF);
     }
 
     /**
@@ -704,7 +701,7 @@ public class XWPFRun implements ISDTCont
         if (pr == null || !pr.isSetKern()) {
             return 0;
         }
-        return pr.getKern().getVal().intValue();
+        return (int)POIXMLUnits.parseLength(pr.getKern().xgetVal());
     }
 
     @Override
@@ -735,7 +732,7 @@ public class XWPFRun implements ISDTCont
         if (pr == null || !pr.isSetSpacing()) {
             return 0;
         }
-        return pr.getSpacing().getVal().intValue();
+        return 
(int)Units.toDXA(POIXMLUnits.parseLength(pr.getSpacing().xgetVal()));
     }
 
     @Override
@@ -878,9 +875,9 @@ public class XWPFRun implements ISDTCont
 
     private BigDecimal getFontSizeAsBigDecimal(int scale) {
         CTRPr pr = getRunProperties(false);
-        return (pr != null && pr.isSetSz()) ?
-                new 
BigDecimal(pr.getSz().getVal()).divide(BigDecimal.valueOf(2)).setScale(scale, 
RoundingMode.HALF_UP) :
-                null;
+        return (pr != null && pr.isSetSz())
+            ? 
BigDecimal.valueOf(Units.toPoints(POIXMLUnits.parseLength(pr.getSz().xgetVal()))).divide(BigDecimal.valueOf(4),
 scale, RoundingMode.HALF_UP)
+            : null;
     }
 
     /**
@@ -936,7 +933,7 @@ public class XWPFRun implements ISDTCont
      */
     public int getTextPosition() {
         CTRPr pr = getRunProperties(false);
-        return (pr != null && pr.isSetPosition()) ? 
pr.getPosition().getVal().intValue()
+        return (pr != null && pr.isSetPosition()) ? 
(int)(Units.toPoints(POIXMLUnits.parseLength(pr.getPosition().xgetVal())) / 2.)
                 : -1;
     }
 
@@ -1385,11 +1382,7 @@ public class XWPFRun implements ISDTCont
             if (ctfldChar.getFldCharType() == STFldCharType.BEGIN) {
                 if (ctfldChar.getFfData() != null) {
                     for (CTFFCheckBox checkBox : 
ctfldChar.getFfData().getCheckBoxList()) {
-                        if (checkBox.getDefault() != null && 
checkBox.getDefault().getVal() == STOnOff.X_1) {
-                            text.append("|X|");
-                        } else {
-                            text.append("|_|");
-                        }
+                        text.append((checkBox.getDefault() != null && 
POIXMLUnits.parseOnOff(checkBox.getDefault().xgetVal())) ? "|X|" : "|_|");
                     }
                 }
             }
@@ -1455,13 +1448,14 @@ public class XWPFRun implements ISDTCont
      * @since 4.0.0
      */
     public int getTextScale() {
-        CTRPr pr = getRunProperties(true);
-        CTTextScale scale = pr.isSetW() ? pr.getW() : pr.addNewW();
-        int value = scale.getVal();
-        if (value == 0) {
-            value = 100; // 100% scaling, that is, no change. See 17.3.2.43 w 
(Expanded/Compressed Text)
+        CTRPr pr = getRunProperties(false);
+        if (pr == null || !pr.isSetW()) {
+            return 100;
         }
-        return value;
+
+        int value = POIXMLUnits.parsePercent(pr.getW().xgetVal());
+        // 100% scaling, that is, no change. See 17.3.2.43 w 
(Expanded/Compressed Text)
+        return value == 0 ? 100 : value / 1000;
     }
 
     /**
@@ -1522,7 +1516,7 @@ public class XWPFRun implements ISDTCont
     public void setVanish(boolean value) {
         CTRPr pr = getRunProperties(true);
         CTOnOff vanish = pr.isSetVanish() ? pr.getVanish() : pr.addNewVanish();
-        vanish.setVal(value ? STOnOff.TRUE : STOnOff.FALSE);
+        vanish.setVal(value ? STOnOff1.ON : STOnOff1.OFF);
     }
 
     /**

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java?rev=1884368&r1=1884367&r2=1884368&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java 
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java 
Sat Dec 12 23:15:20 2020
@@ -29,19 +29,20 @@ import javax.xml.namespace.QName;
 
 import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.ooxml.POIXMLDocumentPart;
+import org.apache.poi.ooxml.util.POIXMLUnits;
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.apache.poi.poifs.crypt.CryptoFunctions;
 import org.apache.poi.poifs.crypt.HashAlgorithm;
 import org.apache.xmlbeans.XmlOptions;
+import org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STAlgClass;
+import org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STAlgType;
+import org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STCryptProv;
+import org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STOnOff1;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocProtect;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSettings;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTZoom;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STAlgClass;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STAlgType;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STCryptProv;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STOnOff;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.SettingsDocument;
 
 public class XWPFSettings extends POIXMLDocumentPart {
@@ -54,7 +55,7 @@ public class XWPFSettings extends POIXML
     public XWPFSettings(PackagePart part) throws IOException {
         super(part);
     }
-    
+
     public XWPFSettings() {
         super();
         ctSettings = CTSettings.Factory.newInstance();
@@ -86,12 +87,8 @@ public class XWPFSettings extends POIXML
             zoom = ctSettings.getZoom();
         }
 
-        
-        BigInteger percent = zoom.getPercent();
-        if(percent == null) {
-            return 100;
-        }
-        return percent.longValue();
+
+        return (zoom.getPercent() == null) ? 100 : 
POIXMLUnits.parsePercent(zoom.xgetPercent()) / 1000;
     }
 
     /**
@@ -111,7 +108,7 @@ public class XWPFSettings extends POIXML
         CTZoom zoom = ctSettings.getZoom();
         zoom.setPercent(BigInteger.valueOf(zoomPercent));
     }
-       
+
        /**
      * Verifies the documentProtection tag inside settings.xml file <br>
      * if the protection is enforced (w:enforcement="1") <br>
@@ -127,12 +124,8 @@ public class XWPFSettings extends POIXML
      */
        public boolean isEnforcedWith() {
         CTDocProtect ctDocProtect = ctSettings.getDocumentProtection();
+        return ctDocProtect != null && 
POIXMLUnits.parseOnOff(ctDocProtect.xgetEnforcement());
 
-        if (ctDocProtect == null) {
-            return false;
-        }
-
-        return ctDocProtect.getEnforcement().equals(STOnOff.X_1);
     }
 
     /**
@@ -151,12 +144,8 @@ public class XWPFSettings extends POIXML
      */
     public boolean isEnforcedWith(STDocProtect.Enum editValue) {
         CTDocProtect ctDocProtect = ctSettings.getDocumentProtection();
+        return ctDocProtect != null && 
POIXMLUnits.parseOnOff(ctDocProtect.xgetEnforcement()) && 
ctDocProtect.getEdit().equals(editValue);
 
-        if (ctDocProtect == null) {
-            return false;
-        }
-
-        return ctDocProtect.getEnforcement().equals(STOnOff.X_1) && 
ctDocProtect.getEdit().equals(editValue);
     }
 
     /**
@@ -173,7 +162,7 @@ public class XWPFSettings extends POIXML
      * </pre>
      */
     public void 
setEnforcementEditValue(org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect.Enum
 editValue) {
-        safeGetDocumentProtection().setEnforcement(STOnOff.X_1);
+        safeGetDocumentProtection().setEnforcement(STOnOff1.ON);
         safeGetDocumentProtection().setEdit(editValue);
     }
 
@@ -196,7 +185,7 @@ public class XWPFSettings extends POIXML
      */
     public void 
setEnforcementEditValue(org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect.Enum
 editValue,
                                         String password, HashAlgorithm 
hashAlgo) {
-        safeGetDocumentProtection().setEnforcement(STOnOff.X_1);
+        safeGetDocumentProtection().setEnforcement(STOnOff1.ON);
         safeGetDocumentProtection().setEdit(editValue);
 
         if (password == null) {
@@ -233,7 +222,7 @@ public class XWPFSettings extends POIXML
             if (hashAlgo == null) {
                 hashAlgo = HashAlgorithm.sha1;
             }
-            
+
             switch (hashAlgo) {
                 case md2:
                     providerType = STCryptProv.RSA_FULL;
@@ -295,7 +284,7 @@ public class XWPFSettings extends POIXML
     /**
      * Validates the existing password
      *
-     * @param password
+     * @param password the password
      * @return true, only if password was set and equals, false otherwise
      */
     public boolean validateProtectionPassword(String password) {
@@ -348,7 +337,7 @@ public class XWPFSettings extends POIXML
      * it sets the value of enforcement to "0" (w:enforcement="0") <br>
      */
     public void removeEnforcement() {
-        safeGetDocumentProtection().setEnforcement(STOnOff.X_0);
+        safeGetDocumentProtection().setEnforcement(STOnOff1.OFF);
     }
 
     /**
@@ -365,12 +354,12 @@ public class XWPFSettings extends POIXML
      */
     public void setUpdateFields() {
         CTOnOff onOff = CTOnOff.Factory.newInstance();
-        onOff.setVal(STOnOff.TRUE);
+        onOff.setVal(STOnOff1.ON);
         ctSettings.setUpdateFields(onOff);
     }
 
     boolean isUpdateFields() {
-        return ctSettings.isSetUpdateFields() && 
ctSettings.getUpdateFields().getVal() == STOnOff.TRUE;
+        return ctSettings.isSetUpdateFields() && 
POIXMLUnits.parseOnOff(ctSettings.getUpdateFields().xgetVal());
     }
 
     /**
@@ -443,12 +432,12 @@ public class XWPFSettings extends POIXML
     /**
      * Turn separate even-and-odd headings on or off
      *
-     * @param enable <code>true</code> to turn on separate even and odd 
headings, 
+     * @param enable <code>true</code> to turn on separate even and odd 
headings,
      * <code>false</code> to turn off even and odd headings.
      */
     public void setEvenAndOddHeadings(boolean enable) {
         CTOnOff onOff = CTOnOff.Factory.newInstance();
-        onOff.setVal(enable ? STOnOff.TRUE : STOnOff.FALSE);
+        onOff.setVal(enable ? STOnOff1.ON : STOnOff1.OFF);
         ctSettings.setEvenAndOddHeaders(onOff);
     }
 
@@ -464,12 +453,12 @@ public class XWPFSettings extends POIXML
     /**
      * Turn mirrored margins on or off
      *
-     * @param enable <code>true</code> to turn on mirrored margins, 
+     * @param enable <code>true</code> to turn on mirrored margins,
      * <code>false</code> to turn off mirrored marginss.
      */
     public void setMirrorMargins(boolean enable) {
         CTOnOff onOff = CTOnOff.Factory.newInstance();
-        onOff.setVal(enable ? STOnOff.TRUE : STOnOff.FALSE);
+        onOff.setVal(enable ? STOnOff1.ON : STOnOff1.OFF);
         ctSettings.setMirrorMargins(onOff);
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to