include/svx/gallery1.hxx | 15 ++++++--------- svx/source/gallery2/gallery1.cxx | 28 +++++++++------------------- svx/source/gallery2/galtheme.cxx | 4 ---- 3 files changed, 15 insertions(+), 32 deletions(-)
New commits: commit 345d033f08ff6309c1bd90ebe81f4130e54c9386 Author: Michael Meeks <michael.me...@suse.com> Date: Fri May 10 21:03:13 2013 +0100 gallery: fix hideous theme numbering / naming situation. Change-Id: Ibe288e5b2e782da4dd5804a7e018d8ae85c156cc diff --git a/include/svx/gallery1.hxx b/include/svx/gallery1.hxx index e116c14..2be6b78 100644 --- a/include/svx/gallery1.hxx +++ b/include/svx/gallery1.hxx @@ -38,11 +38,10 @@ class GalleryThemeEntry { private: - OUString aName; + OUString aName; INetURLObject aThmURL; INetURLObject aSdgURL; INetURLObject aSdvURL; - sal_uInt32 nFileNumber; sal_uInt32 nId; sal_Bool bReadOnly; sal_Bool bModified; @@ -54,12 +53,11 @@ private: public: GalleryThemeEntry( const INetURLObject& rBaseURL, const String& rName, - sal_uInt32 nFileNumber, sal_Bool bReadOnly, - sal_Bool bNewFile, sal_uInt32 nId, sal_Bool bThemeNameFromResource ); + sal_Bool bReadOnly, sal_Bool bNewFile, + sal_uInt32 nId, sal_Bool bThemeNameFromResource ); ~GalleryThemeEntry() {}; - const OUString& GetThemeName() const { return aName; } - sal_uInt32 GetFileNumber() const { return nFileNumber; } + const OUString& GetThemeName() const { return aName; } const INetURLObject& GetThmURL() const { return aThmURL; } const INetURLObject& GetSdgURL() const { return aSdgURL; } @@ -124,8 +122,7 @@ private: INetURLObject aRelURL; INetURLObject aUserURL; rtl_TextEncoding nReadTextEncoding; - sal_uIntPtr nLastFileNumber; - sal_Bool bMultiPath; + sal_Bool bMultiPath; void ImplLoad( const OUString& rMultiPath ); void ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbIsReadOnly ); @@ -151,7 +148,7 @@ public: SVX_DLLPUBLIC sal_Bool HasTheme( const String& rThemeName ); OUString GetThemeName( sal_uIntPtr nThemeId ) const; - SVX_DLLPUBLIC sal_Bool CreateTheme( const String& rThemeName, sal_uInt32 nNumFrom = 0 ); + SVX_DLLPUBLIC sal_Bool CreateTheme( const String& rThemeName ); sal_Bool RenameTheme( const String& rOldName, const String& rNewName ); SVX_DLLPUBLIC sal_Bool RemoveTheme( const String& rThemeName ); diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index ffeb3cf..9d005a1 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 79152db..c140aeb 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 ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits