1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SVX_GALMISC_HXX_
21 #define _SVX_GALMISC_HXX_
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>
41 Date aThemeChangeDate
;
42 Time aThemeChangeTime
;
45 aThemeChangeDate( Date::EMPTY
),
46 aThemeChangeTime( Time::EMPTY
)
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
61 #define IV_IMAPINFO (sal_uInt32('S')*0x00000001+sal_uInt32('D')*0x00000100+sal_uInt32('U')*0x00010000+sal_uInt32('D')*0x01000000)
64 #define USERDATA_HDL() (LINK(this,SgaUserDataFactory,MakeUserData))
66 #define GAL_RES(nId) ResId(nId, *GetGalleryResMgr())
67 #define GAL_RESSTR(nId) GAL_RES(nId).toString()
68 #define STREAMBUF_SIZE 16384L
70 #define SGA_IMPORT_NONE 0x0000
71 #define SGA_IMPORT_FILE 0x0001
72 #define SGA_IMPORT_INET 0x0002
74 #define GALLERY_PROGRESS_RANGE 10000
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()
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
);
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
);
101 class SgaIMapInfo
: public SdrObjUserData
, public SfxListener
106 SgaIMapInfo() : SdrObjUserData( IV_IMAPINFO
, ID_IMAPINFO
, 0 ) {};
108 SgaIMapInfo( const ImageMap
& rImageMap
) :
109 SdrObjUserData( IV_IMAPINFO
, ID_IMAPINFO
, 0 ),
110 aImageMap( rImageMap
) {};
112 virtual ~SgaIMapInfo() {};
114 virtual SdrObjUserData
* Clone( SdrObject
* ) const
116 SgaIMapInfo
* pInfo
= new SgaIMapInfo
;
117 pInfo
->aImageMap
= aImageMap
;
121 const ImageMap
& GetImageMap() const { return aImageMap
; }
124 class SgaUserDataFactory
127 SgaUserDataFactory() { SdrObjFactory::InsertMakeUserDataHdl( USERDATA_HDL() ); }
128 ~SgaUserDataFactory() { SdrObjFactory::RemoveMakeUserDataHdl( USERDATA_HDL() ); }
130 DECL_LINK( MakeUserData
, SdrObjFactory
* );
135 class SVX_DLLPUBLIC GalleryProgress
137 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XProgressBar
> mxProgressBar
;
138 GraphicFilter
* mpFilter
;
142 GalleryProgress( GraphicFilter
* pFilter
= NULL
);
145 void Update( sal_uIntPtr nVal
, sal_uIntPtr nMaxVal
);
152 class GalleryTransferable
: public TransferableHelper
154 friend class GalleryTheme
;
155 using TransferableHelper::CopyToClipboard
;
159 GalleryTheme
* mpTheme
;
160 SgaObjKind meObjectKind
;
161 sal_uInt32 mnObjectPos
;
162 SotStorageStreamRef mxModelStream
;
163 GraphicObject
* mpGraphicObject
;
164 ImageMap
* mpImageMap
;
165 INetURLObject
* mpURL
;
169 GalleryTransferable( GalleryTheme
* pTheme
, sal_uIntPtr nObjectPos
, bool bLazy
);
170 ~GalleryTransferable();
172 void InitData( bool bLazy
);
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();
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
);
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
196 class GalleryHint
: public SfxHint
201 OUString maThemeName
;
202 OUString maStringData
;
208 GalleryHint( sal_uIntPtr nType
, const String
& rThemeName
, sal_uIntPtr nData1
= 0UL, sal_uIntPtr nData2
= 0UL ) :
209 mnType( nType
), maThemeName( rThemeName
), mnData1( nData1
), mnData2( nData2
) {}
211 GalleryHint( sal_uIntPtr nType
, const String
& rThemeName
, const String
& rStringData
, sal_uIntPtr nData1
= 0UL, sal_uIntPtr nData2
= 0UL ) :
212 mnType( nType
), maThemeName( rThemeName
), maStringData( rStringData
), mnData1( nData1
), mnData2( nData2
) {}
214 sal_uIntPtr
GetType() const { return mnType
; }
215 const OUString
& GetThemeName() const { return maThemeName
; }
216 const OUString
& GetStringData() const { return maStringData
; }
217 sal_uIntPtr
GetData1() const { return mnData1
; }
218 sal_uIntPtr
GetData2() const { return mnData2
; }
223 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */