Bump version to 6.4-15
[LibreOffice.git] / include / vcl / print.hxx
blob154ee694bd836782b524c75d53ccb6d592d68c06
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_PRINT_HXX
21 #define INCLUDED_VCL_PRINT_HXX
23 #include <rtl/ustring.hxx>
24 #include <i18nutil/paper.hxx>
26 #include <vcl/errcode.hxx>
27 #include <vcl/dllapi.h>
28 #include <vcl/outdev.hxx>
29 #include <vcl/prntypes.hxx>
30 #include <vcl/jobset.hxx>
32 #include <com/sun/star/beans/PropertyValue.hpp>
33 #include <com/sun/star/uno/Sequence.hxx>
34 #include <com/sun/star/view/PrintableState.hpp>
36 #include <memory>
37 #include <unordered_map>
39 class GDIMetaFile;
40 class SalInfoPrinter;
41 struct SalPrinterQueueInfo;
42 class SalPrinter;
43 class VirtualDevice;
44 enum class SalPrinterError;
46 namespace vcl {
47 class PrinterController;
48 class Window;
51 namespace weld { class Window; }
53 enum class PrinterSupport
55 SetOrientation,
56 SetPaperSize, SetPaper,
57 CollateCopy,
58 SetupDialog
62 class VCL_DLLPUBLIC QueueInfo
64 friend class Printer;
66 private:
67 OUString maPrinterName;
68 OUString maDriver;
69 OUString maLocation;
70 OUString maComment;
71 PrintQueueFlags mnStatus;
72 sal_uInt32 mnJobs;
74 public:
75 QueueInfo();
77 const OUString& GetPrinterName() const { return maPrinterName; }
78 const OUString& GetDriver() const { return maDriver; }
79 const OUString& GetLocation() const { return maLocation; }
80 const OUString& GetComment() const { return maComment; }
81 PrintQueueFlags GetStatus() const { return mnStatus; }
82 sal_uInt32 GetJobs() const { return mnJobs; }
86 enum class PrinterTransparencyMode
88 Auto = 0,
89 NONE = 1
93 enum class PrinterGradientMode
95 Stripes = 0,
96 Color = 1
100 enum class PrinterBitmapMode
102 Optimal = 0,
103 Normal = 1,
104 Resolution = 2
108 class VCL_DLLPUBLIC PrinterOptions
110 private:
112 bool mbReduceTransparency;
113 PrinterTransparencyMode meReducedTransparencyMode;
114 bool mbReduceGradients;
115 PrinterGradientMode meReducedGradientsMode;
116 sal_uInt16 mnReducedGradientStepCount;
117 bool mbReduceBitmaps;
118 PrinterBitmapMode meReducedBitmapMode;
119 sal_uInt16 mnReducedBitmapResolution;
120 bool mbReducedBitmapsIncludeTransparency;
121 bool mbConvertToGreyscales;
122 bool mbPDFAsStandardPrintJobFormat;
124 public:
125 PrinterOptions();
127 bool IsReduceTransparency() const { return mbReduceTransparency; }
128 void SetReduceTransparency( bool bSet ) { mbReduceTransparency = bSet; }
130 PrinterTransparencyMode GetReducedTransparencyMode() const { return meReducedTransparencyMode; }
131 void SetReducedTransparencyMode( PrinterTransparencyMode eMode )
132 { meReducedTransparencyMode = eMode; }
134 bool IsReduceGradients() const { return mbReduceGradients; }
135 void SetReduceGradients( bool bSet ) { mbReduceGradients = bSet; }
137 PrinterGradientMode GetReducedGradientMode() const { return meReducedGradientsMode; }
138 void SetReducedGradientMode( PrinterGradientMode eMode ) { meReducedGradientsMode = eMode; }
140 sal_uInt16 GetReducedGradientStepCount() const { return mnReducedGradientStepCount; }
141 void SetReducedGradientStepCount( sal_uInt16 nStepCount )
142 { mnReducedGradientStepCount = nStepCount; }
144 bool IsReduceBitmaps() const { return mbReduceBitmaps; }
145 void SetReduceBitmaps( bool bSet ) { mbReduceBitmaps = bSet; }
147 PrinterBitmapMode GetReducedBitmapMode() const { return meReducedBitmapMode; }
148 void SetReducedBitmapMode( PrinterBitmapMode eMode ) { meReducedBitmapMode = eMode; }
150 sal_uInt16 GetReducedBitmapResolution() const { return mnReducedBitmapResolution; }
151 void SetReducedBitmapResolution( sal_uInt16 nResolution )
152 { mnReducedBitmapResolution = nResolution; }
154 bool IsReducedBitmapIncludesTransparency() const { return mbReducedBitmapsIncludeTransparency; }
155 void SetReducedBitmapIncludesTransparency( bool bSet )
156 { mbReducedBitmapsIncludeTransparency = bSet; }
158 bool IsConvertToGreyscales() const { return mbConvertToGreyscales; }
159 void SetConvertToGreyscales( bool bSet ) { mbConvertToGreyscales = bSet; }
161 bool IsPDFAsStandardPrintJobFormat() const { return mbPDFAsStandardPrintJobFormat; }
162 void SetPDFAsStandardPrintJobFormat( bool bSet ) { mbPDFAsStandardPrintJobFormat = bSet; }
164 /** Read printer options from configuration
166 parameter decides whether the set for
167 print "to printer" or "to file" should be read.
169 void ReadFromConfig( bool bFile );
173 class VCL_DLLPUBLIC Printer : public OutputDevice
175 friend class ::OutputDevice;
177 private:
178 SalInfoPrinter* mpInfoPrinter;
179 std::unique_ptr<SalPrinter> mpPrinter;
180 SalGraphics* mpJobGraphics;
181 VclPtr<Printer> mpPrev;
182 VclPtr<Printer> mpNext;
183 VclPtr<VirtualDevice> mpDisplayDev;
184 std::unique_ptr<PrinterOptions> mpPrinterOptions;
185 OUString maPrinterName;
186 OUString maDriver;
187 OUString maPrintFile;
188 JobSetup maJobSetup;
189 Point maPageOffset;
190 Size maPaperSize;
191 ErrCode mnError;
192 sal_uInt16 mnPageQueueSize;
193 sal_uInt16 mnCopyCount;
194 bool mbDefPrinter;
195 bool mbPrinting;
196 bool mbJobActive;
197 bool mbCollateCopy;
198 bool mbPrintFile;
199 bool mbInPrintPage;
200 bool mbNewJobSetup;
202 VCL_DLLPRIVATE void ImplInitData();
203 VCL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo );
204 VCL_DLLPRIVATE void ImplInitDisplay();
205 VCL_DLLPRIVATE static SalPrinterQueueInfo*
206 ImplGetQueueInfo( const OUString& rPrinterName, const OUString* pDriver );
207 VCL_DLLPRIVATE void ImplUpdatePageData();
208 VCL_DLLPRIVATE void ImplUpdateFontList();
209 VCL_DLLPRIVATE void ImplFindPaperFormatForUserSize( JobSetup&, bool bMatchNearest );
211 VCL_DLLPRIVATE bool StartJob( const OUString& rJobName, std::shared_ptr<vcl::PrinterController> const & );
213 static VCL_DLLPRIVATE ErrCode
214 ImplSalPrinterErrorCodeToVCL( SalPrinterError nError );
216 private:
217 VCL_DLLPRIVATE void EndJob();
218 Printer( const Printer& rPrinter ) = delete;
219 Printer& operator =( const Printer& rPrinter ) = delete;
221 public:
222 VCL_DLLPRIVATE void ImplStartPage();
223 VCL_DLLPRIVATE void ImplEndPage();
225 protected:
226 virtual bool AcquireGraphics() const override;
227 virtual void ReleaseGraphics( bool bRelease = true ) override;
228 virtual void ImplReleaseFonts() override;
230 virtual long GetGradientStepCount( long nMinRect ) override;
231 virtual bool UsePolyPolygonForComplexGradient() override;
232 virtual void ClipAndDrawGradientMetafile ( const Gradient &rGradient,
233 const tools::PolyPolygon &rPolyPoly ) override;
235 void ScaleBitmap ( Bitmap&, SalTwoRect& ) override { };
236 vcl::Region ClipToDeviceBounds(vcl::Region aRegion) const override;
238 public:
239 void DrawGradientEx( OutputDevice* pOut, const tools::Rectangle& rRect,
240 const Gradient& rGradient );
241 virtual Bitmap GetBitmap( const Point& rSrcPt, const Size& rSize ) const override;
243 protected:
244 virtual void DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor,
245 const Point& rDestPt, const Size& rDestSize,
246 const Point& rSrcPtPixel, const Size& rSrcSizePixel) override;
248 bool DrawTransformBitmapExDirect( const basegfx::B2DHomMatrix& aFullTransform,
249 const BitmapEx& rBitmapEx) override;
251 bool TransformAndReduceBitmapExToTargetRange( const basegfx::B2DHomMatrix& aFullTransform,
252 basegfx::B2DRange &aVisibleRange, double &fMaximumArea) override;
254 void DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize,
255 const Point& rSrcPtPixel, const Size& rSrcSizePixel,
256 BitmapEx& rBitmapEx ) override;
258 virtual void EmulateDrawTransparent( const tools::PolyPolygon& rPolyPoly,
259 sal_uInt16 nTransparencePercent ) override;
261 virtual void SetFontOrientation( LogicalFontInstance* const pFontInstance ) const override;
263 public:
264 Printer();
265 Printer( const JobSetup& rJobSetup );
266 Printer( const QueueInfo& rQueueInfo );
267 Printer( const OUString& rPrinterName );
268 virtual ~Printer() override;
269 virtual void dispose() override;
271 static const std::vector< OUString >&
272 GetPrinterQueues();
273 static const QueueInfo* GetQueueInfo( const OUString& rPrinterName, bool bStatusUpdate );
274 static OUString GetDefaultPrinterName();
276 const OUString& GetName() const { return maPrinterName; }
277 const OUString& GetDriverName() const { return maDriver; }
278 bool IsDefPrinter() const { return mbDefPrinter; }
279 bool IsDisplayPrinter() const { return mpDisplayDev != nullptr; }
280 bool IsValid() const { return !IsDisplayPrinter(); }
282 sal_uInt32 GetCapabilities( PrinterCapType nType ) const;
283 bool HasSupport( PrinterSupport eFeature ) const;
285 bool SetJobSetup( const JobSetup& rSetup );
286 const JobSetup& GetJobSetup() const { return maJobSetup; }
288 bool Setup(weld::Window* pWindow,
289 PrinterSetupMode eMode = PrinterSetupMode::DocumentGlobal);
290 bool SetPrinterProps( const Printer* pPrinter );
292 Color GetBackgroundColor() const override { return COL_WHITE; }
293 Color GetReadableFontColor(const Color&, const Color&) const override { return COL_BLACK; }
295 /** SetPrinterOptions is used internally only now
297 in earlier times it was used only to set the options loaded directly from the configuration
298 in SfxPrinter::InitJob, this is now handled internally
299 should the need arise to set the printer options outside vcl, also a method would have to be devised
300 to not override these again internally
302 VCL_DLLPRIVATE void SetPrinterOptions( const PrinterOptions& rOptions );
303 const PrinterOptions& GetPrinterOptions() const { return( *mpPrinterOptions ); }
305 bool SetOrientation( Orientation eOrient );
306 Orientation GetOrientation() const;
307 void SetDuplexMode( DuplexMode );
308 DuplexMode GetDuplexMode() const;
310 bool SetPaperBin( sal_uInt16 nPaperBin );
311 sal_uInt16 GetPaperBin() const;
312 void SetPaper( Paper ePaper );
313 bool SetPaperSizeUser( const Size& rSize );
314 bool SetPaperSizeUser( const Size& rSize, bool bMatchNearest );
315 Paper GetPaper() const;
316 static OUString GetPaperName( Paper ePaper );
318 /** @return Number of available paper formats */
319 int GetPaperInfoCount() const;
321 /** @return Info about paper format nPaper */
322 const PaperInfo& GetPaperInfo( int nPaper ) const;
323 sal_uInt16 GetPaperBinCount() const;
324 OUString GetPaperBinName( sal_uInt16 nPaperBin ) const;
326 bool GetPrinterSettingsPreferred() const;
327 void SetPrinterSettingsPreferred( bool bPaperSizeFromSetup );
329 const Size& GetPaperSizePixel() const { return maPaperSize; }
330 Size GetPaperSize() const { return PixelToLogic( maPaperSize ); }
331 Size GetPaperSize( int nPaper );
332 const Point& GetPageOffsetPixel() const { return maPageOffset; }
333 Point GetPageOffset() const { return PixelToLogic( maPageOffset ); }
335 void SetCopyCount( sal_uInt16 nCopy, bool bCollate );
336 sal_uInt16 GetCopyCount() const { return mnCopyCount; }
337 bool IsCollateCopy() const { return mbCollateCopy; }
339 bool IsPrinting() const { return mbPrinting; }
341 bool IsJobActive() const { return mbJobActive; }
343 /** Checks the printer list and updates it necessary
345 sends a DataChanged event of type DataChangedEventType::PRINTER if the printer list changed
347 static void updatePrinters();
349 /** Execute a print job
351 starts a print job asynchronously that is will return
353 static void PrintJob( const std::shared_ptr<vcl::PrinterController>& i_pController,
354 const JobSetup& i_rInitSetup );
356 virtual bool HasMirroredGraphics() const override;
358 virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
359 const Point& rSrcPt, const Size& rSrcSize ) override;
361 virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize,
362 const Point& rSrcPt, const Size& rSrcSize,
363 const OutputDevice& rOutDev ) override;
365 virtual void CopyArea( const Point& rDestPt, const Point& rSrcPt,
366 const Size& rSrcSize, bool bWindowInvalidate = false ) override;
368 // These 3 together are more modular PrintJob(), allowing printing more documents as one print job
369 // by repeated calls to ExecutePrintJob(). Used by mailmerge.
370 static bool PreparePrintJob( std::shared_ptr<vcl::PrinterController> i_pController,
371 const JobSetup& i_rInitSetup );
372 static bool ExecutePrintJob(const std::shared_ptr<vcl::PrinterController>& i_pController);
373 static void FinishPrintJob( const std::shared_ptr<vcl::PrinterController>& i_pController );
375 /** Implementation detail of PrintJob being asynchronous
377 not exported, not usable outside vcl
379 static void VCL_DLLPRIVATE ImplPrintJob( const std::shared_ptr<vcl::PrinterController>& i_pController,
380 const JobSetup& i_rInitSetup );
383 namespace vcl
385 class ImplPrinterControllerData;
387 enum class NupOrderType
389 LRTB, TBLR, TBRL, RLTB
392 class VCL_DLLPUBLIC PrinterController
394 std::unique_ptr<ImplPrinterControllerData>
395 mpImplData;
396 protected:
397 PrinterController(const VclPtr<Printer>&, weld::Window*);
398 public:
399 struct MultiPageSetup
401 // all metrics in 100th mm
402 int nRows;
403 int nColumns;
404 Size aPaperSize;
405 long nLeftMargin;
406 long nTopMargin;
407 long nRightMargin;
408 long nBottomMargin;
409 long nHorizontalSpacing;
410 long nVerticalSpacing;
411 bool bDrawBorder;
412 NupOrderType nOrder;
414 MultiPageSetup()
415 : nRows( 1 ), nColumns( 1 ), aPaperSize( 21000, 29700 )
416 , nLeftMargin( 0 ), nTopMargin( 0 )
417 , nRightMargin( 0 ), nBottomMargin( 0 )
418 , nHorizontalSpacing( 0 ), nVerticalSpacing( 0 )
419 , bDrawBorder( false )
420 , nOrder( NupOrderType::LRTB ) {}
423 struct PageSize
425 /// In 100th mm
426 Size aSize;
428 /// Full paper, not only imageable area is printed
429 bool bFullPaper;
431 PageSize( const Size& i_rSize = Size( 21000, 29700 ),
432 bool i_bFullPaper = false)
433 : aSize( i_rSize ), bFullPaper( i_bFullPaper ) {}
436 virtual ~PrinterController();
438 const VclPtr<Printer>& getPrinter() const;
439 weld::Window* getWindow() const;
441 /** For implementations: get current job properties as changed by e.g. print dialog
443 this gets the current set of properties initially told to Printer::PrintJob
445 For convenience a second sequence will be merged in to get a combined sequence.
446 In case of duplicate property names, the value of i_MergeList wins.
448 css::uno::Sequence< css::beans::PropertyValue >
449 getJobProperties(const css::uno::Sequence< css::beans::PropertyValue >& i_rMergeList ) const;
451 /// Get the PropertyValue of a Property
452 css::beans::PropertyValue* getValue( const OUString& i_rPropertyName );
453 const css::beans::PropertyValue* getValue( const OUString& i_rPropertyName ) const;
455 /** Get a bool property
457 in case the property is unknown or not convertible to bool, i_bFallback is returned
459 bool getBoolProperty( const OUString& i_rPropertyName, bool i_bFallback ) const;
461 /** Get an int property
463 in case the property is unknown or not convertible to bool, i_nFallback is returned
465 sal_Int32 getIntProperty( const OUString& i_rPropertyName, sal_Int32 i_nFallback ) const;
467 /// Set a property value - can also be used to add another UI property
468 void setValue( const OUString& i_rPropertyName, const css::uno::Any& i_rValue );
469 void setValue( const css::beans::PropertyValue& i_rValue );
471 /** @return The currently active UI options. These are the same that were passed to setUIOptions. */
472 const css::uno::Sequence< css::beans::PropertyValue >&
473 getUIOptions() const;
475 /** Set possible UI options.
477 should only be done once before passing the PrinterListener to Printer::PrintJob
479 void setUIOptions( const css::uno::Sequence< css::beans::PropertyValue >& );
481 /// Enable/disable an option; this can be used to implement dialog logic.
482 bool isUIOptionEnabled( const OUString& rPropName ) const;
483 bool isUIChoiceEnabled( const OUString& rPropName, sal_Int32 nChoice ) const;
485 /** MakeEnabled will change the property rPropName depends on to the value
487 that makes rPropName enabled. If the dependency itself is also disabled,
488 no action will be performed.
490 @return The property name rPropName depends on or an empty string if no change was made.
492 OUString makeEnabled( const OUString& rPropName );
494 /// App must override this
495 virtual int getPageCount() const = 0;
497 /** Get the page parameters
499 namely the jobsetup that should be active for the page
500 (describing among others the physical page size) and the "page size". In writer
501 case this would probably be the same as the JobSetup since writer sets the page size
502 draw/impress for example print their page on the paper set on the printer,
503 possibly adjusting the page size to fit. That means the page size can be different from
504 the paper size.
506 App must override this
508 @return Page size in 1/100th mm
510 virtual css::uno::Sequence< css::beans::PropertyValue >
511 getPageParameters( int i_nPage ) const = 0;
512 /// App must override this
513 virtual void printPage(int i_nPage) const = 0;
515 /// Will be called after a possible dialog has been shown and the real printjob starts
516 virtual void jobStarted();
517 virtual void jobFinished( css::view::PrintableState );
519 css::view::PrintableState getJobState() const;
521 void abortJob();
523 bool isShowDialogs() const;
524 bool isDirectPrint() const;
526 // implementation details, not usable outside vcl
527 // don't use outside vcl. Some of these are exported for
528 // the benefit of vcl's plugins.
529 // Still: DO NOT USE OUTSIDE VCL
530 int getFilteredPageCount() const;
531 VCL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf,
532 bool i_bMayUseCache = false );
533 PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf,
534 bool i_bMayUseCache = false );
535 void printFilteredPage( int i_nPage );
536 VCL_DLLPRIVATE void setPrinter( const VclPtr<Printer>& );
537 void createProgressDialog();
538 bool isProgressCanceled() const;
539 VCL_DLLPRIVATE void setMultipage( const MultiPageSetup& );
540 VCL_DLLPRIVATE const MultiPageSetup&
541 getMultipage() const;
542 void setLastPage( bool i_bLastPage );
543 VCL_DLLPRIVATE void setReversePrint( bool i_bReverse );
544 VCL_DLLPRIVATE void setPapersizeFromSetup( bool i_bPapersizeFromSetup );
545 VCL_DLLPRIVATE bool getPapersizeFromSetup() const;
546 VCL_DLLPRIVATE Size& getPaperSizeSetup() const;
547 VCL_DLLPRIVATE void setPaperSizeFromUser( Size i_aUserSize );
548 VCL_DLLPRIVATE Size& getPaperSizeFromUser() const;
549 VCL_DLLPRIVATE bool isPaperSizeFromUser() const;
550 void setPrinterModified( bool i_bPapersizeFromSetup );
551 bool getPrinterModified() const;
552 VCL_DLLPRIVATE void pushPropertiesToPrinter();
553 VCL_DLLPRIVATE void resetPaperToLastConfigured();
554 void setJobState( css::view::PrintableState );
555 VCL_DLLPRIVATE void setupPrinter( weld::Window* i_pDlgParent );
557 VCL_DLLPRIVATE int getPageCountProtected() const;
558 VCL_DLLPRIVATE css::uno::Sequence< css::beans::PropertyValue >
559 getPageParametersProtected( int i_nPage ) const;
561 VCL_DLLPRIVATE DrawModeFlags removeTransparencies( GDIMetaFile const & i_rIn, GDIMetaFile& o_rOut );
562 VCL_DLLPRIVATE void resetPrinterOptions( bool i_bFileOutput );
565 class VCL_DLLPUBLIC PrinterOptionsHelper
567 protected:
568 std::unordered_map< OUString, css::uno::Any >
569 m_aPropertyMap;
570 std::vector< css::beans::PropertyValue >
571 m_aUIProperties;
573 public:
575 /// Create without ui properties
576 PrinterOptionsHelper() {}
578 /** Process a new set of properties
580 merges changed properties and returns "true" if any occurred
582 bool processProperties( const css::uno::Sequence< css::beans::PropertyValue >& i_rNewProp );
584 /** Append to a sequence of property values the ui property sequence passed at creation
586 as the "ExtraPrintUIOptions" property. if that sequence was empty, no "ExtraPrintUIOptions" property
587 will be appended.
589 void appendPrintUIOptions( css::uno::Sequence< css::beans::PropertyValue >& io_rProps ) const;
591 /** @return An empty Any for not existing properties */
592 css::uno::Any getValue( const OUString& i_rPropertyName ) const;
594 bool getBoolValue( const OUString& i_rPropertyName, bool i_bDefault ) const;
595 // convenience for fixed strings
596 bool getBoolValue( const char* i_pPropName, bool i_bDefault = false ) const
597 { return getBoolValue( OUString::createFromAscii( i_pPropName ), i_bDefault ); }
599 sal_Int64 getIntValue( const OUString& i_rPropertyName, sal_Int64 i_nDefault ) const;
600 // convenience for fixed strings
601 sal_Int64 getIntValue( const char* i_pPropName, sal_Int64 i_nDefault ) const
602 { return getIntValue( OUString::createFromAscii( i_pPropName ), i_nDefault ); }
604 OUString getStringValue( const OUString& i_rPropertyName ) const;
605 // convenience for fixed strings
606 OUString getStringValue( const char* i_pPropName ) const
607 { return getStringValue( OUString::createFromAscii( i_pPropName ) ); }
609 // helper functions for user to create a single control
610 struct UIControlOptions
612 OUString const maDependsOnName;
613 sal_Int32 const mnDependsOnEntry;
614 bool const mbAttachToDependency;
615 OUString maGroupHint;
616 bool mbInternalOnly;
617 bool mbEnabled;
618 std::vector< css::beans::PropertyValue >
619 maAddProps;
621 UIControlOptions( const OUString& i_rDependsOnName = OUString(),
622 sal_Int32 i_nDependsOnEntry = -1, bool i_bAttachToDependency = false)
623 : maDependsOnName( i_rDependsOnName )
624 , mnDependsOnEntry( i_nDependsOnEntry )
625 , mbAttachToDependency( i_bAttachToDependency )
626 , mbInternalOnly( false )
627 , mbEnabled( true ) {}
630 // note: in the following helper functions HelpIds are expected as an OUString
631 // the normal HelpId form is OString (byte string instead of UTF16 string)
632 // this is because the whole interface is base on UNO properties; in fact the structures
633 // are passed over UNO interfaces. UNO does not know a byte string, hence the string is
634 // transported via UTF16 strings.
636 /// Show general control
637 static css::uno::Any setUIControlOpt( const css::uno::Sequence< OUString >& i_rIDs, const OUString& i_rTitle,
638 const css::uno::Sequence< OUString >& i_rHelpId, const OUString& i_rType,
639 const css::beans::PropertyValue* i_pValue = nullptr,
640 const UIControlOptions& i_rControlOptions = UIControlOptions());
642 /// Show and set the title of a TagPage of id i_rID
643 static css::uno::Any setGroupControlOpt( const OUString& i_rID, const OUString& i_rTitle,
644 const OUString& i_rHelpId);
646 /// Show and set the label of a VclFrame of id i_rID
647 static css::uno::Any setSubgroupControlOpt( const OUString& i_rID, const OUString& i_rTitle, const OUString& i_rHelpId,
648 const UIControlOptions& i_rControlOptions = UIControlOptions());
650 /// Show a bool option as a checkbox
651 static css::uno::Any setBoolControlOpt( const OUString& i_rID, const OUString& i_rTitle, const OUString& i_rHelpId,
652 const OUString& i_rProperty, bool i_bValue,
653 const UIControlOptions& i_rControlOptions = UIControlOptions());
655 /// Show a set of choices in a list box
656 static css::uno::Any setChoiceListControlOpt( const OUString& i_rID, const OUString& i_rTitle,
657 const css::uno::Sequence< OUString >& i_rHelpId, const OUString& i_rProperty,
658 const css::uno::Sequence< OUString >& i_rChoices, sal_Int32 i_nValue,
659 const css::uno::Sequence< sal_Bool >& i_rDisabledChoices = css::uno::Sequence< sal_Bool >(),
660 const UIControlOptions& i_rControlOptions = UIControlOptions());
662 /// Show a set of choices as radio buttons
663 static css::uno::Any setChoiceRadiosControlOpt( const css::uno::Sequence< OUString >& i_rIDs,
664 const OUString& i_rTitle, const css::uno::Sequence< OUString >& i_rHelpId,
665 const OUString& i_rProperty, const css::uno::Sequence< OUString >& i_rChoices,
666 sal_Int32 i_nValue,
667 const css::uno::Sequence< sal_Bool >& i_rDisabledChoices = css::uno::Sequence< sal_Bool >(),
668 const UIControlOptions& i_rControlOptions = UIControlOptions());
670 /** Show an integer range (e.g. a spin field)
672 note: max value < min value means do not apply min/max values
674 static css::uno::Any setRangeControlOpt( const OUString& i_rID, const OUString& i_rTitle, const OUString& i_rHelpId,
675 const OUString& i_rProperty, sal_Int32 i_nValue, sal_Int32 i_nMinValue,
676 sal_Int32 i_nMaxValue, const UIControlOptions& i_rControlOptions);
678 /** Show a string field
680 note: max value < min value means do not apply min/max values
682 static css::uno::Any setEditControlOpt( const OUString& i_rID, const OUString& i_rTitle, const OUString& i_rHelpId,
683 const OUString& i_rProperty, const OUString& i_rValue,
684 const UIControlOptions& i_rControlOptions);
685 }; // class PrinterOptionsHelper
687 } // namespace vcl
690 #endif // INCLUDED_VCL_PRINT_HXX
692 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */