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