LibreOffice Module svx (master) 1
galmisc.hxx
Go to the documentation of this file.
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
34namespace com::sun::star::awt { class XProgressBar; }
35
36class INetURLObject;
37class GalleryTheme;
39class SotTempStream;
40
42{
44 OUString aEditedTitle;
47
49 : pTheme(nullptr)
52 {
53 }
54};
55
56enum class SgaObjKind
57{
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
64};
65
66#define ID_IMAPINFO 2
67
68#define STREAMBUF_SIZE 16384L
69
71{
73};
74
75#define GALLERY_PROGRESS_RANGE 10000
76
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()
80
81class SvStream;
82class Graphic;
83class FmFormModel;
84
85GalleryGraphicImportRet GalleryGraphicImport( const INetURLObject& rURL, Graphic& rGraphic, OUString& rFilterName );
86bool GallerySvDrawImport( SvStream& rIStm, SdrModel& rModel );
87bool CreateIMapGraphic( const FmFormModel& rModel, Graphic& rGraphic, ImageMap& rImageMap );
88SVXCORE_DLLPUBLIC OUString
89 GetReducedString( const INetURLObject& rURL, sal_Int32 nMaxLen );
90OUString GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL );
91
92bool FileExists( const INetURLObject& rURL );
93bool CreateDir( const INetURLObject& rURL );
94bool CopyFile( const INetURLObject& rSrcURL, const INetURLObject& rDstURL );
95bool KillFile( const INetURLObject& rURL );
96
97class SgaIMapInfo final : public SdrObjUserData, public SfxListener
98{
100
101public:
103
104 SgaIMapInfo( const ImageMap& rImageMap) :
106 aImageMap( rImageMap ) {};
107
108 virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* ) const override
109 {
110 SgaIMapInfo* pInfo = new SgaIMapInfo;
111 pInfo->aImageMap = aImageMap;
112 return std::unique_ptr<SdrObjUserData>(pInfo);
113 }
114
115 const ImageMap& GetImageMap() const { return aImageMap; }
116};
117
118class GraphicFilter;
119
121{
122 css::uno::Reference< css::awt::XProgressBar > mxProgressBar;
123
124 public:
125
126 GalleryProgress( const GraphicFilter* pFilter = nullptr );
128
129 void Update( sal_Int32 nVal, sal_Int32 nMaxVal );
130};
131
132class GalleryTheme;
133class GraphicObject;
134
136{
137friend class GalleryTheme;
139
142 sal_uInt32 mnObjectPos;
144 std::unique_ptr<GraphicObject> mpGraphicObject;
145 std::unique_ptr<INetURLObject> mpURL;
146
147 void InitData( bool bLazy );
148
149public:
150 GalleryTransferable( GalleryTheme* pTheme, sal_uInt32 nObjectPos, bool bLazy );
151 virtual ~GalleryTransferable() override;
152
153 void SelectObject(sal_uInt32 nObjectPos);
154
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;
161
162 bool StartDrag();
163};
164
166{
173};
174
175class GalleryHint final : public SfxHint
176{
177private:
178
180 OUString maThemeName;
181 OUString maStringData;
182 void* mnData1;
183
184public:
185
186 GalleryHint( GalleryHintType nType, OUString aThemeName, void* nData1 = nullptr ) :
187 mnType( nType ), maThemeName(std::move( aThemeName )), mnData1( nData1 ) {}
188
189 GalleryHint( GalleryHintType nType, OUString aThemeName, OUString aStringData ) :
190 mnType( nType ), maThemeName(std::move( aThemeName )), maStringData(std::move( aStringData )), mnData1( nullptr ) {}
191
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; }
196};
197
198struct GalleryObject;
199
201
202#endif
203/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OUString & GetThemeName() const
Definition: galmisc.hxx:193
GalleryHintType mnType
Definition: galmisc.hxx:179
GalleryHint(GalleryHintType nType, OUString aThemeName, OUString aStringData)
Definition: galmisc.hxx:189
const OUString & GetStringData() const
Definition: galmisc.hxx:194
void * mnData1
Definition: galmisc.hxx:182
GalleryHint(GalleryHintType nType, OUString aThemeName, void *nData1=nullptr)
Definition: galmisc.hxx:186
void * GetData1() const
Definition: galmisc.hxx:195
OUString maThemeName
Definition: galmisc.hxx:180
OUString maStringData
Definition: galmisc.hxx:181
GalleryHintType GetType() const
Definition: galmisc.hxx:192
css::uno::Reference< css::awt::XProgressBar > mxProgressBar
Definition: galmisc.hxx:122
virtual void ObjectReleased() override
Definition: galmisc.cxx:534
tools::SvRef< SotTempStream > mxModelStream
Definition: galmisc.hxx:143
std::unique_ptr< GraphicObject > mpGraphicObject
Definition: galmisc.hxx:144
virtual bool GetData(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) override
Definition: galmisc.cxx:474
GalleryTheme * mpTheme
Definition: galmisc.hxx:140
void InitData(bool bLazy)
Definition: galmisc.cxx:381
SgaObjKind meObjectKind
Definition: galmisc.hxx:141
virtual void AddSupportedFormats() override
Definition: galmisc.cxx:442
std::unique_ptr< INetURLObject > mpURL
Definition: galmisc.hxx:145
sal_uInt32 mnObjectPos
Definition: galmisc.hxx:142
virtual void DragFinished(sal_Int8 nDropAction) override
Definition: galmisc.cxx:519
GalleryTransferable(GalleryTheme *pTheme, sal_uInt32 nObjectPos, bool bLazy)
Definition: galmisc.cxx:357
void SelectObject(sal_uInt32 nObjectPos)
Definition: galmisc.cxx:366
virtual bool WriteObject(tools::SvRef< SotTempStream > &rxOStm, void *pUserObject, sal_uInt32 nUserObjectId, const css::datatransfer::DataFlavor &rFlavor) override
Definition: galmisc.cxx:505
virtual ~GalleryTransferable() override
Definition: galmisc.cxx:377
User data of a drawing object, e.g.
Definition: svdobj.hxx:152
Abstract DrawObject.
Definition: svdobj.hxx:260
SgaIMapInfo(const ImageMap &rImageMap)
Definition: galmisc.hxx:104
const ImageMap & GetImageMap() const
Definition: galmisc.hxx:115
virtual std::unique_ptr< SdrObjUserData > Clone(SdrObject *) const override
Definition: galmisc.hxx:108
ImageMap aImageMap
Definition: galmisc.hxx:99
void CopyToClipboard(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rClipboard) const
#define ID_IMAPINFO
Definition: galmisc.hxx:66
SVXCORE_DLLPUBLIC OUString GetReducedString(const INetURLObject &rURL, sal_Int32 nMaxLen)
Definition: galmisc.cxx:154
bool CreateIMapGraphic(const FmFormModel &rModel, Graphic &rGraphic, ImageMap &rImageMap)
Definition: galmisc.cxx:120
bool GallerySvDrawImport(SvStream &rIStm, SdrModel &rModel)
Definition: galmisc.cxx:76
bool CreateDir(const INetURLObject &rURL)
Definition: galmisc.cxx:229
INetURLObject ImplGetURL(const GalleryObject *pObject)
Definition: galmisc.cxx:553
OUString GetSvDrawStreamNameFromURL(const INetURLObject &rSvDrawObjURL)
Definition: galmisc.cxx:188
GalleryGraphicImportRet
Definition: galmisc.hxx:71
SgaObjKind
Definition: galmisc.hxx:57
bool KillFile(const INetURLObject &rURL)
Definition: galmisc.cxx:287
bool CopyFile(const INetURLObject &rSrcURL, const INetURLObject &rDstURL)
Definition: galmisc.cxx:261
bool FileExists(const INetURLObject &rURL)
Definition: galmisc.cxx:201
GalleryHintType
Definition: galmisc.hxx:166
GalleryGraphicImportRet GalleryGraphicImport(const INetURLObject &rURL, Graphic &rGraphic, OUString &rFilterName)
Definition: galmisc.cxx:51
NONE
constexpr OUStringLiteral EMPTY
QPRO_FUNC_TYPE nType
GalleryTheme * pTheme
Definition: galmisc.hxx:43
OUString aEditedTitle
Definition: galmisc.hxx:44
tools::Time aThemeChangeTime
Definition: galmisc.hxx:46
Date aThemeChangeDate
Definition: galmisc.hxx:45
SdrInventor
Definition: svdobj.hxx:98
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
signed char sal_Int8