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.hslf.model;
019:
020: import org.apache.poi.ddf.*;
021:
022: /**
023: * Represents a line in a PowerPoint drawing
024: *
025: * @author Yegor Kozlov
026: */
027: public class Line extends SimpleShape {
028: /**
029: * Solid (continuous) pen
030: */
031: public static final int PEN_SOLID = 1;
032: /**
033: * PS_DASH system dash style
034: */
035: public static final int PEN_PS_DASH = 2;
036: /**
037: * PS_DOT system dash style
038: */
039: public static final int PEN_DOT = 3;
040: /**
041: * PS_DASHDOT system dash style
042: */
043: public static final int PEN_DASHDOT = 4;
044: /**
045: * PS_DASHDOTDOT system dash style
046: */
047: public static final int PEN_DASHDOTDOT = 5;
048: /**
049: * square dot style
050: */
051: public static final int PEN_DOTGEL = 6;
052: /**
053: * dash style
054: */
055: public static final int PEN_DASH = 7;
056: /**
057: * long dash style
058: */
059: public static final int PEN_LONGDASHGEL = 8;
060: /**
061: * dash short dash
062: */
063: public static final int PEN_DASHDOTGEL = 9;
064: /**
065: * long dash short dash
066: */
067: public static final int PEN_LONGDASHDOTGEL = 10;
068: /**
069: * long dash short dash short dash
070: */
071: public static final int PEN_LONGDASHDOTDOTGEL = 11;
072:
073: /**
074: * Single line (of width lineWidth)
075: */
076: public static final int LINE_SIMPLE = 0;
077: /**
078: * Double lines of equal width
079: */
080: public static final int LINE_DOUBLE = 1;
081: /**
082: * Double lines, one thick, one thin
083: */
084: public static final int LINE_THICKTHIN = 2;
085: /**
086: * Double lines, reverse order
087: */
088: public static final int LINE_THINTHICK = 3;
089: /**
090: * Three lines, thin, thick, thin
091: */
092: public static final int LINE_TRIPLE = 4;
093:
094: protected Line(EscherContainerRecord escherRecord, Shape parent) {
095: super (escherRecord, parent);
096: }
097:
098: public Line(Shape parent) {
099: super (null, parent);
100: _escherContainer = createSpContainer(parent instanceof ShapeGroup);
101: }
102:
103: public Line() {
104: this (null);
105: }
106:
107: protected EscherContainerRecord createSpContainer(boolean isChild) {
108: EscherContainerRecord spcont = super .createSpContainer(isChild);
109:
110: EscherSpRecord spRecord = spcont
111: .getChildById(EscherSpRecord.RECORD_ID);
112: short type = (ShapeTypes.Line << 4) | 0x2;
113: spRecord.setOptions(type);
114:
115: //set default properties for a line
116: EscherOptRecord opt = (EscherOptRecord) getEscherChild(spcont,
117: EscherOptRecord.RECORD_ID);
118:
119: //default line properties
120: setEscherProperty(opt, EscherProperties.GEOMETRY__SHAPEPATH, 4);
121: setEscherProperty(opt, EscherProperties.GEOMETRY__FILLOK,
122: 0x10000);
123: setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST,
124: 0x100000);
125: setEscherProperty(opt, EscherProperties.LINESTYLE__COLOR,
126: 0x8000001);
127: setEscherProperty(opt,
128: EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0xA0008);
129: setEscherProperty(opt, EscherProperties.SHADOWSTYLE__COLOR,
130: 0x8000002);
131:
132: return spcont;
133: }
134:
135: }
|