From 483982caad21dc387e6b0981895ec99b51d96bd3 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Thu, 5 Feb 2015 23:20:43 +0000 Subject: [PATCH] Stub a common WP paragraph class, needs uncommenting as XWPF implements/emulates git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1657712 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xwpf/usermodel/XWPFParagraph.java | 2 +- .../apache/poi/wp/usermodel/Paragraph.java | 144 ++++++++++++++++++ 2 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 src/scratchpad/src/org/apache/poi/wp/usermodel/Paragraph.java diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java index 1d11c032a..e80fcda29 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java @@ -62,7 +62,7 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTextAlignment; * actual text (possibly along with more styling) is held on * the child {@link XWPFRun}s.

*/ -public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents { +public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Paragraph { private final CTP paragraph; protected IBody part; /** For access to the document's hyperlink, comments, tables etc */ diff --git a/src/scratchpad/src/org/apache/poi/wp/usermodel/Paragraph.java b/src/scratchpad/src/org/apache/poi/wp/usermodel/Paragraph.java new file mode 100644 index 000000000..ba2bc9f8a --- /dev/null +++ b/src/scratchpad/src/org/apache/poi/wp/usermodel/Paragraph.java @@ -0,0 +1,144 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ + +package org.apache.poi.wp.usermodel; + +/** + * This class represents a paragraph, made up of one or more + * runs of text. + */ +public interface Paragraph { + // Tables work very differently between the formats +// public boolean isInTable(); +// public boolean isTableRowEnd(); +// public int getTableLevel(); + + // TODO Implement justifaction in XWPF +// public int getJustification(); +// public void setJustification(byte jc); + + // TODO Expose the different page break related things, + // XWPF currently doesn't have the full set +/* + public boolean keepOnPage(); + public void setKeepOnPage(boolean fKeep); + + public boolean keepWithNext(); + public void setKeepWithNext(boolean fKeepFollow); + + public boolean pageBreakBefore(); + public void setPageBreakBefore(boolean fPageBreak); + + public boolean isSideBySide(); + public void setSideBySide(boolean fSideBySide); +*/ + +/* + public boolean isLineNotNumbered(); + public void setLineNotNumbered(boolean fNoLnn); + + public boolean isAutoHyphenated(); + public void setAutoHyphenated(boolean autoHyph); + + 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); + + public int getSpacingAfter(); + public void setSpacingAfter(int after); +*/ + + // 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 isVertical(); + public void setVertical(boolean vertical); + + public boolean isBackward(); + public void setBackward(boolean bward); +*/ + +/* + public BorderCode getTopBorder(); + public void setTopBorder(BorderCode top); + public BorderCode getLeftBorder(); + public void setLeftBorder(BorderCode left); + public BorderCode getBottomBorder(); + public void setBottomBorder(BorderCode bottom); + public BorderCode getRightBorder(); + public void setRightBorder(BorderCode right); + public BorderCode getBarBorder(); + public void setBarBorder(BorderCode bar); + + public ShadingDescriptor getShading(); + public void setShading(ShadingDescriptor shd); +*/ + + /** + * Returns the ilfo, an index to the document's hpllfo, which + * describes the automatic number formatting of the paragraph. + * A value of zero means it isn't numbered. + */ +// public int getIlfo(); + + /** + * Returns the multi-level indent for the paragraph. Will be + * zero for non-list paragraphs, and the first level of any + * list. Subsequent levels in hold values 1-8. + */ +// public int getIlvl(); + + /** + * Returns the heading level (1-8), or 9 if the paragraph + * isn't in a heading style. + */ +// public int getLvl(); + + /** + * Returns number of tabs stops defined for paragraph. Must be >= 0 and <= + * 64. + * + * @return number of tabs stops defined for paragraph. Must be >= 0 and <= + * 64 + */ +// public int getTabStopsNumber(); + + /** + * Returns array of positions of itbdMac tab stops + * + * @return array of positions of itbdMac tab stops + */ +// public int[] getTabStopsPositions(); +}