nss: upgrade to release 3.73
[LibreOffice.git] / include / svx / galmisc.hxx
blobdd5a361105dead2166a11f2d7af0e19261e73016
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 <vcl/salctype.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;
40 struct ExchangeData
42 GalleryTheme* pTheme;
43 OUString aEditedTitle;
44 Date aThemeChangeDate;
45 tools::Time aThemeChangeTime;
47 ExchangeData()
48 : pTheme(nullptr)
49 , aThemeChangeDate( Date::EMPTY )
50 , aThemeChangeTime( tools::Time::EMPTY )
55 enum class SgaObjKind
57 NONE = 0, // abstract object
58 Bitmap = 1, // bitmap object
59 Sound = 2, // sound object
60 Animation = 4, // animation object
61 SvDraw = 5, // Svdraw object
62 Inet = 6 // graphics from the internet
65 #define ID_IMAPINFO 2
67 #define STREAMBUF_SIZE 16384L
69 enum class GalleryGraphicImportRet
71 IMPORT_NONE, IMPORT_FILE
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()
80 class SvStream;
81 class Graphic;
82 class FmFormModel;
84 GalleryGraphicImportRet GalleryGraphicImport( const INetURLObject& rURL, Graphic& rGraphic, OUString& rFilterName );
85 bool GallerySvDrawImport( SvStream& rIStm, SdrModel& rModel );
86 bool CreateIMapGraphic( const FmFormModel& rModel, Graphic& rGraphic, ImageMap& rImageMap );
87 SVXCORE_DLLPUBLIC OUString
88 GetReducedString( const INetURLObject& rURL, sal_Int32 nMaxLen );
89 OUString GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL );
91 bool FileExists( const INetURLObject& rURL );
92 bool CreateDir( const INetURLObject& rURL );
93 bool CopyFile( const INetURLObject& rSrcURL, const INetURLObject& rDstURL );
94 bool KillFile( const INetURLObject& rURL );
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 SVXCORE_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 TransferDataContainer
136 friend class GalleryTheme;
137 using TransferableHelper::CopyToClipboard;
139 GalleryTheme* mpTheme;
140 SgaObjKind meObjectKind;
141 sal_uInt32 mnObjectPos;
142 tools::SvRef<SotStorageStream> mxModelStream;
143 std::unique_ptr<GraphicObject> mpGraphicObject;
144 std::unique_ptr<INetURLObject> mpURL;
146 void InitData( bool bLazy );
148 public:
149 GalleryTransferable( GalleryTheme* pTheme, sal_uInt32 nObjectPos, bool bLazy );
150 virtual ~GalleryTransferable() override;
152 void SelectObject(sal_uInt32 nObjectPos);
154 // TransferableHelper
155 virtual void AddSupportedFormats() override;
156 virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override;
157 virtual bool WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor& rFlavor ) override;
158 virtual void DragFinished( sal_Int8 nDropAction ) override;
159 virtual void ObjectReleased() override;
161 bool StartDrag();
164 enum class GalleryHintType
166 CLOSE_THEME,
167 THEME_REMOVED,
168 THEME_RENAMED,
169 THEME_CREATED,
170 THEME_UPDATEVIEW,
171 CLOSE_OBJECT
174 class GalleryHint final : public SfxHint
176 private:
178 GalleryHintType mnType;
179 OUString maThemeName;
180 OUString maStringData;
181 void* mnData1;
183 public:
185 GalleryHint( GalleryHintType nType, const OUString& rThemeName, void* nData1 = nullptr ) :
186 mnType( nType ), maThemeName( rThemeName ), mnData1( nData1 ) {}
188 GalleryHint( GalleryHintType nType, const OUString& rThemeName, const OUString& rStringData ) :
189 mnType( nType ), maThemeName( rThemeName ), maStringData( rStringData ), mnData1( nullptr ) {}
191 GalleryHintType GetType() const { return mnType; }
192 const OUString& GetThemeName() const { return maThemeName; }
193 const OUString& GetStringData() const { return maStringData; }
194 void* GetData1() const { return mnData1; }
197 struct GalleryObject;
199 INetURLObject ImplGetURL(const GalleryObject* pObject);
201 #endif
202 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */