summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Funk <juergen.funk_ml@cib.de>2020-09-04 10:53:44 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-09-10 12:11:11 +0200
commit72c1c84e14ffc8127f24930066220e7c7b28a970 (patch)
treecc3877d8429e789b96837ac28c803f7ba1067a8a
parenttdf#108673 XLSX: Don't export invalid sheet references in cell validation (diff)
downloadcore-72c1c84e14ffc8127f24930066220e7c7b28a970.tar.gz
core-72c1c84e14ffc8127f24930066220e7c7b28a970.zip
tdf#127932 fix wrong page number in print progress
- in ctor, reset start pages to non-inflated value after size calculation - update label, _then_ progress in setProgress() Change-Id: I66576e339de814922512b68167e6c0a9b1025378 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102031 Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit 63bf8f042abe3c0f6989f6763d13f5389182b816) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102281 Tested-by: Jenkins
-rw-r--r--vcl/source/window/printdlg.cxx24
1 files changed, 17 insertions, 7 deletions
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 7d340559806a..1515b8b74264 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -2159,6 +2159,15 @@ void PrintDialog::previewLast()
ActivateHdl(*mxPageEdit);
}
+
+static OUString getNewLabel(const OUString& aLabel, int i_nCurr, int i_nMax)
+{
+ OUString aNewText( aLabel.replaceFirst( "%p", OUString::number( i_nCurr ) ) );
+ aNewText = aNewText.replaceFirst( "%n", OUString::number( i_nMax ) );
+
+ return aNewText;
+}
+
// PrintProgressDialog
PrintProgressDialog::PrintProgressDialog(weld::Window* i_pParent, int i_nMax)
: GenericDialogController(i_pParent, "vcl/ui/printprogressdialog.ui", "PrintProgressDialog")
@@ -2176,15 +2185,17 @@ PrintProgressDialog::PrintProgressDialog(weld::Window* i_pParent, int i_nMax)
//just multiply largest value by 10 and take the width of that string as
//the max size we will want
- OUString aNewText( maStr.replaceFirst( "%p", OUString::number( mnMax * 10 ) ) );
- aNewText = aNewText.replaceFirst( "%n", OUString::number( mnMax * 10 ) );
- mxText->set_label( aNewText );
+ mxText->set_label(getNewLabel(maStr, mnMax * 10, mnMax * 10));
mxText->set_size_request(mxText->get_preferred_size().Width(), -1);
//Pick a useful max width
mxProgress->set_size_request(mxProgress->get_approximate_digit_width() * 25, -1);
mxButton->connect_clicked( LINK( this, PrintProgressDialog, ClickHdl ) );
+
+ // after this patch f7157f04fab298423e2c4f6a7e5f8e361164b15f, we have seen the calc Max string (sometimes) look above
+ // now init to the right start vaules
+ mxText->set_label(getNewLabel(maStr, mnCur, mnMax));
}
PrintProgressDialog::~PrintProgressDialog()
@@ -2203,11 +2214,10 @@ void PrintProgressDialog::setProgress( int i_nCurrent )
if( mnMax < 1 )
mnMax = 1;
- mxProgress->set_percentage(mnCur*100/mnMax);
+ mxText->set_label(getNewLabel(maStr, mnCur, mnMax));
- OUString aNewText( maStr.replaceFirst( "%p", OUString::number( mnCur ) ) );
- aNewText = aNewText.replaceFirst( "%n", OUString::number( mnMax ) );
- mxText->set_label( aNewText );
+ // here view the dialog, with the right label
+ mxProgress->set_percentage(mnCur*100/mnMax);
}
void PrintProgressDialog::tick()