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)));
}
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;
}
Exemple #3
0
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);
}
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;
}
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;
}
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;
}
U32
wvGetFSPContainer(FSPContainer *item, MSOFBH *msofbh, wvStream *fd) {
    MSOFBH amsofbh;
    U32    count = 0;

    wvInitFSPContainer(item);
    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 msofbtSpgr:
                count += wvGetFSPGR(&item->fspgr, fd);
                break;

            case msofbtSp:
                wvTrace(("Getting an fsp\n"));
                count += wvGetFSP(&item->fsp, fd);
                break;

            case msofbtOPT:
                count += wvGetFOPTEArray(&item->fopte, &amsofbh, fd);
                break;

            case msofbtAnchor:
            case msofbtChildAnchor:
            case msofbtClientAnchor:
                count += wvGetFAnchor(&item->fanchor, fd);
                break;

            case msofbtClientData:
                count += wvGetClientData(&item->clientdata, &amsofbh, fd);
                break;

            case msofbtClientTextbox:
                count +=
                    wvGetClientTextbox(&item->clienttextbox, &amsofbh, fd);
                break;

            case msofbtTextbox:
                wvError(("unimp\n"));
                break;

            case msofbtOleObject:
                wvError(("unimp\n"));
                break;

            case msofbtDeletedPspl:
                wvError(("unimp\n"));
                break;

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