made getHighlightColor() public, so convertor don't need to clone CHP info

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1147453 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-07-16 16:32:27 +00:00
parent c2c9ea3589
commit deb0c2eb68
2 changed files with 11 additions and 7 deletions

View File

@ -17,7 +17,6 @@
package org.apache.poi.hwpf.converter;
import org.apache.poi.hwpf.usermodel.BorderCode;
import org.apache.poi.hwpf.usermodel.CharacterProperties;
import org.apache.poi.hwpf.usermodel.CharacterRun;
import org.apache.poi.hwpf.usermodel.Paragraph;
import org.apache.poi.hwpf.usermodel.TableCell;
@ -33,7 +32,7 @@ public class WordToHtmlUtils extends AbstractWordUtils
public static void addBorder( BorderCode borderCode, String where,
StringBuilder style )
{
if ( borderCode == null || borderCode.getBorderType() == 0 )
if ( borderCode == null || borderCode.isEmpty() )
return;
if ( isEmpty( where ) )
@ -58,10 +57,7 @@ public class WordToHtmlUtils extends AbstractWordUtils
public static void addCharactersProperties(
final CharacterRun characterRun, StringBuilder style )
{
final CharacterProperties clonedProperties = characterRun
.cloneProperties();
addBorder( clonedProperties.getBrc(), EMPTY, style );
addBorder( characterRun.getBorder(), EMPTY, style );
if ( characterRun.isCapitalized() )
{
@ -70,7 +66,7 @@ public class WordToHtmlUtils extends AbstractWordUtils
if ( characterRun.isHighlighted() )
{
style.append( "background-color: "
+ getColor( clonedProperties.getIcoHighlight() ) + "; " );
+ getColor( characterRun.getHighlightedColor() ) + "; " );
}
if ( characterRun.isStrikeThrough() )
{

View File

@ -417,6 +417,11 @@ public final class CharacterRun
return _props.isFHighlight();
}
public byte getHighlightedColor()
{
return _props.getIcoHighlight();
}
public void setHighlighted(byte color)
{
_props.setFHighlight(true);
@ -533,7 +538,10 @@ public final class CharacterRun
/**
* clone the CharacterProperties object associated with this
* characterRun so that you can apply it to another CharacterRun
*
* @deprecated This method shall not be public and should not be called from high-level code
*/
@Deprecated
public CharacterProperties cloneProperties() {
try {
return (CharacterProperties)_props.clone();