Exemplo n.º 1
0
        /**
         * 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;
        }
Exemplo n.º 2
0
        /**
         * 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;
        }