You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by on...@apache.org on 2017/11/04 09:32:05 UTC

svn commit: r1814264 - in /poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers: BaseRowColShifter.java ColumnShifter.java RowShifter.java

Author: onealj
Date: Sat Nov  4 09:32:05 2017
New Revision: 1814264

URL: http://svn.apache.org/viewvc?rev=1814264&view=rev
Log:
bug 61474, github #81: add shiftMergedRegions to BaseRowColShifter interface

Modified:
    poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/BaseRowColShifter.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/ColumnShifter.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/RowShifter.java

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/BaseRowColShifter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/BaseRowColShifter.java?rev=1814264&r1=1814263&r2=1814264&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/BaseRowColShifter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/BaseRowColShifter.java Sat Nov  4 09:32:05 2017
@@ -25,6 +25,8 @@ import org.apache.poi.ss.formula.ptg.Ptg
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.util.Internal;
 
+import java.util.List;
+
 /**
  * Class for code common to {@link RowShifter} and {@link ColumnShifter}
  * Helper for shifting rows up or down and columns left and right
@@ -44,7 +46,22 @@ public abstract class BaseRowColShifter
      */
     public abstract void updateFormulas(FormulaShifter formulaShifter);
 
+    /**
+     * Shifts, grows, or shrinks the merged regions due to a row shift
+     * ({@link RowShifter}) or column shift ({@link ColumnShifter}).
+     * Merged regions that are completely overlaid by shifting will be deleted.
+     *
+     * @param start the first row or column to be shifted
+     * @param end   the last row or column to be shifted
+     * @param n     the number of rows or columns to shift
+     * @return a list of affected merged regions, excluding contain deleted ones
+     */
+    public abstract List<CellRangeAddress> shiftMergedRegions(int start, int end, int n);
 
+    /**
+     * Update conditional formatting
+     * @param formulaShifter
+     */
     public abstract void updateConditionalFormatting(FormulaShifter formulaShifter);
 
     /**

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/ColumnShifter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/ColumnShifter.java?rev=1814264&r1=1814263&r2=1814264&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/ColumnShifter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/ColumnShifter.java Sat Nov  4 09:32:05 2017
@@ -22,7 +22,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.poi.ss.formula.FormulaShifter;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.util.Beta;
@@ -50,8 +49,10 @@ public abstract class ColumnShifter exte
      * @param endColumn   the column to end shifting
      * @param n        the number of columns to shift
      * @return an array of affected merged regions, doesn't contain deleted ones
+     * @since POI 4.0.0
      */
     // Keep this code in sync with {@link RowShifter#shiftMergedRegions}
+    @Override
     public List<CellRangeAddress> shiftMergedRegions(int startColumn, int endColumn, int n) {
         List<CellRangeAddress> shiftedRegions = new ArrayList<>();
         Set<Integer> removedIndices = new HashSet<>();
@@ -118,27 +119,4 @@ public abstract class ColumnShifter exte
         // if the merged-region and the overwritten area intersect, we need to remove it
         return merged.intersects(overwrite);
     }
-
-    /**
-     * Updated named ranges
-     */
-    public abstract void updateNamedRanges(FormulaShifter formulaShifter);
-
-    /**
-     * Update formulas.
-     */
-    public abstract void updateFormulas(FormulaShifter formulaShifter);
-
-
-    public abstract void updateConditionalFormatting(FormulaShifter formulaShifter);
-    
-    /**
-     * Shift the Hyperlink anchors (not the hyperlink text, even if the hyperlink
-     * is of type LINK_DOCUMENT and refers to a cell that was shifted). Hyperlinks
-     * do not track the content they point to.
-     *
-     * @param formulaShifter the formula shifting policy
-     */
-    public abstract void updateHyperlinks(FormulaShifter formulaShifter);
-
 }

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/RowShifter.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/RowShifter.java?rev=1814264&r1=1814263&r2=1814264&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/RowShifter.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/helpers/RowShifter.java Sat Nov  4 09:32:05 2017
@@ -49,6 +49,7 @@ public abstract class RowShifter extends
      * @return an array of affected merged regions, doesn't contain deleted ones
      */
     // Keep this code in sync with {@link ColumnShifter#shiftMergedRegions}
+    @Override
     public List<CellRangeAddress> shiftMergedRegions(int startRow, int endRow, int n) {
         List<CellRangeAddress> shiftedRegions = new ArrayList<>();
         Set<Integer> removedIndices = new HashSet<>();



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