/src/libreoffice/include/svx/galmisc.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #ifndef INCLUDED_SVX_GALMISC_HXX |
21 | | #define INCLUDED_SVX_GALMISC_HXX |
22 | | |
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> |
33 | | |
34 | | namespace com::sun::star::awt { class XProgressBar; } |
35 | | |
36 | | class INetURLObject; |
37 | | class GalleryTheme; |
38 | | |
39 | | struct ExchangeData |
40 | | { |
41 | | GalleryTheme* pTheme; |
42 | | OUString aEditedTitle; |
43 | | Date aThemeChangeDate; |
44 | | tools::Time aThemeChangeTime; |
45 | | |
46 | | ExchangeData() |
47 | 0 | : pTheme(nullptr) |
48 | 0 | , aThemeChangeDate( Date::EMPTY ) |
49 | 0 | , aThemeChangeTime( tools::Time::EMPTY ) |
50 | 0 | { |
51 | 0 | } |
52 | | }; |
53 | | |
54 | | enum class SgaObjKind |
55 | | { |
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 |
62 | | }; |
63 | | |
64 | 0 | #define ID_IMAPINFO 2 |
65 | | |
66 | 0 | #define STREAMBUF_SIZE 16384L |
67 | | |
68 | | enum class GalleryGraphicImportRet |
69 | | { |
70 | | IMPORT_NONE, IMPORT_FILE |
71 | | }; |
72 | | |
73 | 0 | #define GALLERY_PROGRESS_RANGE 10000 |
74 | | |
75 | 0 | #define GALLERY_BG_COLOR Application::GetSettings().GetStyleSettings().GetWindowColor() |
76 | | |
77 | | class SvStream; |
78 | | class Graphic; |
79 | | class FmFormModel; |
80 | | |
81 | | GalleryGraphicImportRet GalleryGraphicImport( const INetURLObject& rURL, Graphic& rGraphic, OUString& rFilterName ); |
82 | | bool GallerySvDrawImport( SvStream& rIStm, SdrModel& rModel ); |
83 | | bool CreateIMapGraphic( const FmFormModel& rModel, Graphic& rGraphic, ImageMap& rImageMap ); |
84 | | SVXCORE_DLLPUBLIC OUString |
85 | | GetReducedString( const INetURLObject& rURL, sal_Int32 nMaxLen ); |
86 | | OUString GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL ); |
87 | | |
88 | | bool FileExists( const INetURLObject& rURL ); |
89 | | bool CreateDir( const INetURLObject& rURL ); |
90 | | bool CopyFile( const INetURLObject& rSrcURL, const INetURLObject& rDstURL ); |
91 | | bool KillFile( const INetURLObject& rURL ); |
92 | | |
93 | | class SgaIMapInfo final : public SdrObjUserData, public SfxListener |
94 | | { |
95 | | ImageMap m_aImageMap; |
96 | | |
97 | | public: |
98 | 0 | SgaIMapInfo() : SdrObjUserData( SdrInventor::SgaImap, ID_IMAPINFO ) {}; |
99 | | |
100 | | SgaIMapInfo( const ImageMap& rImageMap) : |
101 | 0 | SdrObjUserData( SdrInventor::SgaImap, ID_IMAPINFO ), |
102 | 0 | m_aImageMap( rImageMap ) {}; |
103 | | |
104 | | virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* ) const override |
105 | 0 | { |
106 | 0 | SgaIMapInfo* pInfo = new SgaIMapInfo; |
107 | 0 | pInfo->m_aImageMap = m_aImageMap; |
108 | 0 | return std::unique_ptr<SdrObjUserData>(pInfo); |
109 | 0 | } |
110 | | |
111 | 0 | const ImageMap& GetImageMap() const { return m_aImageMap; } |
112 | | }; |
113 | | |
114 | | class GraphicFilter; |
115 | | |
116 | | class SVXCORE_DLLPUBLIC GalleryProgress |
117 | | { |
118 | | css::uno::Reference< css::awt::XProgressBar > mxProgressBar; |
119 | | |
120 | | public: |
121 | | |
122 | | GalleryProgress( const GraphicFilter* pFilter = nullptr ); |
123 | | ~GalleryProgress(); |
124 | | |
125 | | void Update( sal_Int32 nVal, sal_Int32 nMaxVal ); |
126 | | }; |
127 | | |
128 | | class GalleryTheme; |
129 | | class GraphicObject; |
130 | | |
131 | | class GalleryTransferable final : public TransferDataContainer |
132 | | { |
133 | | friend class GalleryTheme; |
134 | | using TransferableHelper::CopyToClipboard; |
135 | | |
136 | | GalleryTheme* mpTheme; |
137 | | SgaObjKind meObjectKind; |
138 | | sal_uInt32 mnObjectPos; |
139 | | std::unique_ptr<SvStream> mxModelStream; |
140 | | std::unique_ptr<GraphicObject> mpGraphicObject; |
141 | | std::unique_ptr<INetURLObject> mpURL; |
142 | | |
143 | | void InitData( bool bLazy ); |
144 | | |
145 | | public: |
146 | | GalleryTransferable( GalleryTheme* pTheme, sal_uInt32 nObjectPos, bool bLazy ); |
147 | | virtual ~GalleryTransferable() override; |
148 | | |
149 | | void SelectObject(sal_uInt32 nObjectPos); |
150 | | |
151 | | // TransferableHelper |
152 | | virtual void AddSupportedFormats() override; |
153 | | virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; |
154 | | virtual bool WriteObject( SvStream& 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; |
157 | | |
158 | | bool StartDrag(); |
159 | | }; |
160 | | |
161 | | enum class GalleryHintType |
162 | | { |
163 | | CLOSE_THEME, |
164 | | THEME_REMOVED, |
165 | | THEME_RENAMED, |
166 | | THEME_CREATED, |
167 | | THEME_UPDATEVIEW, |
168 | | CLOSE_OBJECT, |
169 | | ADD_OBJECT |
170 | | }; |
171 | | |
172 | | class GalleryHint final : public SfxHint |
173 | | { |
174 | | private: |
175 | | |
176 | | GalleryHintType mnType; |
177 | | OUString maThemeName; |
178 | | OUString maStringData; |
179 | | void* mnData1; |
180 | | |
181 | | public: |
182 | | |
183 | | GalleryHint( GalleryHintType nType, OUString aThemeName, void* nData1 = nullptr ) : |
184 | 0 | SfxHint(SfxHintId::NONE), |
185 | 0 | mnType( nType ), maThemeName(std::move( aThemeName )), mnData1( nData1 ) {} |
186 | | |
187 | | GalleryHint( GalleryHintType nType, OUString aThemeName, OUString aStringData ) : |
188 | 0 | SfxHint(SfxHintId::NONE), |
189 | 0 | mnType( nType ), maThemeName(std::move( aThemeName )), maStringData(std::move( aStringData )), mnData1( nullptr ) {} |
190 | | |
191 | 0 | GalleryHintType GetType() const { return mnType; } |
192 | 0 | const OUString& GetThemeName() const { return maThemeName; } |
193 | 0 | const OUString& GetStringData() const { return maStringData; } |
194 | 0 | void* GetData1() const { return mnData1; } |
195 | | }; |
196 | | |
197 | | struct GalleryObject; |
198 | | |
199 | | INetURLObject ImplGetURL(const GalleryObject* pObject); |
200 | | |
201 | | #endif |
202 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |