summaryrefslogtreecommitdiff
path: root/svx/source/gallery2/galtheme.cxx
diff options
context:
space:
mode:
authorAditya <adityasahu1511@gmail.com>2020-09-01 14:56:51 +0200
committerTomaž Vajngerl <quikee@gmail.com>2020-09-02 09:25:21 +0200
commitc640f745e8023660e89bca3e97308c0d53834b77 (patch)
tree775064a2038ed0696d6b1712e83bccad662fb856 /svx/source/gallery2/galtheme.cxx
parent4824218c896ae2dfec8a5ca21a116dcc8f44ceee (diff)
svx: Refactor GalleryObject member aURL
The member aURL does not belong here and needs to be refactored, the reason is that there can be two type of URLs - XML and binary URL. Change-Id: Ieb4e57a6f144070f95282a7fd02d08bda6d11f3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101084 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx/source/gallery2/galtheme.cxx')
-rw-r--r--svx/source/gallery2/galtheme.cxx21
1 files changed, 12 insertions, 9 deletions
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index c10041ee8471..476ad79f27e6 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -141,7 +141,7 @@ bool GalleryTheme::InsertObject(const SgaObject& rObj, sal_uInt32 nInsertPos)
sal_uInt32 iFoundPos = 0;
for (sal_uInt32 n = maGalleryObjectCollection.size(); iFoundPos < n; ++iFoundPos)
{
- if (maGalleryObjectCollection.get(iFoundPos)->aURL == rObj.GetURL())
+ if (maGalleryObjectCollection.get(iFoundPos)->getURL() == rObj.GetURL())
{
pFoundEntry = maGalleryObjectCollection.get(iFoundPos).get();
break;
@@ -240,7 +240,7 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize
GalleryObject* pEntry = maGalleryObjectCollection.get(i).get();
- const INetURLObject aURL( pEntry->aURL );
+ const INetURLObject aURL( pEntry->getURL());
rActualizeLink.Call( aURL );
@@ -695,6 +695,9 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm )
aFileName = OStringToOUString(aTempFileName, osl_getThreadTextEncoding());
+ pObj->m_pGalleryObjectStorage.reset();
+ pObj->m_pGalleryObjectStorage = std::make_unique<GalleryObjectBinaryStorage>();
+
if( bRel )
{
aFileName = aFileName.replaceAll( "\\", "/" );
@@ -705,9 +708,9 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm )
aPath += aFileName;
- pObj->aURL = INetURLObject( aPath );
+ pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aPath));
- if( !FileExists( pObj->aURL ) )
+ if (!FileExists(pObj->getURL()))
{
aPath = aRelURL2.GetMainURL( INetURLObject::DecodeMechanism::NONE );
@@ -717,7 +720,7 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm )
aPath += aFileName;
// assign this URL, even in the case it is not valid (#94482)
- pObj->aURL = INetURLObject( aPath );
+ pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aPath));
}
}
else
@@ -725,18 +728,18 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm )
if( SgaObjKind::SvDraw == pObj->eObjKind )
{
OUString aDummyURL = "gallery/svdraw/" + aFileName;
- pObj->aURL = INetURLObject( aDummyURL, INetProtocol::PrivSoffice );
+ pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aDummyURL, INetProtocol::PrivSoffice));
}
else
{
OUString aLocalURL;
- pObj->aURL = INetURLObject( aFileName );
+ pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aFileName));
- if( ( pObj->aURL.GetProtocol() == INetProtocol::NotValid ) &&
+ if( ( pObj->getURL().GetProtocol() == INetProtocol::NotValid ) &&
osl::FileBase::getFileURLFromSystemPath( aFileName, aLocalURL ) == osl::FileBase::E_None )
{
- pObj->aURL = INetURLObject( aLocalURL );
+ pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aLocalURL));
}
}
}