版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、 package jxl.biff.drawing;import common.Assert;import common.Logger;import java.io.IOException;import jxl.WorkbookSettings;import jxl.write.biff.File;Store management class ComboBox implements DrawingGroupObject private static Logger logger = Logger.getLogger(ComboBox.class); private EscherContainer
2、 readSpContainer; private EscherContainer spContainer; private MsoDrawingRecord msoDrawingRecord; private ObjRecord objRecord; private boolean initialized = false; private int objectId; private int blipId; private int shapeId; private int column; private int row; private double width; private double
3、 height; private int referenceCount; private EscherContainer escherData; private Origin origin; private DrawingGroup drawingGroup; private DrawingData drawingData; private ShapeType type; private int drawingNumber; private WorkbookSettings workbookSettings;Store management ComboBox(MsoDrawingRecord
4、mso, ObjRecord obj, DrawingData dd, DrawingGroup dg, WorkbookSettings ws) this.drawingGroup = dg; this.msoDrawingRecord = mso; this.drawingData = dd; this.objRecord = obj; this.initialized = false; this.workbookSettings = ws; this.origin = Origin.READ; this.drawingData.addData(this.msoDrawingRecord.
5、getData(); this.drawingNumber = (this.drawingData.getNumDrawings() - 1); this.drawingGroup.addDrawing(this); Assert.verify(mso != null) & (obj != null); initialize(); Store management ComboBox(DrawingGroupObject dgo, DrawingGroup dg, WorkbookSettings ws) ComboBox d = (ComboBox)dgo; Assert.verify(d.o
6、rigin = Origin.READ); this.msoDrawingRecord = d.msoDrawingRecord; this.objRecord = d.objRecord; this.initialized = false; this.origin = Origin.READ; this.drawingData = d.drawingData; this.drawingGroup = dg; this.drawingNumber = d.drawingNumber; this.drawingGroup.addDrawing(this); this.workbookSettin
7、gs = ws; Store management ComboBox() this.initialized = true; this.origin = Origin.WRITE; this.referenceCount = 1; this.type = ShapeType.HOST_CONTROL; private void initialize() this.readSpContainer = this.drawingData.getSpContainer(this.drawingNumber); Assert.verify(this.readSpContainer != null); Es
8、cherRecord children = this.readSpContainer.getChildren(); Sp sp = (Sp)this.readSpContainer.getChildren()0; this.objectId = this.objRecord.getObjectId(); this.shapeId = sp.getShapeId(); this.type = ShapeType.getType(sp.getShapeType(); if (this.type = ShapeType.UNKNOWN) logger.warn(Unknown shape type)
9、; ClientAnchor clientAnchor = null; for (int i = 0; (i children.length) & (clientAnchor = null); i+) if (childreni.getType() = EscherRecordType.CLIENT_ANCHOR) clientAnchor = (ClientAnchor)childreni; if (clientAnchor = null) logger.warn(Client anchor not found); else this.column = (int)clientAnchor.g
10、etX1(); this.row = (int)clientAnchor.getY1(); this.initialized = true; Store management final void setObjectId(int objid, int bip, int sid) this.objectId = objid; this.blipId = bip; this.shapeId = sid; if (this.origin = Origin.READ) this.origin = Origin.READ_WRITE; Store management final int getObje
11、ctId() if (!this.initialized) initialize(); return this.objectId; Store management final int getShapeId() if (!this.initialized) initialize(); return this.shapeId; Store management final int getBlipId() if (!this.initialized) initialize(); return this.blipId; Store management MsoDrawingRecord getMso
12、DrawingRecord() return this.msoDrawingRecord; Store management EscherContainer getSpContainer() if (!this.initialized) initialize(); if (this.origin = Origin.READ) return getReadSpContainer(); SpContainer spc = new SpContainer(); Sp sp = new Sp(this.type, this.shapeId, 2560); spc.add(sp); Opt opt =
13、new Opt(); opt.addProperty(127, false, false, 17039620); opt.addProperty(191, false, false, 524296); opt.addProperty(511, false, false, 524288); opt.addProperty(959, false, false, 131072); spc.add(opt); ClientAnchor clientAnchor = new ClientAnchor(this.column, this.row, this.column + 1, this.row + 1
14、); spc.add(clientAnchor); ClientData clientData = new ClientData(); spc.add(clientData); return spc; Store management void setDrawingGroup(DrawingGroup dg) this.drawingGroup = dg; Store management DrawingGroup getDrawingGroup() return this.drawingGroup; Store management Origin getOrigin() return thi
15、s.origin; Store management int getReferenceCount() return this.referenceCount; Store management void setReferenceCount(int r) this.referenceCount = r; Store management double getX() if (!this.initialized) initialize(); return this.column; Store management void setX(double x) if (this.origin = Origin
16、.READ) if (!this.initialized) initialize(); this.origin = Origin.READ_WRITE; this.column = (int)x); Store management double getY() if (!this.initialized) initialize(); return this.row; Store management void setY(double y) if (this.origin = Origin.READ) if (!this.initialized) initialize(); this.origi
17、n = Origin.READ_WRITE; this.row = (int)y); Store management double getWidth() if (!this.initialized) initialize(); return this.width; Store management void setWidth(double w) if (this.origin = Origin.READ) if (!this.initialized) initialize(); this.origin = Origin.READ_WRITE; this.width = w; Store ma
18、nagement double getHeight() if (!this.initialized) initialize(); return this.height; Store management void setHeight(double h) if (this.origin = Origin.READ) if (!this.initialized) initialize(); this.origin = Origin.READ_WRITE; this.height = h; private EscherContainer getReadSpContainer() if (!this.
19、initialized) initialize(); return this.readSpContainer; Store management byte getImageData() Assert.verify(this.origin = Origin.READ) | (this.origin = Origin.READ_WRITE); if (!this.initialized) initialize(); return this.drawingGroup.getImageData(this.blipId); Store management ShapeType getType() ret
20、urn this.type; Store management byte getImageBytes() Assert.verify(false); return null; Store management String getImageFilePath() Assert.verify(false); return null; Store management void writeAdditionalRecords(File outputFile) throws IOException if (this.origin = Origin.READ) outputFile.write(this.
21、objRecord); return; ObjRecord objrec = new ObjRecord(this.objectId, ObjRecord.COMBOBOX); outputFile.write(objrec); Store management void writeTailRecords(File outputFile) Store management int getRow() return 0; Store management int getColumn() return 0; Store management int hashCode() return getClas
22、s().getName().hashCode(); Store management boolean isFirst() return this.msoDrawingRecord.isFirst(); Store management boolean isFormObject() return false; package jxl.biff.drawing;import common.Assert;import common.Logger;import java.io.IOException;import jxl.WorkbookSettings;import jxl.biff.Continu
23、eRecord;import jxl.biff.IntegerHelper;import jxl.biff.StringHelper;import jxl.write.biff.File;Store management class Comment implements DrawingGroupObject private static Logger logger = Logger.getLogger(Comment.class); private EscherContainer readSpContainer; private EscherContainer spContainer; pri
24、vate MsoDrawingRecord msoDrawingRecord; private ObjRecord objRecord; private boolean initialized = false; private int objectId; private int blipId; private int shapeId; private int column; private int row; private double width; private double height; private int referenceCount; private EscherContain
25、er escherData; private Origin origin; private DrawingGroup drawingGroup; private DrawingData drawingData; private ShapeType type; private int drawingNumber; private MsoDrawingRecord mso; private TextObjectRecord txo; private NoteRecord note; private ContinueRecord text; private ContinueRecord format
26、ting; private String commentText; private WorkbookSettings workbookSettings;Store management Comment(MsoDrawingRecord msorec, ObjRecord obj, DrawingData dd, DrawingGroup dg, WorkbookSettings ws) this.drawingGroup = dg; this.msoDrawingRecord = msorec; this.drawingData = dd; this.objRecord = obj; this
27、.initialized = false; this.workbookSettings = ws; this.origin = Origin.READ; this.drawingData.addData(this.msoDrawingRecord.getData(); this.drawingNumber = (this.drawingData.getNumDrawings() - 1); this.drawingGroup.addDrawing(this); Assert.verify(this.msoDrawingRecord != null) & (this.objRecord != n
28、ull); if (!this.initialized) initialize(); Store management Comment(DrawingGroupObject dgo, DrawingGroup dg, WorkbookSettings ws) Comment d = (Comment)dgo; Assert.verify(d.origin = Origin.READ); this.msoDrawingRecord = d.msoDrawingRecord; this.objRecord = d.objRecord; this.initialized = false; this.
29、origin = Origin.READ; this.drawingData = d.drawingData; this.drawingGroup = dg; this.drawingNumber = d.drawingNumber; this.drawingGroup.addDrawing(this); this.mso = d.mso; this.txo = d.txo; this.text = d.text; this.formatting = d.formatting; this.note = d.note; this.width = d.width; this.height = d.
30、height; this.workbookSettings = ws; Store management Comment(String txt, int c, int r) this.initialized = true; this.origin = Origin.WRITE; this.column = c; this.row = r; this.referenceCount = 1; this.type = ShapeType.TEXT_BOX; mentText = txt; this.width = 3.0D; this.height = 4.0D; private void init
31、ialize() this.readSpContainer = this.drawingData.getSpContainer(this.drawingNumber); Assert.verify(this.readSpContainer != null); EscherRecord children = this.readSpContainer.getChildren(); Sp sp = (Sp)this.readSpContainer.getChildren()0; this.objectId = this.objRecord.getObjectId(); this.shapeId =
32、sp.getShapeId(); this.type = ShapeType.getType(sp.getShapeType(); if (this.type = ShapeType.UNKNOWN) logger.warn(Unknown shape type); ClientAnchor clientAnchor = null; for (int i = 0; (i children.length) & (clientAnchor = null); i+) if (childreni.getType() = EscherRecordType.CLIENT_ANCHOR) clientAnc
33、hor = (ClientAnchor)childreni; if (clientAnchor = null) logger.warn(client anchor not found); else this.column = (int)clientAnchor.getX1() - 1); this.row = (int)clientAnchor.getY1() + 1); this.width = (clientAnchor.getX2() - clientAnchor.getX1(); this.height = (clientAnchor.getY2() - clientAnchor.ge
34、tY1(); this.initialized = true; Store management final void setObjectId(int objid, int bip, int sid) this.objectId = objid; this.blipId = bip; this.shapeId = sid; if (this.origin = Origin.READ) this.origin = Origin.READ_WRITE; Store management final int getObjectId() if (!this.initialized) initializ
35、e(); return this.objectId; Store management final int getShapeId() if (!this.initialized) initialize(); return this.shapeId; Store management final int getBlipId() if (!this.initialized) initialize(); return this.blipId; Store management MsoDrawingRecord getMsoDrawingRecord() return this.msoDrawingR
36、ecord; Store management EscherContainer getSpContainer() if (!this.initialized) initialize(); if (this.origin = Origin.READ) return getReadSpContainer(); if (this.spContainer = null) this.spContainer = new SpContainer(); Sp sp = new Sp(this.type, this.shapeId, 2560); this.spContainer.add(sp); Opt op
37、t = new Opt(); opt.addProperty(344, false, false, 0); opt.addProperty(385, false, false, 134217808); opt.addProperty(387, false, false, 134217808); opt.addProperty(959, false, false, 131074); this.spContainer.add(opt); ClientAnchor clientAnchor = new ClientAnchor(this.column + 1.3D, Math.max(0.0D, t
38、his.row - 0.6D), this.column + 1.3D + this.width, this.row + this.height); this.spContainer.add(clientAnchor); ClientData clientData = new ClientData(); this.spContainer.add(clientData); ClientTextBox clientTextBox = new ClientTextBox(); this.spContainer.add(clientTextBox); return this.spContainer;
39、Store management void setDrawingGroup(DrawingGroup dg) this.drawingGroup = dg; Store management DrawingGroup getDrawingGroup() return this.drawingGroup; Store management Origin getOrigin() return this.origin; Store management int getReferenceCount() return this.referenceCount; Store management void
40、setReferenceCount(int r) this.referenceCount = r; Store management double getX() if (!this.initialized) initialize(); return this.column; Store management void setX(double x) if (this.origin = Origin.READ) if (!this.initialized) initialize(); this.origin = Origin.READ_WRITE; this.column = (int)x); S
41、tore management double getY() if (!this.initialized) initialize(); return this.row; Store management void setY(double y) if (this.origin = Origin.READ) if (!this.initialized) initialize(); this.origin = Origin.READ_WRITE; this.row = (int)y); Store management double getWidth() if (!this.initialized)
42、initialize(); return this.width; Store management void setWidth(double w) if (this.origin = Origin.READ) if (!this.initialized) initialize(); this.origin = Origin.READ_WRITE; this.width = w; Store management double getHeight() if (!this.initialized) initialize(); return this.height; Store management
43、 void setHeight(double h) if (this.origin = Origin.READ) if (!this.initialized) initialize(); this.origin = Origin.READ_WRITE; this.height = h; private EscherContainer getReadSpContainer() if (!this.initialized) initialize(); return this.readSpContainer; Store management byte getImageData() Assert.v
44、erify(this.origin = Origin.READ) | (this.origin = Origin.READ_WRITE); if (!this.initialized) initialize(); return this.drawingGroup.getImageData(this.blipId); Store management ShapeType getType() return this.type; Store management void setTextObject(TextObjectRecord t) this.txo = t; Store management
45、 void setNote(NoteRecord t) this.note = t; Store management void setText(ContinueRecord t) this.text = t; Store management void setFormatting(ContinueRecord t) this.formatting = t; Store management byte getImageBytes() Assert.verify(false); return null; Store management String getImageFilePath() Ass
46、ert.verify(false); return null; Store management void addMso(MsoDrawingRecord d) this.mso = d; this.drawingData.addRawData(this.mso.getData(); Store management void writeAdditionalRecords(File outputFile) throws IOException if (this.origin = Origin.READ) outputFile.write(this.objRecord); if (this.ms
47、o != null) outputFile.write(this.mso); outputFile.write(this.txo); outputFile.write(this.text); if (this.formatting != null) outputFile.write(this.formatting); return; ObjRecord objrec = new ObjRecord(this.objectId, ObjRecord.EXCELNOTE); outputFile.write(objrec); ClientTextBox textBox = new ClientTe
48、xtBox(); MsoDrawingRecord msod = new MsoDrawingRecord(textBox.getData(); outputFile.write(msod); TextObjectRecord txorec = new TextObjectRecord(getText(); outputFile.write(txorec); byte textData = new bytementText.length() * 2 + 1; textData0 = 1; StringHelper.getUnicodeBytes(mentText, textData, 1);
49、ContinueRecord textContinue = new ContinueRecord(textData); outputFile.write(textContinue); byte frData = new byte16; IntegerHelper.getTwoBytes(0, frData, 0); IntegerHelper.getTwoBytes(0, frData, 2); IntegerHelper.getTwoBytes(mentText.length(), frData, 8); IntegerHelper.getTwoBytes(0, frData, 10); C
50、ontinueRecord frContinue = new ContinueRecord(frData); outputFile.write(frContinue); Store management void writeTailRecords(File outputFile) throws IOException if (this.origin = Origin.READ) outputFile.write(this.note); return; NoteRecord noteRecord = new NoteRecord(this.column, this.row, this.objec
51、tId); outputFile.write(noteRecord); Store management int getRow() return this.note.getRow(); Store management int getColumn() return this.note.getColumn(); Store management String getText() if (mentText = null) Assert.verify(this.text != null); byte td = this.text.getData(); if (td0 = 0) mentText =
52、StringHelper.getString(td, td.length - 1, 1, this.workbookSettings); else mentText = StringHelper.getUnicodeString(td, (td.length - 1) / 2, 1); return mentText; Store management int hashCode() return mentText.hashCode(); Store management void setCommentText(String t) mentText = t; if (this.origin =
53、Origin.READ) this.origin = Origin.READ_WRITE; Store management boolean isFirst() return this.msoDrawingRecord.isFirst(); Store management boolean isFormObject() return true; package jxl.biff.drawing;import common.Logger;import java.util.ArrayList;import jxl.biff.IntegerHelper;class Dgg extends Esche
54、rAtom private static Logger logger = Logger.getLogger(Dgg.class); private byte data; private int numClusters; private int maxShapeId; private int shapesSaved; private int drawingsSaved; private ArrayList clusters;Store management Dgg(EscherRecordData erd) super(erd); this.clusters = new ArrayList();
55、 byte bytes = getBytes(); this.maxShapeId = IntegerHelper.getInt(bytes0, bytes1, bytes2, bytes3); this.numClusters = IntegerHelper.getInt(bytes4, bytes5, bytes6, bytes7); this.shapesSaved = IntegerHelper.getInt(bytes8, bytes9, bytes10, bytes11); this.drawingsSaved = IntegerHelper.getInt(bytes12, byt
56、es13, bytes14, bytes15); int pos = 16; for (int i = 0; i this.numClusters; i+) int dgId = IntegerHelper.getInt(bytespos, bytes(pos + 1); int sids = IntegerHelper.getInt(bytes(pos + 2), bytes(pos + 3); Cluster c = new Cluster(dgId, sids); this.clusters.add(c); pos += 4; Store management Dgg(int numSh
57、apes, int numDrawings) super(EscherRecordType.DGG); this.shapesSaved = numShapes; this.drawingsSaved = numDrawings; this.clusters = new ArrayList(); void addCluster(int dgid, int sids) Cluster c = new Cluster(dgid, sids); this.clusters.add(c); byte getData() this.numClusters = this.clusters.size();
58、this.data = new byte16 + this.numClusters * 4; IntegerHelper.getFourBytes(1024 + this.shapesSaved, this.data, 0); IntegerHelper.getFourBytes(this.numClusters, this.data, 4); IntegerHelper.getFourBytes(this.shapesSaved, this.data, 8); IntegerHelper.getFourBytes(1, this.data, 12); int pos = 16; for (i
59、nt i = 0; i this.numClusters; i+) Cluster c = (Cluster)this.clusters.get(i); IntegerHelper.getTwoBytes(c.drawingGroupId, this.data, pos); IntegerHelper.getTwoBytes(c.shapeIdsUsed, this.data, pos + 2); pos += 4; return setHeaderData(this.data); int getShapesSaved() return this.shapesSaved; int getDra
60、wingsSaved() return this.drawingsSaved; Cluster getCluster(int i) return (Cluster)this.clusters.get(i); static final class Cluster int drawingGroupId; int shapeIdsUsed; Cluster(int dgId, int sids) this.drawingGroupId = dgId; this.shapeIdsUsed = sids; package jxl.biff.drawing;import common.Assert;imp
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 保洁保安工作技能培训合作协议书
- 生物标志物指导下的临床试验入组优化
- 生物标志物在药物临床试验中的临床试验研究意义
- 生物打印角膜内皮的细胞存活率优化方案
- 深度解析(2026)《GBT 20319-2017风力发电机组 验收规范》
- 阿里巴集团财务分析师面试题
- 网络工程师招聘面试经典题目与技术要求详解
- 深度解析(2026)《GBT 19559-2021煤层气含量测定方法》
- 生活方式干预对糖尿病心血管保护的作用
- 房地产企业财务分析师招聘面试问题集
- TCECS10270-2023混凝土抑温抗裂防水剂
- 【语 文】第19课《大雁归来》课件 2025-2026学年统编版语文七年级上册
- 2025辽宁葫芦岛市总工会招聘工会社会工作者5人笔试考试参考题库及答案解析
- 印刷消防应急预案(3篇)
- 餐饮签协议合同范本
- 空调维修施工方案
- 2025河南洛阳市瀍河区区属国有企业招聘14人笔试考试备考题库及答案解析
- 医德医风行风培训
- 2025-2026学年小学美术人教版 四年级上册期末练习卷及答案
- 辽宁省名校联盟2025-2026学年高三上学期12月考试物理试卷
- 2025广东肇庆市鼎湖区人民武装部招聘民兵专职教练员8人备考题库带答案解析
评论
0/150
提交评论