merged tag ooo/OOO330_m14
[LibreOffice.git] / chart2 / source / controller / dialogs / dlg_ObjectProperties.cxx
blob2a41d35313e81a293ac2e031046ff2b2c7324733
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_chart2.hxx"
30 #ifndef _ZFORLIST_HXX
31 #ifndef _ZFORLIST_DECLARE_TABLE
32 #define _ZFORLIST_DECLARE_TABLE
33 #endif
34 #include <svl/zforlist.hxx>
35 #endif
37 #include "dlg_ObjectProperties.hxx"
38 #include "ResourceIds.hrc"
39 #include "Strings.hrc"
40 #include "TabPages.hrc"
41 #include "tp_AxisLabel.hxx"
42 #include "tp_DataLabel.hxx"
43 #include "tp_LegendPosition.hxx"
44 #include "tp_PointGeometry.hxx"
45 #include "tp_Scale.hxx"
46 #include "tp_AxisPositions.hxx"
47 #include "tp_ErrorBars.hxx"
48 #include "tp_Trendline.hxx"
49 #include "tp_SeriesToAxis.hxx"
50 #include "tp_TitleRotation.hxx"
51 #include "tp_PolarOptions.hxx"
52 #include "ResId.hxx"
53 #include "ViewElementListProvider.hxx"
54 #include "macros.hxx"
55 #include "ChartModelHelper.hxx"
56 #include "ChartTypeHelper.hxx"
57 #include "ObjectNameProvider.hxx"
58 #include "DiagramHelper.hxx"
59 #include "chartview/NumberFormatterWrapper.hxx"
60 #include "AxisIndexDefines.hxx"
61 #include "AxisHelper.hxx"
63 #include <com/sun/star/chart2/XAxis.hpp>
64 #include <com/sun/star/chart2/XChartType.hpp>
65 #include <com/sun/star/chart2/XDataSeries.hpp>
66 #include <svl/intitem.hxx>
67 #include <svl/languageoptions.hxx>
69 #include <svx/svxids.hrc>
71 #include <svx/drawitem.hxx>
72 #include <svx/ofaitem.hxx>
73 #include <svx/svxgrahicitem.hxx>
75 #include <svx/dialogs.hrc>
76 #include <editeng/flstitem.hxx>
77 #include <svx/tabline.hxx>
79 #include <svx/flagsdef.hxx>
80 #include <svx/numinf.hxx>
82 #include <svl/cjkoptions.hxx>
84 //.............................................................................
85 namespace chart
87 //.............................................................................
89 using namespace ::com::sun::star;
90 using namespace ::com::sun::star::chart2;
91 using ::com::sun::star::uno::Reference;
93 //-----------------------------------------------------------------------------
94 //-----------------------------------------------------------------------------
95 //-----------------------------------------------------------------------------
97 ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const rtl::OUString& rObjectCID )
98 : m_aObjectCID( rObjectCID )
99 , m_eObjectType( ObjectIdentifier::getObjectType( m_aObjectCID ) )
100 , m_bAffectsMultipleObjects(false)
101 , m_aLocalizedName()
102 , m_bHasGeometryProperties(false)
103 , m_bHasStatisticProperties(false)
104 , m_bProvidesSecondaryYAxis(false)
105 , m_bProvidesOverlapAndGapWidth(false)
106 , m_bProvidesBarConnectors(false)
107 , m_bHasAreaProperties(false)
108 , m_bHasSymbolProperties(false)
109 , m_bHasNumberProperties(false)
110 , m_bProvidesStartingAngle(false)
111 , m_bProvidesMissingValueTreatments(false)
112 , m_bHasScaleProperties(false)
113 , m_bCanAxisLabelsBeStaggered(false)
114 , m_bSupportingAxisPositioning(false)
115 , m_bShowAxisOrigin(false)
116 , m_bIsCrossingAxisIsCategoryAxis(false)
117 , m_aCategories()
118 , m_xChartDocument( 0 )
120 rtl::OUString aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID );
121 m_bAffectsMultipleObjects = aParticleID.equals(C2U("ALLELEMENTS"));
123 ObjectPropertiesDialogParameter::~ObjectPropertiesDialogParameter()
126 ObjectType ObjectPropertiesDialogParameter::getObjectType() const
128 return m_eObjectType;
130 rtl::OUString ObjectPropertiesDialogParameter::getLocalizedName() const
132 return m_aLocalizedName;
135 void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel >& xChartModel )
137 m_xChartDocument.set( xChartModel, uno::UNO_QUERY );
138 uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
139 uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel );
140 uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries );
141 sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
143 bool bHasSeriesProperties = (OBJECTTYPE_DATA_SERIES==m_eObjectType);
144 bool bHasDataPointproperties = (OBJECTTYPE_DATA_POINT==m_eObjectType);
146 if( bHasSeriesProperties || bHasDataPointproperties )
148 m_bHasGeometryProperties = ChartTypeHelper::isSupportingGeometryProperties( xChartType, nDimensionCount );
149 m_bHasAreaProperties = ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount );
150 m_bHasSymbolProperties = ChartTypeHelper::isSupportingSymbolProperties( xChartType, nDimensionCount );
152 if( bHasSeriesProperties )
154 m_bHasStatisticProperties = ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount );
155 m_bProvidesSecondaryYAxis = ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount, 1 );
156 m_bProvidesOverlapAndGapWidth = ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount );
157 m_bProvidesBarConnectors = ChartTypeHelper::isSupportingBarConnectors( xChartType, nDimensionCount );
158 m_bProvidesStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType );
160 m_bProvidesMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType )
161 .getLength() ? true : false;
165 if( OBJECTTYPE_DATA_ERRORS == m_eObjectType )
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::REALNUMBER == aData.AxisType || chart2::AxisType::PERCENT == 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) );
212 //no staggering of labels for 3D axis
213 m_bCanAxisLabelsBeStaggered = nDimensionCount==2;
216 //create gui name for this object
218 if( !m_bAffectsMultipleObjects && OBJECTTYPE_AXIS == m_eObjectType )
220 m_aLocalizedName = ObjectNameProvider::getAxisName( m_aObjectCID, xChartModel );
222 else if( !m_bAffectsMultipleObjects && ( OBJECTTYPE_GRID == m_eObjectType || OBJECTTYPE_SUBGRID == m_eObjectType ) )
224 m_aLocalizedName = ObjectNameProvider::getGridName( m_aObjectCID, xChartModel );
226 else if( !m_bAffectsMultipleObjects && OBJECTTYPE_TITLE == m_eObjectType )
228 m_aLocalizedName = ObjectNameProvider::getTitleName( m_aObjectCID, xChartModel );
230 else
232 switch( m_eObjectType )
234 case OBJECTTYPE_DATA_POINT:
235 case OBJECTTYPE_DATA_LABEL:
236 case OBJECTTYPE_DATA_LABELS:
237 case OBJECTTYPE_DATA_ERRORS:
238 case OBJECTTYPE_DATA_ERRORS_X:
239 case OBJECTTYPE_DATA_ERRORS_Y:
240 case OBJECTTYPE_DATA_ERRORS_Z:
241 case OBJECTTYPE_DATA_AVERAGE_LINE:
242 case OBJECTTYPE_DATA_CURVE:
243 case OBJECTTYPE_DATA_CURVE_EQUATION:
244 if( m_bAffectsMultipleObjects )
245 m_aLocalizedName = ObjectNameProvider::getName_ObjectForAllSeries( m_eObjectType );
246 else
247 m_aLocalizedName = ObjectNameProvider::getName_ObjectForSeries( m_eObjectType, m_aObjectCID, m_xChartDocument );
248 break;
249 default:
250 m_aLocalizedName = ObjectNameProvider::getName(m_eObjectType,m_bAffectsMultipleObjects);
251 break;
257 bool ObjectPropertiesDialogParameter::HasGeometryProperties() const
259 return m_bHasGeometryProperties;
261 bool ObjectPropertiesDialogParameter::HasStatisticProperties() const
263 return m_bHasStatisticProperties;
265 bool ObjectPropertiesDialogParameter::ProvidesSecondaryYAxis() const
267 return m_bProvidesSecondaryYAxis;
269 bool ObjectPropertiesDialogParameter::ProvidesOverlapAndGapWidth() const
271 return m_bProvidesOverlapAndGapWidth;
273 bool ObjectPropertiesDialogParameter::ProvidesBarConnectors() const
275 return m_bProvidesBarConnectors;
277 bool ObjectPropertiesDialogParameter::HasAreaProperties() const
279 return m_bHasAreaProperties;
281 bool ObjectPropertiesDialogParameter::HasSymbolProperties() const
283 return m_bHasSymbolProperties;
285 bool ObjectPropertiesDialogParameter::HasScaleProperties() const
287 return m_bHasScaleProperties;
289 bool ObjectPropertiesDialogParameter::CanAxisLabelsBeStaggered() const
291 return m_bCanAxisLabelsBeStaggered;
293 bool ObjectPropertiesDialogParameter::ShowAxisOrigin() const
295 return m_bShowAxisOrigin;
297 bool ObjectPropertiesDialogParameter::IsSupportingAxisPositioning() const
299 return m_bSupportingAxisPositioning;
301 bool ObjectPropertiesDialogParameter::IsCrossingAxisIsCategoryAxis() const
303 return m_bIsCrossingAxisIsCategoryAxis;
305 const uno::Sequence< rtl::OUString >& ObjectPropertiesDialogParameter::GetCategories() const
307 return m_aCategories;
309 bool ObjectPropertiesDialogParameter::HasNumberProperties() const
311 return m_bHasNumberProperties;
313 bool ObjectPropertiesDialogParameter::ProvidesStartingAngle() const
315 return m_bProvidesStartingAngle;
317 bool ObjectPropertiesDialogParameter::ProvidesMissingValueTreatments() const
319 return m_bProvidesMissingValueTreatments;
321 uno::Reference< chart2::XChartDocument > ObjectPropertiesDialogParameter::getDocument() const
323 return m_xChartDocument;
326 //const USHORT nNoArrowDlg = 1100;
327 const USHORT nNoArrowNoShadowDlg = 1101;
329 //-------------------------------------------------------------------
330 //-------------------------------------------------------------------
331 //-------------------------------------------------------------------
333 void SchAttribTabDlg::setSymbolInformation( SfxItemSet* pSymbolShapeProperties,
334 Graphic* pAutoSymbolGraphic )
336 m_pSymbolShapeProperties = pSymbolShapeProperties;
337 m_pAutoSymbolGraphic = pAutoSymbolGraphic;
340 void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
342 m_fAxisMinorStepWidthForErrorBarDecimals = fMinorStepWidth;
345 SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
346 const SfxItemSet* pAttr,
347 const ObjectPropertiesDialogParameter* pDialogParameter,
348 const ViewElementListProvider* pViewElementListProvider,
349 const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
351 : SfxTabDialog(pParent, SchResId(DLG_OBJECT_PROPERTIES), pAttr)
352 , eObjectType(pDialogParameter->getObjectType())
353 , nDlgType(nNoArrowNoShadowDlg)
354 , nPageType(0)
355 , m_pParameter( pDialogParameter )
356 , m_pViewElementListProvider( pViewElementListProvider )
357 , m_pNumberFormatter(0)
358 , m_pSymbolShapeProperties(NULL)
359 , m_pAutoSymbolGraphic(NULL)
360 , m_fAxisMinorStepWidthForErrorBarDecimals(0.1)
361 , m_bOKPressed(false)
363 FreeResource();
365 NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
366 m_pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
368 this->SetText( pDialogParameter->getLocalizedName() );
370 SvtCJKOptions aCJKOptions;
372 switch (eObjectType)
374 case OBJECTTYPE_TITLE:
375 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
376 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
377 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
378 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
379 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
380 AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::Create, NULL);
381 if( aCJKOptions.IsAsianTypographyEnabled() )
382 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
383 break;
385 case OBJECTTYPE_LEGEND:
386 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
387 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
388 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
389 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
390 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
391 AddTabPage(TP_LEGEND_POS, String(SchResId(STR_PAGE_POSITION)), SchLegendPosTabPage::Create, NULL);
392 if( aCJKOptions.IsAsianTypographyEnabled() )
393 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
394 break;
396 case OBJECTTYPE_DATA_SERIES:
397 case OBJECTTYPE_DATA_POINT:
398 if( m_pParameter->ProvidesSecondaryYAxis() || m_pParameter->ProvidesOverlapAndGapWidth() || m_pParameter->ProvidesMissingValueTreatments() )
399 AddTabPage(TP_OPTIONS, String(SchResId(STR_PAGE_OPTIONS)),SchOptionTabPage::Create, NULL);
400 if( m_pParameter->ProvidesStartingAngle())
401 AddTabPage(TP_POLAROPTIONS, String(SchResId(STR_PAGE_OPTIONS)),PolarOptionsTabPage::Create, NULL);
403 if( m_pParameter->HasGeometryProperties() )
404 AddTabPage(TP_LAYOUT, String(SchResId(STR_PAGE_LAYOUT)),SchLayoutTabPage::Create, NULL);
406 if(m_pParameter->HasAreaProperties())
408 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
409 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
411 AddTabPage(RID_SVXPAGE_LINE, String(SchResId( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE )));
412 break;
414 case OBJECTTYPE_DATA_LABEL:
415 case OBJECTTYPE_DATA_LABELS:
416 AddTabPage(TP_DATA_DESCR, String(SchResId(STR_OBJECT_DATALABELS)), DataLabelsTabPage::Create, NULL);
417 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
418 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
419 if( aCJKOptions.IsAsianTypographyEnabled() )
420 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
422 break;
424 case OBJECTTYPE_AXIS:
426 if( m_pParameter->HasScaleProperties() )
427 AddTabPage(TP_SCALE, String(SchResId(STR_PAGE_SCALE)), ScaleTabPage::Create, NULL);
429 if( m_pParameter->HasScaleProperties() )//no positioning page for z axes so far as the tickmarks are not shown so far
430 AddTabPage(TP_AXIS_POSITIONS, String(SchResId(STR_PAGE_POSITIONING)), AxisPositionsTabPage::Create, NULL);
431 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
432 AddTabPage(TP_AXIS_LABEL, String(SchResId(STR_OBJECT_LABEL)), SchAxisLabelTabPage::Create, NULL);
433 if( m_pParameter->HasNumberProperties() )
434 AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
435 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
436 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
437 if( aCJKOptions.IsAsianTypographyEnabled() )
438 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
439 break;
442 case OBJECTTYPE_DATA_ERRORS:
443 case OBJECTTYPE_DATA_ERRORS_X:
444 case OBJECTTYPE_DATA_ERRORS_Y:
445 case OBJECTTYPE_DATA_ERRORS_Z:
446 AddTabPage(TP_YERRORBAR, String(SchResId(STR_PAGE_YERROR_BARS)), ErrorBarsTabPage::Create, NULL);
447 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
448 break;
450 case OBJECTTYPE_GRID:
451 case OBJECTTYPE_SUBGRID:
452 case OBJECTTYPE_DATA_AVERAGE_LINE:
453 case OBJECTTYPE_DATA_STOCK_RANGE:
454 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
455 break;
457 case OBJECTTYPE_DATA_CURVE:
458 AddTabPage(TP_TRENDLINE, String(SchResId(STR_PAGE_TRENDLINE_TYPE)), TrendlineTabPage::Create, NULL);
459 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
460 break;
462 case OBJECTTYPE_DATA_STOCK_LOSS:
463 case OBJECTTYPE_DATA_STOCK_GAIN:
464 case OBJECTTYPE_PAGE:
465 case OBJECTTYPE_DIAGRAM_FLOOR:
466 case OBJECTTYPE_DIAGRAM_WALL:
467 case OBJECTTYPE_DIAGRAM:
468 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
469 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
470 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
471 break;
473 case OBJECTTYPE_LEGEND_ENTRY:
474 case OBJECTTYPE_AXIS_UNITLABEL:
475 case OBJECTTYPE_UNKNOWN:
476 // nothing
477 break;
478 case OBJECTTYPE_DATA_CURVE_EQUATION:
479 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
480 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
481 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
482 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
483 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
484 AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
485 if( SvtLanguageOptions().IsCTLFontEnabled() )
486 /* When rotation is supported for equation text boxes, use
487 SchAlignmentTabPage::Create here. The special
488 SchAlignmentTabPage::CreateWithoutRotation can be deleted. */
489 AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::CreateWithoutRotation, NULL);
490 break;
491 default:
492 break;
495 // used to find out if user left the dialog with OK. When OK is pressed but
496 // no changes were done, Cancel is returned by the SfxTabDialog. See method
497 // DialogWasClosedWithOK.
498 m_aOriginalOKClickHdl = GetOKButton().GetClickHdl();
499 GetOKButton().SetClickHdl( LINK( this, SchAttribTabDlg, OKPressed ));
502 SchAttribTabDlg::~SchAttribTabDlg()
504 delete m_pSymbolShapeProperties;
505 delete m_pAutoSymbolGraphic;
508 void SchAttribTabDlg::PageCreated(USHORT nId, SfxTabPage &rPage)
510 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
511 switch (nId)
513 case TP_LAYOUT:
514 break;
515 case RID_SVXPAGE_LINE:
516 aSet.Put (SvxColorTableItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
517 aSet.Put (SvxDashListItem(m_pViewElementListProvider->GetDashList(),SID_DASH_LIST));
518 aSet.Put (SvxLineEndListItem(m_pViewElementListProvider->GetLineEndList(),SID_LINEEND_LIST));
519 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
520 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
522 if( m_pParameter->HasSymbolProperties() )
524 aSet.Put(OfaPtrItem(SID_OBJECT_LIST,m_pViewElementListProvider->GetSymbolList()));
525 if( m_pSymbolShapeProperties )
526 aSet.Put(SfxTabDialogItem(SID_ATTR_SET,*m_pSymbolShapeProperties));
527 if( m_pAutoSymbolGraphic )
528 aSet.Put(SvxGraphicItem(SID_GRAPHIC,*m_pAutoSymbolGraphic));
530 rPage.PageCreated(aSet);
531 //rPage.ActivatePage(*GetInputSetImpl()); //what for?
532 break;
534 case RID_SVXPAGE_AREA:
535 aSet.Put(SvxColorTableItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
536 aSet.Put(SvxGradientListItem(m_pViewElementListProvider->GetGradientList(),SID_GRADIENT_LIST));
537 aSet.Put(SvxHatchListItem(m_pViewElementListProvider->GetHatchList(),SID_HATCH_LIST));
538 aSet.Put(SvxBitmapListItem(m_pViewElementListProvider->GetBitmapList(),SID_BITMAP_LIST));
539 aSet.Put(SfxUInt16Item(SID_PAGE_TYPE,nPageType));
540 aSet.Put(SfxUInt16Item(SID_DLG_TYPE,nDlgType));
541 rPage.PageCreated(aSet);
542 //rPage.ActivatePage(*GetInputSetImpl()); //what for?
543 break;
545 case RID_SVXPAGE_TRANSPARENCE:
546 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
547 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
548 rPage.PageCreated(aSet);
549 break;
551 case RID_SVXPAGE_CHAR_NAME:
553 //CHINA001 ((SvxCharNamePage&)rPage).
554 //CHINA001 SetFontList(SvxFontListItem(m_pViewElementListProvider->getFontList()));
555 aSet.Put (SvxFontListItem(m_pViewElementListProvider->getFontList(), SID_ATTR_CHAR_FONTLIST)); //CHINA001
556 rPage.PageCreated(aSet); //CHINA001
557 break;
559 case RID_SVXPAGE_CHAR_EFFECTS:
560 //CHINA001 ((SvxCharEffectsPage&) rPage).DisableControls( DISABLE_CASEMAP );
561 aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP)); //CHINA001
562 rPage.PageCreated(aSet);
563 break;
565 case TP_AXIS_LABEL:
567 bool bShowStaggeringControls = m_pParameter->CanAxisLabelsBeStaggered();
568 ((SchAxisLabelTabPage&)rPage).ShowStaggeringControls( bShowStaggeringControls );
569 break;
572 case TP_ALIGNMENT:
573 break;
576 case TP_AXIS_POSITIONS:
578 AxisPositionsTabPage* pPage = dynamic_cast< AxisPositionsTabPage* >( &rPage );
579 if(pPage)
581 pPage->SetNumFormatter( m_pNumberFormatter );
582 if( m_pParameter->IsCrossingAxisIsCategoryAxis() )
584 pPage->SetCrossingAxisIsCategoryAxis( m_pParameter->IsCrossingAxisIsCategoryAxis() );
585 pPage->SetCategories( m_pParameter->GetCategories() );
587 pPage->SupportAxisPositioning( m_pParameter->IsSupportingAxisPositioning() );
590 break;
592 case TP_SCALE:
594 ScaleTabPage* pScaleTabPage = dynamic_cast< ScaleTabPage* >( &rPage );
595 if(pScaleTabPage)
597 pScaleTabPage->SetNumFormatter( m_pNumberFormatter );
598 pScaleTabPage->ShowAxisOrigin( m_pParameter->ShowAxisOrigin() );
601 break;
603 case TP_DATA_DESCR:
605 DataLabelsTabPage* pLabelPage = dynamic_cast< DataLabelsTabPage* >( &rPage );
606 if( pLabelPage )
607 pLabelPage->SetNumberFormatter( m_pNumberFormatter );
609 break;
611 case RID_SVXPAGE_NUMBERFORMAT:
612 aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const USHORT)SID_ATTR_NUMBERFORMAT_INFO));
613 rPage.PageCreated(aSet);
614 break;
616 case TP_YERRORBAR:
618 ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
619 OSL_ASSERT( pTabPage );
620 if( pTabPage )
622 pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
623 pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_Y );
624 pTabPage->SetChartDocumentForRangeChoosing( m_pParameter->getDocument());
626 break;
628 case TP_OPTIONS:
630 SchOptionTabPage* pTabPage = dynamic_cast< SchOptionTabPage* >( &rPage );
631 if( pTabPage && m_pParameter )
632 pTabPage->Init( m_pParameter->ProvidesSecondaryYAxis(), m_pParameter->ProvidesOverlapAndGapWidth(),
633 m_pParameter->ProvidesBarConnectors() );
634 break;
639 IMPL_LINK( SchAttribTabDlg, OKPressed, void * , EMPTYARG )
641 m_bOKPressed = true;
642 return m_aOriginalOKClickHdl.Call( this );
645 bool SchAttribTabDlg::DialogWasClosedWithOK() const
647 return m_bOKPressed;
650 //.............................................................................
651 } //namespace chart
652 //.............................................................................