View | Details | Raw Unified | Return to bug 43247
Collapse All | Expand All

(-)src/scratchpad/src/org/apache/poi/hslf/usermodel/ObjectData.java (+51 lines)
Line 0 Link Here
1
/* ====================================================================
2
   Licensed to the Apache Software Foundation (ASF) under one or more
3
   contributor license agreements.  See the NOTICE file distributed with
4
   this work for additional information regarding copyright ownership.
5
   The ASF licenses this file to You under the Apache License, Version 2.0
6
   (the "License"); you may not use this file except in compliance with
7
   the License.  You may obtain a copy of the License at
8
9
       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
package org.apache.poi.hslf.usermodel;
18
19
import java.io.InputStream;
20
21
import org.apache.poi.hslf.record.ExOleObjStg;
22
23
/**
24
 * A class that represents object data embedded in a slide show.
25
 *
26
 * @author Daniel Noll
27
 */
28
public class ObjectData {
29
    /**
30
     * The record that contains the object data.
31
     */
32
    private ExOleObjStg storage;
33
34
    /**
35
     * Creates the object data wrapping the record that contains the object data.
36
     *
37
     * @param storage the record that contains the object data.
38
     */
39
    public ObjectData(ExOleObjStg storage) {
40
        this.storage = storage;
41
    }
42
43
    /**
44
     * Gets an input stream which returns the binary of the embedded data.
45
     *
46
     * @return the input stream which will contain the binary of the embedded data.
47
     */
48
    public InputStream getData() {
49
        return storage.getData();
50
    }
51
}
(-)src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java (-4 / +4 lines)
Lines 98-108 Link Here
98
    public static final Type FontEmbeddedData = new Type(4024,null);
98
    public static final Type FontEmbeddedData = new Type(4024,null);
99
    public static final Type CString = new Type(4026,CString.class);
99
    public static final Type CString = new Type(4026,CString.class);
100
    public static final Type MetaFile = new Type(4033,null);
100
    public static final Type MetaFile = new Type(4033,null);
101
    public static final Type ExOleObjAtom = new Type(4035,null);
101
    public static final Type ExOleObjAtom = new Type(4035,ExOleObjAtom.class);
102
    public static final Type SrKinsoku = new Type(4040,null);
102
    public static final Type SrKinsoku = new Type(4040,null);
103
    public static final Type HandOut = new Type(4041,null);
103
    public static final Type HandOut = new Type(4041,null);
104
    public static final Type ExEmbed = new Type(4044,null);
104
    public static final Type ExEmbed = new Type(4044,ExEmbed.class);
105
    public static final Type ExEmbedAtom = new Type(4045,null);
105
    public static final Type ExEmbedAtom = new Type(4045,ExEmbedAtom.class);
106
    public static final Type ExLink = new Type(4046,null);
106
    public static final Type ExLink = new Type(4046,null);
107
    public static final Type BookmarkEntityAtom = new Type(4048,null);
107
    public static final Type BookmarkEntityAtom = new Type(4048,null);
108
    public static final Type ExLinkAtom = new Type(4049,null);
108
    public static final Type ExLinkAtom = new Type(4049,null);
Lines 136-142 Link Here
136
    public static final Type ExCDAudio = new Type(4110,null);
136
    public static final Type ExCDAudio = new Type(4110,null);
137
    public static final Type ExWAVAudioEmbedded = new Type(4111,null);
137
    public static final Type ExWAVAudioEmbedded = new Type(4111,null);
138
    public static final Type ExWAVAudioLink = new Type(4112,null);
138
    public static final Type ExWAVAudioLink = new Type(4112,null);
139
    public static final Type ExOleObjStg = new Type(4113,null);
139
    public static final Type ExOleObjStg = new Type(4113,ExOleObjStg.class);
140
    public static final Type ExCDAudioAtom = new Type(4114,null);
140
    public static final Type ExCDAudioAtom = new Type(4114,null);
141
    public static final Type ExWAVAudioEmbeddedAtom = new Type(4115,null);
141
    public static final Type ExWAVAudioEmbeddedAtom = new Type(4115,null);
142
    public static final Type AnimationInfoAtom = new Type(4116,null);
142
    public static final Type AnimationInfoAtom = new Type(4116,null);
(-)src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjStg.java (+93 lines)
Line 0 Link Here
1
package org.apache.poi.hslf.record;
2
3
import java.io.ByteArrayInputStream;
4
import java.io.IOException;
5
import java.io.InputStream;
6
import java.io.OutputStream;
7
import java.util.zip.InflaterInputStream;
8
9
import org.apache.poi.util.LittleEndian;
10
11
/**
12
 * Storage for embedded OLE objects.
13
 */
14
public class ExOleObjStg extends RecordAtom {
15
    /**
16
     * Record header.
17
     */
18
    private byte[] _header;
19
20
    /**
21
     * Record data.
22
     */
23
    private byte[] _data;
24
25
    /**
26
     * Constructs a new empty storage container.
27
     */
28
    protected ExOleObjStg() {
29
        _header = new byte[8];
30
        _data = new byte[0];
31
32
        LittleEndian.putShort(_header, 2, (short)getRecordType());
33
        LittleEndian.putInt(_header, 4, _data.length);
34
    }
35
36
    /**
37
     * Constructs the link related atom record from its
38
     *  source data.
39
     *
40
     * @param source the source data as a byte array.
41
     * @param start the start offset into the byte array.
42
     * @param len the length of the slice in the byte array.
43
     */
44
    protected ExOleObjStg(byte[] source, int start, int len) {
45
        // Get the header.
46
        _header = new byte[8];
47
        System.arraycopy(source,start,_header,0,8);
48
49
        // Get the record data.
50
        _data = new byte[len-8];
51
        System.arraycopy(source,start+8,_data,0,len-8);
52
    }
53
54
    /**
55
     * Gets the uncompressed length of the data.
56
     *
57
     * @return the uncompressed length of the data.
58
     */
59
    public int getDataLength() {
60
        return LittleEndian.getInt(_data, 0);
61
    }
62
63
    /**
64
     * Opens an input stream which will decompress the data on the fly.
65
     *
66
     * @return the data input stream.
67
     */
68
    public InputStream getData() {
69
        InputStream compressedStream = new ByteArrayInputStream(_data, 4, _data.length);
70
        return new InflaterInputStream(compressedStream);
71
    }
72
73
    /**
74
     * Gets the record type.
75
     *
76
     * @return the record type.
77
     */
78
    public long getRecordType() {
79
        return RecordTypes.ExOleObjStg.typeID;
80
    }
81
82
    /**
83
     * Write the contents of the record back, so it can be written
84
     * to disk.
85
     *
86
     * @param out the output stream to write to.
87
     * @throws IOException if an error occurs.
88
     */
89
    public void writeOut(OutputStream out) throws IOException {
90
        out.write(_header);
91
        out.write(_data);
92
    }
93
}
(-)src/scratchpad/src/org/apache/poi/hslf/record/ExOleObjAtom.java (+219 lines)
Line 0 Link Here
1
package org.apache.poi.hslf.record;
2
3
import java.io.IOException;
4
import java.io.OutputStream;
5
6
import org.apache.poi.util.LittleEndian;
7
8
/**
9
 * Atom storing information for an OLE object.
10
 *
11
 * <!--
12
 * offset   type    name         description
13
 *
14
 * 0        uint4   drawAspect   Stores whether the object can be completely seen
15
 *                               (value of 1), or if only the icon is visible (value of 4).
16
 *
17
 * 4        sint4    type        Specifies whether the object is embedded or linked.
18
 *                               0 - embedded
19
 *                               1 - linked
20
 *
21
 * 8        sint4    objID       Unique identifier for the OLE object
22
 *
23
 * 2        sint4    subType     This specifies the type of ole object.
24
 *                               0 - Default object
25
 *                               1 - Microsoft Clipart Gallery
26
 *                               2 - Microsoft Word table
27
 *                               3 - Microsoft Excel
28
 *                               4 - Microsoft Graph
29
 *                               5 - Microsoft Organization Chart
30
 *                               6 - Microsoft Equation Editor
31
 *                               7 - Microsoft Wordart object
32
 *                               8 - Sound
33
 *                               9 - Image
34
 *                               10 - PowerPoint presentation
35
 *                               11 - PowerPoint slide
36
 *                               12 - Microsoft Project
37
 *                               13 - Microsoft Note-It Ole
38
 *                               14 - Microsoft Excel chart
39
 *                               15 - Media Player object
40
 *
41
 * 16       sint4    objStgDataRef    Reference to persist object
42
 *
43
 * 17       bool1    isBlank          Set if the object's image is blank
44
 * -->
45
 */
46
public class ExOleObjAtom extends RecordAtom {
47
48
    public static final int DRAW_ASPECT_VISIBLE = 1;
49
    public static final int DRAW_ASPECT_ICON = 4;
50
51
    public static final int TYPE_EMBEDDED = 0;
52
    public static final int TYPE_LINKED = 1;
53
54
    public static final int SUBTYPE_DEFAULT = 0;
55
    public static final int SUBTYPE_CLIPART_GALLERY = 1;
56
    public static final int SUBTYPE_WORD_TABLE = 2;
57
    public static final int SUBTYPE_EXCEL = 3;
58
    public static final int SUBTYPE_GRAPH = 4;
59
    public static final int SUBTYPE_ORGANIZATION_CHART = 5;
60
    public static final int SUBTYPE_EQUATION = 6;
61
    public static final int SUBTYPE_WORDART = 7;
62
    public static final int SUBTYPE_SOUND = 8;
63
    public static final int SUBTYPE_IMAGE = 9;
64
    public static final int SUBTYPE_POWERPOINT_PRESENTATION = 10;
65
    public static final int SUBTYPE_POWERPOINT_SLIDE = 11;
66
    public static final int SUBTYPE_PROJECT = 12;
67
    public static final int SUBTYPE_NOTEIT = 13;
68
    public static final int SUBTYPE_EXCEL_CHART = 14;
69
    public static final int SUBTYPE_MEDIA_PLAYER = 15;
70
71
    /**
72
     * Record header.
73
     */
74
    private byte[] _header;
75
76
    /**
77
     * Record data.
78
     */
79
    private byte[] _data;
80
81
    /**
82
     * Constructs a brand new link related atom record.
83
     */
84
    protected ExOleObjAtom() {
85
        _header = new byte[8];
86
        _data = new byte[18];
87
88
        LittleEndian.putShort(_header, 2, (short)getRecordType());
89
        LittleEndian.putInt(_header, 4, _data.length);
90
91
        // I hope it is fine for the other values to be zero.
92
    }
93
94
    /**
95
     * Constructs the link related atom record from its
96
     *  source data.
97
     *
98
     * @param source the source data as a byte array.
99
     * @param start the start offset into the byte array.
100
     * @param len the length of the slice in the byte array.
101
     */
102
    protected ExOleObjAtom(byte[] source, int start, int len) {
103
        // Get the header.
104
        _header = new byte[8];
105
        System.arraycopy(source,start,_header,0,8);
106
107
        // Get the record data.
108
        _data = new byte[len-8];
109
        System.arraycopy(source,start+8,_data,0,len-8);
110
111
        // Must be at least 4 bytes long
112
        if(_data.length < 24) {
113
        	throw new IllegalArgumentException("The length of the data for a ExOleObjAtom must be at least 24 bytes, but was only " + _data.length);
114
        }
115
    }
116
117
    /**
118
     * Gets whether the object can be completely seen, or if only the
119
     * icon is visible.
120
     *
121
     * @return the draw aspect, one of the {@code DRAW_ASPECT_*} constants.
122
     */
123
    public int getDrawAspect() {
124
        return LittleEndian.getInt(_data, 0);
125
    }
126
127
    /**
128
     * Gets whether the object is embedded or linked.
129
     *
130
     * @return the type, one of the {@code TYPE_EMBEDDED_*} constants.
131
     */
132
    public int getType() {
133
        return LittleEndian.getInt(_data, 4);
134
    }
135
136
    /**
137
     * Gets the unique identifier for the OLE object.
138
     *
139
     * @return the object ID.
140
     */
141
    public int getObjID() {
142
        return LittleEndian.getInt(_data, 8);
143
    }
144
145
    /**
146
     * Gets the type of OLE object.
147
     * 
148
     * @return the sub-type, one of the {@code SUBTYPE_*} constants.
149
     */
150
    public int getSubType() {
151
        return LittleEndian.getInt(_data, 12);
152
    }
153
154
    /**
155
     * Gets the reference to the persistent object
156
     *
157
     * @return the sub-type, one of the {@code SUBTYPE_*} constants.
158
     */
159
    public int getObjStgDataRef() {
160
        return LittleEndian.getInt(_data, 16);
161
    }
162
163
    /**
164
     * Gets whether the object's image is blank.
165
     *
166
     * @return {@code true} if the object's image is blank.
167
     */
168
    public boolean getIsBlank() {
169
        // Even though this is a mere boolean, KOffice's code says it's an int.
170
        return LittleEndian.getInt(_data, 20) != 0;
171
    }
172
    
173
174
//    16
175
//
176
//
177
//sint4
178
//
179
//
180
//objStgDataRef
181
//
182
//
183
//Reference to persist object
184
//
185
//17
186
//
187
//
188
//bool1
189
//
190
//
191
//isBlank
192
//
193
//
194
//Set if the object's image is blank
195
196
197
    // TODO: Convenience methods.
198
199
    /**
200
     * Returns the type (held as a little endian in bytes 3 and 4)
201
     * that this class handles.
202
     */
203
    public long getRecordType() {
204
        return RecordTypes.ExOleObjAtom.typeID;
205
    }
206
207
    /**
208
     * Have the contents printer out into an OutputStream, used when
209
     * writing a file back out to disk
210
     * (Normally, atom classes will keep their bytes around, but
211
     * non atom classes will just request the bytes from their
212
     * children, then chuck on their header and return)
213
     */
214
    public void writeOut(OutputStream out) throws IOException
215
    {
216
        out.write(_header);
217
        out.write(_data);
218
    }
219
}
(-)src/scratchpad/src/org/apache/poi/hslf/record/ExEmbedAtom.java (+161 lines)
Line 0 Link Here
1
/* ====================================================================
2
   Licensed to the Apache Software Foundation (ASF) under one or more
3
   contributor license agreements.  See the NOTICE file distributed with
4
   this work for additional information regarding copyright ownership.
5
   The ASF licenses this file to You under the Apache License, Version 2.0
6
   (the "License"); you may not use this file except in compliance with
7
   the License.  You may obtain a copy of the License at
8
9
       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.record;
19
20
import java.io.IOException;
21
import java.io.OutputStream;
22
23
import org.apache.poi.util.LittleEndian;
24
25
/**
26
 * Tne atom that holds metadata on a specific embedded object in the document.
27
 *
28
 * <!--
29
 * 0    sint4    followColorScheme  This field indicates how the object follows the color scheme. Valid values are:
30
 *                                  0 - doesn't follow the color scheme
31
 *                                  1 - follows the entire color scheme
32
 *                                  2 - follows the text and background scheme
33
 *
34
 * 4    bool1    cantLockServerB    Set if the embedded server can not be locked
35
 * 5    bool1    noSizeToServerB    Set if don't need to send the dimension to the embedded object
36
 * 6    Bool1    isTable            Set if the object is a Word table
37
 * -->
38
 *
39
 * @author Daniel Noll
40
 */
41
public class ExEmbedAtom extends RecordAtom {
42
43
    /**
44
     * Embedded document does not follow the color scheme.
45
     */
46
    public static final int DOES_NOT_FOLLOW_COLOR_SCHEME = 0;
47
48
    /**
49
     * Embedded document follows the entire color scheme.
50
     */
51
    public static final int FOLLOWS_ENTIRE_COLOR_SCHEME = 1;
52
53
    /**
54
     * Embedded document follows the text and background scheme.
55
     */
56
    public static final int FOLLOWS_TEXT_AND_BACKGROUND_SCHEME = 2;
57
58
    /**
59
     * Record header.
60
     */
61
    private byte[] _header;
62
63
    /**
64
     * Record data.
65
     */
66
    private byte[] _data;
67
68
    /**
69
     * Constructs a brand new embedded object atom record.
70
     */
71
    protected ExEmbedAtom() {
72
        _header = new byte[8];
73
        _data = new byte[7];
74
75
        LittleEndian.putShort(_header, 2, (short)getRecordType());
76
        LittleEndian.putInt(_header, 4, _data.length);
77
78
        // It is fine for the other values to be zero
79
    }
80
81
    /**
82
     * Constructs the embedded object atom record from its source data.
83
     *
84
     * @param source the source data as a byte array.
85
     * @param start the start offset into the byte array.
86
     * @param len the length of the slice in the byte array.
87
     */
88
    protected ExEmbedAtom(byte[] source, int start, int len) {
89
        // Get the header.
90
        _header = new byte[8];
91
        System.arraycopy(source,start,_header,0,8);
92
93
        // Get the record data.
94
        _data = new byte[len-8];
95
        System.arraycopy(source,start+8,_data,0,len-8);
96
97
        // Must be at least 4 bytes long
98
        if(_data.length < 7) {
99
        	throw new IllegalArgumentException("The length of the data for a ExEmbedAtom must be at least 4 bytes, but was only " + _data.length);
100
        }
101
    }
102
103
    /**
104
     * Gets whether the object follows the color scheme.
105
     *
106
     * @return one of {@link #DOES_NOT_FOLLOW_COLOR_SCHEME},
107
     *                {@link #FOLLOWS_ENTIRE_COLOR_SCHEME}, or
108
     *                {@link #FOLLOWS_TEXT_AND_BACKGROUND_SCHEME}.
109
     */
110
    public int getFollowColorScheme() {
111
        return LittleEndian.getInt(_data, 0);
112
    }
113
114
    /**
115
     * Gets whether the embedded server cannot be locked.
116
     *
117
     * @return {@code true} if the embedded server cannot be locked.
118
     */
119
    public boolean getCantLockServerB() {
120
        return _data[4] != 0;
121
    }
122
123
    /**
124
     * Gets whether it is not required to send the dimensions to the embedded object.
125
     *
126
     * @return {@code true} if the embedded server does not require the object dimensions.
127
     */
128
    public boolean getNoSizeToServerB() {
129
        return _data[5] != 0;
130
    }
131
132
    /**
133
     * Getswhether the object is a Word table.
134
     *
135
     * @return {@code true} if the object is a Word table.
136
     */
137
    public boolean getIsTable() {
138
        return _data[6] != 0;
139
    }
140
141
    /**
142
     * Gets the record type.
143
     * @return the record type.
144
     */
145
    public long getRecordType() {
146
        return RecordTypes.ExEmbedAtom.typeID;
147
    }
148
149
    /**
150
     * Write the contents of the record back, so it can be written
151
     * to disk
152
     *
153
     * @param out the output stream to write to.
154
     * @throws IOException if an error occurs.
155
     */
156
    public void writeOut(OutputStream out) throws IOException {
157
        out.write(_header);
158
        out.write(_data);
159
    }
160
161
}
(-)src/scratchpad/src/org/apache/poi/hslf/record/CString.java (+8 lines)
Lines 111-114 Link Here
111
		// Write out our text
111
		// Write out our text
112
		out.write(_text);
112
		out.write(_text);
113
	}
113
	}
114
115
    /**
116
     * Gets a string representation of this object, primarily for debugging.
117
     * @return a string representation of this object.
118
     */
119
    public String toString() {
120
        return getText();
121
    }
114
}
122
}
(-)src/scratchpad/src/org/apache/poi/hslf/record/ExEmbed.java (+190 lines)
Line 0 Link Here
1
/* ====================================================================
2
   Licensed to the Apache Software Foundation (ASF) under one or more
3
   contributor license agreements.  See the NOTICE file distributed with
4
   this work for additional information regarding copyright ownership.
5
   The ASF licenses this file to You under the Apache License, Version 2.0
6
   (the "License"); you may not use this file except in compliance with
7
   the License.  You may obtain a copy of the License at
8
9
       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.record;
19
20
import java.io.OutputStream;
21
import java.io.IOException;
22
23
import org.apache.poi.util.LittleEndian;
24
import org.apache.poi.util.POILogger;
25
26
/**
27
 * This data represents an embedded object in the document.
28
 * @author Daniel Noll
29
 */
30
public class ExEmbed extends RecordContainer {
31
32
    /**
33
     * Record header data.
34
     */
35
    private byte[] _header;
36
37
    // Links to our more interesting children
38
    private ExEmbedAtom embedAtom;
39
    private ExOleObjAtom oleObjAtom;
40
    private CString menuName;
41
    private CString progId;
42
    private CString clipboardName;
43
44
    /**
45
     * Set things up, and find our more interesting children
46
     *
47
     * @param source the source data as a byte array.
48
     * @param start the start offset into the byte array.
49
     * @param len the length of the slice in the byte array.
50
     */
51
    protected ExEmbed(byte[] source, int start, int len) {
52
        // Grab the header
53
        _header = new byte[8];
54
        System.arraycopy(source,start,_header,0,8);
55
56
        // Find our children
57
        _children = Record.findChildRecords(source,start+8,len-8);
58
        findInterestingChildren();
59
    }
60
61
    /**
62
     * Create a new ExEmbed, with blank fields
63
     */
64
    public ExEmbed() {
65
        _header = new byte[8];
66
        _children = new Record[5];
67
68
        // Setup our header block
69
        _header[0] = 0x0f; // We are a container record
70
        LittleEndian.putShort(_header, 2, (short)getRecordType());
71
72
        // Setup our child records
73
        CString cs1 = new CString();
74
        CString cs2 = new CString();
75
        CString cs3 = new CString();
76
//        cs1.setCount(0x00);
77
//        cs2.setCount(0x10);
78
        _children[0] = new ExEmbedAtom();
79
        _children[1] = new ExOleObjAtom();
80
        _children[2] = cs1;
81
        _children[3] = cs2;
82
        _children[4] = cs3;
83
        findInterestingChildren();
84
    }
85
86
    /**
87
     * Go through our child records, picking out the ones that are
88
     * interesting, and saving those for use by the easy helper methods.
89
     */
90
    private void findInterestingChildren() {
91
92
        // First child should be the ExHyperlinkAtom
93
        if(_children[0] instanceof ExEmbedAtom) {
94
            embedAtom = (ExEmbedAtom)_children[0];
95
        } else {
96
            logger.log(POILogger.ERROR, "First child record wasn't a ExEmbedAtom, was of type " + _children[0].getRecordType());
97
        }
98
99
        // Second child should be the ExOleObjAtom
100
        if (_children[2] instanceof ExOleObjAtom) {
101
            oleObjAtom = (ExOleObjAtom)_children[1];
102
        } else {
103
            logger.log(POILogger.ERROR, "Second child record wasn't a ExOleObjAtom, was of type " + _children[0].getRecordType());
104
        }
105
106
        for (int i = 2; i < _children.length; i++) {
107
            if (_children[i] instanceof CString){
108
                if (menuName == null) menuName = (CString)_children[i];
109
                else if (progId == null) progId = (CString)_children[i];
110
                else if (clipboardName == null) clipboardName = (CString)_children[i];
111
            } else {
112
                logger.log(POILogger.ERROR, "Record after atoms wasn't a CString, was of type " + _children[1].getRecordType());
113
            }
114
        }
115
    }
116
117
    /**
118
     * Gets the {@code ExEmbedAtom}.
119
     *
120
     * @return the {@code ExEmbedAtom}.
121
     */
122
    public ExEmbedAtom getExEmbedAtom()
123
    {
124
        return embedAtom;
125
    }
126
127
    /**
128
     * Gets the {@code ExOleObjAtom}.
129
     *
130
     * @return the {@code ExOleObjAtom}.
131
     */
132
    public ExOleObjAtom getExOleObjAtom()
133
    {
134
        return oleObjAtom;
135
    }
136
137
    /**
138
     * Gets the name used for menus and the Links dialog box.
139
     *
140
     * @return the name used for menus and the Links dialog box.
141
     */
142
    public String getMenuName()
143
    {
144
        return menuName == null ? null : menuName.getText();
145
    }
146
147
    /**
148
     * Gets the OLE Programmatic Identifier.
149
     * 
150
     * @return the OLE Programmatic Identifier.
151
     */
152
    public String getProgId()
153
    {
154
        return progId == null ? null : progId.getText();
155
    }
156
157
    /**
158
     * Gets the name that appears in the paste special dialog.
159
     *
160
     * @return the name that appears in the paste special dialog.
161
     */
162
    public String getClipboardName()
163
    {
164
        return clipboardName == null ? null : clipboardName.getText();
165
    }
166
167
    // TODO: Convenience methods.
168
169
    /**
170
     * Returns the type (held as a little endian in bytes 3 and 4)
171
     * that this class handles.
172
     *
173
     * @return the record type.
174
     */
175
    public long getRecordType() {
176
        return RecordTypes.ExEmbed.typeID;
177
    }
178
179
    /**
180
     * Have the contents printer out into an OutputStream, used when
181
     * writing a file back out to disk.
182
     *
183
     * @param out the output stream.
184
     * @throws IOException if there was an error writing to the stream.
185
     */
186
    public void writeOut(OutputStream out) throws IOException {
187
// TODO: Implement method.
188
189
    }
190
}
(-)src/scratchpad/src/org/apache/poi/hslf/HSLFSlideShow.java (-18 / +48 lines)
Lines 20-47 Link Here
20
20
21
package org.apache.poi.hslf;
21
package org.apache.poi.hslf;
22
22
23
import java.util.*;
23
import java.io.ByteArrayInputStream;
24
import java.io.*;
24
import java.io.ByteArrayOutputStream;
25
import java.io.FileInputStream;
26
import java.io.FileNotFoundException;
27
import java.io.IOException;
28
import java.io.InputStream;
29
import java.io.OutputStream;
30
import java.util.ArrayList;
31
import java.util.Arrays;
32
import java.util.Hashtable;
33
import java.util.Iterator;
34
import java.util.List;
25
35
26
import org.apache.poi.POIDocument;
36
import org.apache.poi.POIDocument;
27
import org.apache.poi.util.LittleEndian;
28
import org.apache.poi.util.POILogger;
29
import org.apache.poi.util.POILogFactory;
30
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
31
import org.apache.poi.poifs.filesystem.DocumentEntry;
32
import org.apache.poi.poifs.filesystem.DocumentInputStream;
33
34
import org.apache.poi.hpsf.PropertySet;
35
import org.apache.poi.hpsf.PropertySetFactory;
36
import org.apache.poi.hpsf.MutablePropertySet;
37
import org.apache.poi.hpsf.SummaryInformation;
38
import org.apache.poi.hpsf.DocumentSummaryInformation;
39
40
import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
37
import org.apache.poi.hslf.exceptions.CorruptPowerPointFileException;
41
import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException;
38
import org.apache.poi.hslf.exceptions.EncryptedPowerPointFileException;
42
import org.apache.poi.hslf.exceptions.HSLFException;
39
import org.apache.poi.hslf.exceptions.HSLFException;
43
import org.apache.poi.hslf.record.*;
40
import org.apache.poi.hslf.record.CurrentUserAtom;
41
import org.apache.poi.hslf.record.ExOleObjStg;
42
import org.apache.poi.hslf.record.PersistPtrHolder;
43
import org.apache.poi.hslf.record.PositionDependentRecord;
44
import org.apache.poi.hslf.record.Record;
45
import org.apache.poi.hslf.record.UserEditAtom;
46
import org.apache.poi.hslf.usermodel.ObjectData;
44
import org.apache.poi.hslf.usermodel.PictureData;
47
import org.apache.poi.hslf.usermodel.PictureData;
48
import org.apache.poi.poifs.filesystem.DocumentEntry;
49
import org.apache.poi.poifs.filesystem.DocumentInputStream;
50
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
51
import org.apache.poi.util.LittleEndian;
52
import org.apache.poi.util.POILogFactory;
53
import org.apache.poi.util.POILogger;
45
54
46
/**
55
/**
47
 * This class contains the main functionality for the Powerpoint file 
56
 * This class contains the main functionality for the Powerpoint file 
Lines 68-75 Link Here
68
77
69
	// Raw Pictures contained in the pictures stream
78
	// Raw Pictures contained in the pictures stream
70
	private PictureData[] _pictures;
79
	private PictureData[] _pictures;
71
	
80
72
	/**
81
    // Embedded objects stored in storage records in the document stream, lazily populated.
82
    private ObjectData[] _objects;
83
84
    /**
73
	 * Returns the underlying POIFSFileSystem for the document
85
	 * Returns the underlying POIFSFileSystem for the document
74
	 *  that is open.
86
	 *  that is open.
75
	 */
87
	 */
Lines 507-510 Link Here
507
	public PictureData[] getPictures() {
519
	public PictureData[] getPictures() {
508
		return _pictures;
520
		return _pictures;
509
	}
521
	}
522
523
    /**
524
     * Gets embedded object data from the slide show.
525
     *
526
     * @return the embedded objects.
527
     */
528
    public ObjectData[] getEmbeddedObjects() {
529
        if (_objects == null) {
530
            List objects = new ArrayList();
531
            for (int i = 0; i < _records.length; i++) {
532
                if (_records[i] instanceof ExOleObjStg) {
533
                    objects.add(new ObjectData((ExOleObjStg) _records[i]));
534
                }
535
            }
536
            _objects = (ObjectData[]) objects.toArray(new ObjectData[objects.size()]);
537
        }
538
        return _objects;
539
    }
510
}
540
}

Return to bug 43247