22#include <osl/diagnose.h>
23#include <rtl/ustrbuf.hxx>
25#include <officecfg/Office/Common.hxx>
42#include <bitmaps.hlst>
48#include <com/sun/star/beans/PropertyValue.hpp>
65 bool lcl_ListBoxCompare(
const OUString& rStr1,
const OUString& rStr2 )
71PrintDialog::PrintPreviewWindow::PrintPreviewWindow(
PrintDialog* pDialog)
73 , maOrigSize( 10, 10 )
74 , mnDPIX(
Application::GetDefaultDevice()->GetDPIX())
75 , mnDPIY(
Application::GetDefaultDevice()->GetDPIY())
76 , mbGreyscale( false )
86 Size aNewSize(GetOutputSizePixel());
87 tools::Long nTextHeight = GetDrawingArea()->get_text_height();
95 Size aOrigSize( maOrigSize );
96 if( aOrigSize.
Width() < 1 )
98 if( aOrigSize.
Height() < 1 )
104 fScale = double(aNewSize.
Height())/double(aScaledSize.
Height());
110 fScale = double(aNewSize.
Width())/double(aScaledSize.
Width());
115 maPreviewSize = aScaledSize;
118 preparePreviewBitmap();
123 rRenderContext.
Push();
127 rRenderContext.
Erase();
130 Size aSize(GetOutputSizePixel());
131 Point aOffset((aSize.
Width() - maPreviewSize.Width() + nTextHeight) / 2,
132 (aSize.
Height() - maPreviewSize.Height() + nTextHeight) / 2);
138 auto nStart = aOffset.X() + (maPreviewSize.Width() - nWidth) / 2;
139 rRenderContext.
DrawText(
Point(nStart, aOffset.Y() - nTextHeight), maHorzText, 0, maHorzText.getLength());
142 auto nTop = aOffset.Y() - (nTextHeight / 2);
144 aDecoView.
DrawSeparator(
Point(nStart + nWidth + 2, nTop),
Point(aOffset.X() + maPreviewSize.Width(), nTop),
false);
154 auto nLeft = aOffset.X() - nTextHeight;
157 auto nStart = aOffset.Y() + (maPreviewSize.Height() + nWidth) / 2;
159 rRenderContext.
DrawText(
Point(nLeft, nStart), maVertText, 0, maVertText.getLength());
162 nLeft = aOffset.X() - (nTextHeight / 2);
166 rRenderContext.
Pop();
169 if (!maReplacementString.isEmpty())
173 rRenderContext.
DrawText(aTextRect, maReplacementString,
179 BitmapEx aPreviewBitmap(maPreviewBitmap);
193 rRenderContext.
Pop();
202 mpDialog->previewForward();
203 else if (pWheelData->
GetDelta() < 0)
204 mpDialog->previewBackward();
207 return CustomWidgetController::Command(rEvt);
211 const Size& i_rOrigSize,
212 std::u16string_view i_rPaperName,
213 const OUString& i_rReplacement,
219 maMtf = i_rNewPreview;
222 maOrigSize = i_rOrigSize;
223 maReplacementString = i_rReplacement;
224 mbGreyscale = i_bGreyscale;
236 OUString aNumText( rLocWrap.
getNum( aLogicPaperSize.
Width(), nDigits ) );
238 aBuf.append( aNumText +
" " );
240 if( !i_rPaperName.empty() )
243 aBuf.append( i_rPaperName );
246 maHorzText =
aBuf.makeStringAndClear();
248 aNumText = rLocWrap.
getNum( aLogicPaperSize.
Height(), nDigits );
249 aBuf.append( aNumText +
" " );
251 maVertText =
aBuf.makeStringAndClear();
255 maPreviewBitmap =
Bitmap();
266 if(maPreviewSize.IsEmpty())
275 const sal_uInt32 nMaxSquarePixels(500000);
279 const sal_uInt32 nCurrentSquarePixels(
282 static_cast<sal_uInt32
>(maPreviewBitmap.GetSizePixel().getWidth())
283 *
static_cast<sal_uInt32
>(maPreviewBitmap.GetSizePixel().getHeight())));
287 const sal_uInt32 nRequiredSquarePixels(
290 static_cast<sal_uInt32
>(maPreviewSize.getWidth())
291 *
static_cast<sal_uInt32
>(maPreviewSize.getHeight())));
298 static const double fPreventAwkwardFactor(1.35);
299 if(nCurrentSquarePixels >=
static_cast<sal_uInt32
>(nRequiredSquarePixels * fPreventAwkwardFactor))
310 if(nRequiredSquarePixels < 64)
318 static const double fExtraSpaceFactor(1.65);
319 const sal_uInt32 nPlannedSquarePixels(
322 static_cast<sal_uInt32
>(maPreviewSize.getWidth() * fExtraSpaceFactor)
323 *
static_cast<sal_uInt32
>(maPreviewSize.getHeight() * fExtraSpaceFactor)));
328 const double fRatio(
static_cast<double>(maPreviewSize.getWidth()) /
static_cast<double>(maPreviewSize.getHeight()));
329 const double fNewWidth(sqrt(
static_cast<double>(nPlannedSquarePixels) * fRatio));
330 const double fNewHeight(sqrt(
static_cast<double>(nPlannedSquarePixels) / fRatio));
337 const double fScaledSizeSquare(
static_cast<double>(aScaledSize.
getWidth() * aScaledSize.
getHeight()));
338 const double fPreviewSizeSquare(
static_cast<double>(maPreviewBitmap.GetSizePixel().getWidth() * maPreviewBitmap.GetSizePixel().getHeight()));
341 if(fPreviewSizeSquare != 0.0 && fabs((fScaledSizeSquare / fPreviewSizeSquare) - 1.0) < 0.001)
350 pPrerenderVDev->SetOutputSizePixel(aScaledSize,
false);
351 pPrerenderVDev->SetReferenceDevice( mnDPIX, mnDPIY );
354 Size aLogicSize( pPrerenderVDev->PixelToLogic( pPrerenderVDev->GetOutputSizePixel(),
MapMode( MapUnit::Map100thMM ) ) );
355 Size aOrigSize( maOrigSize );
356 if( aOrigSize.
Width() < 1 )
358 if( aOrigSize.
Height() < 1 )
360 double fScale = double(aLogicSize.
Width())/double(aOrigSize.
Width());
384 static const double fMinimumScale(0.2);
386 if(fScale < fMinimumScale)
388 fFactor = fMinimumScale / fScale;
389 fScale = fMinimumScale;
391 double fWidth(aScaledSize.
getWidth() * fFactor);
392 double fHeight(aScaledSize.
getHeight() * fFactor);
393 const double fNewNeededPixels(fWidth * fHeight);
400 static const double fMaximumQualitySquare(1396221.0);
402 if(fNewNeededPixels > fMaximumQualitySquare)
404 const double fCorrection(fMaximumQualitySquare/fNewNeededPixels);
405 fWidth *= fCorrection;
406 fHeight *= fCorrection;
407 fScale *= fCorrection;
411 pPrerenderVDev->SetOutputSizePixel(aScaledSize2,
false);
412 aLogicSize = pPrerenderVDev->PixelToLogic( aScaledSize2,
MapMode( MapUnit::Map100thMM ) );
415 pPrerenderVDev->EnableOutput();
417 pPrerenderVDev->Erase();
418 pPrerenderVDev->SetMapMode(
MapMode(MapUnit::Map100thMM));
420 pPrerenderVDev->SetDrawMode( pPrerenderVDev->GetDrawMode() |
427 aMtf.
Scale( fScale, fScale );
429 aMtf.
Play(*pPrerenderVDev,
Point(0, 0), aLogicSize);
431 pPrerenderVDev->SetMapMode(
MapMode(MapUnit::MapPixel));
432 maPreviewBitmap = pPrerenderVDev->GetBitmapEx(
Point(0, 0), pPrerenderVDev->GetOutputSizePixel());
454 CustomWidgetController::SetDrawingArea(pDrawingArea);
455 SetOutputSizePixel(aSize);
463 rRenderContext.
Erase();
465 int nPages = mnRows * mnColumns;
470 Size aOutSize(GetOutputSizePixel());
471 Size aSubSize(aOutSize.
Width() / mnColumns, aOutSize.
Height() / mnRows);
473 double fX = double(aSubSize.
Width()) / double(aSampleTextSize.
Width());
474 double fY = double(aSubSize.
Height()) / double(aSampleTextSize.
Height());
475 double fScale = (fX < fY) ? fX : fY;
482 for (
int i = 0;
i < nPages;
i++)
489 nX = (
i % mnColumns);
490 nY = (
i / mnColumns);
497 nX = mnColumns - 1 - (
i % mnColumns);
498 nY = (
i / mnColumns);
501 nX = mnColumns - 1 - (
i / mnRows);
506 int nDeltaX = (aSubSize.
Width() - aTextSize.
Width()) / 2;
507 int nDeltaY = (aSubSize.
Height() - aTextSize.
Height()) / 2;
604 std::sort( rQueues.begin(), rQueues.end(), lcl_ListBoxCompare );
605 for(
const auto& rQueue : rQueues )
616 OUString aValue( pItem->
getValue(
"PrintDialog",
721 officecfg::Office::Common::Print::Dialog::RangeSectionExpanded::get());
723 officecfg::Office::Common::Print::Dialog::LayoutSectionExpanded::get());
736 officecfg::Office::Common::Print::Dialog::RangeSectionExpanded::set(
mxRangeExpander->get_expanded(), batch);
737 officecfg::Office::Common::Print::Dialog::LayoutSectionExpanded::set(
mxLayoutExpander->get_expanded(), batch);
801 OUString aValue = pItem->
getValue(
"PrintDialog",
806 OString sPageId =
mxTabCtrl->get_page_ident(
i);
807 if (aValue ==
mxTabCtrl->get_tab_label_text(sPageId))
815 aValue = pItem->
getValue(
"PrintDialog",
817 if (!aValue.isEmpty())
821 aValue = pItem->
getValue(
"PrintDialog",
823 if( aValue.equalsIgnoreAsciiCase(
"alwaysoff") )
832 aValue = pItem->
getValue(
"PrintDialog",
834 mxCollateBox->set_active( aValue.equalsIgnoreAsciiCase(
"true") );
838 aValue = pItem->
getValue(
"PrintDialog",
839 "CollateSingleJobs" );
843 aValue = pItem->
getValue(
"PrintDialog",
845 if ( aValue.equalsIgnoreAsciiCase(
"false") )
884 OUString aWidth( rLocWrap.
getNum( aLogicPaperSize.
Width(), nDigits ) );
885 OUString aHeight( rLocWrap.
getNum( aLogicPaperSize.
Height(), nDigits ) );
886 OUString aUnit = eUnit ==
o3tl::Length::mm ? OUString(
"mm") : OUString(
"in");
894 aPaperName += aWidth + aUnit +
" x " + aHeight + aUnit;
933 preparePreview(
true);
938 preparePreview(
false);
957 mxPreview->setPreview( aMtf, aCurPageSize,
987 const MapMode aMapMode( MapUnit::Map100thMM );
989 aMtf.
Move( aOff.X(), aOff.Y() );
995 mxPreview->setPreview( aMtf, aCurPageSize,
1036 maPController->setOrientationFromUser( eOrientation, fromUser );
1052 OUString aImg(
mxCollateBox->get_active() ? OUString(SV_PRINT_COLLATE_BMP) : OUString(SV_PRINT_NOCOLLATE_BMP));
1065 bool bShouldbeEnabled =
maPController->isUIOptionEnabled( rEntry.second );
1072 bShouldbeEnabled =
maPController->isUIChoiceEnabled( rEntry.second, r_it->second );
1076 bool bIsEnabled = rEntry.first->get_sensitive();
1079 rEntry.first->set_sensitive( bShouldbeEnabled );
1092 sal_uInt16 nDigits = 0;
1095 eUnit = FieldUnit::INCH;
1153 Size aMultiSize( aPageSize.
Width() * nCols, aPageSize.
Height() * nRows );
1183 bool bCustom =
false;
1191 else if( nPages == 2 || nPages == 4 || nPages == 6 || nPages == 9 || nPages == 16 )
1194 bool bPortrait = aJobPageSize.
Width() < aJobPageSize.
Height();
1208 else if( nPages == 4 )
1210 else if( nPages == 6 )
1223 else if( nPages == 9 )
1225 else if( nPages == 16 )
1241 if( nSheetMargin > nHorzMax )
1242 nSheetMargin = nHorzMax;
1243 if( nSheetMargin > nVertMax )
1244 nSheetMargin = nVertMax;
1248 std::min(nHorzMax, nVertMax) ), FieldUnit::MM_100TH );
1251 nHorzMax = (aSize.
Width() - 2*nSheetMargin);
1253 nHorzMax /= (nCols-1);
1254 nVertMax = (aSize.
Height() - 2*nSheetMargin);
1256 nHorzMax /= (nRows-1);
1258 if( nPageMargin > nHorzMax )
1259 nPageMargin = nHorzMax;
1260 if( nPageMargin > nVertMax )
1261 nPageMargin = nVertMax;
1265 std::min(nHorzMax, nVertMax ) ), FieldUnit::MM_100TH );
1314 if( i_nIndex >= 0 && i_nIndex < i_rHelpIds.getLength() )
1322 if( i_nIndex >= 0 && i_nIndex < i_rHelpTexts.getLength() )
1330 for(
const auto& rOption : rOptions )
1332 if (rOption.Name ==
"OptionsUIFile")
1334 OUString sOptionsUIFile;
1335 rOption.Value >>= sOptionsUIFile;
1343 rOption.Value >>= aOptProp;
1349 OUString aPropertyName;
1355 sal_Int64 nMinValue = 0, nMaxValue = 0;
1356 OUString aGroupingHint;
1358 for(
const beans::PropertyValue& rEntry : std::as_const(aOptProp) )
1360 if ( rEntry.Name ==
"ID" )
1362 rEntry.Value >>= aIDs;
1365 if ( rEntry.Name ==
"Text" )
1367 rEntry.Value >>= aText;
1369 else if ( rEntry.Name ==
"ControlType" )
1371 rEntry.Value >>= aCtrlType;
1373 else if ( rEntry.Name ==
"Choices" )
1375 rEntry.Value >>= aChoices;
1377 else if ( rEntry.Name ==
"ChoicesDisabled" )
1379 rEntry.Value >>= aChoicesDisabled;
1381 else if ( rEntry.Name ==
"Property" )
1384 rEntry.Value >>= aVal;
1385 aPropertyName = aVal.Name;
1387 else if ( rEntry.Name ==
"Enabled" )
1390 else if ( rEntry.Name ==
"GroupingHint" )
1392 rEntry.Value >>= aGroupingHint;
1394 else if ( rEntry.Name ==
"DependsOnName" )
1397 else if ( rEntry.Name ==
"DependsOnEntry" )
1400 else if ( rEntry.Name ==
"AttachToDependency" )
1403 else if ( rEntry.Name ==
"MinValue" )
1405 rEntry.Value >>= nMinValue;
1407 else if ( rEntry.Name ==
"MaxValue" )
1409 rEntry.Value >>= nMaxValue;
1411 else if ( rEntry.Name ==
"HelpText" )
1413 if( ! (rEntry.Value >>= aHelpTexts) )
1416 if( rEntry.Value >>= aHelpText )
1418 aHelpTexts.realloc( 1 );
1419 *aHelpTexts.getArray() = aHelpText;
1423 else if ( rEntry.Name ==
"HelpId" )
1425 if( ! (rEntry.Value >>= aHelpIds ) )
1428 if( rEntry.Value >>= aHelpId )
1430 aHelpIds.realloc( 1 );
1431 *aHelpIds.getArray() = aHelpId;
1435 else if ( rEntry.Name ==
"HintNoLayoutPage" )
1437 bool bHasLayoutFrame =
false;
1438 rEntry.Value >>= bHasLayoutFrame;
1443 if (aCtrlType ==
"Group")
1451 mxTabCtrl->set_tab_label_text(aID, aText);
1454 if (aHelpIds.hasElements())
1458 if (aHelpTexts.hasElements())
1463 else if (aCtrlType ==
"Subgroup" && !aID.isEmpty())
1465 std::unique_ptr<weld::Widget> xWidget;
1467 if (aID ==
"fromwhich")
1469 std::unique_ptr<weld::Label> xLabel =
m_xBuilder->weld_label(aID);
1470 xLabel->set_label(aText);
1471 xWidget = std::move(xLabel);
1480 xFrame->set_label(aText);
1481 xWidget = std::move(
xFrame);
1489 setHelpId(xWidget.get(), aHelpIds, 0);
1491 setHelpText(xWidget.get(), aHelpTexts, 0);
1496 else if( aCtrlType ==
"Bool" && aGroupingHint ==
"LayoutPage" && aPropertyName ==
"PrintProspect" )
1502 PropertyValue* pVal =
maPController->getValue( aPropertyName );
1504 pVal->Value >>= bVal;
1516 else if (aCtrlType ==
"Bool")
1519 std::unique_ptr<weld::CheckButton> xNewBox =
m_xBuilder->weld_check_button(aID);
1525 xNewBox->set_label( aText );
1529 PropertyValue* pVal =
maPController->getValue( aPropertyName );
1531 pVal->Value >>= bVal;
1532 xNewBox->set_active( bVal );
1533 xNewBox->connect_toggled(
LINK(
this,
PrintDialog, UIOption_CheckHdl ) );
1543 setHelpId(pWidget, aHelpIds, 0);
1545 setHelpText(pWidget, aHelpTexts, 0);
1547 else if (aCtrlType ==
"Radio")
1549 sal_Int32 nCurHelpText = 0;
1552 sal_Int32 nSelectVal = 0;
1553 PropertyValue* pVal =
maPController->getValue( aPropertyName );
1554 if( pVal && pVal->Value.hasValue() )
1555 pVal->Value >>= nSelectVal;
1556 for( sal_Int32
m = 0;
m < aChoices.getLength();
m++ )
1559 std::unique_ptr<weld::RadioButton> xBtn =
m_xBuilder->weld_radio_button(aID);
1565 xBtn->set_label( aChoices[
m] );
1566 xBtn->set_active(
m == nSelectVal );
1567 xBtn->connect_toggled(
LINK(
this,
PrintDialog, UIOption_RadioHdl ) );
1568 if( aChoicesDisabled.getLength() >
m && aChoicesDisabled[
m] )
1569 xBtn->set_sensitive(
false );
1581 setHelpId( pWidget, aHelpIds, nCurHelpText );
1583 setHelpText( pWidget, aHelpTexts, nCurHelpText );
1587 else if ( aCtrlType ==
"List" )
1589 std::unique_ptr<weld::ComboBox> xList =
m_xBuilder->weld_combo_box(aID);
1596 for(
const auto& rChoice : std::as_const(aChoices) )
1597 xList->append_text(rChoice);
1599 sal_Int32 nSelectVal = 0;
1600 PropertyValue* pVal =
maPController->getValue( aPropertyName );
1601 if( pVal && pVal->Value.hasValue() )
1602 pVal->Value >>= nSelectVal;
1603 xList->set_active(nSelectVal);
1604 xList->connect_changed(
LINK(
this,
PrintDialog, UIOption_SelectHdl ) );
1615 setHelpId( pWidget, aHelpIds, 0 );
1617 setHelpText( pWidget, aHelpTexts, 0 );
1619 else if ( aCtrlType ==
"Range" )
1621 std::unique_ptr<weld::SpinButton> xField =
m_xBuilder->weld_spin_button(aID);
1628 if(nMinValue != nMaxValue)
1629 xField->set_range(nMinValue, nMaxValue);
1631 sal_Int64 nCurVal = 0;
1632 PropertyValue* pVal =
maPController->getValue( aPropertyName );
1633 if( pVal && pVal->Value.hasValue() )
1634 pVal->Value >>= nCurVal;
1635 xField->set_value( nCurVal );
1636 xField->connect_value_changed(
LINK(
this,
PrintDialog, UIOption_SpinModifyHdl ) );
1647 setHelpId( pWidget, aHelpIds, 0 );
1649 setHelpText( pWidget, aHelpTexts, 0 );
1651 else if (aCtrlType ==
"Edit")
1653 std::unique_ptr<weld::Entry> xField =
m_xBuilder->weld_entry(aID);
1660 PropertyValue* pVal =
maPController->getValue( aPropertyName );
1661 if( pVal && pVal->Value.hasValue() )
1662 pVal->Value >>= aCurVal;
1663 xField->set_text( aCurVal );
1664 xField->connect_changed(
LINK(
this,
PrintDialog, UIOption_EntryModifyHdl ) );
1675 setHelpId( pWidget, aHelpIds, 0 );
1677 setHelpText( pWidget, aHelpTexts, 0 );
1681 SAL_WARN(
"vcl",
"Unsupported UI option: \"" << aCtrlType <<
'"');
1714 OUString aDependency(
maPController->makeEnabled( it->second ) );
1715 if( !aDependency.isEmpty() )
1722 beans::PropertyValue* pValue =
maPController->getValue( i_rProperty );
1727 const auto& rWindows( it->second );
1728 if( rWindows.empty() )
1732 sal_Int32 nVal = -1;
1733 if( pValue->Value >>= bVal )
1741 else if ( i_rProperty ==
"PrintProspect" )
1751 SAL_WARN(
"vcl",
"missing a checkbox" );
1754 else if( pValue->Value >>= nVal )
1760 pList->
set_active(
static_cast< sal_uInt16
>(nVal) );
1765 SAL_WARN_IF( !pBtn,
"vcl",
"unexpected control for property" );
1794 PropertyValue* pVal =
nullptr;
1799 SAL_WARN_IF( !pVal,
"vcl",
"property value not found" );
1803 OSL_FAIL(
"changed control not in property map" );
1810 if (&rButton == mxPreviewBox.get())
1812 maUpdatePreviewIdle.Start();
1814 else if( &rButton == mxBorderCB.get() )
1818 else if (&rButton == mxSingleJobsBox.get())
1820 maPController->setValue(
"SinglePrintJobs",
1821 Any( isSingleJobs() ) );
1822 checkControlDependencies();
1824 else if( &rButton == mxCollateBox.get() )
1826 maPController->setValue(
"Collate",
1827 Any( isCollate() ) );
1828 checkControlDependencies();
1830 else if( &rButton == mxReverseOrderBox.get() )
1832 bool bChecked = mxReverseOrderBox->get_active();
1833 maPController->setReversePrint( bChecked );
1834 maPController->setValue(
"PrintReverse",
1836 maUpdatePreviewIdle.Start();
1838 else if (&rButton == mxBrochureBtn.get())
1840 PropertyValue* pVal = getValueForWindow(mxBrochureBtn.get());
1843 bool bVal = mxBrochureBtn->get_active();
1844 pVal->Value <<= bVal;
1846 checkOptionalControlDependencies();
1849 maUpdatePreviewNoCacheIdle.Start();
1851 if (mxBrochureBtn->get_active())
1853 mxOrientationBox->set_sensitive(
false );
1855 mxNupPagesBox->set_active( 0 );
1856 updateNupFromPages();
1857 showAdvancedControls(
false );
1858 enableNupControls(
false );
1862 mxOrientationBox->set_sensitive(
true );
1864 enableNupControls(
true );
1865 updateNupFromPages();
1873 if (&rButton == mxOKButton.get() || &rButton == mxCancelButton.get())
1878 else if( &rButton == mxHelpButton.get() )
1884 pHelp->
Start(
"vcl/ui/printdialog/PrintDialog", mxOKButton.get());
1887 else if( &rButton == mxForwardBtn.get() )
1891 else if( &rButton == mxBackwardBtn.get() )
1895 else if( &rButton == mxFirstBtn.get() )
1899 else if( &rButton == mxLastBtn.get() )
1905 if( &rButton == mxSetupButton.get() )
1907 maPController->setupPrinter(
m_xDialog.get());
1909 if ( !isPrintToFile() )
1920 if ( mePaper == ePaper )
1922 mxPaperSizeBox->set_active( nPaper );
1928 updateOrientationBox(
false );
1929 setupPaperSidesBox();
1932 maUpdatePreviewNoCacheIdle.Start();
1934 checkControlDependencies();
1941 if (&rBox == mxPrinters.get())
1943 if ( !isPrintToFile() )
1945 OUString aNewPrinter(rBox.get_active_text());
1948 maPController->resetPrinterOptions(
false );
1950 updateOrientationBox();
1953 mxOKButton->set_label(maPrintText);
1954 updatePrinterText();
1956 maUpdatePreviewIdle.Start();
1962 mxOKButton->set_label(maPrintToFileText);
1963 maPController->resetPrinterOptions(
true );
1966 updateOrientationBox();
1967 maUpdatePreviewIdle.Start();
1970 setupPaperSidesBox();
1972 else if ( &rBox == mxPaperSidesBox.get() )
1975 maPController->getPrinter()->SetDuplexMode( eDuplex );
1977 else if( &rBox == mxOrientationBox.get() )
1979 int nOrientation = mxOrientationBox->get_active();
1981 setPaperOrientation(
static_cast<Orientation>( nOrientation - 1 ),
true );
1985 else if ( &rBox == mxNupOrderBox.get() )
1989 else if( &rBox == mxNupPagesBox.get() )
1991 if( !mxPagesBtn->get_active() )
1992 mxPagesBtn->set_active(
true);
1993 updateNupFromPages(
false );
1995 else if ( &rBox == mxPaperSizeBox.get() )
2009 maUpdatePreviewIdle.Start();
2015 checkControlDependencies();
2016 updateNupFromPages();
2021 ActivateHdl(*mxPageEdit);
2026 sal_Int32 nPage = mxPageEdit->get_text().toInt32();
2030 mxPageEdit->set_text(
"1");
2032 else if (nPage > mnCachedPages)
2034 nPage = mnCachedPages;
2035 mxPageEdit->set_text(OUString::number(mnCachedPages));
2037 int nNewCurPage = nPage - 1;
2038 if (nNewCurPage != mnCurPage)
2040 mnCurPage = nNewCurPage;
2041 maUpdatePreviewIdle.Start();
2048 checkControlDependencies();
2049 if (&rEdit == mxNupRowsEdt.get() || &rEdit == mxNupColEdt.get())
2051 updateNupFromPages();
2053 else if( &rEdit == mxCopyCountField.get() )
2055 maPController->setValue(
"CopyCount",
2056 Any( sal_Int32(mxCopyCountField->get_value()) ) );
2057 maPController->setValue(
"Collate",
2058 Any( isCollate() ) );
2064 PropertyValue* pVal = getValueForWindow( &i_rBox );
2067 makeEnabled( &i_rBox );
2069 bool bVal = i_rBox.get_active();
2070 pVal->Value <<= bVal;
2072 checkOptionalControlDependencies();
2075 maUpdatePreviewNoCacheIdle.Start();
2084 if( !i_rBtn.get_active() )
2087 PropertyValue* pVal = getValueForWindow( &i_rBtn );
2088 auto it = maControlToNumValMap.find( &i_rBtn );
2089 if( !(pVal && it != maControlToNumValMap.end()) )
2092 makeEnabled( &i_rBtn );
2094 sal_Int32 nVal = it->second;
2095 pVal->Value <<= nVal;
2097 updateOrientationBox();
2099 checkOptionalControlDependencies();
2102 if (pVal->Name ==
"PrintContent" && mxPageRangesRadioButton->get_active())
2103 mxPageRangeEdit->grab_focus();
2106 maUpdatePreviewNoCacheIdle.Start();
2111 PropertyValue* pVal = getValueForWindow( &i_rBox );
2115 makeEnabled( &i_rBox );
2117 sal_Int32 nVal( i_rBox.get_active() );
2118 pVal->Value <<= nVal;
2125 if (pVal->Name ==
"PageContentType")
2126 maFirstPageSize =
Size();
2128 checkOptionalControlDependencies();
2131 maUpdatePreviewNoCacheIdle.Start();
2136 PropertyValue* pVal = getValueForWindow( &i_rBox );
2139 makeEnabled( &i_rBox );
2141 sal_Int64 nVal = i_rBox.get_value();
2142 pVal->Value <<= nVal;
2144 checkOptionalControlDependencies();
2147 maUpdatePreviewNoCacheIdle.Start();
2153 PropertyValue* pVal = getValueForWindow( &i_rBox );
2156 makeEnabled( &i_rBox );
2158 OUString aVal( i_rBox.get_text() );
2159 pVal->Value <<= aVal;
2161 checkOptionalControlDependencies();
2164 maUpdatePreviewNoCacheIdle.Start();
2201static OUString
getNewLabel(
const OUString& aLabel,
int i_nCurr,
int i_nMax)
2203 OUString aNewText(
aLabel.replaceFirst(
"%p", OUString::number( i_nCurr ) ) );
2204 aNewText = aNewText.replaceFirst(
"%n", OUString::number( i_nMax ) );
2211 : GenericDialogController(i_pParent,
"vcl/ui/printprogressdialog.ui",
"PrintProgressDialog")
2215 ,
mxText(m_xBuilder->weld_label(
"label"))
2216 , mxProgress(m_xBuilder->weld_progress_bar(
"progressbar"))
2217 , mxButton(m_xBuilder->weld_button(
"cancel"))
2227 mxText->set_size_request(
mxText->get_preferred_size().Width(), -1);
Reference< XExecutableDialog > m_xDialog
const StyleSettings & GetStyleSettings() const
Base class used mainly for the LibreOffice Desktop class.
static OutputDevice * GetDefaultDevice()
Get the default "device" (in this case the default window).
static const AllSettings & GetSettings()
Gets the application's settings.
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
static Help * GetHelp()
Gets the application's help.
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
Scale the bitmap.
CommandEventId GetCommand() const
const CommandWheelData * GetWheelData() const
tools::Long GetDelta() const
void DrawFrame(const tools::Rectangle &rRect, const Color &rLeftTopColor, const Color &rRightBottomColor)
void DrawSeparator(const Point &rStart, const Point &rStop, bool bVertical=true)
virtual bool Start(const OUString &rHelpId, weld::Widget *pWidget=nullptr)
virtual void Start(bool bStartTimer=true) override
Schedules the task for execution.
OUString getNum(sal_Int64 nNumber, sal_uInt16 nDecimals, bool bUseThousandSep=true, bool bTrailingZeros=true) const
MeasurementSystem getMeasurementSystemEnum() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
SAL_DLLPRIVATE sal_Int32 GetDPIX() const
Get the output device's DPI x-axis value.
const vcl::Font & GetFont() const
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
void SetFont(const vcl::Font &rNewFont)
SAL_DLLPRIVATE sal_Int32 GetDPIY() const
Get the output device's DPI y-axis value.
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
void SetTextColor(const Color &rColor)
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
void DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
const AllSettings & GetSettings() const
bool sloppyEqual(const PaperInfo &rOther) const
tools::Long getWidth() const
void doSloppyFit(bool bAlsoTryRotated=false)
tools::Long getHeight() const
static OUString GetDefaultPrinterName()
bool SetOrientation(Orientation eOrient)
const Point & GetPageOffsetPixel() const
void SetPaper(Paper ePaper)
Size GetPaperSize() const
static void updatePrinters()
Checks the printer list and updates it necessary.
int GetPaperInfoCount() const
static const std::vector< OUString > & GetPrinterQueues()
static OUString GetPaperName(Paper ePaper)
bool SetPaperSizeUser(const Size &rSize)
static const QueueInfo * GetQueueInfo(const OUString &rPrinterName, bool bStatusUpdate)
Size GetSizeOfPaper() const
const PaperInfo & GetPaperInfo(int nPaper) const
const Size & GetPaperSizePixel() const
const vcl::printer::Options & GetPrinterOptions() const
const OUString & GetPrinterName() const
constexpr tools::Long getHeight() const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
constexpr tools::Long getWidth() const
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
const Color & GetFieldTextColor() const
const vcl::Font & GetFieldFont() const
const vcl::Font & GetLabelFont() const
void SetPriority(TaskPriority ePriority)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
A construction helper for a temporary VclPtr.
static std::shared_ptr< ConfigurationChanges > create()
void SetFontSize(const Size &)
void SetOrientation(Degree10 nLineOrientation)
virtual ~PrintPreviewWindow() override
virtual void Resize() override
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
void setPreview(const GDIMetaFile &, const Size &i_rPaperSize, std::u16string_view i_rPaperName, const OUString &i_rNoPageString, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY, bool i_bGreyscale)
virtual bool Command(const CommandEvent &) override
void preparePreviewBitmap()
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &) override
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea) override
std::unique_ptr< weld::Image > mxCollateImage
std::unique_ptr< weld::CheckButton > mxSingleJobsBox
void updateOrientationBox(bool bAutomatic=true)
std::unique_ptr< weld::Label > mxNupNumPagesTxt
std::unique_ptr< weld::Frame > mxPageLayoutFrame
void setupPaperSidesBox()
std::unique_ptr< weld::Label > mxNupOrderTxt
std::unique_ptr< weld::MetricSpinButton > mxPageMarginEdt
std::vector< std::unique_ptr< weld::Widget > > maExtraControls
Idle maUpdatePreviewNoCacheIdle
void updateWindowFromProperty(const OUString &)
std::unique_ptr< weld::RadioButton > mxPageRangesRadioButton
std::unique_ptr< weld::Entry > mxPageEdit
bool isSingleJobs() const
std::unique_ptr< weld::CustomWeld > mxNupOrderWin
void enableNupControls(bool bEnable)
PrintDialog(weld::Window *, std::shared_ptr< PrinterController >)
std::unique_ptr< weld::MetricSpinButton > mxSheetMarginEdt
void showAdvancedControls(bool)
Size maFirstPageSize
internal, used for automatic Nup-Portrait/landscape
std::unique_ptr< weld::ComboBox > mxPrinters
std::unique_ptr< weld::Notebook > mxTabCtrl
bool hasOrientationChanged() const
std::unique_ptr< weld::ComboBox > mxNupPagesBox
std::shared_ptr< PrinterController > maPController
void updateNup(bool i_bMayUseCache=true)
std::unique_ptr< weld::CheckButton > mxBorderCB
border around each page
std::unique_ptr< weld::Label > mxPageMarginTxt1
std::unique_ptr< weld::Label > mxPagesBoxTitleTxt
std::unique_ptr< weld::SpinButton > mxNupColEdt
std::unique_ptr< weld::Button > mxBackwardBtn
virtual ~PrintDialog() override
std::map< weld::Widget *, OUString > maControlToPropertyMap
void makeEnabled(weld::Widget *)
std::map< OUString, std::vector< weld::Widget * > > maPropertyToWindowMap
std::unique_ptr< weld::ComboBox > mxNupOrderBox
std::unique_ptr< weld::ComboBox > mxOrientationBox
std::unique_ptr< weld::SpinButton > mxNupRowsEdt
std::unique_ptr< weld::Button > mxHelpButton
std::unique_ptr< weld::CheckButton > mxCollateBox
std::unique_ptr< weld::Button > mxSetupButton
std::unique_ptr< weld::Button > mxFirstBtn
std::unique_ptr< weld::CheckButton > mxReverseOrderBox
std::unique_ptr< weld::Label > mxSheetMarginTxt1
std::unique_ptr< weld::Button > mxLastBtn
std::unique_ptr< weld::SpinButton > mxCopyCountField
std::unique_ptr< weld::Label > mxSheetMarginTxt2
void setPaperOrientation(Orientation eOrientation, bool fromUser)
std::unique_ptr< weld::ComboBox > mxPaperSidesBox
std::unique_ptr< weld::Builder > mxCustomOptionsUIBuilder
std::unique_ptr< weld::RadioButton > mxPagesBtn
bool isPrintToFile() const
std::unique_ptr< weld::Label > mxNupTimesTxt
std::unique_ptr< weld::RadioButton > mxBrochureBtn
std::unique_ptr< weld::Label > mxStatusTxt
OUString maPrintToFileText
std::map< weld::Widget *, sal_Int32 > maControlToNumValMap
std::unique_ptr< ShowNupOrderWindow > mxNupOrder
std::unique_ptr< weld::ScrolledWindow > mxScrolledWindow
std::unique_ptr< weld::Expander > mxRangeExpander
void checkControlDependencies()
std::unique_ptr< weld::ComboBox > mxPaperSizeBox
void preparePreview(bool i_bMayUseCache)
std::unique_ptr< PrintPreviewWindow > mxPreview
void initFromMultiPageSetup(const vcl::PrinterController::MultiPageSetup &)
std::unique_ptr< weld::Expander > mxLayoutExpander
css::beans::PropertyValue * getValueForWindow(weld::Widget *) const
std::unique_ptr< weld::Label > mxPageMarginTxt2
std::unique_ptr< weld::Entry > mxPageRangeEdit
std::unique_ptr< weld::Widget > mxCustom
void updateNupFromPages(bool i_bMayUseCache=true)
std::unique_ptr< weld::CustomWeld > mxPreviewWindow
void checkOptionalControlDependencies()
std::unique_ptr< weld::Button > mxForwardBtn
std::unique_ptr< weld::Button > mxCancelButton
std::unique_ptr< weld::Button > mxOKButton
Size const & getJobPageSize()
std::unique_ptr< weld::Label > mxNumPagesText
std::unique_ptr< weld::CheckButton > mxPreviewBox
void setProgress(int i_nCurrent)
std::unique_ptr< weld::Button > mxButton
std::unique_ptr< weld::Label > mxText
std::unique_ptr< weld::ProgressBar > mxProgress
virtual ~PrintProgressDialog() override
PrintProgressDialog(weld::Window *i_pParent, int i_nMax)
OUString getValue(const OUString &rGroup, const OUString &rKey) const
static SettingsConfigItem * get()
void setValue(const OUString &rGroup, const OUString &rKey, const OUString &rValue)
A widget used to choose from a list of items.
virtual void set_active(int pos)=0
std::shared_ptr< weld::Dialog > m_xDialog
GenericDialogController(weld::Widget *pParent, const OUString &rUIFile, const OString &rDialogId, bool bMobile=false)
std::unique_ptr< weld::Builder > m_xBuilder
virtual void set_active(bool active)=0
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
#define LINK(Instance, Class, Member)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
B2IRange fround(const B2DRange &rRange)
const LocaleDataWrapper & GetLocaleDataWrapper(LanguageType nLang)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
sal_Int32 NaturalSortCompare(const OUString &rA, const OUString &rB)
IMPL_LINK(ORoadmap, ImplClickHdl, HyperLabel *, CurHyperLabel, void)
IMPL_LINK_NOARG(QuickSelectionEngine_Data, SearchStringTimeout, Timer *, void)
void SetPointFont(OutputDevice &rDevice, const vcl::Font &rFont)
Reference< text::XText > mxText
static OUString getNewLabel(const OUString &aLabel, int i_nCurr, int i_nMax)
tools::Long nHorizontalSpacing
tools::Long nBottomMargin
tools::Long nVerticalSpacing
bool bFullPaper
Full paper, not only imageable area is printed.
Reference< XFrame > xFrame
OUString VclResId(TranslateId aId)
@ POST_PAINT
Everything running directly after painting.