update credits
[LibreOffice.git] / include / svx / gallery1.hxx
blob5610c0f043b0efb04f98cf74ab7b00cbda8706e9
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_GALLERY1_HXX_
21 #define _SVX_GALLERY1_HXX_
23 #include <tools/string.hxx>
24 #include <tools/urlobj.hxx>
25 #include <svl/brdcst.hxx>
26 #include "svx/svxdllapi.h"
28 #include <cstdio>
29 #include <vector>
31 // ---------------------
32 // - GalleryThemeEntry -
33 // ---------------------
35 class SvStream;
37 class GalleryThemeEntry
39 private:
41 OUString aName;
42 INetURLObject aThmURL;
43 INetURLObject aSdgURL;
44 INetURLObject aSdvURL;
45 INetURLObject aStrURL;
46 sal_uInt32 nId;
47 sal_Bool bReadOnly;
48 sal_Bool bModified;
49 sal_Bool bThemeNameFromResource;
51 GalleryThemeEntry();
52 INetURLObject ImplGetURLIgnoreCase( const INetURLObject& rURL ) const;
54 public:
56 GalleryThemeEntry( bool bCreateUniqueURL,
57 const INetURLObject& rBaseURL,
58 const String& rName,
59 sal_Bool bReadOnly, sal_Bool bNewFile,
60 sal_uInt32 nId, sal_Bool bThemeNameFromResource );
61 ~GalleryThemeEntry() {};
63 const OUString& GetThemeName() const { return aName; }
65 const INetURLObject& GetThmURL() const { return aThmURL; }
66 const INetURLObject& GetSdgURL() const { return aSdgURL; }
67 const INetURLObject& GetSdvURL() const { return aSdvURL; }
68 const INetURLObject& GetStrURL() const { return aStrURL; }
70 OUString ReadStrFromIni(const OUString &aKeyName );
72 sal_Bool IsReadOnly() const { return bReadOnly; }
73 sal_Bool IsDefault() const;
75 sal_Bool IsHidden() const { return aName.match("private://gallery/hidden/"); }
77 sal_Bool IsModified() const { return bModified; }
78 void SetModified( sal_Bool bSet ) { bModified = ( bSet && !IsReadOnly() ); }
80 void SetName( const OUString& rNewName );
81 sal_Bool IsNameFromResource() const { return bThemeNameFromResource; }
83 sal_uInt32 GetId() const { return nId; }
84 void SetId( sal_uInt32 nNewId, sal_Bool bResetThemeName );
87 typedef ::std::vector< GalleryThemeEntry* > GalleryThemeList;
89 // -----------
90 // - Gallery -
91 // -----------
93 class SfxListener;
94 class GalleryTheme;
95 class GalleryThemeCacheEntry;
97 class Gallery : public SfxBroadcaster
99 // only for gengal utility!
100 friend Gallery* createGallery( const OUString& );
101 friend void disposeGallery( Gallery* );
103 typedef std::vector<GalleryThemeCacheEntry*> GalleryCacheThemeList;
105 private:
107 GalleryThemeList aThemeList;
108 GalleryCacheThemeList aThemeCache;
109 INetURLObject aRelURL;
110 INetURLObject aUserURL;
111 rtl_TextEncoding nReadTextEncoding;
112 sal_Bool bMultiPath;
114 void ImplLoad( const OUString& rMultiPath );
115 void ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbIsReadOnly );
117 SVX_DLLPUBLIC GalleryThemeEntry* ImplGetThemeEntry( const OUString& rThemeName );
118 GalleryThemeEntry* ImplGetThemeEntry( sal_uIntPtr nThemeId );
120 GalleryTheme* ImplGetCachedTheme( const GalleryThemeEntry* pThemeEntry );
121 void ImplDeleteCachedTheme( GalleryTheme* pTheme );
123 SVX_DLLPUBLIC Gallery( const OUString& rMultiPath );
124 SVX_DLLPUBLIC ~Gallery();
126 public:
128 SVX_DLLPUBLIC static Gallery* GetGalleryInstance();
130 size_t GetThemeCount() const { return aThemeList.size(); }
131 const GalleryThemeEntry* GetThemeInfo( size_t nPos )
132 { return nPos < aThemeList.size() ? aThemeList[ nPos ] : NULL; }
133 const GalleryThemeEntry* GetThemeInfo( const String& rThemeName ) { return ImplGetThemeEntry( rThemeName ); }
135 SVX_DLLPUBLIC sal_Bool HasTheme( const String& rThemeName );
136 OUString GetThemeName( sal_uIntPtr nThemeId ) const;
138 SVX_DLLPUBLIC sal_Bool CreateTheme( const String& rThemeName );
139 sal_Bool RenameTheme( const String& rOldName, const String& rNewName );
140 SVX_DLLPUBLIC sal_Bool RemoveTheme( const String& rThemeName );
142 SVX_DLLPUBLIC GalleryTheme* AcquireTheme( const String& rThemeName, SfxListener& rListener );
143 SVX_DLLPUBLIC void ReleaseTheme( GalleryTheme* pTheme, SfxListener& rListener );
145 public:
147 const INetURLObject& GetUserURL() const { return aUserURL; }
148 const INetURLObject& GetRelativeURL() const { return aRelURL; }
150 sal_Bool IsMultiPath() const { return bMultiPath; }
153 #endif // _SVX_GALLERY1_HXX_
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */