fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / chart2 / source / controller / dialogs / ChartTypeDialogController.cxx
blobf7f5fcc9ecb9a203f11d65abd217458c3da110d8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "ChartTypeDialogController.hxx"
21 #include "ResId.hxx"
22 #include "HelpIds.hrc"
23 #include "Strings.hrc"
24 #include "Bitmaps.hrc"
25 #include "macros.hxx"
26 #include "ChartModelHelper.hxx"
27 #include "DiagramHelper.hxx"
28 #include "ControllerLockGuard.hxx"
29 #include "AxisHelper.hxx"
30 #include <unonames.hxx>
32 #include <com/sun/star/chart2/DataPointGeometry3D.hpp>
33 #include <com/sun/star/chart2/PieChartOffsetMode.hpp>
34 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
36 #include <svtools/controldims.hrc>
37 #include <svtools/valueset.hxx>
38 #include <vcl/bitmap.hxx>
39 #include <vcl/builder.hxx>
40 #include <vcl/image.hxx>
41 #include <vcl/svapp.hxx>
42 #include <vcl/settings.hxx>
44 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
46 namespace chart
48 using namespace ::com::sun::star;
49 using namespace ::com::sun::star::chart2;
51 ChartTypeParameter::ChartTypeParameter()
52 : nSubTypeIndex( 1 )
53 , bXAxisWithValues( false )
54 , b3DLook( false )
55 , bSymbols( true )
56 , bLines( true )
57 , eStackMode( GlobalStackMode_NONE )
58 , eCurveStyle( CurveStyle_LINES )
59 , nCurveResolution(20)
60 , nSplineOrder(3)
61 , nGeometry3D(DataPointGeometry3D::CUBOID)
62 , eThreeDLookScheme(ThreeDLookScheme_Realistic)
63 , bSortByXValues(false)
64 , mbRoundedEdge(false)
68 ChartTypeParameter::ChartTypeParameter( sal_Int32 SubTypeIndex, bool HasXAxisWithValues
69 , bool Is3DLook, GlobalStackMode nStackMode
70 , bool HasSymbols, bool HasLines
71 , CurveStyle nCurveStyle )
72 : nSubTypeIndex( SubTypeIndex )
73 , bXAxisWithValues( HasXAxisWithValues )
74 , b3DLook( Is3DLook )
75 , bSymbols( HasSymbols )
76 , bLines( HasLines )
77 , eStackMode( nStackMode )
78 , eCurveStyle( nCurveStyle )
79 , nCurveResolution(20)
80 , nSplineOrder(3)
81 , nGeometry3D(DataPointGeometry3D::CUBOID)
82 , eThreeDLookScheme(ThreeDLookScheme_Realistic)
83 , bSortByXValues(false)
84 , mbRoundedEdge(false)
87 ChartTypeParameter::~ChartTypeParameter()
91 bool ChartTypeParameter::mapsToSameService( const ChartTypeParameter& rParameter ) const
93 return this->mapsToSimilarService( rParameter, 0 );
95 bool ChartTypeParameter::mapsToSimilarService( const ChartTypeParameter& rParameter, sal_Int32 nTheHigherTheLess ) const
97 sal_Int32 nMax=7;
98 if(nTheHigherTheLess>nMax)
99 return true;
100 if( this->bXAxisWithValues!=rParameter.bXAxisWithValues )
101 return nTheHigherTheLess>nMax-1;
102 if( this->b3DLook!=rParameter.b3DLook )
103 return nTheHigherTheLess>nMax-2;
104 if( this->eStackMode!=rParameter.eStackMode )
105 return nTheHigherTheLess>nMax-3;
106 if( this->nSubTypeIndex!=rParameter.nSubTypeIndex )
107 return nTheHigherTheLess>nMax-4;
108 if( this->bSymbols!=rParameter.bSymbols )
109 return nTheHigherTheLess>nMax-5;
110 if( this->bLines!=rParameter.bLines )
111 return nTheHigherTheLess>nMax-6;
112 return true;
115 ChartTypeDialogController::ChartTypeDialogController()
116 : bSupportsXAxisWithValues(false)
117 , bSupports3D(true)
121 ChartTypeDialogController::~ChartTypeDialogController()
124 Image ChartTypeDialogController::getImage()
126 return Image();
128 bool ChartTypeDialogController::isSubType( const OUString& rServiceName )
130 const tTemplateServiceChartTypeParameterMap& rTemplateMap = this->getTemplateMap();
131 tTemplateServiceChartTypeParameterMap::const_iterator aIt( rTemplateMap.find( rServiceName ));
132 if( aIt != rTemplateMap.end())
133 return true;
134 return false;
136 ChartTypeParameter ChartTypeDialogController::getChartTypeParameterForService(
137 const OUString& rServiceName
138 , const uno::Reference< beans::XPropertySet >& xTemplateProps )
140 ChartTypeParameter aRet;
141 const tTemplateServiceChartTypeParameterMap& rTemplateMap = this->getTemplateMap();
142 tTemplateServiceChartTypeParameterMap::const_iterator aIt( rTemplateMap.find( rServiceName ));
143 if( aIt != rTemplateMap.end())
144 aRet = (*aIt).second;
145 if( xTemplateProps.is() )
149 xTemplateProps->getPropertyValue( CHART_UNONAME_CURVE_STYLE ) >>= aRet.eCurveStyle;
150 xTemplateProps->getPropertyValue( CHART_UNONAME_CURVE_RESOLUTION ) >>= aRet.nCurveResolution;
151 xTemplateProps->getPropertyValue( CHART_UNONAME_SPLINE_ORDER ) >>= aRet.nSplineOrder;
153 catch( uno::Exception & ex )
155 //not all templates need to support CurveStyle, CurveResolution or SplineOrder
156 ex.Context.is();//to have debug information without compilation warnings
161 xTemplateProps->getPropertyValue( "Geometry3D" ) >>= aRet.nGeometry3D;
163 catch( uno::Exception& ex )
165 //not all templates need to support Geometry3D
166 ex.Context.is();//to have debug information without compilation warnings
171 xTemplateProps->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE) >>= aRet.mbRoundedEdge;
173 catch ( const uno::Exception& ) {}
175 return aRet;
177 void ChartTypeDialogController::adjustSubTypeAndEnableControls( ChartTypeParameter& /*rParameter*/ )
180 void ChartTypeDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
182 switch( rParameter.nSubTypeIndex )
184 case 2:
185 rParameter.eStackMode=GlobalStackMode_STACK_Y;
186 break;
187 case 3:
188 rParameter.eStackMode=GlobalStackMode_STACK_Y_PERCENT;
189 break;
190 case 4:
191 rParameter.eStackMode=GlobalStackMode_STACK_Z;
192 break;
193 default:
194 rParameter.eStackMode=GlobalStackMode_NONE;
195 break;
198 void ChartTypeDialogController::adjustParameterToMainType( ChartTypeParameter& rParameter )
200 bool bFoundSomeMatch=false;
202 rParameter.bXAxisWithValues = bSupportsXAxisWithValues;
203 if( rParameter.b3DLook && !bSupports3D )
204 rParameter.b3DLook = false;
205 if(!rParameter.b3DLook && rParameter.eStackMode==GlobalStackMode_STACK_Z)
206 rParameter.eStackMode = GlobalStackMode_NONE;
208 const tTemplateServiceChartTypeParameterMap& rMap = getTemplateMap();
209 tTemplateServiceChartTypeParameterMap::const_iterator aIter = rMap.begin();
210 const tTemplateServiceChartTypeParameterMap::const_iterator aEnd = rMap.end();
211 for( sal_Int32 nMatchPrecision=0; nMatchPrecision<7 && !bFoundSomeMatch; nMatchPrecision++ )
213 for( aIter = rMap.begin(); aIter != aEnd; ++aIter )
215 if( rParameter.mapsToSimilarService( (*aIter).second, nMatchPrecision ) )
217 //remind some values
218 ThreeDLookScheme aScheme = rParameter.eThreeDLookScheme;
219 sal_Int32 nCurveResolution = rParameter.nCurveResolution;
220 sal_Int32 nSplineOrder = rParameter.nSplineOrder;
221 CurveStyle eCurveStyle = rParameter.eCurveStyle;
222 sal_Int32 nGeometry3D = rParameter.nGeometry3D;
223 bool bSortByXValues = rParameter.bSortByXValues;
224 bool bRoundedEdge = rParameter.mbRoundedEdge;
226 rParameter = (*aIter).second;
228 //some values should not be changed with charttype
229 rParameter.eThreeDLookScheme = aScheme;
230 rParameter.nCurveResolution = nCurveResolution;
231 rParameter.nSplineOrder =nSplineOrder;
232 rParameter.eCurveStyle = eCurveStyle;
233 rParameter.nGeometry3D = nGeometry3D;
234 rParameter.bSortByXValues = bSortByXValues;
235 rParameter.mbRoundedEdge = bRoundedEdge;
237 bFoundSomeMatch = true;
238 break;
242 if(!bFoundSomeMatch)
244 if(rMap.begin()!=rMap.end())
245 rParameter = (*rMap.begin()).second;
246 else
247 rParameter = ChartTypeParameter();
250 OUString ChartTypeDialogController::getServiceNameForParameter( const ChartTypeParameter& rParameter ) const
252 ChartTypeParameter aParameter(rParameter);
253 if( aParameter.bXAxisWithValues )
254 aParameter.eStackMode = GlobalStackMode_NONE;
255 if(!aParameter.b3DLook && aParameter.eStackMode==GlobalStackMode_STACK_Z)
256 aParameter.eStackMode = GlobalStackMode_NONE;
257 const tTemplateServiceChartTypeParameterMap& rMap = getTemplateMap();
258 tTemplateServiceChartTypeParameterMap::const_iterator aIter = rMap.begin();
259 const tTemplateServiceChartTypeParameterMap::const_iterator aEnd = rMap.end();
260 for( ; aIter != aEnd; ++aIter )
262 if( aParameter.mapsToSameService( (*aIter).second ) )
263 return (*aIter).first;
266 OSL_FAIL( "ChartType not implemented yet - use fallback to similar type" );
267 for( sal_Int32 nMatchPrecision=1; nMatchPrecision<8; nMatchPrecision++ )
269 for( aIter = rMap.begin(); aIter != aEnd; ++aIter )
271 if( aParameter.mapsToSimilarService( (*aIter).second, nMatchPrecision ) )
272 return (*aIter).first;
275 return OUString();
277 uno::Reference< XChartTypeTemplate > ChartTypeDialogController::getCurrentTemplate(
278 const ChartTypeParameter& rParameter
279 , const uno::Reference< lang::XMultiServiceFactory >& xTemplateManager ) const
281 uno::Reference< XChartTypeTemplate > xTemplate(0);
283 OUString aServiceName( this->getServiceNameForParameter( rParameter ) );
284 if(!aServiceName.isEmpty())
286 xTemplate.set( xTemplateManager->createInstance( aServiceName ), uno::UNO_QUERY );
287 if(xTemplate.is())
289 uno::Reference< beans::XPropertySet > xTemplateProps( xTemplate, uno::UNO_QUERY );
290 if(xTemplateProps.is())
294 xTemplateProps->setPropertyValue( CHART_UNONAME_CURVE_STYLE , uno::makeAny(rParameter.eCurveStyle) );
295 xTemplateProps->setPropertyValue( CHART_UNONAME_CURVE_RESOLUTION , uno::makeAny(rParameter.nCurveResolution) );
296 xTemplateProps->setPropertyValue( CHART_UNONAME_SPLINE_ORDER , uno::makeAny(rParameter.nSplineOrder) );
298 catch( uno::Exception & ex )
300 //not all templates need to support CurveStyle, CurveResolution or SplineOrder
301 ex.Context.is();//to have debug information without compilation warnings
305 xTemplateProps->setPropertyValue( "Geometry3D" , uno::makeAny(rParameter.nGeometry3D) );
307 catch( uno::Exception & ex )
309 //not all templates need to support Geometry3D
310 ex.Context.is();//to have debug information without compilation warnings
315 xTemplateProps->setPropertyValue(CHART_UNONAME_ROUNDED_EDGE, uno::makeAny(rParameter.mbRoundedEdge));
317 catch ( const uno::Exception& )
323 this->setTemplateProperties( xTemplateProps );
325 catch( const uno::Exception & ex )
327 ASSERT_EXCEPTION( ex );
332 return xTemplate;
335 bool ChartTypeDialogController::commitToModel( const ChartTypeParameter& rParameter
336 , const uno::Reference< XChartDocument >& xChartModel )
338 uno::Reference< lang::XMultiServiceFactory > xTemplateManager( xChartModel->getChartTypeManager(), uno::UNO_QUERY );
339 uno::Reference< XChartTypeTemplate > xTemplate( this->getCurrentTemplate( rParameter, xTemplateManager ) );
340 if(xTemplate.is())
342 uno::Reference< frame::XModel > xModel( xChartModel, uno::UNO_QUERY);
344 // locked controllers
345 ControllerLockGuardUNO aCtrlLockGuard( xModel );
346 uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
347 DiagramHelper::tTemplateWithServiceName aTemplateWithService(
348 DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager ));
349 if( aTemplateWithService.first.is())
350 aTemplateWithService.first->resetStyles( xDiagram );
351 xTemplate->changeDiagram( xDiagram );
352 if( AllSettings::GetMathLayoutRTL() )
353 AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
354 if( rParameter.b3DLook )
355 ThreeDHelper::setScheme( xDiagram, rParameter.eThreeDLookScheme );
357 uno::Reference<beans::XPropertySet> xDiaProp(xDiagram, uno::UNO_QUERY);
358 if (xDiaProp.is())
360 xDiaProp->setPropertyValue(CHART_UNONAME_SORT_BY_XVALUES, uno::makeAny(rParameter.bSortByXValues));
363 return false;
365 void ChartTypeDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& /*rParameter*/ )
367 rSubTypeList.Clear();
369 bool ChartTypeDialogController::shouldShow_3DLookControl() const
371 return false;
373 bool ChartTypeDialogController::shouldShow_StackingControl() const
375 return false;
377 bool ChartTypeDialogController::shouldShow_DeepStackingControl() const
379 return false;
381 bool ChartTypeDialogController::shouldShow_SplineControl() const
383 return false;
385 bool ChartTypeDialogController::shouldShow_GeometryControl() const
387 return false;
389 bool ChartTypeDialogController::shouldShow_SortByXValuesResourceGroup() const
391 return false;
394 bool ChartTypeDialogController::shouldShow_GL3DResourceGroup() const
396 return false;
399 void ChartTypeDialogController::showExtraControls( VclBuilderContainer* /*pParent*/ )
402 void ChartTypeDialogController::hideExtraControls() const
405 void ChartTypeDialogController::fillExtraControls( const ChartTypeParameter& /*rParameter*/
406 , const uno::Reference< XChartDocument >& /*xChartModel*/
407 , const uno::Reference< beans::XPropertySet >& /*xTemplateProps*/ ) const
410 void ChartTypeDialogController::setTemplateProperties( const uno::Reference< beans::XPropertySet >& /*xTemplateProps*/ ) const throw (uno::RuntimeException)
414 ColumnOrBarChartDialogController_Base::ColumnOrBarChartDialogController_Base()
415 : ChartTypeDialogController()
418 ColumnOrBarChartDialogController_Base::~ColumnOrBarChartDialogController_Base()
421 bool ColumnOrBarChartDialogController_Base::shouldShow_3DLookControl() const
423 return true;
425 bool ColumnOrBarChartDialogController_Base::shouldShow_GeometryControl() const
427 return true;
429 void ColumnOrBarChartDialogController_Base::adjustSubTypeAndEnableControls( ChartTypeParameter& rParameter )
431 if(rParameter.nSubTypeIndex>3 && !rParameter.b3DLook)
433 rParameter.nSubTypeIndex=1;
436 ColumnChartDialogController::ColumnChartDialogController()
439 ColumnChartDialogController::~ColumnChartDialogController()
442 OUString ColumnChartDialogController::getName()
444 return SCH_RESSTR( STR_TYPE_COLUMN );
446 Image ColumnChartDialogController::getImage()
448 return Image( SchResId( IMG_TYPE_COLUMN ));
450 const tTemplateServiceChartTypeParameterMap& ColumnChartDialogController::getTemplateMap() const
452 static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
453 tTemplateServiceChartTypeParameterMap
454 ( "com.sun.star.chart2.template.Column" , ChartTypeParameter(1,false,false,GlobalStackMode_NONE) )
455 ( "com.sun.star.chart2.template.StackedColumn" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y) )
456 ( "com.sun.star.chart2.template.PercentStackedColumn" , ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT) )
457 ( "com.sun.star.chart2.template.ThreeDColumnFlat" , ChartTypeParameter(1,false,true,GlobalStackMode_NONE) )
458 ( "com.sun.star.chart2.template.StackedThreeDColumnFlat" , ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y) )
459 ( "com.sun.star.chart2.template.PercentStackedThreeDColumnFlat" , ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT) )
460 ( "com.sun.star.chart2.template.ThreeDColumnDeep" , ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z) )
462 return m_aTemplateMap;
464 void ColumnChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter )
466 rSubTypeList.Clear();
468 if( rParameter.b3DLook )
470 switch(rParameter.nGeometry3D)
472 case DataPointGeometry3D::CYLINDER:
473 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_SAEULE_3D_1))));
474 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_SAEULE_3D_2))));
475 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_SAEULE_3D_3))));
476 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_SAEULE_3D_4))));
477 break;
478 case DataPointGeometry3D::CONE:
479 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_KEGEL_3D_1))));
480 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_KEGEL_3D_2))));
481 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_KEGEL_3D_3))));
482 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_KEGEL_3D_4))));
483 break;
484 case DataPointGeometry3D::PYRAMID:
485 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_PYRAMID_3D_1))));
486 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_PYRAMID_3D_2))));
487 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_PYRAMID_3D_3))));
488 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_PYRAMID_3D_4))));
489 break;
490 default: //DataPointGeometry3D::CUBOID:
491 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_COLUMNS_3D_1))));
492 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_COLUMNS_3D_2))));
493 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_COLUMNS_3D_3))));
494 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_COLUMNS_3D))));
495 break;
498 else
500 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_COLUMNS_2D_1))));
501 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_COLUMNS_2D_2))));
502 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_COLUMNS_2D_3))));
505 rSubTypeList.SetItemText( 1, SCH_RESSTR( STR_NORMAL ) );
506 rSubTypeList.SetItemText( 2, SCH_RESSTR( STR_STACKED ) );
507 rSubTypeList.SetItemText( 3, SCH_RESSTR( STR_PERCENT ) );
508 rSubTypeList.SetItemText( 4, SCH_RESSTR( STR_DEEP ) );
511 BarChartDialogController::BarChartDialogController()
514 BarChartDialogController::~BarChartDialogController()
517 OUString BarChartDialogController::getName()
519 return SCH_RESSTR( STR_TYPE_BAR );
521 Image BarChartDialogController::getImage()
523 return Image( SchResId( IMG_TYPE_BAR ));
525 const tTemplateServiceChartTypeParameterMap& BarChartDialogController::getTemplateMap() const
527 static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
528 tTemplateServiceChartTypeParameterMap
529 ( "com.sun.star.chart2.template.Bar" , ChartTypeParameter(1,false,false,GlobalStackMode_NONE) )
530 ( "com.sun.star.chart2.template.StackedBar" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y) )
531 ( "com.sun.star.chart2.template.PercentStackedBar" , ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT) )
532 ( "com.sun.star.chart2.template.ThreeDBarFlat" , ChartTypeParameter(1,false,true,GlobalStackMode_NONE) )
533 ( "com.sun.star.chart2.template.StackedThreeDBarFlat" , ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y) )
534 ( "com.sun.star.chart2.template.PercentStackedThreeDBarFlat" , ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT) )
535 ( "com.sun.star.chart2.template.ThreeDBarDeep" , ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z) )
537 return m_aTemplateMap;
539 void BarChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter )
541 rSubTypeList.Clear();
543 if( rParameter.b3DLook )
545 switch(rParameter.nGeometry3D)
547 case DataPointGeometry3D::CYLINDER:
548 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_ROEHRE_3D_1))));
549 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_ROEHRE_3D_2))));
550 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_ROEHRE_3D_3))));
551 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_ROEHRE_3D_4))));
552 break;
553 case DataPointGeometry3D::CONE:
554 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_KEGELQ_3D_1))));
555 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_KEGELQ_3D_2))));
556 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_KEGELQ_3D_3))));
557 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_KEGELQ_3D_4))));
558 break;
559 case DataPointGeometry3D::PYRAMID:
560 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_PYRAMIDQ_3D_1))));
561 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_PYRAMIDQ_3D_2))));
562 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_PYRAMIDQ_3D_3))));
563 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_PYRAMIDQ_3D_4))));
564 break;
565 default: //DataPointGeometry3D::CUBOID:
566 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_BARS_3D_1))));
567 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_BARS_3D_2))));
568 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_BARS_3D_3))));
569 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_BARS_3D))));
570 break;
573 else
575 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_BARS_2D_1))));
576 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_BARS_2D_2))));
577 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_BARS_2D_3))));
579 rSubTypeList.SetItemText( 1, SCH_RESSTR( STR_NORMAL ) );
580 rSubTypeList.SetItemText( 2, SCH_RESSTR( STR_STACKED ) );
581 rSubTypeList.SetItemText( 3, SCH_RESSTR( STR_PERCENT ) );
582 rSubTypeList.SetItemText( 4, SCH_RESSTR( STR_DEEP ) );
585 PieChartDialogController::PieChartDialogController()
588 PieChartDialogController::~PieChartDialogController()
591 OUString PieChartDialogController::getName()
593 return SCH_RESSTR( STR_TYPE_PIE );
595 Image PieChartDialogController::getImage()
597 return Image( SchResId( IMG_TYPE_PIE ));
599 const tTemplateServiceChartTypeParameterMap& PieChartDialogController::getTemplateMap() const
601 static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
602 tTemplateServiceChartTypeParameterMap
603 ( "com.sun.star.chart2.template.Pie" , ChartTypeParameter(1,false,false) )
604 ( "com.sun.star.chart2.template.PieAllExploded" , ChartTypeParameter(2,false,false) )
605 ( "com.sun.star.chart2.template.Donut" , ChartTypeParameter(3,false,false) )
606 ( "com.sun.star.chart2.template.DonutAllExploded" , ChartTypeParameter(4,false,false) )
607 ( "com.sun.star.chart2.template.ThreeDPie" , ChartTypeParameter(1,false,true) )
608 ( "com.sun.star.chart2.template.ThreeDPieAllExploded" , ChartTypeParameter(2,false,true) )
609 ( "com.sun.star.chart2.template.ThreeDDonut" , ChartTypeParameter(3,false,true) )
610 ( "com.sun.star.chart2.template.ThreeDDonutAllExploded" , ChartTypeParameter(4,false,true) )
612 return m_aTemplateMap;
614 void PieChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter )
616 rSubTypeList.Clear();
618 if( rParameter.b3DLook )
620 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_CIRCLES_3D))));
621 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_CIRCLES_3D_EXPLODED))));
622 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_DONUT_3D))));
623 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_DONUT_3D_EXPLODED))));
625 else
627 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_CIRCLES_2D))));
628 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_CIRCLES_2D_EXPLODED))));
629 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_DONUT_2D))));
630 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_DONUT_2D_EXPLODED))));
632 rSubTypeList.SetItemText( 1, SCH_RESSTR( STR_NORMAL ) );
633 rSubTypeList.SetItemText( 2, SCH_RESSTR( STR_PIE_EXPLODED ) );
634 rSubTypeList.SetItemText( 3, SCH_RESSTR( STR_DONUT ) );
635 rSubTypeList.SetItemText( 4, SCH_RESSTR( STR_DONUT_EXPLODED ) );
638 bool PieChartDialogController::shouldShow_3DLookControl() const
640 return true;
642 void PieChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
644 if(rParameter.eStackMode==GlobalStackMode_STACK_Z)
645 rParameter.eStackMode = GlobalStackMode_NONE;
647 LineChartDialogController::LineChartDialogController()
650 LineChartDialogController::~LineChartDialogController()
653 OUString LineChartDialogController::getName()
655 return SCH_RESSTR( STR_TYPE_LINE );
657 Image LineChartDialogController::getImage()
659 return Image( SchResId( IMG_TYPE_LINE ));
661 const tTemplateServiceChartTypeParameterMap& LineChartDialogController::getTemplateMap() const
663 static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
664 tTemplateServiceChartTypeParameterMap
665 ( "com.sun.star.chart2.template.Symbol" , ChartTypeParameter(1,false,false,GlobalStackMode_NONE,true,false) )
666 ( "com.sun.star.chart2.template.StackedSymbol" , ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y,true,false) )
667 ( "com.sun.star.chart2.template.PercentStackedSymbol" , ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y_PERCENT,true,false) )
668 ( "com.sun.star.chart2.template.LineSymbol" , ChartTypeParameter(2,false,false,GlobalStackMode_NONE,true,true) )
669 ( "com.sun.star.chart2.template.StackedLineSymbol" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y,true,true) )
670 ( "com.sun.star.chart2.template.PercentStackedLineSymbol" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y_PERCENT,true,true) )
671 ( "com.sun.star.chart2.template.Line" , ChartTypeParameter(3,false,false,GlobalStackMode_NONE,false,true) )
672 ( "com.sun.star.chart2.template.StackedLine" , ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y,false,true) )
673 ( "com.sun.star.chart2.template.PercentStackedLine" , ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT,false,true) )
674 ( "com.sun.star.chart2.template.StackedThreeDLine" , ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Y,false,true) )
675 ( "com.sun.star.chart2.template.PercentStackedThreeDLine" , ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Y_PERCENT,false,true) )
676 ( "com.sun.star.chart2.template.ThreeDLineDeep" , ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z,false,true) )
678 return m_aTemplateMap;
680 void LineChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter )
682 rSubTypeList.Clear();
684 switch( rParameter.eCurveStyle )
686 case CurveStyle_CUBIC_SPLINES:
687 case CurveStyle_B_SPLINES:
688 if( GlobalStackMode_NONE == rParameter.eStackMode || GlobalStackMode_STACK_Z == rParameter.eStackMode )
690 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_POINTS_XCATEGORY))));
691 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_LINE_P_XCATEGORY_SMOOTH))));
692 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_LINE_O_XCATEGORY_SMOOTH))));
693 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_LINE3D_XCATEGORY_SMOOTH))));
695 else
697 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_POINTS_STACKED))));
698 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_LINE_P_STACKED_SMOOTH))));
699 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_LINE_O_STACKED_SMOOTH))));
700 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_LINE3D_STACKED_SMOOTH))));
702 break;
703 case CurveStyle_STEP_START:
704 case CurveStyle_STEP_END:
705 case CurveStyle_STEP_CENTER_X:
706 case CurveStyle_STEP_CENTER_Y:
707 if( GlobalStackMode_NONE == rParameter.eStackMode || GlobalStackMode_STACK_Z == rParameter.eStackMode )
709 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_POINTS_XCATEGORY))));
710 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_LINE_P_XCATEGORY_STEPPED))));
711 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_LINE_O_XCATEGORY_STEPPED))));
712 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_LINE3D_XCATEGORY_STEPPED))));
714 else
716 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_POINTS_STACKED))));
717 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_LINE_P_STACKED_STEPPED))));
718 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_LINE_O_STACKED_STEPPED))));
719 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_LINE3D_STACKED_STEPPED))));
721 break;
722 default: // includes CurveStyle_LINES
723 //direct lines
724 if( GlobalStackMode_NONE == rParameter.eStackMode || GlobalStackMode_STACK_Z == rParameter.eStackMode )
726 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_POINTS_XCATEGORY))));
727 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_LINE_P_XCATEGORY))));
728 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_LINE_O_XCATEGORY))));
729 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_LINE3D_XCATEGORY))));
731 else
733 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_POINTS_STACKED))));
734 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_LINE_P_STACKED))));
735 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_LINE_O_STACKED))));
736 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_LINE3D_STACKED))));
740 rSubTypeList.SetItemText( 1, SCH_RESSTR( STR_POINTS_ONLY ) );
741 rSubTypeList.SetItemText( 2, SCH_RESSTR( STR_POINTS_AND_LINES ) );
742 rSubTypeList.SetItemText( 3, SCH_RESSTR( STR_LINES_ONLY ) );
743 rSubTypeList.SetItemText( 4, SCH_RESSTR( STR_LINES_3D ) );
745 bool LineChartDialogController::shouldShow_StackingControl() const
747 return true;
749 bool LineChartDialogController::shouldShow_DeepStackingControl() const
751 return false;
753 bool LineChartDialogController::shouldShow_SplineControl() const
755 return true;
757 void LineChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
759 rParameter.b3DLook = false;
761 switch( rParameter.nSubTypeIndex )
763 case 2:
764 rParameter.bSymbols = true;
765 rParameter.bLines = true;
766 break;
767 case 3:
768 rParameter.bSymbols = false;
769 rParameter.bLines = true;
770 break;
771 case 4:
772 rParameter.bSymbols = false;
773 rParameter.bLines = true;
774 rParameter.b3DLook = true;
775 if( rParameter.eStackMode == GlobalStackMode_NONE )
776 rParameter.eStackMode = GlobalStackMode_STACK_Z;
777 break;
778 default:
779 rParameter.bSymbols = true;
780 rParameter.bLines = false;
781 break;
784 if(!rParameter.b3DLook && rParameter.eStackMode == GlobalStackMode_STACK_Z )
785 rParameter.eStackMode = GlobalStackMode_NONE;
787 void LineChartDialogController::adjustParameterToMainType( ChartTypeParameter& rParameter )
789 if( rParameter.b3DLook && rParameter.eStackMode == GlobalStackMode_NONE )
790 rParameter.eStackMode = GlobalStackMode_STACK_Z;
792 ChartTypeDialogController::adjustParameterToMainType( rParameter );
794 XYChartDialogController::XYChartDialogController()
796 bSupportsXAxisWithValues = true;
798 XYChartDialogController::~XYChartDialogController()
801 OUString XYChartDialogController::getName()
803 return SCH_RESSTR( STR_TYPE_XY );
805 Image XYChartDialogController::getImage()
807 return Image( SchResId( IMG_TYPE_XY ));
809 const tTemplateServiceChartTypeParameterMap& XYChartDialogController::getTemplateMap() const
811 static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
812 tTemplateServiceChartTypeParameterMap
813 ( "com.sun.star.chart2.template.ScatterSymbol" , ChartTypeParameter(1,true,false,GlobalStackMode_NONE,true,false) )
814 ( "com.sun.star.chart2.template.ScatterLineSymbol" , ChartTypeParameter(2,true,false,GlobalStackMode_NONE,true,true) )
815 ( "com.sun.star.chart2.template.ScatterLine" , ChartTypeParameter(3,true,false,GlobalStackMode_NONE,false,true) )
816 ( "com.sun.star.chart2.template.ThreeDScatter" , ChartTypeParameter(4,true,true,GlobalStackMode_NONE,false,true) )
818 return m_aTemplateMap;
820 void XYChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter )
822 rSubTypeList.Clear();
824 switch (rParameter.eCurveStyle)
826 case CurveStyle_CUBIC_SPLINES:
827 case CurveStyle_B_SPLINES:
829 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_POINTS_XVALUES))));
830 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_LINE_P_XVALUES_SMOOTH))));
831 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_LINE_O_XVALUES_SMOOTH))));
832 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_LINE3D_XVALUES_SMOOTH))));
833 break;
835 case CurveStyle_STEP_START:
836 case CurveStyle_STEP_END:
837 case CurveStyle_STEP_CENTER_X:
838 case CurveStyle_STEP_CENTER_Y:
840 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_POINTS_XVALUES))));
841 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_LINE_P_XVALUES_STEPPED))));
842 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_LINE_O_XVALUES_STEPPED))));
843 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_LINE3D_XVALUES_STEPPED))));
844 break;
846 default: // includes CurveStyle_LINES
847 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_POINTS_XVALUES))));
848 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_LINE_P_XVALUES))));
849 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_LINE_O_XVALUES))));
850 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_LINE3D_XVALUES))));
853 rSubTypeList.SetItemText( 1, SCH_RESSTR( STR_POINTS_ONLY ) );
854 rSubTypeList.SetItemText( 2, SCH_RESSTR( STR_POINTS_AND_LINES ) );
855 rSubTypeList.SetItemText( 3, SCH_RESSTR( STR_LINES_ONLY ) );
856 rSubTypeList.SetItemText( 4, SCH_RESSTR( STR_LINES_3D ) );
858 bool XYChartDialogController::shouldShow_SplineControl() const
860 return true;
862 bool XYChartDialogController::shouldShow_SortByXValuesResourceGroup() const
864 return true;
866 void XYChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
868 rParameter.eStackMode=GlobalStackMode_NONE;
869 rParameter.b3DLook = false;
870 rParameter.bXAxisWithValues = true;
872 switch( rParameter.nSubTypeIndex )
874 case 2:
875 rParameter.bSymbols = true;
876 rParameter.bLines = true;
877 break;
878 case 3:
879 rParameter.bSymbols = false;
880 rParameter.bLines = true;
881 break;
882 case 4:
883 rParameter.bSymbols = false;
884 rParameter.bLines = true;
885 rParameter.b3DLook = true;
886 rParameter.eStackMode=GlobalStackMode_STACK_Z;
887 break;
888 default:
889 rParameter.bSymbols = true;
890 rParameter.bLines = false;
891 break;
894 AreaChartDialogController::AreaChartDialogController()
897 AreaChartDialogController::~AreaChartDialogController()
900 OUString AreaChartDialogController::getName()
902 return SCH_RESSTR(STR_TYPE_AREA);
904 Image AreaChartDialogController::getImage()
906 return Image( SchResId( IMG_TYPE_AREA ));
908 bool AreaChartDialogController::shouldShow_3DLookControl() const
910 return true;
912 const tTemplateServiceChartTypeParameterMap& AreaChartDialogController::getTemplateMap() const
914 static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
915 tTemplateServiceChartTypeParameterMap
916 ( "com.sun.star.chart2.template.Area" , ChartTypeParameter(1,false,false,GlobalStackMode_NONE) )
917 ( "com.sun.star.chart2.template.ThreeDArea" , ChartTypeParameter(1,false,true,GlobalStackMode_STACK_Z) )
918 ( "com.sun.star.chart2.template.StackedArea" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y) )
919 ( "com.sun.star.chart2.template.StackedThreeDArea" , ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y) )
920 ( "com.sun.star.chart2.template.PercentStackedArea" , ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT) )
921 ( "com.sun.star.chart2.template.PercentStackedThreeDArea" , ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT) )
923 return m_aTemplateMap;
925 void AreaChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter )
927 rSubTypeList.Clear();
929 if( rParameter.b3DLook )
931 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_AREAS_3D))));
932 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_AREAS_3D_1))));
933 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_AREAS_3D_2))));
935 else
937 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_AREAS_2D_1))));
938 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_AREAS_2D))));
939 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_AREAS_2D_3))));
942 rSubTypeList.SetItemText( 1, SCH_RESSTR( rParameter.b3DLook ? STR_DEEP : STR_NORMAL ) );
943 rSubTypeList.SetItemText( 2, SCH_RESSTR( STR_STACKED ) );
944 rSubTypeList.SetItemText( 3, SCH_RESSTR( STR_PERCENT ) );
946 void AreaChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
948 rParameter.eCurveStyle = CurveStyle_LINES;
950 if( rParameter.nSubTypeIndex>3 )
951 rParameter.nSubTypeIndex = 1;
952 switch( rParameter.nSubTypeIndex )
954 case 2:
955 rParameter.eStackMode=GlobalStackMode_STACK_Y;
956 break;
957 case 3:
958 rParameter.eStackMode=GlobalStackMode_STACK_Y_PERCENT;
959 break;
960 default:
961 if( rParameter.b3DLook )
962 rParameter.eStackMode=GlobalStackMode_STACK_Z;
963 else
964 rParameter.eStackMode=GlobalStackMode_NONE;
965 break;
968 void AreaChartDialogController::adjustParameterToMainType( ChartTypeParameter& rParameter )
970 if( rParameter.b3DLook && rParameter.eStackMode == GlobalStackMode_NONE )
971 rParameter.eStackMode = GlobalStackMode_STACK_Z;
973 ChartTypeDialogController::adjustParameterToMainType( rParameter );
975 NetChartDialogController::NetChartDialogController()
977 bSupports3D = false;
979 NetChartDialogController::~NetChartDialogController()
982 OUString NetChartDialogController::getName()
984 return SCH_RESSTR(STR_TYPE_NET);
986 Image NetChartDialogController::getImage()
988 return Image( SchResId( IMG_TYPE_NET ));
990 bool NetChartDialogController::shouldShow_StackingControl() const
992 return true;
994 const tTemplateServiceChartTypeParameterMap& NetChartDialogController::getTemplateMap() const
996 static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
997 tTemplateServiceChartTypeParameterMap
998 //@todo need templates with symbols only
999 ( "com.sun.star.chart2.template.NetSymbol" , ChartTypeParameter(1,false,false,GlobalStackMode_NONE,true,false) )
1000 ( "com.sun.star.chart2.template.StackedNetSymbol" , ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y,true,false) )
1001 ( "com.sun.star.chart2.template.PercentStackedNetSymbol" ,ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y_PERCENT,true,false) )
1003 ( "com.sun.star.chart2.template.Net" , ChartTypeParameter(2,false,false,GlobalStackMode_NONE,true,true) )
1004 ( "com.sun.star.chart2.template.StackedNet" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y,true,true) )
1005 ( "com.sun.star.chart2.template.PercentStackedNet" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y_PERCENT,true,true) )
1007 ( "com.sun.star.chart2.template.NetLine" , ChartTypeParameter(3,false,false,GlobalStackMode_NONE,false,true) )
1008 ( "com.sun.star.chart2.template.StackedNetLine" , ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y,false,true) )
1009 ( "com.sun.star.chart2.template.PercentStackedNetLine" , ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT,false,true) )
1011 ( "com.sun.star.chart2.template.FilledNet" , ChartTypeParameter(4,false,false,GlobalStackMode_NONE,false,false) )
1012 ( "com.sun.star.chart2.template.StackedFilledNet" , ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y,false,false) )
1013 ( "com.sun.star.chart2.template.PercentStackedFilledNet" ,ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y_PERCENT,false,false) )
1015 return m_aTemplateMap;
1017 void NetChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& rParameter )
1019 rSubTypeList.Clear();
1021 if( GlobalStackMode_NONE == rParameter.eStackMode )
1023 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_NET_SYMB))));
1024 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_NET_LINESYMB))));
1025 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_NET))));
1026 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_NET_FILL))));
1028 else
1030 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_NET_SYMB_STACK))));
1031 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_NET_LINESYMB_STACK))));
1032 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_NET_STACK))));
1033 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_NET_FILL_STACK))));
1036 rSubTypeList.SetItemText( 1, SCH_RESSTR( STR_POINTS_ONLY ) );
1037 rSubTypeList.SetItemText( 2, SCH_RESSTR( STR_POINTS_AND_LINES ) );
1038 rSubTypeList.SetItemText( 3, SCH_RESSTR( STR_LINES_ONLY ) );
1039 rSubTypeList.SetItemText( 4, SCH_RESSTR( STR_FILLED ) );
1041 void NetChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
1043 rParameter.b3DLook = false;
1044 if(rParameter.eStackMode==GlobalStackMode_STACK_Z)
1045 rParameter.eStackMode = GlobalStackMode_NONE;
1047 switch( rParameter.nSubTypeIndex )
1049 case 2:
1050 rParameter.bSymbols = true;
1051 rParameter.bLines = true;
1052 break;
1053 case 3:
1054 rParameter.bSymbols = false;
1055 rParameter.bLines = true;
1056 break;
1057 case 4:
1058 rParameter.bSymbols = false;
1059 rParameter.bLines = false;
1060 break;
1061 default:
1062 rParameter.bSymbols = true;
1063 rParameter.bLines = false;
1064 break;
1067 StockChartDialogController::StockChartDialogController()
1069 bSupports3D = false;
1072 StockChartDialogController::~StockChartDialogController()
1076 OUString StockChartDialogController::getName()
1078 return SCH_RESSTR(STR_TYPE_STOCK);
1080 Image StockChartDialogController::getImage()
1082 return Image( SchResId( IMG_TYPE_STOCK ));
1085 const tTemplateServiceChartTypeParameterMap& StockChartDialogController::getTemplateMap() const
1087 static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
1088 tTemplateServiceChartTypeParameterMap
1089 ( "com.sun.star.chart2.template.StockLowHighClose" , ChartTypeParameter(1) )
1090 ( "com.sun.star.chart2.template.StockOpenLowHighClose" , ChartTypeParameter(2) )
1091 ( "com.sun.star.chart2.template.StockVolumeLowHighClose" , ChartTypeParameter(3) )
1092 ( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ,ChartTypeParameter(4) )
1094 return m_aTemplateMap;
1097 void StockChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& /*rParameter*/ )
1099 rSubTypeList.Clear();
1100 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_STOCK_1))));
1101 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_STOCK_2))));
1102 rSubTypeList.InsertItem(3, Image(Bitmap(SchResId(BMP_STOCK_3))));
1103 rSubTypeList.InsertItem(4, Image(Bitmap(SchResId(BMP_STOCK_4))));
1105 rSubTypeList.SetItemText( 1, SCH_RESSTR(STR_STOCK_1) );
1106 rSubTypeList.SetItemText( 2, SCH_RESSTR(STR_STOCK_2) );
1107 rSubTypeList.SetItemText( 3, SCH_RESSTR(STR_STOCK_3) );
1108 rSubTypeList.SetItemText( 4, SCH_RESSTR(STR_STOCK_4) );
1111 void StockChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
1113 rParameter.b3DLook = false;
1114 rParameter.eStackMode = GlobalStackMode_NONE;
1117 CombiColumnLineChartDialogController::CombiColumnLineChartDialogController()
1118 : m_pFT_NumberOfLines(0)
1119 , m_pMF_NumberOfLines(0)
1121 bSupports3D = false;
1124 OUString CombiColumnLineChartDialogController::getName()
1126 return SCH_RESSTR(STR_TYPE_COMBI_COLUMN_LINE);
1129 Image CombiColumnLineChartDialogController::getImage( )
1131 return Image( SchResId( IMG_TYPE_COLUMN_LINE ) );
1134 const tTemplateServiceChartTypeParameterMap& CombiColumnLineChartDialogController::getTemplateMap() const
1136 static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
1137 tTemplateServiceChartTypeParameterMap
1138 ( "com.sun.star.chart2.template.ColumnWithLine" , ChartTypeParameter(1) )
1139 ( "com.sun.star.chart2.template.StackedColumnWithLine" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y) )
1141 return m_aTemplateMap;
1144 void CombiColumnLineChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& /*rParameter*/ )
1146 rSubTypeList.Clear();
1147 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_COLUMN_LINE))));
1148 rSubTypeList.InsertItem(2, Image(Bitmap(SchResId(BMP_COLUMN_LINE_STACKED))));
1150 rSubTypeList.SetItemText(1, SCH_RESSTR(STR_LINE_COLUMN));
1151 rSubTypeList.SetItemText(2, SCH_RESSTR(STR_LINE_STACKEDCOLUMN));
1154 void CombiColumnLineChartDialogController::showExtraControls( VclBuilderContainer* pParent )
1156 if (!m_pFT_NumberOfLines)
1158 pParent->get(m_pFT_NumberOfLines, "nolinesft");
1160 if (!m_pMF_NumberOfLines)
1162 pParent->get(m_pMF_NumberOfLines, "nolines");
1164 m_pMF_NumberOfLines->SetSpinSize(1);
1165 m_pMF_NumberOfLines->SetFirst( 1 );
1166 m_pMF_NumberOfLines->SetLast( 100 );
1167 m_pMF_NumberOfLines->SetMin( 1 );
1168 m_pMF_NumberOfLines->SetMax( 100 );
1170 m_pMF_NumberOfLines->SetModifyHdl( LINK( this, CombiColumnLineChartDialogController, ChangeLineCountHdl ) );
1173 m_pFT_NumberOfLines->Show();
1174 m_pMF_NumberOfLines->Show();
1177 void CombiColumnLineChartDialogController::hideExtraControls() const
1179 if(m_pFT_NumberOfLines)
1180 m_pFT_NumberOfLines->Hide();
1181 if(m_pMF_NumberOfLines)
1182 m_pMF_NumberOfLines->Hide();
1185 void CombiColumnLineChartDialogController::fillExtraControls( const ChartTypeParameter& /*rParameter*/
1186 , const uno::Reference< XChartDocument >& xChartModel
1187 , const uno::Reference< beans::XPropertySet >& xTemplateProps ) const
1189 if(!m_pMF_NumberOfLines)
1190 return;
1192 uno::Reference< frame::XModel > xModel( xChartModel, uno::UNO_QUERY );
1194 uno::Reference< XDiagram > xDiagram = ChartModelHelper::findDiagram( xModel );
1195 if(!xDiagram.is())
1196 return;
1198 sal_Int32 nNumLines = 0;
1200 if(xTemplateProps.is())
1204 xTemplateProps->getPropertyValue( "NumberOfLines" ) >>= nNumLines;
1206 catch( const uno::Exception & ex )
1208 ASSERT_EXCEPTION( ex );
1211 if( nNumLines < 0 )
1212 nNumLines = 0;
1213 m_pMF_NumberOfLines->SetValue( nNumLines );
1215 sal_Int32 nMaxLines = ChartModelHelper::getDataSeries( xModel ).size() - 1;
1216 if( nMaxLines < 0 )
1217 nMaxLines = 0;
1218 m_pMF_NumberOfLines->SetLast( nMaxLines );
1219 m_pMF_NumberOfLines->SetMax( nMaxLines );
1221 void CombiColumnLineChartDialogController::setTemplateProperties( const uno::Reference< beans::XPropertySet >& xTemplateProps ) const throw (uno::RuntimeException)
1223 if( xTemplateProps.is() )
1225 sal_Int32 nNumLines = static_cast< sal_Int32 >( m_pMF_NumberOfLines->GetValue());
1226 xTemplateProps->setPropertyValue( "NumberOfLines" , uno::makeAny(nNumLines) );
1230 IMPL_LINK_NOARG(CombiColumnLineChartDialogController, ChangeLineCountHdl)
1232 if( m_pChangeListener )
1233 m_pChangeListener->stateChanged(this);
1234 return 0;
1236 void CombiColumnLineChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
1238 rParameter.b3DLook = false;
1239 if(rParameter.eStackMode==GlobalStackMode_STACK_Z)
1240 rParameter.eStackMode = GlobalStackMode_NONE;
1242 switch( rParameter.nSubTypeIndex )
1244 case 2:
1245 rParameter.eStackMode=GlobalStackMode_STACK_Y;
1246 break;
1247 default:
1248 rParameter.eStackMode=GlobalStackMode_NONE;
1249 break;
1252 BubbleChartDialogController::BubbleChartDialogController()
1255 BubbleChartDialogController::~BubbleChartDialogController()
1258 OUString BubbleChartDialogController::getName()
1260 return SCH_RESSTR(STR_TYPE_BUBBLE);
1262 Image BubbleChartDialogController::getImage()
1264 return Image( SchResId( IMG_TYPE_BUBBLE ));
1266 const tTemplateServiceChartTypeParameterMap& BubbleChartDialogController::getTemplateMap() const
1268 static tTemplateServiceChartTypeParameterMap m_aTemplateMap =
1269 tTemplateServiceChartTypeParameterMap
1270 ( "com.sun.star.chart2.template.Bubble" , ChartTypeParameter(1,true) ) ;
1271 return m_aTemplateMap;
1273 void BubbleChartDialogController::fillSubTypeList( ValueSet& rSubTypeList, const ChartTypeParameter& /*rParameter*/ )
1275 rSubTypeList.Clear();
1276 rSubTypeList.InsertItem(1, Image(Bitmap(SchResId(BMP_BUBBLE_1))));
1278 rSubTypeList.SetItemText( 1, SCH_RESSTR(STR_BUBBLE_1) );
1280 void BubbleChartDialogController::adjustParameterToSubType( ChartTypeParameter& rParameter )
1282 rParameter.b3DLook = false;
1283 rParameter.eStackMode = GlobalStackMode_NONE;
1285 } //namespace chart
1287 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */