LibreOffice Module chart2 (master) 1
res_ErrorBar.cxx
Go to the documentation of this file.
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 <res_ErrorBar.hxx>
21#include <bitmaps.hlst>
23#include <helpids.h>
25#include <vcl/weld.hxx>
26#include <ChartModel.hxx>
27
28#include <rtl/math.hxx>
30#include <osl/diagnose.h>
31#include <svl/stritem.hxx>
32
33#define CHART_LB_FUNCTION_STD_ERROR 0
34#define CHART_LB_FUNCTION_STD_DEV 1
35#define CHART_LB_FUNCTION_VARIANCE 2
36#define CHART_LB_FUNCTION_ERROR_MARGIN 3
37
38using namespace ::com::sun::star;
39
40namespace
41{
42void lcl_enableRangeChoosing(bool bEnable, weld::DialogController* pController)
43{
44 weld::Window* pWeldDialog = pController->getDialog();
45 pWeldDialog->set_modal(!bEnable);
46 pWeldDialog->set_visible(!bEnable);
47}
48
49sal_uInt16 lcl_getLbEntryPosByErrorKind( SvxChartKindError eErrorKind )
50{
51 sal_uInt16 nResult = 0;
52 switch( eErrorKind )
53 {
54 // for these cases select the default in the list box
55 case SvxChartKindError::NONE:
56 case SvxChartKindError::Percent:
57 case SvxChartKindError::Const:
58 case SvxChartKindError::Range:
60 break;
61 case SvxChartKindError::Variant:
63 break;
64 case SvxChartKindError::Sigma:
66 break;
67 case SvxChartKindError::BigError:
69 break;
70 case SvxChartKindError::StdError:
72 break;
73 }
74 return nResult;
75}
76} // anonymous namespace
77
78namespace chart
79{
80
82 const SfxItemSet& rInAttrs, bool bNoneAvailable,
83 tErrorBarType eType /* = ERROR_BAR_Y */ )
84 : m_eErrorKind( SvxChartKindError::NONE )
85 , m_eIndicate( SvxChartIndicate::Both )
86 , m_bErrorKindUnique( true )
87 , m_bIndicatorUnique( true )
88 , m_bRangePosUnique( true )
89 , m_bRangeNegUnique( true )
90 , m_eErrorBarType( eType )
91 , m_nConstDecimalDigits( 1 )
92 , m_nConstSpinSize( 1 )
93 , m_fPlusValue(0.0)
94 , m_fMinusValue(0.0)
95 , m_pController(pController)
96 , m_pCurrentRangeChoosingField( nullptr )
97 , m_bHasInternalDataProvider( true )
98 , m_bEnableDataTableDialog( true )
99 , m_xRbNone(pParent->weld_radio_button("RB_NONE"))
100 , m_xRbConst(pParent->weld_radio_button("RB_CONST"))
101 , m_xRbPercent(pParent->weld_radio_button("RB_PERCENT"))
102 , m_xRbFunction(pParent->weld_radio_button("RB_FUNCTION"))
103 , m_xRbRange(pParent->weld_radio_button("RB_RANGE"))
104 , m_xLbFunction(pParent->weld_combo_box("LB_FUNCTION"))
105 , m_xFlParameters(pParent->weld_frame("framePARAMETERS"))
106 , m_xBxPositive(pParent->weld_widget("boxPOSITIVE"))
107 , m_xMfPositive(pParent->weld_metric_spin_button("MF_POSITIVE", FieldUnit::NONE))
108 , m_xEdRangePositive(pParent->weld_entry("ED_RANGE_POSITIVE"))
109 , m_xIbRangePositive(pParent->weld_button("IB_RANGE_POSITIVE"))
110 , m_xBxNegative(pParent->weld_widget("boxNEGATIVE"))
111 , m_xMfNegative(pParent->weld_metric_spin_button("MF_NEGATIVE", FieldUnit::NONE))
112 , m_xEdRangeNegative(pParent->weld_entry("ED_RANGE_NEGATIVE"))
113 , m_xIbRangeNegative(pParent->weld_button("IB_RANGE_NEGATIVE"))
114 , m_xCbSyncPosNeg(pParent->weld_check_button("CB_SYN_POS_NEG"))
115 , m_xRbBoth(pParent->weld_radio_button("RB_BOTH"))
116 , m_xRbPositive(pParent->weld_radio_button("RB_POSITIVE"))
117 , m_xRbNegative(pParent->weld_radio_button("RB_NEGATIVE"))
118 , m_xFiBoth(pParent->weld_image("FI_BOTH"))
119 , m_xFiPositive(pParent->weld_image("FI_POSITIVE"))
120 , m_xFiNegative(pParent->weld_image("FI_NEGATIVE"))
121 , m_xUIStringPos(pParent->weld_label("STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS"))
122 , m_xUIStringNeg(pParent->weld_label("STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS"))
123 , m_xUIStringRbRange(pParent->weld_label("STR_CONTROLTEXT_ERROR_BARS_FROM_DATA"))
124{
125 if( bNoneAvailable )
126 m_xRbNone->connect_toggled(LINK(this, ErrorBarResources, CategoryChosen));
127 else
128 m_xRbNone->hide();
129
130 m_xRbConst->connect_toggled( LINK( this, ErrorBarResources, CategoryChosen ));
131 m_xRbPercent->connect_toggled( LINK( this, ErrorBarResources, CategoryChosen ));
132 m_xRbFunction->connect_toggled( LINK( this, ErrorBarResources, CategoryChosen ));
133 m_xRbRange->connect_toggled( LINK( this, ErrorBarResources, CategoryChosen ));
134 m_xLbFunction->connect_changed( LINK( this, ErrorBarResources, CategoryChosen2 ));
135
136 m_xCbSyncPosNeg->set_active( false );
137 m_xCbSyncPosNeg->connect_toggled( LINK( this, ErrorBarResources, SynchronizePosAndNeg ));
138
139 m_xMfPositive->connect_value_changed( LINK( this, ErrorBarResources, PosValueChanged ));
140 m_xEdRangePositive->connect_changed( LINK( this, ErrorBarResources, RangeChanged ));
141 m_xEdRangeNegative->connect_changed( LINK( this, ErrorBarResources, RangeChanged ));
142
143 m_xRbPositive->connect_toggled( LINK( this, ErrorBarResources, IndicatorChanged ));
144 m_xRbNegative->connect_toggled( LINK( this, ErrorBarResources, IndicatorChanged ));
145 m_xRbBoth->connect_toggled( LINK( this, ErrorBarResources, IndicatorChanged ));
146
147 m_xIbRangePositive->connect_clicked( LINK( this, ErrorBarResources, ChooseRange ));
148 m_xIbRangeNegative->connect_clicked( LINK( this, ErrorBarResources, ChooseRange ));
149
151 Reset( rInAttrs );
152}
153
155{
156}
157
159{
160 if( m_eErrorBarType != eNewType )
161 {
162 m_eErrorBarType = eNewType;
164 }
165}
166
168 const rtl::Reference<::chart::ChartModel> & xChartDocument )
169{
170 if( xChartDocument.is())
171 {
172 m_bHasInternalDataProvider = xChartDocument->hasInternalDataProvider();
173 uno::Reference< beans::XPropertySet > xProps( static_cast<cppu::OWeakObject*>(xChartDocument.get()), uno::UNO_QUERY );
174 if ( xProps.is() )
175 {
176 try
177 {
178 xProps->getPropertyValue("EnableDataTableDialog") >>= m_bEnableDataTableDialog;
179 }
180 catch( const uno::Exception& )
181 {
182 TOOLS_WARN_EXCEPTION("chart2", "" );
183 }
184 }
185 }
186 m_apRangeSelectionHelper.reset( new RangeSelectionHelper( xChartDocument ));
187
188 // has internal data provider => rename "cell range" to "from data"
189 OSL_ASSERT(m_apRangeSelectionHelper);
191 {
192 m_xRbRange->set_label(m_xUIStringRbRange->get_label());
194 }
195
196 if( m_xRbRange->get_active())
197 {
200 }
201}
202
204{
205 if( fMinorStepWidth < 0 )
206 fMinorStepWidth = -fMinorStepWidth;
207
208 sal_Int32 nExponent = static_cast< sal_Int32 >( ::rtl::math::approxFloor( log10( fMinorStepWidth )));
209 if( nExponent <= 0 )
210 {
211 // one digit precision more
212 m_nConstDecimalDigits = static_cast< sal_uInt16 >( (-nExponent) + 1 );
213 m_nConstSpinSize = 10;
214 }
215 else
216 {
218 m_nConstSpinSize = static_cast< sal_Int64 >( pow( 10.0, static_cast<int>(nExponent) ));
219 }
220}
221
223{
224 // function
225 bool bIsFunction = m_xRbFunction->get_active();
226 m_xLbFunction->set_sensitive( bIsFunction );
227
228 // range buttons
230 bool bShowRange = m_xRbRange->get_active();
231 bool bCanChooseRange =
232 ( bShowRange &&
234 m_apRangeSelectionHelper->hasRangeSelection());
235
236 m_xMfPositive->set_visible( ! bShowRange );
237 m_xMfNegative->set_visible( ! bShowRange );
238
239 // use range but without range chooser => hide controls
240 m_xEdRangePositive->set_visible( bShowRange && ! m_bHasInternalDataProvider );
241 m_xIbRangePositive->set_visible( bCanChooseRange );
242 m_xEdRangeNegative->set_visible( bShowRange && ! m_bHasInternalDataProvider );
243 m_xIbRangeNegative->set_visible( bCanChooseRange );
244
245 bool bShowPosNegAndSync = ! (bShowRange && m_bHasInternalDataProvider);
246 m_xFlParameters->set_visible( bShowPosNegAndSync );
247
248 // unit for metric fields
249 bool bIsErrorMargin(
250 ( m_xRbFunction->get_active()) &&
251 ( m_xLbFunction->get_active() == CHART_LB_FUNCTION_ERROR_MARGIN ));
252 bool bIsPercentage( m_xRbPercent->get_active() || bIsErrorMargin );
253 FieldUnit eFieldUnit = FieldUnit::NONE;
254
255 if( bIsPercentage )
256 {
257 eFieldUnit = FieldUnit::PERCENT;
258 m_xMfPositive->set_digits( 1 );
259 m_xMfPositive->set_increments(10, 100, FieldUnit::NONE);
260 m_xMfNegative->set_digits( 1 );
261 m_xMfNegative->set_increments(10, 100, FieldUnit::NONE);
262 }
263 else
264 {
266 m_xMfPositive->set_increments(m_nConstSpinSize, m_nConstSpinSize * 10, FieldUnit::NONE);
268 m_xMfNegative->set_increments(m_nConstSpinSize, m_nConstSpinSize * 10, FieldUnit::NONE);
269 }
270
271 sal_Int32 nPlusValue = static_cast< sal_Int32 >( m_fPlusValue * pow(10.0,m_xMfPositive->get_digits()) );
272 sal_Int32 nMinusValue = static_cast< sal_Int32 >( m_fMinusValue * pow(10.0,m_xMfNegative->get_digits()) );
273
274 m_xMfPositive->set_value(nPlusValue, FieldUnit::NONE);
275 m_xMfNegative->set_value(nMinusValue, FieldUnit::NONE);
276
277 m_xMfPositive->set_unit(eFieldUnit);
278 m_xMfNegative->set_unit(eFieldUnit);
279
280 // positive and negative value fields
281 bool bPosEnabled = ( m_xRbPositive->get_active() || m_xRbBoth->get_active());
282 bool bNegEnabled = ( m_xRbNegative->get_active() || m_xRbBoth->get_active());
283 if( !( bPosEnabled || bNegEnabled ))
284 {
285 // all three controls are not checked -> ambiguous state
286 bPosEnabled = true;
287 bNegEnabled = true;
288 }
289
290 // functions with only one parameter
291 bool bOneParameterCategory =
292 bIsErrorMargin || m_xRbPercent->get_active();
293 if( bOneParameterCategory )
294 {
295 m_xCbSyncPosNeg->set_active(true);
296 }
297
298 if( m_xCbSyncPosNeg->get_active())
299 {
300 bPosEnabled = true;
301 bNegEnabled = false;
302 }
303
304 // all functions except error margin take no arguments
305 if( m_xRbFunction->get_active() && ( m_xLbFunction->get_active() != CHART_LB_FUNCTION_ERROR_MARGIN ))
306 {
307 bPosEnabled = false;
308 bNegEnabled = false;
309 }
310
311 // enable/disable pos/neg fields
312 m_xBxPositive->set_sensitive( bPosEnabled );
313 m_xBxNegative->set_sensitive( bNegEnabled );
314 if( bShowRange )
315 {
316 m_xEdRangePositive->set_sensitive( bPosEnabled );
317 m_xIbRangePositive->set_sensitive( bPosEnabled );
318 m_xEdRangeNegative->set_sensitive( bNegEnabled );
319 m_xIbRangeNegative->set_sensitive( bNegEnabled );
320 }
321 else
322 {
323 m_xMfPositive->set_sensitive( bPosEnabled );
324 m_xMfNegative->set_sensitive( bNegEnabled );
325 }
326
327 m_xCbSyncPosNeg->set_sensitive( !bOneParameterCategory && ( bPosEnabled || bNegEnabled ));
328
329 // mark invalid entries in the range fields
330 if( bShowRange && ! m_bHasInternalDataProvider )
331 {
334 }
335}
336
338{
339 CategoryChosen(*m_xRbConst);
340}
341
343{
344 m_bErrorKindUnique = true;
345 SvxChartKindError eOldError = m_eErrorKind;
346
347 if( m_xRbNone->get_active())
348 m_eErrorKind = SvxChartKindError::NONE;
349 else if( m_xRbConst->get_active())
350 m_eErrorKind = SvxChartKindError::Const;
351 else if( m_xRbPercent->get_active())
352 m_eErrorKind = SvxChartKindError::Percent;
353 else if( m_xRbRange->get_active())
354 m_eErrorKind = SvxChartKindError::Range;
355 else if( m_xRbFunction->get_active())
356 {
357 switch( m_xLbFunction->get_active())
358 {
360 m_eErrorKind = SvxChartKindError::StdError; break;
362 m_eErrorKind = SvxChartKindError::Sigma; break;
364 m_eErrorKind = SvxChartKindError::Variant; break;
366 m_eErrorKind = SvxChartKindError::BigError; break;
367 default:
368 m_bErrorKindUnique = false;
369 }
370 }
371 else
372 {
373 OSL_FAIL( "Unknown category chosen" );
374 m_bErrorKindUnique = false;
375 }
376
377 // changed to range
378 if( m_eErrorKind == SvxChartKindError::Range &&
379 eOldError != SvxChartKindError::Range )
380 {
381 m_xCbSyncPosNeg->set_active(
382 (!m_xEdRangePositive->get_text().isEmpty()) &&
383 m_xEdRangePositive->get_text() == m_xEdRangeNegative->get_text());
384 }
385 // changed from range
386 else if( m_eErrorKind != SvxChartKindError::Range &&
387 eOldError == SvxChartKindError::Range )
388 {
389 m_xCbSyncPosNeg->set_active( m_xMfPositive->get_value(FieldUnit::NONE) == m_xMfNegative->get_value(FieldUnit::NONE));
390 }
391
392 UpdateControlStates();
393}
394
396{
397 UpdateControlStates();
398 PosValueChanged( *m_xMfPositive );
399}
400
402{
403 if( m_xCbSyncPosNeg->get_active())
404 {
405 if( m_xRbRange->get_active())
406 {
407 m_xEdRangeNegative->set_text( m_xEdRangePositive->get_text());
408 m_bRangeNegUnique = m_bRangePosUnique;
409 }
410 else
411 m_xMfNegative->set_value(m_xMfPositive->get_value(FieldUnit::NONE), FieldUnit::NONE);
412 }
413}
414
416{
417 m_bIndicatorUnique = true;
418 if( m_xRbBoth->get_active())
419 m_eIndicate = SvxChartIndicate::Both;
420 else if( m_xRbPositive->get_active())
421 m_eIndicate = SvxChartIndicate::Up;
422 else if( m_xRbNegative->get_active())
423 m_eIndicate = SvxChartIndicate::Down;
424 else
425 m_bIndicatorUnique = false;
426
427 UpdateControlStates();
428}
429
430IMPL_LINK(ErrorBarResources, ChooseRange, weld::Button&, rButton, void)
431{
432 OSL_ASSERT(m_apRangeSelectionHelper);
433 if (!m_apRangeSelectionHelper)
434 return;
435 OSL_ASSERT( m_pCurrentRangeChoosingField == nullptr );
436
437 OUString aUIString;
438
439 if (&rButton == m_xIbRangePositive.get())
440 {
441 m_pCurrentRangeChoosingField = m_xEdRangePositive.get();
442 aUIString = m_xUIStringPos->get_label();
443 }
444 else
445 {
446 m_pCurrentRangeChoosingField = m_xEdRangeNegative.get();
447 aUIString = m_xUIStringNeg->get_label();
448 }
449
450 lcl_enableRangeChoosing(true, m_pController);
451 m_apRangeSelectionHelper->chooseRange(
452 m_pCurrentRangeChoosingField->get_text(),
453 aUIString, *this );
454}
455
456IMPL_LINK( ErrorBarResources, RangeChanged, weld::Entry&, rEdit, void )
457{
458 if( &rEdit == m_xEdRangePositive.get() )
459 {
460 m_bRangePosUnique = true;
461 PosValueChanged( *m_xMfPositive );
462 }
463 else
464 {
465 m_bRangeNegUnique = true;
466 }
467
468 isRangeFieldContentValid( rEdit );
469}
470
472{
473 const SfxPoolItem *pPoolItem = nullptr;
474
475 // category
476 m_eErrorKind = SvxChartKindError::NONE;
477 SfxItemState aState = rInAttrs.GetItemState( SCHATTR_STAT_KIND_ERROR, true, &pPoolItem );
478 m_bErrorKindUnique = ( aState != SfxItemState::DONTCARE );
479
480 if( aState == SfxItemState::SET )
481 m_eErrorKind = static_cast<const SvxChartKindErrorItem*>(pPoolItem)->GetValue();
482
483 m_xLbFunction->set_active( lcl_getLbEntryPosByErrorKind( m_eErrorKind ));
484
486 {
487 switch( m_eErrorKind )
488 {
489 case SvxChartKindError::NONE:
490 m_xRbNone->set_active(true);
491 break;
492 case SvxChartKindError::Percent:
493 m_xRbPercent->set_active(true);
494 break;
495 case SvxChartKindError::Const:
496 m_xRbConst->set_active(true);
497 break;
498 case SvxChartKindError::StdError:
499 case SvxChartKindError::Variant:
500 case SvxChartKindError::Sigma:
501 case SvxChartKindError::BigError:
502 m_xRbFunction->set_active(true);
503 break;
504 case SvxChartKindError::Range:
505 m_xRbRange->set_active(true);
506 break;
507 }
508 }
509 else
510 {
511 m_xRbNone->set_active( false );
512 m_xRbConst->set_active( false );
513 m_xRbPercent->set_active( false );
514 m_xRbFunction->set_active( false );
515 }
516
517 // parameters
518 if( const SvxDoubleItem* pDoubleItem = rInAttrs.GetItemIfSet( SCHATTR_STAT_CONSTPLUS ) )
519 {
520 m_fPlusValue = pDoubleItem->GetValue();
521 }
522
523 if( const SvxDoubleItem* pStatItem = rInAttrs.GetItemIfSet( SCHATTR_STAT_CONSTMINUS ) )
524 {
525 m_fMinusValue = pStatItem->GetValue();
526
527 if( m_eErrorKind != SvxChartKindError::Range &&
529 m_xCbSyncPosNeg->set_active(true);
530 }
531
532 // indicator
533 aState = rInAttrs.GetItemState( SCHATTR_STAT_INDICATE, true, &pPoolItem );
534 m_bIndicatorUnique = ( aState != SfxItemState::DONTCARE );
535 if( aState == SfxItemState::SET)
536 m_eIndicate = static_cast<const SvxChartIndicateItem *>(pPoolItem)->GetValue();
537
539 {
540 switch( m_eIndicate )
541 {
542 case SvxChartIndicate::NONE :
543 // no longer used, use both as default
544 m_eIndicate = SvxChartIndicate::Both;
545 [[fallthrough]]; // to BOTH
546 case SvxChartIndicate::Both :
547 m_xRbBoth->set_active(true); break;
548 case SvxChartIndicate::Up :
549 m_xRbPositive->set_active(true); break;
550 case SvxChartIndicate::Down :
551 m_xRbNegative->set_active(true); break;
552 }
553 }
554 else
555 {
556 m_xRbBoth->set_active( false );
557 m_xRbPositive->set_active( false );
558 m_xRbNegative->set_active( false );
559 }
560
561 // ranges
562 aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_POS, true, &pPoolItem );
563 m_bRangePosUnique = ( aState != SfxItemState::DONTCARE );
564 if( aState == SfxItemState::SET )
565 {
566 OUString sRangePositive = static_cast< const SfxStringItem * >( pPoolItem )->GetValue();
567 m_xEdRangePositive->set_text( sRangePositive );
568 }
569
570 aState = rInAttrs.GetItemState( SCHATTR_STAT_RANGE_NEG, true, &pPoolItem );
571 m_bRangeNegUnique = ( aState != SfxItemState::DONTCARE );
572 if( aState == SfxItemState::SET )
573 {
574 OUString sRangeNegative = static_cast< const SfxStringItem * >( pPoolItem )->GetValue();
575 m_xEdRangeNegative->set_text( sRangeNegative );
576 if( m_eErrorKind == SvxChartKindError::Range &&
577 !sRangeNegative.isEmpty() &&
578 sRangeNegative == m_xEdRangePositive->get_text() )
579 m_xCbSyncPosNeg->set_active(true);
580 }
581
583}
584
586{
591
593 {
594 if( m_eErrorKind == SvxChartKindError::Range )
595 {
596 OUString aPosRange;
597 OUString aNegRange;
599 {
600 // the strings aPosRange/aNegRange have to be set to a non-empty
601 // arbitrary string to generate error-bar sequences
602 aPosRange = "x";
603 aNegRange = aPosRange;
604 }
605 else
606 {
607 aPosRange = m_xEdRangePositive->get_text();
608 if( m_xCbSyncPosNeg->get_active())
609 aNegRange = aPosRange;
610 else
611 aNegRange = m_xEdRangeNegative->get_text();
612 }
613
615 rOutAttrs.Put( SfxStringItem( SCHATTR_STAT_RANGE_POS, aPosRange ));
617 rOutAttrs.Put( SfxStringItem( SCHATTR_STAT_RANGE_NEG, aNegRange ));
618 }
619 else if( m_eErrorKind == SvxChartKindError::Const ||
620 m_eErrorKind == SvxChartKindError::Percent ||
621 m_eErrorKind == SvxChartKindError::BigError )
622 {
623 double fPosValue = static_cast< double >( m_xMfPositive->get_value(FieldUnit::NONE)) /
624 pow( 10.0, m_xMfPositive->get_digits());
625 double fNegValue = 0.0;
626
627 if( m_xCbSyncPosNeg->get_active())
628 fNegValue = fPosValue;
629 else
630 fNegValue = static_cast< double >( m_xMfNegative->get_value(FieldUnit::NONE)) /
631 pow( 10.0, m_xMfNegative->get_digits());
632
633 rOutAttrs.Put( SvxDoubleItem( fPosValue, SCHATTR_STAT_CONSTPLUS ));
634 rOutAttrs.Put( SvxDoubleItem( fNegValue, SCHATTR_STAT_CONSTMINUS ));
635 }
636 }
637
639}
640
642{
644 {
645 m_xFiNegative->set_from_icon_name(BMP_INDICATE_DOWN);
646 m_xFiPositive->set_from_icon_name(BMP_INDICATE_UP);
647 m_xFiBoth->set_from_icon_name(BMP_INDICATE_BOTH_VERTI);
648 }
649 else if( m_eErrorBarType == ERROR_BAR_X )
650 {
651 m_xFiNegative->set_from_icon_name(BMP_INDICATE_LEFT);
652 m_xFiPositive->set_from_icon_name(BMP_INDICATE_RIGHT);
653 m_xFiBoth->set_from_icon_name(BMP_INDICATE_BOTH_HORI);
654 }
655}
656
658 const OUString & rNewRange )
659{
660 OSL_ASSERT(m_apRangeSelectionHelper);
662 return;
663
664 // rNewRange becomes invalid after removing the listener
665 OUString aRange( rNewRange );
666
667 // stop listening
668 m_apRangeSelectionHelper->stopRangeListening();
669
670 // change edit field
671// if( m_pParentWindow )
672// {
673// m_pParentWindow->ToTop();
674// m_pParentWindow->grab_focus();
675// }
676
678 {
681 PosValueChanged( *m_xMfPositive );
682 }
683
685
687 lcl_enableRangeChoosing(false, m_pController);
688}
689
691{
692 OSL_ASSERT(m_apRangeSelectionHelper);
694 m_apRangeSelectionHelper->stopRangeListening( false );
695}
696
698{
699 OUString aRange( rEdit.get_text());
700 bool bIsValid = ( aRange.isEmpty() ) ||
702 m_apRangeSelectionHelper->verifyCellRange( aRange ));
703
704 if( bIsValid || !rEdit.get_sensitive())
705 {
707 }
708 else
709 {
711 }
712}
713
714} //namespace chart
715
716/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr TypedWhichId< SfxStringItem > SCHATTR_STAT_RANGE_POS(SCHATTR_STAT_START+7)
constexpr TypedWhichId< SvxChartIndicateItem > SCHATTR_STAT_INDICATE(SCHATTR_STAT_START+6)
constexpr TypedWhichId< SfxBoolItem > SCHATTR_STAT_ERRORBAR_TYPE(SCHATTR_STAT_START+9)
constexpr TypedWhichId< SvxChartKindErrorItem > SCHATTR_STAT_KIND_ERROR(SCHATTR_STAT_START+1)
constexpr TypedWhichId< SfxStringItem > SCHATTR_STAT_RANGE_NEG(SCHATTR_STAT_START+8)
constexpr TypedWhichId< SvxDoubleItem > SCHATTR_STAT_CONSTPLUS(SCHATTR_STAT_START+4)
constexpr TypedWhichId< SvxDoubleItem > SCHATTR_STAT_CONSTMINUS(SCHATTR_STAT_START+5)
SvxChartIndicate
SvxChartKindError
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
std::unique_ptr< RangeSelectionHelper > m_apRangeSelectionHelper
void FillItemSet(SfxItemSet &rOutAttrs) const
void SetErrorBarType(tErrorBarType eNewType)
std::unique_ptr< weld::Button > m_xIbRangePositive
std::unique_ptr< weld::RadioButton > m_xRbPositive
tErrorBarType m_eErrorBarType
std::unique_ptr< weld::RadioButton > m_xRbRange
std::unique_ptr< weld::Frame > m_xFlParameters
void Reset(const SfxItemSet &rInAttrs)
std::unique_ptr< weld::RadioButton > m_xRbNone
weld::Entry * m_pCurrentRangeChoosingField
SvxChartIndicate m_eIndicate
std::unique_ptr< weld::MetricSpinButton > m_xMfNegative
sal_uInt16 m_nConstDecimalDigits
std::unique_ptr< weld::CheckButton > m_xCbSyncPosNeg
std::unique_ptr< weld::Widget > m_xBxPositive
void SetAxisMinorStepWidthForErrorBarDecimals(double fMinorStepWidth)
virtual void listeningFinished(const OUString &rNewRange) override
std::unique_ptr< weld::Image > m_xFiBoth
void SetChartDocumentForRangeChoosing(const rtl::Reference<::chart::ChartModel > &xChartDocument)
void isRangeFieldContentValid(weld::Entry &rEdit)
std::unique_ptr< weld::Label > m_xUIStringRbRange
std::unique_ptr< weld::Entry > m_xEdRangePositive
std::unique_ptr< weld::Entry > m_xEdRangeNegative
virtual void disposingRangeSelection() override
std::unique_ptr< weld::MetricSpinButton > m_xMfPositive
std::unique_ptr< weld::Image > m_xFiPositive
std::unique_ptr< weld::Button > m_xIbRangeNegative
ErrorBarResources(weld::Builder *pParent, weld::DialogController *pControllerDialog, const SfxItemSet &rInAttrs, bool bNoneAvailable, chart::ErrorBarResources::tErrorBarType eType=ERROR_BAR_Y)
std::unique_ptr< weld::RadioButton > m_xRbPercent
SvxChartKindError m_eErrorKind
std::unique_ptr< weld::RadioButton > m_xRbNegative
weld::DialogController * m_pController
std::unique_ptr< weld::ComboBox > m_xLbFunction
std::unique_ptr< weld::Image > m_xFiNegative
std::unique_ptr< weld::RadioButton > m_xRbConst
std::unique_ptr< weld::RadioButton > m_xRbFunction
std::unique_ptr< weld::RadioButton > m_xRbBoth
std::unique_ptr< weld::Widget > m_xBxNegative
virtual Dialog * getDialog()=0
virtual void set_text(const OUString &rText)=0
virtual void set_message_type(EntryMessageType eType)=0
virtual OUString get_text() const=0
virtual void grab_focus()=0
virtual void set_visible(bool visible)
virtual bool get_sensitive() const=0
virtual void set_modal(bool bModal)=0
#define TOOLS_WARN_EXCEPTION(area, stream)
FieldUnit
DocumentType eType
constexpr OUStringLiteral HID_SCH_ERROR_BARS_FROM_DATA
Definition: helpids.h:25
NONE
IMPL_LINK(StackingResourceGroup, StackingChangeHdl, weld::Toggleable &, rRadio, void)
IMPL_LINK_NOARG(SplinePropertiesDialog, SplineTypeListBoxHdl, weld::ComboBox &, void)
const char GetValue[]
SfxItemState
#define CHART_LB_FUNCTION_STD_ERROR
#define CHART_LB_FUNCTION_STD_DEV
#define CHART_LB_FUNCTION_ERROR_MARGIN
#define CHART_LB_FUNCTION_VARIANCE