diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2015-07-19 19:00:32 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2015-07-19 19:00:32 +0000 |
commit | 89ab6304a47d06a3f16178e6d6c7451474200c8c (patch) | |
tree | f24892a1d13eb23901d1d2673c46f79ed8f3b560 /src/java/org/apache/poi/sl/usermodel | |
parent | 9b09cb683ab24180411f033a8ba9ed2d6073ebca (diff) | |
parent | a27b7d5b2c80b11bc9d0c49170c684f0201b16fe (diff) | |
download | poi-89ab6304a47d06a3f16178e6d6c7451474200c8c.tar.gz poi-89ab6304a47d06a3f16178e6d6c7451474200c8c.zip |
merge trunk to common sl branch
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/common_sl@1691843 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/sl/usermodel')
35 files changed, 2462 insertions, 0 deletions
diff --git a/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java b/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java new file mode 100644 index 0000000000..3a68313499 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/AutoNumberingScheme.java @@ -0,0 +1,287 @@ +/* ====================================================================
+ 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 enum AutoNumberingScheme {
+ /** Lowercase alphabetic character enclosed in parentheses. Example: (a), (b), (c), ... */
+ alphaLcParenBoth(0x0008, 1),
+ /** Uppercase alphabetic character enclosed in parentheses. Example: (A), (B), (C), ... */
+ alphaUcParenBoth(0x000A, 2),
+ /** Lowercase alphabetic character followed by a closing parenthesis. Example: a), b), c), ... */
+ alphaLcParenRight(0x0009, 3),
+ /** Uppercase alphabetic character followed by a closing parenthesis. Example: A), B), C), ... */
+ alphaUcParenRight(0x000B, 4),
+ /** Lowercase Latin character followed by a period. Example: a., b., c., ... */
+ alphaLcPeriod(0x0000, 5),
+ /** Uppercase Latin character followed by a period. Example: A., B., C., ... */
+ alphaUcPeriod(0x0001, 6),
+ /** Arabic numeral enclosed in parentheses. Example: (1), (2), (3), ... */
+ arabicParenBoth(0x000C, 7),
+ /** Arabic numeral followed by a closing parenthesis. Example: 1), 2), 3), ... */
+ arabicParenRight(0x0002, 8),
+ /** Arabic numeral followed by a period. Example: 1., 2., 3., ... */
+ arabicPeriod(0x0003, 9),
+ /** Arabic numeral. Example: 1, 2, 3, ... */
+ arabicPlain(0x000D, 10),
+ /** Lowercase Roman numeral enclosed in parentheses. Example: (i), (ii), (iii), ... */
+ romanLcParenBoth(0x0004, 11),
+ /** Uppercase Roman numeral enclosed in parentheses. Example: (I), (II), (III), ... */
+ romanUcParenBoth(0x000E, 12),
+ /** Lowercase Roman numeral followed by a closing parenthesis. Example: i), ii), iii), ... */
+ romanLcParenRight(0x0005, 13),
+ /** Uppercase Roman numeral followed by a closing parenthesis. Example: I), II), III), .... */
+ romanUcParenRight(0x000F, 14),
+ /** Lowercase Roman numeral followed by a period. Example: i., ii., iii., ... */
+ romanLcPeriod(0x0006, 15),
+ /** Uppercase Roman numeral followed by a period. Example: I., II., III., ... */
+ romanUcPeriod(0x0007, 16),
+ /** Double byte circle numbers. */
+ circleNumDbPlain(0x0012, 17),
+ /** Wingdings black circle numbers. */
+ circleNumWdBlackPlain(0x0014, 18),
+ /** Wingdings white circle numbers. */
+ circleNumWdWhitePlain(0x0013, 19),
+ /** Double-byte Arabic numbers with double-byte period. */
+ arabicDbPeriod(0x001D, 20),
+ /** Double-byte Arabic numbers. */
+ arabicDbPlain(0x001C, 21),
+ /** Simplified Chinese with single-byte period. */
+ ea1ChsPeriod(0x0011, 22),
+ /** Simplified Chinese. */
+ ea1ChsPlain(0x0010, 23),
+ /** Traditional Chinese with single-byte period. */
+ ea1ChtPeriod(0x0015, 24),
+ /** Traditional Chinese. */
+ ea1ChtPlain(0x0014, 25),
+ /** Japanese with double-byte period. */
+ ea1JpnChsDbPeriod(0x0026, 26),
+ /** Japanese/Korean. */
+ ea1JpnKorPlain(0x001A, 27),
+ /** Japanese/Korean with single-byte period. */
+ ea1JpnKorPeriod(0x001B, 28),
+ /** Bidi Arabic 1 (AraAlpha) with ANSI minus symbol. */
+ arabic1Minus(0x0017, 29),
+ /** Bidi Arabic 2 (AraAbjad) with ANSI minus symbol. */
+ arabic2Minus(0x0018, 30),
+ /** Bidi Hebrew 2 with ANSI minus symbol. */
+ hebrew2Minus(0x0019, 31),
+ /** Thai alphabetic character followed by a period. */
+ thaiAlphaPeriod(0x001E, 32),
+ /** Thai alphabetic character followed by a closing parenthesis. */
+ thaiAlphaParenRight(0x001F, 33),
+ /** Thai alphabetic character enclosed by parentheses. */
+ thaiAlphaParenBoth(0x0020, 34),
+ /** Thai numeral followed by a period. */
+ thaiNumPeriod(0x0021, 35),
+ /** Thai numeral followed by a closing parenthesis. */
+ thaiNumParenRight(0x0022, 36),
+ /** Thai numeral enclosed in parentheses. */
+ thaiNumParenBoth(0x0023, 37),
+ /** Hindi alphabetic character followed by a period. */
+ hindiAlphaPeriod(0x0024, 38),
+ /** Hindi numeric character followed by a period. */
+ hindiNumPeriod(0x0025, 39),
+ /** Hindi numeric character followed by a closing parenthesis. */
+ hindiNumParenRight(0x0027, 40),
+ /** Hindi alphabetic character followed by a period. */
+ hindiAlpha1Period(0x0027, 41);
+
+ public final int nativeId, ooxmlId;
+
+ AutoNumberingScheme(int nativeId, int ooxmlId) {
+ this.nativeId = nativeId;
+ this.ooxmlId = ooxmlId;
+ }
+
+ public static AutoNumberingScheme forNativeID(int nativeId) {
+ for (AutoNumberingScheme ans : values()) {
+ if (ans.nativeId == nativeId) return ans;
+ }
+ return null;
+ }
+
+ public static AutoNumberingScheme forOoxmlID(int ooxmlId) {
+ for (AutoNumberingScheme ans : values()) {
+ if (ans.ooxmlId == ooxmlId) return ans;
+ }
+ return null;
+ }
+
+ public String getDescription() {
+ switch (this) {
+ case alphaLcPeriod : return "Lowercase Latin character followed by a period. Example: a., b., c., ...";
+ case alphaUcPeriod : return "Uppercase Latin character followed by a period. Example: A., B., C., ...";
+ case arabicParenRight : return "Arabic numeral followed by a closing parenthesis. Example: 1), 2), 3), ...";
+ case arabicPeriod : return "Arabic numeral followed by a period. Example: 1., 2., 3., ...";
+ case romanLcParenBoth : return "Lowercase Roman numeral enclosed in parentheses. Example: (i), (ii), (iii), ...";
+ case romanLcParenRight : return "Lowercase Roman numeral followed by a closing parenthesis. Example: i), ii), iii), ...";
+ case romanLcPeriod : return "Lowercase Roman numeral followed by a period. Example: i., ii., iii., ...";
+ case romanUcPeriod : return "Uppercase Roman numeral followed by a period. Example: I., II., III., ...";
+ case alphaLcParenBoth : return "Lowercase alphabetic character enclosed in parentheses. Example: (a), (b), (c), ...";
+ case alphaLcParenRight : return "Lowercase alphabetic character followed by a closing parenthesis. Example: a), b), c), ...";
+ case alphaUcParenBoth : return "Uppercase alphabetic character enclosed in parentheses. Example: (A), (B), (C), ...";
+ case alphaUcParenRight : return "Uppercase alphabetic character followed by a closing parenthesis. Example: A), B), C), ...";
+ case arabicParenBoth : return "Arabic numeral enclosed in parentheses. Example: (1), (2), (3), ...";
+ case arabicPlain : return "Arabic numeral. Example: 1, 2, 3, ...";
+ case romanUcParenBoth : return "Uppercase Roman numeral enclosed in parentheses. Example: (I), (II), (III), ...";
+ case romanUcParenRight : return "Uppercase Roman numeral followed by a closing parenthesis. Example: I), II), III), ...";
+ case ea1ChsPlain : return "Simplified Chinese.";
+ case ea1ChsPeriod : return "Simplified Chinese with single-byte period.";
+ case circleNumDbPlain : return "Double byte circle numbers.";
+ case circleNumWdWhitePlain : return "Wingdings white circle numbers.";
+ case circleNumWdBlackPlain : return "Wingdings black circle numbers.";
+ case ea1ChtPlain : return "Traditional Chinese.";
+ case ea1ChtPeriod : return "Traditional Chinese with single-byte period.";
+ case arabic1Minus : return "Bidi Arabic 1 (AraAlpha) with ANSI minus symbol.";
+ case arabic2Minus : return "Bidi Arabic 2 (AraAbjad) with ANSI minus symbol.";
+ case hebrew2Minus : return "Bidi Hebrew 2 with ANSI minus symbol.";
+ case ea1JpnKorPlain : return "Japanese/Korean.";
+ case ea1JpnKorPeriod : return "Japanese/Korean with single-byte period.";
+ case arabicDbPlain : return "Double-byte Arabic numbers.";
+ case arabicDbPeriod : return "Double-byte Arabic numbers with double-byte period.";
+ case thaiAlphaPeriod : return "Thai alphabetic character followed by a period.";
+ case thaiAlphaParenRight : return "Thai alphabetic character followed by a closing parenthesis.";
+ case thaiAlphaParenBoth : return "Thai alphabetic character enclosed by parentheses.";
+ case thaiNumPeriod : return "Thai numeral followed by a period.";
+ case thaiNumParenRight : return "Thai numeral followed by a closing parenthesis.";
+ case thaiNumParenBoth : return "Thai numeral enclosed in parentheses.";
+ case hindiAlphaPeriod : return "Hindi alphabetic character followed by a period.";
+ case hindiNumPeriod : return "Hindi numeric character followed by a period.";
+ case ea1JpnChsDbPeriod : return "Japanese with double-byte period.";
+ case hindiNumParenRight : return "Hindi numeric character followed by a closing parenthesis.";
+ case hindiAlpha1Period : return "Hindi alphabetic character followed by a period.";
+ default : return "Unknown Numbered Scheme";
+ }
+ }
+
+ public String format(int value) {
+ String index = formatIndex(value);
+ String cased = formatCase(index);
+ String seperated = formatSeperator(cased);
+ return seperated;
+ }
+
+ private String formatSeperator(String cased) {
+ String name = name().toLowerCase();
+ if (name.contains("plain")) return cased;
+ if (name.contains("parenright")) return cased+")";
+ if (name.contains("parenboth")) return "("+cased+")";
+ if (name.contains("period")) return cased+".";
+ if (name.contains("minus")) return cased+"-"; // ???
+ return cased;
+ }
+
+ private String formatCase(String index) {
+ String name = name().toLowerCase();
+ if (name.contains("lc")) return index.toLowerCase();
+ if (name.contains("uc")) return index.toUpperCase();
+ return index;
+ }
+
+ private static final String ARABIC_LIST = "0123456789";
+ private static final String ALPHA_LIST = "abcdefghijklmnopqrstuvwxyz";
+ private static final String WINGDINGS_WHITE_LIST =
+ "\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089";
+ private static final String WINGDINGS_BLACK_LIST =
+ "\u008B\u008C\u008D\u008E\u008F\u0090\u0091\u0092\u0093\u0094";
+ private static final String CIRCLE_DB_LIST =
+ "\u2776\u2777\u2778\u2779\u277A\u277B\u277C\u277D\u277E";
+
+ private String formatIndex(int value) {
+ String name = name().toLowerCase();
+ if (name.startsWith("roman")) {
+ return formatRomanIndex(value);
+ } else if (name.startsWith("arabic") && !name.contains("db")) {
+ return getIndexedList(value, ARABIC_LIST, false);
+ } else if (name.startsWith("alpha")) {
+ return getIndexedList(value, ALPHA_LIST, true);
+ } else if (name.contains("WdWhite")) {
+ return (value == 10) ? "\u008A"
+ : getIndexedList(value, WINGDINGS_WHITE_LIST, false);
+ } else if (name.contains("WdBlack")) {
+ return (value == 10) ? "\u0095"
+ : getIndexedList(value, WINGDINGS_BLACK_LIST, false);
+ } else if (name.contains("NumDb")) {
+ return (value == 10) ? "\u277F"
+ : getIndexedList(value, CIRCLE_DB_LIST, true);
+ } else {
+ return "?";
+ }
+ }
+
+ private static String getIndexedList(int val, String list, boolean oneBased) {
+ StringBuilder sb = new StringBuilder();
+ addIndexedChar(val, list, oneBased, sb);
+ return sb.toString();
+ }
+
+ private static void addIndexedChar(int val, String list, boolean oneBased, StringBuilder sb) {
+ if (oneBased) val -= 1;
+ final int len = list.length();
+ if (val >= len) {
+ addIndexedChar(val/len, list, oneBased, sb);
+ }
+ sb.append(list.charAt(val%len));
+ }
+
+
+ private String formatRomanIndex(int value) {
+ //M (1000), CM (900), D (500), CD (400), C (100), XC (90), L (50), XL (40), X (10), IX (9), V (5), IV (4) and I (1).
+ final int[] VALUES = new int[]{1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
+ final String[] ROMAN = new String[]{"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
+ final String conciseList[][] = {
+ {"XLV", "VL"}, //45
+ {"XCV", "VC"}, //95
+ {"CDL", "LD"}, //450
+ {"CML", "LM"}, //950
+ {"CMVC", "LMVL"}, //995
+ {"CDXC", "LDXL"}, //490
+ {"CDVC", "LDVL"}, //495
+ {"CMXC", "LMXL"}, //990
+ {"XCIX", "VCIV"}, //99
+ {"XLIX", "VLIV"}, //49
+ {"XLIX", "IL"}, //49
+ {"XCIX", "IC"}, //99
+ {"CDXC", "XD"}, //490
+ {"CDVC", "XDV"}, //495
+ {"CDIC", "XDIX"}, //499
+ {"LMVL", "XMV"}, //995
+ {"CMIC", "XMIX"}, //999
+ {"CMXC", "XM"}, // 990
+ {"XDV", "VD"}, //495
+ {"XDIX", "VDIV"}, //499
+ {"XMV", "VM"}, // 995
+ {"XMIX", "VMIV"}, //999
+ {"VDIV", "ID"}, //499
+ {"VMIV", "IM"} //999
+ };
+
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < 13; i++) {
+ while (value >= VALUES[i]) {
+ value -= VALUES[i];
+ sb.append(ROMAN[i]);
+ }
+ }
+ String result = sb.toString();
+ for (String cc[] : conciseList) {
+ result = result.replace(cc[0], cc[1]);
+ }
+ return result;
+ }
+}
\ No newline at end of file diff --git a/src/java/org/apache/poi/sl/usermodel/AutoShape.java b/src/java/org/apache/poi/sl/usermodel/AutoShape.java new file mode 100644 index 0000000000..1bf073dfbb --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/AutoShape.java @@ -0,0 +1,21 @@ +/* ==================================================================== + 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 AutoShape<T extends TextParagraph<? extends TextRun>> extends TextShape<T> { +} diff --git a/src/java/org/apache/poi/sl/usermodel/Background.java b/src/java/org/apache/poi/sl/usermodel/Background.java new file mode 100644 index 0000000000..8d868b8600 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/Background.java @@ -0,0 +1,22 @@ +/* ==================================================================== + 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 Background extends Shape { + FillStyle getFillStyle(); +} diff --git a/src/java/org/apache/poi/sl/usermodel/ColorStyle.java b/src/java/org/apache/poi/sl/usermodel/ColorStyle.java new file mode 100644 index 0000000000..9be847b36c --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/ColorStyle.java @@ -0,0 +1,69 @@ +/* ====================================================================
+ 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;
+
+import java.awt.Color;
+
+
+public interface ColorStyle {
+ Color getColor();
+
+ /**
+ * the opacity as expressed by a percentage value
+ *
+ * @return opacity in percents in the range [0..100000]
+ * or -1 if the value is not set
+ */
+ int getAlpha();
+
+ /**
+ * the luminance shift as expressed by a percentage relative to the input color
+ *
+ * @return luminance shift in percents in the range [0..100000]
+ * or -1 if the value is not set
+ */
+ int getLumOff();
+
+ /**
+ * the luminance as expressed by a percentage relative to the input color
+ *
+ * @return luminance in percents in the range [0..100000]
+ * or -1 if the value is not set
+ */
+ int getLumMod();
+
+ /**
+ * specifies a darker version of its input color.
+ * A 10% shade is 10% of the input color combined with 90% black.
+ *
+ * @return the value of the shade specified as percents in the range [0..100000]
+ * with 0% indicating minimal shade and 100% indicating maximum
+ * or -1 if the value is not set
+ */
+ int getShade();
+
+ /**
+ * specifies a lighter version of its input color.
+ * A 10% tint is 10% of the input color combined with 90% white.
+ *
+ * @return the value of the tint specified as percents in the range [0..100000]
+ * with 0% indicating minimal tint and 100% indicating maximum
+ * or -1 if the value is not set
+ */
+ int getTint();
+}
diff --git a/src/java/org/apache/poi/sl/usermodel/ConnectorShape.java b/src/java/org/apache/poi/sl/usermodel/ConnectorShape.java new file mode 100644 index 0000000000..7e2bbf065c --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/ConnectorShape.java @@ -0,0 +1,22 @@ +/* ====================================================================
+ 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 ConnectorShape extends SimpleShape {
+
+}
diff --git a/src/java/org/apache/poi/sl/usermodel/FillStyle.java b/src/java/org/apache/poi/sl/usermodel/FillStyle.java new file mode 100644 index 0000000000..8414000b8b --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/FillStyle.java @@ -0,0 +1,22 @@ +/* ====================================================================
+ 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 FillStyle {
+ PaintStyle getPaint();
+}
diff --git a/src/java/org/apache/poi/sl/usermodel/FontCollection.java b/src/java/org/apache/poi/sl/usermodel/FontCollection.java new file mode 100644 index 0000000000..61278f4618 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/FontCollection.java @@ -0,0 +1,22 @@ +/* ==================================================================== + 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 FontCollection { + +} diff --git a/src/java/org/apache/poi/sl/usermodel/FreeformShape.java b/src/java/org/apache/poi/sl/usermodel/FreeformShape.java new file mode 100644 index 0000000000..e0843a11a1 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/FreeformShape.java @@ -0,0 +1,22 @@ +/* ====================================================================
+ 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 FreeformShape<T extends TextParagraph<? extends TextRun>> extends AutoShape<T> {
+
+}
diff --git a/src/java/org/apache/poi/sl/usermodel/GroupShape.java b/src/java/org/apache/poi/sl/usermodel/GroupShape.java new file mode 100644 index 0000000000..d71bb253fe --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/GroupShape.java @@ -0,0 +1,39 @@ +/* ==================================================================== + 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; + +import java.awt.geom.Rectangle2D; + +public interface GroupShape<T extends Shape> extends Shape, ShapeContainer<T>, PlaceableShape { + + /** + * Gets the coordinate space of this group. All children are constrained + * to these coordinates. + * + * @param anchor the coordinate space of this group + */ + Rectangle2D getInteriorAnchor(); + + /** + * Sets the coordinate space of this group. All children are constrained + * to these coordinates. + * + * @param anchor the coordinate space of this group + */ + void setInteriorAnchor(Rectangle2D anchor); +} diff --git a/src/java/org/apache/poi/sl/usermodel/Hyperlink.java b/src/java/org/apache/poi/sl/usermodel/Hyperlink.java new file mode 100644 index 0000000000..cde288492c --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/Hyperlink.java @@ -0,0 +1,24 @@ +/* ==================================================================== + 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; + +/** + * A PowerPoint hyperlink + */ +public interface Hyperlink extends org.apache.poi.common.usermodel.Hyperlink { +} diff --git a/src/java/org/apache/poi/sl/usermodel/Insets2D.java b/src/java/org/apache/poi/sl/usermodel/Insets2D.java new file mode 100644 index 0000000000..04b4d77cf4 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/Insets2D.java @@ -0,0 +1,146 @@ +/* ====================================================================
+ 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;
+
+import java.awt.Insets;
+
+/**
+ * This is a replacement for {@link java.awt.Insets} which works on doubles
+ * instead of ints
+ */
+public class Insets2D {
+
+ /**
+ * The inset from the top.
+ * This value is added to the Top of the rectangle
+ * to yield a new location for the Top.
+ */
+ public double top;
+
+ /**
+ * The inset from the left.
+ * This value is added to the Left of the rectangle
+ * to yield a new location for the Left edge.
+ */
+ public double left;
+
+ /**
+ * The inset from the bottom.
+ * This value is subtracted from the Bottom of the rectangle
+ * to yield a new location for the Bottom.
+ */
+ public double bottom;
+
+ /**
+ * The inset from the right.
+ * This value is subtracted from the Right of the rectangle
+ * to yield a new location for the Right edge.
+ */
+ public double right;
+
+ /**
+ * Creates and initializes a new <code>Insets</code> object with the
+ * specified top, left, bottom, and right insets.
+ * @param top the inset from the top.
+ * @param left the inset from the left.
+ * @param bottom the inset from the bottom.
+ * @param right the inset from the right.
+ */
+ public Insets2D(double top, double left, double bottom, double right) {
+ this.top = top;
+ this.left = left;
+ this.bottom = bottom;
+ this.right = right;
+ }
+
+ /**
+ * Set top, left, bottom, and right to the specified values
+ *
+ * @param top the inset from the top.
+ * @param left the inset from the left.
+ * @param bottom the inset from the bottom.
+ * @param right the inset from the right.
+ * @since 1.5
+ */
+ public void set(double top, double left, double bottom, double right) {
+ this.top = top;
+ this.left = left;
+ this.bottom = bottom;
+ this.right = right;
+ }
+
+ /**
+ * Checks whether two insets objects are equal. Two instances
+ * of <code>Insets</code> are equal if the four integer values
+ * of the fields <code>top</code>, <code>left</code>,
+ * <code>bottom</code>, and <code>right</code> are all equal.
+ * @return <code>true</code> if the two insets are equal;
+ * otherwise <code>false</code>.
+ * @since JDK1.1
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof Insets) {
+ Insets insets = (Insets)obj;
+ return ((top == insets.top) && (left == insets.left) &&
+ (bottom == insets.bottom) && (right == insets.right));
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hash code for this Insets.
+ *
+ * @return a hash code for this Insets.
+ */
+ public int hashCode() {
+ double sum1 = left + bottom;
+ double sum2 = right + top;
+ double val1 = sum1 * (sum1 + 1)/2 + left;
+ double val2 = sum2 * (sum2 + 1)/2 + top;
+ double sum3 = val1 + val2;
+ return (int)(sum3 * (sum3 + 1)/2 + val2);
+ }
+
+ /**
+ * Returns a string representation of this <code>Insets</code> object.
+ * This method is intended to be used only for debugging purposes, and
+ * the content and format of the returned string may vary between
+ * implementations. The returned string may be empty but may not be
+ * <code>null</code>.
+ *
+ * @return a string representation of this <code>Insets</code> object.
+ */
+ public String toString() {
+ return getClass().getName() + "[top=" + top + ",left=" + left + ",bottom=" + bottom + ",right=" + right + "]";
+ }
+
+ /**
+ * Create a copy of this object.
+ * @return a copy of this <code>Insets2D</code> object.
+ */
+ public Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ // this shouldn't happen, since we are Cloneable
+ throw new InternalError();
+ }
+ }
+
+
+}
diff --git a/src/java/org/apache/poi/sl/usermodel/Line.java b/src/java/org/apache/poi/sl/usermodel/Line.java new file mode 100644 index 0000000000..b06764e54d --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/Line.java @@ -0,0 +1,22 @@ +/* ==================================================================== + 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 Line<T extends TextParagraph<? extends TextRun>> extends AutoShape<T> { + +} diff --git a/src/java/org/apache/poi/sl/usermodel/LineDecoration.java b/src/java/org/apache/poi/sl/usermodel/LineDecoration.java new file mode 100644 index 0000000000..e95551c9e7 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/LineDecoration.java @@ -0,0 +1,95 @@ +/* ====================================================================
+ 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 LineDecoration {
+ /**
+ * Represents the shape decoration that appears at the ends of lines.
+ */
+ enum DecorationShape {
+ NONE(1),
+ TRIANGLE(2),
+ STEALTH(3),
+ DIAMOND(4),
+ OVAL(5),
+ ARROW(6);
+
+ public final int ooxmlId;
+
+ DecorationShape(int ooxmlId) {
+ this.ooxmlId = ooxmlId;
+ }
+
+ public static DecorationShape fromOoxmlId(int ooxmlId) {
+ for (DecorationShape ds : values()) {
+ if (ds.ooxmlId == ooxmlId) return ds;
+ }
+ return null;
+ }
+ }
+
+ enum DecorationSize {
+ SMALL(1),
+ MEDIUM(2),
+ LARGE(3);
+
+ public final int ooxmlId;
+
+ DecorationSize(int ooxmlId) {
+ this.ooxmlId = ooxmlId;
+ }
+
+ public static DecorationSize fromOoxmlId(int ooxmlId) {
+ for (DecorationSize ds : values()) {
+ if (ds.ooxmlId == ooxmlId) return ds;
+ }
+ return null;
+ }
+ }
+
+ /**
+ * @return the line start shape
+ */
+ DecorationShape getHeadShape();
+
+ /**
+ * @return the width of the start shape
+ */
+ DecorationSize getHeadWidth();
+
+ /**
+ * @return the length of the start shape
+ */
+ DecorationSize getHeadLength();
+
+ /**
+ * @return the line end shape
+ */
+ DecorationShape getTailShape();
+
+ /**
+ * @return the width of the end shape
+ */
+ DecorationSize getTailWidth();
+
+ /**
+ * @return the length of the end shape
+ */
+ DecorationSize getTailLength();
+
+}
diff --git a/src/java/org/apache/poi/sl/usermodel/MasterSheet.java b/src/java/org/apache/poi/sl/usermodel/MasterSheet.java new file mode 100644 index 0000000000..727217d3fa --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/MasterSheet.java @@ -0,0 +1,22 @@ +/* ==================================================================== + 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 MasterSheet<T extends Shape, SS extends SlideShow> extends Sheet<T,SS> { + +} diff --git a/src/java/org/apache/poi/sl/usermodel/Notes.java b/src/java/org/apache/poi/sl/usermodel/Notes.java new file mode 100644 index 0000000000..3e4b924721 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/Notes.java @@ -0,0 +1,24 @@ +/* ==================================================================== + 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; + +import java.util.List; + +public interface Notes<T extends Shape, SS extends SlideShow> extends Sheet<T,SS> { + List<? extends List<? extends TextParagraph<? extends TextRun>>> getTextParagraphs(); +} diff --git a/src/java/org/apache/poi/sl/usermodel/PaintStyle.java b/src/java/org/apache/poi/sl/usermodel/PaintStyle.java new file mode 100644 index 0000000000..2551201692 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/PaintStyle.java @@ -0,0 +1,63 @@ +/* ==================================================================== + 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; + +import java.awt.Color; +import java.io.InputStream; + +import org.apache.poi.sl.draw.DrawPaint; + + + +public interface PaintStyle { + public interface SolidPaint extends PaintStyle { + ColorStyle getSolidColor(); + } + + public interface GradientPaint extends PaintStyle { + enum GradientType { linear, circular, shape } + + /** + * @return the angle of the gradient + */ + double getGradientAngle(); + ColorStyle[] getGradientColors(); + float[] getGradientFractions(); + boolean isRotatedWithShape(); + GradientType getGradientType(); + } + + public interface TexturePaint extends PaintStyle { + /** + * @return the raw image stream + */ + InputStream getImageData(); + + /** + * @return the content type of the image data + */ + String getContentType(); + + /** + * @return the alpha mask in percents [0..100000] + */ + int getAlpha(); + } + + SolidPaint TRANSPARENT_PAINT = DrawPaint.createSolidPaint(new Color(0xFF, 0xFF, 0xFF, 0)); +} diff --git a/src/java/org/apache/poi/sl/usermodel/PictureData.java b/src/java/org/apache/poi/sl/usermodel/PictureData.java new file mode 100644 index 0000000000..8697d33965 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/PictureData.java @@ -0,0 +1,27 @@ +/* ==================================================================== + 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; + +import java.io.IOException; + +public interface PictureData { + public String getContentType(); + + public byte[] getData(); + public void setData(byte[] data) throws IOException; +} diff --git a/src/java/org/apache/poi/sl/usermodel/PictureShape.java b/src/java/org/apache/poi/sl/usermodel/PictureShape.java new file mode 100644 index 0000000000..a2c0824e0c --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/PictureShape.java @@ -0,0 +1,37 @@ +/* ==================================================================== + 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; + +import java.awt.Insets; + +public interface PictureShape extends SimpleShape { + /** + * Returns the picture data for this picture. + * + * @return the picture data for this picture. + */ + PictureData getPictureData(); + + /** + * Returns the clipping values as percent ratio relatively to the image size. + * The clipping are returned as insets converted/scaled to 100000 (=100%). + * + * @return the clipping rectangle, which is given in percent in relation to the image width/height + */ + Insets getClipping(); +} diff --git a/src/java/org/apache/poi/sl/usermodel/PlaceableShape.java b/src/java/org/apache/poi/sl/usermodel/PlaceableShape.java new file mode 100644 index 0000000000..f81a344b17 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/PlaceableShape.java @@ -0,0 +1,84 @@ +/* ====================================================================
+ 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;
+
+import java.awt.geom.Rectangle2D;
+
+public interface PlaceableShape {
+ ShapeContainer<? extends Shape> getParent();
+
+ /**
+ * @return the position of this shape within the drawing canvas.
+ * The coordinates are expressed in points
+ */
+ Rectangle2D getAnchor();
+
+ /**
+ * @param anchor the position of this shape within the drawing canvas.
+ * The coordinates are expressed in points
+ */
+ void setAnchor(Rectangle2D anchor);
+
+ /**
+ * Rotation angle in degrees
+ * <p>
+ * Positive angles are clockwise (i.e., towards the positive y axis);
+ * negative angles are counter-clockwise (i.e., towards the negative y axis).
+ * </p>
+ *
+ * @return rotation angle in degrees
+ */
+ double getRotation();
+
+ /**
+ * Rotate this shape.
+ * <p>
+ * Positive angles are clockwise (i.e., towards the positive y axis);
+ * negative angles are counter-clockwise (i.e., towards the negative y axis).
+ * </p>
+ *
+ * @param theta the rotation angle in degrees.
+ */
+ void setRotation(double theta);
+
+ /**
+ * @param flip whether the shape is horizontally flipped
+ */
+ void setFlipHorizontal(boolean flip);
+
+ /**
+ * Whether the shape is vertically flipped
+ *
+ * @param flip whether the shape is vertically flipped
+ */
+ void setFlipVertical(boolean flip);
+
+ /**
+ * Whether the shape is horizontally flipped
+ *
+ * @return whether the shape is horizontally flipped
+ */
+ boolean getFlipHorizontal();
+
+ /**
+ * Whether the shape is vertically flipped
+ *
+ * @return whether the shape is vertically flipped
+ */
+ boolean getFlipVertical();
+}
diff --git a/src/java/org/apache/poi/sl/usermodel/Resources.java b/src/java/org/apache/poi/sl/usermodel/Resources.java new file mode 100644 index 0000000000..96170e50bd --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/Resources.java @@ -0,0 +1,29 @@ +/* ==================================================================== + 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; + +/** + * Common SlideShow resources, such as fonts, pictures + * and multimedia data + */ +public interface Resources { + public FontCollection getFontCollection(); + + public PictureData[] getPictureData(); + public int addPictureData(PictureData pict); +} diff --git a/src/java/org/apache/poi/sl/usermodel/Shadow.java b/src/java/org/apache/poi/sl/usermodel/Shadow.java new file mode 100644 index 0000000000..430dbe3840 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/Shadow.java @@ -0,0 +1,50 @@ +/* ====================================================================
+ 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;
+
+import org.apache.poi.sl.usermodel.PaintStyle.SolidPaint;
+
+
+
+public interface Shadow {
+ SimpleShape getShadowParent();
+
+ /**
+ * @return the offset of this shadow in points
+ */
+ double getDistance();
+
+ /**
+ *
+ * @return the direction to offset the shadow in angles
+ */
+ double getAngle();
+
+ /**
+ *
+ * @return the blur radius of the shadow
+ * TODO: figure out how to make sense of this property when rendering shadows
+ */
+ double getBlur();
+
+ /**
+ * @return the color of this shadow.
+ * Depending whether the parent shape is filled or stroked, this color is used to fill or stroke this shadow
+ */
+ SolidPaint getFillStyle();
+}
diff --git a/src/java/org/apache/poi/sl/usermodel/Shape.java b/src/java/org/apache/poi/sl/usermodel/Shape.java new file mode 100644 index 0000000000..4de645d41f --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/Shape.java @@ -0,0 +1,29 @@ +/* ==================================================================== + 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 Shape { + ShapeContainer<? extends Shape> getParent(); + + /** + * + * @return the sheet this shape belongs to + */ + Sheet<? extends Shape, ? extends SlideShow> getSheet(); +} diff --git a/src/java/org/apache/poi/sl/usermodel/ShapeContainer.java b/src/java/org/apache/poi/sl/usermodel/ShapeContainer.java new file mode 100644 index 0000000000..1741a732d3 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/ShapeContainer.java @@ -0,0 +1,46 @@ +/* ==================================================================== + 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; + +import java.util.List; + + +public interface ShapeContainer<T extends Shape> extends Iterable<T> { + /** + * Returns an list containing all of the elements in this container in proper + * sequence (from first to last element). + * + * @return an list containing all of the elements in this container in proper + * sequence + */ + List<T> getShapes(); + + void addShape(T shape); + + /** + * Removes the specified shape from this sheet, if it is present + * (optional operation). If this sheet does not contain the element, + * it is unchanged. + * + * @param xShape shape to be removed from this sheet, if present + * @return <tt>true</tt> if this sheet contained the specified element + * @throws IllegalArgumentException if the type of the specified shape + * is incompatible with this sheet (optional) + */ + boolean removeShape(T shape); +} diff --git a/src/java/org/apache/poi/sl/usermodel/ShapeType.java b/src/java/org/apache/poi/sl/usermodel/ShapeType.java new file mode 100644 index 0000000000..91974b79df --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/ShapeType.java @@ -0,0 +1,316 @@ +/* ==================================================================== + 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; + +/** + * known preset shape geometries in PresentationML + */ +public enum ShapeType { + NOT_PRIMITIVE(-1, 0, "NotPrimitive"), + LINE(1, 20, "Line"), + LINE_INV(2, -1, null), + TRIANGLE(3, 5, "IsocelesTriangle"), + RT_TRIANGLE(4, 6, "RightTriangle"), + RECT(5, 1, "Rectangle"), + DIAMOND(6, 4, "Diamond"), + PARALLELOGRAM(7, 7, "Parallelogram"), + TRAPEZOID(8, 8, "Trapezoid"), + NON_ISOSCELES_TRAPEZOID(9, -1, null), + PENTAGON(10, 56, "Pentagon"), + HEXAGON(11, 9, "Hexagon"), + HEPTAGON(12, -1, null), + OCTAGON(13, 10, "Octagon"), + DECAGON(14, -1, null), + DODECAGON(15, -1, null), + STAR_4(16, 187, "Star4"), + STAR_5(17, 12, "Star"), // aka star in native + STAR_6(18, -1, null), + STAR_7(19, -1, null), + STAR_8(20, 58, "Star8"), + STAR_10(21, -1, null), + STAR_12(22, -1, null), + STAR_16(23, 59, "Star16"), + SEAL(23, 18, "Seal"), // same as star_16, but twice in native + STAR_24(24, 92, "Star24"), + STAR_32(25, 60, "Star32"), + ROUND_RECT(26, 2, "RoundRectangle"), + ROUND_1_RECT(27, -1, null), + ROUND_2_SAME_RECT(28, -1, null), + ROUND_2_DIAG_RECT(29, -1, null), + SNIP_ROUND_RECT(30, -1, null), + SNIP_1_RECT(31, -1, null), + SNIP_2_SAME_RECT(32, -1, null), + SNIP_2_DIAG_RECT(33, -1, null), + PLAQUE(34, 21, "Plaque"), + ELLIPSE(35, 3, "Ellipse"), + TEARDROP(36, -1, null), + HOME_PLATE(37, 15, "HomePlate"), + CHEVRON(38, 55, "Chevron"), + PIE_WEDGE(39, -1, null), + PIE(40, -1, null), + BLOCK_ARC(41, 95, "BlockArc"), + DONUT(42, 23, "Donut"), + NO_SMOKING(43, 57, "NoSmoking"), + RIGHT_ARROW(44, 13, "Arrow"), // aka arrow in native + LEFT_ARROW(45, 66, "LeftArrow"), + UP_ARROW(46, 68, "UpArrow"), + DOWN_ARROW(47, 67, "DownArrow"), + STRIPED_RIGHT_ARROW(48, 93, "StripedRightArrow"), + NOTCHED_RIGHT_ARROW(49, 94, "NotchedRightArrow"), + BENT_UP_ARROW(50, 90, "BentUpArrow"), + LEFT_RIGHT_ARROW(51, 69, "LeftRightArrow"), + UP_DOWN_ARROW(52, 70, "UpDownArrow"), + LEFT_UP_ARROW(53, 89, "LeftUpArrow"), + LEFT_RIGHT_UP_ARROW(54, 182, "LeftRightUpArrow"), + QUAD_ARROW(55, 76, "QuadArrow"), + LEFT_ARROW_CALLOUT(56, 77, "LeftArrowCallout"), + RIGHT_ARROW_CALLOUT(57, 78, "RightArrowCallout"), + UP_ARROW_CALLOUT(58, 79, "UpArrowCallout"), + DOWN_ARROW_CALLOUT(59, 80, "DownArrowCallout"), + LEFT_RIGHT_ARROW_CALLOUT(60, 81, "LeftRightArrowCallout"), + UP_DOWN_ARROW_CALLOUT(61, 82, "UpDownArrowCallout"), + QUAD_ARROW_CALLOUT(62, 83, "QuadArrowCallout"), + BENT_ARROW(63, 91, "BentArrow"), + UTURN_ARROW(64, 101, "UturnArrow"), + CIRCULAR_ARROW(65, 99, "CircularArrow"), + LEFT_CIRCULAR_ARROW(66, -1, null), + LEFT_RIGHT_CIRCULAR_ARROW(67, -1, null), + CURVED_RIGHT_ARROW(68, 102, "CurvedRightArrow"), + CURVED_LEFT_ARROW(69, 103, "CurvedLeftArrow"), + CURVED_UP_ARROW(70, 104, "CurvedUpArrow"), + CURVED_DOWN_ARROW(71, 105, "CurvedDownArrow"), + SWOOSH_ARROW(72, -1, null), + CUBE(73, 16, "Cube"), + CAN(74, 22, "Can"), + LIGHTNING_BOLT(75, 73, "LightningBolt"), + HEART(76, 74, "Heart"), + SUN(77, 183, "Sun"), + MOON(78, 184, "Moon"), + SMILEY_FACE(79, 96, "SmileyFace"), + IRREGULAR_SEAL_1(80, 71, "IrregularSeal1"), + IRREGULAR_SEAL_2(81, 72, "IrregularSeal2"), + FOLDED_CORNER(82, 65, "FoldedCorner"), + BEVEL(83, 84, "Bevel"), + FRAME(84, 75, "PictureFrame"), + HALF_FRAME(85, -1, null), + CORNER(86, -1, null), + DIAG_STRIPE(87, -1, null), + CHORD(88, -1, null), + ARC(89, 19, "Arc"), + LEFT_BRACKET(90, 85, "LeftBracket"), + RIGHT_BRACKET(91, 86, "RightBracket"), + LEFT_BRACE(92, 87, "LeftBrace"), + RIGHT_BRACE(93, 88, "RightBrace"), + BRACKET_PAIR(94, 185, "BracketPair"), + BRACE_PAIR(95, 186, "BracePair"), + STRAIGHT_CONNECTOR_1(96, 32, "StraightConnector1"), + BENT_CONNECTOR_2(97, 33, "BentConnector2"), + BENT_CONNECTOR_3(98, 34, "BentConnector3"), + BENT_CONNECTOR_4(99, 35, "BentConnector4"), + BENT_CONNECTOR_5(100, 36, "BentConnector5"), + CURVED_CONNECTOR_2(101, 37, "CurvedConnector2"), + CURVED_CONNECTOR_3(102, 38, "CurvedConnector3"), + CURVED_CONNECTOR_4(103, 39, "CurvedConnector4"), + CURVED_CONNECTOR_5(104, 40, "CurvedConnector5"), + CALLOUT_1(105, 41, "Callout1"), + CALLOUT_2(106, 42, "Callout2"), + CALLOUT_3(107, 43, "Callout3"), + ACCENT_CALLOUT_1(108, 44, "AccentCallout1"), + ACCENT_CALLOUT_2(109, 45, "AccentCallout2"), + ACCENT_CALLOUT_3(110, 46, "AccentCallout3"), + BORDER_CALLOUT_1(111, 47, "BorderCallout1"), + BORDER_CALLOUT_2(112, 48, "BorderCallout2"), + BORDER_CALLOUT_3(113, 49, "BorderCallout3"), + ACCENT_BORDER_CALLOUT_1(114, 50, "AccentBorderCallout1"), + ACCENT_BORDER_CALLOUT_2(115, 51, "AccentBorderCallout2"), + ACCENT_BORDER_CALLOUT_3(116, 52, "AccentBorderCallout3"), + WEDGE_RECT_CALLOUT(117, 61, "WedgeRectCallout"), + WEDGE_ROUND_RECT_CALLOUT(118, 62, "WedgeRRectCallout"), + WEDGE_ELLIPSE_CALLOUT(119, 63, "WedgeEllipseCallout"), + CLOUD_CALLOUT(120, 106, "CloudCallout"), + CLOUD(121, -1, null), + RIBBON(122, 53, "Ribbon"), + RIBBON_2(123, 54, "Ribbon2"), + ELLIPSE_RIBBON(124, 107, "EllipseRibbon"), + ELLIPSE_RIBBON_2(125, 108, "EllipseRibbon2"), + LEFT_RIGHT_RIBBON(126, -1, null), + VERTICAL_SCROLL(127, 97, "VerticalScroll"), + HORIZONTAL_SCROLL(128, 98, "HorizontalScroll"), + WAVE(129, 64, "Wave"), + DOUBLE_WAVE(130, 188, "DoubleWave"), + PLUS(131, 11, "Plus"), + FLOW_CHART_PROCESS(132, 109, "FlowChartProcess"), + FLOW_CHART_DECISION(133, 110, "FlowChartDecision"), + FLOW_CHART_INPUT_OUTPUT(134, 111, "FlowChartInputOutput"), + FLOW_CHART_PREDEFINED_PROCESS(135, 112, "FlowChartPredefinedProcess"), + FLOW_CHART_INTERNAL_STORAGE(136, 113, "FlowChartInternalStorage"), + FLOW_CHART_DOCUMENT(137, 114, "FlowChartDocument"), + FLOW_CHART_MULTIDOCUMENT(138, 115, "FlowChartMultidocument"), + FLOW_CHART_TERMINATOR(139, 116, "FlowChartTerminator"), + FLOW_CHART_PREPARATION(140, 117, "FlowChartPreparation"), + FLOW_CHART_MANUAL_INPUT(141, 118, "FlowChartManualInput"), + FLOW_CHART_MANUAL_OPERATION(142, 119, "FlowChartManualOperation"), + FLOW_CHART_CONNECTOR(143, 120, "FlowChartConnector"), + FLOW_CHART_PUNCHED_CARD(144, 121, "FlowChartPunchedCard"), + FLOW_CHART_PUNCHED_TAPE(145, 122, "FlowChartPunchedTape"), + FLOW_CHART_SUMMING_JUNCTION(146, 123, "FlowChartSummingJunction"), + FLOW_CHART_OR(147, 124, "FlowChartOr"), + FLOW_CHART_COLLATE(148, 125, "FlowChartCollate"), + FLOW_CHART_SORT(149, 126, "FlowChartSort"), + FLOW_CHART_EXTRACT(150, 127, "FlowChartExtract"), + FLOW_CHART_MERGE(151, 128, "FlowChartMerge"), + FLOW_CHART_OFFLINE_STORAGE(152, 129, "FlowChartOfflineStorage"), + FLOW_CHART_ONLINE_STORAGE(153, 130, "FlowChartOnlineStorage"), + FLOW_CHART_MAGNETIC_TAPE(154, 131, "FlowChartMagneticTape"), + FLOW_CHART_MAGNETIC_DISK(155, 132, "FlowChartMagneticDisk"), + FLOW_CHART_MAGNETIC_DRUM(156, 133, "FlowChartMagneticDrum"), + FLOW_CHART_DISPLAY(157, 134, "FlowChartDisplay"), + FLOW_CHART_DELAY(158, 135, "FlowChartDelay"), + FLOW_CHART_ALTERNATE_PROCESS(159, 176, "FlowChartAlternateProcess"), + FLOW_CHART_OFFPAGE_CONNECTOR(160, 177, "FlowChartOffpageConnector"), + ACTION_BUTTON_BLANK(161, 189, "ActionButtonBlank"), + ACTION_BUTTON_HOME(162, 190, "ActionButtonHome"), + ACTION_BUTTON_HELP(163, 191, "ActionButtonHelp"), + ACTION_BUTTON_INFORMATION(164, 192, "ActionButtonInformation"), + ACTION_BUTTON_FORWARD_NEXT(165, 193, "ActionButtonForwardNext"), + ACTION_BUTTON_BACK_PREVIOUS(166, 194, "ActionButtonBackPrevious"), + ACTION_BUTTON_END(167, 195, "ActionButtonEnd"), + ACTION_BUTTON_BEGINNING(168, 196, "ActionButtonBeginning"), + ACTION_BUTTON_RETURN(169, 197, "ActionButtonReturn"), + ACTION_BUTTON_DOCUMENT(170, 198, "ActionButtonDocument"), + ACTION_BUTTON_SOUND(171, 199, "ActionButtonSound"), + ACTION_BUTTON_MOVIE(172, 200, "ActionButtonMovie"), + GEAR_6(173, -1, null), + GEAR_9(174, -1, null), + FUNNEL(175, -1, null), + MATH_PLUS(176, -1, null), + MATH_MINUS(177, -1, null), + MATH_MULTIPLY(178, -1, null), + MATH_DIVIDE(179, -1, null), + MATH_EQUAL(180, -1, null), + MATH_NOT_EQUAL(181, -1, null), + CORNER_TABS(182, -1, null), + SQUARE_TABS(183, -1, null), + PLAQUE_TABS(184, -1, null), + CHART_X(185, -1, null), + CHART_STAR(186, -1, null), + CHART_PLUS(187, -1, null), + // below are shape types only found in native + NOTCHED_CIRCULAR_ARROW(-1, 100, "NotchedCircularArrow"), + THICK_ARROW(-1, 14, "ThickArrow"), + BALLOON(-1, 17, "Balloon"), + TEXT_SIMPLE(-1, 24, "TextSimple"), + TEXT_OCTAGON(-1, 25, "TextOctagon"), + TEXT_HEXAGON(-1, 26, "TextHexagon"), + TEXT_CURVE(-1, 27, "TextCurve"), + TEXT_WAVE(-1, 28, "TextWave"), + TEXT_RING(-1, 29, "TextRing"), + TEXT_ON_CURVE(-1, 30, "TextOnCurve"), + TEXT_ON_RING(-1, 31, "TextOnRing"), + TEXT_PLAIN_TEXT(-1, 136, "TextPlainText"), + TEXT_STOP(-1, 137, "TextStop"), + TEXT_TRIANGLE(-1, 138, "TextTriangle"), + TEXT_TRIANGLE_INVERTED(-1, 139, "TextTriangleInverted"), + TEXT_CHEVRON(-1, 140, "TextChevron"), + TEXT_CHEVRON_INVERTED(-1, 141, "TextChevronInverted"), + TEXT_RING_INSIDE(-1, 142, "TextRingInside"), + TEXT_RING_OUTSIDE(-1, 143, "TextRingOutside"), + TEXT_ARCH_UP_CURVE(-1, 144, "TextArchUpCurve"), + TEXT_ARCH_DOWN_CURVE(-1, 145, "TextArchDownCurve"), + TEXT_CIRCLE_CURVE(-1, 146, "TextCircleCurve"), + TEXT_BUTTON_CURVE(-1, 147, "TextButtonCurve"), + TEXT_ARCH_UP_POUR(-1, 148, "TextArchUpPour"), + TEXT_ARCH_DOWN_POUR(-1, 149, "TextArchDownPour"), + TEXT_CIRCLE_POUR(-1, 150, "TextCirclePour"), + TEXT_BUTTON_POUR(-1, 151, "TextButtonPour"), + TEXT_CURVE_UP(-1, 152, "TextCurveUp"), + TEXT_CURVE_DOWN(-1, 153, "TextCurveDown"), + TEXT_CASCADE_UP(-1, 154, "TextCascadeUp"), + TEXT_CASCADE_DOWN(-1, 155, "TextCascadeDown"), + TEXT_WAVE_1(-1, 156, "TextWave1"), + TEXT_WAVE_2(-1, 157, "TextWave2"), + TEXT_WAVE_3(-1, 158, "TextWave3"), + TEXT_WAVE_4(-1, 159, "TextWave4"), + TEXT_INFLATE(-1, 160, "TextInflate"), + TEXT_DEFLATE(-1, 161, "TextDeflate"), + TEXT_INFLATE_BOTTOM(-1, 162, "TextInflateBottom"), + TEXT_DEFLATE_BOTTOM(-1, 163, "TextDeflateBottom"), + TEXT_INFLATE_TOP(-1, 164, "TextInflateTop"), + TEXT_DEFLATE_TOP(-1, 165, "TextDeflateTop"), + TEXT_DEFLATE_INFLATE(-1, 166, "TextDeflateInflate"), + TEXT_DEFLATE_INFLATE_DEFLATE(-1, 167, "TextDeflateInflateDeflate"), + TEXT_FADE_RIGHT(-1, 168, "TextFadeRight"), + TEXT_FADE_LEFT(-1, 169, "TextFadeLeft"), + TEXT_FADE_UP(-1, 170, "TextFadeUp"), + TEXT_FADE_DOWN(-1, 171, "TextFadeDown"), + TEXT_SLANT_UP(-1, 172, "TextSlantUp"), + TEXT_SLANT_DOWN(-1, 173, "TextSlantDown"), + TEXT_CAN_UP(-1, 174, "TextCanUp"), + TEXT_CAN_DOWN(-1, 175, "TextCanDown"), + CALLOUT_90(-1, 178, "Callout90"), + ACCENT_CALLOUT_90(-1, 179, "AccentCallout90"), + BORDER_CALLOUT_90(-1, 180, "BorderCallout90"), + ACCENT_BORDER_CALLOUT_90(-1, 181, "AccentBorderCallout90"), + HOST_CONTROL(-1, 201, "HostControl"), + TEXT_BOX(-1, 202, "TextBox") + ; + + /** Preset-ID for XML-based shapes */ + public final int ooxmlId; + + /** Preset-ID for binary-based shapes */ + public final int nativeId; + + /** POI-specific name for the binary-based type */ + public final String nativeName; + + ShapeType(int ooxmlId, int nativeId, String nativeName){ + this.ooxmlId = ooxmlId; + this.nativeId = nativeId; + this.nativeName = nativeName; + } + + /** name of the presetShapeDefinit(i)on entry */ + public String getOoxmlName() { + if (this == SEAL) return STAR_16.getOoxmlName(); + if (ooxmlId == -1) { + return (name().startsWith("TEXT")) ? RECT.getOoxmlName() : null; + } + + StringBuilder sb = new StringBuilder(); + boolean toLower = true; + for (char ch : name().toCharArray()) { + if (ch == '_') { + toLower = false; + continue; + } + sb.append(toLower ? Character.toLowerCase(ch) : Character.toUpperCase(ch)); + toLower = true; + } + + return sb.toString(); + } + + public static ShapeType forId(int id, boolean isOoxmlId){ + for(ShapeType t : values()){ + if((isOoxmlId && t.ooxmlId == id) || + (!isOoxmlId && t.nativeId == id)) return t; + } + throw new IllegalArgumentException("Unknown shape type: " + id); + } +} diff --git a/src/java/org/apache/poi/sl/usermodel/Sheet.java b/src/java/org/apache/poi/sl/usermodel/Sheet.java new file mode 100644 index 0000000000..f94b7727a7 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/Sheet.java @@ -0,0 +1,46 @@ +/* ==================================================================== + 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; + +import java.awt.Graphics2D; + + +/** + * Common parent of Slides, Notes and Masters + */ +public interface Sheet<T extends Shape, SS extends SlideShow> extends ShapeContainer<T> { + SS getSlideShow(); + + /** + * @return whether shapes on the master sheet should be shown. By default master graphics is turned off. + * Sheets that support the notion of master (slide, slideLayout) should override it and + * check this setting in the sheet XML + */ + boolean getFollowMasterGraphics(); + + MasterSheet<T,SS> getMasterSheet(); + + Background getBackground(); + + /** + * Convenience method to draw a sheet to a graphics context + * + * @param graphics + */ + void draw(Graphics2D graphics); +} diff --git a/src/java/org/apache/poi/sl/usermodel/SimpleShape.java b/src/java/org/apache/poi/sl/usermodel/SimpleShape.java new file mode 100644 index 0000000000..e4e8efe3a1 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/SimpleShape.java @@ -0,0 +1,36 @@ +/* ==================================================================== + 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; + +import org.apache.poi.sl.draw.geom.CustomGeometry; +import org.apache.poi.sl.draw.geom.IAdjustableShape; + + +public interface SimpleShape extends Shape, IAdjustableShape, PlaceableShape { + FillStyle getFillStyle(); + LineDecoration getLineDecoration(); + StrokeStyle getStrokeStyle(); + + CustomGeometry getGeometry(); + + ShapeType getShapeType(); + + boolean isPlaceholder(); + + Shadow getShadow(); +} diff --git a/src/java/org/apache/poi/sl/usermodel/Slide.java b/src/java/org/apache/poi/sl/usermodel/Slide.java new file mode 100644 index 0000000000..7b238de176 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/Slide.java @@ -0,0 +1,37 @@ +/* ==================================================================== + 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 Slide<T extends Shape, SS extends SlideShow, N extends Notes<T,SS>> extends Sheet<T, SS> { + N getNotes(); + void setNotes(N notes); + + boolean getFollowMasterBackground(); + void setFollowMasterBackground(boolean follow); + + boolean getFollowMasterColourScheme(); + void setFollowMasterColourScheme(boolean follow); + + boolean getFollowMasterObjects(); + void setFollowMasterObjects(boolean follow); + + /** + * @return the 1-based slide no. + */ + int getSlideNumber(); +} diff --git a/src/java/org/apache/poi/sl/usermodel/SlideShow.java b/src/java/org/apache/poi/sl/usermodel/SlideShow.java new file mode 100644 index 0000000000..ca0ddf3918 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/SlideShow.java @@ -0,0 +1,45 @@ +/* ==================================================================== + 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; + +import java.awt.Dimension; +import java.io.IOException; +import java.util.List; + +public interface SlideShow { + Slide<? extends Shape, ? extends SlideShow, ? extends Notes<?,?>> createSlide() throws IOException; + + List<? extends Slide<? extends Shape, ? extends SlideShow, ? extends Notes<?,?>>> getSlides(); + + MasterSheet<? extends Shape, ? extends SlideShow> createMasterSheet() throws IOException; + + /** + * Returns all slide masters. + * This doesn't include notes master and other arbitrary masters. + */ + List<? extends MasterSheet<? extends Shape, ? extends SlideShow>> getSlideMasters(); + + Resources getResources(); + + /** + * Returns the current page size + * + * @return the page size + */ + Dimension getPageSize(); +} diff --git a/src/java/org/apache/poi/sl/usermodel/StrokeStyle.java b/src/java/org/apache/poi/sl/usermodel/StrokeStyle.java new file mode 100644 index 0000000000..244173fed4 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/StrokeStyle.java @@ -0,0 +1,129 @@ +/* ==================================================================== + 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 StrokeStyle { + enum LineCap { + /** Rounded ends */ + ROUND(1), + /** Square protrudes by half line width */ + SQUARE(2), + /** Line ends at end point*/ + FLAT(3); + + public final int ooxmlId; + + LineCap(int ooxmlId) { + this.ooxmlId = ooxmlId; + } + + public static LineCap fromOoxmlId(int ooxmlId) { + for (LineCap lc : values()) { + if (lc.ooxmlId == ooxmlId) return lc; + } + return null; + } + } + + /** + * The line dash with pattern. + * The pattern is derived empirically on PowerPoint 2010 and needs to be multiplied + * with actual line width + */ + enum LineDash { + /** Solid (continuous) pen - native 1 */ + SOLID(1, 1, null), + /** square dot style - native 6 */ + DOT(6, 2, 1,1), + /** dash style - native 7 */ + DASH(7, 3, 3,4), + /** dash short dash - native 9*/ + DASH_DOT(9, 5, 4,3,1,3), + /** long dash style - native 8 */ + LG_DASH(8, 4, 8,3), + /** long dash short dash - native 10 */ + LG_DASH_DOT(10, 6, 8,3,1,3), + /** long dash short dash short dash - native 11 */ + LG_DASH_DOT_DOT(11, 7, 8,3,1,3,1,3), + /** PS_DASH system dash style - native 2 */ + SYS_DASH(2, 8, 2,2), + /** PS_DOT system dash style - native 3 */ + SYS_DOT(3, 9, 1,1), + /** PS_DASHDOT system dash style - native 4 */ + SYS_DASH_DOT(4, 10, 2,2,1,1), + /** PS_DASHDOTDOT system dash style / native 5 */ + SYS_DASH_DOT_DOT(5, 11, 2,2,1,1,1,1); + + public final int pattern[]; + public final int nativeId; + public final int ooxmlId; + + LineDash(int nativeId, int ooxmlId, int... pattern) { + this.nativeId = nativeId; + this.ooxmlId = ooxmlId; + this.pattern = (pattern == null || pattern.length == 0) ? null : pattern; + } + + public static LineDash fromNativeId(int nativeId) { + for (LineDash ld : values()) { + if (ld.nativeId == nativeId) return ld; + } + return null; + } + + public static LineDash fromOoxmlId(int ooxmlId) { + for (LineDash ld : values()) { + if (ld.ooxmlId == ooxmlId) return ld; + } + return null; + } + } + + enum LineCompound { + /** Single line (of width lineWidth) - native 0 / ooxml default */ + SINGLE(0), + /** Double lines of equal width - native 1 / ooxml "dbl" */ + DOUBLE(1), + /** Double lines, one thick, one thin - native 2 / ooxml "thickThin" */ + THICK_THIN(2), + /** Double lines, reverse order - native 3 / ooxml "thinThick" */ + THIN_THICK(3), + /** Three lines, thin, thick, thin - native 4 / ooxml "tri" */ + TRIPLE(4); + + public final int nativeId; + + LineCompound(int nativeId) { + this.nativeId = nativeId; + } + + public static LineCompound fromNativeId(int nativeId) { + for (LineCompound lc : values()) { + if (lc.nativeId == nativeId) return lc; + } + return null; + } + } + + + PaintStyle getPaint(); + LineCap getLineCap(); + LineDash getLineDash(); + LineCompound getLineCompound(); + double getLineWidth(); +} diff --git a/src/java/org/apache/poi/sl/usermodel/TableShape.java b/src/java/org/apache/poi/sl/usermodel/TableShape.java new file mode 100644 index 0000000000..4fda40f2df --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/TableShape.java @@ -0,0 +1,22 @@ +/* ====================================================================
+ 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 TableShape extends Shape, PlaceableShape {
+ // to be defined ...
+}
diff --git a/src/java/org/apache/poi/sl/usermodel/TextBox.java b/src/java/org/apache/poi/sl/usermodel/TextBox.java new file mode 100644 index 0000000000..3fa3bbe20d --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/TextBox.java @@ -0,0 +1,21 @@ +/* ==================================================================== + 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 TextBox<T extends TextParagraph<? extends TextRun>> extends AutoShape<T> { +} diff --git a/src/java/org/apache/poi/sl/usermodel/TextParagraph.java b/src/java/org/apache/poi/sl/usermodel/TextParagraph.java new file mode 100644 index 0000000000..a914dd7cb3 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/TextParagraph.java @@ -0,0 +1,324 @@ +/* ====================================================================
+ 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;
+
+import java.awt.Color;
+
+
+public interface TextParagraph<T extends TextRun> extends Iterable<T> {
+
+ /**
+ * Specifies a list of text alignment types
+ */
+ public enum TextAlign {
+ /**
+ * For horizontal text, left aligned.
+ * For vertical text, top aligned.
+ */
+ LEFT,
+
+ /**
+ * For horizontal text, centered.
+ * For vertical text, middle aligned.
+ */
+ CENTER,
+
+ /**
+ * For horizontal text, right aligned.
+ * For vertical text, bottom aligned.
+ */
+ RIGHT,
+
+ /**
+ * Align text so that it is justified across the whole line. It
+ * is smart in the sense that it will not justify sentences
+ * which are short
+ *
+ * For horizontal text, flush left and right.
+ * For vertical text, flush top and bottom.
+ */
+ JUSTIFY,
+
+ /**
+ * Kashida justify low.
+ */
+ JUSTIFY_LOW,
+
+ /**
+ * Distribute space between characters.
+ */
+ DIST,
+
+ /**
+ * Thai distribution justification.
+ */
+ THAI_DIST
+ }
+
+ /**
+ *
+ */
+ public enum FontAlign {
+ AUTO,
+
+ /**
+ * Characters hang from top of line height.
+ * Also known as "Hanging"
+ */
+ TOP,
+
+ /**
+ * Characters centered within line height.
+ */
+ CENTER,
+
+ /**
+ * Place characters on font baseline.
+ * Also known as "Roman"
+ */
+ BASELINE,
+
+ /**
+ * Characters are anchored to the very bottom of a single line.
+ * This is different than BASELINE because of letters such as "g", "q", and "y".
+ * Also known as "UpholdFixed"
+ */
+ BOTTOM;
+ }
+
+ public interface BulletStyle {
+ String getBulletCharacter();
+ String getBulletFont();
+
+ /**
+ * The bullet point font size
+ * If bulletFontSize >= 0, then space is a percentage of normal line height.
+ * If bulletFontSize < 0, the absolute value in points
+ *
+ * @return the bullet point font size
+ */
+ Double getBulletFontSize();
+ Color getBulletFontColor();
+
+ AutoNumberingScheme getAutoNumberingScheme();
+ /**
+ * Index (1-based) of the first auto number value, or null if auto numbering scheme
+ * wasn't assigned.
+ */
+ Integer getAutoNumberingStartAt();
+ }
+
+ /**
+ * The amount of vertical white space before the paragraph
+ * This may be specified in two different ways, percentage spacing and font point spacing:
+ * <p>
+ * If spaceBefore >= 0, then space is a percentage of normal line height.
+ * If spaceBefore < 0, the absolute value in points
+ * </p>
+ *
+ * @return the vertical white space before the paragraph, or null if unset
+ */
+ Double getSpaceBefore();
+
+ /**
+ * Set the amount of vertical white space that will be present before the paragraph.
+ * This space is specified in either percentage or points:
+ * <p>
+ * If spaceBefore >= 0, then space is a percentage of normal line height.
+ * If spaceBefore < 0, the absolute value of linespacing is the spacing in points
+ * </p>
+ * Examples:
+ * <pre><code>
+ * // The paragraph will be formatted to have a spacing before the paragraph text.
+ * // The spacing will be 200% of the size of the largest text on each line
+ * paragraph.setSpaceBefore(200);
+ *
+ * // The spacing will be a size of 48 points
+ * paragraph.setSpaceBefore(-48.0);
+ * </code></pre>
+ *
+ * @param spaceBefore the vertical white space before the paragraph, null to unset
+ */
+ void setSpaceBefore(Double spaceBefore);
+
+ /**
+ * The amount of vertical white space after the paragraph
+ * This may be specified in two different ways, percentage spacing and font point spacing:
+ * <p>
+ * If spaceBefore >= 0, then space is a percentage of normal line height.
+ * If spaceBefore < 0, the absolute value of linespacing is the spacing in points
+ * </p>
+ *
+ * @return the vertical white space after the paragraph or null, if unset
+ */
+ Double getSpaceAfter();
+
+ /**
+ * Set the amount of vertical white space that will be present after the paragraph.
+ * This space is specified in either percentage or points:
+ * <p>
+ * If spaceAfter >= 0, then space is a percentage of normal line height.
+ * If spaceAfter < 0, the absolute value of linespacing is the spacing in points
+ * </p>
+ * Examples:
+ * <pre><code>
+ * // The paragraph will be formatted to have a spacing after the paragraph text.
+ * // The spacing will be 200% of the size of the largest text on each line
+ * paragraph.setSpaceAfter(200);
+ *
+ * // The spacing will be a size of 48 points
+ * paragraph.setSpaceAfter(-48.0);
+ * </code></pre>
+ *
+ * @param spaceAfter the vertical white space after the paragraph, null to unset
+ */
+ public void setSpaceAfter(Double spaceAfter);
+
+ /**
+ * @return the left margin (in points) of the paragraph or null, if unset
+ */
+ Double getLeftMargin();
+
+ /**
+ * Specifies the left margin of the paragraph. This is specified in addition to the text body
+ * inset and applies only to this text paragraph. That is the text body Inset and the LeftMargin
+ * attributes are additive with respect to the text position.
+ *
+ * @param leftMargin the left margin (in points) or null to unset
+ */
+ void setLeftMargin(Double leftMargin);
+
+
+ /**
+ * Specifies the right margin of the paragraph. This is specified in addition to the text body
+ * inset and applies only to this text paragraph. That is the text body Inset and the RightMargin
+ * attributes are additive with respect to the text position.
+ *
+ * The right margin is not support and therefore ignored by the HSLF implementation.
+ *
+ * @return the right margin (in points) of the paragraph or null, if unset
+ */
+ Double getRightMargin();
+
+ /**
+ * @param rightMargin the right margin (in points) of the paragraph
+ */
+ void setRightMargin(Double rightMargin);
+
+ /**
+ * @return the indent (in points) applied to the first line of text in the paragraph.
+ * or null, if unset
+ */
+ Double getIndent();
+
+ /**
+ * Specifies the indent size that will be applied to the first line of text in the paragraph.
+ *
+ * @param indent the indent (in points) applied to the first line of text in the paragraph
+ */
+ void setIndent(Double indent);
+
+
+ /**
+ * @return the text level of this paragraph (0-based). Default is 0.
+ */
+ int getIndentLevel();
+
+ /**
+ * Specifies the particular level text properties that this paragraph will follow.
+ * The value for this attribute formats the text according to the corresponding level
+ * paragraph properties defined in the SlideMaster.
+ *
+ * @param level the level (0 ... 4)
+ */
+ void setIndentLevel(int level);
+
+ /**
+ * Returns the vertical line spacing that is to be used within a paragraph.
+ * This may be specified in two different ways, percentage spacing and font point spacing:
+ * <p>
+ * If linespacing >= 0, then linespacing is a percentage of normal line height.
+ * If linespacing < 0, the absolute value of linespacing is the spacing in points
+ * </p>
+ *
+ * @return the vertical line spacing or null, if unset
+ */
+ Double getLineSpacing();
+
+ /**
+ * This element specifies the vertical line spacing that is to be used within a paragraph.
+ * This may be specified in two different ways, percentage spacing and font point spacing:
+ * <p>
+ * If linespacing >= 0, then linespacing is a percentage of normal line height
+ * If linespacing < 0, the absolute value of linespacing is the spacing in points
+ * </p>
+ * Examples:
+ * <pre><code>
+ * // spacing will be 120% of the size of the largest text on each line
+ * paragraph.setLineSpacing(120);
+ *
+ * // spacing will be 200% of the size of the largest text on each line
+ * paragraph.setLineSpacing(200);
+ *
+ * // spacing will be 48 points
+ * paragraph.setLineSpacing(-48.0);
+ * </code></pre>
+ *
+ * @param linespacing the vertical line spacing
+ */
+ void setLineSpacing(Double lineSpacing);
+
+ String getDefaultFontFamily();
+
+ /**
+ * @return the default font size, in case its not set in the textrun or null, if unset
+ */
+ Double getDefaultFontSize();
+
+ /**
+ * Returns the alignment that is applied to the paragraph.
+ *
+ * If this attribute is omitted, then a value of left is implied.
+ * @return ??? alignment that is applied to the paragraph
+ */
+ TextAlign getTextAlign();
+
+
+ /**
+ * Returns the font alignment that is applied to the paragraph.
+ *
+ * If this attribute is omitted, then null is return,
+ * user code can imply the a value of {@link FontAlign#AUTO}
+ *
+ * @return alignment that is applied to the paragraph
+ */
+ FontAlign getFontAlign();
+
+ /**
+ * @return the bullet style of the paragraph, if {@code null} then no bullets are used
+ */
+ BulletStyle getBulletStyle();
+
+ /**
+ * @return the default size for a tab character within this paragraph in points, null if unset
+ */
+ Double getDefaultTabSize();
+
+
+ TextShape<? extends TextParagraph<T>> getParentShape();
+}
diff --git a/src/java/org/apache/poi/sl/usermodel/TextRun.java b/src/java/org/apache/poi/sl/usermodel/TextRun.java new file mode 100644 index 0000000000..946bfc3217 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/TextRun.java @@ -0,0 +1,63 @@ +/* ==================================================================== + 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; + +import java.awt.Color; + +/** + * Some text. + */ +public interface TextRun { + enum TextCap { + NONE, + SMALL, + ALL + } + + String getRawText(); + void setText(String text); + + TextCap getTextCap(); + + Color getFontColor(); + void setFontColor(Color color); + + + /** + * @return font size in points or null if font size is not set. + */ + Double getFontSize(); + + /** + * @param fontSize font size in points, if null the underlying fontsize will be unset + */ + void setFontSize(Double fontSize); + String getFontFamily(); + + boolean isBold(); + boolean isItalic(); + boolean isUnderlined(); + boolean isStrikethrough(); + boolean isSubscript(); + boolean isSuperscript(); + + /** + * @return the pitch and family id or -1 if not applicable + */ + byte getPitchAndFamily(); +} diff --git a/src/java/org/apache/poi/sl/usermodel/TextShape.java b/src/java/org/apache/poi/sl/usermodel/TextShape.java new file mode 100644 index 0000000000..927fdf1f9d --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/TextShape.java @@ -0,0 +1,128 @@ +/* ====================================================================
+ 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;
+
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+
+
+
+public interface TextShape<T extends TextParagraph<? extends TextRun>> extends SimpleShape, Iterable<T> {
+ /**
+ * Vertical Text Types
+ */
+ public enum TextDirection {
+ /**
+ * Horizontal text. This should be default.
+ */
+ HORIZONTAL,
+ /**
+ * Vertical orientation.
+ * (each line is 90 degrees rotated clockwise, so it goes
+ * from top to bottom; each next line is to the left from
+ * the previous one).
+ */
+ VERTICAL,
+ /**
+ * Vertical orientation.
+ * (each line is 270 degrees rotated clockwise, so it goes
+ * from bottom to top; each next line is to the right from
+ * the previous one).
+ */
+ VERTICAL_270,
+ /**
+ * Determines if all of the text is vertical
+ * ("one letter on top of another").
+ */
+ STACKED;
+ }
+
+ /**
+ * Specifies alist of auto-fit types.
+ * <p>
+ * Autofit specofies that a shape should be auto-fit to fully contain the text described within it.
+ * Auto-fitting is when text within a shape is scaled in order to contain all the text inside
+ * </p>
+ */
+ public enum TextAutofit {
+ /**
+ * Specifies that text within the text body should not be auto-fit to the bounding box.
+ * Auto-fitting is when text within a text box is scaled in order to remain inside
+ * the text box.
+ */
+ NONE,
+ /**
+ * Specifies that text within the text body should be normally auto-fit to the bounding box.
+ * Autofitting is when text within a text box is scaled in order to remain inside the text box.
+ *
+ * <p>
+ * <em>Example:</em> Consider the situation where a user is building a diagram and needs
+ * to have the text for each shape that they are using stay within the bounds of the shape.
+ * An easy way this might be done is by using NORMAL autofit
+ * </p>
+ */
+ NORMAL,
+ /**
+ * Specifies that a shape should be auto-fit to fully contain the text described within it.
+ * Auto-fitting is when text within a shape is scaled in order to contain all the text inside.
+ *
+ * <p>
+ * <em>Example:</em> Consider the situation where a user is building a diagram and needs to have
+ * the text for each shape that they are using stay within the bounds of the shape.
+ * An easy way this might be done is by using SHAPE autofit
+ * </p>
+ */
+ SHAPE
+ }
+
+ /**
+ * @return text shape margin
+ */
+ Insets2D getInsets();
+
+ /**
+ * Compute the cumulative height occupied by the text
+ */
+ double getTextHeight();
+
+ /**
+ * Returns the type of vertical alignment for the text.
+ *
+ * @return the type of vertical alignment
+ */
+ VerticalAlignment getVerticalAlignment();
+
+ /**
+ * Returns if the text is centered.
+ * If true and if the individual paragraph settings allow it,
+ * the whole text block will be displayed centered, i.e. its left and right
+ * margin will be maximized while still keeping the alignment of the paragraphs
+ *
+ * @return true, if the text anchor is horizontal centered
+ */
+ boolean isHorizontalCentered();
+
+ /**
+ * @return whether to wrap words within the bounding rectangle
+ */
+ boolean getWordWrap();
+
+ /**
+ * @return vertical orientation of the text
+ */
+ TextDirection getTextDirection();
+}
diff --git a/src/java/org/apache/poi/sl/usermodel/VerticalAlignment.java b/src/java/org/apache/poi/sl/usermodel/VerticalAlignment.java new file mode 100644 index 0000000000..540bf2ed51 --- /dev/null +++ b/src/java/org/apache/poi/sl/usermodel/VerticalAlignment.java @@ -0,0 +1,71 @@ +/*
+ * ====================================================================
+ * 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;
+
+/**
+ * Specifies a list of available anchoring types for text
+ *
+ * @author Yegor Kozlov
+ */
+public enum VerticalAlignment {
+ /**
+ * Anchor the text at the top of the bounding rectangle
+ */
+ TOP,
+
+ /**
+ * Anchor the text at the middle of the bounding rectangle
+ */
+ MIDDLE,
+
+ /**
+ * Anchor the text at the bottom of the bounding rectangle.
+ */
+ BOTTOM,
+
+ /**
+ * Anchor the text so that it is justified vertically.
+ * <p>
+ * When text is horizontal, this spaces out the actual lines of
+ * text and is almost always identical in behavior to
+ * {@link #DISTRIBUTED} (special case: if only 1 line, then anchored at top).
+ * </p>
+ * <p>
+ * When text is vertical, then it justifies the letters
+ * vertically. This is different than {@link #DISTRIBUTED},
+ * because in some cases such as very little text in a line,
+ * it will not justify.
+ * </p>
+ */
+ JUSTIFIED,
+
+ /**
+ * Anchor the text so that it is distributed vertically.
+ * <p>
+ * When text is horizontal, this spaces out the actual lines
+ * of text and is almost always identical in behavior to
+ * {@link #JUSTIFIED} (special case: if only 1 line, then anchored in middle).
+ * </p>
+ * <p>
+ * When text is vertical, then it distributes the letters vertically.
+ * This is different than {@link #JUSTIFIED}, because it always forces distribution
+ * of the words, even if there are only one or two words in a line.
+ */
+ DISTRIBUTED
+}
|