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