Fix inconsistent whitespace/formatting

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1691046 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2015-07-14 18:14:50 +00:00
parent 777806d350
commit e349269fcf
6 changed files with 1021 additions and 1055 deletions

View File

@ -25,11 +25,8 @@ import org.apache.poi.util.LittleEndianOutput;
/** /**
* Border Formatting Block of the Conditional Formatting Rule Record. * Border Formatting Block of the Conditional Formatting Rule Record.
*
* @author Dmitriy Kumshayev
*/ */
public final class BorderFormatting { public final class BorderFormatting {
/** No border */ /** No border */
public final static short BORDER_NONE = 0x0; public final static short BORDER_NONE = 0x0;
/** Thin border */ /** Thin border */

View File

@ -23,97 +23,93 @@ import java.util.List;
import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddress;
/** /**
* * TODO Should this move to org.apache.poi.ss.util ?
* @author Dmitriy Kumshayev
*/ */
public final class CellRangeUtil public final class CellRangeUtil {
{ private CellRangeUtil() {
// no instance of this class
private CellRangeUtil() { }
// no instance of this class
} public static final int NO_INTERSECTION = 1;
public static final int OVERLAP = 2;
public static final int NO_INTERSECTION = 1; /** first range is within the second range */
public static final int OVERLAP = 2; public static final int INSIDE = 3;
/** first range is within the second range */ /** first range encloses or is equal to the second */
public static final int INSIDE = 3; public static final int ENCLOSES = 4;
/** first range encloses or is equal to the second */
public static final int ENCLOSES = 4; /**
* Intersect this range with the specified range.
/** *
* Intersect this range with the specified range. * @param crB - the specified range
* * @return code which reflects how the specified range is related to this range.<br/>
* @param crB - the specified range * Possible return codes are:
* @return code which reflects how the specified range is related to this range.<br/> * NO_INTERSECTION - the specified range is outside of this range;<br/>
* Possible return codes are: * OVERLAP - both ranges partially overlap;<br/>
* NO_INTERSECTION - the specified range is outside of this range;<br/> * INSIDE - the specified range is inside of this one<br/>
* OVERLAP - both ranges partially overlap;<br/> * ENCLOSES - the specified range encloses (possibly exactly the same as) this range<br/>
* INSIDE - the specified range is inside of this one<br/> */
* ENCLOSES - the specified range encloses (possibly exactly the same as) this range<br/> public static int intersect(CellRangeAddress crA, CellRangeAddress crB )
*/ {
public static int intersect(CellRangeAddress crA, CellRangeAddress crB )
{ int firstRow = crB.getFirstRow();
int lastRow = crB.getLastRow();
int firstRow = crB.getFirstRow(); int firstCol = crB.getFirstColumn();
int lastRow = crB.getLastRow(); int lastCol = crB.getLastColumn();
int firstCol = crB.getFirstColumn();
int lastCol = crB.getLastColumn(); if
(
if
(
gt(crA.getFirstRow(),lastRow) || gt(crA.getFirstRow(),lastRow) ||
lt(crA.getLastRow(),firstRow) || lt(crA.getLastRow(),firstRow) ||
gt(crA.getFirstColumn(),lastCol) || gt(crA.getFirstColumn(),lastCol) ||
lt(crA.getLastColumn(),firstCol) lt(crA.getLastColumn(),firstCol)
) )
{ {
return NO_INTERSECTION; return NO_INTERSECTION;
} }
else if( contains(crA, crB) ) else if( contains(crA, crB) )
{ {
return INSIDE; return INSIDE;
} }
else if( contains(crB, crA)) else if( contains(crB, crA))
{ {
return ENCLOSES; return ENCLOSES;
} }
else else
{ {
return OVERLAP; return OVERLAP;
} }
}
}
/**
/** * Do all possible cell merges between cells of the list so that:<br>
* Do all possible cell merges between cells of the list so that:<br> * <li>if a cell range is completely inside of another cell range, it gets removed from the list
* <li>if a cell range is completely inside of another cell range, it gets removed from the list * <li>if two cells have a shared border, merge them into one bigger cell range
* <li>if two cells have a shared border, merge them into one bigger cell range * @param cellRanges
* @param cellRanges * @return updated List of cell ranges
* @return updated List of cell ranges */
*/ public static CellRangeAddress[] mergeCellRanges(CellRangeAddress[] cellRanges) {
public static CellRangeAddress[] mergeCellRanges(CellRangeAddress[] cellRanges) { if(cellRanges.length < 1) {
if(cellRanges.length < 1) { return cellRanges;
return cellRanges; }
}
List<CellRangeAddress> lst = new ArrayList<CellRangeAddress>(); List<CellRangeAddress> lst = new ArrayList<CellRangeAddress>();
for(CellRangeAddress cr : cellRanges) { for(CellRangeAddress cr : cellRanges) {
lst.add(cr); lst.add(cr);
} }
List<CellRangeAddress> temp = mergeCellRanges(lst); List<CellRangeAddress> temp = mergeCellRanges(lst);
return toArray(temp); return toArray(temp);
} }
private static List<CellRangeAddress> mergeCellRanges(List<CellRangeAddress> cellRangeList) private static List<CellRangeAddress> mergeCellRanges(List<CellRangeAddress> cellRangeList)
{ {
// loop until either only one item is left or we did not merge anything any more // loop until either only one item is left or we did not merge anything any more
while (cellRangeList.size() > 1) { while (cellRangeList.size() > 1) {
boolean somethingGotMerged = false; boolean somethingGotMerged = false;
// look at all cell-ranges // look at all cell-ranges
for (int i = 0; i < cellRangeList.size(); i++) { for (int i = 0; i < cellRangeList.size(); i++) {
CellRangeAddress range1 = cellRangeList.get(i); CellRangeAddress range1 = cellRangeList.get(i);
// compare each cell range to all other cell-ranges // compare each cell range to all other cell-ranges
for (int j = i + 1; j < cellRangeList.size(); j++) { for (int j = i + 1; j < cellRangeList.size(); j++) {
CellRangeAddress range2 = cellRangeList.get(j); CellRangeAddress range2 = cellRangeList.get(j);
@ -139,16 +135,16 @@ public final class CellRangeUtil
} }
} }
return cellRangeList; return cellRangeList;
} }
/** /**
* @return the new range(s) to replace the supplied ones. <code>null</code> if no merge is possible * @return the new range(s) to replace the supplied ones. <code>null</code> if no merge is possible
*/ */
private static CellRangeAddress[] mergeRanges(CellRangeAddress range1, CellRangeAddress range2) { private static CellRangeAddress[] mergeRanges(CellRangeAddress range1, CellRangeAddress range2) {
int x = intersect(range1, range2); int x = intersect(range1, range2);
switch(x) switch(x)
{ {
case CellRangeUtil.NO_INTERSECTION: case CellRangeUtil.NO_INTERSECTION:
// nothing in common: at most they could be adjacent to each other and thus form a single bigger area // nothing in common: at most they could be adjacent to each other and thus form a single bigger area
if(hasExactSharedBorder(range1, range2)) { if(hasExactSharedBorder(range1, range2)) {
@ -171,108 +167,103 @@ public final class CellRangeUtil
throw new RuntimeException("unexpected intersection result (" + x + ")"); throw new RuntimeException("unexpected intersection result (" + x + ")");
} }
private static CellRangeAddress[] toArray(List<CellRangeAddress> temp) {
private static CellRangeAddress[] toArray(List<CellRangeAddress> temp) { CellRangeAddress[] result = new CellRangeAddress[temp.size()];
CellRangeAddress[] result = new CellRangeAddress[temp.size()]; temp.toArray(result);
temp.toArray(result); return result;
return result; }
}
/**
* Check if the specified range is located inside of this cell range.
*
* @param crB
* @return true if this cell range contains the argument range inside if it's area
*/
public static boolean contains(CellRangeAddress crA, CellRangeAddress crB)
{
int firstRow = crB.getFirstRow();
int lastRow = crB.getLastRow();
int firstCol = crB.getFirstColumn();
int lastCol = crB.getLastColumn();
return le(crA.getFirstRow(), firstRow) && ge(crA.getLastRow(), lastRow)
&& le(crA.getFirstColumn(), firstCol) && ge(crA.getLastColumn(), lastCol);
}
/**
* Check if the two cell ranges have a shared border.
*
* @return <code>true</code> if the ranges have a complete shared border (i.e.
* the two ranges together make a simple rectangular region.
*/
public static boolean hasExactSharedBorder(CellRangeAddress crA, CellRangeAddress crB) {
int oFirstRow = crB.getFirstRow();
int oLastRow = crB.getLastRow();
int oFirstCol = crB.getFirstColumn();
int oLastCol = crB.getLastColumn();
/** if (crA.getFirstRow() > 0 && crA.getFirstRow()-1 == oLastRow ||
* Check if the specified range is located inside of this cell range. oFirstRow > 0 && oFirstRow-1 == crA.getLastRow()) {
* // ranges have a horizontal border in common
* @param crB // make sure columns are identical:
* @return true if this cell range contains the argument range inside if it's area return crA.getFirstColumn() == oFirstCol && crA.getLastColumn() == oLastCol;
*/ }
public static boolean contains(CellRangeAddress crA, CellRangeAddress crB)
{
int firstRow = crB.getFirstRow();
int lastRow = crB.getLastRow();
int firstCol = crB.getFirstColumn();
int lastCol = crB.getLastColumn();
return le(crA.getFirstRow(), firstRow) && ge(crA.getLastRow(), lastRow)
&& le(crA.getFirstColumn(), firstCol) && ge(crA.getLastColumn(), lastCol);
}
/**
* Check if the two cell ranges have a shared border.
*
* @return <code>true</code> if the ranges have a complete shared border (i.e.
* the two ranges together make a simple rectangular region.
*/
public static boolean hasExactSharedBorder(CellRangeAddress crA, CellRangeAddress crB) {
int oFirstRow = crB.getFirstRow();
int oLastRow = crB.getLastRow();
int oFirstCol = crB.getFirstColumn();
int oLastCol = crB.getLastColumn();
if (crA.getFirstRow() > 0 && crA.getFirstRow()-1 == oLastRow ||
oFirstRow > 0 && oFirstRow-1 == crA.getLastRow()) {
// ranges have a horizontal border in common
// make sure columns are identical:
return crA.getFirstColumn() == oFirstCol && crA.getLastColumn() == oLastCol;
}
if (crA.getFirstColumn()>0 && crA.getFirstColumn() - 1 == oLastCol || if (crA.getFirstColumn()>0 && crA.getFirstColumn() - 1 == oLastCol ||
oFirstCol>0 && crA.getLastColumn() == oFirstCol -1) { oFirstCol>0 && crA.getLastColumn() == oFirstCol -1) {
// ranges have a vertical border in common // ranges have a vertical border in common
// make sure rows are identical: // make sure rows are identical:
return crA.getFirstRow() == oFirstRow && crA.getLastRow() == oLastRow; return crA.getFirstRow() == oFirstRow && crA.getLastRow() == oLastRow;
} }
return false; return false;
} }
/**
* Create an enclosing CellRange for the two cell ranges.
*
* @return enclosing CellRange
*/
public static CellRangeAddress createEnclosingCellRange(CellRangeAddress crA, CellRangeAddress crB) {
if( crB == null) {
return crA.copy();
}
return
new CellRangeAddress(
lt(crB.getFirstRow(), crA.getFirstRow()) ?crB.getFirstRow() :crA.getFirstRow(),
gt(crB.getLastRow(), crA.getLastRow()) ?crB.getLastRow() :crA.getLastRow(),
lt(crB.getFirstColumn(),crA.getFirstColumn())?crB.getFirstColumn():crA.getFirstColumn(),
gt(crB.getLastColumn(), crA.getLastColumn()) ?crB.getLastColumn() :crA.getLastColumn()
);
}
/**
* @return true if a < b
*/
private static boolean lt(int a, int b)
{
return a == -1 ? false : (b == -1 ? true : a < b);
}
/**
* @return true if a <= b
*/
private static boolean le(int a, int b)
{
return a == b || lt(a,b);
}
/**
* @return true if a > b
*/
private static boolean gt(int a, int b)
{
return lt(b,a);
}
/** /**
* @return true if a >= b * Create an enclosing CellRange for the two cell ranges.
*/ *
private static boolean ge(int a, int b) * @return enclosing CellRange
{ */
return !lt(a,b); public static CellRangeAddress createEnclosingCellRange(CellRangeAddress crA, CellRangeAddress crB) {
} if( crB == null) {
return crA.copy();
}
return new CellRangeAddress(
lt(crB.getFirstRow(), crA.getFirstRow()) ?crB.getFirstRow() :crA.getFirstRow(),
gt(crB.getLastRow(), crA.getLastRow()) ?crB.getLastRow() :crA.getLastRow(),
lt(crB.getFirstColumn(),crA.getFirstColumn())?crB.getFirstColumn():crA.getFirstColumn(),
gt(crB.getLastColumn(), crA.getLastColumn()) ?crB.getLastColumn() :crA.getLastColumn()
);
}
/**
* @return true if a < b
*/
private static boolean lt(int a, int b)
{
return a == -1 ? false : (b == -1 ? true : a < b);
}
/**
* @return true if a <= b
*/
private static boolean le(int a, int b)
{
return a == b || lt(a,b);
}
/**
* @return true if a > b
*/
private static boolean gt(int a, int b)
{
return lt(b,a);
}
/**
* @return true if a >= b
*/
private static boolean ge(int a, int b)
{
return !lt(a,b);
}
} }

File diff suppressed because it is too large Load Diff

View File

@ -24,8 +24,6 @@ import org.apache.poi.util.LittleEndianOutput;
/** /**
* Pattern Formatting Block of the Conditional Formatting Rule Record. * Pattern Formatting Block of the Conditional Formatting Rule Record.
*
* @author Dmitriy Kumshayev
*/ */
public final class PatternFormatting implements Cloneable { public final class PatternFormatting implements Cloneable {
/** No background */ /** No background */

View File

@ -25,57 +25,54 @@ import org.apache.poi.ss.usermodel.Color;
* High level representation for Font Formatting component * High level representation for Font Formatting component
* of Conditional Formatting settings * of Conditional Formatting settings
*/ */
public final class HSSFFontFormatting implements org.apache.poi.ss.usermodel.FontFormatting public final class HSSFFontFormatting implements org.apache.poi.ss.usermodel.FontFormatting {
{ /** Underline type - None */
/** Underline type - None */ public final static byte U_NONE = FontFormatting.U_NONE;
public final static byte U_NONE = FontFormatting.U_NONE; /** Underline type - Single */
/** Underline type - Single */ public final static byte U_SINGLE = FontFormatting.U_SINGLE;
public final static byte U_SINGLE = FontFormatting.U_SINGLE; /** Underline type - Double */
/** Underline type - Double */ public final static byte U_DOUBLE = FontFormatting.U_DOUBLE;
public final static byte U_DOUBLE = FontFormatting.U_DOUBLE; /** Underline type - Single Accounting */
/** Underline type - Single Accounting */ public final static byte U_SINGLE_ACCOUNTING = FontFormatting.U_SINGLE_ACCOUNTING;
public final static byte U_SINGLE_ACCOUNTING = FontFormatting.U_SINGLE_ACCOUNTING; /** Underline type - Double Accounting */
/** Underline type - Double Accounting */ public final static byte U_DOUBLE_ACCOUNTING = FontFormatting.U_DOUBLE_ACCOUNTING;
public final static byte U_DOUBLE_ACCOUNTING = FontFormatting.U_DOUBLE_ACCOUNTING;
private final FontFormatting fontFormatting; private final FontFormatting fontFormatting;
private final HSSFWorkbook workbook; private final HSSFWorkbook workbook;
protected HSSFFontFormatting(CFRuleBase cfRuleRecord, HSSFWorkbook workbook)
{
this.fontFormatting = cfRuleRecord.getFontFormatting();
this.workbook = workbook;
}
protected FontFormatting getFontFormattingBlock()
{
return fontFormatting;
}
/** protected HSSFFontFormatting(CFRuleBase cfRuleRecord, HSSFWorkbook workbook) {
* get the type of super or subscript for the font this.fontFormatting = cfRuleRecord.getFontFormatting();
* this.workbook = workbook;
* @return super or subscript option }
* @see #SS_NONE
* @see #SS_SUPER
* @see #SS_SUB
*/
public short getEscapementType()
{
return fontFormatting.getEscapementType();
}
/** protected FontFormatting getFontFormattingBlock() {
* @return font color index return fontFormatting;
*/ }
public short getFontColorIndex()
{
return fontFormatting.getFontColorIndex();
}
public HSSFColor getFontColor() { /**
return workbook.getCustomPalette().getColor( * get the type of super or subscript for the font
getFontColorIndex() *
* @return super or subscript option
* @see #SS_NONE
* @see #SS_SUPER
* @see #SS_SUB
*/
public short getEscapementType()
{
return fontFormatting.getEscapementType();
}
/**
* @return font color index
*/
public short getFontColorIndex()
{
return fontFormatting.getFontColorIndex();
}
public HSSFColor getFontColor() {
return workbook.getCustomPalette().getColor(
getFontColorIndex()
); );
} }
@ -83,7 +80,7 @@ public final class HSSFFontFormatting implements org.apache.poi.ss.usermodel.Fon
if (color != null && !(color instanceof HSSFColor)) { if (color != null && !(color instanceof HSSFColor)) {
throw new IllegalArgumentException("Only HSSFColor objects are supported"); throw new IllegalArgumentException("Only HSSFColor objects are supported");
} }
HSSFColor hcolor = (HSSFColor)color; HSSFColor hcolor = (HSSFColor)color;
if (hcolor == null) { if (hcolor == null) {
fontFormatting.setFontColorIndex((short)0); fontFormatting.setFontColorIndex((short)0);
@ -93,328 +90,319 @@ public final class HSSFFontFormatting implements org.apache.poi.ss.usermodel.Fon
} }
/** /**
* gets the height of the font in 1/20th point units * gets the height of the font in 1/20th point units
* *
* @return fontheight (in points/20); or -1 if not modified * @return fontheight (in points/20); or -1 if not modified
*/ */
public int getFontHeight() public int getFontHeight() {
{ return fontFormatting.getFontHeight();
return fontFormatting.getFontHeight(); }
}
/** /**
* get the font weight for this font (100-1000dec or 0x64-0x3e8). Default is * get the font weight for this font (100-1000dec or 0x64-0x3e8). Default is
* 0x190 for normal and 0x2bc for bold * 0x190 for normal and 0x2bc for bold
* *
* @return bw - a number between 100-1000 for the fonts "boldness" * @return bw - a number between 100-1000 for the fonts "boldness"
*/ */
public short getFontWeight() {
return fontFormatting.getFontWeight();
}
public short getFontWeight() /**
{ * @see org.apache.poi.hssf.record.cf.FontFormatting#getRawRecord()
return fontFormatting.getFontWeight(); */
} protected byte[] getRawRecord() {
return fontFormatting.getRawRecord();
}
/** /**
* @see org.apache.poi.hssf.record.cf.FontFormatting#getRawRecord() * get the type of underlining for the font
*/ *
protected byte[] getRawRecord() * @return font underlining type
{ *
return fontFormatting.getRawRecord(); * @see #U_NONE
} * @see #U_SINGLE
* @see #U_DOUBLE
* @see #U_SINGLE_ACCOUNTING
* @see #U_DOUBLE_ACCOUNTING
*/
public short getUnderlineType()
{
return fontFormatting.getUnderlineType();
}
/** /**
* get the type of underlining for the font * get whether the font weight is set to bold or not
* *
* @return font underlining type * @return bold - whether the font is bold or not
* */
* @see #U_NONE public boolean isBold()
* @see #U_SINGLE {
* @see #U_DOUBLE return fontFormatting.isFontWeightModified() && fontFormatting.isBold();
* @see #U_SINGLE_ACCOUNTING }
* @see #U_DOUBLE_ACCOUNTING
*/
public short getUnderlineType()
{
return fontFormatting.getUnderlineType();
}
/** /**
* get whether the font weight is set to bold or not * @return true if escapement type was modified from default
* */
* @return bold - whether the font is bold or not public boolean isEscapementTypeModified()
*/ {
public boolean isBold() return fontFormatting.isEscapementTypeModified();
{ }
return fontFormatting.isFontWeightModified() && fontFormatting.isBold();
}
/** /**
* @return true if escapement type was modified from default * @return true if font cancellation was modified from default
*/ */
public boolean isEscapementTypeModified() public boolean isFontCancellationModified()
{ {
return fontFormatting.isEscapementTypeModified(); return fontFormatting.isFontCancellationModified();
} }
/** /**
* @return true if font cancellation was modified from default * @return true if font outline type was modified from default
*/ */
public boolean isFontCancellationModified() public boolean isFontOutlineModified()
{ {
return fontFormatting.isFontCancellationModified(); return fontFormatting.isFontOutlineModified();
} }
/** /**
* @return true if font outline type was modified from default * @return true if font shadow type was modified from default
*/ */
public boolean isFontOutlineModified() public boolean isFontShadowModified()
{ {
return fontFormatting.isFontOutlineModified(); return fontFormatting.isFontShadowModified();
} }
/** /**
* @return true if font shadow type was modified from default * @return true if font style was modified from default
*/ */
public boolean isFontShadowModified() public boolean isFontStyleModified()
{ {
return fontFormatting.isFontShadowModified(); return fontFormatting.isFontStyleModified();
} }
/** /**
* @return true if font style was modified from default * @return true if font style was set to <i>italic</i>
*/ */
public boolean isFontStyleModified() public boolean isItalic()
{ {
return fontFormatting.isFontStyleModified(); return fontFormatting.isFontStyleModified() && fontFormatting.isItalic();
} }
/** /**
* @return true if font style was set to <i>italic</i> * @return true if font outline is on
*/ */
public boolean isItalic() public boolean isOutlineOn()
{ {
return fontFormatting.isFontStyleModified() && fontFormatting.isItalic(); return fontFormatting.isFontOutlineModified() && fontFormatting.isOutlineOn();
} }
/** /**
* @return true if font outline is on * @return true if font shadow is on
*/ */
public boolean isOutlineOn() public boolean isShadowOn()
{ {
return fontFormatting.isFontOutlineModified() && fontFormatting.isOutlineOn(); return fontFormatting.isFontOutlineModified() && fontFormatting.isShadowOn();
} }
/** /**
* @return true if font shadow is on * @return true if font strikeout is on
*/ */
public boolean isShadowOn() public boolean isStruckout()
{ {
return fontFormatting.isFontOutlineModified() && fontFormatting.isShadowOn(); return fontFormatting.isFontCancellationModified() && fontFormatting.isStruckout();
} }
/** /**
* @return true if font strikeout is on * @return true if font underline type was modified from default
*/ */
public boolean isStruckout() public boolean isUnderlineTypeModified()
{ {
return fontFormatting.isFontCancellationModified() && fontFormatting.isStruckout(); return fontFormatting.isUnderlineTypeModified();
} }
/** /**
* @return true if font underline type was modified from default * @return true if font weight was modified from default
*/ */
public boolean isUnderlineTypeModified() public boolean isFontWeightModified()
{ {
return fontFormatting.isUnderlineTypeModified(); return fontFormatting.isFontWeightModified();
} }
/** /**
* @return true if font weight was modified from default * set font style options.
*/ *
public boolean isFontWeightModified() * @param italic - if true, set posture style to italic, otherwise to normal
{ * @param bold if true, set font weight to bold, otherwise to normal
return fontFormatting.isFontWeightModified(); */
}
/** public void setFontStyle(boolean italic, boolean bold)
* set font style options. {
* boolean modified = italic || bold;
* @param italic - if true, set posture style to italic, otherwise to normal fontFormatting.setItalic(italic);
* @param bold if true, set font weight to bold, otherwise to normal fontFormatting.setBold(bold);
*/ fontFormatting.setFontStyleModified(modified);
fontFormatting.setFontWieghtModified(modified);
public void setFontStyle(boolean italic, boolean bold) }
{
boolean modified = italic || bold;
fontFormatting.setItalic(italic);
fontFormatting.setBold(bold);
fontFormatting.setFontStyleModified(modified);
fontFormatting.setFontWieghtModified(modified);
}
/** /**
* set font style options to default values (non-italic, non-bold) * set font style options to default values (non-italic, non-bold)
*/ */
public void resetFontStyle() public void resetFontStyle()
{ {
setFontStyle(false,false); setFontStyle(false,false);
} }
/** /**
* set the escapement type for the font * set the escapement type for the font
* *
* @param escapementType super or subscript option * @param escapementType super or subscript option
* @see #SS_NONE * @see #SS_NONE
* @see #SS_SUPER * @see #SS_SUPER
* @see #SS_SUB * @see #SS_SUB
*/ */
public void setEscapementType(short escapementType) public void setEscapementType(short escapementType) {
{ switch(escapementType) {
switch(escapementType) case HSSFFontFormatting.SS_SUB:
{ case HSSFFontFormatting.SS_SUPER:
case HSSFFontFormatting.SS_SUB: fontFormatting.setEscapementType(escapementType);
case HSSFFontFormatting.SS_SUPER: fontFormatting.setEscapementTypeModified(true);
fontFormatting.setEscapementType(escapementType); break;
fontFormatting.setEscapementTypeModified(true); case HSSFFontFormatting.SS_NONE:
break; fontFormatting.setEscapementType(escapementType);
case HSSFFontFormatting.SS_NONE: fontFormatting.setEscapementTypeModified(false);
fontFormatting.setEscapementType(escapementType); break;
fontFormatting.setEscapementTypeModified(false); default:
break; }
default: }
}
}
/** /**
* @param modified * @param modified
* @see org.apache.poi.hssf.record.cf.FontFormatting#setEscapementTypeModified(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setEscapementTypeModified(boolean)
*/ */
public void setEscapementTypeModified(boolean modified) public void setEscapementTypeModified(boolean modified) {
{ fontFormatting.setEscapementTypeModified(modified);
fontFormatting.setEscapementTypeModified(modified); }
}
/** /**
* @param modified * @param modified
* @see org.apache.poi.hssf.record.cf.FontFormatting#setFontCancellationModified(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontCancellationModified(boolean)
*/ */
public void setFontCancellationModified(boolean modified) public void setFontCancellationModified(boolean modified)
{ {
fontFormatting.setFontCancellationModified(modified); fontFormatting.setFontCancellationModified(modified);
} }
/** /**
* @param fci * @param fci
* @see org.apache.poi.hssf.record.cf.FontFormatting#setFontColorIndex(short) * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontColorIndex(short)
*/ */
public void setFontColorIndex(short fci) public void setFontColorIndex(short fci)
{ {
fontFormatting.setFontColorIndex(fci); fontFormatting.setFontColorIndex(fci);
} }
/** /**
* @param height * @param height
* @see org.apache.poi.hssf.record.cf.FontFormatting#setFontHeight(int) * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontHeight(int)
*/ */
public void setFontHeight(int height) public void setFontHeight(int height)
{ {
fontFormatting.setFontHeight(height); fontFormatting.setFontHeight(height);
} }
/** /**
* @param modified * @param modified
* @see org.apache.poi.hssf.record.cf.FontFormatting#setFontOutlineModified(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontOutlineModified(boolean)
*/ */
public void setFontOutlineModified(boolean modified) public void setFontOutlineModified(boolean modified)
{ {
fontFormatting.setFontOutlineModified(modified); fontFormatting.setFontOutlineModified(modified);
} }
/** /**
* @param modified * @param modified
* @see org.apache.poi.hssf.record.cf.FontFormatting#setFontShadowModified(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontShadowModified(boolean)
*/ */
public void setFontShadowModified(boolean modified) public void setFontShadowModified(boolean modified)
{ {
fontFormatting.setFontShadowModified(modified); fontFormatting.setFontShadowModified(modified);
} }
/** /**
* @param modified * @param modified
* @see org.apache.poi.hssf.record.cf.FontFormatting#setFontStyleModified(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontStyleModified(boolean)
*/ */
public void setFontStyleModified(boolean modified) public void setFontStyleModified(boolean modified)
{ {
fontFormatting.setFontStyleModified(modified); fontFormatting.setFontStyleModified(modified);
} }
/** /**
* @param on * @param on
* @see org.apache.poi.hssf.record.cf.FontFormatting#setOutline(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setOutline(boolean)
*/ */
public void setOutline(boolean on) public void setOutline(boolean on)
{ {
fontFormatting.setOutline(on); fontFormatting.setOutline(on);
fontFormatting.setFontOutlineModified(on); fontFormatting.setFontOutlineModified(on);
} }
/** /**
* @param on * @param on
* @see org.apache.poi.hssf.record.cf.FontFormatting#setShadow(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setShadow(boolean)
*/ */
public void setShadow(boolean on) public void setShadow(boolean on)
{ {
fontFormatting.setShadow(on); fontFormatting.setShadow(on);
fontFormatting.setFontShadowModified(on); fontFormatting.setFontShadowModified(on);
} }
/** /**
* @param strike * @param strike
* @see org.apache.poi.hssf.record.cf.FontFormatting#setStrikeout(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setStrikeout(boolean)
*/ */
public void setStrikeout(boolean strike) public void setStrikeout(boolean strike)
{ {
fontFormatting.setStrikeout(strike); fontFormatting.setStrikeout(strike);
fontFormatting.setFontCancellationModified(strike); fontFormatting.setFontCancellationModified(strike);
} }
/** /**
* set the type of underlining type for the font * set the type of underlining type for the font
* *
* @param underlineType super or subscript option * @param underlineType super or subscript option
* *
* @see #U_NONE * @see #U_NONE
* @see #U_SINGLE * @see #U_SINGLE
* @see #U_DOUBLE * @see #U_DOUBLE
* @see #U_SINGLE_ACCOUNTING * @see #U_SINGLE_ACCOUNTING
* @see #U_DOUBLE_ACCOUNTING * @see #U_DOUBLE_ACCOUNTING
*/ */
public void setUnderlineType(short underlineType) public void setUnderlineType(short underlineType) {
{ switch(underlineType) {
switch(underlineType) case HSSFFontFormatting.U_SINGLE:
{ case HSSFFontFormatting.U_DOUBLE:
case HSSFFontFormatting.U_SINGLE: case HSSFFontFormatting.U_SINGLE_ACCOUNTING:
case HSSFFontFormatting.U_DOUBLE: case HSSFFontFormatting.U_DOUBLE_ACCOUNTING:
case HSSFFontFormatting.U_SINGLE_ACCOUNTING: fontFormatting.setUnderlineType(underlineType);
case HSSFFontFormatting.U_DOUBLE_ACCOUNTING: setUnderlineTypeModified(true);
fontFormatting.setUnderlineType(underlineType); break;
setUnderlineTypeModified(true);
break; case HSSFFontFormatting.U_NONE:
fontFormatting.setUnderlineType(underlineType);
case HSSFFontFormatting.U_NONE: setUnderlineTypeModified(false);
fontFormatting.setUnderlineType(underlineType); break;
setUnderlineTypeModified(false); default:
break; }
default: }
}
}
/** /**
* @param modified * @param modified
* @see org.apache.poi.hssf.record.cf.FontFormatting#setUnderlineTypeModified(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setUnderlineTypeModified(boolean)
*/ */
public void setUnderlineTypeModified(boolean modified) public void setUnderlineTypeModified(boolean modified)
{ {
fontFormatting.setUnderlineTypeModified(modified); fontFormatting.setUnderlineTypeModified(modified);
} }
} }

View File

@ -22,9 +22,6 @@ package org.apache.poi.ss.usermodel;
/** /**
* High level representation for Font Formatting component * High level representation for Font Formatting component
* of Conditional Formatting settings * of Conditional Formatting settings
*
* @author Dmitriy Kumshayev
* @author Yegor Kozlov
*/ */
public interface FontFormatting { public interface FontFormatting {
/** Escapement type - None */ /** Escapement type - None */