/** * Initializes the member variables from the Escher stream data */ private void initialize() { readSpContainer = drawingData.getSpContainer(drawingNumber); Assert.verify(readSpContainer != null); EscherRecord[] children = readSpContainer.getChildren(); Sp sp = (Sp)readSpContainer.getChildren()[0]; objectId = objRecord.getObjectId(); shapeId = sp.getShapeId(); type = ShapeType.getType(sp.getShapeType()); if (type == ShapeType.UNKNOWN) { //logger.warn("Unknown shape type"); } ClientAnchor clientAnchor = null; for (int i = 0; i < children.Length && clientAnchor == null; i++) { if (children[i].getType() == EscherRecordType.CLIENT_ANCHOR) { clientAnchor = (ClientAnchor)children[i]; } } if (clientAnchor == null) { //logger.warn("client anchor not found"); } else { column = (int)clientAnchor.getX1() - 1; row = (int)clientAnchor.getY1() + 1; width = clientAnchor.getX2() - clientAnchor.getX1(); height = clientAnchor.getY2() - clientAnchor.getY1(); } initialized = true; }
/** * Initializes the member variables from the Escher stream data */ private void initialize() { readSpContainer = drawingData.getSpContainer(drawingNumber); Assert.verify(readSpContainer != null); EscherRecord[] children = readSpContainer.getChildren(); Sp sp = (Sp)readSpContainer.getChildren()[0]; shapeId = sp.getShapeId(); objectId = objRecord.getObjectId(); type = ShapeType.getType(sp.getShapeType()); if (type == ShapeType.UNKNOWN) { //logger.warn("Unknown shape type"); } Opt opt = (Opt)readSpContainer.getChildren()[1]; if (opt.getProperty(260) != null) { blipId = opt.getProperty(260).value; } if (opt.getProperty(261) != null) { imageFile = new System.IO.FileInfo(opt.getProperty(261).StringValue); } else { if (type == ShapeType.PICTURE_FRAME) { //logger.warn("no filename property for drawing"); imageFile = new System.IO.FileInfo(blipId.ToString().Trim()); } } ClientAnchor clientAnchor = null; for (int i = 0; i < children.Length && clientAnchor == null; i++) { if (children[i].getType() == EscherRecordType.CLIENT_ANCHOR) { clientAnchor = (ClientAnchor)children[i]; } } if (clientAnchor == null) { //logger.warn("client anchor not found"); } else { x = clientAnchor.getX1(); y = clientAnchor.getY1(); width = clientAnchor.getX2() - x; height = clientAnchor.getY2() - y; imageAnchorProperties = ImageAnchorProperties.getImageAnchorProperties(clientAnchor.getProperties()); } if (blipId == 0) { //logger.warn("linked drawings are not supported"); } initialized = true; }
/** * Displays an escher record * * @param er the record to display * @param level the amount of indentation * @exception IOException */ private void displayRecord(EscherRecord er, int level) { indent(level); EscherRecordType type = er.getType(); // Display the code writer.Write(System.String.Format("{0:X}", type.getValue())); writer.Write(" - "); // Display the name if (type == EscherRecordType.DGG_CONTAINER) { writer.WriteLine("Dgg Container"); } else if (type == EscherRecordType.BSTORE_CONTAINER) { writer.WriteLine("BStore Container"); } else if (type == EscherRecordType.DG_CONTAINER) { writer.WriteLine("Dg Container"); } else if (type == EscherRecordType.SPGR_CONTAINER) { writer.WriteLine("Spgr Container"); } else if (type == EscherRecordType.SP_CONTAINER) { writer.WriteLine("Sp Container"); } else if (type == EscherRecordType.DGG) { writer.WriteLine("Dgg"); } else if (type == EscherRecordType.BSE) { writer.WriteLine("Bse"); } else if (type == EscherRecordType.DG) { Dg dg = new Dg(er.getEscherData()); writer.WriteLine("Dg: drawing id " + dg.getDrawingId() + " shape count " + dg.getShapeCount()); } else if (type == EscherRecordType.SPGR) { writer.WriteLine("Spgr"); } else if (type == EscherRecordType.SP) { Sp sp = new Sp(er.getEscherData()); writer.WriteLine("Sp: shape id " + sp.getShapeId() + " shape type " + sp.getShapeType()); } else if (type == EscherRecordType.OPT) { Opt opt = new Opt(er.getEscherData()); Opt.Property p260 = opt.getProperty(260); Opt.Property p261 = opt.getProperty(261); writer.Write("Opt (value, StringValue): "); if (p260 != null) { writer.Write("260: " + p260.value + ", " + p260.StringValue + ";"); } if (p261 != null) { writer.Write("261: " + p261.value + ", " + p261.StringValue + ";"); } writer.WriteLine(string.Empty); } else if (type == EscherRecordType.CLIENT_ANCHOR) { writer.WriteLine("Client Anchor"); } else if (type == EscherRecordType.CLIENT_DATA) { writer.WriteLine("Client Data"); } else if (type == EscherRecordType.CLIENT_TEXT_BOX) { writer.WriteLine("Client Text Box"); } else if (type == EscherRecordType.SPLIT_MENU_COLORS) { writer.WriteLine("Split Menu Colors"); } else { writer.WriteLine("???"); } }