Пример #1
0
void CPDF_StreamContentParser::Handle_ExecuteXObject() {
  CFX_ByteString name = GetString(0);
  if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() &&
      m_pLastImage->GetStream()->GetObjNum()) {
    AddImage(nullptr, m_pLastImage, FALSE);
    return;
  }

  if (m_Options.m_bTextOnly) {
    if (!m_pResources)
      return;

    CPDF_Dictionary* pList = m_pResources->GetDict("XObject");
    if (!pList && m_pPageResources && m_pResources != m_pPageResources)
      pList = m_pPageResources->GetDict("XObject");
    if (!pList)
      return;
    CPDF_Reference* pRes = ToReference(pList->GetElement(name));
    if (!pRes)
      return;

    FX_BOOL bForm;
    if (m_pDocument->IsFormStream(pRes->GetRefObjNum(), bForm) && !bForm)
      return;
  }

  CPDF_Stream* pXObject = ToStream(FindResourceObj("XObject", name));
  if (!pXObject) {
    m_bResourceMissing = TRUE;
    return;
  }

  CFX_ByteStringC type = pXObject->GetDict()
                             ? pXObject->GetDict()->GetConstString("Subtype")
                             : CFX_ByteStringC();
  if (type == "Image") {
    if (m_Options.m_bTextOnly) {
      return;
    }
    CPDF_ImageObject* pObj = AddImage(pXObject, NULL, FALSE);
    m_LastImageName = name;
    m_pLastImage = pObj->m_pImage;
    if (!m_pObjectList->m_bHasImageMask)
      m_pObjectList->m_bHasImageMask = m_pLastImage->IsMask();
  } else if (type == "Form") {
    AddForm(pXObject);
  } else {
    return;
  }
}
Пример #2
0
bool CSubFormCollection::CreateSubForm(CDialog* pDlg, UINT id,CWnd* pParentWnd)
{
   // CDialog* pDlg = new CDialog();
    ASSERT(pDlg != NULL);
    if (pDlg == NULL) return(false); // exit and tell the world about it

    AddForm(pDlg); // Add it to the internal table
    pDlg->Create(id,pParentWnd);

    CRect r;
    int x,y;
    pDlg->GetWindowRect(&r); // Get the size and position of the dialog in screen coordinates
    if (m_bCentered) {
        x = m_Rect.left - r.left + ((m_Rect.Width() - r.Width()) / 2);
        y = m_Rect.top - r.top + ((m_Rect.Height() - r.Height()) / 2);
    }
    else { // just use the top left corner
        x = m_Rect.left - r.left;
        y = m_Rect.top - r.top;
    }
    pDlg->SetWindowPos(pParentWnd,x,y, r.Width(), r.Height(), SWP_NOZORDER);
    return(true); // everything ok
}
Пример #3
0
BOOL
bAddMiniForms(
    HANDLE  hPrinter,               /* Access to the printer */
    BOOL    bUpgrade,
    PRASDDUIINFO pRasdduiInfo       /* Global Data Access */

)
{

    short    *psPSInd;          /* Scan the PAPERSOURCE selection */

    PAPERSIZE  *pPS;            /* Scanning PAPERSIZE data */

    FORM_INFO_1  fi1;           /* The info the spooler wants! */

    WCHAR       awchForm[ 64 ];     /* The name of the form */

    psPSInd = (short *)((BYTE *)pdh + pdh->loHeap +
                                      pModel->rgoi[ MD_OI_PAPERSIZE ]);

    fi1.Flags = FORM_PRINTER;
    fi1.pName = awchForm;
    fi1.ImageableArea.left = 0;
    fi1.ImageableArea.top = 0;

    for( ; *psPSInd; ++psPSInd )
    {
        pPS = (PAPERSIZE *)GetTableInfoIndex( pdh, HE_PAPERSIZE, *psPSInd - 1 );

        if( !pPS || pPS->sPaperSizeID <= DMPAPER_USER )
            continue;           /* Standard rasdd defined */

        if( iLoadStringW( &WinResData, pPS->sPaperSizeID,
                                       awchForm, sizeof( awchForm ) ) == 0 )
        {
#if  DBG
            DbgPrint( "rasddUI!bAddMiniForms: Could not load form name string for index %d\n", pPS->sPaperSizeID );
#endif

            continue;            /* See if there are others */
        }

        /*
         *     Now have a minidriver specific form size!  This information
         *  needs to be communicated to the spooler.
         */

        fi1.Size.cx = MASTERTOX( (long)pPS->ptSize.x );
        fi1.Size.cy = MASTERTOY( (long)pPS->ptSize.y );

        fi1.ImageableArea.right = fi1.Size.cx;
        fi1.ImageableArea.bottom = fi1.Size.cy;

        //This is the upgrade case

        if (bUpgrade)
        {
            FORM_INFO_1 FormInfo;
            DWORD dw = 0;

            if ( GetForm( hPrinter, awchForm, 1,
                          (LPBYTE)&FormInfo,
                          sizeof(FORM_INFO_1), &dw ) )
            {
                /* This means  NT 351 */
                if ( FormInfo.Flags & FORM_USER )
                    DeleteForm(hPrinter,awchForm);
            }
        }


        AddForm( hPrinter, 1, (BYTE *)&fi1 );

    }

    return   TRUE;
}
Пример #4
0
BOOL
AddFormsToDataBase(
    PPRINTERINFO    pPI,
    BOOL            DeleteFirst
    )

/*++

Routine Description:

    This function add driver supports forms to the data base

Arguments:

    pPI - Pointer to the PRINTERINFO


Return Value:

    BOOLEAN


Author:

    09-Dec-1993 Thu 22:38:27 created  

    27-Apr-1994 Wed 19:18:58 updated  
        Fixed bug# 13592 which printman/spooler did not call ptrprop first but
        docprop so let us into unknown form database state,

Revision History:


--*/

{
    WCHAR       wName[CCHFORMNAME + 2];
    BOOL        bRet;
    LONG        i;
    DWORD       Type;


    Type = REG_SZ;

    if ((GetPrinterData(pPI->hPrinter,
                        wszModel,
                        &Type,
                        (LPBYTE)wName,
                        sizeof(wName),
                        &i) == ERROR_SUCCESS) &&
        (wcscmp(pPI->PlotDM.dm.dmDeviceName, wName))) {

        PLOTDBG(DBG_FORMS, ("Already added forms to the data base for %s",
                                                pPI->PlotDM.dm.dmDeviceName));
        return(TRUE);
    }

    //
    // Find out if we have permission to do this
    //

    if (SetPrinterData(pPI->hPrinter,
                       wszModel,
                       REG_SZ,
                       (LPBYTE)pPI->PlotDM.dm.dmDeviceName,
                       (wcslen(pPI->PlotDM.dm.dmDeviceName) + 1) *
                                            sizeof(WCHAR)) == ERROR_SUCCESS) {

        PFORMSRC    pFS;
        FORM_INFO_1 FI1;

        //
        // We have permission to update the registry so do it now
        //

        pPI->Flags |= PIF_UPDATE_PERMISSION;

        PLOTDBG(DBG_PERMISSION,
                ("!!! MODEL NAME: '%s' not Match, Re-installed Form Database",
                                            pPI->PlotDM.dm.dmDeviceName));

        //
        // Add the driver supportes forms to the system spooler data base if
        // not yet done so
        //

        FI1.pName = wName;

        for (i = 0, pFS = (PFORMSRC)pPI->pPlotGPC->Forms.pData;
             i < (LONG)pPI->pPlotGPC->Forms.Count;
             i++, pFS++) {

            //
            // We will only add the non-roll paper forms
            //

            if (pFS->Size.cy) {

                str2Wstr(wName, CCHOF(wName), pFS->Name);

                //
                // Firstable we will delete the same name form in the data
                // base first, this will ensure we have our curent user defined
                // form can be installed
                //

                if (DeleteFirst) {

                    DeleteForm(pPI->hPrinter, wName);
                }

                FI1.Size                 = pFS->Size;
                FI1.ImageableArea.left   = pFS->Margin.left;
                FI1.ImageableArea.top    = pFS->Margin.top;
                FI1.ImageableArea.right  = FI1.Size.cx - pFS->Margin.right;
                FI1.ImageableArea.bottom = FI1.Size.cy - pFS->Margin.bottom;

                PLOTDBG(DBG_FORMS, (
                        "AddForm: %s-[%ld x %ld] (%ld, %ld)-(%ld, %ld)",
                        FI1.pName, FI1.Size.cx, FI1.Size.cy,
                        FI1.ImageableArea.left, FI1.ImageableArea.top,
                        FI1.ImageableArea.right,FI1.ImageableArea.bottom));

                FI1.Flags = FORM_PRINTER;

                if ((!AddForm(pPI->hPrinter, 1, (LPBYTE)&FI1))  &&
                    (GetLastError() != ERROR_FILE_EXISTS)       &&
                    (GetLastError() != ERROR_ALREADY_EXISTS)) {

                    bRet = FALSE;
                    PLOTERR(("AddFormsToDataBase: AddForm(%s) failed, [%ld]",
                                        wName, GetLastError()));
                }
            }
        }

        return(TRUE);

    } else {

        pPI->Flags &= ~PIF_UPDATE_PERMISSION;

        PLOTDBG(DBG_PERMISSION, ("AddFormsToDataBase(): NO UPDATE PERMISSION"));

        return(FALSE);
    }
}
Пример #5
0
BOOL
AddDriverForms(
    HANDLE  hPrinter,
    PMPD    pmpd
    )

/*++

Routine Description:

    Add printer-specific forms to the global forms database

Arguments:

    hPrinter - Identifies the printer being upgraded
    pmpd - Points to printer description data

Return Value:

    TRUE if successful, FALSE if there is an error

--*/

{
    PFEATURE    pFeature;
    PPAPERSIZE  pPaperSize;
    WORD        index;
    DWORD       type, value, cbNeeded;
    FORM_INFO_1 formInfo;

    //
    // Check if we've added printer-specific forms already
    //

    if (GetPrinterData(hPrinter,
                       REGSTR_FORMSADDED,
                       &type,
                       (PBYTE) &value,
                       sizeof(value),
                       &cbNeeded) == ERROR_SUCCESS)
    {
        return TRUE;
    }

    Verbose(("Adding printer-specific forms\n"));

    //
    // Call AddForm for every printer specific form
    //

    formInfo.Flags = 0;
    pFeature = MpdPaperSizes(pmpd);
    
    for (index=0; index < pFeature->count; index++) {

        pPaperSize = FindIndexedSelection(pFeature, index);

        //
        // Form name, size, and imageable area
        //

        formInfo.pName = GetXlatedName(pPaperSize);
        formInfo.Size = pPaperSize->size;

        formInfo.ImageableArea.left = formInfo.ImageableArea.top = 0;
        formInfo.ImageableArea.right = formInfo.Size.cx;
        formInfo.ImageableArea.bottom = formInfo.Size.cy;

        AddForm(hPrinter, 1, (PBYTE) &formInfo);
    }

    //
    // Indicate we have successfully added printer specific forms
    //

    value = 1;
    SetPrinterData(hPrinter, REGSTR_FORMSADDED, REG_DWORD, (PBYTE) &value, sizeof(value));
    
    return TRUE;
}
Пример #6
0
void CFormulaDlg::OnBRy() 
{
	AddForm(1,1);	
}
Пример #7
0
void CFormulaDlg::OnBMy() 
{
	AddForm(1,0);	
}
Пример #8
0
void CFormulaDlg::OnBRx() 
{
	AddForm(0,1);
}
Пример #9
0
void CFormulaDlg::OnBMx() 
{
	AddForm(0,0);
}
Пример #10
0
void CFormulaDlg::OnBRz() 
{
	AddForm(2,1);		
}
Пример #11
0
void CFormulaDlg::OnBMz() 
{
	AddForm(2,0);		
}