/** @param partition where to remove this style from */ public void removeStyle(BasePartition partition) { partition.setStyleMask(partition.getStyleMask() & ~mask); if (color != null) partition.setColorRGB(null); if (bgColor != null) partition.setBgColorRGB(null); if (fontDataName != null && fontDataName != NORMAL_FONT_NAME) partition.setFontDataName(NORMAL_FONT_NAME); }
/** @param partition where to apply this style to */ public void applyStyle(BasePartition partition) { if ((mask & FontStyle.SUB) != 0) partition.setSup(false); if ((mask & FontStyle.SUP) != 0) partition.setSub(false); partition.setStyleMask(partition.getStyleMask() | mask); if (color != null) partition.setColorRGB(color); if (bgColor != null) partition.setBgColorRGB(bgColor); if (fontDataName != null) partition.setFontDataName(fontDataName); }
/** * @param partition where to remove this style from * @return true, if this style is applied to partition */ public boolean isApplied(BasePartition partition) { if ((partition.getStyleMask() & mask) > 0) return true; return false; }
/** @param partition where to set this style to */ public void setStyle(BasePartition partition) { partition.setStyleMask(mask); partition.setColorRGB(color); partition.setBgColorRGB(bgColor); partition.setFontDataName(fontDataName); }
/** * Constructor for copying style from some partition * * @param partition Partition to copy style from */ public FontStyle(BasePartition partition) { this.mask = partition.getStyleMask(); this.color = partition.getColorRGB(); this.bgColor = partition.getBgColorRGB(); this.fontDataName = partition.getFontDataName(); }