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

Generated by: LCOV version 1.11