Пример #1
0
 /** @return whether to wrap words within the bounding rectangle */
 public boolean getWordWrap() {
   PropertyFetcher<Boolean> fetcher =
       new TextBodyPropertyFetcher<Boolean>() {
         public boolean fetch(CTTextBodyProperties props) {
           if (props.isSetWrap()) {
             setValue(props.getWrap() == STTextWrappingType.SQUARE);
             return true;
           }
           return false;
         }
       };
   fetchShapeProperty(fetcher);
   return fetcher.getValue() == null ? true : fetcher.getValue();
 }
Пример #2
0
 @Override
 public boolean isHorizontalCentered() {
   PropertyFetcher<Boolean> fetcher =
       new TextBodyPropertyFetcher<Boolean>() {
         public boolean fetch(CTTextBodyProperties props) {
           if (props.isSetAnchorCtr()) {
             setValue(props.getAnchorCtr());
             return true;
           }
           return false;
         }
       };
   fetchShapeProperty(fetcher);
   return fetcher.getValue() == null ? false : fetcher.getValue();
 }
Пример #3
0
 /**
  * Returns the type of vertical alignment for the text.
  *
  * @return the type of vertical alignment
  */
 public VerticalAlignment getVerticalAlignment() {
   PropertyFetcher<VerticalAlignment> fetcher =
       new TextBodyPropertyFetcher<VerticalAlignment>() {
         public boolean fetch(CTTextBodyProperties props) {
           if (props.isSetAnchor()) {
             int val = props.getAnchor().intValue();
             setValue(VerticalAlignment.values()[val - 1]);
             return true;
           }
           return false;
         }
       };
   fetchShapeProperty(fetcher);
   return fetcher.getValue() == null ? VerticalAlignment.TOP : fetcher.getValue();
 }
Пример #4
0
 /**
  * Returns the distance (in points) between the top of the text frame and the top of the inscribed
  * rectangle of the shape that contains the text.
  *
  * @return the top inset in points
  */
 public double getTopInset() {
   PropertyFetcher<Double> fetcher =
       new TextBodyPropertyFetcher<Double>() {
         public boolean fetch(CTTextBodyProperties props) {
           if (props.isSetTIns()) {
             double val = Units.toPoints(props.getTIns());
             setValue(val);
             return true;
           }
           return false;
         }
       };
   fetchShapeProperty(fetcher);
   // If this attribute is omitted, then a value of 0.05 inches is implied
   return fetcher.getValue() == null ? 3.6 : fetcher.getValue();
 }