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 #ifndef INCLUDED_SC_SOURCE_UI_INC_SOLVEROPTIONS_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_SOLVEROPTIONS_HXX
22 
23 #include <vcl/weld.hxx>
24 #include <com/sun/star/uno/Sequence.hxx>
25 
26 namespace com::sun::star {
27  namespace beans { struct PropertyValue; }
28 }
29 
31 {
32  bool mbIsDouble;
33  double mfDoubleValue;
34  sal_Int32 mnIntValue;
35  OUString msStr;
36 
37 public:
38  explicit ScSolverOptionsString(const OUString& rStr)
39  : mbIsDouble(false)
40  , mfDoubleValue(0.0)
41  , mnIntValue(0)
42  , msStr(rStr)
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 
82 public:
84  const css::uno::Sequence<OUString>& rImplNames,
85  const css::uno::Sequence<OUString>& rDescriptions,
86  const OUString& rEngine,
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 
100 public:
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;
114  double m_fMaxValue;
115 
116 public:
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 #endif
127 
128 /* 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