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);
98 const Point& rDestPt,
const Size& rDestSize,
99 const Point& rSrcPtPixel,
const Size& rSrcSizePixel )
114 if( aDestSz.
Width() < 0 )
122 if( aDestSz.
Height() < 0 )
132 aPaint.
Crop( aSrcRect );
138 aPaint.
Mirror( nMirrFlags );
143 aAlphaMask.
Erase( 0 );
148 std::unique_ptr<tools::Long[]> pMapX(
new tools::Long[ nSrcWidth + 1 ]);
149 std::unique_ptr<tools::Long[]> pMapY(
new tools::Long[ nSrcHeight + 1 ]);
150 const bool bOldMap =
mbMap;
155 for( nX = 0; nX <= nSrcWidth; nX++ )
156 pMapX[ nX ] = aDestPt.
X() +
FRound(
static_cast<double>(aDestSz.
Width()) * nX / nSrcWidth );
158 for( nY = 0; nY <= nSrcHeight; nY++ )
159 pMapY[ nY ] = aDestPt.
Y() +
FRound(
static_cast<double>(aDestSz.
Height()) * nY / nSrcHeight );
192 const Point& rSrcPtPixel,
const Size& rSrcSizePixel,
202 DrawBitmap( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, aBmp );
212 sal_uInt16 nTransparencePercent )
233 const sal_uInt16 nTrans = ( nTransparencePercent < 13 ) ? 0 :
234 ( nTransparencePercent < 38 ) ? 25 :
235 ( nTransparencePercent < 63 ) ? 50 :
236 ( nTransparencePercent < 88 ) ? 75 : 100;
240 case 25: nMove = nBaseExtent * 3;
break;
241 case 50: nMove = nBaseExtent * 4;
break;
242 case 75: nMove = nBaseExtent * 6;
break;
245 case 100: nMove = nBaseExtent * 8;
break;
248 default: nMove = 0;
break;
254 const bool bOldMap =
mbMap;
260 while( aRect.
Top() <= aPolyRect.
Bottom() )
263 aRect.
Move( 0, nMove );
267 while( aRect.
Left() <= aPolyRect.
Right() )
270 aRect.
Move( nMove, 0 );
291 SAL_WARN(
"vcl.gdi",
"Don't use OutputDevice::DrawOutDev(...) with printer devices!" );
298 SAL_WARN(
"vcl.gdi",
"Don't use OutputDevice::DrawOutDev(...) with printer devices!" );
305 SAL_WARN(
"vcl.gdi",
"Don't use OutputDevice::CopyArea(...) with printer devices!" );
342 std::unordered_map< OUString, sal_Int32 >::iterator it =
363 std::unordered_map<OUString,sal_Int32>::iterator it =
376 static const char* pEnv = getenv(
"SAL_DISABLE_PRINTERLIST" );
377 if( !pEnv || !*pEnv )
428 static const char* pEnv = getenv(
"SAL_DISABLE_DEFAULTPRINTER" );
429 if( !pEnv || !*pEnv )
674 const Point& rDestPt,
const Size& rDestSize,
675 const Point& rSrcPtPixel,
const Size& rSrcSizePixel )
693 if( aDestSz.
Width() < 0 )
701 if( aDestSz.
Height() < 0 )
710 aMask.
Crop( aSrcRect );
714 aMask.
Mirror( nMirrFlags );
719 std::unique_ptr<tools::Long[]> pMapX(
new tools::Long[ nSrcWidth + 1 ] );
720 std::unique_ptr<tools::Long[]> pMapY(
new tools::Long[ nSrcHeight + 1 ] );
722 const bool bOldMap =
mbMap;
733 for( nX = 0; nX <= nSrcWidth; nX++ )
734 pMapX[ nX ] = aDestPt.
X() +
FRound(
static_cast<double>(aDestSz.
Width()) * nX / nSrcWidth );
736 for( nY = 0; nY <= nSrcHeight; nY++ )
737 pMapY[ nY ] = aDestPt.
Y() +
FRound(
static_cast<double>(aDestSz.
Height()) * nY / nSrcHeight );
744 for (
auto const&
rectangle : aRectangles)
760 const OUString* pDriver )
777 if( rQueueInfo.
mpSalQueueInfo->maPrinterName.equalsIgnoreAsciiCase( rPrinterName ) )
846 , maJobSetup(rJobSetup)
850 OUString aDriver = rConstData.
GetDriver();
934 if (!aBrdSize.
Width())
1223 for (
int i = 0;
i < nPaperCount;
i++ )
1230 ImplGetPaperFormat( rPaperInfo.
getWidth(),
1241 nLandscapeAngle != 0 &&
1247 PaperInfo aRotatedInfo(nRotatedWidth, nRotatedHeight);
1249 for (
int i = 0;
i < nPaperCount;
i++ )
1256 ImplGetPaperFormat( rPaperInfo.
getWidth(),
1320 const Paper aPaper = ImplGetPaperFormat(aPageSize.
Width(), aPageSize.
Height());
1377 static const int PaperIndex[] =
1398 std::unordered_map<int,OUString>::const_iterator it = pSVData->
maPaperNames.find(
static_cast<int>(ePaper) );
1399 return (it != pSVData->
maPaperNames.end()) ? it->second : OUString();
1405 return ImplGetEmptyPaper();
1409 return ImplGetEmptyPaper();
1581 bool bChanged = pPrnList->
m_aQueueInfos.size() != pNewList->m_aQueueInfos.size();
1582 for(
decltype(pPrnList->
m_aQueueInfos)::size_type
i = 0; ! bChanged && i < pPrnList->m_aQueueInfos.size();
i++ )
1634 SAL_WARN(
"vcl.gdi",
"GetBitmap(): This should never be called on by a Printer instance");
1645 aInfo.LeftInset = aOffset.
X();
1646 aInfo.TopInset = aOffset.
Y();
1647 aInfo.RightInset = aDevSz.
Width() - aOutSz.
Width() - aOffset.
X();
1648 aInfo.BottomInset = aDevSz.
Height() - aOutSz.
Height() - aOffset.
Y();
1649 aInfo.Capabilities = 0;
void Erase(sal_uInt8 cTransparency)
Base class used mainly for the LibreOffice Desktop class.
static void ImplCallEventListenersApplicationDataChanged(void *pData)
Send event to all VCL application event listeners.
static void NotifyAllWindows(DataChangedEvent &rDCEvt)
Notify all windows that the application has changed data.
const AlphaMask & GetAlphaMask() const
Bitmap GetBitmap(Color aTransparentReplaceColor) const
bool Blend(const AlphaMask &rAlpha, const Color &rBackgroundColor)
Alpha-blend the given bitmap against a specified uniform background color.
bool Crop(const tools::Rectangle &rRectPixel)
Crop the bitmap.
bool Convert(BmpConversion eConversion)
Convert bitmap format.
Size GetSizePixel() const
vcl::Region CreateRegion(const Color &rColor, const tools::Rectangle &rRect) const
Create region of similar colors in a given rectangle.
vcl::PixelFormat getPixelFormat() const
bool Mirror(BmpMirrorFlags nMirrorFlags)
Mirror the bitmap.
void SetDuplexMode(DuplexMode eDuplexMode)
void SetPaperHeight(tools::Long nHeight)
bool GetPapersizeFromSetup() const
void SetDriverData(sal_uInt8 *pDriverData)
tools::Long GetPaperWidth() const
const sal_uInt8 * GetDriverData() const
void SetPrinterSetupMode(PrinterSetupMode eMode)
void SetPaperWidth(tools::Long nWidth)
void SetPapersizeFromSetup(bool bPapersizeFromSetup)
Orientation GetOrientation() const
void SetPaperBin(sal_uInt16 nPaperBin)
tools::Long GetPaperHeight() const
void SetPrinterName(const OUString &rPrinterName)
void SetOrientation(Orientation eOrientation)
sal_uInt16 GetPaperBin() const
DuplexMode GetDuplexMode() const
void SetPaperFormat(Paper ePaperFormat)
const OUString & GetDriver() const
void SetDriver(const OUString &rDriver)
const OUString & GetPrinterName() const
void SetDriverDataLen(sal_uInt32 nDriverDataLen)
Paper GetPaperFormat() const
ImplPrnQueueData * Get(const OUString &rPrinter)
std::vector< ImplPrnQueueData > m_aQueueInfos
std::unordered_map< OUString, sal_Int32 > m_aNameToIndex
std::vector< OUString > m_aPrinterList
void Add(std::unique_ptr< SalPrinterQueueInfo > pData)
SAL_DLLPRIVATE const ImplJobSetup & ImplGetConstData() const
SAL_DLLPRIVATE ImplJobSetup & ImplGetData()
FontMetricDataRef mxFontMetric
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
void EnableMapMode(bool bEnable=true)
virtual void ReleaseGraphics(bool bRelease=true)=0
Release the graphics device, and remove it from the graphics device list.
css::awt::DeviceInfo GetCommonDeviceInfo(Size const &aDevSize) const
SAL_DLLPRIVATE void InitLineColor()
std::shared_ptr< ImplFontCache > mxFontCache
virtual void dispose() override
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
Size GetOutputSizePixel() const
std::shared_ptr< vcl::font::PhysicalFontCollection > mxFontCollection
void DrawRect(const tools::Rectangle &rRect)
SAL_DLLPRIVATE void InitFillColor()
SalGraphics * mpGraphics
Graphics context to draw on.
VclPtr< OutputDevice > mpNextGraphics
Next output device in list.
void SetTextColor(const Color &rColor)
void DrawBitmap(const Point &rDestPt, const Bitmap &rBitmap)
rtl::Reference< LogicalFontInstance > mpFontInstance
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
AntialiasingFlags mnAntialiasing
virtual Bitmap GetBitmap(const Point &rSrcPt, const Size &rSize) const
VclPtr< VirtualDevice > mpAlphaVDev
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
void DrawGradient(const tools::Rectangle &rRect, const Gradient &rGradient)
std::unique_ptr< vcl::font::PhysicalFontFaceCollection > mpFontFaceCollection
void IntersectClipRegion(const tools::Rectangle &rRect)
VclPtr< OutputDevice > mpPrevGraphics
Previous output device in list.
SAL_DLLPRIVATE void ImplUpdateFontData()
const Color & GetFillColor() const
bool sloppyEqual(const PaperInfo &rOther) const
tools::Long getWidth() const
void doSloppyFit(bool bAlsoTryRotated=false)
tools::Long getHeight() const
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
VCL_DLLPRIVATE void ImplFindPaperFormatForUserSize(JobSetup &)
virtual void DrawOutDev(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPt, const Size &rSrcSize) override
static OUString GetDefaultPrinterName()
css::awt::DeviceInfo GetDeviceInfo() const override
virtual ~Printer() override
VCL_DLLPRIVATE void ImplInitData()
static VCL_DLLPRIVATE ErrCode ImplSalPrinterErrorCodeToVCL(SalPrinterError nError)
std::unique_ptr< vcl::printer::Options > mpPrinterOptions
bool HasSupport(PrinterSupport eFeature) const
virtual void CopyArea(const Point &rDestPt, const Point &rSrcPt, const Size &rSrcSize, bool bWindowInvalidate=false) override
bool SetOrientation(Orientation eOrient)
Size GetWaveLineSize(tools::Long nLineWidth) const override
bool GetPrinterSettingsPreferred() const
bool Setup(weld::Window *pWindow, PrinterSetupMode eMode=PrinterSetupMode::DocumentGlobal)
virtual void DrawDeviceMask(const Bitmap &rMask, const Color &rMaskColor, const Point &rDestPt, const Size &rDestSize, const Point &rSrcPtPixel, const Size &rSrcSizePixel) override
VCL_DLLPRIVATE void ImplUpdateFontList()
static VCL_DLLPRIVATE SalPrinterQueueInfo * ImplGetQueueInfo(const OUString &rPrinterName, const OUString *pDriver)
SalInfoPrinter * mpInfoPrinter
virtual void ImplReleaseFonts() override
VCL_DLLPRIVATE void ImplEndPage()
bool SetPrinterProps(const Printer *pPrinter)
DuplexMode GetDuplexMode() const
virtual bool AcquireGraphics() const override
Acquire a graphics device that the output device uses to draw on.
virtual bool HasMirroredGraphics() const override
const Point & GetPageOffsetPixel() const
VCL_DLLPRIVATE void ImplInit(SalPrinterQueueInfo *pInfo)
VCL_DLLPRIVATE void ImplUpdatePageData()
sal_uInt32 GetCapabilities(PrinterCapType nType) const
bool SetJobSetup(const JobSetup &rSetup)
VCL_DLLPRIVATE void EndJob()
bool SetPaperBin(sal_uInt16 nPaperBin)
SAL_DLLPRIVATE void ImplPrintTransparent(const Bitmap &rBmp, const Point &rDestPt, const Size &rDestSize, const Point &rSrcPtPixel, const Size &rSrcSizePixel)
void SetCopyCount(sal_uInt16 nCopy, bool bCollate)
const OUString & GetDriverName() const
Point GetPageOffset() const
VCL_DLLPRIVATE void SetPrinterOptions(const vcl::printer::Options &rOptions)
SetPrinterOptions is used internally only now.
void SetPaper(Paper ePaper)
virtual void ClipAndDrawGradientMetafile(const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly) override
void SetDuplexMode(DuplexMode)
vcl::Region ClipToDeviceBounds(vcl::Region aRegion) const override
Perform actual rect clip against outdev dimensions, to generate empty clips whenever one of the value...
sal_uInt16 GetPaperBinCount() const
Size GetPaperSize() const
static void updatePrinters()
Checks the printer list and updates it necessary.
int GetPaperInfoCount() const
static const std::vector< OUString > & GetPrinterQueues()
static OUString GetPaperName(Paper ePaper)
std::unique_ptr< SalPrinter > mpPrinter
bool SetPaperSizeUser(const Size &rSize)
sal_uInt16 mnPageQueueSize
static const QueueInfo * GetQueueInfo(const OUString &rPrinterName, bool bStatusUpdate)
virtual Bitmap GetBitmap(const Point &rSrcPt, const Size &rSize) const override
Size GetSizeOfPaper() const
virtual void ReleaseGraphics(bool bRelease=true) override
Release the graphics device, and remove it from the graphics device list.
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...
const OUString & GetName() const
virtual Size GetButtonBorderSize() override
const PaperInfo & GetPaperInfo(int nPaper) const
const Size & GetPaperSizePixel() const
sal_uInt16 GetPaperBin() const
const JobSetup & GetJobSetup() const
void ImplReleaseGraphics(bool bRelease=true)
VclPtr< VirtualDevice > mpDisplayDev
void SetSystemTextColor(SystemTextColorFlags, bool) override
Orientation GetOrientation() const
virtual void EmulateDrawTransparent(const tools::PolyPolygon &rPolyPoly, sal_uInt16 nTransparencePercent) override
virtual void dispose() override
virtual bool UsePolyPolygonForComplexGradient() override
virtual tools::Rectangle GetBackgroundComponentBounds() const override
bool DrawTransformBitmapExDirect(const basegfx::B2DHomMatrix &aFullTransform, const BitmapEx &rBitmapEx, double fAlpha=1.0) override
Transform and draw a bitmap directly.
SalGraphics * mpJobGraphics
bool IsDisplayPrinter() const
virtual void SetFontOrientation(LogicalFontInstance *const pFontInstance) const override
VCL_DLLPRIVATE void ImplInitDisplay()
void SetPrinterSettingsPreferred(bool bPaperSizeFromSetup)
VCL_DLLPRIVATE void ImplStartPage()
virtual tools::Long GetGradientStepCount(tools::Long nMinRect) override
void DrawDeviceBitmapEx(const Point &rDestPt, const Size &rDestSize, const Point &rSrcPtPixel, const Size &rSrcSizePixel, BitmapEx &rBitmapEx) override
OUString GetPaperBinName(sal_uInt16 nPaperBin) const
void SetWaveLineColors(Color const &rColor, tools::Long) override
const OUString & GetDriver() const
const OUString & GetPrinterName() const
virtual void SetXORMode(bool bSet, bool bInvertOnly)=0
virtual void GetResolution(sal_Int32 &rDPIX, sal_Int32 &rDPIY)=0
void setAntiAlias(bool bNew)
virtual void SetLineColor()=0
virtual void SetFillColor()=0
virtual void GetDevFontList(vcl::font::PhysicalFontCollection *)=0
virtual void GetPageInfo(const ImplJobSetup *pSetupData, tools::Long &rOutWidth, tools::Long &rOutHeight, Point &rPageOffset, Size &rPaperSize)=0
virtual OUString GetPaperBinName(const ImplJobSetup *pSetupData, sal_uInt16 nPaperBin)=0
virtual sal_uInt16 GetPaperBinCount(const ImplJobSetup *pSetupData)=0
virtual void InitPaperFormats(const ImplJobSetup *pSetupData)=0
virtual bool SetData(JobSetFlags nFlags, ImplJobSetup *pSetupData)=0
std::vector< PaperInfo > m_aPaperFormats
virtual bool Setup(weld::Window *pFrame, ImplJobSetup *pSetupData)=0
virtual int GetLandscapeAngle(const ImplJobSetup *pSetupData)=0
virtual bool SetPrinterData(ImplJobSetup *pSetupData)=0
virtual void ReleaseGraphics(SalGraphics *pGraphics)=0
virtual sal_uInt32 GetCapabilities(const ImplJobSetup *pSetupData, PrinterCapType nType)=0
virtual SalGraphics * AcquireGraphics()=0
virtual void GetPrinterQueueInfo(ImplPrnQueueList *pList)=0
virtual OUString GetDefaultPrinter()=0
virtual void DestroyInfoPrinter(SalInfoPrinter *pPrinter)=0
virtual SalInfoPrinter * CreateInfoPrinter(SalPrinterQueueInfo *pQueueInfo, ImplJobSetup *pSetupData)=0
virtual void GetPrinterQueueState(SalPrinterQueueInfo *pInfo)=0
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
reference_type * get() const
Get the body.
static VclPtr< reference_type > Create(Arg &&... arg)
A construction helper for VclPtr.
std::unique_ptr< SalVirtualDevice > mpVirDev
void GetRegionRectangles(RectangleVector &rTarget) const
weld::Window * GetFrameWeld() const
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
#define DBG_TESTSOLARMUTEX()
#define PRINTER_GENERALERROR
tools::Long FRound(double fVal)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_N_ELEMENTS(arr)
std::unique_ptr< sal_Int32[]> pData
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
void ImplUpdateJobSetupPaper(JobSetup &rJobSetup)
void ImplDeletePrnQueueList()
static void ImplInitPrnQueueList()
constexpr sal_uInt32 QUEUE_JOBS_DONTKNOW
std::vector< tools::Rectangle > RectangleVector
std::unique_ptr< QueueInfo > mpQueueInfo
std::unique_ptr< SalPrinterQueueInfo > mpSalQueueInfo
std::unordered_map< int, OUString > maPaperNames
VclPtr< OutputDevice > mpLastVirGraphics
VclPtr< Printer > mpFirstPrnGraphics
std::unique_ptr< ImplPrnQueueList > mpPrinterQueueList
std::shared_ptr< vcl::font::PhysicalFontCollection > mxScreenFontList
VclPtr< Printer > mpFirstPrinter
std::shared_ptr< ImplFontCache > mxScreenFontCache
VclPtr< OutputDevice > mpFirstVirGraphics
VclPtr< Printer > mpLastPrnGraphics
ImplSVData * ImplGetSVData()
vcl::Window * ImplGetDefaultWindow()
Returns either the application window, or the default GL context window.
OUString VclResId(TranslateId aId)