Exemple #1
0
void
wvGetDTTMFromBucket (DTTM * item, U8 * pointer)
{
    U16 a = dread_16ubit (NULL, &pointer);
    U16 b = dread_16ubit (NULL, &pointer);
    wvCreateDTTM (item, a, b);
}
void
wvGetSHD_internal(SHD *item, wvStream *fd, U8 *pointer) {
    U16 temp16;

#ifdef PURIFY
    wvInitSHD(item);
#endif
    temp16        = dread_16ubit(fd, &pointer);
    item->icoFore = temp16 & 0x001F;
    item->icoBack = (temp16 & 0x03E0) >> 5;
    item->ipat    = (temp16 & 0xFC00) >> 10;
}
Exemple #3
0
Fichier : brc.c Projet : AbiWord/wv
void
wvGetBRC10_internal (BRC10 * item, wvStream * infd, U8 * pointer)
{
    U16 temp16;
    temp16 = dread_16ubit (infd, &pointer);
#ifdef PURIFY
    wvInitBRC10 (item);
#endif
    item->dxpLine2Width = (temp16 & 0x0007);
    item->dxpSpaceBetween = (temp16 & 0x0038) >> 3;
    item->dxpLine1Width = (temp16 & 0x01C0) >> 6;
    item->dxpSpace = (temp16 & 0x3E00) >> 9;
    item->fShadow = (temp16 & 0x4000) >> 14;
    item->fSpare = (temp16 & 0x8000) >> 15;
}
void
wvGetBRC_internal6(BRC *abrc, wvStream *infd, U8 *pointer) {
    U16 temp16;

#ifdef PURIFY
    wvInitBRC(abrc);
#endif

    temp16 = dread_16ubit(infd, &pointer);

    abrc->dptLineWidth = (temp16 & 0x0007);
    abrc->brcType      = (temp16 & 0x0018) >> 3;
    abrc->fShadow      = (temp16 & 0x0020) >> 5;
    abrc->ico          = (temp16 & 0x07C0) >> 6;
    abrc->dptSpace     = (temp16 & 0xF800) >> 11;
}
/*
   Apply the first UPX (UPX.chpx) in std.grupx to the UPE.

   To apply a UPX.chpx to a UPE.chpx, take the grpprl in UPE.chpx.grpprl (which
   has a length of UPE.chpx.cbGrpprl) and merge the grpprl in UPX.chpx.grpprl
   into it.

   Merging grpprls is a tricky business, but for character styles it is easy
   because no prls in character style grpprls should interact with each other.
   Each prl from the source (the UPX.chpx.grpprl) should be inserted into the
   destination (the UPE.chpx.grpprl) so that the sprm of each prl is in increasing
   order, and any prls that have the same sprm are replaced by the prl in the
   source.

   UPE.chpx.cbGrpprl is then set to the length of resulting grpprl, and
   UPE.chpx.istd is set to the style's istd.
 */
void
wvMergeCHPXFromBucket(CHPX *dest, UPXF *src) {
    BintreeInfo tree;
    Node        *testn, *testp;
    U16         i = 0, j;
    U16         sprm;
    U8          len = 0;
    U8          temp;
    Node        *test = NULL;

    U8 *pointer, *dpointer;
    U8 *grpprl = NULL;

    /*
       use a binary tree ala the wmf stuff and first insert every dest sprm into it,
       then insert every src sprm into it, take the full count and take them out of
       the tree and create the list from them
     */
    InitBintree(&tree, wvCompLT, wvCompEQ);
    pointer = dest->grpprl;

    while (i < dest->cbGrpprl) {
        wvTrace(("gotcha the sprm is %x\n", *((U16 *)pointer)));
        test = InsertNode(&tree, (void *)pointer);
        sprm = dread_16ubit(NULL, &pointer);
        wvTrace(("the sprm is %x\n", sprm));
        temp     = wvEatSprm(sprm, pointer, &i);
        pointer += temp;
        i       += 2;
        if (test)
            len += temp + 2;
    }

    i       = 0;
    pointer = src->upx.chpx.grpprl;
    i       = 0;
    while (i < src->cbUPX) {
        /*wvTrace(("gotcha 2 the sprm is %x\n",*((U16 *)pointer))); */
        test = InsertNode(&tree, (void *)pointer);
        sprm = dread_16ubit(NULL, &pointer);
        i   += 2;
        wvTrace(("the sprm is %x\n", sprm));
        temp = wvEatSprm(sprm, pointer, &i);
        wvTrace(("len of op is %d\n", temp));
        pointer += temp;
        wvTrace(("p dis is %d\n", pointer - src->upx.chpx.grpprl));
        if (test)
            len += temp + 2;
    }

    if (len != 0)
        grpprl = (U8 *)wvMalloc(len);
    else
        return;


    dpointer = grpprl;

    testn = NextNode(&tree, NULL);
    while (testn != NULL) {
        pointer = (U8 *)testn->Data;
        sprm    = sread_16ubit(pointer);
        wvTrace(("methinks the sprm is %x\n", sprm));
        pointer += 2;

        i = 0;
        wvEatSprm(sprm, pointer, &i);
        wvTrace(("i is now %d\n", i));

        pointer = (U8 *)testn->Data;
        for (j = 0; j < i + 2; j++)
            *dpointer++ = *pointer++;

        testp = NextNode(&tree, testn);
        wvDeleteNode(&tree, testn);
        testn = testp;
    }
    wvFree(dest->grpprl);
    dest->grpprl   = grpprl;
    dest->cbGrpprl = len;

    /*test */
    i       = 0;
    pointer = dest->grpprl;
    while (i < dest->cbGrpprl) {
        sprm = dread_16ubit(NULL, &pointer);
        wvTrace(("final test the sprm is %x\n", sprm));
        temp     = wvEatSprm(sprm, pointer, &i);
        pointer += temp;
        i       += 2;
        if (test)
            len += temp + 2;
    }
}