LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/vcl/inc - image.h (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1 100.0 %
Date: 2013-07-09 Functions: 1 1 100.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_IMAGE_H
      21             : #define _SV_IMAGE_H
      22             : 
      23             : #include <vcl/bitmapex.hxx>
      24             : 
      25             : #include <boost/unordered_map.hpp>
      26             : 
      27             : // ----------------
      28             : // - ImplImageBmp -
      29             : // ----------------
      30             : 
      31             : class ImplImageBmp
      32             : {
      33             : public:
      34             : 
      35             :                 ImplImageBmp();
      36             :                 ~ImplImageBmp();
      37             : 
      38             :     void        Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHeight,sal_uInt16 nInitSize );
      39             :     void        ColorTransform();
      40             :     void        Draw( sal_uInt16 nPos, OutputDevice* pDev, const Point& rPos, sal_uInt16 nStyle, const Size* pSize = NULL );
      41             : 
      42             : private:
      43             : 
      44             :     BitmapEx    maBmpEx;
      45             :     BitmapEx    maDisabledBmpEx;
      46             :     BitmapEx*   mpDisplayBmp;
      47             :     Size        maSize;
      48             :     sal_uInt8*      mpInfoAry;
      49             :     sal_uInt16      mnSize;
      50             : 
      51             :     void        ImplUpdateDisplayBmp( OutputDevice* pOutDev );
      52             :     void        ImplUpdateDisabledBmpEx( int nPos );
      53             : 
      54             : private:    // prevent assignment and copy construction
      55             :     ImplImageBmp( const ImplImageBmp& );
      56             :     void operator=( const ImplImageBmp& );
      57             : };
      58             : 
      59             : // --------------
      60             : // - ImageTypes -
      61             : // --------------
      62             : 
      63             : enum ImageType { IMAGETYPE_BITMAP, IMAGETYPE_IMAGE };
      64             : 
      65             : // -----------------
      66             : // - ImplImageList -
      67             : // -----------------
      68             : 
      69             : struct ImageAryData
      70             : {
      71             :     OUString maName;
      72             :     // Images identified by either name, or by id
      73             :     sal_uInt16          mnId;
      74             :     BitmapEx        maBitmapEx;
      75             : 
      76             :     ImageAryData( const OUString &aName,
      77             :                   sal_uInt16 nId, const BitmapEx &aBitmap );
      78             :     ImageAryData( const ImageAryData& rData );
      79             :     ~ImageAryData();
      80             : 
      81       60922 :     bool IsLoadable() { return maBitmapEx.IsEmpty() && !maName.isEmpty(); }
      82             :     void Load(const OUString &rPrefix);
      83             : 
      84             :     ImageAryData&   operator=( const ImageAryData& rData );
      85             : };
      86             : 
      87             : // ------------------------------------------------------------------------------
      88             : 
      89             : struct ImplImageList
      90             : {
      91             :     typedef std::vector<ImageAryData *> ImageAryDataVec;
      92             :     typedef boost::unordered_map< OUString, ImageAryData *, OUStringHash >
      93             :         ImageAryDataNameHash;
      94             : 
      95             :     ImageAryDataVec             maImages;
      96             :     ImageAryDataNameHash        maNameHash;
      97             :     OUString               maPrefix;
      98             :     Size                        maImageSize;
      99             :     sal_uIntPtr                       mnRefCount;
     100             : 
     101             :     ImplImageList();
     102             :     ImplImageList( const ImplImageList &aSrc );
     103             :     ~ImplImageList();
     104             : 
     105             :     void AddImage( const OUString &aName,
     106             :                    sal_uInt16 nId, const BitmapEx &aBitmapEx );
     107             :     void RemoveImage( sal_uInt16 nPos );
     108             : };
     109             : 
     110             : // --------------------
     111             : // - ImplImageRefData -
     112             : // --------------------
     113             : 
     114             : struct ImplImageRefData
     115             : {
     116             :     ImplImageList*  mpImplData;
     117             :     sal_uInt16          mnIndex;
     118             : 
     119             :                     ImplImageRefData() {}    // Um Warning zu umgehen
     120             :                     ~ImplImageRefData();
     121             : 
     122             :     sal_Bool            IsEqual( const ImplImageRefData& rData );
     123             : };
     124             : 
     125             : // ----------------
     126             : // - ImpImageData -
     127             : // ----------------
     128             : 
     129             : struct ImplImageData
     130             : {
     131             :     ImplImageBmp*   mpImageBitmap;
     132             :     BitmapEx        maBmpEx;
     133             : 
     134             :                     ImplImageData( const BitmapEx& rBmpEx );
     135             :                     ~ImplImageData();
     136             : 
     137             :     sal_Bool            IsEqual( const ImplImageData& rData );
     138             : };
     139             : 
     140             : // -------------
     141             : // - ImplImage -
     142             : // -------------
     143             : 
     144             : struct ImplImage
     145             : {
     146             :     sal_uIntPtr         mnRefCount;
     147             :     // TODO: use inheritance to get rid of meType+mpData
     148             :     void*           mpData;
     149             :     ImageType       meType;
     150             : 
     151             :                     ImplImage();
     152             :                     ~ImplImage();
     153             : 
     154             : private:    // prevent assignment and copy construction
     155             :             ImplImage( const ImplImage&);
     156             :     void    operator=( const ImplImage&);
     157             : };
     158             : 
     159             : #endif // _SV_IMAGE_H
     160             : 
     161             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10