50 #include <com/sun/star/beans/XPropertySet.hpp>
51 #include <com/sun/star/configuration/theDefaultProvider.hpp>
52 #include <com/sun/star/container/XNameAccess.hpp>
53 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
54 #include <com/sun/star/uno/Sequence.h>
62 PaperInfo aInfo(nWidth100thMM, nHeight100thMM);
86 rData.SetPaperHeight( aInfo.getHeight() );
98 const Point& rDestPt,
const Size& rDestSize,
99 const Point& rSrcPtPixel,
const Size& rSrcSizePixel )
110 Bitmap aPaint( rBmp ), aMask( rMask );
117 if( aDestSz.
Width() < 0 )
120 aDestPt.AdjustX( -( aDestSz.
Width() - 1 ) );
125 if( aDestSz.
Height() < 0 )
128 aDestPt.AdjustY( -( aDestSz.
Height() - 1 ) );
135 aPaint.Crop( aSrcRect );
136 aMask.
Crop( aSrcRect );
142 aPaint.Mirror( nMirrFlags );
143 aMask.
Mirror( nMirrFlags );
156 std::unique_ptr<tools::Long[]> pMapX(
new tools::Long[ nSrcWidth + 1 ]);
157 std::unique_ptr<tools::Long[]> pMapY(
new tools::Long[ nSrcHeight + 1 ]);
158 const bool bOldMap =
mbMap;
163 for( nX = 0; nX <= nSrcWidth; nX++ )
164 pMapX[ nX ] = aDestPt.X() +
FRound( static_cast<double>(aDestSz.
Width()) * nX / nSrcWidth );
166 for( nY = 0; nY <= nSrcHeight; nY++ )
167 pMapY[ nY ] = aDestPt.Y() +
FRound( static_cast<double>(aDestSz.
Height()) * nY / nSrcHeight );
174 for (
auto const&
rectangle : aRectangles)
177 const Size aMapSz( pMapX[
rectangle.Right() + 1] - aMapPt.X(),
178 pMapY[
rectangle.Bottom() + 1] - aMapPt.Y());
182 DrawBitmap(aMapPt, aMapSz,
Point(), aBandBmp.GetSizePixel(), aBandBmp);
209 const Point& rSrcPtPixel,
const Size& rSrcSizePixel,
219 DrawBitmap( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, aBmp );
229 sal_uInt16 nTransparencePercent )
250 const sal_uInt16 nTrans = ( nTransparencePercent < 13 ) ? 0 :
251 ( nTransparencePercent < 38 ) ? 25 :
252 ( nTransparencePercent < 63 ) ? 50 :
253 ( nTransparencePercent < 88 ) ? 75 : 100;
257 case 25: nMove = nBaseExtent * 3;
break;
258 case 50: nMove = nBaseExtent * 4;
break;
259 case 75: nMove = nBaseExtent * 6;
break;
262 case 100: nMove = nBaseExtent * 8;
break;
265 default: nMove = 0;
break;
271 const bool bOldMap =
mbMap;
277 while( aRect.
Top() <= aPolyRect.
Bottom() )
280 aRect.
Move( 0, nMove );
284 while( aRect.
Left() <= aPolyRect.
Right() )
287 aRect.
Move( nMove, 0 );
306 const Point& ,
const Size& )
308 SAL_WARN(
"vcl.gdi",
"Don't use OutputDevice::DrawOutDev(...) with printer devices!" );
312 const Point& ,
const Size& ,
315 SAL_WARN(
"vcl.gdi",
"Don't use OutputDevice::DrawOutDev(...) with printer devices!" );
319 const Point& ,
const Size& ,
322 SAL_WARN(
"vcl.gdi",
"Don't use OutputDevice::CopyArea(...) with printer devices!" );
359 std::unordered_map< OUString, sal_Int32 >::iterator it =
380 std::unordered_map<OUString,sal_Int32>::iterator it =
393 static const char* pEnv = getenv(
"SAL_DISABLE_PRINTERLIST" );
394 if( !pEnv || !*pEnv )
445 static const char* pEnv = getenv(
"SAL_DISABLE_DEFAULTPRINTER" );
446 if( !pEnv || !*pEnv )
691 const Point& rDestPt,
const Size& rDestSize,
692 const Point& rSrcPtPixel,
const Size& rSrcSizePixel )
710 if( aDestSz.
Width() < 0 )
713 aDestPt.AdjustX( -( aDestSz.
Width() - 1 ) );
718 if( aDestSz.
Height() < 0 )
721 aDestPt.AdjustY( -( aDestSz.
Height() - 1 ) );
727 aMask.
Crop( aSrcRect );
731 aMask.
Mirror( nMirrFlags );
736 std::unique_ptr<tools::Long[]> pMapX(
new tools::Long[ nSrcWidth + 1 ] );
737 std::unique_ptr<tools::Long[]> pMapY(
new tools::Long[ nSrcHeight + 1 ] );
739 const bool bOldMap =
mbMap;
750 for( nX = 0; nX <= nSrcWidth; nX++ )
751 pMapX[ nX ] = aDestPt.X() +
FRound( static_cast<double>(aDestSz.
Width()) * nX / nSrcWidth );
753 for( nY = 0; nY <= nSrcHeight; nY++ )
754 pMapY[ nY ] = aDestPt.Y() +
FRound( static_cast<double>(aDestSz.
Height()) * nY / nSrcHeight );
761 for (
auto const&
rectangle : aRectangles)
765 pMapX[
rectangle.Right() + 1] - aMapPt.X(),
766 pMapY[
rectangle.Bottom() + 1] - aMapPt.Y());
777 const OUString* pDriver )
794 if( rQueueInfo.
mpSalQueueInfo->maPrinterName.equalsIgnoreAsciiCase( rPrinterName ) )
863 , maJobSetup(rJobSetup)
867 OUString aDriver = rConstData.
GetDriver();
951 if (!aBrdSize.
Width())
1240 for (
int i = 0;
i < nPaperCount;
i++ )
1244 if ( aInfo.sloppyEqual(rPaperInfo) )
1247 ImplGetPaperFormat( rPaperInfo.
getWidth(),
1258 nLandscapeAngle != 0 &&
1264 PaperInfo aRotatedInfo(nRotatedWidth, nRotatedHeight);
1266 for (
int i = 0;
i < nPaperCount;
i++ )
1273 ImplGetPaperFormat( rPaperInfo.
getWidth(),
1337 const Paper aPaper = ImplGetPaperFormat(aPageSize.
Width(), aPageSize.
Height());
1393 static const int PaperIndex[] =
1414 std::unordered_map<int,OUString>::const_iterator it = pSVData->
maPaperNames.find( static_cast<int>(ePaper) );
1415 return (it != pSVData->
maPaperNames.end()) ? it->second : OUString();
1421 return ImplGetEmptyPaper();
1425 return ImplGetEmptyPaper();
1597 bool bChanged = pPrnList->
m_aQueueInfos.size() != pNewList->m_aQueueInfos.size();
1598 for( decltype(pPrnList->
m_aQueueInfos)::size_type
i = 0; ! bChanged && i < pPrnList->m_aQueueInfos.size();
i++ )
1650 SAL_WARN(
"vcl.gdi",
"GetBitmap(): This should never be called on by a Printer instance");
1661 aInfo.LeftInset = aOffset.X();
1662 aInfo.TopInset = aOffset.Y();
1663 aInfo.RightInset = aDevSz.
Width() - aOutSz.
Width() - aOffset.X();
1664 aInfo.BottomInset = aDevSz.
Height() - aOutSz.
Height() - aOffset.Y();
1665 aInfo.Capabilities = 0;
bool DrawTransformBitmapExDirect(const basegfx::B2DHomMatrix &aFullTransform, const BitmapEx &rBitmapEx, double fAlpha=1.0) override
Transform and draw a bitmap directly.
void SetPrinterSetupMode(PrinterSetupMode eMode)
virtual void ClipAndDrawGradientMetafile(const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly) override
VclPtr< OutputDevice > mpNextGraphics
Next output device in list.
virtual SalGraphics * AcquireGraphics()=0
virtual void ImplReleaseFonts() override
sal_uInt16 GetPaperBinCount() const
const OUString & GetName() const
static void ImplInitPrnQueueList()
SalGraphics * mpJobGraphics
virtual int GetLandscapeAngle(const ImplJobSetup *pSetupData)=0
bool IsDisplayPrinter() const
void ImplReleaseGraphics(bool bRelease=true)
void setWidth(tools::Long nWidth)
bool SetPaperBin(sal_uInt16 nPaperBin)
static void NotifyAllWindows(DataChangedEvent &rDCEvt)
Notify all windows that the application has changed data.
sal_uInt16 GetPaperBin() const
DuplexMode GetDuplexMode() const
VCL_DLLPRIVATE void ImplInit(SalPrinterQueueInfo *pInfo)
SAL_DLLPRIVATE void ImplPrintTransparent(const Bitmap &rBmp, const Bitmap &rMask, const Point &rDestPt, const Size &rDestSize, const Point &rSrcPtPixel, const Size &rSrcSizePixel)
std::vector< PaperInfo > m_aPaperFormats
virtual bool AcquireGraphics() const override
Acquire a graphics device that the output device uses to draw on.
std::unique_ptr< SalPrinterQueueInfo > mpSalQueueInfo
std::unique_ptr< sal_Int32[]> pData
VCL_DLLPRIVATE void ImplInitDisplay()
static VCL_DLLPRIVATE SalPrinterQueueInfo * ImplGetQueueInfo(const OUString &rPrinterName, const OUString *pDriver)
VclPtr< OutputDevice > mpLastVirGraphics
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
void SetPrinterSettingsPreferred(bool bPaperSizeFromSetup)
const JobSetup & GetJobSetup() const
virtual ~Printer() override
static OUString GetDefaultPrinterName()
VCL_DLLPRIVATE void ImplUpdateFontList()
const ContentProperties & rData
void SetCopyCount(sal_uInt16 nCopy, bool bCollate)
static void updatePrinters()
Checks the printer list and updates it necessary.
std::shared_ptr< vcl::font::PhysicalFontCollection > mxFontCollection
void IntersectClipRegion(const tools::Rectangle &rRect)
void EnableMapMode(bool bEnable=true)
Size GetSizePixel() const
ImplFontMetricDataRef mxFontMetric
std::unique_ptr< SalPrinter > mpPrinter
void doSloppyFit(bool bAlsoTryRotated=false)
const OUString & GetDriver() const
Orientation GetOrientation() const
VCL_DLLPRIVATE void ImplInitData()
SAL_DLLPRIVATE const ImplJobSetup & ImplGetConstData() const
Point GetPageOffset() const
std::vector< tools::Rectangle > RectangleVector
virtual void dispose() override
virtual OUString GetDefaultPrinter()=0
void SetDriverDataLen(sal_uInt32 nDriverDataLen)
DuplexMode GetDuplexMode() const
std::unique_ptr< vcl::font::PhysicalFontFaceCollection > mpFontFaceCollection
constexpr tools::Long Width() const
bool Crop(const tools::Rectangle &rRectPixel)
Crop the bitmap.
SAL_DLLPRIVATE void InitLineColor()
std::unique_ptr< ImplPrnQueueList > mpPrinterQueueList
void SetDuplexMode(DuplexMode)
weld::Window * GetFrameWeld() const
virtual tools::Long GetGradientStepCount(tools::Long nMinRect) override
sal_uInt16 mnPageQueueSize
tools::Long getHeight() const
static void ImplCallEventListenersApplicationDataChanged(void *pData)
Send event to all VCL application event listeners.
bool Mirror(BmpMirrorFlags nMirrorFlags)
Mirror the bitmap.
Size GetSizeOfPaper() const
void SetPaperHeight(tools::Long nHeight)
virtual bool Setup(weld::Window *pFrame, ImplJobSetup *pSetupData)=0
VCL_DLLPRIVATE void ImplFindPaperFormatForUserSize(JobSetup &)
virtual bool UsePolyPolygonForComplexGradient() override
AntialiasingFlags mnAntialiasing
css::awt::DeviceInfo GetDeviceInfo() const override
virtual Bitmap GetBitmap(const Point &rSrcPt, const Size &rSize) const
VCL_DLLPRIVATE void ImplEndPage()
const Size & GetPaperSizePixel() const
void SetDuplexMode(DuplexMode eDuplexMode)
#define PRINTER_GENERALERROR
void SetDriverData(sal_uInt8 *pDriverData)
bool Blend(const AlphaMask &rAlpha, const Color &rBackgroundColor)
Alpha-blend the given bitmap against a specified uniform background color.
SAL_DLLPRIVATE ImplJobSetup & ImplGetData()
Size GetWaveLineSize(tools::Long nLineWidth) const override
void DrawRect(const tools::Rectangle &rRect)
OUString VclResId(TranslateId aId)
#define SAL_N_ELEMENTS(arr)
OUString GetPaperBinName(sal_uInt16 nPaperBin) const
SalGraphics * mpGraphics
Graphics context to draw on.
VclPtr< VirtualDevice > mpDisplayDev
bool SetPaperSizeUser(const Size &rSize)
bool HasSupport(PrinterSupport eFeature) const
bool sloppyEqual(const PaperInfo &rOther) const
VCL_DLLPRIVATE void SetPrinterOptions(const vcl::printer::Options &rOptions)
SetPrinterOptions is used internally only now.
virtual void SetFillColor()=0
ImplSVData * ImplGetSVData()
VclPtr< Printer > mpFirstPrinter
virtual bool HasMirroredGraphics() const override
SAL_DLLPRIVATE void InitFillColor()
VclPtr< Printer > mpLastPrnGraphics
void SetPaperWidth(tools::Long nWidth)
vcl::PixelFormat getPixelFormat() const
virtual void GetResolution(sal_Int32 &rDPIX, sal_Int32 &rDPIY)=0
bool GetPapersizeFromSetup() const
std::unordered_map< OUString, sal_Int32 > m_aNameToIndex
bool TransformAndReduceBitmapExToTargetRange(const basegfx::B2DHomMatrix &aFullTransform, basegfx::B2DRange &aVisibleRange, double &fMaximumArea) override
Transform and reduce the area that needs to be drawn of the bitmap and return the new visible range a...
void SetOrientation(Orientation eOrientation)
virtual void ReleaseGraphics(SalGraphics *pGraphics)=0
void ImplUpdateJobSetupPaper(JobSetup &rJobSetup)
virtual void SetLineColor()=0
virtual void dispose() override
tools::Long FRound(double fVal)
virtual void SetFontOrientation(LogicalFontInstance *const pFontInstance) const override
const OUString & GetPrinterName() const
const OUString & GetDriverName() const
VCL_DLLPRIVATE void ImplStartPage()
const sal_uInt8 * GetDriverData() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
std::vector< OUString > m_aPrinterList
VclPtr< Printer > mpFirstPrnGraphics
ImplPrnQueueData * Get(const OUString &rPrinter)
void SetTextColor(const Color &rColor)
std::unique_ptr< SalVirtualDevice > mpVirDev
virtual tools::Rectangle GetBackgroundComponentBounds() const override
vcl::Region CreateRegion(const Color &rColor, const tools::Rectangle &rRect) const
Create region of similar colors in a given rectangle.
const PaperInfo & GetPaperInfo(int nPaper) const
void SetPapersizeFromSetup(bool bPapersizeFromSetup)
virtual OUString GetPaperBinName(const ImplJobSetup *pSetupData, sal_uInt16 nPaperBin)=0
Size GetOutputSizePixel() const
Orientation GetOrientation() const
Base class used mainly for the LibreOffice Desktop class.
void ImplDeletePrnQueueList()
vcl::Region ClipToDeviceBounds(vcl::Region aRegion) const override
Perform actual rect clip against outdev dimensions, to generate empty clips whenever one of the value...
virtual void GetPageInfo(const ImplJobSetup *pSetupData, tools::Long &rOutWidth, tools::Long &rOutHeight, Point &rPageOffset, Size &rPaperSize)=0
virtual bool SetPrinterData(ImplJobSetup *pSetupData)=0
void DrawBitmap(const Point &rDestPt, const Bitmap &rBitmap)
virtual void DrawOutDev(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPt, const Size &rSrcSize) override
constexpr sal_uInt32 QUEUE_JOBS_DONTKNOW
virtual void ReleaseGraphics(bool bRelease=true) override
Release the graphics device, and remove it from the graphics device list.
static const std::vector< OUString > & GetPrinterQueues()
void SetPaper(Paper ePaper)
virtual SalInfoPrinter * CreateInfoPrinter(SalPrinterQueueInfo *pQueueInfo, ImplJobSetup *pSetupData)=0
Bitmap GetBitmap(Color aTransparentReplaceColor) const
virtual Bitmap GetBitmap(const Point &rSrcPt, const Size &rSize) const override
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
std::vector< ImplPrnQueueData > m_aQueueInfos
virtual void SetXORMode(bool bSet, bool bInvertOnly)=0
VclPtr< OutputDevice > mpPrevGraphics
Previous output device in list.
void setAntiAlias(bool bNew)
VclPtr< VirtualDevice > mpAlphaVDev
sal_uInt16 GetPaperBin() const
const Point & GetPageOffsetPixel() const
AlphaMask GetAlpha() const
bool Setup(weld::Window *pWindow, PrinterSetupMode eMode=PrinterSetupMode::DocumentGlobal)
virtual void ReleaseGraphics(bool bRelease=true)=0
Release the graphics device, and remove it from the graphics device list.
VCL_DLLPRIVATE void ImplUpdatePageData()
const OUString & GetPrinterName() const
css::awt::DeviceInfo GetCommonDeviceInfo(Size const &aDevSize) const
void SetPaperBin(sal_uInt16 nPaperBin)
#define SAL_WARN_IF(condition, area, stream)
constexpr tools::Long Height() const
VCL_DLLPRIVATE void EndJob()
bool Convert(BmpConversion eConversion)
Convert bitmap format.
tools::Long GetPaperWidth() const
bool SetOrientation(Orientation eOrient)
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
virtual void GetPrinterQueueInfo(ImplPrnQueueList *pList)=0
SAL_DLLPRIVATE void ImplUpdateFontData()
void GetRegionRectangles(RectangleVector &rTarget) const
int GetPaperInfoCount() const
Degree10 GetOrientation() const
VclPtr< OutputDevice > mpFirstVirGraphics
static VclPtr< reference_type > Create(Arg &&...arg)
A construction helper for VclPtr.
std::shared_ptr< ImplFontCache > mxScreenFontCache
std::unique_ptr< QueueInfo > mpQueueInfo
std::unique_ptr< vcl::printer::Options > mpPrinterOptions
static VCL_DLLPRIVATE ErrCode ImplSalPrinterErrorCodeToVCL(SalPrinterError nError)
void SetPrinterName(const OUString &rPrinterName)
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
static const QueueInfo * GetQueueInfo(const OUString &rPrinterName, bool bStatusUpdate)
bool GetPrinterSettingsPreferred() const
rtl::Reference< LogicalFontInstance > mpFontInstance
virtual void CopyArea(const Point &rDestPt, const Point &rSrcPt, const Size &rSrcSize, bool bWindowInvalidate=false) override
virtual void InitPaperFormats(const ImplJobSetup *pSetupData)=0
SalInfoPrinter * mpInfoPrinter
Paper GetPaperFormat() const
void SetDriver(const OUString &rDriver)
bool Erase(const Color &rFillColor)
Fill the entire bitmap with the given color.
virtual sal_uInt16 GetPaperBinCount(const ImplJobSetup *pSetupData)=0
void setHeight(tools::Long nHeight)
virtual void EmulateDrawTransparent(const tools::PolyPolygon &rPolyPoly, sal_uInt16 nTransparencePercent) override
virtual bool SetData(JobSetFlags nFlags, ImplJobSetup *pSetupData)=0
tools::Long GetPaperHeight() const
std::shared_ptr< vcl::font::PhysicalFontCollection > mxScreenFontList
reference_type * get() const
Get the body.
std::shared_ptr< ImplFontCache > mxFontCache
#define SAL_WARN(area, stream)
virtual void GetDevFontList(vcl::font::PhysicalFontCollection *)=0
virtual Size GetButtonBorderSize() override
void SetPaperFormat(Paper ePaperFormat)
#define DBG_TESTSOLARMUTEX()
void SetSystemTextColor(SystemTextColorFlags, bool) override
bool SetJobSetup(const JobSetup &rSetup)
virtual void DrawDeviceMask(const Bitmap &rMask, const Color &rMaskColor, const Point &rDestPt, const Size &rDestSize, const Point &rSrcPtPixel, const Size &rSrcSizePixel) override
static OUString GetPaperName(Paper ePaper)
void SetWaveLineColors(Color const &rColor, tools::Long) override
const OUString & GetDriver() const
tools::Long getWidth() const
vcl::Window * ImplGetDefaultWindow()
Returns either the application window, or the default GL context window.
sal_uInt32 GetCapabilities(PrinterCapType nType) const
void DrawGradient(const tools::Rectangle &rRect, const Gradient &rGradient)
virtual sal_uInt32 GetCapabilities(const ImplJobSetup *pSetupData, PrinterCapType nType)=0
void DrawDeviceBitmapEx(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPtPixel, const Size &rSrcSizePixel, BitmapEx &rBitmapEx) override
bool SetPrinterProps(const Printer *pPrinter)
const Color & GetFillColor() const
std::unordered_map< int, OUString > maPaperNames
Size GetPaperSize() const
virtual void DestroyInfoPrinter(SalInfoPrinter *pPrinter)=0
virtual void GetPrinterQueueState(SalPrinterQueueInfo *pInfo)=0
void Add(std::unique_ptr< SalPrinterQueueInfo > pData)