diff options
author | Michael Meeks <michael.meeks@suse.com> | 2013-05-10 21:03:13 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-05-15 09:37:39 +0100 |
commit | 8a3eab7bb210c8f6a9c4b8fc112e692e416fabbe (patch) | |
tree | 6058f8fd1ec43b1815cc34cb945bfd26d2a13087 /svx/source/gallery2 | |
parent | 22ca7c45b91d6f32de9f9b48c72d5b9d2374234d (diff) |
gallery: fix hideous theme numbering / naming situation.
Change-Id: Ibe288e5b2e782da4dd5804a7e018d8ae85c156cc
Diffstat (limited to 'svx/source/gallery2')
-rw-r--r-- | svx/source/gallery2/gallery1.cxx | 28 | ||||
-rw-r--r-- | svx/source/gallery2/galtheme.cxx | 4 |
2 files changed, 9 insertions, 23 deletions
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index ffeb3cff1514..9d005a164334 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -46,24 +46,22 @@ using namespace ::com::sun::star; // --------------------- GalleryThemeEntry::GalleryThemeEntry( const INetURLObject& rBaseURL, const String& rName, - sal_uInt32 _nFileNumber, sal_Bool _bReadOnly, - sal_Bool _bNewFile, sal_uInt32 _nId, sal_Bool _bThemeNameFromResource ) : - nFileNumber ( _nFileNumber ), + sal_Bool _bReadOnly, sal_Bool _bNewFile, + sal_uInt32 _nId, sal_Bool _bThemeNameFromResource ) : nId ( _nId ), bReadOnly ( _bReadOnly ), bThemeNameFromResource ( _bThemeNameFromResource ) { INetURLObject aURL( rBaseURL ); DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - String aFileName( String( "sg" ) ); - aURL.Append( ( aFileName += OUString::number( nFileNumber ) ) += String( RTL_CONSTASCII_USTRINGPARAM( ".thm" ) ) ); + aURL.setExtension( "thm" ); aThmURL = ImplGetURLIgnoreCase( aURL ); - aURL.setExtension( String( RTL_CONSTASCII_USTRINGPARAM( "sdg" ) ) ); + aURL.setExtension( "sdg" ); aSdgURL = ImplGetURLIgnoreCase( aURL ); - aURL.setExtension( String( RTL_CONSTASCII_USTRINGPARAM( "sdv" ) ) ); + aURL.setExtension( "sdv" ); aSdvURL = ImplGetURLIgnoreCase( aURL ); SetModified( _bNewFile ); @@ -172,7 +170,6 @@ public: Gallery::Gallery( const OUString& rMultiPath ) : nReadTextEncoding ( osl_getThreadTextEncoding() ) -, nLastFileNumber ( 0 ) , bMultiPath ( sal_False ) { ImplLoad( rMultiPath ); @@ -406,14 +403,7 @@ void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbDirIsR GalleryThemeEntry* pEntry = GalleryTheme::CreateThemeEntry( aThmURL, rbDirIsReadOnly || bReadOnly ); if( pEntry ) - { - const sal_uIntPtr nFileNumber = (sal_uIntPtr) String(aThmURL.GetBase()).Erase( 0, 2 ).Erase( 6 ).ToInt32(); - aThemeList.push_back( pEntry ); - - if( nFileNumber > nLastFileNumber ) - nLastFileNumber = nFileNumber; - } } } catch( const ucb::ContentCreationException& ) @@ -547,15 +537,15 @@ sal_Bool Gallery::HasTheme( const String& rThemeName ) // ------------------------------------------------------------------------ -sal_Bool Gallery::CreateTheme( const String& rThemeName, sal_uInt32 nNumFrom ) +sal_Bool Gallery::CreateTheme( const String& rThemeName ) { sal_Bool bRet = sal_False; if( !HasTheme( rThemeName ) && ( GetUserURL().GetProtocol() != INET_PROT_NOT_VALID ) ) { - nLastFileNumber = nNumFrom > nLastFileNumber ? nNumFrom : nLastFileNumber + 1; - GalleryThemeEntry* pNewEntry = new GalleryThemeEntry( GetUserURL(), rThemeName, - nLastFileNumber, + INetURLObject aURL( GetUserURL() ); + aURL.Append( rThemeName ); + GalleryThemeEntry* pNewEntry = new GalleryThemeEntry( aURL, rThemeName, sal_False, sal_True, 0, sal_False ); aThemeList.push_back( pNewEntry ); diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 79152dbe6506..c140aebc9324 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -751,11 +751,7 @@ GalleryThemeEntry* GalleryTheme::CreateThemeEntry( const INetURLObject& rURL, sa } INetURLObject aPathURL( rURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); pRet = new GalleryThemeEntry( aPathURL, aThemeName, - String(rURL.GetBase()).Copy( 2, 6 ).ToInt32(), bReadOnly, sal_False, nThemeId, bThemeNameFromResource ); } |