XWPF implementation of some common Paragraph methods

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1657717 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2015-02-05 23:31:59 +00:00
parent 483982caad
commit 25385edc38
2 changed files with 56 additions and 16 deletions

View File

@ -379,6 +379,17 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
jc.setVal(en);
}
/**
* @return The raw alignment value, {@link #getAlignment()} is suggested
*/
public int getFontAlignment() {
return getAlignment().getValue();
}
public void setFontAlignment(int align) {
ParagraphAlignment pAlign = ParagraphAlignment.valueOf(align);
setAlignment(pAlign);
}
/**
* Returns the text vertical alignment which shall be applied to text in
* this paragraph.
@ -942,7 +953,7 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
return (indentation != null && indentation.isSetLeft()) ? indentation.getLeft().intValue()
: -1;
}
/**
* Specifies the indentation which shall be placed between the right text
* margin for this paragraph and the right edge of that paragraph's content
@ -1061,6 +1072,27 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
: -1;
}
public int getIndentFromLeft() {
return getIndentFromLeft();
}
public void setIndentFromLeft(int dxaLeft) {
setIndentationLeft(dxaLeft);
}
public int getIndentFromRight() {
return getIndentFromRight();
}
public void setIndentFromRight(int dxaRight) {
setIndentationRight(dxaRight);
}
public int getFirstLineIndent() {
return getIndentationFirstLine();
}
public void setFirstLineIndent(int first) {
setIndentationFirstLine(first);
}
/**
* This element specifies whether a consumer shall break Latin text which
* exceeds the text extents of a line by breaking the word across two lines
@ -1069,7 +1101,7 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
*
* @param wrap - boolean
*/
public void setWordWrap(boolean wrap) {
public void setWordWrapped(boolean wrap) {
CTOnOff wordWrap = getCTPPr().isSetWordWrap() ? getCTPPr()
.getWordWrap() : getCTPPr().addNewWordWrap();
if (wrap)
@ -1077,6 +1109,10 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
else
wordWrap.unsetVal();
}
@Deprecated
public void setWordWrap(boolean wrap) {
setWordWrapped(wrap);
}
/**
* This element specifies whether a consumer shall break Latin text which
@ -1086,7 +1122,7 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
*
* @return boolean
*/
public boolean isWordWrap() {
public boolean isWordWrapped() {
CTOnOff wordWrap = getCTPPr().isSetWordWrap() ? getCTPPr()
.getWordWrap() : null;
if (wordWrap != null) {
@ -1096,6 +1132,9 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
}
return false;
}
public boolean isWordWrap() {
return isWordWrapped();
}
/**
* This method provides a style to the paragraph

View File

@ -47,6 +47,15 @@ public interface Paragraph {
public void setSideBySide(boolean fSideBySide);
*/
public int getIndentFromRight();
public void setIndentFromRight(int dxaRight);
public int getIndentFromLeft();
public void setIndentFromLeft(int dxaLeft);
public int getFirstLineIndent();
public void setFirstLineIndent(int first);
/*
public boolean isLineNotNumbered();
public void setLineNotNumbered(boolean fNoLnn);
@ -57,15 +66,6 @@ public interface Paragraph {
public boolean isWidowControlled();
public void setWidowControl(boolean widowControl);
public int getIndentFromRight();
public void setIndentFromRight(int dxaRight);
public int getIndentFromLeft();
public void setIndentFromLeft(int dxaLeft);
public int getFirstLineIndent();
public void setFirstLineIndent(int first);
public int getSpacingBefore();
public void setSpacingBefore(int before);
@ -76,13 +76,13 @@ public interface Paragraph {
// public LineSpacingDescriptor getLineSpacing();
// public void setLineSpacing(LineSpacingDescriptor lspd);
/*
public boolean isWordWrapped();
public void setWordWrapped(boolean wrap);
public int getFontAlignment();
public void setFontAlignment(int align);
public boolean isWordWrapped();
public void setWordWrapped(boolean wrap);
/*
public boolean isVertical();
public void setVertical(boolean vertical);
@ -90,6 +90,7 @@ public interface Paragraph {
public void setBackward(boolean bward);
*/
// TODO Make the HWPF and XWPF interface wrappers compatible for these
/*
public BorderCode getTopBorder();
public void setTopBorder(BorderCode top);