merge the formfield patch from ooo-build
[ooovba.git] / chart2 / source / controller / dialogs / dlg_ObjectProperties.cxx
blob063d0406127d19bf5676a91d0594206a697f7725
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);
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 if( !m_bAffectsMultipleObjects && ( OBJECTTYPE_GRID == m_eObjectType || OBJECTTYPE_SUBGRID == m_eObjectType ) )
227 m_aLocalizedName = ObjectNameProvider::getGridName( m_aObjectCID, xChartModel );
229 else if( !m_bAffectsMultipleObjects && OBJECTTYPE_TITLE == m_eObjectType )
231 m_aLocalizedName = ObjectNameProvider::getTitleName( m_aObjectCID, xChartModel );
233 else
235 switch( m_eObjectType )
237 case OBJECTTYPE_DATA_POINT:
238 case OBJECTTYPE_DATA_LABEL:
239 case OBJECTTYPE_DATA_LABELS:
240 case OBJECTTYPE_DATA_ERRORS:
241 case OBJECTTYPE_DATA_ERRORS_X:
242 case OBJECTTYPE_DATA_ERRORS_Y:
243 case OBJECTTYPE_DATA_ERRORS_Z:
244 case OBJECTTYPE_DATA_AVERAGE_LINE:
245 case OBJECTTYPE_DATA_CURVE:
246 case OBJECTTYPE_DATA_CURVE_EQUATION:
247 if( m_bAffectsMultipleObjects )
248 m_aLocalizedName = ObjectNameProvider::getName_ObjectForAllSeries( m_eObjectType );
249 else
250 m_aLocalizedName = ObjectNameProvider::getName_ObjectForSeries( m_eObjectType, m_aObjectCID, m_xChartDocument );
251 break;
252 default:
253 m_aLocalizedName = ObjectNameProvider::getName(m_eObjectType,m_bAffectsMultipleObjects);
254 break;
260 bool ObjectPropertiesDialogParameter::HasGeometryProperties() const
262 return m_bHasGeometryProperties;
264 bool ObjectPropertiesDialogParameter::HasStatisticProperties() const
266 return m_bHasStatisticProperties;
268 bool ObjectPropertiesDialogParameter::ProvidesSecondaryYAxis() const
270 return m_bProvidesSecondaryYAxis;
272 bool ObjectPropertiesDialogParameter::ProvidesOverlapAndGapWidth() const
274 return m_bProvidesOverlapAndGapWidth;
276 bool ObjectPropertiesDialogParameter::ProvidesBarConnectors() const
278 return m_bProvidesBarConnectors;
280 bool ObjectPropertiesDialogParameter::HasAreaProperties() const
282 return m_bHasAreaProperties;
284 bool ObjectPropertiesDialogParameter::HasSymbolProperties() const
286 return m_bHasSymbolProperties;
288 bool ObjectPropertiesDialogParameter::HasScaleProperties() const
290 return m_bHasScaleProperties;
292 bool ObjectPropertiesDialogParameter::CanAxisLabelsBeStaggered() const
294 return m_bCanAxisLabelsBeStaggered;
296 bool ObjectPropertiesDialogParameter::ShowAxisOrigin() const
298 return m_bShowAxisOrigin;
300 bool ObjectPropertiesDialogParameter::IsSupportingAxisPositioning() const
302 return m_bSupportingAxisPositioning;
304 bool ObjectPropertiesDialogParameter::IsCrossingAxisIsCategoryAxis() const
306 return m_bIsCrossingAxisIsCategoryAxis;
308 const uno::Sequence< rtl::OUString >& ObjectPropertiesDialogParameter::GetCategories() const
310 return m_aCategories;
312 bool ObjectPropertiesDialogParameter::HasNumberProperties() const
314 return m_bHasNumberProperties;
316 bool ObjectPropertiesDialogParameter::ProvidesStartingAngle() const
318 return m_bProvidesStartingAngle;
320 bool ObjectPropertiesDialogParameter::ProvidesMissingValueTreatments() const
322 return m_bProvidesMissingValueTreatments;
324 uno::Reference< chart2::XChartDocument > ObjectPropertiesDialogParameter::getDocument() const
326 return m_xChartDocument;
329 //const USHORT nNoArrowDlg = 1100;
330 const USHORT nNoArrowNoShadowDlg = 1101;
332 //-------------------------------------------------------------------
333 //-------------------------------------------------------------------
334 //-------------------------------------------------------------------
336 void SchAttribTabDlg::setSymbolInformation( SfxItemSet* pSymbolShapeProperties,
337 Graphic* pAutoSymbolGraphic )
339 m_pSymbolShapeProperties = pSymbolShapeProperties;
340 m_pAutoSymbolGraphic = pAutoSymbolGraphic;
343 void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
345 m_fAxisMinorStepWidthForErrorBarDecimals = fMinorStepWidth;
348 SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
349 const SfxItemSet* pAttr,
350 const ObjectPropertiesDialogParameter* pDialogParameter,
351 const ViewElementListProvider* pViewElementListProvider,
352 const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
354 : SfxTabDialog(pParent, SchResId(DLG_OBJECT_PROPERTIES), pAttr)
355 , eObjectType(pDialogParameter->getObjectType())
356 , nDlgType(nNoArrowNoShadowDlg)
357 , nPageType(0)
358 , m_pParameter( pDialogParameter )
359 , m_pViewElementListProvider( pViewElementListProvider )
360 , m_pNumberFormatter(0)
361 , m_pSymbolShapeProperties(NULL)
362 , m_pAutoSymbolGraphic(NULL)
363 , m_fAxisMinorStepWidthForErrorBarDecimals(0.1)
364 , m_bOKPressed(false)
366 FreeResource();
368 NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
369 m_pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
371 this->SetText( pDialogParameter->getLocalizedName() );
373 SvtCJKOptions aCJKOptions;
375 switch (eObjectType)
377 case OBJECTTYPE_TITLE:
378 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
379 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
380 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
381 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
382 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
383 AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::Create, NULL);
384 if( aCJKOptions.IsAsianTypographyEnabled() )
385 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
386 break;
388 case OBJECTTYPE_LEGEND:
389 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
390 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
391 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
392 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
393 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
394 AddTabPage(TP_LEGEND_POS, String(SchResId(STR_PAGE_POSITION)), SchLegendPosTabPage::Create, NULL);
395 if( aCJKOptions.IsAsianTypographyEnabled() )
396 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
397 break;
399 case OBJECTTYPE_DATA_SERIES:
400 case OBJECTTYPE_DATA_POINT:
401 if( m_pParameter->ProvidesSecondaryYAxis() || m_pParameter->ProvidesOverlapAndGapWidth() || m_pParameter->ProvidesMissingValueTreatments() )
402 AddTabPage(TP_OPTIONS, String(SchResId(STR_PAGE_OPTIONS)),SchOptionTabPage::Create, NULL);
403 if( m_pParameter->ProvidesStartingAngle())
404 AddTabPage(TP_POLAROPTIONS, String(SchResId(STR_PAGE_OPTIONS)),PolarOptionsTabPage::Create, NULL);
406 if( m_pParameter->HasGeometryProperties() )
407 AddTabPage(TP_LAYOUT, String(SchResId(STR_PAGE_LAYOUT)),SchLayoutTabPage::Create, NULL);
409 if(m_pParameter->HasAreaProperties())
411 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
412 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
414 AddTabPage(RID_SVXPAGE_LINE, String(SchResId( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE )));
415 break;
417 case OBJECTTYPE_DATA_LABEL:
418 case OBJECTTYPE_DATA_LABELS:
419 AddTabPage(TP_DATA_DESCR, String(SchResId(STR_OBJECT_DATALABELS)), DataLabelsTabPage::Create, NULL);
420 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
421 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
422 if( aCJKOptions.IsAsianTypographyEnabled() )
423 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
425 break;
427 case OBJECTTYPE_AXIS:
429 if( m_pParameter->HasScaleProperties() )
430 AddTabPage(TP_SCALE, String(SchResId(STR_PAGE_SCALE)), ScaleTabPage::Create, NULL);
432 if( m_pParameter->HasScaleProperties() )//no positioning page for z axes so far as the tickmarks are not shown so far
433 AddTabPage(TP_AXIS_POSITIONS, String(SchResId(STR_PAGE_POSITIONING)), AxisPositionsTabPage::Create, NULL);
434 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
435 AddTabPage(TP_AXIS_LABEL, String(SchResId(STR_OBJECT_LABEL)), SchAxisLabelTabPage::Create, NULL);
436 if( m_pParameter->HasNumberProperties() )
437 AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
438 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
439 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
440 if( aCJKOptions.IsAsianTypographyEnabled() )
441 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
442 break;
445 case OBJECTTYPE_DATA_ERRORS:
446 case OBJECTTYPE_DATA_ERRORS_X:
447 case OBJECTTYPE_DATA_ERRORS_Y:
448 case OBJECTTYPE_DATA_ERRORS_Z:
449 AddTabPage(TP_YERRORBAR, String(SchResId(STR_PAGE_YERROR_BARS)), ErrorBarsTabPage::Create, NULL);
450 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
451 break;
453 case OBJECTTYPE_GRID:
454 case OBJECTTYPE_SUBGRID:
455 case OBJECTTYPE_DATA_AVERAGE_LINE:
456 case OBJECTTYPE_DATA_STOCK_RANGE:
457 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
458 break;
460 case OBJECTTYPE_DATA_CURVE:
461 AddTabPage(TP_TRENDLINE, String(SchResId(STR_PAGE_TRENDLINE_TYPE)), TrendlineTabPage::Create, NULL);
462 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
463 break;
465 case OBJECTTYPE_DATA_STOCK_LOSS:
466 case OBJECTTYPE_DATA_STOCK_GAIN:
467 case OBJECTTYPE_PAGE:
468 case OBJECTTYPE_DIAGRAM_FLOOR:
469 case OBJECTTYPE_DIAGRAM_WALL:
470 case OBJECTTYPE_DIAGRAM:
471 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
472 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
473 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
474 break;
476 case OBJECTTYPE_LEGEND_ENTRY:
477 case OBJECTTYPE_AXIS_UNITLABEL:
478 case OBJECTTYPE_UNKNOWN:
479 // nothing
480 break;
481 case OBJECTTYPE_DATA_CURVE_EQUATION:
482 AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
483 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
484 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
485 AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
486 AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
487 AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
488 if( SvtLanguageOptions().IsCTLFontEnabled() )
489 /* When rotation is supported for equation text boxes, use
490 SchAlignmentTabPage::Create here. The special
491 SchAlignmentTabPage::CreateWithoutRotation can be deleted. */
492 AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::CreateWithoutRotation, NULL);
493 break;
496 // used to find out if user left the dialog with OK. When OK is pressed but
497 // no changes were done, Cancel is returned by the SfxTabDialog. See method
498 // DialogWasClosedWithOK.
499 m_aOriginalOKClickHdl = GetOKButton().GetClickHdl();
500 GetOKButton().SetClickHdl( LINK( this, SchAttribTabDlg, OKPressed ));
503 SchAttribTabDlg::~SchAttribTabDlg()
505 delete m_pSymbolShapeProperties;
506 delete m_pAutoSymbolGraphic;
509 void SchAttribTabDlg::PageCreated(USHORT nId, SfxTabPage &rPage)
511 SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
512 switch (nId)
514 case TP_LAYOUT:
515 break;
516 case RID_SVXPAGE_LINE:
517 aSet.Put (SvxColorTableItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
518 aSet.Put (SvxDashListItem(m_pViewElementListProvider->GetDashList(),SID_DASH_LIST));
519 aSet.Put (SvxLineEndListItem(m_pViewElementListProvider->GetLineEndList(),SID_LINEEND_LIST));
520 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
521 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
523 if( m_pParameter->HasSymbolProperties() )
525 aSet.Put(OfaPtrItem(SID_OBJECT_LIST,m_pViewElementListProvider->GetSymbolList()));
526 if( m_pSymbolShapeProperties )
527 aSet.Put(SfxTabDialogItem(SID_ATTR_SET,*m_pSymbolShapeProperties));
528 if( m_pAutoSymbolGraphic )
529 aSet.Put(SvxGraphicItem(SID_GRAPHIC,*m_pAutoSymbolGraphic));
531 rPage.PageCreated(aSet);
532 //rPage.ActivatePage(*GetInputSetImpl()); //what for?
533 break;
535 case RID_SVXPAGE_AREA:
536 aSet.Put(SvxColorTableItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
537 aSet.Put(SvxGradientListItem(m_pViewElementListProvider->GetGradientList(),SID_GRADIENT_LIST));
538 aSet.Put(SvxHatchListItem(m_pViewElementListProvider->GetHatchList(),SID_HATCH_LIST));
539 aSet.Put(SvxBitmapListItem(m_pViewElementListProvider->GetBitmapList(),SID_BITMAP_LIST));
540 aSet.Put(SfxUInt16Item(SID_PAGE_TYPE,nPageType));
541 aSet.Put(SfxUInt16Item(SID_DLG_TYPE,nDlgType));
542 rPage.PageCreated(aSet);
543 //rPage.ActivatePage(*GetInputSetImpl()); //what for?
544 break;
546 case RID_SVXPAGE_TRANSPARENCE:
547 aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
548 aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
549 rPage.PageCreated(aSet);
550 break;
552 case RID_SVXPAGE_CHAR_NAME:
554 //CHINA001 ((SvxCharNamePage&)rPage).
555 //CHINA001 SetFontList(SvxFontListItem(m_pViewElementListProvider->getFontList()));
556 aSet.Put (SvxFontListItem(m_pViewElementListProvider->getFontList(), SID_ATTR_CHAR_FONTLIST)); //CHINA001
557 rPage.PageCreated(aSet); //CHINA001
558 break;
560 case RID_SVXPAGE_CHAR_EFFECTS:
561 //CHINA001 ((SvxCharEffectsPage&) rPage).DisableControls( DISABLE_CASEMAP );
562 aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP)); //CHINA001
563 rPage.PageCreated(aSet);
564 break;
566 case TP_AXIS_LABEL:
568 bool bShowStaggeringControls = m_pParameter->CanAxisLabelsBeStaggered();
569 ((SchAxisLabelTabPage&)rPage).ShowStaggeringControls( bShowStaggeringControls );
570 break;
573 case TP_ALIGNMENT:
574 break;
577 case TP_AXIS_POSITIONS:
579 AxisPositionsTabPage* pPage = dynamic_cast< AxisPositionsTabPage* >( &rPage );
580 if(pPage)
582 pPage->SetNumFormatter( m_pNumberFormatter );
583 if( m_pParameter->IsCrossingAxisIsCategoryAxis() )
585 pPage->SetCrossingAxisIsCategoryAxis( m_pParameter->IsCrossingAxisIsCategoryAxis() );
586 pPage->SetCategories( m_pParameter->GetCategories() );
588 pPage->SupportAxisPositioning( m_pParameter->IsSupportingAxisPositioning() );
591 break;
593 case TP_SCALE:
595 ScaleTabPage* pScaleTabPage = dynamic_cast< ScaleTabPage* >( &rPage );
596 if(pScaleTabPage)
598 pScaleTabPage->SetNumFormatter( m_pNumberFormatter );
599 pScaleTabPage->ShowAxisOrigin( m_pParameter->ShowAxisOrigin() );
602 break;
604 case TP_DATA_DESCR:
606 DataLabelsTabPage* pLabelPage = dynamic_cast< DataLabelsTabPage* >( &rPage );
607 if( pLabelPage )
608 pLabelPage->SetNumberFormatter( m_pNumberFormatter );
610 break;
612 case RID_SVXPAGE_NUMBERFORMAT:
613 aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const USHORT)SID_ATTR_NUMBERFORMAT_INFO));
614 rPage.PageCreated(aSet);
615 break;
617 case TP_YERRORBAR:
619 ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
620 OSL_ASSERT( pTabPage );
621 if( pTabPage )
623 pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
624 pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_Y );
625 pTabPage->SetChartDocumentForRangeChoosing( m_pParameter->getDocument());
627 break;
629 case TP_OPTIONS:
631 SchOptionTabPage* pTabPage = dynamic_cast< SchOptionTabPage* >( &rPage );
632 if( pTabPage && m_pParameter )
633 pTabPage->Init( m_pParameter->ProvidesSecondaryYAxis(), m_pParameter->ProvidesOverlapAndGapWidth(),
634 m_pParameter->ProvidesBarConnectors() );
635 break;
640 IMPL_LINK( SchAttribTabDlg, OKPressed, void * , EMPTYARG )
642 m_bOKPressed = true;
643 return m_aOriginalOKClickHdl.Call( this );
646 bool SchAttribTabDlg::DialogWasClosedWithOK() const
648 return m_bOKPressed;
651 //.............................................................................
652 } //namespace chart
653 //.............................................................................