summaryrefslogtreecommitdiff
path: root/vcl/inc/unx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/inc/unx')
-rw-r--r--vcl/inc/unx/genprn.h96
-rw-r--r--vcl/inc/unx/genpspgraphics.h221
-rw-r--r--vcl/inc/unx/gtk/gtkprn.hxx2
-rw-r--r--vcl/inc/unx/printergfx.hxx399
-rw-r--r--vcl/inc/unx/printerjob.hxx130
5 files changed, 847 insertions, 1 deletions
diff --git a/vcl/inc/unx/genprn.h b/vcl/inc/unx/genprn.h
new file mode 100644
index 000000000000..5fee250958a3
--- /dev/null
+++ b/vcl/inc/unx/genprn.h
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_INC_GENERIC_GENPRN_H
+#define INCLUDED_VCL_INC_GENERIC_GENPRN_H
+
+#include "vcl/jobdata.hxx"
+#include "unx/printergfx.hxx"
+#include "unx/printerjob.hxx"
+#include "salprn.hxx"
+#include "vclpluginapi.h"
+
+class GenPspGraphics;
+class VCL_DLLPUBLIC PspSalInfoPrinter : public SalInfoPrinter
+{
+public:
+ GenPspGraphics* m_pGraphics;
+ psp::JobData m_aJobData;
+ psp::PrinterGfx m_aPrinterGfx;
+
+ PspSalInfoPrinter();
+ virtual ~PspSalInfoPrinter();
+
+ // override all pure virtual methods
+ virtual SalGraphics* AcquireGraphics() override;
+ virtual void ReleaseGraphics( SalGraphics* pGraphics ) override;
+ virtual bool Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) override;
+ virtual bool SetPrinterData( ImplJobSetup* pSetupData ) override;
+ virtual bool SetData( sal_uIntPtr nFlags, ImplJobSetup* pSetupData ) override;
+ virtual void GetPageInfo( const ImplJobSetup* pSetupData,
+ long& rOutWidth, long& rOutHeight,
+ long& rPageOffX, long& rPageOffY,
+ long& rPageWidth, long& rPageHeight ) override;
+ virtual sal_uIntPtr GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) override;
+ virtual sal_uIntPtr GetPaperBinCount( const ImplJobSetup* pSetupData ) override;
+ virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uIntPtr nPaperBin ) override;
+ virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) override;
+ virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) override;
+};
+
+class VCL_DLLPUBLIC PspSalPrinter : public SalPrinter
+{
+public:
+ OUString m_aFileName;
+ OUString m_aTmpFile;
+ bool m_bPdf:1;
+ bool m_bIsPDFWriterJob:1;
+ GenPspGraphics* m_pGraphics;
+ psp::PrinterJob m_aPrintJob;
+ psp::JobData m_aJobData;
+ psp::PrinterGfx m_aPrinterGfx;
+ sal_uIntPtr m_nCopies;
+ bool m_bCollate;
+ SalInfoPrinter* m_pInfoPrinter;
+
+ PspSalPrinter( SalInfoPrinter *pPrinter );
+ virtual ~PspSalPrinter();
+
+ // override all pure virtual methods
+ virtual bool StartJob( const OUString* pFileName,
+ const OUString& rJobName,
+ const OUString& rAppName,
+ sal_uIntPtr nCopies,
+ bool bCollate,
+ bool bDirect,
+ ImplJobSetup* pSetupData ) override;
+ virtual bool StartJob( const OUString*,
+ const OUString&,
+ const OUString&,
+ ImplJobSetup*,
+ vcl::PrinterController& i_rController ) override;
+ virtual bool EndJob() override;
+ virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, bool bNewJobData ) override;
+ virtual bool EndPage() override;
+ virtual sal_uIntPtr GetErrorCode() override;
+};
+
+#endif // INCLUDED_VCL_INC_GENERIC_GENPRN_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h
new file mode 100644
index 000000000000..860f15bd794b
--- /dev/null
+++ b/vcl/inc/unx/genpspgraphics.h
@@ -0,0 +1,221 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H
+#define INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H
+
+#include <vcl/vclenum.hxx>
+#include <config_cairo_canvas.h>
+
+#include "fontmanager.hxx"
+#include "salgdi.hxx"
+#include "sallayout.hxx"
+#include "vclpluginapi.h"
+
+class PhysicalFontFace;
+class PhysicalFontCollection;
+
+namespace psp { struct JobData; class PrinterGfx; }
+
+class ServerFont;
+class FontAttributes;
+class SalInfoPrinter;
+class GlyphCache;
+
+class VCL_DLLPUBLIC GenPspGraphics : public SalGraphics
+{
+ protected:
+ psp::JobData* m_pJobData;
+ psp::PrinterGfx* m_pPrinterGfx;
+
+ ServerFont* m_pServerFont[ MAX_FALLBACK ];
+ bool m_bFontVertical;
+ SalInfoPrinter* m_pInfoPrinter;
+public:
+ GenPspGraphics();
+ virtual ~GenPspGraphics();
+
+ void Init( psp::JobData* pJob, psp::PrinterGfx* pGfx,
+ SalInfoPrinter* pInfoPrinter );
+
+ // helper methods
+ static const void * DoGetEmbedFontData ( psp::fontID aFont, const sal_Ucs* pUnicodes,
+ sal_Int32* pWidths, size_t nLen, FontSubsetInfo& rInfo,
+ long* pDataLen );
+ static void DoFreeEmbedFontData( const void* pData, long nLen );
+
+ // helper methods for sharing with X11SalGraphics
+ static const Ucs2SIntMap* DoGetFontEncodingVector( psp::fontID aFont,
+ const Ucs2OStrMap** pNonEncoded,
+ std::set<sal_Unicode> const** ppPriority);
+ static void DoGetGlyphWidths( psp::fontID aFont,
+ bool bVertical,
+ Int32Vector& rWidths,
+ Ucs2UIntMap& rUnicodeEnc );
+
+ static FontAttributes Info2FontAttributes( const psp::FastPrintFontInfo& );
+ static void AnnounceFonts( PhysicalFontCollection*,
+ const psp::FastPrintFontInfo& );
+
+ // override all pure virtual methods
+ virtual SalGraphicsImpl*GetImpl() const override { return NULL; };
+ virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override;
+ virtual sal_uInt16 GetBitCount() const override;
+ virtual long GetGraphicsWidth() const override;
+
+ virtual void ResetClipRegion() override;
+ virtual bool setClipRegion( const vcl::Region& ) override;
+
+ virtual void SetLineColor() override;
+ virtual void SetLineColor( SalColor nSalColor ) override;
+ virtual void SetFillColor() override;
+ virtual void SetFillColor( SalColor nSalColor ) override;
+ virtual void SetXORMode( bool bSet, bool ) override;
+ virtual void SetROPLineColor( SalROPColor nROPColor ) override;
+ virtual void SetROPFillColor( SalROPColor nROPColor ) override;
+
+ virtual void SetTextColor( SalColor nSalColor ) override;
+ virtual sal_uInt16 SetFont( FontSelectPattern*, int nFallbackLevel ) override;
+ virtual void GetFontAttributes( FontAttributes*, int nFallbackLevel ) override;
+ virtual const FontCharMapPtr GetFontCharMap() const override;
+ virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
+ virtual void GetDevFontList( PhysicalFontCollection* ) override;
+ // graphics must drop any cached font info
+ virtual void ClearDevFontCache() override;
+ virtual bool AddTempDevFont( PhysicalFontCollection*,
+ const OUString& rFileURL,
+ const OUString& rFontName ) override;
+ static bool AddTempDevFontHelper( PhysicalFontCollection* pFontCollection,
+ const OUString& rFileURL,
+ const OUString& rFontName,
+ GlyphCache &rGC );
+
+ virtual bool CreateFontSubset( const OUString& rToFile,
+ const PhysicalFontFace*,
+ const sal_GlyphId* pGlyphIDs,
+ const sal_uInt8* pEncoding,
+ sal_Int32* pWidths,
+ int nGlyphs,
+ FontSubsetInfo& rInfo ) override;
+ virtual const Ucs2SIntMap* GetFontEncodingVector( const PhysicalFontFace*,
+ const Ucs2OStrMap** ppNonEncoded,
+ std::set<sal_Unicode> const** ppPriority) override;
+ virtual const void* GetEmbedFontData( const PhysicalFontFace*,
+ const sal_Ucs* pUnicodes,
+ sal_Int32* pWidths,
+ size_t nLen,
+ FontSubsetInfo& rInfo,
+ long* pDataLen ) override;
+ virtual void FreeEmbedFontData( const void* pData, long nDataLen ) override;
+ virtual void GetGlyphWidths( const PhysicalFontFace*,
+ bool bVertical,
+ Int32Vector& rWidths,
+ Ucs2UIntMap& rUnicodeEnc ) override;
+ virtual bool GetGlyphBoundRect( sal_GlyphId, Rectangle& ) override;
+ virtual bool GetGlyphOutline( sal_GlyphId, basegfx::B2DPolyPolygon& ) override;
+ virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override;
+ virtual void DrawServerFontLayout( const ServerFontLayout& ) override;
+ virtual bool supportsOperation( OutDevSupportType ) const override;
+ virtual void drawPixel( long nX, long nY ) override;
+ virtual void drawPixel( long nX, long nY, SalColor nSalColor ) override;
+ virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) override;
+ virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override;
+ virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
+ virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) override;
+ virtual void drawPolyPolygon( sal_uInt32 nPoly,
+ const sal_uInt32* pPoints,
+ PCONSTSALPOINT* pPtAry ) override;
+ virtual bool drawPolyPolygon( const basegfx::B2DPolyPolygon&,
+ double fTransparency ) override;
+ virtual bool drawPolyLine( const basegfx::B2DPolygon&,
+ double fTransparency,
+ const basegfx::B2DVector& rLineWidths,
+ basegfx::B2DLineJoin,
+ css::drawing::LineCap) override;
+ virtual bool drawPolyLineBezier( sal_uInt32 nPoints,
+ const SalPoint* pPtAry,
+ const sal_uInt8* pFlgAry ) override;
+ virtual bool drawPolygonBezier( sal_uInt32 nPoints,
+ const SalPoint* pPtAry,
+ const sal_uInt8* pFlgAry ) override;
+ virtual bool drawPolyPolygonBezier( sal_uInt32 nPoly,
+ const sal_uInt32* pPoints,
+ const SalPoint* const* pPtAry,
+ const sal_uInt8* const* pFlgAry ) override;
+ virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) override { return false; };
+
+ virtual void copyArea( long nDestX,
+ long nDestY,
+ long nSrcX,
+ long nSrcY,
+ long nSrcWidth,
+ long nSrcHeight,
+ sal_uInt16 nFlags ) override;
+ virtual void copyBits( const SalTwoRect& rPosAry,
+ SalGraphics* pSrcGraphics ) override;
+ virtual void drawBitmap( const SalTwoRect& rPosAry,
+ const SalBitmap& rSalBitmap ) override;
+ virtual void drawBitmap( const SalTwoRect& rPosAry,
+ const SalBitmap& rSalBitmap,
+ const SalBitmap& rTransparentBitmap ) override;
+ virtual void drawMask( const SalTwoRect& rPosAry,
+ const SalBitmap& rSalBitmap,
+ SalColor nMaskColor ) override;
+ virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ) override;
+ virtual SalColor getPixel( long nX, long nY ) override;
+ virtual void invert( long nX, long nY, long nWidth, long nHeight,
+ SalInvert nFlags ) override;
+ virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry,
+ SalInvert nFlags ) override;
+
+ virtual bool drawEPS( long nX, long nY, long nWidth, long nHeight,
+ void* pPtr, sal_uIntPtr nSize ) override;
+ virtual bool blendBitmap( const SalTwoRect&,
+ const SalBitmap& rBitmap ) override;
+ virtual bool blendAlphaBitmap( const SalTwoRect&,
+ const SalBitmap& rSrcBitmap,
+ const SalBitmap& rMaskBitmap,
+ const SalBitmap& rAlphaBitmap ) override;
+ virtual bool drawAlphaBitmap( const SalTwoRect&,
+ const SalBitmap& rSourceBitmap,
+ const SalBitmap& rAlphaBitmap ) override;
+ virtual bool drawTransformedBitmap( const basegfx::B2DPoint& rNull,
+ const basegfx::B2DPoint& rX,
+ const basegfx::B2DPoint& rY,
+ const SalBitmap& rSourceBitmap,
+ const SalBitmap* pAlphaBitmap) override;
+ virtual bool drawAlphaRect( long nX, long nY, long nWidth, long nHeight,
+ sal_uInt8 nTransparency ) override;
+
+ virtual SystemGraphicsData GetGraphicsData() const override;
+
+#if ENABLE_CAIRO_CANVAS
+ virtual bool SupportsCairo() const override;
+ virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override;
+ virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const override;
+ virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const override;
+ virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const override;
+
+ virtual SystemFontData GetSysFontData( int nFallbacklevel ) const override;
+#endif // ENABLE_CAIRO_CANVAS
+};
+
+#endif // INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/gtk/gtkprn.hxx b/vcl/inc/unx/gtk/gtkprn.hxx
index 910ddcbf4c32..e7da3c75b0fd 100644
--- a/vcl/inc/unx/gtk/gtkprn.hxx
+++ b/vcl/inc/unx/gtk/gtkprn.hxx
@@ -10,7 +10,7 @@
#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKPRN_HXX
#define INCLUDED_VCL_INC_UNX_GTK_GTKPRN_HXX
-#include "generic/genprn.h"
+#include "unx/genprn.h"
#include <memory>
diff --git a/vcl/inc/unx/printergfx.hxx b/vcl/inc/unx/printergfx.hxx
new file mode 100644
index 000000000000..e6eec88e53ab
--- /dev/null
+++ b/vcl/inc/unx/printergfx.hxx
@@ -0,0 +1,399 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_INC_GENERIC_PRINTERGFX_HXX
+#define INCLUDED_VCL_INC_GENERIC_PRINTERGFX_HXX
+
+#include "vcl/helper.hxx"
+#include "sallayout.hxx"
+#include "osl/file.hxx"
+#include "tools/gen.hxx"
+#include "vclpluginapi.h"
+
+#include <list>
+
+namespace psp {
+
+struct JobData;
+
+/*
+ * lightweight container to handle RGB values
+ */
+
+class PrinterColor
+{
+public:
+
+ enum ColorSpace { eInvalid, eRGB };
+
+private:
+
+ sal_uInt8 mnRed;
+ sal_uInt8 mnGreen;
+ sal_uInt8 mnBlue;
+ ColorSpace meColorspace;
+
+public:
+
+ PrinterColor()
+ : mnRed(0)
+ , mnGreen(0)
+ , mnBlue(0)
+ , meColorspace(eInvalid)
+ {}
+ PrinterColor (sal_uInt16 nRed, sal_uInt16 nGreen,
+ sal_uInt16 nBlue) :
+ mnRed (nRed),
+ mnGreen (nGreen),
+ mnBlue (nBlue),
+ meColorspace (eRGB)
+ {}
+ PrinterColor (sal_uInt32 nRGB) :
+ mnRed ((nRGB & 0x00ff0000) >> 16),
+ mnGreen ((nRGB & 0x0000ff00) >> 8),
+ mnBlue ((nRGB & 0x000000ff) ),
+ meColorspace (eRGB)
+ {}
+ ~PrinterColor ()
+ {}
+
+ bool Is () const
+ { return meColorspace != eInvalid; }
+
+ sal_uInt16 GetRed () const
+ { return mnRed; }
+ sal_uInt16 GetGreen () const
+ { return mnGreen; }
+ sal_uInt16 GetBlue () const
+ { return mnBlue; }
+ bool operator== (const PrinterColor& aColor) const
+ {
+ return aColor.Is() && this->Is()
+ && mnRed == aColor.mnRed
+ && mnGreen == aColor.mnGreen
+ && mnBlue == aColor.mnBlue;
+ }
+ bool operator!= (const PrinterColor& aColor) const
+ { return ! (aColor==*this); }
+ PrinterColor& operator= (const PrinterColor& aColor)
+ {
+ meColorspace = aColor.meColorspace;
+ mnRed = aColor.mnRed;
+ mnGreen = aColor.mnGreen;
+ mnBlue = aColor.mnBlue;
+
+ return *this;
+ }
+
+ PrinterColor& operator= (sal_uInt32 nRGB)
+ {
+ meColorspace = eRGB;
+ mnBlue = (nRGB & 0x000000ff);
+ mnGreen = (nRGB & 0x0000ff00) >> 8;
+ mnRed = (nRGB & 0x00ff0000) >> 16;
+
+ return *this;
+ }
+};
+
+class Font2;
+class GlyphSet;
+class PrinterJob;
+class PrintFontManager;
+struct CharacterMetric;
+
+/*
+ * Bitmap Interface, this has to be filled with your actual bitmap implementation
+ * sample implementations can be found in:
+ * psprint/workben/cui/pspdem.cxx
+ * vcl/unx/source/gdi/salgdi2.cxx
+ */
+
+class VCL_DLLPUBLIC PrinterBmp
+{
+public:
+
+ virtual ~PrinterBmp () = 0;
+ virtual sal_uInt32 GetPaletteColor (sal_uInt32 nIdx) const = 0;
+ virtual sal_uInt32 GetPaletteEntryCount () const = 0;
+ virtual sal_uInt32 GetPixelRGB (sal_uInt32 nRow, sal_uInt32 nColumn) const = 0;
+ virtual sal_uInt8 GetPixelGray (sal_uInt32 nRow, sal_uInt32 nColumn) const = 0;
+ virtual sal_uInt8 GetPixelIdx (sal_uInt32 nRow, sal_uInt32 nColumn) const = 0;
+ virtual sal_uInt32 GetDepth () const = 0;
+};
+
+typedef enum {
+ InvalidType = 0,
+ TrueColorImage,
+ MonochromeImage,
+ PaletteImage,
+ GrayScaleImage
+} ImageType;
+
+/*
+ * printer raster operations
+ */
+
+struct GraphicsStatus
+{
+ OString maFont;
+ rtl_TextEncoding maEncoding;
+ bool mbArtItalic;
+ bool mbArtBold;
+ sal_Int32 mnTextHeight;
+ sal_Int32 mnTextWidth;
+ PrinterColor maColor;
+ double mfLineWidth;
+
+ GraphicsStatus();
+};
+
+class Font2;
+
+class VCL_DLLPUBLIC PrinterGfx
+{
+private:
+
+ /* common settings */
+
+ double mfScaleX;
+ double mfScaleY;
+
+ sal_uInt32 mnDpi;
+ sal_uInt16 mnDepth;
+
+ sal_uInt16 mnPSLevel;
+ bool mbColor;
+ bool mbUploadPS42Fonts;
+
+ osl::File* mpPageHeader;
+ osl::File* mpPageBody;
+
+ /* text/font related data, for a type1 font it has to be checked
+ whether this font has already been downloaded. A TrueType font
+ will be converted into one or more Type3 fonts, containing glyphs
+ in no particular order. In addition to the existence of the
+ glyph in one of the subfonts, the mapping from unicode to the
+ glyph has to be remembered */
+
+ std::list< sal_Int32 > maPS1Font;
+ std::list< GlyphSet > maPS3Font;
+
+ sal_Int32 mnFontID;
+ sal_Int32 mnFallbackID;
+ sal_Int32 mnTextAngle;
+ bool mbTextVertical;
+ PrintFontManager& mrFontMgr;
+
+ /* bitmap drawing implementation */
+
+ bool mbCompressBmp;
+
+ void DrawPS1GrayImage (const PrinterBmp& rBitmap, const Rectangle& rArea);
+ void writePS2ImageHeader (const Rectangle& rArea, psp::ImageType nType);
+ void writePS2Colorspace (const PrinterBmp& rBitmap, psp::ImageType nType);
+ void DrawPS2GrayImage (const PrinterBmp& rBitmap, const Rectangle& rArea);
+ void DrawPS2PaletteImage (const PrinterBmp& rBitmap, const Rectangle& rArea);
+ void DrawPS2TrueColorImage (const PrinterBmp& rBitmap, const Rectangle& rArea);
+ void DrawPS2MonoImage (const PrinterBmp& rBitmap, const Rectangle& rArea);
+
+ /* clip region */
+
+ std::list< Rectangle > maClipRegion;
+ bool JoinVerticalClipRectangles( std::list< Rectangle >::iterator& it,
+ Point& aOldPoint, sal_Int32& nColumn );
+
+ /* color settings */
+ PrinterColor maFillColor;
+ PrinterColor maTextColor;
+ PrinterColor maLineColor;
+
+ /* graphics state */
+ GraphicsStatus maVirtualStatus;
+ std::list< GraphicsStatus > maGraphicsStack;
+ GraphicsStatus& currentState() { return maGraphicsStack.front(); }
+
+ /* font */
+ friend class Font2;
+ int getCharWidth (bool b_vert, sal_Unicode n_char,
+ CharacterMetric *p_bbox);
+ fontID getCharMetric (const Font2 &rFont, sal_Unicode n_char,
+ CharacterMetric *p_bbox);
+ fontID getFallbackID () const { return mnFallbackID; }
+
+public:
+ /* graphics status update */
+ void PSSetColor ();
+ void PSSetLineWidth ();
+ void PSSetFont ();
+
+ /* graphics status functions */
+ void PSSetColor (const PrinterColor& rColor)
+ { maVirtualStatus.maColor = rColor; }
+
+ void PSUploadPS1Font (sal_Int32 nFontID);
+ void PSSetFont (const OString& rName,
+ rtl_TextEncoding nEncoding = RTL_TEXTENCODING_DONTKNOW)
+ { maVirtualStatus.maFont = rName; maVirtualStatus.maEncoding = nEncoding; }
+
+ /* graphics status stack */
+ void PSGSave ();
+ void PSGRestore ();
+
+ /* PS helpers */
+ enum pspath_t { moveto = 0, lineto = 1 };
+ void PSBinLineTo (const Point& rCurrent, Point& rOld,
+ sal_Int32& nColumn);
+ void PSBinMoveTo (const Point& rCurrent, Point& rOld,
+ sal_Int32& nColumn);
+ void PSBinStartPath ();
+ void PSBinEndPath ();
+ void PSBinCurrentPath (sal_uInt32 nPoints, const Point* pPath);
+ void PSBinPath (const Point& rCurrent, Point& rOld,
+ pspath_t eType, sal_Int32& nColumn);
+
+ void PSRotate (sal_Int32 nAngle);
+ void PSTranslate (const Point& rPoint);
+ void PSMoveTo (const Point& rPoint);
+ void PSScale (double fScaleX, double fScaleY);
+ void PSLineTo(const Point& rPoint );
+ void PSPointOp (const Point& rPoint, const sal_Char* pOperator);
+ void PSHexString (const unsigned char* pString, sal_Int16 nLen);
+ void PSDeltaArray (const sal_Int32 *pArray, sal_Int16 nEntries);
+ void PSShowText (const unsigned char* pString,
+ sal_Int16 nGlyphs, sal_Int16 nBytes,
+ const sal_Int32* pDeltaArray = nullptr);
+ void PSComment (const sal_Char* pComment );
+ void LicenseWarning (const Point& rPoint, const sal_Unicode* pStr,
+ sal_Int16 nLen, const sal_Int32* pDeltaArray);
+
+ void OnEndJob ();
+ void writeResources( osl::File* pFile, std::list< OString >& rSuppliedFonts );
+ PrintFontManager& GetFontMgr () { return mrFontMgr; }
+
+ bool drawVerticalizedText (const Point& rPoint,
+ const sal_Unicode* pStr,
+ sal_Int16 nLen,
+ const sal_Int32* pDeltaArray );
+ void drawText (const Point& rPoint,
+ const sal_Unicode* pStr, sal_Int16 nLen,
+ const sal_Int32* pDeltaArray = nullptr);
+
+ void drawGlyphs( const Point& rPoint,
+ sal_GlyphId* pGlyphIds,
+ sal_Unicode* pUnicodes,
+ sal_Int16 nLen,
+ sal_Int32* pDeltaArray );
+public:
+ PrinterGfx();
+ ~PrinterGfx();
+ bool Init (PrinterJob &rPrinterSpec);
+ bool Init (const JobData& rData);
+ void Clear();
+
+ // query depth
+ sal_uInt16 GetBitCount () { return mnDepth;}
+
+ // clip region
+ void ResetClipRegion ();
+ void BeginSetClipRegion (sal_uInt32);
+ bool UnionClipRegion (sal_Int32 nX, sal_Int32 nY,
+ sal_Int32 nDX, sal_Int32 nDY);
+ void EndSetClipRegion ();
+
+ // set xy color
+ void SetLineColor (const PrinterColor& rLineColor = PrinterColor())
+ { maLineColor = rLineColor; }
+ void SetFillColor (const PrinterColor& rFillColor = PrinterColor())
+ { maFillColor = rFillColor; }
+
+ // drawing primitives
+ void DrawPixel (const Point& rPoint, const PrinterColor& rPixelColor);
+ void DrawPixel (const Point& rPoint)
+ { DrawPixel (rPoint, maLineColor); }
+ void DrawLine (const Point& rFrom, const Point& rTo);
+ void DrawRect (const Rectangle& rRectangle);
+ void DrawPolyLine (sal_uInt32 nPoints, const Point* pPath );
+ void DrawPolygon (sal_uInt32 nPoints, const Point* pPath);
+ void DrawPolyPolygon (sal_uInt32 nPoly,
+ const sal_uInt32 *pPolygonSize,
+ const Point** pPolygonList);
+ void DrawPolyLineBezier (sal_uInt32 nPoints,
+ const Point* pPath,
+ const sal_uInt8* pFlgAry );
+ void DrawPolygonBezier (sal_uInt32 nPoints,
+ const Point* pPath,
+ const sal_uInt8* pFlgAry);
+ void DrawPolyPolygonBezier (sal_uInt32 nPoly,
+ const sal_uInt32* pPoints,
+ const Point* const* pPtAry,
+ const sal_uInt8* const* pFlgAry);
+
+ // eps
+ bool DrawEPS ( const Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize);
+
+ // image drawing
+ void DrawBitmap (const Rectangle& rDest, const Rectangle& rSrc,
+ const PrinterBmp& rBitmap);
+
+ // font and text handling
+ sal_uInt16 SetFont (
+ sal_Int32 nFontID,
+ sal_Int32 nPointHeight,
+ sal_Int32 nPointWidth,
+ sal_Int32 nAngle,
+ bool bVertical,
+ bool bArtItalic,
+ bool bArtBold
+ );
+ sal_Int32 GetFontAngle () const
+ { return mnTextAngle; }
+ sal_Int32 GetFontID () const
+ { return mnFontID; }
+ bool GetFontVertical() const
+ { return mbTextVertical; }
+ sal_Int32 GetFontHeight () const
+ { return maVirtualStatus.mnTextHeight; }
+ sal_Int32 GetFontWidth () const
+ { return maVirtualStatus.mnTextWidth; }
+ bool GetArtificialItalic() const
+ { return maVirtualStatus.mbArtItalic; }
+ bool GetArtificialBold() const
+ { return maVirtualStatus.mbArtBold; }
+ void DrawText (const Point& rPoint,
+ const sal_Unicode* pStr, sal_Int16 nLen,
+ const sal_Int32* pDeltaArray = nullptr);
+ void SetTextColor (PrinterColor& rTextColor)
+ { maTextColor = rTextColor; }
+ sal_Int32 GetCharWidth (sal_uInt16 nFrom, sal_uInt16 nTo,
+ long *pWidthArray);
+ // for CTL
+ void DrawGlyphs( const Point& rPoint,
+ sal_GlyphId* pGlyphIds,
+ sal_Unicode* pUnicodes,
+ sal_Int16 nLen,
+ sal_Int32* pDeltaArray );
+
+};
+
+} /* namespace psp */
+
+#endif // INCLUDED_VCL_INC_GENERIC_PRINTERGFX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/printerjob.hxx b/vcl/inc/unx/printerjob.hxx
new file mode 100644
index 000000000000..c3738a5c3bef
--- /dev/null
+++ b/vcl/inc/unx/printerjob.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_INC_GENERIC_PRINTERJOB_HXX
+#define INCLUDED_VCL_INC_GENERIC_PRINTERJOB_HXX
+
+#include "vcl/jobdata.hxx"
+#include "osl/file.hxx"
+#include "rtl/string.hxx"
+
+#include <list>
+
+namespace psp {
+
+class PrinterGfx;
+
+class PrinterJob
+{
+private:
+ OUString maSpoolDirName;
+ OUString maFileName; // empty: spool to command, else spool to named file
+ OUString maJobTitle;
+ int mnFileMode;
+
+ osl::File* mpJobHeader;
+ osl::File* mpJobTrailer;
+
+ std::list< osl::File* > maPageList;
+ std::list< osl::File* > maHeaderList;
+
+ JobData m_aDocumentJobData;
+ JobData m_aLastJobData;
+ PrinterGfx* m_pGraphics;
+
+ sal_uInt32 mnResolution;
+
+ sal_uInt32 mnWidthPt;
+ sal_uInt32 mnHeightPt;
+ sal_uInt32 mnMaxWidthPt;
+ sal_uInt32 mnMaxHeightPt;
+
+ int mnLandscapes;
+ int mnPortraits;
+
+ sal_uInt32 mnLMarginPt;
+ sal_uInt32 mnRMarginPt;
+ sal_uInt32 mnTMarginPt;
+ sal_uInt32 mnBMarginPt;
+
+ double mfXScale;
+ double mfYScale;
+
+ bool m_bQuickJob;
+
+private:
+ osl::File* CreateSpoolFile (const OUString& rName,
+ const OUString& rExtension);
+ void InitPaperSize (const JobData& rJobSetup);
+
+ bool writeFeatureList( osl::File* pFile, const JobData&, bool bDocumentSetup );
+ bool writeSetup( osl::File* pFile, const JobData& );
+ bool writePageSetup( osl::File* pFile, const JobData&, bool bWriteFeatures = true );
+ static void writeJobPatch( osl::File* File, const JobData& );
+ static bool writeProlog (osl::File* pFile, const JobData& );
+
+public: // for usage in PrinterGfx
+ sal_uInt32 GetResolution () const { return mnResolution; }
+ void GetScale (double &rXScale, double &rYScale) const;
+ sal_uInt16 GetDepth () const;
+ sal_uInt16 GetPostscriptLevel (const JobData *pJobData = nullptr) const;
+ bool IsColorPrinter () const;
+
+ osl::File* GetCurrentPageHeader ();
+ osl::File* GetCurrentPageBody ();
+
+ const OUString& GetPrinterName() const { return m_aLastJobData.m_aPrinterName; }
+
+public:
+ PrinterJob ();
+ ~PrinterJob ();
+
+ /* rFileName: if length is greater than 0 save resulting PostScript
+ * to named file.
+ * nMode: only meaningful when saving to file: if nonzero, try
+ * to impose the mode on the resulting file's inode; for nonexistant
+ * files use open, for existent files try a chmod
+ * rJobName: text to appear in the %%Title comment
+ * rAppName: text to appear in the %%Creator comment
+ * rSetupData: JobData that apply to this job
+ * pGraphics: the graphics used to print this job;
+ * this graphics must live until EndJob() has returned
+ * bIsQuickJob: the job was started as "direct print" meaning
+ * the quick command for spooling should be used instead
+ * of the normal command
+ */
+ bool StartJob (const OUString& rFileName,
+ int nMode,
+ const OUString& rJobName,
+ const OUString& rAppName,
+ const JobData& rSetupData,
+ PrinterGfx* pGraphics,
+ bool bIsQuickJob
+ );
+ bool EndJob ();
+
+ bool StartPage (const JobData& rJobSetup);
+ bool EndPage ();
+};
+
+} // namespace psp
+
+#endif // INCLUDED_VCL_INC_GENERIC_PRINTERJOB_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */