LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/svx - galmisc.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 24 12.5 %
Date: 2013-07-09 Functions: 2 18 11.1 %
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 _SVX_GALMISC_HXX_
      21             : #define _SVX_GALMISC_HXX_
      22             : 
      23             : #include <sot/storage.hxx>
      24             : #include <tools/urlobj.hxx>
      25             : #include <svtools/imap.hxx>
      26             : #include <svl/hint.hxx>
      27             : #include <svtools/transfer.hxx>
      28             : #include <svx/svdobj.hxx>
      29             : #include <com/sun/star/uno/Reference.h>
      30             : #include <com/sun/star/awt/XProgressMonitor.hpp>
      31             : #include "svx/svxdllapi.h"
      32             : #include <tools/date.hxx>
      33             : #include <tools/time.hxx>
      34             : 
      35             : class GalleryTheme;
      36             : 
      37           0 : struct ExchangeData
      38             : {
      39             :     GalleryTheme*   pTheme;
      40             :     String          aEditedTitle;
      41             :     Date            aThemeChangeDate;
      42             :     Time            aThemeChangeTime;
      43             : 
      44           0 :     ExchangeData() :
      45             :         aThemeChangeDate( Date::EMPTY ),
      46           0 :         aThemeChangeTime( Time::EMPTY )
      47           0 :         {}
      48             : };
      49             : 
      50             : enum SgaObjKind
      51             : {
      52             :     SGA_OBJ_NONE = 0,   // abstract object
      53             :     SGA_OBJ_BMP = 1,    // bitmap object
      54             :     SGA_OBJ_SOUND = 2,  // sound object
      55             :     SGA_OBJ_VIDEO = 3,  // video object
      56             :     SGA_OBJ_ANIM = 4,   // animation object
      57             :     SGA_OBJ_SVDRAW = 5, // Svdraw object
      58             :     SGA_OBJ_INET = 6    // graphics from the internet
      59             : };
      60             : 
      61             : #define IV_IMAPINFO             (sal_uInt32('S')*0x00000001+sal_uInt32('D')*0x00000100+sal_uInt32('U')*0x00010000+sal_uInt32('D')*0x01000000)
      62             : #define ID_IMAPINFO             2
      63             : 
      64             : #define USERDATA_HDL()          (LINK(this,SgaUserDataFactory,MakeUserData))
      65             : 
      66             : #define GAL_RES(nId)            ResId(nId, *GetGalleryResMgr())
      67             : #define GAL_RESSTR(nId)         GAL_RES(nId).toString()
      68             : #define STREAMBUF_SIZE          16384L
      69             : 
      70             : #define SGA_IMPORT_NONE         0x0000
      71             : #define SGA_IMPORT_FILE         0x0001
      72             : #define SGA_IMPORT_INET         0x0002
      73             : 
      74             : #define GALLERY_PROGRESS_RANGE  10000
      75             : 
      76             : #define GALLERY_FG_COLOR        Application::GetSettings().GetStyleSettings().GetWindowTextColor()
      77             : #define GALLERY_BG_COLOR        Application::GetSettings().GetStyleSettings().GetWindowColor()
      78             : #define GALLERY_DLG_COLOR       Application::GetSettings().GetStyleSettings().GetDialogColor()
      79             : 
      80             : class ResMgr;
      81             : class String;
      82             : class SvStream;
      83             : class Graphic;
      84             : class FmFormModel;
      85             : class ImageMap;
      86             : class Gallery;
      87             : 
      88             : SVX_DLLPUBLIC ResMgr*           GetGalleryResMgr();
      89             : sal_uInt16          GalleryGraphicImport( const INetURLObject& rURL, Graphic& rGraphic, String& rFilterName, sal_Bool bShowProgress = sal_False );
      90             : sal_Bool            GallerySvDrawImport( SvStream& rIStm, SdrModel& rModel );
      91             : sal_Bool            CreateIMapGraphic( const FmFormModel& rModel, Graphic& rGraphic, ImageMap& rImageMap );
      92             : SVX_DLLPUBLIC String            GetReducedString( const INetURLObject& rURL, sal_uIntPtr nMaxLen );
      93             : String          GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL );
      94             : 
      95             : sal_Bool            FileExists( const INetURLObject& rURL );
      96             : sal_Bool            CreateDir(  const INetURLObject& rURL );
      97             : sal_Bool            CopyFile(  const INetURLObject& rSrcURL, const INetURLObject& rDstURL );
      98             : sal_Bool            KillFile( const INetURLObject& rURL );
      99             : BitmapEx        GalleryResGetBitmapEx( sal_uInt32 nId );
     100             : 
     101             : class SgaIMapInfo : public SdrObjUserData, public SfxListener
     102             : {
     103             :     ImageMap                aImageMap;
     104             : 
     105             : public:
     106           0 :                             SgaIMapInfo() : SdrObjUserData( IV_IMAPINFO, ID_IMAPINFO, 0 ) {};
     107             : 
     108           0 :                             SgaIMapInfo( const ImageMap& rImageMap) :
     109             :                                 SdrObjUserData( IV_IMAPINFO, ID_IMAPINFO, 0 ),
     110           0 :                                 aImageMap( rImageMap ) {};
     111             : 
     112           0 :     virtual                 ~SgaIMapInfo() {};
     113             : 
     114           0 :     virtual SdrObjUserData* Clone( SdrObject* ) const
     115             :                             {
     116           0 :                                 SgaIMapInfo* pInfo = new SgaIMapInfo;
     117           0 :                                 pInfo->aImageMap = aImageMap;
     118           0 :                                 return pInfo;
     119             :                             }
     120             : 
     121           0 :     const ImageMap&         GetImageMap() const { return aImageMap; }
     122             : };
     123             : 
     124             : class SgaUserDataFactory
     125             : {
     126             : public:
     127           0 :         SgaUserDataFactory() { SdrObjFactory::InsertMakeUserDataHdl( USERDATA_HDL() ); }
     128           0 :         ~SgaUserDataFactory() { SdrObjFactory::RemoveMakeUserDataHdl( USERDATA_HDL() ); }
     129             : 
     130             :         DECL_LINK( MakeUserData, SdrObjFactory* );
     131             : };
     132             : 
     133             : class GraphicFilter;
     134             : 
     135             : class SVX_DLLPUBLIC GalleryProgress
     136             : {
     137             :     ::com::sun::star::uno::Reference< ::com::sun::star::awt::XProgressBar > mxProgressBar;
     138             :     GraphicFilter*                                                          mpFilter;
     139             : 
     140             :     public:
     141             : 
     142             :                                     GalleryProgress( GraphicFilter* pFilter = NULL );
     143             :                                     ~GalleryProgress();
     144             : 
     145             :     void                            Update( sal_uIntPtr nVal, sal_uIntPtr nMaxVal );
     146             : };
     147             : 
     148             : class Gallery;
     149             : class GalleryTheme;
     150             : class GraphicObject;
     151             : 
     152             : class GalleryTransferable : public TransferableHelper
     153             : {
     154             : friend class GalleryTheme;
     155             : using TransferableHelper::CopyToClipboard;
     156             : 
     157             : private:
     158             : 
     159             :     GalleryTheme*                   mpTheme;
     160             :     SgaObjKind                      meObjectKind;
     161             :     sal_uInt32                      mnObjectPos;
     162             :     SotStorageStreamRef             mxModelStream;
     163             :     GraphicObject*                  mpGraphicObject;
     164             :     ImageMap*                       mpImageMap;
     165             :     INetURLObject*                  mpURL;
     166             : 
     167             : protected:
     168             : 
     169             :                                     GalleryTransferable( GalleryTheme* pTheme, sal_uIntPtr nObjectPos, bool bLazy );
     170             :                                     ~GalleryTransferable();
     171             : 
     172             :     void                            InitData( bool bLazy );
     173             : 
     174             :     // TransferableHelper
     175             :     virtual void                    AddSupportedFormats();
     176             :     virtual sal_Bool                GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     177             :     virtual sal_Bool                WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
     178             :     virtual void                    DragFinished( sal_Int8 nDropAction );
     179             :     virtual void                    ObjectReleased();
     180             : 
     181             :     void                            CopyToClipboard( Window* pWindow );
     182             :     void                            StartDrag( Window* pWindow, sal_Int8 nDragSourceActions,
     183             :                                                sal_Int32 nDragPointer = DND_POINTER_NONE,
     184             :                                                sal_Int32 nDragImage = DND_IMAGE_NONE );
     185             : };
     186             : 
     187             : #define GALLERY_HINT_NONE               0x00000000
     188             : #define GALLERY_HINT_CLOSE_THEME        0x00000001
     189             : #define GALLERY_HINT_THEME_REMOVED      0x00000002
     190             : #define GALLERY_HINT_THEME_RENAMED      0x00000004
     191             : #define GALLERY_HINT_THEME_CREATED      0x00000008
     192             : #define GALLERY_HINT_THEME_UPDATEVIEW   0x00000010
     193             : #define GALLERY_HINT_CLOSE_OBJECT       0x00000020
     194             : #define GALLERY_HINT_OBJECT_REMOVED     0x00000040
     195             : 
     196        1520 : class GalleryHint : public SfxHint
     197             : {
     198             : private:
     199             : 
     200             :     sal_uIntPtr         mnType;
     201             :     OUString       maThemeName;
     202             :     OUString       maStringData;
     203             :     sal_uIntPtr         mnData1;
     204             :     sal_uIntPtr         mnData2;
     205             : 
     206             : public:
     207             : 
     208        1520 :                     GalleryHint( sal_uIntPtr nType, const String& rThemeName, sal_uIntPtr nData1 = 0UL, sal_uIntPtr nData2 = 0UL ) :
     209        1520 :                         mnType( nType ), maThemeName( rThemeName ), mnData1( nData1 ), mnData2( nData2 ) {}
     210             : 
     211           0 :                     GalleryHint( sal_uIntPtr nType, const String& rThemeName, const String& rStringData, sal_uIntPtr nData1 = 0UL, sal_uIntPtr nData2 = 0UL ) :
     212           0 :                         mnType( nType ), maThemeName( rThemeName ), maStringData( rStringData ), mnData1( nData1 ), mnData2( nData2 ) {}
     213             : 
     214           0 :     sal_uIntPtr          GetType() const { return mnType; }
     215           0 :     const OUString& GetThemeName() const { return maThemeName; }
     216           0 :     const OUString& GetStringData() const { return maStringData; }
     217           0 :     sal_uIntPtr          GetData1() const { return mnData1; }
     218             :     sal_uIntPtr          GetData2() const { return mnData2; }
     219             : };
     220             : 
     221             :     #endif
     222             : 
     223             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10