예제 #1
0
void
wvGetEscher(escherstruct *item, U32 offset, U32 len, wvStream *fd,
            wvStream *delay) {
    U32    count = 0;
    MSOFBH amsofbh;

    wvStream_goto(fd, offset);
    wvTrace(("offset %x, len %d\n", offset, len));
    wvInitEscher(item);
    while (count < len) {
        count += wvGetMSOFBH(&amsofbh, fd);
        wvTrace(
            ("count is %x,len is %x, next len is %x\n", count, len,
             amsofbh.cbLength));
        wvTrace(("type is %x\n	", amsofbh.fbt));
        switch (amsofbh.fbt) {
            case msofbtDggContainer:
                count +=
                    wvGetDggContainer(&item->dggcontainer, &amsofbh, fd,
                                      delay);
                break;

            case msofbtDgContainer:
                count += wvGetDgContainer(&item->dgcontainer, &amsofbh, fd);
                break;

            default:
                wvError(("Not a container, panic (%x)\n", amsofbh.fbt));
                return;
                break;
        }
    }
    wvTrace(("offset %x, len %d (pos %x)\n", offset, len, wvStream_tell(fd)));
}
예제 #2
0
파일: fib.c 프로젝트: AbiWord/wv
wvStream *
wvWhichTableStream (FIB * fib, wvParseStruct * ps)
{
    wvStream *ret;

    if ((wvQuerySupported (fib, NULL) & 0x7fff) == WORD8)
      {
	  if (fib->fWhichTblStm)
	    {
		wvTrace (("1Table\n"));
		ret = ps->tablefd1;
		if (ret == NULL)
		  {
		      wvError (
			       ("!!, the FIB lied to us, (told us to use the 1Table) making a heroic effort to use the other table stream, hold on tight\n"));
		      ret = ps->tablefd0;
		  }
	    }
	  else
	    {
		wvTrace (("0Table\n"));
		ret = ps->tablefd0;
		if (ret == NULL)
		  {
		      wvError (
			       ("!!, the FIB lied to us, (told us to use the 0Table) making a heroic effort to use the other table stream, hold on tight\n"));
		      ret = ps->tablefd1;
		  }
	    }
      }
    else			/* word 7- */
	ret = ps->mainfd;
    return (ret);
}
예제 #3
0
파일: fkp.c 프로젝트: AbiWord/wv
int
wvGetIndexFCInFKP_PAPX (PAPX_FKP * fkp, U32 currentfc)
{
    U32 i = 1;			/*was 0, there is something slightly out of sync in the system */
    U8 until = fkp->crun + 1;

    while (i < until)
      {
	  wvTrace (
		   ("current fc is %x, %x, %x\n", currentfc,
		    wvNormFC (fkp->rgfc[i], NULL), fkp->rgfc[i]));
	  if (wvNormFC (fkp->rgfc[i], NULL) == currentfc)
	      return (i);
	  i++;
      }
    /*
       basically read 
       Algorithm to determine paragraph properties for a paragraph &
       Formatted Disk Page for PAPXs, somehow the currentfc sent in was wrong
       or my understanding is !
     */
    wvTrace (("S***e, fix me %x %x\n", currentfc, fkp->rgfc[0]));
    /*return 1 to make things continue on their merry way */
    return (1);
}
예제 #4
0
파일: blip.c 프로젝트: AbiWord/wv
fbse_list *
wvGetSPID (U32 spid, fsp_list * afsp_list, fbse_list * afbse_list)
{
    fopte_list *temp;
    U32 i;

    while (afsp_list != NULL)
      {
	  if (afsp_list->afsp.spid == spid)
	    {
		wvTrace (("found the correct spid\n"));
		temp = afsp_list->afopte_list;
		while (temp != NULL)
		  {
		      if ((temp->afopte.fBid) && (!(temp->afopte.fComplex)))
			{
			    wvTrace (
				     ("found a graphic to go with the spid, no %d\n",
				      temp->afopte.op));
			    for (i = 1; i < temp->afopte.op; i++)
				afbse_list = afbse_list->next;
			    return (afbse_list);
			    break;
			}
		      temp = temp->next;
		  }
		break;
	    }
	  afsp_list = afsp_list->next;
      }

    return (NULL);
}
예제 #5
0
파일: blip.c 프로젝트: AbiWord/wv
U32
twvGetFOPTE (FOPTE * afopte, wvStream * infd)
{
    U32 ret = 0;
    U16 dtemp;
    dtemp = read_16ubit (infd);
#ifdef PURIFY
    afopte->pid = 0;
    afopte->fBid = 0;
    afopte->fComplex = 0;
#endif
    afopte->pid = (dtemp & 0x3fff);
    afopte->fBid = ((dtemp & 0x4000) >> 14);
    afopte->fComplex = ((dtemp & 0x8000) >> 15);
    afopte->op = read_32ubit (infd);

    if (afopte->fComplex)
      {
	  wvTrace (("1 complex len is %d (%x)\n", afopte->op, afopte->op));
	  ret = afopte->op;
      }
#if 0
    else if (afopte->fBid)
	wvTrace (
		 ("great including graphic number %d %d\n", afopte->op,
		  afopte->op));
#endif
    wvTrace (
	     ("orig %x,pid is %x, val is %x\n", dtemp, afopte->pid,
	      afopte->op));
    return (ret);
}
예제 #6
0
U32
wvGetBstoreContainer(BstoreContainer *item, MSOFBH *msofbh, wvStream *fd,
                     wvStream *delay) {
    MSOFBH amsofbh;
    U32    count = 0;

    while (count < msofbh->cbLength) {
        count += wvGetMSOFBH(&amsofbh, fd);
        wvTrace(("type is %x\n	", amsofbh.fbt));
        switch (amsofbh.fbt) {
            case msofbtBSE:
                wvTrace(("Blip at %x\n", wvStream_tell(fd)));
                item->no_fbse++;
                item->blip =
                    (Blip *)realloc(item->blip,
                                    sizeof(Blip) * item->no_fbse);
                count +=
                    wvGetBlip((&item->blip[item->no_fbse - 1]), fd, delay);
                wvTrace(
                    ("type is %d (number is %d\n",
                     item->blip[item->no_fbse - 1].type, item->no_fbse));
                break;

            default:
                count += wvEatmsofbt(&amsofbh, fd);
                wvError(("Eating type 0x%x\n", amsofbh.fbt));
                break;
        }
    }
    return count;
}
예제 #7
0
void
wvGetFFN_STTBF(FFN_STTBF *item, U32 offset, U32 len, wvStream *fd) {
    int i;

    wvTrace(("reading fonts...\n"));
    wvTrace(("seeking to %x, len %d\n", offset, len));
    if (len == 0) {
        item->nostrings = 0;
        item->ffn       = NULL;
    } else {
        wvStream_goto(fd, offset);
        item->extendedflag = read_16ubit(fd);
        if (item->extendedflag == 0xFFFF)
            item->nostrings = read_16ubit(fd);
        else
            item->nostrings = item->extendedflag;
        item->extradatalen = read_16ubit(fd);
        item->ffn          = (FFN *)wvMalloc(item->nostrings * sizeof(FFN));
        for (i = 0; i < item->nostrings; i++) {
#ifdef DEBUG
            char *dbg;
#endif
            wvGetFFN(&(item->ffn[i]), fd);
#ifdef DEBUG
            dbg = wvWideStrToMB(item->ffn[i].xszFfn);
            wvTrace(("font %d: %s\n", i, dbg));
            if (dbg)
                wvFree(dbg);
#endif
        }
    }

    wvTrace(("done reading fonts.\n"));
}
예제 #8
0
int
wv0x01(Blip *blip, wvStream *fd, U32 len) {
    MSOFBH       amsofbh;
    FSPContainer item;
    U32          count = 0;
/*    char test[3];*/
    int ret = 0;


    if (fd == NULL)
        return 0;

    /*[email protected] fix hack as outdated look picf*/

    /*
       temp hack to test older included bmps in word 6 and 7,
       should be wrapped in a modern escher strucure before getting
       to here, and then handled as normal
     */

    /*test[2] = '\0';
       test[0] = read_8ubit (fd);
       test[1] = read_8ubit (fd);
       wvStream_rewind (fd);
       if (!(strcmp (test, "BM")))
       {
          blip->blip.bitmap.m_pvBits = fd;
          blip->type = msoblipDIB;
          return (1);
       }
     */
    while (count < len) {
        wvTrace(("count is %x,len is %x\n", count, len));
        count += wvGetMSOFBH(&amsofbh, fd);
        wvTrace(("type is %x\n	", amsofbh.fbt));
        switch (amsofbh.fbt) {
            case msofbtSpContainer:
                wvTrace(("Container at %x\n", wvStream_tell(fd)));
                count += wvGetFSPContainer(&item, &amsofbh, fd);
                wvReleaseFSPContainer(&item);
                break;

            case msofbtBSE:
                wvTrace(("Blip at %x\n", wvStream_tell(fd)));
                count += wvGetBlip(blip, fd, NULL);
                ret    = 1;
                break;

            default:
                wvError(("Not a shape container\n"));
                return 0;
                break;
        }
    }
    return ret;
}
예제 #9
0
파일: generic.c 프로젝트: AbiWord/wv
void
wvAppendStr (char **orig, const char *add)
{
    int pos;
    wvTrace (("got this far\n"));
    pos = wvStrlen (*orig);
    wvTrace (("len is %d %d\n", pos, wvStrlen (add)));
    (*orig) = (char *) realloc (*orig, pos + wvStrlen (add) + 1);
    (*orig)[pos] = '\0';
    wvTrace (("3 test str of %s\n", *orig));
    wvStrcat (*orig, add);
    wvTrace (("3 test str of %s\n", *orig));
}
예제 #10
0
U32
wvGetDgContainer(DgContainer *item, MSOFBH *msofbh, wvStream *fd) {
    MSOFBH amsofbh;
    U32    count = 0;

    item->spcontainer    = NULL;
    item->no_spcontainer = 0;

    while (count < msofbh->cbLength) {
        count += wvGetMSOFBH(&amsofbh, fd);
        wvTrace(
            ("len is %x, type is %x, count %x,fullen %x\n",
             amsofbh.cbLength, amsofbh.fbt, count, msofbh->cbLength));
        wvTrace(("type is %x\n	", amsofbh.fbt));
        switch (amsofbh.fbt) {
            case msofbtDg:
                count += wvGetFDG(&item->fdg, fd);
                break;

            case msofbtSpgrContainer:
                item->no_spgrcontainer++;
                item->spgrcontainer =
                    (SpgrContainer *)realloc(item->spgrcontainer,
                                             sizeof(SpgrContainer) *
                                             item->no_spgrcontainer);
                count +=
                    wvGetSpgrContainer(&
                                       (item->spgrcontainer
                                        [item->no_spgrcontainer - 1]), &amsofbh, fd);
                break;

            case msofbtSpContainer:
                item->no_spcontainer++;
                item->spcontainer =
                    (FSPContainer *)realloc(item->spcontainer,
                                            sizeof(FSPContainer) *
                                            item->no_spcontainer);
                count +=
                    wvGetFSPContainer(&
                                      (item->spcontainer
                                       [item->no_spcontainer - 1]), &amsofbh, fd);
                break;

            default:
                count += wvEatmsofbt(&amsofbh, fd);
                wvError(("Eating type 0x%x\n", amsofbh.fbt));
                break;
        }
    }
    return count;
}
예제 #11
0
파일: table.c 프로젝트: AbiWord/wv
void
wvGetFullTableInit (wvParseStruct * ps, U32 para_intervals, BTE * btePapx,
		    U32 * posPapx)
{
    PAPX_FKP para_fkp;
	U32 para_fcFirst, para_fcLim = 0xffffffffL;
    PAP apap;
    U32 i, j = 0;
    TAP *test = NULL;
    wvVersion ver = wvQuerySupported (&ps->fib, NULL);
    if (ps->intable)
	return;

    wvInitPAPX_FKP (&para_fkp);

    i = wvStream_tell (ps->mainfd);
    wvTrace (("TOP\n"));
    do
      {
	  wvReleasePAPX_FKP (&para_fkp);
	  wvGetSimpleParaBounds (ver, &para_fkp,
				 &para_fcFirst, &para_fcLim, i, btePapx,
				 posPapx, para_intervals, ps->mainfd);
	  wvAssembleSimplePAP (ver, &apap, para_fcLim, &para_fkp, ps);
	  wvTrace (("para from %x to %x\n", para_fcFirst, para_fcLim));
	  i = para_fcLim;

	  /* ignore the row end markers */
	  /*if (apap.ptap.itcMac)*/
	  /* we ascertain the number of rows by counting the end of row
		 markers. NB: a row marker can have a 0 itcMac*/
	  if (apap.fTtp)
	    {
		test = (TAP *) realloc (test, sizeof (TAP) * (j + 1));
		wvCopyTAP (&(test[j]), &apap.ptap);
		wvTrace (("Row %d\n", j));
		j++;
	    }

      }
    while (apap.fInTable);
    wvTrace (("BOTTOM\n"));

    wvReleasePAPX_FKP (&para_fkp);

    wvSetTableInfo (ps, test, j);
    ps->intable = 1;
    ps->norows = j;
    wvFree (test);
}
예제 #12
0
파일: ffn.c 프로젝트: clone/wv
void
wvGetFFN_STTBF6 (FFN_STTBF * item, U32 offset, U32 len, wvStream * fd)
{
    U32 count = 0;
    int noffn = 0;
    wvTrace (("reading fonts 6...\n"));
    wvTrace (("seeking to %x, len %d\n", offset, len));
    if (len == 0)
    {
        item->nostrings = 0;
        item->ffn = NULL;
        return;
    }
    wvStream_goto (fd, offset);
    item->extendedflag = 0;
    item->nostrings = 5;	/* lets just set a val to start off with */
    item->extradatalen = 0;
    item->ffn = (FFN *) wvMalloc (item->nostrings * sizeof (FFN));
    if (len != read_16ubit (fd))
        wvError (("FFN STTBF lens differ\n"));
    count += 2;

    while (count < len)
    {
#ifdef DEBUG
        char *dbg;
#endif
        if (noffn == item->nostrings)
        {
            /* need to extend the array just in case */
            item->nostrings += 5;
            item->ffn =
                (FFN *) realloc (item->ffn, item->nostrings * sizeof (FFN));
        }
        wvGetFFN6 (&(item->ffn[noffn]), fd);
        count += (item->ffn[noffn].cbFfnM1 + 1);
#ifdef DEBUG
        dbg = wvWideStrToMB (item->ffn[noffn].xszFfn);
        wvTrace (("font %d: %s\n", noffn, dbg));
        if (dbg)
            wvFree (dbg);
#endif
        noffn++;
    }

    if (item->nostrings != noffn)
        item->nostrings = noffn;

    wvTrace (("done reading fonts 6.\n"));
}
예제 #13
0
U32
wvGetDggContainer(DggContainer *item, MSOFBH *msofbh, wvStream *fd,
                  wvStream *delay) {
    MSOFBH amsofbh;
    U32    count = 0;

    while (count < msofbh->cbLength) {
        count += wvGetMSOFBH(&amsofbh, fd);
        wvTrace(
            ("len is %x, type is %x, count %x,fullen %x\n",
             amsofbh.cbLength, amsofbh.fbt, count, msofbh->cbLength));
        wvTrace(("type is %x\n	", amsofbh.fbt));
        switch (amsofbh.fbt) {
            case msofbtDgg:
                count += wvGetDgg(&item->dgg, &amsofbh, fd);
                break;

            case msofbtSplitMenuColors:
                count +=
                    wvGetSplitMenuColors(&item->splitmenucolors, &amsofbh, fd);
                break;

            case msofbtBstoreContainer:
                count +=
                    wvGetBstoreContainer(&item->bstorecontainer, &amsofbh,
                                         fd, delay);
                wvTrace(
                    ("type is %d (number is %d\n",
                     item->bstorecontainer.blip[item->bstorecontainer.
                                                   no_fbse - 1].type,
                     item->bstorecontainer.no_fbse));
                break;

            default:
                count += wvEatmsofbt(&amsofbh, fd);
                wvError(("Eating type 0x%x\n", amsofbh.fbt));
                break;
        }
    }

    /*
       For some reason I appear to have an extra byte associated either with
       this or its wrapper, I will investigate further.
     */
    read_8ubit(fd);
    count++;

    return count;
}
예제 #14
0
파일: bte.c 프로젝트: AbiWord/wv
int
wvGetBTE_PLCF6 (BTE ** bte, U32 ** pos, U32 * nobte, U32 offset, U32 len,
		wvStream * fd)
{
    U32 i;
    if (len == 0)
      {
	  *bte = NULL;
	  *pos = NULL;
	  *nobte = 0;
      }
    else
      {
	  wvTrace (("offset is %x, len is %d\n", offset, len));
	  *nobte = (len - 4) / (cb6BTE + 4);
	  wvTrace (("no of bte is %d at %x\n", *nobte, offset));
	  *pos = (U32 *) wvMalloc ((*nobte + 1) * sizeof (U32));
	  if (*pos == NULL)
	    {
		wvError (
			 ("NO MEM 1, failed to alloc %d bytes\n",
			  (*nobte + 1) * sizeof (U32)));
		return (1);
	    }

	  *bte = (BTE *) wvMalloc (*nobte * sizeof (BTE));
	  if (*bte == NULL)
	    {
		wvError (
			 ("NO MEM 1, failed to alloc %d bytes\n",
			  *nobte * sizeof (BTE)));
		wvFree (pos);
		return (1);
	    }
	  wvStream_goto (fd, offset);
	  for (i = 0; i <= *nobte; i++)
	    {
		(*pos)[i] = read_32ubit (fd);
		wvTrace (("pos is %x\n", (*pos)[i]));
	    }
	  for (i = 0; i < *nobte; i++)
	    {
		wvInitBTE (&((*bte)[i]));
		(*bte)[i].pn = read_16ubit (fd);
	    }
      }
    return (0);
}
예제 #15
0
U32
wvGetFSP(FSP *fsp, wvStream *fd) {
    fsp->spid = read_32ubit(fd);
    wvTrace(("SPID is %x\n", fsp->spid));
    fsp->grfPersistent = read_32ubit(fd);
    return 8;
}
예제 #16
0
파일: fkp.c 프로젝트: AbiWord/wv
void
internal_wvReleaseCHPX_FKP (CHPX_FKP * fkp)
{
    int i;
    wvTrace (("chpx fkp b freeed\n"));
    wvFree (fkp->rgfc);
    fkp->rgfc = NULL;
    wvFree (fkp->rgb);
    fkp->rgb = NULL;
    for (i = 0; i < fkp->crun; i++)
	wvReleaseCHPX (&(fkp->grpchpx[i]));
    fkp->crun = 0;
    wvFree (fkp->grpchpx);
    fkp->grpchpx = NULL;
    wvTrace (("chpx fkp e freeed\n"));
}
예제 #17
0
파일: support.c 프로젝트: AbiWord/wv
int
write_8ubit (wvStream * in, U8 out)
{
    guint8 cpy = (guint8) TO_LE_8 (out);
    int nwr = 0;
    wvTrace (("About to write 16-bit value"));

    if (in->kind == GSF_STREAM)
      {
#if 0
	  nwr =
	      (int) in->stream.gsf_stream->write (in->stream.gsf_stream,
						     (guint8 *) & cpy, 8);
#endif
      }
    else if (in->kind == FILE_STREAM)
      {
	  nwr = (int) fwrite (&cpy, sizeof (guint8), 1, in->stream.file_stream);
      }
    else{
      nwr = 1;
	    *((U8 *)(in->stream.memory_stream->mem + 
		           in->stream.memory_stream->current)) = cpy;
	    in->stream.memory_stream->current++;
	  }
    return nwr;
}
예제 #18
0
U32
wvGetFIDCL(FIDCL *afidcl, wvStream *fd) {
    afidcl->dgid     = read_32ubit(fd);
    afidcl->cspidCur = read_32ubit(fd);
    wvTrace(("dgid %d cspidCur %d\n", afidcl->dgid, afidcl->cspidCur));
    return 8;
}
예제 #19
0
void
wvApplyCHPXFromBucket(CHP *achp, CHPX *chpx, STSH *stsh) {
    U8  *pointer;
    U16 i = 0;
    U16 sprm;

#ifdef SPRMTEST
    GET_fprintf_HANDLER() (stderr, "\n");
    while (i < chpx->cbGrpprl) {
        GET_fprintf_HANDLER() (stderr, "%x (%d) ", *(chpx->grpprl + i),
                               *(chpx->grpprl + i));
        i++;
    }
    GET_fprintf_HANDLER() (stderr, "\n");
    i = 0;
#endif
    while (i < chpx->cbGrpprl) {
        sprm = bread_16ubit(chpx->grpprl + i, &i);
        wvTrace(("the sprm is %d\n", sprm));
        pointer = chpx->grpprl + i;
        wvApplySprmFromBucket(WORD8, sprm, NULL, achp, NULL, stsh, pointer,
                              &i, NULL);
    }
    achp->istd = chpx->istd;
}
예제 #20
0
파일: fkp.c 프로젝트: AbiWord/wv
U32
wvSearchNextLargestFCCHPX_FKP (CHPX_FKP * fkp, U32 currentfc)
{
    U32 i = 0;
    U8 until = fkp->crun + 1;
    U32 fcTest = 0;


    while (i < until)
      {
	  wvTrace (("searching fkp %x %x\n", currentfc, fkp->rgfc[i]));
	  if ((wvNormFC (fkp->rgfc[i], NULL) <= currentfc)
	      && (wvNormFC (fkp->rgfc[i], NULL) > fcTest))
	      fcTest = wvNormFC (fkp->rgfc[i], NULL);
	  i++;
      }

    /*for the first paragraph return the current pos as the beginning */
    /*
       if (fcTest == 0)
       fcTest = currentfc+1;
     */

    return (fcTest);
}
예제 #21
0
void
wvAddCHPXFromBucket6(CHP *achp, UPXF *upxf, STSH *stsh) {
    U8  *pointer;
    U16 i = 0;
    U8  sprm8;
    U16 sprm;

    wvTrace(("cbUPX word 6 is %d\n", upxf->cbUPX));

#ifdef SPRMTEST
    GET_fprintf_HANDLER() (stderr, "\n");
    while (i < upxf->cbUPX) {
        GET_fprintf_HANDLER() (stderr, "%x (%d) ", *(upxf->upx.chpx.grpprl + i),
                               *(upxf->upx.chpx.grpprl + i));
        i++;
    }
    GET_fprintf_HANDLER() (stderr, "\n");
    i = 0;
#endif
    while (i < upxf->cbUPX) {
        sprm8 = bread_8ubit(upxf->upx.chpx.grpprl + i, &i);
#ifdef SPRMTEST
        wvError(("chp word 6 sprm is %x (%d)\n", sprm8, sprm8));
#endif
        sprm = (U16)wvGetrgsprmWord6(sprm8);
#ifdef SPRMTEST
        wvError(("chp word 6 sprm is converted to %x\n", sprm));
#endif

        pointer = upxf->upx.chpx.grpprl + i;
        wvApplySprmFromBucket(WORD6, sprm, NULL, achp, NULL, stsh, pointer,
                              &i, NULL);
    }
}
예제 #22
0
파일: fbse.c 프로젝트: Distrotech/wv
U32
wvGetBlip (Blip * blip, wvStream * fd, wvStream * delay)
{
    U32 i, count, count2;
    MSOFBH amsofbh;
    long pos = 0;
    count = wvGetFBSE (&blip->fbse, fd);
    wvTrace (("count is %d\n", count));
    if (blip->fbse.cbName == 0)
	blip->name = NULL;
    else
	blip->name = (U16 *) wvMalloc (sizeof (U16) * blip->fbse.cbName);
    for (i = 0; i < blip->fbse.cbName; i++)
	blip->name[i] = read_16ubit (fd);
    count += blip->fbse.cbName * 2;
    wvTrace (("count is %d\n", count));
    wvTrace (("offset %x\n", blip->fbse.foDelay));

    if (delay)
      {
	  pos = wvStream_tell (delay);
	  if(blip->fbse.foDelay!=-1)
		wvStream_goto (delay, blip->fbse.foDelay);
	  wvTrace (("offset %x\n", blip->fbse.foDelay));
	  fd = delay;
      }

    count2 = wvGetMSOFBH (&amsofbh, fd);
    wvTrace (("count is %d\n", count2));
    wvTrace (
	     ("HERE is %x %x (%d)\n", wvStream_tell (fd), amsofbh.fbt,
	      amsofbh.fbt - msofbtBlipFirst));
    wvTrace (("type is %x\n", amsofbh.fbt));
    switch (amsofbh.fbt - msofbtBlipFirst)
      {
      case msoblipWMF:
      case msoblipEMF:
      case msoblipPICT:
	  count2 += wvGetMetafile (&blip->blip.metafile, &amsofbh, fd);
	  break;
      case msoblipJPEG:
      case msoblipPNG:
      case msoblipDIB:
	  count2 += wvGetBitmap (&blip->blip.bitmap, &amsofbh, fd);
	  break;
      }
    wvTrace (("count is %d\n", count2));
    blip->type = amsofbh.fbt - msofbtBlipFirst;

    if (delay)
      {
	  wvStream_goto (delay, pos);
	  return (count);
      }

    return (count + count2);
}
예제 #23
0
U32
wvGetFDG(FDG *afdg, wvStream *fd) {
    afdg->csp     = read_32ubit(fd);
    afdg->spidCur = read_32ubit(fd);
    wvTrace(
        ("there are %d shapes here, the last is %x\n", afdg->csp,
         afdg->spidCur));
    return 8;
}
예제 #24
0
파일: table.c 프로젝트: AbiWord/wv
void
wvGetComplexRowTap (wvParseStruct * ps, PAP * dpap, U32 para_intervals,
		    BTE * btePapx, U32 * posPapx, U32 piece)
{
    PAPX_FKP para_fkp;
	U32 para_fcFirst, para_fcLim = 0xffffffffL;
    PAP apap;
    U32 i;
    S32 j = 0;
    wvVersion ver = wvQuerySupported (&ps->fib, NULL);
    wvCopyPAP (&apap, dpap);

    wvInitPAPX_FKP (&para_fkp);

    i = wvStream_tell (ps->mainfd);

    do
      {
	  wvReleasePAPX_FKP (&para_fkp);

	  wvTrace (
		   ("3: cp and fc are %x(%d) %x\n", i, i,
		    wvConvertCPToFC (i, &ps->clx)));
	  piece =
	      wvGetComplexParaBounds (ver, &para_fkp, &para_fcFirst, &para_fcLim,
				      i, &ps->clx, btePapx, posPapx,
				      para_intervals, piece, ps->mainfd);
	  if (piece == 0xffffffffL)
	      break;
	  wvAssembleSimplePAP (ver, &apap, para_fcLim, &para_fkp, ps);
	  wvAssembleComplexPAP (ver, &apap, piece, ps);
	  wvTrace (
		   ("para from %x to %x, table is %d\n", para_fcFirst,
		    para_fcLim, apap.fInTable));
	  i = para_fcLim;
      }
    while (apap.fTtp == 0);

    wvReleasePAPX_FKP (&para_fkp);
    wvCopyTAP (&(dpap->ptap), &apap.ptap);

    for (j = 0; j < apap.ptap.itcMac + 1; j++)
	wvTrace (("This Row-->%d\n", apap.ptap.rgdxaCenter[j]));
}
예제 #25
0
U32
wvGetFDGG(FDGG *afdgg, wvStream *fd) {
    afdgg->spidMax  = read_32ubit(fd);
    afdgg->cidcl    = read_32ubit(fd);
    afdgg->cspSaved = read_32ubit(fd);
    afdgg->cdgSaved = read_32ubit(fd);
    wvTrace(
        ("spidMax %d cidcl %d cspSaved %d cdgSaved %d\n", afdgg->spidMax,
         afdgg->cidcl, afdgg->cspSaved, afdgg->cdgSaved));
    return 16;
}
예제 #26
0
U32
wvGetFBSE(FBSE *afbse, wvStream *fd) {
    int i;

    afbse->btWin32 = read_8ubit(fd);
    afbse->btMacOS = read_8ubit(fd);
    for (i = 0; i < 16; i++)
        afbse->rgbUid[i] = read_8ubit(fd);
    afbse->tag     = read_16ubit(fd);
    afbse->size    = read_32ubit(fd);
    afbse->cRef    = read_32ubit(fd);
    afbse->foDelay = read_32ubit(fd);
    wvTrace(("location is %x, size is %d\n", afbse->foDelay, afbse->size));
    afbse->usage  = read_8ubit(fd);
    afbse->cbName = read_8ubit(fd);
    wvTrace(("name len is %d\n", afbse->cbName));
    afbse->unused2 = read_8ubit(fd);
    afbse->unused3 = read_8ubit(fd);
    return 36;
}
예제 #27
0
void
wvInitCHPFromIstd(CHP *achp, U16 istdBase, STSH *stsh) {
    wvTrace(("initing from %d\n", istdBase));
    if (istdBase == istdNil) {
        wvInitCHP(achp);

        /* Set the Nil style's fonts from the defaults. */
        achp->ftcAscii = stsh->Stshi.rgftcStandardChpStsh[0];
        achp->ftcFE    = stsh->Stshi.rgftcStandardChpStsh[1];
        achp->ftcOther = stsh->Stshi.rgftcStandardChpStsh[2];
    } else {
        if (istdBase >= stsh->Stshi.cstd) {
            wvError(
                ("ISTD out of bounds, requested %d of %d\n",
                 istdBase, stsh->Stshi.cstd));
            wvInitCHP(achp);            /*it can't hurt to try and start with a blank istd */
            return;
        } else {
            if (stsh->std[istdBase].cupx == 0) {        /*empty slot in the array, i don't think this should happen */
                wvTrace(("Empty style slot used (chp)\n"));
                wvInitCHP(achp);
            } else {
                wvTrace(("type is %d\n", stsh->std[istdBase].sgc));
                switch (stsh->std[istdBase].sgc) {
                    case sgcPara:
                        wvCopyCHP(achp,
                                  &(stsh->std[istdBase].grupe[1].achp));
                        break;

                    case sgcChp:
                        wvInitCHP(achp);
                        wvApplyCHPXFromBucket(achp,
                                              &(stsh->std[istdBase].
                                                   grupe[0].chpx), stsh);
                        strncpy(achp->stylename, stsh->std[istdBase].xstzName, sizeof(achp->stylename));
                        break;
                }
            }
        }
    }
}
예제 #28
0
int
wv0x08(Blip *blip, S32 spid, wvParseStruct *ps) {
    int          ret = 0;
    U32          i;
    escherstruct item;
    FSPContainer *answer = NULL;

    wvTrace(("spid is %x\n", spid));
    wvGetEscher(&item, ps->fib.fcDggInfo, ps->fib.lcbDggInfo, ps->tablefd,
                ps->mainfd);

    for (i = 0; i < item.dgcontainer.no_spgrcontainer; i++) {
        answer = wvFindSPID(&(item.dgcontainer.spgrcontainer[i]), spid);
        if (answer)
            break;
    }

    i = 0;
    if (answer == NULL)
        wvError(("Damn found nothing\n"));
    else if (answer->fopte) {
        while (answer->fopte[i].pid != 0) {
            if (answer->fopte[i].pid == 260) {
                wvTrace(
                    ("has a blip reference of %d\n",
                     answer->fopte[i].op));
                wvTrace(
                    ("no blips is %d\n",
                     item.dggcontainer.bstorecontainer.no_fbse));
                wvTrace(
                    ("type is %d (number is %d\n",
                     item.dggcontainer.bstorecontainer.blip[item.
                                                               dggcontainer.
                                                               bstorecontainer.
                                                               no_fbse -
                                                            1].type,
                     item.dggcontainer.bstorecontainer.no_fbse));
                if (answer->fopte[i].op <=
                    item.dggcontainer.bstorecontainer.no_fbse) {
                    wvTrace(("Copied Blip\n"));
                    wvCopyBlip(blip,
                               &(item.dggcontainer.bstorecontainer.
                                    blip[answer->fopte[i].op - 1]));
                    wvTrace(("type is %d\n", blip->type));
                    ret = 1;
                    break;
                }
            }
            i++;
        }
    }
    wvTrace(("spid is %x\n", spid));
    wvReleaseEscher(&item);
    return ret;
}
예제 #29
0
파일: table.c 프로젝트: AbiWord/wv
void
wvGetRowTap (wvParseStruct * ps, PAP * dpap, U32 para_intervals,
	     BTE * btePapx, U32 * posPapx)
{
    PAPX_FKP para_fkp;
	
    U32 para_fcFirst, para_fcLim = 0xffffffffL;
    PAP apap;
    U32 i;
    S32 j = 0;
    wvVersion ver = wvQuerySupported (&ps->fib, NULL);
    wvCopyPAP (&apap, dpap);

    wvInitPAPX_FKP (&para_fkp);

    i = wvStream_tell (ps->mainfd);
    wvTrace (("RowTab begin\n"));
    do
      {
	  wvReleasePAPX_FKP (&para_fkp);
	  wvGetSimpleParaBounds (ver, &para_fkp,
				 &para_fcFirst, &para_fcLim, i, btePapx,
				 posPapx, para_intervals, ps->mainfd);
	  wvTrace (("2: para from %x to %x\n", para_fcFirst, para_fcLim));
	  wvAssembleSimplePAP (ver, &apap, para_fcLim, &para_fkp, ps);
	  i = para_fcLim;
      }
    while ((apap.fTtp == 0) && apap.fInTable); /* placing '&& apap.fInTable' here fixes #11433. I can't find any regressions */

    wvTrace (("fTtp is %d\n", apap.fTtp));

    wvReleasePAPX_FKP (&para_fkp);
    wvCopyTAP (&(dpap->ptap), &apap.ptap);

    for (j = 0; j < apap.ptap.itcMac + 1; j++)
	wvTrace (("This Row-->%d\n", apap.ptap.rgdxaCenter[j]));
}
예제 #30
0
파일: fkp.c 프로젝트: AbiWord/wv
/* Character properties 
 * -basically just like PAPX FKPs above
 * however, rather than an array of BX structs in rgbx,
 * there is an array of bytes (giving the word offset to the CHPX) in rgb
 * -JB
 */
void
wvGetCHPX_FKP (wvVersion ver, CHPX_FKP * fkp, U32 pn, wvStream * fd)
{
    int i;
    U8 page[WV_PAGESIZE];
    U16 pos = 0;
    /*size_t bytes_read; */

    /* [email protected] */
    /* there seem to be a lot of repeat calls... */
    /* pn=0 is safe because thats the index block, not a CHPX_FKP */
    if (pn != 0 && pn == wvCHPX_pn_previous)
      {
	  memcpy (fkp, &wvCHPX_FKP_previous, sizeof (CHPX_FKP));
	  return;
      }
    wvStream_goto (fd, pn * WV_PAGESIZE);
    /*bytes_read= */ wvStream_read (page, WV_PAGESIZE, 1, fd);
    fkp->crun = (U8) page[WV_PAGESIZE - 1];
    wvTrace (("chpx fkp gone to %x\n", pn * WV_PAGESIZE + (WV_PAGESIZE - 1)));
    wvTrace (("crun is %d\n", fkp->crun));
    fkp->rgfc = (U32 *) wvMalloc (sizeof (U32) * (fkp->crun + 1));
    fkp->rgb = (U8 *) wvMalloc (sizeof (U8) * (fkp->crun));
    fkp->grpchpx = (CHPX *) wvMalloc (sizeof (CHPX) * (fkp->crun));
    wvStream_goto (fd, pn * WV_PAGESIZE);
    wvTrace (("offset is %x\n", pn * WV_PAGESIZE));
    for (i = 0; i < fkp->crun + 1; i++)
      {
	  fkp->rgfc[i] = bread_32ubit (&(page[pos]), &pos);
	  wvTrace (("rgfc is %x\n", fkp->rgfc[i]));
      }

    for (i = 0; i < fkp->crun; i++)
	fkp->rgb[i] = bread_8ubit (&(page[pos]), &pos);

    for (i = 0; i < fkp->crun; i++)
      {
	  if (fkp->rgb[i] == 0)
	    {
		wvTrace (("i is %d, using clear chpx\n", i));
		wvInitCHPX (&(fkp->grpchpx[i]));
	    }
	  else
	    {
		wvTrace (
			 ("chpx index i is %d, offset is %x\n", i,
			  (pn * WV_PAGESIZE) + (fkp->rgb[i] * 2)));
		pos = fkp->rgb[i] * 2;
		wvGetCHPX (ver, &(fkp->grpchpx[i]), page, &pos);
	    }
      }
    if (wvCHPX_pn_previous != 0)
	internal_wvReleaseCHPX_FKP (&wvCHPX_FKP_previous);
    memcpy (&wvCHPX_FKP_previous, fkp, sizeof (CHPX_FKP));
    wvCHPX_pn_previous = pn;
}