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