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