LCOV - code coverage report
Current view: top level - svx/inc - galobj.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 8 19 42.1 %
Date: 2015-06-13 12:38:46 Functions: 9 24 37.5 %
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_SVX_INC_GALOBJ_HXX
      21             : #define INCLUDED_SVX_INC_GALOBJ_HXX
      22             : 
      23             : #include <tools/urlobj.hxx>
      24             : #include <vcl/graph.hxx>
      25             : #include "svx/galmisc.hxx"
      26             : 
      27             : #define S_THUMB 80
      28             : 
      29             : 
      30             : 
      31             : enum GalSoundType
      32             : {
      33             :     SOUND_STANDARD = 0,
      34             :     SOUND_COMPUTER = 1,
      35             :     SOUND_MISC = 2,
      36             :     SOUND_MUSIC = 3,
      37             :     SOUND_NATURE = 4,
      38             :     SOUND_SPEECH = 5,
      39             :     SOUND_TECHNIC = 6,
      40             :     SOUND_ANIMAL = 7
      41             : };
      42             : 
      43             : class SVX_DLLPUBLIC SgaObject
      44             : {
      45             :     friend class GalleryTheme;
      46             : 
      47             : private:
      48             : 
      49           0 :     void                    ImplUpdateURL( const INetURLObject& rNewURL ) { aURL = rNewURL; }
      50             : 
      51             : protected:
      52             : 
      53             :     BitmapEx                aThumbBmp; // Allow transparence to survive
      54             :     GDIMetaFile             aThumbMtf;
      55             :     INetURLObject           aURL;
      56             :     OUString                aUserName;
      57             :     OUString                aTitle;
      58             :     bool                    bIsValid;
      59             :     bool                    bIsThumbBmp;
      60             : 
      61             :     virtual void            WriteData( SvStream& rOut, const OUString& rDestDir ) const;
      62             :     virtual void            ReadData( SvStream& rIn, sal_uInt16& rReadVersion );
      63             : 
      64             :     bool                    CreateThumb( const Graphic& rGraphic );
      65             : 
      66             : public:
      67             :                             SgaObject();
      68         503 :     virtual                 ~SgaObject() {};
      69             : 
      70             :     virtual SgaObjKind      GetObjKind() const = 0;
      71             :     virtual sal_uInt16      GetVersion() const = 0;
      72             : 
      73           0 :     virtual BitmapEx        GetThumbBmp() const { return aThumbBmp; }
      74           0 :     const GDIMetaFile&      GetThumbMtf() const { return aThumbMtf; }
      75       16671 :     const INetURLObject&    GetURL() const { return aURL; }
      76         503 :     bool                IsValid() const { return bIsValid; }
      77           0 :     bool                IsThumbBitmap() const { return bIsThumbBmp; }
      78             : 
      79             :     const OUString          GetTitle() const;
      80             :     void                    SetTitle( const OUString& rTitle );
      81             : 
      82             :     friend SvStream&        WriteSgaObject( SvStream& rOut, const SgaObject& rObj );
      83             :     friend SvStream&        ReadSgaObject( SvStream& rIn, SgaObject& rObj );
      84             : 
      85             :     BitmapEx createPreviewBitmapEx(const Size& rSizePixel) const;
      86             : };
      87             : 
      88             : class SgaObjectSound : public SgaObject
      89             : {
      90             : private:
      91             : 
      92             :     GalSoundType        eSoundType;
      93             : 
      94             :     virtual void        WriteData( SvStream& rOut, const OUString& rDestDir ) const SAL_OVERRIDE;
      95             :     virtual void        ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) SAL_OVERRIDE;
      96             : 
      97          35 :     virtual sal_uInt16      GetVersion() const SAL_OVERRIDE { return 6; }
      98             : 
      99             : public:
     100             : 
     101             :                         SgaObjectSound();
     102             :                         SgaObjectSound( const INetURLObject& rURL );
     103             :     virtual            ~SgaObjectSound();
     104             : 
     105          70 :     virtual SgaObjKind  GetObjKind() const SAL_OVERRIDE { return SGA_OBJ_SOUND; }
     106             :     virtual BitmapEx    GetThumbBmp() const SAL_OVERRIDE;
     107             :     GalSoundType        GetSoundType() const { return eSoundType; }
     108             : };
     109             : 
     110             : class FmFormModel;
     111             : 
     112             : class SgaObjectSvDraw : public SgaObject
     113             : {
     114             :     using SgaObject::CreateThumb;
     115             : 
     116             : private:
     117             : 
     118             :     bool                CreateThumb( const FmFormModel& rModel );
     119             : 
     120             :     virtual void        WriteData( SvStream& rOut, const OUString& rDestDir ) const SAL_OVERRIDE;
     121             :     virtual void        ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) SAL_OVERRIDE;
     122             : 
     123           0 :     virtual sal_uInt16      GetVersion() const SAL_OVERRIDE { return 5; }
     124             : 
     125             : public:
     126             : 
     127             :                         SgaObjectSvDraw();
     128             :                         SgaObjectSvDraw( const FmFormModel& rModel, const INetURLObject& rURL );
     129             :                         SgaObjectSvDraw( SvStream& rIStm, const INetURLObject& rURL );
     130           0 :     virtual            ~SgaObjectSvDraw() {};
     131             : 
     132           0 :     virtual SgaObjKind  GetObjKind() const SAL_OVERRIDE { return SGA_OBJ_SVDRAW; }
     133             : };
     134             : 
     135             : class SgaObjectBmp: public SgaObject
     136             : {
     137             : private:
     138             : 
     139             :     void                Init( const Graphic& rGraphic, const INetURLObject& rURL );
     140             : 
     141             :     virtual void        WriteData( SvStream& rOut, const OUString& rDestDir ) const SAL_OVERRIDE;
     142             :     virtual void        ReadData( SvStream& rIn, sal_uInt16& rReadVersion ) SAL_OVERRIDE;
     143             : 
     144         468 :     virtual sal_uInt16      GetVersion() const SAL_OVERRIDE { return 5; }
     145             : 
     146             : public:
     147             : 
     148             :                         SgaObjectBmp();
     149             :                         SgaObjectBmp( const INetURLObject& rURL );
     150             :                         SgaObjectBmp( const Graphic& rGraphic, const INetURLObject& rURL, const OUString& rFormat );
     151         936 :     virtual             ~SgaObjectBmp() {};
     152             : 
     153         936 :     virtual SgaObjKind  GetObjKind() const SAL_OVERRIDE { return SGA_OBJ_BMP; }
     154             : };
     155             : 
     156             : class SgaObjectAnim : public SgaObjectBmp
     157             : {
     158             : private:
     159             : 
     160             :                         SgaObjectAnim( const INetURLObject& ) {};
     161             : 
     162             : public:
     163             : 
     164             :                         SgaObjectAnim();
     165             :                         SgaObjectAnim( const Graphic& rGraphic, const INetURLObject& rURL, const OUString& rFormatName );
     166             : 
     167           0 :     virtual            ~SgaObjectAnim() {};
     168             : 
     169           0 :     virtual SgaObjKind  GetObjKind() const SAL_OVERRIDE { return SGA_OBJ_ANIM; }
     170             : };
     171             : 
     172             : class SgaObjectINet : public SgaObjectAnim
     173             : {
     174             : private:
     175             : 
     176             :                         SgaObjectINet( const INetURLObject& ) {};
     177             : 
     178             : public:
     179             : 
     180             :                         SgaObjectINet();
     181             :                         SgaObjectINet( const Graphic& rGraphic, const INetURLObject& rURL, const OUString& rFormatName );
     182             : 
     183           0 :     virtual            ~SgaObjectINet() {};
     184             : 
     185           0 :     virtual SgaObjKind  GetObjKind() const SAL_OVERRIDE { return SGA_OBJ_INET; }
     186             : };
     187             : #endif
     188             : 
     189             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11