include/vcl/print.hxx | 647 ++++++++++++++++++++++++++------------------------ 1 file changed, 337 insertions(+), 310 deletions(-)
New commits: commit 8594b4b459a5c8d3bfa904056611f2a24024151a Author: Juergen Funk <juergen.funk...@cib.de> Date: Tue Dec 1 20:18:55 2015 +0100 vcl: cleanup indents, add doxygen comments Change-Id: I0e2f269af47caa219bbf2a6a011febbea20791c2 Reviewed-on: https://gerrit.libreoffice.org/20339 Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> Tested-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 11a4974..b8f32ff 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -51,10 +51,13 @@ namespace vcl { -enum PrinterSupport { SUPPORT_SET_ORIENTATION, SUPPORT_SET_PAPERBIN, - SUPPORT_SET_PAPERSIZE, SUPPORT_SET_PAPER, - SUPPORT_COPY, SUPPORT_COLLATECOPY, - SUPPORT_SETUPDIALOG, SUPPORT_FAX, SUPPORT_PDF }; +enum PrinterSupport +{ + SUPPORT_SET_ORIENTATION, SUPPORT_SET_PAPERBIN, + SUPPORT_SET_PAPERSIZE, SUPPORT_SET_PAPER, + SUPPORT_COPY, SUPPORT_COLLATECOPY, + SUPPORT_SETUPDIALOG, SUPPORT_FAX, SUPPORT_PDF +}; class VCL_DLLPUBLIC PrinterPage @@ -64,18 +67,17 @@ class VCL_DLLPUBLIC PrinterPage public: - PrinterPage() : mpMtf( new GDIMetaFile() ) {} - PrinterPage( GDIMetaFile* pMtf, const JobSetup& rSetup ) : - mpMtf( pMtf ), maJobSetup( rSetup ) {} - ~PrinterPage() { delete mpMtf; } - + PrinterPage() : mpMtf( new GDIMetaFile() ) {} + PrinterPage( GDIMetaFile* pMtf, const JobSetup& rSetup ) + : mpMtf( pMtf ), maJobSetup( rSetup ) {} + ~PrinterPage() { delete mpMtf; } }; class VCL_DLLPUBLIC QueueInfo { - friend class Printer; + friend class Printer; private: OUString maPrinterName; @@ -97,7 +99,7 @@ public: PrintQueueFlags GetStatus() const { return mnStatus; } sal_uInt32 GetJobs() const { return mnJobs; } - bool operator==( const QueueInfo& rInfo ) const; + bool operator==( const QueueInfo& rInfo ) const; }; @@ -111,16 +113,16 @@ enum PrinterTransparencyMode enum PrinterGradientMode { - PRINTER_GRADIENT_STRIPES = 0, - PRINTER_GRADIENT_COLOR = 1 + PRINTER_GRADIENT_STRIPES = 0, + PRINTER_GRADIENT_COLOR = 1 }; enum PrinterBitmapMode { - PRINTER_BITMAP_OPTIMAL = 0, - PRINTER_BITMAP_NORMAL = 1, + PRINTER_BITMAP_OPTIMAL = 0, + PRINTER_BITMAP_NORMAL = 1, PRINTER_BITMAP_RESOLUTION = 2 }; @@ -143,7 +145,6 @@ private: bool mbPDFAsStandardPrintJobFormat; public: - PrinterOptions(); ~PrinterOptions(); @@ -151,7 +152,8 @@ public: void SetReduceTransparency( bool bSet ) { mbReduceTransparency = bSet; } PrinterTransparencyMode GetReducedTransparencyMode() const { return meReducedTransparencyMode; } - void SetReducedTransparencyMode( PrinterTransparencyMode eMode ) { meReducedTransparencyMode = eMode; } + void SetReducedTransparencyMode( PrinterTransparencyMode eMode ) + { meReducedTransparencyMode = eMode; } bool IsReduceGradients() const { return mbReduceGradients; } void SetReduceGradients( bool bSet ) { mbReduceGradients = bSet; } @@ -160,7 +162,8 @@ public: void SetReducedGradientMode( PrinterGradientMode eMode ) { meReducedGradientsMode = eMode; } sal_uInt16 GetReducedGradientStepCount() const { return mnReducedGradientStepCount; } - void SetReducedGradientStepCount( sal_uInt16 nStepCount ) { mnReducedGradientStepCount = nStepCount; } + void SetReducedGradientStepCount( sal_uInt16 nStepCount ) + { mnReducedGradientStepCount = nStepCount; } bool IsReduceBitmaps() const { return mbReduceBitmaps; } void SetReduceBitmaps( bool bSet ) { mbReduceBitmaps = bSet; } @@ -169,10 +172,12 @@ public: void SetReducedBitmapMode( PrinterBitmapMode eMode ) { meReducedBitmapMode = eMode; } sal_uInt16 GetReducedBitmapResolution() const { return mnReducedBitmapResolution; } - void SetReducedBitmapResolution( sal_uInt16 nResolution ) { mnReducedBitmapResolution = nResolution; } + void SetReducedBitmapResolution( sal_uInt16 nResolution ) + { mnReducedBitmapResolution = nResolution; } bool IsReducedBitmapIncludesTransparency() const { return mbReducedBitmapsIncludeTransparency; } - void SetReducedBitmapIncludesTransparency( bool bSet ) { mbReducedBitmapsIncludeTransparency = bSet; } + void SetReducedBitmapIncludesTransparency( bool bSet ) + { mbReducedBitmapsIncludeTransparency = bSet; } bool IsConvertToGreyscales() const { return mbConvertToGreyscales; } void SetConvertToGreyscales( bool bSet ) { mbConvertToGreyscales = bSet; } @@ -180,16 +185,19 @@ public: bool IsPDFAsStandardPrintJobFormat() const { return mbPDFAsStandardPrintJobFormat; } void SetPDFAsStandardPrintJobFormat( bool bSet ) { mbPDFAsStandardPrintJobFormat = bSet; } - // read printer options from configuration, parameter decides whether the set for - // print "to printer" or "to file" should be read. - // returns true if config was read, false if an error occurred + /** Read printer options from configuration + + parameter decides whether the set for + print "to printer" or "to file" should be read. + @return True if config was read, false if an error occurred + */ bool ReadFromConfig( bool bFile ); }; class VCL_DLLPUBLIC Printer : public OutputDevice { - friend class ::OutputDevice; + friend class ::OutputDevice; private: SalInfoPrinter* mpInfoPrinter; @@ -223,20 +231,21 @@ private: SAL_DLLPRIVATE void ImplInitData(); SAL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo ); SAL_DLLPRIVATE void ImplInitDisplay( const vcl::Window* pWindow ); - SAL_DLLPRIVATE static SalPrinterQueueInfo* ImplGetQueueInfo( const OUString& rPrinterName, - const OUString* pDriver ); + SAL_DLLPRIVATE static SalPrinterQueueInfo* + ImplGetQueueInfo( const OUString& rPrinterName, const OUString* pDriver ); SAL_DLLPRIVATE void ImplUpdatePageData(); SAL_DLLPRIVATE void ImplUpdateFontList(); SAL_DLLPRIVATE void ImplFindPaperFormatForUserSize( JobSetup&, bool bMatchNearest ); - SAL_DLLPRIVATE bool StartJob( const OUString& rJobName, std::shared_ptr<vcl::PrinterController>& ); + SAL_DLLPRIVATE bool StartJob( const OUString& rJobName, std::shared_ptr<vcl::PrinterController>& ); - static SAL_DLLPRIVATE sal_uLong ImplSalPrinterErrorCodeToVCL( sal_uLong nError ); + static SAL_DLLPRIVATE sal_uLong + ImplSalPrinterErrorCodeToVCL( sal_uLong nError ); private: SAL_DLLPRIVATE bool EndJob(); - Printer( const Printer& rPrinter ) = delete; - Printer& operator =( const Printer& rPrinter ) = delete; + Printer( const Printer& rPrinter ) = delete; + Printer& operator =( const Printer& rPrinter ) = delete; public: SAL_DLLPRIVATE void ImplStartPage(); @@ -249,34 +258,33 @@ protected: virtual long GetGradientStepCount( long nMinRect ) override; virtual bool UsePolyPolygonForComplexGradient() override; - virtual void ClipAndDrawGradientMetafile ( const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly ) override; + virtual void ClipAndDrawGradientMetafile ( const Gradient &rGradient, + const tools::PolyPolygon &rPolyPoly ) override; void ScaleBitmap ( Bitmap&, SalTwoRect& ) override { }; public: - void DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, const Gradient& rGradient ); + void DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, + const Gradient& rGradient ); virtual Bitmap GetBitmap( const Point& rSrcPt, const Size& rSize ) const override; protected: - virtual void DrawDeviceMask ( const Bitmap& rMask, const Color& rMaskColor, - const Point& rDestPt, const Size& rDestSize, - const Point& rSrcPtPixel, const Size& rSrcSizePixel ) override; + virtual void DrawDeviceMask( const Bitmap& rMask, const Color& rMaskColor, + const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPtPixel, const Size& rSrcSizePixel) override; - bool DrawTransformBitmapExDirect( - const basegfx::B2DHomMatrix& aFullTransform, + bool DrawTransformBitmapExDirect( const basegfx::B2DHomMatrix& aFullTransform, const BitmapEx& rBitmapEx) override; - bool TransformAndReduceBitmapExToTargetRange( - const basegfx::B2DHomMatrix& aFullTransform, - basegfx::B2DRange &aVisibleRange, - double &fMaximumArea) override; + bool TransformAndReduceBitmapExToTargetRange( const basegfx::B2DHomMatrix& aFullTransform, + basegfx::B2DRange &aVisibleRange, double &fMaximumArea) override; - void DrawDeviceBitmap( - const Point& rDestPt, const Size& rDestSize, + void DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, BitmapEx& rBitmapEx ) override; - virtual void EmulateDrawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent ) override; + virtual void EmulateDrawTransparent( const tools::PolyPolygon& rPolyPoly, + sal_uInt16 nTransparencePercent ) override; virtual void InitFont() const override; virtual void SetFontOrientation( ImplFontEntry* const pFontEntry ) const override; @@ -289,7 +297,8 @@ public: virtual ~Printer(); virtual void dispose() override; - static const std::vector< OUString >& GetPrinterQueues(); + static const std::vector< OUString >& + GetPrinterQueues(); static const QueueInfo* GetQueueInfo( const OUString& rPrinterName, bool bStatusUpdate ); static OUString GetDefaultPrinterName(); @@ -308,20 +317,24 @@ public: bool Setup( vcl::Window* pWindow = nullptr, bool bPapersizeFromSetup = false ); bool SetPrinterProps( const Printer* pPrinter ); - // SetPrinterOptions is used internally only now - // in earlier times it was used only to set the options loaded directly from the configuration - // in SfxPrinter::InitJob, this is now handled internally - // should the need arise to set the printer options outside vcl, also a method would have to be devised - // to not override these again internally + /** SetPrinterOptions is used internally only now + + in earlier times it was used only to set the options loaded directly from the configuration + in SfxPrinter::InitJob, this is now handled internally + should the need arise to set the printer options outside vcl, also a method would have to be devised + to not override these again internally + */ SAL_DLLPRIVATE void SetPrinterOptions( const PrinterOptions& rOptions ); const PrinterOptions& GetPrinterOptions() const { return( *mpPrinterOptions ); } bool SetOrientation( Orientation eOrient ); Orientation GetOrientation() const; bool SetDuplexMode( DuplexMode ); - // returns the angle that a landscape page will be turned counterclockwise - // wrt to portrait. The return value may be only valid for - // the current paper + + /** @return The angle that a landscape page will be turned counterclockwise wrt to portrait. + + The return value may be only valid for the current paper + */ int GetLandscapeAngle() const; bool SetPaperBin( sal_uInt16 nPaperBin ); sal_uInt16 GetPaperBin() const; @@ -330,12 +343,14 @@ public: bool SetPaperSizeUser( const Size& rSize, bool bMatchNearest ); Paper GetPaper() const; static OUString GetPaperName( Paper ePaper ); - // return a UI string for the current paper; i_bPaperUser == false means an empty string for PAPER_USER + + /** @return A UI string for the current paper; i_bPaperUser == false means an empty string for PAPER_USER */ OUString GetPaperName( bool i_bPaperUser = true ) const; - // returns number of available paper formats + /** @return Number of available paper formats */ int GetPaperInfoCount() const; - // returns info about paper format nPaper + + /** @return Info about paper format nPaper */ const PaperInfo& GetPaperInfo( int nPaper ) const; sal_uInt16 GetPaperBinCount() const; OUString GetPaperBinName( sal_uInt16 nPaperBin ) const; @@ -353,48 +368,48 @@ public: bool IsJobActive() const { return mbJobActive; } - /** checks the printer list and updates it necessary - * - * sends a DataChanged event of type DataChangedEventType::PRINTER - * if the printer list changed + /** Checks the printer list and updates it necessary + + sends a DataChanged event of type DataChangedEventType::PRINTER if the printer list changed */ static void updatePrinters(); - /** execute a print job - - starts a print job asynchronously (that is will return + /** Execute a print job + starts a print job asynchronously that is will return */ static void PrintJob( const std::shared_ptr<vcl::PrinterController>& i_pController, - const JobSetup& i_rInitSetup ); + const JobSetup& i_rInitSetup ); virtual bool HasMirroredGraphics() const override; virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize, - const Point& rSrcPt, const Size& rSrcSize ) override; + const Point& rSrcPt, const Size& rSrcSize ) override; + virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize, - const Point& rSrcPt, const Size& rSrcSize, - const OutputDevice& rOutDev ) override; - virtual void CopyArea( const Point& rDestPt, - const Point& rSrcPt, const Size& rSrcSize, - bool bWindowInvalidate = false ) override; + const Point& rSrcPt, const Size& rSrcSize, + const OutputDevice& rOutDev ) override; + + virtual void CopyArea( const Point& rDestPt, const Point& rSrcPt, + const Size& rSrcSize, bool bWindowInvalidate = false ) override; virtual void DrawImage( const Point&, const Image&, DrawImageFlags ) override; - virtual void DrawImage( const Point&, const Size&, - const Image&, DrawImageFlags ) override; + virtual void DrawImage( const Point&, const Size&, const Image&, DrawImageFlags ) override; // These 3 together are more modular PrintJob(), allowing printing more documents as one print job // by repeated calls to ExecutePrintJob(). Used by mailmerge. static bool PreparePrintJob( std::shared_ptr<vcl::PrinterController> i_pController, - const JobSetup& i_rInitSetup ); + const JobSetup& i_rInitSetup ); static bool ExecutePrintJob( std::shared_ptr<vcl::PrinterController> i_pController ); static void FinishPrintJob( std::shared_ptr<vcl::PrinterController> i_pController ); - // implementation detail of PrintJob being asynchronous - // not exported, not usable outside vcl + /** Implementation detail of PrintJob being asynchronous + + not exported, not usable outside vcl + */ static void SAL_DLLPRIVATE ImplPrintJob( std::shared_ptr<vcl::PrinterController> i_pController, - const JobSetup& i_rInitSetup ); + const JobSetup& i_rInitSetup ); }; namespace vcl @@ -403,224 +418,255 @@ class ImplPrinterControllerData; class VCL_DLLPUBLIC PrinterController { - ImplPrinterControllerData* mpImplData; + ImplPrinterControllerData* mpImplData; protected: - PrinterController( const VclPtr<Printer>& ); + PrinterController( const VclPtr<Printer>& ); public: enum NupOrderType - { LRTB, TBLR, TBRL, RLTB }; + { + LRTB, TBLR, TBRL, RLTB + }; + struct MultiPageSetup { // all metrics in 100th mm - int nRows; - int nColumns; - int nRepeat; - Size aPaperSize; - long nLeftMargin; - long nTopMargin; - long nRightMargin; - long nBottomMargin; - long nHorizontalSpacing; - long nVerticalSpacing; - bool bDrawBorder; - PrinterController::NupOrderType nOrder; + int nRows; + int nColumns; + int nRepeat; + Size aPaperSize; + long nLeftMargin; + long nTopMargin; + long nRightMargin; + long nBottomMargin; + long nHorizontalSpacing; + long nVerticalSpacing; + bool bDrawBorder; + PrinterController::NupOrderType nOrder; MultiPageSetup() - : nRows( 1 ), nColumns( 1 ), nRepeat( 1 ), aPaperSize( 21000, 29700 ) - , nLeftMargin( 0 ), nTopMargin( 0 ) - , nRightMargin( 0 ), nBottomMargin( 0 ) - , nHorizontalSpacing( 0 ), nVerticalSpacing( 0 ) - , bDrawBorder( false ) - , nOrder( LRTB ) - { - } + : nRows( 1 ), nColumns( 1 ), nRepeat( 1 ), aPaperSize( 21000, 29700 ) + , nLeftMargin( 0 ), nTopMargin( 0 ) + , nRightMargin( 0 ), nBottomMargin( 0 ) + , nHorizontalSpacing( 0 ), nVerticalSpacing( 0 ) + , bDrawBorder( false ) + , nOrder( LRTB ) {} }; struct PageSize { - Size aSize; // in 100th mm - bool bFullPaper; // full paper, not only imageable area is printed + /// In 100th mm + Size aSize; - PageSize( const Size& i_rSize = Size( 21000, 29700 ), - bool i_bFullPaper = false - ) : aSize( i_rSize ), bFullPaper( i_bFullPaper ) {} + /// Full paper, not only imageable area is printed + bool bFullPaper; + + PageSize( const Size& i_rSize = Size( 21000, 29700 ), + bool i_bFullPaper = false) + : aSize( i_rSize ), bFullPaper( i_bFullPaper ) {} }; virtual ~PrinterController(); - const VclPtr<Printer>& getPrinter() const; - /* for implementations: get current job properties as changed by e.g. print dialog - this gets the current set of properties initially told to Printer::PrintJob + const VclPtr<Printer>& getPrinter() const; + + /** For implementations: get current job properties as changed by e.g. print dialog - For convenience a second sequence will be merged in to get a combined sequence. - In case of duplicate property names, the value of i_MergeList wins. + this gets the current set of properties initially told to Printer::PrintJob + + For convenience a second sequence will be merged in to get a combined sequence. + In case of duplicate property names, the value of i_MergeList wins. */ css::uno::Sequence< css::beans::PropertyValue > - getJobProperties( const css::uno::Sequence< css::beans::PropertyValue >& i_rMergeList ) const; + getJobProperties(const css::uno::Sequence< css::beans::PropertyValue >& i_rMergeList ) const; - /* get the PropertyValue of a Property - */ - css::beans::PropertyValue* getValue( const OUString& i_rPropertyName ); - const css::beans::PropertyValue* getValue( const OUString& i_rPropertyName ) const; - /* get a bool property - in case the property is unknown or not convertible to bool, i_bFallback is returned - */ - bool getBoolProperty( const OUString& i_rPropertyName, bool i_bFallback ) const; - /* get an int property - in case the property is unknown or not convertible to bool, i_nFallback is returned - */ - sal_Int32 getIntProperty( const OUString& i_rPropertyName, sal_Int32 i_nFallback ) const; + /// Get the PropertyValue of a Property + css::beans::PropertyValue* getValue( const OUString& i_rPropertyName ); + const css::beans::PropertyValue* getValue( const OUString& i_rPropertyName ) const; - /* set a property value - can also be used to add another UI property - */ - void setValue( const OUString& i_rPropertyName, const css::uno::Any& i_rValue ); - void setValue( const css::beans::PropertyValue& i_rValue ); + /** Get a bool property - /* return the currently active UI options. These are the same that were passed to setUIOptions. + in case the property is unknown or not convertible to bool, i_bFallback is returned */ - const css::uno::Sequence< css::beans::PropertyValue >& getUIOptions() const; - /* set possible UI options. should only be done once before passing the PrinterListener - to Printer::PrintJob + bool getBoolProperty( const OUString& i_rPropertyName, bool i_bFallback ) const; + + /** Get an int property + + in case the property is unknown or not convertible to bool, i_nFallback is returned */ - void setUIOptions( const css::uno::Sequence< css::beans::PropertyValue >& ); - /* enable/disable an option; this can be used to implement dialog logic. + sal_Int32 getIntProperty( const OUString& i_rPropertyName, sal_Int32 i_nFallback ) const; + + /// Set a property value - can also be used to add another UI property + void setValue( const OUString& i_rPropertyName, const css::uno::Any& i_rValue ); + void setValue( const css::beans::PropertyValue& i_rValue ); + + /** @return The currently active UI options. These are the same that were passed to setUIOptions. */ + const css::uno::Sequence< css::beans::PropertyValue >& + getUIOptions() const; + + /** Set possible UI options. + + should only be done once before passing the PrinterListener to Printer::PrintJob */ - bool isUIOptionEnabled( const OUString& rPropName ) const; - bool isUIChoiceEnabled( const OUString& rPropName, sal_Int32 nChoice ) const; - /* returns the property name rPropName depends on or an empty string - if no dependency exists. + void setUIOptions( const css::uno::Sequence< css::beans::PropertyValue >& ); + + /// Enable/disable an option; this can be used to implement dialog logic. + bool isUIOptionEnabled( const OUString& rPropName ) const; + bool isUIChoiceEnabled( const OUString& rPropName, sal_Int32 nChoice ) const; + + /** @return The property name rPropName depends on or an empty string + + if no dependency exists. */ - OUString getDependency( const OUString& rPropName ) const; - /* makeEnabled will chage the property rPropName depends on to the value - that makes rPropName enabled. If the dependency itself is also disabled, - no action will be performed. + OUString getDependency( const OUString& rPropName ) const; - returns the property name rPropName depends on or an empty string - if no change was made. + /** MakeEnabled will change the property rPropName depends on to the value + + that makes rPropName enabled. If the dependency itself is also disabled, + no action will be performed. + + @return The property name rPropName depends on or an empty string if no change was made. */ - OUString makeEnabled( const OUString& rPropName ); - - virtual int getPageCount() const = 0; /// App must override this - /* get the page parameters, namely the jobsetup that should be active for the page - (describing among others the physical page size) and the "page size". In writer - case this would probably be the same as the JobSetup since writer sets the page size - draw/impress for example print their page on the paper set on the printer, - possibly adjusting the page size to fit. That means the page size can be different from - the paper size. - App must override this, return page size in 1/100th mm + OUString makeEnabled( const OUString& rPropName ); + + /// App must override this + virtual int getPageCount() const = 0; + + /** Get the page parameters + + namely the jobsetup that should be active for the page + (describing among others the physical page size) and the "page size". In writer + case this would probably be the same as the JobSetup since writer sets the page size + draw/impress for example print their page on the paper set on the printer, + possibly adjusting the page size to fit. That means the page size can be different from + the paper size. + + App must override this + + @return Page size in 1/100th mm */ - virtual css::uno::Sequence< css::beans::PropertyValue > getPageParameters( int i_nPage ) const = 0; - virtual void printPage(int i_nPage) const = 0; /// App must override this - virtual void jobStarted(); // will be called after a possible dialog has been shown and the real printjob starts - virtual void jobFinished( css::view::PrintableState ); + virtual css::uno::Sequence< css::beans::PropertyValue > + getPageParameters( int i_nPage ) const = 0; + /// App must override this + virtual void printPage(int i_nPage) const = 0; + + /// Will be called after a possible dialog has been shown and the real printjob starts + virtual void jobStarted(); + virtual void jobFinished( css::view::PrintableState ); - css::view::PrintableState getJobState() const; + css::view::PrintableState getJobState() const; - void abortJob(); + void abortJob(); - bool isShowDialogs() const; - bool isDirectPrint() const; + bool isShowDialogs() const; + bool isDirectPrint() const; // implementation details, not usable outside vcl // don't use outside vcl. Some of these are exported for // the benefit of vcl's plugins. // Still: DO NOT USE OUTSIDE VCL - VCL_PLUGIN_PUBLIC int getFilteredPageCount(); - SAL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, bool i_bMayUseCache = false ); - VCL_PLUGIN_PUBLIC PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false ); - VCL_PLUGIN_PUBLIC void printFilteredPage( int i_nPage ); - SAL_DLLPRIVATE void setPrinter( const VclPtr<Printer>& ); - VCL_PLUGIN_PUBLIC void createProgressDialog(); - VCL_PLUGIN_PUBLIC bool isProgressCanceled() const; - SAL_DLLPRIVATE void setMultipage( const MultiPageSetup& ); - SAL_DLLPRIVATE const MultiPageSetup& getMultipage() const; - VCL_PLUGIN_PUBLIC void setLastPage( bool i_bLastPage ); - SAL_DLLPRIVATE void setReversePrint( bool i_bReverse ); - SAL_DLLPRIVATE bool getReversePrint() const; - SAL_DLLPRIVATE void setPapersizeFromSetup( bool i_bPapersizeFromSetup ); - SAL_DLLPRIVATE bool getPapersizeFromSetup() const; - VCL_PLUGIN_PUBLIC void setPrinterModified( bool i_bPapersizeFromSetup ); - VCL_PLUGIN_PUBLIC bool getPrinterModified() const; - SAL_DLLPRIVATE void pushPropertiesToPrinter(); - SAL_DLLPRIVATE void resetPaperToLastConfigured(); - VCL_PLUGIN_PUBLIC void setJobState( css::view::PrintableState ); - SAL_DLLPRIVATE bool setupPrinter( vcl::Window* i_pDlgParent ); - - SAL_DLLPRIVATE int getPageCountProtected() const; - SAL_DLLPRIVATE css::uno::Sequence< css::beans::PropertyValue > getPageParametersProtected( int i_nPage ) const; - - SAL_DLLPRIVATE DrawModeFlags removeTransparencies( GDIMetaFile& i_rIn, GDIMetaFile& o_rOut ); - SAL_DLLPRIVATE void resetPrinterOptions( bool i_bFileOutput ); + VCL_PLUGIN_PUBLIC int getFilteredPageCount(); + SAL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, + bool i_bMayUseCache = false ); + VCL_PLUGIN_PUBLIC PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, + bool i_bMayUseCache = false ); + VCL_PLUGIN_PUBLIC void printFilteredPage( int i_nPage ); + SAL_DLLPRIVATE void setPrinter( const VclPtr<Printer>& ); + VCL_PLUGIN_PUBLIC void createProgressDialog(); + VCL_PLUGIN_PUBLIC bool isProgressCanceled() const; + SAL_DLLPRIVATE void setMultipage( const MultiPageSetup& ); + SAL_DLLPRIVATE const MultiPageSetup& + getMultipage() const; + VCL_PLUGIN_PUBLIC void setLastPage( bool i_bLastPage ); + SAL_DLLPRIVATE void setReversePrint( bool i_bReverse ); + SAL_DLLPRIVATE bool getReversePrint() const; + SAL_DLLPRIVATE void setPapersizeFromSetup( bool i_bPapersizeFromSetup ); + SAL_DLLPRIVATE bool getPapersizeFromSetup() const; + VCL_PLUGIN_PUBLIC void setPrinterModified( bool i_bPapersizeFromSetup ); + VCL_PLUGIN_PUBLIC bool getPrinterModified() const; + SAL_DLLPRIVATE void pushPropertiesToPrinter(); + SAL_DLLPRIVATE void resetPaperToLastConfigured(); + VCL_PLUGIN_PUBLIC void setJobState( css::view::PrintableState ); + SAL_DLLPRIVATE bool setupPrinter( vcl::Window* i_pDlgParent ); + + SAL_DLLPRIVATE int getPageCountProtected() const; + SAL_DLLPRIVATE css::uno::Sequence< css::beans::PropertyValue > + getPageParametersProtected( int i_nPage ) const; + + SAL_DLLPRIVATE DrawModeFlags removeTransparencies( GDIMetaFile& i_rIn, GDIMetaFile& o_rOut ); + SAL_DLLPRIVATE void resetPrinterOptions( bool i_bFileOutput ); }; class VCL_DLLPUBLIC PrinterOptionsHelper { protected: - std::unordered_map< OUString, css::uno::Any, OUStringHash > m_aPropertyMap; - css::uno::Sequence< css::beans::PropertyValue > m_aUIProperties; + std::unordered_map< OUString, css::uno::Any, OUStringHash > + m_aPropertyMap; + css::uno::Sequence< css::beans::PropertyValue > + m_aUIProperties; public: - PrinterOptionsHelper() {} // create without ui properties - PrinterOptionsHelper( const css::uno::Sequence< css::beans::PropertyValue >& i_rUIProperties ) - : m_aUIProperties( i_rUIProperties ) - {} - ~PrinterOptionsHelper() - {} - - /* process a new set of properties - * merges changed properties and returns "true" if any occurred - * if the optional output set is not NULL then the names of the changed properties are returned - **/ - bool processProperties( const css::uno::Sequence< css::beans::PropertyValue >& i_rNewProp, - std::set< OUString >* o_pChangeProp = nullptr ); - /* append to a sequence of property values the ui property sequence passed at creation - * as the "ExtraPrintUIOptions" property. if that sequence was empty, no "ExtraPrintUIOptions" property - * will be appended. - **/ - void appendPrintUIOptions( css::uno::Sequence< css::beans::PropertyValue >& io_rProps ) const; - - // returns an empty Any for not existing properties - css::uno::Any getValue( const OUString& i_rPropertyName ) const; - - bool getBoolValue( const OUString& i_rPropertyName, bool i_bDefault = false ) const; + + /// Create without ui properties + PrinterOptionsHelper() {} + PrinterOptionsHelper( const css::uno::Sequence< css::beans::PropertyValue >& i_rUIProperties ) + : m_aUIProperties( i_rUIProperties ) {} + ~PrinterOptionsHelper() {} + + /** Process a new set of properties + + merges changed properties and returns "true" if any occurred + if the optional output set is not NULL then the names of the changed properties are returned + */ + bool processProperties( const css::uno::Sequence< css::beans::PropertyValue >& i_rNewProp, + std::set< OUString >* o_pChangeProp = nullptr ); + + /** Append to a sequence of property values the ui property sequence passed at creation + + as the "ExtraPrintUIOptions" property. if that sequence was empty, no "ExtraPrintUIOptions" property + will be appended. + */ + void appendPrintUIOptions( css::uno::Sequence< css::beans::PropertyValue >& io_rProps ) const; + + /** @return An empty Any for not existing properties */ + css::uno::Any getValue( const OUString& i_rPropertyName ) const; + + bool getBoolValue( const OUString& i_rPropertyName, bool i_bDefault = false ) const; // convenience for fixed strings - bool getBoolValue( const char* i_pPropName, bool i_bDefault = false ) const - { return getBoolValue( OUString::createFromAscii( i_pPropName ), i_bDefault ); } + bool getBoolValue( const char* i_pPropName, bool i_bDefault = false ) const + { return getBoolValue( OUString::createFromAscii( i_pPropName ), i_bDefault ); } - sal_Int64 getIntValue( const OUString& i_rPropertyName, sal_Int64 i_nDefault ) const; + sal_Int64 getIntValue( const OUString& i_rPropertyName, sal_Int64 i_nDefault ) const; // convenience for fixed strings - sal_Int64 getIntValue( const char* i_pPropName, sal_Int64 i_nDefault ) const - { return getIntValue( OUString::createFromAscii( i_pPropName ), i_nDefault ); } + sal_Int64 getIntValue( const char* i_pPropName, sal_Int64 i_nDefault ) const + { return getIntValue( OUString::createFromAscii( i_pPropName ), i_nDefault ); } - OUString getStringValue( const OUString& i_rPropertyName, const OUString& i_rDefault = OUString() ) const; + OUString getStringValue( const OUString& i_rPropertyName, const OUString& i_rDefault = OUString() ) const; // convenience for fixed strings - OUString getStringValue( const char* i_pPropName, const OUString& i_rDefault = OUString() ) const - { return getStringValue( OUString::createFromAscii( i_pPropName ), i_rDefault ); } + OUString getStringValue( const char* i_pPropName, const OUString& i_rDefault = OUString() ) const + { return getStringValue( OUString::createFromAscii( i_pPropName ), i_rDefault ); } // helper functions for user to create a single control struct UIControlOptions { - OUString maDependsOnName; - sal_Int32 mnDependsOnEntry; - bool mbAttachToDependency; - OUString maGroupHint; - bool mbInternalOnly; - bool mbEnabled; - css::uno::Sequence< css::beans::PropertyValue > maAddProps; - - UIControlOptions( const OUString& i_rDependsOnName = OUString(), - sal_Int32 i_nDependsOnEntry = -1, - bool i_bAttachToDependency = false, - const OUString& i_rGroupHint = OUString(), - bool i_bInternalOnly = false, - bool i_bEnabled = true - ) - : maDependsOnName( i_rDependsOnName ) - , mnDependsOnEntry( i_nDependsOnEntry ) - , mbAttachToDependency( i_bAttachToDependency ) - , maGroupHint( i_rGroupHint ) - , mbInternalOnly( i_bInternalOnly ) - , mbEnabled( i_bEnabled ) {} + OUString maDependsOnName; + sal_Int32 mnDependsOnEntry; + bool mbAttachToDependency; + OUString maGroupHint; + bool mbInternalOnly; + bool mbEnabled; + css::uno::Sequence< css::beans::PropertyValue > + maAddProps; + + UIControlOptions( const OUString& i_rDependsOnName = OUString(), + sal_Int32 i_nDependsOnEntry = -1, bool i_bAttachToDependency = false, + const OUString& i_rGroupHint = OUString(), bool i_bInternalOnly = false, + bool i_bEnabled = true) + : maDependsOnName( i_rDependsOnName ) + , mnDependsOnEntry( i_nDependsOnEntry ) + , mbAttachToDependency( i_bAttachToDependency ) + , maGroupHint( i_rGroupHint ) + , mbInternalOnly( i_bInternalOnly ) + , mbEnabled( i_bEnabled ) {} }; // note: in the following helper functions HelpIds are expected as an OUString @@ -629,77 +675,58 @@ class VCL_DLLPUBLIC PrinterOptionsHelper // are passed over UNO interfaces. UNO does not know a byte string, hence the string is // transported via UTF16 strings. - // Show general control - static css::uno::Any setUIControlOpt( const css::uno::Sequence< OUString >& i_rIDs, - const OUString& i_rTitle, - const css::uno::Sequence< OUString >& i_rHelpId, - const OUString& i_rType, - const css::beans::PropertyValue* i_pValue = nullptr, - const UIControlOptions& i_rControlOptions = UIControlOptions() - ); - - // Show and set the title of a TagPage of id i_rID - static css::uno::Any setGroupControlOpt(const OUString& i_rID, - const OUString& i_rTitle, - const OUString& i_rHelpId); - - // Show and set the label of a VclFrame of id i_rID - static css::uno::Any setSubgroupControlOpt(const OUString& i_rID, - const OUString& i_rTitle, - const OUString& i_rHelpId, - const UIControlOptions& i_rControlOptions = UIControlOptions()); - - // Show a bool option as a checkbox - static css::uno::Any setBoolControlOpt(const OUString& i_rID, - const OUString& i_rTitle, - const OUString& i_rHelpId, - const OUString& i_rProperty, - bool i_bValue, - const UIControlOptions& i_rControlOptions = UIControlOptions()); - - // Show a set of choices in a list box - static css::uno::Any setChoiceListControlOpt(const OUString& i_rID, - const OUString& i_rTitle, - const css::uno::Sequence< OUString >& i_rHelpId, - const OUString& i_rProperty, - const css::uno::Sequence< OUString >& i_rChoices, - sal_Int32 i_nValue, - const css::uno::Sequence< sal_Bool >& i_rDisabledChoices = css::uno::Sequence< sal_Bool >(), - const UIControlOptions& i_rControlOptions = UIControlOptions()); - - // show a set of choices as radio buttons - static css::uno::Any setChoiceRadiosControlOpt(const css::uno::Sequence< OUString >& i_rIDs, - const OUString& i_rTitle, - const css::uno::Sequence< OUString >& i_rHelpId, - const OUString& i_rProperty, - const css::uno::Sequence< OUString >& i_rChoices, - sal_Int32 i_nValue, - const css::uno::Sequence< sal_Bool >& i_rDisabledChoices = css::uno::Sequence< sal_Bool >(), - const UIControlOptions& i_rControlOptions = UIControlOptions()); - - - // show an integer range (e.g. a spin field) - // note: max value < min value means do not apply min/max values - static css::uno::Any setRangeControlOpt(const OUString& i_rID, - const OUString& i_rTitle, - const OUString& i_rHelpId, - const OUString& i_rProperty, - sal_Int32 i_nValue, - sal_Int32 i_nMinValue = -1, - sal_Int32 i_nMaxValue = -2, - const UIControlOptions& i_rControlOptions = UIControlOptions()); - - // show a string field - // note: max value < min value means do not apply min/max values - static css::uno::Any setEditControlOpt(const OUString& i_rID, - const OUString& i_rTitle, - const OUString& i_rHelpId, - const OUString& i_rProperty, - const OUString& i_rValue, - const UIControlOptions& i_rControlOptions = UIControlOptions()); -}; + /// Show general control + static css::uno::Any setUIControlOpt( const css::uno::Sequence< OUString >& i_rIDs, const OUString& i_rTitle, + const css::uno::Sequence< OUString >& i_rHelpId, const OUString& i_rType, + const css::beans::PropertyValue* i_pValue = nullptr, + const UIControlOptions& i_rControlOptions = UIControlOptions()); + + /// Show and set the title of a TagPage of id i_rID + static css::uno::Any setGroupControlOpt( const OUString& i_rID, const OUString& i_rTitle, + const OUString& i_rHelpId); + + /// Show and set the label of a VclFrame of id i_rID + static css::uno::Any setSubgroupControlOpt( const OUString& i_rID, const OUString& i_rTitle, const OUString& i_rHelpId, + const UIControlOptions& i_rControlOptions = UIControlOptions()); + + /// Show a bool option as a checkbox + static css::uno::Any setBoolControlOpt( const OUString& i_rID, const OUString& i_rTitle, const OUString& i_rHelpId, + const OUString& i_rProperty, bool i_bValue, + const UIControlOptions& i_rControlOptions = UIControlOptions()); + + /// Show a set of choices in a list box + static css::uno::Any setChoiceListControlOpt( const OUString& i_rID, const OUString& i_rTitle, + const css::uno::Sequence< OUString >& i_rHelpId, const OUString& i_rProperty, + const css::uno::Sequence< OUString >& i_rChoices, sal_Int32 i_nValue, + const css::uno::Sequence< sal_Bool >& i_rDisabledChoices = css::uno::Sequence< sal_Bool >(), + const UIControlOptions& i_rControlOptions = UIControlOptions()); + + /// Show a set of choices as radio buttons + static css::uno::Any setChoiceRadiosControlOpt( const css::uno::Sequence< OUString >& i_rIDs, + const OUString& i_rTitle, const css::uno::Sequence< OUString >& i_rHelpId, + const OUString& i_rProperty, const css::uno::Sequence< OUString >& i_rChoices, + sal_Int32 i_nValue, + const css::uno::Sequence< sal_Bool >& i_rDisabledChoices = css::uno::Sequence< sal_Bool >(), + const UIControlOptions& i_rControlOptions = UIControlOptions()); + + /** Show an integer range (e.g. a spin field) + + note: max value < min value means do not apply min/max values + */ + static css::uno::Any setRangeControlOpt( const OUString& i_rID, const OUString& i_rTitle, const OUString& i_rHelpId, + const OUString& i_rProperty, sal_Int32 i_nValue, sal_Int32 i_nMinValue = -1, + sal_Int32 i_nMaxValue = -2, const UIControlOptions& i_rControlOptions = UIControlOptions()); -} + /** Show a string field + + note: max value < min value means do not apply min/max values + */ + static css::uno::Any setEditControlOpt( const OUString& i_rID, const OUString& i_rTitle, const OUString& i_rHelpId, + const OUString& i_rProperty, const OUString& i_rValue, + const UIControlOptions& i_rControlOptions = UIControlOptions()); +}; // class PrinterOptionsHelper + +} // namespace vcl #endif // INCLUDED_VCL_PRINT_HXX _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits