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