[Libreoffice-commits] core.git: include/svx svx/Library_svxcore.mk svx/source
Aditya (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 4 19:59:13 UTC 2020
include/svx/gallery1.hxx | 13 +--
include/svx/gallerybinaryengine.hxx | 6 -
include/svx/gallerybinaryengineentry.hxx | 7 -
include/svx/gallerybinarystoragelocations.hxx | 52 ++++++++++++
include/svx/gallerystoragelocations.hxx | 25 ------
svx/Library_svxcore.mk | 1
svx/source/gallery2/gallery1.cxx | 11 ++
svx/source/gallery2/gallerybinaryengine.cxx | 8 -
svx/source/gallery2/gallerybinaryengineentry.cxx | 4
svx/source/gallery2/gallerybinarystoragelocations.cxx | 75 ++++++++++++++++++
svx/source/gallery2/gallerystoragelocations.cxx | 53 ------------
svx/source/gallery2/galtheme.cxx | 2
12 files changed, 163 insertions(+), 94 deletions(-)
New commits:
commit 86099e6ec0a2ae72c560c5f2d8b2c3e482ce2e60
Author: Aditya <adityasahu1511 at gmail.com>
AuthorDate: Thu Aug 27 11:42:16 2020 +0530
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Sep 4 21:58:30 2020 +0200
svx: Introduce GalleryBinaryStorageLocations
Make GalleryStorageLocations abstract superclass of
GalleryBinaryStorageLocations and upcoming GalleryXMLStorageLocations.
Change-Id: Iccd53b723a4495e0d93ab5e3306f899ec41705f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101434
Tested-by: Tomaž Vajngerl <quikee at gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/include/svx/gallery1.hxx b/include/svx/gallery1.hxx
index 6d3e7bbd105d..41b71c1c6130 100644
--- a/include/svx/gallery1.hxx
+++ b/include/svx/gallery1.hxx
@@ -39,7 +39,7 @@ class GalleryThemeEntry
private:
std::unique_ptr<GalleryBinaryEngineEntry> mpGalleryStorageEngineEntry;
- GalleryStorageLocations maGalleryStorageLocations;
+ std::unique_ptr<GalleryStorageLocations> mpGalleryStorageLocations;
OUString aName;
sal_uInt32 nId;
bool bReadOnly;
@@ -56,14 +56,15 @@ public:
std::unique_ptr<GalleryBinaryEngineEntry> createGalleryStorageEngineEntry();
const std::unique_ptr<GalleryBinaryEngineEntry>& getGalleryStorageEngineEntry() const { return mpGalleryStorageEngineEntry; }
- const GalleryStorageLocations& getGalleryStorageLocations() const { return maGalleryStorageLocations; }
+ static std::unique_ptr<GalleryStorageLocations> createGalleryStorageLocations();
+ const std::unique_ptr<GalleryStorageLocations>& getGalleryStorageLocations() const { return mpGalleryStorageLocations; }
const OUString& GetThemeName() const { return aName; }
- const INetURLObject& GetThmURL() const { return mpGalleryStorageEngineEntry->GetThmURL(); }
- const INetURLObject& GetSdgURL() const { return mpGalleryStorageEngineEntry->GetSdgURL(); }
- const INetURLObject& GetSdvURL() const { return mpGalleryStorageEngineEntry->GetSdvURL(); }
- const INetURLObject& GetStrURL() const { return mpGalleryStorageEngineEntry->GetStrURL(); }
+ const INetURLObject& GetThmURL() const { return mpGalleryStorageEngineEntry->GetThmURL(); }
+ const INetURLObject& GetSdgURL() const { return mpGalleryStorageEngineEntry->GetSdgURL(); }
+ const INetURLObject& GetSdvURL() const { return mpGalleryStorageEngineEntry->GetSdvURL(); }
+ const INetURLObject& GetStrURL() const { return mpGalleryStorageEngineEntry->GetStrURL(); }
bool IsReadOnly() const { return bReadOnly; }
bool IsDefault() const;
diff --git a/include/svx/gallerybinaryengine.hxx b/include/svx/gallerybinaryengine.hxx
index 46322f5b99bf..1e6fd0b28eb1 100644
--- a/include/svx/gallerybinaryengine.hxx
+++ b/include/svx/gallerybinaryengine.hxx
@@ -23,6 +23,7 @@
#include <svx/svxdllapi.h>
#include <svx/fmmodel.hxx>
#include <svx/gallerystoragelocations.hxx>
+#include <svx/gallerybinarystoragelocations.hxx>
#include <svx/galleryfilestorage.hxx>
#include <tools/urlobj.hxx>
#include <sot/storage.hxx>
@@ -33,6 +34,7 @@
#include <memory>
class GalleryStorageLocations;
+class GalleryBinaryStorageLocations;
class GalleryObjectCollection;
class SgaObjectSvDraw;
class SgaObjectBmp;
@@ -47,7 +49,7 @@ class SVXCORE_DLLPUBLIC GalleryBinaryEngine : public GalleryFileStorage
{
private:
tools::SvRef<SotStorage> m_aSvDrawStorageRef;
- const GalleryStorageLocations& maGalleryStorageLocations;
+ const GalleryBinaryStorageLocations& maGalleryStorageLocations;
GalleryObjectCollection& mrGalleryObjectCollection;
bool mbReadOnly;
OUString m_aDestDir;
@@ -59,7 +61,7 @@ private:
const INetURLObject& GetThmURL() const { return maGalleryStorageLocations.GetThmURL(); }
public:
- GalleryBinaryEngine(const GalleryStorageLocations& rGalleryStorageLocations,
+ GalleryBinaryEngine(const GalleryBinaryStorageLocations& rGalleryStorageLocations,
GalleryObjectCollection& rGalleryObjectCollection, bool bReadOnly);
SAL_DLLPRIVATE ~GalleryBinaryEngine();
diff --git a/include/svx/gallerybinaryengineentry.hxx b/include/svx/gallerybinaryengineentry.hxx
index e2561ce764dd..8039661e4dec 100644
--- a/include/svx/gallerybinaryengineentry.hxx
+++ b/include/svx/gallerybinaryengineentry.hxx
@@ -24,17 +24,18 @@
#include <svx/galtheme.hxx>
#include <svx/gallerybinaryengine.hxx>
#include <svx/gallerystoragelocations.hxx>
+#include <svx/gallerybinarystoragelocations.hxx>
#include <svx/galleryfilestorageentry.hxx>
-class GalleryStorageLocations;
+class GalleryBinaryStorageLocations;
class GalleryBinaryEngineEntry : public GalleryFileStorageEntry
{
private:
- GalleryStorageLocations& m_rGalleryStorageLocations;
+ GalleryBinaryStorageLocations& m_rGalleryStorageLocations;
public:
- GalleryBinaryEngineEntry(GalleryStorageLocations& rGalleryStorageLocations);
+ GalleryBinaryEngineEntry(GalleryBinaryStorageLocations& rGalleryStorageLocations);
static void CreateUniqueURL(const INetURLObject& rBaseURL, INetURLObject& aURL);
OUString ReadStrFromIni(const OUString& aKeyName);
diff --git a/include/svx/gallerybinarystoragelocations.hxx b/include/svx/gallerybinarystoragelocations.hxx
new file mode 100644
index 000000000000..c744ea610577
--- /dev/null
+++ b/include/svx/gallerybinarystoragelocations.hxx
@@ -0,0 +1,52 @@
+/* -*- 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 <svx/gallerystoragelocations.hxx>
+
+class GalleryBinaryStorageLocations : 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/include/svx/gallerystoragelocations.hxx b/include/svx/gallerystoragelocations.hxx
index dbc96207d11d..0e15c35bab70 100644
--- a/include/svx/gallerystoragelocations.hxx
+++ b/include/svx/gallerystoragelocations.hxx
@@ -20,32 +20,13 @@
#pragma once
#include <tools/urlobj.hxx>
-#include <svx/svxdllapi.h>
class GalleryStorageLocations
{
-private:
- INetURLObject maThmURL;
- INetURLObject maSdgURL;
- INetURLObject maSdvURL;
- INetURLObject maStrURL;
-
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 SetThmExtension(INetURLObject& aURL);
- void SetSdgExtension(INetURLObject& aURL);
- void SetSdvExtension(INetURLObject& aURL);
- void SetStrExtension(INetURLObject& aURL);
-
- void SetStorageLocations(INetURLObject& aURL);
-
- const INetURLObject& getThemeURL() const { return maSdgURL; }
+ virtual ~GalleryStorageLocations() = 0;
+ virtual void SetStorageLocations(INetURLObject& aURL) = 0;
+ virtual const INetURLObject& getThemeURL() const = 0;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index c5a54708a70a..3d4590d216a1 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -155,6 +155,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
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 \
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx
index 78f517f63868..aaa6b47ed918 100644
--- a/svx/source/gallery2/gallery1.cxx
+++ b/svx/source/gallery2/gallery1.cxx
@@ -122,8 +122,9 @@ GalleryThemeEntry::GalleryThemeEntry( bool bCreateUniqueURL,
{
GalleryBinaryEngineEntry::CreateUniqueURL(rBaseURL,aURL);
}
+ mpGalleryStorageLocations = createGalleryStorageLocations();
mpGalleryStorageEngineEntry = createGalleryStorageEngineEntry();
- maGalleryStorageLocations.SetStorageLocations(aURL);
+ mpGalleryStorageLocations->SetStorageLocations(aURL);
SetModified( _bNewFile );
@@ -163,10 +164,16 @@ GalleryThemeEntry::GalleryThemeEntry( bool bCreateUniqueURL,
std::unique_ptr<GalleryBinaryEngineEntry> GalleryThemeEntry::createGalleryStorageEngineEntry()
{
- std::unique_ptr<GalleryBinaryEngineEntry> pGalleryBinaryEngineEntry = std::make_unique<GalleryBinaryEngineEntry>(maGalleryStorageLocations);
+ std::unique_ptr<GalleryBinaryEngineEntry> pGalleryBinaryEngineEntry = std::make_unique<GalleryBinaryEngineEntry>(dynamic_cast<GalleryBinaryStorageLocations&>(*mpGalleryStorageLocations));
return pGalleryBinaryEngineEntry;
}
+std::unique_ptr<GalleryStorageLocations> GalleryThemeEntry::createGalleryStorageLocations()
+{
+ std::unique_ptr<GalleryStorageLocations> pGalleryStorageLocations = std::make_unique<GalleryBinaryStorageLocations>();
+ return pGalleryStorageLocations;
+}
+
void GalleryTheme::InsertAllThemes(weld::ComboBox& rListBox)
{
for (size_t i = 0; i < SAL_N_ELEMENTS(aUnlocalized); ++i)
diff --git a/svx/source/gallery2/gallerybinaryengine.cxx b/svx/source/gallery2/gallerybinaryengine.cxx
index 298edd596001..eb740c5a0cff 100644
--- a/svx/source/gallery2/gallerybinaryengine.cxx
+++ b/svx/source/gallery2/gallerybinaryengine.cxx
@@ -50,10 +50,10 @@
using namespace ::com::sun::star;
-GalleryBinaryEngine::GalleryBinaryEngine(const GalleryStorageLocations& rGalleryStorageLocations,
- GalleryObjectCollection& rGalleryObjectCollection,
- bool bReadOnly)
- : maGalleryStorageLocations(rGalleryStorageLocations)
+GalleryBinaryEngine::GalleryBinaryEngine(
+ const GalleryBinaryStorageLocations& rGalleryBinaryStorageLocations,
+ GalleryObjectCollection& rGalleryObjectCollection, bool bReadOnly)
+ : maGalleryStorageLocations(rGalleryBinaryStorageLocations)
, mrGalleryObjectCollection(rGalleryObjectCollection)
, mbReadOnly(bReadOnly)
, m_bDestDirRelative(false)
diff --git a/svx/source/gallery2/gallerybinaryengineentry.cxx b/svx/source/gallery2/gallerybinaryengineentry.cxx
index 8255b2b8a276..1d669576dc98 100644
--- a/svx/source/gallery2/gallerybinaryengineentry.cxx
+++ b/svx/source/gallery2/gallerybinaryengineentry.cxx
@@ -42,14 +42,14 @@ static bool FileExists(const INetURLObject& rURL, const OUString& rExt)
}
GalleryBinaryEngineEntry::GalleryBinaryEngineEntry(
- GalleryStorageLocations& rGalleryStorageLocations)
+ GalleryBinaryStorageLocations& rGalleryStorageLocations)
: m_rGalleryStorageLocations(rGalleryStorageLocations)
{
}
void GalleryBinaryEngineEntry::CreateUniqueURL(const INetURLObject& rBaseURL, INetURLObject& aURL)
{
- INetURLObject aBaseNoCase(GalleryStorageLocations::ImplGetURLIgnoreCase(rBaseURL));
+ INetURLObject aBaseNoCase(GalleryBinaryStorageLocations::ImplGetURLIgnoreCase(rBaseURL));
aURL = aBaseNoCase;
static sal_Int32 nIdx = 0;
while (FileExists(aURL, "thm"))
diff --git a/svx/source/gallery2/gallerybinarystoragelocations.cxx b/svx/source/gallery2/gallerybinarystoragelocations.cxx
new file mode 100644
index 000000000000..cefb79d543a9
--- /dev/null
+++ b/svx/source/gallery2/gallerybinarystoragelocations.cxx
@@ -0,0 +1,75 @@
+/* -*- 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/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("thm");
+ maThmURL = ImplGetURLIgnoreCase(aURL);
+}
+
+void GalleryBinaryStorageLocations::SetSdgExtension(INetURLObject& aURL)
+{
+ aURL.setExtension("sdg");
+ maSdgURL = ImplGetURLIgnoreCase(aURL);
+}
+
+void GalleryBinaryStorageLocations::SetSdvExtension(INetURLObject& aURL)
+{
+ aURL.setExtension("sdv");
+ maSdvURL = ImplGetURLIgnoreCase(aURL);
+}
+
+void GalleryBinaryStorageLocations::SetStrExtension(INetURLObject& aURL)
+{
+ aURL.setExtension("str");
+ maStrURL = ImplGetURLIgnoreCase(aURL);
+}
+
+void GalleryBinaryStorageLocations::SetStorageLocations(INetURLObject& aURL)
+{
+ SetThmExtension(aURL);
+ SetSdgExtension(aURL);
+ SetSdvExtension(aURL);
+ SetStrExtension(aURL);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/gallerystoragelocations.cxx b/svx/source/gallery2/gallerystoragelocations.cxx
index cc427c8d16b4..d71ae452fd71 100644
--- a/svx/source/gallery2/gallerystoragelocations.cxx
+++ b/svx/source/gallery2/gallerystoragelocations.cxx
@@ -18,58 +18,7 @@
*/
#include <svx/gallerystoragelocations.hxx>
-#include <svx/galmisc.hxx>
-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("thm");
- maThmURL = ImplGetURLIgnoreCase(aURL);
-}
-
-void GalleryStorageLocations::SetSdgExtension(INetURLObject& aURL)
-{
- aURL.setExtension("sdg");
- maSdgURL = ImplGetURLIgnoreCase(aURL);
-}
-
-void GalleryStorageLocations::SetSdvExtension(INetURLObject& aURL)
-{
- aURL.setExtension("sdv");
- maSdvURL = ImplGetURLIgnoreCase(aURL);
-}
-
-void GalleryStorageLocations::SetStrExtension(INetURLObject& aURL)
-{
- aURL.setExtension("str");
- maStrURL = ImplGetURLIgnoreCase(aURL);
-}
-
-void GalleryStorageLocations::SetStorageLocations(INetURLObject& aURL)
-{
- SetThmExtension(aURL);
- SetSdgExtension(aURL);
- SetSdvExtension(aURL);
- SetStrExtension(aURL);
-}
+GalleryStorageLocations::~GalleryStorageLocations(){};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index a25964afa1f3..c0fb25b430ce 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -96,7 +96,7 @@ void GalleryTheme::SetDestDir(const OUString& rDestDir, bool bRelative)
std::unique_ptr<GalleryBinaryEngine> GalleryTheme::createGalleryStorageEngine(bool bReadOnly)
{
- std::unique_ptr<GalleryBinaryEngine> pGalleryBinaryEngine = std::make_unique<GalleryBinaryEngine>(pThm->getGalleryStorageLocations(), maGalleryObjectCollection, bReadOnly);
+ std::unique_ptr<GalleryBinaryEngine> pGalleryBinaryEngine = std::make_unique<GalleryBinaryEngine>(dynamic_cast<GalleryBinaryStorageLocations&>(*pThm->getGalleryStorageLocations()), maGalleryObjectCollection, bReadOnly);
return pGalleryBinaryEngine;
}
More information about the Libreoffice-commits
mailing list