Source Code Cross Referenced for StyleSheet.java in  » Collaboration » poi-3.0.2-beta2 » org » apache » poi » hdf » extractor » 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.hdf.extractor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /* ====================================================================
0002:         Licensed to the Apache Software Foundation (ASF) under one or more
0003:         contributor license agreements.  See the NOTICE file distributed with
0004:         this work for additional information regarding copyright ownership.
0005:         The ASF licenses this file to You under the Apache License, Version 2.0
0006:         (the "License"); you may not use this file except in compliance with
0007:         the License.  You may obtain a copy of the License at
0008:
0009:         http://www.apache.org/licenses/LICENSE-2.0
0010:
0011:         Unless required by applicable law or agreed to in writing, software
0012:         distributed under the License is distributed on an "AS IS" BASIS,
0013:         WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014:         See the License for the specific language governing permissions and
0015:         limitations under the License.
0016:         ==================================================================== */
0017:
0018:        package org.apache.poi.hdf.extractor;
0019:
0020:        import java.util.*;
0021:
0022:        /**
0023:         * Comment me
0024:         *
0025:         * @author Ryan Ackley 
0026:         */
0027:
0028:        public class StyleSheet {
0029:
0030:            private static final int NIL_STYLE = 4095;
0031:            private static final int PAP_TYPE = 1;
0032:            private static final int CHP_TYPE = 2;
0033:            private static final int SEP_TYPE = 4;
0034:            private static final int TAP_TYPE = 5;
0035:            //Vector _styleDescriptions;
0036:            StyleDescription _nilStyle = new StyleDescription();
0037:            StyleDescription[] _styleDescriptions;
0038:
0039:            public StyleSheet(byte[] styleSheet) {
0040:                int stshiLength = Utils.convertBytesToShort(styleSheet, 0);
0041:                int stdCount = Utils.convertBytesToShort(styleSheet, 2);
0042:                int baseLength = Utils.convertBytesToShort(styleSheet, 4);
0043:                int[] rgftc = new int[3];
0044:
0045:                rgftc[0] = Utils.convertBytesToInt(styleSheet, 14);
0046:                rgftc[1] = Utils.convertBytesToInt(styleSheet, 18);
0047:                rgftc[2] = Utils.convertBytesToInt(styleSheet, 22);
0048:
0049:                int offset = 0;
0050:                _styleDescriptions = new StyleDescription[stdCount];
0051:                for (int x = 0; x < stdCount; x++) {
0052:                    int stdOffset = (2 + stshiLength) + offset;
0053:                    int stdSize = Utils.convertBytesToShort(styleSheet,
0054:                            stdOffset);
0055:                    if (stdSize > 0) {
0056:                        byte[] std = new byte[stdSize];
0057:
0058:                        //get past the size
0059:                        stdOffset += 2;
0060:                        System
0061:                                .arraycopy(styleSheet, stdOffset, std, 0,
0062:                                        stdSize);
0063:                        StyleDescription aStyle = new StyleDescription(std,
0064:                                baseLength, true);
0065:
0066:                        _styleDescriptions[x] = aStyle;
0067:                    }
0068:
0069:                    offset += stdSize + 2;
0070:
0071:                }
0072:                for (int x = 0; x < _styleDescriptions.length; x++) {
0073:                    if (_styleDescriptions[x] != null) {
0074:                        createPap(x);
0075:                        createChp(x);
0076:                    }
0077:                }
0078:            }
0079:
0080:            private void createPap(int istd) {
0081:                StyleDescription sd = _styleDescriptions[istd];
0082:                PAP pap = sd.getPAP();
0083:                byte[] papx = sd.getPAPX();
0084:                int baseIndex = sd.getBaseStyle();
0085:                if (pap == null && papx != null) {
0086:                    PAP parentPAP = _nilStyle.getPAP();
0087:                    if (baseIndex != NIL_STYLE) {
0088:
0089:                        parentPAP = _styleDescriptions[baseIndex].getPAP();
0090:                        if (parentPAP == null) {
0091:                            createPap(baseIndex);
0092:                            parentPAP = _styleDescriptions[baseIndex].getPAP();
0093:                        }
0094:
0095:                    }
0096:
0097:                    pap = (PAP) uncompressProperty(papx, parentPAP, this );
0098:                    sd.setPAP(pap);
0099:                }
0100:            }
0101:
0102:            private void createChp(int istd) {
0103:                StyleDescription sd = _styleDescriptions[istd];
0104:                CHP chp = sd.getCHP();
0105:                byte[] chpx = sd.getCHPX();
0106:                int baseIndex = sd.getBaseStyle();
0107:                if (chp == null && chpx != null) {
0108:                    CHP parentCHP = _nilStyle.getCHP();
0109:                    if (baseIndex != NIL_STYLE) {
0110:
0111:                        parentCHP = _styleDescriptions[baseIndex].getCHP();
0112:                        if (parentCHP == null) {
0113:                            createChp(baseIndex);
0114:                            parentCHP = _styleDescriptions[baseIndex].getCHP();
0115:                        }
0116:
0117:                    }
0118:
0119:                    chp = (CHP) uncompressProperty(chpx, parentCHP, this );
0120:                    sd.setCHP(chp);
0121:                }
0122:            }
0123:
0124:            public StyleDescription getStyleDescription(int x) {
0125:                return _styleDescriptions[x];
0126:            }
0127:
0128:            static void doCHPOperation(CHP oldCHP, CHP newCHP, int operand,
0129:                    int param, byte[] varParam, byte[] grpprl, int offset,
0130:                    StyleSheet styleSheet) {
0131:                switch (operand) {
0132:                case 0:
0133:                    newCHP._fRMarkDel = getFlag(param);
0134:                    break;
0135:                case 0x1:
0136:                    newCHP._fRMark = getFlag(param);
0137:                    break;
0138:                case 0x2:
0139:                    break;
0140:                case 0x3:
0141:                    newCHP._fcPic = param;
0142:                    newCHP._fSpec = true;
0143:                    break;
0144:                case 0x4:
0145:                    newCHP._ibstRMark = (short) param;
0146:                    break;
0147:                case 0x5:
0148:                    newCHP._dttmRMark[0] = Utils.convertBytesToShort(grpprl,
0149:                            (offset - 4));
0150:                    newCHP._dttmRMark[1] = Utils.convertBytesToShort(grpprl,
0151:                            (offset - 2));
0152:                    break;
0153:                case 0x6:
0154:                    newCHP._fData = getFlag(param);
0155:                    break;
0156:                case 0x7:
0157:                    //don't care about this
0158:                    break;
0159:                case 0x8:
0160:                    short chsDiff = (short) ((param & 0xff0000) >>> 8);
0161:                    newCHP._fChsDiff = getFlag(chsDiff);
0162:                    newCHP._chse = (short) (param & 0xffff);
0163:                    break;
0164:                case 0x9:
0165:                    newCHP._fSpec = true;
0166:                    newCHP._ftcSym = (short) Utils.convertBytesToShort(
0167:                            varParam, 0);
0168:                    newCHP._xchSym = (short) Utils.convertBytesToShort(
0169:                            varParam, 2);
0170:                    break;
0171:                case 0xa:
0172:                    newCHP._fOle2 = getFlag(param);
0173:                    break;
0174:                case 0xb:
0175:                    //?
0176:                    break;
0177:                case 0xc:
0178:                    newCHP._icoHighlight = (byte) param;
0179:                    newCHP._highlighted = getFlag(param);
0180:                    break;
0181:                case 0xd:
0182:                    break;
0183:                case 0xe:
0184:                    newCHP._fcObj = param;
0185:                    break;
0186:                case 0xf:
0187:                    break;
0188:                case 0x10:
0189:                    //?
0190:                    break;
0191:                case 0x11:
0192:                    break;
0193:                case 0x12:
0194:                    break;
0195:                case 0x13:
0196:                    break;
0197:                case 0x14:
0198:                    break;
0199:                case 0x15:
0200:                    break;
0201:                case 0x16:
0202:                    break;
0203:                case 0x17:
0204:                    break;
0205:                case 0x18:
0206:                    break;
0207:                case 0x19:
0208:                    break;
0209:                case 0x1a:
0210:                    break;
0211:                case 0x1b:
0212:                    break;
0213:                case 0x1c:
0214:                    break;
0215:                case 0x1d:
0216:                    break;
0217:                case 0x1e:
0218:                    break;
0219:                case 0x1f:
0220:                    break;
0221:                case 0x20:
0222:                    break;
0223:                case 0x21:
0224:                    break;
0225:                case 0x22:
0226:                    break;
0227:                case 0x23:
0228:                    break;
0229:                case 0x24:
0230:                    break;
0231:                case 0x25:
0232:                    break;
0233:                case 0x26:
0234:                    break;
0235:                case 0x27:
0236:                    break;
0237:                case 0x28:
0238:                    break;
0239:                case 0x29:
0240:                    break;
0241:                case 0x2a:
0242:                    break;
0243:                case 0x2b:
0244:                    break;
0245:                case 0x2c:
0246:                    break;
0247:                case 0x2d:
0248:                    break;
0249:                case 0x2e:
0250:                    break;
0251:                case 0x2f:
0252:                    break;
0253:                case 0x30:
0254:                    newCHP._istd = param;
0255:                    break;
0256:                case 0x31:
0257:                    //permutation vector for fast saves who cares!
0258:                    break;
0259:                case 0x32:
0260:                    newCHP._bold = false;
0261:                    newCHP._italic = false;
0262:                    newCHP._fOutline = false;
0263:                    newCHP._fStrike = false;
0264:                    newCHP._fShadow = false;
0265:                    newCHP._fSmallCaps = false;
0266:                    newCHP._fCaps = false;
0267:                    newCHP._fVanish = false;
0268:                    newCHP._kul = 0;
0269:                    newCHP._ico = 0;
0270:                    break;
0271:                case 0x33:
0272:                    newCHP.copy(oldCHP);
0273:                    return;
0274:                case 0x34:
0275:                    break;
0276:                case 0x35:
0277:                    newCHP._bold = getCHPFlag((byte) param, oldCHP._bold);
0278:                    break;
0279:                case 0x36:
0280:                    newCHP._italic = getCHPFlag((byte) param, oldCHP._italic);
0281:                    break;
0282:                case 0x37:
0283:                    newCHP._fStrike = getCHPFlag((byte) param, oldCHP._fStrike);
0284:                    break;
0285:                case 0x38:
0286:                    newCHP._fOutline = getCHPFlag((byte) param,
0287:                            oldCHP._fOutline);
0288:                    break;
0289:                case 0x39:
0290:                    newCHP._fShadow = getCHPFlag((byte) param, oldCHP._fShadow);
0291:                    break;
0292:                case 0x3a:
0293:                    newCHP._fSmallCaps = getCHPFlag((byte) param,
0294:                            oldCHP._fSmallCaps);
0295:                    break;
0296:                case 0x3b:
0297:                    newCHP._fCaps = getCHPFlag((byte) param, oldCHP._fCaps);
0298:                    break;
0299:                case 0x3c:
0300:                    newCHP._fVanish = getCHPFlag((byte) param, oldCHP._fVanish);
0301:                    break;
0302:                case 0x3d:
0303:                    newCHP._ftc = (short) param;
0304:                    break;
0305:                case 0x3e:
0306:                    newCHP._kul = (byte) param;
0307:                    break;
0308:                case 0x3f:
0309:                    int hps = param & 0xff;
0310:                    if (hps != 0) {
0311:                        newCHP._hps = hps;
0312:                    }
0313:                    byte cInc = (byte) (((byte) (param & 0xfe00) >>> 4) >> 1);
0314:                    if (cInc != 0) {
0315:                        newCHP._hps = Math.max(newCHP._hps + (cInc * 2), 2);
0316:                    }
0317:                    byte hpsPos = (byte) ((param & 0xff0000) >>> 8);
0318:                    if (hpsPos != 0x80) {
0319:                        newCHP._hpsPos = hpsPos;
0320:                    }
0321:                    boolean fAdjust = (param & 0x0100) > 0;
0322:                    if (fAdjust && hpsPos != 128 && hpsPos != 0
0323:                            && oldCHP._hpsPos == 0) {
0324:                        newCHP._hps = Math.max(newCHP._hps + (-2), 2);
0325:                    }
0326:                    if (fAdjust && hpsPos == 0 && oldCHP._hpsPos != 0) {
0327:                        newCHP._hps = Math.max(newCHP._hps + 2, 2);
0328:                    }
0329:                    break;
0330:                case 0x40:
0331:                    newCHP._dxaSpace = param;
0332:                    break;
0333:                case 0x41:
0334:                    newCHP._lidDefault = (short) param;
0335:                    break;
0336:                case 0x42:
0337:                    newCHP._ico = (byte) param;
0338:                    break;
0339:                case 0x43:
0340:                    newCHP._hps = param;
0341:                    break;
0342:                case 0x44:
0343:                    byte hpsLvl = (byte) param;
0344:                    newCHP._hps = Math.max(newCHP._hps + (hpsLvl * 2), 2);
0345:                    break;
0346:                case 0x45:
0347:                    newCHP._hpsPos = (short) param;
0348:                    break;
0349:                case 0x46:
0350:                    if (param != 0) {
0351:                        if (oldCHP._hpsPos == 0) {
0352:                            newCHP._hps = Math.max(newCHP._hps + (-2), 2);
0353:                        }
0354:                    } else {
0355:                        if (oldCHP._hpsPos != 0) {
0356:                            newCHP._hps = Math.max(newCHP._hps + 2, 2);
0357:                        }
0358:                    }
0359:                    break;
0360:                case 0x47:
0361:                    CHP genCHP = new CHP();
0362:                    genCHP._ftc = 4;
0363:                    genCHP = (CHP) uncompressProperty(varParam, genCHP,
0364:                            styleSheet);
0365:                    CHP styleCHP = styleSheet.getStyleDescription(
0366:                            oldCHP._baseIstd).getCHP();
0367:                    if (genCHP._bold == newCHP._bold) {
0368:                        newCHP._bold = styleCHP._bold;
0369:                    }
0370:                    if (genCHP._italic == newCHP._italic) {
0371:                        newCHP._italic = styleCHP._italic;
0372:                    }
0373:                    if (genCHP._fSmallCaps == newCHP._fSmallCaps) {
0374:                        newCHP._fSmallCaps = styleCHP._fSmallCaps;
0375:                    }
0376:                    if (genCHP._fVanish == newCHP._fVanish) {
0377:                        newCHP._fVanish = styleCHP._fVanish;
0378:                    }
0379:                    if (genCHP._fStrike == newCHP._fStrike) {
0380:                        newCHP._fStrike = styleCHP._fStrike;
0381:                    }
0382:                    if (genCHP._fCaps == newCHP._fCaps) {
0383:                        newCHP._fCaps = styleCHP._fCaps;
0384:                    }
0385:                    if (genCHP._ftcAscii == newCHP._ftcAscii) {
0386:                        newCHP._ftcAscii = styleCHP._ftcAscii;
0387:                    }
0388:                    if (genCHP._ftcFE == newCHP._ftcFE) {
0389:                        newCHP._ftcFE = styleCHP._ftcFE;
0390:                    }
0391:                    if (genCHP._ftcOther == newCHP._ftcOther) {
0392:                        newCHP._ftcOther = styleCHP._ftcOther;
0393:                    }
0394:                    if (genCHP._hps == newCHP._hps) {
0395:                        newCHP._hps = styleCHP._hps;
0396:                    }
0397:                    if (genCHP._hpsPos == newCHP._hpsPos) {
0398:                        newCHP._hpsPos = styleCHP._hpsPos;
0399:                    }
0400:                    if (genCHP._kul == newCHP._kul) {
0401:                        newCHP._kul = styleCHP._kul;
0402:                    }
0403:                    if (genCHP._dxaSpace == newCHP._dxaSpace) {
0404:                        newCHP._dxaSpace = styleCHP._dxaSpace;
0405:                    }
0406:                    if (genCHP._ico == newCHP._ico) {
0407:                        newCHP._ico = styleCHP._ico;
0408:                    }
0409:                    if (genCHP._lidDefault == newCHP._lidDefault) {
0410:                        newCHP._lidDefault = styleCHP._lidDefault;
0411:                    }
0412:                    if (genCHP._lidFE == newCHP._lidFE) {
0413:                        newCHP._lidFE = styleCHP._lidFE;
0414:                    }
0415:                    break;
0416:                case 0x48:
0417:                    newCHP._iss = (byte) param;
0418:                    break;
0419:                case 0x49:
0420:                    newCHP._hps = Utils.convertBytesToShort(varParam, 0);
0421:                    break;
0422:                case 0x4a:
0423:                    int increment = Utils.convertBytesToShort(varParam, 0);
0424:                    newCHP._hps = Math.max(newCHP._hps + increment, 8);
0425:                    break;
0426:                case 0x4b:
0427:                    newCHP._hpsKern = param;
0428:                    break;
0429:                case 0x4c:
0430:                    doCHPOperation(oldCHP, newCHP, 0x47, param, varParam,
0431:                            grpprl, offset, styleSheet);
0432:                    break;
0433:                case 0x4d:
0434:                    float percentage = (float) param / 100.0f;
0435:                    int add = (int) ((float) percentage * (float) newCHP._hps);
0436:                    newCHP._hps += add;
0437:                    break;
0438:                case 0x4e:
0439:                    newCHP._ysr = (byte) param;
0440:                    break;
0441:                case 0x4f:
0442:                    newCHP._ftcAscii = (short) param;
0443:                    break;
0444:                case 0x50:
0445:                    newCHP._ftcFE = (short) param;
0446:                    break;
0447:                case 0x51:
0448:                    newCHP._ftcOther = (short) param;
0449:                    break;
0450:                case 0x52:
0451:                    break;
0452:                case 0x53:
0453:                    newCHP._fDStrike = getFlag(param);
0454:                    break;
0455:                case 0x54:
0456:                    newCHP._fImprint = getFlag(param);
0457:                    break;
0458:                case 0x55:
0459:                    newCHP._fSpec = getFlag(param);
0460:                    break;
0461:                case 0x56:
0462:                    newCHP._fObj = getFlag(param);
0463:                    break;
0464:                case 0x57:
0465:                    newCHP._fPropMark = getFlag(varParam[0]);
0466:                    newCHP._ibstPropRMark = (short) Utils.convertBytesToShort(
0467:                            varParam, 1);
0468:                    newCHP._dttmPropRMark = Utils
0469:                            .convertBytesToInt(varParam, 3);
0470:                    break;
0471:                case 0x58:
0472:                    newCHP._fEmboss = getFlag(param);
0473:                    break;
0474:                case 0x59:
0475:                    newCHP._sfxtText = (byte) param;
0476:                    break;
0477:                case 0x5a:
0478:                    break;
0479:                case 0x5b:
0480:                    break;
0481:                case 0x5c:
0482:                    break;
0483:                case 0x5d:
0484:                    break;
0485:                case 0x5e:
0486:                    break;
0487:                case 0x5f:
0488:                    break;
0489:                case 0x60:
0490:                    break;
0491:                case 0x61:
0492:                    break;
0493:                case 0x62:
0494:                    newCHP._fDispFldRMark = getFlag(varParam[0]);
0495:                    newCHP._ibstDispFldRMark = (short) Utils
0496:                            .convertBytesToShort(varParam, 1);
0497:                    newCHP._dttmDispFldRMark = Utils.convertBytesToInt(
0498:                            varParam, 3);
0499:                    System.arraycopy(varParam, 7, newCHP._xstDispFldRMark, 0,
0500:                            32);
0501:                    break;
0502:                case 0x63:
0503:                    newCHP._ibstRMarkDel = (short) param;
0504:                    break;
0505:                case 0x64:
0506:                    newCHP._dttmRMarkDel[0] = Utils.convertBytesToShort(grpprl,
0507:                            offset - 4);
0508:                    newCHP._dttmRMarkDel[1] = Utils.convertBytesToShort(grpprl,
0509:                            offset - 2);
0510:                    break;
0511:                case 0x65:
0512:                    newCHP._brc[0] = (short) Utils.convertBytesToShort(grpprl,
0513:                            offset - 4);
0514:                    newCHP._brc[1] = (short) Utils.convertBytesToShort(grpprl,
0515:                            offset - 2);
0516:                    break;
0517:                case 0x66:
0518:                    newCHP._shd = (short) param;
0519:                    break;
0520:                case 0x67:
0521:                    break;
0522:                case 0x68:
0523:                    break;
0524:                case 0x69:
0525:                    break;
0526:                case 0x6a:
0527:                    break;
0528:                case 0x6b:
0529:                    break;
0530:                case 0x6c:
0531:                    break;
0532:                case 0x6d:
0533:                    newCHP._lidDefault = (short) param;
0534:                    break;
0535:                case 0x6e:
0536:                    newCHP._lidFE = (short) param;
0537:                    break;
0538:                case 0x6f:
0539:                    newCHP._idctHint = (byte) param;
0540:                    break;
0541:                }
0542:            }
0543:
0544:            static Object uncompressProperty(byte[] grpprl, Object parent,
0545:                    StyleSheet styleSheet) {
0546:                return uncompressProperty(grpprl, parent, styleSheet, true);
0547:            }
0548:
0549:            static Object uncompressProperty(byte[] grpprl, Object parent,
0550:                    StyleSheet styleSheet, boolean doIstd) {
0551:                Object newProperty = null;
0552:                int offset = 0;
0553:                int propertyType = PAP_TYPE;
0554:
0555:                if (parent instanceof  PAP) {
0556:                    try {
0557:                        newProperty = ((PAP) parent).clone();
0558:                    } catch (Exception e) {
0559:                    }
0560:                    if (doIstd) {
0561:                        ((PAP) newProperty)._istd = Utils.convertBytesToShort(
0562:                                grpprl, 0);
0563:
0564:                        offset = 2;
0565:                    }
0566:                } else if (parent instanceof  CHP) {
0567:                    try {
0568:                        newProperty = ((CHP) parent).clone();
0569:                        ((CHP) newProperty)._baseIstd = ((CHP) parent)._istd;
0570:                    } catch (Exception e) {
0571:                    }
0572:                    propertyType = CHP_TYPE;
0573:                } else if (parent instanceof  SEP) {
0574:                    newProperty = parent;
0575:                    propertyType = SEP_TYPE;
0576:                } else if (parent instanceof  TAP) {
0577:                    newProperty = parent;
0578:                    propertyType = TAP_TYPE;
0579:                    offset = 2;//because this is really just a papx
0580:                } else {
0581:                    return null;
0582:                }
0583:
0584:                while (offset < grpprl.length) {
0585:                    short sprm = Utils.convertBytesToShort(grpprl, offset);
0586:                    offset += 2;
0587:
0588:                    byte spra = (byte) ((sprm & 0xe000) >> 13);
0589:                    int opSize = 0;
0590:                    int param = 0;
0591:                    byte[] varParam = null;
0592:
0593:                    switch (spra) {
0594:                    case 0:
0595:                    case 1:
0596:                        opSize = 1;
0597:                        param = grpprl[offset];
0598:                        break;
0599:                    case 2:
0600:                        opSize = 2;
0601:                        param = Utils.convertBytesToShort(grpprl, offset);
0602:                        break;
0603:                    case 3:
0604:                        opSize = 4;
0605:                        param = Utils.convertBytesToInt(grpprl, offset);
0606:                        break;
0607:                    case 4:
0608:                    case 5:
0609:                        opSize = 2;
0610:                        param = Utils.convertBytesToShort(grpprl, offset);
0611:                        break;
0612:                    case 6://variable size
0613:
0614:                        //there is one sprm that is a very special case
0615:                        if (sprm != (short) 0xd608) {
0616:                            opSize = Utils
0617:                                    .convertUnsignedByteToInt(grpprl[offset]);
0618:                            offset++;
0619:                        } else {
0620:                            opSize = Utils.convertBytesToShort(grpprl, offset) - 1;
0621:                            offset += 2;
0622:                        }
0623:                        varParam = new byte[opSize];
0624:                        System.arraycopy(grpprl, offset, varParam, 0, opSize);
0625:
0626:                        break;
0627:                    case 7:
0628:                        opSize = 3;
0629:                        param = Utils.convertBytesToInt((byte) 0,
0630:                                grpprl[offset + 2], grpprl[offset + 1],
0631:                                grpprl[offset]);
0632:                        break;
0633:                    default:
0634:                        throw new RuntimeException("unrecognized pap opcode");
0635:                    }
0636:
0637:                    offset += opSize;
0638:                    short operand = (short) (sprm & 0x1ff);
0639:                    byte type = (byte) ((sprm & 0x1c00) >> 10);
0640:                    switch (propertyType) {
0641:                    case PAP_TYPE:
0642:                        if (type == 1)//papx stores TAP sprms along with PAP sprms
0643:                        {
0644:                            doPAPOperation((PAP) newProperty, operand, param,
0645:                                    varParam, grpprl, offset, spra);
0646:                        }
0647:                        break;
0648:                    case CHP_TYPE:
0649:
0650:                        doCHPOperation((CHP) parent, (CHP) newProperty,
0651:                                operand, param, varParam, grpprl, offset,
0652:                                styleSheet);
0653:                        break;
0654:                    case SEP_TYPE:
0655:
0656:                        doSEPOperation((SEP) newProperty, operand, param,
0657:                                varParam);
0658:                        break;
0659:                    case TAP_TYPE:
0660:                        if (type == 5) {
0661:                            doTAPOperation((TAP) newProperty, operand, param,
0662:                                    varParam);
0663:                        }
0664:                        break;
0665:                    }
0666:
0667:                }
0668:                return newProperty;
0669:
0670:            }
0671:
0672:            static void doPAPOperation(PAP newPAP, int operand, int param,
0673:                    byte[] varParam, byte[] grpprl, int offset, int spra) {
0674:                switch (operand) {
0675:                case 0:
0676:                    newPAP._istd = param;
0677:                    break;
0678:                case 0x1:
0679:                    //permuteIstd(newPAP, varParam);
0680:                    break;
0681:                case 0x2:
0682:                    if (newPAP._istd <= 9 || newPAP._istd >= 1) {
0683:                        newPAP._istd += param;
0684:                        if (param > 0) {
0685:                            newPAP._istd = Math.max(newPAP._istd, 9);
0686:                        } else {
0687:                            newPAP._istd = Math.min(newPAP._istd, 1);
0688:                        }
0689:                    }
0690:                    break;
0691:                case 0x3:
0692:                    newPAP._jc = (byte) param;
0693:                    break;
0694:                case 0x4:
0695:                    newPAP._fSideBySide = (byte) param;
0696:                    break;
0697:                case 0x5:
0698:                    newPAP._fKeep = (byte) param;
0699:                    break;
0700:                case 0x6:
0701:                    newPAP._fKeepFollow = (byte) param;
0702:                    break;
0703:                case 0x7:
0704:                    newPAP._fPageBreakBefore = (byte) param;
0705:                    break;
0706:                case 0x8:
0707:                    newPAP._brcl = (byte) param;
0708:                    break;
0709:                case 0x9:
0710:                    newPAP._brcp = (byte) param;
0711:                    break;
0712:                case 0xa:
0713:                    newPAP._ilvl = (byte) param;
0714:                    break;
0715:                case 0xb:
0716:                    newPAP._ilfo = param;
0717:                    break;
0718:                case 0xc:
0719:                    newPAP._fNoLnn = (byte) param;
0720:                    break;
0721:                case 0xd:
0722:                    /**@todo handle tabs*/
0723:                    break;
0724:                case 0xe:
0725:                    newPAP._dxaRight = param;
0726:                    break;
0727:                case 0xf:
0728:                    newPAP._dxaLeft = param;
0729:                    break;
0730:                case 0x10:
0731:                    newPAP._dxaLeft += param;
0732:                    newPAP._dxaLeft = Math.max(0, newPAP._dxaLeft);
0733:                    break;
0734:                case 0x11:
0735:                    newPAP._dxaLeft1 = param;
0736:                    break;
0737:                case 0x12:
0738:                    newPAP._lspd[0] = Utils.convertBytesToShort(grpprl,
0739:                            offset - 4);
0740:                    newPAP._lspd[1] = Utils.convertBytesToShort(grpprl,
0741:                            offset - 2);
0742:                    break;
0743:                case 0x13:
0744:                    newPAP._dyaBefore = param;
0745:                    break;
0746:                case 0x14:
0747:                    newPAP._dyaAfter = param;
0748:                    break;
0749:                case 0x15:
0750:                    /**@todo handle tabs*/
0751:                    break;
0752:                case 0x16:
0753:                    newPAP._fInTable = (byte) param;
0754:                    break;
0755:                case 0x17:
0756:                    newPAP._fTtp = (byte) param;
0757:                    break;
0758:                case 0x18:
0759:                    newPAP._dxaAbs = param;
0760:                    break;
0761:                case 0x19:
0762:                    newPAP._dyaAbs = param;
0763:                    break;
0764:                case 0x1a:
0765:                    newPAP._dxaWidth = param;
0766:                    break;
0767:                case 0x1b:
0768:                    /** @todo handle paragraph postioning*/
0769:                    /*byte pcVert = (param & 0x0c) >> 2;
0770:                    byte pcHorz = param & 0x03;
0771:                    if(pcVert != 3)
0772:                    {
0773:                       newPAP._pcVert = pcVert;
0774:                    }
0775:                    if(pcHorz != 3)
0776:                    {
0777:                       newPAP._pcHorz = pcHorz;
0778:                    }*/
0779:                    break;
0780:                case 0x1c:
0781:                    newPAP._brcTop1 = (short) param;
0782:                    break;
0783:                case 0x1d:
0784:                    newPAP._brcLeft1 = (short) param;
0785:                    break;
0786:                case 0x1e:
0787:                    newPAP._brcBottom1 = (short) param;
0788:                    break;
0789:                case 0x1f:
0790:                    newPAP._brcRight1 = (short) param;
0791:                    break;
0792:                case 0x20:
0793:                    newPAP._brcBetween1 = (short) param;
0794:                    break;
0795:                case 0x21:
0796:                    newPAP._brcBar1 = (byte) param;
0797:                    break;
0798:                case 0x22:
0799:                    newPAP._dxaFromText = param;
0800:                    break;
0801:                case 0x23:
0802:                    newPAP._wr = (byte) param;
0803:                    break;
0804:                case 0x24:
0805:                    newPAP._brcTop[0] = (short) Utils.convertBytesToShort(
0806:                            grpprl, offset - 4);
0807:                    newPAP._brcTop[1] = (short) Utils.convertBytesToShort(
0808:                            grpprl, offset - 2);
0809:                    break;
0810:                case 0x25:
0811:                    newPAP._brcLeft[0] = (short) Utils.convertBytesToShort(
0812:                            grpprl, offset - 4);
0813:                    newPAP._brcLeft[1] = (short) Utils.convertBytesToShort(
0814:                            grpprl, offset - 2);
0815:                    break;
0816:                case 0x26:
0817:                    newPAP._brcBottom[0] = (short) Utils.convertBytesToShort(
0818:                            grpprl, offset - 4);
0819:                    newPAP._brcBottom[1] = (short) Utils.convertBytesToShort(
0820:                            grpprl, offset - 2);
0821:                    break;
0822:                case 0x27:
0823:                    newPAP._brcRight[0] = (short) Utils.convertBytesToShort(
0824:                            grpprl, offset - 4);
0825:                    newPAP._brcRight[1] = (short) Utils.convertBytesToShort(
0826:                            grpprl, offset - 2);
0827:                    break;
0828:                case 0x28:
0829:                    newPAP._brcBetween[0] = (short) Utils.convertBytesToShort(
0830:                            grpprl, offset - 4);
0831:                    newPAP._brcBetween[1] = (short) Utils.convertBytesToShort(
0832:                            grpprl, offset - 2);
0833:                    break;
0834:                case 0x29:
0835:                    newPAP._brcBar[0] = (short) Utils.convertBytesToShort(
0836:                            grpprl, offset - 4);
0837:                    newPAP._brcBar[1] = (short) Utils.convertBytesToShort(
0838:                            grpprl, offset - 2);
0839:                    break;
0840:                case 0x2a:
0841:                    newPAP._fNoAutoHyph = (byte) param;
0842:                    break;
0843:                case 0x2b:
0844:                    newPAP._dyaHeight = param;
0845:                    break;
0846:                case 0x2c:
0847:                    newPAP._dcs = param;
0848:                    break;
0849:                case 0x2d:
0850:                    newPAP._shd = param;
0851:                    break;
0852:                case 0x2e:
0853:                    newPAP._dyaFromText = param;
0854:                    break;
0855:                case 0x2f:
0856:                    newPAP._dxaFromText = param;
0857:                    break;
0858:                case 0x30:
0859:                    newPAP._fLocked = (byte) param;
0860:                    break;
0861:                case 0x31:
0862:                    newPAP._fWindowControl = (byte) param;
0863:                    break;
0864:                case 0x32:
0865:                    //undocumented
0866:                    break;
0867:                case 0x33:
0868:                    newPAP._fKinsoku = (byte) param;
0869:                    break;
0870:                case 0x34:
0871:                    newPAP._fWordWrap = (byte) param;
0872:                    break;
0873:                case 0x35:
0874:                    newPAP._fOverflowPunct = (byte) param;
0875:                    break;
0876:                case 0x36:
0877:                    newPAP._fTopLinePunct = (byte) param;
0878:                    break;
0879:                case 0x37:
0880:                    newPAP._fAutoSpaceDE = (byte) param;
0881:                    break;
0882:                case 0x38:
0883:                    newPAP._fAutoSpaceDN = (byte) param;
0884:                    break;
0885:                case 0x39:
0886:                    newPAP._wAlignFont = param;
0887:                    break;
0888:                case 0x3a:
0889:                    newPAP._fontAlign = (short) param;
0890:                    break;
0891:                case 0x3b:
0892:                    //obsolete
0893:                    break;
0894:                case 0x3e:
0895:                    newPAP._anld = varParam;
0896:                    break;
0897:                case 0x3f:
0898:                    //don't really need this. spec is confusing regarding this
0899:                    //sprm
0900:                    break;
0901:                case 0x40:
0902:                    //newPAP._lvl = param;
0903:                    break;
0904:                case 0x41:
0905:                    //?
0906:                    break;
0907:                case 0x43:
0908:                    //?
0909:                    break;
0910:                case 0x44:
0911:                    //?
0912:                    break;
0913:                case 0x45:
0914:                    if (spra == 6) {
0915:                        newPAP._numrm = varParam;
0916:                    } else {
0917:                        /**@todo handle large PAPX from data stream*/
0918:                    }
0919:                    break;
0920:
0921:                case 0x47:
0922:                    newPAP._fUsePgsuSettings = (byte) param;
0923:                    break;
0924:                case 0x48:
0925:                    newPAP._fAdjustRight = (byte) param;
0926:                    break;
0927:                default:
0928:                    break;
0929:                }
0930:            }
0931:
0932:            static void doTAPOperation(TAP newTAP, int operand, int param,
0933:                    byte[] varParam) {
0934:                switch (operand) {
0935:                case 0:
0936:                    newTAP._jc = (short) param;
0937:                    break;
0938:                case 0x01: {
0939:                    int adjust = param
0940:                            - (newTAP._rgdxaCenter[0] + newTAP._dxaGapHalf);
0941:                    for (int x = 0; x < newTAP._itcMac; x++) {
0942:                        newTAP._rgdxaCenter[x] += adjust;
0943:                    }
0944:                    break;
0945:                }
0946:                case 0x02:
0947:                    if (newTAP._rgdxaCenter != null) {
0948:                        int adjust = newTAP._dxaGapHalf - param;
0949:                        newTAP._rgdxaCenter[0] += adjust;
0950:                    }
0951:                    newTAP._dxaGapHalf = param;
0952:                    break;
0953:                case 0x03:
0954:                    newTAP._fCantSplit = getFlag(param);
0955:                    break;
0956:                case 0x04:
0957:                    newTAP._fTableHeader = getFlag(param);
0958:                    break;
0959:                case 0x05:
0960:
0961:                    newTAP._brcTop[0] = Utils.convertBytesToShort(varParam, 0);
0962:                    newTAP._brcTop[1] = Utils.convertBytesToShort(varParam, 2);
0963:
0964:                    newTAP._brcLeft[0] = Utils.convertBytesToShort(varParam, 4);
0965:                    newTAP._brcLeft[1] = Utils.convertBytesToShort(varParam, 6);
0966:
0967:                    newTAP._brcBottom[0] = Utils.convertBytesToShort(varParam,
0968:                            8);
0969:                    newTAP._brcBottom[1] = Utils.convertBytesToShort(varParam,
0970:                            10);
0971:
0972:                    newTAP._brcRight[0] = Utils.convertBytesToShort(varParam,
0973:                            12);
0974:                    newTAP._brcRight[1] = Utils.convertBytesToShort(varParam,
0975:                            14);
0976:
0977:                    newTAP._brcHorizontal[0] = Utils.convertBytesToShort(
0978:                            varParam, 16);
0979:                    newTAP._brcHorizontal[1] = Utils.convertBytesToShort(
0980:                            varParam, 18);
0981:
0982:                    newTAP._brcVertical[0] = Utils.convertBytesToShort(
0983:                            varParam, 20);
0984:                    newTAP._brcVertical[1] = Utils.convertBytesToShort(
0985:                            varParam, 22);
0986:                    break;
0987:                case 0x06:
0988:                    //obsolete, used in word 1.x
0989:                    break;
0990:                case 0x07:
0991:                    newTAP._dyaRowHeight = param;
0992:                    break;
0993:                case 0x08:
0994:                    //I use varParam[0] and newTAP._itcMac interchangably
0995:                    newTAP._itcMac = varParam[0];
0996:                    newTAP._rgdxaCenter = new short[varParam[0] + 1];
0997:                    newTAP._rgtc = new TC[varParam[0]];
0998:
0999:                    for (int x = 0; x < newTAP._itcMac; x++) {
1000:                        newTAP._rgdxaCenter[x] = Utils.convertBytesToShort(
1001:                                varParam, 1 + (x * 2));
1002:                        newTAP._rgtc[x] = TC.convertBytesToTC(varParam, 1
1003:                                + ((varParam[0] + 1) * 2) + (x * 20));
1004:                    }
1005:                    newTAP._rgdxaCenter[newTAP._itcMac] = Utils
1006:                            .convertBytesToShort(varParam,
1007:                                    1 + (newTAP._itcMac * 2));
1008:                    break;
1009:                case 0x09:
1010:                    /** @todo handle cell shading*/
1011:                    break;
1012:                case 0x0a:
1013:                    /** @todo handle word defined table styles*/
1014:                    break;
1015:                case 0x20:
1016:                    for (int x = varParam[0]; x < varParam[1]; x++) {
1017:                        if ((varParam[2] & 0x08) > 0) {
1018:                            newTAP._rgtc[x]._brcRight[0] = Utils
1019:                                    .convertBytesToShort(varParam, 6);
1020:                            newTAP._rgtc[x]._brcRight[1] = Utils
1021:                                    .convertBytesToShort(varParam, 8);
1022:                        } else if ((varParam[2] & 0x04) > 0) {
1023:                            newTAP._rgtc[x]._brcBottom[0] = Utils
1024:                                    .convertBytesToShort(varParam, 6);
1025:                            newTAP._rgtc[x]._brcBottom[1] = Utils
1026:                                    .convertBytesToShort(varParam, 8);
1027:                        } else if ((varParam[2] & 0x02) > 0) {
1028:                            newTAP._rgtc[x]._brcLeft[0] = Utils
1029:                                    .convertBytesToShort(varParam, 6);
1030:                            newTAP._rgtc[x]._brcLeft[1] = Utils
1031:                                    .convertBytesToShort(varParam, 8);
1032:                        } else if ((varParam[2] & 0x01) > 0) {
1033:                            newTAP._rgtc[x]._brcTop[0] = Utils
1034:                                    .convertBytesToShort(varParam, 6);
1035:                            newTAP._rgtc[x]._brcTop[1] = Utils
1036:                                    .convertBytesToShort(varParam, 8);
1037:                        }
1038:                    }
1039:                    break;
1040:                case 0x21:
1041:                    int index = (param & 0xff000000) >> 24;
1042:                    int count = (param & 0x00ff0000) >> 16;
1043:                    int width = (param & 0x0000ffff);
1044:
1045:                    short[] rgdxaCenter = new short[newTAP._itcMac + count + 1];
1046:                    TC[] rgtc = new TC[newTAP._itcMac + count];
1047:                    if (index >= newTAP._itcMac) {
1048:                        index = newTAP._itcMac;
1049:                        System.arraycopy(newTAP._rgdxaCenter, 0, rgdxaCenter,
1050:                                0, newTAP._itcMac + 1);
1051:                        System.arraycopy(newTAP._rgtc, 0, rgtc, 0,
1052:                                newTAP._itcMac);
1053:                    } else {
1054:                        //copy rgdxaCenter
1055:                        System.arraycopy(newTAP._rgdxaCenter, 0, rgdxaCenter,
1056:                                0, index + 1);
1057:                        System.arraycopy(newTAP._rgdxaCenter, index + 1,
1058:                                rgdxaCenter, index + count, (newTAP._itcMac)
1059:                                        - (index));
1060:                        //copy rgtc
1061:                        System.arraycopy(newTAP._rgtc, 0, rgtc, 0, index);
1062:                        System.arraycopy(newTAP._rgtc, index, rgtc, index
1063:                                + count, newTAP._itcMac - index);
1064:                    }
1065:
1066:                    for (int x = index; x < index + count; x++) {
1067:                        rgtc[x] = new TC();
1068:                        rgdxaCenter[x] = (short) (rgdxaCenter[x - 1] + width);
1069:                    }
1070:                    rgdxaCenter[index + count] = (short) (rgdxaCenter[(index + count) - 1] + width);
1071:                    break;
1072:                /**@todo handle table sprms from complex files*/
1073:                case 0x22:
1074:                case 0x23:
1075:                case 0x24:
1076:                case 0x25:
1077:                case 0x26:
1078:                case 0x27:
1079:                case 0x28:
1080:                case 0x29:
1081:                case 0x2a:
1082:                case 0x2b:
1083:                case 0x2c:
1084:                    break;
1085:                default:
1086:                    break;
1087:                }
1088:            }
1089:
1090:            static void doSEPOperation(SEP newSEP, int operand, int param,
1091:                    byte[] varParam) {
1092:                switch (operand) {
1093:                case 0:
1094:                    newSEP._cnsPgn = (byte) param;
1095:                    break;
1096:                case 0x1:
1097:                    newSEP._iHeadingPgn = (byte) param;
1098:                    break;
1099:                case 0x2:
1100:                    newSEP._olstAnn = varParam;
1101:                    break;
1102:                case 0x3:
1103:                    //not quite sure
1104:                    break;
1105:                case 0x4:
1106:                    //not quite sure
1107:                    break;
1108:                case 0x5:
1109:                    newSEP._fEvenlySpaced = getFlag(param);
1110:                    break;
1111:                case 0x6:
1112:                    newSEP._fUnlocked = getFlag(param);
1113:                    break;
1114:                case 0x7:
1115:                    newSEP._dmBinFirst = (short) param;
1116:                    break;
1117:                case 0x8:
1118:                    newSEP._dmBinOther = (short) param;
1119:                    break;
1120:                case 0x9:
1121:                    newSEP._bkc = (byte) param;
1122:                    break;
1123:                case 0xa:
1124:                    newSEP._fTitlePage = getFlag(param);
1125:                    break;
1126:                case 0xb:
1127:                    newSEP._ccolM1 = (short) param;
1128:                    break;
1129:                case 0xc:
1130:                    newSEP._dxaColumns = param;
1131:                    break;
1132:                case 0xd:
1133:                    newSEP._fAutoPgn = getFlag(param);
1134:                    break;
1135:                case 0xe:
1136:                    newSEP._nfcPgn = (byte) param;
1137:                    break;
1138:                case 0xf:
1139:                    newSEP._dyaPgn = (short) param;
1140:                    break;
1141:                case 0x10:
1142:                    newSEP._dxaPgn = (short) param;
1143:                    break;
1144:                case 0x11:
1145:                    newSEP._fPgnRestart = getFlag(param);
1146:                    break;
1147:                case 0x12:
1148:                    newSEP._fEndNote = getFlag(param);
1149:                    break;
1150:                case 0x13:
1151:                    newSEP._lnc = (byte) param;
1152:                    break;
1153:                case 0x14:
1154:                    newSEP._grpfIhdt = (byte) param;
1155:                    break;
1156:                case 0x15:
1157:                    newSEP._nLnnMod = (short) param;
1158:                    break;
1159:                case 0x16:
1160:                    newSEP._dxaLnn = param;
1161:                    break;
1162:                case 0x17:
1163:                    newSEP._dyaHdrTop = param;
1164:                    break;
1165:                case 0x18:
1166:                    newSEP._dyaHdrBottom = param;
1167:                    break;
1168:                case 0x19:
1169:                    newSEP._fLBetween = getFlag(param);
1170:                    break;
1171:                case 0x1a:
1172:                    newSEP._vjc = (byte) param;
1173:                    break;
1174:                case 0x1b:
1175:                    newSEP._lnnMin = (short) param;
1176:                    break;
1177:                case 0x1c:
1178:                    newSEP._pgnStart = (short) param;
1179:                    break;
1180:                case 0x1d:
1181:                    newSEP._dmOrientPage = (byte) param;
1182:                    break;
1183:                case 0x1e:
1184:                    //nothing
1185:                    break;
1186:                case 0x1f:
1187:                    newSEP._xaPage = param;
1188:                    break;
1189:                case 0x20:
1190:                    newSEP._yaPage = param;
1191:                    break;
1192:                case 0x21:
1193:                    newSEP._dxaLeft = param;
1194:                    break;
1195:                case 0x22:
1196:                    newSEP._dxaRight = param;
1197:                    break;
1198:                case 0x23:
1199:                    newSEP._dyaTop = param;
1200:                    break;
1201:                case 0x24:
1202:                    newSEP._dyaBottom = param;
1203:                    break;
1204:                case 0x25:
1205:                    newSEP._dzaGutter = param;
1206:                    break;
1207:                case 0x26:
1208:                    newSEP._dmPaperReq = (short) param;
1209:                    break;
1210:                case 0x27:
1211:                    newSEP._fPropMark = getFlag(varParam[0]);
1212:                    break;
1213:                case 0x28:
1214:                    break;
1215:                case 0x29:
1216:                    break;
1217:                case 0x2a:
1218:                    break;
1219:                case 0x2b:
1220:                    newSEP._brcTop[0] = (short) (param & 0xffff);
1221:                    newSEP._brcTop[1] = (short) ((param & 0xffff0000) >> 16);
1222:                    break;
1223:                case 0x2c:
1224:                    newSEP._brcLeft[0] = (short) (param & 0xffff);
1225:                    newSEP._brcLeft[1] = (short) ((param & 0xffff0000) >> 16);
1226:                    break;
1227:                case 0x2d:
1228:                    newSEP._brcBottom[0] = (short) (param & 0xffff);
1229:                    newSEP._brcBottom[1] = (short) ((param & 0xffff0000) >> 16);
1230:                    break;
1231:                case 0x2e:
1232:                    newSEP._brcRight[0] = (short) (param & 0xffff);
1233:                    newSEP._brcRight[1] = (short) ((param & 0xffff0000) >> 16);
1234:                    break;
1235:                case 0x2f:
1236:                    newSEP._pgbProp = (short) param;
1237:                    break;
1238:                case 0x30:
1239:                    newSEP._dxtCharSpace = param;
1240:                    break;
1241:                case 0x31:
1242:                    newSEP._dyaLinePitch = param;
1243:                    break;
1244:                case 0x33:
1245:                    newSEP._wTextFlow = (short) param;
1246:                    break;
1247:                default:
1248:                    break;
1249:                }
1250:
1251:            }
1252:
1253:            private static boolean getCHPFlag(byte x, boolean oldVal) {
1254:                switch (x) {
1255:                case 0:
1256:                    return false;
1257:                case 1:
1258:                    return true;
1259:                case (byte) 0x80:
1260:                    return oldVal;
1261:                case (byte) 0x81:
1262:                    return !oldVal;
1263:                default:
1264:                    return false;
1265:                }
1266:            }
1267:
1268:            public static boolean getFlag(int x) {
1269:                if (x != 0) {
1270:                    return true;
1271:                } else {
1272:                    return false;
1273:                }
1274:            }
1275:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.