Source Code Cross Referenced for CharacterRun.java in  » Collaboration » poi-3.0.2-beta2 » org » apache » poi » hwpf » usermodel » 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.hwpf.usermodel 
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.hwpf.usermodel;
019:
020:        import org.apache.poi.hwpf.model.CHPX;
021:        import org.apache.poi.hwpf.model.StyleSheet;
022:        import org.apache.poi.hwpf.sprm.SprmBuffer;
023:
024:        /**
025:         * This class represents a run of text that share common properties.
026:         *
027:         * @author Ryan Ackley
028:         */
029:        public class CharacterRun extends Range implements  Cloneable {
030:            public final static short SPRM_FRMARKDEL = (short) 0x0800;
031:            public final static short SPRM_FRMARK = 0x0801;
032:            public final static short SPRM_FFLDVANISH = 0x0802;
033:            public final static short SPRM_PICLOCATION = 0x6A03;
034:            public final static short SPRM_IBSTRMARK = 0x4804;
035:            public final static short SPRM_DTTMRMARK = 0x6805;
036:            public final static short SPRM_FDATA = 0x0806;
037:            public final static short SPRM_SYMBOL = 0x6A09;
038:            public final static short SPRM_FOLE2 = 0x080A;
039:            public final static short SPRM_HIGHLIGHT = 0x2A0C;
040:            public final static short SPRM_OBJLOCATION = 0x680E;
041:            public final static short SPRM_ISTD = 0x4A30;
042:            public final static short SPRM_FBOLD = 0x0835;
043:            public final static short SPRM_FITALIC = 0x0836;
044:            public final static short SPRM_FSTRIKE = 0x0837;
045:            public final static short SPRM_FOUTLINE = 0x0838;
046:            public final static short SPRM_FSHADOW = 0x0839;
047:            public final static short SPRM_FSMALLCAPS = 0x083A;
048:            public final static short SPRM_FCAPS = 0x083B;
049:            public final static short SPRM_FVANISH = 0x083C;
050:            public final static short SPRM_KUL = 0x2A3E;
051:            public final static short SPRM_DXASPACE = (short) 0x8840;
052:            public final static short SPRM_LID = 0x4A41;
053:            public final static short SPRM_ICO = 0x2A42;
054:            public final static short SPRM_HPS = 0x4A43;
055:            public final static short SPRM_HPSPOS = 0x4845;
056:            public final static short SPRM_ISS = 0x2A48;
057:            public final static short SPRM_HPSKERN = 0x484B;
058:            public final static short SPRM_YSRI = 0x484E;
059:            public final static short SPRM_RGFTCASCII = 0x4A4F;
060:            public final static short SPRM_RGFTCFAREAST = 0x4A50;
061:            public final static short SPRM_RGFTCNOTFAREAST = 0x4A51;
062:            public final static short SPRM_CHARSCALE = 0x4852;
063:            public final static short SPRM_FDSTRIKE = 0x2A53;
064:            public final static short SPRM_FIMPRINT = 0x0854;
065:            public final static short SPRM_FSPEC = 0x0855;
066:            public final static short SPRM_FOBJ = 0x0856;
067:            public final static short SPRM_PROPRMARK = (short) 0xCA57;
068:            public final static short SPRM_FEMBOSS = 0x0858;
069:            public final static short SPRM_SFXTEXT = 0x2859;
070:            public final static short SPRM_DISPFLDRMARK = (short) 0xCA62;
071:            public final static short SPRM_IBSTRMARKDEL = 0x4863;
072:            public final static short SPRM_DTTMRMARKDEL = 0x6864;
073:            public final static short SPRM_BRC = 0x6865;
074:            public final static short SPRM_SHD = 0x4866;
075:            public final static short SPRM_IDSIRMARKDEL = 0x4867;
076:            public final static short SPRM_CPG = 0x486B;
077:            public final static short SPRM_NONFELID = 0x486D;
078:            public final static short SPRM_FELID = 0x486E;
079:            public final static short SPRM_IDCTHINT = 0x286F;
080:
081:            SprmBuffer _chpx;
082:            CharacterProperties _props;
083:
084:            /**
085:             *
086:             * @param chpx The chpx this object is based on.
087:             * @param ss The stylesheet for the document this run belongs to.
088:             * @param istd The style index if this run's base style.
089:             * @param parent The parent range of this character run (usually a paragraph).
090:             */
091:            CharacterRun(CHPX chpx, StyleSheet ss, short istd, Range parent) {
092:                super (Math.max(parent._start, chpx.getStart()), Math.min(
093:                        parent._end, chpx.getEnd()), parent);
094:                _props = chpx.getCharacterProperties(ss, istd);
095:                _chpx = chpx.getSprmBuf();
096:            }
097:
098:            /**
099:             * Here for runtime type determination using a switch statement convenient.
100:             *
101:             * @return TYPE_CHARACTER
102:             */
103:            public int type() {
104:                return TYPE_CHARACTER;
105:            }
106:
107:            public boolean isMarkedDeleted() {
108:                return _props.isFRMarkDel();
109:            }
110:
111:            public void markDeleted(boolean mark) {
112:                _props.setFRMarkDel(mark);
113:
114:                byte newVal = (byte) (mark ? 1 : 0);
115:                _chpx.updateSprm(SPRM_FRMARKDEL, newVal);
116:
117:            }
118:
119:            public boolean isBold() {
120:                return _props.isFBold();
121:            }
122:
123:            public void setBold(boolean bold) {
124:                _props.setFBold(bold);
125:
126:                byte newVal = (byte) (bold ? 1 : 0);
127:                _chpx.updateSprm(SPRM_FBOLD, newVal);
128:
129:            }
130:
131:            public boolean isItalic() {
132:                return _props.isFItalic();
133:            }
134:
135:            public void setItalic(boolean italic) {
136:                _props.setFItalic(italic);
137:
138:                byte newVal = (byte) (italic ? 1 : 0);
139:                _chpx.updateSprm(SPRM_FITALIC, newVal);
140:
141:            }
142:
143:            public boolean isOutlined() {
144:                return _props.isFOutline();
145:            }
146:
147:            public void setOutline(boolean outlined) {
148:                _props.setFOutline(outlined);
149:
150:                byte newVal = (byte) (outlined ? 1 : 0);
151:                _chpx.updateSprm(SPRM_FOUTLINE, newVal);
152:
153:            }
154:
155:            public boolean isFldVanished() {
156:                return _props.isFFldVanish();
157:            }
158:
159:            public void setFldVanish(boolean fldVanish) {
160:                _props.setFFldVanish(fldVanish);
161:
162:                byte newVal = (byte) (fldVanish ? 1 : 0);
163:                _chpx.updateSprm(SPRM_FFLDVANISH, newVal);
164:
165:            }
166:
167:            public boolean isSmallCaps() {
168:                return _props.isFSmallCaps();
169:            }
170:
171:            public void setSmallCaps(boolean smallCaps) {
172:                _props.setFSmallCaps(smallCaps);
173:
174:                byte newVal = (byte) (smallCaps ? 1 : 0);
175:                _chpx.updateSprm(SPRM_FSMALLCAPS, newVal);
176:
177:            }
178:
179:            public boolean isCapitalized() {
180:                return _props.isFCaps();
181:            }
182:
183:            public void setCapitalized(boolean caps) {
184:                _props.setFCaps(caps);
185:
186:                byte newVal = (byte) (caps ? 1 : 0);
187:                _chpx.updateSprm(SPRM_FCAPS, newVal);
188:
189:            }
190:
191:            public boolean isVanished() {
192:                return _props.isFVanish();
193:            }
194:
195:            public void setVanished(boolean vanish) {
196:                _props.setFVanish(vanish);
197:
198:                byte newVal = (byte) (vanish ? 1 : 0);
199:                _chpx.updateSprm(SPRM_FVANISH, newVal);
200:
201:            }
202:
203:            public boolean isMarkedInserted() {
204:                return _props.isFRMark();
205:            }
206:
207:            public void markInserted(boolean mark) {
208:                _props.setFRMark(mark);
209:
210:                byte newVal = (byte) (mark ? 1 : 0);
211:                _chpx.updateSprm(SPRM_FRMARK, newVal);
212:
213:            }
214:
215:            public boolean isStrikeThrough() {
216:                return _props.isFStrike();
217:            }
218:
219:            public void strikeThrough(boolean strike) {
220:                _props.setFStrike(strike);
221:
222:                byte newVal = (byte) (strike ? 1 : 0);
223:                _chpx.updateSprm(SPRM_FSTRIKE, newVal);
224:
225:            }
226:
227:            public boolean isShadowed() {
228:                return _props.isFShadow();
229:            }
230:
231:            public void setShadow(boolean shadow) {
232:                _props.setFShadow(shadow);
233:
234:                byte newVal = (byte) (shadow ? 1 : 0);
235:                _chpx.updateSprm(SPRM_FSHADOW, newVal);
236:
237:            }
238:
239:            public boolean isEmbossed() {
240:                return _props.isFEmboss();
241:            }
242:
243:            public void setEmbossed(boolean emboss) {
244:                _props.setFEmboss(emboss);
245:
246:                byte newVal = (byte) (emboss ? 1 : 0);
247:                _chpx.updateSprm(SPRM_FEMBOSS, newVal);
248:
249:            }
250:
251:            public boolean isImprinted() {
252:                return _props.isFImprint();
253:            }
254:
255:            public void setImprinted(boolean imprint) {
256:                _props.setFImprint(imprint);
257:
258:                byte newVal = (byte) (imprint ? 1 : 0);
259:                _chpx.updateSprm(SPRM_FIMPRINT, newVal);
260:
261:            }
262:
263:            public boolean isDoubleStrikeThrough() {
264:                return _props.isFDStrike();
265:            }
266:
267:            public void setDoubleStrikethrough(boolean dstrike) {
268:                _props.setFDStrike(dstrike);
269:
270:                byte newVal = (byte) (dstrike ? 1 : 0);
271:                _chpx.updateSprm(SPRM_FDSTRIKE, newVal);
272:
273:            }
274:
275:            public void setFtcAscii(int ftcAscii) {
276:                _props.setFtcAscii(ftcAscii);
277:
278:                _chpx.updateSprm(SPRM_RGFTCASCII, (short) ftcAscii);
279:
280:            }
281:
282:            public void setFtcFE(int ftcFE) {
283:                _props.setFtcFE(ftcFE);
284:
285:                _chpx.updateSprm(SPRM_RGFTCFAREAST, (short) ftcFE);
286:
287:            }
288:
289:            public void setFtcOther(int ftcOther) {
290:                _props.setFtcOther(ftcOther);
291:
292:                _chpx.updateSprm(SPRM_RGFTCNOTFAREAST, (short) ftcOther);
293:
294:            }
295:
296:            public int getFontSize() {
297:                return _props.getHps();
298:            }
299:
300:            public void setFontSize(int halfPoints) {
301:                _props.setHps(halfPoints);
302:
303:                _chpx.updateSprm(SPRM_HPS, (short) halfPoints);
304:
305:            }
306:
307:            public int getCharacterSpacing() {
308:                return _props.getDxaSpace();
309:            }
310:
311:            public void setCharacterSpacing(int twips) {
312:                _props.setDxaSpace(twips);
313:
314:                _chpx.updateSprm(SPRM_DXASPACE, twips);
315:
316:            }
317:
318:            public short getSubSuperScriptIndex() {
319:                return _props.getIss();
320:            }
321:
322:            public void setSubSuperScriptIndex(short iss) {
323:                _props.setDxaSpace(iss);
324:
325:                _chpx.updateSprm(SPRM_DXASPACE, iss);
326:
327:            }
328:
329:            public int getUnderlineCode() {
330:                return _props.getKul();
331:            }
332:
333:            public void setUnderlineCode(int kul) {
334:                _props.setKul((byte) kul);
335:                _chpx.updateSprm(SPRM_KUL, (byte) kul);
336:            }
337:
338:            public int getColor() {
339:                return _props.getIco();
340:            }
341:
342:            public void setColor(int color) {
343:                _props.setIco((byte) color);
344:                _chpx.updateSprm(SPRM_ICO, (byte) color);
345:            }
346:
347:            public int getVerticalOffset() {
348:                return _props.getHpsPos();
349:            }
350:
351:            public void setVerticalOffset(int hpsPos) {
352:                _props.setHpsPos(hpsPos);
353:                _chpx.updateSprm(SPRM_HPSPOS, (byte) hpsPos);
354:            }
355:
356:            public int getKerning() {
357:                return _props.getHpsKern();
358:            }
359:
360:            public void setKerning(int kern) {
361:                _props.setHpsKern(kern);
362:                _chpx.updateSprm(SPRM_HPSKERN, (short) kern);
363:            }
364:
365:            public boolean isHighlighted() {
366:                return _props.isFHighlight();
367:            }
368:
369:            public void setHighlighted(byte color) {
370:                _props.setFHighlight(true);
371:                _props.setIcoHighlight(color);
372:                _chpx.updateSprm(SPRM_HIGHLIGHT, color);
373:            }
374:
375:            public String getFontName() {
376:                return _doc.getFontTable().getMainFont(_props.getFtcAscii());
377:            }
378:
379:            public boolean isSpecialCharacter() {
380:                return _props.isFSpec();
381:            }
382:
383:            public void setSpecialCharacter(boolean spec) {
384:                _props.setFSpec(spec);
385:
386:                byte newVal = (byte) (spec ? 1 : 0);
387:                _chpx.updateSprm(SPRM_FSPEC, newVal);
388:            }
389:
390:            public boolean isObj() {
391:                return _props.isFObj();
392:            }
393:
394:            public void setObj(boolean obj) {
395:                _props.setFObj(obj);
396:
397:                byte newVal = (byte) (obj ? 1 : 0);
398:                _chpx.updateSprm(SPRM_FOBJ, newVal);
399:            }
400:
401:            public int getPicOffset() {
402:                return _props.getFcPic();
403:            }
404:
405:            public void setPicOffset(int offset) {
406:                _props.setFcPic(offset);
407:                _chpx.updateSprm(SPRM_PICLOCATION, offset);
408:            }
409:
410:            public boolean isData() {
411:                return _props.isFData();
412:            }
413:
414:            public void setData(boolean data) {
415:                _props.setFData(data);
416:
417:                byte newVal = (byte) (data ? 1 : 0);
418:                _chpx.updateSprm(SPRM_FOBJ, newVal);
419:            }
420:
421:            public boolean isOle2() {
422:                return _props.isFOle2();
423:            }
424:
425:            public void setOle2(boolean ole) {
426:                _props.setFOle2(ole);
427:
428:                byte newVal = (byte) (ole ? 1 : 0);
429:                _chpx.updateSprm(SPRM_FOBJ, newVal);
430:            }
431:
432:            public int getObjOffset() {
433:                return _props.getFcObj();
434:            }
435:
436:            public void setObjOffset(int obj) {
437:                _props.setFcObj(obj);
438:                _chpx.updateSprm(SPRM_OBJLOCATION, obj);
439:            }
440:
441:            /**
442:             * Get the ico24 field for the CHP record.
443:             */
444:            public int getIco24() {
445:                return _props.getIco24();
446:            }
447:
448:            /**
449:             * Set the ico24 field for the CHP record.
450:             */
451:            public void setIco24(int colour24) {
452:                _props.setIco24(colour24);
453:            }
454:
455:            /**
456:             * clone the CharacterProperties object associated with this
457:             * characterRun so that you can apply it to another CharacterRun
458:             */
459:            public CharacterProperties cloneProperties() {
460:                try {
461:                    return (CharacterProperties) _props.clone();
462:                } catch (java.lang.CloneNotSupportedException e) {
463:                    throw new RuntimeException(e);
464:                }
465:            }
466:
467:            /**
468:             * Used to create a deep copy of this object.
469:             *
470:             * @return A deep copy.
471:             * @throws CloneNotSupportedException never
472:             */
473:            public Object clone() throws CloneNotSupportedException {
474:                CharacterRun cp = (CharacterRun) super .clone();
475:                cp._props.setDttmRMark((DateAndTime) _props.getDttmRMark()
476:                        .clone());
477:                cp._props.setDttmRMarkDel((DateAndTime) _props
478:                        .getDttmRMarkDel().clone());
479:                cp._props.setDttmPropRMark((DateAndTime) _props
480:                        .getDttmPropRMark().clone());
481:                cp._props.setDttmDispFldRMark((DateAndTime) _props
482:                        .getDttmDispFldRMark().clone());
483:                cp._props.setXstDispFldRMark((byte[]) _props
484:                        .getXstDispFldRMark().clone());
485:                cp._props.setShd((ShadingDescriptor) _props.getShd().clone());
486:
487:                return cp;
488:            }
489:
490:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.