1f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f6e50924SAndrew Rist * distributed with this work for additional information 6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f6e50924SAndrew Rist * software distributed under the License is distributed on an 15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17f6e50924SAndrew Rist * specific language governing permissions and limitations 18f6e50924SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20f6e50924SAndrew Rist *************************************************************/ 21f6e50924SAndrew Rist 22f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <unotools/pathoptions.hxx> 28cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 29cdf0e10cSrcweir #include "svx/gallery1.hxx" 30cdf0e10cSrcweir #include "svx/galtheme.hxx" 31cdf0e10cSrcweir #include "svx/galbrws.hxx" 32cdf0e10cSrcweir #include "svx/gallery.hxx" 33cdf0e10cSrcweir #include "galobj.hxx" 34cdf0e10cSrcweir 35cdf0e10cSrcweir // ----------- 36cdf0e10cSrcweir // - Statics - 37cdf0e10cSrcweir // ----------- 38cdf0e10cSrcweir 39cdf0e10cSrcweir static SfxListener aLockListener; 40cdf0e10cSrcweir 41cdf0e10cSrcweir // ------------------- 42cdf0e10cSrcweir // - GalleryExplorer - 43cdf0e10cSrcweir // ------------------- 44cdf0e10cSrcweir 45cdf0e10cSrcweir sal_Bool GalleryExplorer::FillThemeList( List& rThemeList ) 46cdf0e10cSrcweir { 47*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 48cdf0e10cSrcweir 49cdf0e10cSrcweir if( pGal ) 50cdf0e10cSrcweir { 51cdf0e10cSrcweir for( sal_uIntPtr i = 0, nCount = pGal->GetThemeCount(); i < nCount; i++ ) 52cdf0e10cSrcweir { 53cdf0e10cSrcweir const GalleryThemeEntry* pEntry = pGal->GetThemeInfo( i ); 54cdf0e10cSrcweir 55cdf0e10cSrcweir if( pEntry && !pEntry->IsReadOnly() && !pEntry->IsHidden() ) 56cdf0e10cSrcweir rThemeList.Insert( new String( pEntry->GetThemeName() ), LIST_APPEND ); 57cdf0e10cSrcweir } 58cdf0e10cSrcweir } 59cdf0e10cSrcweir 60cdf0e10cSrcweir return( rThemeList.Count() > 0 ); 61cdf0e10cSrcweir } 62cdf0e10cSrcweir 63cdf0e10cSrcweir // ------------------------------------------------------------------------ 64cdf0e10cSrcweir 65cdf0e10cSrcweir sal_Bool GalleryExplorer::FillObjList( const String& rThemeName, List& rObjList ) 66cdf0e10cSrcweir { 67*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 68cdf0e10cSrcweir 69cdf0e10cSrcweir if( pGal ) 70cdf0e10cSrcweir { 71cdf0e10cSrcweir SfxListener aListener; 72cdf0e10cSrcweir GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener ); 73cdf0e10cSrcweir 74cdf0e10cSrcweir if( pTheme ) 75cdf0e10cSrcweir { 76cdf0e10cSrcweir for( sal_uIntPtr i = 0, nCount = pTheme->GetObjectCount(); i < nCount; i++ ) 77cdf0e10cSrcweir rObjList.Insert( new String( pTheme->GetObjectURL( i ).GetMainURL( INetURLObject::NO_DECODE ) ), LIST_APPEND ); 78cdf0e10cSrcweir 79cdf0e10cSrcweir pGal->ReleaseTheme( pTheme, aListener ); 80cdf0e10cSrcweir } 81cdf0e10cSrcweir } 82cdf0e10cSrcweir 83cdf0e10cSrcweir return( rObjList.Count() > 0 ); 84cdf0e10cSrcweir } 85cdf0e10cSrcweir 86cdf0e10cSrcweir // ------------------------------------------------------------------------ 87cdf0e10cSrcweir 88cdf0e10cSrcweir sal_Bool GalleryExplorer::FillObjList( sal_uIntPtr nThemeId, List& rObjList ) 89cdf0e10cSrcweir { 90*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 91cdf0e10cSrcweir return( pGal ? FillObjList( pGal->GetThemeName( nThemeId ), rObjList ) : sal_False ); 92cdf0e10cSrcweir } 93cdf0e10cSrcweir 94cdf0e10cSrcweir // ------------------------------------------------------------------------ 95cdf0e10cSrcweir 96cdf0e10cSrcweir sal_Bool GalleryExplorer::FillObjListTitle( const sal_uInt32 nThemeId, std::vector< rtl::OUString >& rList ) 97cdf0e10cSrcweir { 98*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 99cdf0e10cSrcweir if( pGal ) 100cdf0e10cSrcweir { 101cdf0e10cSrcweir SfxListener aListener; 102cdf0e10cSrcweir GalleryTheme* pTheme = pGal->AcquireTheme( pGal->GetThemeName( nThemeId ), aListener ); 103cdf0e10cSrcweir 104cdf0e10cSrcweir if( pTheme ) 105cdf0e10cSrcweir { 106cdf0e10cSrcweir for( sal_uIntPtr i = 0, nCount = pTheme->GetObjectCount(); i < nCount; i++ ) 107cdf0e10cSrcweir { 108cdf0e10cSrcweir SgaObject* pObj = pTheme->AcquireObject( i ); 109cdf0e10cSrcweir if ( pObj ) 110cdf0e10cSrcweir { 111cdf0e10cSrcweir rtl::OUString aTitle( pObj->GetTitle() ); 112cdf0e10cSrcweir rList.push_back( aTitle ); 113cdf0e10cSrcweir pTheme->ReleaseObject( pObj ); 114cdf0e10cSrcweir } 115cdf0e10cSrcweir } 116cdf0e10cSrcweir pGal->ReleaseTheme( pTheme, aListener ); 117cdf0e10cSrcweir } 118cdf0e10cSrcweir } 119cdf0e10cSrcweir return( rList.size() > 0 ); 120cdf0e10cSrcweir } 121cdf0e10cSrcweir 122cdf0e10cSrcweir // ------------------------------------------------------------------------ 123cdf0e10cSrcweir 124cdf0e10cSrcweir sal_Bool GalleryExplorer::InsertURL( const String& rThemeName, const String& rURL ) 125cdf0e10cSrcweir { 126*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 127cdf0e10cSrcweir sal_Bool bRet = sal_False; 128cdf0e10cSrcweir 129cdf0e10cSrcweir if( pGal ) 130cdf0e10cSrcweir { 131cdf0e10cSrcweir SfxListener aListener; 132cdf0e10cSrcweir GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener ); 133cdf0e10cSrcweir 134cdf0e10cSrcweir if( pTheme ) 135cdf0e10cSrcweir { 136cdf0e10cSrcweir INetURLObject aURL( rURL ); 137cdf0e10cSrcweir DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); 138cdf0e10cSrcweir bRet = pTheme->InsertURL( aURL ); 139cdf0e10cSrcweir pGal->ReleaseTheme( pTheme, aListener ); 140cdf0e10cSrcweir } 141cdf0e10cSrcweir } 142cdf0e10cSrcweir 143cdf0e10cSrcweir return bRet; 144cdf0e10cSrcweir } 145cdf0e10cSrcweir 146cdf0e10cSrcweir // ------------------------------------------------------------------------ 147cdf0e10cSrcweir 148*9afceb33SAriel Constenla-Haile sal_Bool GalleryExplorer::InsertURL( sal_uIntPtr nThemeId, const String& rURL ) 149cdf0e10cSrcweir { 150*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 151*9afceb33SAriel Constenla-Haile return( pGal ? InsertURL( pGal->GetThemeName( nThemeId ), rURL ) : sal_False ); 152cdf0e10cSrcweir } 153cdf0e10cSrcweir 154cdf0e10cSrcweir // ------------------------------------------------------------------------ 155cdf0e10cSrcweir 156cdf0e10cSrcweir sal_uIntPtr GalleryExplorer::GetObjCount( const String& rThemeName ) 157cdf0e10cSrcweir { 158*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 159cdf0e10cSrcweir sal_uIntPtr nRet = 0; 160cdf0e10cSrcweir 161cdf0e10cSrcweir if( pGal ) 162cdf0e10cSrcweir { 163cdf0e10cSrcweir SfxListener aListener; 164cdf0e10cSrcweir GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener ); 165cdf0e10cSrcweir 166cdf0e10cSrcweir if( pTheme ) 167cdf0e10cSrcweir { 168cdf0e10cSrcweir nRet = pTheme->GetObjectCount(); 169cdf0e10cSrcweir pGal->ReleaseTheme( pTheme, aListener ); 170cdf0e10cSrcweir } 171cdf0e10cSrcweir } 172cdf0e10cSrcweir 173cdf0e10cSrcweir return nRet; 174cdf0e10cSrcweir } 175cdf0e10cSrcweir 176cdf0e10cSrcweir // ------------------------------------------------------------------------ 177cdf0e10cSrcweir 178cdf0e10cSrcweir sal_uIntPtr GalleryExplorer::GetObjCount( sal_uIntPtr nThemeId ) 179cdf0e10cSrcweir { 180*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 181cdf0e10cSrcweir return( pGal ? GetObjCount( pGal->GetThemeName( nThemeId ) ) : sal_False ); 182cdf0e10cSrcweir } 183cdf0e10cSrcweir 184cdf0e10cSrcweir // ------------------------------------------------------------------------ 185cdf0e10cSrcweir 186cdf0e10cSrcweir sal_Bool GalleryExplorer::GetGraphicObj( const String& rThemeName, sal_uIntPtr nPos, 1876dd94783SArmin Le Grand Graphic* pGraphic, BitmapEx* pThumb, 188cdf0e10cSrcweir sal_Bool bProgress ) 189cdf0e10cSrcweir { 190*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 191cdf0e10cSrcweir sal_Bool bRet = sal_False; 192cdf0e10cSrcweir 193cdf0e10cSrcweir if( pGal ) 194cdf0e10cSrcweir { 195cdf0e10cSrcweir SfxListener aListener; 196cdf0e10cSrcweir GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener ); 197cdf0e10cSrcweir 198cdf0e10cSrcweir if( pTheme ) 199cdf0e10cSrcweir { 200cdf0e10cSrcweir if( pGraphic ) 201cdf0e10cSrcweir bRet = bRet || pTheme->GetGraphic( nPos, *pGraphic, bProgress ); 202cdf0e10cSrcweir 203cdf0e10cSrcweir if( pThumb ) 204cdf0e10cSrcweir bRet = bRet || pTheme->GetThumb( nPos, *pThumb, bProgress ); 205cdf0e10cSrcweir 206cdf0e10cSrcweir pGal->ReleaseTheme( pTheme, aListener ); 207cdf0e10cSrcweir } 208cdf0e10cSrcweir } 209cdf0e10cSrcweir 210cdf0e10cSrcweir return bRet; 211cdf0e10cSrcweir } 212cdf0e10cSrcweir 213cdf0e10cSrcweir // ------------------------------------------------------------------------ 214cdf0e10cSrcweir 215cdf0e10cSrcweir sal_Bool GalleryExplorer::GetGraphicObj( sal_uIntPtr nThemeId, sal_uIntPtr nPos, 2166dd94783SArmin Le Grand Graphic* pGraphic, BitmapEx* pThumb, 217cdf0e10cSrcweir sal_Bool bProgress ) 218cdf0e10cSrcweir { 219*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 220cdf0e10cSrcweir return( pGal ? GetGraphicObj( pGal->GetThemeName( nThemeId ), nPos, pGraphic, pThumb, bProgress ) : sal_False ); 221cdf0e10cSrcweir } 222cdf0e10cSrcweir 223cdf0e10cSrcweir // ------------------------------------------------------------------------ 224cdf0e10cSrcweir 225cdf0e10cSrcweir sal_Bool GalleryExplorer::InsertGraphicObj( const String& rThemeName, const Graphic& rGraphic ) 226cdf0e10cSrcweir { 227*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 228cdf0e10cSrcweir sal_Bool bRet = sal_False; 229cdf0e10cSrcweir 230cdf0e10cSrcweir if( pGal ) 231cdf0e10cSrcweir { 232cdf0e10cSrcweir SfxListener aListener; 233cdf0e10cSrcweir GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener ); 234cdf0e10cSrcweir 235cdf0e10cSrcweir if( pTheme ) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir bRet = pTheme->InsertGraphic( rGraphic ); 238cdf0e10cSrcweir pGal->ReleaseTheme( pTheme, aListener ); 239cdf0e10cSrcweir } 240cdf0e10cSrcweir } 241cdf0e10cSrcweir 242cdf0e10cSrcweir return bRet; 243cdf0e10cSrcweir } 244cdf0e10cSrcweir 245cdf0e10cSrcweir // ------------------------------------------------------------------------ 246cdf0e10cSrcweir 247cdf0e10cSrcweir sal_Bool GalleryExplorer::InsertGraphicObj( sal_uIntPtr nThemeId, const Graphic& rGraphic ) 248cdf0e10cSrcweir { 249*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 250cdf0e10cSrcweir return( pGal ? InsertGraphicObj( pGal->GetThemeName( nThemeId ), rGraphic ) : sal_False ); 251cdf0e10cSrcweir } 252cdf0e10cSrcweir 253cdf0e10cSrcweir // ------------------------------------------------------------------------ 254cdf0e10cSrcweir 255cdf0e10cSrcweir sal_uIntPtr GalleryExplorer::GetSdrObjCount( const String& rThemeName ) 256cdf0e10cSrcweir { 257*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 258cdf0e10cSrcweir sal_uIntPtr nRet = 0; 259cdf0e10cSrcweir 260cdf0e10cSrcweir if( pGal ) 261cdf0e10cSrcweir { 262cdf0e10cSrcweir SfxListener aListener; 263cdf0e10cSrcweir GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener ); 264cdf0e10cSrcweir 265cdf0e10cSrcweir if( pTheme ) 266cdf0e10cSrcweir { 267cdf0e10cSrcweir for( sal_uIntPtr i = 0, nCount = pTheme->GetObjectCount(); i < nCount; i++ ) 268cdf0e10cSrcweir if( SGA_OBJ_SVDRAW == pTheme->GetObjectKind( i ) ) 269cdf0e10cSrcweir nRet++; 270cdf0e10cSrcweir 271cdf0e10cSrcweir pGal->ReleaseTheme( pTheme, aListener ); 272cdf0e10cSrcweir } 273cdf0e10cSrcweir } 274cdf0e10cSrcweir 275cdf0e10cSrcweir return nRet; 276cdf0e10cSrcweir } 277cdf0e10cSrcweir 278cdf0e10cSrcweir // ------------------------------------------------------------------------ 279cdf0e10cSrcweir 280cdf0e10cSrcweir sal_uIntPtr GalleryExplorer::GetSdrObjCount( sal_uIntPtr nThemeId ) 281cdf0e10cSrcweir { 282*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 283cdf0e10cSrcweir return( pGal ? GetSdrObjCount( pGal->GetThemeName( nThemeId ) ) : sal_False ); 284cdf0e10cSrcweir } 285cdf0e10cSrcweir 286cdf0e10cSrcweir // ------------------------------------------------------------------------ 287cdf0e10cSrcweir 288cdf0e10cSrcweir sal_Bool GalleryExplorer::GetSdrObj( const String& rThemeName, sal_uIntPtr nSdrModelPos, 2896dd94783SArmin Le Grand SdrModel* pModel, BitmapEx* pThumb ) 290cdf0e10cSrcweir { 291*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 292cdf0e10cSrcweir sal_Bool bRet = sal_False; 293cdf0e10cSrcweir 294cdf0e10cSrcweir if( pGal ) 295cdf0e10cSrcweir { 296cdf0e10cSrcweir SfxListener aListener; 297cdf0e10cSrcweir GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener ); 298cdf0e10cSrcweir 299cdf0e10cSrcweir if( pTheme ) 300cdf0e10cSrcweir { 301cdf0e10cSrcweir for( sal_uIntPtr i = 0, nCount = pTheme->GetObjectCount(), nActPos = 0; ( i < nCount ) && !bRet; i++ ) 302cdf0e10cSrcweir { 303cdf0e10cSrcweir if( SGA_OBJ_SVDRAW == pTheme->GetObjectKind( i ) ) 304cdf0e10cSrcweir { 305cdf0e10cSrcweir if( nActPos++ == nSdrModelPos ) 306cdf0e10cSrcweir { 307cdf0e10cSrcweir if( pModel ) 308cdf0e10cSrcweir bRet = bRet || pTheme->GetModel( i, *pModel, sal_False ); 309cdf0e10cSrcweir 310cdf0e10cSrcweir if( pThumb ) 311cdf0e10cSrcweir bRet = bRet || pTheme->GetThumb( i, *pThumb ); 312cdf0e10cSrcweir } 313cdf0e10cSrcweir } 314cdf0e10cSrcweir } 315cdf0e10cSrcweir 316cdf0e10cSrcweir pGal->ReleaseTheme( pTheme, aListener ); 317cdf0e10cSrcweir } 318cdf0e10cSrcweir } 319cdf0e10cSrcweir 320cdf0e10cSrcweir return bRet; 321cdf0e10cSrcweir } 322cdf0e10cSrcweir 323cdf0e10cSrcweir // ------------------------------------------------------------------------ 324cdf0e10cSrcweir 325cdf0e10cSrcweir sal_Bool GalleryExplorer::GetSdrObj( sal_uIntPtr nThemeId, sal_uIntPtr nSdrModelPos, 3266dd94783SArmin Le Grand SdrModel* pModel, BitmapEx* pThumb ) 327cdf0e10cSrcweir { 328*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 329cdf0e10cSrcweir return( pGal ? GetSdrObj( pGal->GetThemeName( nThemeId ), nSdrModelPos, pModel, pThumb ) : sal_False ); 330cdf0e10cSrcweir } 331cdf0e10cSrcweir 332cdf0e10cSrcweir // ------------------------------------------------------------------------ 333cdf0e10cSrcweir 334cdf0e10cSrcweir sal_Bool GalleryExplorer::InsertSdrObj( const String& rThemeName, FmFormModel& rModel ) 335cdf0e10cSrcweir { 336*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 337cdf0e10cSrcweir sal_Bool bRet = sal_False; 338cdf0e10cSrcweir 339cdf0e10cSrcweir if( pGal ) 340cdf0e10cSrcweir { 341cdf0e10cSrcweir SfxListener aListener; 342cdf0e10cSrcweir GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener ); 343cdf0e10cSrcweir 344cdf0e10cSrcweir if( pTheme ) 345cdf0e10cSrcweir { 346cdf0e10cSrcweir bRet = pTheme->InsertModel( rModel ); 347cdf0e10cSrcweir pGal->ReleaseTheme( pTheme, aListener ); 348cdf0e10cSrcweir } 349cdf0e10cSrcweir } 350cdf0e10cSrcweir 351cdf0e10cSrcweir return bRet; 352cdf0e10cSrcweir } 353cdf0e10cSrcweir 354cdf0e10cSrcweir // ------------------------------------------------------------------------ 355cdf0e10cSrcweir 356cdf0e10cSrcweir sal_Bool GalleryExplorer::InsertSdrObj( sal_uIntPtr nThemeId, FmFormModel& rModel ) 357cdf0e10cSrcweir { 358*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 359cdf0e10cSrcweir return( pGal ? InsertSdrObj( pGal->GetThemeName( nThemeId ), rModel ) : sal_False ); 360cdf0e10cSrcweir } 361cdf0e10cSrcweir 362cdf0e10cSrcweir // ----------------------------------------------------------------------------- 363cdf0e10cSrcweir 364cdf0e10cSrcweir sal_Bool GalleryExplorer::BeginLocking( const String& rThemeName ) 365cdf0e10cSrcweir { 366*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 367cdf0e10cSrcweir sal_Bool bRet = sal_False; 368cdf0e10cSrcweir 369cdf0e10cSrcweir if( pGal ) 370cdf0e10cSrcweir { 371cdf0e10cSrcweir GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aLockListener ); 372cdf0e10cSrcweir 373cdf0e10cSrcweir if( pTheme ) 374cdf0e10cSrcweir { 375cdf0e10cSrcweir pTheme->LockTheme(); 376cdf0e10cSrcweir bRet = sal_True; 377cdf0e10cSrcweir } 378cdf0e10cSrcweir } 379cdf0e10cSrcweir 380cdf0e10cSrcweir return bRet; 381cdf0e10cSrcweir } 382cdf0e10cSrcweir 383cdf0e10cSrcweir // ----------------------------------------------------------------------------- 384cdf0e10cSrcweir 385cdf0e10cSrcweir sal_Bool GalleryExplorer::BeginLocking( sal_uIntPtr nThemeId ) 386cdf0e10cSrcweir { 387*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 388cdf0e10cSrcweir return( pGal ? BeginLocking( pGal->GetThemeName( nThemeId ) ) : sal_False ); 389cdf0e10cSrcweir } 390cdf0e10cSrcweir 391cdf0e10cSrcweir // ----------------------------------------------------------------------------- 392cdf0e10cSrcweir 393cdf0e10cSrcweir sal_Bool GalleryExplorer::EndLocking( const String& rThemeName ) 394cdf0e10cSrcweir { 395*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 396cdf0e10cSrcweir sal_Bool bRet = sal_False; 397cdf0e10cSrcweir 398cdf0e10cSrcweir if( pGal ) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir SfxListener aListener; 401cdf0e10cSrcweir GalleryTheme* pTheme = pGal->AcquireTheme( rThemeName, aListener ); 402cdf0e10cSrcweir 403cdf0e10cSrcweir if( pTheme ) 404cdf0e10cSrcweir { 405cdf0e10cSrcweir const sal_Bool bReleaseLockedTheme = pTheme->UnlockTheme(); 406cdf0e10cSrcweir 407cdf0e10cSrcweir // release acquired theme 408cdf0e10cSrcweir pGal->ReleaseTheme( pTheme, aListener ); 409cdf0e10cSrcweir 410cdf0e10cSrcweir if( bReleaseLockedTheme ) 411cdf0e10cSrcweir { 412cdf0e10cSrcweir // release locked theme 413cdf0e10cSrcweir pGal->ReleaseTheme( pTheme, aLockListener ); 414cdf0e10cSrcweir bRet = sal_True; 415cdf0e10cSrcweir } 416cdf0e10cSrcweir } 417cdf0e10cSrcweir } 418cdf0e10cSrcweir 419cdf0e10cSrcweir return bRet; 420cdf0e10cSrcweir } 421cdf0e10cSrcweir 422cdf0e10cSrcweir // ----------------------------------------------------------------------------- 423cdf0e10cSrcweir 424cdf0e10cSrcweir sal_Bool GalleryExplorer::EndLocking( sal_uIntPtr nThemeId ) 425cdf0e10cSrcweir { 426*9afceb33SAriel Constenla-Haile Gallery* pGal = ::Gallery::GetGalleryInstance(); 427cdf0e10cSrcweir return( pGal ? EndLocking( pGal->GetThemeName( nThemeId ) ) : sal_False ); 428cdf0e10cSrcweir } 429cdf0e10cSrcweir 430cdf0e10cSrcweir // ----------------------------------------------------------------------------- 4316dd94783SArmin Le Grand // eof 432