Kaydet (Commit) 950dbaff authored tarafından Yuri Dario's avatar Yuri Dario

i122990 - implemented missing InitPaperFormats and GetLandscapeAngle methods.

üst bd363910
...@@ -57,32 +57,8 @@ ...@@ -57,32 +57,8 @@
#include <print.h> #include <print.h>
#include <jobset.h> #include <jobset.h>
/*
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <comphelper/processfactory.hxx>
*/
#include <malloc.h> #include <malloc.h>
/*
#define _SV_SALPRN_CXX
#include <tools/debug.hxx>
#include <saldata.hxx>
#include <salinst.h>
#include <salgdi.h>
#include <salframe.h>
#include <vcl/salptype.hxx>
#include <salprn.h>
#include <vcl/print.h>
#include <vcl/jobset.h>
*/
#ifndef __H_FT2LIB #ifndef __H_FT2LIB
#include <os2/wingdi.h> #include <os2/wingdi.h>
#include <ft2lib.h> #include <ft2lib.h>
...@@ -583,11 +559,15 @@ static void ImplFreeFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter ) ...@@ -583,11 +559,15 @@ static void ImplFreeFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter )
static void ImplGetFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter, const ImplJobSetup* pSetupData ) static void ImplGetFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter, const ImplJobSetup* pSetupData )
{ {
// if not defined, suppose default orientation is portrait
Orientation orientation = ORIENTATION_PORTRAIT;
ImplFreeFormAndTrayList( pOs2SalInfoPrinter ); ImplFreeFormAndTrayList( pOs2SalInfoPrinter );
LONG alQuery[] = LONG alQuery[] =
{ {
0, 0, // First two members of QUERYSIZE 0, 0, // First two members of QUERYSIZE
DJP_SJ_ORIENTATION, DJP_CURRENT,
DJP_CJ_FORM, DJP_ALL, DJP_CJ_FORM, DJP_ALL,
DJP_CJ_TRAYNAME, DJP_ALL, DJP_CJ_TRAYNAME, DJP_ALL,
DJP_NONE, DJP_NONE // EOL marker DJP_NONE, DJP_NONE // EOL marker
...@@ -638,7 +618,18 @@ static void ImplGetFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter, const ...@@ -638,7 +618,18 @@ static void ImplGetFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter, const
PQUERYTUPLE pTuple = pQuerySize->aTuples; PQUERYTUPLE pTuple = pQuerySize->aTuples;
while ( DJP_NONE != pTuple->ulProperty ) while ( DJP_NONE != pTuple->ulProperty )
{ {
if ( pDJP->ulProperty == DJP_CJ_FORM ) if ( pDJP->ulProperty == DJP_SJ_ORIENTATION )
{
if ( pDJP->ulNumReturned )
{
PDJPT_ORIENTATION pElm = DJP_ELEMENTP( *pDJP, DJPT_ORIENTATION );
if ( (DJP_ORI_PORTRAIT == *pElm) || (DJP_ORI_REV_PORTRAIT == *pElm) )
orientation = ORIENTATION_PORTRAIT;
else
orientation = ORIENTATION_LANDSCAPE;
}
}
else if ( pDJP->ulProperty == DJP_CJ_FORM )
{ {
if ( pDJP->ulNumReturned ) if ( pDJP->ulNumReturned )
{ {
...@@ -649,11 +640,20 @@ static void ImplGetFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter, const ...@@ -649,11 +640,20 @@ static void ImplGetFormAndTrayList( Os2SalInfoPrinter* pOs2SalInfoPrinter, const
for( int i = 0; i < pDJP->ulNumReturned; i++, pElm++ ) for( int i = 0; i < pDJP->ulNumReturned; i++, pElm++ )
{ {
ImplFormInfo* pInfo = new ImplFormInfo; ImplFormInfo* pInfo = new ImplFormInfo;
pInfo->mnPaperWidth = pElm->hcInfo.cx; // AOO expects form size always in portrait mode
pInfo->mnPaperHeight = pElm->hcInfo.cy; if (orientation == ORIENTATION_PORTRAIT)
{
pInfo->mnPaperWidth = pElm->hcInfo.cx;
pInfo->mnPaperHeight = pElm->hcInfo.cy;
}
else
{
pInfo->mnPaperWidth = pElm->hcInfo.cy;
pInfo->mnPaperHeight = pElm->hcInfo.cx;
}
#if OSL_DEBUG_LEVEL>0 #if OSL_DEBUG_LEVEL>0
printf("ImplGetFormAndTrayList mnPaperWidth %d\n", pInfo->mnPaperWidth); debug_printf("ImplGetFormAndTrayList #%d: %d x %d",
printf("ImplGetFormAndTrayList mnPaperHeight %d\n", pInfo->mnPaperHeight); i, pInfo->mnPaperWidth, pInfo->mnPaperHeight);
#endif #endif
pInfo->mnId = pElm->djppsFormID; pInfo->mnId = pElm->djppsFormID;
pOs2SalInfoPrinter->mpFormArray[i] = pInfo; pOs2SalInfoPrinter->mpFormArray[i] = pInfo;
...@@ -865,6 +865,9 @@ static sal_Bool ImplSetOrientation( HDC hPrinterDC, PDRIVDATA pDriverData, ...@@ -865,6 +865,9 @@ static sal_Bool ImplSetOrientation( HDC hPrinterDC, PDRIVDATA pDriverData,
DJP_SJ_ORIENTATION, DJP_CURRENT, DJP_SJ_ORIENTATION, DJP_CURRENT,
DJP_NONE, DJP_NONE // EOL marker DJP_NONE, DJP_NONE // EOL marker
}; };
#if OSL_DEBUG_LEVEL>0
debug_printf( "ImplSetOrientation mhDC %x, %d", hPrinterDC, eOrientation);
#endif
APIRET rc; APIRET rc;
PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery; PQUERYSIZE pQuerySize = (PQUERYSIZE)alQuery;
...@@ -1164,6 +1167,7 @@ Os2SalInfoPrinter::Os2SalInfoPrinter() ...@@ -1164,6 +1167,7 @@ Os2SalInfoPrinter::Os2SalInfoPrinter()
mpFormArray = NULL; mpFormArray = NULL;
mnTrayCount = 0; mnTrayCount = 0;
mpTrayArray = NULL; mpTrayArray = NULL;
m_bPapersInit = FALSE;
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -1181,6 +1185,42 @@ Os2SalInfoPrinter::~Os2SalInfoPrinter() ...@@ -1181,6 +1185,42 @@ Os2SalInfoPrinter::~Os2SalInfoPrinter()
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void Os2SalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData )
{
#if OSL_DEBUG_LEVEL>0
debug_printf( "Os2SalInfoPrinter::InitPaperFormats pSetupData %x",
pSetupData);
#endif
m_aPaperFormats.clear();
m_bPapersInit = true;
// init paperbinlist if empty
if ( !mnTrayCount )
ImplGetFormAndTrayList( this, pSetupData );
for( int i = 0; i < mnFormCount; i++)
{
PaperInfo aInfo( mpFormArray[i]->mnPaperWidth * 100,
mpFormArray[i]->mnPaperHeight * 100);
#if OSL_DEBUG_LEVEL>0
debug_printf( "Os2SalInfoPrinter::InitPaperFormats #%d: %d x %d",
i, mpFormArray[i]->mnPaperWidth * 100,
mpFormArray[i]->mnPaperHeight * 100);
#endif
m_aPaperFormats.push_back( aInfo );
}
}
// -----------------------------------------------------------------------
int Os2SalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData )
{
return 900;
}
// -----------------------------------------------------------------------
SalGraphics* Os2SalInfoPrinter::GetGraphics() SalGraphics* Os2SalInfoPrinter::GetGraphics()
{ {
if ( mbGraphics ) if ( mbGraphics )
...@@ -1292,6 +1332,11 @@ sal_Bool Os2SalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData ) ...@@ -1292,6 +1332,11 @@ sal_Bool Os2SalInfoPrinter::SetPrinterData( ImplJobSetup* pSetupData )
sal_Bool Os2SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData ) sal_Bool Os2SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData )
{ {
#if OSL_DEBUG_LEVEL>0
debug_printf( "Os2SalInfoPrinter::SetData nFlags %x, pSetupData %x",
nFlags, pSetupData);
#endif
// needs DJP support // needs DJP support
if ( !mbDJPSupported ) if ( !mbDJPSupported )
return FALSE; return FALSE;
...@@ -1306,6 +1351,9 @@ sal_Bool Os2SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData ) ...@@ -1306,6 +1351,9 @@ sal_Bool Os2SalInfoPrinter::SetData( ULONG nFlags, ImplJobSetup* pSetupData )
// set orientation // set orientation
if ( nFlags & SAL_JOBSET_ORIENTATION ) if ( nFlags & SAL_JOBSET_ORIENTATION )
{ {
#if OSL_DEBUG_LEVEL>0
debug_printf( "Os2SalInfoPrinter::SetData meOrientation %d", pSetupData->meOrientation);
#endif
if ( ImplSetOrientation( mhDC, pDrivData, pSetupData->meOrientation ) ) if ( ImplSetOrientation( mhDC, pDrivData, pSetupData->meOrientation ) )
bOK = TRUE; bOK = TRUE;
} }
...@@ -1687,6 +1735,9 @@ sal_Bool Os2SalPrinter::StartJob( const XubString* pFileName, ...@@ -1687,6 +1735,9 @@ sal_Bool Os2SalPrinter::StartJob( const XubString* pFileName,
// Can we print with DJP // Can we print with DJP
mbPrintDJPSupported = ImplIsDriverPrintDJPEnabled( mhDC ); mbPrintDJPSupported = ImplIsDriverPrintDJPEnabled( mhDC );
#if OSL_DEBUG_LEVEL>0
debug_printf( "mbPrintDJPSupported %d", mbPrintDJPSupported);
#endif
// JobName ermitteln und Job starten // JobName ermitteln und Job starten
PSZ pszJobName = NULL; PSZ pszJobName = NULL;
...@@ -1697,9 +1748,10 @@ sal_Bool Os2SalPrinter::StartJob( const XubString* pFileName, ...@@ -1697,9 +1748,10 @@ sal_Bool Os2SalPrinter::StartJob( const XubString* pFileName,
nJobNameLen = jobName.Len(); nJobNameLen = jobName.Len();
} }
rc = DevEscape( mhDC, rc = DevEscape( mhDC,
DEVESC_STARTDOC, mbPrintDJPSupported ? DEVESC_STARTDOC_WPROP : DEVESC_STARTDOC,
nJobNameLen, (PBYTE)pszJobName, nJobNameLen, (PBYTE)pszJobName,
0, (PBYTE)NULL ); &((PDRIVDATA)(pSetupData->mpDriverData))->cb,
(PBYTE)(pSetupData->mpDriverData));
if ( rc != DEV_OK ) if ( rc != DEV_OK )
{ {
...@@ -1770,6 +1822,13 @@ SalGraphics* Os2SalPrinter::StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJo ...@@ -1770,6 +1822,13 @@ SalGraphics* Os2SalPrinter::StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJo
{ {
APIRET rc; APIRET rc;
#if OSL_DEBUG_LEVEL>0
debug_printf( "Os2SalPrinter::StartPage mhDC %x, mbFirstPage %d, bNewJobSetup %d",
mhDC, mbFirstPage, bNewJobSetup);
debug_printf( "Os2SalPrinter::StartPage pSetupData %x",
pSetupData);
#endif
if ( mbFirstPage ) if ( mbFirstPage )
mbFirstPage = FALSE; mbFirstPage = FALSE;
else else
...@@ -1840,6 +1899,10 @@ SalGraphics* Os2SalPrinter::StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJo ...@@ -1840,6 +1899,10 @@ SalGraphics* Os2SalPrinter::StartPage( ImplJobSetup* pSetupData, sal_Bool bNewJo
sal_Bool Os2SalPrinter::EndPage() sal_Bool Os2SalPrinter::EndPage()
{ {
#if OSL_DEBUG_LEVEL>0
debug_printf( "Os2SalPrinter::EndPage mhDC %x", mhDC);
#endif
if ( mpGraphics ) if ( mpGraphics )
{ {
// destroy SalGraphics // destroy SalGraphics
...@@ -1857,14 +1920,3 @@ ULONG Os2SalPrinter::GetErrorCode() ...@@ -1857,14 +1920,3 @@ ULONG Os2SalPrinter::GetErrorCode()
{ {
return mnError; return mnError;
} }
void Os2SalInfoPrinter::InitPaperFormats( const ImplJobSetup* pSetupData )
{
printf("Os2SalInfoPrinter::InitPaperFormats\n");
}
int Os2SalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* pSetupData )
{
printf("Os2SalInfoPrinter::GetLandscapeAngle\n");
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment