vcl: allow for overriding the default PDF rendering resolution
[LibreOffice.git] / chart2 / source / controller / dialogs / dlg_ObjectProperties.cxx
blob6a8b618b3c8bba70773db242bd9efb0b2d671835
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 <dlg_ObjectProperties.hxx>
21 #include <strings.hrc>
22 #include "tp_AxisLabel.hxx"
23 #include "tp_DataLabel.hxx"
24 #include "tp_LegendPosition.hxx"
25 #include "tp_PointGeometry.hxx"
26 #include "tp_Scale.hxx"
27 #include "tp_AxisPositions.hxx"
28 #include "tp_ErrorBars.hxx"
29 #include "tp_Trendline.hxx"
30 #include "tp_SeriesToAxis.hxx"
31 #include "tp_TitleRotation.hxx"
32 #include "tp_PolarOptions.hxx"
33 #include <ResId.hxx>
34 #include <ViewElementListProvider.hxx>
35 #include <ChartModelHelper.hxx>
36 #include <ChartTypeHelper.hxx>
37 #include <ObjectNameProvider.hxx>
38 #include <DiagramHelper.hxx>
39 #include <NumberFormatterWrapper.hxx>
40 #include <AxisHelper.hxx>
41 #include <ExplicitCategoriesProvider.hxx>
42 #include <ChartModel.hxx>
43 #include <CommonConverters.hxx>
44 #include <RegressionCalculationHelper.hxx>
46 #include <com/sun/star/chart2/AxisType.hpp>
47 #include <com/sun/star/chart2/XAxis.hpp>
48 #include <svl/intitem.hxx>
49 #include <svl/languageoptions.hxx>
51 #include <svx/svxids.hrc>
53 #include <svx/drawitem.hxx>
54 #include <svx/ofaitem.hxx>
55 #include <svx/svxgrahicitem.hxx>
57 #include <svx/dialogs.hrc>
58 #include <editeng/flstitem.hxx>
60 #include <svx/flagsdef.hxx>
61 #include <svx/numinf.hxx>
63 #include <svl/cjkoptions.hxx>
64 #include <tools/diagnose_ex.h>
66 namespace com { namespace sun { namespace star { namespace chart2 { class XChartType; } } } }
67 namespace com { namespace sun { namespace star { namespace chart2 { class XDataSeries; } } } }
69 namespace chart
72 using namespace ::com::sun::star;
73 using namespace ::com::sun::star::chart2;
74 using ::com::sun::star::uno::Reference;
75 using ::com::sun::star::uno::Sequence;
76 using ::com::sun::star::uno::Exception;
77 using ::com::sun::star::beans::XPropertySet;
79 ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const OUString& rObjectCID )
80 : m_aObjectCID( rObjectCID )
81 , m_eObjectType( ObjectIdentifier::getObjectType( m_aObjectCID ) )
82 , m_bAffectsMultipleObjects(false)
83 , m_aLocalizedName()
84 , m_bHasGeometryProperties(false)
85 , m_bHasStatisticProperties(false)
86 , m_bProvidesSecondaryYAxis(false)
87 , m_bProvidesOverlapAndGapWidth(false)
88 , m_bProvidesBarConnectors(false)
89 , m_bHasAreaProperties(false)
90 , m_bHasSymbolProperties(false)
91 , m_bHasNumberProperties(false)
92 , m_bProvidesStartingAngle(false)
93 , m_bProvidesMissingValueTreatments(false)
94 , m_bHasScaleProperties(false)
95 , m_bCanAxisLabelsBeStaggered(false)
96 , m_bSupportingAxisPositioning(false)
97 , m_bShowAxisOrigin(false)
98 , m_bIsCrossingAxisIsCategoryAxis(false)
99 , m_aCategories()
100 , m_bComplexCategoriesAxis( false )
101 , m_nNbPoints( 0 )
103 OUString aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID );
104 m_bAffectsMultipleObjects = (aParticleID == "ALLELEMENTS");
106 ObjectPropertiesDialogParameter::~ObjectPropertiesDialogParameter()
110 void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel >& xChartModel )
112 m_xChartDocument.set( xChartModel, uno::UNO_QUERY );
113 uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
114 uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel );
115 uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries );
116 sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
118 bool bHasSeriesProperties = (m_eObjectType==OBJECTTYPE_DATA_SERIES);
119 bool bHasDataPointproperties = (m_eObjectType==OBJECTTYPE_DATA_POINT);
121 if( bHasSeriesProperties || bHasDataPointproperties )
123 m_bHasGeometryProperties = ChartTypeHelper::isSupportingGeometryProperties( xChartType, nDimensionCount );
124 m_bHasAreaProperties = ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount );
125 m_bHasSymbolProperties = ChartTypeHelper::isSupportingSymbolProperties( xChartType, nDimensionCount );
127 if( bHasSeriesProperties )
129 m_bHasStatisticProperties = ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount );
130 m_bProvidesSecondaryYAxis = ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount );
131 m_bProvidesOverlapAndGapWidth = ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount );
132 m_bProvidesBarConnectors = ChartTypeHelper::isSupportingBarConnectors( xChartType, nDimensionCount );
133 m_bProvidesStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType );
135 m_bProvidesMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType )
136 .hasElements();
140 if( m_eObjectType == OBJECTTYPE_DATA_ERRORS_X ||
141 m_eObjectType == OBJECTTYPE_DATA_ERRORS_Y ||
142 m_eObjectType == OBJECTTYPE_DATA_ERRORS_Z)
143 m_bHasStatisticProperties = true;
145 if( m_eObjectType == OBJECTTYPE_AXIS )
147 //show scale properties only for a single axis not for multiselection
148 m_bHasScaleProperties = !m_bAffectsMultipleObjects;
150 if( m_bHasScaleProperties )
152 uno::Reference< XAxis > xAxis( ObjectIdentifier::getAxisForCID( m_aObjectCID, xChartModel ) );
153 if( xAxis.is() )
155 //no scale page for series axis
156 ScaleData aData( xAxis->getScaleData() );
157 if( aData.AxisType == chart2::AxisType::SERIES )
158 m_bHasScaleProperties = false;
159 if( aData.AxisType != chart2::AxisType::SERIES )
160 m_bHasNumberProperties = true;
162 sal_Int32 nCooSysIndex=0;
163 sal_Int32 nDimensionIndex=0;
164 sal_Int32 nAxisIndex=0;
165 if( AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ) )
167 xChartType = AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( xDiagram, nAxisIndex );
168 //show positioning controls only if they make sense
169 m_bSupportingAxisPositioning = ChartTypeHelper::isSupportingAxisPositioning( xChartType, nDimensionCount, nDimensionIndex );
171 //show axis origin only for secondary y axis
172 if( nDimensionIndex==1 && nAxisIndex==1 && ChartTypeHelper::isSupportingBaseValue( xChartType ) )
173 m_bShowAxisOrigin = true;
176 //is the crossing main axis a category axes?:
177 uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) );
178 uno::Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) );
179 if( xCrossingMainAxis.is() )
181 ScaleData aScale( xCrossingMainAxis->getScaleData() );
182 m_bIsCrossingAxisIsCategoryAxis = ( aScale.AxisType == chart2::AxisType::CATEGORY );
183 if( m_bIsCrossingAxisIsCategoryAxis )
185 ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
186 if (pModel)
187 m_aCategories = DiagramHelper::getExplicitSimpleCategories( *pModel );
191 m_bComplexCategoriesAxis = false;
192 if ( nDimensionIndex == 0 && aData.AxisType == chart2::AxisType::CATEGORY )
194 ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
195 if (pModel)
197 ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, *pModel );
198 m_bComplexCategoriesAxis = aExplicitCategoriesProvider.hasComplexCategories();
204 //no staggering of labels for 3D axis
205 m_bCanAxisLabelsBeStaggered = nDimensionCount==2;
208 if( m_eObjectType == OBJECTTYPE_DATA_CURVE )
210 uno::Reference< data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
211 Sequence< Reference< data::XLabeledDataSequence > > aDataSeqs( xSource->getDataSequences());
212 Sequence< double > aXValues, aYValues;
213 bool bXValuesFound = false, bYValuesFound = false;
214 m_nNbPoints = 0;
215 sal_Int32 i = 0;
216 for( i=0;
217 ! (bXValuesFound && bYValuesFound) && i<aDataSeqs.getLength();
218 ++i )
222 Reference< data::XDataSequence > xSeq( aDataSeqs[i]->getValues());
223 Reference< XPropertySet > xProp( xSeq, uno::UNO_QUERY_THROW );
224 OUString aRole;
225 if( xProp->getPropertyValue( "Role" ) >>= aRole )
227 if( !bXValuesFound && aRole == "values-x" )
229 aXValues = DataSequenceToDoubleSequence( xSeq );
230 bXValuesFound = true;
232 else if( !bYValuesFound && aRole == "values-y" )
234 aYValues = DataSequenceToDoubleSequence( xSeq );
235 bYValuesFound = true;
239 catch( const Exception & )
241 DBG_UNHANDLED_EXCEPTION("chart2");
244 if( !bXValuesFound && bYValuesFound )
246 // initialize with 1, 2, ...
247 //first category (index 0) matches with real number 1.0
248 aXValues.realloc( aYValues.getLength() );
249 for( i=0; i<aXValues.getLength(); ++i )
250 aXValues[i] = i+1;
251 bXValuesFound = true;
254 if( bXValuesFound && bYValuesFound &&
255 aXValues.hasElements() &&
256 aYValues.hasElements() )
258 RegressionCalculationHelper::tDoubleVectorPair aValues(
259 RegressionCalculationHelper::cleanup( aXValues, aYValues, RegressionCalculationHelper::isValid()));
260 m_nNbPoints = aValues.second.size();
264 //create gui name for this object
266 if( !m_bAffectsMultipleObjects && m_eObjectType == OBJECTTYPE_AXIS )
268 m_aLocalizedName = ObjectNameProvider::getAxisName( m_aObjectCID, xChartModel );
270 else if( !m_bAffectsMultipleObjects && ( m_eObjectType == OBJECTTYPE_GRID || m_eObjectType == OBJECTTYPE_SUBGRID ) )
272 m_aLocalizedName = ObjectNameProvider::getGridName( m_aObjectCID, xChartModel );
274 else if( !m_bAffectsMultipleObjects && m_eObjectType == OBJECTTYPE_TITLE )
276 m_aLocalizedName = ObjectNameProvider::getTitleName( m_aObjectCID, xChartModel );
278 else
280 switch( m_eObjectType )
282 case OBJECTTYPE_DATA_POINT:
283 case OBJECTTYPE_DATA_LABEL:
284 case OBJECTTYPE_DATA_LABELS:
285 case OBJECTTYPE_DATA_ERRORS_X:
286 case OBJECTTYPE_DATA_ERRORS_Y:
287 case OBJECTTYPE_DATA_ERRORS_Z:
288 case OBJECTTYPE_DATA_AVERAGE_LINE:
289 case OBJECTTYPE_DATA_CURVE:
290 case OBJECTTYPE_DATA_CURVE_EQUATION:
291 if( m_bAffectsMultipleObjects )
292 m_aLocalizedName = ObjectNameProvider::getName_ObjectForAllSeries( m_eObjectType );
293 else
294 m_aLocalizedName = ObjectNameProvider::getName_ObjectForSeries( m_eObjectType, m_aObjectCID, m_xChartDocument );
295 break;
296 default:
297 m_aLocalizedName = ObjectNameProvider::getName(m_eObjectType,m_bAffectsMultipleObjects);
298 break;
304 const sal_uInt16 nNoArrowNoShadowDlg = 1101;
306 void SchAttribTabDlg::setSymbolInformation( std::unique_ptr<SfxItemSet> pSymbolShapeProperties,
307 std::unique_ptr<Graphic> pAutoSymbolGraphic )
309 m_pSymbolShapeProperties = std::move(pSymbolShapeProperties);
310 m_pAutoSymbolGraphic = std::move(pAutoSymbolGraphic);
313 void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
315 m_fAxisMinorStepWidthForErrorBarDecimals = fMinorStepWidth;
318 SchAttribTabDlg::SchAttribTabDlg(weld::Window* pParent,
319 const SfxItemSet* pAttr,
320 const ObjectPropertiesDialogParameter* pDialogParameter,
321 const ViewElementListProvider* pViewElementListProvider,
322 const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier)
323 : SfxTabDialogController(pParent, "modules/schart/ui/attributedialog.ui", "AttributeDialog", pAttr)
324 , m_pParameter( pDialogParameter )
325 , m_pViewElementListProvider( pViewElementListProvider )
326 , m_pNumberFormatter(nullptr)
327 , m_fAxisMinorStepWidthForErrorBarDecimals(0.1)
328 , m_bOKPressed(false)
330 NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
331 m_pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
333 m_xDialog->set_title(pDialogParameter->getLocalizedName());
335 SvtCJKOptions aCJKOptions;
337 switch (pDialogParameter->getObjectType())
339 case OBJECTTYPE_TITLE:
340 AddTabPage("border", SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
341 AddTabPage("area", SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
342 AddTabPage("transparent", SchResId(STR_PAGE_TRANSPARENCY), RID_SVXPAGE_TRANSPARENCE);
343 AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
344 AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
345 AddTabPage("alignment", SchResId(STR_PAGE_ALIGNMENT), SchAlignmentTabPage::Create);
346 if( aCJKOptions.IsAsianTypographyEnabled() )
347 AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN);
348 break;
350 case OBJECTTYPE_LEGEND:
351 AddTabPage("border", SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
352 AddTabPage("area", SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
353 AddTabPage("transparent", SchResId(STR_PAGE_TRANSPARENCY), RID_SVXPAGE_TRANSPARENCE);
354 AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
355 AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
356 AddTabPage("legendpos", SchResId(STR_PAGE_POSITION), SchLegendPosTabPage::Create);
357 if (aCJKOptions.IsAsianTypographyEnabled())
358 AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN);
359 break;
361 case OBJECTTYPE_DATA_SERIES:
362 case OBJECTTYPE_DATA_POINT:
363 if( m_pParameter->ProvidesSecondaryYAxis() || m_pParameter->ProvidesOverlapAndGapWidth() || m_pParameter->ProvidesMissingValueTreatments() )
364 AddTabPage("options", SchResId(STR_PAGE_OPTIONS),SchOptionTabPage::Create);
365 if( m_pParameter->ProvidesStartingAngle())
366 AddTabPage("polaroptions", SchResId(STR_PAGE_OPTIONS), PolarOptionsTabPage::Create);
368 if( m_pParameter->HasGeometryProperties() )
369 AddTabPage("layout", SchResId(STR_PAGE_LAYOUT), SchLayoutTabPage::Create);
371 if(m_pParameter->HasAreaProperties())
373 AddTabPage("area", SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
374 AddTabPage("transparent", SchResId(STR_PAGE_TRANSPARENCY), RID_SVXPAGE_TRANSPARENCE);
376 AddTabPage("border", SchResId( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE ), RID_SVXPAGE_LINE);
377 break;
379 case OBJECTTYPE_DATA_LABEL:
380 case OBJECTTYPE_DATA_LABELS:
381 AddTabPage("border", SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
382 AddTabPage("datalabels", SchResId(STR_OBJECT_DATALABELS), DataLabelsTabPage::Create);
383 AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
384 AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
385 if( aCJKOptions.IsAsianTypographyEnabled() )
386 AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN);
388 break;
390 case OBJECTTYPE_AXIS:
392 if( m_pParameter->HasScaleProperties() )
394 AddTabPage("scale", SchResId(STR_PAGE_SCALE), ScaleTabPage::Create);
395 //no positioning page for z axes so far as the tickmarks are not shown so far
396 AddTabPage("axispos", SchResId(STR_PAGE_POSITIONING), AxisPositionsTabPage::Create);
398 AddTabPage("border", SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE);
399 AddTabPage("axislabel", SchResId(STR_OBJECT_LABEL), SchAxisLabelTabPage::Create);
400 if( m_pParameter->HasNumberProperties() )
401 AddTabPage("numberformat", SchResId(STR_PAGE_NUMBERS), RID_SVXPAGE_NUMBERFORMAT);
402 AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
403 AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
404 if( aCJKOptions.IsAsianTypographyEnabled() )
405 AddTabPage("asian", SchResId(STR_PAGE_ASIAN), RID_SVXPAGE_PARA_ASIAN);
406 break;
409 case OBJECTTYPE_DATA_ERRORS_X:
410 AddTabPage("xerrorbar", SchResId(STR_PAGE_XERROR_BARS), ErrorBarsTabPage::Create);
411 AddTabPage("border", SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE);
412 break;
414 case OBJECTTYPE_DATA_ERRORS_Y:
415 AddTabPage("yerrorbar", SchResId(STR_PAGE_YERROR_BARS), ErrorBarsTabPage::Create);
416 AddTabPage("border", SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE);
417 break;
419 case OBJECTTYPE_DATA_ERRORS_Z:
420 break;
422 case OBJECTTYPE_GRID:
423 case OBJECTTYPE_SUBGRID:
424 case OBJECTTYPE_DATA_AVERAGE_LINE:
425 case OBJECTTYPE_DATA_STOCK_RANGE:
426 AddTabPage("border", SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE);
427 break;
429 case OBJECTTYPE_DATA_CURVE:
430 AddTabPage("trendline", SchResId(STR_PAGE_TRENDLINE_TYPE), TrendlineTabPage::Create);
431 AddTabPage("border", SchResId(STR_PAGE_LINE), RID_SVXPAGE_LINE);
432 break;
434 case OBJECTTYPE_DATA_STOCK_LOSS:
435 case OBJECTTYPE_DATA_STOCK_GAIN:
436 case OBJECTTYPE_PAGE:
437 case OBJECTTYPE_DIAGRAM_FLOOR:
438 case OBJECTTYPE_DIAGRAM_WALL:
439 case OBJECTTYPE_DIAGRAM:
440 AddTabPage("border", SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
441 AddTabPage("area", SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
442 AddTabPage("transparent", SchResId(STR_PAGE_TRANSPARENCY), RID_SVXPAGE_TRANSPARENCE);
443 break;
445 case OBJECTTYPE_LEGEND_ENTRY:
446 case OBJECTTYPE_AXIS_UNITLABEL:
447 case OBJECTTYPE_UNKNOWN:
448 // nothing
449 break;
450 case OBJECTTYPE_DATA_CURVE_EQUATION:
451 AddTabPage("border", SchResId(STR_PAGE_BORDER), RID_SVXPAGE_LINE);
452 AddTabPage("area", SchResId(STR_PAGE_AREA), RID_SVXPAGE_AREA);
453 AddTabPage("transparent", SchResId(STR_PAGE_TRANSPARENCY), RID_SVXPAGE_TRANSPARENCE);
454 AddTabPage("fontname", SchResId(STR_PAGE_FONT), RID_SVXPAGE_CHAR_NAME);
455 AddTabPage("effects", SchResId(STR_PAGE_FONT_EFFECTS), RID_SVXPAGE_CHAR_EFFECTS);
456 AddTabPage("numberformat", SchResId(STR_PAGE_NUMBERS), RID_SVXPAGE_NUMBERFORMAT);
457 if (SvtLanguageOptions().IsCTLFontEnabled())
459 /* When rotation is supported for equation text boxes, use
460 SchAlignmentTabPage::Create here. The special
461 SchAlignmentTabPage::CreateWithoutRotation can be deleted. */
462 AddTabPage("alignment", SchResId(STR_PAGE_ALIGNMENT), SchAlignmentTabPage::CreateWithoutRotation);
464 break;
465 default:
466 break;
469 // used to find out if user left the dialog with OK. When OK is pressed but
470 // no changes were done, Cancel is returned by the SfxTabDialog. See method
471 // DialogWasClosedWithOK.
472 GetOKButton().connect_clicked(LINK(this, SchAttribTabDlg, OKPressed));
475 SchAttribTabDlg::~SchAttribTabDlg()
479 void SchAttribTabDlg::PageCreated(const OString& rId, SfxTabPage &rPage)
481 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
482 if (rId == "border")
484 aSet.Put (SvxColorListItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
485 aSet.Put (SvxDashListItem(m_pViewElementListProvider->GetDashList(),SID_DASH_LIST));
486 aSet.Put (SvxLineEndListItem(m_pViewElementListProvider->GetLineEndList(),SID_LINEEND_LIST));
487 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,0));
488 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nNoArrowNoShadowDlg));
490 if( m_pParameter->HasSymbolProperties() )
492 aSet.Put(OfaPtrItem(SID_OBJECT_LIST,m_pViewElementListProvider->GetSymbolList()));
493 if( m_pSymbolShapeProperties )
494 aSet.Put(SfxTabDialogItem(SID_ATTR_SET,*m_pSymbolShapeProperties));
495 if( m_pAutoSymbolGraphic )
496 aSet.Put(SvxGraphicItem(*m_pAutoSymbolGraphic));
498 rPage.PageCreated(aSet);
500 else if (rId == "area")
502 aSet.Put(SvxColorListItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
503 aSet.Put(SvxGradientListItem(m_pViewElementListProvider->GetGradientList(),SID_GRADIENT_LIST));
504 aSet.Put(SvxHatchListItem(m_pViewElementListProvider->GetHatchList(),SID_HATCH_LIST));
505 aSet.Put(SvxBitmapListItem(m_pViewElementListProvider->GetBitmapList(),SID_BITMAP_LIST));
506 aSet.Put(SvxPatternListItem(m_pViewElementListProvider->GetPatternList(),SID_PATTERN_LIST));
507 aSet.Put(SfxUInt16Item(SID_PAGE_TYPE,0));
508 aSet.Put(SfxUInt16Item(SID_DLG_TYPE,nNoArrowNoShadowDlg));
509 rPage.PageCreated(aSet);
511 else if (rId == "transparent")
513 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,0));
514 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nNoArrowNoShadowDlg));
515 rPage.PageCreated(aSet);
517 else if (rId == "fontname")
519 aSet.Put (SvxFontListItem(m_pViewElementListProvider->getFontList(), SID_ATTR_CHAR_FONTLIST));
520 rPage.PageCreated(aSet);
522 else if (rId == "effects")
524 aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
525 rPage.PageCreated(aSet);
527 else if (rId == "axislabel")
529 bool bShowStaggeringControls = m_pParameter->CanAxisLabelsBeStaggered();
530 static_cast<SchAxisLabelTabPage&>(rPage).ShowStaggeringControls( bShowStaggeringControls );
531 dynamic_cast< SchAxisLabelTabPage& >( rPage ).SetComplexCategories( m_pParameter->IsComplexCategoriesAxis() );
533 else if (rId == "axispos")
535 AxisPositionsTabPage* pPage = dynamic_cast< AxisPositionsTabPage* >( &rPage );
536 if(pPage)
538 pPage->SetNumFormatter( m_pNumberFormatter );
539 if( m_pParameter->IsCrossingAxisIsCategoryAxis() )
541 pPage->SetCrossingAxisIsCategoryAxis( m_pParameter->IsCrossingAxisIsCategoryAxis() );
542 pPage->SetCategories( m_pParameter->GetCategories() );
544 pPage->SupportAxisPositioning( m_pParameter->IsSupportingAxisPositioning() );
547 else if (rId == "scale")
549 ScaleTabPage* pScaleTabPage = dynamic_cast< ScaleTabPage* >( &rPage );
550 if(pScaleTabPage)
552 pScaleTabPage->SetNumFormatter( m_pNumberFormatter );
553 pScaleTabPage->ShowAxisOrigin( m_pParameter->ShowAxisOrigin() );
556 else if (rId == "datalabels")
558 DataLabelsTabPage* pLabelPage = dynamic_cast< DataLabelsTabPage* >( &rPage );
559 if( pLabelPage )
560 pLabelPage->SetNumberFormatter( m_pNumberFormatter );
562 else if (rId == "numberformat")
564 aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, static_cast<sal_uInt16>(SID_ATTR_NUMBERFORMAT_INFO)));
565 rPage.PageCreated(aSet);
567 else if (rId == "xerrorbar")
569 ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
570 OSL_ASSERT( pTabPage );
571 if( pTabPage )
573 pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
574 pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_X );
575 pTabPage->SetChartDocumentForRangeChoosing( m_pParameter->getDocument());
578 else if (rId == "yerrorbar")
580 ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
581 OSL_ASSERT( pTabPage );
582 if( pTabPage )
584 pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
585 pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_Y );
586 pTabPage->SetChartDocumentForRangeChoosing( m_pParameter->getDocument());
589 else if (rId == "options")
591 SchOptionTabPage* pTabPage = dynamic_cast< SchOptionTabPage* >( &rPage );
592 if( pTabPage && m_pParameter )
593 pTabPage->Init( m_pParameter->ProvidesSecondaryYAxis(), m_pParameter->ProvidesOverlapAndGapWidth(),
594 m_pParameter->ProvidesBarConnectors() );
596 else if (rId == "trendline")
598 TrendlineTabPage* pTrendlineTabPage = dynamic_cast< TrendlineTabPage* >( &rPage );
599 if(pTrendlineTabPage)
601 pTrendlineTabPage->SetNumFormatter( m_pNumberFormatter );
602 pTrendlineTabPage->SetNbPoints( m_pParameter->getNbPoints() );
607 IMPL_LINK(SchAttribTabDlg, OKPressed, weld::Button&, rButton, void)
609 m_bOKPressed = true;
610 OkHdl(rButton);
613 } //namespace chart
615 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */