Source Code Cross Referenced for SlidePersistAtom.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 SlidePersist Atom (type 1011). Holds information on the text of a
026:         *  given slide, which are stored in the same SlideListWithText
027:         *
028:         * @author Nick Burch
029:         */
030:
031:        public class SlidePersistAtom extends RecordAtom {
032:            private byte[] _header;
033:            private static long _type = 1011l;
034:
035:            /** 
036:             * Slide reference ID. Should correspond to the PersistPtr 
037:             *  "sheet ID" of the matching slide/notes record 
038:             */
039:            private int refID;
040:            private boolean hasShapesOtherThanPlaceholders;
041:            /** Number of placeholder texts that will follow in the SlideListWithText */
042:            private int numPlaceholderTexts;
043:            /** 
044:             * The internal identifier (256+), which is used to tie slides
045:             *  and notes together 
046:             */
047:            private int slideIdentifier;
048:            /** Reserved fields. Who knows what they do */
049:            private byte[] reservedFields;
050:
051:            public int getRefID() {
052:                return refID;
053:            }
054:
055:            public int getSlideIdentifier() {
056:                return slideIdentifier;
057:            }
058:
059:            public int getNumPlaceholderTexts() {
060:                return numPlaceholderTexts;
061:            }
062:
063:            public boolean getHasShapesOtherThanPlaceholders() {
064:                return hasShapesOtherThanPlaceholders;
065:            }
066:
067:            // Only set these if you know what you're doing!
068:            public void setRefID(int id) {
069:                refID = id;
070:            }
071:
072:            public void setSlideIdentifier(int id) {
073:                slideIdentifier = id;
074:            }
075:
076:            /* *************** record code follows ********************** */
077:
078:            /** 
079:             * For the SlidePersist Atom
080:             */
081:            protected SlidePersistAtom(byte[] source, int start, int len) {
082:                // Sanity Checking
083:                if (len < 8) {
084:                    len = 8;
085:                }
086:
087:                // Get the header
088:                _header = new byte[8];
089:                System.arraycopy(source, start, _header, 0, 8);
090:
091:                // Grab the reference ID
092:                refID = (int) LittleEndian.getInt(source, start + 8);
093:
094:                // Next up is a set of flags, but only bit 3 is used!
095:                int flags = (int) LittleEndian.getInt(source, start + 12);
096:                if (flags == 4) {
097:                    hasShapesOtherThanPlaceholders = true;
098:                } else {
099:                    hasShapesOtherThanPlaceholders = false;
100:                }
101:
102:                // Now the number of Placeholder Texts
103:                numPlaceholderTexts = (int) LittleEndian.getInt(source,
104:                        start + 16);
105:
106:                // Last useful one is the unique slide identifier
107:                slideIdentifier = (int) LittleEndian.getInt(source, start + 20);
108:
109:                // Finally you have typically 4 or 8 bytes of reserved fields, 
110:                //  all zero running from 24 bytes in to the end
111:                reservedFields = new byte[len - 24];
112:                System.arraycopy(source, start + 24, reservedFields, 0,
113:                        reservedFields.length);
114:            }
115:
116:            /**
117:             * Create a new SlidePersistAtom, for use with a new Slide
118:             */
119:            public SlidePersistAtom() {
120:                _header = new byte[8];
121:                LittleEndian.putUShort(_header, 0, 0);
122:                LittleEndian.putUShort(_header, 2, (int) _type);
123:                LittleEndian.putInt(_header, 4, 20);
124:
125:                hasShapesOtherThanPlaceholders = true;
126:                reservedFields = new byte[4];
127:            }
128:
129:            /**
130:             * We are of type 1011
131:             */
132:            public long getRecordType() {
133:                return _type;
134:            }
135:
136:            /**
137:             * Write the contents of the record back, so it can be written
138:             *  to disk
139:             */
140:            public void writeOut(OutputStream out) throws IOException {
141:                // Header - size or type unchanged
142:                out.write(_header);
143:
144:                // Compute the flags part - only bit 3 is used
145:                int flags = 0;
146:                if (hasShapesOtherThanPlaceholders) {
147:                    flags = 4;
148:                }
149:
150:                // Write out our fields
151:                writeLittleEndian(refID, out);
152:                writeLittleEndian(flags, out);
153:                writeLittleEndian(numPlaceholderTexts, out);
154:                writeLittleEndian(slideIdentifier, out);
155:                out.write(reservedFields);
156:            }
157:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.