Author: fanningpj
Date: Wed Apr 29 20:21:20 2020
New Revision: 1877174
URL: http://svn.apache.org/viewvc?rev=1877174&view=rev
Log:
[github-178] Make isLatentStyle() public. This closes #178
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFLatentStyles.java
Modified:
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFLatentStyles.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFLatentStyles.java?rev=1877174&r1=1877173&r2=1877174&view=diff
==============================================================================
---
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFLatentStyles.java
(original)
+++
poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFLatentStyles.java
Wed Apr 29 20:21:20 2020
@@ -19,6 +19,16 @@ package org.apache.poi.xwpf.usermodel;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLatentStyles;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLsdException;
+/*
+ * Latent styles are style names that are known to the client (i.e., Word) but
that
+ * are mapped to real styles dynamically within the client. This means that
the only
+ * thing you can know about a latent style is its name.
+ * <p>
+ * When generating DOCX files it is useful to know if a given style name is a
+ * latent style so the DOCX generator can distinguish between attempts to
+ * use a latent style and attempts to use a completely undefined style.
+ * </p>
+ */
public class XWPFLatentStyles {
// As of 2016-06-10, POI does not contain a LatentStyle class, nor was one
included in the patch for bug 48574.
protected XWPFStyles styles; //LatentStyle shall know styles
@@ -41,14 +51,17 @@ public class XWPFLatentStyles {
}
/**
- * checks whether specific LatentStyleID is a latentStyle
+ * Determines if the specified style name is the name of a latent style.
+ * @param latentStyleName The name of the latent style to check for.
+ * @return true if the latent style is defined.
+ * @since 4.1.2
*/
- protected boolean isLatentStyle(String latentStyleID) {
+ public boolean isLatentStyle(String latentStyleName) {
for (CTLsdException lsd : latentStyles.getLsdExceptionArray()) {
- if (lsd.getName().equals(latentStyleID)) {
+ if (lsd.getName().equals(latentStyleName)) {
return true;
}
}
return false;
}
-}
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]