fix build
[LibreOffice.git] / include / svx / galmisc.hxx
blob60dfb3cc993e96732f876a87663171ec74d2e2dc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
23 #include <utility>
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>
32 #include <memory>
34 namespace com::sun::star::awt { class XProgressBar; }
36 class INetURLObject;
37 class GalleryTheme;
38 class SotStorageStream;
39 class SotTempStream;
41 struct ExchangeData
43 GalleryTheme* pTheme;
44 OUString aEditedTitle;
45 Date aThemeChangeDate;
46 tools::Time aThemeChangeTime;
48 ExchangeData()
49 : pTheme(nullptr)
50 , aThemeChangeDate( Date::EMPTY )
51 , aThemeChangeTime( tools::Time::EMPTY )
56 enum class SgaObjKind
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
66 #define ID_IMAPINFO 2
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()
81 class SvStream;
82 class Graphic;
83 class FmFormModel;
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
99 ImageMap aImageMap;
101 public:
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; }
118 class GraphicFilter;
120 class SVXCORE_DLLPUBLIC GalleryProgress
122 css::uno::Reference< css::awt::XProgressBar > mxProgressBar;
124 public:
126 GalleryProgress( const GraphicFilter* pFilter = nullptr );
127 ~GalleryProgress();
129 void Update( sal_Int32 nVal, sal_Int32 nMaxVal );
132 class GalleryTheme;
133 class GraphicObject;
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 );
149 public:
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;
162 bool StartDrag();
165 enum class GalleryHintType
167 CLOSE_THEME,
168 THEME_REMOVED,
169 THEME_RENAMED,
170 THEME_CREATED,
171 THEME_UPDATEVIEW,
172 CLOSE_OBJECT
175 class GalleryHint final : public SfxHint
177 private:
179 GalleryHintType mnType;
180 OUString maThemeName;
181 OUString maStringData;
182 void* mnData1;
184 public:
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);
202 #endif
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */