xref: /aoo4110/main/sc/source/ui/inc/solvrdlg.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_SOLVRDLG_HXX
25 #define SC_SOLVRDLG_HXX
26 
27 #include "global.hxx"
28 #include "address.hxx"
29 #include "anyrefdg.hxx"
30 
31 
32 #include <vcl/fixed.hxx>
33 #include <vcl/group.hxx>
34 
35 //----------------------------------------------------------------------------
36 
37 enum ScSolverErr
38 	{
39 		SOLVERR_NOFORMULA,
40 		SOLVERR_INVALID_FORMULA,
41 		SOLVERR_INVALID_VARIABLE,
42 		SOLVERR_INVALID_TARGETVALUE
43 	};
44 
45 
46 //============================================================================
47 
48 class ScSolverDlg : public ScAnyRefDlg
49 {
50 public:
51 					ScSolverDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
52 								 ScDocument* pDocument,
53 								 ScAddress aCursorPos );
54 					~ScSolverDlg();
55 
56 	virtual void	SetReference( const ScRange& rRef, ScDocument* pDoc );
57     virtual sal_Bool    IsRefInputMode() const;
58 	virtual void	SetActive();
59 	virtual sal_Bool	Close();
60 
61 private:
62     FixedLine       aFlVariables;
63 	FixedText		aFtFormulaCell;
64     formula::RefEdit		aEdFormulaCell;
65 	formula::RefButton		aRBFormulaCell;
66 
67 	FixedText		aFtTargetVal;
68 	Edit			aEdTargetVal;
69 
70 	FixedText		aFtVariableCell;
71 	formula::RefEdit		aEdVariableCell;
72 	formula::RefButton		aRBVariableCell;
73 
74 	OKButton		aBtnOk;
75 	CancelButton	aBtnCancel;
76 	HelpButton		aBtnHelp;
77 
78 	ScAddress		theFormulaCell;
79 	ScAddress		theVariableCell;
80 	String			theTargetValStr;
81 
82 	ScDocument*		pDoc;
83 	const SCTAB	    nCurTab;
84     formula::RefEdit*		pEdActive;
85 	sal_Bool			bDlgLostFocus;
86 	const String	errMsgInvalidVar;
87 	const String	errMsgInvalidForm;
88 	const String	errMsgNoFormula;
89 	const String	errMsgInvalidVal;
90 
91 
92 #ifdef _SOLVRDLG_CXX
93 	void	Init();
94 	sal_Bool	CheckTargetValue( String& rStrVal );
95 	void	RaiseError( ScSolverErr eError );
96 
97 	DECL_LINK( BtnHdl, PushButton* );
98     DECL_LINK( GetFocusHdl, Control* );
99     DECL_LINK( LoseFocusHdl, Control* );
100 #endif	// _SOLVERDLG_CXX
101 };
102 
103 #endif // SC_SOLVRDLG_HXX
104 
105 
106