tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / vcl / inc / win / salbmp.h
blob2edf291342cc491952da00431cf09afc8bb05164
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include <tools/gen.hxx>
23 #include <win/wincomp.hxx>
24 #include <salbmp.hxx>
25 #include <basegfx/utils/systemdependentdata.hxx>
26 #include <memory>
29 struct BitmapBuffer;
30 class BitmapColor;
31 class BitmapPalette;
32 class SalGraphics;
33 namespace Gdiplus { class Bitmap; }
35 class WinSalBitmap final: public SalBitmap, public basegfx::SystemDependentDataHolder
37 private:
38 Size maSize;
39 HGLOBAL mhDIB;
40 HBITMAP mhDDB;
42 sal_uInt16 mnBitCount;
44 std::shared_ptr<Gdiplus::Bitmap> ImplCreateGdiPlusBitmap(const WinSalBitmap& rAlphaSource);
45 std::shared_ptr<Gdiplus::Bitmap> ImplCreateGdiPlusBitmap();
47 public:
49 HGLOBAL ImplGethDIB() const { return mhDIB; }
50 HBITMAP ImplGethDDB() const { return mhDDB; }
52 std::shared_ptr< Gdiplus::Bitmap > ImplGetGdiPlusBitmap(const WinSalBitmap* pAlphaSource = nullptr) const;
54 static HGLOBAL ImplCreateDIB( const Size& rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal );
55 static HANDLE ImplCopyDIBOrDDB( HANDLE hHdl, bool bDIB );
56 static sal_uInt16 ImplGetDIBColorCount( HGLOBAL hDIB );
58 public:
60 WinSalBitmap();
61 virtual ~WinSalBitmap() override;
63 using SalBitmap::addOrReplaceSystemDependentData;
64 using SalBitmap::getSystemDependentData;
65 using SystemDependentDataHolder::addOrReplaceSystemDependentData;
66 using SystemDependentDataHolder::getSystemDependentData;
68 public:
70 bool Create( HANDLE hBitmap );
71 virtual bool Create( const Size& rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal ) override;
72 virtual bool Create( const SalBitmap& rSalBmpImpl ) override;
73 virtual bool Create( const SalBitmap& rSalBmpImpl, SalGraphics* pGraphics ) override;
74 virtual bool Create( const SalBitmap& rSalBmpImpl, vcl::PixelFormat eNewPixelFormat ) override;
75 virtual bool Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas,
76 Size& rSize,
77 bool bMask = false ) override;
79 virtual void Destroy() override;
81 virtual Size GetSize() const override { return maSize; }
82 virtual sal_uInt16 GetBitCount() const override { return mnBitCount; }
84 virtual BitmapBuffer* AcquireBuffer( BitmapAccessMode nMode ) override;
85 virtual void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override;
86 virtual bool GetSystemData( BitmapSystemData& rData ) override;
88 virtual bool ScalingSupported() const override;
89 virtual bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ) override;
90 virtual bool Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uInt8 nTol ) override;
92 virtual const basegfx::SystemDependentDataHolder* accessSystemDependentDataHolder() const override;
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */