Gtk-WARNING gtktreestore.c:1047: Invalid column number 1 added to iter
[LibreOffice.git] / chart2 / source / controller / dialogs / dlg_ObjectProperties.cxx
blobf067bd2b0987e95b8d087cec66a20ba543a74ed9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <sal/config.h>
22 #include <cstddef>
24 #include <dlg_ObjectProperties.hxx>
25 #include <strings.hrc>
26 #include "tp_AxisLabel.hxx"
27 #include "tp_DataLabel.hxx"
28 #include "tp_LegendPosition.hxx"
29 #include "tp_PointGeometry.hxx"
30 #include "tp_Scale.hxx"
31 #include "tp_AxisPositions.hxx"
32 #include "tp_ErrorBars.hxx"
33 #include "tp_Trendline.hxx"
34 #include "tp_SeriesToAxis.hxx"
35 #include "tp_TitleRotation.hxx"
36 #include "tp_PolarOptions.hxx"
37 #include "tp_DataPointOption.hxx"
38 #include "tp_DataTable.hxx"
39 #include <ResId.hxx>
40 #include <ViewElementListProvider.hxx>
41 #include <ChartModelHelper.hxx>
42 #include <ChartType.hxx>
43 #include <ChartTypeHelper.hxx>
44 #include <ObjectNameProvider.hxx>
45 #include <DataSeries.hxx>
46 #include <DiagramHelper.hxx>
47 #include <Diagram.hxx>
48 #include <NumberFormatterWrapper.hxx>
49 #include <Axis.hxx>
50 #include <AxisHelper.hxx>
51 #include <ExplicitCategoriesProvider.hxx>
52 #include <ChartModel.hxx>
53 #include <CommonConverters.hxx>
54 #include <RegressionCalculationHelper.hxx>
55 #include <BaseCoordinateSystem.hxx>
57 #include <com/sun/star/chart2/AxisType.hpp>
58 #include <com/sun/star/chart2/XAxis.hpp>
59 #include <svl/intitem.hxx>
60 #include <svl/ctloptions.hxx>
62 #include <svx/svxids.hrc>
64 #include <svx/drawitem.hxx>
65 #include <svx/ofaitem.hxx>
66 #include <svx/svxgraphicitem.hxx>
68 #include <svx/dialogs.hrc>
69 #include <editeng/flstitem.hxx>
71 #include <svx/flagsdef.hxx>
72 #include <svx/numinf.hxx>
74 #include <svl/cjkoptions.hxx>
75 #include <utility>
76 #include <comphelper/diagnose_ex.hxx>
78 namespace com::sun::star::chart2 { class XChartType; }
79 namespace com::sun::star::chart2 { class XDataSeries; }
81 namespace chart
84 using namespace ::com::sun::star;
85 using namespace ::com::sun::star::chart2;
86 using ::com::sun::star::uno::Reference;
87 using ::com::sun::star::uno::Sequence;
88 using ::com::sun::star::uno::Exception;
89 using ::com::sun::star::beans::XPropertySet;
91 ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( OUString aObjectCID )
92 : m_aObjectCID(std::move( aObjectCID ))
93 , m_eObjectType( ObjectIdentifier::getObjectType( m_aObjectCID ) )
94 , m_bAffectsMultipleObjects(false)
95 , m_bHasGeometryProperties(false)
96 , m_bHasStatisticProperties(false)
97 , m_bProvidesSecondaryYAxis(false)
98 , m_bProvidesOverlapAndGapWidth(false)
99 , m_bProvidesBarConnectors(false)
100 , m_bHasAreaProperties(false)
101 , m_bHasSymbolProperties(false)
102 , m_bHasNumberProperties(false)
103 , m_bProvidesStartingAngle(false)
104 , m_bProvidesMissingValueTreatments(false)
105 , m_bIsPieChartDataPoint(false)
106 , m_bHasScaleProperties(false)
107 , m_bCanAxisLabelsBeStaggered(false)
108 , m_bSupportingAxisPositioning(false)
109 , m_bShowAxisOrigin(false)
110 , m_bIsCrossingAxisIsCategoryAxis(false)
111 , m_bSupportingCategoryPositioning(false)
112 , m_bComplexCategoriesAxis( false )
113 , m_nNbPoints( 0 )
115 std::u16string_view aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID );
116 m_bAffectsMultipleObjects = (aParticleID == u"ALLELEMENTS");
118 ObjectPropertiesDialogParameter::~ObjectPropertiesDialogParameter()
122 void ObjectPropertiesDialogParameter::init( const rtl::Reference<::chart::ChartModel>& xChartModel )
124 m_xChartDocument = xChartModel;
125 rtl::Reference< Diagram > xDiagram = xChartModel->getFirstChartDiagram();
126 rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel );
127 rtl::Reference< ChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries );
128 sal_Int32 nDimensionCount = 0;
129 if (xDiagram)
130 nDimensionCount = xDiagram->getDimension();
132 bool bHasSeriesProperties = (m_eObjectType==OBJECTTYPE_DATA_SERIES);
133 bool bHasDataPointproperties = (m_eObjectType==OBJECTTYPE_DATA_POINT);
135 if( bHasSeriesProperties || bHasDataPointproperties )
137 m_bHasGeometryProperties = ChartTypeHelper::isSupportingGeometryProperties( xChartType, nDimensionCount );
138 m_bHasAreaProperties = ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount );
139 m_bHasSymbolProperties = ChartTypeHelper::isSupportingSymbolProperties( xChartType, nDimensionCount );
140 m_bIsPieChartDataPoint = bHasDataPointproperties && ChartTypeHelper::isSupportingStartingAngle( xChartType );
142 if( bHasSeriesProperties )
144 m_bHasStatisticProperties = ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount );
145 m_bProvidesSecondaryYAxis = ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount );
146 m_bProvidesOverlapAndGapWidth = ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount );
147 m_bProvidesBarConnectors = ChartTypeHelper::isSupportingBarConnectors( xChartType, nDimensionCount );
148 m_bProvidesStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType );
150 m_bProvidesMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType )
151 .hasElements();
155 if( m_eObjectType == OBJECTTYPE_DATA_ERRORS_X ||
156 m_eObjectType == OBJECTTYPE_DATA_ERRORS_Y ||
157 m_eObjectType == OBJECTTYPE_DATA_ERRORS_Z)
158 m_bHasStatisticProperties = true;
160 if( m_eObjectType == OBJECTTYPE_AXIS )
162 //show scale properties only for a single axis not for multiselection
163 m_bHasScaleProperties = !m_bAffectsMultipleObjects;
165 if( m_bHasScaleProperties )
167 rtl::Reference< Axis > xAxis = ObjectIdentifier::getAxisForCID( m_aObjectCID, xChartModel );
168 if( xAxis.is() )
170 //no scale page for series axis
171 ScaleData aData( xAxis->getScaleData() );
172 if( aData.AxisType == chart2::AxisType::SERIES )
173 m_bHasScaleProperties = false;
174 if( aData.AxisType != chart2::AxisType::SERIES )
175 m_bHasNumberProperties = true;
177 //is the crossing main axis a category axes?:
178 rtl::Reference< BaseCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) );
179 uno::Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) );
180 if( xCrossingMainAxis.is() )
182 ScaleData aScale( xCrossingMainAxis->getScaleData() );
183 m_bIsCrossingAxisIsCategoryAxis = ( aScale.AxisType == chart2::AxisType::CATEGORY );
184 if( m_bIsCrossingAxisIsCategoryAxis )
186 if (xChartModel)
187 m_aCategories = DiagramHelper::getExplicitSimpleCategories( *xChartModel );
191 sal_Int32 nCooSysIndex=0;
192 sal_Int32 nDimensionIndex=0;
193 sal_Int32 nAxisIndex=0;
194 if( AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ) )
196 xChartType = AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( xDiagram, nAxisIndex );
197 //show positioning controls only if they make sense
198 m_bSupportingAxisPositioning = ChartTypeHelper::isSupportingAxisPositioning( xChartType, nDimensionCount, nDimensionIndex );
200 //show axis origin only for secondary y axis
201 if( nDimensionIndex==1 && nAxisIndex==1 && ChartTypeHelper::isSupportingBaseValue( xChartType ) )
202 m_bShowAxisOrigin = true;
204 if ( nDimensionIndex == 0 && ( aData.AxisType == chart2::AxisType::CATEGORY || aData.AxisType == chart2::AxisType::DATE ) )
206 if (xChartModel)
208 ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, *xChartModel );
209 m_bComplexCategoriesAxis = aExplicitCategoriesProvider.hasComplexCategories();
212 if (!m_bComplexCategoriesAxis)
213 m_bSupportingCategoryPositioning = ChartTypeHelper::isSupportingCategoryPositioning( xChartType, nDimensionCount );
219 //no staggering of labels for 3D axis
220 m_bCanAxisLabelsBeStaggered = nDimensionCount==2;
223 if( m_eObjectType == OBJECTTYPE_DATA_CURVE )
225 const std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > & aDataSeqs( xSeries->getDataSequences2());
226 Sequence< double > aXValues, aYValues;
227 bool bXValuesFound = false, bYValuesFound = false;
228 m_nNbPoints = 0;
229 for( std::size_t i=0;
230 ! (bXValuesFound && bYValuesFound) && i<aDataSeqs.size();
231 ++i )
235 Reference< data::XDataSequence > xSeq( aDataSeqs[i]->getValues());
236 Reference< XPropertySet > xProp( xSeq, uno::UNO_QUERY_THROW );
237 OUString aRole;
238 if( xProp->getPropertyValue( u"Role"_ustr ) >>= aRole )
240 if( !bXValuesFound && aRole == "values-x" )
242 aXValues = DataSequenceToDoubleSequence( xSeq );
243 bXValuesFound = true;
245 else if( !bYValuesFound && aRole == "values-y" )
247 aYValues = DataSequenceToDoubleSequence( xSeq );
248 bYValuesFound = true;
252 catch( const Exception & )
254 DBG_UNHANDLED_EXCEPTION("chart2");
257 if( !bXValuesFound && bYValuesFound )
259 // initialize with 1, 2, ...
260 //first category (index 0) matches with real number 1.0
261 aXValues.realloc( aYValues.getLength() );
262 auto pXValues = aXValues.getArray();
263 for( sal_Int32 i=0; i<aXValues.getLength(); ++i )
264 pXValues[i] = i+1;
265 bXValuesFound = true;
268 if( bXValuesFound && bYValuesFound &&
269 aXValues.hasElements() &&
270 aYValues.hasElements() )
272 RegressionCalculationHelper::tDoubleVectorPair aValues(
273 RegressionCalculationHelper::cleanup( aXValues, aYValues, RegressionCalculationHelper::isValid()));
274 m_nNbPoints = aValues.second.size();
278 //create gui name for this object
280 if( !m_bAffectsMultipleObjects && m_eObjectType == OBJECTTYPE_AXIS )
282 m_aLocalizedName = ObjectNameProvider::getAxisName( m_aObjectCID, xChartModel );
284 else if( !m_bAffectsMultipleObjects && ( m_eObjectType == OBJECTTYPE_GRID || m_eObjectType == OBJECTTYPE_SUBGRID ) )
286 m_aLocalizedName = ObjectNameProvider::getGridName( m_aObjectCID, xChartModel );
288 else if( !m_bAffectsMultipleObjects && m_eObjectType == OBJECTTYPE_TITLE )
290 m_aLocalizedName = ObjectNameProvider::getTitleName( m_aObjectCID, xChartModel );
292 else
294 switch( m_eObjectType )
296 case OBJECTTYPE_DATA_POINT:
297 case OBJECTTYPE_DATA_LABEL:
298 case OBJECTTYPE_DATA_LABELS:
299 case OBJECTTYPE_DATA_ERRORS_X:
300 case OBJECTTYPE_DATA_ERRORS_Y:
301 case OBJECTTYPE_DATA_ERRORS_Z:
302 case OBJECTTYPE_DATA_AVERAGE_LINE:
303 case OBJECTTYPE_DATA_CURVE:
304 case OBJECTTYPE_DATA_CURVE_EQUATION:
305 if( m_bAffectsMultipleObjects )
306 m_aLocalizedName = ObjectNameProvider::getName_ObjectForAllSeries( m_eObjectType );
307 else
308 m_aLocalizedName = ObjectNameProvider::getName_ObjectForSeries( m_eObjectType, m_aObjectCID, m_xChartDocument );
309 break;
310 default:
311 m_aLocalizedName = ObjectNameProvider::getName(m_eObjectType,m_bAffectsMultipleObjects);
312 break;
318 const sal_uInt16 nNoArrowNoShadowDlg = 1101;
320 void SchAttribTabDlg::setSymbolInformation( SfxItemSet&& rSymbolShapeProperties,
321 std::optional<Graphic> oAutoSymbolGraphic )
323 m_oSymbolShapeProperties.emplace(std::move(rSymbolShapeProperties));
324 m_oAutoSymbolGraphic = std::move(oAutoSymbolGraphic);
327 void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
329 m_fAxisMinorStepWidthForErrorBarDecimals = fMinorStepWidth;
332 SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
333 const SfxItemSet* pAttr,
334 const ObjectPropertiesDialogParameter* pDialogParameter,
335 const ViewElementListProvider* pViewElementListProvider,
336 const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier)
337 : SfxTabDialogController(pParent, u"modules/schart/ui/attributedialog.ui"_ustr, u"AttributeDialog"_ustr, pAttr)
338 , m_pParameter( pDialogParameter )
339 , m_pViewElementListProvider( pViewElementListProvider )
340 , m_pNumberFormatter(nullptr)
341 , m_fAxisMinorStepWidthForErrorBarDecimals(0.1)
342 , m_bOKPressed(false)
344 NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
345 m_pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
347 m_xDialog->set_title(pDialogParameter->getLocalizedName());
349 switch (pDialogParameter->getObjectType())
351 case OBJECTTYPE_TITLE:
352 AddTabPage(u"border"_ustr, SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
353 AddTabPage(u"area"_ustr, SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
354 AddTabPage(u"transparent"_ustr, SchResId(STR_PAGE_TRANSPARENCY), RID_SVXPAGE_TRANSPARENCE);
355 AddTabPage(u"fontname"_ustr, SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
356 AddTabPage(u"effects"_ustr, SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
357 AddTabPage(u"alignment"_ustr, SchResId(STR_PAGE_ALIGNMENT), SchAlignmentTabPage::Create);
358 if( SvtCJKOptions::IsAsianTypographyEnabled() )
359 AddTabPage(u"asian"_ustr, SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN);
360 break;
362 case OBJECTTYPE_LEGEND:
363 AddTabPage(u"border"_ustr, SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
364 AddTabPage(u"area"_ustr, SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
365 AddTabPage(u"transparent"_ustr, SchResId(STR_PAGE_TRANSPARENCY), RID_SVXPAGE_TRANSPARENCE);
366 AddTabPage(u"fontname"_ustr, SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
367 AddTabPage(u"effects"_ustr, SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
368 AddTabPage(u"legendpos"_ustr, SchResId(STR_PAGE_POSITION), SchLegendPosTabPage::Create);
369 if (SvtCJKOptions::IsAsianTypographyEnabled())
370 AddTabPage(u"asian"_ustr, SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN);
371 break;
373 case OBJECTTYPE_DATA_SERIES:
374 case OBJECTTYPE_DATA_POINT:
375 if( m_pParameter->ProvidesSecondaryYAxis() || m_pParameter->ProvidesOverlapAndGapWidth() || m_pParameter->ProvidesMissingValueTreatments() )
376 AddTabPage(u"options"_ustr, SchResId(STR_PAGE_OPTIONS),SchOptionTabPage::Create);
377 if( m_pParameter->ProvidesStartingAngle())
378 AddTabPage(u"polaroptions"_ustr, SchResId(STR_PAGE_OPTIONS), PolarOptionsTabPage::Create);
379 if (m_pParameter->IsPieChartDataPoint())
380 AddTabPage(u"datapointoption"_ustr, SchResId(STR_PAGE_OPTIONS), DataPointOptionTabPage::Create);
382 if( m_pParameter->HasGeometryProperties() )
383 AddTabPage(u"layout"_ustr, SchResId(STR_PAGE_LAYOUT), SchLayoutTabPage::Create);
385 if(m_pParameter->HasAreaProperties())
387 AddTabPage(u"area"_ustr, SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
388 AddTabPage(u"transparent"_ustr, SchResId(STR_PAGE_TRANSPARENCY), RID_SVXPAGE_TRANSPARENCE);
390 AddTabPage(u"border"_ustr, SchResId( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE ), RID_SVXPAGE_LINE);
391 break;
393 case OBJECTTYPE_DATA_LABEL:
394 case OBJECTTYPE_DATA_LABELS:
395 AddTabPage(u"border"_ustr, SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
396 AddTabPage(u"datalabels"_ustr, SchResId(STR_OBJECT_DATALABELS), DataLabelsTabPage::Create);
397 AddTabPage(u"fontname"_ustr, SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
398 AddTabPage(u"effects"_ustr, SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
399 if( SvtCJKOptions::IsAsianTypographyEnabled() )
400 AddTabPage(u"asian"_ustr, SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN);
402 break;
404 case OBJECTTYPE_AXIS:
406 if( m_pParameter->HasScaleProperties() )
408 AddTabPage(u"scale"_ustr, SchResId(STR_PAGE_SCALE), ScaleTabPage::Create);
409 //no positioning page for z axes so far as the tickmarks are not shown so far
410 AddTabPage(u"axispos"_ustr, SchResId(STR_PAGE_POSITIONING), AxisPositionsTabPage::Create);
412 AddTabPage(u"border"_ustr, SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE);
413 AddTabPage(u"axislabel"_ustr, SchResId(STR_OBJECT_LABEL), SchAxisLabelTabPage::Create);
414 if( m_pParameter->HasNumberProperties() )
415 AddTabPage(u"numberformat"_ustr, SchResId(STR_PAGE_NUMBERS), RID_SVXPAGE_NUMBERFORMAT);
416 AddTabPage(u"fontname"_ustr, SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
417 AddTabPage(u"effects"_ustr, SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
418 if( SvtCJKOptions::IsAsianTypographyEnabled() )
419 AddTabPage(u"asian"_ustr, SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN);
420 break;
423 case OBJECTTYPE_DATA_ERRORS_X:
424 AddTabPage(u"xerrorbar"_ustr, SchResId(STR_PAGE_XERROR_BARS), ErrorBarsTabPage::Create);
425 AddTabPage(u"border"_ustr, SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE);
426 break;
428 case OBJECTTYPE_DATA_ERRORS_Y:
429 AddTabPage(u"yerrorbar"_ustr, SchResId(STR_PAGE_YERROR_BARS), ErrorBarsTabPage::Create);
430 AddTabPage(u"border"_ustr, SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE);
431 break;
433 case OBJECTTYPE_DATA_ERRORS_Z:
434 break;
436 case OBJECTTYPE_GRID:
437 case OBJECTTYPE_SUBGRID:
438 case OBJECTTYPE_DATA_AVERAGE_LINE:
439 case OBJECTTYPE_DATA_STOCK_RANGE:
440 AddTabPage(u"border"_ustr, SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE);
441 break;
443 case OBJECTTYPE_DATA_CURVE:
444 AddTabPage(u"trendline"_ustr, SchResId(STR_PAGE_TRENDLINE_TYPE), TrendlineTabPage::Create);
445 AddTabPage(u"border"_ustr, SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE);
446 break;
448 case OBJECTTYPE_DATA_STOCK_LOSS:
449 case OBJECTTYPE_DATA_STOCK_GAIN:
450 case OBJECTTYPE_PAGE:
451 case OBJECTTYPE_DIAGRAM_FLOOR:
452 case OBJECTTYPE_DIAGRAM_WALL:
453 case OBJECTTYPE_DIAGRAM:
454 AddTabPage(u"border"_ustr, SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
455 AddTabPage(u"area"_ustr, SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
456 AddTabPage(u"transparent"_ustr, SchResId(STR_PAGE_TRANSPARENCY), RID_SVXPAGE_TRANSPARENCE);
457 break;
459 case OBJECTTYPE_LEGEND_ENTRY:
460 case OBJECTTYPE_AXIS_UNITLABEL:
461 case OBJECTTYPE_UNKNOWN:
462 // nothing
463 break;
464 case OBJECTTYPE_DATA_TABLE:
465 AddTabPage(u"datatable"_ustr, SchResId(STR_DATA_TABLE), DataTableTabPage::Create);
466 AddTabPage(u"border"_ustr, SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE);
467 AddTabPage(u"area"_ustr, SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
468 AddTabPage(u"fontname"_ustr, SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
469 AddTabPage(u"effects"_ustr, SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
470 break;
471 case OBJECTTYPE_DATA_CURVE_EQUATION:
472 AddTabPage(u"border"_ustr, SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
473 AddTabPage(u"area"_ustr, SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
474 AddTabPage(u"transparent"_ustr, SchResId(STR_PAGE_TRANSPARENCY), RID_SVXPAGE_TRANSPARENCE);
475 AddTabPage(u"fontname"_ustr, SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
476 AddTabPage(u"effects"_ustr, SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
477 AddTabPage(u"numberformat"_ustr, SchResId(STR_PAGE_NUMBERS), RID_SVXPAGE_NUMBERFORMAT);
478 if (SvtCTLOptions::IsCTLFontEnabled())
480 /* When rotation is supported for equation text boxes, use
481 SchAlignmentTabPage::Create here. The special
482 SchAlignmentTabPage::CreateWithoutRotation can be deleted. */
483 AddTabPage(u"alignment"_ustr, SchResId(STR_PAGE_ALIGNMENT), SchAlignmentTabPage::CreateWithoutRotation);
485 break;
486 default:
487 break;
490 // used to find out if user left the dialog with OK. When OK is pressed but
491 // no changes were done, Cancel is returned by the SfxTabDialog. See method
492 // DialogWasClosedWithOK.
493 GetOKButton().connect_clicked(LINK(this, SchAttribTabDlg, OKPressed));
496 SchAttribTabDlg::~SchAttribTabDlg()
500 void SchAttribTabDlg::PageCreated(const OUString& rId, SfxTabPage &rPage)
502 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
503 if (rId == "border")
505 aSet.Put (SvxColorListItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
506 aSet.Put (SvxDashListItem(m_pViewElementListProvider->GetDashList(),SID_DASH_LIST));
507 aSet.Put (SvxLineEndListItem(m_pViewElementListProvider->GetLineEndList(),SID_LINEEND_LIST));
508 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,0));
509 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nNoArrowNoShadowDlg));
511 if( m_pParameter->HasSymbolProperties() )
513 aSet.Put(OfaPtrItem(SID_OBJECT_LIST,m_pViewElementListProvider->GetSymbolList()));
514 if( m_oSymbolShapeProperties )
515 aSet.Put(SfxTabDialogItem(SID_ATTR_SET, *m_oSymbolShapeProperties));
516 if( m_oAutoSymbolGraphic )
517 aSet.Put(SvxGraphicItem(*m_oAutoSymbolGraphic));
519 rPage.PageCreated(aSet);
521 else if (rId == "area")
523 aSet.Put(SvxColorListItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
524 aSet.Put(SvxGradientListItem(m_pViewElementListProvider->GetGradientList(),SID_GRADIENT_LIST));
525 aSet.Put(SvxHatchListItem(m_pViewElementListProvider->GetHatchList(),SID_HATCH_LIST));
526 aSet.Put(SvxBitmapListItem(m_pViewElementListProvider->GetBitmapList(),SID_BITMAP_LIST));
527 aSet.Put(SvxPatternListItem(m_pViewElementListProvider->GetPatternList(),SID_PATTERN_LIST));
528 aSet.Put(SfxUInt16Item(SID_PAGE_TYPE,0));
529 aSet.Put(SfxUInt16Item(SID_DLG_TYPE,nNoArrowNoShadowDlg));
530 rPage.PageCreated(aSet);
532 else if (rId == "transparent")
534 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,0));
535 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nNoArrowNoShadowDlg));
536 rPage.PageCreated(aSet);
538 else if (rId == "fontname")
540 aSet.Put (SvxFontListItem(m_pViewElementListProvider->getFontList(), SID_ATTR_CHAR_FONTLIST));
541 rPage.PageCreated(aSet);
543 else if (rId == "effects")
545 aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
546 rPage.PageCreated(aSet);
548 else if (rId == "axislabel")
550 bool bShowStaggeringControls = m_pParameter->CanAxisLabelsBeStaggered();
551 auto & rLabelPage = static_cast<SchAxisLabelTabPage&>(rPage);
552 rLabelPage.ShowStaggeringControls( bShowStaggeringControls );
553 rLabelPage.SetComplexCategories( m_pParameter->IsComplexCategoriesAxis() );
555 else if (rId == "axispos")
557 AxisPositionsTabPage* pPage = dynamic_cast< AxisPositionsTabPage* >( &rPage );
558 if(pPage)
560 pPage->SetNumFormatter( m_pNumberFormatter );
561 if( m_pParameter->IsCrossingAxisIsCategoryAxis() )
563 pPage->SetCrossingAxisIsCategoryAxis( m_pParameter->IsCrossingAxisIsCategoryAxis() );
564 pPage->SetCategories( m_pParameter->GetCategories() );
566 pPage->SupportAxisPositioning( m_pParameter->IsSupportingAxisPositioning() );
567 pPage->SupportCategoryPositioning( m_pParameter->IsSupportingCategoryPositioning() );
570 else if (rId == "scale")
572 ScaleTabPage* pScaleTabPage = dynamic_cast< ScaleTabPage* >( &rPage );
573 if(pScaleTabPage)
575 pScaleTabPage->SetNumFormatter( m_pNumberFormatter );
576 pScaleTabPage->ShowAxisOrigin( m_pParameter->ShowAxisOrigin() );
579 else if (rId == "datalabels")
581 DataLabelsTabPage* pLabelPage = dynamic_cast< DataLabelsTabPage* >( &rPage );
582 if( pLabelPage )
583 pLabelPage->SetNumberFormatter( m_pNumberFormatter );
585 else if (rId == "numberformat")
587 aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, SID_ATTR_NUMBERFORMAT_INFO));
588 rPage.PageCreated(aSet);
590 else if (rId == "xerrorbar")
592 ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
593 OSL_ASSERT( pTabPage );
594 if( pTabPage )
596 pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
597 pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_X );
598 pTabPage->SetChartDocumentForRangeChoosing( m_pParameter->getDocument());
601 else if (rId == "yerrorbar")
603 ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
604 OSL_ASSERT( pTabPage );
605 if( pTabPage )
607 pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
608 pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_Y );
609 pTabPage->SetChartDocumentForRangeChoosing( m_pParameter->getDocument());
612 else if (rId == "options")
614 SchOptionTabPage* pTabPage = dynamic_cast< SchOptionTabPage* >( &rPage );
615 if( pTabPage && m_pParameter )
616 pTabPage->Init( m_pParameter->ProvidesSecondaryYAxis(), m_pParameter->ProvidesOverlapAndGapWidth(),
617 m_pParameter->ProvidesBarConnectors() );
619 else if (rId == "trendline")
621 TrendlineTabPage* pTrendlineTabPage = dynamic_cast< TrendlineTabPage* >( &rPage );
622 if(pTrendlineTabPage)
624 pTrendlineTabPage->SetNumFormatter( m_pNumberFormatter );
625 pTrendlineTabPage->SetNbPoints( m_pParameter->getNbPoints() );
630 IMPL_LINK(SchAttribTabDlg, OKPressed, weld::Button&, rButton, void)
632 m_bOKPressed = true;
633 OkHdl(rButton);
636 } //namespace chart
638 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */