LibreOffice Module svx (master) 1
gallery1.cxx
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#include <config_features.h>
21
22#if defined(MACOSX) && HAVE_FEATURE_READONLY_INSTALLSET
23#define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
24#include <premac.h>
25#include <Foundation/Foundation.h>
26#include <postmac.h>
27#endif
28
29#include <sal/config.h>
30
32#include <ucbhelper/content.hxx>
33#include <com/sun/star/ucb/ContentCreationException.hpp>
34#include <o3tl/string_view.hxx>
38#include <svx/dialmgr.hxx>
39#include <svx/gallery.hxx>
41#include <svx/strings.hrc>
42#include <strings.hxx>
43#include <svx/galmisc.hxx>
44#include <svx/galtheme.hxx>
45#include <svx/gallery1.hxx>
47#include <vcl/weld.hxx>
48#include <com/sun/star/sdbc/XResultSet.hpp>
49#include <com/sun/star/ucb/XContentAccess.hpp>
50#include <memory>
51
52
53using namespace ::com::sun::star;
54
55
56const std::pair<sal_uInt16, rtl::OUStringConstExpr> aUnlocalized[] =
57{
65};
66
67const std::pair<sal_uInt16, TranslateId> aLocalized[] =
68{
69 { RID_GALLERY_THEME_3D, RID_GALLERYSTR_THEME_3D },
70 { RID_GALLERY_THEME_ANIMATIONS, RID_GALLERYSTR_THEME_ANIMATIONS },
71 { RID_GALLERY_THEME_BULLETS, RID_GALLERYSTR_THEME_BULLETS },
72 { RID_GALLERY_THEME_OFFICE, RID_GALLERYSTR_THEME_OFFICE },
73 { RID_GALLERY_THEME_FLAGS, RID_GALLERYSTR_THEME_FLAGS },
74 { RID_GALLERY_THEME_FLOWCHARTS, RID_GALLERYSTR_THEME_FLOWCHARTS },
75 { RID_GALLERY_THEME_EMOTICONS, RID_GALLERYSTR_THEME_EMOTICONS },
76 { RID_GALLERY_THEME_PHOTOS, RID_GALLERYSTR_THEME_PHOTOS },
77 { RID_GALLERY_THEME_BACKGROUNDS, RID_GALLERYSTR_THEME_BACKGROUNDS },
78 { RID_GALLERY_THEME_HOMEPAGE, RID_GALLERYSTR_THEME_HOMEPAGE },
79 { RID_GALLERY_THEME_INTERACTION, RID_GALLERYSTR_THEME_INTERACTION },
80 { RID_GALLERY_THEME_MAPS, RID_GALLERYSTR_THEME_MAPS },
81 { RID_GALLERY_THEME_PEOPLE, RID_GALLERYSTR_THEME_PEOPLE },
82 { RID_GALLERY_THEME_SURFACES, RID_GALLERYSTR_THEME_SURFACES },
83 { RID_GALLERY_THEME_SOUNDS, RID_GALLERYSTR_THEME_SOUNDS },
84 { RID_GALLERY_THEME_SYMBOLS, RID_GALLERYSTR_THEME_SYMBOLS },
85 { RID_GALLERY_THEME_MYTHEME, RID_GALLERYSTR_THEME_MYTHEME },
86
87 { RID_GALLERY_THEME_ARROWS, RID_GALLERYSTR_THEME_ARROWS },
88 { RID_GALLERY_THEME_BALLOONS, RID_GALLERYSTR_THEME_BALLOONS },
89 { RID_GALLERY_THEME_KEYBOARD, RID_GALLERYSTR_THEME_KEYBOARD },
90 { RID_GALLERY_THEME_TIME, RID_GALLERYSTR_THEME_TIME },
91 { RID_GALLERY_THEME_PRESENTATION, RID_GALLERYSTR_THEME_PRESENTATION },
92 { RID_GALLERY_THEME_CALENDAR, RID_GALLERYSTR_THEME_CALENDAR },
93 { RID_GALLERY_THEME_NAVIGATION, RID_GALLERYSTR_THEME_NAVIGATION },
94 { RID_GALLERY_THEME_COMMUNICATION, RID_GALLERYSTR_THEME_COMMUNICATION },
95 { RID_GALLERY_THEME_FINANCES, RID_GALLERYSTR_THEME_FINANCES },
96 { RID_GALLERY_THEME_COMPUTER, RID_GALLERYSTR_THEME_COMPUTER },
97
98 { RID_GALLERY_THEME_CLIMA, RID_GALLERYSTR_THEME_CLIMA },
99 { RID_GALLERY_THEME_EDUCATION, RID_GALLERYSTR_THEME_EDUCATION },
100 { RID_GALLERY_THEME_TROUBLE, RID_GALLERYSTR_THEME_TROUBLE },
101 { RID_GALLERY_THEME_SCREENBEANS, RID_GALLERYSTR_THEME_SCREENBEANS },
102
103 { RID_GALLERY_THEME_COMPUTERS, RID_GALLERYSTR_THEME_COMPUTERS },
104 { RID_GALLERY_THEME_DIAGRAMS, RID_GALLERYSTR_THEME_DIAGRAMS },
105 { RID_GALLERY_THEME_ENVIRONMENT, RID_GALLERYSTR_THEME_ENVIRONMENT },
106 { RID_GALLERY_THEME_FINANCE, RID_GALLERYSTR_THEME_FINANCE },
107 { RID_GALLERY_THEME_TRANSPORT, RID_GALLERYSTR_THEME_TRANSPORT },
108 { RID_GALLERY_THEME_TXTSHAPES, RID_GALLERYSTR_THEME_TXTSHAPES }
109};
110
112 const INetURLObject& rBaseURL, const OUString& rName,
113 bool _bReadOnly, bool _bNewFile,
114 sal_uInt32 _nId, bool _bThemeNameFromResource ) :
115 nId ( _nId ),
116 bReadOnly ( _bReadOnly ),
117 bThemeNameFromResource ( _bThemeNameFromResource )
118{
119 INetURLObject aURL( rBaseURL );
120 DBG_ASSERT( aURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
121
122 if (bCreateUniqueURL)
123 {
125 }
126
127 mpGalleryStorageEngineEntry = std::make_unique<GalleryBinaryEngineEntry>();
129
130 SetModified( _bNewFile );
131
132 aName = mpGalleryStorageEngineEntry->ReadStrFromIni( u"name" );
133
134 // This is awful - we shouldn't use these resources if we
135 // possibly can avoid them
136 if( aName.isEmpty() && nId && bThemeNameFromResource )
137 {
138 //some of these are supposed to *not* be localized
139 //so catch them before looking up the resource
140 for (size_t i = 0; i < SAL_N_ELEMENTS(aUnlocalized); ++i)
141 {
142 if (aUnlocalized[i].first == nId)
143 {
144 aName = aUnlocalized[i].second;
145 break;
146 }
147 }
148 //look up the rest of the ids in string resources
149 if (aName.isEmpty())
150 {
151 for (size_t i = 0; i < SAL_N_ELEMENTS(aLocalized); ++i)
152 {
153 if (aLocalized[i].first == nId)
154 {
155 aName = SvxResId(aLocalized[i].second);
156 break;
157 }
158 }
159 }
160 }
161
162 if( aName.isEmpty() )
163 aName = rName;
164}
165
167{
168 mpGalleryStorageEngineEntry->setStorageLocations(rURL);
169}
170
172{
173 return new GalleryTheme(pGallery,this);
174}
175
176std::unique_ptr<GalleryBinaryEngine> GalleryThemeEntry::createGalleryStorageEngine(GalleryObjectCollection& mrGalleryObjectCollection)
177{
178 return mpGalleryStorageEngineEntry->createGalleryStorageEngine(mrGalleryObjectCollection, bReadOnly);
179}
180
182{
183 for (size_t i = 0; i < SAL_N_ELEMENTS(aUnlocalized); ++i)
184 rListBox.append_text(aUnlocalized[i].second);
185
186 for (size_t i = 0; i < SAL_N_ELEMENTS(aLocalized); ++i)
187 rListBox.append_text(SvxResId(aLocalized[i].second));
188}
189
190void GalleryThemeEntry::SetName( const OUString& rNewName )
191{
192 if( aName != rNewName )
193 {
194 aName = rNewName;
195 SetModified( true );
197 }
198}
199
200void GalleryThemeEntry::SetId( sal_uInt32 nNewId, bool bResetThemeName )
201{
202 nId = nNewId;
203 SetModified( true );
204 bThemeNameFromResource = ( nId && bResetThemeName );
205}
206
208{
209 mpGalleryStorageEngineEntry->removeTheme();
210}
211
213{
214private:
215
217 std::unique_ptr<GalleryTheme> mpTheme;
218
219public:
220
221 GalleryThemeCacheEntry( const GalleryThemeEntry* pThemeEntry, std::unique_ptr<GalleryTheme> pTheme ) :
222 mpThemeEntry( pThemeEntry ), mpTheme( std::move(pTheme) ) {}
223
225 GalleryTheme* GetTheme() const { return mpTheme.get(); }
226};
227
228
229Gallery::Gallery( std::u16string_view rMultiPath )
230: bMultiPath ( false )
231{
232 ImplLoad( rMultiPath );
233}
234
236{
237}
238
240{
241 // note: this would deadlock if it used osl::Mutex::getGlobalMutex()
242 static Gallery *const s_pGallery(
244 new Gallery(SvtPathOptions().GetGalleryPath()));
245
246 return s_pGallery;
247}
248
249void Gallery::ImplLoad( std::u16string_view rMultiPath )
250{
251 bool bIsReadOnlyDir {false};
252
253 bMultiPath = !rMultiPath.empty();
254
255 INetURLObject aCurURL(SvtPathOptions().GetConfigPath());
256 ImplLoadSubDirs( aCurURL, bIsReadOnlyDir );
257
258 if( !bIsReadOnlyDir )
259 aUserURL = aCurURL;
260
261 if( bMultiPath )
262 {
263 bool bIsRelURL {true};
264 sal_Int32 nIdx {0};
265 do
266 {
267 aCurURL = INetURLObject(o3tl::getToken(rMultiPath, 0, ';', nIdx));
268 if (bIsRelURL)
269 {
270 aRelURL = aCurURL;
271 bIsRelURL = false;
272 }
273
274 ImplLoadSubDirs( aCurURL, bIsReadOnlyDir );
275
276 if( !bIsReadOnlyDir )
277 aUserURL = aCurURL;
278 }
279 while (nIdx>0);
280 }
281 else
282 aRelURL = INetURLObject( rMultiPath );
283
284 DBG_ASSERT( aUserURL.GetProtocol() != INetProtocol::NotValid, "no writable Gallery user directory available" );
285 DBG_ASSERT( aRelURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
286}
287
288void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, bool& rbDirIsReadOnly )
289{
290 rbDirIsReadOnly = false;
291
292 try
293 {
294 uno::Reference< ucb::XCommandEnvironment > xEnv;
296
297 uno::Sequence<OUString> aProps { "Url" };
298
299 uno::Reference< sdbc::XResultSet > xResultSet( aCnt.createCursor( aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) );
300
301#if defined(MACOSX) && HAVE_FEATURE_READONLY_INSTALLSET
302 if( rBaseURL.GetProtocol() == INetProtocol::File )
303 {
304 const char *appBundle = [[[NSBundle mainBundle] bundlePath] UTF8String];
305 OUString path = rBaseURL.GetURLPath();
306 if( path.startsWith( Concat2View(OUString( appBundle, strlen( appBundle ), RTL_TEXTENCODING_UTF8 ) + "/") ) )
307 rbDirIsReadOnly = true;
308 }
309#else
310 try
311 {
312 // check readonlyness the very hard way
313 INetURLObject aTestURL( rBaseURL );
314
315 aTestURL.Append( u"cdefghij.klm" );
316 std::unique_ptr<SvStream> pTestStm(::utl::UcbStreamHelper::CreateStream( aTestURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::WRITE ));
317
318 if( pTestStm )
319 {
320 pTestStm->WriteInt32( sal_Int32(1) );
321
322 if( pTestStm->GetError() )
323 rbDirIsReadOnly = true;
324
325 pTestStm.reset();
326 KillFile( aTestURL );
327 }
328 else
329 rbDirIsReadOnly = true;
330 }
331 catch( const ucb::ContentCreationException& )
332 {
333 }
334 catch( const uno::RuntimeException& )
335 {
336 }
337 catch( const uno::Exception& )
338 {
339 }
340#endif
341 if( xResultSet.is() )
342 {
343 uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY );
344
345 if( xContentAccess.is() )
346 {
347 static constexpr OUStringLiteral s_sTitle = u"Title";
348 static constexpr OUStringLiteral s_sIsReadOnly = u"IsReadOnly";
349
350 while( xResultSet->next() )
351 {
352 INetURLObject aThmURL( xContentAccess->queryContentIdentifierString() );
353
354 if (aThmURL.GetFileExtension().equalsIgnoreAsciiCase("thm"))
355 {
356 INetURLObject aSdgURL( aThmURL); aSdgURL.SetExtension( u"sdg" );
357 INetURLObject aSdvURL( aThmURL ); aSdvURL.SetExtension( u"sdv" );
358
359 try
360 {
364
365 OUString aTitle;
366 try
367 {
368 aThmCnt.getPropertyValue( s_sTitle ) >>= aTitle;
369 }
370 catch( const uno::RuntimeException& )
371 {
372 }
373 catch( const uno::Exception& )
374 {
375 }
376
377 if( !aTitle.isEmpty() )
378 {
379 bool bReadOnly = false;
380
381 try
382 {
383 aThmCnt.getPropertyValue( s_sIsReadOnly ) >>= bReadOnly;
384 }
385 catch( const uno::RuntimeException& )
386 {
387 }
388 catch( const uno::Exception& )
389 {
390 }
391
392 if( !bReadOnly )
393 {
394 try
395 {
396 aSdgCnt.getPropertyValue( s_sTitle ) >>= aTitle;
397 }
398 catch( const css::uno::RuntimeException& )
399 {
400 }
401 catch( const css::uno::Exception& )
402 {
403 }
404
405 if( !aTitle.isEmpty() )
406 {
407 try
408 {
409 aSdgCnt.getPropertyValue( s_sIsReadOnly ) >>= bReadOnly;
410 }
411 catch( const uno::RuntimeException& )
412 {
413 }
414 catch( const uno::Exception& )
415 {
416 }
417 }
418 }
419
420 if( !bReadOnly )
421 {
422 try
423 {
424 aSdvCnt.getPropertyValue( s_sTitle ) >>= aTitle;
425 }
426 catch( const css::uno::RuntimeException& )
427 {
428 }
429 catch( const css::uno::Exception& )
430 {
431 }
432
433 if( !aTitle.isEmpty() )
434 {
435 try
436 {
437 aSdvCnt.getPropertyValue( s_sIsReadOnly ) >>= bReadOnly;
438 }
439 catch( const uno::RuntimeException& )
440 {
441 }
442 catch( const uno::Exception& )
443 {
444 }
445 }
446 }
447
448 GalleryThemeEntry* pEntry = GalleryBinaryEngineEntry::CreateThemeEntry( aThmURL, rbDirIsReadOnly || bReadOnly );
449
450 if( pEntry )
451 aThemeList.emplace_back( pEntry );
452 }
453 }
454 catch( const ucb::ContentCreationException& )
455 {
456 }
457 catch( const uno::RuntimeException& )
458 {
459 }
460 catch( const uno::Exception& )
461 {
462 }
463 }
464 }
465 }
466 }
467 }
468 catch( const ucb::ContentCreationException& )
469 {
470 }
471 catch( const uno::RuntimeException& )
472 {
473 }
474 catch( const uno::Exception& )
475 {
476 }
477}
478
479GalleryThemeEntry* Gallery::ImplGetThemeEntry( std::u16string_view rThemeName )
480{
481 if( !rThemeName.empty() )
482 {
483 for ( size_t i = 0, n = aThemeList.size(); i < n; ++i )
484 if( rThemeName == aThemeList[ i ]->GetThemeName() )
485 return aThemeList[ i ].get();
486 }
487
488 return nullptr;
489}
490
491OUString Gallery::GetThemeName( sal_uInt32 nThemeId ) const
492{
493 GalleryThemeEntry* pFound = nullptr;
494
495 for ( size_t i = 0, n = aThemeList.size(); i < n && !pFound; ++i )
496 {
497 GalleryThemeEntry* pEntry = aThemeList[ i ].get();
498 if( nThemeId == pEntry->GetId() )
499 pFound = pEntry;
500 }
501
502 // try fallback, if no entry was found
503 if( !pFound )
504 {
505 OUString aFallback;
506
507 switch( nThemeId )
508 {
509 case GALLERY_THEME_3D:
510 aFallback = SvxResId(RID_GALLERYSTR_THEME_3D);
511 break;
513 aFallback = SvxResId(RID_GALLERYSTR_THEME_BULLETS);
514 break;
516 aFallback = SvxResId(RID_GALLERYSTR_THEME_HOMEPAGE);
517 break;
520 break;
523 break;
526 break;
528 aFallback = SvxResId(RID_GALLERYSTR_THEME_SOUNDS);
529 break;
531 aFallback = SvxResId(RID_GALLERYSTR_THEME_ARROWS);
532 break;
534 aFallback = SvxResId(RID_GALLERYSTR_THEME_COMPUTERS);
535 break;
537 aFallback = SvxResId(RID_GALLERYSTR_THEME_DIAGRAMS);
538 break;
540 aFallback = SvxResId(RID_GALLERYSTR_THEME_EDUCATION);
541 break;
543 aFallback = SvxResId(RID_GALLERYSTR_THEME_ENVIRONMENT);
544 break;
546 aFallback = SvxResId(RID_GALLERYSTR_THEME_FINANCE);
547 break;
549 aFallback = SvxResId(RID_GALLERYSTR_THEME_PEOPLE);
550 break;
552 aFallback = SvxResId(RID_GALLERYSTR_THEME_SYMBOLS);
553 break;
555 aFallback = SvxResId(RID_GALLERYSTR_THEME_TRANSPORT);
556 break;
558 aFallback = SvxResId(RID_GALLERYSTR_THEME_TXTSHAPES);
559 break;
560 default:
561 break;
562 }
563
564 pFound = const_cast<Gallery*>(this)->ImplGetThemeEntry(aFallback);
565 }
566
567 return( pFound ? pFound->GetThemeName() : OUString() );
568}
569
570bool Gallery::HasTheme( std::u16string_view rThemeName )
571{
572 return( ImplGetThemeEntry( rThemeName ) != nullptr );
573}
574
575bool Gallery::CreateTheme( const OUString& rThemeName )
576{
577 bool bRet = false;
578
579 if( !HasTheme( rThemeName ) && ( GetUserURL().GetProtocol() != INetProtocol::NotValid ) )
580 {
582 aURL.Append( rThemeName );
583 GalleryThemeEntry* pNewEntry = new GalleryThemeEntry(
584 true, aURL, rThemeName,
585 false, true, 0, false );
586
587 aThemeList.emplace_back( pNewEntry );
588 delete pNewEntry->createGalleryTheme( this );
590 bRet = true;
591 }
592
593 return bRet;
594}
595
596void Gallery::RenameTheme( const OUString& rOldName, const OUString& rNewName )
597{
598 GalleryThemeEntry* pThemeEntry = ImplGetThemeEntry( rOldName );
599
600 // check if the new theme name is already present
601 if( !pThemeEntry || HasTheme( rNewName ) || pThemeEntry->IsReadOnly() )
602 return;
603
604 SfxListener aListener;
605 GalleryTheme* pThm = AcquireTheme( rOldName, aListener );
606
607 if( pThm )
608 {
609 pThemeEntry->SetName( rNewName );
610 if (pThm->pThm->IsModified())
611 if (!pThm->mpGalleryStorageEngine->implWrite(*pThm, pThm->pThm))
612 pThm->ImplSetModified(false);
613
615 ReleaseTheme( pThm, aListener );
616 }
617}
618
619bool Gallery::RemoveTheme( const OUString& rThemeName )
620{
621 GalleryThemeEntry* pThemeEntry = ImplGetThemeEntry( rThemeName );
622 bool bRet = false;
623
624 if( pThemeEntry && !pThemeEntry->IsReadOnly() )
625 {
627
628 SfxListener aListener;
629 GalleryTheme* pThm = AcquireTheme( rThemeName, aListener );
630
631 if( pThm )
632 {
633 ReleaseTheme(pThm, aListener);
634 pThemeEntry->removeTheme();
635 }
636
637 auto it = std::find_if(aThemeList.begin(), aThemeList.end(),
638 [&pThemeEntry](const std::unique_ptr<GalleryThemeEntry>& rpEntry) { return pThemeEntry == rpEntry.get(); });
639 if (it != aThemeList.end())
640 aThemeList.erase( it );
641
643
644 bRet = true;
645 }
646
647 return bRet;
648}
649
650std::unique_ptr<GalleryTheme> GalleryThemeEntry::getCachedTheme(Gallery* pGallery)
651{
652 std::unique_ptr<GalleryTheme> pNewTheme;
653 pNewTheme.reset(createGalleryTheme(pGallery));
654 mpGalleryStorageEngineEntry->getCachedTheme(pNewTheme);
655 return pNewTheme;
656}
657
659{
660 GalleryTheme* pTheme = nullptr;
661
662 if( pThemeEntry )
663 {
664 auto it = std::find_if(aThemeCache.begin(), aThemeCache.end(),
665 [&pThemeEntry](const GalleryThemeCacheEntry* pEntry) { return pThemeEntry == pEntry->GetThemeEntry(); });
666 if (it != aThemeCache.end())
667 pTheme = (*it)->GetTheme();
668
669 if( !pTheme )
670 {
671 std::unique_ptr<GalleryTheme> pNewTheme = pThemeEntry->getCachedTheme(this);
672 if (pNewTheme)
673 {
674 aThemeCache.push_back( new GalleryThemeCacheEntry( pThemeEntry, std::move(pNewTheme) ));
675 pTheme = aThemeCache.back()->GetTheme();
676 }
677 }
678 }
679
680 return pTheme;
681}
682
684{
685 auto it = std::find_if(aThemeCache.begin(), aThemeCache.end(),
686 [&pTheme](const GalleryThemeCacheEntry* pEntry) { return pTheme == pEntry->GetTheme(); });
687 if (it != aThemeCache.end())
688 {
689 delete *it;
690 aThemeCache.erase(it);
691 }
692}
693
694GalleryTheme* Gallery::AcquireTheme( std::u16string_view rThemeName, SfxListener& rListener )
695{
696 GalleryTheme* pTheme = nullptr;
697 GalleryThemeEntry* pThemeEntry = ImplGetThemeEntry( rThemeName );
698
699 if( pThemeEntry )
700 {
701 pTheme = ImplGetCachedTheme( pThemeEntry );
702 if (pTheme)
703 rListener.StartListening(*pTheme, DuplicateHandling::Prevent);
704 }
705 return pTheme;
706}
707
709{
710 if( pTheme )
711 {
712 rListener.EndListening( *pTheme );
713
714 if( !pTheme->HasListeners() )
715 ImplDeleteCachedTheme( pTheme );
716 }
717}
718
720{
721 return nId > 0 && nId != GALLERY_THEME_MYTHEME;
722}
723
724/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static GalleryThemeEntry * CreateThemeEntry(const INetURLObject &rURL, bool bReadOnly)
static void CreateUniqueURL(const INetURLObject &rBaseURL, INetURLObject &aURL)
const GalleryThemeEntry * mpThemeEntry
Definition: gallery1.cxx:216
const GalleryThemeEntry * GetThemeEntry() const
Definition: gallery1.cxx:224
GalleryTheme * GetTheme() const
Definition: gallery1.cxx:225
GalleryThemeCacheEntry(const GalleryThemeEntry *pThemeEntry, std::unique_ptr< GalleryTheme > pTheme)
Definition: gallery1.cxx:221
std::unique_ptr< GalleryTheme > mpTheme
Definition: gallery1.cxx:217
const OUString & GetThemeName() const
Definition: gallery1.hxx:64
sal_uInt32 nId
Definition: gallery1.hxx:44
bool IsReadOnly() const
Definition: gallery1.hxx:66
std::unique_ptr< GalleryBinaryEngineEntry > mpGalleryStorageEngineEntry
Definition: gallery1.hxx:42
GalleryThemeEntry(bool bCreateUniqueURL, const INetURLObject &rBaseURL, const OUString &rName, bool bReadOnly, bool bNewFile, sal_uInt32 nId, bool bThemeNameFromResource)
Definition: gallery1.cxx:111
GalleryTheme * createGalleryTheme(Gallery *pGallery)
Definition: gallery1.cxx:171
sal_uInt32 GetId() const
Definition: gallery1.hxx:77
void setStorageLocations(INetURLObject &rURL)
Definition: gallery1.cxx:166
bool IsDefault() const
Definition: gallery1.cxx:719
OUString aName
Definition: gallery1.hxx:43
std::unique_ptr< GalleryBinaryEngine > createGalleryStorageEngine(GalleryObjectCollection &mrGalleryObjectCollection)
Definition: gallery1.cxx:176
bool bThemeNameFromResource
Definition: gallery1.hxx:47
void SetModified(bool bSet)
Definition: gallery1.hxx:72
std::unique_ptr< GalleryTheme > getCachedTheme(Gallery *pGallery)
Definition: gallery1.cxx:650
void SetId(sal_uInt32 nNewId, bool bResetThemeName)
Definition: gallery1.cxx:200
bool IsModified() const
Definition: gallery1.hxx:71
void SetName(const OUString &rNewName)
Definition: gallery1.cxx:190
SAL_DLLPRIVATE void ImplSetModified(bool bModified)
Definition: galtheme.cxx:768
const OUString & GetName() const
Definition: galtheme.cxx:778
static void InsertAllThemes(weld::ComboBox &rListBox)
Definition: gallery1.cxx:181
GalleryThemeEntry * pThm
Definition: galtheme.hxx:62
std::unique_ptr< GalleryBinaryEngine > mpGalleryStorageEngine
Definition: galtheme.hxx:59
SAL_DLLPRIVATE OUString GetThemeName(sal_uInt32 nThemeId) const
Definition: gallery1.cxx:491
static Gallery * GetGalleryInstance()
Definition: gallery1.cxx:239
SAL_DLLPRIVATE void ImplLoadSubDirs(const INetURLObject &rBaseURL, bool &rbIsReadOnly)
Definition: gallery1.cxx:288
void ReleaseTheme(GalleryTheme *pTheme, SfxListener &rListener)
Definition: gallery1.cxx:708
bool bMultiPath
Definition: gallery1.hxx:103
bool CreateTheme(const OUString &rThemeName)
Definition: gallery1.cxx:575
SAL_DLLPRIVATE const INetURLObject & GetUserURL() const
Definition: gallery1.hxx:140
bool HasTheme(std::u16string_view rThemeName)
Definition: gallery1.cxx:570
void RenameTheme(const OUString &rOldName, const OUString &rNewName)
Definition: gallery1.cxx:596
virtual ~Gallery() override
Definition: gallery1.cxx:235
Gallery(Gallery const &)=delete
INetURLObject aUserURL
Definition: gallery1.hxx:102
bool RemoveTheme(const OUString &rThemeName)
Definition: gallery1.cxx:619
SAL_DLLPRIVATE void ImplLoad(std::u16string_view rMultiPath)
Definition: gallery1.cxx:249
GalleryThemeEntry * ImplGetThemeEntry(std::u16string_view rThemeName)
Definition: gallery1.cxx:479
SAL_DLLPRIVATE GalleryTheme * ImplGetCachedTheme(GalleryThemeEntry *pThemeEntry)
Definition: gallery1.cxx:658
std::vector< std::unique_ptr< GalleryThemeEntry > > aThemeList
Definition: gallery1.hxx:99
GalleryCacheThemeList aThemeCache
Definition: gallery1.hxx:100
INetURLObject aRelURL
Definition: gallery1.hxx:101
GalleryTheme * AcquireTheme(std::u16string_view rThemeName, SfxListener &rListener)
Definition: gallery1.cxx:694
SAL_DLLPRIVATE void ImplDeleteCachedTheme(GalleryTheme const *pTheme)
Definition: gallery1.cxx:683
void SetExtension(std::u16string_view rTheExtension)
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString GetFileExtension() const
OUString GetURLPath(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
bool Append(std::u16string_view rTheSegment, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
bool HasListeners() const
void Broadcast(const SfxHint &rHint)
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
css::uno::Any getPropertyValue(const OUString &rPropertyName)
css::uno::Reference< css::sdbc::XResultSet > createCursor(const css::uno::Sequence< OUString > &rPropertyNames, ResultSetInclude eMode=INCLUDE_FOLDERS_AND_DOCUMENTS)
static bool IsFuzzing()
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
void append_text(const OUString &rStr)
#define DBG_ASSERT(sCon, aError)
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
URL aURL
float u
bool bReadOnly
const std::pair< sal_uInt16, TranslateId > aLocalized[]
Definition: gallery1.cxx:67
const std::pair< sal_uInt16, rtl::OUStringConstExpr > aUnlocalized[]
Definition: gallery1.cxx:56
#define RID_GALLERY_THEME_PRESENTATION
Definition: gallery.hxx:74
#define RID_GALLERY_THEME_BACKGROUNDS
Definition: gallery.hxx:59
#define GALLERY_THEME_FONTWORK
Definition: gallery.hxx:38
#define RID_GALLERY_THEME_CLIMA
Definition: gallery.hxx:80
#define RID_GALLERY_THEME_PEOPLE
Definition: gallery.hxx:63
#define GALLERY_THEME_DUMMY5
Definition: gallery.hxx:37
#define RID_GALLERY_THEME_COMMUNICATION
Definition: gallery.hxx:77
#define GALLERY_THEME_USERSOUNDS
Definition: gallery.hxx:36
#define GALLERY_THEME_FONTWORK_VERTICAL
Definition: gallery.hxx:39
#define GALLERY_THEME_MYTHEME
Definition: gallery.hxx:35
#define RID_GALLERY_THEME_TROUBLE
Definition: gallery.hxx:82
#define RID_GALLERY_THEME_CALENDAR
Definition: gallery.hxx:75
#define RID_GALLERY_THEME_INTERACTION
Definition: gallery.hxx:61
#define RID_GALLERY_THEME_MAPS
Definition: gallery.hxx:62
#define RID_GALLERY_THEME_3D
Definition: gallery.hxx:51
#define RID_GALLERY_THEME_FINANCE
Definition: gallery.hxx:88
#define RID_GALLERY_THEME_TRANSPORT
Definition: gallery.hxx:89
#define GALLERY_THEME_POWERPOINT
Definition: gallery.hxx:32
#define RID_GALLERY_THEME_DIAGRAMS
Definition: gallery.hxx:86
#define RID_GALLERY_THEME_BULLETS
Definition: gallery.hxx:53
#define RID_GALLERY_THEME_SYMBOLS
Definition: gallery.hxx:67
#define RID_GALLERY_THEME_COMPUTER
Definition: gallery.hxx:79
#define RID_GALLERY_THEME_SOUNDS
Definition: gallery.hxx:66
#define RID_GALLERY_THEME_ARROWS
Definition: gallery.hxx:70
#define RID_GALLERY_THEME_SURFACES
Definition: gallery.hxx:64
#define RID_GALLERY_THEME_ANIMATIONS
Definition: gallery.hxx:52
#define RID_GALLERY_THEME_FLOWCHARTS
Definition: gallery.hxx:56
#define GALLERY_THEME_BULLETS
Definition: gallery.hxx:29
#define RID_GALLERY_THEME_SCREENBEANS
Definition: gallery.hxx:83
#define RID_GALLERY_THEME_MYTHEME
Definition: gallery.hxx:68
#define RID_GALLERY_THEME_TXTSHAPES
Definition: gallery.hxx:90
#define RID_GALLERY_THEME_EMOTICONS
Definition: gallery.hxx:57
#define RID_GALLERY_THEME_BALLOONS
Definition: gallery.hxx:71
#define GALLERY_THEME_RULERS
Definition: gallery.hxx:33
#define RID_GALLERY_THEME_KEYBOARD
Definition: gallery.hxx:72
#define GALLERY_THEME_3D
Definition: gallery.hxx:28
#define RID_GALLERY_THEME_FINANCES
Definition: gallery.hxx:78
#define RID_GALLERY_THEME_OFFICE
Definition: gallery.hxx:54
#define RID_GALLERY_THEME_TIME
Definition: gallery.hxx:73
#define RID_GALLERY_THEME_PHOTOS
Definition: gallery.hxx:58
#define RID_GALLERY_THEME_ENVIRONMENT
Definition: gallery.hxx:87
#define RID_GALLERY_THEME_HOMEPAGE
Definition: gallery.hxx:60
#define RID_GALLERY_THEME_FLAGS
Definition: gallery.hxx:55
#define RID_GALLERY_THEME_COMPUTERS
Definition: gallery.hxx:85
#define RID_GALLERY_THEME_EDUCATION
Definition: gallery.hxx:81
#define GALLERY_THEME_SOUNDS
Definition: gallery.hxx:34
#define GALLERY_THEME_HOMEPAGE
Definition: gallery.hxx:30
#define RID_GALLERY_THEME_NAVIGATION
Definition: gallery.hxx:76
bool KillFile(const INetURLObject &rURL)
Definition: galmisc.cxx:287
sal_Int64 n
#define SAL_N_ELEMENTS(arr)
Reference< XComponentContext > getProcessComponentContext()
int i
constexpr OUStringLiteral first
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
sal_Int16 nId
constexpr OUStringLiteral RID_GALLERYSTR_THEME_RULERS
Definition: strings.hxx:15
constexpr OUStringLiteral RID_GALLERYSTR_THEME_POWERPOINT
Definition: strings.hxx:14
constexpr OUStringLiteral RID_GALLERYSTR_THEME_USERSOUNDS
Definition: strings.hxx:16
constexpr OUStringLiteral RID_GALLERYSTR_THEME_HTMLBUTTONS
Definition: strings.hxx:13
constexpr OUStringLiteral RID_GALLERYSTR_THEME_FONTWORK_VERTICAL
Definition: strings.hxx:19
constexpr OUStringLiteral RID_GALLERYSTR_THEME_FONTWORK
Definition: strings.hxx:18
constexpr OUStringLiteral RID_GALLERYSTR_THEME_DUMMY5
Definition: strings.hxx:17