include/svx/ColorSets.hxx         |    3 +--
 svx/source/dialog/ThemeDialog.cxx |    2 +-
 svx/source/styles/ColorSets.cxx   |   37 +++++++++++--------------------------
 3 files changed, 13 insertions(+), 29 deletions(-)

New commits:
commit b9d7ab8dde9fef6eba30d8c75f3949acec4d42ff
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Feb 26 10:21:51 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Feb 26 13:18:27 2025 +0100

    IdenticalNameAction is unused
    
    insert() is always called with the same value
    
    Change-Id: I319864f112097ce7ba3c01687cf0598789005bdb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182205
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/include/svx/ColorSets.hxx b/include/svx/ColorSets.hxx
index 6bf29c4ea196..a3557debca19 100644
--- a/include/svx/ColorSets.hxx
+++ b/include/svx/ColorSets.hxx
@@ -24,7 +24,6 @@ private:
     ColorSets();
     void init();
 public:
-    enum class IdenticalNameAction { Overwrite, AutoRename };
     static ColorSets& get();
 
     const std::vector<model::ColorSet>& getColorSetVector() const
@@ -39,7 +38,7 @@ public:
 
     model::ColorSet const* getColorSet(std::u16string_view rName) const;
 
-    void insert(model::ColorSet const& rColorSet, IdenticalNameAction eAction);
+    void insert(model::ColorSet const& rColorSet);
     void writeToUserFolder(model::ColorSet const& rNewColorSet);
 
 };
diff --git a/svx/source/dialog/ThemeDialog.cxx 
b/svx/source/dialog/ThemeDialog.cxx
index d20ce3be360b..47e374579662 100644
--- a/svx/source/dialog/ThemeDialog.cxx
+++ b/svx/source/dialog/ThemeDialog.cxx
@@ -102,7 +102,7 @@ void ThemeDialog::runThemeColorEditDialog()
         auto aColorSet = mxSubDialog->getColorSet();
         if (!aColorSet.getName().isEmpty())
         {
-            ColorSets::get().insert(aColorSet, 
ColorSets::IdenticalNameAction::AutoRename);
+            ColorSets::get().insert(aColorSet);
             maColorSets.clear();
             mxValueSetThemeColors->Clear();
 
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index 30268c913720..0e59effe779a 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -198,36 +198,21 @@ OUString findUniqueName(std::unordered_set<OUString> 
const& rNames, OUString con
 
 } // end anonymous namespace
 
-void ColorSets::insert(model::ColorSet const& rNewColorSet, 
IdenticalNameAction eAction)
+void ColorSets::insert(model::ColorSet const& rNewColorSet)
 {
-    if (eAction == IdenticalNameAction::Overwrite)
-    {
-        for (model::ColorSet& rColorSet : maColorSets)
-        {
-            if (rColorSet.getName() == rNewColorSet.getName())
-            {
-                rColorSet = rNewColorSet;
-                return;
-            }
-        }
-        // color set not found, so insert it
-        maColorSets.push_back(rNewColorSet);
-        writeToUserFolder(rNewColorSet);
-    }
-    else if (eAction == IdenticalNameAction::AutoRename)
-    {
-        std::unordered_set<OUString> aNames;
-        for (model::ColorSet& rColorSet : maColorSets)
-            aNames.insert(rColorSet.getName());
+    // auto-rename if it already exists
 
-        OUString aName = findUniqueName(aNames, rNewColorSet.getName());
+    std::unordered_set<OUString> aNames;
+    for (model::ColorSet& rColorSet : maColorSets)
+        aNames.insert(rColorSet.getName());
 
-        model::ColorSet aNewColorSet = rNewColorSet;
-        aNewColorSet.setName(aName);
+    OUString aName = findUniqueName(aNames, rNewColorSet.getName());
 
-        maColorSets.push_back(aNewColorSet);
-        writeToUserFolder(aNewColorSet);
-    }
+    model::ColorSet aNewColorSet = rNewColorSet;
+    aNewColorSet.setName(aName);
+
+    maColorSets.push_back(aNewColorSet);
+    writeToUserFolder(aNewColorSet);
 }
 
 void ColorSets::writeToUserFolder(model::ColorSet const& rNewColorSet)

Reply via email to