diff options
-rw-r--r-- | include/svx/galleryobjectcollection.hxx | 6 | ||||
-rw-r--r-- | include/svx/galleryobjectstorage.hxx | 32 | ||||
-rw-r--r-- | svx/Library_svxcore.mk | 3 | ||||
-rw-r--r-- | svx/inc/galleryobjectbinarystorage.hxx | 35 | ||||
-rw-r--r-- | svx/inc/galleryobjectxmlstorage.hxx | 35 | ||||
-rw-r--r-- | svx/source/gallery2/gallerybinaryengine.cxx | 32 | ||||
-rw-r--r-- | svx/source/gallery2/galleryobjectbinarystorage.cxx | 25 | ||||
-rw-r--r-- | svx/source/gallery2/galleryobjectcollection.cxx | 4 | ||||
-rw-r--r-- | svx/source/gallery2/galleryobjectstorage.cxx | 24 | ||||
-rw-r--r-- | svx/source/gallery2/galleryobjectxmlstorage.cxx | 25 | ||||
-rw-r--r-- | svx/source/gallery2/galmisc.cxx | 2 | ||||
-rw-r--r-- | svx/source/gallery2/galtheme.cxx | 22 | ||||
-rw-r--r-- | svx/source/unogallery/unogalitem.cxx | 2 |
13 files changed, 32 insertions, 215 deletions
diff --git a/include/svx/galleryobjectcollection.hxx b/include/svx/galleryobjectcollection.hxx index 07a952b59f54..ec27761cc07e 100644 --- a/include/svx/galleryobjectcollection.hxx +++ b/include/svx/galleryobjectcollection.hxx @@ -21,16 +21,16 @@ #include <svx/svxdllapi.h> #include <svx/galmisc.hxx> -#include <svx/galleryobjectstorage.hxx> #include <vcl/bitmapex.hxx> #include <tools/urlobj.hxx> #include <memory> +#include <optional> #include <vector> struct GalleryObject { - std::unique_ptr<GalleryObjectStorage> m_pGalleryObjectStorage; + std::optional<INetURLObject> m_oStorageUrl; sal_uInt32 nOffset; SgaObjKind eObjKind; bool mbDelete; @@ -40,8 +40,6 @@ struct GalleryObject Size maPreparedSize; OUString maTitle; OUString maPath; - - const INetURLObject& getURL() const { return m_pGalleryObjectStorage->getURL(); } }; class SVXCORE_DLLPUBLIC GalleryObjectCollection diff --git a/include/svx/galleryobjectstorage.hxx b/include/svx/galleryobjectstorage.hxx deleted file mode 100644 index cdca68b14a8f..000000000000 --- a/include/svx/galleryobjectstorage.hxx +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <tools/urlobj.hxx> - -class GalleryObjectStorage -{ -public: - virtual ~GalleryObjectStorage() = 0; - virtual const INetURLObject& getURL() const = 0; - virtual void setURL(INetURLObject aURL) = 0; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index 5a7e48a47018..270a2056ef60 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -211,9 +211,6 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/gallery2/galleryobjectcollection \ svx/source/gallery2/galleryfilestorage \ svx/source/gallery2/galleryfilestorageentry \ - svx/source/gallery2/galleryobjectstorage \ - svx/source/gallery2/galleryobjectbinarystorage \ - svx/source/gallery2/galleryobjectxmlstorage \ svx/source/items/chrtitem \ svx/source/items/clipfmtitem \ svx/source/items/customshapeitem \ diff --git a/svx/inc/galleryobjectbinarystorage.hxx b/svx/inc/galleryobjectbinarystorage.hxx deleted file mode 100644 index 611ff637bead..000000000000 --- a/svx/inc/galleryobjectbinarystorage.hxx +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <tools/urlobj.hxx> -#include <svx/galleryobjectstorage.hxx> - -class GalleryObjectBinaryStorage final : public GalleryObjectStorage -{ -private: - INetURLObject m_aURL; - -public: - void setURL(INetURLObject aURL); - const INetURLObject& getURL() const { return m_aURL; } -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/inc/galleryobjectxmlstorage.hxx b/svx/inc/galleryobjectxmlstorage.hxx deleted file mode 100644 index f72d7067a38f..000000000000 --- a/svx/inc/galleryobjectxmlstorage.hxx +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <tools/urlobj.hxx> -#include <svx/galleryobjectstorage.hxx> - -class GalleryObjectXMLStorage final : public GalleryObjectStorage -{ -private: - INetURLObject m_aURL; - -public: - void setURL(INetURLObject aURL); - const INetURLObject& getURL() const { return m_aURL; } -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/gallery2/gallerybinaryengine.cxx b/svx/source/gallery2/gallerybinaryengine.cxx index 9b4356c5ed83..46b618d90b61 100644 --- a/svx/source/gallery2/gallerybinaryengine.cxx +++ b/svx/source/gallery2/gallerybinaryengine.cxx @@ -23,7 +23,6 @@ #include <svx/gallerybinaryengine.hxx> #include <svx/galleryobjectcollection.hxx> #include <svx/gallery1.hxx> -#include <galleryobjectbinarystorage.hxx> #include <osl/thread.hxx> #include "codec.hxx" #include "gallerydrawmodel.hxx" @@ -164,7 +163,7 @@ void GalleryBinaryEngine::removeObject(const std::unique_ptr<GalleryObject>& pEn if (SgaObjKind::SvDraw == pEntry->eObjKind) GetSvDrawStorage()->Remove( - pEntry->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE)); + pEntry->m_oStorageUrl->GetMainURL(INetURLObject::DecodeMechanism::NONE)); } std::unique_ptr<SgaObject> GalleryBinaryEngine::implReadSgaObject(GalleryObject const* pEntry) @@ -213,7 +212,7 @@ std::unique_ptr<SgaObject> GalleryBinaryEngine::implReadSgaObject(GalleryObject if (pSgaObj) { ReadSgaObject(*pIStm, *pSgaObj); - pSgaObj->ImplUpdateURL(pEntry->getURL()); + pSgaObj->ImplUpdateURL(*pEntry->m_oStorageUrl); } } } @@ -253,8 +252,7 @@ bool GalleryBinaryEngine::implWriteSgaObject(const SgaObject& rObj, sal_uInt32 n else pEntry = pExistentEntry; - pEntry->m_pGalleryObjectStorage = std::make_unique<GalleryObjectBinaryStorage>(); - pEntry->m_pGalleryObjectStorage->setURL(rObj.GetURL()); + pEntry->m_oStorageUrl = rObj.GetURL(); pEntry->nOffset = nOffset; pEntry->eObjKind = rObj.GetObjKind(); @@ -454,7 +452,7 @@ INetURLObject GalleryBinaryEngine::implCreateUniqueURL(SgaObjKind eObjKind, for (auto const& pObject : mrGalleryObjectCollection.getObjectList()) { - if (pObject->getURL() == aNewURL) + if (*pObject->m_oStorageUrl == aNewURL) { bExists = true; break; @@ -534,7 +532,7 @@ SgaObjectSvDraw GalleryBinaryEngine::updateSvDrawObject(const GalleryObject* pEn { if (GetSvDrawStorage().is()) { - const OUString aStmName(GetSvDrawStreamNameFromURL(pEntry->getURL())); + const OUString aStmName(GetSvDrawStreamNameFromURL(*pEntry->m_oStorageUrl)); tools::SvRef<SotStorageStream> pIStm = GetSvDrawStorage()->OpenSotStream(aStmName, StreamMode::READ); @@ -542,7 +540,7 @@ SgaObjectSvDraw GalleryBinaryEngine::updateSvDrawObject(const GalleryObject* pEn { pIStm->SetBufferSize(16384); - SgaObjectSvDraw aNewObj(*pIStm, pEntry->getURL()); + SgaObjectSvDraw aNewObj(*pIStm, *pEntry->m_oStorageUrl); pIStm->SetBufferSize(0); @@ -707,29 +705,30 @@ SvStream& GalleryBinaryEngine::writeGalleryTheme(SvStream& rOStm, const GalleryT if (SgaObjKind::SvDraw == pObj->eObjKind) { - aPath = GetSvDrawStreamNameFromURL(pObj->getURL()); + aPath = GetSvDrawStreamNameFromURL(*pObj->m_oStorageUrl); bRel = false; } else { - aPath = pObj->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE); + aPath = pObj->m_oStorageUrl->GetMainURL(INetURLObject::DecodeMechanism::NONE); aPath = aPath.copy( 0, std::min(rRelURL1.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength(), aPath.getLength())); bRel = aPath == rRelURL1.GetMainURL(INetURLObject::DecodeMechanism::NONE); if (bRel - && (pObj->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength() + && (pObj->m_oStorageUrl->GetMainURL(INetURLObject::DecodeMechanism::NONE) + .getLength() > (rRelURL1.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength() + 1))) { - aPath = pObj->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE); + aPath = pObj->m_oStorageUrl->GetMainURL(INetURLObject::DecodeMechanism::NONE); aPath = aPath.copy( std::min(rRelURL1.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength(), aPath.getLength())); } else { - aPath = pObj->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE); + aPath = pObj->m_oStorageUrl->GetMainURL(INetURLObject::DecodeMechanism::NONE); aPath = aPath.copy( 0, std::min(rRelURL2.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength(), @@ -737,17 +736,18 @@ SvStream& GalleryBinaryEngine::writeGalleryTheme(SvStream& rOStm, const GalleryT bRel = aPath == rRelURL2.GetMainURL(INetURLObject::DecodeMechanism::NONE); if (bRel - && (pObj->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength() + && (pObj->m_oStorageUrl->GetMainURL(INetURLObject::DecodeMechanism::NONE) + .getLength() > (rRelURL2.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength() + 1))) { - aPath = pObj->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE); + aPath = pObj->m_oStorageUrl->GetMainURL(INetURLObject::DecodeMechanism::NONE); aPath = aPath.copy(std::min( rRelURL2.GetMainURL(INetURLObject::DecodeMechanism::NONE).getLength(), aPath.getLength())); } else - aPath = pObj->getURL().GetMainURL(INetURLObject::DecodeMechanism::NONE); + aPath = pObj->m_oStorageUrl->GetMainURL(INetURLObject::DecodeMechanism::NONE); } } diff --git a/svx/source/gallery2/galleryobjectbinarystorage.cxx b/svx/source/gallery2/galleryobjectbinarystorage.cxx deleted file mode 100644 index 14bdc8b0848c..000000000000 --- a/svx/source/gallery2/galleryobjectbinarystorage.cxx +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <galleryobjectbinarystorage.hxx> -#include <tools/urlobj.hxx> - -void GalleryObjectBinaryStorage::setURL(INetURLObject aURL) { m_aURL = aURL; } - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/gallery2/galleryobjectcollection.cxx b/svx/source/gallery2/galleryobjectcollection.cxx index 515f52759028..bfcca1fb2a4b 100644 --- a/svx/source/gallery2/galleryobjectcollection.cxx +++ b/svx/source/gallery2/galleryobjectcollection.cxx @@ -27,7 +27,7 @@ const GalleryObject* GalleryObjectCollection::searchObjectWithURL(const INetURLO { for (auto const& pObject : m_aObjectList) { - if (pObject->getURL() == rURL) + if (*pObject->m_oStorageUrl == rURL) return pObject.get(); } return nullptr; @@ -53,7 +53,7 @@ const INetURLObject g_aInvalidURL; const INetURLObject& GalleryObjectCollection::getURLForPosition(sal_uInt32 nPos) const { if (nPos < size()) - return get(nPos)->getURL(); + return *get(nPos)->m_oStorageUrl; return g_aInvalidURL; } diff --git a/svx/source/gallery2/galleryobjectstorage.cxx b/svx/source/gallery2/galleryobjectstorage.cxx deleted file mode 100644 index 2d324b3d0eb2..000000000000 --- a/svx/source/gallery2/galleryobjectstorage.cxx +++ /dev/null @@ -1,24 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <svx/galleryobjectstorage.hxx> - -GalleryObjectStorage::~GalleryObjectStorage() = default; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/gallery2/galleryobjectxmlstorage.cxx b/svx/source/gallery2/galleryobjectxmlstorage.cxx deleted file mode 100644 index f07b7b869075..000000000000 --- a/svx/source/gallery2/galleryobjectxmlstorage.cxx +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <galleryobjectxmlstorage.hxx> -#include <tools/urlobj.hxx> - -void GalleryObjectXMLStorage::setURL(INetURLObject aURL) { m_aURL = aURL; } - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index 68cb1bc0c45d..ab5713f7a4df 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -555,7 +555,7 @@ INetURLObject ImplGetURL(const GalleryObject* pObject) INetURLObject aURL; if (pObject) - aURL = pObject->getURL(); + aURL = *pObject->m_oStorageUrl; return aURL; } diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 25c072ee65a8..72e0f0dcecb6 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -41,7 +41,6 @@ #include <svx/galtheme.hxx> #include <svx/svdpage.hxx> #include <svx/galleryobjectcollection.hxx> -#include <galleryobjectbinarystorage.hxx> #include <galobj.hxx> #include <svx/gallery1.hxx> #include "gallerydrawmodel.hxx" @@ -124,7 +123,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)->getURL() == rObj.GetURL()) + if (*maGalleryObjectCollection.get(iFoundPos)->m_oStorageUrl == rObj.GetURL()) { pFoundEntry = maGalleryObjectCollection.get(iFoundPos).get(); break; @@ -223,7 +222,7 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize GalleryObject* pEntry = maGalleryObjectCollection.get(i).get(); - const INetURLObject aURL( pEntry->getURL()); + const INetURLObject aURL( *pEntry->m_oStorageUrl ); rActualizeLink.Call( aURL ); @@ -683,8 +682,7 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm ) aFileName = OStringToOUString(aTempFileName, osl_getThreadTextEncoding()); - pObj->m_pGalleryObjectStorage.reset(); - pObj->m_pGalleryObjectStorage = std::make_unique<GalleryObjectBinaryStorage>(); + pObj->m_oStorageUrl.emplace(); if( bRel ) { @@ -696,9 +694,9 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm ) aPath += aFileName; - pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aPath)); + pObj->m_oStorageUrl = INetURLObject(aPath); - if (!FileExists(pObj->getURL())) + if (!FileExists(*pObj->m_oStorageUrl)) { aPath = aRelURL2.GetMainURL( INetURLObject::DecodeMechanism::NONE ); @@ -708,7 +706,7 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm ) aPath += aFileName; // assign this URL, even in the case it is not valid (#94482) - pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aPath)); + pObj->m_oStorageUrl = INetURLObject(aPath); } } else @@ -716,18 +714,18 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm ) if( SgaObjKind::SvDraw == pObj->eObjKind ) { OUString aDummyURL = "gallery/svdraw/" + aFileName; - pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aDummyURL, INetProtocol::PrivSoffice)); + pObj->m_oStorageUrl = INetURLObject(aDummyURL, INetProtocol::PrivSoffice); } else { OUString aLocalURL; - pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aFileName)); + pObj->m_oStorageUrl = INetURLObject(aFileName); - if( ( pObj->getURL().GetProtocol() == INetProtocol::NotValid ) && + if( ( pObj->m_oStorageUrl->GetProtocol() == INetProtocol::NotValid ) && osl::FileBase::getFileURLFromSystemPath( aFileName, aLocalURL ) == osl::FileBase::E_None ) { - pObj->m_pGalleryObjectStorage->setURL(INetURLObject(aLocalURL)); + pObj->m_oStorageUrl = INetURLObject(aLocalURL); } } } diff --git a/svx/source/unogallery/unogalitem.cxx b/svx/source/unogallery/unogalitem.cxx index 5addd32269bb..c6ac0505e197 100644 --- a/svx/source/unogallery/unogalitem.cxx +++ b/svx/source/unogallery/unogalitem.cxx @@ -255,7 +255,7 @@ void GalleryItem::_getPropertyValues( const comphelper::PropertyMapEntry** ppEnt ::GalleryTheme* pGalTheme = ( isValid() ? mpTheme->implGetTheme() : nullptr ); if( pGalTheme ) - *pValue <<= implGetObject()->getURL().GetMainURL( INetURLObject::DecodeMechanism::NONE ); + *pValue <<= implGetObject()->m_oStorageUrl->GetMainURL( INetURLObject::DecodeMechanism::NONE ); } break; |