diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-07-16 13:57:43 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-07-16 14:16:47 +0100 |
commit | 6d6198393e0677710191248d6f7c9ec15d0f0e0f (patch) | |
tree | 4b1c10c38a6613323799857fb432a881be936f3a /svx | |
parent | 995b97632e3e6f0a789f0ee59fc3bcc6f24bf096 (diff) |
Resolves: fdo#42454 'imported' gallery format doesn't appear to exist
AFAICS an "imported" gallery can only be written if you already have an
imported gallery in the first place, i.e. its something coming from an earlier
version. All the way back to 2000, so I suspect its an earlier pre-OOo feature,
which can't arise in practice with no migration from staroffice configs to
OpenOffice.org or LibreOffice.
Change-Id: I9f248baadb20633da129d3bcacce3d7f92ef7510
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/gallery.hrc | 1 | ||||
-rw-r--r-- | svx/inc/svx/gallery1.hxx | 9 | ||||
-rw-r--r-- | svx/inc/svx/galtheme.hxx | 4 | ||||
-rw-r--r-- | svx/source/gallery2/galbrws1.cxx | 16 | ||||
-rw-r--r-- | svx/source/gallery2/galbrws2.cxx | 13 | ||||
-rw-r--r-- | svx/source/gallery2/galctrl.cxx | 2 | ||||
-rw-r--r-- | svx/source/gallery2/gallery.src | 5 | ||||
-rw-r--r-- | svx/source/gallery2/gallery1.cxx | 160 | ||||
-rw-r--r-- | svx/source/gallery2/galtheme.cxx | 38 |
9 files changed, 37 insertions, 211 deletions
diff --git a/svx/inc/gallery.hrc b/svx/inc/gallery.hrc index d4d85ddb32ee..3a477e2c5c6a 100644 --- a/svx/inc/gallery.hrc +++ b/svx/inc/gallery.hrc @@ -64,7 +64,6 @@ // Images #define RID_SVXBMP_GALLERY (RID_SVX_GALLERY_START + 46) #define RID_SVXBMP_THEME_NORMAL (RID_SVX_GALLERY_START + 48) -#define RID_SVXBMP_THEME_IMPORTED (RID_SVX_GALLERY_START + 50) #define RID_SVXBMP_THEME_READONLY (RID_SVX_GALLERY_START + 52) #define RID_SVXBMP_THEME_DEFAULT (RID_SVX_GALLERY_START + 54) #define RID_SVXIMG_GALLERY_VIEW_ICON (RID_SVX_GALLERY_START + 56) diff --git a/svx/inc/svx/gallery1.hxx b/svx/inc/svx/gallery1.hxx index aad41fa28341..081fffd4bbb5 100644 --- a/svx/inc/svx/gallery1.hxx +++ b/svx/inc/svx/gallery1.hxx @@ -54,7 +54,6 @@ private: sal_uInt32 nFileNumber; sal_uInt32 nId; sal_Bool bReadOnly; - sal_Bool bImported; sal_Bool bModified; sal_Bool bThemeNameFromResource; @@ -64,7 +63,7 @@ private: public: GalleryThemeEntry( const INetURLObject& rBaseURL, const String& rName, - sal_uInt32 nFileNumber, sal_Bool bReadOnly, sal_Bool bImported, + sal_uInt32 nFileNumber, sal_Bool bReadOnly, sal_Bool bNewFile, sal_uInt32 nId, sal_Bool bThemeNameFromResource ); ~GalleryThemeEntry() {}; @@ -75,14 +74,13 @@ public: const INetURLObject& GetSdgURL() const { return aSdgURL; } const INetURLObject& GetSdvURL() const { return aSdvURL; } - sal_Bool IsImported() const { return bImported; } sal_Bool IsReadOnly() const { return bReadOnly; } sal_Bool IsDefault() const; sal_Bool IsHidden() const { return aName.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("private://gallery/hidden/")); } sal_Bool IsModified() const { return bModified; } - void SetModified( sal_Bool bSet ) { bModified = ( bSet && !IsImported() && !IsReadOnly() ); } + void SetModified( sal_Bool bSet ) { bModified = ( bSet && !IsReadOnly() ); } void SetName( const rtl::OUString& rNewName ); sal_Bool IsNameFromResource() const { return bThemeNameFromResource; } @@ -102,7 +100,6 @@ struct GalleryImportThemeEntry rtl::OUString aThemeName; rtl::OUString aUIName; INetURLObject aURL; - rtl::OUString aImportName; }; typedef ::std::vector< GalleryImportThemeEntry* > GalleryImportThemeList; @@ -141,8 +138,6 @@ private: void ImplLoad( const rtl::OUString& rMultiPath ); void ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbIsReadOnly ); - void ImplLoadImports(); - void ImplWriteImportList(); SVX_DLLPUBLIC GalleryThemeEntry* ImplGetThemeEntry( const rtl::OUString& rThemeName ); GalleryThemeEntry* ImplGetThemeEntry( sal_uIntPtr nThemeId ); diff --git a/svx/inc/svx/galtheme.hxx b/svx/inc/svx/galtheme.hxx index 766bb449a78f..972b968aa651 100644 --- a/svx/inc/svx/galtheme.hxx +++ b/svx/inc/svx/galtheme.hxx @@ -99,7 +99,6 @@ class GalleryTheme : public SfxBroadcaster private: GalleryObjectList aObjectList; - rtl::OUString aImportName; String m_aDestDir; SotStorageRef aSvDrawStorageRef; Gallery* pParent; @@ -149,8 +148,6 @@ public: SVX_DLLPUBLIC const rtl::OUString& GetName() const; const rtl::OUString& GetRealName() const; - const rtl::OUString& GetImportName() const { return aImportName; } - void SetImportName(const rtl::OUString& rImportName) { aImportName = rImportName; } const String& GetDestDir() const { return m_aDestDir; } void SetDestDir(const String& rDestDir) { m_aDestDir = rDestDir; } @@ -177,7 +174,6 @@ public: sal_Bool IsThemeNameFromResource() const; - SVX_DLLPUBLIC sal_Bool IsImported() const; SVX_DLLPUBLIC sal_Bool IsReadOnly() const; SVX_DLLPUBLIC sal_Bool IsDefault() const; sal_Bool IsModified() const; diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx index 143dde6d8d9c..df80ccf72bc9 100644 --- a/svx/source/gallery2/galbrws1.cxx +++ b/svx/source/gallery2/galbrws1.cxx @@ -147,8 +147,7 @@ GalleryBrowser1::GalleryBrowser1( GalleryBrowser* pParent, const ResId& rResId, mpThemePropsDlgItemSet( NULL ), aImgNormal ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_NORMAL ) ), aImgDefault ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_DEFAULT ) ), - aImgReadOnly ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_READONLY ) ), - aImgImported ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_IMPORTED ) ) + aImgReadOnly ( GalleryResGetBitmapEx( RID_SVXBMP_THEME_READONLY ) ) { StartListening( *mpGallery ); @@ -195,9 +194,7 @@ sal_uIntPtr GalleryBrowser1::ImplInsertThemeEntry( const GalleryThemeEntry* pEnt { const Image* pImage; - if( pEntry->IsImported() ) - pImage = &aImgImported; - else if( pEntry->IsReadOnly() ) + if( pEntry->IsReadOnly() ) pImage = &aImgReadOnly; else if( pEntry->IsDefault() ) pImage = &aImgDefault; @@ -267,11 +264,6 @@ void GalleryBrowser1::ImplGetExecuteVector(::std::vector< sal_uInt16 >& o_aExec) if( pTheme->IsReadOnly() ) bUpdateAllowed = bRenameAllowed = bRemoveAllowed = sal_False; - else if( pTheme->IsImported() ) - { - bUpdateAllowed = sal_False; - bRenameAllowed = bRemoveAllowed = sal_True; - } else if( pTheme->IsDefault() ) { bUpdateAllowed = bRenameAllowed = sal_True; @@ -289,7 +281,7 @@ void GalleryBrowser1::ImplGetExecuteVector(::std::vector< sal_uInt16 >& o_aExec) if( bRemoveAllowed ) o_aExec.push_back( MN_DELETE ); - if( bIdDialog && !pTheme->IsReadOnly() && !pTheme->IsImported() ) + if( bIdDialog && !pTheme->IsReadOnly() ) o_aExec.push_back( MN_ASSIGN_ID ); o_aExec.push_back( MN_PROPERTIES ); @@ -465,7 +457,7 @@ void GalleryBrowser1::ImplExecute( sal_uInt16 nId ) { GalleryTheme* pTheme = mpGallery->AcquireTheme( GetSelectedTheme(), *this ); - if( pTheme && !pTheme->IsReadOnly() && !pTheme->IsImported() ) + if (pTheme && !pTheme->IsReadOnly()) { SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index 6a673f5bc777..287a1885dcef 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -460,7 +460,7 @@ sal_Int8 GalleryBrowser2::AcceptDrop( DropTargetHelper& rTarget, const AcceptDro { sal_Int8 nRet = DND_ACTION_NONE; - if( mpCurTheme && !mpCurTheme->IsReadOnly() && !mpCurTheme ->IsImported() ) + if( mpCurTheme && !mpCurTheme->IsReadOnly() ) { if( !mpCurTheme->IsDragging() ) { @@ -1092,18 +1092,9 @@ void GalleryBrowser2::ImplExecute( sal_uInt16 nId ) String GalleryBrowser2::GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags ) { - INetURLObject aURL; String aRet; - if( rTheme.IsImported() ) - { - aURL = rTheme.GetParent()->GetImportURL( rTheme.GetName() ); - - aURL.removeSegment(); - aURL.Append( rObj.GetURL().GetName() ); - } - else - aURL = rObj.GetURL(); + INetURLObject aURL(rObj.GetURL()); if( nItemTextFlags & GALLERY_ITEM_THEMENAME ) { diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx index 2a00e5cdd2b7..c803c5802c5b 100644 --- a/svx/source/gallery2/galctrl.cxx +++ b/svx/source/gallery2/galctrl.cxx @@ -692,7 +692,7 @@ sal_Int8 GalleryListView::AcceptDrop( const BrowserAcceptDropEvent& ) { sal_Int8 nRet = DND_ACTION_NONE; - if( mpTheme && !mpTheme->IsReadOnly() && !mpTheme ->IsImported() ) + if( mpTheme && !mpTheme->IsReadOnly() ) nRet = DND_ACTION_COPY; return nRet; diff --git a/svx/source/gallery2/gallery.src b/svx/source/gallery2/gallery.src index b801b1d3fa50..6bb583a053d2 100644 --- a/svx/source/gallery2/gallery.src +++ b/svx/source/gallery2/gallery.src @@ -190,11 +190,6 @@ Bitmap RID_SVXBMP_THEME_NORMAL File = "galnors.bmp" ; }; -Bitmap RID_SVXBMP_THEME_IMPORTED -{ - File = "galimps.bmp" ; -}; - Bitmap RID_SVXBMP_THEME_READONLY { File = "galrdos.bmp" ; diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx index b00d02ab6f97..f50b3c6ff2da 100644 --- a/svx/source/gallery2/gallery1.cxx +++ b/svx/source/gallery2/gallery1.cxx @@ -53,12 +53,11 @@ using namespace ::com::sun::star; // --------------------- GalleryThemeEntry::GalleryThemeEntry( const INetURLObject& rBaseURL, const String& rName, - sal_uInt32 _nFileNumber, sal_Bool _bReadOnly, sal_Bool _bImported, + sal_uInt32 _nFileNumber, sal_Bool _bReadOnly, sal_Bool _bNewFile, sal_uInt32 _nId, sal_Bool _bThemeNameFromResource ) : nFileNumber ( _nFileNumber ), nId ( _nId ), - bReadOnly ( _bReadOnly || _bImported ), - bImported ( _bImported ), + bReadOnly ( _bReadOnly ), bThemeNameFromResource ( _bThemeNameFromResource ) { INetURLObject aURL( rBaseURL ); @@ -136,7 +135,7 @@ SvStream& operator<<( SvStream& rOut, const GalleryImportThemeEntry& rEntry ) write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, rEntry.aThemeName, RTL_TEXTENCODING_UTF8); write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, rEntry.aUIName, RTL_TEXTENCODING_UTF8); write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, (rEntry.aURL.GetMainURL( INetURLObject::NO_DECODE )), RTL_TEXTENCODING_UTF8); - write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, rEntry.aImportName, RTL_TEXTENCODING_UTF8); + write_lenPrefixed_uInt8s_FromOUString<sal_uInt16>(rOut, rtl::OUString(), RTL_TEXTENCODING_UTF8); //aImportName write_lenPrefixed_uInt8s_FromOString<sal_uInt16>(rOut, rtl::OString()); return rOut; @@ -149,7 +148,7 @@ SvStream& operator>>( SvStream& rIn, GalleryImportThemeEntry& rEntry ) rEntry.aThemeName = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rIn, RTL_TEXTENCODING_UTF8); rEntry.aUIName = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rIn, RTL_TEXTENCODING_UTF8); rEntry.aURL = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rIn, RTL_TEXTENCODING_UTF8); - rEntry.aImportName = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rIn, RTL_TEXTENCODING_UTF8); + read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(rIn, RTL_TEXTENCODING_UTF8); //aImportName read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rIn); return rIn; } @@ -254,8 +253,6 @@ void Gallery::ImplLoad( const rtl::OUString& rMultiPath ) DBG_ASSERT( aUserURL.GetProtocol() != INET_PROT_NOT_VALID, "no writable Gallery user directory available" ); DBG_ASSERT( aRelURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - ImplLoadImports(); } // ------------------------------------------------------------------------ @@ -454,85 +451,6 @@ void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, sal_Bool& rbDirIsR // ------------------------------------------------------------------------ -void Gallery::ImplLoadImports() -{ - INetURLObject aURL( GetUserURL() ); - - aURL.Append( String( RTL_CONSTASCII_USTRINGPARAM( "gallery.sdi" ) ) ); - - if( FileExists( aURL ) ) - { - SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ ); - - if( pIStm ) - { - GalleryThemeEntry* pThemeEntry; - GalleryImportThemeEntry* pImportEntry; - INetURLObject aFile; - sal_uInt32 nInventor; - sal_uInt32 nCount; - sal_uInt16 nId; - sal_uInt16 i; - sal_uInt16 nTempCharSet; - - for ( size_t j = 0, n = aImportList.size(); j < n; ++j ) - delete aImportList[ j ]; - aImportList.clear(); - - *pIStm >> nInventor; - - if( nInventor == COMPAT_FORMAT( 'S', 'G', 'A', '3' ) ) - { - *pIStm >> nId >> nCount >> nTempCharSet; - - for( i = 0; i < nCount; i++ ) - { - pImportEntry = new GalleryImportThemeEntry; - - *pIStm >> *pImportEntry; - aImportList.push_back( pImportEntry ); - aFile = INetURLObject( pImportEntry->aURL ); - pThemeEntry = new GalleryThemeEntry( aFile, - pImportEntry->aUIName, - String(aFile.GetBase()).Erase( 0, 2 ).Erase( 6 ).ToInt32(), - sal_True, sal_True, sal_False, 0, sal_False ); - - aThemeList.push_back( pThemeEntry ); - } - } - - delete pIStm; - } - } -} - -// ------------------------------------------------------------------------ - -void Gallery::ImplWriteImportList() -{ - INetURLObject aURL( GetUserURL() ); - aURL.Append( ( String( "gallery.sdi", RTL_TEXTENCODING_UTF8 ) ) ); - SvStream* pOStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE | STREAM_TRUNC ); - - if( pOStm ) - { - const sal_uInt32 nInventor = (sal_uInt32) COMPAT_FORMAT( 'S', 'G', 'A', '3' ); - const sal_uInt16 nId = 0x0004; - - *pOStm << nInventor << nId << (sal_uInt32) aImportList.size() << (sal_uInt16) osl_getThreadTextEncoding(); - - for ( size_t i = 0, n = aImportList.size(); i < n; ++i ) - *pOStm << *aImportList[ i ]; - - if( pOStm->GetError() ) - ErrorHandler::HandleError( ERRCODE_IO_GENERAL ); - - delete pOStm; - } -} - -// ------------------------------------------------------------------------ - GalleryThemeEntry* Gallery::ImplGetThemeEntry( const rtl::OUString& rThemeName ) { GalleryThemeEntry* pFound = NULL; @@ -632,7 +550,7 @@ sal_Bool Gallery::CreateTheme( const String& rThemeName, sal_uInt32 nNumFrom ) nLastFileNumber = nNumFrom > nLastFileNumber ? nNumFrom : nLastFileNumber + 1; GalleryThemeEntry* pNewEntry = new GalleryThemeEntry( GetUserURL(), rThemeName, nLastFileNumber, - sal_False, sal_False, sal_True, 0, sal_False ); + sal_False, sal_True, 0, sal_False ); aThemeList.push_back( pNewEntry ); delete( new GalleryTheme( this, pNewEntry ) ); @@ -651,7 +569,7 @@ sal_Bool Gallery::RenameTheme( const String& rOldName, const String& rNewName ) sal_Bool bRet = sal_False; // Ueberpruefen, ob neuer Themenname schon vorhanden ist - if( pThemeEntry && !HasTheme( rNewName ) && ( !pThemeEntry->IsReadOnly() || pThemeEntry->IsImported() ) ) + if( pThemeEntry && !HasTheme( rNewName ) && !pThemeEntry->IsReadOnly() ) { SfxListener aListener; GalleryTheme* pThm = AcquireTheme( rOldName, aListener ); @@ -663,19 +581,6 @@ sal_Bool Gallery::RenameTheme( const String& rOldName, const String& rNewName ) pThemeEntry->SetName( rNewName ); pThm->ImplWrite(); - if( pThemeEntry->IsImported() ) - { - pThm->SetImportName( rNewName ); - - GalleryImportThemeEntry* pImportEntry = ImplGetImportThemeEntry( rOldName ); - - if( pImportEntry ) - { - pImportEntry->aUIName = rNewName; - ImplWriteImportList(); - } - } - Broadcast( GalleryHint( GALLERY_HINT_THEME_RENAMED, aOldName, pThm->GetName() ) ); ReleaseTheme( pThm, aListener ); bRet = sal_True; @@ -692,44 +597,24 @@ sal_Bool Gallery::RemoveTheme( const String& rThemeName ) GalleryThemeEntry* pThemeEntry = ImplGetThemeEntry( rThemeName ); sal_Bool bRet = sal_False; - if( pThemeEntry && ( !pThemeEntry->IsReadOnly() || pThemeEntry->IsImported() ) ) + if( pThemeEntry && !pThemeEntry->IsReadOnly() ) { Broadcast( GalleryHint( GALLERY_HINT_CLOSE_THEME, rThemeName ) ); - if( pThemeEntry->IsImported() ) - { - GalleryImportThemeEntry* pImportEntry = ImplGetImportThemeEntry( rThemeName ); + SfxListener aListener; + GalleryTheme* pThm = AcquireTheme( rThemeName, aListener ); - if( pImportEntry ) - { - for ( GalleryImportThemeList::iterator it = aImportList.begin(); it != aImportList.end(); ++it ) - { - if ( *it == pImportEntry ) - { - delete pImportEntry; - aImportList.erase( it ); - break; - } - } - } - } - else + if( pThm ) { - SfxListener aListener; - GalleryTheme* pThm = AcquireTheme( rThemeName, aListener ); - - if( pThm ) - { - INetURLObject aThmURL( pThm->GetThmURL() ); - INetURLObject aSdgURL( pThm->GetSdgURL() ); - INetURLObject aSdvURL( pThm->GetSdvURL() ); + INetURLObject aThmURL( pThm->GetThmURL() ); + INetURLObject aSdgURL( pThm->GetSdgURL() ); + INetURLObject aSdvURL( pThm->GetSdvURL() ); - ReleaseTheme( pThm, aListener ); + ReleaseTheme( pThm, aListener ); - KillFile( aThmURL ); - KillFile( aSdgURL ); - KillFile( aSdvURL ); - } + KillFile( aThmURL ); + KillFile( aSdgURL ); + KillFile( aSdvURL ); } for ( GalleryThemeList::iterator it = aThemeList.begin(); it != aThemeList.end(); ++it ) @@ -784,12 +669,7 @@ GalleryTheme* Gallery::ImplGetCachedTheme( const GalleryThemeEntry* pThemeEntry if( !pTheme ) { - INetURLObject aURL; - - if( !pThemeEntry->IsImported() ) - aURL = pThemeEntry->GetThmURL(); - else - aURL = GetImportURL( pThemeEntry->GetThemeName() ); + INetURLObject aURL = pThemeEntry->GetThmURL(); DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); @@ -803,9 +683,9 @@ GalleryTheme* Gallery::ImplGetCachedTheme( const GalleryThemeEntry* pThemeEntry *pIStm >> *pTheme; if( pIStm->GetError() ) + { delete pTheme, pTheme = NULL; - else if( pThemeEntry->IsImported() ) - pTheme->SetImportName( pThemeEntry->GetThemeName() ); + } delete pIStm; } diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 27caa5f5ef1d..e82289d5f970 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -79,9 +79,6 @@ GalleryTheme::GalleryTheme( Gallery* pGallery, GalleryThemeEntry* pThemeEntry ) bDragging ( sal_False ) { ImplCreateSvDrawStorage(); - - if( pThm->IsImported() ) - aImportName = pThm->GetThemeName(); } // ------------------------------------------------------------------------ @@ -104,15 +101,10 @@ GalleryTheme::~GalleryTheme() void GalleryTheme::ImplCreateSvDrawStorage() { - if( !pThm->IsImported() ) - { - aSvDrawStorageRef = new SvStorage( sal_False, GetSdvURL().GetMainURL( INetURLObject::NO_DECODE ), pThm->IsReadOnly() ? STREAM_READ : STREAM_STD_READWRITE ); - // #i50423# ReadOnly may not been set though the file can't be written (because of security reasons) - if ( ( aSvDrawStorageRef->GetError() != ERRCODE_NONE ) && !pThm->IsReadOnly() ) - aSvDrawStorageRef = new SvStorage( sal_False, GetSdvURL().GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ ); - } - else - aSvDrawStorageRef.Clear(); + aSvDrawStorageRef = new SvStorage( sal_False, GetSdvURL().GetMainURL( INetURLObject::NO_DECODE ), pThm->IsReadOnly() ? STREAM_READ : STREAM_STD_READWRITE ); + // #i50423# ReadOnly may not been set though the file can't be written (because of security reasons) + if ( ( aSvDrawStorageRef->GetError() != ERRCODE_NONE ) && !pThm->IsReadOnly() ) + aSvDrawStorageRef = new SvStorage( sal_False, GetSdvURL().GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ ); } // ------------------------------------------------------------------------ @@ -256,19 +248,7 @@ INetURLObject GalleryTheme::ImplGetURL( const GalleryObject* pObject ) const INetURLObject aURL; if( pObject ) - { - if( IsImported() ) - { - INetURLObject aPathURL( GetParent()->GetImportURL( GetName() ) ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - aPathURL.Append( pObject->aURL.GetName() ); - aURL = aPathURL; - } - else - aURL = pObject->aURL; - } + aURL = pObject->aURL; return aURL; } @@ -536,7 +516,7 @@ bool GalleryTheme::ChangeObjectPos( size_t nOldPos, size_t nNewPos ) void GalleryTheme::Actualize( const Link& rActualizeLink, GalleryProgress* pProgress ) { - if( !IsReadOnly() && !IsImported() ) + if( !IsReadOnly() ) { Graphic aGraphic; String aFormat; @@ -778,7 +758,7 @@ GalleryThemeEntry* GalleryTheme::CreateThemeEntry( const INetURLObject& rURL, sa aPathURL.removeFinalSlash(); pRet = new GalleryThemeEntry( aPathURL, aThemeName, String(rURL.GetBase()).Copy( 2, 6 ).ToInt32(), - bReadOnly, sal_False, sal_False, nThemeId, + bReadOnly, sal_False, nThemeId, bThemeNameFromResource ); } @@ -1432,7 +1412,6 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm ) String aThemeName; rtl_TextEncoding nTextEncoding; - aImportName = rtl::OUString(); rIStm >> nVersion; rtl::OString aTmpStr = read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rIStm); rIStm >> nCount; @@ -1587,11 +1566,10 @@ const INetURLObject& GalleryTheme::GetSdvURL() const { return pThm->GetSdvURL(); sal_uInt32 GalleryTheme::GetId() const { return pThm->GetId(); } void GalleryTheme::SetId( sal_uInt32 nNewId, sal_Bool bResetThemeName ) { pThm->SetId( nNewId, bResetThemeName ); } sal_Bool GalleryTheme::IsThemeNameFromResource() const { return pThm->IsNameFromResource(); } -sal_Bool GalleryTheme::IsImported() const { return pThm->IsImported(); } sal_Bool GalleryTheme::IsReadOnly() const { return pThm->IsReadOnly(); } sal_Bool GalleryTheme::IsDefault() const { return pThm->IsDefault(); } sal_Bool GalleryTheme::IsModified() const { return pThm->IsModified(); } -const rtl::OUString& GalleryTheme::GetName() const { return IsImported() ? aImportName : pThm->GetThemeName(); } +const rtl::OUString& GalleryTheme::GetName() const { return pThm->GetThemeName(); } void GalleryTheme::InsertAllThemes( ListBox& rListBox ) { |