From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- sc/source/ui/optdlg/tpcompatibility.cxx | 76 +++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sc/source/ui/optdlg/tpcompatibility.cxx (limited to 'sc/source/ui/optdlg/tpcompatibility.cxx') diff --git a/sc/source/ui/optdlg/tpcompatibility.cxx b/sc/source/ui/optdlg/tpcompatibility.cxx new file mode 100644 index 000000000..65d1b80b4 --- /dev/null +++ b/sc/source/ui/optdlg/tpcompatibility.cxx @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#undef SC_DLLIMPLEMENTATION + +#include + +#include +#include +#include + +ScTpCompatOptions::ScTpCompatOptions(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rCoreAttrs) + : SfxTabPage(pPage, pController, "modules/scalc/ui/optcompatibilitypage.ui", "OptCompatibilityPage", &rCoreAttrs) + , m_xLbKeyBindings(m_xBuilder->weld_combo_box("keybindings")) +{ +} + +ScTpCompatOptions::~ScTpCompatOptions() +{ +} + +std::unique_ptr ScTpCompatOptions::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rCoreAttrs) +{ + return std::make_unique(pPage, pController, *rCoreAttrs); +} + +bool ScTpCompatOptions::FillItemSet(SfxItemSet *rCoreAttrs) +{ + bool bRet = false; + if (m_xLbKeyBindings->get_value_changed_from_saved()) + { + rCoreAttrs->Put( + SfxUInt16Item( + SID_SC_OPT_KEY_BINDING_COMPAT, m_xLbKeyBindings->get_active())); + bRet = true; + } + return bRet; +} + +void ScTpCompatOptions::Reset(const SfxItemSet *rCoreAttrs) +{ + const SfxPoolItem* pItem; + if (rCoreAttrs->HasItem(SID_SC_OPT_KEY_BINDING_COMPAT, &pItem)) + { + const SfxUInt16Item* p16Item = static_cast(pItem); + ScOptionsUtil::KeyBindingType eKeyB = + static_cast(p16Item->GetValue()); + + switch (eKeyB) + { + case ScOptionsUtil::KEY_DEFAULT: + m_xLbKeyBindings->set_active(0); + break; + case ScOptionsUtil::KEY_OOO_LEGACY: + m_xLbKeyBindings->set_active(1); + break; + default: + ; + } + } + + m_xLbKeyBindings->save_value(); +} + +DeactivateRC ScTpCompatOptions::DeactivatePage(SfxItemSet* /*pSet*/) +{ + return DeactivateRC::KeepPage; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3