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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_chart2.hxx"
30 #include "tp_AxisPositions.hxx"
31 
32 #include "ResId.hxx"
33 #include "TabPages.hrc"
34 #include "Strings.hrc"
35 #include "chartview/ChartSfxItemIds.hxx"
36 #include "NoWarningThisInCTOR.hxx"
37 #include "AxisHelper.hxx"
38 
39 #ifndef _SVX_SVXIDS_HRC
40 #include <svx/svxids.hrc>
41 #endif
42 #include <rtl/math.hxx>
43 // header for class SvxDoubleItem
44 #include <svx/chrtitem.hxx>
45 // header for class SfxBoolItem
46 #include <svl/eitem.hxx>
47 // header for SfxInt32Item
48 #include <svl/intitem.hxx>
49 
50 // header for class WarningBox
51 #include <vcl/msgbox.hxx>
52 
53 // header for class SvNumberformat
54 #ifndef _ZFORMAT_HXX
55 #ifndef _ZFORLIST_DECLARE_TABLE
56 #define _ZFORLIST_DECLARE_TABLE
57 #endif
58 #include <svl/zformat.hxx>
59 #endif
60 
61 #include <svtools/controldims.hrc>
62 
63 #include <com/sun/star/chart/ChartAxisPosition.hpp>
64 #include <com/sun/star/chart2/AxisType.hpp>
65 
66 using namespace ::com::sun::star;
67 
68 //.............................................................................
69 namespace chart
70 {
71 //.............................................................................
72 
73 namespace
74 {
75 void lcl_newXPos( Control& rControl, long nXPos )
76 {
77     Point aPos( rControl.GetPosPixel() );
78     aPos.X() = nXPos;
79     rControl.SetPosPixel(aPos);
80 }
81 
82 void lcl_shiftY( Control& rControl, long nYDiff )
83 {
84     Point aPos( rControl.GetPosPixel() );
85     aPos.Y() += nYDiff;
86     rControl.SetPosPixel(aPos);
87 }
88 
89 }
90 
91 AxisPositionsTabPage::AxisPositionsTabPage(Window* pWindow,const SfxItemSet& rInAttrs)
92     : SfxTabPage(pWindow, SchResId(TP_AXIS_POSITIONS), rInAttrs)
93 
94     , m_aFL_AxisLine(this,SchResId(FL_AXIS_LINE))
95     , m_aFT_CrossesAt(this,SchResId(FT_CROSSES_OTHER_AXIS_AT))
96     , m_aLB_CrossesAt(this,SchResId(LB_CROSSES_OTHER_AXIS_AT))
97     , m_aED_CrossesAt(this,SchResId(EDT_CROSSES_OTHER_AXIS_AT))
98     , m_aED_CrossesAtCategory(this,SchResId(EDT_CROSSES_OTHER_AXIS_AT_CATEGORY))
99     , m_aCB_AxisBetweenCategories(this, SchResId(CB_AXIS_BETWEEN_CATEGORIES))
100 
101     , m_aFL_Labels(this,SchResId(FL_LABELS))
102     , m_aFT_PlaceLabels( this, SchResId( FT_PLACE_LABELS ) )
103     , m_aLB_PlaceLabels( this, SchResId( LB_PLACE_LABELS ) )
104     , m_aFT_LabelDistance( this, SchResId( FT_AXIS_LABEL_DISTANCE ) )
105     , m_aED_LabelDistance( this, SchResId( EDT_AXIS_LABEL_DISTANCE ) )
106 
107     , m_aFL_Ticks(this,SchResId(FL_TICKS))
108     , m_aFT_Major(this,SchResId(FT_MAJOR))
109     , m_aCB_TicksInner(this,SchResId(CB_TICKS_INNER))
110 	, m_aCB_TicksOuter(this,SchResId(CB_TICKS_OUTER))
111     , m_aFT_Minor(this,SchResId(FT_MINOR))
112 	, m_aCB_MinorInner(this,SchResId(CB_MINOR_INNER))
113 	, m_aCB_MinorOuter(this,SchResId(CB_MINOR_OUTER))
114 
115     , m_aFL_Vertical(this,SchResId(FL_VERTICAL))
116     , m_aFT_PlaceTicks(this,SchResId(FT_PLACE_TICKS))
117     , m_aLB_PlaceTicks(this,SchResId(LB_PLACE_TICKS))
118 
119     , m_aFL_Grids(this,SchResId(FL_GRIDS))
120     , m_aCB_MajorGrid(this,SchResId(CB_MAJOR_GRID))
121     , m_aPB_MajorGrid(this,SchResId(PB_MAJOR_GRID))
122     , m_aCB_MinorGrid(this,SchResId(CB_MINOR_GRID))
123     , m_aPB_MinorGrid(this,SchResId(PB_MINOR_GRID))
124 
125 	, m_pNumFormatter(NULL)
126     , m_bCrossingAxisIsCategoryAxis(false)
127     , m_aCategories()
128 {
129 	FreeResource();
130 	SetExchangeSupport();
131 
132     const long nDialogWidth = GetSizePixel().Width();
133     const long nDistance = LogicToPixel( Size(RSC_SP_CTRL_X, 0), MapMode(MAP_APPFONT) ).Width();
134 
135     //axis line controls
136     {
137         if( m_aFT_CrossesAt.CalcMinimumSize().Width() < m_aFT_CrossesAt.GetSizePixel().Width() )
138         {
139             m_aFT_CrossesAt.SetSizePixel(m_aFT_CrossesAt.CalcMinimumSize());
140             long nXPos = m_aFT_CrossesAt.GetPosPixel().X() + m_aFT_CrossesAt.GetSizePixel().Width() + nDistance;
141             lcl_newXPos( m_aLB_CrossesAt, nXPos );
142 
143             nXPos += m_aLB_CrossesAt.GetSizePixel().Width() + nDistance;
144             lcl_newXPos( m_aED_CrossesAt, nXPos );
145             lcl_newXPos( m_aED_CrossesAtCategory, nXPos );
146         }
147     }
148 
149     long nFixTextHeight = m_aFT_PlaceLabels.GetSizePixel().Height();
150     long nLabelPlacementWidth = m_aFT_PlaceLabels.CalcMinimumSize().Width();
151     long nMarkPlacementWidth = m_aFT_PlaceTicks.CalcMinimumSize().Width();
152 
153 
154     long nWidth_0 = ::std::max( m_aFT_Major.CalcMinimumSize().Width(), m_aFT_Minor.CalcMinimumSize().Width() );
155     nWidth_0 = ::std::max( nWidth_0, nLabelPlacementWidth );
156     nWidth_0 = ::std::max( nWidth_0, nMarkPlacementWidth );
157     nLabelPlacementWidth = nMarkPlacementWidth = nWidth_0;
158 
159     //label placement
160     {
161         m_aFT_PlaceLabels.SetSizePixel( Size( nLabelPlacementWidth, nFixTextHeight ) );
162         long nXPos = m_aFT_PlaceLabels.GetPosPixel().X() + nLabelPlacementWidth + nDistance;
163         lcl_newXPos( m_aLB_PlaceLabels, nXPos );
164         m_aLB_PlaceLabels.SetSizePixel(m_aLB_PlaceLabels.CalcMinimumSize());
165     }
166 
167     //tickmark placement
168     {
169         m_aFT_PlaceTicks.SetSizePixel( Size( nMarkPlacementWidth, nFixTextHeight ) );
170         long nXPos = m_aFT_PlaceTicks.GetPosPixel().X() + nMarkPlacementWidth + nDistance;
171         lcl_newXPos( m_aLB_PlaceTicks, nXPos );
172         m_aLB_PlaceTicks.SetSizePixel( m_aLB_PlaceTicks.CalcMinimumSize() );
173     }
174 
175     //tickmark controls
176     {
177         long nWidth_1 = ::std::max( m_aCB_TicksInner.CalcMinimumSize().Width(), m_aCB_MinorInner.CalcMinimumSize().Width() );
178         long nWidth_2 = ::std::max( m_aCB_TicksOuter.CalcMinimumSize().Width(), m_aCB_MinorOuter.CalcMinimumSize().Width() );
179 
180         long nLeftSpace = nDialogWidth - nWidth_0 - nWidth_1 - nWidth_2 - 3*nDistance;
181 
182         if(nLeftSpace>=0)
183         {
184             m_aFT_Major.SetSizePixel(m_aFT_Major.CalcMinimumSize());
185             m_aFT_Minor.SetSizePixel(m_aFT_Minor.CalcMinimumSize());
186 
187             m_aCB_TicksInner.SetSizePixel( m_aCB_TicksInner.CalcMinimumSize()  );
188             m_aCB_MinorInner.SetSizePixel( m_aCB_MinorInner.CalcMinimumSize()  );
189 
190             m_aCB_TicksOuter.SetSizePixel( m_aCB_TicksOuter.CalcMinimumSize() );
191             m_aCB_MinorOuter.SetSizePixel( m_aCB_MinorOuter.CalcMinimumSize() );
192 
193             long nXPos = m_aFT_Major.GetPosPixel().X() + nWidth_0 + nDistance;
194             lcl_newXPos( m_aCB_TicksInner, nXPos );
195             lcl_newXPos( m_aCB_MinorInner, nXPos );
196 
197             nXPos += nWidth_1 + nDistance;
198             lcl_newXPos( m_aCB_TicksOuter, nXPos );
199             lcl_newXPos( m_aCB_MinorOuter, nXPos );
200 
201             nXPos += nWidth_2 + nDistance;
202             lcl_newXPos( m_aFL_Vertical, nXPos );
203         }
204     }
205 
206     //right alignement of listboxes:
207     {
208         long nLabelRightBorder = m_aLB_PlaceLabels.GetPosPixel().X() + m_aLB_PlaceLabels.GetSizePixel().Width();
209         long nTickmarksRightBorder = m_aLB_PlaceTicks.GetPosPixel().X() + m_aLB_PlaceTicks.GetSizePixel().Width();
210 
211         long nNewRightBorder = ::std::max( m_aLB_CrossesAt.GetPosPixel().X() + m_aLB_CrossesAt.GetSizePixel().Width(),  nLabelRightBorder);
212         nNewRightBorder = ::std::max( nTickmarksRightBorder, nNewRightBorder );
213 
214         long nListBoxHeight = m_aLB_PlaceLabels.GetSizePixel().Height();
215         m_aLB_PlaceLabels.SetSizePixel( Size( m_aLB_PlaceLabels.GetSizePixel().Width()+nNewRightBorder-nLabelRightBorder, nListBoxHeight ) );
216         m_aLB_PlaceTicks.SetSizePixel( Size( m_aLB_PlaceTicks.GetSizePixel().Width()+nNewRightBorder-nTickmarksRightBorder, nListBoxHeight ) );
217     }
218 
219     m_aLB_CrossesAt.SetSelectHdl( LINK( this, AxisPositionsTabPage, CrossesAtSelectHdl ) );
220     m_aLB_CrossesAt.SetDropDownLineCount( m_aLB_CrossesAt.GetEntryCount() );
221 
222     m_aLB_PlaceLabels.SetSelectHdl( LINK( this, AxisPositionsTabPage, PlaceLabelsSelectHdl ) );
223     m_aLB_PlaceLabels.SetDropDownLineCount( m_aLB_PlaceLabels.GetEntryCount() );
224     m_aLB_PlaceTicks.SetDropDownLineCount( m_aLB_PlaceTicks.GetEntryCount() );
225     m_aCB_TicksInner.SetAccessibleRelationLabeledBy(&m_aFT_Major);
226 	m_aCB_TicksOuter.SetAccessibleRelationLabeledBy(&m_aFT_Major);
227 	m_aCB_MinorInner.SetAccessibleRelationLabeledBy(&m_aFT_Minor);
228 	m_aCB_MinorOuter.SetAccessibleRelationLabeledBy(&m_aFT_Minor);
229 }
230 
231 SfxTabPage* AxisPositionsTabPage::Create(Window* pWindow,const SfxItemSet& rOutAttrs)
232 {
233     return new AxisPositionsTabPage(pWindow, rOutAttrs);
234 }
235 
236 sal_Bool AxisPositionsTabPage::FillItemSet(SfxItemSet& rOutAttrs)
237 {
238     // axis line
239 	sal_uInt16 nPos = m_aLB_CrossesAt.GetSelectEntryPos();
240     rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_POSITION, nPos+1 ));
241     if( 2==nPos )
242     {
243         double fCrossover = m_aED_CrossesAt.GetValue();
244         if( m_bCrossingAxisIsCategoryAxis )
245             fCrossover = m_aED_CrossesAtCategory.GetSelectEntryPos()+1;
246         rOutAttrs.Put(SvxDoubleItem(fCrossover,SCHATTR_AXIS_POSITION_VALUE));
247     }
248 
249     // labels
250     sal_uInt16 nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos();
251     if( nLabelPos != LISTBOX_ENTRY_NOTFOUND )
252         rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_LABEL_POSITION, nLabelPos ));
253 
254     // tick marks
255     long nTicks=0;
256 	long nMinorTicks=0;
257 
258 	if(m_aCB_MinorInner.IsChecked())
259 		nMinorTicks|=CHAXIS_MARK_INNER;
260 	if(m_aCB_MinorOuter.IsChecked())
261 		nMinorTicks|=CHAXIS_MARK_OUTER;
262 	if(m_aCB_TicksInner.IsChecked())
263 		nTicks|=CHAXIS_MARK_INNER;
264 	if(m_aCB_TicksOuter.IsChecked())
265 		nTicks|=CHAXIS_MARK_OUTER;
266 
267 	rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_TICKS,nTicks));
268 	rOutAttrs.Put(SfxInt32Item(SCHATTR_AXIS_HELPTICKS,nMinorTicks));
269 
270     sal_uInt16 nMarkPos = m_aLB_PlaceTicks.GetSelectEntryPos();
271     if( nMarkPos != LISTBOX_ENTRY_NOTFOUND )
272         rOutAttrs.Put( SfxInt32Item( SCHATTR_AXIS_MARK_POSITION, nMarkPos ));
273 
274 	return sal_True;
275 }
276 
277 void AxisPositionsTabPage::Reset(const SfxItemSet& rInAttrs)
278 {
279     //init and enable controls
280     m_aED_CrossesAt.Show( !m_bCrossingAxisIsCategoryAxis );
281     m_aED_CrossesAtCategory.Show( m_bCrossingAxisIsCategoryAxis );
282     const sal_Int32 nMaxCount = LISTBOX_ENTRY_NOTFOUND;
283     if( m_bCrossingAxisIsCategoryAxis )
284     {
285         for( sal_Int32 nN=0; nN<m_aCategories.getLength() && nN<nMaxCount; nN++ )
286             m_aED_CrossesAtCategory.InsertEntry( m_aCategories[nN] );
287 
288         sal_uInt16 nCount = m_aED_CrossesAtCategory.GetEntryCount();
289         if( nCount>30 )
290             nCount=30;
291         m_aED_CrossesAtCategory.SetDropDownLineCount( nCount );
292     }
293 
294     if( m_aLB_CrossesAt.GetEntryCount() > 3 )
295     {
296         if( m_bCrossingAxisIsCategoryAxis )
297             m_aLB_CrossesAt.RemoveEntry(2);
298         else
299             m_aLB_CrossesAt.RemoveEntry(3);
300     }
301 
302     //fill controls
303     const SfxPoolItem *pPoolItem = NULL;
304 
305     //axis line
306     if(rInAttrs.GetItemState(SCHATTR_AXIS_POSITION,sal_True, &pPoolItem)== SFX_ITEM_SET)
307     {
308         bool bZero = false;
309 		sal_uInt16 nPos = (sal_uInt16)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
310         if(nPos==0)
311         {
312             //switch to value
313             bZero = true;
314             nPos = 2;
315         }
316         else
317             nPos--;
318 
319         if( nPos < m_aLB_CrossesAt.GetEntryCount() )
320             m_aLB_CrossesAt.SelectEntryPos( nPos );
321         CrossesAtSelectHdl( (void*)0 );
322 
323         if( rInAttrs.GetItemState(SCHATTR_AXIS_POSITION_VALUE,sal_True, &pPoolItem)== SFX_ITEM_SET || bZero )
324         {
325             double fCrossover = 0.0;
326             if( !bZero )
327                 fCrossover = (((const SvxDoubleItem*)pPoolItem)->GetValue());
328             if( m_bCrossingAxisIsCategoryAxis )
329                 m_aED_CrossesAtCategory.SelectEntryPos( static_cast<sal_uInt16>(::rtl::math::round(fCrossover-1.0)) );
330             else
331                 m_aED_CrossesAt.SetValue(fCrossover);
332         }
333         else
334         {
335             m_aED_CrossesAtCategory.SetNoSelection();
336             m_aED_CrossesAt.SetTextValue(XubString());
337         }
338     }
339     else
340     {
341         m_aLB_CrossesAt.SetNoSelection();
342         m_aED_CrossesAt.Enable( sal_False );
343     }
344 
345     // Labels
346     if( rInAttrs.GetItemState( SCHATTR_AXIS_LABEL_POSITION, sal_False, &pPoolItem ) == SFX_ITEM_SET )
347     {
348         sal_uInt16 nPos = (sal_uInt16)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
349         if( nPos < m_aLB_PlaceLabels.GetEntryCount() )
350             m_aLB_PlaceLabels.SelectEntryPos( nPos );
351     }
352     else
353         m_aLB_PlaceLabels.SetNoSelection();
354     PlaceLabelsSelectHdl( (void*)0 );
355 
356     // Tick marks
357     long nTicks=0,nMinorTicks=0;
358 	if(rInAttrs.GetItemState(SCHATTR_AXIS_TICKS,sal_True, &pPoolItem)== SFX_ITEM_SET)
359 		nTicks=((const SfxInt32Item*)pPoolItem)->GetValue();
360 	if(rInAttrs.GetItemState(SCHATTR_AXIS_HELPTICKS,sal_True, &pPoolItem)== SFX_ITEM_SET)
361 		nMinorTicks=((const SfxInt32Item*)pPoolItem)->GetValue();
362 
363     m_aCB_TicksInner.Check(sal_Bool(nTicks&CHAXIS_MARK_INNER));
364 	m_aCB_TicksOuter.Check(sal_Bool(nTicks&CHAXIS_MARK_OUTER));
365 	m_aCB_MinorInner.Check(sal_Bool(nMinorTicks&CHAXIS_MARK_INNER));
366 	m_aCB_MinorOuter.Check(sal_Bool(nMinorTicks&CHAXIS_MARK_OUTER));
367 
368     // Tick position
369     if( rInAttrs.GetItemState( SCHATTR_AXIS_MARK_POSITION, sal_False, &pPoolItem ) == SFX_ITEM_SET )
370     {
371         sal_uInt16 nPos = (sal_uInt16)static_cast< const SfxInt32Item * >( pPoolItem )->GetValue();
372         if( nPos < m_aLB_PlaceTicks.GetEntryCount() )
373             m_aLB_PlaceTicks.SelectEntryPos( nPos );
374     }
375     else
376         m_aLB_PlaceTicks.SetNoSelection();
377 
378 
379     if( !m_bSupportAxisPositioning )
380     {
381         m_aFL_AxisLine.Show(false);
382         m_aFT_CrossesAt.Show(false);
383         m_aLB_CrossesAt.Show(false);
384         m_aED_CrossesAt.Show(false);
385         m_aED_CrossesAtCategory.Show(false);
386         m_aCB_AxisBetweenCategories.Show(false);
387 
388         m_aFL_Labels.Show(false);
389         m_aFT_PlaceLabels.Show(false);
390         m_aLB_PlaceLabels.Show(false);
391         m_aFT_LabelDistance.Show(false);
392         m_aED_LabelDistance.Show(false);
393 
394         m_aFL_Vertical.Show(false);
395         m_aFT_PlaceTicks.Show(false);
396         m_aLB_PlaceTicks.Show(false);
397 
398         long nYDiff = m_aFL_AxisLine.GetPosPixel().Y() - m_aFL_Ticks.GetPosPixel().Y();
399         lcl_shiftY( m_aFL_Ticks, nYDiff );
400         lcl_shiftY( m_aFT_Major, nYDiff );
401         lcl_shiftY( m_aCB_TicksInner, nYDiff );
402         lcl_shiftY( m_aCB_TicksOuter, nYDiff );
403 
404         lcl_shiftY( m_aFT_Minor, nYDiff );
405         lcl_shiftY( m_aCB_MinorInner, nYDiff );
406         lcl_shiftY( m_aCB_MinorOuter, nYDiff );
407     }
408     else if( !AxisHelper::isAxisPositioningEnabled() )
409     {
410         m_aFL_AxisLine.Enable(false);
411         m_aFT_CrossesAt.Enable(false);
412         m_aLB_CrossesAt.Enable(false);
413         m_aED_CrossesAt.Enable(false);
414         m_aED_CrossesAtCategory.Enable(false);
415         m_aCB_AxisBetweenCategories.Enable(false);
416 
417         m_aFL_Labels.Enable(false);
418         m_aFT_PlaceLabels.Enable(false);
419         m_aLB_PlaceLabels.Enable(false);
420         m_aFT_LabelDistance.Enable(false);
421         m_aED_LabelDistance.Enable(false);
422 
423         m_aFL_Vertical.Enable(false);
424         m_aFT_PlaceTicks.Enable(false);
425         m_aLB_PlaceTicks.Enable(false);
426 
427         //todo: maybe set a special help id to all those controls
428     }
429 }
430 
431 int AxisPositionsTabPage::DeactivatePage(SfxItemSet* pItemSet)
432 {
433     if( pItemSet )
434 		FillItemSet( *pItemSet );
435 
436     return LEAVE_PAGE;
437 }
438 
439 void AxisPositionsTabPage::SetNumFormatter( SvNumberFormatter* pFormatter )
440 {
441 	m_pNumFormatter = pFormatter;
442     m_aED_CrossesAt.SetFormatter( m_pNumFormatter );
443 	m_aED_CrossesAt.UseInputStringForFormatting();
444 
445 	const SfxPoolItem *pPoolItem = NULL;
446     if( GetItemSet().GetItemState( SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT, sal_True, &pPoolItem ) == SFX_ITEM_SET )
447 	{
448 		sal_uLong nFmt = (sal_uLong)((const SfxInt32Item*)pPoolItem)->GetValue();
449 		m_aED_CrossesAt.SetFormatKey( nFmt );
450 	}
451 }
452 
453 void AxisPositionsTabPage::SetCrossingAxisIsCategoryAxis( bool bCrossingAxisIsCategoryAxis )
454 {
455     m_bCrossingAxisIsCategoryAxis = bCrossingAxisIsCategoryAxis;
456 }
457 
458 void AxisPositionsTabPage::SetCategories( const ::com::sun::star::uno::Sequence< rtl::OUString >& rCategories )
459 {
460     m_aCategories = rCategories;
461 }
462 
463 void AxisPositionsTabPage::SupportAxisPositioning( bool bSupportAxisPositioning )
464 {
465     m_bSupportAxisPositioning = bSupportAxisPositioning;
466 }
467 
468 IMPL_LINK ( AxisPositionsTabPage, CrossesAtSelectHdl, void *, EMPTYARG )
469 {
470     sal_uInt16 nPos = m_aLB_CrossesAt.GetSelectEntryPos();
471     m_aED_CrossesAt.Show( (2==nPos) && !m_bCrossingAxisIsCategoryAxis );
472     m_aED_CrossesAtCategory.Show( (2==nPos) && m_bCrossingAxisIsCategoryAxis );
473 
474     if(! m_aED_CrossesAt.GetText().Len() )
475         m_aED_CrossesAt.SetValue(0.0);
476     if( 0 == m_aED_CrossesAtCategory.GetSelectEntryCount() )
477         m_aED_CrossesAtCategory.SelectEntryPos(0);
478 
479     PlaceLabelsSelectHdl( (void*)0 );
480     return 0;
481 }
482 
483 IMPL_LINK ( AxisPositionsTabPage, PlaceLabelsSelectHdl, void *, EMPTYARG )
484 {
485     sal_uInt16 nLabelPos = m_aLB_PlaceLabels.GetSelectEntryPos();
486 
487     bool bEnableTickmarkPlacement = (nLabelPos>1);
488     if( bEnableTickmarkPlacement )
489     {
490         sal_uInt16 nAxisPos = m_aLB_CrossesAt.GetSelectEntryPos();
491         if( nLabelPos-2 == nAxisPos )
492             bEnableTickmarkPlacement=false;
493     }
494     m_aFT_PlaceTicks.Enable(bEnableTickmarkPlacement);
495     m_aLB_PlaceTicks.Enable(bEnableTickmarkPlacement);
496 
497     return 0;
498 }
499 
500 //.............................................................................
501 } //namespace chart
502 //.............................................................................
503