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.dev;
19:
20: import org.apache.poi.hslf.*;
21: import org.apache.poi.hslf.record.*;
22:
23: /**
24: * Uses record level code to locate Notes and Slide records.
25: * Having found them, it asks their SlideAtom or NotesAtom entries
26: * what they are all about. Useful for checking the matching between
27: * Slides, Master Slides and Notes
28: */
29: public class SlideAndNotesAtomListing {
30: public static void main(String[] args) throws Exception {
31: if (args.length < 1) {
32: System.err.println("Need to give a filename");
33: System.exit(1);
34: }
35:
36: HSLFSlideShow ss = new HSLFSlideShow(args[0]);
37: System.out.println("");
38:
39: // Find either Slides or Notes
40: Record[] records = ss.getRecords();
41: for (int i = 0; i < records.length; i++) {
42: Record r = records[i];
43:
44: // When we find them, print out their IDs
45: if (r instanceof Slide) {
46: Slide s = (Slide) r;
47: SlideAtom sa = s.getSlideAtom();
48: System.out.println("Found Slide at " + i);
49: System.out.println(" Slide's master ID is "
50: + sa.getMasterID());
51: System.out.println(" Slide's notes ID is "
52: + sa.getNotesID());
53: System.out.println("");
54: }
55: if (r instanceof Notes) {
56: Notes n = (Notes) r;
57: NotesAtom na = n.getNotesAtom();
58: System.out.println("Found Notes at " + i);
59: System.out.println(" Notes ID is " + na.getSlideID());
60: System.out.println("");
61: }
62: }
63: }
64: }
|