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 <vcl/weld.hxx>
23 #include <com/sun/star/uno/Sequence.hxx>
24 
25 namespace com::sun::star {
26  namespace beans { struct PropertyValue; }
27 }
28 
30 {
31  bool mbIsDouble;
32  double mfDoubleValue;
33  sal_Int32 mnIntValue;
34  OUString msStr;
35 
36 public:
37  explicit ScSolverOptionsString(const OUString& rStr)
38  : mbIsDouble(false)
39  , mfDoubleValue(0.0)
40  , mnIntValue(0)
41  , msStr(rStr)
42  {
43  }
44 
45  bool IsDouble() const { return mbIsDouble; }
46  double GetDoubleValue() const { return mfDoubleValue; }
47  sal_Int32 GetIntValue() const { return mnIntValue; }
48  const OUString& GetText() const { return msStr; }
49 
50  void SetDoubleValue( double fNew ) { mbIsDouble = true; mfDoubleValue = fNew; }
51  void SetIntValue( sal_Int32 nNew ) { mbIsDouble = false; mnIntValue = nNew; }
52 };
53 
56 
58 {
59  css::uno::Sequence<OUString> maImplNames;
60  OUString maEngine;
61  css::uno::Sequence<css::beans::PropertyValue> maProperties;
62 
63  std::vector<std::unique_ptr<ScSolverOptionsString>> m_aOptions;
64 
65  std::unique_ptr<weld::ComboBox> m_xLbEngine;
66  std::unique_ptr<weld::TreeView> m_xLbSettings;
67  std::unique_ptr<weld::Button> m_xBtnEdit;
68 
69  std::shared_ptr<ScSolverIntegerDialog> m_xIntDialog;
70  std::shared_ptr<ScSolverValueDialog> m_xValDialog;
71 
72  DECL_LINK( EngineSelectHdl, weld::ComboBox&, void );
73  DECL_LINK( SettingsSelHdl, weld::TreeView&, void );
74  DECL_LINK( SettingsDoubleClickHdl, weld::TreeView&, bool );
75  DECL_LINK( ButtonHdl, weld::Button&, void );
76 
77  void ReadFromComponent();
78  void FillListBox();
79  void EditOption();
80 
81 public:
83  const css::uno::Sequence<OUString>& rImplNames,
84  const css::uno::Sequence<OUString>& rDescriptions,
85  const OUString& rEngine,
86  const css::uno::Sequence<css::beans::PropertyValue>& rProperties );
87  virtual ~ScSolverOptionsDialog() override;
88 
89  // already updated in selection handler
90  const OUString& GetEngine() const { return maEngine; }
91  const css::uno::Sequence<css::beans::PropertyValue>& GetProperties();
92 };
93 
95 {
96  std::unique_ptr<weld::Frame> m_xFrame;
97  std::unique_ptr<weld::SpinButton> m_xNfValue;
98 
99 public:
101  virtual ~ScSolverIntegerDialog() override;
102 
103  void SetOptionName( const OUString& rName );
104  void SetValue( sal_Int32 nValue );
105  void SetMax( sal_Int32 nValue );
106  sal_Int32 GetValue() const;
107 };
108 
110 {
111  std::unique_ptr<weld::Frame> m_xFrame;
112  std::unique_ptr<weld::Entry> m_xEdValue;
113  double m_fMaxValue;
114 
115 public:
117  virtual ~ScSolverValueDialog() override;
118 
119  void SetOptionName( const OUString& rName );
120  void SetValue( double fValue );
121  void SetMax( double fValue );
122  double GetValue() const;
123 };
124 
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~ScSolverValueDialog() override
ScSolverOptionsDialog(weld::Window *pParent, const css::uno::Sequence< OUString > &rImplNames, const css::uno::Sequence< OUString > &rDescriptions, const OUString &rEngine, const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
void SetDoubleValue(double fNew)
void SetMax(sal_Int32 nValue)
const css::uno::Sequence< css::beans::PropertyValue > & GetProperties()
sal_Int32 GetIntValue() const
ScSolverIntegerDialog(weld::Window *pParent)
void SetIntValue(sal_Int32 nNew)
std::unique_ptr< weld::Entry > m_xEdValue
std::unique_ptr< weld::SpinButton > m_xNfValue
const OUString & GetEngine() const
void SetValue(double fValue)
virtual ~ScSolverIntegerDialog() override
css::uno::Sequence< OUString > maImplNames
ScSolverValueDialog(weld::Window *pParent)
void SetOptionName(const OUString &rName)
DECL_LINK(EngineSelectHdl, weld::ComboBox &, void)
bool IsDouble() const
std::shared_ptr< ScSolverValueDialog > m_xValDialog
exports com.sun.star. beans
double GetDoubleValue() const
ScSolverOptionsString(const OUString &rStr)
void SetMax(double fValue)
std::unique_ptr< weld::Frame > m_xFrame
void SetValue(sal_Int32 nValue)
std::shared_ptr< ScSolverIntegerDialog > m_xIntDialog
virtual ~ScSolverOptionsDialog() override
std::unique_ptr< weld::Button > m_xBtnEdit
const OUString & GetText() const
css::uno::Sequence< css::beans::PropertyValue > maProperties
sal_Int32 GetValue() const
std::unique_ptr< weld::Frame > m_xFrame
std::unique_ptr< weld::ComboBox > m_xLbEngine
double GetValue() const
void SetOptionName(const OUString &rName)
std::vector< std::unique_ptr< ScSolverOptionsString > > m_aOptions
std::unique_ptr< weld::TreeView > m_xLbSettings