summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/print.hxx1
-rw-r--r--vcl/source/gdi/print3.cxx18
-rw-r--r--vcl/source/window/printdlg.cxx11
3 files changed, 26 insertions, 4 deletions
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index d67073ea3dcd..93a56a96f0c4 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -547,6 +547,7 @@ public:
VCL_DLLPRIVATE bool getReversePrint() const;
VCL_DLLPRIVATE void setPapersizeFromSetup( bool i_bPapersizeFromSetup );
VCL_DLLPRIVATE bool getPapersizeFromSetup() const;
+ VCL_DLLPRIVATE void setPaperSizeFromUser( Size i_aUserSize );
void setPrinterModified( bool i_bPapersizeFromSetup );
bool getPrinterModified() const;
VCL_DLLPRIVATE void pushPropertiesToPrinter();
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index e698ab9ee251..91306453977e 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -152,6 +152,7 @@ public:
bool mbLastPage;
bool mbReversePageOrder;
bool mbPapersizeFromSetup;
+ bool mbPapersizeFromUser;
bool mbPrinterModified;
css::view::PrintableState meJobState;
@@ -163,6 +164,8 @@ public:
// set by user through printer properties subdialog of printer settings dialog
Size maDefaultPageSize;
+ // set by user through print dialog
+ Size maUserPageSize;
// set by user through printer properties subdialog of printer settings dialog
sal_Int32 mnDefaultPaperBin;
// Set by user through printer properties subdialog of print dialog.
@@ -187,6 +190,7 @@ public:
mbLastPage( false ),
mbReversePageOrder( false ),
mbPapersizeFromSetup( false ),
+ mbPapersizeFromUser( false ),
mbPrinterModified( false ),
meJobState( css::view::PrintableState_JOB_STARTED ),
mpProgress( nullptr ),
@@ -197,6 +201,8 @@ public:
const Size& getRealPaperSize( const Size& i_rPageSize, bool bNoNUP ) const
{
+ if ( mbPapersizeFromUser )
+ return maUserPageSize;
if( mbPapersizeFromSetup )
return maDefaultPageSize;
if( maMultiPage.nRows * maMultiPage.nColumns > 1 && ! bNoNUP )
@@ -783,6 +789,7 @@ void PrinterController::setPrinter( const VclPtr<Printer>& i_rPrinter )
mpImplData->mxPrinter->Push();
mpImplData->mxPrinter->SetMapMode(MapMode(MapUnit::Map100thMM));
mpImplData->maDefaultPageSize = mpImplData->mxPrinter->GetPaperSize();
+ mpImplData->mbPapersizeFromUser = false;
mpImplData->mxPrinter->Pop();
mpImplData->mnFixedPaperBin = -1;
}
@@ -1362,6 +1369,8 @@ void PrinterController::setPapersizeFromSetup( bool i_bPapersizeFromSetup )
{
mpImplData->mbPapersizeFromSetup = i_bPapersizeFromSetup;
mpImplData->mxPrinter->SetPrinterSettingsPreferred( i_bPapersizeFromSetup );
+ if ( i_bPapersizeFromSetup )
+ mpImplData->mbPapersizeFromUser = !i_bPapersizeFromSetup;
}
bool PrinterController::getPapersizeFromSetup() const
@@ -1369,6 +1378,15 @@ bool PrinterController::getPapersizeFromSetup() const
return mpImplData->mbPapersizeFromSetup;
}
+void PrinterController::setPaperSizeFromUser( Size i_aUserSize )
+{
+ mpImplData->mbPapersizeFromUser = true;
+ mpImplData->mbPapersizeFromSetup = false;
+ mpImplData->mxPrinter->SetPrinterSettingsPreferred( false );
+
+ mpImplData->maUserPageSize = i_aUserSize;
+}
+
void PrinterController::setPrinterModified( bool i_bPrinterModified )
{
mpImplData->mbPrinterModified = i_bPrinterModified;
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 5951c8aff4c2..0f20dcccdb95 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -777,15 +777,15 @@ void PrintDialog::setPaperSizes()
{
mpPaperSizeBox->Clear();
+ VclPtr<Printer> aPrt( maPController->getPrinter() );
+ mePaper = aPrt->GetPaper();
+
if ( isPrintToFile() )
{
mpPaperSizeBox->Enable( false );
}
else
{
- VclPtr<Printer> aPrt( maPController->getPrinter() );
- mePaper = aPrt->GetPaper();
-
for (int nPaper = 0; nPaper < aPrt->GetPaperInfoCount(); nPaper++)
{
PaperInfo aInfo = aPrt->GetPaperInfo( nPaper );
@@ -1835,10 +1835,13 @@ IMPL_LINK( PrintDialog, SelectHdl, ListBox&, rBox, void )
PaperInfo aInfo = aPrt->GetPaperInfo( rBox.GetSelectedEntryPos() );
aInfo.doSloppyFit();
mePaper = aInfo.getPaper();
- aPrt->SetPaper( mePaper );
+
if ( mePaper == PAPER_USER )
aPrt->SetPaperSizeUser( Size( aInfo.getWidth(), aInfo.getHeight() ) );
+ else
+ aPrt->SetPaper( mePaper );
+ maPController->setPaperSizeFromUser( Size( aInfo.getWidth(), aInfo.getHeight() ) );
preparePreview();
}
}