LCOV - code coverage report
Current view: top level - include/vcl - gfxlink.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 14 0.0 %
Date: 2014-04-14 Functions: 0 10 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 <rtl/ustring.hxx>
      24             : #include <tools/stream.hxx>
      25             : #include <tools/solar.h>
      26             : #include <vcl/dllapi.h>
      27             : #include <vcl/mapmod.hxx>
      28             : 
      29             : 
      30             : // - ImpBuffer -
      31             : 
      32             : 
      33             : struct ImpBuffer
      34             : {
      35             :     sal_uLong       mnRefCount;
      36             :     sal_uInt8*      mpBuffer;
      37             : 
      38           0 :                 ImpBuffer( sal_uLong nSize )
      39             :                 {
      40           0 :                     mnRefCount = 1UL;
      41           0 :                     mpBuffer = nSize ? new sal_uInt8[ nSize ] : NULL;
      42           0 :                 }
      43             : 
      44           0 :                 ImpBuffer( sal_uInt8* pBuf ) { mnRefCount = 1UL; mpBuffer = pBuf; }
      45             : 
      46           0 :                 ~ImpBuffer() { delete[] mpBuffer; }
      47             : };
      48             : 
      49             : 
      50             : // - ImpSwap -
      51             : 
      52             : 
      53             : struct ImpSwap
      54             : {
      55             :     OUString   maURL;
      56             :     sal_uLong           mnDataSize;
      57             :     sal_uLong           mnRefCount;
      58             : 
      59             :                     ImpSwap( sal_uInt8* pData, sal_uLong nDataSize );
      60             :                     ~ImpSwap();
      61             : 
      62             :     sal_uInt8*          GetData() const;
      63             : 
      64           0 :     bool            IsSwapped() const { return maURL.getLength() > 0; }
      65             : 
      66             :     void            WriteTo( SvStream& rOStm ) const;
      67             : };
      68             : 
      69             : 
      70             : // - ImpGfxLink -
      71             : 
      72             : 
      73           0 : struct ImpGfxLink
      74             : {
      75             :     MapMode         maPrefMapMode;
      76             :     Size            maPrefSize;
      77             :     bool            mbPrefMapModeValid;
      78             :     bool            mbPrefSizeValid;
      79             : 
      80           0 :     ImpGfxLink() :
      81             :         maPrefMapMode(),
      82             :         maPrefSize(),
      83             :         mbPrefMapModeValid( false ),
      84           0 :         mbPrefSizeValid( false )
      85           0 :     {}
      86             : };
      87             : 
      88             : //#endif // __PRIVATE
      89             : 
      90             : 
      91             : // - GfxLinkType -
      92             : 
      93             : 
      94             : enum GfxLinkType
      95             : {
      96             :     GFX_LINK_TYPE_NONE          = 0,
      97             :     GFX_LINK_TYPE_EPS_BUFFER    = 1,
      98             :     GFX_LINK_TYPE_NATIVE_GIF    = 2,    // Don't forget to update the following defines
      99             :     GFX_LINK_TYPE_NATIVE_JPG    = 3,    // Don't forget to update the following defines
     100             :     GFX_LINK_TYPE_NATIVE_PNG    = 4,    // Don't forget to update the following defines
     101             :     GFX_LINK_TYPE_NATIVE_TIF    = 5,    // Don't forget to update the following defines
     102             :     GFX_LINK_TYPE_NATIVE_WMF    = 6,    // Don't forget to update the following defines
     103             :     GFX_LINK_TYPE_NATIVE_MET    = 7,    // Don't forget to update the following defines
     104             :     GFX_LINK_TYPE_NATIVE_PCT    = 8,    // Don't forget to update the following defines
     105             :     GFX_LINK_TYPE_NATIVE_SVG    = 9,    // Don't forget to update the following defines
     106             :     GFX_LINK_TYPE_NATIVE_MOV    = 10,   // Don't forget to update the following defines
     107             :     // #i15508# added BMP type support
     108             :     GFX_LINK_TYPE_NATIVE_BMP    = 11,   // Don't forget to update the following defines
     109             :     GFX_LINK_TYPE_USER          = 0xffff
     110             : };
     111             : 
     112             : #define GFX_LINK_FIRST_NATIVE_ID    GFX_LINK_TYPE_NATIVE_GIF
     113             : #define GFX_LINK_LAST_NATIVE_ID     GFX_LINK_TYPE_NATIVE_BMP
     114             : 
     115             : 
     116             : // - GfxLink -
     117             : 
     118             : 
     119             : struct ImpBuffer;
     120             : struct ImpSwap;
     121             : struct ImpGfxLink;
     122             : class Graphic;
     123             : 
     124             : class VCL_DLLPUBLIC GfxLink
     125             : {
     126             : private:
     127             : 
     128             :     GfxLinkType         meType;
     129             :     ImpBuffer*          mpBuf;
     130             :     ImpSwap*            mpSwap;
     131             :     sal_uInt32          mnBufSize;
     132             :     sal_uInt32          mnUserId;
     133             :     ImpGfxLink*         mpImpData;
     134             : 
     135             :     SAL_DLLPRIVATE void ImplCopy( const GfxLink& rGfxLink );
     136             : 
     137             : public:
     138             :                         GfxLink();
     139             :                         GfxLink( const GfxLink& );
     140             :                         GfxLink( const OUString& rPath, GfxLinkType nType );
     141             :                         GfxLink( sal_uInt8* pBuf, sal_uInt32 nBufSize, GfxLinkType nType, bool bOwns );
     142             :                         ~GfxLink();
     143             : 
     144             :     GfxLink&            operator=( const GfxLink& );
     145             :     bool            IsEqual( const GfxLink& ) const;
     146             : 
     147             :     GfxLinkType         GetType() const;
     148             : 
     149           0 :     void                SetUserId( sal_uInt32 nUserId ) { mnUserId = nUserId; }
     150           0 :     sal_uInt32          GetUserId() const { return mnUserId; }
     151             : 
     152             :     sal_uInt32          GetDataSize() const;
     153             :     void                SetData( sal_uInt8* pBuf, sal_uInt32 nSize, GfxLinkType nType, bool bOwns );
     154             :     const sal_uInt8*            GetData() const;
     155             : 
     156             :     const Size&         GetPrefSize() const;
     157             :     void                SetPrefSize( const Size& rPrefSize );
     158             :     bool                IsPrefSizeValid();
     159             : 
     160             :     const MapMode&      GetPrefMapMode() const;
     161             :     void                SetPrefMapMode( const MapMode& rPrefMapMode );
     162             :     bool                IsPrefMapModeValid();
     163             : 
     164             :     bool                IsNative() const;
     165             :     bool                IsUser() const { return( GFX_LINK_TYPE_USER == meType ); }
     166             : 
     167             :     bool                LoadNative( Graphic& rGraphic );
     168             : 
     169             :     bool                ExportNative( SvStream& rOStream ) const;
     170             : 
     171             :     void                SwapOut();
     172             :     void                SwapIn();
     173           0 :     bool                IsSwappedOut() const { return( mpSwap != NULL ); }
     174             : 
     175             : public:
     176             : 
     177             :     friend VCL_DLLPUBLIC SvStream&  WriteGfxLink( SvStream& rOStream, const GfxLink& rGfxLink );
     178             :     friend VCL_DLLPUBLIC SvStream&  ReadGfxLink( SvStream& rIStream, GfxLink& rGfxLink );
     179             : };
     180             : 
     181             : #endif
     182             : 
     183             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10