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 _SV_GFXLINK_HXX
21 #define _SV_GFXLINK_HXX
23 #include <vcl/dllapi.h>
24 #include <tools/solar.h>
25 #include <vcl/mapmod.hxx>
26 #include <tools/stream.hxx>
37 ImpBuffer( sal_uLong nSize
)
40 mpBuffer
= nSize
? new sal_uInt8
[ nSize
] : NULL
;
43 ImpBuffer( sal_uInt8
* pBuf
) { mnRefCount
= 1UL; mpBuffer
= pBuf
; }
45 ~ImpBuffer() { delete[] mpBuffer
; }
58 ImpSwap( sal_uInt8
* pData
, sal_uLong nDataSize
);
61 sal_uInt8
* GetData() const;
63 sal_Bool
IsSwapped() const { return maURL
.getLength() > 0; }
65 void WriteTo( SvStream
& rOStm
) const;
74 MapMode maPrefMapMode
;
76 bool mbPrefMapModeValid
;
82 mbPrefMapModeValid( false ),
83 mbPrefSizeValid( false )
95 GFX_LINK_TYPE_NONE
= 0,
96 GFX_LINK_TYPE_EPS_BUFFER
= 1,
97 GFX_LINK_TYPE_NATIVE_GIF
= 2, // Don't forget to update the following defines
98 GFX_LINK_TYPE_NATIVE_JPG
= 3, // Don't forget to update the following defines
99 GFX_LINK_TYPE_NATIVE_PNG
= 4, // Don't forget to update the following defines
100 GFX_LINK_TYPE_NATIVE_TIF
= 5, // Don't forget to update the following defines
101 GFX_LINK_TYPE_NATIVE_WMF
= 6, // Don't forget to update the following defines
102 GFX_LINK_TYPE_NATIVE_MET
= 7, // Don't forget to update the following defines
103 GFX_LINK_TYPE_NATIVE_PCT
= 8, // Don't forget to update the following defines
104 GFX_LINK_TYPE_NATIVE_SVG
= 9, // Don't forget to update the following defines
105 GFX_LINK_TYPE_USER
= 0xffff
108 #define GFX_LINK_FIRST_NATIVE_ID GFX_LINK_TYPE_NATIVE_GIF
109 #define GFX_LINK_LAST_NATIVE_ID GFX_LINK_TYPE_NATIVE_SVG
120 class VCL_DLLPUBLIC GfxLink
127 sal_uInt32 mnBufSize
;
129 ImpGfxLink
* mpImpData
;
132 SAL_DLLPRIVATE
void ImplCopy( const GfxLink
& rGfxLink
);
136 GfxLink( const GfxLink
& );
137 GfxLink( const String
& rPath
, GfxLinkType nType
);
138 GfxLink( sal_uInt8
* pBuf
, sal_uInt32 nBufSize
, GfxLinkType nType
, sal_Bool bOwns
);
141 GfxLink
& operator=( const GfxLink
& );
142 sal_Bool
IsEqual( const GfxLink
& ) const;
144 GfxLinkType
GetType() const;
146 void SetUserId( sal_uInt32 nUserId
) { mnUserId
= nUserId
; }
147 sal_uInt32
GetUserId() const { return mnUserId
; }
149 sal_uInt32
GetDataSize() const;
150 void SetData( sal_uInt8
* pBuf
, sal_uInt32 nSize
, GfxLinkType nType
, sal_Bool bOwns
);
151 const sal_uInt8
* GetData() const;
153 const Size
& GetPrefSize() const;
154 void SetPrefSize( const Size
& rPrefSize
);
155 bool IsPrefSizeValid();
157 const MapMode
& GetPrefMapMode() const;
158 void SetPrefMapMode( const MapMode
& rPrefMapMode
);
159 bool IsPrefMapModeValid();
161 sal_Bool
IsNative() const;
162 sal_Bool
IsUser() const { return( GFX_LINK_TYPE_USER
== meType
); }
164 sal_Bool
LoadNative( Graphic
& rGraphic
);
166 sal_Bool
ExportNative( SvStream
& rOStream
) const;
170 sal_Bool
IsSwappedOut() const { return( mpSwap
!= NULL
); }
174 friend VCL_DLLPUBLIC SvStream
& operator<<( SvStream
& rOStream
, const GfxLink
& rGfxLink
);
175 friend VCL_DLLPUBLIC SvStream
& operator>>( SvStream
& rIStream
, GfxLink
& rGfxLink
);
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */