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 <rtl/ustring.hxx>
24 #include <tools/stream.hxx>
25 #include <tools/gen.hxx>
26 #include <tools/solar.h>
27 #include <vcl/dllapi.h>
28 #include <vcl/mapmod.hxx>
39 ImpBuffer( sal_uLong nSize
)
42 mpBuffer
= nSize
? new sal_uInt8
[ nSize
] : NULL
;
45 ImpBuffer( sal_uInt8
* pBuf
) { mnRefCount
= 1UL; mpBuffer
= pBuf
; }
47 ~ImpBuffer() { delete[] mpBuffer
; }
60 ImpSwap( sal_uInt8
* pData
, sal_uLong nDataSize
);
63 sal_uInt8
* GetData() const;
65 bool IsSwapped() const { return maURL
.getLength() > 0; }
67 void WriteTo( SvStream
& rOStm
) const;
76 MapMode maPrefMapMode
;
78 bool mbPrefMapModeValid
;
84 mbPrefMapModeValid( false ),
85 mbPrefSizeValid( false )
97 GFX_LINK_TYPE_NONE
= 0,
98 GFX_LINK_TYPE_EPS_BUFFER
= 1,
99 GFX_LINK_TYPE_NATIVE_GIF
= 2, // Don't forget to update the following defines
100 GFX_LINK_TYPE_NATIVE_JPG
= 3, // Don't forget to update the following defines
101 GFX_LINK_TYPE_NATIVE_PNG
= 4, // Don't forget to update the following defines
102 GFX_LINK_TYPE_NATIVE_TIF
= 5, // Don't forget to update the following defines
103 GFX_LINK_TYPE_NATIVE_WMF
= 6, // Don't forget to update the following defines
104 GFX_LINK_TYPE_NATIVE_MET
= 7, // Don't forget to update the following defines
105 GFX_LINK_TYPE_NATIVE_PCT
= 8, // Don't forget to update the following defines
106 GFX_LINK_TYPE_NATIVE_SVG
= 9, // Don't forget to update the following defines
107 GFX_LINK_TYPE_NATIVE_MOV
= 10, // Don't forget to update the following defines
108 // #i15508# added BMP type support
109 GFX_LINK_TYPE_NATIVE_BMP
= 11, // Don't forget to update the following defines
110 GFX_LINK_TYPE_USER
= 0xffff
113 #define GFX_LINK_FIRST_NATIVE_ID GFX_LINK_TYPE_NATIVE_GIF
114 #define GFX_LINK_LAST_NATIVE_ID GFX_LINK_TYPE_NATIVE_BMP
125 class VCL_DLLPUBLIC GfxLink
132 sal_uInt32 mnBufSize
;
134 ImpGfxLink
* mpImpData
;
136 SAL_DLLPRIVATE
void ImplCopy( const GfxLink
& rGfxLink
);
140 GfxLink( const GfxLink
& );
141 GfxLink( const OUString
& rPath
, GfxLinkType nType
);
142 GfxLink( sal_uInt8
* pBuf
, sal_uInt32 nBufSize
, GfxLinkType nType
, bool bOwns
);
145 GfxLink
& operator=( const GfxLink
& );
146 bool IsEqual( const GfxLink
& ) const;
148 GfxLinkType
GetType() const { return meType
;}
150 void SetUserId( sal_uInt32 nUserId
) { mnUserId
= nUserId
; }
151 sal_uInt32
GetUserId() const { return mnUserId
; }
153 sal_uInt32
GetDataSize() const { return mnBufSize
;}
154 void SetData( sal_uInt8
* pBuf
, sal_uInt32 nSize
, GfxLinkType nType
, bool bOwns
);
155 const sal_uInt8
* GetData() const;
157 const Size
& GetPrefSize() const { return mpImpData
->maPrefSize
;}
158 void SetPrefSize( const Size
& rPrefSize
);
159 bool IsPrefSizeValid() { return mpImpData
->mbPrefSizeValid
;}
161 const MapMode
& GetPrefMapMode() const { return mpImpData
->maPrefMapMode
;}
162 void SetPrefMapMode( const MapMode
& rPrefMapMode
);
163 bool IsPrefMapModeValid() { return mpImpData
->mbPrefMapModeValid
;}
165 bool IsNative() const;
166 bool IsUser() const { return( GFX_LINK_TYPE_USER
== meType
); }
168 bool LoadNative( Graphic
& rGraphic
);
170 bool ExportNative( SvStream
& rOStream
) const;
174 bool IsSwappedOut() const { return( mpSwap
!= NULL
); }
178 friend VCL_DLLPUBLIC SvStream
& WriteGfxLink( SvStream
& rOStream
, const GfxLink
& rGfxLink
);
179 friend VCL_DLLPUBLIC SvStream
& ReadGfxLink( SvStream
& rIStream
, GfxLink
& rGfxLink
);
184 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */