update dev300-m57
[ooovba.git] / chart2 / source / controller / dialogs / dlg_ObjectProperties.cxx
blob5c521854438b07890243376a0129b0eab4c0742c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dlg_ObjectProperties.cxx,v $
10 * $Revision: 1.23.42.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
33 #ifndef _ZFORLIST_HXX
34 #ifndef _ZFORLIST_DECLARE_TABLE
35 #define _ZFORLIST_DECLARE_TABLE
36 #endif
37 #include <svtools/zforlist.hxx>
38 #endif
40 #include "dlg_ObjectProperties.hxx"
41 #include "ResourceIds.hrc"
42 #include "Strings.hrc"
43 #include "TabPages.hrc"
44 #include "tp_AxisLabel.hxx"
45 #include "tp_DataLabel.hxx"
46 #include "tp_LegendPosition.hxx"
47 #include "tp_PointGeometry.hxx"
48 #include "tp_Scale.hxx"
49 #include "tp_AxisPositions.hxx"
50 #include "tp_ErrorBars.hxx"
51 #include "tp_Trendline.hxx"
52 #include "tp_SeriesToAxis.hxx"
53 #include "tp_TitleRotation.hxx"
54 #include "tp_PolarOptions.hxx"
55 #include "ResId.hxx"
56 #include "ViewElementListProvider.hxx"
57 #include "macros.hxx"
58 #include "ChartModelHelper.hxx"
59 #include "ChartTypeHelper.hxx"
60 #include "ObjectNameProvider.hxx"
61 #include "DiagramHelper.hxx"
62 #include "chartview/NumberFormatterWrapper.hxx"
63 #include "AxisIndexDefines.hxx"
64 #include "AxisHelper.hxx"
66 #include <com/sun/star/chart2/XAxis.hpp>
67 #include <com/sun/star/chart2/XChartType.hpp>
68 #include <com/sun/star/chart2/XDataSeries.hpp>
69 #include <svtools/intitem.hxx>
70 #include <svtools/languageoptions.hxx>
72 #include <svx/svxids.hrc>
74 #include <svx/drawitem.hxx>
75 #include <svx/ofaitem.hxx>
76 #include <svx/svxgrahicitem.hxx>
78 #include <svx/dialogs.hrc>
79 #include <svx/flstitem.hxx>
80 #include <svx/tabline.hxx>
82 #include <svx/flagsdef.hxx>
83 #include <svx/numinf.hxx>
85 #include <svtools/cjkoptions.hxx>
87 //.............................................................................
88 namespace chart
90 //.............................................................................
92 using namespace ::com::sun::star;
93 using namespace ::com::sun::star::chart2;
94 using ::com::sun::star::uno::Reference;
96 //-----------------------------------------------------------------------------
97 //-----------------------------------------------------------------------------
98 //-----------------------------------------------------------------------------
100 ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const rtl::OUString& rObjectCID )
101 : m_aObjectCID( rObjectCID )
102 , m_eObjectType( ObjectIdentifier::getObjectType( m_aObjectCID ) )
103 , m_bAffectsMultipleObjects(false)
104 , m_aLocalizedName()
105 , m_bHasGeometryProperties(false)
106 , m_bHasStatisticProperties(false)
107 , m_bProvidesSecondaryYAxis(false)
108 , m_bProvidesOverlapAndGapWidth(false)
109 , m_bProvidesBarConnectors(false)
110 , m_bHasAreaProperties(false)
111 , m_bHasSymbolProperties(false)
112 , m_bHasNumberProperties(false)
113 , m_bProvidesStartingAngle(false)
114 , m_bProvidesMissingValueTreatments(false)
115 , m_bHasScaleProperties(false)
116 , m_bCanAxisLabelsBeStaggered(false)
117 , m_bSupportingAxisPositioning(false)
118 , m_bShowAxisOrigin(false)
119 , m_bIsCrossingAxisIsCategoryAxis(false)
120 , m_aCategories()
121 , m_xChartDocument( 0 )
123 rtl::OUString aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID );
124 m_bAffectsMultipleObjects = aParticleID.equals(C2U("ALLELEMENTS"));
126 ObjectPropertiesDialogParameter::~ObjectPropertiesDialogParameter()
129 ObjectType ObjectPropertiesDialogParameter::getObjectType() const
131 return m_eObjectType;
133 rtl::OUString ObjectPropertiesDialogParameter::getLocalizedName() const
135 return m_aLocalizedName;
138 void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel >& xChartModel )
140 m_xChartDocument.set( xChartModel, uno::UNO_QUERY );
141 uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
142 uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel );
143 uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries );
144 sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
146 bool bHasSeriesProperties = (OBJECTTYPE_DATA_SERIES==m_eObjectType || OBJECTTYPE_DATA_LABELS==m_eObjectType);
147 bool bHasDataPointproperties = (OBJECTTYPE_DATA_POINT==m_eObjectType);
149 if( bHasSeriesProperties || bHasDataPointproperties )
151 m_bHasGeometryProperties = ChartTypeHelper::isSupportingGeometryProperties( xChartType, nDimensionCount );
152 m_bHasAreaProperties = ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount );
153 m_bHasSymbolProperties = ChartTypeHelper::isSupportingSymbolProperties( xChartType, nDimensionCount );
155 if( bHasSeriesProperties )
157 m_bHasStatisticProperties = ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount );
158 m_bProvidesSecondaryYAxis = ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount, 1 );
159 m_bProvidesOverlapAndGapWidth = ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount );
160 m_bProvidesBarConnectors = ChartTypeHelper::isSupportingBarConnectors( xChartType, nDimensionCount );
161 m_bProvidesStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType );
163 m_bProvidesMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType )
164 .getLength() ? true : false;
168 if( OBJECTTYPE_DATA_ERRORS == m_eObjectType )
169 m_bHasStatisticProperties = true;
171 if( OBJECTTYPE_AXIS == m_eObjectType )
173 //show scale properties only for a single axis not for multiselection
174 m_bHasScaleProperties = !m_bAffectsMultipleObjects;
176 if( m_bHasScaleProperties )
178 uno::Reference< XAxis > xAxis( ObjectIdentifier::getAxisForCID( m_aObjectCID, xChartModel ) );
179 if( xAxis.is() )
181 //no scale page for series axis
182 ScaleData aData( xAxis->getScaleData() );
183 if( chart2::AxisType::SERIES == aData.AxisType )
184 m_bHasScaleProperties = false;
185 if( chart2::AxisType::REALNUMBER == aData.AxisType || chart2::AxisType::PERCENT == aData.AxisType )
186 m_bHasNumberProperties = true;
188 sal_Int32 nCooSysIndex=0;
189 sal_Int32 nDimensionIndex=0;
190 sal_Int32 nAxisIndex=0;
191 if( AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ) )
193 xChartType = AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( xDiagram, nAxisIndex );
194 //show positioning controls only if they make sense
195 m_bSupportingAxisPositioning = ChartTypeHelper::isSupportingAxisPositioning( xChartType, nDimensionCount, nDimensionIndex );
197 //show axis origin only for secondary y axis
198 if( 1==nDimensionIndex && 1==nAxisIndex && ChartTypeHelper::isSupportingBaseValue( xChartType ) )
199 m_bShowAxisOrigin = true;
202 //is the crossin main axis a category axes?:
203 uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) );
204 uno::Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) );
205 if( xCrossingMainAxis.is() )
207 ScaleData aScale( xCrossingMainAxis->getScaleData() );
208 m_bIsCrossingAxisIsCategoryAxis = ( chart2::AxisType::CATEGORY == aScale.AxisType );
209 if( m_bIsCrossingAxisIsCategoryAxis )
210 m_aCategories = DiagramHelper::generateAutomaticCategories( Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY) );
215 //no staggering of labels for 3D axis
216 m_bCanAxisLabelsBeStaggered = nDimensionCount==2;
219 //create gui name for this object
221 if( !m_bAffectsMultipleObjects && OBJECTTYPE_AXIS == m_eObjectType )
223 m_aLocalizedName = ObjectNameProvider::getAxisName( m_aObjectCID, xChartModel );
225 else
227 ObjectType eType = m_eObjectType;
228 if( OBJECTTYPE_DATA_LABEL == eType )
229 eType = OBJECTTYPE_DATA_POINT;
230 else if( OBJECTTYPE_DATA_LABELS == eType )
231 eType = OBJECTTYPE_DATA_SERIES;
232 m_aLocalizedName = ObjectNameProvider::getName(eType,m_bAffectsMultipleObjects);
237 bool ObjectPropertiesDialogParameter::HasGeometryProperties() const
239 return m_bHasGeometryProperties;
241 bool ObjectPropertiesDialogParameter::HasStatisticProperties() const
243 return m_bHasStatisticProperties;
245 bool ObjectPropertiesDialogParameter::ProvidesSecondaryYAxis() const
247 return m_bProvidesSecondaryYAxis;
249 bool ObjectPropertiesDialogParameter::ProvidesOverlapAndGapWidth() const
251 return m_bProvidesOverlapAndGapWidth;
253 bool ObjectPropertiesDialogParameter::ProvidesBarConnectors() const
255 return m_bProvidesBarConnectors;
257 bool ObjectPropertiesDialogParameter::HasAreaProperties() const
259 return m_bHasAreaProperties;
261 bool ObjectPropertiesDialogParameter::HasSymbolProperties() const
263 return m_bHasSymbolProperties;
265 bool ObjectPropertiesDialogParameter::HasScaleProperties() const
267 return m_bHasScaleProperties;
269 bool ObjectPropertiesDialogParameter::CanAxisLabelsBeStaggered() const
271 return m_bCanAxisLabelsBeStaggered;
273 bool ObjectPropertiesDialogParameter::ShowAxisOrigin() const
275 return m_bShowAxisOrigin;
277 bool ObjectPropertiesDialogParameter::IsSupportingAxisPositioning() const
279 return m_bSupportingAxisPositioning;
281 bool ObjectPropertiesDialogParameter::IsCrossingAxisIsCategoryAxis() const
283 return m_bIsCrossingAxisIsCategoryAxis;
285 const uno::Sequence< rtl::OUString >& ObjectPropertiesDialogParameter::GetCategories() const
287 return m_aCategories;
289 bool ObjectPropertiesDialogParameter::HasNumberProperties() const
291 return m_bHasNumberProperties;
293 bool ObjectPropertiesDialogParameter::ProvidesStartingAngle() const
295 return m_bProvidesStartingAngle;
297 bool ObjectPropertiesDialogParameter::ProvidesMissingValueTreatments() const
299 return m_bProvidesMissingValueTreatments;
301 uno::Reference< chart2::XChartDocument > ObjectPropertiesDialogParameter::getDocument() const
303 return m_xChartDocument;
306 //const USHORT nNoArrowDlg = 1100;
307 const USHORT nNoArrowNoShadowDlg = 1101;
309 //-------------------------------------------------------------------
310 //-------------------------------------------------------------------
311 //-------------------------------------------------------------------
313 void SchAttribTabDlg::setSymbolInformation( SfxItemSet* pSymbolShapeProperties,
314 Graphic* pAutoSymbolGraphic )
316 m_pSymbolShapeProperties = pSymbolShapeProperties;
317 m_pAutoSymbolGraphic = pAutoSymbolGraphic;
320 void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
322 m_fAxisMinorStepWidthForErrorBarDecimals = fMinorStepWidth;
325 SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
326 const SfxItemSet* pAttr,
327 const ObjectPropertiesDialogParameter* pDialogParameter,
328 const ViewElementListProvider* pViewElementListProvider,
329 const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
331 : SfxTabDialog(pParent, SchResId(DLG_OBJECT_PROPERTIES), pAttr)
332 , eObjectType(pDialogParameter->getObjectType())
333 , nDlgType(nNoArrowNoShadowDlg)
334 , nPageType(0)
335 , m_pParameter( pDialogParameter )
336 , m_pViewElementListProvider( pViewElementListProvider )
337 , m_pNumberFormatter(0)
338 , m_pSymbolShapeProperties(NULL)
339 , m_pAutoSymbolGraphic(NULL)
340 , m_fAxisMinorStepWidthForErrorBarDecimals(0.1)
341 , m_bOKPressed(false)
343 FreeResource();
345 NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
346 m_pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
348 this->SetText( pDialogParameter->getLocalizedName() );
350 SvtCJKOptions aCJKOptions;
352 switch (eObjectType)
354 case OBJECTTYPE_TITLE:
355 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
356 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
357 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
358 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS)));
359 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
360 AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::Create, NULL);
361 if( aCJKOptions.IsAsianTypographyEnabled() )
362 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
363 break;
365 case OBJECTTYPE_LEGEND:
366 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
367 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
368 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
369 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS)));
370 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
371 AddTabPage(TP_LEGEND_POS, String(SchResId(STR_PAGE_POSITION)), SchLegendPosTabPage::Create, NULL);
372 if( aCJKOptions.IsAsianTypographyEnabled() )
373 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
374 break;
376 case OBJECTTYPE_DATA_SERIES:
377 case OBJECTTYPE_DATA_POINT:
378 case OBJECTTYPE_DATA_LABEL:
379 case OBJECTTYPE_DATA_LABELS:
380 AddTabPage(RID_SVXPAGE_LINE, String(SchResId( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE )));
381 if(m_pParameter->HasAreaProperties())
383 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
384 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
386 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS)));
387 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
388 if( aCJKOptions.IsAsianTypographyEnabled() )
389 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
390 AddTabPage(TP_DATA_DESCR, String(SchResId(STR_OBJECT_DATALABELS)), DataLabelsTabPage::Create, NULL);
391 // if( m_pParameter->HasStatisticProperties() )
392 // AddTabPage(TP_YERRORBAR, String(SchResId(STR_PAGE_YERROR_BARS)), ErrorBarsTabPage::Create, NULL);
393 if( m_pParameter->HasGeometryProperties() )
394 AddTabPage(TP_LAYOUT, String(SchResId(STR_PAGE_LAYOUT)),SchLayoutTabPage::Create, NULL);
395 if( m_pParameter->ProvidesSecondaryYAxis() || m_pParameter->ProvidesOverlapAndGapWidth() || m_pParameter->ProvidesMissingValueTreatments() )
396 AddTabPage(TP_OPTIONS, String(SchResId(STR_PAGE_OPTIONS)),SchOptionTabPage::Create, NULL);
397 if( m_pParameter->ProvidesStartingAngle())
398 AddTabPage(TP_POLAROPTIONS, String(SchResId(STR_PAGE_OPTIONS)),PolarOptionsTabPage::Create, NULL);
399 break;
401 case OBJECTTYPE_AXIS:
403 if( m_pParameter->HasScaleProperties() )
404 AddTabPage(TP_SCALE, String(SchResId(STR_PAGE_SCALE)), ScaleTabPage::Create, NULL);
406 if( m_pParameter->HasScaleProperties() )//no positioning page for z axes so far as the tickmarks are not shown so far
407 AddTabPage(TP_AXIS_POSITIONS, String(SchResId(STR_PAGE_POSITIONING)), AxisPositionsTabPage::Create, NULL);
408 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
409 AddTabPage(TP_AXIS_LABEL, String(SchResId(STR_OBJECT_LABEL)), SchAxisLabelTabPage::Create, NULL);
410 if( m_pParameter->HasNumberProperties() )
411 AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
412 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS)));
413 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
414 if( aCJKOptions.IsAsianTypographyEnabled() )
415 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
416 break;
419 case OBJECTTYPE_DATA_ERRORS:
420 case OBJECTTYPE_DATA_ERRORS_X:
421 case OBJECTTYPE_DATA_ERRORS_Y:
422 case OBJECTTYPE_DATA_ERRORS_Z:
423 AddTabPage(TP_YERRORBAR, String(SchResId(STR_PAGE_YERROR_BARS)), ErrorBarsTabPage::Create, NULL);
424 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
425 break;
427 case OBJECTTYPE_GRID:
428 case OBJECTTYPE_SUBGRID:
429 case OBJECTTYPE_DATA_AVERAGE_LINE:
430 case OBJECTTYPE_DATA_STOCK_RANGE:
431 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
432 break;
434 case OBJECTTYPE_DATA_CURVE:
435 AddTabPage(TP_TRENDLINE, String(SchResId(STR_PAGE_TRENDLINE_TYPE)), TrendlineTabPage::Create, NULL);
436 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
437 break;
439 case OBJECTTYPE_DATA_STOCK_LOSS:
440 case OBJECTTYPE_DATA_STOCK_GAIN:
441 case OBJECTTYPE_PAGE:
442 case OBJECTTYPE_DIAGRAM_FLOOR:
443 case OBJECTTYPE_DIAGRAM_WALL:
444 case OBJECTTYPE_DIAGRAM:
445 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
446 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
447 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
448 break;
450 case OBJECTTYPE_LEGEND_ENTRY:
451 case OBJECTTYPE_AXIS_UNITLABEL:
452 case OBJECTTYPE_UNKNOWN:
453 // nothing
454 break;
455 case OBJECTTYPE_DATA_CURVE_EQUATION:
456 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
457 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
458 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
459 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_CHARACTERS)));
460 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
461 AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
462 if( SvtLanguageOptions().IsCTLFontEnabled() )
463 /* When rotation is supported for equation text boxes, use
464 SchAlignmentTabPage::Create here. The special
465 SchAlignmentTabPage::CreateWithoutRotation can be deleted. */
466 AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::CreateWithoutRotation, NULL);
467 break;
470 // used to find out if user left the dialog with OK. When OK is pressed but
471 // no changes were done, Cancel is returned by the SfxTabDialog. See method
472 // DialogWasClosedWithOK.
473 m_aOriginalOKClickHdl = GetOKButton().GetClickHdl();
474 GetOKButton().SetClickHdl( LINK( this, SchAttribTabDlg, OKPressed ));
477 SchAttribTabDlg::~SchAttribTabDlg()
479 delete m_pSymbolShapeProperties;
480 delete m_pAutoSymbolGraphic;
483 void SchAttribTabDlg::PageCreated(USHORT nId, SfxTabPage &rPage)
485 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
486 switch (nId)
488 case TP_LAYOUT:
489 break;
490 case RID_SVXPAGE_LINE:
491 aSet.Put (SvxColorTableItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
492 aSet.Put (SvxDashListItem(m_pViewElementListProvider->GetDashList(),SID_DASH_LIST));
493 aSet.Put (SvxLineEndListItem(m_pViewElementListProvider->GetLineEndList(),SID_LINEEND_LIST));
494 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
495 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
497 if( m_pParameter->HasSymbolProperties() )
499 aSet.Put(OfaPtrItem(SID_OBJECT_LIST,m_pViewElementListProvider->GetSymbolList()));
500 if( m_pSymbolShapeProperties )
501 aSet.Put(SfxTabDialogItem(SID_ATTR_SET,*m_pSymbolShapeProperties));
502 if( m_pAutoSymbolGraphic )
503 aSet.Put(SvxGraphicItem(SID_GRAPHIC,*m_pAutoSymbolGraphic));
505 rPage.PageCreated(aSet);
506 //rPage.ActivatePage(*GetInputSetImpl()); //what for?
507 break;
509 case RID_SVXPAGE_AREA:
510 aSet.Put(SvxColorTableItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
511 aSet.Put(SvxGradientListItem(m_pViewElementListProvider->GetGradientList(),SID_GRADIENT_LIST));
512 aSet.Put(SvxHatchListItem(m_pViewElementListProvider->GetHatchList(),SID_HATCH_LIST));
513 aSet.Put(SvxBitmapListItem(m_pViewElementListProvider->GetBitmapList(),SID_BITMAP_LIST));
514 aSet.Put(SfxUInt16Item(SID_PAGE_TYPE,nPageType));
515 aSet.Put(SfxUInt16Item(SID_DLG_TYPE,nDlgType));
516 rPage.PageCreated(aSet);
517 //rPage.ActivatePage(*GetInputSetImpl()); //what for?
518 break;
520 case RID_SVXPAGE_TRANSPARENCE:
521 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
522 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
523 rPage.PageCreated(aSet);
524 break;
526 case RID_SVXPAGE_CHAR_NAME:
528 //CHINA001 ((SvxCharNamePage&)rPage).
529 //CHINA001 SetFontList(SvxFontListItem(m_pViewElementListProvider->getFontList()));
530 aSet.Put (SvxFontListItem(m_pViewElementListProvider->getFontList(), SID_ATTR_CHAR_FONTLIST)); //CHINA001
531 rPage.PageCreated(aSet); //CHINA001
532 break;
534 case RID_SVXPAGE_CHAR_EFFECTS:
535 //CHINA001 ((SvxCharEffectsPage&) rPage).DisableControls( DISABLE_CASEMAP );
536 aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP)); //CHINA001
537 rPage.PageCreated(aSet);
538 break;
540 case TP_AXIS_LABEL:
542 bool bShowStaggeringControls = m_pParameter->CanAxisLabelsBeStaggered();
543 ((SchAxisLabelTabPage&)rPage).ShowStaggeringControls( bShowStaggeringControls );
544 break;
547 case TP_ALIGNMENT:
548 break;
551 case TP_AXIS_POSITIONS:
553 AxisPositionsTabPage* pPage = dynamic_cast< AxisPositionsTabPage* >( &rPage );
554 if(pPage)
556 pPage->SetNumFormatter( m_pNumberFormatter );
557 if( m_pParameter->IsCrossingAxisIsCategoryAxis() )
559 pPage->SetCrossingAxisIsCategoryAxis( m_pParameter->IsCrossingAxisIsCategoryAxis() );
560 pPage->SetCategories( m_pParameter->GetCategories() );
562 pPage->SupportAxisPositioning( m_pParameter->IsSupportingAxisPositioning() );
565 break;
567 case TP_SCALE:
569 ScaleTabPage* pScaleTabPage = dynamic_cast< ScaleTabPage* >( &rPage );
570 if(pScaleTabPage)
572 pScaleTabPage->SetNumFormatter( m_pNumberFormatter );
573 pScaleTabPage->ShowAxisOrigin( m_pParameter->ShowAxisOrigin() );
576 break;
578 case TP_DATA_DESCR:
580 DataLabelsTabPage* pLabelPage = dynamic_cast< DataLabelsTabPage* >( &rPage );
581 if( pLabelPage )
582 pLabelPage->SetNumberFormatter( m_pNumberFormatter );
584 break;
586 case RID_SVXPAGE_NUMBERFORMAT:
587 aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const USHORT)SID_ATTR_NUMBERFORMAT_INFO));
588 rPage.PageCreated(aSet);
589 break;
591 case TP_YERRORBAR:
593 ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
594 OSL_ASSERT( pTabPage );
595 if( pTabPage )
597 pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
598 pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_Y );
599 pTabPage->SetChartDocumentForRangeChoosing( m_pParameter->getDocument());
601 break;
603 case TP_OPTIONS:
605 SchOptionTabPage* pTabPage = dynamic_cast< SchOptionTabPage* >( &rPage );
606 if( pTabPage && m_pParameter )
607 pTabPage->Init( m_pParameter->ProvidesSecondaryYAxis(), m_pParameter->ProvidesOverlapAndGapWidth(),
608 m_pParameter->ProvidesBarConnectors() );
609 break;
614 IMPL_LINK( SchAttribTabDlg, OKPressed, void * , EMPTYARG )
616 m_bOKPressed = true;
617 return m_aOriginalOKClickHdl.Call( this );
620 bool SchAttribTabDlg::DialogWasClosedWithOK() const
622 return m_bOKPressed;
625 //.............................................................................
626 } //namespace chart
627 //.............................................................................