Bump for 3.6-28
[LibreOffice.git] / chart2 / source / controller / dialogs / dlg_ObjectProperties.cxx
blobb4f5906ac4b089ed72c606daf6530d1b30f7b5a6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _ZFORLIST_HXX
30 #include <svl/zforlist.hxx>
31 #endif
33 #include "dlg_ObjectProperties.hxx"
34 #include "ResourceIds.hrc"
35 #include "Strings.hrc"
36 #include "TabPages.hrc"
37 #include "tp_AxisLabel.hxx"
38 #include "tp_DataLabel.hxx"
39 #include "tp_LegendPosition.hxx"
40 #include "tp_PointGeometry.hxx"
41 #include "tp_Scale.hxx"
42 #include "tp_AxisPositions.hxx"
43 #include "tp_ErrorBars.hxx"
44 #include "tp_Trendline.hxx"
45 #include "tp_SeriesToAxis.hxx"
46 #include "tp_TitleRotation.hxx"
47 #include "tp_PolarOptions.hxx"
48 #include "ResId.hxx"
49 #include "ViewElementListProvider.hxx"
50 #include "macros.hxx"
51 #include "ChartModelHelper.hxx"
52 #include "ChartTypeHelper.hxx"
53 #include "ObjectNameProvider.hxx"
54 #include "DiagramHelper.hxx"
55 #include "NumberFormatterWrapper.hxx"
56 #include "AxisIndexDefines.hxx"
57 #include "AxisHelper.hxx"
58 #include "ExplicitCategoriesProvider.hxx"
60 #include <com/sun/star/chart2/XAxis.hpp>
61 #include <com/sun/star/chart2/XChartType.hpp>
62 #include <com/sun/star/chart2/XDataSeries.hpp>
63 #include <svl/intitem.hxx>
64 #include <svl/languageoptions.hxx>
66 #include <svx/svxids.hrc>
68 #include <svx/drawitem.hxx>
69 #include <svx/ofaitem.hxx>
70 #include <svx/svxgrahicitem.hxx>
72 #include <svx/dialogs.hrc>
73 #include <editeng/flstitem.hxx>
74 #include <svx/tabline.hxx>
76 #include <svx/flagsdef.hxx>
77 #include <svx/numinf.hxx>
79 #include <svl/cjkoptions.hxx>
81 //.............................................................................
82 namespace chart
84 //.............................................................................
86 using namespace ::com::sun::star;
87 using namespace ::com::sun::star::chart2;
88 using ::com::sun::star::uno::Reference;
90 //-----------------------------------------------------------------------------
91 //-----------------------------------------------------------------------------
92 //-----------------------------------------------------------------------------
94 ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const rtl::OUString& rObjectCID )
95 : m_aObjectCID( rObjectCID )
96 , m_eObjectType( ObjectIdentifier::getObjectType( m_aObjectCID ) )
97 , m_bAffectsMultipleObjects(false)
98 , m_aLocalizedName()
99 , m_bHasGeometryProperties(false)
100 , m_bHasStatisticProperties(false)
101 , m_bProvidesSecondaryYAxis(false)
102 , m_bProvidesOverlapAndGapWidth(false)
103 , m_bProvidesBarConnectors(false)
104 , m_bHasAreaProperties(false)
105 , m_bHasSymbolProperties(false)
106 , m_bHasNumberProperties(false)
107 , m_bProvidesStartingAngle(false)
108 , m_bProvidesMissingValueTreatments(false)
109 , m_bHasScaleProperties(false)
110 , m_bCanAxisLabelsBeStaggered(false)
111 , m_bSupportingAxisPositioning(false)
112 , m_bShowAxisOrigin(false)
113 , m_bIsCrossingAxisIsCategoryAxis(false)
114 , m_aCategories()
115 , m_xChartDocument( 0 )
116 , m_bComplexCategoriesAxis( false )
118 rtl::OUString aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID );
119 m_bAffectsMultipleObjects = aParticleID.equals(C2U("ALLELEMENTS"));
121 ObjectPropertiesDialogParameter::~ObjectPropertiesDialogParameter()
124 ObjectType ObjectPropertiesDialogParameter::getObjectType() const
126 return m_eObjectType;
128 rtl::OUString ObjectPropertiesDialogParameter::getLocalizedName() const
130 return m_aLocalizedName;
133 void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel >& xChartModel )
135 m_xChartDocument.set( xChartModel, uno::UNO_QUERY );
136 uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
137 uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel );
138 uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries );
139 sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
141 bool bHasSeriesProperties = (OBJECTTYPE_DATA_SERIES==m_eObjectType);
142 bool bHasDataPointproperties = (OBJECTTYPE_DATA_POINT==m_eObjectType);
144 if( bHasSeriesProperties || bHasDataPointproperties )
146 m_bHasGeometryProperties = ChartTypeHelper::isSupportingGeometryProperties( xChartType, nDimensionCount );
147 m_bHasAreaProperties = ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount );
148 m_bHasSymbolProperties = ChartTypeHelper::isSupportingSymbolProperties( xChartType, nDimensionCount );
150 if( bHasSeriesProperties )
152 m_bHasStatisticProperties = ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount );
153 m_bProvidesSecondaryYAxis = ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount, 1 );
154 m_bProvidesOverlapAndGapWidth = ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount );
155 m_bProvidesBarConnectors = ChartTypeHelper::isSupportingBarConnectors( xChartType, nDimensionCount );
156 m_bProvidesStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType );
158 m_bProvidesMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType )
159 .getLength() ? true : false;
163 if( m_eObjectType == OBJECTTYPE_DATA_ERRORS_X ||
164 m_eObjectType == OBJECTTYPE_DATA_ERRORS_Y ||
165 m_eObjectType == OBJECTTYPE_DATA_ERRORS_Z)
166 m_bHasStatisticProperties = true;
168 if( OBJECTTYPE_AXIS == m_eObjectType )
170 //show scale properties only for a single axis not for multiselection
171 m_bHasScaleProperties = !m_bAffectsMultipleObjects;
173 if( m_bHasScaleProperties )
175 uno::Reference< XAxis > xAxis( ObjectIdentifier::getAxisForCID( m_aObjectCID, xChartModel ) );
176 if( xAxis.is() )
178 //no scale page for series axis
179 ScaleData aData( xAxis->getScaleData() );
180 if( chart2::AxisType::SERIES == aData.AxisType )
181 m_bHasScaleProperties = false;
182 if( chart2::AxisType::SERIES != aData.AxisType )
183 m_bHasNumberProperties = true;
185 sal_Int32 nCooSysIndex=0;
186 sal_Int32 nDimensionIndex=0;
187 sal_Int32 nAxisIndex=0;
188 if( AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ) )
190 xChartType = AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( xDiagram, nAxisIndex );
191 //show positioning controls only if they make sense
192 m_bSupportingAxisPositioning = ChartTypeHelper::isSupportingAxisPositioning( xChartType, nDimensionCount, nDimensionIndex );
194 //show axis origin only for secondary y axis
195 if( 1==nDimensionIndex && 1==nAxisIndex && ChartTypeHelper::isSupportingBaseValue( xChartType ) )
196 m_bShowAxisOrigin = true;
199 //is the crossin main axis a category axes?:
200 uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) );
201 uno::Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) );
202 if( xCrossingMainAxis.is() )
204 ScaleData aScale( xCrossingMainAxis->getScaleData() );
205 m_bIsCrossingAxisIsCategoryAxis = ( chart2::AxisType::CATEGORY == aScale.AxisType );
206 if( m_bIsCrossingAxisIsCategoryAxis )
207 m_aCategories = DiagramHelper::getExplicitSimpleCategories( Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY) );
210 m_bComplexCategoriesAxis = false;
211 if ( nDimensionIndex == 0 && aData.AxisType == chart2::AxisType::CATEGORY )
213 ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, xChartModel );
214 m_bComplexCategoriesAxis = aExplicitCategoriesProvider.hasComplexCategories();
219 //no staggering of labels for 3D axis
220 m_bCanAxisLabelsBeStaggered = nDimensionCount==2;
223 //create gui name for this object
225 if( !m_bAffectsMultipleObjects && OBJECTTYPE_AXIS == m_eObjectType )
227 m_aLocalizedName = ObjectNameProvider::getAxisName( m_aObjectCID, xChartModel );
229 else if( !m_bAffectsMultipleObjects && ( OBJECTTYPE_GRID == m_eObjectType || OBJECTTYPE_SUBGRID == m_eObjectType ) )
231 m_aLocalizedName = ObjectNameProvider::getGridName( m_aObjectCID, xChartModel );
233 else if( !m_bAffectsMultipleObjects && OBJECTTYPE_TITLE == m_eObjectType )
235 m_aLocalizedName = ObjectNameProvider::getTitleName( m_aObjectCID, xChartModel );
237 else
239 switch( m_eObjectType )
241 case OBJECTTYPE_DATA_POINT:
242 case OBJECTTYPE_DATA_LABEL:
243 case OBJECTTYPE_DATA_LABELS:
244 case OBJECTTYPE_DATA_ERRORS_X:
245 case OBJECTTYPE_DATA_ERRORS_Y:
246 case OBJECTTYPE_DATA_ERRORS_Z:
247 case OBJECTTYPE_DATA_AVERAGE_LINE:
248 case OBJECTTYPE_DATA_CURVE:
249 case OBJECTTYPE_DATA_CURVE_EQUATION:
250 if( m_bAffectsMultipleObjects )
251 m_aLocalizedName = ObjectNameProvider::getName_ObjectForAllSeries( m_eObjectType );
252 else
253 m_aLocalizedName = ObjectNameProvider::getName_ObjectForSeries( m_eObjectType, m_aObjectCID, m_xChartDocument );
254 break;
255 default:
256 m_aLocalizedName = ObjectNameProvider::getName(m_eObjectType,m_bAffectsMultipleObjects);
257 break;
263 bool ObjectPropertiesDialogParameter::HasGeometryProperties() const
265 return m_bHasGeometryProperties;
267 bool ObjectPropertiesDialogParameter::HasStatisticProperties() const
269 return m_bHasStatisticProperties;
271 bool ObjectPropertiesDialogParameter::ProvidesSecondaryYAxis() const
273 return m_bProvidesSecondaryYAxis;
275 bool ObjectPropertiesDialogParameter::ProvidesOverlapAndGapWidth() const
277 return m_bProvidesOverlapAndGapWidth;
279 bool ObjectPropertiesDialogParameter::ProvidesBarConnectors() const
281 return m_bProvidesBarConnectors;
283 bool ObjectPropertiesDialogParameter::HasAreaProperties() const
285 return m_bHasAreaProperties;
287 bool ObjectPropertiesDialogParameter::HasSymbolProperties() const
289 return m_bHasSymbolProperties;
291 bool ObjectPropertiesDialogParameter::HasScaleProperties() const
293 return m_bHasScaleProperties;
295 bool ObjectPropertiesDialogParameter::CanAxisLabelsBeStaggered() const
297 return m_bCanAxisLabelsBeStaggered;
299 bool ObjectPropertiesDialogParameter::ShowAxisOrigin() const
301 return m_bShowAxisOrigin;
303 bool ObjectPropertiesDialogParameter::IsSupportingAxisPositioning() const
305 return m_bSupportingAxisPositioning;
307 bool ObjectPropertiesDialogParameter::IsCrossingAxisIsCategoryAxis() const
309 return m_bIsCrossingAxisIsCategoryAxis;
311 const uno::Sequence< rtl::OUString >& ObjectPropertiesDialogParameter::GetCategories() const
313 return m_aCategories;
315 bool ObjectPropertiesDialogParameter::HasNumberProperties() const
317 return m_bHasNumberProperties;
319 bool ObjectPropertiesDialogParameter::ProvidesStartingAngle() const
321 return m_bProvidesStartingAngle;
323 bool ObjectPropertiesDialogParameter::ProvidesMissingValueTreatments() const
325 return m_bProvidesMissingValueTreatments;
327 uno::Reference< chart2::XChartDocument > ObjectPropertiesDialogParameter::getDocument() const
329 return m_xChartDocument;
331 bool ObjectPropertiesDialogParameter::IsComplexCategoriesAxis() const
333 return m_bComplexCategoriesAxis;
336 const sal_uInt16 nNoArrowNoShadowDlg = 1101;
338 //-------------------------------------------------------------------
339 //-------------------------------------------------------------------
340 //-------------------------------------------------------------------
342 void SchAttribTabDlg::setSymbolInformation( SfxItemSet* pSymbolShapeProperties,
343 Graphic* pAutoSymbolGraphic )
345 m_pSymbolShapeProperties = pSymbolShapeProperties;
346 m_pAutoSymbolGraphic = pAutoSymbolGraphic;
349 void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
351 m_fAxisMinorStepWidthForErrorBarDecimals = fMinorStepWidth;
354 SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
355 const SfxItemSet* pAttr,
356 const ObjectPropertiesDialogParameter* pDialogParameter,
357 const ViewElementListProvider* pViewElementListProvider,
358 const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
360 : SfxTabDialog(pParent, SchResId(DLG_OBJECT_PROPERTIES), pAttr)
361 , eObjectType(pDialogParameter->getObjectType())
362 , nDlgType(nNoArrowNoShadowDlg)
363 , nPageType(0)
364 , m_pParameter( pDialogParameter )
365 , m_pViewElementListProvider( pViewElementListProvider )
366 , m_pNumberFormatter(0)
367 , m_pSymbolShapeProperties(NULL)
368 , m_pAutoSymbolGraphic(NULL)
369 , m_fAxisMinorStepWidthForErrorBarDecimals(0.1)
370 , m_bOKPressed(false)
372 FreeResource();
374 NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
375 m_pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
377 this->SetText( pDialogParameter->getLocalizedName() );
379 SvtCJKOptions aCJKOptions;
381 switch (eObjectType)
383 case OBJECTTYPE_TITLE:
384 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_BORDER));
385 AddTabPage(RID_SVXPAGE_AREA, SCH_RESSTR(STR_PAGE_AREA));
386 AddTabPage(RID_SVXPAGE_TRANSPARENCE, SCH_RESSTR(STR_PAGE_TRANSPARENCY));
387 AddTabPage(RID_SVXPAGE_CHAR_NAME, SCH_RESSTR(STR_PAGE_FONT));
388 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, SCH_RESSTR(STR_PAGE_FONT_EFFECTS));
389 AddTabPage(TP_ALIGNMENT, SCH_RESSTR(STR_PAGE_ALIGNMENT), SchAlignmentTabPage::Create, NULL);
390 if( aCJKOptions.IsAsianTypographyEnabled() )
391 AddTabPage(RID_SVXPAGE_PARA_ASIAN, SCH_RESSTR(STR_PAGE_ASIAN));
392 break;
394 case OBJECTTYPE_LEGEND:
395 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_BORDER));
396 AddTabPage(RID_SVXPAGE_AREA, SCH_RESSTR(STR_PAGE_AREA));
397 AddTabPage(RID_SVXPAGE_TRANSPARENCE, SCH_RESSTR(STR_PAGE_TRANSPARENCY));
398 AddTabPage(RID_SVXPAGE_CHAR_NAME, SCH_RESSTR(STR_PAGE_FONT));
399 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, SCH_RESSTR(STR_PAGE_FONT_EFFECTS));
400 AddTabPage(TP_LEGEND_POS, SCH_RESSTR(STR_PAGE_POSITION), SchLegendPosTabPage::Create, NULL);
401 if( aCJKOptions.IsAsianTypographyEnabled() )
402 AddTabPage(RID_SVXPAGE_PARA_ASIAN, SCH_RESSTR(STR_PAGE_ASIAN));
403 break;
405 case OBJECTTYPE_DATA_SERIES:
406 case OBJECTTYPE_DATA_POINT:
407 if( m_pParameter->ProvidesSecondaryYAxis() || m_pParameter->ProvidesOverlapAndGapWidth() || m_pParameter->ProvidesMissingValueTreatments() )
408 AddTabPage(TP_OPTIONS, SCH_RESSTR(STR_PAGE_OPTIONS),SchOptionTabPage::Create, NULL);
409 if( m_pParameter->ProvidesStartingAngle())
410 AddTabPage(TP_POLAROPTIONS, SCH_RESSTR(STR_PAGE_OPTIONS),PolarOptionsTabPage::Create, NULL);
412 if( m_pParameter->HasGeometryProperties() )
413 AddTabPage(TP_LAYOUT, SCH_RESSTR(STR_PAGE_LAYOUT),SchLayoutTabPage::Create, NULL);
415 if(m_pParameter->HasAreaProperties())
417 AddTabPage(RID_SVXPAGE_AREA, SCH_RESSTR(STR_PAGE_AREA));
418 AddTabPage(RID_SVXPAGE_TRANSPARENCE, SCH_RESSTR(STR_PAGE_TRANSPARENCY));
420 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE ));
421 break;
423 case OBJECTTYPE_DATA_LABEL:
424 case OBJECTTYPE_DATA_LABELS:
425 AddTabPage(TP_DATA_DESCR, SCH_RESSTR(STR_OBJECT_DATALABELS), DataLabelsTabPage::Create, NULL);
426 AddTabPage(RID_SVXPAGE_CHAR_NAME, SCH_RESSTR(STR_PAGE_FONT));
427 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, SCH_RESSTR(STR_PAGE_FONT_EFFECTS));
428 if( aCJKOptions.IsAsianTypographyEnabled() )
429 AddTabPage(RID_SVXPAGE_PARA_ASIAN, SCH_RESSTR(STR_PAGE_ASIAN));
431 break;
433 case OBJECTTYPE_AXIS:
435 if( m_pParameter->HasScaleProperties() )
436 AddTabPage(TP_SCALE, SCH_RESSTR(STR_PAGE_SCALE), ScaleTabPage::Create, NULL);
438 if( m_pParameter->HasScaleProperties() )//no positioning page for z axes so far as the tickmarks are not shown so far
439 AddTabPage(TP_AXIS_POSITIONS, SCH_RESSTR(STR_PAGE_POSITIONING), AxisPositionsTabPage::Create, NULL);
440 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_LINE));
441 AddTabPage(TP_AXIS_LABEL, SCH_RESSTR(STR_OBJECT_LABEL), SchAxisLabelTabPage::Create, NULL);
442 if( m_pParameter->HasNumberProperties() )
443 AddTabPage(RID_SVXPAGE_NUMBERFORMAT, SCH_RESSTR(STR_PAGE_NUMBERS));
444 AddTabPage(RID_SVXPAGE_CHAR_NAME, SCH_RESSTR(STR_PAGE_FONT));
445 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, SCH_RESSTR(STR_PAGE_FONT_EFFECTS));
446 if( aCJKOptions.IsAsianTypographyEnabled() )
447 AddTabPage(RID_SVXPAGE_PARA_ASIAN, SCH_RESSTR(STR_PAGE_ASIAN));
448 break;
451 case OBJECTTYPE_DATA_ERRORS_X:
452 AddTabPage(TP_XERRORBAR, SCH_RESSTR(STR_PAGE_XERROR_BARS), ErrorBarsTabPage::Create, NULL);
453 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_LINE));
454 break;
456 case OBJECTTYPE_DATA_ERRORS_Y:
457 AddTabPage(TP_YERRORBAR, SCH_RESSTR(STR_PAGE_YERROR_BARS), ErrorBarsTabPage::Create, NULL);
458 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_LINE));
459 break;
461 case OBJECTTYPE_DATA_ERRORS_Z:
462 break;
464 case OBJECTTYPE_GRID:
465 case OBJECTTYPE_SUBGRID:
466 case OBJECTTYPE_DATA_AVERAGE_LINE:
467 case OBJECTTYPE_DATA_STOCK_RANGE:
468 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_LINE));
469 break;
471 case OBJECTTYPE_DATA_CURVE:
472 AddTabPage(TP_TRENDLINE, SCH_RESSTR(STR_PAGE_TRENDLINE_TYPE), TrendlineTabPage::Create, NULL);
473 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_LINE));
474 break;
476 case OBJECTTYPE_DATA_STOCK_LOSS:
477 case OBJECTTYPE_DATA_STOCK_GAIN:
478 case OBJECTTYPE_PAGE:
479 case OBJECTTYPE_DIAGRAM_FLOOR:
480 case OBJECTTYPE_DIAGRAM_WALL:
481 case OBJECTTYPE_DIAGRAM:
482 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_BORDER));
483 AddTabPage(RID_SVXPAGE_AREA, SCH_RESSTR(STR_PAGE_AREA));
484 AddTabPage(RID_SVXPAGE_TRANSPARENCE, SCH_RESSTR(STR_PAGE_TRANSPARENCY));
485 break;
487 case OBJECTTYPE_LEGEND_ENTRY:
488 case OBJECTTYPE_AXIS_UNITLABEL:
489 case OBJECTTYPE_UNKNOWN:
490 // nothing
491 break;
492 case OBJECTTYPE_DATA_CURVE_EQUATION:
493 AddTabPage(RID_SVXPAGE_LINE, SCH_RESSTR(STR_PAGE_BORDER));
494 AddTabPage(RID_SVXPAGE_AREA, SCH_RESSTR(STR_PAGE_AREA));
495 AddTabPage(RID_SVXPAGE_TRANSPARENCE, SCH_RESSTR(STR_PAGE_TRANSPARENCY));
496 AddTabPage(RID_SVXPAGE_CHAR_NAME, SCH_RESSTR(STR_PAGE_FONT));
497 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, SCH_RESSTR(STR_PAGE_FONT_EFFECTS));
498 AddTabPage(RID_SVXPAGE_NUMBERFORMAT, SCH_RESSTR(STR_PAGE_NUMBERS));
499 if( SvtLanguageOptions().IsCTLFontEnabled() )
500 /* When rotation is supported for equation text boxes, use
501 SchAlignmentTabPage::Create here. The special
502 SchAlignmentTabPage::CreateWithoutRotation can be deleted. */
503 AddTabPage(TP_ALIGNMENT, SCH_RESSTR(STR_PAGE_ALIGNMENT), SchAlignmentTabPage::CreateWithoutRotation, NULL);
504 break;
505 default:
506 break;
509 // used to find out if user left the dialog with OK. When OK is pressed but
510 // no changes were done, Cancel is returned by the SfxTabDialog. See method
511 // DialogWasClosedWithOK.
512 m_aOriginalOKClickHdl = GetOKButton().GetClickHdl();
513 GetOKButton().SetClickHdl( LINK( this, SchAttribTabDlg, OKPressed ));
516 SchAttribTabDlg::~SchAttribTabDlg()
518 delete m_pSymbolShapeProperties;
519 delete m_pAutoSymbolGraphic;
522 void SchAttribTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
524 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
525 switch (nId)
527 case TP_LAYOUT:
528 break;
529 case RID_SVXPAGE_LINE:
530 aSet.Put (SvxColorListItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
531 aSet.Put (SvxDashListItem(m_pViewElementListProvider->GetDashList(),SID_DASH_LIST));
532 aSet.Put (SvxLineEndListItem(m_pViewElementListProvider->GetLineEndList(),SID_LINEEND_LIST));
533 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
534 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
536 if( m_pParameter->HasSymbolProperties() )
538 aSet.Put(OfaPtrItem(SID_OBJECT_LIST,m_pViewElementListProvider->GetSymbolList()));
539 if( m_pSymbolShapeProperties )
540 aSet.Put(SfxTabDialogItem(SID_ATTR_SET,*m_pSymbolShapeProperties));
541 if( m_pAutoSymbolGraphic )
542 aSet.Put(SvxGraphicItem(SID_GRAPHIC,*m_pAutoSymbolGraphic));
544 rPage.PageCreated(aSet);
545 break;
547 case RID_SVXPAGE_AREA:
548 aSet.Put(SvxColorListItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
549 aSet.Put(SvxGradientListItem(m_pViewElementListProvider->GetGradientList(),SID_GRADIENT_LIST));
550 aSet.Put(SvxHatchListItem(m_pViewElementListProvider->GetHatchList(),SID_HATCH_LIST));
551 aSet.Put(SvxBitmapListItem(m_pViewElementListProvider->GetBitmapList(),SID_BITMAP_LIST));
552 aSet.Put(SfxUInt16Item(SID_PAGE_TYPE,nPageType));
553 aSet.Put(SfxUInt16Item(SID_DLG_TYPE,nDlgType));
554 rPage.PageCreated(aSet);
555 break;
557 case RID_SVXPAGE_TRANSPARENCE:
558 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
559 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
560 rPage.PageCreated(aSet);
561 break;
563 case RID_SVXPAGE_CHAR_NAME:
565 aSet.Put (SvxFontListItem(m_pViewElementListProvider->getFontList(), SID_ATTR_CHAR_FONTLIST));
566 rPage.PageCreated(aSet);
567 break;
569 case RID_SVXPAGE_CHAR_EFFECTS:
570 aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
571 rPage.PageCreated(aSet);
572 break;
574 case TP_AXIS_LABEL:
576 bool bShowStaggeringControls = m_pParameter->CanAxisLabelsBeStaggered();
577 ((SchAxisLabelTabPage&)rPage).ShowStaggeringControls( bShowStaggeringControls );
578 ( dynamic_cast< SchAxisLabelTabPage& >( rPage ) ).SetComplexCategories( m_pParameter->IsComplexCategoriesAxis() );
579 break;
582 case TP_ALIGNMENT:
583 break;
586 case TP_AXIS_POSITIONS:
588 AxisPositionsTabPage* pPage = dynamic_cast< AxisPositionsTabPage* >( &rPage );
589 if(pPage)
591 pPage->SetNumFormatter( m_pNumberFormatter );
592 if( m_pParameter->IsCrossingAxisIsCategoryAxis() )
594 pPage->SetCrossingAxisIsCategoryAxis( m_pParameter->IsCrossingAxisIsCategoryAxis() );
595 pPage->SetCategories( m_pParameter->GetCategories() );
597 pPage->SupportAxisPositioning( m_pParameter->IsSupportingAxisPositioning() );
600 break;
602 case TP_SCALE:
604 ScaleTabPage* pScaleTabPage = dynamic_cast< ScaleTabPage* >( &rPage );
605 if(pScaleTabPage)
607 pScaleTabPage->SetNumFormatter( m_pNumberFormatter );
608 pScaleTabPage->ShowAxisOrigin( m_pParameter->ShowAxisOrigin() );
611 break;
613 case TP_DATA_DESCR:
615 DataLabelsTabPage* pLabelPage = dynamic_cast< DataLabelsTabPage* >( &rPage );
616 if( pLabelPage )
617 pLabelPage->SetNumberFormatter( m_pNumberFormatter );
619 break;
621 case RID_SVXPAGE_NUMBERFORMAT:
622 aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const sal_uInt16)SID_ATTR_NUMBERFORMAT_INFO));
623 rPage.PageCreated(aSet);
624 break;
625 case TP_XERRORBAR:
627 ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
628 OSL_ASSERT( pTabPage );
629 if( pTabPage )
631 pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
632 pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_X );
633 pTabPage->SetChartDocumentForRangeChoosing( m_pParameter->getDocument());
635 break;
637 case TP_YERRORBAR:
639 ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
640 OSL_ASSERT( pTabPage );
641 if( pTabPage )
643 pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
644 pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_Y );
645 pTabPage->SetChartDocumentForRangeChoosing( m_pParameter->getDocument());
647 break;
649 case TP_OPTIONS:
651 SchOptionTabPage* pTabPage = dynamic_cast< SchOptionTabPage* >( &rPage );
652 if( pTabPage && m_pParameter )
653 pTabPage->Init( m_pParameter->ProvidesSecondaryYAxis(), m_pParameter->ProvidesOverlapAndGapWidth(),
654 m_pParameter->ProvidesBarConnectors() );
655 break;
660 IMPL_LINK_NOARG(SchAttribTabDlg, OKPressed)
662 m_bOKPressed = true;
663 return m_aOriginalOKClickHdl.Call( this );
666 bool SchAttribTabDlg::DialogWasClosedWithOK() const
668 return m_bOKPressed;
671 //.............................................................................
672 } //namespace chart
673 //.............................................................................
675 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */