summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-11-26 22:30:33 +0200
committerTor Lillqvist <tml@collabora.com>2014-11-28 10:22:45 +0200
commit7920af486b7124b85b2eb30c90aa26ddc471bd15 (patch)
tree41e9fcb149e5756da0a950c93008e15214738f79 /sc/source/ui
parent8d239f25a22523a35d862db18341606440ae5473 (diff)
Work in progress: Move Calc-independend OpenCL configuration out of sc
Intermediate commit. More changes will follow: The device selection logic needs to be moved, too. (And cleaned up.) Instead of the separate formulacalculationoptions dialog we should simply have a normal options page for those OpenCL-related settings that will remain purely Calc-specific, like the formula opcode subsetting. Change-Id: Id60d95e80d377cbbf5780beb473b221bce06b5e5
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/optdlg/calcoptionsdlg.cxx207
-rw-r--r--sc/source/ui/optdlg/calcoptionsdlg.hxx29
-rw-r--r--sc/source/ui/unoobj/docuno.cxx8
3 files changed, 15 insertions, 229 deletions
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx
index 2a19a76d5797..996334c5797c 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.cxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx
@@ -42,8 +42,6 @@ typedef enum {
CALC_OPTION_ENABLE_OPENCL_SUBSET,
CALC_OPTION_OPENCL_MIN_SIZE,
CALC_OPTION_OPENCL_SUBSET_OPS,
- CALC_OPTION_OPENCL_BLACKLIST,
- CALC_OPTION_OPENCL_WHITELIST,
} CalcOptionOrder;
class OptionString : public SvLBoxString
@@ -155,16 +153,6 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
get(mpBtnFalse, "false");
get(mpSpinButton, "spinbutton");
get(mpEditField, "entry");
- get(mpOpenCLWhiteAndBlackListGrid, "listgrid");
- get(mpOpenCLWhiteAndBlackListBox, "listbox");
- get(mpOS, "os");
- get(mpOSVersion, "osversion");
- get(mpPlatformVendor, "platformvendor");
- get(mpDevice, "opencldevice");
- get(mpDriverVersion, "opencldriverversion");
- get(mpListNewButton, "listbox-new");
- get(mpListDeleteButton, "listbox-delete");
- get(mpTestButton, "test");
get(mpOpenclInfoList, "opencl_list");
get(mpBtnAutomaticSelectionTrue, "automatic_select_true");
get(mpBtnAutomaticSelectionFalse, "automatic_select_false");
@@ -174,14 +162,6 @@ 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);
mpOpenclInfoList->set_height_request(4* mpOpenclInfoList->GetTextHeight());
mpOpenclInfoList->SetStyle(mpOpenclInfoList->GetStyle() | WB_CLIPCHILDREN | WB_FORCE_MAKEVISIBLE);
@@ -214,12 +194,6 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
maCaptionOpenCLSubsetOpCodes = get<vcl::Window>("opencl_subset_opcodes")->GetText();
maDescOpenCLSubsetOpCodes = get<vcl::Window>("opencl_subset_opcodes_desc")->GetText();
- maCaptionOpenCLBlackList = get<vcl::Window>("opencl_blacklist")->GetText();
- maDescOpenCLBlackList = get<vcl::Window>("opencl_blacklist_desc")->GetText();
-
- maCaptionOpenCLWhiteList = get<vcl::Window>("opencl_whitelist")->GetText();
- maDescOpenCLWhiteList = get<vcl::Window>("opencl_whitelist_desc")->GetText();
-
maSoftware = get<vcl::Window>("software")->GetText();
mpLbSettings->set_height_request(8 * mpLbSettings->GetTextHeight());
@@ -230,14 +204,6 @@ ScCalcOptionsDialog::ScCalcOptionsDialog(vcl::Window* pParent, const ScCalcConfi
mpLbSettings->SetSelectHdl(aLink);
mpLbOptionEdit->SetSelectHdl(aLink);
- aLink = LINK(this, ScCalcOptionsDialog, OpenCLWhiteAndBlackListSelHdl);
- mpOpenCLWhiteAndBlackListBox->SetSelectHdl(aLink);
-
- mpListNewButton->SetClickHdl(LINK(this, ScCalcOptionsDialog, ListNewClickHdl));
- mpListDeleteButton->SetClickHdl(LINK(this, ScCalcOptionsDialog, ListDeleteClickHdl));
-
- mpTestButton->SetClickHdl(LINK(this, ScCalcOptionsDialog, TestClickHdl));
-
aLink = LINK(this, ScCalcOptionsDialog, BtnToggleHdl);
mpBtnTrue->SetToggleHdl(aLink); // Set handler only to the 'True' button.
@@ -293,10 +259,10 @@ void ScCalcOptionsDialog::fillOpenCLList()
SvTreeListEntry* pSelectedEntry = NULL;
sc::FormulaGroupInterpreter::fillOpenCLInfo(maPlatformInfo);
- for(std::vector<sc::OpenCLPlatformInfo>::iterator it = maPlatformInfo.begin(),
+ for(std::vector<OpenCLPlatformInfo>::iterator it = maPlatformInfo.begin(),
itEnd = maPlatformInfo.end(); it != itEnd; ++it)
{
- for(std::vector<sc::OpenCLDeviceInfo>::iterator
+ for(std::vector<OpenCLDeviceInfo>::iterator
itr = it->maDevices.begin(), itrEnd = it->maDevices.end(); itr != itrEnd; ++itr)
{
OUString aDeviceId = it->maVendor + " " + itr->maName + " " + itr->maDriver;
@@ -320,32 +286,6 @@ void ScCalcOptionsDialog::fillOpenCLList()
SelectedDeviceChanged();
}
-namespace {
-
-OUString format(const ScCalcConfig::OpenCLImplMatcher& rImpl)
-{
- return (rImpl.maOS + " " +
- rImpl.maOSVersion + " " +
- rImpl.maPlatformVendor + " " +
- rImpl.maDevice + " " +
- rImpl.maDriverVersion);
-}
-
-void fillListBox(ListBox* pListBox, const ScCalcConfig::OpenCLImplMatcherSet& rSet)
-{
- pListBox->SetUpdateMode(false);
- pListBox->Clear();
-
- for (auto i = rSet.cbegin(); i != rSet.cend(); ++i)
- {
- pListBox->InsertEntry(format(*i), LISTBOX_APPEND);
- }
-
- pListBox->SetUpdateMode(true);
-}
-
-} // anonymous namespace
-
#endif
namespace {
@@ -386,8 +326,6 @@ void ScCalcOptionsDialog::FillOptionsList()
pModel->Insert(createItem(maCaptionOpenCLSubsetEnabled,toString(maConfig.mbOpenCLSubsetOnly)));
pModel->Insert(createItem(maCaptionOpenCLMinimumFormulaSize,toString(maConfig.mnOpenCLMinimumFormulaGroupSize)));
pModel->Insert(createItem(maCaptionOpenCLSubsetOpCodes,ScOpCodeSetToSymbolicString(maConfig.maOpenCLSubsetOpCodes)));
- pModel->Insert(createItem(maCaptionOpenCLBlackList,""));
- pModel->Insert(createItem(maCaptionOpenCLWhiteList,""));
fillOpenCLList();
@@ -410,7 +348,6 @@ void ScCalcOptionsDialog::SelectionChanged()
mpBtnFalse->Hide();
mpSpinButton->Hide();
mpEditField->Hide();
- mpOpenCLWhiteAndBlackListGrid->Hide();
mpLbOptionEdit->Show();
mpOpenclInfoList->GetParent()->Hide();
@@ -445,7 +382,6 @@ void ScCalcOptionsDialog::SelectionChanged()
mpBtnFalse->Hide();
mpSpinButton->Hide();
mpEditField->Hide();
- mpOpenCLWhiteAndBlackListGrid->Hide();
mpLbOptionEdit->Show();
mpOpenclInfoList->GetParent()->Hide();
@@ -482,7 +418,6 @@ void ScCalcOptionsDialog::SelectionChanged()
mpBtnFalse->Show();
mpSpinButton->Hide();
mpEditField->Hide();
- mpOpenCLWhiteAndBlackListGrid->Hide();
bool bValue = false;
bool bEnable = true;
@@ -546,7 +481,6 @@ void ScCalcOptionsDialog::SelectionChanged()
mpBtnFalse->Hide();
mpSpinButton->Show();
mpEditField->Hide();
- mpOpenCLWhiteAndBlackListGrid->Hide();
mpOpenclInfoList->GetParent()->Hide();
mpFtAnnotation->SetText(maDescOpenCLMinimumFormulaSize);
mpSpinButton->SetValue(nValue);
@@ -563,38 +497,12 @@ void ScCalcOptionsDialog::SelectionChanged()
mpBtnFalse->Hide();
mpSpinButton->Hide();
mpEditField->Show();
- mpOpenCLWhiteAndBlackListGrid->Hide();
mpOpenclInfoList->GetParent()->Hide();
mpFtAnnotation->SetText(maDescOpenCLSubsetOpCodes);
mpEditField->SetText(sValue);
}
break;
- // string lists
- case CALC_OPTION_OPENCL_BLACKLIST:
- case CALC_OPTION_OPENCL_WHITELIST:
- {
- mpLbOptionEdit->Hide();
- mpBtnTrue->Hide();
- mpBtnFalse->Hide();
- mpSpinButton->Hide();
- mpEditField->Hide();
- mpOpenCLWhiteAndBlackListGrid->Show();
- mpOpenclInfoList->GetParent()->Hide();
-#if HAVE_FEATURE_OPENCL
- if ( nSelectedPos == CALC_OPTION_OPENCL_WHITELIST )
- {
- mpFtAnnotation->SetText(maDescOpenCLWhiteList);
- fillListBox(mpOpenCLWhiteAndBlackListBox, maConfig.maOpenCLWhiteList);
- }
- else
- {
- mpFtAnnotation->SetText(maDescOpenCLBlackList);
- fillListBox(mpOpenCLWhiteAndBlackListBox, maConfig.maOpenCLBlackList);
- }
-#endif
- }
- break;
}
}
@@ -647,8 +555,6 @@ void ScCalcOptionsDialog::ListOptionValueChanged()
case CALC_OPTION_ENABLE_OPENCL_SUBSET:
case CALC_OPTION_OPENCL_MIN_SIZE:
case CALC_OPTION_OPENCL_SUBSET_OPS:
- case CALC_OPTION_OPENCL_BLACKLIST:
- case CALC_OPTION_OPENCL_WHITELIST:
break;
}
}
@@ -671,7 +577,7 @@ void ScCalcOptionsDialog::SelectedDeviceChanged()
if(!pEntry)
return;
- sc::OpenCLDeviceInfo* pInfo = reinterpret_cast<sc::OpenCLDeviceInfo*>(pEntry->GetUserData());
+ OpenCLDeviceInfo* pInfo = reinterpret_cast<OpenCLDeviceInfo*>(pEntry->GetUserData());
if(pInfo)
{
mpFtFrequency->SetText(OUString::number(pInfo->mnFrequency));
@@ -726,22 +632,6 @@ void ScCalcOptionsDialog::SpinButtonValueChanged()
maConfig.mnOpenCLMinimumFormulaGroupSize = nVal;
}
-ScCalcConfig::OpenCLImplMatcherSet& ScCalcOptionsDialog::CurrentWhiteOrBlackList()
-{
- return (mpLbSettings->GetSelectEntryPos() == CALC_OPTION_OPENCL_WHITELIST ? maConfig.maOpenCLWhiteList : maConfig.maOpenCLBlackList);
-}
-
-const ScCalcConfig::OpenCLImplMatcher& ScCalcOptionsDialog::CurrentWhiteOrBlackListEntry()
-{
- ScCalcConfig::OpenCLImplMatcherSet& rSet(CurrentWhiteOrBlackList());
-
- auto i = rSet.begin();
- int n(mpOpenCLWhiteAndBlackListBox->GetSelectEntryPos());
- std::advance(i, n);
-
- return *i;
-}
-
void ScCalcOptionsDialog::EditFieldValueChanged(Control *pCtrl)
{
Edit& rEdit(dynamic_cast<Edit&>(*pCtrl));
@@ -754,46 +644,6 @@ void ScCalcOptionsDialog::EditFieldValueChanged(Control *pCtrl)
// 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::OpenCLImplMatcher& impl(CurrentWhiteOrBlackListEntry());
- ScCalcConfig::OpenCLImplMatcher newImpl(impl);
-
- if (&rEdit == mpOS)
- {
- newImpl.maOS = sVal;
- }
- else if (&rEdit == mpOSVersion)
- {
- newImpl.maOSVersion = sVal;
- }
- else if (&rEdit == mpPlatformVendor)
- {
- newImpl.maPlatformVendor = sVal;
- }
- else if (&rEdit == mpDevice)
- {
- newImpl.maDevice = sVal;
- }
- else if (&rEdit == mpDriverVersion)
- {
- newImpl.maDriverVersion = sVal;
- }
- else
- assert(false && "rEdit does not match any of the Edit fields");
-
- ScCalcConfig::OpenCLImplMatcherSet& rSet(CurrentWhiteOrBlackList());
-
- rSet.erase(impl);
- rSet.insert(newImpl);
-#if HAVE_FEATURE_OPENCL
- fillListBox(mpOpenCLWhiteAndBlackListBox, rSet);
- mpOpenCLWhiteAndBlackListBox->SelectEntry(format(newImpl));
-#endif
- }
}
OUString ScCalcOptionsDialog::toString(formula::FormulaGrammar::AddressConvention eConv) const
@@ -879,54 +729,7 @@ IMPL_LINK(ScCalcOptionsDialog, EditModifiedHdl, Control*, pCtrl)
return 0;
}
-IMPL_LINK(ScCalcOptionsDialog, OpenCLWhiteAndBlackListSelHdl, Control*, )
-{
- // We know this handler is used for the mpOpenCLWhiteAndBlackListBox
-
- const ScCalcConfig::OpenCLImplMatcher& impl(CurrentWhiteOrBlackListEntry());
-
- mpOS->SetText(impl.maOS);
- mpOSVersion->SetText(impl.maOSVersion);
- mpPlatformVendor->SetText(impl.maPlatformVendor);
- mpDevice->SetText(impl.maDevice);
- mpDriverVersion->SetText(impl.maDriverVersion);
-
- return 0;
-}
-
-IMPL_LINK( ScCalcOptionsDialog, ListNewClickHdl, PushButton*, )
-{
- ScCalcConfig::OpenCLImplMatcher aEmpty;
- ScCalcConfig::OpenCLImplMatcherSet& rSet(CurrentWhiteOrBlackList());
-
- mpOS->SetText("");
- mpOSVersion->SetText("");
- mpPlatformVendor->SetText("");
- mpDevice->SetText("");
- mpDriverVersion->SetText("");
-
- rSet.insert(aEmpty);
-#if HAVE_FEATURE_OPENCL
- fillListBox(mpOpenCLWhiteAndBlackListBox, rSet);
- mpOpenCLWhiteAndBlackListBox->SelectEntry(format(aEmpty));
-#endif
- return 0;
-}
-
-IMPL_LINK( ScCalcOptionsDialog, ListDeleteClickHdl, PushButton*, )
-{
- if (mpOpenCLWhiteAndBlackListBox->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND)
- return 0;
-
- ScCalcConfig::OpenCLImplMatcherSet& rSet(CurrentWhiteOrBlackList());
- const ScCalcConfig::OpenCLImplMatcher& rImpl(CurrentWhiteOrBlackListEntry());
-
-#if HAVE_FEATURE_OPENCL
- rSet.erase(rImpl);
- fillListBox(mpOpenCLWhiteAndBlackListBox, rSet);
-#endif
- return 0;
-}
+#if 0
namespace {
@@ -1360,4 +1163,6 @@ IMPL_LINK( ScCalcOptionsDialog, TestClickHdl, PushButton*, )
return 0;
}
+#endif
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/optdlg/calcoptionsdlg.hxx b/sc/source/ui/optdlg/calcoptionsdlg.hxx
index 5c483b02976f..789c01ddbd7d 100644
--- a/sc/source/ui/optdlg/calcoptionsdlg.hxx
+++ b/sc/source/ui/optdlg/calcoptionsdlg.hxx
@@ -25,7 +25,8 @@
#include "calcconfig.hxx"
#if HAVE_FEATURE_OPENCL
-#include "platforminfo.hxx"
+#include <opencl/openclconfig.hxx>
+#include <opencl/platforminfo.hxx>
#endif
class ScCalcOptionsDialog : public ModalDialog
@@ -40,10 +41,6 @@ public:
DECL_LINK( DeviceSelHdl, void* );
DECL_LINK( NumModifiedHdl, void * );
DECL_LINK( EditModifiedHdl, Control * );
- DECL_LINK( OpenCLWhiteAndBlackListSelHdl, Control* );
- DECL_LINK( ListNewClickHdl, PushButton* );
- DECL_LINK( ListDeleteClickHdl, PushButton* );
- DECL_LINK( TestClickHdl, PushButton* );
const ScCalcConfig& GetConfig() const { return maConfig;}
@@ -66,8 +63,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::OpenCLImplMatcher>& CurrentWhiteOrBlackList();
- const ScCalcConfig::OpenCLImplMatcher& CurrentWhiteOrBlackListEntry();
+ OpenCLConfig::ImplMatcherSet& CurrentWhiteOrBlackList();
+ const OpenCLConfig::ImplMatcher& CurrentWhiteOrBlackListEntry();
private:
SvxCheckListBox* mpLbSettings;
@@ -77,16 +74,6 @@ private:
RadioButton* mpBtnFalse;
NumericField* mpSpinButton;
Edit* mpEditField;
- VclGrid* mpOpenCLWhiteAndBlackListGrid;
- ListBox* mpOpenCLWhiteAndBlackListBox;
- Edit* mpOS;
- Edit* mpOSVersion;
- Edit* mpPlatformVendor;
- Edit* mpDevice;
- Edit* mpDriverVersion;
- PushButton* mpListNewButton;
- PushButton* mpListDeleteButton;
- PushButton* mpTestButton;
FixedText* mpFtAnnotation;
FixedText* mpFtFrequency;
@@ -128,17 +115,11 @@ private:
OUString maCaptionOpenCLSubsetOpCodes;
OUString maDescOpenCLSubsetOpCodes;
- OUString maCaptionOpenCLWhiteList;
- OUString maDescOpenCLWhiteList;
-
- OUString maCaptionOpenCLBlackList;
- OUString maDescOpenCLBlackList;
-
OUString maSoftware;
ScCalcConfig maConfig;
#if HAVE_FEATURE_OPENCL
- std::vector<sc::OpenCLPlatformInfo> maPlatformInfo;
+ std::vector<OpenCLPlatformInfo> maPlatformInfo;
#endif
bool mbSelectedEmptyStringAsZero;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 94a06f050073..2e1ee23d5235 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -58,6 +58,7 @@
#include <comphelper/servicehelper.hxx>
#include <comphelper/string.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <opencl/platforminfo.hxx>
#include "docuno.hxx"
#include "cellsuno.hxx"
@@ -93,7 +94,6 @@
#include "sheetevents.hxx"
#include "sc.hrc"
#include "scresid.hxx"
-#include "platforminfo.hxx"
#include "interpre.hxx"
#include "formulagroup.hxx"
#include "gridwin.hxx"
@@ -2369,7 +2369,7 @@ void ScModelObj::selectOpenCLDevice( sal_Int32 nPlatform, sal_Int32 nDevice )
if(nPlatform < 0 || nDevice < 0)
throw uno::RuntimeException();
- std::vector<sc::OpenCLPlatformInfo> aPlatformInfo;
+ std::vector<OpenCLPlatformInfo> aPlatformInfo;
sc::FormulaGroupInterpreter::fillOpenCLInfo(aPlatformInfo);
if(size_t(nPlatform) >= aPlatformInfo.size())
throw uno::RuntimeException();
@@ -2402,7 +2402,7 @@ sal_Int32 ScModelObj::getDeviceID()
uno::Sequence< sheet::opencl::OpenCLPlatform > ScModelObj::getOpenCLPlatforms()
throw (uno::RuntimeException, std::exception)
{
- std::vector<sc::OpenCLPlatformInfo> aPlatformInfo;
+ std::vector<OpenCLPlatformInfo> aPlatformInfo;
sc::FormulaGroupInterpreter::fillOpenCLInfo(aPlatformInfo);
uno::Sequence<sheet::opencl::OpenCLPlatform> aRet(aPlatformInfo.size());
@@ -2414,7 +2414,7 @@ uno::Sequence< sheet::opencl::OpenCLPlatform > ScModelObj::getOpenCLPlatforms()
aRet[i].Devices.realloc(aPlatformInfo[i].maDevices.size());
for(size_t j = 0; j < aPlatformInfo[i].maDevices.size(); ++j)
{
- const sc::OpenCLDeviceInfo& rDevice = aPlatformInfo[i].maDevices[j];
+ const OpenCLDeviceInfo& rDevice = aPlatformInfo[i].maDevices[j];
aRet[i].Devices[j].Name = rDevice.maName;
aRet[i].Devices[j].Vendor = rDevice.maVendor;
aRet[i].Devices[j].Driver = rDevice.maDriver;