View | Details | Raw Unified | Return to issue 15529
Collapse All | Expand All

(-)source/gdi/jobset.cxx (-3 / +6 lines)
Lines 67-72 Link Here
67
#ifndef _STREAM_HXX
67
#ifndef _STREAM_HXX
68
#include <tools/stream.hxx>
68
#include <tools/stream.hxx>
69
#endif
69
#endif
70
#ifndef _RTL_ALLOC_H
71
#include <rtl/alloc.h>
72
#endif
70
73
71
#ifndef _SV_JOBSET_HXX
74
#ifndef _SV_JOBSET_HXX
72
#include <jobset.hxx>
75
#include <jobset.hxx>
Lines 134-140 Link Here
134
	mnDriverDataLen 	= rJobSetup.mnDriverDataLen;
137
	mnDriverDataLen 	= rJobSetup.mnDriverDataLen;
135
	if ( rJobSetup.mpDriverData )
138
	if ( rJobSetup.mpDriverData )
136
	{
139
	{
137
		mpDriverData = new BYTE[mnDriverDataLen];
140
		mpDriverData = (BYTE*)rtl_allocateMemory( mnDriverDataLen );
138
		memcpy( mpDriverData, rJobSetup.mpDriverData, mnDriverDataLen );
141
		memcpy( mpDriverData, rJobSetup.mpDriverData, mnDriverDataLen );
139
	}
142
	}
140
	else
143
	else
Lines 146-152 Link Here
146
149
147
ImplJobSetup::~ImplJobSetup()
150
ImplJobSetup::~ImplJobSetup()
148
{
151
{
149
	delete[] mpDriverData;
152
	rtl_freeMemory( mpDriverData );
150
}
153
}
151
154
152
// =======================================================================
155
// =======================================================================
Lines 381-387 Link Here
381
				if ( pJobData->mnDriverDataLen )
384
				if ( pJobData->mnDriverDataLen )
382
				{
385
				{
383
					BYTE* pDriverData = ((BYTE*)pOldJobData) + nOldJobDataSize;
386
					BYTE* pDriverData = ((BYTE*)pOldJobData) + nOldJobDataSize;
384
					pJobData->mpDriverData = new BYTE[pJobData->mnDriverDataLen];
387
					pJobData->mpDriverData = (BYTE*)rtl_allocateMemory( pJobData->mnDriverDataLen );
385
					memcpy( pJobData->mpDriverData, pDriverData, pJobData->mnDriverDataLen );
388
					memcpy( pJobData->mpDriverData, pDriverData, pJobData->mnDriverDataLen );
386
				}
389
				}
387
				if( nSystem == JOBSET_FILE605_SYSTEM )
390
				if( nSystem == JOBSET_FILE605_SYSTEM )
(-)unx/source/gdi/salprnpsp.cxx (-4 / +51 lines)
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 ) )

Return to issue 15529