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 #ifndef _CHART2_TP_SCALES_HXX
28 #define _CHART2_TP_SCALES_HXX
29 
30 // header for SfxTabPage
31 #include <sfx2/tabdlg.hxx>
32 // header for class FormattedField
33 #include <svtools/fmtfield.hxx>
34 // header for FixedText
35 #include <vcl/fixed.hxx>
36 // header for CheckBox
37 #include <vcl/button.hxx>
38 // header for MetricField
39 #include <vcl/field.hxx>
40 // header for class ListBox
41 #include <vcl/lstbox.hxx>
42 
43 //.............................................................................
44 namespace chart
45 {
46 //.............................................................................
47 
48 class ScaleTabPage : public SfxTabPage
49 {
50 public:
51 	ScaleTabPage( Window* pParent, const SfxItemSet& rInAttrs );
52 
53 	static SfxTabPage* Create( Window* pParent, const SfxItemSet& rInAttrs );
54 	virtual sal_Bool FillItemSet( SfxItemSet& rOutAttrs );
55 	virtual void Reset( const SfxItemSet& rInAttrs );
56     using TabPage::DeactivatePage;
57 	virtual int DeactivatePage( SfxItemSet* pItemSet = NULL );
58 
59 	void SetNumFormatter( SvNumberFormatter* pFormatter );
60 	void SetNumFormat();
61 
62     void ShowAxisOrigin( bool bShowOrigin );
63 
64     virtual void StateChanged( StateChangedType nType );
65 
66 private:
67 	FixedLine			aFlScale;
68 
69     CheckBox            aCbxReverse;
70 
71     CheckBox			aCbxLogarithm;
72 
73     FixedText			m_aTxt_AxisType;
74     ListBox             m_aLB_AxisType;
75 
76 	FixedText			aTxtMin;
77 	FormattedField		aFmtFldMin;
78 	CheckBox			aCbxAutoMin;
79 
80 	FixedText			aTxtMax;
81 	FormattedField		aFmtFldMax;
82 	CheckBox			aCbxAutoMax;
83 
84     FixedText           m_aTxt_TimeResolution;
85 	ListBox             m_aLB_TimeResolution;
86 	CheckBox			m_aCbx_AutoTimeResolution;
87 
88 	FixedText           aTxtMain;
89 	FormattedField		aFmtFldStepMain;
90     MetricField         m_aMt_MainDateStep;
91 	ListBox             m_aLB_MainTimeUnit;
92     CheckBox			aCbxAutoStepMain;
93 
94     FixedText           aTxtHelpCount;
95 	FixedText           aTxtHelp;
96 	MetricField         aMtStepHelp;
97 	ListBox             m_aLB_HelpTimeUnit;
98     CheckBox			aCbxAutoStepHelp;
99 
100     FixedText           aTxtOrigin;
101 	FormattedField		aFmtFldOrigin;
102 	CheckBox			aCbxAutoOrigin;
103 
104 	double				fMin;
105 	double				fMax;
106 	double				fStepMain;
107     sal_Int32           nStepHelp;
108 	double				fOrigin;
109     sal_Int32           m_nTimeResolution;
110     sal_Int32           m_nMainTimeUnit;
111     sal_Int32           m_nHelpTimeUnit;
112 	int                 m_nAxisType;
113     bool                m_bAllowDateAxis;
114 	SvNumberFormatter*	pNumFormatter;
115 
116     bool                m_bShowAxisOrigin;
117 
118     void AdjustControlPositions();
119     void EnableControls();
120     void PlaceIntervalControlsAccordingToAxisType();
121 
122     DECL_LINK( SelectAxisTypeHdl, void* );
123 	DECL_LINK( EnableValueHdl, CheckBox* );
124     DECL_LINK( FmtFieldModifiedHdl, FormattedField* );
125 
126     /** shows a warning window due to an invalid input.
127 
128         @param nResIdMessage
129             The resource identifier that represents the localized warning text.
130             If this is 0, no warning is shown and false is returned.
131 
132         @param pControl
133             If non-NULL, contains a pointer to the control in which the
134             errornous value was in.  This method gives this control the focus
135             and selects its content.
136 
137         @return false, if nResIdMessage was 0, true otherwise
138      */
139     bool ShowWarning( sal_uInt16 nResIdMessage, Control* pControl = NULL );
140 };
141 
142 //.............................................................................
143 } //namespace chart
144 //.............................................................................
145 
146 #endif
147 
148