LibreOffice Module cui (master) 1
optopencl.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <vcl/svapp.hxx>
21#include <vcl/weld.hxx>
24#include <officecfg/Office/Common.hxx>
26
27#include "optopencl.hxx"
28
30 : SfxTabPage(pPage, pController, "cui/ui/optopenclpage.ui", "OptOpenCLPage", &rSet)
31 , maConfig(OpenCLConfig::get())
32 , mxUseOpenCL(m_xBuilder->weld_check_button("useopencl"))
33 , mxOclUsed(m_xBuilder->weld_label("openclused"))
34 , mxOclNotUsed(m_xBuilder->weld_label("openclnotused"))
35{
36 mxUseOpenCL->set_active(maConfig.mbUseOpenCL);
37 mxUseOpenCL->set_sensitive(!officecfg::Office::Common::Misc::UseOpenCL::isReadOnly());
38
40 mxOclUsed->set_visible(bCLUsed);
41 mxOclNotUsed->set_visible(!bCLUsed);
42}
43
45{
46}
47
48std::unique_ptr<SfxTabPage> SvxOpenCLTabPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrSet)
49{
50 return std::make_unique<SvxOpenCLTabPage>(pPage, pController, *rAttrSet);
51}
52
54{
55 bool bModified = false;
56 std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create());
57
58 if (mxUseOpenCL->get_state_changed_from_saved())
59 maConfig.mbUseOpenCL = mxUseOpenCL->get_active();
60
62 {
63 maConfig.set();
64 bModified = true;
65 }
66
67 if (bModified)
68 {
69 batch->commit();
70 SolarMutexGuard aGuard;
73 GetDialogController()->response(RET_OK);
74 }
75
76 return bModified;
77}
78
80{
82
83 mxUseOpenCL->set_active(maConfig.mbUseOpenCL);
84 mxUseOpenCL->save_state();
85}
86
87
88/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SfxOkDialogController * GetDialogController() const
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rSet)
Definition: optopencl.cxx:48
std::unique_ptr< weld::CheckButton > mxUseOpenCL
Definition: optopencl.hxx:29
virtual ~SvxOpenCLTabPage() override
Definition: optopencl.cxx:44
std::unique_ptr< weld::Label > mxOclUsed
Definition: optopencl.hxx:30
SvxOpenCLTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
Definition: optopencl.cxx:29
virtual bool FillItemSet(SfxItemSet *rSet) override
Definition: optopencl.cxx:53
virtual void Reset(const SfxItemSet *rSet) override
Definition: optopencl.cxx:79
std::unique_ptr< weld::Label > mxOclNotUsed
Definition: optopencl.hxx:31
OpenCLConfig maConfig
Definition: optopencl.hxx:27
static std::shared_ptr< ConfigurationChanges > create()
Reference< XComponentContext > getProcessComponentContext()
RESTART_REASON_OPENCL
SVT_DLLPUBLIC bool executeRestartDialog(css::uno::Reference< css::uno::XComponentContext > const &context, weld::Window *parent, RestartReason reason)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
static SfxItemSet & rSet
static OpenCLConfig get()
static bool isOpenCLEnabled()
RET_OK