LibreOffice Module vcl (master)  1
gfxlink.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_VCL_GFXLINK_HXX
21 #define INCLUDED_VCL_GFXLINK_HXX
22 
23 #include <tools/gen.hxx>
24 #include <vcl/dllapi.h>
25 #include <vcl/mapmod.hxx>
27 #include <memory>
28 
29 class SvStream;
30 
36 enum class GfxLinkType
37 {
38  NONE = 0,
39  EpsBuffer = 1,
40  NativeGif = 2,
41  NativeJpg = 3,
42  NativePng = 4,
43  NativeTif = 5,
44  NativeWmf = 6,
45  NativeMet = 7,
46  NativePct = 8,
47  NativeSvg = 9,
48  NativeMov = 10,
49  NativeBmp = 11,
50  NativePdf = 12,
51  NativeWebp = 13, // If a new type is added, make sure to change NativeLast too
52 
53  // Alias for when the first native type starts and last native
54  // type ends.
57 };
58 
59 class Graphic;
60 
62 {
63 private:
65  sal_uInt32 mnUserId;
67  mutable size_t maHash;
72 
73 public:
74  GfxLink();
75  explicit GfxLink(std::unique_ptr<sal_uInt8[]> pBuf, sal_uInt32 nBufSize, GfxLinkType nType);
76  explicit GfxLink(BinaryDataContainer const & rDataConainer, GfxLinkType nType);
77 
78  bool operator==( const GfxLink& ) const;
79 
80  GfxLinkType GetType() const { return meType;}
81 
82  size_t GetHash() const;
83 
84  void SetUserId( sal_uInt32 nUserId ) { mnUserId = nUserId; }
85  sal_uInt32 GetUserId() const { return mnUserId; }
86 
87  sal_uInt32 GetDataSize() const { return maDataContainer.getSize(); }
88  const sal_uInt8* GetData() const;
89 
91  {
92  return maDataContainer;
93  }
94 
95  const Size& GetPrefSize() const { return maPrefSize;}
96  void SetPrefSize( const Size& rPrefSize );
97  bool IsPrefSizeValid() const { return mbPrefSizeValid;}
98 
99  const MapMode& GetPrefMapMode() const { return maPrefMapMode;}
100  void SetPrefMapMode( const MapMode& rPrefMapMode );
101  bool IsPrefMapModeValid() const { return mbPrefMapModeValid;}
102 
103  bool IsNative() const;
104 
105  bool LoadNative( Graphic& rGraphic ) const;
106 
107  bool ExportNative( SvStream& rOStream ) const;
108 
109  bool IsEMF() const; // WMF & EMF stored under the same type (NativeWmf)
110 };
111 
112 #endif
113 
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
Container for the binary data, whose responsibility is to manage the make it as simple as possible to...
bool operator==(const ItalicMatrix &a, const ItalicMatrix &b)
Definition: vclenum.hxx:203
unsigned char sal_uInt8