summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2013-05-10 21:03:13 +0100
committerMichael Meeks <michael.meeks@suse.com>2013-05-15 09:37:39 +0100
commit8a3eab7bb210c8f6a9c4b8fc112e692e416fabbe (patch)
tree6058f8fd1ec43b1815cc34cb945bfd26d2a13087
parent22ca7c45b91d6f32de9f9b48c72d5b9d2374234d (diff)
gallery: fix hideous theme numbering / naming situation.
Change-Id: Ibe288e5b2e782da4dd5804a7e018d8ae85c156cc
-rw-r--r--include/svx/gallery1.hxx15
-rw-r--r--svx/source/gallery2/gallery1.cxx28
-rw-r--r--svx/source/gallery2/galtheme.cxx4
3 files changed, 15 insertions, 32 deletions
diff --git a/include/svx/gallery1.hxx b/include/svx/gallery1.hxx
index e116c14b8cf6..2be6b788a50c 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 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 );
}