1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
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.
14  *
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).
20  *
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.
25  *
26  ************************************************************************/
27 
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
36 
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 "NumberFormatterWrapper.hxx"
60 #include "AxisIndexDefines.hxx"
61 #include "AxisHelper.hxx"
62 #include "ExplicitCategoriesProvider.hxx"
63 
64 #include <com/sun/star/chart2/XAxis.hpp>
65 #include <com/sun/star/chart2/XChartType.hpp>
66 #include <com/sun/star/chart2/XDataSeries.hpp>
67 #include <svl/intitem.hxx>
68 #include <svl/languageoptions.hxx>
69 
70 #include <svx/svxids.hrc>
71 
72 #include <svx/drawitem.hxx>
73 #include <svx/ofaitem.hxx>
74 #include <svx/svxgrahicitem.hxx>
75 
76 #include <svx/dialogs.hrc>
77 #include <editeng/flstitem.hxx>
78 #include <svx/tabline.hxx>
79 
80 #include <svx/flagsdef.hxx>
81 #include <svx/numinf.hxx>
82 
83 #include <svl/cjkoptions.hxx>
84 
85 //.............................................................................
86 namespace chart
87 {
88 //.............................................................................
89 
90 using namespace ::com::sun::star;
91 using namespace ::com::sun::star::chart2;
92 using ::com::sun::star::uno::Reference;
93 
94 //-----------------------------------------------------------------------------
95 //-----------------------------------------------------------------------------
96 //-----------------------------------------------------------------------------
97 
98 ObjectPropertiesDialogParameter::ObjectPropertiesDialogParameter( const rtl::OUString& rObjectCID )
99         : m_aObjectCID( rObjectCID )
100         , m_eObjectType( ObjectIdentifier::getObjectType( m_aObjectCID ) )
101         , m_bAffectsMultipleObjects(false)
102         , m_aLocalizedName()
103         , m_bHasGeometryProperties(false)
104         , m_bHasStatisticProperties(false)
105         , m_bProvidesSecondaryYAxis(false)
106         , m_bProvidesOverlapAndGapWidth(false)
107         , m_bProvidesBarConnectors(false)
108         , m_bHasAreaProperties(false)
109         , m_bHasSymbolProperties(false)
110         , m_bHasNumberProperties(false)
111         , m_bProvidesStartingAngle(false)
112         , m_bProvidesMissingValueTreatments(false)
113         , m_bHasScaleProperties(false)
114         , m_bCanAxisLabelsBeStaggered(false)
115         , m_bSupportingAxisPositioning(false)
116         , m_bShowAxisOrigin(false)
117         , m_bIsCrossingAxisIsCategoryAxis(false)
118         , m_aCategories()
119         , m_xChartDocument( 0 )
120         , m_bComplexCategoriesAxis( false )
121 {
122     rtl::OUString aParticleID = ObjectIdentifier::getParticleID( m_aObjectCID );
123     m_bAffectsMultipleObjects = aParticleID.equals(C2U("ALLELEMENTS"));
124 }
125 ObjectPropertiesDialogParameter::~ObjectPropertiesDialogParameter()
126 {
127 }
128 ObjectType ObjectPropertiesDialogParameter::getObjectType() const
129 {
130     return m_eObjectType;
131 }
132 rtl::OUString ObjectPropertiesDialogParameter::getLocalizedName() const
133 {
134     return m_aLocalizedName;
135 }
136 
137 void ObjectPropertiesDialogParameter::init( const uno::Reference< frame::XModel >& xChartModel )
138 {
139     m_xChartDocument.set( xChartModel, uno::UNO_QUERY );
140     uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
141     uno::Reference< XDataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel );
142     uno::Reference< XChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries );
143     sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
144 
145     bool bHasSeriesProperties = (OBJECTTYPE_DATA_SERIES==m_eObjectType);
146     bool bHasDataPointproperties = (OBJECTTYPE_DATA_POINT==m_eObjectType);
147 
148     if( bHasSeriesProperties || bHasDataPointproperties )
149     {
150         m_bHasGeometryProperties = ChartTypeHelper::isSupportingGeometryProperties( xChartType, nDimensionCount );
151         m_bHasAreaProperties     = ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount );
152         m_bHasSymbolProperties   = ChartTypeHelper::isSupportingSymbolProperties( xChartType, nDimensionCount );
153 
154         if( bHasSeriesProperties )
155         {
156             m_bHasStatisticProperties =  ChartTypeHelper::isSupportingStatisticProperties( xChartType, nDimensionCount );
157             m_bProvidesSecondaryYAxis =  ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount, 1 );
158             m_bProvidesOverlapAndGapWidth =  ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount );
159             m_bProvidesBarConnectors =  ChartTypeHelper::isSupportingBarConnectors( xChartType, nDimensionCount );
160             m_bProvidesStartingAngle = ChartTypeHelper::isSupportingStartingAngle( xChartType );
161 
162             m_bProvidesMissingValueTreatments = ChartTypeHelper::getSupportedMissingValueTreatments( xChartType )
163                                             .getLength() ? true : false;
164         }
165     }
166 
167     if( OBJECTTYPE_DATA_ERRORS == m_eObjectType )
168         m_bHasStatisticProperties = true;
169 
170     if( OBJECTTYPE_AXIS == m_eObjectType )
171     {
172         //show scale properties only for a single axis not for multiselection
173         m_bHasScaleProperties = !m_bAffectsMultipleObjects;
174 
175         if( m_bHasScaleProperties )
176         {
177             uno::Reference< XAxis > xAxis( ObjectIdentifier::getAxisForCID( m_aObjectCID, xChartModel ) );
178             if( xAxis.is() )
179             {
180                 //no scale page for series axis
181                 ScaleData aData( xAxis->getScaleData() );
182                 if( chart2::AxisType::SERIES == aData.AxisType )
183                     m_bHasScaleProperties = false;
184                 if( chart2::AxisType::SERIES != aData.AxisType )
185                     m_bHasNumberProperties = true;
186 
187                 sal_Int32 nCooSysIndex=0;
188                 sal_Int32 nDimensionIndex=0;
189                 sal_Int32 nAxisIndex=0;
190                 if( AxisHelper::getIndicesForAxis( xAxis, xDiagram, nCooSysIndex, nDimensionIndex, nAxisIndex ) )
191                 {
192                     xChartType = AxisHelper::getFirstChartTypeWithSeriesAttachedToAxisIndex( xDiagram, nAxisIndex );
193                     //show positioning controls only if they make sense
194                     m_bSupportingAxisPositioning = ChartTypeHelper::isSupportingAxisPositioning( xChartType, nDimensionCount, nDimensionIndex );
195 
196                     //show axis origin only for secondary y axis
197                     if( 1==nDimensionIndex && 1==nAxisIndex && ChartTypeHelper::isSupportingBaseValue( xChartType ) )
198                         m_bShowAxisOrigin = true;
199                 }
200 
201                 //is the crossin main axis a category axes?:
202                 uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, xDiagram ) );
203                 uno::Reference< XAxis > xCrossingMainAxis( AxisHelper::getCrossingMainAxis( xAxis, xCooSys ) );
204                 if( xCrossingMainAxis.is() )
205                 {
206                     ScaleData aScale( xCrossingMainAxis->getScaleData() );
207                     m_bIsCrossingAxisIsCategoryAxis = ( chart2::AxisType::CATEGORY == aScale.AxisType  );
208                     if( m_bIsCrossingAxisIsCategoryAxis )
209                         m_aCategories = DiagramHelper::getExplicitSimpleCategories( Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY) );
210                 }
211 
212                 m_bComplexCategoriesAxis = false;
213                 if ( nDimensionIndex == 0 && aData.AxisType == chart2::AxisType::CATEGORY )
214                 {
215                     ExplicitCategoriesProvider aExplicitCategoriesProvider( xCooSys, xChartModel );
216                     m_bComplexCategoriesAxis = aExplicitCategoriesProvider.hasComplexCategories();
217                 }
218             }
219         }
220 
221         //no staggering of labels for 3D axis
222         m_bCanAxisLabelsBeStaggered = nDimensionCount==2;
223     }
224 
225     //create gui name for this object
226     {
227         if( !m_bAffectsMultipleObjects && OBJECTTYPE_AXIS == m_eObjectType )
228         {
229             m_aLocalizedName = ObjectNameProvider::getAxisName( m_aObjectCID, xChartModel );
230         }
231         else if( !m_bAffectsMultipleObjects && ( OBJECTTYPE_GRID == m_eObjectType || OBJECTTYPE_SUBGRID == m_eObjectType ) )
232         {
233             m_aLocalizedName = ObjectNameProvider::getGridName( m_aObjectCID, xChartModel );
234         }
235         else if( !m_bAffectsMultipleObjects && OBJECTTYPE_TITLE == m_eObjectType )
236         {
237             m_aLocalizedName = ObjectNameProvider::getTitleName( m_aObjectCID, xChartModel );
238         }
239         else
240         {
241             switch( m_eObjectType )
242             {
243                 case OBJECTTYPE_DATA_POINT:
244                 case OBJECTTYPE_DATA_LABEL:
245                 case OBJECTTYPE_DATA_LABELS:
246                 case OBJECTTYPE_DATA_ERRORS:
247                 case OBJECTTYPE_DATA_ERRORS_X:
248                 case OBJECTTYPE_DATA_ERRORS_Y:
249                 case OBJECTTYPE_DATA_ERRORS_Z:
250                 case OBJECTTYPE_DATA_AVERAGE_LINE:
251                 case OBJECTTYPE_DATA_CURVE:
252                 case OBJECTTYPE_DATA_CURVE_EQUATION:
253                     if( m_bAffectsMultipleObjects )
254                         m_aLocalizedName = ObjectNameProvider::getName_ObjectForAllSeries( m_eObjectType );
255                     else
256                         m_aLocalizedName = ObjectNameProvider::getName_ObjectForSeries( m_eObjectType, m_aObjectCID, m_xChartDocument );
257                     break;
258                 default:
259                     m_aLocalizedName = ObjectNameProvider::getName(m_eObjectType,m_bAffectsMultipleObjects);
260                     break;
261             }
262         }
263     }
264 }
265 
266 bool ObjectPropertiesDialogParameter::HasGeometryProperties() const
267 {
268     return m_bHasGeometryProperties;
269 }
270 bool ObjectPropertiesDialogParameter::HasStatisticProperties() const
271 {
272     return m_bHasStatisticProperties;
273 }
274 bool ObjectPropertiesDialogParameter::ProvidesSecondaryYAxis() const
275 {
276     return m_bProvidesSecondaryYAxis;
277 }
278 bool ObjectPropertiesDialogParameter::ProvidesOverlapAndGapWidth() const
279 {
280     return m_bProvidesOverlapAndGapWidth;
281 }
282 bool ObjectPropertiesDialogParameter::ProvidesBarConnectors() const
283 {
284     return m_bProvidesBarConnectors;
285 }
286 bool ObjectPropertiesDialogParameter::HasAreaProperties() const
287 {
288     return m_bHasAreaProperties;
289 }
290 bool ObjectPropertiesDialogParameter::HasSymbolProperties() const
291 {
292     return m_bHasSymbolProperties;
293 }
294 bool ObjectPropertiesDialogParameter::HasScaleProperties() const
295 {
296     return m_bHasScaleProperties;
297 }
298 bool ObjectPropertiesDialogParameter::CanAxisLabelsBeStaggered() const
299 {
300     return m_bCanAxisLabelsBeStaggered;
301 }
302 bool ObjectPropertiesDialogParameter::ShowAxisOrigin() const
303 {
304     return m_bShowAxisOrigin;
305 }
306 bool ObjectPropertiesDialogParameter::IsSupportingAxisPositioning() const
307 {
308     return m_bSupportingAxisPositioning;
309 }
310 bool ObjectPropertiesDialogParameter::IsCrossingAxisIsCategoryAxis() const
311 {
312     return m_bIsCrossingAxisIsCategoryAxis;
313 }
314 const uno::Sequence< rtl::OUString >& ObjectPropertiesDialogParameter::GetCategories() const
315 {
316     return m_aCategories;
317 }
318 bool ObjectPropertiesDialogParameter::HasNumberProperties() const
319 {
320     return m_bHasNumberProperties;
321 }
322 bool ObjectPropertiesDialogParameter::ProvidesStartingAngle() const
323 {
324     return m_bProvidesStartingAngle;
325 }
326 bool ObjectPropertiesDialogParameter::ProvidesMissingValueTreatments() const
327 {
328     return m_bProvidesMissingValueTreatments;
329 }
330 uno::Reference< chart2::XChartDocument > ObjectPropertiesDialogParameter::getDocument() const
331 {
332     return m_xChartDocument;
333 }
334 bool ObjectPropertiesDialogParameter::IsComplexCategoriesAxis() const
335 {
336     return m_bComplexCategoriesAxis;
337 }
338 
339 //const sal_uInt16 nNoArrowDlg          = 1100;
340 const sal_uInt16 nNoArrowNoShadowDlg    = 1101;
341 
342 //-------------------------------------------------------------------
343 //-------------------------------------------------------------------
344 //-------------------------------------------------------------------
345 
346 void SchAttribTabDlg::setSymbolInformation( SfxItemSet* pSymbolShapeProperties,
347                 Graphic* pAutoSymbolGraphic )
348 {
349     m_pSymbolShapeProperties = pSymbolShapeProperties;
350     m_pAutoSymbolGraphic = pAutoSymbolGraphic;
351 }
352 
353 void SchAttribTabDlg::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth )
354 {
355     m_fAxisMinorStepWidthForErrorBarDecimals = fMinorStepWidth;
356 }
357 
358 SchAttribTabDlg::SchAttribTabDlg(Window* pParent,
359                                  const SfxItemSet* pAttr,
360                                  const ObjectPropertiesDialogParameter* pDialogParameter,
361                                  const ViewElementListProvider* pViewElementListProvider,
362                                  const uno::Reference< util::XNumberFormatsSupplier >& xNumberFormatsSupplier
363                                  )
364     : SfxTabDialog(pParent, SchResId(DLG_OBJECT_PROPERTIES), pAttr)
365     , eObjectType(pDialogParameter->getObjectType())
366     , nDlgType(nNoArrowNoShadowDlg)
367     , nPageType(0)
368     , m_pParameter( pDialogParameter )
369     , m_pViewElementListProvider( pViewElementListProvider )
370     , m_pNumberFormatter(0)
371     , m_pSymbolShapeProperties(NULL)
372     , m_pAutoSymbolGraphic(NULL)
373     , m_fAxisMinorStepWidthForErrorBarDecimals(0.1)
374     , m_bOKPressed(false)
375 {
376     FreeResource();
377 
378     NumberFormatterWrapper aNumberFormatterWrapper( xNumberFormatsSupplier );
379     m_pNumberFormatter = aNumberFormatterWrapper.getSvNumberFormatter();
380 
381     this->SetText( pDialogParameter->getLocalizedName() );
382 
383     SvtCJKOptions aCJKOptions;
384 
385     switch (eObjectType)
386     {
387         case OBJECTTYPE_TITLE:
388             AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
389             AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
390             AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
391             AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
392             AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
393             AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::Create, NULL);
394             if( aCJKOptions.IsAsianTypographyEnabled() )
395                 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
396             break;
397 
398         case OBJECTTYPE_LEGEND:
399             AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
400             AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
401             AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
402             AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
403             AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
404             AddTabPage(TP_LEGEND_POS, String(SchResId(STR_PAGE_POSITION)), SchLegendPosTabPage::Create, NULL);
405             if( aCJKOptions.IsAsianTypographyEnabled() )
406                 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
407             break;
408 
409         case OBJECTTYPE_DATA_SERIES:
410         case OBJECTTYPE_DATA_POINT:
411             if( m_pParameter->ProvidesSecondaryYAxis() || m_pParameter->ProvidesOverlapAndGapWidth() || m_pParameter->ProvidesMissingValueTreatments() )
412                 AddTabPage(TP_OPTIONS, String(SchResId(STR_PAGE_OPTIONS)),SchOptionTabPage::Create, NULL);
413             if( m_pParameter->ProvidesStartingAngle())
414                 AddTabPage(TP_POLAROPTIONS, String(SchResId(STR_PAGE_OPTIONS)),PolarOptionsTabPage::Create, NULL);
415 
416             if( m_pParameter->HasGeometryProperties() )
417                 AddTabPage(TP_LAYOUT, String(SchResId(STR_PAGE_LAYOUT)),SchLayoutTabPage::Create, NULL);
418 
419             if(m_pParameter->HasAreaProperties())
420             {
421                 AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
422                 AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
423             }
424             AddTabPage(RID_SVXPAGE_LINE, String(SchResId( m_pParameter->HasAreaProperties() ? STR_PAGE_BORDER : STR_PAGE_LINE )));
425             break;
426 
427         case OBJECTTYPE_DATA_LABEL:
428         case OBJECTTYPE_DATA_LABELS:
429             AddTabPage(TP_DATA_DESCR, String(SchResId(STR_OBJECT_DATALABELS)), DataLabelsTabPage::Create, NULL);
430             AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
431             AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
432             if( aCJKOptions.IsAsianTypographyEnabled() )
433                 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
434 
435             break;
436 
437         case OBJECTTYPE_AXIS:
438         {
439             if( m_pParameter->HasScaleProperties() )
440                 AddTabPage(TP_SCALE, String(SchResId(STR_PAGE_SCALE)), ScaleTabPage::Create, NULL);
441 
442             if( m_pParameter->HasScaleProperties() )//no positioning page for z axes so far as the tickmarks are not shown so far
443                 AddTabPage(TP_AXIS_POSITIONS, String(SchResId(STR_PAGE_POSITIONING)), AxisPositionsTabPage::Create, NULL);
444             AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
445             AddTabPage(TP_AXIS_LABEL, String(SchResId(STR_OBJECT_LABEL)), SchAxisLabelTabPage::Create, NULL);
446             if( m_pParameter->HasNumberProperties() )
447                 AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
448             AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
449             AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
450             if( aCJKOptions.IsAsianTypographyEnabled() )
451                 AddTabPage(RID_SVXPAGE_PARA_ASIAN, String(SchResId(STR_PAGE_ASIAN)));
452             break;
453         }
454 
455         case OBJECTTYPE_DATA_ERRORS:
456         case OBJECTTYPE_DATA_ERRORS_X:
457         case OBJECTTYPE_DATA_ERRORS_Y:
458         case OBJECTTYPE_DATA_ERRORS_Z:
459             AddTabPage(TP_YERRORBAR, String(SchResId(STR_PAGE_YERROR_BARS)), ErrorBarsTabPage::Create, NULL);
460             AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
461             break;
462 
463         case OBJECTTYPE_GRID:
464         case OBJECTTYPE_SUBGRID:
465         case OBJECTTYPE_DATA_AVERAGE_LINE:
466         case OBJECTTYPE_DATA_STOCK_RANGE:
467             AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
468             break;
469 
470         case OBJECTTYPE_DATA_CURVE:
471             AddTabPage(TP_TRENDLINE, String(SchResId(STR_PAGE_TRENDLINE_TYPE)), TrendlineTabPage::Create, NULL);
472             AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_LINE)));
473             break;
474 
475         case OBJECTTYPE_DATA_STOCK_LOSS:
476         case OBJECTTYPE_DATA_STOCK_GAIN:
477         case OBJECTTYPE_PAGE:
478         case OBJECTTYPE_DIAGRAM_FLOOR:
479         case OBJECTTYPE_DIAGRAM_WALL:
480         case OBJECTTYPE_DIAGRAM:
481             AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
482             AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
483             AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
484             break;
485 
486         case OBJECTTYPE_LEGEND_ENTRY:
487         case OBJECTTYPE_AXIS_UNITLABEL:
488         case OBJECTTYPE_UNKNOWN:
489             // nothing
490             break;
491         case OBJECTTYPE_DATA_CURVE_EQUATION:
492             AddTabPage(RID_SVXPAGE_LINE, String(SchResId(STR_PAGE_BORDER)));
493             AddTabPage(RID_SVXPAGE_AREA, String(SchResId(STR_PAGE_AREA)));
494             AddTabPage(RID_SVXPAGE_TRANSPARENCE, String(SchResId(STR_PAGE_TRANSPARENCY)));
495             AddTabPage(RID_SVXPAGE_CHAR_NAME, String(SchResId(STR_PAGE_FONT)));
496             AddTabPage(RID_SVXPAGE_CHAR_EFFECTS, String(SchResId(STR_PAGE_FONT_EFFECTS)));
497             AddTabPage(RID_SVXPAGE_NUMBERFORMAT, String(SchResId(STR_PAGE_NUMBERS)));
498             if( SvtLanguageOptions().IsCTLFontEnabled() )
499                 /*  When rotation is supported for equation text boxes, use
500                     SchAlignmentTabPage::Create here. The special
501                     SchAlignmentTabPage::CreateWithoutRotation can be deleted. */
502                 AddTabPage(TP_ALIGNMENT, String(SchResId(STR_PAGE_ALIGNMENT)), SchAlignmentTabPage::CreateWithoutRotation, NULL);
503             break;
504         default:
505             break;
506     }
507 
508     // used to find out if user left the dialog with OK. When OK is pressed but
509     // no changes were done, Cancel is returned by the SfxTabDialog. See method
510     // DialogWasClosedWithOK.
511     m_aOriginalOKClickHdl = GetOKButton().GetClickHdl();
512     GetOKButton().SetClickHdl( LINK( this, SchAttribTabDlg, OKPressed ));
513 }
514 
515 SchAttribTabDlg::~SchAttribTabDlg()
516 {
517     delete m_pSymbolShapeProperties;
518     delete m_pAutoSymbolGraphic;
519 }
520 
521 void SchAttribTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage)
522 {
523     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
524     switch (nId)
525     {
526         case TP_LAYOUT:
527         break;
528         case RID_SVXPAGE_LINE:
529             aSet.Put (SvxColorTableItem(m_pViewElementListProvider->GetColorTable(),SID_COLOR_TABLE));
530             aSet.Put (SvxDashListItem(m_pViewElementListProvider->GetDashList(),SID_DASH_LIST));
531             aSet.Put (SvxLineEndListItem(m_pViewElementListProvider->GetLineEndList(),SID_LINEEND_LIST));
532             aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
533             aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
534 
535             if( m_pParameter->HasSymbolProperties() )
536             {
537                 aSet.Put(OfaPtrItem(SID_OBJECT_LIST,m_pViewElementListProvider->GetSymbolList()));
538                 if( m_pSymbolShapeProperties )
539                     aSet.Put(SfxTabDialogItem(SID_ATTR_SET,*m_pSymbolShapeProperties));
540                 if( m_pAutoSymbolGraphic )
541                     aSet.Put(SvxGraphicItem(SID_GRAPHIC,*m_pAutoSymbolGraphic));
542             }
543             rPage.PageCreated(aSet);
544             //rPage.ActivatePage(*GetInputSetImpl()); //what for?
545             break;
546 
547         case RID_SVXPAGE_AREA:
548             aSet.Put(SvxColorTableItem(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             //rPage.ActivatePage(*GetInputSetImpl()); //what for?
556             break;
557 
558         case RID_SVXPAGE_TRANSPARENCE:
559             aSet.Put (SfxUInt16Item(SID_PAGE_TYPE,nPageType));
560             aSet.Put (SfxUInt16Item(SID_DLG_TYPE,nDlgType));
561             rPage.PageCreated(aSet);
562             break;
563 
564         case RID_SVXPAGE_CHAR_NAME:
565 
566             //CHINA001 ((SvxCharNamePage&)rPage).
567             //CHINA001     SetFontList(SvxFontListItem(m_pViewElementListProvider->getFontList()));
568 			aSet.Put (SvxFontListItem(m_pViewElementListProvider->getFontList(), SID_ATTR_CHAR_FONTLIST)); //CHINA001
569 			rPage.PageCreated(aSet); //CHINA001
570             break;
571 
572         case RID_SVXPAGE_CHAR_EFFECTS:
573             //CHINA001 ((SvxCharEffectsPage&) rPage).DisableControls( DISABLE_CASEMAP );
574 			aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP)); //CHINA001
575 			rPage.PageCreated(aSet);
576             break;
577 
578         case TP_AXIS_LABEL:
579         {
580             bool bShowStaggeringControls = m_pParameter->CanAxisLabelsBeStaggered();
581             ((SchAxisLabelTabPage&)rPage).ShowStaggeringControls( bShowStaggeringControls );
582             ( dynamic_cast< SchAxisLabelTabPage& >( rPage ) ).SetComplexCategories( m_pParameter->IsComplexCategoriesAxis() );
583             break;
584         }
585 
586         case TP_ALIGNMENT:
587             break;
588 
589 
590         case TP_AXIS_POSITIONS:
591             {
592                 AxisPositionsTabPage* pPage = dynamic_cast< AxisPositionsTabPage* >( &rPage );
593                 if(pPage)
594                 {
595                     pPage->SetNumFormatter( m_pNumberFormatter );
596                     if( m_pParameter->IsCrossingAxisIsCategoryAxis() )
597                     {
598                         pPage->SetCrossingAxisIsCategoryAxis( m_pParameter->IsCrossingAxisIsCategoryAxis() );
599                         pPage->SetCategories( m_pParameter->GetCategories() );
600                     }
601                     pPage->SupportAxisPositioning( m_pParameter->IsSupportingAxisPositioning() );
602                 }
603             }
604             break;
605 
606         case TP_SCALE:
607             {
608                 ScaleTabPage* pScaleTabPage = dynamic_cast< ScaleTabPage* >( &rPage );
609                 if(pScaleTabPage)
610                 {
611                     pScaleTabPage->SetNumFormatter( m_pNumberFormatter );
612                     pScaleTabPage->ShowAxisOrigin( m_pParameter->ShowAxisOrigin() );
613                 }
614             }
615             break;
616 
617         case TP_DATA_DESCR:
618             {
619                 DataLabelsTabPage* pLabelPage = dynamic_cast< DataLabelsTabPage* >( &rPage );
620                 if( pLabelPage )
621                     pLabelPage->SetNumberFormatter( m_pNumberFormatter );
622             }
623             break;
624 
625         case RID_SVXPAGE_NUMBERFORMAT:
626            	aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (const sal_uInt16)SID_ATTR_NUMBERFORMAT_INFO));
627 			rPage.PageCreated(aSet);
628             break;
629 
630         case TP_YERRORBAR:
631         {
632             ErrorBarsTabPage * pTabPage = dynamic_cast< ErrorBarsTabPage * >( &rPage );
633             OSL_ASSERT( pTabPage );
634             if( pTabPage )
635             {
636                 pTabPage->SetAxisMinorStepWidthForErrorBarDecimals( m_fAxisMinorStepWidthForErrorBarDecimals );
637                 pTabPage->SetErrorBarType( ErrorBarResources::ERROR_BAR_Y );
638                 pTabPage->SetChartDocumentForRangeChoosing( m_pParameter->getDocument());
639             }
640             break;
641         }
642         case TP_OPTIONS:
643         {
644             SchOptionTabPage* pTabPage = dynamic_cast< SchOptionTabPage* >( &rPage );
645             if( pTabPage && m_pParameter )
646                 pTabPage->Init( m_pParameter->ProvidesSecondaryYAxis(), m_pParameter->ProvidesOverlapAndGapWidth(),
647                     m_pParameter->ProvidesBarConnectors() );
648             break;
649         }
650     }
651 }
652 
653 IMPL_LINK( SchAttribTabDlg, OKPressed, void * , EMPTYARG )
654 {
655     m_bOKPressed = true;
656     return m_aOriginalOKClickHdl.Call( this );
657 }
658 
659 bool SchAttribTabDlg::DialogWasClosedWithOK() const
660 {
661     return m_bOKPressed;
662 }
663 
664 //.............................................................................
665 } //namespace chart
666 //.............................................................................
667