summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-05-08 12:18:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-05-09 09:11:48 +0200
commit440c23ee678442fc64aa9fcca13b137738e10a04 (patch)
tree85fb3c1cd71cb57e668ad82e67f4e07b278ba0bd /svx
parent8bafae3656f7a0a6b74bb0985403a96f9a3f61be (diff)
merge GalleryStorageLocations with GalleryBinaryStorageLocations
Change-Id: Icf9a942047f212132d7b543cd1b1a857f8f95223 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151551 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/Library_svxcore.mk3
-rw-r--r--svx/inc/gallerybinaryengine.hxx8
-rw-r--r--svx/inc/gallerybinaryengineentry.hxx7
-rw-r--r--svx/inc/gallerybinarystoragelocations.hxx52
-rw-r--r--svx/inc/gallerystoragelocations.hxx26
-rw-r--r--svx/qa/unit/gallery/test_gallery.cxx13
-rw-r--r--svx/source/gallery2/gallerybinaryengine.cxx2
-rw-r--r--svx/source/gallery2/gallerybinaryengineentry.cxx5
-rw-r--r--svx/source/gallery2/gallerybinarystoragelocations.cxx75
-rw-r--r--svx/source/gallery2/gallerystoragelocations.cxx53
10 files changed, 91 insertions, 153 deletions
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 270a2056ef60..757244f5f6d0 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -206,11 +206,10 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/gallery2/GalleryControl \
svx/source/gallery2/gallerybinaryengine \
svx/source/gallery2/gallerybinaryengineentry \
- svx/source/gallery2/gallerystoragelocations \
- svx/source/gallery2/gallerybinarystoragelocations \
svx/source/gallery2/galleryobjectcollection \
svx/source/gallery2/galleryfilestorage \
svx/source/gallery2/galleryfilestorageentry \
+ svx/source/gallery2/gallerystoragelocations \
svx/source/items/chrtitem \
svx/source/items/clipfmtitem \
svx/source/items/customshapeitem \
diff --git a/svx/inc/gallerybinaryengine.hxx b/svx/inc/gallerybinaryengine.hxx
index 2863e8dc9d69..f1f221e34447 100644
--- a/svx/inc/gallerybinaryengine.hxx
+++ b/svx/inc/gallerybinaryengine.hxx
@@ -22,7 +22,7 @@
#include <svx/galmisc.hxx>
#include <svx/svxdllapi.h>
#include <svx/fmmodel.hxx>
-#include "gallerybinarystoragelocations.hxx"
+#include "gallerystoragelocations.hxx"
#include "galleryfilestorage.hxx"
#include <tools/urlobj.hxx>
#include <sot/storage.hxx>
@@ -32,8 +32,6 @@
#include <memory>
-class GalleryStorageLocations;
-class GalleryBinaryStorageLocations;
class GalleryObjectCollection;
class SgaObjectSvDraw;
class SgaObjectBmp;
@@ -48,7 +46,7 @@ class SVXCORE_DLLPUBLIC GalleryBinaryEngine final : public GalleryFileStorage
{
private:
tools::SvRef<SotStorage> m_aSvDrawStorageRef;
- const GalleryBinaryStorageLocations& maGalleryStorageLocations;
+ const GalleryStorageLocations& maGalleryStorageLocations;
GalleryObjectCollection& mrGalleryObjectCollection;
bool mbReadOnly;
OUString m_aDestDir;
@@ -60,7 +58,7 @@ private:
const INetURLObject& GetThmURL() const { return maGalleryStorageLocations.GetThmURL(); }
public:
- GalleryBinaryEngine(const GalleryBinaryStorageLocations& rGalleryStorageLocations,
+ GalleryBinaryEngine(const GalleryStorageLocations& rGalleryStorageLocations,
GalleryObjectCollection& rGalleryObjectCollection, bool bReadOnly);
SAL_DLLPRIVATE ~GalleryBinaryEngine();
diff --git a/svx/inc/gallerybinaryengineentry.hxx b/svx/inc/gallerybinaryengineentry.hxx
index 8b5b3d3f607b..e21d6a64fea7 100644
--- a/svx/inc/gallerybinaryengineentry.hxx
+++ b/svx/inc/gallerybinaryengineentry.hxx
@@ -22,17 +22,16 @@
#include <tools/urlobj.hxx>
#include <svx/galtheme.hxx>
#include "gallerybinaryengine.hxx"
-#include "gallerybinarystoragelocations.hxx"
+#include "gallerystoragelocations.hxx"
#include "galleryfilestorageentry.hxx"
-class GalleryBinaryStorageLocations;
class GalleryObjectCollection;
class GalleryBinaryEngine;
class GalleryBinaryEngineEntry final : public GalleryFileStorageEntry
{
private:
- std::unique_ptr<GalleryBinaryStorageLocations> mpGalleryStorageLocations;
+ std::unique_ptr<GalleryStorageLocations> mpGalleryStorageLocations;
public:
GalleryBinaryEngineEntry();
@@ -45,7 +44,7 @@ public:
const INetURLObject& GetSdvURL() const { return mpGalleryStorageLocations->GetSdvURL(); }
const INetURLObject& GetStrURL() const { return mpGalleryStorageLocations->GetStrURL(); }
- const std::unique_ptr<GalleryBinaryStorageLocations>& getGalleryStorageLocations() const
+ const std::unique_ptr<GalleryStorageLocations>& getGalleryStorageLocations() const
{
return mpGalleryStorageLocations;
}
diff --git a/svx/inc/gallerybinarystoragelocations.hxx b/svx/inc/gallerybinarystoragelocations.hxx
deleted file mode 100644
index 7d14299e5430..000000000000
--- a/svx/inc/gallerybinarystoragelocations.hxx
+++ /dev/null
@@ -1,52 +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/svxdllapi.h>
-#include "gallerystoragelocations.hxx"
-
-class SVXCORE_DLLPUBLIC GalleryBinaryStorageLocations final : public GalleryStorageLocations
-{
-private:
- INetURLObject maThmURL;
- INetURLObject maSdgURL;
- INetURLObject maSdvURL;
- INetURLObject maStrURL;
-
- void SetThmExtension(INetURLObject& aURL);
- void SetSdgExtension(INetURLObject& aURL);
- void SetSdvExtension(INetURLObject& aURL);
- void SetStrExtension(INetURLObject& aURL);
-
-public:
- static INetURLObject ImplGetURLIgnoreCase(const INetURLObject& rURL);
-
- const INetURLObject& GetThmURL() const { return maThmURL; }
- const INetURLObject& GetSdgURL() const { return maSdgURL; }
- const INetURLObject& GetSdvURL() const { return maSdvURL; }
- const INetURLObject& GetStrURL() const { return maStrURL; }
-
- void SetStorageLocations(INetURLObject& aURL);
-
- const INetURLObject& getThemeURL() const { return maSdgURL; }
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/inc/gallerystoragelocations.hxx b/svx/inc/gallerystoragelocations.hxx
index 343ed0b7e77b..e30ea9cf0e18 100644
--- a/svx/inc/gallerystoragelocations.hxx
+++ b/svx/inc/gallerystoragelocations.hxx
@@ -22,12 +22,30 @@
#include <svx/svxdllapi.h>
#include <tools/urlobj.hxx>
-class SVXCORE_DLLPUBLIC GalleryStorageLocations
+class SVXCORE_DLLPUBLIC GalleryStorageLocations final
{
+private:
+ INetURLObject maThmURL;
+ INetURLObject maSdgURL;
+ INetURLObject maSdvURL;
+ INetURLObject maStrURL;
+
+ void SetThmExtension(INetURLObject& aURL);
+ void SetSdgExtension(INetURLObject& aURL);
+ void SetSdvExtension(INetURLObject& aURL);
+ void SetStrExtension(INetURLObject& aURL);
+
public:
- virtual ~GalleryStorageLocations() = 0;
- virtual void SetStorageLocations(INetURLObject& aURL) = 0;
- virtual const INetURLObject& getThemeURL() const = 0;
+ static INetURLObject ImplGetURLIgnoreCase(const INetURLObject& rURL);
+
+ const INetURLObject& GetThmURL() const { return maThmURL; }
+ const INetURLObject& GetSdgURL() const { return maSdgURL; }
+ const INetURLObject& GetSdvURL() const { return maSdvURL; }
+ const INetURLObject& GetStrURL() const { return maStrURL; }
+
+ void SetStorageLocations(INetURLObject& aURL);
+
+ const INetURLObject& getThemeURL() const { return maSdgURL; }
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/gallery/test_gallery.cxx b/svx/qa/unit/gallery/test_gallery.cxx
index cf868bd219fd..ac6a1b6ee875 100644
--- a/svx/qa/unit/gallery/test_gallery.cxx
+++ b/svx/qa/unit/gallery/test_gallery.cxx
@@ -17,7 +17,7 @@
#include <svx/galtheme.hxx>
#include <gallerystoragelocations.hxx>
#include <galobj.hxx>
-#include <gallerybinarystoragelocations.hxx>
+#include <gallerystoragelocations.hxx>
#include <cppunit/TestAssert.h>
#include <cppunit/extensions/HelperMacros.h>
@@ -256,8 +256,7 @@ void GalleryObjTest::TestGalleryThemeEntry()
myThemeName);
// Check URLs
- GalleryBinaryStorageLocations& aGalleryBinaryStorageLocations
- = dynamic_cast<GalleryBinaryStorageLocations&>(mpThemeEntry->getGalleryStorageLocations());
+ GalleryStorageLocations& rGalleryStorageLocations = mpThemeEntry->getGalleryStorageLocations();
INetURLObject aURL(aGalleryURL);
aURL.Append(myThemeName);
INetURLObject aThemeURL(aURL), aSdvURL(aURL), aSdgURL(aURL), aStrURL(aURL);
@@ -266,19 +265,19 @@ void GalleryObjTest::TestGalleryThemeEntry()
aSdgURL.setExtension(u"sdg");
aStrURL.setExtension(u"str");
CPPUNIT_ASSERT_EQUAL_MESSAGE("Theme URL doesn't match",
- aGalleryBinaryStorageLocations.GetThmURL().GetMainURL(
+ rGalleryStorageLocations.GetThmURL().GetMainURL(
INetURLObject::DecodeMechanism::Unambiguous),
aThemeURL.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Sdv URL doesn't match",
- aGalleryBinaryStorageLocations.GetSdvURL().GetMainURL(
+ rGalleryStorageLocations.GetSdvURL().GetMainURL(
INetURLObject::DecodeMechanism::Unambiguous),
aSdvURL.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Sdg URL doesn't match",
- aGalleryBinaryStorageLocations.GetSdgURL().GetMainURL(
+ rGalleryStorageLocations.GetSdgURL().GetMainURL(
INetURLObject::DecodeMechanism::Unambiguous),
aSdgURL.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Str URL doesn't match",
- aGalleryBinaryStorageLocations.GetStrURL().GetMainURL(
+ rGalleryStorageLocations.GetStrURL().GetMainURL(
INetURLObject::DecodeMechanism::Unambiguous),
aStrURL.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous));
}
diff --git a/svx/source/gallery2/gallerybinaryengine.cxx b/svx/source/gallery2/gallerybinaryengine.cxx
index b1c0e317cfb9..009fe113f210 100644
--- a/svx/source/gallery2/gallerybinaryengine.cxx
+++ b/svx/source/gallery2/gallerybinaryengine.cxx
@@ -51,7 +51,7 @@
using namespace ::com::sun::star;
GalleryBinaryEngine::GalleryBinaryEngine(
- const GalleryBinaryStorageLocations& rGalleryBinaryStorageLocations,
+ const GalleryStorageLocations& rGalleryBinaryStorageLocations,
GalleryObjectCollection& rGalleryObjectCollection, bool bReadOnly)
: maGalleryStorageLocations(rGalleryBinaryStorageLocations)
, mrGalleryObjectCollection(rGalleryObjectCollection)
diff --git a/svx/source/gallery2/gallerybinaryengineentry.cxx b/svx/source/gallery2/gallerybinaryengineentry.cxx
index 75f7cdda83c8..9c222b1c15fe 100644
--- a/svx/source/gallery2/gallerybinaryengineentry.cxx
+++ b/svx/source/gallery2/gallerybinaryengineentry.cxx
@@ -18,6 +18,7 @@
*/
#include <gallerybinaryengineentry.hxx>
+#include <gallerystoragelocations.hxx>
#include <svx/galmisc.hxx>
#include <svx/gallery1.hxx>
@@ -36,7 +37,7 @@ static bool FileExists(const INetURLObject& rURL, std::u16string_view rExt)
GalleryBinaryEngineEntry::GalleryBinaryEngineEntry()
{
- mpGalleryStorageLocations = std::make_unique<GalleryBinaryStorageLocations>();
+ mpGalleryStorageLocations = std::make_unique<GalleryStorageLocations>();
}
void GalleryBinaryEngineEntry::setStorageLocations(INetURLObject& rURL)
@@ -53,7 +54,7 @@ std::unique_ptr<GalleryBinaryEngine> GalleryBinaryEngineEntry::createGalleryStor
void GalleryBinaryEngineEntry::CreateUniqueURL(const INetURLObject& rBaseURL, INetURLObject& aURL)
{
- INetURLObject aBaseNoCase(GalleryBinaryStorageLocations::ImplGetURLIgnoreCase(rBaseURL));
+ INetURLObject aBaseNoCase(GalleryStorageLocations::ImplGetURLIgnoreCase(rBaseURL));
aURL = aBaseNoCase;
static sal_Int32 nIdx = 0;
while (FileExists(aURL, u"thm"))
diff --git a/svx/source/gallery2/gallerybinarystoragelocations.cxx b/svx/source/gallery2/gallerybinarystoragelocations.cxx
deleted file mode 100644
index 1fec54d10d9a..000000000000
--- a/svx/source/gallery2/gallerybinarystoragelocations.cxx
+++ /dev/null
@@ -1,75 +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 <gallerybinarystoragelocations.hxx>
-#include <svx/galmisc.hxx>
-
-INetURLObject GalleryBinaryStorageLocations::ImplGetURLIgnoreCase(const INetURLObject& rURL)
-{
- INetURLObject aURL(rURL);
-
- // check original file name
- if (!FileExists(aURL))
- {
- // check upper case file name
- aURL.setName(aURL.getName().toAsciiUpperCase());
-
- if (!FileExists(aURL))
- {
- // check lower case file name
- aURL.setName(aURL.getName().toAsciiLowerCase());
- }
- }
-
- return aURL;
-}
-
-void GalleryBinaryStorageLocations::SetThmExtension(INetURLObject& aURL)
-{
- aURL.setExtension(u"thm");
- maThmURL = ImplGetURLIgnoreCase(aURL);
-}
-
-void GalleryBinaryStorageLocations::SetSdgExtension(INetURLObject& aURL)
-{
- aURL.setExtension(u"sdg");
- maSdgURL = ImplGetURLIgnoreCase(aURL);
-}
-
-void GalleryBinaryStorageLocations::SetSdvExtension(INetURLObject& aURL)
-{
- aURL.setExtension(u"sdv");
- maSdvURL = ImplGetURLIgnoreCase(aURL);
-}
-
-void GalleryBinaryStorageLocations::SetStrExtension(INetURLObject& aURL)
-{
- aURL.setExtension(u"str");
- maStrURL = ImplGetURLIgnoreCase(aURL);
-}
-
-void GalleryBinaryStorageLocations::SetStorageLocations(INetURLObject& rURL)
-{
- SetThmExtension(rURL);
- SetSdgExtension(rURL);
- SetSdvExtension(rURL);
- SetStrExtension(rURL);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/gallerystoragelocations.cxx b/svx/source/gallery2/gallerystoragelocations.cxx
index a723a681b7b5..bd2a81c33562 100644
--- a/svx/source/gallery2/gallerystoragelocations.cxx
+++ b/svx/source/gallery2/gallerystoragelocations.cxx
@@ -18,7 +18,58 @@
*/
#include <gallerystoragelocations.hxx>
+#include <svx/galmisc.hxx>
-GalleryStorageLocations::~GalleryStorageLocations(){};
+INetURLObject GalleryStorageLocations::ImplGetURLIgnoreCase(const INetURLObject& rURL)
+{
+ INetURLObject aURL(rURL);
+
+ // check original file name
+ if (!FileExists(aURL))
+ {
+ // check upper case file name
+ aURL.setName(aURL.getName().toAsciiUpperCase());
+
+ if (!FileExists(aURL))
+ {
+ // check lower case file name
+ aURL.setName(aURL.getName().toAsciiLowerCase());
+ }
+ }
+
+ return aURL;
+}
+
+void GalleryStorageLocations::SetThmExtension(INetURLObject& aURL)
+{
+ aURL.setExtension(u"thm");
+ maThmURL = ImplGetURLIgnoreCase(aURL);
+}
+
+void GalleryStorageLocations::SetSdgExtension(INetURLObject& aURL)
+{
+ aURL.setExtension(u"sdg");
+ maSdgURL = ImplGetURLIgnoreCase(aURL);
+}
+
+void GalleryStorageLocations::SetSdvExtension(INetURLObject& aURL)
+{
+ aURL.setExtension(u"sdv");
+ maSdvURL = ImplGetURLIgnoreCase(aURL);
+}
+
+void GalleryStorageLocations::SetStrExtension(INetURLObject& aURL)
+{
+ aURL.setExtension(u"str");
+ maStrURL = ImplGetURLIgnoreCase(aURL);
+}
+
+void GalleryStorageLocations::SetStorageLocations(INetURLObject& rURL)
+{
+ SetThmExtension(rURL);
+ SetSdgExtension(rURL);
+ SetSdvExtension(rURL);
+ SetStrExtension(rURL);
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */