tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / solveroptions.hxx
bloba43a6b6320e0ad1809a889ffdd4616d8497c59ed
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <utility>
23 #include <vcl/weld.hxx>
24 #include <com/sun/star/uno/Sequence.hxx>
26 namespace com::sun::star {
27 namespace beans { struct PropertyValue; }
30 class ScSolverOptionsString
32 bool mbIsDouble;
33 double mfDoubleValue;
34 sal_Int32 mnIntValue;
35 OUString msStr;
37 public:
38 explicit ScSolverOptionsString(OUString aStr)
39 : mbIsDouble(false)
40 , mfDoubleValue(0.0)
41 , mnIntValue(0)
42 , msStr(std::move(aStr))
46 bool IsDouble() const { return mbIsDouble; }
47 double GetDoubleValue() const { return mfDoubleValue; }
48 sal_Int32 GetIntValue() const { return mnIntValue; }
49 const OUString& GetText() const { return msStr; }
51 void SetDoubleValue( double fNew ) { mbIsDouble = true; mfDoubleValue = fNew; }
52 void SetIntValue( sal_Int32 nNew ) { mbIsDouble = false; mnIntValue = nNew; }
55 class ScSolverIntegerDialog;
56 class ScSolverValueDialog;
58 class ScSolverOptionsDialog : public weld::GenericDialogController
60 css::uno::Sequence<OUString> maImplNames;
61 OUString maEngine;
62 css::uno::Sequence<css::beans::PropertyValue> maProperties;
64 std::vector<std::unique_ptr<ScSolverOptionsString>> m_aOptions;
66 std::unique_ptr<weld::ComboBox> m_xLbEngine;
67 std::unique_ptr<weld::TreeView> m_xLbSettings;
68 std::unique_ptr<weld::Button> m_xBtnEdit;
70 std::shared_ptr<ScSolverIntegerDialog> m_xIntDialog;
71 std::shared_ptr<ScSolverValueDialog> m_xValDialog;
73 DECL_LINK( EngineSelectHdl, weld::ComboBox&, void );
74 DECL_LINK( SettingsSelHdl, weld::TreeView&, void );
75 DECL_LINK( SettingsDoubleClickHdl, weld::TreeView&, bool );
76 DECL_LINK( ButtonHdl, weld::Button&, void );
78 void ReadFromComponent();
79 void FillListBox();
80 void EditOption();
82 public:
83 ScSolverOptionsDialog( weld::Window* pParent,
84 const css::uno::Sequence<OUString>& rImplNames,
85 const css::uno::Sequence<OUString>& rDescriptions,
86 OUString aEngine,
87 const css::uno::Sequence<css::beans::PropertyValue>& rProperties );
88 virtual ~ScSolverOptionsDialog() override;
90 // already updated in selection handler
91 const OUString& GetEngine() const { return maEngine; }
92 const css::uno::Sequence<css::beans::PropertyValue>& GetProperties();
95 class ScSolverIntegerDialog : public weld::GenericDialogController
97 std::unique_ptr<weld::Frame> m_xFrame;
98 std::unique_ptr<weld::SpinButton> m_xNfValue;
100 public:
101 ScSolverIntegerDialog(weld::Window* pParent);
102 virtual ~ScSolverIntegerDialog() override;
104 void SetOptionName( const OUString& rName );
105 void SetValue( sal_Int32 nValue );
106 void SetMax( sal_Int32 nValue );
107 sal_Int32 GetValue() const;
110 class ScSolverValueDialog : public weld::GenericDialogController
112 std::unique_ptr<weld::Frame> m_xFrame;
113 std::unique_ptr<weld::Entry> m_xEdValue;
114 double m_fMaxValue;
116 public:
117 ScSolverValueDialog(weld::Window* pParent);
118 virtual ~ScSolverValueDialog() override;
120 void SetOptionName( const OUString& rName );
121 void SetValue( double fValue );
122 void SetMax( double fValue );
123 double GetValue() const;
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */