Source Code Cross Referenced for DocumentAtom.java in  » Collaboration » poi-3.0.2-beta2 » org » apache » poi » hslf » record » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Collaboration » poi 3.0.2 beta2 » org.apache.poi.hslf.record 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.record;
019:
020:        import org.apache.poi.util.LittleEndian;
021:        import java.io.IOException;
022:        import java.io.OutputStream;
023:
024:        /**
025:         * A Document Atom (type 1001). Holds misc information on the PowerPoint
026:         * document, lots of them size and scale related.
027:         *
028:         * @author Nick Burch
029:         */
030:
031:        public class DocumentAtom extends RecordAtom {
032:            private byte[] _header;
033:            private static long _type = 1001l;
034:
035:            private long slideSizeX; // PointAtom, assume 1st 4 bytes = X
036:            private long slideSizeY; // PointAtom, assume 2nd 4 bytes = Y
037:            private long notesSizeX; // PointAtom, assume 1st 4 bytes = X
038:            private long notesSizeY; // PointAtom, assume 2nd 4 bytes = Y
039:            private long serverZoomFrom; // RatioAtom, assume 1st 4 bytes = from
040:            private long serverZoomTo; // RatioAtom, assume 2nd 4 bytes = to
041:
042:            private long notesMasterPersist; // ref to NotesMaster, 0 if none
043:            private long handoutMasterPersist; // ref to HandoutMaster, 0 if none
044:
045:            private int firstSlideNum;
046:            private int slideSizeType; // see DocumentAtom.SlideSize
047:
048:            private byte saveWithFonts;
049:            private byte omitTitlePlace;
050:            private byte rightToLeft;
051:            private byte showComments;
052:
053:            private byte[] reserved;
054:
055:            public long getSlideSizeX() {
056:                return slideSizeX;
057:            }
058:
059:            public long getSlideSizeY() {
060:                return slideSizeY;
061:            }
062:
063:            public long getNotesSizeX() {
064:                return notesSizeX;
065:            }
066:
067:            public long getNotesSizeY() {
068:                return notesSizeY;
069:            }
070:
071:            public void setSlideSizeX(long x) {
072:                slideSizeX = x;
073:            }
074:
075:            public void setSlideSizeY(long y) {
076:                slideSizeY = y;
077:            }
078:
079:            public void setNotesSizeX(long x) {
080:                notesSizeX = x;
081:            }
082:
083:            public void setNotesSizeY(long y) {
084:                notesSizeY = y;
085:            }
086:
087:            public long getServerZoomFrom() {
088:                return serverZoomFrom;
089:            }
090:
091:            public long getServerZoomTo() {
092:                return serverZoomTo;
093:            }
094:
095:            public void setServerZoomFrom(long zoom) {
096:                serverZoomFrom = zoom;
097:            }
098:
099:            public void setServerZoomTo(long zoom) {
100:                serverZoomTo = zoom;
101:            }
102:
103:            /** Returns a reference to the NotesMaster, or 0 if none */
104:            public long getNotesMasterPersist() {
105:                return notesMasterPersist;
106:            }
107:
108:            /** Returns a reference to the HandoutMaster, or 0 if none */
109:            public long getHandoutMasterPersist() {
110:                return handoutMasterPersist;
111:            }
112:
113:            public int getFirstSlideNum() {
114:                return firstSlideNum;
115:            }
116:
117:            /** The Size of the Document's slides, @see DocumentAtom.SlideSize for values */
118:            public int getSlideSizeType() {
119:                return slideSizeType;
120:            }
121:
122:            /** Was the document saved with True Type fonts embeded? */
123:            public boolean getSaveWithFonts() {
124:                if (saveWithFonts == 0) {
125:                    return false;
126:                } else {
127:                    return true;
128:                }
129:            }
130:
131:            /** Have the placeholders on the title slide been omitted? */
132:            public boolean getOmitTitlePlace() {
133:                if (omitTitlePlace == 0) {
134:                    return false;
135:                } else {
136:                    return true;
137:                }
138:            }
139:
140:            /** Is this a Bi-Directional PPT Doc? */
141:            public boolean getRightToLeft() {
142:                if (rightToLeft == 0) {
143:                    return false;
144:                } else {
145:                    return true;
146:                }
147:            }
148:
149:            /** Are comment shapes visible? */
150:            public boolean getShowComments() {
151:                if (showComments == 0) {
152:                    return false;
153:                } else {
154:                    return true;
155:                }
156:            }
157:
158:            /* *************** record code follows ********************** */
159:
160:            /** 
161:             * For the Document Atom
162:             */
163:            protected DocumentAtom(byte[] source, int start, int len) {
164:                // Sanity Checking
165:                if (len < 48) {
166:                    len = 48;
167:                }
168:
169:                // Get the header
170:                _header = new byte[8];
171:                System.arraycopy(source, start, _header, 0, 8);
172:
173:                // Get the sizes and zoom ratios
174:                slideSizeX = LittleEndian.getInt(source, start + 0 + 8);
175:                slideSizeY = LittleEndian.getInt(source, start + 4 + 8);
176:                notesSizeX = LittleEndian.getInt(source, start + 8 + 8);
177:                notesSizeY = LittleEndian.getInt(source, start + 12 + 8);
178:                serverZoomFrom = LittleEndian.getInt(source, start + 16 + 8);
179:                serverZoomTo = LittleEndian.getInt(source, start + 20 + 8);
180:
181:                // Get the master persists
182:                notesMasterPersist = LittleEndian
183:                        .getInt(source, start + 24 + 8);
184:                handoutMasterPersist = LittleEndian.getInt(source,
185:                        start + 28 + 8);
186:
187:                // Get the ID of the first slide
188:                firstSlideNum = (int) LittleEndian.getShort(source,
189:                        start + 32 + 8);
190:
191:                // Get the slide size type
192:                slideSizeType = (int) LittleEndian.getShort(source,
193:                        start + 34 + 8);
194:
195:                // Get the booleans as bytes
196:                saveWithFonts = source[start + 36 + 8];
197:                omitTitlePlace = source[start + 37 + 8];
198:                rightToLeft = source[start + 38 + 8];
199:                showComments = source[start + 39 + 8];
200:
201:                // If there's any other bits of data, keep them about
202:                reserved = new byte[len - 40 - 8];
203:                System.arraycopy(source, start + 48, reserved, 0,
204:                        reserved.length);
205:            }
206:
207:            /**
208:             * We are of type 1001
209:             */
210:            public long getRecordType() {
211:                return _type;
212:            }
213:
214:            /**
215:             * Write the contents of the record back, so it can be written
216:             *  to disk
217:             */
218:            public void writeOut(OutputStream out) throws IOException {
219:                // Header
220:                out.write(_header);
221:
222:                // The sizes and zoom ratios
223:                writeLittleEndian((int) slideSizeX, out);
224:                writeLittleEndian((int) slideSizeY, out);
225:                writeLittleEndian((int) notesSizeX, out);
226:                writeLittleEndian((int) notesSizeY, out);
227:                writeLittleEndian((int) serverZoomFrom, out);
228:                writeLittleEndian((int) serverZoomTo, out);
229:
230:                // The master persists
231:                writeLittleEndian((int) notesMasterPersist, out);
232:                writeLittleEndian((int) handoutMasterPersist, out);
233:
234:                // The ID of the first slide
235:                writeLittleEndian((short) firstSlideNum, out);
236:
237:                // The slide size type
238:                writeLittleEndian((short) slideSizeType, out);
239:
240:                // The booleans as bytes
241:                out.write(saveWithFonts);
242:                out.write(omitTitlePlace);
243:                out.write(rightToLeft);
244:                out.write(showComments);
245:
246:                // Reserved data
247:                out.write(reserved);
248:            }
249:
250:            /**
251:             * Holds the different Slide Size values
252:             */
253:            public static final class SlideSize {
254:                public static final int ON_SCREEN = 0;
255:                public static final int LETTER_SIZED_PAPER = 1;
256:                public static final int A4_SIZED_PAPER = 2;
257:                public static final int ON_35MM = 3;
258:                public static final int OVERHEAD = 4;
259:                public static final int BANNER = 5;
260:                public static final int CUSTOM = 6;
261:            }
262:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.