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

Generated by: LCOV version 1.10