Class SheetOverlayWrapper

    • Constructor Detail

      • SheetOverlayWrapper

        public SheetOverlayWrapper​(org.apache.poi.ss.usermodel.ClientAnchor anchor)
    • Method Detail

      • setOverlayChangeListener

        public void setOverlayChangeListener​(SheetOverlayWrapper.OverlayChangeListener listener)
        If this overlay's state can be dynamically changed (like minimizing), this method can inform the spreadsheet.
        Parameters:
        listener -
      • isVisible

        public boolean isVisible​(int r1,
                                 int c1,
                                 int r2,
                                 int c2)
        Determines if this image should be visible within the given visible area.
        Parameters:
        r1 - Row index of topmost row, 1-based
        c1 - Column index of leftmost column, 1-based
        r2 - Row index of bottom-most row, 1-based
        c2 - Column index of rightmost column, 1-based
        Returns:
        true if the image should be visible inside the range, false otherwise
      • getWidth

        public float getWidth​(org.apache.poi.ss.usermodel.Sheet sheet,
                              int[] colW,
                              int defaultColumnWidthPX)
        Calculates the width of the image. Might not be 100% correct because of bugs in POI (returns inconsistent values for Dx and Dy).

        If the image doesn't have a specified width and should be sized to image file size, -1 is returned.

        Parameters:
        sheet - The sheet this image belongs to
        colW - Array of column widths in pixels
        defaultColumnWidthPX - Default column width in pixels
        Returns:
        Width of the image in pixels, or -1 if image file width should be used
      • getHeight

        public float getHeight​(org.apache.poi.ss.usermodel.Sheet sheet,
                               float[] rowH)
        Calculates the height of the image. Might not be 100% correct because of bugs in POI (returns inconsistent values for Dx and Dy).

        If the image doesn't have a specified height and should be sized to image file size, -1 is returned.

        Parameters:
        sheet - The sheet this image belongs to
        rowH - Array of row heights in points
        Returns:
        Image height in points, or -1 if image file height should be used.
      • getId

        public String getId()
        Returns a unique ID of this overlay, used also as a resource key for images.
      • isVisible

        public boolean isVisible()
        Gets the visibility state of this overlay in the current spreadsheet view.
        Returns:
        true if overlay is visible, false otherwise
      • setVisible

        public void setVisible​(boolean visible)
        Marks this as image visible or hidden in the current spreadsheet view. Only used for the spreadsheet to remember if data needs to be removed, doesn't affect real visibility.
        Parameters:
        visible - true to set visible, false to set hidden
      • getAnchor

        public org.apache.poi.ss.usermodel.ClientAnchor getAnchor()
        Gets the anchor for this image within the sheet containing this image.
        Returns:
        Anchor for this image
      • getComponent

        public Component getComponent​(boolean init)
        Returns the component contained in this wrapper if there is one.
        Parameters:
        init - false if you don't want to initialize the component, calling with true after the first time has no effect.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object