xref: /trunk/main/sc/source/ui/inc/crnrdlg.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_CRNRDLG_HXX
29 #define SC_CRNRDLG_HXX
30 
31 #include "anyrefdg.hxx"
32 #include "rangelst.hxx"
33 #include <vcl/fixed.hxx>
34 #include <vcl/lstbox.hxx>
35 
36 #include <hash_map>
37 
38 class ScViewData;
39 class ScDocument;
40 
41 
42 //============================================================================
43 
44 class ScColRowNameRangesDlg : public ScAnyRefDlg
45 {
46 public:
47 					ScColRowNameRangesDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
48 								 ScViewData*	ptrViewData );
49 					~ScColRowNameRangesDlg();
50 
51 	virtual void	SetReference( const ScRange& rRef, ScDocument* pDoc );
52 
53 	virtual sal_Bool	IsRefInputMode() const;
54 	virtual void	SetActive();
55 	virtual sal_Bool	Close();
56 
57 private:
58     FixedLine       aFlAssign;
59 	ListBox			aLbRange;
60 
61 	formula::RefEdit		aEdAssign;
62 	formula::RefButton		aRbAssign;
63 	RadioButton		aBtnColHead;
64 	RadioButton		aBtnRowHead;
65 	FixedText		aFtAssign2;
66 	formula::RefEdit		aEdAssign2;
67 	formula::RefButton		aRbAssign2;
68 
69 	OKButton		aBtnOk;
70 	CancelButton	aBtnCancel;
71 	HelpButton		aBtnHelp;
72 	PushButton		aBtnAdd;
73 	PushButton		aBtnRemove;
74 
75 	ScRange			theCurArea;
76 	ScRange			theCurData;
77 
78 	ScRangePairListRef	xColNameRanges;
79 	ScRangePairListRef	xRowNameRanges;
80 
81     typedef ::std::hash_map< String, ScRange, ScStringHashCode, ::std::equal_to<String> > NameRangeMap;
82     NameRangeMap    aRangeMap;
83 	ScViewData*		pViewData;
84 	ScDocument*		pDoc;
85 	formula::RefEdit*		pEdActive;
86 	sal_Bool			bDlgLostFocus;
87 
88 #ifdef _CRNRDLG_CXX
89 private:
90 	void Init				();
91 	void UpdateNames		();
92 	void UpdateRangeData	( const ScRange& rRange, sal_Bool bColName );
93 	void SetColRowData( const ScRange& rLabelRange,sal_Bool bRef=sal_False);
94 	void AdjustColRowData( const ScRange& rDataRange,sal_Bool bRef=sal_False);
95 	DECL_LINK( CancelBtnHdl, void * );
96 	DECL_LINK( OkBtnHdl, void * );
97 	DECL_LINK( AddBtnHdl, void * );
98 	DECL_LINK( RemoveBtnHdl, void * );
99 	DECL_LINK( Range1SelectHdl, void * );
100 	DECL_LINK( Range1DataModifyHdl, void * );
101 	DECL_LINK( ColClickHdl, void * );
102 	DECL_LINK( RowClickHdl, void * );
103 	DECL_LINK( Range2DataModifyHdl, void * );
104     DECL_LINK( GetFocusHdl, Control* );
105     DECL_LINK( LoseFocusHdl, Control* );
106 #endif
107 };
108 
109 
110 
111 #endif // SC_CRNRDLG_HXX
112 
113