poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1691843 [14/30] - in /poi/branches/common_sl: ./ .settings/ legal/ osgi/ osgi/src/ src/examples/src/org/apache/poi/hpsf/examples/ src/examples/src/org/apache/poi/hssf/usermodel/examples/ src/examples/src/org/apache/poi/ss/examples/ src/exa...
Date Sun, 19 Jul 2015 19:00:38 GMT
Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFontFormatting.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFontFormatting.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFontFormatting.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFontFormatting.java Sun Jul 19 19:00:32 2015
@@ -80,7 +80,6 @@ public class XSSFFontFormatting implemen
         return (short)idx;
     }
 
-
     /**
      * @param color font color index
      */
@@ -91,16 +90,28 @@ public class XSSFFontFormatting implemen
         }
     }
 
-    /**
-     *
-     * @return xssf color wrapper or null if color info is missing
-     */
-    public XSSFColor getXSSFColor(){
+    public XSSFColor getFontColor() {
         if(_font.sizeOfColorArray() == 0) return null;
 
         return new XSSFColor(_font.getColorArray(0));
     }
 
+    public void setFontColor(Color color) {
+        XSSFColor xcolor = XSSFColor.toXSSFColor(color);
+        if (xcolor == null) {
+            _font.getColorList().clear();
+        } else {
+            _font.setColorArray(0, xcolor.getCTColor());
+        }
+    }
+
+    /**
+     * @deprecated use {@link #getFontColor()}
+     */
+    public XSSFColor getXSSFColor(){
+        return getFontColor();
+    }
+
     /**
      * gets the height of the font in 1/20th point units
      *

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPatternFormatting.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPatternFormatting.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPatternFormatting.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPatternFormatting.java Sun Jul 19 19:00:32 2015
@@ -18,6 +18,7 @@
  */
 package org.apache.poi.xssf.usermodel;
 
+import org.apache.poi.ss.usermodel.Color;
 import org.apache.poi.ss.usermodel.PatternFormatting;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFill;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPatternFill;
@@ -34,37 +35,69 @@ public class XSSFPatternFormatting imple
         _fill = fill;
     }
 
-    public short getFillBackgroundColor(){
-        if(!_fill.isSetPatternFill()) return 0;
-
-        return (short)_fill.getPatternFill().getBgColor().getIndexed();
+    public XSSFColor getFillBackgroundColorColor() {
+        if(!_fill.isSetPatternFill()) return null;
+        return new XSSFColor(_fill.getPatternFill().getBgColor());
     }
-
-    public short getFillForegroundColor(){
+    public XSSFColor getFillForegroundColorColor() {
         if(!_fill.isSetPatternFill() || ! _fill.getPatternFill().isSetFgColor())
-            return 0;
-
-        return (short)_fill.getPatternFill().getFgColor().getIndexed();
+            return null;
+        return new XSSFColor(_fill.getPatternFill().getFgColor());
     }
 
-    public short getFillPattern(){
+    public short getFillPattern() {
         if(!_fill.isSetPatternFill() || !_fill.getPatternFill().isSetPatternType()) return NO_FILL;
 
         return (short)(_fill.getPatternFill().getPatternType().intValue() - 1);
      }
 
-    public void setFillBackgroundColor(short bg){
-        CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill();
+    public short getFillBackgroundColor() {
+        XSSFColor color = getFillBackgroundColorColor();
+        if (color == null) return 0;
+        return color.getIndexed();
+    }
+    public short getFillForegroundColor() {
+        XSSFColor color = getFillForegroundColorColor();
+        if (color == null) return 0;
+        return color.getIndexed();
+    }
+
+    public void setFillBackgroundColor(Color bg) {
+        XSSFColor xcolor = XSSFColor.toXSSFColor(bg);
+        if (xcolor == null) setFillBackgroundColor((CTColor)null);
+        else setFillBackgroundColor(xcolor.getCTColor());
+    }
+    public void setFillBackgroundColor(short bg) {
         CTColor bgColor = CTColor.Factory.newInstance();
         bgColor.setIndexed(bg);
-        ptrn.setBgColor(bgColor);
+        setFillBackgroundColor(bgColor);
     }
-
-    public void setFillForegroundColor(short fg){
+    private void setFillBackgroundColor(CTColor color) {
         CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill();
+        if (color == null) {
+            ptrn.unsetBgColor();
+        } else {
+            ptrn.setBgColor(color);
+        }
+    }
+    
+    public void setFillForegroundColor(Color fg) {
+        XSSFColor xcolor = XSSFColor.toXSSFColor(fg);
+        if (xcolor == null) setFillForegroundColor((CTColor)null);
+        else setFillForegroundColor(xcolor.getCTColor());
+    }
+    public void setFillForegroundColor(short fg) {
         CTColor fgColor = CTColor.Factory.newInstance();
         fgColor.setIndexed(fg);
-        ptrn.setFgColor(fgColor);
+        setFillForegroundColor(fgColor);
+    }
+    private void setFillForegroundColor(CTColor color) {
+        CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill();
+        if (color == null) {
+            ptrn.unsetFgColor();
+        } else {
+            ptrn.setFgColor(color);
+        }
     }
 
     public void setFillPattern(short fp){

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPrintSetup.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPrintSetup.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPrintSetup.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPrintSetup.java Sun Jul 19 19:00:32 2015
@@ -120,6 +120,8 @@ public class XSSFPrintSetup implements P
     public void setLeftToRight(boolean ltor) {
         if (ltor)
             setPageOrder(PageOrder.OVER_THEN_DOWN);
+        else 
+            setPageOrder(PageOrder.DOWN_THEN_OVER);
     }
 
     /**
@@ -130,6 +132,8 @@ public class XSSFPrintSetup implements P
     public void setLandscape(boolean ls) {
         if (ls)
             setOrientation(PrintOrientation.LANDSCAPE);
+        else 
+            setOrientation(PrintOrientation.PORTRAIT);
     }
 
     /**

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java Sun Jul 19 19:00:32 2015
@@ -281,7 +281,7 @@ public final class XSSFRelation extends
         "application/vnd.ms-office.vbaProject",
         "http://schemas.microsoft.com/office/2006/relationships/vbaProject",
         "/xl/vbaProject.bin",
-        null
+        XSSFVBAPart.class
     );
 
     public static final XSSFRelation ACTIVEX_CONTROLS = new XSSFRelation(

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Sun Jul 19 19:00:32 2015
@@ -25,11 +25,13 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.SortedMap;
 import java.util.TreeMap;
 
 import javax.xml.namespace.QName;
@@ -131,7 +133,7 @@ public class XSSFSheet extends POIXMLDoc
     protected CTSheet sheet;
     protected CTWorksheet worksheet;
 
-    private TreeMap<Integer, XSSFRow> _rows;
+    private SortedMap<Integer, XSSFRow> _rows;
     private List<XSSFHyperlink> hyperlinks;
     private ColumnHelper columnHelper;
     private CommentsTable sheetComments;
@@ -140,7 +142,7 @@ public class XSSFSheet extends POIXMLDoc
      * Master shared formula is the first formula in a group of shared formulas is saved in the f element.
      */
     private Map<Integer, CTCellFormula> sharedFormulas;
-    private TreeMap<String,XSSFTable> tables;
+    private SortedMap<String,XSSFTable> tables;
     private List<CellRangeAddress> arrayFormulas;
     private XSSFDataValidationHelper dataValidationHelper;
 
@@ -600,6 +602,15 @@ public class XSSFSheet extends POIXMLDoc
         CTRow ctRow;
         XSSFRow prev = _rows.get(rownum);
         if(prev != null){
+            // the Cells in an existing row are invalidated on-purpose, in order to clean up correctly, we
+            // need to call the remove, so things like ArrayFormulas and CalculationChain updates are done 
+            // correctly. 
+            // We remove the cell this way as the internal cell-list is changed by the remove call and 
+            // thus would cause ConcurrentModificationException otherwise
+            while(prev.getFirstCellNum() != -1) {
+                prev.removeCell(prev.getCell(prev.getFirstCellNum()));
+            }
+            
             ctRow = prev.getCTRow();
             ctRow.set(CTRow.Factory.newInstance());
         } else {
@@ -1071,6 +1082,10 @@ public class XSSFSheet extends POIXMLDoc
     }
 
     /**
+     * Returns the merged region at the specified index. If you want multiple
+     * regions, it is faster to call {@link #getMergedRegions()} than to call
+     * this each time.
+     *
      * @return the merged region at the specified index
      * @throws IllegalStateException if this worksheet does not contain merged regions
      */
@@ -1085,6 +1100,27 @@ public class XSSFSheet extends POIXMLDoc
     }
 
     /**
+     * Returns the list of merged regions. If you want multiple regions, this is
+     * faster than calling {@link #getMergedRegion(int)} each time.
+     *
+     * @return the list of merged regions
+     * @throws IllegalStateException if this worksheet does not contain merged regions
+     */
+    @SuppressWarnings("deprecation")
+    @Override
+    public List<CellRangeAddress> getMergedRegions() {
+        CTMergeCells ctMergeCells = worksheet.getMergeCells();
+        if(ctMergeCells == null) throw new IllegalStateException("This worksheet does not contain merged regions");
+
+        List<CellRangeAddress> addresses = new ArrayList<CellRangeAddress>();
+        for(CTMergeCell ctMergeCell : ctMergeCells.getMergeCellArray()) {
+            String ref = ctMergeCell.getRef();
+            addresses.add(CellRangeAddress.valueOf(ref));
+        }
+        return addresses;
+    }
+
+    /**
      * Returns the number of merged regions defined in this worksheet
      *
      * @return number of merged regions in this worksheet
@@ -2555,38 +2591,90 @@ public class XSSFSheet extends POIXMLDoc
      */
     @Override
     @SuppressWarnings("deprecation") //YK: getXYZArray() array accessors are deprecated in xmlbeans with JDK 1.5 support
-    public void shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight) {
-        // first remove all rows which will be overwritten
+    public void shiftRows(int startRow, int endRow, final int n, boolean copyRowHeight, boolean resetOriginalRowHeight) {
+    	XSSFVMLDrawing vml = getVMLDrawing(false);
+
+    	// first remove all rows which will be overwritten
         for (Iterator<Row> it = rowIterator() ; it.hasNext() ; ) {
             XSSFRow row = (XSSFRow)it.next();
             int rownum = row.getRowNum();
 
             // check if we should remove this row as it will be overwritten by the data later
-            if (removeRow(startRow, endRow, n, rownum)) {
+            if (shouldRemoveRow(startRow, endRow, n, rownum)) {
                 // remove row from worksheet.getSheetData row array
                 int idx = _rows.headMap(row.getRowNum()).size();
                 worksheet.getSheetData().removeRow(idx);
+
                 // remove row from _rows
                 it.remove();
+
+                // also remove any comments associated with this row
+                if(sheetComments != null){
+                    CTCommentList lst = sheetComments.getCTComments().getCommentList();
+                    for (CTComment comment : lst.getCommentArray()) {
+                    	String strRef = comment.getRef();
+                    	CellReference ref = new CellReference(strRef);
+
+                    	// is this comment part of the current row?
+                    	if(ref.getRow() == rownum) {
+                            sheetComments.removeComment(strRef);
+                            vml.removeCommentShape(ref.getRow(), ref.getCol());
+                    	}
+                    }
+                }
             }
         }
 
         // then do the actual moving and also adjust comments/rowHeight
+        // we need to sort it in a way so the shifting does not mess up the structures, 
+        // i.e. when shifting down, start from down and go up, when shifting up, vice-versa
+        SortedMap<XSSFComment, Integer> commentsToShift = new TreeMap<XSSFComment, Integer>(new Comparator<XSSFComment>() {
+			public int compare(XSSFComment o1, XSSFComment o2) {
+				int row1 = o1.getRow();
+				int row2 = o2.getRow();
+				
+				if(row1 == row2) {
+					// ordering is not important when row is equal, but don't return zero to still 
+					// get multiple comments per row into the map
+					return o1.hashCode() - o2.hashCode();
+				}
+
+				// when shifting down, sort higher row-values first
+				if(n > 0) {
+					return row1 < row2 ? 1 : -1;
+				} else {
+					// sort lower-row values first when shifting up
+					return row1 > row2 ? 1 : -1;
+				}
+			}
+		});
+
+        
         for (Iterator<Row> it = rowIterator() ; it.hasNext() ; ) {
             XSSFRow row = (XSSFRow)it.next();
             int rownum = row.getRowNum();
 
             if(sheetComments != null){
-                //TODO shift Note's anchor in the associated /xl/drawing/vmlDrawings#.vml
-                CTCommentList lst = sheetComments.getCTComments().getCommentList();
-                for (CTComment comment : lst.getCommentArray()) {
-                    String oldRef = comment.getRef();
-                    CellReference ref = new CellReference(oldRef);
-                    if(ref.getRow() == rownum){
-                        ref = new CellReference(rownum + n, ref.getCol());
-                        comment.setRef(ref.formatAsString());
-                        sheetComments.referenceUpdated(oldRef, comment);
-                    }
+            	// calculate the new rownum
+            	int newrownum = shiftedRowNum(startRow, endRow, n, rownum);
+            	
+            	// is there a change necessary for the current row?
+            	if(newrownum != rownum) {
+                    CTCommentList lst = sheetComments.getCTComments().getCommentList();
+                    for (CTComment comment : lst.getCommentArray()) {
+                    	String oldRef = comment.getRef();
+                    	CellReference ref = new CellReference(oldRef);
+                    	
+                    	// is this comment part of the current row?
+                    	if(ref.getRow() == rownum) {
+                        	XSSFComment xssfComment = new XSSFComment(sheetComments, comment,
+                                    vml == null ? null : vml.findCommentShape(rownum, ref.getCol()));
+                        	
+                        	// we should not perform the shifting right here as we would then find
+                        	// already shifted comments and would shift them again...
+                        	commentsToShift.put(xssfComment, newrownum);
+                        }
+                	}
                 }
             }
 
@@ -2598,6 +2686,14 @@ public class XSSFSheet extends POIXMLDoc
 
             row.shift(n);
         }
+        
+        // adjust all the affected comment-structures now
+        // the Map is sorted and thus provides them in the order that we need here, 
+        // i.e. from down to up if shifting down, vice-versa otherwise
+        for(Map.Entry<XSSFComment, Integer> entry : commentsToShift.entrySet()) {
+        	entry.getKey().setRow(entry.getValue());
+        }
+        
         XSSFRowShifter rowShifter = new XSSFRowShifter(this);
 
         int sheetIndex = getWorkbook().getSheetIndex(this);
@@ -2611,13 +2707,40 @@ public class XSSFSheet extends POIXMLDoc
         rowShifter.updateConditionalFormatting(shifter);
 
         //rebuild the _rows map
-        TreeMap<Integer, XSSFRow> map = new TreeMap<Integer, XSSFRow>();
+        SortedMap<Integer, XSSFRow> map = new TreeMap<Integer, XSSFRow>();
         for(XSSFRow r : _rows.values()) {
             map.put(r.getRowNum(), r);
         }
         _rows = map;
     }
 
+    private int shiftedRowNum(int startRow, int endRow, int n, int rownum) {
+		// no change if before any affected row
+    	if(rownum < startRow && (n > 0 || (startRow - rownum) > n)) {
+			return rownum;
+		}
+		
+    	// no change if after any affected row
+    	if(rownum > endRow && (n < 0 || (rownum - endRow) > n)) {
+    		return rownum;
+    	}
+    	
+    	// row before and things are moved up
+    	if(rownum < startRow) {
+    		// row is moved down by the shifting
+    		return rownum + (endRow - startRow);
+    	}
+    	
+    	// row is after and things are moved down
+    	if(rownum > endRow) {
+    		// row is moved up by the shifting
+    		return rownum - (endRow - startRow);
+    	}
+    	
+    	// row is part of the shifted block
+		return rownum + n;
+	}
+
     /**
      * Location of the top left visible cell Location of the top left visible cell in the bottom right
      * pane (when in Left-to-Right mode).
@@ -2873,7 +2996,7 @@ public class XSSFSheet extends POIXMLDoc
         return sheetPr.isSetPageSetUpPr() ? sheetPr.getPageSetUpPr() : sheetPr.addNewPageSetUpPr();
     }
 
-    private boolean removeRow(int startRow, int endRow, int n, int rownum) {
+    private boolean shouldRemoveRow(int startRow, int endRow, int n, int rownum) {
         // is this row in the target-window where the moved rows will land?
         if (rownum >= (startRow + n) && rownum <= (endRow + n)) {
             // only remove it if the current row is not part of the data that is copied

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheetConditionalFormatting.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheetConditionalFormatting.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheetConditionalFormatting.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheetConditionalFormatting.java Sun Jul 19 19:00:32 2015
@@ -27,6 +27,7 @@ import org.apache.poi.ss.SpreadsheetVers
 import org.apache.poi.ss.usermodel.ComparisonOperator;
 import org.apache.poi.ss.usermodel.ConditionalFormatting;
 import org.apache.poi.ss.usermodel.ConditionalFormattingRule;
+import org.apache.poi.ss.usermodel.IconMultiStateFormatting.IconSet;
 import org.apache.poi.ss.usermodel.SheetConditionalFormatting;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCfRule;
@@ -36,9 +37,12 @@ import org.openxmlformats.schemas.spread
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.STConditionalFormattingOperator;
 
 /**
- * @author Yegor Kozlov
+ * XSSF Conditional Formattings
  */
 public class XSSFSheetConditionalFormatting implements SheetConditionalFormatting {
+    /** Office 2010 Conditional Formatting extensions namespace */
+    protected static final String CF_EXT_2009_NS_X14 = "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main";
+
     private final XSSFSheet _sheet;
 
     /* package */ XSSFSheetConditionalFormatting(XSSFSheet sheet) {
@@ -115,6 +119,27 @@ public class XSSFSheetConditionalFormatt
         return rule;
     }
 
+    /**
+     * A factory method allowing the creation of conditional formatting
+     *  rules using an Icon Set / Multi-State formatting.
+     * The thresholds for it will be created, but will be empty
+     *  and require configuring with 
+     *  {@link XSSFConditionalFormattingRule#getMultiStateFormatting()}
+     *  then
+     *  {@link XSSFIconMultiStateFormatting#getThresholds()}
+     */
+    public XSSFConditionalFormattingRule createConditionalFormattingRule(IconSet iconSet) {
+        XSSFConditionalFormattingRule rule = new XSSFConditionalFormattingRule(_sheet);
+        
+        // Have it setup, with suitable defaults
+        rule.createMultiStateFormatting(iconSet);
+        
+        // All done!
+        return rule;
+    }
+
+    // TODO Support types beyond CELL_VALUE_IS and FORMULA and ICONs
+    
     @SuppressWarnings("deprecation")
     public int addConditionalFormatting(CellRangeAddress[] regions, ConditionalFormattingRule[] cfRules) {
         if (regions == null) {

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTextParagraph.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTextParagraph.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTextParagraph.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFTextParagraph.java Sun Jul 19 19:00:32 2015
@@ -709,13 +709,19 @@ public class XSSFTextParagraph implement
     public boolean isBullet() {
         ParagraphPropertyFetcher<Boolean> fetcher = new ParagraphPropertyFetcher<Boolean>(getLevel()){
             public boolean fetch(CTTextParagraphProperties props){
-                if(props.isSetBuNone()) {
+                if (props.isSetBuNone()) {
                     setValue(false);
                     return true;
                 }
-                if(props.isSetBuFont() || props.isSetBuChar() || props.isSetBuAutoNum()){
-                    setValue(true);
-                    return true;
+                if (props.isSetBuFont()) {
+                    if (props.isSetBuChar() || props.isSetBuAutoNum()) {
+                        setValue(true);
+                        return true;
+                    } else {
+                        // Excel treats text with buFont but no char/autonum
+                        //  as not bulleted
+                        // Possibly the font is just used if bullets turned on again?
+                    }
                 }
                 return false;
             }

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java Sun Jul 19 19:00:32 2015
@@ -68,6 +68,7 @@ public final class XSSFVMLDrawing extend
     private static final QName QNAME_SHAPE_LAYOUT = new QName("urn:schemas-microsoft-com:office:office", "shapelayout");
     private static final QName QNAME_SHAPE_TYPE = new QName("urn:schemas-microsoft-com:vml", "shapetype");
     private static final QName QNAME_SHAPE = new QName("urn:schemas-microsoft-com:vml", "shape");
+    private static final String COMMENT_SHAPE_TYPE_ID = "_x0000_t202"; // this ID value seems to have significance to Excel >= 2010; see https://issues.apache.org/bugzilla/show_bug.cgi?id=55409
 
     /**
      * regexp to parse shape ids, in VML they have weird form of id="_x0000_s1026"
@@ -190,7 +191,7 @@ public final class XSSFVMLDrawing extend
         _qnames.add(QNAME_SHAPE_LAYOUT);
 
         CTShapetype shapetype = CTShapetype.Factory.newInstance();
-        _shapeTypeId = "_xssf_cell_comment";
+        _shapeTypeId = COMMENT_SHAPE_TYPE_ID;
         shapetype.setId(_shapeTypeId);
         shapetype.setCoordsize("21600,21600");
         shapetype.setSpt(202);

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java Sun Jul 19 19:00:32 2015
@@ -215,7 +215,15 @@ public class XSSFWorkbook extends POIXML
      * Create a new SpreadsheetML workbook.
      */
     public XSSFWorkbook() {
-        super(newPackage());
+        this(XSSFWorkbookType.XLSX);
+    }
+
+    /**
+     * Create a new SpreadsheetML workbook.
+     * @param workbookType The type of workbook to make (.xlsx or .xlsm).
+     */
+    public XSSFWorkbook(XSSFWorkbookType workbookType) {
+        super(newPackage(workbookType));
         onWorkbookCreate();
     }
 
@@ -429,7 +437,7 @@ public class XSSFWorkbook extends POIXML
     /**
      * Create a new SpreadsheetML package and setup the default minimal content
      */
-    protected static OPCPackage newPackage() {
+    protected static OPCPackage newPackage(XSSFWorkbookType workbookType) {
         try {
             OPCPackage pkg = OPCPackage.create(new ByteArrayOutputStream());
             // Main part
@@ -437,7 +445,7 @@ public class XSSFWorkbook extends POIXML
             // Create main part relationship
             pkg.addRelationship(corePartName, TargetMode.INTERNAL, PackageRelationshipTypes.CORE_DOCUMENT);
             // Create main document part
-            pkg.createPart(corePartName, XSSFRelation.WORKBOOK.getContentType());
+            pkg.createPart(corePartName, workbookType.getContentType());
 
             pkg.getPackageProperties().setCreatorProperty(DOCUMENT_CREATOR);
 
@@ -576,13 +584,17 @@ public class XSSFWorkbook extends POIXML
             // copy drawing contents
             clonedDg.getCTDrawing().set(dg.getCTDrawing());
 
+            clonedDg = clonedSheet.createDrawingPatriarch();
+            
             // Clone drawing relations
             List<POIXMLDocumentPart> srcRels = srcSheet.createDrawingPatriarch().getRelations();
             for (POIXMLDocumentPart rel : srcRels) {
                 PackageRelationship relation = rel.getPackageRelationship();
-                clonedSheet
-                        .createDrawingPatriarch()
-                        .getPackagePart()
+
+                clonedDg.addRelation(relation.getId(), rel);
+                
+                clonedDg
+						.getPackagePart()
                         .addRelationship(relation.getTargetURI(), relation.getTargetMode(),
                                 relation.getRelationshipType(), relation.getId());
             }
@@ -751,8 +763,26 @@ public class XSSFWorkbook extends POIXML
         CTSheet sheet = addSheet(sheetname);
 
         int sheetNumber = 1;
-        for(XSSFSheet sh : sheets) {
-            sheetNumber = (int)Math.max(sh.sheet.getSheetId() + 1, sheetNumber);
+        outerloop:
+        while(true) {
+            for(XSSFSheet sh : sheets) {
+                sheetNumber = (int)Math.max(sh.sheet.getSheetId() + 1, sheetNumber);
+            }
+            
+            // Bug 57165: We also need to check that the resulting file name is not already taken
+            // this can happen when moving/cloning sheets
+            String sheetName = XSSFRelation.WORKSHEET.getFileName(sheetNumber);
+            for(POIXMLDocumentPart relation : getRelations()) {
+                if(relation.getPackagePart() != null && 
+                        sheetName.equals(relation.getPackagePart().getPartName().getName())) {
+                    // name is taken => try next one
+                    sheetNumber++;
+                    continue outerloop;
+                }
+            }
+
+            // no duplicate found => use this one
+            break;
         }
 
         XSSFSheet wrapper = (XSSFSheet)createRelationship(XSSFRelation.WORKSHEET, XSSFFactory.getInstance(), sheetNumber);
@@ -821,6 +851,15 @@ public class XSSFWorkbook extends POIXML
      */
     @Override
     public XSSFCellStyle getCellStyleAt(short idx) {
+        return getCellStyleAt(idx&0xffff);
+    }
+    /**
+     * Get the cell style object at the given index
+     *
+     * @param idx  index within the set of styles
+     * @return XSSFCellStyle object at the index
+     */
+    public XSSFCellStyle getCellStyleAt(int idx) {
         return stylesSource.getStyleAt(idx);
     }
 
@@ -1518,16 +1557,6 @@ public class XSSFWorkbook extends POIXML
     }
     
     /**
-     * Closes the underlying {@link OPCPackage} from which
-     *  the Workbook was read, if any. Has no effect on newly 
-     *  created Workbooks.
-     */
-    @Override
-    public void close() throws IOException {
-        super.close();
-    }
-
-    /**
      * Returns SharedStringsTable - tha cache of string for this workbook
      *
      * @return the shared string table
@@ -2023,4 +2052,67 @@ public class XSSFWorkbook extends POIXML
     protected void setPivotTables(List<XSSFPivotTable> pivotTables) {
         this.pivotTables = pivotTables;
     }
+
+    public XSSFWorkbookType getWorkbookType() {
+        return isMacroEnabled() ? XSSFWorkbookType.XLSM : XSSFWorkbookType.XLSX;
+    }
+
+    /**
+     * Sets whether the workbook will be an .xlsx or .xlsm (macro-enabled) file.
+     */
+    public void setWorkbookType(XSSFWorkbookType type) {
+        try {
+            getPackagePart().setContentType(type.getContentType());
+        } catch (InvalidFormatException e) {
+            throw new POIXMLException(e);
+        }
+    }
+
+    /**
+     * Adds a vbaProject.bin file to the workbook.  This will change the workbook
+     * type if necessary.
+     *
+     * @throws IOException
+     */
+    public void setVBAProject(InputStream vbaProjectStream) throws IOException {
+        if (!isMacroEnabled()) {
+            setWorkbookType(XSSFWorkbookType.XLSM);
+        }
+
+        PackagePartName ppName;
+        try {
+            ppName = PackagingURIHelper.createPartName(XSSFRelation.VBA_MACROS.getDefaultFileName());
+        } catch (InvalidFormatException e) {
+            throw new POIXMLException(e);
+        }
+        OPCPackage opc = getPackage();
+        OutputStream outputStream;
+        if (!opc.containPart(ppName)) {
+            POIXMLDocumentPart relationship = createRelationship(XSSFRelation.VBA_MACROS, XSSFFactory.getInstance());
+            outputStream = relationship.getPackagePart().getOutputStream();
+        } else {
+            PackagePart part = opc.getPart(ppName);
+            outputStream = part.getOutputStream();
+        }
+        try {
+            IOUtils.copy(vbaProjectStream, outputStream);
+        } finally {
+            IOUtils.closeQuietly(outputStream);
+        }
+    }
+
+    /**
+     * Adds a vbaProject.bin file taken from another, given workbook to this one.
+     * @throws IOException
+     * @throws InvalidFormatException
+     */
+    public void setVBAProject(XSSFWorkbook macroWorkbook) throws IOException, InvalidFormatException {
+        if (!macroWorkbook.isMacroEnabled()) {
+            return;
+        }
+        InputStream vbaProjectStream = XSSFRelation.VBA_MACROS.getContents(macroWorkbook.getCorePart());
+        if (vbaProjectStream != null) {
+            setVBAProject(vbaProjectStream);
+        }
+    }
 }

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFFormulaUtils.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFFormulaUtils.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFFormulaUtils.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xssf/usermodel/helpers/XSSFFormulaUtils.java Sun Jul 19 19:00:32 2015
@@ -24,6 +24,7 @@ import org.apache.poi.ss.formula.Formula
 import org.apache.poi.ss.formula.FormulaType;
 import org.apache.poi.ss.formula.ptg.Ptg;
 import org.apache.poi.ss.formula.ptg.Pxg;
+import org.apache.poi.ss.formula.ptg.Pxg3D;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
@@ -125,9 +126,17 @@ public final class XSSFFormulaUtils {
         if (ptg instanceof Pxg) {
             Pxg pxg = (Pxg)ptg;
             if (pxg.getExternalWorkbookNumber() < 1) {
-                if (pxg.getSheetName().equals(oldName)) {
+                if (pxg.getSheetName() != null &&
+                        pxg.getSheetName().equals(oldName)) {
                     pxg.setSheetName(newName);
                 }
+                if (pxg instanceof Pxg3D) {
+                    Pxg3D pxg3D = (Pxg3D)pxg;
+                    if (pxg3D.getLastSheetName() != null &&
+                            pxg3D.getLastSheetName().equals(oldName)) {
+                        pxg3D.setLastSheetName(newName);
+                    }
+                }
             }
         }
     }

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/extractor/XWPFWordExtractor.java Sun Jul 19 19:00:32 2015
@@ -46,46 +46,47 @@ import org.openxmlformats.schemas.wordpr
  * Helper class to extract text from an OOXML Word file
  */
 public class XWPFWordExtractor extends POIXMLTextExtractor {
-   public static final XWPFRelation[] SUPPORTED_TYPES = new XWPFRelation[] {
-      XWPFRelation.DOCUMENT, XWPFRelation.TEMPLATE,
-      XWPFRelation.MACRO_DOCUMENT, 
-      XWPFRelation.MACRO_TEMPLATE_DOCUMENT
-   };
-   
-	private XWPFDocument document;
-	private boolean fetchHyperlinks = false;
-	
-	public XWPFWordExtractor(OPCPackage container) throws XmlException, OpenXML4JException, IOException {
-		this(new XWPFDocument(container));
-	}
-	public XWPFWordExtractor(XWPFDocument document) {
-		super(document);
-		this.document = document;
-	}
-
-	/**
-	 * Should we also fetch the hyperlinks, when fetching 
-	 *  the text content? Default is to only output the
-	 *  hyperlink label, and not the contents
-	 */
-	public void setFetchHyperlinks(boolean fetch) {
-		fetchHyperlinks = fetch;
-	}
-	
-	public static void main(String[] args) throws Exception {
-		if(args.length < 1) {
-			System.err.println("Use:");
-			System.err.println("  XWPFWordExtractor <filename.docx>");
-			System.exit(1);
-		}
-		POIXMLTextExtractor extractor = 
-			new XWPFWordExtractor(POIXMLDocument.openPackage(
-					args[0]
-			));
-		System.out.println(extractor.getText());
-		extractor.close();
-	}
-	
+    public static final XWPFRelation[] SUPPORTED_TYPES = new XWPFRelation[]{
+            XWPFRelation.DOCUMENT, XWPFRelation.TEMPLATE,
+            XWPFRelation.MACRO_DOCUMENT,
+            XWPFRelation.MACRO_TEMPLATE_DOCUMENT
+    };
+
+    private XWPFDocument document;
+    private boolean fetchHyperlinks = false;
+
+    public XWPFWordExtractor(OPCPackage container) throws XmlException, OpenXML4JException, IOException {
+        this(new XWPFDocument(container));
+    }
+
+    public XWPFWordExtractor(XWPFDocument document) {
+        super(document);
+        this.document = document;
+    }
+
+    public static void main(String[] args) throws Exception {
+        if (args.length < 1) {
+            System.err.println("Use:");
+            System.err.println("  XWPFWordExtractor <filename.docx>");
+            System.exit(1);
+        }
+        POIXMLTextExtractor extractor =
+                new XWPFWordExtractor(POIXMLDocument.openPackage(
+                        args[0]
+                ));
+        System.out.println(extractor.getText());
+        extractor.close();
+    }
+
+    /**
+     * Should we also fetch the hyperlinks, when fetching
+     * the text content? Default is to only output the
+     * hyperlink label, and not the contents
+     */
+    public void setFetchHyperlinks(boolean fetch) {
+        fetchHyperlinks = fetch;
+    }
+
     public String getText() {
         StringBuffer text = new StringBuffer();
         XWPFHeaderFooterPolicy hfPolicy = document.getHeaderFooterPolicy();
@@ -94,9 +95,9 @@ public class XWPFWordExtractor extends P
         extractHeaders(text, hfPolicy);
 
         // Process all body elements
-        for (IBodyElement e : document.getBodyElements()){
-        	appendBodyElementText(text, e);
-        	text.append('\n');
+        for (IBodyElement e : document.getBodyElements()) {
+            appendBodyElementText(text, e);
+            text.append('\n');
         }
 
         // Finish up with all the footers
@@ -105,108 +106,108 @@ public class XWPFWordExtractor extends P
         return text.toString();
     }
 
-   public void appendBodyElementText(StringBuffer text, IBodyElement e){
-      if (e instanceof XWPFParagraph){
-          appendParagraphText(text, (XWPFParagraph)e);
-      } else if (e instanceof XWPFTable){
-          appendTableText(text, (XWPFTable)e);
-      } else if (e instanceof XWPFSDT){
-          text.append(((XWPFSDT)e).getContent().getText());
-      }
-   }
-   
-   public void appendParagraphText(StringBuffer text, XWPFParagraph paragraph){
-      try {
-          CTSectPr ctSectPr = null;
-          if (paragraph.getCTP().getPPr()!=null) {
-              ctSectPr = paragraph.getCTP().getPPr().getSectPr();
-          }
-
-          XWPFHeaderFooterPolicy headerFooterPolicy = null;
-
-          if (ctSectPr!=null) {
-              headerFooterPolicy = new XWPFHeaderFooterPolicy(document, ctSectPr);
-              extractHeaders(text, headerFooterPolicy);
-          }
-
-
-          for(IRunElement run : paragraph.getRuns()) {
-              text.append(run.toString());
-              if(run instanceof XWPFHyperlinkRun && fetchHyperlinks) {
-                  XWPFHyperlink link = ((XWPFHyperlinkRun)run).getHyperlink(document);
-                  if(link != null)
-                      text.append(" <" + link.getURL() + ">");
-              }
-          }
-
-          // Add comments
-          XWPFCommentsDecorator decorator = new XWPFCommentsDecorator(paragraph, null);
-          String commentText = decorator.getCommentText();
-          if (commentText.length() > 0){
-              text.append(commentText).append('\n');
-          }
-
-          // Do endnotes and footnotes
-          String footnameText = paragraph.getFootnoteText();
-          if(footnameText != null && footnameText.length() > 0) {
-              text.append(footnameText + '\n');
-          }
-
-          if (ctSectPr!=null) {
-              extractFooters(text, headerFooterPolicy);
-          }
-      } catch (IOException e) {
-          throw new POIXMLException(e);
-      } catch (XmlException e) {
-          throw new POIXMLException(e);
-      }
-     
-   }
-
-   private void appendTableText(StringBuffer text, XWPFTable table) {
-      //this works recursively to pull embedded tables from tables
-      for (XWPFTableRow row : table.getRows()) {
-          List<ICell> cells = row.getTableICells();
-          for (int i = 0; i < cells.size(); i++) {
-              ICell cell = cells.get(i);
-              if (cell instanceof XWPFTableCell) {
-                  text.append(((XWPFTableCell)cell).getTextRecursively());
-              } else if (cell instanceof XWPFSDTCell) {
-                  text.append(((XWPFSDTCell)cell).getContent().getText());
-              }
-              if (i < cells.size()-1) {
-                  text.append("\t");
-              }
-          }
-          text.append('\n');
-      }
-   }
-   
-	private void extractFooters(StringBuffer text, XWPFHeaderFooterPolicy hfPolicy) {
-		if (hfPolicy == null) return;
-		
-		if(hfPolicy.getFirstPageFooter() != null) {
-			text.append( hfPolicy.getFirstPageFooter().getText() );
-		}
-		if(hfPolicy.getEvenPageFooter() != null) {
-			text.append( hfPolicy.getEvenPageFooter().getText() );
-		}
-		if(hfPolicy.getDefaultFooter() != null) {
-			text.append( hfPolicy.getDefaultFooter().getText() );
-		}
-	}
-
-	private void extractHeaders(StringBuffer text, XWPFHeaderFooterPolicy hfPolicy) {
-		if (hfPolicy == null) return;
-		
-		if(hfPolicy.getFirstPageHeader() != null) {
-			text.append( hfPolicy.getFirstPageHeader().getText() );
-		}
-		if(hfPolicy.getEvenPageHeader() != null) {
-			text.append( hfPolicy.getEvenPageHeader().getText() );
-		}
-		if(hfPolicy.getDefaultHeader() != null) {
-			text.append( hfPolicy.getDefaultHeader().getText() );
-		}
-	}
+    public void appendBodyElementText(StringBuffer text, IBodyElement e) {
+        if (e instanceof XWPFParagraph) {
+            appendParagraphText(text, (XWPFParagraph) e);
+        } else if (e instanceof XWPFTable) {
+            appendTableText(text, (XWPFTable) e);
+        } else if (e instanceof XWPFSDT) {
+            text.append(((XWPFSDT) e).getContent().getText());
+        }
+    }
+
+    public void appendParagraphText(StringBuffer text, XWPFParagraph paragraph) {
+        try {
+            CTSectPr ctSectPr = null;
+            if (paragraph.getCTP().getPPr() != null) {
+                ctSectPr = paragraph.getCTP().getPPr().getSectPr();
+            }
+
+            XWPFHeaderFooterPolicy headerFooterPolicy = null;
+
+            if (ctSectPr != null) {
+                headerFooterPolicy = new XWPFHeaderFooterPolicy(document, ctSectPr);
+                extractHeaders(text, headerFooterPolicy);
+            }
+
+
+            for (IRunElement run : paragraph.getRuns()) {
+                text.append(run.toString());
+                if (run instanceof XWPFHyperlinkRun && fetchHyperlinks) {
+                    XWPFHyperlink link = ((XWPFHyperlinkRun) run).getHyperlink(document);
+                    if (link != null)
+                        text.append(" <" + link.getURL() + ">");
+                }
+            }
+
+            // Add comments
+            XWPFCommentsDecorator decorator = new XWPFCommentsDecorator(paragraph, null);
+            String commentText = decorator.getCommentText();
+            if (commentText.length() > 0) {
+                text.append(commentText).append('\n');
+            }
+
+            // Do endnotes and footnotes
+            String footnameText = paragraph.getFootnoteText();
+            if (footnameText != null && footnameText.length() > 0) {
+                text.append(footnameText + '\n');
+            }
+
+            if (ctSectPr != null) {
+                extractFooters(text, headerFooterPolicy);
+            }
+        } catch (IOException e) {
+            throw new POIXMLException(e);
+        } catch (XmlException e) {
+            throw new POIXMLException(e);
+        }
+
+    }
+
+    private void appendTableText(StringBuffer text, XWPFTable table) {
+        //this works recursively to pull embedded tables from tables
+        for (XWPFTableRow row : table.getRows()) {
+            List<ICell> cells = row.getTableICells();
+            for (int i = 0; i < cells.size(); i++) {
+                ICell cell = cells.get(i);
+                if (cell instanceof XWPFTableCell) {
+                    text.append(((XWPFTableCell) cell).getTextRecursively());
+                } else if (cell instanceof XWPFSDTCell) {
+                    text.append(((XWPFSDTCell) cell).getContent().getText());
+                }
+                if (i < cells.size() - 1) {
+                    text.append("\t");
+                }
+            }
+            text.append('\n');
+        }
+    }
+
+    private void extractFooters(StringBuffer text, XWPFHeaderFooterPolicy hfPolicy) {
+        if (hfPolicy == null) return;
+
+        if (hfPolicy.getFirstPageFooter() != null) {
+            text.append(hfPolicy.getFirstPageFooter().getText());
+        }
+        if (hfPolicy.getEvenPageFooter() != null) {
+            text.append(hfPolicy.getEvenPageFooter().getText());
+        }
+        if (hfPolicy.getDefaultFooter() != null) {
+            text.append(hfPolicy.getDefaultFooter().getText());
+        }
+    }
+
+    private void extractHeaders(StringBuffer text, XWPFHeaderFooterPolicy hfPolicy) {
+        if (hfPolicy == null) return;
+
+        if (hfPolicy.getFirstPageHeader() != null) {
+            text.append(hfPolicy.getFirstPageHeader().getText());
+        }
+        if (hfPolicy.getEvenPageHeader() != null) {
+            text.append(hfPolicy.getEvenPageHeader().getText());
+        }
+        if (hfPolicy.getDefaultHeader() != null) {
+            text.append(hfPolicy.getDefaultHeader().getText());
+        }
+    }
 }

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XMLParagraph.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XMLParagraph.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XMLParagraph.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XMLParagraph.java Sun Jul 19 19:00:32 2015
@@ -22,16 +22,15 @@ import org.openxmlformats.schemas.wordpr
  * Base class for XWPF paragraphs
  *
  * @author Yury Batrakov (batrakov at gmail.com)
- * 
  */
 public class XMLParagraph {
-	protected CTP paragraph;
-	
-	public XMLParagraph(CTP paragraph) {
-		this.paragraph = paragraph;
-	}
+    protected CTP paragraph;
 
-	public CTP getCTP() {
-		return paragraph;
-	}
+    public XMLParagraph(CTP paragraph) {
+        this.paragraph = paragraph;
+    }
+
+    public CTP getCTP() {
+        return paragraph;
+    }
 }
\ No newline at end of file

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFCommentsDecorator.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFCommentsDecorator.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFCommentsDecorator.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFCommentsDecorator.java Sun Jul 19 19:00:32 2015
@@ -21,38 +21,36 @@ import org.apache.poi.xwpf.usermodel.XWP
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTMarkupRange;
 
 /**
- * Decorator class for XWPFParagraph allowing to add comments 
+ * Decorator class for XWPFParagraph allowing to add comments
  * found in paragraph to its text
  *
  * @author Yury Batrakov (batrakov at gmail.com)
- * 
  */
 public class XWPFCommentsDecorator extends XWPFParagraphDecorator {
-	private StringBuffer commentText;
-	
-	public XWPFCommentsDecorator(XWPFParagraphDecorator nextDecorator) {
-		this(nextDecorator.paragraph, nextDecorator);
-	}
-
-	@SuppressWarnings("deprecation")
-	public XWPFCommentsDecorator(XWPFParagraph paragraph, XWPFParagraphDecorator nextDecorator) {
-		super(paragraph, nextDecorator);
-
-		XWPFComment comment;
-		commentText = new StringBuffer();
-
-		for(CTMarkupRange anchor : paragraph.getCTP().getCommentRangeStartArray())
-		{
-			if((comment = paragraph.getDocument().getCommentByID(anchor.getId().toString())) != null)
-				commentText.append("\tComment by " + comment.getAuthor()+": "+comment.getText());
-		}
-	}
-
-	public String getCommentText() {
-	   return commentText.toString();
-	}
-	
-	public String getText() {
-		return super.getText() + commentText;
-	}
+    private StringBuffer commentText;
+
+    public XWPFCommentsDecorator(XWPFParagraphDecorator nextDecorator) {
+        this(nextDecorator.paragraph, nextDecorator);
+    }
+
+    @SuppressWarnings("deprecation")
+    public XWPFCommentsDecorator(XWPFParagraph paragraph, XWPFParagraphDecorator nextDecorator) {
+        super(paragraph, nextDecorator);
+
+        XWPFComment comment;
+        commentText = new StringBuffer();
+
+        for (CTMarkupRange anchor : paragraph.getCTP().getCommentRangeStartArray()) {
+            if ((comment = paragraph.getDocument().getCommentByID(anchor.getId().toString())) != null)
+                commentText.append("\tComment by " + comment.getAuthor() + ": " + comment.getText());
+        }
+    }
+
+    public String getCommentText() {
+        return commentText.toString();
+    }
+
+    public String getText() {
+        return super.getText() + commentText;
+    }
 }

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java Sun Jul 19 19:00:32 2015
@@ -45,7 +45,6 @@ import org.openxmlformats.schemas.wordpr
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.HdrDocument;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STHdrFtr.Enum;
-
 import schemasMicrosoftComOfficeOffice.CTLock;
 import schemasMicrosoftComOfficeOffice.STConnectType;
 import schemasMicrosoftComVml.CTFormulas;
@@ -61,10 +60,10 @@ import schemasMicrosoftComVml.STTrueFals
 
 /**
  * A .docx file can have no headers/footers, the same header/footer
- *  on each page, odd/even page footers, and optionally also 
- *  a different header/footer on the first page.
+ * on each page, odd/even page footers, and optionally also
+ * a different header/footer on the first page.
  * This class handles sorting out what there is, and giving you
- *  the right headers and footers for the document.
+ * the right headers and footers for the document.
  */
 public class XWPFHeaderFooterPolicy {
     public static final Enum DEFAULT = STHdrFtr.DEFAULT;
@@ -84,8 +83,8 @@ public class XWPFHeaderFooterPolicy {
 
     /**
      * Figures out the policy for the given document,
-     *  and creates any header and footer objects
-     *  as required.
+     * and creates any header and footer objects
+     * as required.
      */
     public XWPFHeaderFooterPolicy(XWPFDocument doc) throws IOException, XmlException {
         this(doc, doc.getDocument().getBody().getSectPr());
@@ -93,8 +92,8 @@ public class XWPFHeaderFooterPolicy {
 
     /**
      * Figures out the policy for the given document,
-     *  and creates any header and footer objects
-     *  as required.
+     * and creates any header and footer objects
+     * as required.
      */
     public XWPFHeaderFooterPolicy(XWPFDocument doc, CTSectPr sectPr) throws IOException, XmlException {
         // Grab what headers and footers have been defined
@@ -102,7 +101,7 @@ public class XWPFHeaderFooterPolicy {
         //  doesn't seem that .docx properly supports that
         //  feature of the file format yet
         this.doc = doc;
-        for(int i=0; i<sectPr.sizeOfHeaderReferenceArray(); i++) {
+        for (int i = 0; i < sectPr.sizeOfHeaderReferenceArray(); i++) {
             // Get the header
             CTHdrFtrRef ref = sectPr.getHeaderReferenceArray(i);
             POIXMLDocumentPart relatedPart = doc.getRelationById(ref.getId());
@@ -114,13 +113,12 @@ public class XWPFHeaderFooterPolicy {
             Enum type = ref.getType();
             assignHeader(hdr, type);
         }
-        for(int i=0; i<sectPr.sizeOfFooterReferenceArray(); i++) {
+        for (int i = 0; i < sectPr.sizeOfFooterReferenceArray(); i++) {
             // Get the footer
             CTHdrFtrRef ref = sectPr.getFooterReferenceArray(i);
             POIXMLDocumentPart relatedPart = doc.getRelationById(ref.getId());
             XWPFFooter ftr = null;
-            if (relatedPart != null && relatedPart instanceof XWPFFooter)
-            {
+            if (relatedPart != null && relatedPart instanceof XWPFFooter) {
                 ftr = (XWPFFooter) relatedPart;
             }
             // Assign it
@@ -130,9 +128,9 @@ public class XWPFHeaderFooterPolicy {
     }
 
     private void assignFooter(XWPFFooter ftr, Enum type) {
-        if(type == STHdrFtr.FIRST) {
+        if (type == STHdrFtr.FIRST) {
             firstPageFooter = ftr;
-        } else if(type == STHdrFtr.EVEN) {
+        } else if (type == STHdrFtr.EVEN) {
             evenPageFooter = ftr;
         } else {
             defaultFooter = ftr;
@@ -140,9 +138,9 @@ public class XWPFHeaderFooterPolicy {
     }
 
     private void assignHeader(XWPFHeader hdr, Enum type) {
-        if(type == STHdrFtr.FIRST) {
+        if (type == STHdrFtr.FIRST) {
             firstPageHeader = hdr;
-        } else if(type == STHdrFtr.EVEN) {
+        } else if (type == STHdrFtr.EVEN) {
             evenPageHeader = hdr;
         } else {
             defaultHeader = hdr;
@@ -159,15 +157,15 @@ public class XWPFHeaderFooterPolicy {
 
     /**
      * Creates a new header of the specified type, to which the
-     *  supplied (and previously unattached!) paragraphs are
-     *  added to.
+     * supplied (and previously unattached!) paragraphs are
+     * added to.
      */
     public XWPFHeader createHeader(Enum type, XWPFParagraph[] pars) throws IOException {
         XWPFRelation relation = XWPFRelation.HEADER;
         String pStyle = "Header";
         int i = getRelationIndex(relation);
         HdrDocument hdrDoc = HdrDocument.Factory.newInstance();
-        XWPFHeader wrapper = (XWPFHeader)doc.createRelationship(relation, XWPFFactory.getInstance(), i);
+        XWPFHeader wrapper = (XWPFHeader) doc.createRelationship(relation, XWPFFactory.getInstance(), i);
 
         CTHdrFtr hdr = buildHdr(type, pStyle, wrapper, pars);
         wrapper.setHeaderFooter(hdr);
@@ -193,15 +191,15 @@ public class XWPFHeaderFooterPolicy {
 
     /**
      * Creates a new footer of the specified type, to which the
-     *  supplied (and previously unattached!) paragraphs are
-     *  added to.
+     * supplied (and previously unattached!) paragraphs are
+     * added to.
      */
     public XWPFFooter createFooter(Enum type, XWPFParagraph[] pars) throws IOException {
         XWPFRelation relation = XWPFRelation.FOOTER;
         String pStyle = "Footer";
         int i = getRelationIndex(relation);
         FtrDocument ftrDoc = FtrDocument.Factory.newInstance();
-        XWPFFooter wrapper = (XWPFFooter)doc.createRelationship(relation, XWPFFactory.getInstance(), i);
+        XWPFFooter wrapper = (XWPFFooter) doc.createRelationship(relation, XWPFFactory.getInstance(), i);
 
         CTHdrFtr ftr = buildFtr(type, pStyle, wrapper, pars);
         wrapper.setHeaderFooter(ftr);
@@ -220,10 +218,10 @@ public class XWPFHeaderFooterPolicy {
     private int getRelationIndex(XWPFRelation relation) {
         List<POIXMLDocumentPart> relations = doc.getRelations();
         int i = 1;
-        for (Iterator<POIXMLDocumentPart> it = relations.iterator(); it.hasNext() ; ) {
+        for (Iterator<POIXMLDocumentPart> it = relations.iterator(); it.hasNext(); ) {
             POIXMLDocumentPart item = it.next();
             if (item.getPackageRelationship().getRelationshipType().equals(relation.getRelation())) {
-                i++;	
+                i++;
             }
         }
         return i;
@@ -231,14 +229,14 @@ public class XWPFHeaderFooterPolicy {
 
     private CTHdrFtr buildFtr(Enum type, String pStyle, XWPFHeaderFooter wrapper, XWPFParagraph[] pars) {
         //CTHdrFtr ftr = buildHdrFtr(pStyle, pars);				// MB 24 May 2010
-        CTHdrFtr ftr = buildHdrFtr(pStyle, pars, wrapper);		// MB 24 May 2010
+        CTHdrFtr ftr = buildHdrFtr(pStyle, pars, wrapper);        // MB 24 May 2010
         setFooterReference(type, wrapper);
         return ftr;
     }
 
     private CTHdrFtr buildHdr(Enum type, String pStyle, XWPFHeaderFooter wrapper, XWPFParagraph[] pars) {
         //CTHdrFtr hdr = buildHdrFtr(pStyle, pars);				// MB 24 May 2010
-        CTHdrFtr hdr = buildHdrFtr(pStyle, pars, wrapper);		// MB 24 May 2010
+        CTHdrFtr hdr = buildHdrFtr(pStyle, pars, wrapper);        // MB 24 May 2010
         setHeaderReference(type, wrapper);
         return hdr;
     }
@@ -246,13 +244,12 @@ public class XWPFHeaderFooterPolicy {
     private CTHdrFtr buildHdrFtr(String pStyle, XWPFParagraph[] paragraphs) {
         CTHdrFtr ftr = CTHdrFtr.Factory.newInstance();
         if (paragraphs != null) {
-            for (int i = 0 ; i < paragraphs.length ; i++) {
+            for (int i = 0; i < paragraphs.length; i++) {
                 CTP p = ftr.addNewP();
                 //ftr.setPArray(0, paragraphs[i].getCTP());		// MB 23 May 2010
-                ftr.setPArray(i, paragraphs[i].getCTP());   	// MB 23 May 2010
+                ftr.setPArray(i, paragraphs[i].getCTP());    // MB 23 May 2010
             }
-        }
-        else {
+        } else {
             CTP p = ftr.addNewP();
             byte[] rsidr = doc.getDocument().getBody().getPArray(0).getRsidR();
             byte[] rsidrdefault = doc.getDocument().getBody().getPArray(0).getRsidRDefault();
@@ -270,21 +267,20 @@ public class XWPFHeaderFooterPolicy {
      * and createFooter(int, XWPFParagraph[]) methods or the getXXXXXHeader/Footer methods where
      * headers or footers had been added to a document since it had been created/opened, returned
      * an object that contained no XWPFParagraph objects even if the header/footer itself did contain
-     * text. The reason was that this line of code; CTHdrFtr ftr = CTHdrFtr.Factory.newInstance(); 
+     * text. The reason was that this line of code; CTHdrFtr ftr = CTHdrFtr.Factory.newInstance();
      * created a brand new instance of the CTHDRFtr class which was then populated with data when
      * it should have recovered the CTHdrFtr object encapsulated within the XWPFHeaderFooter object
-     * that had previoulsy been instantiated in the createHeader(int, XWPFParagraph[]) or 
+     * that had previoulsy been instantiated in the createHeader(int, XWPFParagraph[]) or
      * createFooter(int, XWPFParagraph[]) methods.
      */
     private CTHdrFtr buildHdrFtr(String pStyle, XWPFParagraph[] paragraphs, XWPFHeaderFooter wrapper) {
         CTHdrFtr ftr = wrapper._getHdrFtr();
         if (paragraphs != null) {
-            for (int i = 0 ; i < paragraphs.length ; i++) {
+            for (int i = 0; i < paragraphs.length; i++) {
                 CTP p = ftr.addNewP();
                 ftr.setPArray(i, paragraphs[i].getCTP());
             }
-        }
-        else {
+        } else {
             CTP p = ftr.addNewP();
             byte[] rsidr = doc.getDocument().getBody().getPArray(0).getRsidR();
             byte[] rsidrdefault = doc.getDocument().getBody().getPArray(0).getRsidRDefault();
@@ -330,60 +326,70 @@ public class XWPFHeaderFooterPolicy {
     public XWPFHeader getFirstPageHeader() {
         return firstPageHeader;
     }
+
     public XWPFFooter getFirstPageFooter() {
         return firstPageFooter;
     }
+
     /**
      * Returns the odd page header. This is
-     *  also the same as the default one...
+     * also the same as the default one...
      */
     public XWPFHeader getOddPageHeader() {
         return defaultHeader;
     }
+
     /**
      * Returns the odd page footer. This is
-     *  also the same as the default one...
+     * also the same as the default one...
      */
     public XWPFFooter getOddPageFooter() {
         return defaultFooter;
     }
+
     public XWPFHeader getEvenPageHeader() {
         return evenPageHeader;
     }
+
     public XWPFFooter getEvenPageFooter() {
         return evenPageFooter;
     }
+
     public XWPFHeader getDefaultHeader() {
         return defaultHeader;
     }
+
     public XWPFFooter getDefaultFooter() {
         return defaultFooter;
     }
 
     /**
      * Get the header that applies to the given
-     *  (1 based) page.
+     * (1 based) page.
+     *
      * @param pageNumber The one based page number
      */
     public XWPFHeader getHeader(int pageNumber) {
-        if(pageNumber == 1 && firstPageHeader != null) {
+        if (pageNumber == 1 && firstPageHeader != null) {
             return firstPageHeader;
         }
-        if(pageNumber % 2 == 0 && evenPageHeader != null) {
+        if (pageNumber % 2 == 0 && evenPageHeader != null) {
             return evenPageHeader;
         }
         return defaultHeader;
     }
+
     /**
      * Get the footer that applies to the given
-     *  (1 based) page.
+     * (1 based) page.
+     *
      * @param pageNumber The one based page number
      */
     public XWPFFooter getFooter(int pageNumber) {
-        if(pageNumber == 1 && firstPageFooter != null) {
+        if (pageNumber == 1 && firstPageFooter != null) {
             return firstPageFooter;
         }
-        if(pageNumber % 2 == 0 && evenPageFooter != null) {
+        if (pageNumber % 2 == 0 && evenPageFooter != null) {
             return evenPageFooter;
         }
         return defaultFooter;
@@ -459,7 +465,7 @@ public class XWPFHeaderFooterPolicy {
         lock.setExt(STExt.EDIT);
         CTShape shape = group.addNewShape();
         shape.setId("PowerPlusWaterMarkObject" + idx);
-        shape.setSpid("_x0000_s102" + (4+idx));
+        shape.setSpid("_x0000_s102" + (4 + idx));
         shape.setType("#_x0000_t136");
         shape.setStyle("position:absolute;margin-left:0;margin-top:0;width:415pt;height:207.5pt;z-index:-251654144;mso-wrap-edited:f;mso-position-horizontal:center;mso-position-horizontal-relative:margin;mso-position-vertical:center;mso-position-vertical-relative:margin");
         shape.setWrapcoords("616 5068 390 16297 39 16921 -39 17155 7265 17545 7186 17467 -39 17467 18904 17467 10507 17467 8710 17545 18904 17077 18787 16843 18358 16297 18279 12554 19178 12476 20701 11774 20779 11228 21131 10059 21248 8811 21248 7563 20975 6316 20935 5380 19490 5146 14022 5068 2616 5068");

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHyperlinkDecorator.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHyperlinkDecorator.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHyperlinkDecorator.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHyperlinkDecorator.java Sun Jul 19 19:00:32 2015
@@ -23,50 +23,49 @@ import org.openxmlformats.schemas.wordpr
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText;
 
 /**
- * Decorator class for XWPFParagraph allowing to add hyperlinks 
- *  found in paragraph to its text.
- *  
+ * Decorator class for XWPFParagraph allowing to add hyperlinks
+ * found in paragraph to its text.
+ * <p/>
  * Note - adds the hyperlink at the end, not in the right place...
- *  
+ *
  * @deprecated Use {@link XWPFHyperlinkRun} instead
  */
 @Deprecated
 public class XWPFHyperlinkDecorator extends XWPFParagraphDecorator {
-	private StringBuffer hyperlinkText;
-	
-	/**
-	 * @param nextDecorator The next decorator to use
-	 * @param outputHyperlinkUrls Should we output the links too, or just the link text?
-	 */
-	public XWPFHyperlinkDecorator(XWPFParagraphDecorator nextDecorator, boolean outputHyperlinkUrls) {
-		this(nextDecorator.paragraph, nextDecorator, outputHyperlinkUrls);
-	}
-	
-	/**
-	 * @param prgrph The paragraph of text to work on
-	 * @param outputHyperlinkUrls Should we output the links too, or just the link text?
-	 */
-	public XWPFHyperlinkDecorator(XWPFParagraph prgrph, XWPFParagraphDecorator nextDecorator, boolean outputHyperlinkUrls) {
-		super(prgrph, nextDecorator);
-		
-		hyperlinkText = new StringBuffer();
-		
-		// loop over hyperlink anchors
-		for(CTHyperlink link : paragraph.getCTP().getHyperlinkArray()){
-			for (CTR r : link.getRArray()) {
-				// Loop over text runs
-				for (CTText text : r.getTArray()){
-					hyperlinkText.append(text.getStringValue());
-				}
-			}
-			if(outputHyperlinkUrls && paragraph.getDocument().getHyperlinkByID(link.getId()) != null) {
-				hyperlinkText.append(" <"+paragraph.getDocument().getHyperlinkByID(link.getId()).getURL()+">");
-			}
-		}
-	}
-	
-	public String getText()
-	{
-		return super.getText() + hyperlinkText;
-	}
+    private StringBuffer hyperlinkText;
+
+    /**
+     * @param nextDecorator       The next decorator to use
+     * @param outputHyperlinkUrls Should we output the links too, or just the link text?
+     */
+    public XWPFHyperlinkDecorator(XWPFParagraphDecorator nextDecorator, boolean outputHyperlinkUrls) {
+        this(nextDecorator.paragraph, nextDecorator, outputHyperlinkUrls);
+    }
+
+    /**
+     * @param prgrph              The paragraph of text to work on
+     * @param outputHyperlinkUrls Should we output the links too, or just the link text?
+     */
+    public XWPFHyperlinkDecorator(XWPFParagraph prgrph, XWPFParagraphDecorator nextDecorator, boolean outputHyperlinkUrls) {
+        super(prgrph, nextDecorator);
+
+        hyperlinkText = new StringBuffer();
+
+        // loop over hyperlink anchors
+        for (CTHyperlink link : paragraph.getCTP().getHyperlinkArray()) {
+            for (CTR r : link.getRArray()) {
+                // Loop over text runs
+                for (CTText text : r.getTArray()) {
+                    hyperlinkText.append(text.getStringValue());
+                }
+            }
+            if (outputHyperlinkUrls && paragraph.getDocument().getHyperlinkByID(link.getId()) != null) {
+                hyperlinkText.append(" <" + paragraph.getDocument().getHyperlinkByID(link.getId()).getURL() + ">");
+            }
+        }
+    }
+
+    public String getText() {
+        return super.getText() + hyperlinkText;
+    }
 }

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFParagraphDecorator.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFParagraphDecorator.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFParagraphDecorator.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/model/XWPFParagraphDecorator.java Sun Jul 19 19:00:32 2015
@@ -22,22 +22,22 @@ import org.apache.poi.xwpf.usermodel.XWP
  * Base decorator class for XWPFParagraph
  */
 public abstract class XWPFParagraphDecorator {
-	protected XWPFParagraph paragraph;
-	protected XWPFParagraphDecorator nextDecorator;
-	
-	public XWPFParagraphDecorator(XWPFParagraph paragraph) {
-		this(paragraph, null);
-	}
-	
-	public XWPFParagraphDecorator(XWPFParagraph paragraph, XWPFParagraphDecorator nextDecorator) {
-		this.paragraph = paragraph;
-		this.nextDecorator = nextDecorator;
-	}
-	
-	public String getText() {
-		if(nextDecorator != null) {
-			return nextDecorator.getText();
-		}
-		return paragraph.getText();
-	}
+    protected XWPFParagraph paragraph;
+    protected XWPFParagraphDecorator nextDecorator;
+
+    public XWPFParagraphDecorator(XWPFParagraph paragraph) {
+        this(paragraph, null);
+    }
+
+    public XWPFParagraphDecorator(XWPFParagraph paragraph, XWPFParagraphDecorator nextDecorator) {
+        this.paragraph = paragraph;
+        this.nextDecorator = nextDecorator;
+    }
+
+    public String getText() {
+        if (nextDecorator != null) {
+            return nextDecorator.getText();
+        }
+        return paragraph.getText();
+    }
 }

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/package.html
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/package.html?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/package.html (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/package.html Sun Jul 19 19:00:32 2015
@@ -19,9 +19,9 @@
 -->
 <html>
 <body>
-    <p>This package contains classes for handling Microsoft .docx
-       Word Processing files, known in POI as XWPF (XML Word Processing
-       Format).
-    </p>
+<p>This package contains classes for handling Microsoft .docx
+    Word Processing files, known in POI as XWPF (XML Word Processing
+    Format).
+</p>
 </body>
 </html>

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/AbstractXWPFSDT.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/AbstractXWPFSDT.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/AbstractXWPFSDT.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/AbstractXWPFSDT.java Sun Jul 19 19:00:32 2015
@@ -13,102 +13,92 @@
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-==================================================================== */
-package org.apache.poi.xwpf.usermodel;
-
-import java.util.List;
-
-import org.apache.poi.POIXMLDocumentPart;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtPr;
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTString;
-
-/**
- * Experimental abstract class that is a base for XWPFSDT and XWPFSDTCell
- *  
- * WARNING - APIs expected to change rapidly.
- * 
- * These classes have so far been built only for read-only processing.
- * 
- */
-public abstract class AbstractXWPFSDT implements ISDTContents {
-   private final String title;
-   private final String tag;
-   private final IBody part;
-
-   @SuppressWarnings("deprecation")
-   public AbstractXWPFSDT(CTSdtPr pr, IBody part){
-       
-       CTString[] aliases = pr.getAliasArray();
-       if (aliases != null && aliases.length > 0){
-          title = aliases[0].getVal();
-       } else {
-          title = "";
-       }
-       CTString[] tags = pr.getTagArray();
-       if (tags != null && tags.length > 0){
-          tag = tags[0].getVal();
-       } else {
-          tag = "";
-       }
-       this.part = part;
-       
-   }
-
-   /**
-    * 
-    * @return first SDT Title
-    */
-   public String getTitle(){
-      return title;
-   }
-   
-   /**
-    * 
-    * @return first SDT Tag
-    */
-   public String getTag(){
-      return tag;
-   }
-   
-   /**
-    * 
-    * @return the content object
-    */
-   public abstract ISDTContent getContent();
-
-   /**
-    * 
-    * @return null
-    */
-   public IBody getBody() {
-      return null;
-   }
-
-   /**
-    * 
-    * @return document part
-    */
-   public POIXMLDocumentPart getPart() {
-      return part.getPart();
-   }
-
-   /**
-    * 
-    * @return partType
-    */
-   public BodyType getPartType() {
-      return BodyType.CONTENTCONTROL;
-   }
-
-   /**
-    * 
-    * @return element type
-    */
-   public BodyElementType getElementType() {
-      return BodyElementType.CONTENTCONTROL;
-   }
-
-   public XWPFDocument getDocument() {
-      return part.getXWPFDocument();
-   }
-}
+==================================================================== */
+package org.apache.poi.xwpf.usermodel;
+
+import org.apache.poi.POIXMLDocumentPart;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtPr;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTString;
+
+/**
+ * Experimental abstract class that is a base for XWPFSDT and XWPFSDTCell
+ * <p/>
+ * WARNING - APIs expected to change rapidly.
+ * <p/>
+ * These classes have so far been built only for read-only processing.
+ */
+public abstract class AbstractXWPFSDT implements ISDTContents {
+    private final String title;
+    private final String tag;
+    private final IBody part;
+
+    @SuppressWarnings("deprecation")
+    public AbstractXWPFSDT(CTSdtPr pr, IBody part) {
+
+        CTString[] aliases = pr.getAliasArray();
+        if (aliases != null && aliases.length > 0) {
+            title = aliases[0].getVal();
+        } else {
+            title = "";
+        }
+        CTString[] tags = pr.getTagArray();
+        if (tags != null && tags.length > 0) {
+            tag = tags[0].getVal();
+        } else {
+            tag = "";
+        }
+        this.part = part;
+
+    }
+
+    /**
+     * @return first SDT Title
+     */
+    public String getTitle() {
+        return title;
+    }
+
+    /**
+     * @return first SDT Tag
+     */
+    public String getTag() {
+        return tag;
+    }
+
+    /**
+     * @return the content object
+     */
+    public abstract ISDTContent getContent();
+
+    /**
+     * @return null
+     */
+    public IBody getBody() {
+        return null;
+    }
+
+    /**
+     * @return document part
+     */
+    public POIXMLDocumentPart getPart() {
+        return part.getPart();
+    }
+
+    /**
+     * @return partType
+     */
+    public BodyType getPartType() {
+        return BodyType.CONTENTCONTROL;
+    }
+
+    /**
+     * @return element type
+     */
+    public BodyElementType getElementType() {
+        return BodyElementType.CONTENTCONTROL;
+    }
+
+    public XWPFDocument getDocument() {
+        return part.getXWPFDocument();
+    }
+}

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/BodyElementType.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/BodyElementType.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/BodyElementType.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/BodyElementType.java Sun Jul 19 19:00:32 2015
@@ -21,15 +21,14 @@ package org.apache.poi.xwpf.usermodel;
  * <p>
  * 9 Jan 2010
  * </p>
- * <p>
- * // TODO insert Javadoc here!
- * </p>
- * @author epp
- *
- */
-public enum BodyElementType {
-   CONTENTCONTROL,
-   PARAGRAPH,
-	TABLE,
-	
-}
+ * <p>
+ * // TODO insert Javadoc here!
+ * </p>
+ *
+ * @author epp
+ */
+public enum BodyElementType {
+    CONTENTCONTROL,
+    PARAGRAPH,
+    TABLE,
+}

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/Borders.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/Borders.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/Borders.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/Borders.java Sun Jul 19 19:00:32 2015
@@ -29,14 +29,15 @@ import java.util.Map;
  * </li>
  * <li> Art borders: which specify a repeated image to be used
  * when drawing a border around the specified object. Line borders may be
- * specified on any object which allows a border, however, art borders may only
- * be used as a border at the page level - the borders under the pgBorders
- * element
- *</li>
- * </ul>
- * @author Gisella Bronzetti
- */
-public enum Borders {
+ * specified on any object which allows a border, however, art borders may only
+ * be used as a border at the page level - the borders under the pgBorders
+ * element
+ * </li>
+ * </ul>
+ *
+ * @author Gisella Bronzetti
+ */
+public enum Borders {
 
     NIL(1),
 
@@ -596,31 +597,32 @@ public enum Borders {
     ZANY_TRIANGLES(189),
 
     ZIG_ZAG(190),
-
-    ZIG_ZAG_STITCH(191);
-
-    private final int value;
-
-    private Borders(int val) {
-        value = val;
-    }
-
-    public int getValue() {
-        return value;
-    }
-
-    private static Map<Integer, Borders> imap = new HashMap<Integer, Borders>();
-    static {
-        for (Borders p : values()) {
-            imap.put(Integer.valueOf(p.getValue()), p);
-        }
-    }
-
-    public static Borders valueOf(int type) {
-        Borders pBorder = imap.get(Integer.valueOf(type));
-        if (pBorder == null) {
-            throw new IllegalArgumentException("Unknown paragraph border: " + type);
-        }
-        return pBorder;
-    }
-}
+
+    ZIG_ZAG_STITCH(191);
+
+    private static Map<Integer, Borders> imap = new HashMap<Integer, Borders>();
+
+    static {
+        for (Borders p : values()) {
+            imap.put(Integer.valueOf(p.getValue()), p);
+        }
+    }
+
+    private final int value;
+
+    private Borders(int val) {
+        value = val;
+    }
+
+    public static Borders valueOf(int type) {
+        Borders pBorder = imap.get(Integer.valueOf(type));
+        if (pBorder == null) {
+            throw new IllegalArgumentException("Unknown paragraph border: " + type);
+        }
+        return pBorder;
+    }
+
+    public int getValue() {
+        return value;
+    }
+}

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/BreakClear.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/BreakClear.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/BreakClear.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/BreakClear.java Sun Jul 19 19:00:32 2015
@@ -20,23 +20,23 @@ import java.util.HashMap;
 import java.util.Map;
 
 /**
- * Specifies the set of possible restart locations which may be used as to
- * determine the next available line when a break's type attribute has a value
- * of textWrapping.
- * 
- * @author Gisella Bronzetti
- */
-public enum BreakClear {
+ * Specifies the set of possible restart locations which may be used as to
+ * determine the next available line when a break's type attribute has a value
+ * of textWrapping.
+ *
+ * @author Gisella Bronzetti
+ */
+public enum BreakClear {
 
     /**
      * Specifies that the text wrapping break shall advance the text to the next
-     * line in the WordprocessingML document, regardless of its position left to
-     * right or the presence of any floating objects which intersect with the
-     * line,
-     * 
-     * This is the setting for a typical line break in a document.
-     */
-
+     * line in the WordprocessingML document, regardless of its position left to
+     * right or the presence of any floating objects which intersect with the
+     * line,
+     * <p/>
+     * This is the setting for a typical line break in a document.
+     */
+
     NONE(1),
 
     /**
@@ -80,31 +80,32 @@ public enum BreakClear {
      * Specifies that the text wrapping break shall advance the text to the next
      * line in the WordprocessingML document which spans the full width of the
      * line.
-     */
-    ALL(4);
-
-    private final int value;
-
-    private BreakClear(int val) {
-       value = val;
-    }
-
-    public int getValue() {
-       return value;
-    }
-
-    private static Map<Integer, BreakClear> imap = new HashMap<Integer, BreakClear>();
-    static {
-       for (BreakClear p : values()) {
-          imap.put(new Integer(p.getValue()), p);
-       }
-    }
-
-    public static BreakClear valueOf(int type) {
-       BreakClear bType = imap.get(new Integer(type));
-       if (bType == null)
-          throw new IllegalArgumentException("Unknown break clear type: "
-                + type);
-       return bType;
-    }
-}
+     */
+    ALL(4);
+
+    private static Map<Integer, BreakClear> imap = new HashMap<Integer, BreakClear>();
+
+    static {
+        for (BreakClear p : values()) {
+            imap.put(new Integer(p.getValue()), p);
+        }
+    }
+
+    private final int value;
+
+    private BreakClear(int val) {
+        value = val;
+    }
+
+    public static BreakClear valueOf(int type) {
+        BreakClear bType = imap.get(new Integer(type));
+        if (bType == null)
+            throw new IllegalArgumentException("Unknown break clear type: "
+                    + type);
+        return bType;
+    }
+
+    public int getValue() {
+        return value;
+    }
+}

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/BreakType.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/BreakType.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/BreakType.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/BreakType.java Sun Jul 19 19:00:32 2015
@@ -21,18 +21,18 @@ import java.util.Map;
 
 /**
  * Specifies the possible types of break characters in a WordprocessingML
- * document.
- * The break type determines the next location where text shall be
- * placed after this manual break is applied to the text contents
- * 
- * @author Gisella Bronzetti
- */
-public enum BreakType {
-
-    
-    /**
-     * Specifies that the current break shall restart itself on the next page of
-     * the document when the document is displayed in page view.
+ * document.
+ * The break type determines the next location where text shall be
+ * placed after this manual break is applied to the text contents
+ *
+ * @author Gisella Bronzetti
+ */
+public enum BreakType {
+
+
+    /**
+     * Specifies that the current break shall restart itself on the next page of
+     * the document when the document is displayed in page view.
      */
     PAGE(1),
 
@@ -53,31 +53,32 @@ public enum BreakType {
      * the document when the document is displayed in page view.
      * The determine of the next line shall be done subject to the value of the clear
      * attribute on the specified break character.
-     */
-    TEXT_WRAPPING(3);
-
-    private final int value;
-
-    private BreakType(int val) {
-       value = val;
-    }
-
-    public int getValue() {
-       return value;
-    }
-
-    private static Map<Integer, BreakType> imap = new HashMap<Integer, BreakType>();
-    static {
-       for (BreakType p : values()) {
-          imap.put(new Integer(p.getValue()), p);
-       }
-    }
-
-    public static BreakType valueOf(int type) {
-       BreakType bType = imap.get(new Integer(type));
-       if (bType == null)
-          throw new IllegalArgumentException("Unknown break type: "
-                + type);
-       return bType;
-    }
-}
+     */
+    TEXT_WRAPPING(3);
+
+    private static Map<Integer, BreakType> imap = new HashMap<Integer, BreakType>();
+
+    static {
+        for (BreakType p : values()) {
+            imap.put(new Integer(p.getValue()), p);
+        }
+    }
+
+    private final int value;
+
+    private BreakType(int val) {
+        value = val;
+    }
+
+    public static BreakType valueOf(int type) {
+        BreakType bType = imap.get(new Integer(type));
+        if (bType == null)
+            throw new IllegalArgumentException("Unknown break type: "
+                    + type);
+        return bType;
+    }
+
+    public int getValue() {
+        return value;
+    }
+}

Modified: poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/Document.java
URL: http://svn.apache.org/viewvc/poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/Document.java?rev=1691843&r1=1691842&r2=1691843&view=diff
==============================================================================
--- poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/Document.java (original)
+++ poi/branches/common_sl/src/ooxml/java/org/apache/poi/xwpf/usermodel/Document.java Sun Jul 19 19:00:32 2015
@@ -14,31 +14,45 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 ==================================================================== */
-package org.apache.poi.xwpf.usermodel;
-
-public interface Document {
-    /** Extended windows meta file */
-    public static final int PICTURE_TYPE_EMF = 2;
-
-    /** Windows Meta File */
-    public static final int PICTURE_TYPE_WMF = 3;
-
-    /** Mac PICT format */
-    public static final int PICTURE_TYPE_PICT = 4;
-
-    /** JPEG format */
-    public static final int PICTURE_TYPE_JPEG = 5;
-
-    /** PNG format */
-    public static final int PICTURE_TYPE_PNG = 6;
-
-    /** Device independent bitmap */
-    public static final int PICTURE_TYPE_DIB = 7;
-
-    /** GIF image format */
-    public static final int PICTURE_TYPE_GIF = 8;
-
-    /**
+package org.apache.poi.xwpf.usermodel;
+
+public interface Document {
+    /**
+     * Extended windows meta file
+     */
+    public static final int PICTURE_TYPE_EMF = 2;
+
+    /**
+     * Windows Meta File
+     */
+    public static final int PICTURE_TYPE_WMF = 3;
+
+    /**
+     * Mac PICT format
+     */
+    public static final int PICTURE_TYPE_PICT = 4;
+
+    /**
+     * JPEG format
+     */
+    public static final int PICTURE_TYPE_JPEG = 5;
+
+    /**
+     * PNG format
+     */
+    public static final int PICTURE_TYPE_PNG = 6;
+
+    /**
+     * Device independent bitmap
+     */
+    public static final int PICTURE_TYPE_DIB = 7;
+
+    /**
+     * GIF image format
+     */
+    public static final int PICTURE_TYPE_GIF = 8;
+
+    /**
      * Tag Image File (.tiff)
      */
     public static final int PICTURE_TYPE_TIFF = 9;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message