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 INCLUDED_SVX_GALMISC_HXX
21 #define INCLUDED_SVX_GALMISC_HXX
24 #include <vcl/imap.hxx>
25 #include <svl/hint.hxx>
26 #include <vcl/transfer.hxx>
27 #include <svx/svdobj.hxx>
28 #include <com/sun/star/uno/Reference.h>
29 #include <svx/svxdllapi.h>
30 #include <tools/date.hxx>
31 #include <tools/time.hxx>
34 namespace com::sun::star::awt
{ class XProgressBar
; }
38 class SotStorageStream
;
44 OUString aEditedTitle
;
45 Date aThemeChangeDate
;
46 tools::Time aThemeChangeTime
;
50 , aThemeChangeDate( Date::EMPTY
)
51 , aThemeChangeTime( tools::Time::EMPTY
)
58 NONE
= 0, // abstract object
59 Bitmap
= 1, // bitmap object
60 Sound
= 2, // sound object
61 Animation
= 4, // animation object
62 SvDraw
= 5, // Svdraw object
63 Inet
= 6 // graphics from the internet
68 #define STREAMBUF_SIZE 16384L
70 enum class GalleryGraphicImportRet
72 IMPORT_NONE
, IMPORT_FILE
75 #define GALLERY_PROGRESS_RANGE 10000
77 #define GALLERY_FG_COLOR Application::GetSettings().GetStyleSettings().GetWindowTextColor()
78 #define GALLERY_BG_COLOR Application::GetSettings().GetStyleSettings().GetWindowColor()
79 #define GALLERY_DLG_COLOR Application::GetSettings().GetStyleSettings().GetDialogColor()
85 GalleryGraphicImportRet
GalleryGraphicImport( const INetURLObject
& rURL
, Graphic
& rGraphic
, OUString
& rFilterName
);
86 bool GallerySvDrawImport( SvStream
& rIStm
, SdrModel
& rModel
);
87 bool CreateIMapGraphic( const FmFormModel
& rModel
, Graphic
& rGraphic
, ImageMap
& rImageMap
);
88 SVXCORE_DLLPUBLIC OUString
89 GetReducedString( const INetURLObject
& rURL
, sal_Int32 nMaxLen
);
90 OUString
GetSvDrawStreamNameFromURL( const INetURLObject
& rSvDrawObjURL
);
92 bool FileExists( const INetURLObject
& rURL
);
93 bool CreateDir( const INetURLObject
& rURL
);
94 bool CopyFile( const INetURLObject
& rSrcURL
, const INetURLObject
& rDstURL
);
95 bool KillFile( const INetURLObject
& rURL
);
97 class SgaIMapInfo final
: public SdrObjUserData
, public SfxListener
102 SgaIMapInfo() : SdrObjUserData( SdrInventor::SgaImap
, ID_IMAPINFO
) {};
104 SgaIMapInfo( const ImageMap
& rImageMap
) :
105 SdrObjUserData( SdrInventor::SgaImap
, ID_IMAPINFO
),
106 aImageMap( rImageMap
) {};
108 virtual std::unique_ptr
<SdrObjUserData
> Clone( SdrObject
* ) const override
110 SgaIMapInfo
* pInfo
= new SgaIMapInfo
;
111 pInfo
->aImageMap
= aImageMap
;
112 return std::unique_ptr
<SdrObjUserData
>(pInfo
);
115 const ImageMap
& GetImageMap() const { return aImageMap
; }
120 class SVXCORE_DLLPUBLIC GalleryProgress
122 css::uno::Reference
< css::awt::XProgressBar
> mxProgressBar
;
126 GalleryProgress( const GraphicFilter
* pFilter
= nullptr );
129 void Update( sal_Int32 nVal
, sal_Int32 nMaxVal
);
135 class GalleryTransferable final
: public TransferDataContainer
137 friend class GalleryTheme
;
138 using TransferableHelper::CopyToClipboard
;
140 GalleryTheme
* mpTheme
;
141 SgaObjKind meObjectKind
;
142 sal_uInt32 mnObjectPos
;
143 tools::SvRef
<SotTempStream
> mxModelStream
;
144 std::unique_ptr
<GraphicObject
> mpGraphicObject
;
145 std::unique_ptr
<INetURLObject
> mpURL
;
147 void InitData( bool bLazy
);
150 GalleryTransferable( GalleryTheme
* pTheme
, sal_uInt32 nObjectPos
, bool bLazy
);
151 virtual ~GalleryTransferable() override
;
153 void SelectObject(sal_uInt32 nObjectPos
);
155 // TransferableHelper
156 virtual void AddSupportedFormats() override
;
157 virtual bool GetData( const css::datatransfer::DataFlavor
& rFlavor
, const OUString
& rDestDoc
) override
;
158 virtual bool WriteObject( tools::SvRef
<SotTempStream
>& rxOStm
, void* pUserObject
, sal_uInt32 nUserObjectId
, const css::datatransfer::DataFlavor
& rFlavor
) override
;
159 virtual void DragFinished( sal_Int8 nDropAction
) override
;
160 virtual void ObjectReleased() override
;
165 enum class GalleryHintType
175 class GalleryHint final
: public SfxHint
179 GalleryHintType mnType
;
180 OUString maThemeName
;
181 OUString maStringData
;
186 GalleryHint( GalleryHintType nType
, OUString aThemeName
, void* nData1
= nullptr ) :
187 mnType( nType
), maThemeName(std::move( aThemeName
)), mnData1( nData1
) {}
189 GalleryHint( GalleryHintType nType
, OUString aThemeName
, OUString aStringData
) :
190 mnType( nType
), maThemeName(std::move( aThemeName
)), maStringData(std::move( aStringData
)), mnData1( nullptr ) {}
192 GalleryHintType
GetType() const { return mnType
; }
193 const OUString
& GetThemeName() const { return maThemeName
; }
194 const OUString
& GetStringData() const { return maStringData
; }
195 void* GetData1() const { return mnData1
; }
198 struct GalleryObject
;
200 INetURLObject
ImplGetURL(const GalleryObject
* pObject
);
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */