nss: upgrade to release 3.73
[LibreOffice.git] / include / vcl / gfxlink.hxx
blob72352f6902a155f1de25ad9c4e9714529fa747af
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 #ifndef INCLUDED_VCL_GFXLINK_HXX
21 #define INCLUDED_VCL_GFXLINK_HXX
23 #include <tools/gen.hxx>
24 #include <vcl/dllapi.h>
25 #include <vcl/mapmod.hxx>
26 #include <memory>
28 class SvStream;
30 /** GfxLink graphic types that are supported by GfxLink.
32 * It is important that the numbers for native types stay the same, because
33 * they are used in serialization to MTF.
35 enum class GfxLinkType
37 NONE = 0,
38 EpsBuffer = 1,
39 NativeGif = 2,
40 NativeJpg = 3,
41 NativePng = 4,
42 NativeTif = 5,
43 NativeWmf = 6,
44 NativeMet = 7,
45 NativePct = 8,
46 NativeSvg = 9,
47 NativeMov = 10,
48 NativeBmp = 11,
49 NativePdf = 12, // If a new type is added, make sure to change NativeLast too
51 // Alias for when the first native type starts and last native
52 // type ends.
53 NativeFirst = NativeGif,
54 NativeLast = NativePdf,
57 class Graphic;
59 class VCL_DLLPUBLIC GfxLink
61 private:
62 GfxLinkType meType;
63 sal_uInt32 mnUserId;
64 mutable std::shared_ptr<sal_uInt8> mpSwapInData;
65 mutable size_t maHash;
66 sal_uInt32 mnSwapInDataSize;
67 MapMode maPrefMapMode;
68 Size maPrefSize;
69 bool mbPrefMapModeValid;
70 bool mbPrefSizeValid;
72 SAL_DLLPRIVATE std::shared_ptr<sal_uInt8> GetSwapInData() const;
73 public:
74 GfxLink();
76 // pBuff = The Graphic data. This class takes ownership of this
77 GfxLink( std::unique_ptr<sal_uInt8[]> pBuf, sal_uInt32 nBufSize, GfxLinkType nType );
79 bool operator==( const GfxLink& ) const;
81 GfxLinkType GetType() const { return meType;}
83 size_t GetHash() const;
85 void SetUserId( sal_uInt32 nUserId ) { mnUserId = nUserId; }
86 sal_uInt32 GetUserId() const { return mnUserId; }
88 sal_uInt32 GetDataSize() const { return mnSwapInDataSize;}
89 const sal_uInt8* GetData() const;
91 const Size& GetPrefSize() const { return maPrefSize;}
92 void SetPrefSize( const Size& rPrefSize );
93 bool IsPrefSizeValid() const { return mbPrefSizeValid;}
95 const MapMode& GetPrefMapMode() const { return maPrefMapMode;}
96 void SetPrefMapMode( const MapMode& rPrefMapMode );
97 bool IsPrefMapModeValid() const { return mbPrefMapModeValid;}
99 bool IsNative() const;
101 bool LoadNative( Graphic& rGraphic );
103 bool ExportNative( SvStream& rOStream ) const;
105 bool IsEMF() const; // WMF & EMF stored under the same type (NativeWmf)
108 #endif
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */