[Libreoffice-commits] core.git: 4 commits - officecfg/registry sc/inc sc/source sc/uiconfig

Tor Lillqvist tml at collabora.com
Fri Nov 7 08:45:13 PST 2014


 officecfg/registry/schema/org/openoffice/Office/Calc.xcs |    2 
 sc/inc/calcconfig.hxx                                    |   70 ++++-
 sc/source/core/tool/calcconfig.cxx                       |   44 ++-
 sc/source/core/tool/formulaopt.cxx                       |   62 +++-
 sc/source/ui/optdlg/calcoptionsdlg.cxx                   |  197 ++++++++++-----
 sc/source/ui/optdlg/calcoptionsdlg.hxx                   |   22 +
 sc/uiconfig/scalc/ui/formulacalculationoptions.ui        |   22 -
 7 files changed, 300 insertions(+), 119 deletions(-)

New commits:
commit d156dd493c089ebe953348b3ae3668b233701fda
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Nov 7 17:35:52 2014 +0200

    Update the white or black list when editing an entry
    
    Must be careful to re-select the logically same entry even after it actually
    has been removed and the edited on inserted.
    
    Change-Id: Id19f7845fadbc018affab7a6cb6b421ed9170297

diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 8140eef..051cd98 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -308,19 +308,23 @@ void ScCalcOptionsDialog::fillOpenCLList()
 
 namespace {
 
-    void fillListBox(ListBox* pListBox, const ScCalcConfig::OpenCLImplSet& rSet)
+OUString format(const ScCalcConfig::OpenCLImpl& rImpl)
+{
+    return (rImpl.maOS + " " +
+            rImpl.maOSVersion + " " +
+            rImpl.maPlatformVendor + " " +
+            rImpl.maDevice + " " +
+            rImpl.maDriverVersion);
+}
+
+void fillListBox(ListBox* pListBox, const ScCalcConfig::OpenCLImplSet& rSet)
 {
     pListBox->SetUpdateMode(false);
     pListBox->Clear();
 
     for (auto i = rSet.cbegin(); i != rSet.cend(); ++i)
     {
-        pListBox->InsertEntry((*i).maOS + " " +
-                              (*i).maOSVersion + " " +
-                              (*i).maPlatformVendor + " " +
-                              (*i).maDevice + " " +
-                              (*i).maDriverVersion,
-                              LISTBOX_APPEND);
+        pListBox->InsertEntry(format(*i), LISTBOX_APPEND);
     }
 
     pListBox->SetUpdateMode(true);
@@ -799,6 +803,9 @@ void ScCalcOptionsDialog::EditFieldValueChanged(Control *pCtrl)
 
         rSet.erase(impl);
         rSet.insert(newImpl);
+
+        fillListBox(mpOpenCLWhiteAndBlackListBox, rSet);
+        mpOpenCLWhiteAndBlackListBox->SelectEntry(format(newImpl));
     }
 }
 
commit 0485355e05da36f4023b4c594ecb80b342608f5a
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Nov 7 15:08:07 2014 +0200

    Make it possible to actually edit existing white/black list entries
    
    Still not possible to add new ones or delete existing ones, though. And the UI
    for this is not finished at all. Work in progress.
    
    Also some refactoring. To increase readability, introduce typedefs in
    ScCalcConfig. Not sure whether nested types inside the class is a good idea or
    not.
    
    Change-Id: I8e1695bb0594e2cd5f8b5ce0ece075842b77762a

diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx
index 1a4c62c..4b72dc8 100644
--- a/sc/inc/calcconfig.hxx
+++ b/sc/inc/calcconfig.hxx
@@ -101,10 +101,15 @@ struct SC_DLLPUBLIC ScCalcConfig
     bool mbOpenCLAutoSelect:1;
     OUString maOpenCLDevice;
     sal_Int32 mnOpenCLMinimumFormulaGroupSize;
-    std::set<OpCodeEnum> maOpenCLSubsetOpCodes;
 
-    std::set<OpenCLImpl> maOpenCLWhiteList;
-    std::set<OpenCLImpl> maOpenCLBlackList;
+    typedef std::set<OpCodeEnum> OpCodeSet;
+
+    OpCodeSet maOpenCLSubsetOpCodes;
+
+    typedef std::set<OpenCLImpl> OpenCLImplSet;
+
+    OpenCLImplSet maOpenCLWhiteList;
+    OpenCLImplSet maOpenCLBlackList;
 
     ScCalcConfig();
 
@@ -117,11 +122,13 @@ struct SC_DLLPUBLIC ScCalcConfig
     bool operator!= (const ScCalcConfig& r) const;
 };
 
+SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImpl& rImpl);
+SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImplSet& rSet);
 SC_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig& rConfig);
 
-SC_DLLPUBLIC OUString ScOpCodeSetToNumberString(const std::set<OpCodeEnum>& rOpCodes);
-SC_DLLPUBLIC OUString ScOpCodeSetToSymbolicString(const std::set<OpCodeEnum>& rOpCodes);
-SC_DLLPUBLIC std::set<OpCodeEnum> ScStringToOpCodeSet(const OUString& rOpCodes);
+SC_DLLPUBLIC OUString ScOpCodeSetToNumberString(const ScCalcConfig::OpCodeSet& rOpCodes);
+SC_DLLPUBLIC OUString ScOpCodeSetToSymbolicString(const ScCalcConfig::OpCodeSet& rOpCodes);
+SC_DLLPUBLIC ScCalcConfig::OpCodeSet ScStringToOpCodeSet(const OUString& rOpCodes);
 
 #endif
 
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx
index 5fd4aec..583c2a3 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -82,27 +82,32 @@ bool ScCalcConfig::operator!= (const ScCalcConfig& r) const
     return !operator==(r);
 }
 
-namespace {
+std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImpl& rImpl)
+{
+    rStream << "{"
+        "OS=" << rImpl.maOS << ","
+        "OSVersion=" << rImpl.maOSVersion << ","
+        "PlatformVendor=" << rImpl.maPlatformVendor << ","
+        "Device=" << rImpl.maDevice << ","
+        "DriverVersion=" << rImpl.maDriverVersion <<
+        "}";
 
-std::ostream& operator<<(std::ostream& rStream, const std::set<ScCalcConfig::OpenCLImpl>& rSet)
+    return rStream;
+}
+
+std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig::OpenCLImplSet& rSet)
 {
+    rStream << "{";
     for (auto i = rSet.cbegin(); i != rSet.cend(); ++i)
     {
         if (i != rSet.cbegin())
             rStream << ",";
-        rStream << "{"
-            "OS=" << (*i).maOS << ","
-            "OSVersion=" << (*i).maOSVersion << ","
-            "PlatformVendor=" << (*i).maPlatformVendor << ","
-            "Device=" << (*i).maDevice << ","
-            "DriverVersion=" << (*i).maDriverVersion <<
-            "}";
+        rStream << *i;
     }
+    rStream << "}";
     return rStream;
 }
 
-} // anonymous namespace
-
 std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig& rConfig)
 {
     rStream << "{"
@@ -115,8 +120,8 @@ std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig& rConfig)
         "OpenCLDevice='" << rConfig.maOpenCLDevice << "',"
         "OpenCLMinimumFormulaGroupSize=" << rConfig.mnOpenCLMinimumFormulaGroupSize << ","
         "OpenCLSubsetOpCodes={" << ScOpCodeSetToSymbolicString(rConfig.maOpenCLSubsetOpCodes) << "},"
-        "OpenCLWhiteList={" << rConfig.maOpenCLWhiteList << "},"
-        "OpenCLBlackList={" << rConfig.maOpenCLBlackList << "}"
+        "OpenCLWhiteList=" << rConfig.maOpenCLWhiteList << ","
+        "OpenCLBlackList=" << rConfig.maOpenCLBlackList <<
         "}";
     return rStream;
 }
@@ -140,7 +145,7 @@ formula::FormulaCompiler::OpCodeMapPtr setup()
 
 } // anonymous namespace
 
-OUString ScOpCodeSetToNumberString(const std::set<OpCodeEnum>& rOpCodes)
+OUString ScOpCodeSetToNumberString(const ScCalcConfig::OpCodeSet& rOpCodes)
 {
     OUStringBuffer result;
 
@@ -154,7 +159,7 @@ OUString ScOpCodeSetToNumberString(const std::set<OpCodeEnum>& rOpCodes)
     return result.toString();
 }
 
-OUString ScOpCodeSetToSymbolicString(const std::set<OpCodeEnum>& rOpCodes)
+OUString ScOpCodeSetToSymbolicString(const ScCalcConfig::OpCodeSet& rOpCodes)
 {
     OUStringBuffer result;
     formula::FormulaCompiler::OpCodeMapPtr pOpCodeMap(setup());
@@ -172,9 +177,9 @@ OUString ScOpCodeSetToSymbolicString(const std::set<OpCodeEnum>& rOpCodes)
     return result.toString();
 }
 
-std::set<OpCodeEnum> ScStringToOpCodeSet(const OUString& rOpCodes)
+ScCalcConfig::OpCodeSet ScStringToOpCodeSet(const OUString& rOpCodes)
 {
-    std::set<OpCodeEnum> result;
+    ScCalcConfig::OpCodeSet result;
     formula::FormulaCompiler::OpCodeMapPtr pOpCodeMap(setup());
 
     OUString s(rOpCodes + ";");
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 2768b40..8140eef 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -162,6 +162,11 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
 
     mpSpinButton->SetModifyHdl(LINK(this, ScCalcOptionsDialog, NumModifiedHdl));
     mpEditField->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
+    mpOS->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
+    mpOSVersion->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
+    mpPlatformVendor->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
+    mpDevice->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
+    mpDriverVersion->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
 
     mpOpenCLWhiteAndBlackListBox->set_height_request(4* mpOpenCLWhiteAndBlackListBox->GetTextHeight());
     mpOpenCLWhiteAndBlackListBox->SetStyle(mpOpenCLWhiteAndBlackListBox->GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
@@ -303,7 +308,7 @@ void ScCalcOptionsDialog::fillOpenCLList()
 
 namespace {
 
-void fillListBox(ListBox* pListBox, const std::set<ScCalcConfig::OpenCLImpl>& rSet)
+    void fillListBox(ListBox* pListBox, const ScCalcConfig::OpenCLImplSet& rSet)
 {
     pListBox->SetUpdateMode(false);
     pListBox->Clear();
@@ -725,12 +730,76 @@ void ScCalcOptionsDialog::SpinButtonValueChanged()
     maConfig.mnOpenCLMinimumFormulaGroupSize = nVal;
 }
 
-void ScCalcOptionsDialog::EditFieldValueChanged()
+ScCalcConfig::OpenCLImplSet& ScCalcOptionsDialog::CurrentWhiteOrBlackList()
 {
-    // We know that the mpEditField is used for only one thing at the moment,
-    // the OpenCL subset list of opcodes
-    OUString sVal = mpEditField->GetText();
-    maConfig.maOpenCLSubsetOpCodes = ScStringToOpCodeSet(sVal);
+    return (mpLbSettings->GetSelectEntryPos() == CALC_OPTION_OPENCL_WHITELIST ? maConfig.maOpenCLWhiteList : maConfig.maOpenCLBlackList);
+}
+
+const ScCalcConfig::OpenCLImpl& ScCalcOptionsDialog::CurrentWhiteOrBlackListEntry()
+{
+    ScCalcConfig::OpenCLImplSet& rSet(CurrentWhiteOrBlackList());
+
+    auto i = rSet.begin();
+    int n(mpOpenCLWhiteAndBlackListBox->GetSelectEntryPos());
+    while (n && i != rSet.end())
+    {
+        ++i;
+        --n;
+    }
+
+    return *i;
+}
+
+void ScCalcOptionsDialog::EditFieldValueChanged(Control *pCtrl)
+{
+    Edit* pEdit(dynamic_cast<Edit*>(pCtrl));
+
+    assert(pEdit);
+
+    OUString sVal = pEdit->GetText();
+
+    if (pEdit == mpEditField)
+    {
+        // We know that the mpEditField is used for only one thing at the moment,
+        // the OpenCL subset list of opcodes
+        maConfig.maOpenCLSubsetOpCodes = ScStringToOpCodeSet(sVal);
+    }
+    else
+    {
+        // We know that this handler is otherwise currently used only
+        // for the OpenCL white/blacklists
+
+        const ScCalcConfig::OpenCLImpl& impl(CurrentWhiteOrBlackListEntry());
+        ScCalcConfig::OpenCLImpl newImpl(impl);
+
+        if (pEdit == mpOS)
+        {
+            newImpl.maOS = sVal;
+        }
+        else if (pEdit == mpOSVersion)
+        {
+            newImpl.maOSVersion = sVal;
+        }
+        else if (pEdit == mpPlatformVendor)
+        {
+            newImpl.maPlatformVendor = sVal;
+        }
+        else if (pEdit == mpDevice)
+        {
+            newImpl.maDevice = sVal;
+        }
+        else if (pEdit == mpDriverVersion)
+        {
+            newImpl.maDriverVersion = sVal;
+        }
+        else
+            assert(false && "pEdit does not match any of the Edit fields");
+
+        ScCalcConfig::OpenCLImplSet& rSet(CurrentWhiteOrBlackList());
+
+        rSet.erase(impl);
+        rSet.insert(newImpl);
+    }
 }
 
 void ScCalcOptionsDialog::WhiteAndBlackListSelectionChanged()
@@ -814,37 +883,17 @@ IMPL_LINK_NOARG(ScCalcOptionsDialog, NumModifiedHdl)
     return 0;
 }
 
-IMPL_LINK_NOARG(ScCalcOptionsDialog, EditModifiedHdl)
+IMPL_LINK(ScCalcOptionsDialog, EditModifiedHdl, Control*, pCtrl)
 {
-    EditFieldValueChanged();
+    EditFieldValueChanged(pCtrl);
     return 0;
 }
 
-namespace {
-
-template <class T>
-typename T::iterator nth(T container, int n)
-{
-    auto i = container.begin();
-    while (n && i != container.end())
-    {
-        ++i;
-        --n;
-    }
-
-    return i;
-}
-
-} // anonymous namespace
-
 IMPL_LINK(ScCalcOptionsDialog, OpenCLWhiteAndBlackListSelHdl, Control*, )
 {
-    // We know this is called for the mpOpenCLWhiteAndBlackListBox
+    // We know this handler is used for the mpOpenCLWhiteAndBlackListBox
 
-    std::set<ScCalcConfig::OpenCLImpl>
-        &implSet(mpLbSettings->GetSelectEntryPos() == CALC_OPTION_OPENCL_WHITELIST ? maConfig.maOpenCLWhiteList : maConfig.maOpenCLBlackList);
-    sal_uLong n(mpOpenCLWhiteAndBlackListBox->GetSelectEntryPos());
-    const ScCalcConfig::OpenCLImpl& impl(*nth(implSet, n));
+    const ScCalcConfig::OpenCLImpl& impl(CurrentWhiteOrBlackListEntry());
 
     mpOS->SetText(impl.maOS);
     mpOSVersion->SetText(impl.maOSVersion);
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx
index 45d8e58..d8115c2 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.hxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx
@@ -39,7 +39,7 @@ public:
     DECL_LINK( BtnAutomaticSelectHdl, void* );
     DECL_LINK( DeviceSelHdl, void* );
     DECL_LINK( NumModifiedHdl, void * );
-    DECL_LINK( EditModifiedHdl, void * );
+    DECL_LINK( EditModifiedHdl, Control * );
     DECL_LINK( OpenCLWhiteAndBlackListSelHdl, Control* );
 
     const ScCalcConfig& GetConfig() const { return maConfig;}
@@ -52,7 +52,7 @@ private:
     void OpenCLAutomaticSelectionChanged();
     void SelectedDeviceChanged();
     void SpinButtonValueChanged();
-    void EditFieldValueChanged();
+    void EditFieldValueChanged(Control *pCtrl);
     void WhiteAndBlackListSelectionChanged();
 #if HAVE_FEATURE_OPENCL
     void fillOpenCLList();
@@ -64,6 +64,8 @@ private:
     OUString toString(sal_Int32 nVal) const;
     SvTreeListEntry *createItem(const OUString &rCaption, const OUString& sValue) const;
     void     setValueAt(size_t nPos, const OUString &rString);
+    std::set<ScCalcConfig::OpenCLImpl>& CurrentWhiteOrBlackList();
+    const ScCalcConfig::OpenCLImpl& CurrentWhiteOrBlackListEntry();
 
 private:
     SvxCheckListBox* mpLbSettings;
commit 03b4aa438b4a72431044f9fc137804329e5bdf43
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Nov 7 12:03:09 2014 +0200

    Some simplification and refactoring, no functional change
    
    Change-Id: Ie7ba158063dc0c588e114278cedb80e414ccc4cb

diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx
index e051e1d..1a4c62c 100644
--- a/sc/inc/calcconfig.hxx
+++ b/sc/inc/calcconfig.hxx
@@ -41,7 +41,7 @@ struct SC_DLLPUBLIC ScCalcConfig
         STRING_CONVERSION_LOCALE_DEPENDENT  ///<  =1+"1.000" may be 2 or 1001 ... =1+"x" gives #VALUE!
     };
 
-    struct OpenCLImplementationMatcher
+    struct OpenCLImpl
     {
         OUString maOS;
         OUString maOSVersion;
@@ -49,15 +49,15 @@ struct SC_DLLPUBLIC ScCalcConfig
         OUString maDevice;
         OUString maDriverVersion;
 
-        OpenCLImplementationMatcher()
+        OpenCLImpl()
         {
         }
 
-        OpenCLImplementationMatcher(const OUString& rOS,
-                                    const OUString& rOSVersion,
-                                    const OUString& rPlatformVendor,
-                                    const OUString& rDevice,
-                                    const OUString& rDriverVersion)
+        OpenCLImpl(const OUString& rOS,
+                   const OUString& rOSVersion,
+                   const OUString& rPlatformVendor,
+                   const OUString& rDevice,
+                   const OUString& rDriverVersion)
             : maOS(rOS),
               maOSVersion(rOSVersion),
               maPlatformVendor(rPlatformVendor),
@@ -66,7 +66,7 @@ struct SC_DLLPUBLIC ScCalcConfig
         {
         }
 
-        bool operator==(const OpenCLImplementationMatcher& r) const
+        bool operator==(const OpenCLImpl& r) const
         {
             return maOS == r.maOS &&
                    maOSVersion == r.maOSVersion &&
@@ -74,11 +74,11 @@ struct SC_DLLPUBLIC ScCalcConfig
                    maDevice == r.maDevice &&
                    maDriverVersion == r.maDriverVersion;
         }
-        bool operator!=(const OpenCLImplementationMatcher& r) const
+        bool operator!=(const OpenCLImpl& r) const
         {
             return !operator==(r);
         }
-        bool operator<(const OpenCLImplementationMatcher& r) const
+        bool operator<(const OpenCLImpl& r) const
         {
             return (maOS < r.maOS ||
                     (maOS == r.maOS &&
@@ -103,8 +103,8 @@ struct SC_DLLPUBLIC ScCalcConfig
     sal_Int32 mnOpenCLMinimumFormulaGroupSize;
     std::set<OpCodeEnum> maOpenCLSubsetOpCodes;
 
-    std::set<OpenCLImplementationMatcher> maOpenCLWhiteList;
-    std::set<OpenCLImplementationMatcher> maOpenCLBlackList;
+    std::set<OpenCLImpl> maOpenCLWhiteList;
+    std::set<OpenCLImpl> maOpenCLBlackList;
 
     ScCalcConfig();
 
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx
index 8b7e58a..5fd4aec 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -44,8 +44,8 @@ void ScCalcConfig::setOpenCLConfigToDefault()
     maOpenCLSubsetOpCodes.insert(ocSum);
     maOpenCLSubsetOpCodes.insert(ocAverage);
     maOpenCLSubsetOpCodes.insert(ocSumIfs);
-    maOpenCLBlackList.insert(OpenCLImplementationMatcher("Windows", "*", "Intel(R) Corporation", "*", "9.17.10.2884"));
-    maOpenCLBlackList.insert(OpenCLImplementationMatcher("SuperOS", "*", "Big Corp, Inc.", "Whizz\\Grafix", "4.2/beta;3"));
+    maOpenCLBlackList.insert(OpenCLImpl("Windows", "*", "Intel(R) Corporation", "*", "9.17.10.2884"));
+    maOpenCLBlackList.insert(OpenCLImpl("SuperOS", "*", "Big Corp, Inc.", "Whizz\\Grafix", "4.2/beta;3"));
 }
 
 void ScCalcConfig::reset()
@@ -84,7 +84,7 @@ bool ScCalcConfig::operator!= (const ScCalcConfig& r) const
 
 namespace {
 
-void writeOpenCLImplementationMatcher(std::ostream& rStream, const std::set<ScCalcConfig::OpenCLImplementationMatcher>& rSet)
+std::ostream& operator<<(std::ostream& rStream, const std::set<ScCalcConfig::OpenCLImpl>& rSet)
 {
     for (auto i = rSet.cbegin(); i != rSet.cend(); ++i)
     {
@@ -98,6 +98,7 @@ void writeOpenCLImplementationMatcher(std::ostream& rStream, const std::set<ScCa
             "DriverVersion=" << (*i).maDriverVersion <<
             "}";
     }
+    return rStream;
 }
 
 } // anonymous namespace
@@ -114,12 +115,8 @@ std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig& rConfig)
         "OpenCLDevice='" << rConfig.maOpenCLDevice << "',"
         "OpenCLMinimumFormulaGroupSize=" << rConfig.mnOpenCLMinimumFormulaGroupSize << ","
         "OpenCLSubsetOpCodes={" << ScOpCodeSetToSymbolicString(rConfig.maOpenCLSubsetOpCodes) << "},"
-        "OpenCLWhiteList={";
-    writeOpenCLImplementationMatcher(rStream, rConfig.maOpenCLWhiteList);
-    rStream << "},"
-        "OpenCLBlackList={";
-    writeOpenCLImplementationMatcher(rStream, rConfig.maOpenCLBlackList);
-    rStream << "}"
+        "OpenCLWhiteList={" << rConfig.maOpenCLWhiteList << "},"
+        "OpenCLBlackList={" << rConfig.maOpenCLBlackList << "}"
         "}";
     return rStream;
 }
diff --git a/sc/source/core/tool/formulaopt.cxx b/sc/source/core/tool/formulaopt.cxx
index 9661b49..bcf7282 100644
--- a/sc/source/core/tool/formulaopt.cxx
+++ b/sc/source/core/tool/formulaopt.cxx
@@ -280,7 +280,7 @@ ScFormulaCfg::ScFormulaCfg() :
 
 namespace {
 
-css::uno::Sequence<OUString> SetOfOpenCLImplementationMatcherToStringSequence(std::set<ScCalcConfig::OpenCLImplementationMatcher>& rSet)
+css::uno::Sequence<OUString> SetOfOpenCLImplToStringSequence(std::set<ScCalcConfig::OpenCLImpl>& rSet)
 {
     css::uno::Sequence<OUString> result(rSet.size());
 
@@ -323,13 +323,13 @@ OUString getToken(const OUString& string, sal_Int32& index)
     return result;
 }
 
-std::set<ScCalcConfig::OpenCLImplementationMatcher> StringSequenceToSetOfOpenCLImplementationMatcher(css::uno::Sequence<OUString>& rSequence)
+std::set<ScCalcConfig::OpenCLImpl> StringSequenceToSetOfOpenCLImpl(css::uno::Sequence<OUString>& rSequence)
 {
-    std::set<ScCalcConfig::OpenCLImplementationMatcher> result;
+    std::set<ScCalcConfig::OpenCLImpl> result;
 
     for (auto i = rSequence.begin(); i != rSequence.end(); ++i)
     {
-        ScCalcConfig::OpenCLImplementationMatcher m;
+        ScCalcConfig::OpenCLImpl m;
         sal_Int32 index(0);
         m.maOS = getToken(*i, index);
         m.maOSVersion = getToken(*i, index);
@@ -589,16 +589,16 @@ void ScFormulaCfg::UpdateFromProperties( const Sequence<OUString>& aNames )
                 break;
                 case SCFORMULAOPT_OPENCL_WHITELIST:
                 {
-                    css::uno::Sequence<OUString> sVal = SetOfOpenCLImplementationMatcherToStringSequence(GetCalcConfig().maOpenCLWhiteList);
+                    css::uno::Sequence<OUString> sVal = SetOfOpenCLImplToStringSequence(GetCalcConfig().maOpenCLWhiteList);
                     pValues[nProp] >>= sVal;
-                    GetCalcConfig().maOpenCLWhiteList = StringSequenceToSetOfOpenCLImplementationMatcher(sVal);
+                    GetCalcConfig().maOpenCLWhiteList = StringSequenceToSetOfOpenCLImpl(sVal);
                 }
                 break;
                 case SCFORMULAOPT_OPENCL_BLACKLIST:
                 {
-                    css::uno::Sequence<OUString> sVal = SetOfOpenCLImplementationMatcherToStringSequence(GetCalcConfig().maOpenCLBlackList);
+                    css::uno::Sequence<OUString> sVal = SetOfOpenCLImplToStringSequence(GetCalcConfig().maOpenCLBlackList);
                     pValues[nProp] >>= sVal;
-                    GetCalcConfig().maOpenCLBlackList = StringSequenceToSetOfOpenCLImplementationMatcher(sVal);
+                    GetCalcConfig().maOpenCLBlackList = StringSequenceToSetOfOpenCLImpl(sVal);
                 }
                 break;
                 }
@@ -756,13 +756,13 @@ void ScFormulaCfg::Commit()
             break;
             case SCFORMULAOPT_OPENCL_WHITELIST:
             {
-                css::uno::Sequence<OUString> sVal = SetOfOpenCLImplementationMatcherToStringSequence(GetCalcConfig().maOpenCLWhiteList);
+                css::uno::Sequence<OUString> sVal = SetOfOpenCLImplToStringSequence(GetCalcConfig().maOpenCLWhiteList);
                 pValues[nProp] <<= sVal;
             }
             break;
             case SCFORMULAOPT_OPENCL_BLACKLIST:
             {
-                css::uno::Sequence<OUString> sVal = SetOfOpenCLImplementationMatcherToStringSequence(GetCalcConfig().maOpenCLBlackList);
+                css::uno::Sequence<OUString> sVal = SetOfOpenCLImplToStringSequence(GetCalcConfig().maOpenCLBlackList);
                 pValues[nProp] <<= sVal;
             }
             break;
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 9551f16..2768b40 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -231,27 +231,7 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
 
 ScCalcOptionsDialog::~ScCalcOptionsDialog() {}
 
-SvTreeListEntry *ScCalcOptionsDialog::createBoolItem(const OUString &rCaption, bool bValue) const
-{
-    SvTreeListEntry* pEntry = new SvTreeListEntry;
-    pEntry->AddItem(new SvLBoxString(pEntry, 0, OUString()));
-    pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, Image(), Image(), false));
-    OptionString* pItem = new OptionString(rCaption, toString(bValue));
-    pEntry->AddItem(pItem);
-    return pEntry;
-}
-
-SvTreeListEntry *ScCalcOptionsDialog::createIntegerItem(const OUString &rCaption, sal_Int32 nValue) const
-{
-    SvTreeListEntry* pEntry = new SvTreeListEntry;
-    pEntry->AddItem(new SvLBoxString(pEntry, 0, OUString()));
-    pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, Image(), Image(), false));
-    OptionString* pItem = new OptionString(rCaption, toString(nValue));
-    pEntry->AddItem(pItem);
-    return pEntry;
-}
-
-SvTreeListEntry *ScCalcOptionsDialog::createStringItem(const OUString &rCaption, const OUString& sValue) const
+SvTreeListEntry *ScCalcOptionsDialog::createItem(const OUString &rCaption, const OUString& sValue) const
 {
     SvTreeListEntry* pEntry = new SvTreeListEntry;
     pEntry->AddItem(new SvLBoxString(pEntry, 0, OUString()));
@@ -261,16 +241,6 @@ SvTreeListEntry *ScCalcOptionsDialog::createStringItem(const OUString &rCaption,
     return pEntry;
 }
 
-SvTreeListEntry *ScCalcOptionsDialog::createStringListItem(const OUString &rCaption) const
-{
-    SvTreeListEntry* pEntry = new SvTreeListEntry;
-    pEntry->AddItem(new SvLBoxString(pEntry, 0, OUString()));
-    pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, Image(), Image(), false));
-    OptionString* pItem = new OptionString(rCaption, "");
-    pEntry->AddItem(pItem);
-    return pEntry;
-}
-
 void ScCalcOptionsDialog::setValueAt(size_t nPos, const OUString &rValue)
 {
     SvTreeList *pModel = mpLbSettings->GetModel();
@@ -333,7 +303,7 @@ void ScCalcOptionsDialog::fillOpenCLList()
 
 namespace {
 
-void fillListBox(ListBox* pListBox, const std::set<ScCalcConfig::OpenCLImplementationMatcher>& rSet)
+void fillListBox(ListBox* pListBox, const std::set<ScCalcConfig::OpenCLImpl>& rSet)
 {
     pListBox->SetUpdateMode(false);
     pListBox->Clear();
@@ -380,7 +350,7 @@ void ScCalcOptionsDialog::FillOptionsList()
         addOption( pModel, pItem);
     }
 
-    pModel->Insert(createBoolItem(maCaptionEmptyStringAsZero,maConfig.mbEmptyStringAsZero));
+    pModel->Insert(createItem(maCaptionEmptyStringAsZero,toString(maConfig.mbEmptyStringAsZero)));
 
     {
         // Syntax for INDIRECT function.
@@ -390,12 +360,12 @@ void ScCalcOptionsDialog::FillOptionsList()
     }
 
 #if HAVE_FEATURE_OPENCL
-    pModel->Insert(createBoolItem(maCaptionOpenCLEnabled,maConfig.mbOpenCLEnabled));
-    pModel->Insert(createBoolItem(maCaptionOpenCLSubsetEnabled,maConfig.mbOpenCLSubsetOnly));
-    pModel->Insert(createIntegerItem(maCaptionOpenCLMinimumFormulaSize,maConfig.mnOpenCLMinimumFormulaGroupSize));
-    pModel->Insert(createStringItem(maCaptionOpenCLSubsetOpCodes,ScOpCodeSetToSymbolicString(maConfig.maOpenCLSubsetOpCodes)));
-    pModel->Insert(createStringListItem(maCaptionOpenCLWhiteList));
-    pModel->Insert(createStringListItem(maCaptionOpenCLBlackList));
+    pModel->Insert(createItem(maCaptionOpenCLEnabled,toString(maConfig.mbOpenCLEnabled)));
+    pModel->Insert(createItem(maCaptionOpenCLSubsetEnabled,toString(maConfig.mbOpenCLSubsetOnly)));
+    pModel->Insert(createItem(maCaptionOpenCLMinimumFormulaSize,toString(maConfig.mnOpenCLMinimumFormulaGroupSize)));
+    pModel->Insert(createItem(maCaptionOpenCLSubsetOpCodes,ScOpCodeSetToSymbolicString(maConfig.maOpenCLSubsetOpCodes)));
+    pModel->Insert(createItem(maCaptionOpenCLWhiteList,""));
+    pModel->Insert(createItem(maCaptionOpenCLBlackList,""));
 
     fillOpenCLList();
 
@@ -871,15 +841,16 @@ IMPL_LINK(ScCalcOptionsDialog, OpenCLWhiteAndBlackListSelHdl, Control*, )
 {
     // We know this is called for the mpOpenCLWhiteAndBlackListBox
 
-    std::set<ScCalcConfig::OpenCLImplementationMatcher>
-        &m(mpLbSettings->GetSelectEntryPos() == CALC_OPTION_OPENCL_WHITELIST ? maConfig.maOpenCLWhiteList : maConfig.maOpenCLBlackList);
+    std::set<ScCalcConfig::OpenCLImpl>
+        &implSet(mpLbSettings->GetSelectEntryPos() == CALC_OPTION_OPENCL_WHITELIST ? maConfig.maOpenCLWhiteList : maConfig.maOpenCLBlackList);
     sal_uLong n(mpOpenCLWhiteAndBlackListBox->GetSelectEntryPos());
+    const ScCalcConfig::OpenCLImpl& impl(*nth(implSet, n));
 
-    mpOS->SetText(nth(m, n)->maOS);
-    mpOSVersion->SetText(nth(m, n)->maOSVersion);
-    mpPlatformVendor->SetText(nth(m, n)->maPlatformVendor);
-    mpDevice->SetText(nth(m, n)->maDevice);
-    mpDriverVersion->SetText(nth(m, n)->maDriverVersion);
+    mpOS->SetText(impl.maOS);
+    mpOSVersion->SetText(impl.maOSVersion);
+    mpPlatformVendor->SetText(impl.maPlatformVendor);
+    mpDevice->SetText(impl.maDevice);
+    mpDriverVersion->SetText(impl.maDriverVersion);
 
     return 0;
 }
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx
index a6ad5cd..45d8e58 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.hxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx
@@ -62,10 +62,7 @@ private:
     OUString toString(ScCalcConfig::StringConversion eConv) const;
     OUString toString(bool bVal) const;
     OUString toString(sal_Int32 nVal) const;
-    SvTreeListEntry *createBoolItem(const OUString &rCaption, bool bValue) const;
-    SvTreeListEntry *createIntegerItem(const OUString &rCaption, sal_Int32 nValue) const;
-    SvTreeListEntry *createStringItem(const OUString &rCaption, const OUString& sValue) const;
-    SvTreeListEntry *createStringListItem(const OUString &rCaption) const;
+    SvTreeListEntry *createItem(const OUString &rCaption, const OUString& sValue) const;
     void     setValueAt(size_t nPos, const OUString &rString);
 
 private:
commit cd56935a177b7d9fd10434afe220fe6c10820f82
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Nov 6 20:02:22 2014 +0200

    More work on OpenCL whitelist/blacklist UI
    
    Change-Id: I526d6652a956be3031ed46ab15eeb333d3f40a7c

diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index 46edbf2..d3c20cf 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -1401,7 +1401,7 @@
           <info>
             <desc>Like OpenCLWhiteList, but for combinations known to be bad.</desc>
           </info>
-          <value oor:separator=";">Windows/*/Intel(R) Corporation/9.17.10.2884;SuperOS/1.0/Big Corp, Inc./2.3\/beta</value>
+          <value oor:separator=";">Windows/*/Intel(R) Corporation/*/9.17.10.2884;SuperOS/*/Big Corp, Inc./Whizz\Grafix/4.2%2Fbeta%3B3</value>
         </prop>
       </group>
       <group oor:name="Syntax">
diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx
index eaaeb3f..e051e1d 100644
--- a/sc/inc/calcconfig.hxx
+++ b/sc/inc/calcconfig.hxx
@@ -41,6 +41,57 @@ struct SC_DLLPUBLIC ScCalcConfig
         STRING_CONVERSION_LOCALE_DEPENDENT  ///<  =1+"1.000" may be 2 or 1001 ... =1+"x" gives #VALUE!
     };
 
+    struct OpenCLImplementationMatcher
+    {
+        OUString maOS;
+        OUString maOSVersion;
+        OUString maPlatformVendor;
+        OUString maDevice;
+        OUString maDriverVersion;
+
+        OpenCLImplementationMatcher()
+        {
+        }
+
+        OpenCLImplementationMatcher(const OUString& rOS,
+                                    const OUString& rOSVersion,
+                                    const OUString& rPlatformVendor,
+                                    const OUString& rDevice,
+                                    const OUString& rDriverVersion)
+            : maOS(rOS),
+              maOSVersion(rOSVersion),
+              maPlatformVendor(rPlatformVendor),
+              maDevice(rDevice),
+              maDriverVersion(rDriverVersion)
+        {
+        }
+
+        bool operator==(const OpenCLImplementationMatcher& r) const
+        {
+            return maOS == r.maOS &&
+                   maOSVersion == r.maOSVersion &&
+                   maPlatformVendor == r.maPlatformVendor &&
+                   maDevice == r.maDevice &&
+                   maDriverVersion == r.maDriverVersion;
+        }
+        bool operator!=(const OpenCLImplementationMatcher& r) const
+        {
+            return !operator==(r);
+        }
+        bool operator<(const OpenCLImplementationMatcher& r) const
+        {
+            return (maOS < r.maOS ||
+                    (maOS == r.maOS &&
+                     (maOSVersion < r.maOSVersion ||
+                      (maOSVersion == r.maOSVersion &&
+                       (maPlatformVendor < r.maPlatformVendor ||
+                        (maPlatformVendor == r.maPlatformVendor &&
+                         (maDevice < r.maDevice ||
+                          (maDevice == r.maDevice &&
+                           (maDriverVersion < r.maDriverVersion)))))))));
+        }
+    };
+
     formula::FormulaGrammar::AddressConvention meStringRefAddressSyntax;
     StringConversion meStringConversion;
     bool mbEmptyStringAsZero:1;
@@ -52,8 +103,8 @@ struct SC_DLLPUBLIC ScCalcConfig
     sal_Int32 mnOpenCLMinimumFormulaGroupSize;
     std::set<OpCodeEnum> maOpenCLSubsetOpCodes;
 
-    std::set<OUString> maOpenCLWhiteList;
-    std::set<OUString> maOpenCLBlackList;
+    std::set<OpenCLImplementationMatcher> maOpenCLWhiteList;
+    std::set<OpenCLImplementationMatcher> maOpenCLBlackList;
 
     ScCalcConfig();
 
diff --git a/sc/source/core/tool/calcconfig.cxx b/sc/source/core/tool/calcconfig.cxx
index a56d2fa..8b7e58a 100644
--- a/sc/source/core/tool/calcconfig.cxx
+++ b/sc/source/core/tool/calcconfig.cxx
@@ -26,6 +26,8 @@ ScCalcConfig::ScCalcConfig() :
     mbEmptyStringAsZero(false)
 {
     setOpenCLConfigToDefault();
+
+    // SAL _DEBUG(__FILE__ ":" << __LINE__ << ": ScCalcConfig::ScCalcConfig(): " << *this);
 }
 
 void ScCalcConfig::setOpenCLConfigToDefault()
@@ -42,8 +44,8 @@ void ScCalcConfig::setOpenCLConfigToDefault()
     maOpenCLSubsetOpCodes.insert(ocSum);
     maOpenCLSubsetOpCodes.insert(ocAverage);
     maOpenCLSubsetOpCodes.insert(ocSumIfs);
-    maOpenCLBlackList.insert("Windows/*/Intel(R) Corporation/9.17.10.2884");
-    maOpenCLBlackList.insert("SuperOS/1.0/Big Corp, Inc./2.3\\/beta");
+    maOpenCLBlackList.insert(OpenCLImplementationMatcher("Windows", "*", "Intel(R) Corporation", "*", "9.17.10.2884"));
+    maOpenCLBlackList.insert(OpenCLImplementationMatcher("SuperOS", "*", "Big Corp, Inc.", "Whizz\\Grafix", "4.2/beta;3"));
 }
 
 void ScCalcConfig::reset()
@@ -82,13 +84,19 @@ bool ScCalcConfig::operator!= (const ScCalcConfig& r) const
 
 namespace {
 
-void writeStringSet(std::ostream& rStream, const std::set<OUString>& rSet)
+void writeOpenCLImplementationMatcher(std::ostream& rStream, const std::set<ScCalcConfig::OpenCLImplementationMatcher>& rSet)
 {
     for (auto i = rSet.cbegin(); i != rSet.cend(); ++i)
     {
         if (i != rSet.cbegin())
             rStream << ",";
-        rStream << (*i).replaceAll(",", "\\,");
+        rStream << "{"
+            "OS=" << (*i).maOS << ","
+            "OSVersion=" << (*i).maOSVersion << ","
+            "PlatformVendor=" << (*i).maPlatformVendor << ","
+            "Device=" << (*i).maDevice << ","
+            "DriverVersion=" << (*i).maDriverVersion <<
+            "}";
     }
 }
 
@@ -107,10 +115,10 @@ std::ostream& operator<<(std::ostream& rStream, const ScCalcConfig& rConfig)
         "OpenCLMinimumFormulaGroupSize=" << rConfig.mnOpenCLMinimumFormulaGroupSize << ","
         "OpenCLSubsetOpCodes={" << ScOpCodeSetToSymbolicString(rConfig.maOpenCLSubsetOpCodes) << "},"
         "OpenCLWhiteList={";
-    writeStringSet(rStream, rConfig.maOpenCLWhiteList);
+    writeOpenCLImplementationMatcher(rStream, rConfig.maOpenCLWhiteList);
     rStream << "},"
         "OpenCLBlackList={";
-    writeStringSet(rStream, rConfig.maOpenCLBlackList);
+    writeOpenCLImplementationMatcher(rStream, rConfig.maOpenCLBlackList);
     rStream << "}"
         "}";
     return rStream;
diff --git a/sc/source/core/tool/formulaopt.cxx b/sc/source/core/tool/formulaopt.cxx
index aa2b7a1..9661b49 100644
--- a/sc/source/core/tool/formulaopt.cxx
+++ b/sc/source/core/tool/formulaopt.cxx
@@ -7,6 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <ctype.h>
+
 #include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <com/sun/star/lang/Locale.hpp>
@@ -278,26 +280,64 @@ ScFormulaCfg::ScFormulaCfg() :
 
 namespace {
 
-css::uno::Sequence<OUString> StringSetToStringSequence(std::set<OUString>& rSet)
+css::uno::Sequence<OUString> SetOfOpenCLImplementationMatcherToStringSequence(std::set<ScCalcConfig::OpenCLImplementationMatcher>& rSet)
 {
     css::uno::Sequence<OUString> result(rSet.size());
 
     size_t n(0);
     for (auto i = rSet.cbegin(); i != rSet.cend(); ++i)
     {
-        result[n++] = *i;
+        result[n++] =
+            (*i).maOS.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
+            (*i).maOSVersion.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
+            (*i).maPlatformVendor.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
+            (*i).maDevice.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B") + "/" +
+            (*i).maDriverVersion.replaceAll("%", "%25").replaceAll("/", "%2F").replaceAll(";", "%3B");
+    }
+
+    return result;
+}
+
+OUString getToken(const OUString& string, sal_Int32& index)
+{
+    OUString token(string.getToken(0, '/', index));
+    OUString result;
+    sal_Int32 i(0);
+    sal_Int32 p;
+    while ((p = token.indexOf('%', i)) >= 0)
+    {
+        if (p > i)
+            result += token.copy(i, p - i);
+        if (p < token.getLength() - 2)
+        {
+            result += OUString(static_cast<sal_Unicode>(token.copy(p+1, 2).toInt32(16)));
+            i = p + 3;
+        }
+        else
+        {
+            i = token.getLength();
+        }
     }
+    result += token.copy(i);
 
     return result;
 }
 
-std::set<OUString> StringSequenceToStringSet(css::uno::Sequence<OUString>& rSequence)
+std::set<ScCalcConfig::OpenCLImplementationMatcher> StringSequenceToSetOfOpenCLImplementationMatcher(css::uno::Sequence<OUString>& rSequence)
 {
-    std::set<OUString> result;
+    std::set<ScCalcConfig::OpenCLImplementationMatcher> result;
 
     for (auto i = rSequence.begin(); i != rSequence.end(); ++i)
     {
-        result.insert(*i);
+        ScCalcConfig::OpenCLImplementationMatcher m;
+        sal_Int32 index(0);
+        m.maOS = getToken(*i, index);
+        m.maOSVersion = getToken(*i, index);
+        m.maPlatformVendor = getToken(*i, index);
+        m.maDevice = getToken(*i, index);
+        m.maDriverVersion = getToken(*i, index);
+
+        result.insert(m);
     }
 
     return result;
@@ -549,16 +589,16 @@ void ScFormulaCfg::UpdateFromProperties( const Sequence<OUString>& aNames )
                 break;
                 case SCFORMULAOPT_OPENCL_WHITELIST:
                 {
-                    css::uno::Sequence<OUString> sVal = StringSetToStringSequence(GetCalcConfig().maOpenCLWhiteList);
+                    css::uno::Sequence<OUString> sVal = SetOfOpenCLImplementationMatcherToStringSequence(GetCalcConfig().maOpenCLWhiteList);
                     pValues[nProp] >>= sVal;
-                    GetCalcConfig().maOpenCLWhiteList = StringSequenceToStringSet(sVal);
+                    GetCalcConfig().maOpenCLWhiteList = StringSequenceToSetOfOpenCLImplementationMatcher(sVal);
                 }
                 break;
                 case SCFORMULAOPT_OPENCL_BLACKLIST:
                 {
-                    css::uno::Sequence<OUString> sVal = StringSetToStringSequence(GetCalcConfig().maOpenCLBlackList);
+                    css::uno::Sequence<OUString> sVal = SetOfOpenCLImplementationMatcherToStringSequence(GetCalcConfig().maOpenCLBlackList);
                     pValues[nProp] >>= sVal;
-                    GetCalcConfig().maOpenCLBlackList = StringSequenceToStringSet(sVal);
+                    GetCalcConfig().maOpenCLBlackList = StringSequenceToSetOfOpenCLImplementationMatcher(sVal);
                 }
                 break;
                 }
@@ -716,13 +756,13 @@ void ScFormulaCfg::Commit()
             break;
             case SCFORMULAOPT_OPENCL_WHITELIST:
             {
-                css::uno::Sequence<OUString> sVal = StringSetToStringSequence(GetCalcConfig().maOpenCLWhiteList);
+                css::uno::Sequence<OUString> sVal = SetOfOpenCLImplementationMatcherToStringSequence(GetCalcConfig().maOpenCLWhiteList);
                 pValues[nProp] <<= sVal;
             }
             break;
             case SCFORMULAOPT_OPENCL_BLACKLIST:
             {
-                css::uno::Sequence<OUString> sVal = StringSetToStringSequence(GetCalcConfig().maOpenCLBlackList);
+                css::uno::Sequence<OUString> sVal = SetOfOpenCLImplementationMatcherToStringSequence(GetCalcConfig().maOpenCLBlackList);
                 pValues[nProp] <<= sVal;
             }
             break;
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 286cc7f..9551f16 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -143,8 +143,13 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
     get(mpBtnFalse, "false");
     get(mpSpinButton, "spinbutton");
     get(mpEditField, "entry");
-    get(mpListGrid, "listgrid");
-    get(mpListBox, "listbox");
+    get(mpOpenCLWhiteAndBlackListGrid, "listgrid");
+    get(mpOpenCLWhiteAndBlackListBox, "listbox");
+    get(mpOS, "os");
+    get(mpOSVersion, "osversion");
+    get(mpPlatformVendor, "platformvendor");
+    get(mpDevice, "opencldevice");
+    get(mpDriverVersion, "opencldriverversion");
     get(mpListEditButton, "listbox-edit");
     get(mpListNewButton, "listbox-new");
     get(mpListDeleteButton, "listbox-delete");
@@ -158,8 +163,8 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
     mpSpinButton->SetModifyHdl(LINK(this, ScCalcOptionsDialog, NumModifiedHdl));
     mpEditField->SetModifyHdl(LINK(this, ScCalcOptionsDialog, EditModifiedHdl));
 
-    mpListBox->set_height_request(4* mpListBox->GetTextHeight());
-    mpListBox->SetStyle(mpListBox->GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
+    mpOpenCLWhiteAndBlackListBox->set_height_request(4* mpOpenCLWhiteAndBlackListBox->GetTextHeight());
+    mpOpenCLWhiteAndBlackListBox->SetStyle(mpOpenCLWhiteAndBlackListBox->GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
 
     mpOpenclInfoList->set_height_request(4* mpOpenclInfoList->GetTextHeight());
     mpOpenclInfoList->SetStyle(mpOpenclInfoList->GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
@@ -211,6 +216,9 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
     mpLbSettings->SetSelectHdl(aLink);
     mpLbOptionEdit->SetSelectHdl(aLink);
 
+    aLink = LINK(this, ScCalcOptionsDialog, OpenCLWhiteAndBlackListSelHdl);
+    mpOpenCLWhiteAndBlackListBox->SetSelectHdl(aLink);
+
     aLink = LINK(this, ScCalcOptionsDialog, BtnToggleHdl);
     mpBtnTrue->SetToggleHdl(aLink); // Set handler only to the 'True' button.
 
@@ -325,14 +333,19 @@ void ScCalcOptionsDialog::fillOpenCLList()
 
 namespace {
 
-void fillListBox(ListBox* pListBox, const std::set<OUString>& rSet)
+void fillListBox(ListBox* pListBox, const std::set<ScCalcConfig::OpenCLImplementationMatcher>& rSet)
 {
     pListBox->SetUpdateMode(false);
     pListBox->Clear();
 
     for (auto i = rSet.cbegin(); i != rSet.cend(); ++i)
     {
-        pListBox->InsertEntry(*i, LISTBOX_APPEND);
+        pListBox->InsertEntry((*i).maOS + " " +
+                              (*i).maOSVersion + " " +
+                              (*i).maPlatformVendor + " " +
+                              (*i).maDevice + " " +
+                              (*i).maDriverVersion,
+                              LISTBOX_APPEND);
     }
 
     pListBox->SetUpdateMode(true);
@@ -405,7 +418,7 @@ void ScCalcOptionsDialog::SelectionChanged()
             mpBtnFalse->Hide();
             mpSpinButton->Hide();
             mpEditField->Hide();
-            mpListGrid->Hide();
+            mpOpenCLWhiteAndBlackListGrid->Hide();
             mpLbOptionEdit->Show();
             mpOpenclInfoList->GetParent()->Hide();
 
@@ -440,7 +453,7 @@ void ScCalcOptionsDialog::SelectionChanged()
             mpBtnFalse->Hide();
             mpSpinButton->Hide();
             mpEditField->Hide();
-            mpListGrid->Hide();
+            mpOpenCLWhiteAndBlackListGrid->Hide();
             mpLbOptionEdit->Show();
             mpOpenclInfoList->GetParent()->Hide();
 
@@ -478,7 +491,7 @@ void ScCalcOptionsDialog::SelectionChanged()
             mpBtnFalse->Show();
             mpSpinButton->Hide();
             mpEditField->Hide();
-            mpListGrid->Hide();
+            mpOpenCLWhiteAndBlackListGrid->Hide();
 
             bool bValue = false;
             bool bEnable = true;
@@ -555,7 +568,7 @@ void ScCalcOptionsDialog::SelectionChanged()
             mpBtnFalse->Hide();
             mpSpinButton->Show();
             mpEditField->Hide();
-            mpListGrid->Hide();
+            mpOpenCLWhiteAndBlackListGrid->Hide();
             mpOpenclInfoList->GetParent()->Hide();
             mpFtAnnotation->SetText(maDescOpenCLMinimumFormulaSize);
             mpSpinButton->SetValue(nValue);
@@ -572,7 +585,7 @@ void ScCalcOptionsDialog::SelectionChanged()
             mpBtnFalse->Hide();
             mpSpinButton->Hide();
             mpEditField->Show();
-            mpListGrid->Hide();
+            mpOpenCLWhiteAndBlackListGrid->Hide();
             mpOpenclInfoList->GetParent()->Hide();
             mpFtAnnotation->SetText(maDescOpenCLSubsetOpCodes);
             mpEditField->SetText(sValue);
@@ -583,23 +596,22 @@ void ScCalcOptionsDialog::SelectionChanged()
         case CALC_OPTION_OPENCL_WHITELIST:
         case CALC_OPTION_OPENCL_BLACKLIST:
         {
-            // SAL _DEBUG(__FILE__ ":" << __LINE__ << ": " << maConfig);
             mpLbOptionEdit->Hide();
             mpBtnTrue->Hide();
             mpBtnFalse->Hide();
             mpSpinButton->Hide();
             mpEditField->Hide();
-            mpListGrid->Show();
+            mpOpenCLWhiteAndBlackListGrid->Show();
             mpOpenclInfoList->GetParent()->Hide();
             if ( nSelectedPos == CALC_OPTION_OPENCL_WHITELIST )
             {
                 mpFtAnnotation->SetText(maDescOpenCLWhiteList);
-                fillListBox(mpListBox, maConfig.maOpenCLWhiteList);
+                fillListBox(mpOpenCLWhiteAndBlackListBox, maConfig.maOpenCLWhiteList);
             }
             else
             {
                 mpFtAnnotation->SetText(maDescOpenCLBlackList);
-                fillListBox(mpListBox, maConfig.maOpenCLBlackList);
+                fillListBox(mpOpenCLWhiteAndBlackListBox, maConfig.maOpenCLBlackList);
             }
         }
         break;
@@ -751,6 +763,10 @@ void ScCalcOptionsDialog::EditFieldValueChanged()
     maConfig.maOpenCLSubsetOpCodes = ScStringToOpCodeSet(sVal);
 }
 
+void ScCalcOptionsDialog::WhiteAndBlackListSelectionChanged()
+{
+}
+
 OUString ScCalcOptionsDialog::toString(formula::FormulaGrammar::AddressConvention eConv) const
 {
     switch (eConv)
@@ -834,4 +850,38 @@ IMPL_LINK_NOARG(ScCalcOptionsDialog, EditModifiedHdl)
     return 0;
 }
 
+namespace {
+
+template <class T>
+typename T::iterator nth(T container, int n)
+{
+    auto i = container.begin();
+    while (n && i != container.end())
+    {
+        ++i;
+        --n;
+    }
+
+    return i;
+}
+
+} // anonymous namespace
+
+IMPL_LINK(ScCalcOptionsDialog, OpenCLWhiteAndBlackListSelHdl, Control*, )
+{
+    // We know this is called for the mpOpenCLWhiteAndBlackListBox
+
+    std::set<ScCalcConfig::OpenCLImplementationMatcher>
+        &m(mpLbSettings->GetSelectEntryPos() == CALC_OPTION_OPENCL_WHITELIST ? maConfig.maOpenCLWhiteList : maConfig.maOpenCLBlackList);
+    sal_uLong n(mpOpenCLWhiteAndBlackListBox->GetSelectEntryPos());
+
+    mpOS->SetText(nth(m, n)->maOS);
+    mpOSVersion->SetText(nth(m, n)->maOSVersion);
+    mpPlatformVendor->SetText(nth(m, n)->maPlatformVendor);
+    mpDevice->SetText(nth(m, n)->maDevice);
+    mpDriverVersion->SetText(nth(m, n)->maDriverVersion);
+
+    return 0;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx
index 860f943..a6ad5cd 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.hxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx
@@ -40,6 +40,7 @@ public:
     DECL_LINK( DeviceSelHdl, void* );
     DECL_LINK( NumModifiedHdl, void * );
     DECL_LINK( EditModifiedHdl, void * );
+    DECL_LINK( OpenCLWhiteAndBlackListSelHdl, Control* );
 
     const ScCalcConfig& GetConfig() const { return maConfig;}
 
@@ -52,6 +53,7 @@ private:
     void SelectedDeviceChanged();
     void SpinButtonValueChanged();
     void EditFieldValueChanged();
+    void WhiteAndBlackListSelectionChanged();
 #if HAVE_FEATURE_OPENCL
     void fillOpenCLList();
 #endif
@@ -74,8 +76,13 @@ private:
     RadioButton* mpBtnFalse;
     NumericField* mpSpinButton;
     Edit* mpEditField;
-    VclGrid* mpListGrid;
-    ListBox* mpListBox;
+    VclGrid* mpOpenCLWhiteAndBlackListGrid;
+    ListBox* mpOpenCLWhiteAndBlackListBox;
+    Edit* mpOS;
+    Edit* mpOSVersion;
+    Edit* mpPlatformVendor;
+    Edit* mpDevice;
+    Edit* mpDriverVersion;
     PushButton* mpListEditButton;
     PushButton* mpListNewButton;
     PushButton* mpListDeleteButton;
diff --git a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
index 959c2b1..513106c 100644
--- a/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
+++ b/sc/uiconfig/scalc/ui/formulacalculationoptions.ui
@@ -224,11 +224,9 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkTextView" id="os:border">
+                              <object class="GtkEntry" id="os:border">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property name="hexpand">True</property>
-                                <property name="vexpand">True</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
@@ -250,11 +248,9 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkTextView" id="osversion:border">
+                              <object class="GtkEntry" id="osversion:border">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property name="hexpand">True</property>
-                                <property name="vexpand">True</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
@@ -262,7 +258,7 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkLabel" id="openclvendorlabel">
+                              <object class="GtkLabel" id="platformvendorlabel">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="xalign">0</property>
@@ -276,11 +272,9 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkTextView" id="openclvendor:border">
+                              <object class="GtkEntry" id="platformvendor:border">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property name="hexpand">True</property>
-                                <property name="vexpand">True</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
@@ -302,11 +296,9 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkTextView" id="opencldevice:border">
+                              <object class="GtkEntry" id="opencldevice:border">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property name="hexpand">True</property>
-                                <property name="vexpand">True</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
@@ -328,11 +320,9 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkTextView" id="opencldriverversion:border">
+                              <object class="GtkEntry" id="opencldriverversion:border">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property name="hexpand">True</property>
-                                <property name="vexpand">True</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>


More information about the Libreoffice-commits mailing list