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,90 +23,86 @@ 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() { public static final int NO_INTERSECTION = 1;
// no instance of this class public static final int OVERLAP = 2;
} /** first range is within the second range */
public static final int INSIDE = 3;
/** first range encloses or is equal to the second */
public static final int ENCLOSES = 4;
public static final int NO_INTERSECTION = 1; /**
public static final int OVERLAP = 2; * Intersect this range with the specified range.
/** first range is within the second range */ *
public static final int INSIDE = 3; * @param crB - the specified range
/** first range encloses or is equal to the second */ * @return code which reflects how the specified range is related to this range.<br/>
public static final int ENCLOSES = 4; * Possible return codes are:
* NO_INTERSECTION - the specified range is outside of this range;<br/>
* OVERLAP - both ranges partially overlap;<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 )
{
/** int firstRow = crB.getFirstRow();
* Intersect this range with the specified range. int lastRow = crB.getLastRow();
* int firstCol = crB.getFirstColumn();
* @param crB - the specified range int lastCol = crB.getLastColumn();
* @return code which reflects how the specified range is related to this range.<br/>
* Possible return codes are:
* NO_INTERSECTION - the specified range is outside of this range;<br/>
* OVERLAP - both ranges partially overlap;<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 )
{
int firstRow = crB.getFirstRow(); if
int lastRow = crB.getLastRow(); (
int firstCol = crB.getFirstColumn();
int lastCol = crB.getLastColumn();
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>
/** * <li>if a cell range is completely inside of another cell range, it gets removed from the list
* Do all possible cell merges between cells of the list so that:<br> * <li>if two cells have a shared border, merge them into one bigger cell range
* <li>if a cell range is completely inside of another cell range, it gets removed from the list * @param cellRanges
* <li>if two cells have a shared border, merge them into one bigger cell range * @return updated List of cell ranges
* @param cellRanges */
* @return updated List of cell ranges public static CellRangeAddress[] mergeCellRanges(CellRangeAddress[] cellRanges) {
*/ if(cellRanges.length < 1) {
public static CellRangeAddress[] mergeCellRanges(CellRangeAddress[] cellRanges) { return cellRanges;
if(cellRanges.length < 1) { }
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;
@ -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) {
CellRangeAddress[] result = new CellRangeAddress[temp.size()];
temp.toArray(result);
return result;
}
private static CellRangeAddress[] toArray(List<CellRangeAddress> temp) { /**
CellRangeAddress[] result = new CellRangeAddress[temp.size()]; * Check if the specified range is located inside of this cell range.
temp.toArray(result); *
return result; * @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 ||
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 ||
* Check if the specified range is located inside of this cell range. oFirstCol>0 && crA.getLastColumn() == oFirstCol -1) {
* // ranges have a vertical border in common
* @param crB // make sure rows are identical:
* @return true if this cell range contains the argument range inside if it's area return crA.getFirstRow() == oFirstRow && crA.getLastRow() == oLastRow;
*/ }
public static boolean contains(CellRangeAddress crA, CellRangeAddress crB) return false;
{ }
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. * Create an enclosing CellRange for the two cell ranges.
* *
* @return <code>true</code> if the ranges have a complete shared border (i.e. * @return enclosing CellRange
* the two ranges together make a simple rectangular region. */
*/ public static CellRangeAddress createEnclosingCellRange(CellRangeAddress crA, CellRangeAddress crB) {
public static boolean hasExactSharedBorder(CellRangeAddress crA, CellRangeAddress crB) { if( crB == null) {
int oFirstRow = crB.getFirstRow(); return crA.copy();
int oLastRow = crB.getLastRow(); }
int oFirstCol = crB.getFirstColumn();
int oLastCol = crB.getLastColumn();
if (crA.getFirstRow() > 0 && crA.getFirstRow()-1 == oLastRow || return new CellRangeAddress(
oFirstRow > 0 && oFirstRow-1 == crA.getLastRow()) { lt(crB.getFirstRow(), crA.getFirstRow()) ?crB.getFirstRow() :crA.getFirstRow(),
// ranges have a horizontal border in common gt(crB.getLastRow(), crA.getLastRow()) ?crB.getLastRow() :crA.getLastRow(),
// make sure columns are identical: lt(crB.getFirstColumn(),crA.getFirstColumn())?crB.getFirstColumn():crA.getFirstColumn(),
return crA.getFirstColumn() == oFirstCol && crA.getLastColumn() == oLastCol; gt(crB.getLastColumn(), crA.getLastColumn()) ?crB.getLastColumn() :crA.getLastColumn()
} );
}
if (crA.getFirstColumn()>0 && crA.getFirstColumn() - 1 == oLastCol || /**
oFirstCol>0 && crA.getLastColumn() == oFirstCol -1) { * @return true if a < b
// ranges have a vertical border in common */
// make sure rows are identical: private static boolean lt(int a, int b)
return crA.getFirstRow() == oFirstRow && crA.getLastRow() == oLastRow; {
} return a == -1 ? false : (b == -1 ? true : a < b);
return false; }
}
/** /**
* Create an enclosing CellRange for the two cell ranges. * @return true if a <= b
* */
* @return enclosing CellRange private static boolean le(int a, int b)
*/ {
public static CellRangeAddress createEnclosingCellRange(CellRangeAddress crA, CellRangeAddress crB) { return a == b || lt(a,b);
if( crB == null) { }
return crA.copy();
}
return /**
new CellRangeAddress( * @return true if a > b
lt(crB.getFirstRow(), crA.getFirstRow()) ?crB.getFirstRow() :crA.getFirstRow(), */
gt(crB.getLastRow(), crA.getLastRow()) ?crB.getLastRow() :crA.getLastRow(), private static boolean gt(int a, int b)
lt(crB.getFirstColumn(),crA.getFirstColumn())?crB.getFirstColumn():crA.getFirstColumn(), {
gt(crB.getLastColumn(), crA.getLastColumn()) ?crB.getLastColumn() :crA.getLastColumn() return lt(b,a);
); }
} /**
* @return true if a >= b
/** */
* @return true if a < b private static boolean ge(int a, int b)
*/ {
private static boolean lt(int a, int b) return !lt(a,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) protected HSSFFontFormatting(CFRuleBase cfRuleRecord, HSSFWorkbook workbook) {
{ this.fontFormatting = cfRuleRecord.getFontFormatting();
this.fontFormatting = cfRuleRecord.getFontFormatting(); this.workbook = workbook;
this.workbook = workbook; }
}
protected FontFormatting getFontFormattingBlock() protected FontFormatting getFontFormattingBlock() {
{ return fontFormatting;
return fontFormatting; }
}
/** /**
* get the type of super or subscript for the font * get the type of super or subscript for the font
* *
* @return super or subscript option * @return super or subscript option
* @see #SS_NONE * @see #SS_NONE
* @see #SS_SUPER * @see #SS_SUPER
* @see #SS_SUB * @see #SS_SUB
*/ */
public short getEscapementType() public short getEscapementType()
{ {
return fontFormatting.getEscapementType(); return fontFormatting.getEscapementType();
} }
/** /**
* @return font color index * @return font color index
*/ */
public short getFontColorIndex() public short getFontColorIndex()
{ {
return fontFormatting.getFontColorIndex(); return fontFormatting.getFontColorIndex();
} }
public HSSFColor getFontColor() { public HSSFColor getFontColor() {
return workbook.getCustomPalette().getColor( return workbook.getCustomPalette().getColor(
getFontColorIndex() getFontColorIndex()
); );
} }
@ -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) /**
{ * set font style options to default values (non-italic, non-bold)
boolean modified = italic || bold; */
fontFormatting.setItalic(italic); public void resetFontStyle()
fontFormatting.setBold(bold); {
fontFormatting.setFontStyleModified(modified); setFontStyle(false,false);
fontFormatting.setFontWieghtModified(modified); }
}
/** /**
* set font style options to default values (non-italic, non-bold) * set the escapement type for the font
*/ *
public void resetFontStyle() * @param escapementType super or subscript option
{ * @see #SS_NONE
setFontStyle(false,false); * @see #SS_SUPER
} * @see #SS_SUB
*/
public void setEscapementType(short escapementType) {
switch(escapementType) {
case HSSFFontFormatting.SS_SUB:
case HSSFFontFormatting.SS_SUPER:
fontFormatting.setEscapementType(escapementType);
fontFormatting.setEscapementTypeModified(true);
break;
case HSSFFontFormatting.SS_NONE:
fontFormatting.setEscapementType(escapementType);
fontFormatting.setEscapementTypeModified(false);
break;
default:
}
}
/** /**
* set the escapement type for the font * @param modified
* * @see org.apache.poi.hssf.record.cf.FontFormatting#setEscapementTypeModified(boolean)
* @param escapementType super or subscript option */
* @see #SS_NONE public void setEscapementTypeModified(boolean modified) {
* @see #SS_SUPER fontFormatting.setEscapementTypeModified(modified);
* @see #SS_SUB }
*/
public void setEscapementType(short escapementType)
{
switch(escapementType)
{
case HSSFFontFormatting.SS_SUB:
case HSSFFontFormatting.SS_SUPER:
fontFormatting.setEscapementType(escapementType);
fontFormatting.setEscapementTypeModified(true);
break;
case HSSFFontFormatting.SS_NONE:
fontFormatting.setEscapementType(escapementType);
fontFormatting.setEscapementTypeModified(false);
break;
default:
}
}
/** /**
* @param modified * @param modified
* @see org.apache.poi.hssf.record.cf.FontFormatting#setEscapementTypeModified(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontCancellationModified(boolean)
*/ */
public void setEscapementTypeModified(boolean modified) public void setFontCancellationModified(boolean modified)
{ {
fontFormatting.setEscapementTypeModified(modified); fontFormatting.setFontCancellationModified(modified);
} }
/** /**
* @param modified * @param fci
* @see org.apache.poi.hssf.record.cf.FontFormatting#setFontCancellationModified(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontColorIndex(short)
*/ */
public void setFontCancellationModified(boolean modified) public void setFontColorIndex(short fci)
{ {
fontFormatting.setFontCancellationModified(modified); fontFormatting.setFontColorIndex(fci);
} }
/** /**
* @param fci * @param height
* @see org.apache.poi.hssf.record.cf.FontFormatting#setFontColorIndex(short) * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontHeight(int)
*/ */
public void setFontColorIndex(short fci) public void setFontHeight(int height)
{ {
fontFormatting.setFontColorIndex(fci); fontFormatting.setFontHeight(height);
} }
/** /**
* @param height * @param modified
* @see org.apache.poi.hssf.record.cf.FontFormatting#setFontHeight(int) * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontOutlineModified(boolean)
*/ */
public void setFontHeight(int height) public void setFontOutlineModified(boolean modified)
{ {
fontFormatting.setFontHeight(height); fontFormatting.setFontOutlineModified(modified);
} }
/** /**
* @param modified * @param modified
* @see org.apache.poi.hssf.record.cf.FontFormatting#setFontOutlineModified(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontShadowModified(boolean)
*/ */
public void setFontOutlineModified(boolean modified) public void setFontShadowModified(boolean modified)
{ {
fontFormatting.setFontOutlineModified(modified); fontFormatting.setFontShadowModified(modified);
} }
/** /**
* @param modified * @param modified
* @see org.apache.poi.hssf.record.cf.FontFormatting#setFontShadowModified(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setFontStyleModified(boolean)
*/ */
public void setFontShadowModified(boolean modified) public void setFontStyleModified(boolean modified)
{ {
fontFormatting.setFontShadowModified(modified); fontFormatting.setFontStyleModified(modified);
} }
/** /**
* @param modified * @param on
* @see org.apache.poi.hssf.record.cf.FontFormatting#setFontStyleModified(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setOutline(boolean)
*/ */
public void setFontStyleModified(boolean modified) public void setOutline(boolean on)
{ {
fontFormatting.setFontStyleModified(modified); fontFormatting.setOutline(on);
} fontFormatting.setFontOutlineModified(on);
}
/** /**
* @param on * @param on
* @see org.apache.poi.hssf.record.cf.FontFormatting#setOutline(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setShadow(boolean)
*/ */
public void setOutline(boolean on) public void setShadow(boolean on)
{ {
fontFormatting.setOutline(on); fontFormatting.setShadow(on);
fontFormatting.setFontOutlineModified(on); fontFormatting.setFontShadowModified(on);
} }
/** /**
* @param on * @param strike
* @see org.apache.poi.hssf.record.cf.FontFormatting#setShadow(boolean) * @see org.apache.poi.hssf.record.cf.FontFormatting#setStrikeout(boolean)
*/ */
public void setShadow(boolean on) public void setStrikeout(boolean strike)
{ {
fontFormatting.setShadow(on); fontFormatting.setStrikeout(strike);
fontFormatting.setFontShadowModified(on); fontFormatting.setFontCancellationModified(strike);
} }
/** /**
* @param strike * set the type of underlining type for the font
* @see org.apache.poi.hssf.record.cf.FontFormatting#setStrikeout(boolean) *
*/ * @param underlineType super or subscript option
public void setStrikeout(boolean strike) *
{ * @see #U_NONE
fontFormatting.setStrikeout(strike); * @see #U_SINGLE
fontFormatting.setFontCancellationModified(strike); * @see #U_DOUBLE
} * @see #U_SINGLE_ACCOUNTING
* @see #U_DOUBLE_ACCOUNTING
*/
public void setUnderlineType(short underlineType) {
switch(underlineType) {
case HSSFFontFormatting.U_SINGLE:
case HSSFFontFormatting.U_DOUBLE:
case HSSFFontFormatting.U_SINGLE_ACCOUNTING:
case HSSFFontFormatting.U_DOUBLE_ACCOUNTING:
fontFormatting.setUnderlineType(underlineType);
setUnderlineTypeModified(true);
break;
/** case HSSFFontFormatting.U_NONE:
* set the type of underlining type for the font fontFormatting.setUnderlineType(underlineType);
* setUnderlineTypeModified(false);
* @param underlineType super or subscript option break;
* default:
* @see #U_NONE }
* @see #U_SINGLE }
* @see #U_DOUBLE
* @see #U_SINGLE_ACCOUNTING
* @see #U_DOUBLE_ACCOUNTING
*/
public void setUnderlineType(short underlineType)
{
switch(underlineType)
{
case HSSFFontFormatting.U_SINGLE:
case HSSFFontFormatting.U_DOUBLE:
case HSSFFontFormatting.U_SINGLE_ACCOUNTING:
case HSSFFontFormatting.U_DOUBLE_ACCOUNTING:
fontFormatting.setUnderlineType(underlineType);
setUnderlineTypeModified(true);
break;
case HSSFFontFormatting.U_NONE: /**
fontFormatting.setUnderlineType(underlineType); * @param modified
setUnderlineTypeModified(false); * @see org.apache.poi.hssf.record.cf.FontFormatting#setUnderlineTypeModified(boolean)
break; */
default: public void setUnderlineTypeModified(boolean modified)
} {
} fontFormatting.setUnderlineTypeModified(modified);
}
/**
* @param modified
* @see org.apache.poi.hssf.record.cf.FontFormatting#setUnderlineTypeModified(boolean)
*/
public void setUnderlineTypeModified(boolean 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 */