fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / dialogs / dlg_ObjectProperties.cxx
blob92c6cb668f56304e6686c034f26551fbbac4c5c1
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 <svl/zforlist.hxx>
21 #include "dlg_ObjectProperties.hxx"
22 #include "ResourceIds.hrc"
23 #include "Strings.hrc"
24 #include "tp_AxisLabel.hxx"
25 #include "tp_DataLabel.hxx"
26 #include "tp_LegendPosition.hxx"
27 #include "tp_PointGeometry.hxx"
28 #include "tp_Scale.hxx"
29 #include "tp_AxisPositions.hxx"
30 #include "tp_ErrorBars.hxx"
31 #include "tp_Trendline.hxx"
32 #include "tp_SeriesToAxis.hxx"
33 #include "tp_TitleRotation.hxx"
34 #include "tp_PolarOptions.hxx"
35 #include "ResId.hxx"
36 #include "ViewElementListProvider.hxx"
37 #include "macros.hxx"
38 #include "ChartModelHelper.hxx"
39 #include "ChartTypeHelper.hxx"
40 #include "ObjectNameProvider.hxx"
41 #include "DiagramHelper.hxx"
42 #include "NumberFormatterWrapper.hxx"
43 #include "AxisIndexDefines.hxx"
44 #include "AxisHelper.hxx"
45 #include "ExplicitCategoriesProvider.hxx"
46 #include "ChartModel.hxx"
47 #include "CommonConverters.hxx"
48 #include "RegressionCalculationHelper.hxx"
50 #include <com/sun/star/chart2/XAxis.hpp>
51 #include <com/sun/star/chart2/XChartType.hpp>
52 #include <com/sun/star/chart2/XDataSeries.hpp>
53 #include <svl/intitem.hxx>
54 #include <svl/languageoptions.hxx>
56 #include <svx/svxids.hrc>
58 #include <svx/drawitem.hxx>
59 #include <svx/ofaitem.hxx>
60 #include <svx/svxgrahicitem.hxx>
62 #include <svx/dialogs.hrc>
63 #include <editeng/flstitem.hxx>
64 #include <svx/tabline.hxx>
66 #include <svx/flagsdef.hxx>
67 #include <svx/numinf.hxx>
69 #include <svl/cjkoptions.hxx>
71 namespace chart
74 using namespace ::com::sun::star;
75 using namespace ::com::sun::star::chart2;
76 using ::com::sun::star::uno::Reference;
77 using ::com::sun::star::uno::Sequence;
78 using ::com::sun::star::uno::Exception;
79 using ::com::sun::star::beans::XPropertySet;
81 ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const OUString& rObjectCID )
82 : m_aObjectCID( rObjectCID )
83 , m_eObjectType( ObjectIdentifier::getObjectType( m_aObjectCID ) )
84 , m_bAffectsMultipleObjects(false)
85 , m_aLocalizedName()
86 , m_bHasGeometryProperties(false)
87 , m_bHasStatisticProperties(false)
88 , m_bProvidesSecondaryYAxis(false)
89 , m_bProvidesOverlapAndGapWidth(false)
90 , m_bProvidesBarConnectors(false)
91 , m_bHasAreaProperties(false)
92 , m_bHasSymbolProperties(false)
93 , m_bHasNumberProperties(false)
94 , m_bProvidesStartingAngle(false)
95 , m_bProvidesMissingValueTreatments(false)
96 , m_bHasScaleProperties(false)
97 , m_bCanAxisLabelsBeStaggered(false)
98 , m_bSupportingAxisPositioning(false)
99 , m_bShowAxisOrigin(false)
100 , m_bIsCrossingAxisIsCategoryAxis(false)
101 , m_aCategories()
102 , m_xChartDocument( 0 )
103 , m_bComplexCategoriesAxis( false )
104 , m_nNbPoints( 0 )
106 OUString aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID );
107 m_bAffectsMultipleObjects = (aParticleID == "ALLELEMENTS");
109 ObjectPropertiesDialogParameter::~ObjectPropertiesDialogParameter()
113 void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel >& xChartModel )
115 m_xChartDocument.set( xChartModel, uno::UNO_QUERY );
116 uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
117 uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel );
118 uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries );
119 sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
121 bool bHasSeriesProperties = (OBJECTTYPE_DATA_SERIES==m_eObjectType);
122 bool bHasDataPointproperties = (OBJECTTYPE_DATA_POINT==m_eObjectType);
124 if( bHasSeriesProperties || bHasDataPointproperties )
126 m_bHasGeometryProperties = ChartTypeHelper::isSupportingGeometryProperties( xChartType, nDimensionCount );
127 m_bHasAreaProperties = ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount );
128 m_bHasSymbolProperties = ChartTypeHelper::isSupportingSymbolProperties( xChartType, nDimensionCount );
130 if( bHasSeriesProperties )
132 m_bHasStatisticProperties = ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount );
133 m_bProvidesSecondaryYAxis = ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount, 1 );
134 m_bProvidesOverlapAndGapWidth = ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount );
135 m_bProvidesBarConnectors = ChartTypeHelper::isSupportingBarConnectors( xChartType, nDimensionCount );
136 m_bProvidesStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType );
138 m_bProvidesMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType )
139 .getLength();
143 if( m_eObjectType == OBJECTTYPE_DATA_ERRORS_X ||
144 m_eObjectType == OBJECTTYPE_DATA_ERRORS_Y ||
145 m_eObjectType == OBJECTTYPE_DATA_ERRORS_Z)
146 m_bHasStatisticProperties = true;
148 if( OBJECTTYPE_AXIS == m_eObjectType )
150 //show scale properties only for a single axis not for multiselection
151 m_bHasScaleProperties = !m_bAffectsMultipleObjects;
153 if( m_bHasScaleProperties )
155 uno::Reference< XAxis > xAxis( ObjectIdentifier::getAxisForCID( m_aObjectCID, xChartModel ) );
156 if( xAxis.is() )
158 //no scale page for series axis
159 ScaleData aData( xAxis->getScaleData() );
160 if( chart2::AxisType::SERIES == aData.AxisType )
161 m_bHasScaleProperties = false;
162 if( chart2::AxisType::SERIES != aData.AxisType )
163 m_bHasNumberProperties = true;
165 sal_Int32 nCooSysIndex=0;
166 sal_Int32 nDimensionIndex=0;
167 sal_Int32 nAxisIndex=0;
168 if( AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ) )
170 xChartType = AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( xDiagram, nAxisIndex );
171 //show positioning controls only if they make sense
172 m_bSupportingAxisPositioning = ChartTypeHelper::isSupportingAxisPositioning( xChartType, nDimensionCount, nDimensionIndex );
174 //show axis origin only for secondary y axis
175 if( 1==nDimensionIndex && 1==nAxisIndex && ChartTypeHelper::isSupportingBaseValue( xChartType ) )
176 m_bShowAxisOrigin = true;
179 //is the crossin main axis a category axes?:
180 uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) );
181 uno::Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) );
182 if( xCrossingMainAxis.is() )
184 ScaleData aScale( xCrossingMainAxis->getScaleData() );
185 m_bIsCrossingAxisIsCategoryAxis = ( chart2::AxisType::CATEGORY == aScale.AxisType );
186 if( m_bIsCrossingAxisIsCategoryAxis )
188 ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
189 if (pModel)
190 m_aCategories = DiagramHelper::getExplicitSimpleCategories( *pModel );
194 m_bComplexCategoriesAxis = false;
195 if ( nDimensionIndex == 0 && aData.AxisType == chart2::AxisType::CATEGORY )
197 ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
198 if (pModel)
200 ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, *pModel );
201 m_bComplexCategoriesAxis = aExplicitCategoriesProvider.hasComplexCategories();
207 //no staggering of labels for 3D axis
208 m_bCanAxisLabelsBeStaggered = nDimensionCount==2;
211 if( OBJECTTYPE_DATA_CURVE == m_eObjectType )
213 uno::Reference< data::XDataSource > xSource( xSeries, uno::UNO_QUERY );
214 Sequence< Reference< data::XLabeledDataSequence > > aDataSeqs( xSource->getDataSequences());
215 Sequence< double > aXValues, aYValues;
216 bool bXValuesFound = false, bYValuesFound = false;
217 m_nNbPoints = 0;
218 sal_Int32 i = 0;
219 for( i=0;
220 ! (bXValuesFound && bYValuesFound) && i<aDataSeqs.getLength();
221 ++i )
225 Reference< data::XDataSequence > xSeq( aDataSeqs[i]->getValues());
226 Reference< XPropertySet > xProp( xSeq, uno::UNO_QUERY_THROW );
227 OUString aRole;
228 if( xProp->getPropertyValue( "Role" ) >>= aRole )
230 if( !bXValuesFound && aRole == "values-x" )
232 aXValues = DataSequenceToDoubleSequence( xSeq );
233 bXValuesFound = true;
235 else if( !bYValuesFound && aRole == "values-y" )
237 aYValues = DataSequenceToDoubleSequence( xSeq );
238 bYValuesFound = true;
242 catch( const Exception & ex )
244 ASSERT_EXCEPTION( ex );
247 if( !bXValuesFound && bYValuesFound )
249 // initialize with 1, 2, ...
250 //first category (index 0) matches with real number 1.0
251 aXValues.realloc( aYValues.getLength() );
252 for( i=0; i<aXValues.getLength(); ++i )
253 aXValues[i] = i+1;
254 bXValuesFound = true;
257 if( bXValuesFound && bYValuesFound &&
258 aXValues.getLength() > 0 &&
259 aYValues.getLength() > 0 )
261 RegressionCalculationHelper::tDoubleVectorPair aValues(
262 RegressionCalculationHelper::cleanup( aXValues, aYValues, RegressionCalculationHelper::isValid()));
263 m_nNbPoints = aValues.second.size();
267 //create gui name for this object
269 if( !m_bAffectsMultipleObjects && OBJECTTYPE_AXIS == m_eObjectType )
271 m_aLocalizedName = ObjectNameProvider::getAxisName( m_aObjectCID, xChartModel );
273 else if( !m_bAffectsMultipleObjects && ( OBJECTTYPE_GRID == m_eObjectType || OBJECTTYPE_SUBGRID == m_eObjectType ) )
275 m_aLocalizedName = ObjectNameProvider::getGridName( m_aObjectCID, xChartModel );
277 else if( !m_bAffectsMultipleObjects && OBJECTTYPE_TITLE == m_eObjectType )
279 m_aLocalizedName = ObjectNameProvider::getTitleName( m_aObjectCID, xChartModel );
281 else
283 switch( m_eObjectType )
285 case OBJECTTYPE_DATA_POINT:
286 case OBJECTTYPE_DATA_LABEL:
287 case OBJECTTYPE_DATA_LABELS:
288 case OBJECTTYPE_DATA_ERRORS_X:
289 case OBJECTTYPE_DATA_ERRORS_Y:
290 case OBJECTTYPE_DATA_ERRORS_Z:
291 case OBJECTTYPE_DATA_AVERAGE_LINE:
292 case OBJECTTYPE_DATA_CURVE:
293 case OBJECTTYPE_DATA_CURVE_EQUATION:
294 if( m_bAffectsMultipleObjects )
295 m_aLocalizedName = ObjectNameProvider::getName_ObjectForAllSeries( m_eObjectType );
296 else
297 m_aLocalizedName = ObjectNameProvider::getName_ObjectForSeries( m_eObjectType, m_aObjectCID, m_xChartDocument );
298 break;
299 default:
300 m_aLocalizedName = ObjectNameProvider::getName(m_eObjectType,m_bAffectsMultipleObjects);
301 break;
307 const sal_uInt16 nNoArrowNoShadowDlg = 1101;
309 void SchAttribTabDlg::setSymbolInformation( SfxItemSet* pSymbolShapeProperties,
310 Graphic* pAutoSymbolGraphic )
312 m_pSymbolShapeProperties = pSymbolShapeProperties;
313 m_pAutoSymbolGraphic = pAutoSymbolGraphic;
316 void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
318 m_fAxisMinorStepWidthForErrorBarDecimals = fMinorStepWidth;
321 SchAttribTabDlg::SchAttribTabDlg(vcl::Window* pParent,
322 const SfxItemSet* pAttr,
323 const ObjectPropertiesDialogParameter* pDialogParameter,
324 const ViewElementListProvider* pViewElementListProvider,
325 const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
327 : SfxTabDialog(pParent, "AttributeDialog", "modules/schart/ui/attributedialog.ui", pAttr)
328 , eObjectType(pDialogParameter->getObjectType())
329 , nDlgType(nNoArrowNoShadowDlg)
330 , nPageType(0)
331 , m_pParameter( pDialogParameter )
332 , m_pViewElementListProvider( pViewElementListProvider )
333 , m_pNumberFormatter(0)
334 , m_pSymbolShapeProperties(NULL)
335 , m_pAutoSymbolGraphic(NULL)
336 , m_fAxisMinorStepWidthForErrorBarDecimals(0.1)
337 , m_bOKPressed(false)
339 NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
340 m_pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
342 this->SetText( pDialogParameter->getLocalizedName() );
344 SvtCJKOptions aCJKOptions;
346 switch (eObjectType)
348 case OBJECTTYPE_TITLE:
349 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_BORDER));
350 AddTabPage(RID_SVXPAGE_AREA, SCH_RESSTR(STR_PAGE_AREA));
351 AddTabPage(RID_SVXPAGE_TRANSPARENCE, SCH_RESSTR(STR_PAGE_TRANSPARENCY));
352 AddTabPage(RID_SVXPAGE_CHAR_NAME, SCH_RESSTR(STR_PAGE_FONT));
353 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, SCH_RESSTR(STR_PAGE_FONT_EFFECTS));
354 AddTabPage(TP_ALIGNMENT, SCH_RESSTR(STR_PAGE_ALIGNMENT), SchAlignmentTabPage::Create, NULL);
355 if( aCJKOptions.IsAsianTypographyEnabled() )
356 AddTabPage(RID_SVXPAGE_PARA_ASIAN, SCH_RESSTR(STR_PAGE_ASIAN));
357 break;
359 case OBJECTTYPE_LEGEND:
360 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_BORDER));
361 AddTabPage(RID_SVXPAGE_AREA, SCH_RESSTR(STR_PAGE_AREA));
362 AddTabPage(RID_SVXPAGE_TRANSPARENCE, SCH_RESSTR(STR_PAGE_TRANSPARENCY));
363 AddTabPage(RID_SVXPAGE_CHAR_NAME, SCH_RESSTR(STR_PAGE_FONT));
364 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, SCH_RESSTR(STR_PAGE_FONT_EFFECTS));
365 AddTabPage(TP_LEGEND_POS, SCH_RESSTR(STR_PAGE_POSITION), SchLegendPosTabPage::Create, NULL);
366 if( aCJKOptions.IsAsianTypographyEnabled() )
367 AddTabPage(RID_SVXPAGE_PARA_ASIAN, SCH_RESSTR(STR_PAGE_ASIAN));
368 break;
370 case OBJECTTYPE_DATA_SERIES:
371 case OBJECTTYPE_DATA_POINT:
372 if( m_pParameter->ProvidesSecondaryYAxis() || m_pParameter->ProvidesOverlapAndGapWidth() || m_pParameter->ProvidesMissingValueTreatments() )
373 AddTabPage(TP_OPTIONS, SCH_RESSTR(STR_PAGE_OPTIONS),SchOptionTabPage::Create, NULL);
374 if( m_pParameter->ProvidesStartingAngle())
375 AddTabPage(TP_POLAROPTIONS, SCH_RESSTR(STR_PAGE_OPTIONS),PolarOptionsTabPage::Create, NULL);
377 if( m_pParameter->HasGeometryProperties() )
378 AddTabPage(TP_LAYOUT, SCH_RESSTR(STR_PAGE_LAYOUT),SchLayoutTabPage::Create, NULL);
380 if(m_pParameter->HasAreaProperties())
382 AddTabPage(RID_SVXPAGE_AREA, SCH_RESSTR(STR_PAGE_AREA));
383 AddTabPage(RID_SVXPAGE_TRANSPARENCE, SCH_RESSTR(STR_PAGE_TRANSPARENCY));
385 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE ));
386 break;
388 case OBJECTTYPE_DATA_LABEL:
389 case OBJECTTYPE_DATA_LABELS:
390 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_BORDER));
391 AddTabPage(TP_DATA_DESCR, SCH_RESSTR(STR_OBJECT_DATALABELS), DataLabelsTabPage::Create, NULL);
392 AddTabPage(RID_SVXPAGE_CHAR_NAME, SCH_RESSTR(STR_PAGE_FONT));
393 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, SCH_RESSTR(STR_PAGE_FONT_EFFECTS));
394 if( aCJKOptions.IsAsianTypographyEnabled() )
395 AddTabPage(RID_SVXPAGE_PARA_ASIAN, SCH_RESSTR(STR_PAGE_ASIAN));
397 break;
399 case OBJECTTYPE_AXIS:
401 if( m_pParameter->HasScaleProperties() )
402 AddTabPage(TP_SCALE, SCH_RESSTR(STR_PAGE_SCALE), ScaleTabPage::Create, NULL);
404 if( m_pParameter->HasScaleProperties() )//no positioning page for z axes so far as the tickmarks are not shown so far
405 AddTabPage(TP_AXIS_POSITIONS, SCH_RESSTR(STR_PAGE_POSITIONING), AxisPositionsTabPage::Create, NULL);
406 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_LINE));
407 AddTabPage(TP_AXIS_LABEL, SCH_RESSTR(STR_OBJECT_LABEL), SchAxisLabelTabPage::Create, NULL);
408 if( m_pParameter->HasNumberProperties() )
409 AddTabPage(RID_SVXPAGE_NUMBERFORMAT, SCH_RESSTR(STR_PAGE_NUMBERS));
410 AddTabPage(RID_SVXPAGE_CHAR_NAME, SCH_RESSTR(STR_PAGE_FONT));
411 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, SCH_RESSTR(STR_PAGE_FONT_EFFECTS));
412 if( aCJKOptions.IsAsianTypographyEnabled() )
413 AddTabPage(RID_SVXPAGE_PARA_ASIAN, SCH_RESSTR(STR_PAGE_ASIAN));
414 break;
417 case OBJECTTYPE_DATA_ERRORS_X:
418 AddTabPage(TP_XERRORBAR, SCH_RESSTR(STR_PAGE_XERROR_BARS), ErrorBarsTabPage::Create, NULL);
419 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_LINE));
420 break;
422 case OBJECTTYPE_DATA_ERRORS_Y:
423 AddTabPage(TP_YERRORBAR, SCH_RESSTR(STR_PAGE_YERROR_BARS), ErrorBarsTabPage::Create, NULL);
424 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_LINE));
425 break;
427 case OBJECTTYPE_DATA_ERRORS_Z:
428 break;
430 case OBJECTTYPE_GRID:
431 case OBJECTTYPE_SUBGRID:
432 case OBJECTTYPE_DATA_AVERAGE_LINE:
433 case OBJECTTYPE_DATA_STOCK_RANGE:
434 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_LINE));
435 break;
437 case OBJECTTYPE_DATA_CURVE:
438 AddTabPage(TP_TRENDLINE, SCH_RESSTR(STR_PAGE_TRENDLINE_TYPE), TrendlineTabPage::Create, NULL);
439 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_LINE));
440 break;
442 case OBJECTTYPE_DATA_STOCK_LOSS:
443 case OBJECTTYPE_DATA_STOCK_GAIN:
444 case OBJECTTYPE_PAGE:
445 case OBJECTTYPE_DIAGRAM_FLOOR:
446 case OBJECTTYPE_DIAGRAM_WALL:
447 case OBJECTTYPE_DIAGRAM:
448 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_BORDER));
449 AddTabPage(RID_SVXPAGE_AREA, SCH_RESSTR(STR_PAGE_AREA));
450 AddTabPage(RID_SVXPAGE_TRANSPARENCE, SCH_RESSTR(STR_PAGE_TRANSPARENCY));
451 break;
453 case OBJECTTYPE_LEGEND_ENTRY:
454 case OBJECTTYPE_AXIS_UNITLABEL:
455 case OBJECTTYPE_UNKNOWN:
456 // nothing
457 break;
458 case OBJECTTYPE_DATA_CURVE_EQUATION:
459 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_BORDER));
460 AddTabPage(RID_SVXPAGE_AREA, SCH_RESSTR(STR_PAGE_AREA));
461 AddTabPage(RID_SVXPAGE_TRANSPARENCE, SCH_RESSTR(STR_PAGE_TRANSPARENCY));
462 AddTabPage(RID_SVXPAGE_CHAR_NAME, SCH_RESSTR(STR_PAGE_FONT));
463 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, SCH_RESSTR(STR_PAGE_FONT_EFFECTS));
464 AddTabPage(RID_SVXPAGE_NUMBERFORMAT, SCH_RESSTR(STR_PAGE_NUMBERS));
465 if( SvtLanguageOptions().IsCTLFontEnabled() )
466 /* When rotation is supported for equation text boxes, use
467 SchAlignmentTabPage::Create here. The special
468 SchAlignmentTabPage::CreateWithoutRotation can be deleted. */
469 AddTabPage(TP_ALIGNMENT, SCH_RESSTR(STR_PAGE_ALIGNMENT), SchAlignmentTabPage::CreateWithoutRotation, NULL);
470 break;
471 default:
472 break;
475 // used to find out if user left the dialog with OK. When OK is pressed but
476 // no changes were done, Cancel is returned by the SfxTabDialog. See method
477 // DialogWasClosedWithOK.
478 m_aOriginalOKClickHdl = GetOKButton().GetClickHdl();
479 GetOKButton().SetClickHdl( LINK( this, SchAttribTabDlg, OKPressed ));
482 SchAttribTabDlg::~SchAttribTabDlg()
484 disposeOnce();
487 void SchAttribTabDlg::dispose()
489 delete m_pSymbolShapeProperties;
490 m_pSymbolShapeProperties = NULL;
491 delete m_pAutoSymbolGraphic;
492 m_pAutoSymbolGraphic = NULL;
493 SfxTabDialog::dispose();
496 void SchAttribTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
498 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
499 switch (nId)
501 case TP_LAYOUT:
502 break;
503 case RID_SVXPAGE_LINE:
504 aSet.Put (SvxColorListItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
505 aSet.Put (SvxDashListItem(m_pViewElementListProvider->GetDashList(),SID_DASH_LIST));
506 aSet.Put (SvxLineEndListItem(m_pViewElementListProvider->GetLineEndList(),SID_LINEEND_LIST));
507 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
508 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
510 if( m_pParameter->HasSymbolProperties() )
512 aSet.Put(OfaPtrItem(SID_OBJECT_LIST,m_pViewElementListProvider->GetSymbolList()));
513 if( m_pSymbolShapeProperties )
514 aSet.Put(SfxTabDialogItem(SID_ATTR_SET,*m_pSymbolShapeProperties));
515 if( m_pAutoSymbolGraphic )
516 aSet.Put(SvxGraphicItem(SID_GRAPHIC,*m_pAutoSymbolGraphic));
518 rPage.PageCreated(aSet);
519 break;
521 case RID_SVXPAGE_AREA:
522 aSet.Put(SvxColorListItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
523 aSet.Put(SvxGradientListItem(m_pViewElementListProvider->GetGradientList(),SID_GRADIENT_LIST));
524 aSet.Put(SvxHatchListItem(m_pViewElementListProvider->GetHatchList(),SID_HATCH_LIST));
525 aSet.Put(SvxBitmapListItem(m_pViewElementListProvider->GetBitmapList(),SID_BITMAP_LIST));
526 aSet.Put(SfxUInt16Item(SID_PAGE_TYPE,nPageType));
527 aSet.Put(SfxUInt16Item(SID_DLG_TYPE,nDlgType));
528 rPage.PageCreated(aSet);
529 break;
531 case RID_SVXPAGE_TRANSPARENCE:
532 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
533 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
534 rPage.PageCreated(aSet);
535 break;
537 case RID_SVXPAGE_CHAR_NAME:
539 aSet.Put (SvxFontListItem(m_pViewElementListProvider->getFontList(), SID_ATTR_CHAR_FONTLIST));
540 rPage.PageCreated(aSet);
541 break;
543 case RID_SVXPAGE_CHAR_EFFECTS:
544 aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
545 rPage.PageCreated(aSet);
546 break;
548 case TP_AXIS_LABEL:
550 bool bShowStaggeringControls = m_pParameter->CanAxisLabelsBeStaggered();
551 static_cast<SchAxisLabelTabPage&>(rPage).ShowStaggeringControls( bShowStaggeringControls );
552 ( dynamic_cast< SchAxisLabelTabPage& >( rPage ) ).SetComplexCategories( m_pParameter->IsComplexCategoriesAxis() );
553 break;
556 case TP_ALIGNMENT:
557 break;
559 case TP_AXIS_POSITIONS:
561 AxisPositionsTabPage* pPage = dynamic_cast< AxisPositionsTabPage* >( &rPage );
562 if(pPage)
564 pPage->SetNumFormatter( m_pNumberFormatter );
565 if( m_pParameter->IsCrossingAxisIsCategoryAxis() )
567 pPage->SetCrossingAxisIsCategoryAxis( m_pParameter->IsCrossingAxisIsCategoryAxis() );
568 pPage->SetCategories( m_pParameter->GetCategories() );
570 pPage->SupportAxisPositioning( m_pParameter->IsSupportingAxisPositioning() );
573 break;
575 case TP_SCALE:
577 ScaleTabPage* pScaleTabPage = dynamic_cast< ScaleTabPage* >( &rPage );
578 if(pScaleTabPage)
580 pScaleTabPage->SetNumFormatter( m_pNumberFormatter );
581 pScaleTabPage->ShowAxisOrigin( m_pParameter->ShowAxisOrigin() );
584 break;
586 case TP_DATA_DESCR:
588 DataLabelsTabPage* pLabelPage = dynamic_cast< DataLabelsTabPage* >( &rPage );
589 if( pLabelPage )
590 pLabelPage->SetNumberFormatter( m_pNumberFormatter );
592 break;
594 case RID_SVXPAGE_NUMBERFORMAT:
595 aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const sal_uInt16)SID_ATTR_NUMBERFORMAT_INFO));
596 rPage.PageCreated(aSet);
597 break;
598 case TP_XERRORBAR:
600 ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
601 OSL_ASSERT( pTabPage );
602 if( pTabPage )
604 pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
605 pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_X );
606 pTabPage->SetChartDocumentForRangeChoosing( m_pParameter->getDocument());
608 break;
610 case TP_YERRORBAR:
612 ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
613 OSL_ASSERT( pTabPage );
614 if( pTabPage )
616 pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
617 pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_Y );
618 pTabPage->SetChartDocumentForRangeChoosing( m_pParameter->getDocument());
620 break;
622 case TP_OPTIONS:
624 SchOptionTabPage* pTabPage = dynamic_cast< SchOptionTabPage* >( &rPage );
625 if( pTabPage && m_pParameter )
626 pTabPage->Init( m_pParameter->ProvidesSecondaryYAxis(), m_pParameter->ProvidesOverlapAndGapWidth(),
627 m_pParameter->ProvidesBarConnectors() );
628 break;
630 case TP_TRENDLINE:
632 TrendlineTabPage* pTrendlineTabPage = dynamic_cast< TrendlineTabPage* >( &rPage );
633 if(pTrendlineTabPage)
635 pTrendlineTabPage->SetNumFormatter( m_pNumberFormatter );
636 pTrendlineTabPage->SetNbPoints( m_pParameter->getNbPoints() );
638 break;
643 IMPL_LINK_NOARG(SchAttribTabDlg, OKPressed)
645 m_bOKPressed = true;
646 return m_aOriginalOKClickHdl.Call( this );
649 } //namespace chart
651 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */