Bump version to 6.4-15
[LibreOffice.git] / include / svx / galmisc.hxx
blobb3236cf9c37bb889b92fee0f62c9de59e6209921
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 <vcl/imap.hxx>
24 #include <svl/hint.hxx>
25 #include <vcl/transfer.hxx>
26 #include <svx/svdobj.hxx>
27 #include <com/sun/star/uno/Reference.h>
28 #include <svx/svxdllapi.h>
29 #include <tools/date.hxx>
30 #include <tools/time.hxx>
31 #include <memory>
33 namespace com::sun::star::awt { class XProgressBar; }
35 class INetURLObject;
36 class GalleryTheme;
37 class SotStorageStream;
39 struct ExchangeData
41 GalleryTheme* pTheme;
42 OUString aEditedTitle;
43 Date aThemeChangeDate;
44 tools::Time aThemeChangeTime;
46 ExchangeData()
47 : pTheme(nullptr)
48 , aThemeChangeDate( Date::EMPTY )
49 , aThemeChangeTime( tools::Time::EMPTY )
54 enum class SgaObjKind
56 NONE = 0, // abstract object
57 Bitmap = 1, // bitmap object
58 Sound = 2, // sound object
59 Animation = 4, // animation object
60 SvDraw = 5, // Svdraw object
61 Inet = 6 // graphics from the internet
64 #define ID_IMAPINFO 2
66 #define STREAMBUF_SIZE 16384L
68 enum class GalleryGraphicImportRet
70 IMPORT_NONE, IMPORT_FILE
73 #define GALLERY_PROGRESS_RANGE 10000
75 #define GALLERY_FG_COLOR Application::GetSettings().GetStyleSettings().GetWindowTextColor()
76 #define GALLERY_BG_COLOR Application::GetSettings().GetStyleSettings().GetWindowColor()
77 #define GALLERY_DLG_COLOR Application::GetSettings().GetStyleSettings().GetDialogColor()
79 class SvStream;
80 class Graphic;
81 class FmFormModel;
83 GalleryGraphicImportRet GalleryGraphicImport( const INetURLObject& rURL, Graphic& rGraphic, OUString& rFilterName );
84 bool GallerySvDrawImport( SvStream& rIStm, SdrModel& rModel );
85 bool CreateIMapGraphic( const FmFormModel& rModel, Graphic& rGraphic, ImageMap& rImageMap );
86 SVX_DLLPUBLIC OUString
87 GetReducedString( const INetURLObject& rURL, sal_Int32 nMaxLen );
88 OUString GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL );
90 bool FileExists( const INetURLObject& rURL );
91 bool CreateDir( const INetURLObject& rURL );
92 bool CopyFile( const INetURLObject& rSrcURL, const INetURLObject& rDstURL );
93 bool KillFile( const INetURLObject& rURL );
94 BitmapEx GalleryResGetBitmapEx(const OUString& rId);
96 class SgaIMapInfo final : public SdrObjUserData, public SfxListener
98 ImageMap aImageMap;
100 public:
101 SgaIMapInfo() : SdrObjUserData( SdrInventor::SgaImap, ID_IMAPINFO ) {};
103 SgaIMapInfo( const ImageMap& rImageMap) :
104 SdrObjUserData( SdrInventor::SgaImap, ID_IMAPINFO ),
105 aImageMap( rImageMap ) {};
107 virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* ) const override
109 SgaIMapInfo* pInfo = new SgaIMapInfo;
110 pInfo->aImageMap = aImageMap;
111 return std::unique_ptr<SdrObjUserData>(pInfo);
114 const ImageMap& GetImageMap() const { return aImageMap; }
117 class GraphicFilter;
119 class SVX_DLLPUBLIC GalleryProgress
121 css::uno::Reference< css::awt::XProgressBar > mxProgressBar;
123 public:
125 GalleryProgress( const GraphicFilter* pFilter = nullptr );
126 ~GalleryProgress();
128 void Update( sal_Int32 nVal, sal_Int32 nMaxVal );
131 class GalleryTheme;
132 class GraphicObject;
134 class GalleryTransferable final : public TransferableHelper
136 friend class GalleryTheme;
137 using TransferableHelper::CopyToClipboard;
139 GalleryTheme* mpTheme;
140 SgaObjKind const meObjectKind;
141 sal_uInt32 const mnObjectPos;
142 tools::SvRef<SotStorageStream> mxModelStream;
143 std::unique_ptr<GraphicObject> mpGraphicObject;
144 std::unique_ptr<INetURLObject> mpURL;
146 GalleryTransferable( GalleryTheme* pTheme, sal_uInt32 nObjectPos, bool bLazy );
147 virtual ~GalleryTransferable() override;
149 void InitData( bool bLazy );
151 // TransferableHelper
152 virtual void AddSupportedFormats() override;
153 virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
154 virtual bool WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
155 virtual void DragFinished( sal_Int8 nDropAction ) override;
156 virtual void ObjectReleased() override;
158 void StartDrag( vcl::Window* pWindow, sal_Int8 nDragSourceActions );
161 enum class GalleryHintType
163 CLOSE_THEME,
164 THEME_REMOVED,
165 THEME_RENAMED,
166 THEME_CREATED,
167 THEME_UPDATEVIEW,
168 CLOSE_OBJECT
171 class GalleryHint final : public SfxHint
173 private:
175 GalleryHintType const mnType;
176 OUString const maThemeName;
177 OUString const maStringData;
178 void* const mnData1;
180 public:
182 GalleryHint( GalleryHintType nType, const OUString& rThemeName, void* nData1 = nullptr ) :
183 mnType( nType ), maThemeName( rThemeName ), mnData1( nData1 ) {}
185 GalleryHint( GalleryHintType nType, const OUString& rThemeName, const OUString& rStringData ) :
186 mnType( nType ), maThemeName( rThemeName ), maStringData( rStringData ), mnData1( nullptr ) {}
188 GalleryHintType GetType() const { return mnType; }
189 const OUString& GetThemeName() const { return maThemeName; }
190 const OUString& GetStringData() const { return maStringData; }
191 void* GetData1() const { return mnData1; }
194 #endif
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */