01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: http://www.apache.org/licenses/LICENSE-2.0
10:
11: Unless required by applicable law or agreed to in writing, software
12: distributed under the License is distributed on an "AS IS" BASIS,
13: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: See the License for the specific language governing permissions and
15: limitations under the License.
16: ==================================================================== */
17:
18: package org.apache.poi.hslf.model;
19:
20: import org.apache.poi.ddf.*;
21:
22: /**
23: * Represents a autoshape in a PowerPoint drawing
24: *
25: * @author Yegor Kozlov
26: */
27: public class AutoShape extends SimpleShape {
28:
29: protected AutoShape(EscherContainerRecord escherRecord, Shape parent) {
30: super (escherRecord, parent);
31: }
32:
33: public AutoShape(int type, Shape parent) {
34: super (null, parent);
35: _escherContainer = createSpContainer(type,
36: parent instanceof ShapeGroup);
37: }
38:
39: public AutoShape(int type) {
40: this (type, null);
41: }
42:
43: protected EscherContainerRecord createSpContainer(int shapeType,
44: boolean isChild) {
45: EscherContainerRecord spcont = super .createSpContainer(isChild);
46:
47: EscherSpRecord spRecord = spcont
48: .getChildById(EscherSpRecord.RECORD_ID);
49: short type = (short) ((shapeType << 4) | 0x2);
50: spRecord.setOptions(type);
51:
52: //set default properties for an autoshape
53: EscherOptRecord opt = (EscherOptRecord) getEscherChild(spcont,
54: EscherOptRecord.RECORD_ID);
55:
56: opt.addEscherProperty(new EscherSimpleProperty(
57: EscherProperties.FILL__FILLCOLOR, 0x8000004));
58: opt.addEscherProperty(new EscherSimpleProperty(
59: EscherProperties.FILL__FILLBACKCOLOR, 0x8000000));
60: opt.addEscherProperty(new EscherSimpleProperty(
61: EscherProperties.FILL__NOFILLHITTEST, 0x100010));
62: opt.addEscherProperty(new EscherSimpleProperty(
63: EscherProperties.LINESTYLE__COLOR, 0x8000001));
64: opt.addEscherProperty(new EscherSimpleProperty(
65: EscherProperties.LINESTYLE__NOLINEDRAWDASH, 0x80008));
66: opt.addEscherProperty(new EscherSimpleProperty(
67: EscherProperties.SHADOWSTYLE__COLOR, 0x8000002));
68:
69: return spcont;
70: }
71:
72: }
|