fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / svx / galtheme.hxx
blob8eccc86c5927a0e614dffff569077b79c6cc15d7
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 _SVX_GALTHEME_HXX_
21 #define _SVX_GALTHEME_HXX_
23 #include "svx/svxdllapi.h"
25 #include <tools/debug.hxx>
26 #include <tools/urlobj.hxx>
27 #include <vcl/salctype.hxx>
28 #include <svl/brdcst.hxx>
29 #include <svl/lstner.hxx>
30 #include <svtools/transfer.hxx>
31 #include <sot/storage.hxx>
32 #include <svx/svdmodel.hxx>
33 #include <svx/galmisc.hxx>
34 #include <vector>
36 // -----------------
37 // - GalleryObject -
38 // -----------------
39 // --------------
40 // - SgaObjKind -
41 // --------------
43 struct GalleryObject
45 INetURLObject aURL;
46 sal_uInt32 nOffset;
47 SgaObjKind eObjKind;
48 sal_Bool bDummy;
51 typedef ::std::vector< GalleryObject* > GalleryObjectList;
53 class GalleryThemeEntry;
54 class SgaObject;
55 class FmFormModel;
56 class ListBox;
58 // -----------------
59 // - GalDragParams -
60 // -----------------
62 struct GalDragParams
64 Region aDragRegion;
65 sal_uIntPtr nDragObjPos;
66 OUString aThemeName;
67 OUString aFileName;
68 SgaObjKind eObjKind;
71 // ----------------
72 // - GalleryTheme -
73 // ----------------
75 class Gallery;
76 class GalleryProgress;
77 namespace unogallery
79 class GalleryTheme;
80 class GalleryItem;
83 class GalleryTheme : public SfxBroadcaster
85 friend class Gallery;
86 friend class GalleryThemeCacheEntry;
87 friend class ::unogallery::GalleryTheme;
88 friend class ::unogallery::GalleryItem;
90 private:
92 GalleryObjectList aObjectList;
93 String m_aDestDir;
94 bool m_bDestDirRelative;
95 SotStorageRef aSvDrawStorageRef;
96 Gallery* pParent;
97 GalleryThemeEntry* pThm;
98 sal_uIntPtr mnThemeLockCount;
99 sal_uIntPtr mnBroadcasterLockCount;
100 sal_uIntPtr nDragPos;
101 sal_Bool bDragging;
102 sal_Bool bAbortActualize;
104 void ImplCreateSvDrawStorage();
105 SVX_DLLPUBLIC SgaObject* ImplReadSgaObject( GalleryObject* pEntry );
106 sal_Bool ImplWriteSgaObject( const SgaObject& rObj, size_t nPos, GalleryObject* pExistentEntry );
107 void ImplWrite();
108 const GalleryObject* ImplGetGalleryObject( size_t nPos ) const
109 { return ( nPos < aObjectList.size() ) ? aObjectList[ nPos ] : NULL; }
110 SVX_DLLPUBLIC const GalleryObject* ImplGetGalleryObject( const INetURLObject& rURL );
112 size_t ImplGetGalleryObjectPos( const GalleryObject* pObj ) const
114 for ( size_t i = 0, n = aObjectList.size(); i < n; ++i )
115 if ( pObj == aObjectList[ i ] )
116 return i;
117 return size_t(-1);
119 INetURLObject ImplGetURL( const GalleryObject* pObject ) const;
120 INetURLObject ImplCreateUniqueURL( SgaObjKind eObjKind, sal_uIntPtr nFormat = CVT_UNKNOWN );
121 void ImplSetModified( sal_Bool bModified );
122 void ImplBroadcast( sal_uIntPtr nUpdatePos );
124 GalleryTheme();
125 GalleryTheme( Gallery* pGallery, GalleryThemeEntry* pThemeEntry );
126 ~GalleryTheme();
128 public:
130 static GalleryThemeEntry* CreateThemeEntry( const INetURLObject& rURL, sal_Bool bReadOnly );
132 size_t GetObjectCount() const { return aObjectList.size(); }
134 SVX_DLLPUBLIC SgaObject* AcquireObject( size_t nPos );
135 SVX_DLLPUBLIC void ReleaseObject( SgaObject* pObj );
137 SVX_DLLPUBLIC bool InsertObject( const SgaObject& rObj, sal_uIntPtr nPos = LIST_APPEND );
138 SVX_DLLPUBLIC bool RemoveObject( size_t nPos );
139 bool ChangeObjectPos( size_t nOldPos, size_t nNewPos );
141 SVX_DLLPUBLIC const OUString& GetName() const;
142 const OUString& GetRealName() const;
144 // used for building gallery themes during compilation:
145 const String& GetDestDir() const { return m_aDestDir; }
146 void SetDestDir(const String& rDestDir, bool bRelative = true)
147 { m_aDestDir = rDestDir; m_bDestDirRelative = bRelative; }
149 const INetURLObject& GetThmURL() const;
150 SVX_DLLPUBLIC const INetURLObject& GetSdgURL() const;
151 const INetURLObject& GetSdvURL() const;
152 const INetURLObject& GetStrURL() const;
154 SVX_DLLPUBLIC sal_uInt32 GetId() const;
155 void SetId( sal_uInt32 nNewId, sal_Bool bResetThemeName );
157 void SetDragging( sal_Bool bSet ) { bDragging = bSet; }
158 sal_Bool IsDragging() const { return bDragging; }
160 void LockTheme() { ++mnThemeLockCount; }
161 sal_Bool UnlockTheme();
163 void LockBroadcaster() { mnBroadcasterLockCount++; }
164 SVX_DLLPUBLIC void UnlockBroadcaster( sal_uIntPtr nUpdatePos = 0 );
165 sal_Bool IsBroadcasterLocked() const { return mnBroadcasterLockCount > 0; }
167 void SetDragPos( sal_uIntPtr nPos ) { nDragPos = nPos; }
168 sal_uIntPtr GetDragPos() const { return nDragPos; }
170 sal_Bool IsThemeNameFromResource() const;
172 SVX_DLLPUBLIC sal_Bool IsReadOnly() const;
173 SVX_DLLPUBLIC sal_Bool IsDefault() const;
174 sal_Bool IsModified() const;
176 SVX_DLLPUBLIC void Actualize( const Link& rActualizeLink, GalleryProgress* pProgress = NULL );
177 void AbortActualize() { bAbortActualize = sal_True; }
179 Gallery* GetParent() const { return pParent; }
180 SotStorageRef GetSvDrawStorage() const { return aSvDrawStorageRef; }
182 public:
184 SgaObjKind GetObjectKind( sal_uIntPtr nPos ) const
186 DBG_ASSERT( nPos < GetObjectCount(), "Position out of range" );
187 return ImplGetGalleryObject( nPos )->eObjKind;
191 const INetURLObject& GetObjectURL( sal_uIntPtr nPos ) const
193 DBG_ASSERT( nPos < GetObjectCount(), "Position out of range" );
194 return ImplGetGalleryObject( nPos )->aURL;
197 sal_Bool GetThumb( sal_uIntPtr nPos, BitmapEx& rBmp, sal_Bool bProgress = sal_False );
199 SVX_DLLPUBLIC sal_Bool GetGraphic( sal_uIntPtr nPos, Graphic& rGraphic, sal_Bool bProgress = sal_False );
200 SVX_DLLPUBLIC sal_Bool InsertGraphic( const Graphic& rGraphic, sal_uIntPtr nInsertPos = LIST_APPEND );
202 SVX_DLLPUBLIC sal_Bool GetModel( sal_uIntPtr nPos, SdrModel& rModel, sal_Bool bProgress = sal_False );
203 SVX_DLLPUBLIC sal_Bool InsertModel( const FmFormModel& rModel, sal_uIntPtr nInsertPos = LIST_APPEND );
205 sal_Bool GetModelStream( sal_uIntPtr nPos, SotStorageStreamRef& rModelStreamRef, sal_Bool bProgress = sal_False );
206 sal_Bool InsertModelStream( const SotStorageStreamRef& rModelStream, sal_uIntPtr nInsertPos = LIST_APPEND );
208 sal_Bool GetURL( sal_uIntPtr nPos, INetURLObject& rURL, sal_Bool bProgress = sal_False );
209 SVX_DLLPUBLIC sal_Bool InsertURL( const INetURLObject& rURL, sal_uIntPtr nInsertPos = LIST_APPEND );
210 sal_Bool InsertFileOrDirURL( const INetURLObject& rFileOrDirURL, sal_uIntPtr nInsertPos = LIST_APPEND );
212 sal_Bool InsertTransferable( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable, sal_uIntPtr nInsertPos );
214 void CopyToClipboard( Window* pWindow, sal_uIntPtr nPos );
215 void StartDrag( Window* pWindow, sal_uIntPtr nPos );
217 public:
219 SvStream& WriteData( SvStream& rOut ) const;
220 SvStream& ReadData( SvStream& rIn );
221 static SVX_DLLPUBLIC void InsertAllThemes( ListBox& rListBox );
224 SvStream& operator<<( SvStream& rOut, const GalleryTheme& rTheme );
225 SvStream& operator>>( SvStream& rIn, GalleryTheme& rTheme );
227 #endif
229 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */