configmgr/Library_configmgr.mk                |    4 +++
 configmgr/source/components.cxx               |   32 +++++++++++++-------------
 configmgr/source/components.hxx               |    5 ++--
 configmgr/source/data.cxx                     |   18 +++++++++++++-
 configmgr/source/data.hxx                     |    4 +--
 configmgr/source/parsemanager.cxx             |    6 ++--
 configmgr/source/parsemanager.hxx             |    3 +-
 configmgr/source/parser.hxx                   |    4 +--
 configmgr/source/update.cxx                   |    4 ++-
 configmgr/source/xcdparser.cxx                |    8 +++---
 configmgr/source/xcdparser.hxx                |    2 -
 configmgr/source/xcsparser.cxx                |    2 -
 configmgr/source/xcsparser.hxx                |    2 -
 configmgr/source/xcuparser.cxx                |    8 +++---
 configmgr/source/xcuparser.hxx                |    4 +--
 desktop/source/migration/migration.cxx        |   31 +++++++++++++++++++++++++
 offapi/com/sun/star/configuration/XUpdate.idl |    4 +--
 17 files changed, 98 insertions(+), 43 deletions(-)

New commits:
commit 3f3d39b3ddcda9d6840552b01e808a7e649e61ef
Author:     Balazs Varga <[email protected]>
AuthorDate: Thu Sep 8 16:04:10 2022 +0200
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Fri Sep 16 08:38:35 2022 +0200

    Migrating product name related color schemes between different versions
    
    Making work to migrate product name related color schemes
    with different kind of product names. For example from a product
    named by LibreOffice to a product named by LibreOfficeDev.
    
    (cherry picked from commit 583ea856f2aa227bb04581c5bcdc3a402f5a184f)
    
    Change-Id: Iabef982216f126b781df122ed258816af2ae337c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139690
    Tested-by: Jenkins
    Tested-by: Gabor Kelemen <[email protected]>
    Reviewed-by: Balazs Varga <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139875
    Tested-by: Thorsten Behrens <[email protected]>
    Reviewed-by: Thorsten Behrens <[email protected]>

diff --git a/configmgr/Library_configmgr.mk b/configmgr/Library_configmgr.mk
index 19477b172308..d7873a09ba0e 100644
--- a/configmgr/Library_configmgr.mk
+++ b/configmgr/Library_configmgr.mk
@@ -52,6 +52,10 @@ $(eval $(call gb_Library_use_externals,configmgr, \
     dconf \
 ))
 
+$(eval $(call gb_Library_use_custom_headers,configmgr, \
+    officecfg/registry \
+))
+
 $(eval $(call gb_Library_use_sdk_api,configmgr))
 
 $(eval $(call gb_Library_use_libraries,configmgr, \
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index 939d226e964d..425d7925d366 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -93,23 +93,23 @@ typedef std::vector< UnresolvedVectorItem > 
UnresolvedVector;
 
 void parseXcsFile(
     OUString const & url, int layer, Data & data, Partial const * partial,
-    Modifications * modifications, Additions * additions)
+    Modifications * modifications, Additions * additions, OUString const & 
oldProductName)
 {
     assert(partial == nullptr && modifications == nullptr && additions == 
nullptr);
     (void) partial; (void) modifications; (void) additions;
     bool ok = rtl::Reference< ParseManager >(
-        new ParseManager(url, new XcsParser(layer, data)))->parse(nullptr);
+        new ParseManager(url, oldProductName, new XcsParser(layer, 
data)))->parse(nullptr);
     assert(ok);
     (void) ok; // avoid warnings
 }
 
 void parseXcuFile(
     OUString const & url, int layer, Data & data, Partial const * partial,
-    Modifications * modifications, Additions * additions)
+    Modifications * modifications, Additions * additions, OUString const & 
oldProductName)
 {
     bool ok = rtl::Reference< ParseManager >(
         new ParseManager(
-            url,
+            url, oldProductName,
             new XcuParser(layer, data, partial, modifications, additions)))->
         parse(nullptr);
     assert(ok);
@@ -212,7 +212,7 @@ rtl::Reference< Node > 
Components::resolvePathRepresentation(
     const
 {
     return data_.resolvePathRepresentation(
-        pathRepresentation, canonicRepresentation, path, finalizedLayer);
+        pathRepresentation, OUString(), canonicRepresentation, path, 
finalizedLayer);
 }
 
 rtl::Reference< Node > Components::getTemplate(OUString const & fullName) const
@@ -308,7 +308,7 @@ void Components::insertExtensionXcsFile(
 {
     int layer = getExtensionLayer(shared);
     try {
-        parseXcsFile(fileUri, layer, data_, nullptr, nullptr, nullptr);
+        parseXcsFile(fileUri, layer, data_, nullptr, nullptr, nullptr, 
OUString());
     } catch (css::container::NoSuchElementException & e) {
         throw css::uno::RuntimeException(
             "insertExtensionXcsFile does not exist: " + e.Message);
@@ -322,7 +322,7 @@ void Components::insertExtensionXcuFile(
     int layer = getExtensionLayer(shared) + 1;
     Additions * adds = data_.addExtensionXcuAdditions(fileUri, layer);
     try {
-        parseXcuFile(fileUri, layer, data_, nullptr, modifications, adds);
+        parseXcuFile(fileUri, layer, data_, nullptr, modifications, adds, 
OUString());
     } catch (css::container::NoSuchElementException & e) {
         data_.removeExtensionXcuAdditions(fileUri);
         throw css::uno::RuntimeException(
@@ -384,7 +384,7 @@ void Components::removeExtensionXcuFile(
 }
 
 void Components::insertModificationXcuFile(
-    OUString const & fileUri,
+    OUString const & fileUri, OUString const & oldProductName,
     std::set< OUString > const & includedPaths,
     std::set< OUString > const & excludedPaths,
     Modifications * modifications)
@@ -393,7 +393,7 @@ void Components::insertModificationXcuFile(
     Partial part(includedPaths, excludedPaths);
     try {
         parseFileLeniently(
-            &parseXcuFile, fileUri, Data::NO_LAYER, &part, modifications, 
nullptr);
+            &parseXcuFile, fileUri, Data::NO_LAYER, &part, modifications, 
nullptr, oldProductName);
     } catch (const css::container::NoSuchElementException &) {
         TOOLS_WARN_EXCEPTION(
             "configmgr",
@@ -552,7 +552,7 @@ Components::Components(
             }
             OUString aTempFileURL;
             if (dumpWindowsRegistry(&aTempFileURL, eType)) {
-                parseFileLeniently(&parseXcuFile, aTempFileURL, layer, 
nullptr, nullptr, nullptr);
+                parseFileLeniently(&parseXcuFile, aTempFileURL, layer, 
nullptr, nullptr, nullptr, OUString());
                 if (!getenv("SAL_CONFIG_WINREG_RETAIN_TMP"))
                     osl::File::remove(aTempFileURL);
             }
@@ -644,11 +644,11 @@ Components::~Components()
 void Components::parseFileLeniently(
     FileParser * parseFile, OUString const & url, int layer,
     Partial const * partial, Modifications * modifications,
-    Additions * additions)
+    Additions * additions, OUString const & oldProductName)
 {
     assert(parseFile != nullptr);
     try {
-        (*parseFile)(url, layer, data_, partial, modifications, additions);
+        (*parseFile)(url, layer, data_, partial, modifications, additions, 
oldProductName);
     } catch (const css::container::NoSuchElementException &) {
         throw;
     } catch (const css::uno::Exception &) { //TODO: more specific exception 
catching
@@ -701,7 +701,7 @@ void Components::parseFiles(
             if (file.endsWith(extension)) {
                 try {
                     parseFileLeniently(
-                        parseFile, stat.getFileURL(), layer, nullptr, nullptr, 
nullptr);
+                        parseFile, stat.getFileURL(), layer, nullptr, nullptr, 
nullptr, OUString());
                 } catch (css::container::NoSuchElementException & e) {
                     if (stat.getFileType() == osl::FileStatus::Link) {
                         SAL_WARN("configmgr", "dangling link <" << 
stat.getFileURL() << ">");
@@ -727,7 +727,7 @@ void Components::parseFileList(
                 adds = data_.addExtensionXcuAdditions(url, layer);
             }
             try {
-                parseFileLeniently(parseFile, url, layer, nullptr, nullptr, 
adds);
+                parseFileLeniently(parseFile, url, layer, nullptr, nullptr, 
adds, OUString());
             } catch (const css::container::NoSuchElementException &) {
                 TOOLS_WARN_EXCEPTION("configmgr", "file does not exist");
                 if (adds != nullptr) {
@@ -780,7 +780,7 @@ void Components::parseXcdFiles(int layer, OUString const & 
url) {
                 rtl::Reference< ParseManager > manager;
                 try {
                     manager = new ParseManager(
-                        stat.getFileURL(),
+                        stat.getFileURL(), OUString(),
                         new XcdParser(layer, processedDeps, data_));
                 } catch (css::container::NoSuchElementException & e) {
                     if (stat.getFileType() == osl::FileStatus::Link) {
@@ -868,7 +868,7 @@ void Components::parseResLayer(int layer, OUString const & 
url) {
 
 void Components::parseModificationLayer(int layer, OUString const & url) {
     try {
-        parseFileLeniently(&parseXcuFile, url, layer, nullptr, nullptr, 
nullptr);
+        parseFileLeniently(&parseXcuFile, url, layer, nullptr, nullptr, 
nullptr, OUString());
     } catch (css::container::NoSuchElementException &) {
         SAL_INFO(
             "configmgr", "user registrymodifications.xcu does not (yet) 
exist");
diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx
index dc64d3c995a3..0dfb4bca8c5d 100644
--- a/configmgr/source/components.hxx
+++ b/configmgr/source/components.hxx
@@ -91,6 +91,7 @@ public:
 
     void insertModificationXcuFile(
         OUString const & fileUri,
+        OUString const & oldProductName,
         std::set< OUString > const & includedPaths,
         std::set< OUString > const & excludedPaths,
         Modifications * modifications);
@@ -104,7 +105,7 @@ private:
 
     typedef void FileParser(
         OUString const &, int, Data &, Partial const *, Modifications *,
-        Additions *);
+        Additions *, OUString const &);
 public:
     explicit Components(
         css::uno::Reference< css::uno::XComponentContext > const & context);
@@ -115,7 +116,7 @@ private:
     void parseFileLeniently(
         FileParser * parseFile, OUString const & url, int layer,
         Partial const * partial, Modifications * modifications,
-        Additions * additions);
+        Additions * additions, OUString const & oldProductName);
 
     void parseFiles(
         int layer, OUString const & extension, FileParser * parseFile,
diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx
index 4f91d3b25612..5eac69345f03 100644
--- a/configmgr/source/data.cxx
+++ b/configmgr/source/data.cxx
@@ -23,6 +23,7 @@
 #include <cassert>
 
 #include <com/sun/star/uno/RuntimeException.hpp>
+#include <officecfg/Setup.hxx>
 #include <rtl/ref.hxx>
 #include <rtl/string.h>
 #include <rtl/ustrbuf.hxx>
@@ -177,7 +178,7 @@ bool Data::equalTemplateNames(
 Data::Data(): root_(new RootNode) {}
 
 rtl::Reference< Node > Data::resolvePathRepresentation(
-    OUString const & pathRepresentation,
+    OUString const & pathRepresentation, OUString const & oldProductName,
     OUString * canonicRepresentation, std::vector<OUString> * path, int * 
finalizedLayer)
     const
 {
@@ -247,6 +248,21 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
             throw css::uno::RuntimeException(
                 "bad path " + pathRepresentation);
         }
+        // The name of the product name related color schemes need to be 
replaced
+        // with the new product name during migration.
+        if (path != nullptr && path->back() == "ColorSchemes")
+        {
+            OUString aDarkTheme = " Dark";
+            if (seg.equals(oldProductName))
+            {
+                seg = officecfg::Setup::Product::ooName::get();
+            }
+            else if (seg.equals(oldProductName + aDarkTheme))
+            {
+                seg = officecfg::Setup::Product::ooName::get() + aDarkTheme;
+            }
+        }
+
         // For backwards compatibility, allow set members to be accessed with
         // simple path segments, like group members:
         p = p->getMember(seg);
diff --git a/configmgr/source/data.hxx b/configmgr/source/data.hxx
index 315fe7b9bf47..ddfc4daeb95c 100644
--- a/configmgr/source/data.hxx
+++ b/configmgr/source/data.hxx
@@ -68,8 +68,8 @@ struct Data {
     Data();
 
     rtl::Reference< Node > resolvePathRepresentation(
-        OUString const & pathRepresentation,
-        OUString * canonicRepresenation, std::vector<OUString> * path, int * 
finalizedLayer)
+        OUString const & pathRepresentation, OUString const & oldProductName,
+        OUString * canonicRepresentation, std::vector<OUString> * path, int * 
finalizedLayer)
         const;
 
     rtl::Reference< Node > getTemplate(
diff --git a/configmgr/source/parsemanager.cxx 
b/configmgr/source/parsemanager.cxx
index 36dea373dca1..fbce29f74459 100644
--- a/configmgr/source/parsemanager.cxx
+++ b/configmgr/source/parsemanager.cxx
@@ -33,8 +33,8 @@
 namespace configmgr {
 
 ParseManager::ParseManager(
-    OUString const & url, rtl::Reference< Parser > const & parser)
-   : reader_(url), parser_(parser), itemNamespaceId_(-1)
+    OUString const & url, OUString const & oldProductName, rtl::Reference< 
Parser > const & parser)
+   : reader_(url), oldProductName_(oldProductName), parser_(parser), 
itemNamespaceId_(-1)
 {
     assert(parser.is());
     int id;
@@ -64,7 +64,7 @@ bool ParseManager::parse(std::set< OUString > const * 
existingDependencies) {
         {
         case xmlreader::XmlReader::Result::Begin:
             if (!parser_->startElement(
-                    reader_, itemNamespaceId_, itemData_, 
existingDependencies))
+                    reader_, oldProductName_, itemNamespaceId_, itemData_, 
existingDependencies))
             {
                 SAL_INFO("configmgr", "parsing " << reader_.getUrl() << " took 
" << (osl_getGlobalTimer() - startTime) << " ms, fail");
                 return false;
diff --git a/configmgr/source/parsemanager.hxx 
b/configmgr/source/parsemanager.hxx
index 86eb2db5ac9f..b6c8fca4151a 100644
--- a/configmgr/source/parsemanager.hxx
+++ b/configmgr/source/parsemanager.hxx
@@ -37,7 +37,7 @@ class Parser;
 class ParseManager: public salhelper::SimpleReferenceObject {
 public:
     ParseManager(
-        OUString const & url, rtl::Reference< Parser > const & parser);
+        OUString const & url, OUString const & oldProductName, rtl::Reference< 
Parser > const & parser);
 
     bool parse(std::set< OUString > const * existingDependencies);
 
@@ -47,6 +47,7 @@ private:
     virtual ~ParseManager() override;
 
     xmlreader::XmlReader reader_;
+    OUString oldProductName_;
     rtl::Reference< Parser > parser_;
     xmlreader::Span itemData_;
     int itemNamespaceId_;
diff --git a/configmgr/source/parser.hxx b/configmgr/source/parser.hxx
index de57d4783381..1b8693e2e070 100644
--- a/configmgr/source/parser.hxx
+++ b/configmgr/source/parser.hxx
@@ -36,8 +36,8 @@ public:
     virtual xmlreader::XmlReader::Text getTextMode() = 0;
 
     virtual bool startElement(
-        xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name,
-        std::set< OUString > const * existingDependencies) = 0;
+        xmlreader::XmlReader & reader, OUString const & oldProductName, int 
nsId,
+        xmlreader::Span const & name, std::set< OUString > const * 
existingDependencies) = 0;
 
     virtual void endElement(xmlreader::XmlReader const & reader) = 0;
 
diff --git a/configmgr/source/update.cxx b/configmgr/source/update.cxx
index 046fea4b0285..683ef9c22a6f 100644
--- a/configmgr/source/update.cxx
+++ b/configmgr/source/update.cxx
@@ -78,6 +78,7 @@ private:
 
     virtual void SAL_CALL insertModificationXcuFile(
         OUString const & fileUri,
+        OUString const & oldProductName,
         css::uno::Sequence< OUString > const & includedPaths,
         css::uno::Sequence< OUString > const & excludedPaths) override;
 
@@ -123,6 +124,7 @@ void Service::removeExtensionXcuFile(OUString const & 
fileUri)
 
 void Service::insertModificationXcuFile(
     OUString const & fileUri,
+    OUString const & oldProductName,
     css::uno::Sequence< OUString > const & includedPaths,
     css::uno::Sequence< OUString > const & excludedPaths)
 {
@@ -132,7 +134,7 @@ void Service::insertModificationXcuFile(
         Components & components = Components::getSingleton(context_);
         Modifications mods;
         components.insertModificationXcuFile(
-            fileUri, seqToSet(includedPaths), seqToSet(excludedPaths), &mods);
+            fileUri, oldProductName, seqToSet(includedPaths), 
seqToSet(excludedPaths), &mods);
         components.initGlobalBroadcaster(
             mods, rtl::Reference< RootAccess >(), &bc);
     }
diff --git a/configmgr/source/xcdparser.cxx b/configmgr/source/xcdparser.cxx
index a069c6b99c6f..bd4be2de7482 100644
--- a/configmgr/source/xcdparser.cxx
+++ b/configmgr/source/xcdparser.cxx
@@ -50,14 +50,14 @@ xmlreader::XmlReader::Text XcdParser::getTextMode() {
 }
 
 bool XcdParser::startElement(
-    xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name,
+    xmlreader::XmlReader & reader, OUString const & oldProductName, int nsId, 
xmlreader::Span const & name,
     std::set< OUString > const * existingDependencies)
 {
     if (nestedParser_.is()) {
         assert(nesting_ != LONG_MAX);
         ++nesting_;
         return nestedParser_->startElement(
-            reader, nsId, name, existingDependencies);
+            reader, oldProductName, nsId, name, existingDependencies);
     }
     switch (state_) {
     case STATE_START:
@@ -123,7 +123,7 @@ bool XcdParser::startElement(
             nestedParser_ = new XcsParser(layer_, data_);
             nesting_ = 1;
             return nestedParser_->startElement(
-                reader, nsId, name, existingDependencies);
+                reader, oldProductName, nsId, name, existingDependencies);
         }
         if (nsId == ParseManager::NAMESPACE_OOR &&
             (name == "component-data" || name == "items"))
@@ -131,7 +131,7 @@ bool XcdParser::startElement(
             nestedParser_ = new XcuParser(layer_ + 1, data_, nullptr, nullptr, 
nullptr);
             nesting_ = 1;
             return nestedParser_->startElement(
-                reader, nsId, name, existingDependencies);
+                reader, oldProductName, nsId, name, existingDependencies);
         }
         break;
     default: // STATE_DEPENDENCY
diff --git a/configmgr/source/xcdparser.hxx b/configmgr/source/xcdparser.hxx
index c51bd6368136..5141b0ba734c 100644
--- a/configmgr/source/xcdparser.hxx
+++ b/configmgr/source/xcdparser.hxx
@@ -48,7 +48,7 @@ private:
     virtual xmlreader::XmlReader::Text getTextMode() override;
 
     virtual bool startElement(
-        xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name,
+        xmlreader::XmlReader & reader, OUString const & oldProductName, int 
nsId, xmlreader::Span const & name,
         std::set< OUString > const * existingDependencies) override;
 
     virtual void endElement(xmlreader::XmlReader const & reader) override;
diff --git a/configmgr/source/xcsparser.cxx b/configmgr/source/xcsparser.cxx
index 7b1750b20972..5acd87393567 100644
--- a/configmgr/source/xcsparser.cxx
+++ b/configmgr/source/xcsparser.cxx
@@ -119,7 +119,7 @@ xmlreader::XmlReader::Text XcsParser::getTextMode() {
 }
 
 bool XcsParser::startElement(
-    xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name,
+    xmlreader::XmlReader & reader, OUString const & /*oldProductName*/, int 
nsId, xmlreader::Span const & name,
     std::set< OUString > const * /*existingDependencies*/)
 {
     if (valueParser_.startElement(reader, nsId, name)) {
diff --git a/configmgr/source/xcsparser.hxx b/configmgr/source/xcsparser.hxx
index d662ff47bbed..9b90555e45a8 100644
--- a/configmgr/source/xcsparser.hxx
+++ b/configmgr/source/xcsparser.hxx
@@ -50,7 +50,7 @@ private:
     virtual xmlreader::XmlReader::Text getTextMode() override;
 
     virtual bool startElement(
-        xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name,
+        xmlreader::XmlReader & reader, OUString const & /*oldProductName*/, 
int nsId, xmlreader::Span const & name,
         std::set< OUString > const * existingDependencies) override;
 
     virtual void endElement(xmlreader::XmlReader const & reader) override;
diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx
index 03e3c60ab067..b6bdd4200d61 100644
--- a/configmgr/source/xcuparser.cxx
+++ b/configmgr/source/xcuparser.cxx
@@ -67,7 +67,7 @@ xmlreader::XmlReader::Text XcuParser::getTextMode() {
 }
 
 bool XcuParser::startElement(
-    xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name,
+    xmlreader::XmlReader & reader, OUString const & oldProductName, int nsId, 
xmlreader::Span const & name,
     std::set< OUString > const * /*existingDependencies*/)
 {
     if (valueParser_.startElement(reader, nsId, name)) {
@@ -95,7 +95,7 @@ bool XcuParser::startElement(
                 "bad items node member <" + name.convertFromUtf8() + "> in " +
                 reader.getUrl());
         }
-        handleItem(reader);
+        handleItem(reader, oldProductName);
     } else {
         switch (state_.top().node->kind()) {
         case Node::KIND_PROPERTY:
@@ -312,7 +312,7 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & 
reader) {
     state_.push(State::Modify(node));
 }
 
-void XcuParser::handleItem(xmlreader::XmlReader & reader) {
+void XcuParser::handleItem(xmlreader::XmlReader & reader, OUString const & 
oldProductName) {
     xmlreader::Span attrPath;
     for (;;) {
         int attrNsId;
@@ -332,7 +332,7 @@ void XcuParser::handleItem(xmlreader::XmlReader & reader) {
     int finalizedLayer;
     rtl::Reference< Node > node(
         data_.resolvePathRepresentation(
-            path, nullptr, &path_, &finalizedLayer));
+            path, oldProductName, nullptr, &path_, &finalizedLayer));
     if (!node.is()) {
         SAL_WARN(
             "configmgr",
diff --git a/configmgr/source/xcuparser.hxx b/configmgr/source/xcuparser.hxx
index 3e3544385634..15a566f8336d 100644
--- a/configmgr/source/xcuparser.hxx
+++ b/configmgr/source/xcuparser.hxx
@@ -60,7 +60,7 @@ private:
     virtual xmlreader::XmlReader::Text getTextMode() override;
 
     virtual bool startElement(
-        xmlreader::XmlReader & reader, int nsId, xmlreader::Span const & name,
+        xmlreader::XmlReader & reader, OUString const & oldProductName, int 
nsId, xmlreader::Span const & name,
         std::set< OUString > const * existingDependencies) override;
 
     virtual void endElement(xmlreader::XmlReader const & reader) override;
@@ -74,7 +74,7 @@ private:
 
     void handleComponentData(xmlreader::XmlReader & reader);
 
-    void handleItem(xmlreader::XmlReader & reader);
+    void handleItem(xmlreader::XmlReader & reader, OUString const & 
oldProductName);
 
     void handlePropValue(xmlreader::XmlReader & reader, PropertyNode * prop);
 
diff --git a/desktop/source/migration/migration.cxx 
b/desktop/source/migration/migration.cxx
index be21788c40d1..c36780a1c229 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -689,6 +689,10 @@ void MigrationImpl::copyConfig()
     // check if the shared registrymodifications.xcu file exists
     bool bRegistryModificationsXcuExists = false;
     OUString regFilePath = m_aInfo.userdata + 
"/user/registrymodifications.xcu";
+    OUString sMigratedProductName = m_aInfo.productname;
+    // remove version number from the end of pruduct name if exist
+    if (isdigit(sMigratedProductName[sMigratedProductName.getLength() - 1]))
+        sMigratedProductName = (sMigratedProductName.copy(0, 
m_aInfo.productname.getLength() - 1)).trim();
     File regFile(regFilePath);
     ::osl::FileBase::RC nError = regFile.open(osl_File_OpenFlag_Read);
     if ( nError == ::osl::FileBase::E_None ) {
@@ -726,14 +730,41 @@ void MigrationImpl::copyConfig()
                 comphelper::getProcessComponentContext())->
             insertModificationXcuFile(
                 regFilePath,
+                sMigratedProductName,
                 comphelper::containerToSequence(comp.second.includedPaths),
                 comphelper::containerToSequence(comp.second.excludedPaths));
+
         } else {
             SAL_INFO( "desktop.migration", "configuration migration component 
" << comp.first << " ignored (only excludes, no includes)" );
         }
 next:
         ;
     }
+    // checking the migrated (product name related) color scheme name, and 
replace it to the current version scheme name
+    try
+    {
+        OUString sMigratedColorScheme;
+        uno::Reference<XPropertySet> aPropertySet(
+            getConfigAccess("org.openoffice.Office.UI/ColorScheme", true), 
uno::UNO_QUERY_THROW);
+        if (aPropertySet->getPropertyValue("CurrentColorScheme") >>= 
sMigratedColorScheme)
+        {
+            OUString aDarkTheme = " Dark";
+            if (sMigratedColorScheme.equals(sMigratedProductName))
+            {
+                aPropertySet->setPropertyValue("CurrentColorScheme",
+                                               
uno::Any(utl::ConfigManager::getProductName()));
+                uno::Reference<XChangesBatch>(aPropertySet, 
uno::UNO_QUERY_THROW)->commitChanges();
+            }
+            else if (sMigratedColorScheme.equals(sMigratedProductName + 
aDarkTheme))
+            {
+                aPropertySet->setPropertyValue("CurrentColorScheme",
+                                               
uno::Any(utl::ConfigManager::getProductName() + aDarkTheme));
+                uno::Reference<XChangesBatch>(aPropertySet, 
uno::UNO_QUERY_THROW)->commitChanges();
+            }
+        }
+    } catch (const Exception&) {
+        // fail silently...
+    }
 }
 
 uno::Reference< XNameAccess > MigrationImpl::getConfigAccess(const sal_Char* 
pPath, bool bUpdate)
diff --git a/offapi/com/sun/star/configuration/XUpdate.idl 
b/offapi/com/sun/star/configuration/XUpdate.idl
index 90862b112944..c58cabced7b1 100644
--- a/offapi/com/sun/star/configuration/XUpdate.idl
+++ b/offapi/com/sun/star/configuration/XUpdate.idl
@@ -40,8 +40,8 @@ interface XUpdate {
         // argument
 
     void insertModificationXcuFile(
-        [in] string fileUri, [in] sequence< string > includedPaths,
-        [in] sequence< string > excludedPaths);
+        [in] string fileUri, [in] string oldProductName,
+        [in] sequence< string > includedPaths, [in] sequence< string > 
excludedPaths);
 };
 
 }; }; }; };

Reply via email to