Class TextEmbed


  • public abstract class TextEmbed
    extends java.lang.Object
    This class represents an object embedded in a text stream. It serves as an abstract base class for application object implementations.

    The application must derive its own embedded object class(es). It can insert instances of its object into a stream as it sees fit. Insertion creates a copy; the application continues to own its instance and the stream owns the copy. The application must delete its own instance but must not delete the copy in the stream.

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract TextEmbed cloneEmbed()
      Pure virtual: Create a new instance
      The derived class must provide an implementation of Clone() that at least creates a new object of the correct (derived) type.
      void copyFrom​(TextEmbed oSource)
      Assignment operator
      Copy the content of the embedded object, but not its containing stream association.
      int embedAt()
      Overridable: Query the vertical placement rule for the object
      When text and embedded objects are mixed in a stream, embedded objects tend to appear bottom-aligned on the text baseline.
      boolean enforceHeight()
      Overridable: Query whether the object enforces its height
      This is likely legacy functionality.
      TextContext getContext()
      Get the object's text context.
      abstract void gfxDraw​(GFXEnv oEnv)
      Pure virtual: Draw the object in the given graphic environment
      This method is a call-back that AXTE framework calls to draw the object on a given graphic environment.
      void gfxSource​(TextGfxSource oGfxSource)
      Overridable: Set the object's graphic source
      This method allows the derived class to cache graphics source information (attribute pools, font mapper) used by the stream containing the object.
      abstract UnitSpan height()
      Pure virtual: Return the height of the object
      abstract boolean isEqual​(TextEmbed poCompare)
      Pure virtual: Compare embedded objects
      The derived class must implement this method.
      TextPosn position()
      Query the object's position in its owning stream
      An embedded object exists at some position in its containing stream.
      void setLegacyLevel​(int eLevel)
      Cascade the legacy level.
      void update​(boolean bEraseBkgnd)
      Tell the base class that the object has changed
      The derived class must support the ability to make changes through the derived object's API.
      abstract UnitSpan width()
      Pure virtual: Return the width of the object
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TextEmbed

        public TextEmbed()
        Constructor.

        Create an embedded object that is not currently embedded in any stream.

      • TextEmbed

        public TextEmbed​(TextEmbed oSource)
        Copy constructor.

        Create an embedded object by copying another embedded object. Note that the actual embed stream/position is not copied; the object is not initially embedded in any stream.

    • Method Detail

      • update

        public void update​(boolean bEraseBkgnd)
        Tell the base class that the object has changed
        The derived class must support the ability to make changes through the derived object's API. AXTE does not make changes to the object. When the derived object has changed, it must tell the base class, in order to get the display updated.
        Parameters:
        bEraseBkgnd - Optional: TRUE (default) if the object's background is to be erased first; FALSE if not.
      • getContext

        public TextContext getContext()
        Get the object's text context.
        The text context allows multiple streams to share common objects that are used at layout time, thereby reducing resource usage. This method returns a pointer to the text context in effect for this embedded object.
        Returns:
        Pointer to the text context; NULL if none is in effect.
      • position

        public TextPosn position()
        Query the object's position in its owning stream
        An embedded object exists at some position in its containing stream. This method returns that position.
        Returns:
        Text position object which describes both the stream and index within that stream (see class TextPosn). If the object currently embedded in any stream, the returned position is not associated with any stream.
      • copyFrom

        public void copyFrom​(TextEmbed oSource)
        Assignment operator
        Copy the content of the embedded object, but not its containing stream association.
        Parameters:
        oSource - Source embedded object to copy
      • isEqual

        public abstract boolean isEqual​(TextEmbed poCompare)
        Pure virtual: Compare embedded objects
        The derived class must implement this method. The purpose is to compare this embedded object with another for equality.
        Parameters:
        poCompare - Pointer to object to compare against. The derived class must cast this to its own type. As long as the derived class follows the XTG jfObj convention for object types, it will never be called with the wrong type.
        Returns:
        TRUE if the objects are equal; FALSE if not.
      • width

        public abstract UnitSpan width()
        Pure virtual: Return the width of the object
        Returns:
        The width of the embedded object, in form units.
      • height

        public abstract UnitSpan height()
        Pure virtual: Return the height of the object
        Returns:
        The height of the embedded object, in form units.
      • enforceHeight

        public boolean enforceHeight()
        Overridable: Query whether the object enforces its height
        This is likely legacy functionality. The user can override the default line spacing for the font with a larger amount (e.g., for double-space text). An embedded object can suppress that override for the line in which it appears, resulting in default line spacing. We're not sure why.
        Returns:
        TRUE if the line spacing override is to be ignored; FALSE if not. The default implementation returns FALSE.
      • cloneEmbed

        public abstract TextEmbed cloneEmbed()
        Pure virtual: Create a new instance
        The derived class must provide an implementation of Clone() that at least creates a new object of the correct (derived) type. This will be invoked by the parent stream when the caller adds one of its objects to the stream, in order to create the copy that the parent stream holds on to.
        Returns:
        Pointer to cloned copy. Note that this is a true clone that must copy all attributes of this embedded object, rather than creating an empty new instance.
      • gfxDraw

        public abstract void gfxDraw​(GFXEnv oEnv)
        Pure virtual: Draw the object in the given graphic environment
        This method is a call-back that AXTE framework calls to draw the object on a given graphic environment. The object may draw itself in form co-ordinates, with the origin (0,0) at the top-left corner of the extent that the object previously returned by the Width() and Height() methods. Alternatively, the object may choose to work in device co-ordinates, using the graphic environment and its driver to determine the mapping.
        Parameters:
        oEnv - Graphic environment in which to draw the object.
      • gfxSource

        public void gfxSource​(TextGfxSource oGfxSource)
        Overridable: Set the object's graphic source
        This method allows the derived class to cache graphics source information (attribute pools, font mapper) used by the stream containing the object. The default implementation does nothing.
        Parameters:
        oGfxSource - Graphic source used by the containing stream.
      • embedAt

        public int embedAt()
        Overridable: Query the vertical placement rule for the object
        When text and embedded objects are mixed in a stream, embedded objects tend to appear bottom-aligned on the text baseline. The value EMBED_AT_BASELINE of the class's EmbedAtCode enumeration describes this situation However, the object can override this default placement in one of two additional ways: EMBED_AT_TOP - position at the top of the text line and grow down; or EMBED_AT_BOTTOM - position at the bottom (baseline+descent) of the text line and grow up.
        Returns:
        The embed enumeration value. The default implementation returns EMBED_AT_BASELINE.
      • setLegacyLevel

        public void setLegacyLevel​(int eLevel)
        Cascade the legacy level.

        This method allows the stream/object hierarchy to cascade the legacy level to embedded objects. The default implementation ignores the call.

        Parameters:
        eLevel - - New legacy level.