Kaydet (Commit) 7a5bfde1 authored tarafından Caolán McNamara's avatar Caolán McNamara

Related: fdo#61186 ensure printer settings paper format is not clobbered

scenario 1: with attached test document

a file->printer settings->properties->paper
  set a paper size, ideally something not used in the test doc, e.g. Executive
b file->print->print
c file->printer settings->properties->paper
  the paper size here should now still be what was selected in a and
  *not* what happened to be the last page format used in the document
  which is letter

Change-Id: I66be32e2d03381dc2103479f1be46669a342a2ab
üst 6389bf38
......@@ -522,6 +522,7 @@ public:
SAL_DLLPRIVATE void setReversePrint( sal_Bool i_bReverse );
SAL_DLLPRIVATE bool getReversePrint() const;
SAL_DLLPRIVATE void pushPropertiesToPrinter();
SAL_DLLPRIVATE void resetPaperToLastConfigured();
VCL_PLUGIN_PUBLIC void setJobState( com::sun::star::view::PrintableState );
SAL_DLLPRIVATE bool setupPrinter( Window* i_pDlgParent );
......
......@@ -159,12 +159,14 @@ public:
ImplPageCache maPageCache;
// set by user through printer config dialog
// set by user through printer properties subdialog of printer settings dialog
Size maDefaultPageSize;
// Set by user through printer properties subdialog of print dialog.
// if set, pages are centered and trimmed onto the fixed page
Size maFixedPageSize;
// set by user through printer config dialog
// set by user through printer properties subdialog of printer settings dialog
sal_Int32 mnDefaultPaperBin;
// Set by user through printer preferences in print dialog.
// Set by user through printer properties subdialog of print dialog.
// Overrides application-set tray for a page.
sal_Int32 mnFixedPaperBin;
......@@ -203,6 +205,7 @@ public:
bool isFixedPageSize() const
{ return maFixedPageSize.Width() != 0 && maFixedPageSize.Height() != 0; }
PrinterController::PageSize modifyJobSetup( const Sequence< PropertyValue >& i_rProps, bool bNoNUP );
void resetPaperToLastConfigured();
};
PrinterController::PrinterController( const boost::shared_ptr<Printer>& i_pPrinter )
......@@ -502,6 +505,8 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pContr
pController->getPrinter()->StartJob( String( aJobName ), pController );
pController->resetPaperToLastConfigured();
pController->jobFinished( pController->getJobState() );
}
......@@ -756,10 +761,15 @@ void PrinterController::setPrinter( const boost::shared_ptr<Printer>& i_rPrinter
setValue( OUString( "Name" ),
makeAny( OUString( i_rPrinter->GetName() ) ) );
mpImplData->mnDefaultPaperBin = mpImplData->mpPrinter->GetPaperBin();
mpImplData->mpPrinter->Push();
mpImplData->mpPrinter->SetMapMode(MapMode(MAP_100TH_MM));
mpImplData->maDefaultPageSize = mpImplData->mpPrinter->GetPaperSize();
mpImplData->mpPrinter->Pop();
mpImplData->mnFixedPaperBin = -1;
mpImplData->maFixedPageSize = Size();
}
void PrinterController:: resetPrinterOptions( bool i_bFileOutput )
void PrinterController::resetPrinterOptions( bool i_bFileOutput )
{
PrinterOptions aOpt;
aOpt.ReadFromConfig( i_bFileOutput );
......@@ -861,6 +871,28 @@ PrinterController::PageSize vcl::ImplPrinterControllerData::modifyJobSetup( cons
return aPageSize;
}
//fdo#61886
//
//when printing is finished, set the paper size of the printer to either what
//the user explicitly set as the desired paper size, or fallback to whatever
//the printer had before printing started. That way it doesn't contain the last
//paper size of a multiple paper size using document when we are in our normal
//auto accept document paper size mode and end up overwriting the original
//paper size setting for file->printer_settings just by pressing "ok" in the
//print dialog
void vcl::ImplPrinterControllerData::resetPaperToLastConfigured()
{
Size aPaperSize(maDefaultPageSize);
if (maFixedPageSize.Width() > 0 && maFixedPageSize.Height() > 0)
aPaperSize = maFixedPageSize;
mpPrinter->Push();
mpPrinter->SetMapMode(MapMode(MAP_100TH_MM));
Size aCurSize(mpPrinter->GetPaperSize());
if (aPaperSize != aCurSize)
mpPrinter->SetPaperSizeUser(aPaperSize, !isFixedPageSize());
mpPrinter->Pop();
}
int PrinterController::getPageCountProtected() const
{
const MapMode aMapMode( MAP_100TH_MM );
......@@ -1604,6 +1636,11 @@ const PrinterController::MultiPageSetup& PrinterController::getMultipage() const
return mpImplData->maMultiPage;
}
void PrinterController::resetPaperToLastConfigured()
{
mpImplData->resetPaperToLastConfigured();
}
void PrinterController::pushPropertiesToPrinter()
{
sal_Int32 nCopyCount = 1;
......
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