[Libreoffice-commits] core.git: Branch 'feature/print_revamp' - include/vcl vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Aug 10 19:35:02 UTC 2018
include/vcl/print.hxx | 1 +
vcl/source/gdi/print3.cxx | 18 ++++++++++++++++++
vcl/source/window/printdlg.cxx | 11 +++++++----
3 files changed, 26 insertions(+), 4 deletions(-)
New commits:
commit baa647b52b7984faff3ec7295ecd3407f7cc57ee
Author: Daniel <danielfaleirosilva at gmail.com>
AuthorDate: Mon Aug 6 10:50:17 2018 -0300
Commit: Daniel Silva <danielfaleirosilva at gmail.com>
CommitDate: Fri Aug 10 21:34:39 2018 +0200
Fix paper size combobox selection
Change-Id: I9682e0fcd58b45957e7f488e0b184475a39240c2
Reviewed-on: https://gerrit.libreoffice.org/58644
Tested-by: Jenkins
Reviewed-by: Daniel Silva <danielfaleirosilva at gmail.com>
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 21117df0a5fe..d4ec3219af3d 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -557,6 +557,7 @@ public:
SAL_DLLPRIVATE bool getReversePrint() const;
SAL_DLLPRIVATE void setPapersizeFromSetup( bool i_bPapersizeFromSetup );
SAL_DLLPRIVATE bool getPapersizeFromSetup() const;
+ SAL_DLLPRIVATE void setPaperSizeFromUser( Size i_aUserSize );
VCL_PLUGIN_PUBLIC void setPrinterModified( bool i_bPapersizeFromSetup );
VCL_PLUGIN_PUBLIC bool getPrinterModified() const;
SAL_DLLPRIVATE void pushPropertiesToPrinter();
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 69dc05d9a949..0405aeecabfb 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -151,6 +151,7 @@ public:
bool mbLastPage;
bool mbReversePageOrder;
bool mbPapersizeFromSetup;
+ bool mbPapersizeFromUser;
bool mbPrinterModified;
css::view::PrintableState meJobState;
@@ -162,6 +163,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.
@@ -186,6 +189,7 @@ public:
mbLastPage( false ),
mbReversePageOrder( false ),
mbPapersizeFromSetup( false ),
+ mbPapersizeFromUser( false ),
mbPrinterModified( false ),
meJobState( css::view::PrintableState_JOB_STARTED ),
mpProgress( nullptr ),
@@ -196,6 +200,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 )
@@ -785,6 +791,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;
}
@@ -1364,6 +1371,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
@@ -1371,6 +1380,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 7b9ff7f7cd80..ddc8589fd23a 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -776,15 +776,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 );
@@ -1834,10 +1834,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();
}
}
More information about the Libreoffice-commits
mailing list