001: /* ====================================================================
002: Licensed to the Apache Software Foundation (ASF) under one or more
003: contributor license agreements. See the NOTICE file distributed with
004: this work for additional information regarding copyright ownership.
005: The ASF licenses this file to You under the Apache License, Version 2.0
006: (the "License"); you may not use this file except in compliance with
007: the License. You may obtain a copy of the License at
008:
009: http://www.apache.org/licenses/LICENSE-2.0
010:
011: Unless required by applicable law or agreed to in writing, software
012: distributed under the License is distributed on an "AS IS" BASIS,
013: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: See the License for the specific language governing permissions and
015: limitations under the License.
016: ==================================================================== */
017:
018: package org.apache.poi.hssf.usermodel;
019:
020: /**
021: * A textbox is a shape that may hold a rich text string.
022: *
023: * @author Glen Stampoultzis (glens at apache.org)
024: */
025: public class HSSFTextbox extends HSSFSimpleShape {
026: public final static short OBJECT_TYPE_TEXT = 6;
027:
028: int marginLeft, marginRight, marginTop, marginBottom;
029:
030: HSSFRichTextString string = new HSSFRichTextString("");
031:
032: /**
033: * Construct a new textbox with the given parent and anchor.
034: * @param parent
035: * @param anchor One of HSSFClientAnchor or HSSFChildAnchor
036: */
037: public HSSFTextbox(HSSFShape parent, HSSFAnchor anchor) {
038: super (parent, anchor);
039: setShapeType(OBJECT_TYPE_TEXT);
040: }
041:
042: /**
043: * @return the rich text string for this textbox.
044: */
045: public HSSFRichTextString getString() {
046: return string;
047: }
048:
049: /**
050: * @param string Sets the rich text string used by this object.
051: */
052: public void setString(HSSFRichTextString string) {
053: this .string = string;
054: }
055:
056: /**
057: * @return Returns the left margin within the textbox.
058: */
059: public int getMarginLeft() {
060: return marginLeft;
061: }
062:
063: /**
064: * Sets the left margin within the textbox.
065: */
066: public void setMarginLeft(int marginLeft) {
067: this .marginLeft = marginLeft;
068: }
069:
070: /**
071: * @return returns the right margin within the textbox.
072: */
073: public int getMarginRight() {
074: return marginRight;
075: }
076:
077: /**
078: * Sets the right margin within the textbox.
079: */
080: public void setMarginRight(int marginRight) {
081: this .marginRight = marginRight;
082: }
083:
084: /**
085: * @return returns the top margin within the textbox.
086: */
087: public int getMarginTop() {
088: return marginTop;
089: }
090:
091: /**
092: * Sets the top margin within the textbox.
093: */
094: public void setMarginTop(int marginTop) {
095: this .marginTop = marginTop;
096: }
097:
098: /**
099: * Gets the bottom margin within the textbox.
100: */
101: public int getMarginBottom() {
102: return marginBottom;
103: }
104:
105: /**
106: * Sets the bottom margin within the textbox.
107: */
108: public void setMarginBottom(int marginBottom) {
109: this.marginBottom = marginBottom;
110: }
111: }
|