LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/vcl - gfxlink.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 9 14 64.3 %
Date: 2012-12-27 Functions: 8 10 80.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 _SV_GFXLINK_HXX
      21             : #define _SV_GFXLINK_HXX
      22             : 
      23             : #include <vcl/dllapi.h>
      24             : #include <tools/solar.h>
      25             : #include <vcl/mapmod.hxx>
      26             : #include <tools/stream.hxx>
      27             : 
      28             : // -------------
      29             : // - ImpBuffer -
      30             : // -------------
      31             : 
      32             : struct ImpBuffer
      33             : {
      34             :     sal_uLong       mnRefCount;
      35             :     sal_uInt8*      mpBuffer;
      36             : 
      37           0 :                 ImpBuffer( sal_uLong nSize )
      38             :                 {
      39           0 :                     mnRefCount = 1UL;
      40           0 :                     mpBuffer = nSize ? new sal_uInt8[ nSize ] : NULL;
      41           0 :                 }
      42             : 
      43          49 :                 ImpBuffer( sal_uInt8* pBuf ) { mnRefCount = 1UL; mpBuffer = pBuf; }
      44             : 
      45          49 :                 ~ImpBuffer() { delete[] mpBuffer; }
      46             : };
      47             : 
      48             : // -----------
      49             : // - ImpSwap -
      50             : // -----------
      51             : 
      52             : struct ImpSwap
      53             : {
      54             :     rtl::OUString   maURL;
      55             :     sal_uLong           mnDataSize;
      56             :     sal_uLong           mnRefCount;
      57             : 
      58             :                     ImpSwap( sal_uInt8* pData, sal_uLong nDataSize );
      59             :                     ~ImpSwap();
      60             : 
      61             :     sal_uInt8*          GetData() const;
      62             : 
      63          96 :     sal_Bool            IsSwapped() const { return maURL.getLength() > 0; }
      64             : 
      65             :     void            WriteTo( SvStream& rOStm ) const;
      66             : };
      67             : 
      68             : // --------------
      69             : // - ImpGfxLink -
      70             : // --------------
      71             : 
      72        5201 : struct ImpGfxLink
      73             : {
      74             :     MapMode         maPrefMapMode;
      75             :     Size            maPrefSize;
      76             :     bool            mbPrefMapModeValid;
      77             :     bool            mbPrefSizeValid;
      78             : 
      79        3561 :     ImpGfxLink() :
      80             :         maPrefMapMode(),
      81             :         maPrefSize(),
      82             :         mbPrefMapModeValid( false ),
      83        3561 :         mbPrefSizeValid( false )
      84        3561 :     {}
      85             : };
      86             : 
      87             : //#endif // __PRIVATE
      88             : 
      89             : // ---------------
      90             : // - GfxLinkType -
      91             : // ---------------
      92             : 
      93             : enum GfxLinkType
      94             : {
      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
     106             : };
     107             : 
     108             : #define GFX_LINK_FIRST_NATIVE_ID    GFX_LINK_TYPE_NATIVE_GIF
     109             : #define GFX_LINK_LAST_NATIVE_ID     GFX_LINK_TYPE_NATIVE_SVG
     110             : 
     111             : // -----------
     112             : // - GfxLink -
     113             : // -----------
     114             : 
     115             : struct ImpBuffer;
     116             : struct ImpSwap;
     117             : struct ImpGfxLink;
     118             : class Graphic;
     119             : 
     120             : class VCL_DLLPUBLIC GfxLink
     121             : {
     122             : private:
     123             : 
     124             :     GfxLinkType         meType;
     125             :     ImpBuffer*          mpBuf;
     126             :     ImpSwap*            mpSwap;
     127             :     sal_uInt32          mnBufSize;
     128             :     sal_uInt32          mnUserId;
     129             :     ImpGfxLink*         mpImpData;
     130             :     sal_uLong               mnExtra2;
     131             : 
     132             :     SAL_DLLPRIVATE void ImplCopy( const GfxLink& rGfxLink );
     133             : 
     134             : public:
     135             :                         GfxLink();
     136             :                         GfxLink( const GfxLink& );
     137             :                         GfxLink( const String& rPath, GfxLinkType nType );
     138             :                         GfxLink( sal_uInt8* pBuf, sal_uInt32 nBufSize, GfxLinkType nType, sal_Bool bOwns );
     139             :                         ~GfxLink();
     140             : 
     141             :     GfxLink&            operator=( const GfxLink& );
     142             :     sal_Bool            IsEqual( const GfxLink& ) const;
     143             : 
     144             :     GfxLinkType         GetType() const;
     145             : 
     146           0 :     void                SetUserId( sal_uInt32 nUserId ) { mnUserId = nUserId; }
     147          10 :     sal_uInt32          GetUserId() const { return mnUserId; }
     148             : 
     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;
     152             : 
     153             :     const Size&         GetPrefSize() const;
     154             :     void                SetPrefSize( const Size& rPrefSize );
     155             :     bool                IsPrefSizeValid();
     156             : 
     157             :     const MapMode&      GetPrefMapMode() const;
     158             :     void                SetPrefMapMode( const MapMode& rPrefMapMode );
     159             :     bool                IsPrefMapModeValid();
     160             : 
     161             :     sal_Bool                IsNative() const;
     162             :     sal_Bool                IsUser() const { return( GFX_LINK_TYPE_USER == meType ); }
     163             : 
     164             :     sal_Bool                LoadNative( Graphic& rGraphic );
     165             : 
     166             :     sal_Bool                ExportNative( SvStream& rOStream ) const;
     167             : 
     168             :     void                SwapOut();
     169             :     void                SwapIn();
     170         224 :     sal_Bool                IsSwappedOut() const { return( mpSwap != NULL ); }
     171             : 
     172             : public:
     173             : 
     174             :     friend VCL_DLLPUBLIC SvStream&  operator<<( SvStream& rOStream, const GfxLink& rGfxLink );
     175             :     friend VCL_DLLPUBLIC SvStream&  operator>>( SvStream& rIStream, GfxLink& rGfxLink );
     176             : };
     177             : 
     178             : #endif
     179             : 
     180             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10