Class DrawingPropsIdTracker
java.lang.Object
org.docx4j.openpackaging.parts.WordprocessingML.DrawingPropsIdTracker
public class DrawingPropsIdTracker
extends java.lang.Object
wp:docPr/@id must be unique across all parts in a docx,
otherwise Word can't open the docx. This problem is
difficult to track down if you aren't aware of it,
so this class attempts to keep track of Ids in use,
and dispense unique values.
There is one DocPropIdTracker per package.
Relies on Docx4jUnmarshallerListener so is susceptible
to those cases where that listener is not listening.
- Since:
- 11.4.6
- Author:
- jharrop
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
log
-
Constructor Summary
Constructors Constructor Description DrawingPropsIdTracker()
-
Method Summary
Modifier and Type Method Description void
deregisterPart(Part part)
If its been unmarshalled, we'll already know about any docPr ids it may contain, so forget about it.long
generateId()
If this throws an exception, you'll have to create an Id on your own.void
registerId(long num)
void
registerPart(Part part)
Keep track of parts which are yet to be unmarshalled.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
log
protected static org.slf4j.Logger log
-
-
Constructor Details
-
DrawingPropsIdTracker
public DrawingPropsIdTracker()
-
-
Method Details
-
registerPart
Keep track of parts which are yet to be unmarshalled.- Parameters:
part
-
-
deregisterPart
If its been unmarshalled, we'll already know about any docPr ids it may contain, so forget about it.- Parameters:
part
-
-
registerId
public void registerId(long num) -
generateId
If this throws an exception, you'll have to create an Id on your own.- Returns:
- Throws:
Docx4JException
-