Kaydet (Commit) 3feb370b authored tarafından Clément Lassieur's avatar Clément Lassieur Kaydeden (comit) Katarina Behrens

tdf#63905: fix regression by using paper size set in printer properties

Change-Id: I51407c4b7ebbe3782539e1cb6f3c8294ae29566e
Reviewed-on: https://gerrit.libreoffice.org/13763Reviewed-by: 's avatarKatarina Behrens <bubli@bubli.org>
Tested-by: 's avatarKatarina Behrens <bubli@bubli.org>
üst 9f2e07aa
...@@ -161,6 +161,12 @@ namespace { ...@@ -161,6 +161,12 @@ namespace {
return GetBoolValue("PrintProspect", false); return GetBoolValue("PrintProspect", false);
} }
bool IsPrinterPreferred(DocumentType eDocType) const
{
bool bIsDraw = eDocType == DOCUMENT_TYPE_DRAW;
return IsTilePage() || IsPageSize() || IsBooklet() || (!bIsDraw && !IsNotes());
}
bool IsPrintExcluded() const bool IsPrintExcluded() const
{ {
return (IsNotes() || IsDraw() || IsHandout()) && IsHiddenPages(); return (IsNotes() || IsDraw() || IsHandout()) && IsHiddenPages();
...@@ -1359,9 +1365,7 @@ private: ...@@ -1359,9 +1365,7 @@ private:
PrintInfo& rInfo) PrintInfo& rInfo)
{ {
SdDrawDocument* pDocument = mrBase.GetMainViewShell()->GetDoc(); SdDrawDocument* pDocument = mrBase.GetMainViewShell()->GetDoc();
bool bIsDraw = pDocument->GetDocumentType() == DOCUMENT_TYPE_DRAW;
rInfo.meOrientation = ORIENTATION_PORTRAIT; rInfo.meOrientation = ORIENTATION_PORTRAIT;
bool bDoDodgyHeightWidthFit = mpOptions->IsBooklet() || (!bIsDraw && !mpOptions->IsNotes());
if( ! mpOptions->IsBooklet()) if( ! mpOptions->IsBooklet())
{ {
...@@ -1370,10 +1374,9 @@ private: ...@@ -1370,10 +1374,9 @@ private:
else if (rInfo.maPageSize.Width() < rInfo.maPageSize.Height()) else if (rInfo.maPageSize.Width() < rInfo.maPageSize.Height())
rInfo.meOrientation = ORIENTATION_LANDSCAPE; rInfo.meOrientation = ORIENTATION_LANDSCAPE;
// Draw and Notes should abide by their specified paper size, except // Draw and Notes should usually abide by their specified paper size
// for booklets
Size aPaperSize; Size aPaperSize;
if (!bDoDodgyHeightWidthFit) if (!mpOptions->IsPrinterPreferred(pDocument->GetDocumentType()))
{ {
aPaperSize.setWidth(rInfo.maPageSize.Width()); aPaperSize.setWidth(rInfo.maPageSize.Width());
aPaperSize.setHeight(rInfo.maPageSize.Height()); aPaperSize.setHeight(rInfo.maPageSize.Height());
...@@ -1386,7 +1389,7 @@ private: ...@@ -1386,7 +1389,7 @@ private:
maPrintSize = awt::Size(aPaperSize.Width(), aPaperSize.Height()); maPrintSize = awt::Size(aPaperSize.Width(), aPaperSize.Height());
if (bDoDodgyHeightWidthFit) if (mpOptions->IsPrinterPreferred(pDocument->GetDocumentType()))
{ {
if( (rInfo.meOrientation == ORIENTATION_LANDSCAPE && if( (rInfo.meOrientation == ORIENTATION_LANDSCAPE &&
(aPaperSize.Width() < aPaperSize.Height())) (aPaperSize.Width() < aPaperSize.Height()))
...@@ -1448,8 +1451,8 @@ private: ...@@ -1448,8 +1451,8 @@ private:
if (mpOptions->IsTime()) if (mpOptions->IsTime())
aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData()->getTime( ::tools::Time( ::tools::Time::SYSTEM ), false, false ); aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData()->getTime( ::tools::Time( ::tools::Time::SYSTEM ), false, false );
// Draw should use specified paper size when printing, except for booklets // Draw and Notes should usually use specified paper size when printing
if (!mpOptions->IsBooklet() && mrBase.GetDocShell()->GetDocumentType() == DOCUMENT_TYPE_DRAW) if (!mpOptions->IsPrinterPreferred(mrBase.GetDocShell()->GetDocumentType()))
{ {
aInfo.maPrintSize = mrBase.GetDocument()->GetSdPage(0, PK_STANDARD)->GetSize(); aInfo.maPrintSize = mrBase.GetDocument()->GetSdPage(0, PK_STANDARD)->GetSize();
maPrintSize = awt::Size(aInfo.maPrintSize.Width(), maPrintSize = awt::Size(aInfo.maPrintSize.Width(),
......
...@@ -1608,7 +1608,9 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton ) ...@@ -1608,7 +1608,9 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton )
if( pButton == maJobPage.mpSetupButton ) if( pButton == maJobPage.mpSetupButton )
{ {
maPController->setupPrinter( this ); maPController->setupPrinter( this );
preparePreview( true, true );
// tdf#63905 don't use cache: page size may change
preparePreview( true, false );
} }
checkControlDependencies(); checkControlDependencies();
} }
...@@ -1758,6 +1760,10 @@ IMPL_LINK( PrintDialog, UIOption_RadioHdl, RadioButton*, i_pBtn ) ...@@ -1758,6 +1760,10 @@ IMPL_LINK( PrintDialog, UIOption_RadioHdl, RadioButton*, i_pBtn )
sal_Int32 nVal = it->second; sal_Int32 nVal = it->second;
pVal->Value <<= nVal; pVal->Value <<= nVal;
// tdf#63905 use paper size set in printer properties
if (pVal->Name == "PageOptions")
maPController->resetPaperToLastConfigured();
checkOptionalControlDependencies(); checkOptionalControlDependencies();
// update preview and page settings // update preview and page settings
......
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