From ed845ff18fafd925a55176337f44a315ac35eead Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Sat, 16 Jul 2011 16:32:27 +0000 Subject: [PATCH] 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 --- .../org/apache/poi/hwpf/converter/WordToHtmlUtils.java | 10 +++------- .../org/apache/poi/hwpf/usermodel/CharacterRun.java | 8 ++++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlUtils.java b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlUtils.java index 1642b46ac4..59a11753d0 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlUtils.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/converter/WordToHtmlUtils.java @@ -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() ) { diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java index 763ad2a638..d1ea206872 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java @@ -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(); -- 2.39.5