Exemplo n.º 1
0
        /**
         * Display the formatted escher stream
         *
         * @exception IOException
         */
        public void display()
        {
            EscherRecordData er = new EscherRecordData(stream, 0);
            EscherContainer  ec = new EscherContainer(er);

            displayContainer(ec, 0);
        }
Exemplo n.º 2
0
        /**
         * Initialization
         */
        private void initialize()
        {
            EscherRecordData er = new EscherRecordData(this, 0);

            Assert.verify(er.isContainer());

            EscherContainer dgContainer = new EscherContainer(er);

            EscherRecord[] children = dgContainer.getChildren();

            children = dgContainer.getChildren();
            // Dg dg = (Dg) children[0];

            EscherContainer spgrContainer = null;

            for (int i = 0; i < children.Length && spgrContainer == null; i++)
            {
                EscherRecord child = children[i];
                if (child.getType() == EscherRecordType.SPGR_CONTAINER)
                {
                    spgrContainer = (EscherContainer)child;
                }
            }
            Assert.verify(spgrContainer != null);

            EscherRecord[] spgrChildren = spgrContainer.getChildren();

            // See if any of the spgrChildren are SpgrContainer
            bool nestedContainers = false;

            for (int i = 0; i < spgrChildren.Length && !nestedContainers; i++)
            {
                if (spgrChildren[i].getType() == EscherRecordType.SPGR_CONTAINER)
                {
                    nestedContainers = true;
                }
            }

            // If there are no nested containers, simply set the spContainer list
            // to be the list of children
            if (!nestedContainers)
            {
                spContainers = spgrChildren;
            }
            else
            {
                // Go through the hierarchy and dig out all the Sp containers
                ArrayList sps = new ArrayList();
                getSpContainers(spgrContainer, sps);

                spContainers = new EscherRecord[sps.Count];
                int pos = 0;
                foreach (EscherRecord record in sps)
                {
                    spContainers[pos++] = record;
                }
            }

            initialized = true;
        }
 /**
  * Constructor
  *
  * @param erd the escher record data
  */
 public BlipStoreEntry(EscherRecordData erd)
     : base(erd)
 {
     type = BlipType.getType(getInstance());
     write = false;
     byte[] bytes = getBytes();
     referenceCount = IntegerHelper.getInt(bytes[24],bytes[25],bytes[26],bytes[27]);
 }
Exemplo n.º 4
0
 /**
  * Constructor
  *
  * @param erd the escher record data
  */
 public BlipStoreEntry(EscherRecordData erd)
     : base(erd)
 {
     type  = BlipType.getType(getInstance());
     write = false;
     byte[] bytes = getBytes();
     referenceCount = IntegerHelper.getInt(bytes[24], bytes[25], bytes[26], bytes[27]);
 }
Exemplo n.º 5
0
        /**
         * Initializes the drawing data from the escher record read in
         */
        private void initialize()
        {
            EscherRecordData er = new EscherRecordData(this, 0);

            Assert.verify(er.isContainer());

            escherData = new EscherContainer(er);

            Assert.verify(escherData.getLength() == drawingData.Length);
            Assert.verify(escherData.getType() == EscherRecordType.DGG_CONTAINER);

            initialized = true;
        }
Exemplo n.º 6
0
        /**
         * Constructor
         *
         * @param erd the read in data
         */
        public Dgg(EscherRecordData erd)
            : base(erd)
        {
            clusters = new ArrayList();
            byte[] bytes = getBytes();
            maxShapeId    = IntegerHelper.getInt(bytes[0], bytes[1], bytes[2], bytes[3]);
            numClusters   = IntegerHelper.getInt(bytes[4], bytes[5], bytes[6], bytes[7]);
            shapesSaved   = IntegerHelper.getInt(bytes[8], bytes[9], bytes[10], bytes[11]);
            drawingsSaved = IntegerHelper.getInt(bytes[12], bytes[13], bytes[14], bytes[15]);

            int pos = 16;

            for (int i = 0; i < numClusters; i++)
            {
                int     dgId = IntegerHelper.getInt(bytes[pos], bytes[pos + 1]);
                int     sids = IntegerHelper.getInt(bytes[pos + 2], bytes[pos + 3]);
                Cluster c    = new Cluster(dgId, sids);
                clusters.Add(c);
                pos += 4;
            }
        }
Exemplo n.º 7
0
 /**
  * Constructor
  *
  * @param erd the escher record data
  */
 public Opt(EscherRecordData erd)
     : base(erd)
 {
     numProperties = getInstance();
     readProperties();
 }
 /**
  * Constructor
  *
  * @param erd the raw data
  */
 public EscherContainer(EscherRecordData erd)
     : base(erd)
 {
     initialized = false;
     children = new ArrayList();
 }
        /**
         * Initialization
         */
        private void initialize()
        {
            int curpos = getPos() + HEADER_LENGTH;
            int endpos = System.Math.Min(getPos() + getLength(),getStreamLength());

            EscherRecord newRecord = null;

            while (curpos < endpos)
                {
                EscherRecordData erd = new EscherRecordData(getEscherStream(),curpos);

                EscherRecordType type = erd.getType();
                if (type == EscherRecordType.DGG)
                    newRecord = new Dgg(erd);
                else if (type == EscherRecordType.DG)
                    newRecord = new Dg(erd);
                else if (type == EscherRecordType.BSTORE_CONTAINER)
                    newRecord = new BStoreContainer(erd);
                else if (type == EscherRecordType.SPGR_CONTAINER)
                    newRecord = new SpgrContainer(erd);
                else if (type == EscherRecordType.SP_CONTAINER)
                    newRecord = new SpContainer(erd);
                else if (type == EscherRecordType.SPGR)
                    newRecord = new Spgr(erd);
                else if (type == EscherRecordType.SP)
                    newRecord = new Sp(erd);
                else if (type == EscherRecordType.CLIENT_ANCHOR)
                    newRecord = new ClientAnchor(erd);
                else if (type == EscherRecordType.CLIENT_DATA)
                    newRecord = new ClientData(erd);
                else if (type == EscherRecordType.BSE)
                    newRecord = new BlipStoreEntry(erd);
                else if (type == EscherRecordType.OPT)
                    newRecord = new Opt(erd);
                else if (type == EscherRecordType.SPLIT_MENU_COLORS)
                    newRecord = new SplitMenuColors(erd);
                else if (type == EscherRecordType.CLIENT_TEXT_BOX)
                    newRecord = new ClientTextBox(erd);
                else
                    newRecord = new EscherAtom(erd);

                children.Add(newRecord);
                curpos += newRecord.getLength();
                }

            initialized = true;
        }
Exemplo n.º 10
0
        /**
         * Initialization
         */
        private void initialize()
        {
            EscherRecordData er = new EscherRecordData(this,0);
            Assert.verify(er.isContainer());

            EscherContainer dgContainer = new EscherContainer(er);
            EscherRecord[] children = dgContainer.getChildren();

            children = dgContainer.getChildren();
            // Dg dg = (Dg) children[0];

            EscherContainer spgrContainer = null;

            for (int i = 0; i < children.Length && spgrContainer == null; i++)
                {
                EscherRecord child = children[i];
                if (child.getType() == EscherRecordType.SPGR_CONTAINER)
                    {
                    spgrContainer = (EscherContainer)child;
                    }
                }
            Assert.verify(spgrContainer != null);

            EscherRecord[] spgrChildren = spgrContainer.getChildren();

            // See if any of the spgrChildren are SpgrContainer
            bool nestedContainers = false;
            for (int i = 0; i < spgrChildren.Length && !nestedContainers; i++)
                {
                if (spgrChildren[i].getType() == EscherRecordType.SPGR_CONTAINER)
                    {
                    nestedContainers = true;
                    }
                }

            // If there are no nested containers, simply set the spContainer list
            // to be the list of children
            if (!nestedContainers)
                spContainers = spgrChildren;
            else
                {
                // Go through the hierarchy and dig out all the Sp containers
                ArrayList sps = new ArrayList();
                getSpContainers(spgrContainer,sps);

                spContainers = new EscherRecord[sps.Count];
                int pos = 0;
                foreach (EscherRecord record in sps)
                    spContainers[pos++] = record;
                }

            initialized = true;
        }
Exemplo n.º 11
0
 /**
  * Constructor
  *
  * @param erd the escher record data
  */
 public Opt(EscherRecordData erd)
     : base(erd)
 {
     numProperties = getInstance();
     readProperties();
 }
Exemplo n.º 12
0
 /**
  * Constructor
  *
  * @param erd the raw data
  */
 public EscherContainer(EscherRecordData erd)
     : base(erd)
 {
     initialized = false;
     children    = new ArrayList();
 }
Exemplo n.º 13
0
        /**
         * Initialization
         */
        private void initialize()
        {
            int curpos = getPos() + HEADER_LENGTH;
            int endpos = System.Math.Min(getPos() + getLength(), getStreamLength());

            EscherRecord newRecord = null;

            while (curpos < endpos)
            {
                EscherRecordData erd = new EscherRecordData(getEscherStream(), curpos);

                EscherRecordType type = erd.getType();
                if (type == EscherRecordType.DGG)
                {
                    newRecord = new Dgg(erd);
                }
                else if (type == EscherRecordType.DG)
                {
                    newRecord = new Dg(erd);
                }
                else if (type == EscherRecordType.BSTORE_CONTAINER)
                {
                    newRecord = new BStoreContainer(erd);
                }
                else if (type == EscherRecordType.SPGR_CONTAINER)
                {
                    newRecord = new SpgrContainer(erd);
                }
                else if (type == EscherRecordType.SP_CONTAINER)
                {
                    newRecord = new SpContainer(erd);
                }
                else if (type == EscherRecordType.SPGR)
                {
                    newRecord = new Spgr(erd);
                }
                else if (type == EscherRecordType.SP)
                {
                    newRecord = new Sp(erd);
                }
                else if (type == EscherRecordType.CLIENT_ANCHOR)
                {
                    newRecord = new ClientAnchor(erd);
                }
                else if (type == EscherRecordType.CLIENT_DATA)
                {
                    newRecord = new ClientData(erd);
                }
                else if (type == EscherRecordType.BSE)
                {
                    newRecord = new BlipStoreEntry(erd);
                }
                else if (type == EscherRecordType.OPT)
                {
                    newRecord = new Opt(erd);
                }
                else if (type == EscherRecordType.SPLIT_MENU_COLORS)
                {
                    newRecord = new SplitMenuColors(erd);
                }
                else if (type == EscherRecordType.CLIENT_TEXT_BOX)
                {
                    newRecord = new ClientTextBox(erd);
                }
                else
                {
                    newRecord = new EscherAtom(erd);
                }

                children.Add(newRecord);
                curpos += newRecord.getLength();
            }

            initialized = true;
        }