LibreOffice Module sc (master) 1
solveroptions.hxx
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#pragma once
21
22#include <utility>
23#include <vcl/weld.hxx>
24#include <com/sun/star/uno/Sequence.hxx>
25
26namespace com::sun::star {
27 namespace beans { struct PropertyValue; }
28}
29
31{
34 sal_Int32 mnIntValue;
35 OUString msStr;
36
37public:
38 explicit ScSolverOptionsString(OUString aStr)
39 : mbIsDouble(false)
40 , mfDoubleValue(0.0)
41 , mnIntValue(0)
42 , msStr(std::move(aStr))
43 {
44 }
45
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; }
50
51 void SetDoubleValue( double fNew ) { mbIsDouble = true; mfDoubleValue = fNew; }
52 void SetIntValue( sal_Int32 nNew ) { mbIsDouble = false; mnIntValue = nNew; }
53};
54
57
59{
60 css::uno::Sequence<OUString> maImplNames;
61 OUString maEngine;
62 css::uno::Sequence<css::beans::PropertyValue> maProperties;
63
64 std::vector<std::unique_ptr<ScSolverOptionsString>> m_aOptions;
65
66 std::unique_ptr<weld::ComboBox> m_xLbEngine;
67 std::unique_ptr<weld::TreeView> m_xLbSettings;
68 std::unique_ptr<weld::Button> m_xBtnEdit;
69
70 std::shared_ptr<ScSolverIntegerDialog> m_xIntDialog;
71 std::shared_ptr<ScSolverValueDialog> m_xValDialog;
72
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 );
77
78 void ReadFromComponent();
79 void FillListBox();
80 void EditOption();
81
82public:
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;
89
90 // already updated in selection handler
91 const OUString& GetEngine() const { return maEngine; }
92 const css::uno::Sequence<css::beans::PropertyValue>& GetProperties();
93};
94
96{
97 std::unique_ptr<weld::Frame> m_xFrame;
98 std::unique_ptr<weld::SpinButton> m_xNfValue;
99
100public:
102 virtual ~ScSolverIntegerDialog() override;
103
104 void SetOptionName( const OUString& rName );
105 void SetValue( sal_Int32 nValue );
106 void SetMax( sal_Int32 nValue );
107 sal_Int32 GetValue() const;
108};
109
111{
112 std::unique_ptr<weld::Frame> m_xFrame;
113 std::unique_ptr<weld::Entry> m_xEdValue;
115
116public:
118 virtual ~ScSolverValueDialog() override;
119
120 void SetOptionName( const OUString& rName );
121 void SetValue( double fValue );
122 void SetMax( double fValue );
123 double GetValue() const;
124};
125
126/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 GetValue() const
std::unique_ptr< weld::SpinButton > m_xNfValue
void SetValue(sal_Int32 nValue)
virtual ~ScSolverIntegerDialog() override
void SetOptionName(const OUString &rName)
void SetMax(sal_Int32 nValue)
std::unique_ptr< weld::Frame > m_xFrame
ScSolverIntegerDialog(weld::Window *pParent)
DECL_LINK(SettingsSelHdl, weld::TreeView &, void)
css::uno::Sequence< OUString > maImplNames
std::shared_ptr< ScSolverIntegerDialog > m_xIntDialog
DECL_LINK(EngineSelectHdl, weld::ComboBox &, void)
std::shared_ptr< ScSolverValueDialog > m_xValDialog
const OUString & GetEngine() const
virtual ~ScSolverOptionsDialog() override
std::unique_ptr< weld::Button > m_xBtnEdit
std::unique_ptr< weld::ComboBox > m_xLbEngine
std::unique_ptr< weld::TreeView > m_xLbSettings
DECL_LINK(ButtonHdl, weld::Button &, void)
const css::uno::Sequence< css::beans::PropertyValue > & GetProperties()
ScSolverOptionsDialog(weld::Window *pParent, const css::uno::Sequence< OUString > &rImplNames, const css::uno::Sequence< OUString > &rDescriptions, OUString aEngine, const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
css::uno::Sequence< css::beans::PropertyValue > maProperties
std::vector< std::unique_ptr< ScSolverOptionsString > > m_aOptions
DECL_LINK(SettingsDoubleClickHdl, weld::TreeView &, bool)
const OUString & GetText() const
ScSolverOptionsString(OUString aStr)
double GetDoubleValue() const
sal_Int32 GetIntValue() const
void SetIntValue(sal_Int32 nNew)
void SetDoubleValue(double fNew)
void SetOptionName(const OUString &rName)
virtual ~ScSolverValueDialog() override
std::unique_ptr< weld::Frame > m_xFrame
double GetValue() const
std::unique_ptr< weld::Entry > m_xEdValue
void SetMax(double fValue)
ScSolverValueDialog(weld::Window *pParent)
void SetValue(double fValue)
aStr