// Related: tdf#163126 a printer is not needed to use the native // macOS print dialog so if the printer is nil, use the native // default printer instead. if( !mpPrinter )
mpPrinter = [NSPrintInfo defaultPrinter]; if( !mpPrinter && pShared )
mpPrinter = [pShared printer]; if( mpPrinter )
[mpPrinter retain];
// possibly create one job for collated output bool bSinglePrintJobs = i_rController.getPrinter()->IsSinglePrintJobs();
// FIXME: jobStarted() should be done after the print dialog has ended (if there is one) // how do I know when that might be ?
i_rController.jobStarted();
int nCopies = i_rController.getPrinter()->GetCopyCount(); int nJobs = 1; if( bSinglePrintJobs )
{
nJobs = nCopies;
nCopies = 1;
}
Size aCurSize( 21000, 29700 ); if( nAllPages > 0 )
{ // Related: tdf#159995 use filtered page sizes so that // printing multiple pages per sheet in LibreOffice's // non-native print dialog uses the correct paper size. // Note: to use LibreOffice's non-native print dialog, // set "UseSystemPrintDialog" to "false" in LibreOffice's // Expert Configuration dialog and restart.
GDIMetaFile aPageFile;
mnCurPageRangeCount = 1;
aCurSize = i_rController.getFilteredPageFile( mnCurPageRangeStart, aPageFile ).aSize;
Size aNextSize( aCurSize );
// print pages up to a different size while( mnCurPageRangeStart + mnCurPageRangeCount < nAllPages )
{
aNextSize = i_rController.getFilteredPageFile( mnCurPageRangeStart + mnCurPageRangeCount, aPageFile ).aSize; if( aCurSize == aNextSize // same page size
||
(aCurSize.Width() == aNextSize.Height() && aCurSize.Height() == aNextSize.Width()) // same size, but different orientation
)
{
mnCurPageRangeCount++;
} else break;
}
} else
mnCurPageRangeCount = 0;
// now for the current run
mnStartPageOffsetX = mnStartPageOffsetY = 0; // setup the paper size and orientation // do this on our associated Printer object, since that is // out interface to the applications which occasionally rely on the paper // information (e.g. brochure printing scales to the found paper size) // also SetPaperSizeUser has the advantage that we can share a // platform independent paper matching algorithm
VclPtr<Printer> pPrinter( i_rController.getPrinter() );
pPrinter->SetMapMode( MapMode( MapUnit::Map100thMM ) );
pPrinter->SetPaperSizeUser( aCurSize );
[pPrintDict setObject: [[NSNumber numberWithInt: nCopies] autorelease] forKey: NSPrintCopies]; if( nCopies > 1 )
[pPrintDict setObject: [[NSNumber numberWithBool: pPrinter->IsCollateCopy()] autorelease] forKey: NSPrintMustCollate];
[pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting];
[pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage]; // #i103253# weird: for some reason, autoreleasing the value below like the others above // leads do a double free malloc error. Why this value should behave differently from all the others // is a mystery.
[pPrintDict setObject: [NSNumber numberWithInt: mnCurPageRangeCount] forKey: NSPrintLastPage];
// set job title (since MacOSX 10.5) if( [pPrintOperation respondsToSelector: @selector(setJobTitle:)] )
[pPrintOperation performSelector: @selector(setJobTitle:) withObject: [CreateNSString( i_rJobName ) autorelease]];
if( bShowPanel && mnCurPageRangeStart == 0 && nCurJob == 0) // only the first range of pages (in the first job) gets the accessory view
pReleaseAfterUse = [AquaPrintAccessoryView setupPrinterPanel: pPrintOperation withController: &i_rController withState: &aAccViewState];
// When the last page has a page size change, one more loop // still needs to run so set mnCurPageRangeCount to zero. if( !aAccViewState.bNeedRestart )
mnCurPageRangeStart += mnCurPageRangeCount;
mnCurPageRangeCount = 0;
} while( ( !bWasAborted || aAccViewState.bNeedRestart ) && mnCurPageRangeStart + mnCurPageRangeCount < nAllPages );
}
// inform application that it can release its data // this is awkward, but the XRenderable interface has no method for this, // so we need to call XRenderable::render one last time with IsLastPage = true
i_rController.setLastPage( true );
GDIMetaFile aPageFile; if( mrContext )
SetupPrinterGraphics( mrContext );
i_rController.getFilteredPageFile( 0, aPageFile );
const PaperInfo* pMatch = nullptr;
o_rOrientation = Orientation::Portrait; for( int n = 0; n < 2 ; n++ )
{ for( size_t i = 0; i < m_aPaperFormats.size(); i++ )
{ // Related: tdf#163126 expand match range to 1/10th of an inch // The A4 page size in Apple's "no printer installed" printer // can differ from LibreOffice's A4 page size by more than a // millimeter so increase the match range to 1/10th of an inch // since an A4 match would fail when using the previous 0.5 // millimeter match range. if( std::abs( m_aPaperFormats[i].getWidth() - i_nWidth ) < 254 &&
std::abs( m_aPaperFormats[i].getHeight() - i_nHeight ) < 254 )
{
pMatch = &m_aPaperFormats[i]; return pMatch;
}
}
o_rOrientation = Orientation::Landscape;
std::swap( i_nWidth, i_nHeight );
} return pMatch;
}
int AquaSalInfoPrinter::GetLandscapeAngle( const ImplJobSetup* )
{ return900;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.