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<GalleryFileStorageEntry>();
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
170{
171 mpGalleryStorageEngineEntry->setStorageLocations(rURL);
172}
173
175{
176 return new GalleryTheme(pGallery,this);
177}
178
179std::unique_ptr<GalleryFileStorage> GalleryThemeEntry::createGalleryStorageEngine(GalleryObjectCollection& mrGalleryObjectCollection)
180{
181 return mpGalleryStorageEngineEntry->createGalleryStorageEngine(mrGalleryObjectCollection, bReadOnly);
182}
183
185{
186 for (size_t i = 0; i < SAL_N_ELEMENTS(aUnlocalized); ++i)
187 rListBox.append_text(aUnlocalized[i].second);
188
189 for (size_t i = 0; i < SAL_N_ELEMENTS(aLocalized); ++i)
190 rListBox.append_text(SvxResId(aLocalized[i].second));
191}
192
193void GalleryThemeEntry::SetName( const OUString& rNewName )
194{
195 if( aName != rNewName )
196 {
197 aName = rNewName;
198 SetModified( true );
200 }
201}
202
203void GalleryThemeEntry::SetId( sal_uInt32 nNewId, bool bResetThemeName )
204{
205 nId = nNewId;
206 SetModified( true );
207 bThemeNameFromResource = ( nId && bResetThemeName );
208}
209
211{
212 mpGalleryStorageEngineEntry->removeTheme();
213}
214
216{
217private:
218
220 std::unique_ptr<GalleryTheme> mpTheme;
221
222public:
223
224 GalleryThemeCacheEntry( const GalleryThemeEntry* pThemeEntry, std::unique_ptr<GalleryTheme> pTheme ) :
225 mpThemeEntry( pThemeEntry ), mpTheme( std::move(pTheme) ) {}
226
228 GalleryTheme* GetTheme() const { return mpTheme.get(); }
229};
230
231
232Gallery::Gallery( std::u16string_view rMultiPath )
233: bMultiPath ( false )
234{
235 ImplLoad( rMultiPath );
236}
237
239{
240}
241
243{
244 // note: this would deadlock if it used osl::Mutex::getGlobalMutex()
245 static Gallery *const s_pGallery(
247 new Gallery(SvtPathOptions().GetGalleryPath()));
248
249 return s_pGallery;
250}
251
252void Gallery::ImplLoad( std::u16string_view rMultiPath )
253{
254 bool bIsReadOnlyDir {false};
255
256 bMultiPath = !rMultiPath.empty();
257
258 INetURLObject aCurURL(SvtPathOptions().GetConfigPath());
259 ImplLoadSubDirs( aCurURL, bIsReadOnlyDir );
260
261 if( !bIsReadOnlyDir )
262 aUserURL = aCurURL;
263
264 if( bMultiPath )
265 {
266 bool bIsRelURL {true};
267 sal_Int32 nIdx {0};
268 do
269 {
270 aCurURL = INetURLObject(o3tl::getToken(rMultiPath, 0, ';', nIdx));
271 if (bIsRelURL)
272 {
273 aRelURL = aCurURL;
274 bIsRelURL = false;
275 }
276
277 ImplLoadSubDirs( aCurURL, bIsReadOnlyDir );
278
279 if( !bIsReadOnlyDir )
280 aUserURL = aCurURL;
281 }
282 while (nIdx>0);
283 }
284 else
285 aRelURL = INetURLObject( rMultiPath );
286
287 DBG_ASSERT( aUserURL.GetProtocol() != INetProtocol::NotValid, "no writable Gallery user directory available" );
288 DBG_ASSERT( aRelURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
289}
290
291void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, bool& rbDirIsReadOnly )
292{
293 rbDirIsReadOnly = false;
294
295 try
296 {
297 uno::Reference< ucb::XCommandEnvironment > xEnv;
299
300 uno::Sequence<OUString> aProps { "Url" };
301
302 uno::Reference< sdbc::XResultSet > xResultSet( aCnt.createCursor( aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY ) );
303
304#if defined(MACOSX) && HAVE_FEATURE_READONLY_INSTALLSET
305 if( rBaseURL.GetProtocol() == INetProtocol::File )
306 {
307 const char *appBundle = [[[NSBundle mainBundle] bundlePath] UTF8String];
308 OUString path = rBaseURL.GetURLPath();
309 if( path.startsWith( Concat2View(OUString( appBundle, strlen( appBundle ), RTL_TEXTENCODING_UTF8 ) + "/") ) )
310 rbDirIsReadOnly = true;
311 }
312#else
313 try
314 {
315 // check readonlyness the very hard way
316 INetURLObject aTestURL( rBaseURL );
317
318 aTestURL.Append( u"cdefghij.klm" );
319 std::unique_ptr<SvStream> pTestStm(::utl::UcbStreamHelper::CreateStream( aTestURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::WRITE ));
320
321 if( pTestStm )
322 {
323 pTestStm->WriteInt32( sal_Int32(1) );
324
325 if( pTestStm->GetError() )
326 rbDirIsReadOnly = true;
327
328 pTestStm.reset();
329 KillFile( aTestURL );
330 }
331 else
332 rbDirIsReadOnly = true;
333 }
334 catch( const ucb::ContentCreationException& )
335 {
336 }
337 catch( const uno::RuntimeException& )
338 {
339 }
340 catch( const uno::Exception& )
341 {
342 }
343#endif
344 if( xResultSet.is() )
345 {
346 uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY );
347
348 if( xContentAccess.is() )
349 {
350 static constexpr OUStringLiteral s_sTitle = u"Title";
351 static constexpr OUStringLiteral s_sIsReadOnly = u"IsReadOnly";
352
353 while( xResultSet->next() )
354 {
355 INetURLObject aThmURL( xContentAccess->queryContentIdentifierString() );
356
357 if (aThmURL.GetFileExtension().equalsIgnoreAsciiCase("thm"))
358 {
359 INetURLObject aSdgURL( aThmURL); aSdgURL.SetExtension( u"sdg" );
360 INetURLObject aSdvURL( aThmURL ); aSdvURL.SetExtension( u"sdv" );
361
362 try
363 {
367
368 OUString aTitle;
369 try
370 {
371 aThmCnt.getPropertyValue( s_sTitle ) >>= aTitle;
372 }
373 catch( const uno::RuntimeException& )
374 {
375 }
376 catch( const uno::Exception& )
377 {
378 }
379
380 if( !aTitle.isEmpty() )
381 {
382 bool bReadOnly = false;
383
384 try
385 {
386 aThmCnt.getPropertyValue( s_sIsReadOnly ) >>= bReadOnly;
387 }
388 catch( const uno::RuntimeException& )
389 {
390 }
391 catch( const uno::Exception& )
392 {
393 }
394
395 if( !bReadOnly )
396 {
397 try
398 {
399 aSdgCnt.getPropertyValue( s_sTitle ) >>= aTitle;
400 }
401 catch( const css::uno::RuntimeException& )
402 {
403 }
404 catch( const css::uno::Exception& )
405 {
406 }
407
408 if( !aTitle.isEmpty() )
409 {
410 try
411 {
412 aSdgCnt.getPropertyValue( s_sIsReadOnly ) >>= bReadOnly;
413 }
414 catch( const uno::RuntimeException& )
415 {
416 }
417 catch( const uno::Exception& )
418 {
419 }
420 }
421 }
422
423 if( !bReadOnly )
424 {
425 try
426 {
427 aSdvCnt.getPropertyValue( s_sTitle ) >>= aTitle;
428 }
429 catch( const css::uno::RuntimeException& )
430 {
431 }
432 catch( const css::uno::Exception& )
433 {
434 }
435
436 if( !aTitle.isEmpty() )
437 {
438 try
439 {
440 aSdvCnt.getPropertyValue( s_sIsReadOnly ) >>= bReadOnly;
441 }
442 catch( const uno::RuntimeException& )
443 {
444 }
445 catch( const uno::Exception& )
446 {
447 }
448 }
449 }
450
451 GalleryThemeEntry* pEntry = GalleryFileStorageEntry::CreateThemeEntry( aThmURL, rbDirIsReadOnly || bReadOnly );
452
453 if( pEntry )
454 aThemeList.emplace_back( pEntry );
455 }
456 }
457 catch( const ucb::ContentCreationException& )
458 {
459 }
460 catch( const uno::RuntimeException& )
461 {
462 }
463 catch( const uno::Exception& )
464 {
465 }
466 }
467 }
468 }
469 }
470 }
471 catch( const ucb::ContentCreationException& )
472 {
473 }
474 catch( const uno::RuntimeException& )
475 {
476 }
477 catch( const uno::Exception& )
478 {
479 }
480}
481
482GalleryThemeEntry* Gallery::ImplGetThemeEntry( std::u16string_view rThemeName )
483{
484 if( !rThemeName.empty() )
485 {
486 for ( size_t i = 0, n = aThemeList.size(); i < n; ++i )
487 if( rThemeName == aThemeList[ i ]->GetThemeName() )
488 return aThemeList[ i ].get();
489 }
490
491 return nullptr;
492}
493
494OUString Gallery::GetThemeName( sal_uInt32 nThemeId ) const
495{
496 GalleryThemeEntry* pFound = nullptr;
497
498 for ( size_t i = 0, n = aThemeList.size(); i < n && !pFound; ++i )
499 {
500 GalleryThemeEntry* pEntry = aThemeList[ i ].get();
501 if( nThemeId == pEntry->GetId() )
502 pFound = pEntry;
503 }
504
505 // try fallback, if no entry was found
506 if( !pFound )
507 {
508 OUString aFallback;
509
510 switch( nThemeId )
511 {
512 case GALLERY_THEME_3D:
513 aFallback = SvxResId(RID_GALLERYSTR_THEME_3D);
514 break;
516 aFallback = SvxResId(RID_GALLERYSTR_THEME_BULLETS);
517 break;
519 aFallback = SvxResId(RID_GALLERYSTR_THEME_HOMEPAGE);
520 break;
523 break;
526 break;
529 break;
531 aFallback = SvxResId(RID_GALLERYSTR_THEME_SOUNDS);
532 break;
534 aFallback = SvxResId(RID_GALLERYSTR_THEME_ARROWS);
535 break;
537 aFallback = SvxResId(RID_GALLERYSTR_THEME_COMPUTERS);
538 break;
540 aFallback = SvxResId(RID_GALLERYSTR_THEME_DIAGRAMS);
541 break;
543 aFallback = SvxResId(RID_GALLERYSTR_THEME_EDUCATION);
544 break;
546 aFallback = SvxResId(RID_GALLERYSTR_THEME_ENVIRONMENT);
547 break;
549 aFallback = SvxResId(RID_GALLERYSTR_THEME_FINANCE);
550 break;
552 aFallback = SvxResId(RID_GALLERYSTR_THEME_PEOPLE);
553 break;
555 aFallback = SvxResId(RID_GALLERYSTR_THEME_SYMBOLS);
556 break;
558 aFallback = SvxResId(RID_GALLERYSTR_THEME_TRANSPORT);
559 break;
561 aFallback = SvxResId(RID_GALLERYSTR_THEME_TXTSHAPES);
562 break;
563 default:
564 break;
565 }
566
567 pFound = const_cast<Gallery*>(this)->ImplGetThemeEntry(aFallback);
568 }
569
570 return( pFound ? pFound->GetThemeName() : OUString() );
571}
572
573bool Gallery::HasTheme( std::u16string_view rThemeName )
574{
575 return( ImplGetThemeEntry( rThemeName ) != nullptr );
576}
577
578bool Gallery::CreateTheme( const OUString& rThemeName )
579{
580 bool bRet = false;
581
582 if( !HasTheme( rThemeName ) && ( GetUserURL().GetProtocol() != INetProtocol::NotValid ) )
583 {
585 aURL.Append( rThemeName );
586 GalleryThemeEntry* pNewEntry = new GalleryThemeEntry(
587 true, aURL, rThemeName,
588 false, true, 0, false );
589
590 aThemeList.emplace_back( pNewEntry );
591 delete pNewEntry->createGalleryTheme( this );
593 bRet = true;
594 }
595
596 return bRet;
597}
598
599void Gallery::RenameTheme( const OUString& rOldName, const OUString& rNewName )
600{
601 GalleryThemeEntry* pThemeEntry = ImplGetThemeEntry( rOldName );
602
603 // check if the new theme name is already present
604 if( !pThemeEntry || HasTheme( rNewName ) || pThemeEntry->IsReadOnly() )
605 return;
606
607 SfxListener aListener;
608 GalleryTheme* pThm = AcquireTheme( rOldName, aListener );
609
610 if( pThm )
611 {
612 pThemeEntry->SetName( rNewName );
613 if (pThm->pThm->IsModified())
614 if (!pThm->mpGalleryStorageEngine->implWrite(*pThm, pThm->pThm))
615 pThm->ImplSetModified(false);
616
618 ReleaseTheme( pThm, aListener );
619 }
620}
621
622bool Gallery::RemoveTheme( const OUString& rThemeName )
623{
624 GalleryThemeEntry* pThemeEntry = ImplGetThemeEntry( rThemeName );
625 bool bRet = false;
626
627 if( pThemeEntry && !pThemeEntry->IsReadOnly() )
628 {
630
631 SfxListener aListener;
632 GalleryTheme* pThm = AcquireTheme( rThemeName, aListener );
633
634 if( pThm )
635 {
636 ReleaseTheme(pThm, aListener);
637 pThemeEntry->removeTheme();
638 }
639
640 auto it = std::find_if(aThemeList.begin(), aThemeList.end(),
641 [&pThemeEntry](const std::unique_ptr<GalleryThemeEntry>& rpEntry) { return pThemeEntry == rpEntry.get(); });
642 if (it != aThemeList.end())
643 aThemeList.erase( it );
644
646
647 bRet = true;
648 }
649
650 return bRet;
651}
652
653std::unique_ptr<GalleryTheme> GalleryThemeEntry::getCachedTheme(Gallery* pGallery)
654{
655 std::unique_ptr<GalleryTheme> pNewTheme;
656 pNewTheme.reset(createGalleryTheme(pGallery));
657 mpGalleryStorageEngineEntry->getCachedTheme(pNewTheme);
658 return pNewTheme;
659}
660
662{
663 GalleryTheme* pTheme = nullptr;
664
665 if( pThemeEntry )
666 {
667 auto it = std::find_if(aThemeCache.begin(), aThemeCache.end(),
668 [&pThemeEntry](const GalleryThemeCacheEntry* pEntry) { return pThemeEntry == pEntry->GetThemeEntry(); });
669 if (it != aThemeCache.end())
670 pTheme = (*it)->GetTheme();
671
672 if( !pTheme )
673 {
674 std::unique_ptr<GalleryTheme> pNewTheme = pThemeEntry->getCachedTheme(this);
675 if (pNewTheme)
676 {
677 aThemeCache.push_back( new GalleryThemeCacheEntry( pThemeEntry, std::move(pNewTheme) ));
678 pTheme = aThemeCache.back()->GetTheme();
679 }
680 }
681 }
682
683 return pTheme;
684}
685
687{
688 auto it = std::find_if(aThemeCache.begin(), aThemeCache.end(),
689 [&pTheme](const GalleryThemeCacheEntry* pEntry) { return pTheme == pEntry->GetTheme(); });
690 if (it != aThemeCache.end())
691 {
692 delete *it;
693 aThemeCache.erase(it);
694 }
695}
696
697GalleryTheme* Gallery::AcquireTheme( std::u16string_view rThemeName, SfxListener& rListener )
698{
699 GalleryTheme* pTheme = nullptr;
700 GalleryThemeEntry* pThemeEntry = ImplGetThemeEntry( rThemeName );
701
702 if( pThemeEntry )
703 {
704 pTheme = ImplGetCachedTheme( pThemeEntry );
705 if (pTheme)
706 rListener.StartListening(*pTheme, DuplicateHandling::Prevent);
707 }
708 return pTheme;
709}
710
712{
713 if( pTheme )
714 {
715 rListener.EndListening( *pTheme );
716
717 if( !pTheme->HasListeners() )
718 ImplDeleteCachedTheme( pTheme );
719 }
720}
721
723{
724 return nId > 0 && nId != GALLERY_THEME_MYTHEME;
725}
726
728{
729 return mpGalleryStorageEngineEntry->getGalleryStorageLocations();
730}
731
732/* 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:219
const GalleryThemeEntry * GetThemeEntry() const
Definition: gallery1.cxx:227
GalleryTheme * GetTheme() const
Definition: gallery1.cxx:228
GalleryThemeCacheEntry(const GalleryThemeEntry *pThemeEntry, std::unique_ptr< GalleryTheme > pTheme)
Definition: gallery1.cxx:224
std::unique_ptr< GalleryTheme > mpTheme
Definition: gallery1.cxx:220
const OUString & GetThemeName() const
Definition: gallery1.hxx:64
sal_uInt32 nId
Definition: gallery1.hxx:45
bool IsReadOnly() const
Definition: gallery1.hxx:66
std::unique_ptr< GalleryFileStorageEntry > mpGalleryStorageEngineEntry
Definition: gallery1.hxx:43
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:174
GalleryStorageLocations & getGalleryStorageLocations() const
Definition: gallery1.cxx:727
sal_uInt32 GetId() const
Definition: gallery1.hxx:77
void setStorageLocations(INetURLObject &rURL)
Definition: gallery1.cxx:169
bool IsDefault() const
Definition: gallery1.cxx:722
OUString aName
Definition: gallery1.hxx:44
bool bThemeNameFromResource
Definition: gallery1.hxx:48
void SetModified(bool bSet)
Definition: gallery1.hxx:72
std::unique_ptr< GalleryTheme > getCachedTheme(Gallery *pGallery)
Definition: gallery1.cxx:653
void SetId(sal_uInt32 nNewId, bool bResetThemeName)
Definition: gallery1.cxx:203
bool IsModified() const
Definition: gallery1.hxx:71
void SetName(const OUString &rNewName)
Definition: gallery1.cxx:193
std::unique_ptr< GalleryFileStorage > createGalleryStorageEngine(GalleryObjectCollection &mrGalleryObjectCollection)
Definition: gallery1.cxx:179
SAL_DLLPRIVATE void ImplSetModified(bool bModified)
Definition: galtheme.cxx:767
const OUString & GetName() const
Definition: galtheme.cxx:777
static void InsertAllThemes(weld::ComboBox &rListBox)
Definition: gallery1.cxx:184
GalleryThemeEntry * pThm
Definition: galtheme.hxx:63
std::unique_ptr< GalleryFileStorage > mpGalleryStorageEngine
Definition: galtheme.hxx:60
SAL_DLLPRIVATE OUString GetThemeName(sal_uInt32 nThemeId) const
Definition: gallery1.cxx:494
static Gallery * GetGalleryInstance()
Definition: gallery1.cxx:242
SAL_DLLPRIVATE void ImplLoadSubDirs(const INetURLObject &rBaseURL, bool &rbIsReadOnly)
Definition: gallery1.cxx:291
void ReleaseTheme(GalleryTheme *pTheme, SfxListener &rListener)
Definition: gallery1.cxx:711
bool bMultiPath
Definition: gallery1.hxx:103
bool CreateTheme(const OUString &rThemeName)
Definition: gallery1.cxx:578
SAL_DLLPRIVATE const INetURLObject & GetUserURL() const
Definition: gallery1.hxx:140
bool HasTheme(std::u16string_view rThemeName)
Definition: gallery1.cxx:573
void RenameTheme(const OUString &rOldName, const OUString &rNewName)
Definition: gallery1.cxx:599
virtual ~Gallery() override
Definition: gallery1.cxx:238
Gallery(Gallery const &)=delete
INetURLObject aUserURL
Definition: gallery1.hxx:102
bool RemoveTheme(const OUString &rThemeName)
Definition: gallery1.cxx:622
SAL_DLLPRIVATE void ImplLoad(std::u16string_view rMultiPath)
Definition: gallery1.cxx:252
GalleryThemeEntry * ImplGetThemeEntry(std::u16string_view rThemeName)
Definition: gallery1.cxx:482
SAL_DLLPRIVATE GalleryTheme * ImplGetCachedTheme(GalleryThemeEntry *pThemeEntry)
Definition: gallery1.cxx:661
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:697
SAL_DLLPRIVATE void ImplDeleteCachedTheme(GalleryTheme const *pTheme)
Definition: gallery1.cxx:686
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