1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <vcl/BinaryDataContainer.hxx>
31 /** GfxLink graphic types that are supported by GfxLink.
33 * It is important that the numbers for native types stay the same, because
34 * they are used in serialization to MTF.
36 enum class GfxLinkType
50 NativePdf
= 12, // If a new type is added, make sure to change NativeLast too
52 // Alias for when the first native type starts and last native
54 NativeFirst
= NativeGif
,
55 NativeLast
= NativePdf
,
60 class VCL_DLLPUBLIC GfxLink
65 BinaryDataContainer maDataContainer
;
66 mutable size_t maHash
;
67 MapMode maPrefMapMode
;
69 bool mbPrefMapModeValid
;
74 explicit GfxLink(std::unique_ptr
<sal_uInt8
[]> pBuf
, sal_uInt32 nBufSize
, GfxLinkType nType
);
75 explicit GfxLink(BinaryDataContainer
const & rDataConainer
, GfxLinkType nType
);
77 bool operator==( const GfxLink
& ) const;
79 GfxLinkType
GetType() const { return meType
;}
81 size_t GetHash() const;
83 void SetUserId( sal_uInt32 nUserId
) { mnUserId
= nUserId
; }
84 sal_uInt32
GetUserId() const { return mnUserId
; }
86 sal_uInt32
GetDataSize() const { return maDataContainer
.getSize(); }
87 const sal_uInt8
* GetData() const;
89 const BinaryDataContainer
& getDataContainer() const
91 return maDataContainer
;
94 const Size
& GetPrefSize() const { return maPrefSize
;}
95 void SetPrefSize( const Size
& rPrefSize
);
96 bool IsPrefSizeValid() const { return mbPrefSizeValid
;}
98 const MapMode
& GetPrefMapMode() const { return maPrefMapMode
;}
99 void SetPrefMapMode( const MapMode
& rPrefMapMode
);
100 bool IsPrefMapModeValid() const { return mbPrefMapModeValid
;}
102 bool IsNative() const;
104 bool LoadNative( Graphic
& rGraphic
) const;
106 bool ExportNative( SvStream
& rOStream
) const;
108 bool IsEMF() const; // WMF & EMF stored under the same type (NativeWmf)
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */