1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
22 #include <strings.hrc>
23 #include <bitmaps.hlst>
24 #include <ChartModelHelper.hxx>
25 #include <DiagramHelper.hxx>
26 #include <ControllerLockGuard.hxx>
27 #include <AxisHelper.hxx>
28 #include <unonames.hxx>
30 #include <com/sun/star/chart2/DataPointGeometry3D.hpp>
31 #include <com/sun/star/chart2/PieChartOffsetMode.hpp>
32 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
34 #include <svtools/controldims.hxx>
35 #include <svtools/valueset.hxx>
36 #include <vcl/bitmap.hxx>
37 #include <vcl/builder.hxx>
38 #include <vcl/image.hxx>
39 #include <vcl/svapp.hxx>
40 #include <vcl/settings.hxx>
42 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
43 #include <tools/diagnose_ex.h>
47 using namespace ::com::sun::star
;
48 using namespace ::com::sun::star::chart2
;
50 ChartTypeParameter::ChartTypeParameter()
52 , bXAxisWithValues( false )
56 , eStackMode( GlobalStackMode_NONE
)
57 , eCurveStyle( CurveStyle_LINES
)
58 , nCurveResolution(20)
60 , nGeometry3D(DataPointGeometry3D::CUBOID
)
61 , eThreeDLookScheme(ThreeDLookScheme_Realistic
)
62 , bSortByXValues(false)
63 , mbRoundedEdge(false)
67 ChartTypeParameter::ChartTypeParameter( sal_Int32 SubTypeIndex
, bool HasXAxisWithValues
68 , bool Is3DLook
, GlobalStackMode nStackMode
69 , bool HasSymbols
, bool HasLines
70 , CurveStyle nCurveStyle
)
71 : nSubTypeIndex( SubTypeIndex
)
72 , bXAxisWithValues( HasXAxisWithValues
)
74 , bSymbols( HasSymbols
)
76 , eStackMode( nStackMode
)
77 , eCurveStyle( nCurveStyle
)
78 , nCurveResolution(20)
80 , nGeometry3D(DataPointGeometry3D::CUBOID
)
81 , eThreeDLookScheme(ThreeDLookScheme_Realistic
)
82 , bSortByXValues(false)
83 , mbRoundedEdge(false)
87 bool ChartTypeParameter::mapsToSameService( const ChartTypeParameter
& rParameter
) const
89 return mapsToSimilarService( rParameter
, 0 );
91 bool ChartTypeParameter::mapsToSimilarService( const ChartTypeParameter
& rParameter
, sal_Int32 nTheHigherTheLess
) const
94 if(nTheHigherTheLess
>nMax
)
96 if( bXAxisWithValues
!=rParameter
.bXAxisWithValues
)
97 return nTheHigherTheLess
>nMax
-1;
98 if( b3DLook
!=rParameter
.b3DLook
)
99 return nTheHigherTheLess
>nMax
-2;
100 if( eStackMode
!=rParameter
.eStackMode
)
101 return nTheHigherTheLess
>nMax
-3;
102 if( nSubTypeIndex
!=rParameter
.nSubTypeIndex
)
103 return nTheHigherTheLess
>nMax
-4;
104 if( bSymbols
!=rParameter
.bSymbols
)
105 return nTheHigherTheLess
>nMax
-5;
106 if( bLines
!=rParameter
.bLines
)
107 return nTheHigherTheLess
>nMax
-6;
111 ChartTypeDialogController::ChartTypeDialogController()
112 : bSupportsXAxisWithValues(false)
117 ChartTypeDialogController::~ChartTypeDialogController()
120 Image
ChartTypeDialogController::getImage()
124 bool ChartTypeDialogController::isSubType( const OUString
& rServiceName
)
126 const tTemplateServiceChartTypeParameterMap
& rTemplateMap
= getTemplateMap();
127 tTemplateServiceChartTypeParameterMap::const_iterator
aIt( rTemplateMap
.find( rServiceName
));
128 return aIt
!= rTemplateMap
.end();
130 ChartTypeParameter
ChartTypeDialogController::getChartTypeParameterForService(
131 const OUString
& rServiceName
132 , const uno::Reference
< beans::XPropertySet
>& xTemplateProps
)
134 ChartTypeParameter aRet
;
135 const tTemplateServiceChartTypeParameterMap
& rTemplateMap
= getTemplateMap();
136 tTemplateServiceChartTypeParameterMap::const_iterator
aIt( rTemplateMap
.find( rServiceName
));
137 if( aIt
!= rTemplateMap
.end())
138 aRet
= (*aIt
).second
;
139 if( xTemplateProps
.is() )
143 xTemplateProps
->getPropertyValue( CHART_UNONAME_CURVE_STYLE
) >>= aRet
.eCurveStyle
;
144 xTemplateProps
->getPropertyValue( CHART_UNONAME_CURVE_RESOLUTION
) >>= aRet
.nCurveResolution
;
145 xTemplateProps
->getPropertyValue( CHART_UNONAME_SPLINE_ORDER
) >>= aRet
.nSplineOrder
;
147 catch( uno::Exception
& ex
)
149 //not all templates need to support CurveStyle, CurveResolution or SplineOrder
150 ex
.Context
.is();//to have debug information without compilation warnings
155 xTemplateProps
->getPropertyValue( "Geometry3D" ) >>= aRet
.nGeometry3D
;
157 catch( uno::Exception
& ex
)
159 //not all templates need to support Geometry3D
160 ex
.Context
.is();//to have debug information without compilation warnings
165 xTemplateProps
->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE
) >>= aRet
.mbRoundedEdge
;
167 catch ( const uno::Exception
& ) {}
171 void ChartTypeDialogController::adjustSubTypeAndEnableControls( ChartTypeParameter
& /*rParameter*/ )
174 void ChartTypeDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
176 switch( rParameter
.nSubTypeIndex
)
179 rParameter
.eStackMode
=GlobalStackMode_STACK_Y
;
182 rParameter
.eStackMode
=GlobalStackMode_STACK_Y_PERCENT
;
185 rParameter
.eStackMode
=GlobalStackMode_STACK_Z
;
188 rParameter
.eStackMode
=GlobalStackMode_NONE
;
192 void ChartTypeDialogController::adjustParameterToMainType( ChartTypeParameter
& rParameter
)
194 bool bFoundSomeMatch
=false;
196 rParameter
.bXAxisWithValues
= bSupportsXAxisWithValues
;
197 if( rParameter
.b3DLook
&& !bSupports3D
)
198 rParameter
.b3DLook
= false;
199 if(!rParameter
.b3DLook
&& rParameter
.eStackMode
==GlobalStackMode_STACK_Z
)
200 rParameter
.eStackMode
= GlobalStackMode_NONE
;
202 const tTemplateServiceChartTypeParameterMap
& rMap
= getTemplateMap();
203 for( sal_Int32 nMatchPrecision
=0; nMatchPrecision
<7 && !bFoundSomeMatch
; nMatchPrecision
++ )
205 for (auto const& elem
: rMap
)
207 if( rParameter
.mapsToSimilarService( elem
.second
, nMatchPrecision
) )
210 ThreeDLookScheme aScheme
= rParameter
.eThreeDLookScheme
;
211 sal_Int32 nCurveResolution
= rParameter
.nCurveResolution
;
212 sal_Int32 nSplineOrder
= rParameter
.nSplineOrder
;
213 CurveStyle eCurveStyle
= rParameter
.eCurveStyle
;
214 sal_Int32 nGeometry3D
= rParameter
.nGeometry3D
;
215 bool bSortByXValues
= rParameter
.bSortByXValues
;
216 bool bRoundedEdge
= rParameter
.mbRoundedEdge
;
218 rParameter
= elem
.second
;
220 //some values should not be changed with charttype
221 rParameter
.eThreeDLookScheme
= aScheme
;
222 rParameter
.nCurveResolution
= nCurveResolution
;
223 rParameter
.nSplineOrder
=nSplineOrder
;
224 rParameter
.eCurveStyle
= eCurveStyle
;
225 rParameter
.nGeometry3D
= nGeometry3D
;
226 rParameter
.bSortByXValues
= bSortByXValues
;
227 rParameter
.mbRoundedEdge
= bRoundedEdge
;
229 bFoundSomeMatch
= true;
237 rParameter
= (*rMap
.begin()).second
;
239 rParameter
= ChartTypeParameter();
242 OUString
ChartTypeDialogController::getServiceNameForParameter( const ChartTypeParameter
& rParameter
) const
244 ChartTypeParameter
aParameter(rParameter
);
245 if( aParameter
.bXAxisWithValues
)
246 aParameter
.eStackMode
= GlobalStackMode_NONE
;
247 if(!aParameter
.b3DLook
&& aParameter
.eStackMode
==GlobalStackMode_STACK_Z
)
248 aParameter
.eStackMode
= GlobalStackMode_NONE
;
249 const tTemplateServiceChartTypeParameterMap
& rMap
= getTemplateMap();
250 for (auto const& elem
: rMap
)
252 if( aParameter
.mapsToSameService(elem
.second
) )
256 OSL_FAIL( "ChartType not implemented yet - use fallback to similar type" );
257 for( sal_Int32 nMatchPrecision
=1; nMatchPrecision
<8; nMatchPrecision
++ )
259 for (auto const& elem
: rMap
)
261 if( aParameter
.mapsToSimilarService(elem
.second
, nMatchPrecision
) )
267 uno::Reference
< XChartTypeTemplate
> ChartTypeDialogController::getCurrentTemplate(
268 const ChartTypeParameter
& rParameter
269 , const uno::Reference
< lang::XMultiServiceFactory
>& xTemplateManager
) const
271 uno::Reference
< XChartTypeTemplate
> xTemplate(nullptr);
273 OUString
aServiceName( getServiceNameForParameter( rParameter
) );
274 if(!aServiceName
.isEmpty())
276 xTemplate
.set( xTemplateManager
->createInstance( aServiceName
), uno::UNO_QUERY
);
279 uno::Reference
< beans::XPropertySet
> xTemplateProps( xTemplate
, uno::UNO_QUERY
);
280 if(xTemplateProps
.is())
284 xTemplateProps
->setPropertyValue( CHART_UNONAME_CURVE_STYLE
, uno::Any(rParameter
.eCurveStyle
) );
285 xTemplateProps
->setPropertyValue( CHART_UNONAME_CURVE_RESOLUTION
, uno::Any(rParameter
.nCurveResolution
) );
286 xTemplateProps
->setPropertyValue( CHART_UNONAME_SPLINE_ORDER
, uno::Any(rParameter
.nSplineOrder
) );
288 catch( uno::Exception
& ex
)
290 //not all templates need to support CurveStyle, CurveResolution or SplineOrder
291 ex
.Context
.is();//to have debug information without compilation warnings
295 xTemplateProps
->setPropertyValue( "Geometry3D" , uno::Any(rParameter
.nGeometry3D
) );
297 catch( uno::Exception
& ex
)
299 //not all templates need to support Geometry3D
300 ex
.Context
.is();//to have debug information without compilation warnings
305 xTemplateProps
->setPropertyValue(CHART_UNONAME_ROUNDED_EDGE
, uno::Any(rParameter
.mbRoundedEdge
));
307 catch ( const uno::Exception
& )
313 setTemplateProperties( xTemplateProps
);
315 catch( const uno::Exception
& )
317 DBG_UNHANDLED_EXCEPTION("chart2");
325 void ChartTypeDialogController::commitToModel( const ChartTypeParameter
& rParameter
326 , const uno::Reference
< XChartDocument
>& xChartModel
)
328 uno::Reference
< lang::XMultiServiceFactory
> xTemplateManager( xChartModel
->getChartTypeManager(), uno::UNO_QUERY
);
329 uno::Reference
< XChartTypeTemplate
> xTemplate( getCurrentTemplate( rParameter
, xTemplateManager
) );
332 uno::Reference
< frame::XModel
> xModel( xChartModel
, uno::UNO_QUERY
);
334 // locked controllers
335 ControllerLockGuardUNO
aCtrlLockGuard( xModel
);
336 uno::Reference
< XDiagram
> xDiagram
= ChartModelHelper::findDiagram( xModel
);
337 DiagramHelper::tTemplateWithServiceName
aTemplateWithService(
338 DiagramHelper::getTemplateForDiagram( xDiagram
, xTemplateManager
));
339 if( aTemplateWithService
.first
.is())
340 aTemplateWithService
.first
->resetStyles( xDiagram
);
341 xTemplate
->changeDiagram( xDiagram
);
342 if( AllSettings::GetMathLayoutRTL() )
343 AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram
, 0 ) );
344 if( rParameter
.b3DLook
)
345 ThreeDHelper::setScheme( xDiagram
, rParameter
.eThreeDLookScheme
);
347 uno::Reference
<beans::XPropertySet
> xDiaProp(xDiagram
, uno::UNO_QUERY
);
350 xDiaProp
->setPropertyValue(CHART_UNONAME_SORT_BY_XVALUES
, uno::Any(rParameter
.bSortByXValues
));
354 void ChartTypeDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& /*rParameter*/ )
356 rSubTypeList
.Clear();
358 bool ChartTypeDialogController::shouldShow_3DLookControl() const
362 bool ChartTypeDialogController::shouldShow_StackingControl() const
366 bool ChartTypeDialogController::shouldShow_DeepStackingControl() const
370 bool ChartTypeDialogController::shouldShow_SplineControl() const
374 bool ChartTypeDialogController::shouldShow_GeometryControl() const
378 bool ChartTypeDialogController::shouldShow_SortByXValuesResourceGroup() const
383 bool ChartTypeDialogController::shouldShow_GL3DResourceGroup() const
388 void ChartTypeDialogController::showExtraControls( VclBuilderContainer
* /*pParent*/ )
391 void ChartTypeDialogController::hideExtraControls() const
394 void ChartTypeDialogController::fillExtraControls( const ChartTypeParameter
& /*rParameter*/
395 , const uno::Reference
< XChartDocument
>& /*xChartModel*/
396 , const uno::Reference
< beans::XPropertySet
>& /*xTemplateProps*/ ) const
399 void ChartTypeDialogController::setTemplateProperties( const uno::Reference
< beans::XPropertySet
>& /*xTemplateProps*/ ) const
403 ColumnOrBarChartDialogController_Base::ColumnOrBarChartDialogController_Base()
404 : ChartTypeDialogController()
407 ColumnOrBarChartDialogController_Base::~ColumnOrBarChartDialogController_Base()
410 bool ColumnOrBarChartDialogController_Base::shouldShow_3DLookControl() const
414 bool ColumnOrBarChartDialogController_Base::shouldShow_GeometryControl() const
418 void ColumnOrBarChartDialogController_Base::adjustSubTypeAndEnableControls( ChartTypeParameter
& rParameter
)
420 if(rParameter
.nSubTypeIndex
>3 && !rParameter
.b3DLook
)
422 rParameter
.nSubTypeIndex
=1;
425 ColumnChartDialogController::ColumnChartDialogController()
428 ColumnChartDialogController::~ColumnChartDialogController()
431 OUString
ColumnChartDialogController::getName()
433 return SchResId( STR_TYPE_COLUMN
);
436 Image
ColumnChartDialogController::getImage()
438 return Image(BitmapEx(BMP_TYPE_COLUMN
));
441 const tTemplateServiceChartTypeParameterMap
& ColumnChartDialogController::getTemplateMap() const
443 static tTemplateServiceChartTypeParameterMap s_aTemplateMap
{
444 {"com.sun.star.chart2.template.Column" , ChartTypeParameter(1,false,false,GlobalStackMode_NONE
)},
445 {"com.sun.star.chart2.template.StackedColumn" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y
)},
446 {"com.sun.star.chart2.template.PercentStackedColumn" , ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT
)},
447 {"com.sun.star.chart2.template.ThreeDColumnFlat" , ChartTypeParameter(1,false,true,GlobalStackMode_NONE
)},
448 {"com.sun.star.chart2.template.StackedThreeDColumnFlat" , ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y
)},
449 {"com.sun.star.chart2.template.PercentStackedThreeDColumnFlat" , ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT
)},
450 {"com.sun.star.chart2.template.ThreeDColumnDeep" , ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z
)}};
451 return s_aTemplateMap
;
453 void ColumnChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
)
455 rSubTypeList
.Clear();
457 if( rParameter
.b3DLook
)
459 switch(rParameter
.nGeometry3D
)
461 case DataPointGeometry3D::CYLINDER
:
462 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_SAEULE_3D_1
)));
463 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_SAEULE_3D_2
)));
464 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_SAEULE_3D_3
)));
465 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_SAEULE_3D_4
)));
467 case DataPointGeometry3D::CONE
:
468 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_KEGEL_3D_1
)));
469 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_KEGEL_3D_2
)));
470 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_KEGEL_3D_3
)));
471 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_KEGEL_3D_4
)));
473 case DataPointGeometry3D::PYRAMID
:
474 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_PYRAMID_3D_1
)));
475 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_PYRAMID_3D_2
)));
476 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_PYRAMID_3D_3
)));
477 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_PYRAMID_3D_4
)));
479 default: //DataPointGeometry3D::CUBOID:
480 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_COLUMNS_3D_1
)));
481 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_COLUMNS_3D_2
)));
482 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_COLUMNS_3D_3
)));
483 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_COLUMNS_3D
)));
489 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_COLUMNS_2D_1
)));
490 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_COLUMNS_2D_2
)));
491 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_COLUMNS_2D_3
)));
494 rSubTypeList
.SetItemText( 1, SchResId( STR_NORMAL
) );
495 rSubTypeList
.SetItemText( 2, SchResId( STR_STACKED
) );
496 rSubTypeList
.SetItemText( 3, SchResId( STR_PERCENT
) );
497 rSubTypeList
.SetItemText( 4, SchResId( STR_DEEP
) );
500 BarChartDialogController::BarChartDialogController()
504 BarChartDialogController::~BarChartDialogController()
508 OUString
BarChartDialogController::getName()
510 return SchResId( STR_TYPE_BAR
);
513 Image
BarChartDialogController::getImage()
515 return Image(BitmapEx(BMP_TYPE_BAR
));
518 const tTemplateServiceChartTypeParameterMap
& BarChartDialogController::getTemplateMap() const
520 static tTemplateServiceChartTypeParameterMap s_aTemplateMap
{
521 {"com.sun.star.chart2.template.Bar" , ChartTypeParameter(1,false,false,GlobalStackMode_NONE
)},
522 {"com.sun.star.chart2.template.StackedBar" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y
)},
523 {"com.sun.star.chart2.template.PercentStackedBar" , ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT
)},
524 {"com.sun.star.chart2.template.ThreeDBarFlat" , ChartTypeParameter(1,false,true,GlobalStackMode_NONE
)},
525 {"com.sun.star.chart2.template.StackedThreeDBarFlat" , ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y
)},
526 {"com.sun.star.chart2.template.PercentStackedThreeDBarFlat" , ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT
)},
527 {"com.sun.star.chart2.template.ThreeDBarDeep" , ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z
)}};
528 return s_aTemplateMap
;
530 void BarChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
)
532 rSubTypeList
.Clear();
534 if( rParameter
.b3DLook
)
536 switch(rParameter
.nGeometry3D
)
538 case DataPointGeometry3D::CYLINDER
:
539 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_ROEHRE_3D_1
)));
540 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_ROEHRE_3D_2
)));
541 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_ROEHRE_3D_3
)));
542 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_ROEHRE_3D_4
)));
544 case DataPointGeometry3D::CONE
:
545 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_KEGELQ_3D_1
)));
546 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_KEGELQ_3D_2
)));
547 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_KEGELQ_3D_3
)));
548 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_KEGELQ_3D_4
)));
550 case DataPointGeometry3D::PYRAMID
:
551 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_PYRAMIDQ_3D_1
)));
552 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_PYRAMIDQ_3D_2
)));
553 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_PYRAMIDQ_3D_3
)));
554 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_PYRAMIDQ_3D_4
)));
556 default: //DataPointGeometry3D::CUBOID:
557 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_BARS_3D_1
)));
558 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_BARS_3D_2
)));
559 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_BARS_3D_3
)));
560 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_BARS_3D
)));
566 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_BARS_2D_1
)));
567 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_BARS_2D_2
)));
568 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_BARS_2D_3
)));
570 rSubTypeList
.SetItemText( 1, SchResId( STR_NORMAL
) );
571 rSubTypeList
.SetItemText( 2, SchResId( STR_STACKED
) );
572 rSubTypeList
.SetItemText( 3, SchResId( STR_PERCENT
) );
573 rSubTypeList
.SetItemText( 4, SchResId( STR_DEEP
) );
576 PieChartDialogController::PieChartDialogController()
579 PieChartDialogController::~PieChartDialogController()
582 OUString
PieChartDialogController::getName()
584 return SchResId( STR_TYPE_PIE
);
586 Image
PieChartDialogController::getImage()
588 return Image(BitmapEx(BMP_TYPE_PIE
));
590 const tTemplateServiceChartTypeParameterMap
& PieChartDialogController::getTemplateMap() const
592 static tTemplateServiceChartTypeParameterMap s_aTemplateMap
{
593 {"com.sun.star.chart2.template.Pie" , ChartTypeParameter(1,false,false)},
594 {"com.sun.star.chart2.template.PieAllExploded" , ChartTypeParameter(2,false,false)},
595 {"com.sun.star.chart2.template.Donut" , ChartTypeParameter(3,false,false)},
596 {"com.sun.star.chart2.template.DonutAllExploded" , ChartTypeParameter(4,false,false)},
597 {"com.sun.star.chart2.template.ThreeDPie" , ChartTypeParameter(1,false,true)},
598 {"com.sun.star.chart2.template.ThreeDPieAllExploded" , ChartTypeParameter(2,false,true)},
599 {"com.sun.star.chart2.template.ThreeDDonut" , ChartTypeParameter(3,false,true)},
600 {"com.sun.star.chart2.template.ThreeDDonutAllExploded" , ChartTypeParameter(4,false,true)}};
601 return s_aTemplateMap
;
603 void PieChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
)
605 rSubTypeList
.Clear();
607 if( rParameter
.b3DLook
)
609 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_CIRCLES_3D
)));
610 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_CIRCLES_3D_EXPLODED
)));
611 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_DONUT_3D
)));
612 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_DONUT_3D_EXPLODED
)));
616 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_CIRCLES_2D
)));
617 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_CIRCLES_2D_EXPLODED
)));
618 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_DONUT_2D
)));
619 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_DONUT_2D_EXPLODED
)));
621 rSubTypeList
.SetItemText( 1, SchResId( STR_NORMAL
) );
622 rSubTypeList
.SetItemText( 2, SchResId( STR_PIE_EXPLODED
) );
623 rSubTypeList
.SetItemText( 3, SchResId( STR_DONUT
) );
624 rSubTypeList
.SetItemText( 4, SchResId( STR_DONUT_EXPLODED
) );
627 bool PieChartDialogController::shouldShow_3DLookControl() const
631 void PieChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
633 if(rParameter
.eStackMode
==GlobalStackMode_STACK_Z
)
634 rParameter
.eStackMode
= GlobalStackMode_NONE
;
636 LineChartDialogController::LineChartDialogController()
639 LineChartDialogController::~LineChartDialogController()
642 OUString
LineChartDialogController::getName()
644 return SchResId( STR_TYPE_LINE
);
647 Image
LineChartDialogController::getImage()
649 return Image(BitmapEx(BMP_TYPE_LINE
));
652 const tTemplateServiceChartTypeParameterMap
& LineChartDialogController::getTemplateMap() const
654 static tTemplateServiceChartTypeParameterMap s_aTemplateMap
{
655 {"com.sun.star.chart2.template.Symbol" , ChartTypeParameter(1,false,false,GlobalStackMode_NONE
,true,false)},
656 {"com.sun.star.chart2.template.StackedSymbol" , ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y
,true,false)},
657 {"com.sun.star.chart2.template.PercentStackedSymbol" , ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y_PERCENT
,true,false)},
658 {"com.sun.star.chart2.template.LineSymbol" , ChartTypeParameter(2,false,false,GlobalStackMode_NONE
,true,true)},
659 {"com.sun.star.chart2.template.StackedLineSymbol" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y
,true,true)},
660 {"com.sun.star.chart2.template.PercentStackedLineSymbol" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y_PERCENT
,true,true)},
661 {"com.sun.star.chart2.template.Line" , ChartTypeParameter(3,false,false,GlobalStackMode_NONE
,false,true)},
662 {"com.sun.star.chart2.template.StackedLine" , ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y
,false,true)},
663 {"com.sun.star.chart2.template.PercentStackedLine" , ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT
,false,true)},
664 {"com.sun.star.chart2.template.StackedThreeDLine" , ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Y
,false,true)},
665 {"com.sun.star.chart2.template.PercentStackedThreeDLine" , ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Y_PERCENT
,false,true)},
666 {"com.sun.star.chart2.template.ThreeDLineDeep" , ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z
,false,true)}};
667 return s_aTemplateMap
;
669 void LineChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
)
671 rSubTypeList
.Clear();
673 switch( rParameter
.eCurveStyle
)
675 case CurveStyle_CUBIC_SPLINES
:
676 case CurveStyle_B_SPLINES
:
677 if( rParameter
.eStackMode
== GlobalStackMode_NONE
|| rParameter
.eStackMode
== GlobalStackMode_STACK_Z
)
679 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_POINTS_XCATEGORY
)));
680 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_LINE_P_XCATEGORY_SMOOTH
)));
681 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_LINE_O_XCATEGORY_SMOOTH
)));
682 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_LINE3D_XCATEGORY_SMOOTH
)));
686 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_POINTS_STACKED
)));
687 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_LINE_P_STACKED_SMOOTH
)));
688 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_LINE_O_STACKED_SMOOTH
)));
689 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_LINE3D_STACKED_SMOOTH
)));
692 case CurveStyle_STEP_START
:
693 case CurveStyle_STEP_END
:
694 case CurveStyle_STEP_CENTER_X
:
695 case CurveStyle_STEP_CENTER_Y
:
696 if( rParameter
.eStackMode
== GlobalStackMode_NONE
|| rParameter
.eStackMode
== GlobalStackMode_STACK_Z
)
698 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_POINTS_XCATEGORY
)));
699 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_LINE_P_XCATEGORY_STEPPED
)));
700 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_LINE_O_XCATEGORY_STEPPED
)));
701 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_LINE3D_XCATEGORY_STEPPED
)));
705 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_POINTS_STACKED
)));
706 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_LINE_P_STACKED_STEPPED
)));
707 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_LINE_O_STACKED_STEPPED
)));
708 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_LINE3D_STACKED_STEPPED
)));
711 default: // includes CurveStyle_LINES
713 if( rParameter
.eStackMode
== GlobalStackMode_NONE
|| rParameter
.eStackMode
== GlobalStackMode_STACK_Z
)
715 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_POINTS_XCATEGORY
)));
716 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_LINE_P_XCATEGORY
)));
717 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_LINE_O_XCATEGORY
)));
718 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_LINE3D_XCATEGORY
)));
722 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_POINTS_STACKED
)));
723 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_LINE_P_STACKED
)));
724 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_LINE_O_STACKED
)));
725 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_LINE3D_STACKED
)));
729 rSubTypeList
.SetItemText( 1, SchResId( STR_POINTS_ONLY
) );
730 rSubTypeList
.SetItemText( 2, SchResId( STR_POINTS_AND_LINES
) );
731 rSubTypeList
.SetItemText( 3, SchResId( STR_LINES_ONLY
) );
732 rSubTypeList
.SetItemText( 4, SchResId( STR_LINES_3D
) );
734 bool LineChartDialogController::shouldShow_StackingControl() const
738 bool LineChartDialogController::shouldShow_DeepStackingControl() const
742 bool LineChartDialogController::shouldShow_SplineControl() const
746 void LineChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
748 rParameter
.b3DLook
= false;
750 switch( rParameter
.nSubTypeIndex
)
753 rParameter
.bSymbols
= true;
754 rParameter
.bLines
= true;
757 rParameter
.bSymbols
= false;
758 rParameter
.bLines
= true;
761 rParameter
.bSymbols
= false;
762 rParameter
.bLines
= true;
763 rParameter
.b3DLook
= true;
764 if( rParameter
.eStackMode
== GlobalStackMode_NONE
)
765 rParameter
.eStackMode
= GlobalStackMode_STACK_Z
;
768 rParameter
.bSymbols
= true;
769 rParameter
.bLines
= false;
773 if(!rParameter
.b3DLook
&& rParameter
.eStackMode
== GlobalStackMode_STACK_Z
)
774 rParameter
.eStackMode
= GlobalStackMode_NONE
;
776 void LineChartDialogController::adjustParameterToMainType( ChartTypeParameter
& rParameter
)
778 if( rParameter
.b3DLook
&& rParameter
.eStackMode
== GlobalStackMode_NONE
)
779 rParameter
.eStackMode
= GlobalStackMode_STACK_Z
;
781 ChartTypeDialogController::adjustParameterToMainType( rParameter
);
784 XYChartDialogController::XYChartDialogController()
786 bSupportsXAxisWithValues
= true;
789 XYChartDialogController::~XYChartDialogController()
793 OUString
XYChartDialogController::getName()
795 return SchResId( STR_TYPE_XY
);
798 Image
XYChartDialogController::getImage()
800 return Image(BitmapEx(BMP_TYPE_XY
));
803 const tTemplateServiceChartTypeParameterMap
& XYChartDialogController::getTemplateMap() const
805 static tTemplateServiceChartTypeParameterMap s_aTemplateMap
{
806 {"com.sun.star.chart2.template.ScatterSymbol" , ChartTypeParameter(1,true,false,GlobalStackMode_NONE
,true,false)},
807 {"com.sun.star.chart2.template.ScatterLineSymbol" , ChartTypeParameter(2,true,false,GlobalStackMode_NONE
,true,true)},
808 {"com.sun.star.chart2.template.ScatterLine" , ChartTypeParameter(3,true,false,GlobalStackMode_NONE
,false,true)},
809 {"com.sun.star.chart2.template.ThreeDScatter" , ChartTypeParameter(4,true,true,GlobalStackMode_NONE
,false,true)}};
810 return s_aTemplateMap
;
813 void XYChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
)
815 rSubTypeList
.Clear();
817 switch (rParameter
.eCurveStyle
)
819 case CurveStyle_CUBIC_SPLINES
:
820 case CurveStyle_B_SPLINES
:
822 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_POINTS_XVALUES
)));
823 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_LINE_P_XVALUES_SMOOTH
)));
824 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_LINE_O_XVALUES_SMOOTH
)));
825 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_LINE3D_XVALUES_SMOOTH
)));
828 case CurveStyle_STEP_START
:
829 case CurveStyle_STEP_END
:
830 case CurveStyle_STEP_CENTER_X
:
831 case CurveStyle_STEP_CENTER_Y
:
833 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_POINTS_XVALUES
)));
834 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_LINE_P_XVALUES_STEPPED
)));
835 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_LINE_O_XVALUES_STEPPED
)));
836 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_LINE3D_XVALUES_STEPPED
)));
839 default: // includes CurveStyle_LINES
840 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_POINTS_XVALUES
)));
841 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_LINE_P_XVALUES
)));
842 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_LINE_O_XVALUES
)));
843 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_LINE3D_XVALUES
)));
846 rSubTypeList
.SetItemText( 1, SchResId( STR_POINTS_ONLY
) );
847 rSubTypeList
.SetItemText( 2, SchResId( STR_POINTS_AND_LINES
) );
848 rSubTypeList
.SetItemText( 3, SchResId( STR_LINES_ONLY
) );
849 rSubTypeList
.SetItemText( 4, SchResId( STR_LINES_3D
) );
851 bool XYChartDialogController::shouldShow_SplineControl() const
855 bool XYChartDialogController::shouldShow_SortByXValuesResourceGroup() const
859 void XYChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
861 rParameter
.eStackMode
=GlobalStackMode_NONE
;
862 rParameter
.b3DLook
= false;
863 rParameter
.bXAxisWithValues
= true;
865 switch( rParameter
.nSubTypeIndex
)
868 rParameter
.bSymbols
= true;
869 rParameter
.bLines
= true;
872 rParameter
.bSymbols
= false;
873 rParameter
.bLines
= true;
876 rParameter
.bSymbols
= false;
877 rParameter
.bLines
= true;
878 rParameter
.b3DLook
= true;
879 rParameter
.eStackMode
=GlobalStackMode_STACK_Z
;
882 rParameter
.bSymbols
= true;
883 rParameter
.bLines
= false;
888 AreaChartDialogController::AreaChartDialogController()
892 AreaChartDialogController::~AreaChartDialogController()
896 OUString
AreaChartDialogController::getName()
898 return SchResId(STR_TYPE_AREA
);
901 Image
AreaChartDialogController::getImage()
903 return Image(BitmapEx(BMP_TYPE_AREA
));
906 bool AreaChartDialogController::shouldShow_3DLookControl() const
911 const tTemplateServiceChartTypeParameterMap
& AreaChartDialogController::getTemplateMap() const
913 static tTemplateServiceChartTypeParameterMap s_aTemplateMap
{
914 {"com.sun.star.chart2.template.Area" , ChartTypeParameter(1,false,false,GlobalStackMode_NONE
)},
915 {"com.sun.star.chart2.template.ThreeDArea" , ChartTypeParameter(1,false,true,GlobalStackMode_STACK_Z
)},
916 {"com.sun.star.chart2.template.StackedArea" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y
)},
917 {"com.sun.star.chart2.template.StackedThreeDArea" , ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y
)},
918 {"com.sun.star.chart2.template.PercentStackedArea" , ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT
)},
919 {"com.sun.star.chart2.template.PercentStackedThreeDArea" , ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT
)}};
920 return s_aTemplateMap
;
923 void AreaChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
)
925 rSubTypeList
.Clear();
927 if( rParameter
.b3DLook
)
929 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_AREAS_3D
)));
930 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_AREAS_3D_1
)));
931 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_AREAS_3D_2
)));
935 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_AREAS_2D_1
)));
936 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_AREAS_2D
)));
937 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_AREAS_2D_3
)));
940 rSubTypeList
.SetItemText( 1, SchResId( rParameter
.b3DLook
? STR_DEEP
: STR_NORMAL
) );
941 rSubTypeList
.SetItemText( 2, SchResId( STR_STACKED
) );
942 rSubTypeList
.SetItemText( 3, SchResId( STR_PERCENT
) );
944 void AreaChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
946 rParameter
.eCurveStyle
= CurveStyle_LINES
;
948 if( rParameter
.nSubTypeIndex
>3 )
949 rParameter
.nSubTypeIndex
= 1;
950 switch( rParameter
.nSubTypeIndex
)
953 rParameter
.eStackMode
=GlobalStackMode_STACK_Y
;
956 rParameter
.eStackMode
=GlobalStackMode_STACK_Y_PERCENT
;
959 if( rParameter
.b3DLook
)
960 rParameter
.eStackMode
=GlobalStackMode_STACK_Z
;
962 rParameter
.eStackMode
=GlobalStackMode_NONE
;
966 void AreaChartDialogController::adjustParameterToMainType( ChartTypeParameter
& rParameter
)
968 if( rParameter
.b3DLook
&& rParameter
.eStackMode
== GlobalStackMode_NONE
)
969 rParameter
.eStackMode
= GlobalStackMode_STACK_Z
;
971 ChartTypeDialogController::adjustParameterToMainType( rParameter
);
974 NetChartDialogController::NetChartDialogController()
979 NetChartDialogController::~NetChartDialogController()
983 OUString
NetChartDialogController::getName()
985 return SchResId(STR_TYPE_NET
);
988 Image
NetChartDialogController::getImage()
990 return Image(BitmapEx(BMP_TYPE_NET
));
993 bool NetChartDialogController::shouldShow_StackingControl() const
998 const tTemplateServiceChartTypeParameterMap
& NetChartDialogController::getTemplateMap() const
1000 static tTemplateServiceChartTypeParameterMap s_aTemplateMap
{
1001 //@todo need templates with symbols only
1002 {"com.sun.star.chart2.template.NetSymbol" , ChartTypeParameter(1,false,false,GlobalStackMode_NONE
,true,false)},
1003 {"com.sun.star.chart2.template.StackedNetSymbol" , ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y
,true,false)},
1004 {"com.sun.star.chart2.template.PercentStackedNetSymbol" ,ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y_PERCENT
,true,false)},
1006 {"com.sun.star.chart2.template.Net" , ChartTypeParameter(2,false,false,GlobalStackMode_NONE
,true,true)},
1007 {"com.sun.star.chart2.template.StackedNet" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y
,true,true)},
1008 {"com.sun.star.chart2.template.PercentStackedNet" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y_PERCENT
,true,true)},
1010 {"com.sun.star.chart2.template.NetLine" , ChartTypeParameter(3,false,false,GlobalStackMode_NONE
,false,true)},
1011 {"com.sun.star.chart2.template.StackedNetLine" , ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y
,false,true)},
1012 {"com.sun.star.chart2.template.PercentStackedNetLine" , ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT
,false,true)},
1014 {"com.sun.star.chart2.template.FilledNet" , ChartTypeParameter(4,false,false,GlobalStackMode_NONE
,false,false)},
1015 {"com.sun.star.chart2.template.StackedFilledNet" , ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y
,false,false)},
1016 {"com.sun.star.chart2.template.PercentStackedFilledNet" ,ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y_PERCENT
,false,false)}};
1017 return s_aTemplateMap
;
1019 void NetChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& rParameter
)
1021 rSubTypeList
.Clear();
1023 if( rParameter
.eStackMode
== GlobalStackMode_NONE
)
1025 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_NET_SYMB
)));
1026 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_NET_LINESYMB
)));
1027 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_NET
)));
1028 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_NET_FILL
)));
1032 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_NET_SYMB_STACK
)));
1033 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_NET_LINESYMB_STACK
)));
1034 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_NET_STACK
)));
1035 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_NET_FILL_STACK
)));
1038 rSubTypeList
.SetItemText( 1, SchResId( STR_POINTS_ONLY
) );
1039 rSubTypeList
.SetItemText( 2, SchResId( STR_POINTS_AND_LINES
) );
1040 rSubTypeList
.SetItemText( 3, SchResId( STR_LINES_ONLY
) );
1041 rSubTypeList
.SetItemText( 4, SchResId( STR_FILLED
) );
1043 void NetChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
1045 rParameter
.b3DLook
= false;
1046 if(rParameter
.eStackMode
==GlobalStackMode_STACK_Z
)
1047 rParameter
.eStackMode
= GlobalStackMode_NONE
;
1049 switch( rParameter
.nSubTypeIndex
)
1052 rParameter
.bSymbols
= true;
1053 rParameter
.bLines
= true;
1056 rParameter
.bSymbols
= false;
1057 rParameter
.bLines
= true;
1060 rParameter
.bSymbols
= false;
1061 rParameter
.bLines
= false;
1064 rParameter
.bSymbols
= true;
1065 rParameter
.bLines
= false;
1069 StockChartDialogController::StockChartDialogController()
1071 bSupports3D
= false;
1074 StockChartDialogController::~StockChartDialogController()
1078 OUString
StockChartDialogController::getName()
1080 return SchResId(STR_TYPE_STOCK
);
1083 Image
StockChartDialogController::getImage()
1085 return Image(BitmapEx(BMP_TYPE_STOCK
));
1088 const tTemplateServiceChartTypeParameterMap
& StockChartDialogController::getTemplateMap() const
1090 static tTemplateServiceChartTypeParameterMap s_aTemplateMap
{
1091 {"com.sun.star.chart2.template.StockLowHighClose" , ChartTypeParameter(1)},
1092 {"com.sun.star.chart2.template.StockOpenLowHighClose" , ChartTypeParameter(2)},
1093 {"com.sun.star.chart2.template.StockVolumeLowHighClose" , ChartTypeParameter(3)},
1094 {"com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ,ChartTypeParameter(4)}};
1095 return s_aTemplateMap
;
1098 void StockChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& /*rParameter*/ )
1100 rSubTypeList
.Clear();
1101 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_STOCK_1
)));
1102 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_STOCK_2
)));
1103 rSubTypeList
.InsertItem(3, Image(BitmapEx(BMP_STOCK_3
)));
1104 rSubTypeList
.InsertItem(4, Image(BitmapEx(BMP_STOCK_4
)));
1106 rSubTypeList
.SetItemText( 1, SchResId(STR_STOCK_1
) );
1107 rSubTypeList
.SetItemText( 2, SchResId(STR_STOCK_2
) );
1108 rSubTypeList
.SetItemText( 3, SchResId(STR_STOCK_3
) );
1109 rSubTypeList
.SetItemText( 4, SchResId(STR_STOCK_4
) );
1112 void StockChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
1114 rParameter
.b3DLook
= false;
1115 rParameter
.eStackMode
= GlobalStackMode_NONE
;
1118 CombiColumnLineChartDialogController::CombiColumnLineChartDialogController()
1119 : m_pFT_NumberOfLines(nullptr)
1120 , m_pMF_NumberOfLines(nullptr)
1122 bSupports3D
= false;
1125 OUString
CombiColumnLineChartDialogController::getName()
1127 return SchResId(STR_TYPE_COMBI_COLUMN_LINE
);
1130 Image
CombiColumnLineChartDialogController::getImage( )
1132 return Image(BitmapEx(BMP_TYPE_COLUMN_LINE
));
1135 const tTemplateServiceChartTypeParameterMap
& CombiColumnLineChartDialogController::getTemplateMap() const
1137 static tTemplateServiceChartTypeParameterMap s_aTemplateMap
{
1138 {"com.sun.star.chart2.template.ColumnWithLine" , ChartTypeParameter(1)},
1139 {"com.sun.star.chart2.template.StackedColumnWithLine" , ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y
)}};
1140 return s_aTemplateMap
;
1143 void CombiColumnLineChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& /*rParameter*/ )
1145 rSubTypeList
.Clear();
1146 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_COLUMN_LINE
)));
1147 rSubTypeList
.InsertItem(2, Image(BitmapEx(BMP_COLUMN_LINE_STACKED
)));
1149 rSubTypeList
.SetItemText(1, SchResId(STR_LINE_COLUMN
));
1150 rSubTypeList
.SetItemText(2, SchResId(STR_LINE_STACKEDCOLUMN
));
1153 void CombiColumnLineChartDialogController::showExtraControls( VclBuilderContainer
* pParent
)
1155 if (!m_pFT_NumberOfLines
)
1157 pParent
->get(m_pFT_NumberOfLines
, "nolinesft");
1159 if (!m_pMF_NumberOfLines
)
1161 pParent
->get(m_pMF_NumberOfLines
, "nolines");
1163 m_pMF_NumberOfLines
->SetSpinSize(1);
1164 m_pMF_NumberOfLines
->SetFirst( 1 );
1165 m_pMF_NumberOfLines
->SetLast( 100 );
1166 m_pMF_NumberOfLines
->SetMin( 1 );
1167 m_pMF_NumberOfLines
->SetMax( 100 );
1169 m_pMF_NumberOfLines
->SetModifyHdl( LINK( this, CombiColumnLineChartDialogController
, ChangeLineCountHdl
) );
1172 m_pFT_NumberOfLines
->Show();
1173 m_pMF_NumberOfLines
->Show();
1176 void CombiColumnLineChartDialogController::hideExtraControls() const
1178 if(m_pFT_NumberOfLines
)
1179 m_pFT_NumberOfLines
->Hide();
1180 if(m_pMF_NumberOfLines
)
1181 m_pMF_NumberOfLines
->Hide();
1184 void CombiColumnLineChartDialogController::fillExtraControls( const ChartTypeParameter
& /*rParameter*/
1185 , const uno::Reference
< XChartDocument
>& xChartModel
1186 , const uno::Reference
< beans::XPropertySet
>& xTemplateProps
) const
1188 if(!m_pMF_NumberOfLines
)
1191 uno::Reference
< frame::XModel
> xModel( xChartModel
, uno::UNO_QUERY
);
1193 uno::Reference
< XDiagram
> xDiagram
= ChartModelHelper::findDiagram( xModel
);
1197 sal_Int32 nNumLines
= 0;
1199 if(xTemplateProps
.is())
1203 xTemplateProps
->getPropertyValue( "NumberOfLines" ) >>= nNumLines
;
1205 catch( const uno::Exception
& )
1207 DBG_UNHANDLED_EXCEPTION("chart2");
1212 m_pMF_NumberOfLines
->SetValue( nNumLines
);
1214 sal_Int32 nMaxLines
= ChartModelHelper::getDataSeries( xModel
).size() - 1;
1217 m_pMF_NumberOfLines
->SetLast( nMaxLines
);
1218 m_pMF_NumberOfLines
->SetMax( nMaxLines
);
1220 void CombiColumnLineChartDialogController::setTemplateProperties( const uno::Reference
< beans::XPropertySet
>& xTemplateProps
) const
1222 if( xTemplateProps
.is() )
1224 sal_Int32 nNumLines
= static_cast< sal_Int32
>( m_pMF_NumberOfLines
->GetValue());
1225 xTemplateProps
->setPropertyValue( "NumberOfLines" , uno::Any(nNumLines
) );
1229 IMPL_LINK_NOARG(CombiColumnLineChartDialogController
, ChangeLineCountHdl
, Edit
&, void)
1231 if( m_pChangeListener
)
1232 m_pChangeListener
->stateChanged(this);
1234 void CombiColumnLineChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
1236 rParameter
.b3DLook
= false;
1237 if(rParameter
.eStackMode
==GlobalStackMode_STACK_Z
)
1238 rParameter
.eStackMode
= GlobalStackMode_NONE
;
1240 switch( rParameter
.nSubTypeIndex
)
1243 rParameter
.eStackMode
=GlobalStackMode_STACK_Y
;
1246 rParameter
.eStackMode
=GlobalStackMode_NONE
;
1251 BubbleChartDialogController::BubbleChartDialogController()
1255 BubbleChartDialogController::~BubbleChartDialogController()
1259 OUString
BubbleChartDialogController::getName()
1261 return SchResId(STR_TYPE_BUBBLE
);
1264 Image
BubbleChartDialogController::getImage()
1266 return Image(BitmapEx(BMP_TYPE_BUBBLE
));
1269 const tTemplateServiceChartTypeParameterMap
& BubbleChartDialogController::getTemplateMap() const
1271 static tTemplateServiceChartTypeParameterMap s_aTemplateMap
{
1272 {"com.sun.star.chart2.template.Bubble" , ChartTypeParameter(1,true)}};
1273 return s_aTemplateMap
;
1275 void BubbleChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, const ChartTypeParameter
& /*rParameter*/ )
1277 rSubTypeList
.Clear();
1278 rSubTypeList
.InsertItem(1, Image(BitmapEx(BMP_BUBBLE_1
)));
1280 rSubTypeList
.SetItemText( 1, SchResId(STR_BUBBLE_1
) );
1282 void BubbleChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
1284 rParameter
.b3DLook
= false;
1285 rParameter
.eStackMode
= GlobalStackMode_NONE
;
1289 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */