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

Generated by: LCOV version 1.10