Lines 296-302
Link Here
|
296 |
|
296 |
|
297 |
// copy the whole context |
297 |
// copy the whole context |
298 |
if( pJobSetup->mpDriverData ) |
298 |
if( pJobSetup->mpDriverData ) |
299 |
delete pJobSetup->mpDriverData; |
299 |
rtl_freeMemory( pJobSetup->mpDriverData ); |
300 |
|
300 |
|
301 |
int nBytes; |
301 |
int nBytes; |
302 |
void* pBuffer = NULL; |
302 |
void* pBuffer = NULL; |
Lines 613-619
Link Here
|
613 |
|
613 |
|
614 |
if( pSetupFunction( aInfo ) ) |
614 |
if( pSetupFunction( aInfo ) ) |
615 |
{ |
615 |
{ |
616 |
delete pJobSetup->mpDriverData; |
616 |
rtl_freeMemory( pJobSetup->mpDriverData ); |
617 |
pJobSetup->mpDriverData = NULL; |
617 |
pJobSetup->mpDriverData = NULL; |
618 |
|
618 |
|
619 |
int nBytes; |
619 |
int nBytes; |
Lines 678-689
Link Here
|
678 |
nHeight = pJobSetup->mnPaperWidth; |
678 |
nHeight = pJobSetup->mnPaperWidth; |
679 |
} |
679 |
} |
680 |
String aPaper; |
680 |
String aPaper; |
681 |
if( pJobSetup->mePaperFormat == PAPER_USER ) |
681 |
|
|
|
682 |
#ifdef MACOSX |
683 |
// For Mac OS X, many printers are directly attached |
684 |
// USB/Serial printers with a stripped-down PPD that gives us |
685 |
// problems. We need to do PS->PDF conversion for these printers |
686 |
// but they are not able to handle multiple page sizes in the same |
687 |
// document at all, since we must pass -o media=... to them to get |
688 |
// a good printout. |
689 |
// So, we must find a match between the paper size from OOo and what |
690 |
// the PPD of the printer has, and pass that paper size to -o media=... |
691 |
// If a match cannot be found (ie the paper size from Format->Page is |
692 |
// nowhere near anything in the PPD), we default to what has been |
693 |
// chosen in File->Print->Properties. |
694 |
// |
695 |
// For printers capable of directly accepting PostScript data, none |
696 |
// of this occurs and we default to the normal OOo behavior. |
697 |
const PPDKey *pCupsFilterKey; |
698 |
const PPDValue *pCupsFilterValue; |
699 |
BOOL bIsCUPSPrinter = TRUE; |
700 |
|
701 |
// Printers that need PS->PDF conversion have a "cupsFilter" key and |
702 |
// a value of "application/pdf" in that key |
703 |
pCupsFilterKey = aData.m_pParser->getKey( String(RTL_CONSTASCII_USTRINGPARAM("cupsFilter")) ); |
704 |
pCupsFilterValue = pCupsFilterKey != NULL ? aData.m_aContext.getValue( pCupsFilterKey ) : NULL; |
705 |
if ( pCupsFilterValue ) |
706 |
{ |
707 |
// PPD had a cupsFilter key, check for PS->PDF conversion requirement |
708 |
ByteString aCupsFilterString( pCupsFilterValue->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ); |
709 |
if ( aCupsFilterString.Search("application/pdf") == 0 ) |
710 |
bIsCUPSPrinter = FALSE; |
711 |
} |
712 |
else |
713 |
bIsCUPSPrinter = FALSE; |
714 |
|
715 |
if ( TRUE == bIsCUPSPrinter ) |
716 |
{ |
717 |
// If its a directly attached printer, with a |
718 |
// stripped down PPD (most OS X printers are) always |
719 |
// match the paper size. |
682 |
aPaper = aData.m_pParser->matchPaper( |
720 |
aPaper = aData.m_pParser->matchPaper( |
683 |
TenMuToPt( pJobSetup->mnPaperWidth ), |
721 |
TenMuToPt( pJobSetup->mnPaperWidth ), |
684 |
TenMuToPt( pJobSetup->mnPaperHeight ) ); |
722 |
TenMuToPt( pJobSetup->mnPaperHeight ) ); |
|
|
723 |
} |
685 |
else |
724 |
else |
686 |
aPaper = String( ByteString( aPaperTab[ pJobSetup->mePaperFormat ].name ), RTL_TEXTENCODING_ISO_8859_1 ); |
725 |
#endif |
|
|
726 |
{ |
727 |
if( pJobSetup->mePaperFormat == PAPER_USER ) |
728 |
aPaper = aData.m_pParser->matchPaper( |
729 |
TenMuToPt( pJobSetup->mnPaperWidth ), |
730 |
TenMuToPt( pJobSetup->mnPaperHeight ) ); |
731 |
else |
732 |
aPaper = String( ByteString( aPaperTab[ pJobSetup->mePaperFormat ].name ), RTL_TEXTENCODING_ISO_8859_1 ); |
733 |
} |
687 |
pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) ); |
734 |
pKey = aData.m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) ) ); |
688 |
pValue = pKey ? pKey->getValue( aPaper ) : NULL; |
735 |
pValue = pKey ? pKey->getValue( aPaper ) : NULL; |
689 |
if( ! ( pKey && pValue && aData.m_aContext.setValue( pKey, pValue, false ) == pValue ) ) |
736 |
if( ! ( pKey && pValue && aData.m_aContext.setValue( pKey, pValue, false ) == pValue ) ) |