xref: /aoo41x/main/sc/source/ui/inc/solvrdlg.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SC_SOLVRDLG_HXX
29 #define SC_SOLVRDLG_HXX
30 
31 #include "global.hxx"
32 #include "address.hxx"
33 #include "anyrefdg.hxx"
34 
35 
36 #include <vcl/fixed.hxx>
37 #include <vcl/group.hxx>
38 
39 //----------------------------------------------------------------------------
40 
41 enum ScSolverErr
42 	{
43 		SOLVERR_NOFORMULA,
44 		SOLVERR_INVALID_FORMULA,
45 		SOLVERR_INVALID_VARIABLE,
46 		SOLVERR_INVALID_TARGETVALUE
47 	};
48 
49 
50 //============================================================================
51 
52 class ScSolverDlg : public ScAnyRefDlg
53 {
54 public:
55 					ScSolverDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
56 								 ScDocument* pDocument,
57 								 ScAddress aCursorPos );
58 					~ScSolverDlg();
59 
60 	virtual void	SetReference( const ScRange& rRef, ScDocument* pDoc );
61     virtual sal_Bool    IsRefInputMode() const;
62 	virtual void	SetActive();
63 	virtual sal_Bool	Close();
64 
65 private:
66     FixedLine       aFlVariables;
67 	FixedText		aFtFormulaCell;
68     formula::RefEdit		aEdFormulaCell;
69 	formula::RefButton		aRBFormulaCell;
70 
71 	FixedText		aFtTargetVal;
72 	Edit			aEdTargetVal;
73 
74 	FixedText		aFtVariableCell;
75 	formula::RefEdit		aEdVariableCell;
76 	formula::RefButton		aRBVariableCell;
77 
78 	OKButton		aBtnOk;
79 	CancelButton	aBtnCancel;
80 	HelpButton		aBtnHelp;
81 
82 	ScAddress		theFormulaCell;
83 	ScAddress		theVariableCell;
84 	String			theTargetValStr;
85 
86 	ScDocument*		pDoc;
87 	const SCTAB	    nCurTab;
88     formula::RefEdit*		pEdActive;
89 	sal_Bool			bDlgLostFocus;
90 	const String	errMsgInvalidVar;
91 	const String	errMsgInvalidForm;
92 	const String	errMsgNoFormula;
93 	const String	errMsgInvalidVal;
94 
95 
96 #ifdef _SOLVRDLG_CXX
97 	void	Init();
98 	sal_Bool	CheckTargetValue( String& rStrVal );
99 	void	RaiseError( ScSolverErr eError );
100 
101 	DECL_LINK( BtnHdl, PushButton* );
102     DECL_LINK( GetFocusHdl, Control* );
103     DECL_LINK( LoseFocusHdl, Control* );
104 #endif	// _SOLVERDLG_CXX
105 };
106 
107 #endif // SC_SOLVRDLG_HXX
108 
109 
110