Ejemplo n.º 1
0
        private void putObjectData(LegacyBBeBObject obj)
        {
            // Record certain id's in LRF Header
            if (obj.m_eType == ObjectType.BookAtr)
            {
                m_FileData.putShort(LRF_ROOT_ID, obj.m_Id);
            }
            else if (obj.m_eType == ObjectType.TOC)
            {
                m_FileData.putShort(LRF_TOC_ID, obj.m_Id);
            }

            // Record position of sub file record in file
            obj.m_nFileLocation = m_FileData.Position;

            // Put in Object Type TAG
            m_FileData.putTagInt(TagId.ObjectStart, obj.m_Id);
            m_FileData.putShort((ushort)obj.m_eType);

            // Put in tags
            m_FileData.put(obj.TagData.GetBuffer(), 0, (int)obj.TagData.Length);

            // Write data block if we have one
            if (obj.StreamData != null)
            {
                m_FileData.put(obj.StreamData.GetBuffer(), 0, (int)obj.StreamData.Length);
            }

            // Write end of sub file marker
            m_FileData.putTag(TagId.ObjectEnd);

            // Record size of sub file data written
            obj.m_nSizeInFile = (int)(m_FileData.Position - obj.m_nFileLocation);
        }
Ejemplo n.º 2
0
        private void AddStreamData(ObjectFlags aDataFlags, byte[] aData, long aLength)
        {
            m_StreamData = new BBeByteBuffer();

            m_StreamData.putTagShort(TagId.StreamFlags, (ushort)aDataFlags);

            m_StreamData.putTagInt(TagId.StreamSize, (int)aLength);

            m_StreamData.putTagBytes(TagId.StreamStart, aData, (int)aLength);

            m_StreamData.putTag(TagId.StreamEnd);
        }
Ejemplo n.º 3
0
        public void AddTextPage(LegacyBBeBObject text)
        {
            // font size?? para.addTag( 0x11, 80);
            text.AddTagInt(TagId.Link, m_nFontRecordId);

            /* The text goes into a bounding box */
            BBeByteBuffer boxData = new BBeByteBuffer();

            boxData.putTagInt(TagId.Link, text.m_Id);

            LegacyBBeBObject box = new LegacyBBeBObject(this, ObjectType.Block, ObjectFlags.NONE, boxData);

            box.AddTagInt(TagId.Link, m_nPageBoxId);

            // add_tag_to_subfile(box,new_tag(0x31,sizeof(WORD),0,600));
            // add_tag_to_subfile(box,new_tag(0x32,sizeof(WORD),0,800));
            // add_tag_to_subfile(box,new_tag(0x33,sizeof(WORD),0,0x22));

            BBeByteBuffer pageFiles = new BBeByteBuffer();

            pageFiles.putShort(3);
            pageFiles.putInt(m_nFontRecordId);
            pageFiles.putInt(text.m_Id);
            pageFiles.putInt(box.m_Id);

            BBeByteBuffer pageData = new BBeByteBuffer();

            pageData.putTagInt(TagId.Link, box.m_Id);

            LegacyBBeBObject page = new LegacyBBeBObject(this, ObjectType.Page, ObjectFlags.NONE, pageData);

            page.AddTagInt(TagId.ParentPageTree, m_BookFile.m_Id);
            page.AddTag(TagId.PageObjectIds, pageFiles.GetBuffer(), (int)pageFiles.Length);
            page.AddTagInt(TagId.Link, m_nMarginsId);

            // We make the layout big so paragraphs can break over display pages
            // We don't really understand the format of the PAGE_LAYOUT object info
            // object yet.
            byte[] layoutData = new byte[24];
            ByteBuffer.PackInt(layoutData, 0, 1);
            ByteBuffer.PackInt(layoutData, 4, box.m_Id);
            LegacyBBeBObject physicalPages = new LegacyBBeBObject(this, ObjectType.ObjectInfo,
                                                                  ObjectFlags.PAGE_LAYOUT, layoutData);

            page.AddTagInt(TagId.ObjectInfoLink, physicalPages.m_Id);

            m_nNumPages++;
        }
Ejemplo n.º 4
0
 public void AddTagInt(TagId aID, int aValue)
 {
     m_TagData.putTagInt(aID, aValue);
 }