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 <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>
32
33namespace com::sun::star::awt { class XProgressBar; }
34
35class INetURLObject;
36class GalleryTheme;
38class SotTempStream;
39
41{
43 OUString aEditedTitle;
46
48 : pTheme(nullptr)
51 {
52 }
53};
54
55enum class SgaObjKind
56{
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
63};
64
65#define ID_IMAPINFO 2
66
67#define STREAMBUF_SIZE 16384L
68
70{
72};
73
74#define GALLERY_PROGRESS_RANGE 10000
75
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()
79
80class SvStream;
81class Graphic;
82class FmFormModel;
83
84GalleryGraphicImportRet GalleryGraphicImport( const INetURLObject& rURL, Graphic& rGraphic, OUString& rFilterName );
85bool GallerySvDrawImport( SvStream& rIStm, SdrModel& rModel );
86bool CreateIMapGraphic( const FmFormModel& rModel, Graphic& rGraphic, ImageMap& rImageMap );
87SVXCORE_DLLPUBLIC OUString
88 GetReducedString( const INetURLObject& rURL, sal_Int32 nMaxLen );
89OUString GetSvDrawStreamNameFromURL( const INetURLObject& rSvDrawObjURL );
90
91bool FileExists( const INetURLObject& rURL );
92bool CreateDir( const INetURLObject& rURL );
93bool CopyFile( const INetURLObject& rSrcURL, const INetURLObject& rDstURL );
94bool KillFile( const INetURLObject& rURL );
95
96class SgaIMapInfo final : public SdrObjUserData, public SfxListener
97{
99
100public:
102
103 SgaIMapInfo( const ImageMap& rImageMap) :
105 aImageMap( rImageMap ) {};
106
107 virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* ) const override
108 {
109 SgaIMapInfo* pInfo = new SgaIMapInfo;
110 pInfo->aImageMap = aImageMap;
111 return std::unique_ptr<SdrObjUserData>(pInfo);
112 }
113
114 const ImageMap& GetImageMap() const { return aImageMap; }
115};
116
117class GraphicFilter;
118
120{
121 css::uno::Reference< css::awt::XProgressBar > mxProgressBar;
122
123 public:
124
125 GalleryProgress( const GraphicFilter* pFilter = nullptr );
127
128 void Update( sal_Int32 nVal, sal_Int32 nMaxVal );
129};
130
131class GalleryTheme;
132class GraphicObject;
133
135{
136friend class GalleryTheme;
138
141 sal_uInt32 mnObjectPos;
143 std::unique_ptr<GraphicObject> mpGraphicObject;
144 std::unique_ptr<INetURLObject> mpURL;
145
146 void InitData( bool bLazy );
147
148public:
149 GalleryTransferable( GalleryTheme* pTheme, sal_uInt32 nObjectPos, bool bLazy );
150 virtual ~GalleryTransferable() override;
151
152 void SelectObject(sal_uInt32 nObjectPos);
153
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<SotTempStream>& 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;
160
161 bool StartDrag();
162};
163
165{
172};
173
174class GalleryHint final : public SfxHint
175{
176private:
177
179 OUString maThemeName;
180 OUString maStringData;
181 void* mnData1;
182
183public:
184
185 GalleryHint( GalleryHintType nType, const OUString& rThemeName, void* nData1 = nullptr ) :
186 mnType( nType ), maThemeName( rThemeName ), mnData1( nData1 ) {}
187
188 GalleryHint( GalleryHintType nType, const OUString& rThemeName, const OUString& rStringData ) :
189 mnType( nType ), maThemeName( rThemeName ), maStringData( rStringData ), mnData1( nullptr ) {}
190
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; }
195};
196
197struct GalleryObject;
198
200
201#endif
202/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OUString & GetThemeName() const
Definition: galmisc.hxx:192
GalleryHintType mnType
Definition: galmisc.hxx:178
GalleryHint(GalleryHintType nType, const OUString &rThemeName, const OUString &rStringData)
Definition: galmisc.hxx:188
GalleryHint(GalleryHintType nType, const OUString &rThemeName, void *nData1=nullptr)
Definition: galmisc.hxx:185
const OUString & GetStringData() const
Definition: galmisc.hxx:193
void * mnData1
Definition: galmisc.hxx:181
void * GetData1() const
Definition: galmisc.hxx:194
OUString maThemeName
Definition: galmisc.hxx:179
OUString maStringData
Definition: galmisc.hxx:180
GalleryHintType GetType() const
Definition: galmisc.hxx:191
css::uno::Reference< css::awt::XProgressBar > mxProgressBar
Definition: galmisc.hxx:121
virtual void ObjectReleased() override
Definition: galmisc.cxx:534
tools::SvRef< SotTempStream > mxModelStream
Definition: galmisc.hxx:142
std::unique_ptr< GraphicObject > mpGraphicObject
Definition: galmisc.hxx:143
virtual bool GetData(const css::datatransfer::DataFlavor &rFlavor, const OUString &rDestDoc) override
Definition: galmisc.cxx:474
GalleryTheme * mpTheme
Definition: galmisc.hxx:139
void InitData(bool bLazy)
Definition: galmisc.cxx:381
SgaObjKind meObjectKind
Definition: galmisc.hxx:140
virtual void AddSupportedFormats() override
Definition: galmisc.cxx:442
std::unique_ptr< INetURLObject > mpURL
Definition: galmisc.hxx:144
sal_uInt32 mnObjectPos
Definition: galmisc.hxx:141
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:153
Abstract DrawObject.
Definition: svdobj.hxx:261
SgaIMapInfo(const ImageMap &rImageMap)
Definition: galmisc.hxx:103
const ImageMap & GetImageMap() const
Definition: galmisc.hxx:114
virtual std::unique_ptr< SdrObjUserData > Clone(SdrObject *) const override
Definition: galmisc.hxx:107
ImageMap aImageMap
Definition: galmisc.hxx:98
void CopyToClipboard(const css::uno::Reference< css::datatransfer::clipboard::XClipboard > &rClipboard) const
#define ID_IMAPINFO
Definition: galmisc.hxx:65
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:70
SgaObjKind
Definition: galmisc.hxx:56
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:165
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:42
OUString aEditedTitle
Definition: galmisc.hxx:43
tools::Time aThemeChangeTime
Definition: galmisc.hxx:45
Date aThemeChangeDate
Definition: galmisc.hxx:44
SdrInventor
Definition: svdobj.hxx:100
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
signed char sal_Int8