1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_SC_SOURCE_UI_INC_SOLVEROPTIONS_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_SOLVEROPTIONS_HXX
23 #include <vcl/weld.hxx>
24 #include <com/sun/star/uno/Sequence.hxx>
26 namespace com
{ namespace sun
{ namespace star
{
27 namespace beans
{ struct PropertyValue
; }
30 class ScSolverOptionsString
38 explicit ScSolverOptionsString(const OUString
& rStr
)
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 ScSolverOptionsDialog
: public weld::GenericDialogController
57 css::uno::Sequence
<OUString
> maImplNames
;
58 css::uno::Sequence
<OUString
> maDescriptions
;
60 css::uno::Sequence
<css::beans::PropertyValue
> maProperties
;
62 std::vector
<std::unique_ptr
<ScSolverOptionsString
>> m_aOptions
;
64 std::unique_ptr
<weld::ComboBox
> m_xLbEngine
;
65 std::unique_ptr
<weld::TreeView
> m_xLbSettings
;
66 std::unique_ptr
<weld::Button
> m_xBtnEdit
;
68 DECL_LINK( EngineSelectHdl
, weld::ComboBox
&, void );
69 DECL_LINK( SettingsSelHdl
, weld::TreeView
&, void );
70 DECL_LINK( SettingsDoubleClickHdl
, weld::TreeView
&, bool );
71 DECL_LINK( ButtonHdl
, weld::Button
&, void );
73 void ReadFromComponent();
78 ScSolverOptionsDialog( weld::Window
* pParent
,
79 const css::uno::Sequence
<OUString
>& rImplNames
,
80 const css::uno::Sequence
<OUString
>& rDescriptions
,
81 const OUString
& rEngine
,
82 const css::uno::Sequence
<css::beans::PropertyValue
>& rProperties
);
83 virtual ~ScSolverOptionsDialog() override
;
85 // already updated in selection handler
86 const OUString
& GetEngine() const { return maEngine
; }
87 const css::uno::Sequence
<css::beans::PropertyValue
>& GetProperties();
90 class ScSolverIntegerDialog
: public weld::GenericDialogController
92 std::unique_ptr
<weld::Frame
> m_xFrame
;
93 std::unique_ptr
<weld::SpinButton
> m_xNfValue
;
96 ScSolverIntegerDialog(weld::Window
* pParent
);
97 virtual ~ScSolverIntegerDialog() override
;
99 void SetOptionName( const OUString
& rName
);
100 void SetValue( sal_Int32 nValue
);
101 sal_Int32
GetValue() const;
104 class ScSolverValueDialog
: public weld::GenericDialogController
106 std::unique_ptr
<weld::Frame
> m_xFrame
;
107 std::unique_ptr
<weld::Entry
> m_xEdValue
;
110 ScSolverValueDialog(weld::Window
* pParent
);
111 virtual ~ScSolverValueDialog() override
;
113 void SetOptionName( const OUString
& rName
);
114 void SetValue( double fValue
);
115 double GetValue() const;
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */