Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /* ====================================================================
     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.hslf.model;
 
 
Represents an AutoShape.

AutoShapes are drawing objects with a particular shape that may be customized through smart resizing and adjustments. See ShapeTypes

Author(s):
Yegor Kozlov
 
 public class AutoShape extends TextShape {
 
     protected AutoShape(EscherContainerRecord escherRecordShape parent){
         super(escherRecordparent);
     }
 
     public AutoShape(int typeShape parent){
         super(nullparent);
          = createSpContainer(typeparent instanceof ShapeGroup);
     }
 
     public AutoShape(int type){
         this(typenull);
     }
 
     protected EscherContainerRecord createSpContainer(int shapeTypeboolean isChild){
          = super.createSpContainer(isChild);
 
         setShapeType(shapeType);
 
         //set default properties for an autoshape
         setEscherProperty(., 0x8000004);
         setEscherProperty(., 0x8000004);
         setEscherProperty(., 0x8000001);
 
         return ;
     }
 
     protected void setDefaultTextProperties(TextRun _txtrun){
         setWordWrap(.);
     }

    
Gets adjust value which controls smart resizing of the auto-shape.

The adjustment values are given in shape coordinates: the origin is at the top-left, positive-x is to the right, positive-y is down. The region from (0,0) to (S,S) maps to the geometry box of the shape (S=21600 is a constant).

Parameters:
idx the adjust index in the [0, 9] range
Returns:
the adjustment value
 
     public int getAdjustmentValue(int idx){
         if(idx < 0 || idx > 9) throw new IllegalArgumentException("The index of an adjustment value must be in the [0, 9] range");
 
         return getEscherProperty((short)(. + idx));
     }

    
Sets adjust value which controls smart resizing of the auto-shape.

The adjustment values are given in shape coordinates: the origin is at the top-left, positive-x is to the right, positive-y is down. The region from (0,0) to (S,S) maps to the geometry box of the shape (S=21600 is a constant).

Parameters:
idx the adjust index in the [0, 9] range
val the adjustment value
    public void setAdjustmentValue(int idxint val){
        if(idx < 0 || idx > 9) throw new IllegalArgumentException("The index of an adjustment value must be in the [0, 9] range");
        setEscherProperty((short)(. + idx), val);
    }
    public java.awt.Shape getOutline(){
        ShapeOutline outline = AutoShapes.getShapeOutline(getShapeType());
        Rectangle2D anchor = getLogicalAnchor2D();
        if(outline == null){
            .log(."Outline not found for " + ShapeTypes.typeName(getShapeType()));
            return anchor;
        }
        java.awt.Shape shape = outline.getOutline(this);
        return AutoShapes.transform(shapeanchor);
    }
New to GrepCode? Check out our FAQ X