20#ifndef INCLUDED_VCL_PRINT_HXX
21#define INCLUDED_VCL_PRINT_HXX
26#include <rtl/ustring.hxx>
40#include <com/sun/star/beans/PropertyValue.hpp>
41#include <com/sun/star/uno/Sequence.hxx>
42#include <com/sun/star/view/PrintableState.hpp>
45#include <unordered_map>
56 class PrinterController;
67 friend class ::OutputDevice;
99 ImplGetQueueInfo(
const OUString& rPrinterName,
const OUString* pDriver );
104 VCL_DLLPRIVATE bool StartJob(
const OUString& rJobName, std::shared_ptr<vcl::PrinterController>
const & );
109 SAL_DLLPRIVATE
void ImplPrintTransparent (
111 const Point& rDestPt,
const Size& rDestSize,
112 const Point& rSrcPtPixel,
const Size& rSrcSizePixel );
126 void ImplReleaseGraphics(
bool bRelease =
true);
157 const Point& rDestPt,
const Size& rDestSize,
158 const Point& rSrcPtPixel,
const Size& rSrcSizePixel)
override;
161 const BitmapEx& rBitmapEx,
double fAlpha = 1.0)
override;
167 const Point& rSrcPtPixel,
const Size& rSrcSizePixel,
171 sal_uInt16 nTransparencePercent )
override;
183 Printer(
const OUString& rPrinterName );
185 virtual void dispose()
override;
189 static const std::vector< OUString >&
191 static const QueueInfo* GetQueueInfo(
const OUString& rPrinterName,
bool bStatusUpdate );
192 static OUString GetDefaultPrinterName();
194 const OUString&
GetName()
const {
return maPrinterName; }
198 bool IsValid()
const {
return !IsDisplayPrinter(); }
203 bool SetJobSetup(
const JobSetup& rSetup );
208 bool SetPrinterProps(
const Printer* pPrinter );
228 bool SetPaperBin( sal_uInt16 nPaperBin );
229 sal_uInt16 GetPaperBin()
const;
231 bool SetPaperSizeUser(
const Size& rSize );
233 Paper GetPaper()
const;
235 Size GetSizeOfPaper()
const;
236 static OUString GetPaperName(
Paper ePaper );
239 int GetPaperInfoCount()
const;
242 const PaperInfo& GetPaperInfo(
int nPaper )
const;
243 sal_uInt16 GetPaperBinCount()
const;
244 OUString GetPaperBinName( sal_uInt16 nPaperBin )
const;
246 bool GetPrinterSettingsPreferred()
const;
247 void SetPrinterSettingsPreferred(
bool bPaperSizeFromSetup );
251 Size GetPaperSize(
int nPaper )
const;
255 void SetCopyCount( sal_uInt16 nCopy,
bool bCollate );
269 static void updatePrinters();
275 static void PrintJob(
const std::shared_ptr<vcl::PrinterController>& i_pController,
281 const Point& rSrcPt,
const Size& rSrcSize )
override;
284 const Point& rSrcPt,
const Size& rSrcSize,
288 const Size& rSrcSize,
bool bWindowInvalidate =
false )
override;
294 static bool PreparePrintJob( std::shared_ptr<vcl::PrinterController> i_pController,
296 static bool ExecutePrintJob(
const std::shared_ptr<vcl::PrinterController>& i_pController);
297 static void FinishPrintJob(
const std::shared_ptr<vcl::PrinterController>& i_pController );
303 static void VCL_DLLPRIVATE ImplPrintJob(
const std::shared_ptr<vcl::PrinterController>& i_pController,
309class ImplPrinterControllerData;
318 std::unique_ptr<ImplPrinterControllerData>
339 : nRows( 1 ), nColumns( 1 ), aPaperSize( 21000, 29700 )
342 , nHorizontalSpacing( 0 ), nVerticalSpacing( 0 )
343 , bDrawBorder( false )
356 bool i_bFullPaper =
false)
357 : aSize( i_rSize ), bFullPaper( i_bFullPaper ) {}
372 css::uno::Sequence< css::beans::PropertyValue >
373 getJobProperties(
const css::uno::Sequence< css::beans::PropertyValue >& i_rMergeList )
const;
376 css::beans::PropertyValue*
getValue(
const OUString& i_rPropertyName );
377 const css::beans::PropertyValue*
getValue(
const OUString& i_rPropertyName )
const;
383 bool getBoolProperty(
const OUString& i_rPropertyName,
bool i_bFallback )
const;
389 sal_Int32 getIntProperty(
const OUString& i_rPropertyName, sal_Int32 i_nFallback )
const;
392 void setValue(
const OUString& i_rPropertyName,
const css::uno::Any& i_rValue );
393 void setValue(
const css::beans::PropertyValue& i_rValue );
396 const css::uno::Sequence< css::beans::PropertyValue >&
397 getUIOptions()
const;
403 void setUIOptions(
const css::uno::Sequence< css::beans::PropertyValue >& );
406 bool isUIOptionEnabled(
const OUString& rPropName )
const;
407 bool isUIChoiceEnabled(
const OUString& rPropName, sal_Int32 nChoice )
const;
416 OUString makeEnabled(
const OUString& rPropName );
434 virtual css::uno::Sequence< css::beans::PropertyValue >
440 virtual void jobStarted();
441 virtual void jobFinished( css::view::PrintableState );
443 css::view::PrintableState getJobState()
const;
447 bool isShowDialogs()
const;
448 bool isDirectPrint()
const;
450 void dialogsParentClosing();
456 int getFilteredPageCount()
const;
458 bool i_bMayUseCache =
false );
460 bool i_bMayUseCache =
false );
461 void printFilteredPage(
int i_nPage );
463 void createProgressDialog();
464 bool isProgressCanceled()
const;
467 getMultipage()
const;
468 void setLastPage(
bool i_bLastPage );
470 VCL_DLLPRIVATE void setPapersizeFromSetup(
bool i_bPapersizeFromSetup );
474 void setPrinterModified(
bool i_bPapersizeFromSetup );
475 bool getPrinterModified()
const;
478 void setJobState( css::view::PrintableState );
483 getPageParametersProtected(
int i_nPage )
const;
492 std::unordered_map< OUString, css::uno::Any >
494 std::vector< css::beans::PropertyValue >
506 bool processProperties(
const css::uno::Sequence< css::beans::PropertyValue >& i_rNewProp );
513 void appendPrintUIOptions( css::uno::Sequence< css::beans::PropertyValue >& io_rProps )
const;
516 css::uno::Any
getValue(
const OUString& i_rPropertyName )
const;
518 bool getBoolValue(
const OUString& i_rPropertyName,
bool i_bDefault )
const;
520 bool getBoolValue(
const char* i_pPropName,
bool i_bDefault =
false )
const
521 {
return getBoolValue( OUString::createFromAscii( i_pPropName ), i_bDefault ); }
523 sal_Int64 getIntValue(
const OUString& i_rPropertyName, sal_Int64 i_nDefault )
const;
525 sal_Int64
getIntValue(
const char* i_pPropName, sal_Int64 i_nDefault )
const
526 {
return getIntValue( OUString::createFromAscii( i_pPropName ), i_nDefault ); }
528 OUString getStringValue(
const OUString& i_rPropertyName )
const;
531 {
return getStringValue( OUString::createFromAscii( i_pPropName ) ); }
538 std::vector< css::beans::PropertyValue >
546 sal_Int32 i_nDependsOnEntry = -1,
bool i_bAttachToDependency =
false)
547 : maDependsOnName(
std::move( i_DependsOnName ))
548 , mnDependsOnEntry( i_nDependsOnEntry )
549 , mbAttachToDependency( i_bAttachToDependency )
550 , mbInternalOnly( false )
551 , mbEnabled( true ) {}
561 static css::uno::Any setUIControlOpt(
const css::uno::Sequence< OUString >& i_rIDs,
const OUString& i_rTitle,
562 const css::uno::Sequence< OUString >& i_rHelpId,
const OUString& i_rType,
563 const css::beans::PropertyValue* i_pValue =
nullptr,
564 const UIControlOptions& i_rControlOptions = UIControlOptions());
567 static css::uno::Any setGroupControlOpt(
const OUString& i_rID,
const OUString& i_rTitle,
568 const OUString& i_rHelpId);
571 static css::uno::Any setSubgroupControlOpt(
const OUString& i_rID,
const OUString& i_rTitle,
const OUString& i_rHelpId,
572 const UIControlOptions& i_rControlOptions = UIControlOptions());
575 static css::uno::Any setBoolControlOpt(
const OUString& i_rID,
const OUString& i_rTitle,
const OUString& i_rHelpId,
576 const OUString& i_rProperty,
bool i_bValue,
577 const UIControlOptions& i_rControlOptions = UIControlOptions());
580 static css::uno::Any setChoiceListControlOpt(
const OUString& i_rID,
const OUString& i_rTitle,
581 const css::uno::Sequence< OUString >& i_rHelpId,
const OUString& i_rProperty,
582 const css::uno::Sequence< OUString >& i_rChoices, sal_Int32 i_nValue,
583 const css::uno::Sequence< sal_Bool >& i_rDisabledChoices = css::uno::Sequence< sal_Bool >(),
584 const UIControlOptions& i_rControlOptions = UIControlOptions());
587 static css::uno::Any setChoiceRadiosControlOpt(
const css::uno::Sequence< OUString >& i_rIDs,
588 const OUString& i_rTitle,
const css::uno::Sequence< OUString >& i_rHelpId,
589 const OUString& i_rProperty,
const css::uno::Sequence< OUString >& i_rChoices,
591 const css::uno::Sequence< sal_Bool >& i_rDisabledChoices = css::uno::Sequence< sal_Bool >(),
592 const UIControlOptions& i_rControlOptions = UIControlOptions());
598 static css::uno::Any setRangeControlOpt(
const OUString& i_rID,
const OUString& i_rTitle,
const OUString& i_rHelpId,
599 const OUString& i_rProperty, sal_Int32 i_nValue, sal_Int32 i_nMinValue,
600 sal_Int32 i_nMaxValue,
const UIControlOptions& i_rControlOptions);
606 static css::uno::Any setEditControlOpt(
const OUString& i_rID,
const OUString& i_rTitle,
const OUString& i_rHelpId,
607 const OUString& i_rProperty,
const OUString& i_rValue,
608 const UIControlOptions& i_rControlOptions);
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
virtual css::awt::DeviceInfo GetDeviceInfo() const
virtual void DrawDeviceBitmapEx(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPtPixel, const Size &rSrcSizePixel, BitmapEx &rBitmapEx)
virtual void ReleaseGraphics(bool bRelease=true)=0
Release the graphics device, and remove it from the graphics device list.
OutputDevice & operator=(const OutputDevice &)=delete
virtual void dispose() override
virtual bool AcquireGraphics() const =0
Acquire a graphics device that the output device uses to draw on.
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
void DrawRect(const tools::Rectangle &rRect)
virtual void SetSystemTextColor(SystemTextColorFlags nFlags, bool bEnabled)
virtual void ImplReleaseFonts()
virtual void DrawOutDev(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPt, const Size &rSrcSize)
virtual Size GetWaveLineSize(tools::Long nLineWidth) const
virtual vcl::Region ClipToDeviceBounds(vcl::Region aRegion) const
Perform actual rect clip against outdev dimensions, to generate empty clips whenever one of the value...
virtual bool UsePolyPolygonForComplexGradient()=0
virtual void SetWaveLineColors(Color const &rColor, tools::Long nLineWidth)
virtual Size GetButtonBorderSize()
virtual void ClipAndDrawGradientMetafile(const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly)
virtual bool HasMirroredGraphics() const
virtual Bitmap GetBitmap(const Point &rSrcPt, const Size &rSize) const
virtual void CopyArea(const Point &rDestPt, const Point &rSrcPt, const Size &rSrcSize, bool bWindowInvalidate=false)
virtual bool TransformAndReduceBitmapExToTargetRange(const basegfx::B2DHomMatrix &aFullTransform, basegfx::B2DRange &aVisibleRange, double &fMaximumArea)
Transform and reduce the area that needs to be drawn of the bitmap and return the new visible range a...
virtual tools::Long GetGradientStepCount(tools::Long nMinRect)
virtual bool DrawTransformBitmapExDirect(const basegfx::B2DHomMatrix &aFullTransform, const BitmapEx &rBitmapEx, double fAlpha=1.0)
Transform and draw a bitmap directly.
virtual void EmulateDrawTransparent(const tools::PolyPolygon &rPolyPoly, sal_uInt16 nTransparencePercent)
virtual void DrawDeviceMask(const Bitmap &rMask, const Color &rMaskColor, const Point &rDestPt, const Size &rDestSize, const Point &rSrcPtPixel, const Size &rSrcSizePixel)
virtual void SetFontOrientation(LogicalFontInstance *const pFontInstance) const
virtual tools::Rectangle GetBackgroundComponentBounds() const
virtual void SetMetafileMapMode(const MapMode &rNewMapMode, bool) override
void SetSinglePrintJobs(bool bSinglePrintJobs)
std::unique_ptr< vcl::printer::Options > mpPrinterOptions
bool IsSinglePrintJobs() const
bool CanSubsampleBitmap() const override
Color GetReadableFontColor(const Color &, const Color &) const override
SalInfoPrinter * mpInfoPrinter
const Point & GetPageOffsetPixel() const
sal_uInt16 GetCopyCount() const
bool IsDefPrinter() const
const OUString & GetDriverName() const
Point GetPageOffset() const
Size GetPaperSize() const
std::unique_ptr< SalPrinter > mpPrinter
bool IsCollateCopy() const
sal_uInt16 mnPageQueueSize
Color GetBackgroundColor() const override
bool shouldDrawWavePixelAsRect(tools::Long) const override
const OUString & GetName() const
bool IsScreenComp() const override
const Size & GetPaperSizePixel() const
const JobSetup & GetJobSetup() const
VclPtr< VirtualDevice > mpDisplayDev
const vcl::printer::Options & GetPrinterOptions() const
SalGraphics * mpJobGraphics
bool IsDisplayPrinter() const
Printer(const Printer &rPrinter)=delete
void DrawBorder(tools::Rectangle aBorderRect) override
virtual Color GetMonochromeButtonColor() override
virtual css::uno::Sequence< css::beans::PropertyValue > getPageParameters(int i_nPage) const =0
Get the page parameters.
std::unique_ptr< ImplPrinterControllerData > mpImplData
virtual int getPageCount() const =0
App must override this.
virtual void printPage(int i_nPage) const =0
App must override this.
OUString getStringValue(const char *i_pPropName) const
std::vector< css::beans::PropertyValue > m_aUIProperties
bool getBoolValue(const char *i_pPropName, bool i_bDefault=false) const
std::unordered_map< OUString, css::uno::Any > m_aPropertyMap
PrinterOptionsHelper()
Create without ui properties.
sal_Int64 getIntValue(const char *i_pPropName, sal_Int64 i_nDefault) const
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
tools::Long const nRightMargin
tools::Long const nBottomMargin
tools::Long const nTopMargin
tools::Long const nLeftMargin
css::beans::Optional< css::uno::Any > getValue(std::u16string_view id)
RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey, rtl_uString *keyName, RegValueType valueType, RegValue pData, sal_uInt32 valueSize)
tools::Long nHorizontalSpacing
tools::Long nBottomMargin
tools::Long nVerticalSpacing
bool bFullPaper
Full paper, not only imageable area is printed.
PageSize(const Size &i_rSize=Size(21000, 29700), bool i_bFullPaper=false)
sal_Int32 mnDependsOnEntry
UIControlOptions(OUString i_DependsOnName=OUString(), sal_Int32 i_nDependsOnEntry=-1, bool i_bAttachToDependency=false)
std::vector< css::beans::PropertyValue > maAddProps
bool mbAttachToDependency