LCOV - code coverage report
Current view: top level - vcl/inc - image.h (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2012-08-25 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 4 75.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _SV_IMAGE_H
      30                 :            : #define _SV_IMAGE_H
      31                 :            : 
      32                 :            : #include <vcl/bitmapex.hxx>
      33                 :            : 
      34                 :            : #include <boost/unordered_map.hpp>
      35                 :            : 
      36                 :            : // ----------------
      37                 :            : // - ImplImageBmp -
      38                 :            : // ----------------
      39                 :            : 
      40                 :            : class ImplImageBmp
      41                 :            : {
      42                 :            : public:
      43                 :            : 
      44                 :            :                 ImplImageBmp();
      45                 :            :                 ~ImplImageBmp();
      46                 :            : 
      47                 :            :     void        Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHeight,sal_uInt16 nInitSize );
      48                 :            :     void        ColorTransform();
      49                 :            :     void        Draw( sal_uInt16 nPos, OutputDevice* pDev, const Point& rPos, sal_uInt16 nStyle, const Size* pSize = NULL );
      50                 :            : 
      51                 :            : private:
      52                 :            : 
      53                 :            :     BitmapEx    maBmpEx;
      54                 :            :     BitmapEx    maDisabledBmpEx;
      55                 :            :     BitmapEx*   mpDisplayBmp;
      56                 :            :     Size        maSize;
      57                 :            :     sal_uInt8*      mpInfoAry;
      58                 :            :     sal_uInt16      mnSize;
      59                 :            : 
      60                 :            :     void        ImplUpdateDisplayBmp( OutputDevice* pOutDev );
      61                 :            :     void        ImplUpdateDisabledBmpEx( int nPos );
      62                 :            : 
      63                 :            : private:    // prevent assignment and copy construction
      64                 :            :     ImplImageBmp( const ImplImageBmp& );
      65                 :            :     void operator=( const ImplImageBmp& );
      66                 :            : };
      67                 :            : 
      68                 :            : // --------------
      69                 :            : // - ImageTypes -
      70                 :            : // --------------
      71                 :            : 
      72                 :            : enum ImageType { IMAGETYPE_BITMAP, IMAGETYPE_IMAGE };
      73                 :            : 
      74                 :            : // -----------------
      75                 :            : // - ImplImageList -
      76                 :            : // -----------------
      77                 :            : 
      78                 :            : struct ImageAryData
      79                 :            : {
      80                 :            :     ::rtl::OUString maName;
      81                 :            :     // Images identified by either name, or by id
      82                 :            :     sal_uInt16          mnId;
      83                 :            :     BitmapEx        maBitmapEx;
      84                 :            : 
      85                 :            :     ImageAryData( const rtl::OUString &aName,
      86                 :            :                   sal_uInt16 nId, const BitmapEx &aBitmap );
      87                 :            :     ImageAryData( const ImageAryData& rData );
      88                 :            :     ~ImageAryData();
      89                 :            : 
      90 [ +  + ][ +  - ]:      95098 :     bool IsLoadable() { return maBitmapEx.IsEmpty() && !maName.isEmpty(); }
      91                 :            :     void Load(const rtl::OUString &rPrefix);
      92                 :            : 
      93                 :            :     ImageAryData&   operator=( const ImageAryData& rData );
      94                 :            : };
      95                 :            : 
      96                 :            : // ------------------------------------------------------------------------------
      97                 :            : 
      98                 :            : struct ImplImageList
      99                 :            : {
     100                 :            :     typedef std::vector<ImageAryData *> ImageAryDataVec;
     101                 :            :     typedef boost::unordered_map< rtl::OUString, ImageAryData *, rtl::OUStringHash >
     102                 :            :         ImageAryDataNameHash;
     103                 :            : 
     104                 :            :     ImageAryDataVec             maImages;
     105                 :            :     ImageAryDataNameHash        maNameHash;
     106                 :            :     rtl::OUString               maPrefix;
     107                 :            :     Size                        maImageSize;
     108                 :            :     sal_uIntPtr                       mnRefCount;
     109                 :            : 
     110                 :            :     ImplImageList();
     111                 :            :     ImplImageList( const ImplImageList &aSrc );
     112                 :            :     ~ImplImageList();
     113                 :            : 
     114                 :            :     void AddImage( const ::rtl::OUString &aName,
     115                 :            :                    sal_uInt16 nId, const BitmapEx &aBitmapEx );
     116                 :            :     void RemoveImage( sal_uInt16 nPos );
     117                 :            : };
     118                 :            : 
     119                 :            : // --------------------
     120                 :            : // - ImplImageRefData -
     121                 :            : // --------------------
     122                 :            : 
     123                 :            : struct ImplImageRefData
     124                 :            : {
     125                 :            :     ImplImageList*  mpImplData;
     126                 :            :     sal_uInt16          mnIndex;
     127                 :            : 
     128                 :            :                     ImplImageRefData() {}    // Um Warning zu umgehen
     129                 :            :                     ~ImplImageRefData();
     130                 :            : 
     131                 :            :     sal_Bool            IsEqual( const ImplImageRefData& rData );
     132                 :            : };
     133                 :            : 
     134                 :            : // ----------------
     135                 :            : // - ImpImageData -
     136                 :            : // ----------------
     137                 :            : 
     138                 :            : struct ImplImageData
     139                 :            : {
     140                 :            :     ImplImageBmp*   mpImageBitmap;
     141                 :            :     BitmapEx        maBmpEx;
     142                 :            : 
     143                 :            :                     ImplImageData( const BitmapEx& rBmpEx );
     144                 :            :                     ~ImplImageData();
     145                 :            : 
     146                 :            :     sal_Bool            IsEqual( const ImplImageData& rData );
     147                 :            : };
     148                 :            : 
     149                 :            : // -------------
     150                 :            : // - ImplImage -
     151                 :            : // -------------
     152                 :            : 
     153                 :            : struct ImplImage
     154                 :            : {
     155                 :            :     sal_uIntPtr         mnRefCount;
     156                 :            :     // TODO: use inheritance to get rid of meType+mpData
     157                 :            :     void*           mpData;
     158                 :            :     ImageType       meType;
     159                 :            : 
     160                 :            :                     ImplImage();
     161                 :            :                     ~ImplImage();
     162                 :            : 
     163                 :            : private:    // prevent assignment and copy construction
     164                 :            :             ImplImage( const ImplImage&);
     165                 :            :     void    operator=( const ImplImage&);
     166                 :            : };
     167                 :            : 
     168                 :            : #endif // _SV_IMAGE_H
     169                 :            : 
     170                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10