22 #include <strings.hrc>
23 #include <bitmaps.hlst>
40 #include <osl/diagnose.h>
41 #include <rtl/ustrbuf.hxx>
43 #include <com/sun/star/beans/PropertyValue.hpp>
60 bool lcl_ListBoxCompare(
const OUString& rStr1,
const OUString& rStr2 )
69 , maOrigSize( 10, 10 )
71 , mnDPIX(
Application::GetDefaultDevice()->GetDPIX())
72 , mnDPIY(
Application::GetDefaultDevice()->GetDPIY())
74 , maReplacementString()
75 , mbGreyscale( false )
85 Size aNewSize(GetOutputSizePixel());
86 tools::Long nTextHeight = GetDrawingArea()->get_text_height();
94 Size aOrigSize( maOrigSize );
95 if( aOrigSize.
Width() < 1 )
97 if( aOrigSize.
Height() < 1 )
103 fScale =
double(aNewSize.
Height())/
double(aScaledSize.
Height());
109 fScale =
double(aNewSize.
Width())/
double(aScaledSize.
Width());
114 maPreviewSize = aScaledSize;
117 preparePreviewBitmap();
124 CustomWidgetController::SetDrawingArea(pDrawingArea);
129 rRenderContext.
Push();
133 pDefaultDevice->SetPointFont(rRenderContext, aFont);
137 rRenderContext.
Erase();
140 Size aSize(GetOutputSizePixel());
141 Point aOffset((aSize.
Width() - maPreviewSize.Width() + nTextHeight) / 2,
142 (aSize.
Height() - maPreviewSize.Height() + nTextHeight) / 2);
148 auto nStart = aOffset.X() + (maPreviewSize.Width() - nWidth) / 2;
149 rRenderContext.
DrawText(
Point(nStart, aOffset.Y() - nTextHeight), maHorzText, 0, maHorzText.getLength());
152 auto nTop = aOffset.Y() - (nTextHeight / 2);
154 aDecoView.
DrawSeparator(
Point(nStart + nWidth + 2, nTop),
Point(aOffset.X() + maPreviewSize.Width(), nTop),
false);
164 auto nLeft = aOffset.X() - nTextHeight;
167 auto nStart = aOffset.Y() + (maPreviewSize.Height() + nWidth) / 2;
169 rRenderContext.
DrawText(
Point(nLeft, nStart), maVertText, 0, maVertText.getLength());
172 nLeft = aOffset.X() - (nTextHeight / 2);
176 rRenderContext.
Pop();
179 if (!maReplacementString.isEmpty())
183 rRenderContext.
DrawText(aTextRect, maReplacementString,
189 BitmapEx aPreviewBitmap(maPreviewBitmap);
203 rRenderContext.
Pop();
212 mpDialog->previewForward();
213 else if (pWheelData->
GetDelta() < 0)
214 mpDialog->previewBackward();
217 return CustomWidgetController::Command(rEvt);
221 const Size& i_rOrigSize,
222 const OUString& i_rPaperName,
223 const OUString& i_rReplacement,
229 maMtf = i_rNewPreview;
232 maOrigSize = i_rOrigSize;
233 maReplacementString = i_rReplacement;
234 mbGreyscale = i_bGreyscale;
238 MapUnit eUnit = MapUnit::MapMM;
242 eUnit = MapUnit::Map100thInch;
246 OUString aNumText( rLocWrap.
getNum( aLogicPaperSize.
Width(), nDigits ) );
248 aBuf.append( aNumText )
250 aBuf.appendAscii( eUnit == MapUnit::MapMM ?
"mm" :
"in" );
251 if( !i_rPaperName.isEmpty() )
254 aBuf.append( i_rPaperName );
257 maHorzText = aBuf.makeStringAndClear();
259 aNumText = rLocWrap.
getNum( aLogicPaperSize.
Height(), nDigits );
260 aBuf.append( aNumText )
262 aBuf.appendAscii( eUnit == MapUnit::MapMM ?
"mm" :
"in" );
263 maVertText = aBuf.makeStringAndClear();
267 maPreviewBitmap =
Bitmap();
278 if(maPreviewSize.IsEmpty())
287 const sal_uInt32 nMaxSquarePixels(500000);
291 const sal_uInt32 nCurrentSquarePixels(
294 static_cast<sal_uInt32>(maPreviewBitmap.GetSizePixel().getWidth())
295 * static_cast<sal_uInt32>(maPreviewBitmap.GetSizePixel().getHeight())));
299 const sal_uInt32 nRequiredSquarePixels(
302 static_cast<sal_uInt32>(maPreviewSize.getWidth())
303 * static_cast<sal_uInt32>(maPreviewSize.getHeight())));
310 static const double fPreventAwkwardFactor(1.35);
311 if(nCurrentSquarePixels >= static_cast<sal_uInt32>(nRequiredSquarePixels * fPreventAwkwardFactor))
322 if(nRequiredSquarePixels < 64)
330 static const double fExtraSpaceFactor(1.65);
331 const sal_uInt32 nPlannedSquarePixels(
334 static_cast<sal_uInt32>(maPreviewSize.getWidth() * fExtraSpaceFactor)
335 * static_cast<sal_uInt32>(maPreviewSize.getHeight() * fExtraSpaceFactor)));
340 const double fRatio(static_cast<double>(maPreviewSize.getWidth()) / static_cast<double>(maPreviewSize.getHeight()));
341 const double fNewWidth(sqrt(static_cast<double>(nPlannedSquarePixels) * fRatio));
342 const double fNewHeight(sqrt(static_cast<double>(nPlannedSquarePixels) / fRatio));
349 const double fScaledSizeSquare(static_cast<double>(aScaledSize.
getWidth() * aScaledSize.
getHeight()));
350 const double fPreviewSizeSquare(static_cast<double>(maPreviewBitmap.GetSizePixel().getWidth() * maPreviewBitmap.GetSizePixel().getHeight()));
353 if(fPreviewSizeSquare != 0.0 && fabs((fScaledSizeSquare / fPreviewSizeSquare) - 1.0) < 0.001)
361 pPrerenderVDev->SetOutputSizePixel(aScaledSize,
false);
362 pPrerenderVDev->SetReferenceDevice( mnDPIX, mnDPIY );
363 pPrerenderVDev->EnableOutput();
368 Size aVDevSize( pPrerenderVDev->GetOutputSizePixel() );
369 const Size aLogicSize( pPrerenderVDev->PixelToLogic( aVDevSize,
MapMode( MapUnit::Map100thMM ) ) );
370 Size aOrigSize( maOrigSize );
371 if( aOrigSize.Width() < 1 )
372 aOrigSize.setWidth( aLogicSize.Width() );
373 if( aOrigSize.Height() < 1 )
374 aOrigSize.setHeight( aLogicSize.Height() );
375 double fScale = double(aLogicSize.Width())/
double(aOrigSize.Width());
377 pPrerenderVDev->Erase();
378 pPrerenderVDev->Push();
379 pPrerenderVDev->SetMapMode(
MapMode(MapUnit::Map100thMM));
382 pPrerenderVDev->SetDrawMode( pPrerenderVDev->GetDrawMode() |
386 aMtf.
Scale( fScale, fScale );
391 aMtf.
Play( pPrerenderVDev.
get(),
Point( 0, 0 ), aLogicSize );
392 pPrerenderVDev->SetAntialiasing(nOriginalAA);
394 pPrerenderVDev->Pop();
396 pPrerenderVDev->SetMapMode(
MapMode(MapUnit::MapPixel));
398 maPreviewBitmap = pPrerenderVDev->GetBitmapEx(
Point(0, 0), aVDevSize);
400 pPrerenderVDev->SetDrawMode( nOldDrawMode );
414 CustomWidgetController::SetDrawingArea(pDrawingArea);
415 SetOutputSizePixel(aSize);
423 rRenderContext.
Erase();
425 int nPages = mnRows * mnColumns;
430 Size aOutSize(GetOutputSizePixel());
431 Size aSubSize(aOutSize.Width() / mnColumns, aOutSize.Height() / mnRows);
433 double fX = double(aSubSize.Width()) /
double(aSampleTextSize.Width());
434 double fY = double(aSubSize.Height()) /
double(aSampleTextSize.Height());
435 double fScale = (fX < fY) ? fX : fY;
439 aFont.SetFontSize(
Size( 0, nFontHeight));
442 for (
int i = 0;
i < nPages;
i++)
449 nX = (
i % mnColumns);
450 nY = (
i / mnColumns);
457 nX = mnColumns - 1 - (
i % mnColumns);
458 nY = (
i / mnColumns);
461 nX = mnColumns - 1 - (
i / mnRows);
466 int nDeltaX = (aSubSize.Width() - aTextSize.Width()) / 2;
467 int nDeltaY = (aSubSize.Height() - aTextSize.Height()) / 2;
468 rRenderContext.
DrawText(
Point(nX * aSubSize.Width() + nDeltaX,
469 nY * aSubSize.Height() + nDeltaY), aPageText);
565 std::sort( rQueues.begin(), rQueues.end(), lcl_ListBoxCompare );
566 for(
const auto& rQueue : rQueues )
577 OUString aValue( pItem->
getValue(
"PrintDialog",
758 OUString aValue = pItem->
getValue(
"PrintDialog",
761 for (sal_uInt16
i = 0;
i < nCount; ++
i)
763 OString sPageId =
mxTabCtrl->get_page_ident(
i);
764 if (aValue ==
mxTabCtrl->get_tab_label_text(sPageId))
772 aValue = pItem->
getValue(
"PrintDialog",
774 if (!aValue.isEmpty())
778 aValue = pItem->
getValue(
"PrintDialog",
780 if( aValue.equalsIgnoreAsciiCase(
"alwaysoff") )
789 aValue = pItem->
getValue(
"PrintDialog",
791 mxCollateBox->set_active( aValue.equalsIgnoreAsciiCase(
"true") );
795 aValue = pItem->
getValue(
"PrintDialog",
796 "CollateSingleJobs" );
800 aValue = pItem->
getValue(
"PrintDialog",
802 if ( aValue.equalsIgnoreAsciiCase(
"false") )
822 for (
int nPaper = 0; nPaper < aPrt->GetPaperInfoCount(); nPaper++)
824 PaperInfo aInfo = aPrt->GetPaperInfo( nPaper );
829 MapUnit eUnit = MapUnit::MapMM;
833 eUnit = MapUnit::Map100thInch;
836 Size aSize = aPrt->GetPaperSize( nPaper );
839 OUString aWidth( rLocWrap.
getNum( aLogicPaperSize.
Width(), nDigits ) );
840 OUString aHeight( rLocWrap.
getNum( aLogicPaperSize.
Height(), nDigits ) );
841 OUString aUnit = eUnit == MapUnit::MapMM ? OUString(
"mm") : OUString(
"in");
842 OUString aPaperName =
Printer::GetPaperName( ePaper ) +
" " + aWidth + aUnit +
" x " + aHeight + aUnit;
846 if ( ePaper == mePaper )
880 preparePreview(
true);
885 preparePreview(
false);
891 Size aCurPageSize = aPrt->PixelToLogic( aPrt->GetPaperSizePixel(),
MapMode( MapUnit::Map100thMM ) );
904 mxPreview->setPreview( aMtf, aCurPageSize,
907 aPrt->GetDPIX(), aPrt->GetDPIY(),
908 aPrt->GetPrinterOptions().IsConvertToGreyscales()
927 const MapMode aMapMode( MapUnit::Map100thMM );
934 Point aOff( aPrt->PixelToLogic( aPrt->GetPageOffsetPixel(), aMapMode ) );
935 aMtf.
Move( aOff.X(), aOff.Y() );
939 mxPreview->setPreview( aMtf, aCurPageSize,
942 aPrt->GetDPIX(), aPrt->GetDPIY(),
943 aPrt->GetPrinterOptions().IsConvertToGreyscales()
1019 OUString aImg(
mxCollateBox->get_active() ? OUString(SV_PRINT_COLLATE_BMP) : OUString(SV_PRINT_NOCOLLATE_BMP));
1032 bool bShouldbeEnabled =
maPController->isUIOptionEnabled( rEntry.second );
1034 if (bShouldbeEnabled && dynamic_cast<weld::RadioButton*>(rEntry.first))
1039 bShouldbeEnabled =
maPController->isUIChoiceEnabled( rEntry.second, r_it->second );
1043 bool bIsEnabled = rEntry.first->get_sensitive();
1045 if (bShouldbeEnabled != bIsEnabled)
1046 rEntry.first->set_sensitive( bShouldbeEnabled );
1059 sal_uInt16 nDigits = 0;
1062 eUnit = FieldUnit::INCH;
1120 Size aMultiSize( aPageSize.
Width() * nCols, aPageSize.
Height() * nRows );
1121 if( aMultiSize.Width() > aMultiSize.Height() )
1150 bool bCustom =
false;
1158 else if( nPages == 2 || nPages == 4 || nPages == 6 || nPages == 9 || nPages == 16 )
1161 bool bPortrait = aJobPageSize.
Width() < aJobPageSize.
Height();
1175 else if( nPages == 4 )
1177 else if( nPages == 6 )
1190 else if( nPages == 9 )
1192 else if( nPages == 16 )
1208 if( nSheetMargin > nHorzMax )
1209 nSheetMargin = nHorzMax;
1210 if( nSheetMargin > nVertMax )
1211 nSheetMargin = nVertMax;
1215 std::min(nHorzMax, nVertMax) ), FieldUnit::MM_100TH );
1218 nHorzMax = (aSize.
Width() - 2*nSheetMargin);
1220 nHorzMax /= (nCols-1);
1221 nVertMax = (aSize.
Height() - 2*nSheetMargin);
1223 nHorzMax /= (nRows-1);
1225 if( nPageMargin > nHorzMax )
1226 nPageMargin = nHorzMax;
1227 if( nPageMargin > nVertMax )
1228 nPageMargin = nVertMax;
1232 std::min(nHorzMax, nVertMax ) ), FieldUnit::MM_100TH );
1281 if( i_nIndex >= 0 && i_nIndex < i_rHelpIds.getLength() )
1289 if( i_nIndex >= 0 && i_nIndex < i_rHelpTexts.getLength() )
1297 for(
const auto& rOption : rOptions )
1299 if (rOption.Name ==
"OptionsUIFile")
1301 OUString sOptionsUIFile;
1302 rOption.Value >>= sOptionsUIFile;
1310 rOption.Value >>= aOptProp;
1316 OUString aPropertyName;
1322 sal_Int64 nMinValue = 0, nMaxValue = 0;
1323 OUString aGroupingHint;
1325 for(
const beans::PropertyValue& rEntry : std::as_const(aOptProp) )
1327 if ( rEntry.Name ==
"ID" )
1329 rEntry.Value >>= aIDs;
1332 if ( rEntry.Name ==
"Text" )
1334 rEntry.Value >>= aText;
1336 else if ( rEntry.Name ==
"ControlType" )
1338 rEntry.Value >>= aCtrlType;
1340 else if ( rEntry.Name ==
"Choices" )
1342 rEntry.Value >>= aChoices;
1344 else if ( rEntry.Name ==
"ChoicesDisabled" )
1346 rEntry.Value >>= aChoicesDisabled;
1348 else if ( rEntry.Name ==
"Property" )
1351 rEntry.Value >>= aVal;
1352 aPropertyName = aVal.Name;
1354 else if ( rEntry.Name ==
"Enabled" )
1357 else if ( rEntry.Name ==
"GroupingHint" )
1359 rEntry.Value >>= aGroupingHint;
1361 else if ( rEntry.Name ==
"DependsOnName" )
1364 else if ( rEntry.Name ==
"DependsOnEntry" )
1367 else if ( rEntry.Name ==
"AttachToDependency" )
1370 else if ( rEntry.Name ==
"MinValue" )
1372 rEntry.Value >>= nMinValue;
1374 else if ( rEntry.Name ==
"MaxValue" )
1376 rEntry.Value >>= nMaxValue;
1378 else if ( rEntry.Name ==
"HelpText" )
1380 if( ! (rEntry.Value >>= aHelpTexts) )
1383 if( rEntry.Value >>= aHelpText )
1385 aHelpTexts.realloc( 1 );
1386 *aHelpTexts.getArray() = aHelpText;
1390 else if ( rEntry.Name ==
"HelpId" )
1392 if( ! (rEntry.Value >>= aHelpIds ) )
1395 if( rEntry.Value >>= aHelpId )
1397 aHelpIds.realloc( 1 );
1398 *aHelpIds.getArray() = aHelpId;
1402 else if ( rEntry.Name ==
"HintNoLayoutPage" )
1404 bool bHasLayoutFrame =
false;
1405 rEntry.Value >>= bHasLayoutFrame;
1410 if (aCtrlType ==
"Group")
1418 mxTabCtrl->set_tab_label_text(aID, aText);
1421 if (aHelpIds.hasElements())
1425 if (aHelpTexts.hasElements())
1430 else if (aCtrlType ==
"Subgroup" && !aID.isEmpty())
1432 std::unique_ptr<weld::Widget> xWidget;
1434 if (aID ==
"fromwhich")
1436 std::unique_ptr<weld::Label> xLabel =
m_xBuilder->weld_label(aID);
1437 xLabel->set_label(aText);
1438 xWidget = std::move(xLabel);
1447 xFrame->set_label(aText);
1448 xWidget = std::move(xFrame);
1456 setHelpId(xWidget.get(), aHelpIds, 0);
1458 setHelpText(xWidget.get(), aHelpTexts, 0);
1463 else if( aCtrlType ==
"Bool" && aGroupingHint ==
"LayoutPage" && aPropertyName ==
"PrintProspect" )
1469 PropertyValue* pVal =
maPController->getValue( aPropertyName );
1471 pVal->Value >>= bVal;
1484 else if (aCtrlType ==
"Bool")
1487 std::unique_ptr<weld::CheckButton> xNewBox =
m_xBuilder->weld_check_button(aID);
1493 xNewBox->set_label( aText );
1497 PropertyValue* pVal =
maPController->getValue( aPropertyName );
1499 pVal->Value >>= bVal;
1500 xNewBox->set_active( bVal );
1501 xNewBox->connect_toggled(
LINK(
this,
PrintDialog, UIOption_CheckHdl ) );
1511 setHelpId(pWidget, aHelpIds, 0);
1513 setHelpText(pWidget, aHelpTexts, 0);
1515 else if (aCtrlType ==
"Radio")
1517 sal_Int32 nCurHelpText = 0;
1520 sal_Int32 nSelectVal = 0;
1521 PropertyValue* pVal =
maPController->getValue( aPropertyName );
1522 if( pVal && pVal->Value.hasValue() )
1523 pVal->Value >>= nSelectVal;
1524 for( sal_Int32
m = 0;
m < aChoices.getLength();
m++ )
1527 std::unique_ptr<weld::RadioButton> xBtn =
m_xBuilder->weld_radio_button(aID);
1533 xBtn->set_label( aChoices[m] );
1534 xBtn->set_active( m == nSelectVal );
1535 xBtn->connect_toggled(
LINK(
this,
PrintDialog, UIOption_RadioHdl ) );
1536 if( aChoicesDisabled.getLength() > m && aChoicesDisabled[m] )
1537 xBtn->set_sensitive(
false );
1549 setHelpId( pWidget, aHelpIds, nCurHelpText );
1551 setHelpText( pWidget, aHelpTexts, nCurHelpText );
1555 else if ( aCtrlType ==
"List" )
1557 std::unique_ptr<weld::ComboBox> xList =
m_xBuilder->weld_combo_box(aID);
1564 for(
const auto& rChoice : std::as_const(aChoices) )
1565 xList->append_text(rChoice);
1567 sal_Int32 nSelectVal = 0;
1568 PropertyValue* pVal =
maPController->getValue( aPropertyName );
1569 if( pVal && pVal->Value.hasValue() )
1570 pVal->Value >>= nSelectVal;
1571 xList->set_active(nSelectVal);
1572 xList->connect_changed(
LINK(
this,
PrintDialog, UIOption_SelectHdl ) );
1583 setHelpId( pWidget, aHelpIds, 0 );
1585 setHelpText( pWidget, aHelpTexts, 0 );
1587 else if ( aCtrlType ==
"Range" )
1589 std::unique_ptr<weld::SpinButton> xField =
m_xBuilder->weld_spin_button(aID);
1596 if(nMinValue != nMaxValue)
1597 xField->set_range(nMinValue, nMaxValue);
1599 sal_Int64 nCurVal = 0;
1600 PropertyValue* pVal =
maPController->getValue( aPropertyName );
1601 if( pVal && pVal->Value.hasValue() )
1602 pVal->Value >>= nCurVal;
1603 xField->set_value( nCurVal );
1604 xField->connect_value_changed(
LINK(
this,
PrintDialog, UIOption_SpinModifyHdl ) );
1615 setHelpId( pWidget, aHelpIds, 0 );
1617 setHelpText( pWidget, aHelpTexts, 0 );
1619 else if (aCtrlType ==
"Edit")
1621 std::unique_ptr<weld::Entry> xField =
m_xBuilder->weld_entry(aID);
1628 PropertyValue* pVal =
maPController->getValue( aPropertyName );
1629 if( pVal && pVal->Value.hasValue() )
1630 pVal->Value >>= aCurVal;
1631 xField->set_text( aCurVal );
1632 xField->connect_changed(
LINK(
this,
PrintDialog, UIOption_EntryModifyHdl ) );
1643 setHelpId( pWidget, aHelpIds, 0 );
1645 setHelpText( pWidget, aHelpTexts, 0 );
1649 SAL_WARN(
"vcl",
"Unsupported UI option: \"" << aCtrlType <<
'"');
1663 mxPagesBtn->set_accessible_relation_label_for(
nullptr);
1684 OUString aDependency(
maPController->makeEnabled( it->second ) );
1685 if( !aDependency.isEmpty() )
1692 beans::PropertyValue* pValue =
maPController->getValue( i_rProperty );
1697 const auto& rWindows( it->second );
1698 if( rWindows.empty() )
1702 sal_Int32 nVal = -1;
1703 if( pValue->Value >>= bVal )
1711 else if ( i_rProperty ==
"PrintProspect" )
1721 SAL_WARN(
"vcl",
"missing a checkbox" );
1724 else if( pValue->Value >>= nVal )
1730 pList->
set_active( static_cast< sal_uInt16 >(nVal) );
1732 else if( nVal >= 0 && nVal < sal_Int32(rWindows.size() ) )
1735 SAL_WARN_IF( !pBtn,
"vcl",
"unexpected control for property" );
1764 PropertyValue* pVal =
nullptr;
1769 SAL_WARN_IF( !pVal,
"vcl",
"property value not found" );
1773 OSL_FAIL(
"changed control not in property map" );
1785 if (&rButton == mxOKButton.get() || &rButton == mxCancelButton.get())
1790 else if( &rButton == mxHelpButton.get() )
1796 pHelp->
Start(
"vcl/ui/printdialog/PrintDialog", mxOKButton.get());
1799 else if ( &rButton == mxPreviewBox.get() )
1801 maUpdatePreviewIdle.Start();
1803 else if( &rButton == mxForwardBtn.get() )
1807 else if( &rButton == mxBackwardBtn.get() )
1811 else if( &rButton == mxFirstBtn.get() )
1815 else if( &rButton == mxLastBtn.get() )
1819 else if( &rButton == mxBrochureBtn.get() )
1821 PropertyValue* pVal = getValueForWindow( &rButton );
1824 bool bVal = mxBrochureBtn->get_active();
1825 pVal->Value <<= bVal;
1827 checkOptionalControlDependencies();
1830 maUpdatePreviewNoCacheIdle.Start();
1832 if( mxBrochureBtn->get_active() )
1834 mxOrientationBox->set_sensitive(
false );
1836 mxNupPagesBox->set_active( 0 );
1837 updateNupFromPages();
1838 showAdvancedControls(
false );
1839 enableNupControls(
false );
1842 else if( &rButton == mxPagesBtn.get() )
1844 mxOrientationBox->set_sensitive(
true );
1846 enableNupControls(
true );
1847 updateNupFromPages();
1849 else if( &rButton == mxCollateBox.get() )
1851 maPController->setValue(
"Collate",
1853 checkControlDependencies();
1855 else if( &rButton == mxSingleJobsBox.get() )
1857 maPController->setValue(
"SinglePrintJobs",
1859 checkControlDependencies();
1861 else if( &rButton == mxReverseOrderBox.get() )
1863 bool bChecked = mxReverseOrderBox->get_active();
1864 maPController->setReversePrint( bChecked );
1865 maPController->setValue(
"PrintReverse",
1867 maUpdatePreviewIdle.Start();
1869 else if( &rButton == mxBorderCB.get() )
1875 if( &rButton == mxSetupButton.get() )
1877 maPController->setupPrinter(
m_xDialog.get());
1879 if ( !isPrintToFile() )
1884 for (
int nPaper = 0; nPaper < aPrt->GetPaperInfoCount(); nPaper++ )
1886 PaperInfo aInfo = aPrt->GetPaperInfo( nPaper );
1890 if ( mePaper == ePaper )
1892 mxPaperSizeBox->set_active( nPaper );
1898 updateOrientationBox(
false );
1899 setupPaperSidesBox();
1902 maUpdatePreviewNoCacheIdle.Start();
1904 checkControlDependencies();
1911 if (&rBox == mxPrinters.get())
1913 if ( !isPrintToFile() )
1915 OUString aNewPrinter(rBox.get_active_text());
1918 maPController->resetPrinterOptions(
false );
1920 updateOrientationBox();
1923 mxOKButton->set_label(maPrintText);
1924 updatePrinterText();
1926 maUpdatePreviewIdle.Start();
1932 mxOKButton->set_label(maPrintToFileText);
1933 maPController->resetPrinterOptions(
true );
1936 updateOrientationBox();
1937 maUpdatePreviewIdle.Start();
1940 setupPaperSidesBox();
1942 else if ( &rBox == mxPaperSidesBox.get() )
1945 maPController->getPrinter()->SetDuplexMode( eDuplex );
1947 else if( &rBox == mxOrientationBox.get() )
1949 int nOrientation = mxOrientationBox->get_active();
1951 setPaperOrientation( static_cast<Orientation>( nOrientation - 1 ) );
1955 else if ( &rBox == mxNupOrderBox.get() )
1959 else if( &rBox == mxNupPagesBox.get() )
1961 if( !mxPagesBtn->get_active() )
1962 mxPagesBtn->set_active(
true);
1963 updateNupFromPages(
false );
1965 else if ( &rBox == mxPaperSizeBox.get() )
1968 PaperInfo aInfo = aPrt->GetPaperInfo( rBox.get_active() );
1969 aInfo.doSloppyFit();
1970 mePaper = aInfo.getPaper();
1975 aPrt->SetPaper( mePaper );
1977 Size aPaperSize( aInfo.getWidth(), aInfo.getHeight() );
1978 checkPaperSize( aPaperSize );
1979 maPController->setPaperSizeFromUser( aPaperSize );
1981 maUpdatePreviewIdle.Start();
1987 checkControlDependencies();
1988 updateNupFromPages();
1993 ActivateHdl(*mxPageEdit);
1998 sal_Int32 nPage = mxPageEdit->get_text().toInt32();
2002 mxPageEdit->set_text(
"1");
2004 else if (nPage > mnCachedPages)
2006 nPage = mnCachedPages;
2007 mxPageEdit->set_text(OUString::number(mnCachedPages));
2009 int nNewCurPage = nPage - 1;
2010 if (nNewCurPage != mnCurPage)
2012 mnCurPage = nNewCurPage;
2013 maUpdatePreviewIdle.Start();
2020 checkControlDependencies();
2021 if (&
rEdit == mxNupRowsEdt.get() || &
rEdit == mxNupColEdt.get())
2023 updateNupFromPages();
2025 else if( &
rEdit == mxCopyCountField.get() )
2027 maPController->setValue(
"CopyCount",
2028 makeAny( sal_Int32(mxCopyCountField->get_value()) ) );
2029 maPController->setValue(
"Collate",
2036 PropertyValue* pVal = getValueForWindow( &i_rBox );
2039 makeEnabled( &i_rBox );
2041 bool bVal = i_rBox.get_active();
2042 pVal->Value <<= bVal;
2044 checkOptionalControlDependencies();
2047 maUpdatePreviewNoCacheIdle.Start();
2056 if( !i_rBtn.get_active() )
2059 PropertyValue* pVal = getValueForWindow( &i_rBtn );
2060 auto it = maControlToNumValMap.find( &i_rBtn );
2061 if( !(pVal && it != maControlToNumValMap.end()) )
2064 makeEnabled( &i_rBtn );
2066 sal_Int32 nVal = it->second;
2067 pVal->Value <<= nVal;
2069 updateOrientationBox();
2071 checkOptionalControlDependencies();
2074 if (pVal->Name ==
"PrintContent" && mxPageRangesRadioButton->get_active())
2075 mxPageRangeEdit->grab_focus();
2078 maUpdatePreviewNoCacheIdle.Start();
2083 PropertyValue* pVal = getValueForWindow( &i_rBox );
2087 makeEnabled( &i_rBox );
2089 sal_Int32 nVal( i_rBox.get_active() );
2090 pVal->Value <<= nVal;
2097 if (pVal->Name ==
"PageContentType")
2098 maFirstPageSize =
Size();
2100 checkOptionalControlDependencies();
2103 maUpdatePreviewNoCacheIdle.Start();
2108 PropertyValue* pVal = getValueForWindow( &i_rBox );
2111 makeEnabled( &i_rBox );
2113 sal_Int64 nVal = i_rBox.get_value();
2114 pVal->Value <<= nVal;
2116 checkOptionalControlDependencies();
2119 maUpdatePreviewNoCacheIdle.Start();
2125 PropertyValue* pVal = getValueForWindow( &i_rBox );
2128 makeEnabled( &i_rBox );
2130 OUString aVal( i_rBox.get_text() );
2131 pVal->Value <<= aVal;
2133 checkOptionalControlDependencies();
2136 maUpdatePreviewNoCacheIdle.Start();
2145 mxPageEdit->set_text(OUString::number(nValue));
2155 mxPageEdit->set_text(OUString::number(nValue));
2173 static OUString
getNewLabel(
const OUString& aLabel,
int i_nCurr,
int i_nMax)
2175 OUString aNewText( aLabel.replaceFirst(
"%p", OUString::number( i_nCurr ) ) );
2176 aNewText = aNewText.replaceFirst(
"%n", OUString::number( i_nMax ) );
2183 : GenericDialogController(i_pParent,
"vcl/ui/printprogressdialog.ui",
"PrintProgressDialog")
2187 ,
mxText(m_xBuilder->weld_label(
"label"))
2188 , mxProgress(m_xBuilder->weld_progress_bar(
"progressbar"))
2189 , mxButton(m_xBuilder->weld_button(
"cancel"))
2199 mxText->set_size_request(
mxText->get_preferred_size().Width(), -1);
#define LINK(Instance, Class, Member)
std::shared_ptr< weld::Dialog > m_xDialog
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, MetricVector *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
PrintPreviewWindow(PrintDialog *pDialog)
void setPaperOrientation(Orientation eOrientation)
std::unique_ptr< weld::Widget > mxCustom
std::unique_ptr< weld::CheckButton > mxBorderCB
border around each page
OUString maPrintToFileText
std::unique_ptr< weld::Button > mxBackwardBtn
std::unique_ptr< weld::ComboBox > mxNupPagesBox
sal_Int32 NaturalSortCompare(const OUString &rA, const OUString &rB)
void SetFontSize(const Size &)
std::shared_ptr< PrinterController > maPController
std::unique_ptr< weld::MetricSpinButton > mxPageMarginEdt
std::unique_ptr< weld::RadioButton > mxBrochureBtn
std::unique_ptr< weld::Builder > m_xBuilder
void setWidth(tools::Long nWidth)
virtual ~PrintPreviewWindow() override
void checkOptionalControlDependencies()
tools::Long nHorizontalSpacing
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
std::unique_ptr< weld::Button > mxHelpButton
std::unique_ptr< weld::Button > mxFirstBtn
void showAdvancedControls(bool)
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static Help * GetHelp()
Gets the application's help.
void updateNupFromPages(bool i_bMayUseCache=true)
tools::Long getWidth() const
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
Scale the bitmap.
void checkPaperSize(Size &rPaperSize)
std::unique_ptr< weld::CheckButton > mxSingleJobsBox
std::unique_ptr< weld::ComboBox > mxNupOrderBox
tools::Long nVerticalSpacing
std::unique_ptr< weld::Label > mxPageMarginTxt2
std::unique_ptr< weld::Button > mxForwardBtn
void setPreview(const GDIMetaFile &, const Size &i_rPaperSize, const OUString &i_rPaperName, const OUString &i_rNoPageString, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY, bool i_bGreyscale)
Reference< XFrame > xFrame
const StyleSettings & GetStyleSettings() const
static const AllSettings & GetSettings()
Gets the application's settings.
std::unique_ptr< ShowNupOrderWindow > mxNupOrder
std::unique_ptr< weld::RadioButton > mxPageRangesRadioButton
void DrawFrame(const tools::Rectangle &rRect, const Color &rLeftTopColor, const Color &rRightBottomColor)
std::unique_ptr< weld::Expander > mxRangeExpander
static OUString GetDefaultPrinterName()
virtual ~PrintDialog() override
static weld::Builder * CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false)
static void updatePrinters()
Checks the printer list and updates it necessary.
std::unique_ptr< weld::Expander > mxLayoutExpander
Idle maUpdatePreviewNoCacheIdle
std::unique_ptr< weld::RadioButton > mxPagesBtn
const CommandWheelData * GetWheelData() const
std::map< OUString, std::vector< weld::Widget * > > maPropertyToWindowMap
std::unique_ptr< weld::CheckButton > mxReverseOrderBox
const vcl::Font & GetFieldFont() const
const Color & GetFieldTextColor() const
std::unique_ptr< weld::Button > mxCancelButton
void makeEnabled(weld::Widget *)
virtual void Resize() override
Everything running directly after painting.
static OutputDevice * GetDefaultDevice()
Get the default "device" (in this case the default window).
std::unique_ptr< weld::ComboBox > mxPaperSidesBox
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
void setProgress(int i_nCurrent)
std::vector< std::unique_ptr< weld::Widget > > maExtraControls
void updateOrientationBox(bool bAutomatic=true)
const vcl::Font & GetLabelFont() const
const vcl::Font & GetFont() const
std::unique_ptr< weld::Button > mxSetupButton
Size const & getJobPageSize()
virtual void Start() override
Activates the timer task.
std::unique_ptr< weld::ComboBox > mxOrientationBox
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
tools::Long nBottomMargin
void initFromMultiPageSetup(const vcl::PrinterController::MultiPageSetup &)
PrintProgressDialog(weld::Window *i_pParent, int i_nMax)
B2IRange fround(const B2DRange &rRange)
std::unique_ptr< weld::Entry > mxPageRangeEdit
bool SetPaperSizeUser(const Size &rSize)
tools::Long getHeight() const
std::unique_ptr< weld::ComboBox > mxPrinters
std::unique_ptr< weld::SpinButton > mxNupRowsEdt
std::unique_ptr< weld::CustomWeld > mxPreviewWindow
std::unique_ptr< weld::ProgressBar > mxProgress
void setValue(const OUString &rGroup, const OUString &rKey, const OUString &rValue)
virtual bool Command(const CommandEvent &) override
std::unique_ptr< weld::Label > mxSheetMarginTxt2
std::unique_ptr< weld::SpinButton > mxCopyCountField
void SetOrientation(Degree10 nLineOrientation)
std::unique_ptr< weld::Button > mxLastBtn
void checkControlDependencies()
bool hasOrientationChanged() const
std::unique_ptr< weld::Notebook > mxTabCtrl
virtual bool Start(const OUString &rHelpId, const vcl::Window *pWindow)
tools::Long Width() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
CommandEventId GetCommand() const
void SetTextColor(const Color &rColor)
Reference< text::XText > mxText
std::unique_ptr< weld::Label > mxNumPagesText
bool isPrintToFile() const
const LocaleDataWrapper & GetLocaleDataWrapper(LanguageType nLang)
OUString getValue(const OUString &rGroup, const OUString &rKey) const
std::unique_ptr< weld::CheckButton > mxCollateBox
virtual void set_active(int pos)=0
const AllSettings & GetSettings() const
Base class used mainly for the LibreOffice Desktop class.
std::unique_ptr< weld::Builder > mxCustomOptionsUIBuilder
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
std::unique_ptr< weld::CheckButton > mxPreviewBox
std::unique_ptr< weld::Label > mxNupNumPagesTxt
std::unique_ptr< weld::Label > mxPageMarginTxt1
std::unique_ptr< weld::Frame > mxPageLayoutFrame
void DrawSeparator(const Point &rStart, const Point &rStop, bool bVertical=true)
std::map< weld::Widget *, OUString > maControlToPropertyMap
std::unique_ptr< weld::Entry > mxPageEdit
static const std::vector< OUString > & GetPrinterQueues()
std::unique_ptr< weld::ScrolledWindow > mxScrolledWindow
std::unique_ptr< weld::Label > mxStatusTxt
A construction helper for a temporary VclPtr.
A widget used to choose from a list of items.
std::unique_ptr< weld::Label > mxPagesBoxTitleTxt
void preparePreviewBitmap()
const OUString & GetPrinterName() const
void updateWindowFromProperty(const OUString &)
#define SAL_WARN_IF(condition, area, stream)
css::beans::PropertyValue * getValueForWindow(weld::Widget *) const
void enableNupControls(bool bEnable)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
void SetFont(const vcl::Font &rNewFont)
std::unique_ptr< weld::CustomWeld > mxNupOrderWin
bool SetOrientation(Orientation eOrient)
void updateNup(bool i_bMayUseCache=true)
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
static OUString getNewLabel(const OUString &aLabel, int i_nCurr, int i_nMax)
std::unique_ptr< PrintPreviewWindow > mxPreview
std::unique_ptr< weld::MetricSpinButton > mxSheetMarginEdt
tools::Long AdjustWidth(tools::Long n)
std::unique_ptr< weld::Label > mxNupOrderTxt
std::unique_ptr< weld::Label > mxSheetMarginTxt1
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
Reference< XExecutableDialog > m_xDialog
tools::Long Height() const
std::unique_ptr< weld::Image > mxCollateImage
std::unique_ptr< weld::Button > mxMoreOptionsBtn
std::unique_ptr< weld::Label > mxNupTimesTxt
void SetInvokeHandler(const Link< Timer *, void > &rLink)
static const QueueInfo * GetQueueInfo(const OUString &rPrinterName, bool bStatusUpdate)
std::unique_ptr< weld::Button > mxOKButton
tools::Long AdjustHeight(tools::Long n)
std::map< weld::Widget *, sal_Int32 > maControlToNumValMap
std::unique_ptr< weld::ComboBox > mxPaperSizeBox
IMPL_LINK(ORoadmap, ImplClickHdl, HyperLabel *, CurHyperLabel, void)
std::unique_ptr< weld::Button > mxButton
void setHeight(tools::Long nHeight)
tools::Long GetDelta() const
reference_type * get() const
Get the body.
bool isSingleJobs() const
void setupPaperSidesBox()
#define SAL_WARN(area, stream)
OUString VclResId(const char *pId)
void SetPriority(TaskPriority ePriority)
OUString getNum(sal_Int64 nNumber, sal_uInt16 nDecimals, bool bUseThousandSep=true, bool bTrailingZeros=true) const
static OUString GetPaperName(Paper ePaper)
std::unique_ptr< weld::SpinButton > mxNupColEdt
bool bFullPaper
Full paper, not only imageable area is printed.
static SettingsConfigItem * get()
Size maFirstPageSize
internal, used for automatic Nup-Portrait/landscape
IMPL_LINK_NOARG(QuickSelectionEngine_Data, SearchStringTimeout, Timer *, void)
void Push(PushFlags nFlags=PushFlags::ALL)
PrintDialog(weld::Window *, const std::shared_ptr< PrinterController > &)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &) override
void preparePreview(bool i_bMayUseCache)
virtual ~PrintProgressDialog() override
GenericDialogController(weld::Widget *pParent, const OUString &rUIFile, const OString &rDialogId, bool bMobile=false)
MeasurementSystem getMeasurementSystemEnum() const
std::unique_ptr< weld::Label > mxText
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)