aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSaid Ryan Ackley <sackley@apache.org>2003-11-13 03:28:33 +0000
committerSaid Ryan Ackley <sackley@apache.org>2003-11-13 03:28:33 +0000
commita0ef8cee4319f9a430fd0f89250940b661a6f67d (patch)
treed74f5a46ed78cf282d51bae78184f51cce912f8e /src
parent2a22b330c257fbf2aab7354e7719a462e95431e4 (diff)
downloadpoi-a0ef8cee4319f9a430fd0f89250940b661a6f67d.tar.gz
poi-a0ef8cee4319f9a430fd0f89250940b661a6f67d.zip
latest changes
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353448 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java8
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/Range.java20
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPBinTable.java18
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPX.java15
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPieceTable.java55
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java58
-rw-r--r--src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java151
7 files changed, 250 insertions, 75 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java b/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java
index 154f8d7bd7..b901b6dfe2 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/HWPFDocument.java
@@ -64,6 +64,7 @@ import java.io.FileOutputStream;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.poifs.filesystem.DocumentEntry;
import org.apache.poi.poifs.common.POIFSConstants;
+import org.apache.poi.hwpf.usermodel.CharacterRun;
import org.apache.poi.hwpf.model.hdftypes.*;
import org.apache.poi.hwpf.model.io.*;
@@ -327,8 +328,13 @@ public class HWPFDocument
try
{
HWPFDocument doc = new HWPFDocument(new FileInputStream(args[0]));
+ CharacterRun run = new CharacterRun();
+ run.setBold(true);
+ run.setItalic(true);
+ run.setCapitalized(true);
+
Range range = doc.getRange();
- range.insertBefore("Hello World!!! HAHAHAHAHA I DID IT!!!");
+ range.insertBefore("Hello World!!! HAHAHAHAHA I DID IT!!!", run);
OutputStream out = new FileOutputStream(args[1]);
doc.write(out);
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/Range.java b/src/scratchpad/src/org/apache/poi/hwpf/Range.java
index 39fd0859d6..72936c0c55 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/Range.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/Range.java
@@ -77,6 +77,7 @@ import org.apache.poi.hwpf.model.hdftypes.TextPieceTable;
import org.apache.poi.hwpf.model.hdftypes.TextPiece;
import org.apache.poi.hwpf.sprm.CharacterSprmUncompressor;
+import org.apache.poi.hwpf.sprm.CharacterSprmCompressor;
import org.apache.poi.hwpf.sprm.SectionSprmUncompressor;
import org.apache.poi.hwpf.sprm.ParagraphSprmUncompressor;
@@ -194,7 +195,7 @@ public class Range
_doc.getCharacterTable().adjustForInsert(_textStart, adjustedLength);
_doc.getParagraphTable().adjustForInsert(_textStart, adjustedLength);
_doc.getSectionTable().adjustForInsert(_textStart, adjustedLength);
- return null;
+ return getCharacterRange(0);
}
public CharacterRange insertAfter(String text)
@@ -203,8 +204,19 @@ public class Range
}
public CharacterRange insertBefore(String text, CharacterRun cr)
+ throws UnsupportedEncodingException
{
- return null;
+ initAll();
+ PAPX papx = (PAPX)_paragraphs.get(_parStart);
+ short istd = papx.getIstd();
+
+ StyleSheet ss = _doc.getStyleSheet();
+ CharacterRun baseStyle = ss.getCharacterStyle(istd);
+
+ byte[] grpprl = CharacterSprmCompressor.compressCharacterProperty(cr, baseStyle);
+ _doc.getCharacterTable().insert(_charStart, _start, grpprl);
+
+ return insertBefore(text);
}
public CharacterRange insertAfter(String text, CharacterRun cr)
@@ -234,7 +246,7 @@ public class Range
chpx.getEnd());
List paragraphList = _paragraphs.subList(point[0], point[1]);
PAPX papx = (PAPX)paragraphList.get(0);
- short istd = LittleEndian.getShort(papx.getBuf());
+ short istd = papx.getIstd();
StyleSheet sd = _doc.getStyleSheet();
CharacterRun baseStyle = sd.getCharacterStyle(istd);
@@ -260,7 +272,7 @@ public class Range
public Paragraph getParagraph(int index)
{
initParagraphs();
- PAPX papx = (PAPX)_sections.get(index + _parStart);
+ PAPX papx = (PAPX)_paragraphs.get(index + _parStart);
Paragraph pap = (Paragraph)papx.getCacheContents();
if (pap == null)
{
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPBinTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPBinTable.java
index cb1016ee56..745e9db781 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPBinTable.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/CHPBinTable.java
@@ -147,6 +147,24 @@ public class CHPBinTable
}
}
+ public void insert(int listIndex, int cpStart, byte[] grpprl)
+ {
+ CHPX insertChpx = new CHPX(cpStart, cpStart, grpprl);
+ CHPX chpx = (CHPX)_textRuns.get(listIndex);
+ if (chpx.getStart() < cpStart)
+ {
+ CHPX clone = new CHPX(cpStart, chpx.getEnd(), chpx.getGrpprl());
+ chpx.setEnd(cpStart);
+
+ _textRuns.add(listIndex + 1, insertChpx);
+ _textRuns.add(listIndex + 2, clone);
+ }
+ else
+ {
+ _textRuns.add(listIndex, insertChpx);
+ }
+ }
+
public void adjustForInsert(int listIndex, int length)
{
int size = _textRuns.size();
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPX.java b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPX.java
index 0d76518464..9eb9f1017f 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPX.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/PAPX.java
@@ -56,6 +56,8 @@
package org.apache.poi.hwpf.model.hdftypes;
+import org.apache.poi.util.LittleEndian;
+
import org.apache.poi.hwpf.usermodel.Paragraph;
import org.apache.poi.hwpf.sprm.SprmBuffer;
@@ -91,6 +93,19 @@ public class PAPX extends PropertyNode
return getGrpprl();
}
+ public short getIstd()
+ {
+ byte[] buf = getGrpprl();
+ if (buf.length == 0)
+ {
+ return 0;
+ }
+ else
+ {
+ return LittleEndian.getShort(buf);
+ }
+ }
+
public boolean equals(Object o)
{
if (super.equals(o))
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPieceTable.java b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPieceTable.java
index c6ccb1c3ad..23308b5421 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPieceTable.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/model/hdftypes/TextPieceTable.java
@@ -68,7 +68,7 @@ import org.apache.poi.hwpf.model.io.*;
public class TextPieceTable
{
ArrayList _textPieces = new ArrayList();
- int _multiple;
+ //int _multiple;
int _cpMin;
public TextPieceTable(byte[] documentStream, byte[] tableStream, int offset,
@@ -78,7 +78,7 @@ public class TextPieceTable
// get our plex of PieceDescriptors
PlexOfCps pieceTable = new PlexOfCps(tableStream, offset, size, PieceDescriptor.getSizeInBytes());
- _multiple = 2;
+ //_multiple = 2;
int length = pieceTable.length();
PieceDescriptor[] pieces = new PieceDescriptor[length];
@@ -89,31 +89,45 @@ public class TextPieceTable
PropertyNode node = pieceTable.getProperty(x);
pieces[x] = new PieceDescriptor(node.getBuf(), 0);
- if (!pieces[x].isUnicode())
- {
- _multiple = 1;
- }
+// if (!pieces[x].isUnicode())
+// {
+// _multiple = 1;
+// }
}
_cpMin = pieces[0].getFilePosition() - fcMin;
+ // if a piece is unicode the actual offset may be bumped because of the
+ // doubling of the needed size.
+ int bump = 0;
+
// using the PieceDescriptors, build our list of TextPieces.
for (int x = 0; x < pieces.length; x++)
{
int start = pieces[x].getFilePosition();
PropertyNode node = pieceTable.getProperty(x);
int nodeStart = node.getStart();
+
// multiple will be 2 if there is only one piece and its unicode. Some
// type of optimization.
- int nodeEnd = ((node.getEnd() - nodeStart) * _multiple) + nodeStart;
+ boolean unicode = pieces[x].isUnicode();
+
+ int multiple = 1;
+ if (unicode)
+ {
+ multiple = 2;
+ }
+ int nodeEnd = ((node.getEnd() - nodeStart) * multiple) + nodeStart;
int textSize = nodeEnd - nodeStart;
- boolean unicode = pieces[x].isUnicode();
- String toStr = null;
- byte[] buf = new byte[textSize + (unicode ? textSize % 2 : 0)];
+ byte[] buf = new byte[textSize];
System.arraycopy(documentStream, start, buf, 0, textSize);
- _textPieces.add(new TextPiece(nodeStart, nodeEnd, buf, pieces[x]));
+ _textPieces.add(new TextPiece(nodeStart + bump, nodeEnd + bump, buf, pieces[x]));
+ if (unicode)
+ {
+ bump += (node.getEnd() - nodeStart);
+ }
}
}
@@ -135,6 +149,7 @@ public class TextPieceTable
//int fcMin = docStream.getOffset();
int size = _textPieces.size();
+ int bumpDown = 0;
for (int x = 0; x < size; x++)
{
TextPiece next = (TextPiece)_textPieces.get(x);
@@ -145,12 +160,24 @@ public class TextPieceTable
// write the text to the docstream and save the piece descriptor to the
// plex which will be written later to the tableStream.
+ //if (_multiple == 1 && pd.isUnicode() &&
docStream.write(next.getBuf());
int nodeStart = next.getStart();
- textPlex.addProperty(new PropertyNode(nodeStart,
- (next.getEnd() - nodeStart)/_multiple + nodeStart,
- pd.toByteArray()));
+ int multiple = 1;
+ if (pd.isUnicode())
+ {
+ multiple = 2;
+ }
+ textPlex.addProperty(new PropertyNode(nodeStart - bumpDown,
+ ((next.getEnd() - nodeStart)/multiple + nodeStart) - bumpDown,
+ pd.toByteArray()));
+
+ if (pd.isUnicode())
+ {
+ bumpDown += ((next.getEnd() - nodeStart)/multiple);
+ }
+
}
diff --git a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java
index adde0e28ce..800c535f0c 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterProperties.java
@@ -113,8 +113,6 @@ public class CharacterProperties
public final static short SPRM_FELID = 0x486E;
public final static short SPRM_IDCTHINT = 0x286F;
-
- StyleDescription _baseStyle;
SprmBuffer _chpx;
public CharacterProperties()
@@ -141,7 +139,7 @@ public class CharacterProperties
public void markDeleted(boolean mark)
{
- if (mark != isFRMarkDel())
+ if (_chpx != null && mark != isFRMarkDel())
{
byte newVal = (byte)(mark ? 1 : 0);
_chpx.addSprm(SPRM_FRMARKDEL, newVal);
@@ -156,7 +154,7 @@ public class CharacterProperties
public void setBold(boolean bold)
{
- if (bold != isFBold())
+ if (_chpx != null && bold != isFBold())
{
byte newVal = (byte)(bold ? 1 : 0);
_chpx.addSprm(SPRM_FBOLD, newVal);
@@ -171,7 +169,7 @@ public class CharacterProperties
public void setItalic(boolean italic)
{
- if (italic != isFItalic())
+ if (_chpx != null && italic != isFItalic())
{
byte newVal = (byte)(italic ? 1 : 0);
_chpx.addSprm(SPRM_FITALIC, newVal);
@@ -186,7 +184,7 @@ public class CharacterProperties
public void setOutline(boolean outlined)
{
- if (outlined != isFOutline())
+ if (_chpx != null && outlined != isFOutline())
{
byte newVal = (byte)(outlined ? 1 : 0);
_chpx.addSprm(SPRM_FOUTLINE, newVal);
@@ -202,7 +200,7 @@ public class CharacterProperties
public void setFldVanish(boolean fldVanish)
{
- if (fldVanish != isFFldVanish())
+ if (_chpx != null && fldVanish != isFFldVanish())
{
byte newVal = (byte)(fldVanish ? 1 : 0);
_chpx.addSprm(SPRM_FFLDVANISH, newVal);
@@ -217,7 +215,7 @@ public class CharacterProperties
public void setSmallCaps(boolean smallCaps)
{
- if (smallCaps != isFSmallCaps())
+ if (_chpx != null && smallCaps != isFSmallCaps())
{
byte newVal = (byte)(smallCaps ? 1 : 0);
_chpx.addSprm(SPRM_FSMALLCAPS, newVal);
@@ -231,7 +229,7 @@ public class CharacterProperties
public void setCapitalized(boolean caps)
{
- if (caps != isFCaps())
+ if (_chpx != null && caps != isFCaps())
{
byte newVal = (byte)(caps ? 1 : 0);
_chpx.addSprm(SPRM_FCAPS, newVal);
@@ -246,7 +244,7 @@ public class CharacterProperties
public void setVanished(boolean vanish)
{
- if (vanish != isFVanish())
+ if (_chpx != null && vanish != isFVanish())
{
byte newVal = (byte)(vanish ? 1 : 0);
_chpx.addSprm(SPRM_FVANISH, newVal);
@@ -261,7 +259,7 @@ public class CharacterProperties
public void markInserted(boolean mark)
{
- if (mark != isFRMark())
+ if (_chpx != null && mark != isFRMark())
{
byte newVal = (byte)(mark ? 1 : 0);
_chpx.addSprm(SPRM_FRMARK, newVal);
@@ -276,7 +274,7 @@ public class CharacterProperties
public void strikeThrough(boolean strike)
{
- if (strike != isFStrike())
+ if (_chpx != null && strike != isFStrike())
{
byte newVal = (byte)(strike ? 1 : 0);
_chpx.addSprm(SPRM_FSTRIKE, newVal);
@@ -291,7 +289,7 @@ public class CharacterProperties
public void setShadow(boolean shadow)
{
- if (shadow != isFShadow())
+ if (_chpx != null && shadow != isFShadow())
{
byte newVal = (byte)(shadow ? 1 : 0);
_chpx.addSprm(SPRM_FSHADOW, newVal);
@@ -307,7 +305,7 @@ public class CharacterProperties
public void setEmbossed(boolean emboss)
{
- if (emboss != isFEmboss())
+ if (_chpx != null && emboss != isFEmboss())
{
byte newVal = (byte)(emboss ? 1 : 0);
_chpx.addSprm(SPRM_FEMBOSS, newVal);
@@ -323,11 +321,11 @@ public class CharacterProperties
public void setImprinted(boolean imprint)
{
- if (imprint != isFImprint())
+ super.setFImprint(imprint);
+ if (_chpx != null && imprint != isFImprint())
{
byte newVal = (byte)(imprint ? 1 : 0);
_chpx.addSprm(SPRM_FIMPRINT, newVal);
- super.setFImprint(imprint);
}
}
@@ -339,39 +337,39 @@ public class CharacterProperties
public void setDoubleStrikethrough(boolean dstrike)
{
- if (dstrike != isFDStrike())
+ super.setFDStrike(dstrike);
+ if (_chpx != null && dstrike != isFDStrike())
{
byte newVal = (byte)(dstrike ? 1 : 0);
_chpx.addSprm(SPRM_FDSTRIKE, newVal);
- super.setFDStrike(dstrike);
}
}
public void setFtcAscii(int ftcAscii)
{
- if (ftcAscii != getFtcAscii())
+ super.setFtcAscii(ftcAscii);
+ if (_chpx != null && ftcAscii != getFtcAscii())
{
_chpx.addSprm(SPRM_RGFTCASCII, (short)ftcAscii);
}
- super.setFtcAscii(ftcAscii);
}
public void setFtcFE(int ftcFE)
{
- if (ftcFE != getFtcFE())
+ super.setFtcFE(ftcFE);
+ if (_chpx != null && ftcFE != getFtcFE())
{
_chpx.addSprm(SPRM_RGFTCFAREAST, (short)ftcFE);
}
- super.setFtcFE(ftcFE);
}
public void setFtcOther(int ftcOther)
{
- if (ftcOther != getFtcOther())
+ super.setFtcOther(ftcOther);
+ if (_chpx != null && ftcOther != getFtcOther())
{
_chpx.addSprm(SPRM_RGFTCNOTFAREAST, (short)ftcOther);
}
- super.setFtcOther(ftcOther);
}
public int getFontSize()
@@ -381,10 +379,10 @@ public class CharacterProperties
public void setFontSize(int halfPoints)
{
- if (halfPoints != getHps())
+ super.setHps(halfPoints);
+ if (_chpx != null && halfPoints != getHps())
{
_chpx.addSprm(SPRM_HPS, (short)halfPoints);
- super.setHps(halfPoints);
}
}
@@ -395,10 +393,10 @@ public class CharacterProperties
public void setCharacterSpacing(int twips)
{
- if (twips != getDxaSpace())
+ super.setDxaSpace(twips);
+ if (_chpx != null && twips != getDxaSpace())
{
_chpx.addSprm(SPRM_DXASPACE, twips);
- super.setDxaSpace(twips);
}
}
@@ -409,10 +407,10 @@ public class CharacterProperties
public void setSubSuperScriptIndex(short iss)
{
- if (iss != getIss())
+ super.setDxaSpace(iss);
+ if (_chpx != null && iss != getIss())
{
_chpx.addSprm(SPRM_DXASPACE, iss);
- super.setDxaSpace(iss);
}
}
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 8a9d66682b..aa67b8e68a 100644
--- a/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java
+++ b/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java
@@ -113,8 +113,6 @@ public class CharacterRun
public final static short SPRM_FELID = 0x486E;
public final static short SPRM_IDCTHINT = 0x286F;
-
- StyleDescription _baseStyle;
SprmBuffer _chpx;
public CharacterRun()
@@ -141,11 +139,11 @@ public class CharacterRun
public void markDeleted(boolean mark)
{
- if (mark != isFRMarkDel() && mark != _baseStyle.getCHP().isFRMarkDel())
+ super.setFRMarkDel(mark);
+ if (_chpx != null && mark != isFRMarkDel())
{
byte newVal = (byte)(mark ? 1 : 0);
_chpx.addSprm(SPRM_FRMARKDEL, newVal);
- super.setFRMarkDel(mark);
}
}
@@ -156,11 +154,11 @@ public class CharacterRun
public void setBold(boolean bold)
{
- if (bold != isFBold() && bold != _baseStyle.getCHP().isFBold())
+ super.setFBold(bold);
+ if (_chpx != null && bold != isFBold())
{
byte newVal = (byte)(bold ? 1 : 0);
_chpx.addSprm(SPRM_FBOLD, newVal);
- super.setFBold(bold);
}
}
@@ -171,11 +169,11 @@ public class CharacterRun
public void setItalic(boolean italic)
{
- if (italic != isFItalic() && italic != _baseStyle.getCHP().isFItalic())
+ super.setFItalic(italic);
+ if (_chpx != null && italic != isFItalic())
{
byte newVal = (byte)(italic ? 1 : 0);
_chpx.addSprm(SPRM_FITALIC, newVal);
- super.setFItalic(italic);
}
}
@@ -186,11 +184,11 @@ public class CharacterRun
public void setOutline(boolean outlined)
{
- if (outlined != isFOutline() && outlined != _baseStyle.getCHP().isFOutline())
+ super.setFOutline(outlined);
+ if (_chpx != null && outlined != isFOutline())
{
byte newVal = (byte)(outlined ? 1 : 0);
_chpx.addSprm(SPRM_FOUTLINE, newVal);
- super.setFOutline(outlined);
}
}
@@ -202,11 +200,11 @@ public class CharacterRun
public void setFldVanish(boolean fldVanish)
{
- if (fldVanish != isFFldVanish() && fldVanish != _baseStyle.getCHP().isFFldVanish())
+ super.setFFldVanish(fldVanish);
+ if (_chpx != null && fldVanish != isFFldVanish())
{
byte newVal = (byte)(fldVanish ? 1 : 0);
_chpx.addSprm(SPRM_FFLDVANISH, newVal);
- super.setFFldVanish(fldVanish);
}
}
@@ -217,11 +215,11 @@ public class CharacterRun
public void setSmallCaps(boolean smallCaps)
{
- if (smallCaps != isFSmallCaps() && smallCaps != _baseStyle.getCHP().isFSmallCaps())
+ super.setFSmallCaps(smallCaps);
+ if (_chpx != null && smallCaps != isFSmallCaps())
{
byte newVal = (byte)(smallCaps ? 1 : 0);
_chpx.addSprm(SPRM_FSMALLCAPS, newVal);
- super.setFSmallCaps(smallCaps);
}
}
public boolean isCapitalized()
@@ -231,11 +229,11 @@ public class CharacterRun
public void setCapitalized(boolean caps)
{
- if (caps != isFCaps() && caps != _baseStyle.getCHP().isFCaps())
+ super.setFCaps(caps);
+ if (_chpx != null && caps != isFCaps())
{
byte newVal = (byte)(caps ? 1 : 0);
_chpx.addSprm(SPRM_FCAPS, newVal);
- super.setFCaps(caps);
}
}
@@ -246,11 +244,11 @@ public class CharacterRun
public void setVanished(boolean vanish)
{
- if (vanish != isFVanish() && vanish != _baseStyle.getCHP().isFVanish())
+ super.setFVanish(vanish);
+ if (_chpx != null && vanish != isFVanish())
{
byte newVal = (byte)(vanish ? 1 : 0);
_chpx.addSprm(SPRM_FVANISH, newVal);
- super.setFVanish(vanish);
}
}
@@ -261,11 +259,11 @@ public class CharacterRun
public void markInserted(boolean mark)
{
- if (mark != isFRMark() && mark != _baseStyle.getCHP().isFRMark())
+ super.setFRMark(mark);
+ if (_chpx != null && mark != isFRMark())
{
byte newVal = (byte)(mark ? 1 : 0);
_chpx.addSprm(SPRM_FRMARK, newVal);
- super.setFRMark(mark);
}
}
@@ -276,11 +274,11 @@ public class CharacterRun
public void strikeThrough(boolean strike)
{
- if (strike != isFStrike() && strike != _baseStyle.getCHP().isFStrike())
+ super.setFStrike(strike);
+ if (_chpx != null && strike != isFStrike())
{
byte newVal = (byte)(strike ? 1 : 0);
_chpx.addSprm(SPRM_FSTRIKE, newVal);
- super.setFStrike(strike);
}
}
@@ -291,11 +289,11 @@ public class CharacterRun
public void setShadow(boolean shadow)
{
- if (shadow != isFShadow() && shadow != _baseStyle.getCHP().isFShadow())
+ super.setFShadow(shadow);
+ if (_chpx != null && shadow != isFShadow())
{
byte newVal = (byte)(shadow ? 1 : 0);
_chpx.addSprm(SPRM_FSHADOW, newVal);
- super.setFShadow(shadow);
}
}
@@ -307,11 +305,112 @@ public class CharacterRun
public void setEmbossed(boolean emboss)
{
- if (emboss != isFEmboss() && emboss != _baseStyle.getCHP().isFEmboss())
+ super.setFEmboss(emboss);
+ if (_chpx != null && emboss != isFEmboss())
{
byte newVal = (byte)(emboss ? 1 : 0);
_chpx.addSprm(SPRM_FEMBOSS, newVal);
- super.setFEmboss(emboss);
+ }
+
+ }
+
+ public boolean isImprinted()
+ {
+ return isFImprint();
+ }
+
+ public void setImprinted(boolean imprint)
+ {
+ super.setFImprint(imprint);
+ if (_chpx != null && imprint != isFImprint())
+ {
+ byte newVal = (byte)(imprint ? 1 : 0);
+ _chpx.addSprm(SPRM_FIMPRINT, newVal);
+ }
+
+ }
+
+ public boolean isDoubleStrikeThrough()
+ {
+ return isFDStrike();
+ }
+
+ public void setDoubleStrikethrough(boolean dstrike)
+ {
+ super.setFDStrike(dstrike);
+ if (_chpx != null && dstrike != isFDStrike())
+ {
+ byte newVal = (byte)(dstrike ? 1 : 0);
+ _chpx.addSprm(SPRM_FDSTRIKE, newVal);
+ }
+ }
+
+ public void setFtcAscii(int ftcAscii)
+ {
+ super.setFtcAscii(ftcAscii);
+ if (_chpx != null && ftcAscii != getFtcAscii())
+ {
+ _chpx.addSprm(SPRM_RGFTCASCII, (short)ftcAscii);
+ }
+ }
+
+ public void setFtcFE(int ftcFE)
+ {
+ super.setFtcFE(ftcFE);
+ if (_chpx != null && ftcFE != getFtcFE())
+ {
+ _chpx.addSprm(SPRM_RGFTCFAREAST, (short)ftcFE);
+ }
+ }
+
+ public void setFtcOther(int ftcOther)
+ {
+ super.setFtcOther(ftcOther);
+ if (_chpx != null && ftcOther != getFtcOther())
+ {
+ _chpx.addSprm(SPRM_RGFTCNOTFAREAST, (short)ftcOther);
+ }
+ }
+
+ public int getFontSize()
+ {
+ return getHps();
+ }
+
+ public void setFontSize(int halfPoints)
+ {
+ super.setHps(halfPoints);
+ if (_chpx != null && halfPoints != getHps())
+ {
+ _chpx.addSprm(SPRM_HPS, (short)halfPoints);
+ }
+ }
+
+ public int getCharacterSpacing()
+ {
+ return getDxaSpace();
+ }
+
+ public void setCharacterSpacing(int twips)
+ {
+ super.setDxaSpace(twips);
+ if (_chpx != null && twips != getDxaSpace())
+ {
+ _chpx.addSprm(SPRM_DXASPACE, twips);
+ }
+ }
+
+ public short getSubSuperScriptIndex()
+ {
+ return getIss();
+ }
+
+ public void setSubSuperScriptIndex(short iss)
+ {
+ super.setDxaSpace(iss);
+ if (_chpx != null && iss != getIss())
+ {
+ _chpx.addSprm(SPRM_DXASPACE, iss);
}
}