diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2018-02-11 20:39:18 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2018-02-11 20:39:18 +0000 |
commit | 9968e86b14188b43920f0ef28f68559e3dadf7be (patch) | |
tree | 54e5d238df674471154d47f5ed5746bfb92ee782 /src/java/org/apache/poi/sl/usermodel | |
parent | 5f71c8013157ee2754dcc3109b79f9873d14a086 (diff) | |
download | poi-9968e86b14188b43920f0ef28f68559e3dadf7be.tar.gz poi-9968e86b14188b43920f0ef28f68559e3dadf7be.zip |
#62096 - Add support for tabstops
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1823893 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/sl/usermodel')
-rw-r--r-- | src/java/org/apache/poi/sl/usermodel/MasterSheet.java | 9 | ||||
-rw-r--r-- | src/java/org/apache/poi/sl/usermodel/TabStop.java | 66 | ||||
-rw-r--r-- | src/java/org/apache/poi/sl/usermodel/TextParagraph.java | 30 |
3 files changed, 104 insertions, 1 deletions
diff --git a/src/java/org/apache/poi/sl/usermodel/MasterSheet.java b/src/java/org/apache/poi/sl/usermodel/MasterSheet.java index ac23bc3bba..81da0bb19a 100644 --- a/src/java/org/apache/poi/sl/usermodel/MasterSheet.java +++ b/src/java/org/apache/poi/sl/usermodel/MasterSheet.java @@ -21,5 +21,12 @@ public interface MasterSheet< S extends Shape<S,P>, P extends TextParagraph<S,P,? extends TextRun> > extends Sheet<S,P> { - + /** + * Return the placeholder shape for the specified type + * + * @return the shape or {@code null} if it is not defined in this mastersheet + * + * @since POI 4.0.0 + */ + SimpleShape<S,P> getPlaceholder(Placeholder type); } diff --git a/src/java/org/apache/poi/sl/usermodel/TabStop.java b/src/java/org/apache/poi/sl/usermodel/TabStop.java new file mode 100644 index 0000000000..479b1fec44 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/TabStop.java @@ -0,0 +1,66 @@ +/* ==================================================================== + 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.sl.usermodel; + +public interface TabStop { + + enum TabStopType { + LEFT(0,1), CENTER(1,2), RIGHT(2,3), DECIMAL(3,4); + public final int nativeId; + public final int ooxmlId; + + TabStopType(int nativeId, int ooxmlId) { + this.nativeId = nativeId; + this.ooxmlId = ooxmlId; + } + public static TabStopType fromNativeId(final int nativeId) { + for (TabStopType tst : values()) { + if (tst.nativeId == nativeId) { + return tst; + } + } + return null; + } + public static TabStopType fromOoxmlId(final int ooxmlId) { + for (TabStopType tst : values()) { + if (tst.ooxmlId == ooxmlId) { + return tst; + } + } + return null; + } + } + + /** + * Gets the position in points relative to the left side of the paragraph. + * + * @return position in points + */ + double getPositionInPoints(); + + /** + * Sets the position in points relative to the left side of the paragraph + * + * @param position position in points + */ + void setPositionInPoints(double position); + + TabStopType getType(); + + void setType(TabStopType type); +} diff --git a/src/java/org/apache/poi/sl/usermodel/TextParagraph.java b/src/java/org/apache/poi/sl/usermodel/TextParagraph.java index 1c0913614c..0f6a25b9cc 100644 --- a/src/java/org/apache/poi/sl/usermodel/TextParagraph.java +++ b/src/java/org/apache/poi/sl/usermodel/TextParagraph.java @@ -374,4 +374,34 @@ public interface TextParagraph< * @since POI 3.15-beta2 */ boolean isHeaderOrFooter(); + + + /** + * Get the {@link TabStop TabStops} - the list can't be and it's entries shouldn't be modified. + * Opposed to other properties, this method is not cascading to the master sheet, + * if the property is not defined on the normal slide level, i.e. the tabstops on + * different levels aren't merged. + * + * @return the tabstop collection or {@code null} if no tabstops are defined + * + * @since POI 4.0.0 + */ + List<? extends TabStop> getTabStops(); + + /** + * Set the {@link TabStop} collection + * + * @param tabStops the {@link TabStop} collection + * + * @since POI 4.0.0 + */ + void addTabStops(double positionInPoints, TabStop.TabStopType tabStopType); + + /** + * Removes the tabstops of this paragraphs. + * This doesn't affect inherited tabstops, e.g. inherited by the slide master + * + * @since POI 4.0.0 + */ + void clearTabStops(); }
\ No newline at end of file |