1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ChartTypeDialogController.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
34 #include "ChartTypeDialogController.hxx"
36 #include "HelpIds.hrc"
37 #include "Strings.hrc"
38 #include "Bitmaps.hrc"
39 #include "Bitmaps_HC.hrc"
41 #include "ChartModelHelper.hxx"
42 #include "DiagramHelper.hxx"
43 #include "ControllerLockGuard.hxx"
44 #include "AxisHelper.hxx"
46 #include <com/sun/star/chart2/DataPointGeometry3D.hpp>
47 #include <com/sun/star/chart2/PieChartOffsetMode.hpp>
48 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
50 #ifndef _SVT_CONTROLDIMS_HRC_
51 #include <svtools/controldims.hrc>
53 // header for class Image
54 #include <vcl/image.hxx>
55 // header for class Bitmap
56 #include <vcl/bitmap.hxx>
57 #include <vcl/svapp.hxx>
59 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
61 //.............................................................................
64 //.............................................................................
65 using namespace ::com::sun::star
;
66 using namespace ::com::sun::star::chart2
;
68 // macro for selecting a normal or high contrast bitmap the stack variable
69 // bIsHighContrast must exist and reflect the correct state
70 #define SELECT_BITMAP(name) Bitmap( SchResId( bIsHighContrast ? name ## _HC : name ))
71 #define SELECT_IMAGE(name) Image( SchResId( bIsHighContrast ? name ## _HC : name ))
74 ( C2U( "com.sun.star.chart2.template.Surface" ), CHSTYLE_3D_SURFACE)
75 ( C2U( "com.sun.star.chart2.template.Addin" ), CHSTYLE_ADDIN)
78 ChartTypeParameter::ChartTypeParameter()
80 , bXAxisWithValues( false )
84 , eStackMode( GlobalStackMode_NONE
)
85 , eCurveStyle( CurveStyle_LINES
)
86 , nCurveResolution(20)
88 , nGeometry3D(DataPointGeometry3D::CUBOID
)
89 , eThreeDLookScheme(ThreeDLookScheme_Realistic
)
90 , bSortByXValues(sal_False
)
94 ChartTypeParameter::ChartTypeParameter( sal_Int32 SubTypeIndex
, bool HasXAxisWithValues
95 , bool Is3DLook
, GlobalStackMode nStackMode
96 , bool HasSymbols
, bool HasLines
97 , CurveStyle nCurveStyle
)
98 : nSubTypeIndex( SubTypeIndex
)
99 , bXAxisWithValues( HasXAxisWithValues
)
100 , b3DLook( Is3DLook
)
101 , bSymbols( HasSymbols
)
103 , eStackMode( nStackMode
)
104 , eCurveStyle( nCurveStyle
)
105 , nCurveResolution(20)
107 , nGeometry3D(DataPointGeometry3D::CUBOID
)
108 , eThreeDLookScheme(ThreeDLookScheme_Realistic
)
109 , bSortByXValues(sal_False
)
112 ChartTypeParameter::~ChartTypeParameter()
116 bool ChartTypeParameter::mapsToSameService( const ChartTypeParameter
& rParameter
) const
118 return this->mapsToSimilarService( rParameter
, 0 );
120 bool ChartTypeParameter::mapsToSimilarService( const ChartTypeParameter
& rParameter
, sal_Int32 nTheHigherTheLess
) const
123 if(nTheHigherTheLess
>nMax
)
125 if( this->bXAxisWithValues
!=rParameter
.bXAxisWithValues
)
126 return nTheHigherTheLess
>nMax
-1;
127 if( this->b3DLook
!=rParameter
.b3DLook
)
128 return nTheHigherTheLess
>nMax
-2;
129 if( this->eStackMode
!=rParameter
.eStackMode
)
130 return nTheHigherTheLess
>nMax
-3;
131 if( this->nSubTypeIndex
!=rParameter
.nSubTypeIndex
)
132 return nTheHigherTheLess
>nMax
-4;
133 if( this->bSymbols
!=rParameter
.bSymbols
)
134 return nTheHigherTheLess
>nMax
-5;
135 if( this->bLines
!=rParameter
.bLines
)
136 return nTheHigherTheLess
>nMax
-6;
140 //-----------------------------------------------------------------------------
141 //-----------------------------------------------------------------------------
142 //-----------------------------------------------------------------------------
144 ChartTypeDialogController::ChartTypeDialogController()
145 : bSupportsXAxisWithValues(false)
150 ChartTypeDialogController::~ChartTypeDialogController()
153 Image
ChartTypeDialogController::getImage( bool /*bIsHighContrast*/ )
157 bool ChartTypeDialogController::isSubType( const rtl::OUString
& rServiceName
)
159 const tTemplateServiceChartTypeParameterMap
& rTemplateMap
= this->getTemplateMap();
160 tTemplateServiceChartTypeParameterMap::const_iterator
aIt( rTemplateMap
.find( rServiceName
));
161 if( aIt
!= rTemplateMap
.end())
165 ChartTypeParameter
ChartTypeDialogController::getChartTypeParameterForService(
166 const rtl::OUString
& rServiceName
167 , const uno::Reference
< beans::XPropertySet
>& xTemplateProps
)
169 ChartTypeParameter aRet
;
170 const tTemplateServiceChartTypeParameterMap
& rTemplateMap
= this->getTemplateMap();
171 tTemplateServiceChartTypeParameterMap::const_iterator
aIt( rTemplateMap
.find( rServiceName
));
172 if( aIt
!= rTemplateMap
.end())
173 aRet
= (*aIt
).second
;
174 if( xTemplateProps
.is() )
178 xTemplateProps
->getPropertyValue( C2U( "CurveStyle" )) >>= aRet
.eCurveStyle
;
179 xTemplateProps
->getPropertyValue( C2U( "CurveResolution" )) >>= aRet
.nCurveResolution
;
180 xTemplateProps
->getPropertyValue( C2U( "SplineOrder" )) >>= aRet
.nSplineOrder
;
182 catch( uno::Exception
& ex
)
184 //not all templates need to support CurveStyle, CurveResolution or SplineOrder
185 ex
.Context
.is();//to have debug information without compilation warnings
190 xTemplateProps
->getPropertyValue( C2U( "Geometry3D" )) >>= aRet
.nGeometry3D
;
192 catch( uno::Exception
& ex
)
194 //not all templates need to support CGeometry3D
195 ex
.Context
.is();//to have debug information without compilation warnings
200 void ChartTypeDialogController::adjustSubTypeAndEnableControls( ChartTypeParameter
& /*rParameter*/ )
203 void ChartTypeDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
205 switch( rParameter
.nSubTypeIndex
)
208 rParameter
.eStackMode
=GlobalStackMode_STACK_Y
;
211 rParameter
.eStackMode
=GlobalStackMode_STACK_Y_PERCENT
;
214 rParameter
.eStackMode
=GlobalStackMode_STACK_Z
;
217 rParameter
.eStackMode
=GlobalStackMode_NONE
;
221 void ChartTypeDialogController::adjustParameterToMainType( ChartTypeParameter
& rParameter
)
223 bool bFoundSomeMatch
=false;
225 rParameter
.bXAxisWithValues
= bSupportsXAxisWithValues
;
226 if( rParameter
.b3DLook
&& !bSupports3D
)
227 rParameter
.b3DLook
= false;
228 if(!rParameter
.b3DLook
&& rParameter
.eStackMode
==GlobalStackMode_STACK_Z
)
229 rParameter
.eStackMode
= GlobalStackMode_NONE
;
231 const tTemplateServiceChartTypeParameterMap
& rMap
= getTemplateMap();
232 tTemplateServiceChartTypeParameterMap::const_iterator aIter
= rMap
.begin();
233 const tTemplateServiceChartTypeParameterMap::const_iterator aEnd
= rMap
.end();
234 for( sal_Int32 nMatchPrecision
=0; nMatchPrecision
<7 && !bFoundSomeMatch
; nMatchPrecision
++ )
236 for( aIter
= rMap
.begin(); aIter
!= aEnd
; aIter
++ )
238 if( rParameter
.mapsToSimilarService( (*aIter
).second
, nMatchPrecision
) )
241 ThreeDLookScheme aScheme
= rParameter
.eThreeDLookScheme
;
242 sal_Int32 nCurveResolution
= rParameter
.nCurveResolution
;
243 sal_Int32 nSplineOrder
= rParameter
.nSplineOrder
;
244 CurveStyle eCurveStyle
= rParameter
.eCurveStyle
;
245 sal_Int32 nGeometry3D
= rParameter
.nGeometry3D
;
246 sal_Bool bSortByXValues
= rParameter
.bSortByXValues
;
248 rParameter
= (*aIter
).second
;
250 //some values should not be changed with charttype
251 rParameter
.eThreeDLookScheme
= aScheme
;
252 rParameter
.nCurveResolution
= nCurveResolution
;
253 rParameter
.nSplineOrder
=nSplineOrder
;
254 rParameter
.eCurveStyle
= eCurveStyle
;
255 rParameter
.nGeometry3D
= nGeometry3D
;
256 rParameter
.bSortByXValues
= bSortByXValues
;
258 bFoundSomeMatch
= true;
265 if(rMap
.begin()!=rMap
.end())
266 rParameter
= (*rMap
.begin()).second
;
268 rParameter
= ChartTypeParameter();
271 rtl::OUString
ChartTypeDialogController::getServiceNameForParameter( const ChartTypeParameter
& rParameter
) const
273 ChartTypeParameter
aParameter(rParameter
);
274 if( aParameter
.bXAxisWithValues
)
275 aParameter
.eStackMode
= GlobalStackMode_NONE
;
276 if(!aParameter
.b3DLook
&& aParameter
.eStackMode
==GlobalStackMode_STACK_Z
)
277 aParameter
.eStackMode
= GlobalStackMode_NONE
;
278 const tTemplateServiceChartTypeParameterMap
& rMap
= getTemplateMap();
279 tTemplateServiceChartTypeParameterMap::const_iterator aIter
= rMap
.begin();
280 const tTemplateServiceChartTypeParameterMap::const_iterator aEnd
= rMap
.end();
281 for( ; aIter
!= aEnd
; aIter
++ )
283 if( aParameter
.mapsToSameService( (*aIter
).second
) )
284 return (*aIter
).first
;
287 OSL_ENSURE( false, "ChartType not implemented yet - use fallback to similar type" );
288 for( sal_Int32 nMatchPrecision
=1; nMatchPrecision
<8; nMatchPrecision
++ )
290 for( aIter
= rMap
.begin(); aIter
!= aEnd
; aIter
++ )
292 if( aParameter
.mapsToSimilarService( (*aIter
).second
, nMatchPrecision
) )
293 return (*aIter
).first
;
296 return ::rtl::OUString();
298 uno::Reference
< XChartTypeTemplate
> ChartTypeDialogController::getCurrentTemplate(
299 const ChartTypeParameter
& rParameter
300 , const uno::Reference
< lang::XMultiServiceFactory
>& xTemplateManager
) const
302 uno::Reference
< XChartTypeTemplate
> xTemplate(0);
304 rtl::OUString
aServiceName( this->getServiceNameForParameter( rParameter
) );
305 if(aServiceName
.getLength())
307 xTemplate
.set( xTemplateManager
->createInstance( aServiceName
), uno::UNO_QUERY
);
310 uno::Reference
< beans::XPropertySet
> xTemplateProps( xTemplate
, uno::UNO_QUERY
);
311 if(xTemplateProps
.is())
315 xTemplateProps
->setPropertyValue( C2U( "CurveStyle" ), uno::makeAny(rParameter
.eCurveStyle
) );
316 xTemplateProps
->setPropertyValue( C2U( "CurveResolution" ), uno::makeAny(rParameter
.nCurveResolution
) );
317 xTemplateProps
->setPropertyValue( C2U( "SplineOrder" ), uno::makeAny(rParameter
.nSplineOrder
) );
319 catch( uno::Exception
& ex
)
321 //not all templates need to support CurveStyle, CurveResolution or SplineOrder
322 ex
.Context
.is();//to have debug information without compilation warnings
326 xTemplateProps
->setPropertyValue( C2U( "Geometry3D" ), uno::makeAny(rParameter
.nGeometry3D
) );
328 catch( uno::Exception
& ex
)
330 //not all templates need to support Geometry3D
331 ex
.Context
.is();//to have debug information without compilation warnings
335 this->setTemplateProperties( xTemplateProps
);
337 catch( uno::Exception
& ex
)
339 ASSERT_EXCEPTION( ex
);
347 bool ChartTypeDialogController::commitToModel( const ChartTypeParameter
& rParameter
348 , const uno::Reference
< XChartDocument
>& xChartModel
)
350 uno::Reference
< lang::XMultiServiceFactory
> xTemplateManager( xChartModel
->getChartTypeManager(), uno::UNO_QUERY
);
351 uno::Reference
< XChartTypeTemplate
> xTemplate( this->getCurrentTemplate( rParameter
, xTemplateManager
) );
354 uno::Reference
< frame::XModel
> xModel( xChartModel
, uno::UNO_QUERY
);
356 // /-- locked controllers
357 ControllerLockGuard
aCtrlLockGuard( xModel
);
358 uno::Reference
< XDiagram
> xDiagram
= ChartModelHelper::findDiagram( xModel
);
359 DiagramHelper::tTemplateWithServiceName
aTemplateWithService(
360 DiagramHelper::getTemplateForDiagram( xDiagram
, xTemplateManager
));
361 if( aTemplateWithService
.first
.is())
362 aTemplateWithService
.first
->resetStyles( xDiagram
);
363 xTemplate
->changeDiagram( xDiagram
);
364 if( Application::GetSettings().GetLayoutRTL() )
365 AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram
, 0 ) );
366 if( rParameter
.b3DLook
)
367 ThreeDHelper::setScheme( xDiagram
, rParameter
.eThreeDLookScheme
);
371 uno::Reference
< beans::XPropertySet
> xDiaProp( xDiagram
, uno::UNO_QUERY
);
373 xDiaProp
->setPropertyValue( C2U( "SortByXValues" ), uno::makeAny( rParameter
.bSortByXValues
) );
375 // \-- locked controllers
379 void ChartTypeDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, bool /*bIsHighContrast*/, const ChartTypeParameter
& /*rParameter*/ )
381 rSubTypeList
.Clear();
383 bool ChartTypeDialogController::shouldShow_XAxisTypeControl() const
387 bool ChartTypeDialogController::shouldShow_3DLookControl() const
391 bool ChartTypeDialogController::shouldShow_StackingControl() const
395 bool ChartTypeDialogController::shouldShow_DeepStackingControl() const
399 bool ChartTypeDialogController::shouldShow_SplineControl() const
403 bool ChartTypeDialogController::shouldShow_GeometryControl() const
407 bool ChartTypeDialogController::shouldShow_SortByXValuesResourceGroup() const
412 void ChartTypeDialogController::showExtraControls( Window
* /*pParent*/, const Point
& /*rPosition*/, const Size
& /*rSize*/ )
415 void ChartTypeDialogController::hideExtraControls() const
418 void ChartTypeDialogController::fillExtraControls( const ChartTypeParameter
& /*rParameter*/
419 , const uno::Reference
< XChartDocument
>& /*xChartModel*/
420 , const uno::Reference
< beans::XPropertySet
>& /*xTemplateProps*/ ) const
423 void ChartTypeDialogController::setTemplateProperties( const uno::Reference
< beans::XPropertySet
>& /*xTemplateProps*/ ) const throw (uno::RuntimeException
)
426 //--------------------------------------------------------------------------
428 ColumnOrBarChartDialogController_Base::ColumnOrBarChartDialogController_Base()
429 : ChartTypeDialogController()
432 ColumnOrBarChartDialogController_Base::~ColumnOrBarChartDialogController_Base()
435 bool ColumnOrBarChartDialogController_Base::shouldShow_3DLookControl() const
439 bool ColumnOrBarChartDialogController_Base::shouldShow_GeometryControl() const
443 void ColumnOrBarChartDialogController_Base::adjustSubTypeAndEnableControls( ChartTypeParameter
& rParameter
)
445 if(rParameter
.nSubTypeIndex
>3 && !rParameter
.b3DLook
)
447 rParameter
.nSubTypeIndex
=1;
450 //--------------------------------------------------------------------------
451 ColumnChartDialogController::ColumnChartDialogController()
454 ColumnChartDialogController::~ColumnChartDialogController()
457 String
ColumnChartDialogController::getName()
459 return String( SchResId( STR_TYPE_COLUMN
));
461 Image
ColumnChartDialogController::getImage( bool bIsHighContrast
)
463 return SELECT_IMAGE( IMG_TYPE_COLUMN
);
465 const tTemplateServiceChartTypeParameterMap
& ColumnChartDialogController::getTemplateMap() const
467 static tTemplateServiceChartTypeParameterMap m_aTemplateMap
=
468 tTemplateServiceChartTypeParameterMap
469 ( C2U( "com.sun.star.chart2.template.Column" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE
) )
470 ( C2U( "com.sun.star.chart2.template.StackedColumn" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y
) )
471 ( C2U( "com.sun.star.chart2.template.PercentStackedColumn" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT
) )
472 ( C2U( "com.sun.star.chart2.template.ThreeDColumnFlat" ), ChartTypeParameter(1,false,true,GlobalStackMode_NONE
) )
473 ( C2U( "com.sun.star.chart2.template.StackedThreeDColumnFlat" ), ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y
) )
474 ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDColumnFlat" ), ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT
) )
475 ( C2U( "com.sun.star.chart2.template.ThreeDColumnDeep" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z
) )
477 return m_aTemplateMap
;
479 void ColumnChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
)
481 rSubTypeList
.Clear();
483 if( rParameter
.b3DLook
)
485 switch(rParameter
.nGeometry3D
)
487 case DataPointGeometry3D::CYLINDER
:
488 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_SAEULE_3D_1
) );
489 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_SAEULE_3D_2
) );
490 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_SAEULE_3D_3
) );
491 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_SAEULE_3D_4
) );
493 case DataPointGeometry3D::CONE
:
494 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_KEGEL_3D_1
) );
495 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_KEGEL_3D_2
) );
496 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_KEGEL_3D_3
) );
497 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_KEGEL_3D_4
) );
499 case DataPointGeometry3D::PYRAMID
:
500 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_PYRAMID_3D_1
) );
501 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_PYRAMID_3D_2
) );
502 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_PYRAMID_3D_3
) );
503 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_PYRAMID_3D_4
) );
505 default: //DataPointGeometry3D::CUBOID:
506 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_COLUMNS_3D_1
) );
507 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_COLUMNS_3D_2
) );
508 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_COLUMNS_3D_3
) );
509 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_COLUMNS_3D
) );
515 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_COLUMNS_2D_1
) );
516 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_COLUMNS_2D_2
) );
517 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_COLUMNS_2D_3
) );
520 rSubTypeList
.SetItemText( 1, String( SchResId( STR_NORMAL
)) );
521 rSubTypeList
.SetItemText( 2, String( SchResId( STR_STACKED
)) );
522 rSubTypeList
.SetItemText( 3, String( SchResId( STR_PERCENT
)) );
523 rSubTypeList
.SetItemText( 4, String( SchResId( STR_DEEP
)) );
526 //--------------------------------------------------------------------------
528 BarChartDialogController::BarChartDialogController()
531 BarChartDialogController::~BarChartDialogController()
534 String
BarChartDialogController::getName()
536 return String( SchResId( STR_TYPE_BAR
));
538 Image
BarChartDialogController::getImage( bool bIsHighContrast
)
540 return SELECT_IMAGE( IMG_TYPE_BAR
);
542 const tTemplateServiceChartTypeParameterMap
& BarChartDialogController::getTemplateMap() const
544 static tTemplateServiceChartTypeParameterMap m_aTemplateMap
=
545 tTemplateServiceChartTypeParameterMap
546 ( C2U( "com.sun.star.chart2.template.Bar" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE
) )
547 ( C2U( "com.sun.star.chart2.template.StackedBar" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y
) )
548 ( C2U( "com.sun.star.chart2.template.PercentStackedBar" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT
) )
549 ( C2U( "com.sun.star.chart2.template.ThreeDBarFlat" ), ChartTypeParameter(1,false,true,GlobalStackMode_NONE
) )
550 ( C2U( "com.sun.star.chart2.template.StackedThreeDBarFlat" ), ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y
) )
551 ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDBarFlat" ), ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT
) )
552 ( C2U( "com.sun.star.chart2.template.ThreeDBarDeep" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z
) )
554 return m_aTemplateMap
;
556 void BarChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
)
558 rSubTypeList
.Clear();
560 if( rParameter
.b3DLook
)
562 switch(rParameter
.nGeometry3D
)
564 case DataPointGeometry3D::CYLINDER
:
565 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_ROEHRE_3D_1
) );
566 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_ROEHRE_3D_2
) );
567 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_ROEHRE_3D_3
) );
568 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_ROEHRE_3D_4
) );
570 case DataPointGeometry3D::CONE
:
571 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_KEGELQ_3D_1
) );
572 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_KEGELQ_3D_2
) );
573 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_KEGELQ_3D_3
) );
574 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_KEGELQ_3D_4
) );
576 case DataPointGeometry3D::PYRAMID
:
577 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_PYRAMIDQ_3D_1
) );
578 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_PYRAMIDQ_3D_2
) );
579 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_PYRAMIDQ_3D_3
) );
580 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_PYRAMIDQ_3D_4
) );
582 default: //DataPointGeometry3D::CUBOID:
583 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_BARS_3D_1
) );
584 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_BARS_3D_2
) );
585 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_BARS_3D_3
) );
586 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_BARS_3D
) );
592 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_BARS_2D_1
) );
593 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_BARS_2D_2
) );
594 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_BARS_2D_3
) );
596 rSubTypeList
.SetItemText( 1, String( SchResId( STR_NORMAL
)) );
597 rSubTypeList
.SetItemText( 2, String( SchResId( STR_STACKED
)) );
598 rSubTypeList
.SetItemText( 3, String( SchResId( STR_PERCENT
)) );
599 rSubTypeList
.SetItemText( 4, String( SchResId( STR_DEEP
)) );
602 //--------------------------------------------------------------------------
604 PieChartDialogController::PieChartDialogController()
607 PieChartDialogController::~PieChartDialogController()
610 String
PieChartDialogController::getName()
612 return String( SchResId( STR_TYPE_PIE
));
614 Image
PieChartDialogController::getImage( bool bIsHighContrast
)
616 return SELECT_IMAGE( IMG_TYPE_PIE
);
618 const tTemplateServiceChartTypeParameterMap
& PieChartDialogController::getTemplateMap() const
620 static tTemplateServiceChartTypeParameterMap m_aTemplateMap
=
621 tTemplateServiceChartTypeParameterMap
622 ( C2U( "com.sun.star.chart2.template.Pie" ), ChartTypeParameter(1,false,false) )
623 ( C2U( "com.sun.star.chart2.template.PieAllExploded" ), ChartTypeParameter(2,false,false) )
624 ( C2U( "com.sun.star.chart2.template.Donut" ), ChartTypeParameter(3,false,false) )
625 ( C2U( "com.sun.star.chart2.template.DonutAllExploded" ), ChartTypeParameter(4,false,false) )
626 ( C2U( "com.sun.star.chart2.template.ThreeDPie" ), ChartTypeParameter(1,false,true) )
627 ( C2U( "com.sun.star.chart2.template.ThreeDPieAllExploded" ), ChartTypeParameter(2,false,true) )
628 ( C2U( "com.sun.star.chart2.template.ThreeDDonut" ), ChartTypeParameter(3,false,true) )
629 ( C2U( "com.sun.star.chart2.template.ThreeDDonutAllExploded" ), ChartTypeParameter(4,false,true) )
631 return m_aTemplateMap
;
633 void PieChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
)
635 rSubTypeList
.Clear();
637 if( rParameter
.b3DLook
)
639 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_CIRCLES_3D
) );
640 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_CIRCLES_3D_EXPLODED
) );
641 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_DONUT_3D
) );
642 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_DONUT_3D_EXPLODED
) );
646 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_CIRCLES_2D
) );
647 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_CIRCLES_2D_EXPLODED
) );
648 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_DONUT_2D
) );
649 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_DONUT_2D_EXPLODED
) );
651 rSubTypeList
.SetItemText( 1, String( SchResId( STR_NORMAL
)) );
652 rSubTypeList
.SetItemText( 2, String( SchResId( STR_PIE_EXPLODED
)) );
653 rSubTypeList
.SetItemText( 3, String( SchResId( STR_DONUT
)) );
654 rSubTypeList
.SetItemText( 4, String( SchResId( STR_DONUT_EXPLODED
)) );
656 bool PieChartDialogController::shouldShow_3DLookControl() const
660 void PieChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
662 if(rParameter
.eStackMode
==GlobalStackMode_STACK_Z
)
663 rParameter
.eStackMode
= GlobalStackMode_NONE
;
665 //--------------------------------------------------------------------------
666 LineChartDialogController::LineChartDialogController()
669 LineChartDialogController::~LineChartDialogController()
672 String
LineChartDialogController::getName()
674 return String( SchResId( STR_TYPE_LINE
));
676 Image
LineChartDialogController::getImage( bool bIsHighContrast
)
678 return SELECT_IMAGE( IMG_TYPE_LINE
);
680 const tTemplateServiceChartTypeParameterMap
& LineChartDialogController::getTemplateMap() const
682 static tTemplateServiceChartTypeParameterMap m_aTemplateMap
=
683 tTemplateServiceChartTypeParameterMap
684 //-------------------------------------------------------
685 ( C2U( "com.sun.star.chart2.template.Symbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE
,true,false) )
686 ( C2U( "com.sun.star.chart2.template.StackedSymbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y
,true,false) )
687 ( C2U( "com.sun.star.chart2.template.PercentStackedSymbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y_PERCENT
,true,false) )
688 ( C2U( "com.sun.star.chart2.template.LineSymbol" ), ChartTypeParameter(2,false,false,GlobalStackMode_NONE
,true,true) )
689 ( C2U( "com.sun.star.chart2.template.StackedLineSymbol" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y
,true,true) )
690 ( C2U( "com.sun.star.chart2.template.PercentStackedLineSymbol" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y_PERCENT
,true,true) )
691 ( C2U( "com.sun.star.chart2.template.Line" ), ChartTypeParameter(3,false,false,GlobalStackMode_NONE
,false,true) )
692 ( C2U( "com.sun.star.chart2.template.StackedLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y
,false,true) )
693 ( C2U( "com.sun.star.chart2.template.PercentStackedLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT
,false,true) )
694 //-------------------------------------------------------
695 //( C2U( "com.sun.star.chart2.template.ThreeDLine" ), ChartTypeParameter(4,false,true,GlobalStackMode_NONE,false,true) )
696 ( C2U( "com.sun.star.chart2.template.StackedThreeDLine" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Y
,false,true) )
697 ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDLine" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Y_PERCENT
,false,true) )
698 ( C2U( "com.sun.star.chart2.template.ThreeDLineDeep" ), ChartTypeParameter(4,false,true,GlobalStackMode_STACK_Z
,false,true) )
699 //-------------------------------------------------------
701 return m_aTemplateMap
;
703 void LineChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
)
705 rSubTypeList
.Clear();
707 if( CurveStyle_LINES
==rParameter
.eCurveStyle
)
710 if( GlobalStackMode_NONE
== rParameter
.eStackMode
|| GlobalStackMode_STACK_Z
== rParameter
.eStackMode
)
712 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_XCATEGORY
) );
713 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_XCATEGORY
) );
714 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_XCATEGORY
) );
715 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_XCATEGORY
) );
719 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_STACKED
) );
720 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_STACKED
) );
721 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_STACKED
) );
722 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_STACKED
) );
725 else //CurveStyle_LINES
727 if( GlobalStackMode_NONE
== rParameter
.eStackMode
|| GlobalStackMode_STACK_Z
== rParameter
.eStackMode
)
729 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_XCATEGORY
) );
730 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_XCATEGORY_SMOOTH
) );
731 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_XCATEGORY_SMOOTH
) );
732 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_XCATEGORY_SMOOTH
) );
736 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_STACKED
) );
737 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_STACKED_SMOOTH
) );
738 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_STACKED_SMOOTH
) );
739 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_STACKED_SMOOTH
) );
743 rSubTypeList
.SetItemText( 1, String( SchResId( STR_POINTS_ONLY
)) );
744 rSubTypeList
.SetItemText( 2, String( SchResId( STR_POINTS_AND_LINES
)) );
745 rSubTypeList
.SetItemText( 3, String( SchResId( STR_LINES_ONLY
)) );
746 rSubTypeList
.SetItemText( 4, String( SchResId( STR_LINES_3D
)) );
748 bool LineChartDialogController::shouldShow_StackingControl() const
752 bool LineChartDialogController::shouldShow_DeepStackingControl() const
756 bool LineChartDialogController::shouldShow_SplineControl() const
760 void LineChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
762 rParameter
.b3DLook
= false;
764 switch( rParameter
.nSubTypeIndex
)
767 rParameter
.bSymbols
= true;
768 rParameter
.bLines
= true;
771 rParameter
.bSymbols
= false;
772 rParameter
.bLines
= true;
775 rParameter
.bSymbols
= false;
776 rParameter
.bLines
= true;
777 rParameter
.b3DLook
= true;
778 if( rParameter
.eStackMode
== GlobalStackMode_NONE
)
779 rParameter
.eStackMode
= GlobalStackMode_STACK_Z
;
782 rParameter
.bSymbols
= true;
783 rParameter
.bLines
= false;
787 if(!rParameter
.b3DLook
&& rParameter
.eStackMode
== GlobalStackMode_STACK_Z
)
788 rParameter
.eStackMode
= GlobalStackMode_NONE
;
790 void LineChartDialogController::adjustParameterToMainType( ChartTypeParameter
& rParameter
)
792 if( rParameter
.b3DLook
&& rParameter
.eStackMode
== GlobalStackMode_NONE
)
793 rParameter
.eStackMode
= GlobalStackMode_STACK_Z
;
795 ChartTypeDialogController::adjustParameterToMainType( rParameter
);
797 //--------------------------------------------------------------------------
798 XYChartDialogController::XYChartDialogController()
800 bSupportsXAxisWithValues
= true;
802 XYChartDialogController::~XYChartDialogController()
805 String
XYChartDialogController::getName()
807 return String( SchResId( STR_TYPE_XY
));
809 Image
XYChartDialogController::getImage( bool bIsHighContrast
)
811 return SELECT_IMAGE( IMG_TYPE_XY
);
813 const tTemplateServiceChartTypeParameterMap
& XYChartDialogController::getTemplateMap() const
815 static tTemplateServiceChartTypeParameterMap m_aTemplateMap
=
816 tTemplateServiceChartTypeParameterMap
817 //-------------------------------------------------------
818 ( C2U( "com.sun.star.chart2.template.ScatterSymbol" ), ChartTypeParameter(1,true,false,GlobalStackMode_NONE
,true,false) )
819 ( C2U( "com.sun.star.chart2.template.ScatterLineSymbol" ), ChartTypeParameter(2,true,false,GlobalStackMode_NONE
,true,true) )
820 ( C2U( "com.sun.star.chart2.template.ScatterLine" ), ChartTypeParameter(3,true,false,GlobalStackMode_NONE
,false,true) )
821 ( C2U( "com.sun.star.chart2.template.ThreeDScatter" ), ChartTypeParameter(4,true,true,GlobalStackMode_NONE
,false,true) )
823 return m_aTemplateMap
;
825 void XYChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
)
827 rSubTypeList
.Clear();
829 if( CurveStyle_LINES
==rParameter
.eCurveStyle
)
831 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_XVALUES
) );
832 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_XVALUES
) );
833 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_XVALUES
) );
834 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_XVALUES
) );
836 else //CurveStyle_LINES
839 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_POINTS_XVALUES
) );
840 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_LINE_P_XVALUES_SMOOTH
) );
841 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_LINE_O_XVALUES_SMOOTH
) );
842 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_LINE3D_XVALUES_SMOOTH
) );
845 rSubTypeList
.SetItemText( 1, String( SchResId( STR_POINTS_ONLY
)) );
846 rSubTypeList
.SetItemText( 2, String( SchResId( STR_POINTS_AND_LINES
)) );
847 rSubTypeList
.SetItemText( 3, String( SchResId( STR_LINES_ONLY
)) );
848 rSubTypeList
.SetItemText( 4, String( SchResId( STR_LINES_3D
)) );
850 bool XYChartDialogController::shouldShow_SplineControl() const
854 bool XYChartDialogController::shouldShow_SortByXValuesResourceGroup() const
858 void XYChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
860 rParameter
.eStackMode
=GlobalStackMode_NONE
;
861 rParameter
.b3DLook
= false;
863 switch( rParameter
.nSubTypeIndex
)
866 rParameter
.bSymbols
= true;
867 rParameter
.bLines
= true;
870 rParameter
.bSymbols
= false;
871 rParameter
.bLines
= true;
874 rParameter
.bSymbols
= false;
875 rParameter
.bLines
= true;
876 rParameter
.b3DLook
= true;
877 rParameter
.eStackMode
=GlobalStackMode_STACK_Z
;
880 rParameter
.bSymbols
= true;
881 rParameter
.bLines
= false;
885 //--------------------------------------------------------------------------
886 AreaChartDialogController::AreaChartDialogController()
889 AreaChartDialogController::~AreaChartDialogController()
892 String
AreaChartDialogController::getName()
894 return String( SchResId( STR_TYPE_AREA
));
896 Image
AreaChartDialogController::getImage( bool bIsHighContrast
)
898 return SELECT_IMAGE( IMG_TYPE_AREA
);
900 bool AreaChartDialogController::shouldShow_3DLookControl() const
904 const tTemplateServiceChartTypeParameterMap
& AreaChartDialogController::getTemplateMap() const
906 static tTemplateServiceChartTypeParameterMap m_aTemplateMap
=
907 tTemplateServiceChartTypeParameterMap
908 ( C2U( "com.sun.star.chart2.template.Area" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE
) )
909 ( C2U( "com.sun.star.chart2.template.ThreeDArea" ), ChartTypeParameter(1,false,true,GlobalStackMode_STACK_Z
) )
910 ( C2U( "com.sun.star.chart2.template.StackedArea" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y
) )
911 ( C2U( "com.sun.star.chart2.template.StackedThreeDArea" ), ChartTypeParameter(2,false,true,GlobalStackMode_STACK_Y
) )
912 ( C2U( "com.sun.star.chart2.template.PercentStackedArea" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT
) )
913 ( C2U( "com.sun.star.chart2.template.PercentStackedThreeDArea" ), ChartTypeParameter(3,false,true,GlobalStackMode_STACK_Y_PERCENT
) )
915 return m_aTemplateMap
;
917 void AreaChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
)
919 rSubTypeList
.Clear();
921 if( rParameter
.b3DLook
)
923 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_AREAS_3D
) );
924 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_AREAS_3D_1
) );
925 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_AREAS_3D_2
) );
929 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_AREAS_2D_1
) );
930 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_AREAS_2D
) );
931 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_AREAS_2D_3
) );
934 rSubTypeList
.SetItemText( 1, String( SchResId( rParameter
.b3DLook
? STR_DEEP
: STR_NORMAL
)) );
935 rSubTypeList
.SetItemText( 2, String( SchResId( STR_STACKED
)) );
936 rSubTypeList
.SetItemText( 3, String( SchResId( STR_PERCENT
)) );
938 void AreaChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
940 rParameter
.eCurveStyle
= CurveStyle_LINES
;
942 if( rParameter
.nSubTypeIndex
>3 )
943 rParameter
.nSubTypeIndex
= 1;
944 switch( rParameter
.nSubTypeIndex
)
947 rParameter
.eStackMode
=GlobalStackMode_STACK_Y
;
950 rParameter
.eStackMode
=GlobalStackMode_STACK_Y_PERCENT
;
953 if( rParameter
.b3DLook
)
954 rParameter
.eStackMode
=GlobalStackMode_STACK_Z
;
956 rParameter
.eStackMode
=GlobalStackMode_NONE
;
960 void AreaChartDialogController::adjustParameterToMainType( ChartTypeParameter
& rParameter
)
962 if( rParameter
.b3DLook
&& rParameter
.eStackMode
== GlobalStackMode_NONE
)
963 rParameter
.eStackMode
= GlobalStackMode_STACK_Z
;
965 ChartTypeDialogController::adjustParameterToMainType( rParameter
);
967 //--------------------------------------------------------------------------
968 NetChartDialogController::NetChartDialogController()
972 NetChartDialogController::~NetChartDialogController()
975 String
NetChartDialogController::getName()
977 return String( SchResId( STR_TYPE_NET
));
979 Image
NetChartDialogController::getImage( bool bIsHighContrast
)
981 return SELECT_IMAGE( IMG_TYPE_NET
);
983 bool NetChartDialogController::shouldShow_StackingControl() const
987 const tTemplateServiceChartTypeParameterMap
& NetChartDialogController::getTemplateMap() const
989 static tTemplateServiceChartTypeParameterMap m_aTemplateMap
=
990 tTemplateServiceChartTypeParameterMap
991 //@todo need templates with symbols only
992 ( C2U( "com.sun.star.chart2.template.NetSymbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_NONE
,true,false) )
993 ( C2U( "com.sun.star.chart2.template.StackedNetSymbol" ), ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y
,true,false) )
994 ( C2U( "com.sun.star.chart2.template.PercentStackedNetSymbol" ),ChartTypeParameter(1,false,false,GlobalStackMode_STACK_Y_PERCENT
,true,false) )
996 ( C2U( "com.sun.star.chart2.template.Net" ), ChartTypeParameter(2,false,false,GlobalStackMode_NONE
,true,true) )
997 ( C2U( "com.sun.star.chart2.template.StackedNet" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y
,true,true) )
998 ( C2U( "com.sun.star.chart2.template.PercentStackedNet" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y_PERCENT
,true,true) )
1000 ( C2U( "com.sun.star.chart2.template.NetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_NONE
,false,true) )
1001 ( C2U( "com.sun.star.chart2.template.StackedNetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y
,false,true) )
1002 ( C2U( "com.sun.star.chart2.template.PercentStackedNetLine" ), ChartTypeParameter(3,false,false,GlobalStackMode_STACK_Y_PERCENT
,false,true) )
1004 ( C2U( "com.sun.star.chart2.template.FilledNet" ), ChartTypeParameter(4,false,false,GlobalStackMode_NONE
,false,false) )
1005 ( C2U( "com.sun.star.chart2.template.StackedFilledNet" ), ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y
,false,false) )
1006 ( C2U( "com.sun.star.chart2.template.PercentStackedFilledNet" ),ChartTypeParameter(4,false,false,GlobalStackMode_STACK_Y_PERCENT
,false,false) )
1008 return m_aTemplateMap
;
1010 void NetChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& rParameter
)
1012 rSubTypeList
.Clear();
1014 if( GlobalStackMode_NONE
== rParameter
.eStackMode
)
1016 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_NET_SYMB
) );
1017 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_NET_LINESYMB
) );
1018 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_NET
) );
1019 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_NET_FILL
) );
1023 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_NET_SYMB_STACK
) );
1024 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_NET_LINESYMB_STACK
) );
1025 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_NET_STACK
) );
1026 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_NET_FILL_STACK
) );
1029 rSubTypeList
.SetItemText( 1, String( SchResId( STR_POINTS_ONLY
)) );
1030 rSubTypeList
.SetItemText( 2, String( SchResId( STR_POINTS_AND_LINES
)) );
1031 rSubTypeList
.SetItemText( 3, String( SchResId( STR_LINES_ONLY
)) );
1032 rSubTypeList
.SetItemText( 4, String( SchResId( STR_FILLED
)) );
1034 void NetChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
1036 rParameter
.b3DLook
= false;
1037 if(rParameter
.eStackMode
==GlobalStackMode_STACK_Z
)
1038 rParameter
.eStackMode
= GlobalStackMode_NONE
;
1040 switch( rParameter
.nSubTypeIndex
)
1043 rParameter
.bSymbols
= true;
1044 rParameter
.bLines
= true;
1047 rParameter
.bSymbols
= false;
1048 rParameter
.bLines
= true;
1051 rParameter
.bSymbols
= false;
1052 rParameter
.bLines
= false;
1055 rParameter
.bSymbols
= true;
1056 rParameter
.bLines
= false;
1060 //--------------------------------------------------------------------------
1061 StockChartDialogController::StockChartDialogController()
1063 bSupports3D
= false;
1065 StockChartDialogController::~StockChartDialogController()
1068 String
StockChartDialogController::getName()
1070 return String( SchResId( STR_TYPE_STOCK
));
1072 Image
StockChartDialogController::getImage( bool bIsHighContrast
)
1074 return SELECT_IMAGE( IMG_TYPE_STOCK
);
1076 const tTemplateServiceChartTypeParameterMap
& StockChartDialogController::getTemplateMap() const
1078 static tTemplateServiceChartTypeParameterMap m_aTemplateMap
=
1079 tTemplateServiceChartTypeParameterMap
1080 ( C2U( "com.sun.star.chart2.template.StockLowHighClose" ), ChartTypeParameter(1) )
1081 ( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ), ChartTypeParameter(2) )
1082 ( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ), ChartTypeParameter(3) )
1083 ( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ),ChartTypeParameter(4) )
1085 return m_aTemplateMap
;
1087 void StockChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& /*rParameter*/ )
1089 rSubTypeList
.Clear();
1090 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_STOCK_1
) );
1091 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_STOCK_2
) );
1092 rSubTypeList
.InsertItem( 3, SELECT_BITMAP( BMP_STOCK_3
) );
1093 rSubTypeList
.InsertItem( 4, SELECT_BITMAP( BMP_STOCK_4
) );
1095 rSubTypeList
.SetItemText( 1, String( SchResId( STR_STOCK_1
)) );
1096 rSubTypeList
.SetItemText( 2, String( SchResId( STR_STOCK_2
)) );
1097 rSubTypeList
.SetItemText( 3, String( SchResId( STR_STOCK_3
)) );
1098 rSubTypeList
.SetItemText( 4, String( SchResId( STR_STOCK_4
)) );
1100 void StockChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
1102 rParameter
.b3DLook
= false;
1103 rParameter
.eStackMode
= GlobalStackMode_NONE
;
1105 //--------------------------------------------------------------------------
1106 CombiColumnLineChartDialogController::CombiColumnLineChartDialogController()
1107 : m_pFT_NumberOfLines(0)
1108 , m_pMF_NumberOfLines(0)
1110 bSupports3D
= false;
1112 CombiColumnLineChartDialogController::~CombiColumnLineChartDialogController()
1114 if(m_pFT_NumberOfLines
)
1115 delete m_pFT_NumberOfLines
;
1116 if(m_pMF_NumberOfLines
)
1117 delete m_pMF_NumberOfLines
;
1119 String
CombiColumnLineChartDialogController::getName()
1121 return String( SchResId( STR_TYPE_COMBI_COLUMN_LINE
));
1123 Image
CombiColumnLineChartDialogController::getImage( bool bIsHighContrast
)
1125 return SELECT_IMAGE( IMG_TYPE_COLUMN_LINE
);
1127 const tTemplateServiceChartTypeParameterMap
& CombiColumnLineChartDialogController::getTemplateMap() const
1129 static tTemplateServiceChartTypeParameterMap m_aTemplateMap
=
1130 tTemplateServiceChartTypeParameterMap
1131 ( C2U( "com.sun.star.chart2.template.ColumnWithLine" ), ChartTypeParameter(1) )
1132 ( C2U( "com.sun.star.chart2.template.StackedColumnWithLine" ), ChartTypeParameter(2,false,false,GlobalStackMode_STACK_Y
) )
1134 return m_aTemplateMap
;
1136 void CombiColumnLineChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& /*rParameter*/ )
1138 rSubTypeList
.Clear();
1139 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_COLUMN_LINE
) );
1140 rSubTypeList
.InsertItem( 2, SELECT_BITMAP( BMP_COLUMN_LINE_STACKED
) );
1142 rSubTypeList
.SetItemText( 1, String( SchResId( STR_LINE_COLUMN
)) );
1143 rSubTypeList
.SetItemText( 2, String( SchResId( STR_LINE_STACKEDCOLUMN
)) );
1145 void CombiColumnLineChartDialogController::showExtraControls( Window
* pParent
, const Point
& rPosition
, const Size
& rSize
)
1147 if(!m_pFT_NumberOfLines
)
1149 m_pFT_NumberOfLines
= new FixedText(pParent
,pParent
->GetStyle());
1150 m_pFT_NumberOfLines
->SetText( String( SchResId( STR_NUMBER_OF_LINES
)) );
1152 if(!m_pMF_NumberOfLines
)
1154 m_pMF_NumberOfLines
= new MetricField(pParent
,pParent
->GetStyle() | WB_SPIN
| WB_REPEAT
| WB_BORDER
);
1155 m_pMF_NumberOfLines
->SetDefaultUnit( FUNIT_CUSTOM
);
1156 m_pMF_NumberOfLines
->SetUnit( FUNIT_CUSTOM
);
1157 m_pMF_NumberOfLines
->SetSpinSize(1);
1158 m_pMF_NumberOfLines
->SetFirst( 1, FUNIT_CUSTOM
);
1159 m_pMF_NumberOfLines
->SetLast( 100, FUNIT_CUSTOM
);
1160 m_pMF_NumberOfLines
->SetMin( 1, FUNIT_CUSTOM
);
1161 m_pMF_NumberOfLines
->SetMax( 100, FUNIT_CUSTOM
);
1162 m_pMF_NumberOfLines
->SetHelpId( HID_SCH_NUM_OF_LINES
);
1164 m_pMF_NumberOfLines
->SetModifyHdl( LINK( this, CombiColumnLineChartDialogController
, ChangeLineCountHdl
) );
1167 Size
aDistanceSize( pParent
->LogicToPixel( Size(RSC_SP_CTRL_DESC_X
,2), MapMode(MAP_APPFONT
) ) );
1168 Size
aMFSize( pParent
->LogicToPixel( Size(20,RSC_CD_TEXTBOX_HEIGHT
), MapMode(MAP_APPFONT
) ) );
1169 m_pMF_NumberOfLines
->SetSizePixel( aMFSize
);
1171 Size
aFTSize(m_pFT_NumberOfLines
->CalcMinimumSize(rSize
.Width()-aMFSize
.Width()-aDistanceSize
.Width()));
1172 m_pFT_NumberOfLines
->SetSizePixel(aFTSize
);
1174 m_pFT_NumberOfLines
->SetPosPixel( Point( rPosition
.X(), rPosition
.Y()+aDistanceSize
.Height()) );
1175 m_pMF_NumberOfLines
->SetPosPixel( Point( rPosition
.X()+aFTSize
.Width()+aDistanceSize
.Width(), rPosition
.Y()) );
1177 m_pFT_NumberOfLines
->Show();
1178 m_pMF_NumberOfLines
->Show();
1180 void CombiColumnLineChartDialogController::hideExtraControls() const
1182 if(m_pFT_NumberOfLines
)
1183 m_pFT_NumberOfLines
->Hide();
1184 if(m_pMF_NumberOfLines
)
1185 m_pMF_NumberOfLines
->Hide();
1187 void CombiColumnLineChartDialogController::fillExtraControls( const ChartTypeParameter
& /*rParameter*/
1188 , const uno::Reference
< XChartDocument
>& xChartModel
1189 , const uno::Reference
< beans::XPropertySet
>& xTemplateProps
) const
1191 if(!m_pMF_NumberOfLines
)
1194 uno::Reference
< frame::XModel
> xModel( xChartModel
, uno::UNO_QUERY
);
1196 uno::Reference
< XDiagram
> xDiagram
= ChartModelHelper::findDiagram( xModel
);
1200 sal_Int32 nNumLines
= 0;
1202 if(xTemplateProps
.is())
1205 xTemplateProps
->getPropertyValue( C2U("NumberOfLines") ) >>= nNumLines
;
1207 catch( uno::Exception
& ex
)
1209 ASSERT_EXCEPTION( ex
);
1213 m_pMF_NumberOfLines
->SetValue( nNumLines
);
1215 sal_Int32 nMaxLines
= ChartModelHelper::getDataSeries( xModel
).size() - 1;
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( C2U( "NumberOfLines" ), uno::makeAny(nNumLines
) );
1230 IMPL_LINK( CombiColumnLineChartDialogController
, ChangeLineCountHdl
, void *, EMPTYARG
)
1232 if( m_pChangeListener
)
1233 m_pChangeListener
->stateChanged(this);
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
)
1245 rParameter
.eStackMode
=GlobalStackMode_STACK_Y
;
1248 rParameter
.eStackMode
=GlobalStackMode_NONE
;
1252 //--------------------------------------------------------------------------
1253 BubbleChartDialogController::BubbleChartDialogController()
1256 BubbleChartDialogController::~BubbleChartDialogController()
1259 String
BubbleChartDialogController::getName()
1261 return String( SchResId( STR_TYPE_BUBBLE
));
1263 Image
BubbleChartDialogController::getImage( bool bIsHighContrast
)
1265 return SELECT_IMAGE( IMG_TYPE_BUBBLE
);
1267 const tTemplateServiceChartTypeParameterMap
& BubbleChartDialogController::getTemplateMap() const
1269 static tTemplateServiceChartTypeParameterMap m_aTemplateMap
=
1270 tTemplateServiceChartTypeParameterMap
1271 ( C2U( "com.sun.star.chart2.template.Bubble" ), ChartTypeParameter(1,true) ) ;
1272 return m_aTemplateMap
;
1274 void BubbleChartDialogController::fillSubTypeList( ValueSet
& rSubTypeList
, bool bIsHighContrast
, const ChartTypeParameter
& /*rParameter*/ )
1276 rSubTypeList
.Clear();
1277 rSubTypeList
.InsertItem( 1, SELECT_BITMAP( BMP_BUBBLE_1
) );
1279 rSubTypeList
.SetItemText( 1, String( SchResId( STR_BUBBLE_1
)) );
1281 void BubbleChartDialogController::adjustParameterToSubType( ChartTypeParameter
& rParameter
)
1283 rParameter
.b3DLook
= false;
1284 rParameter
.eStackMode
= GlobalStackMode_NONE
;
1286 //.............................................................................
1288 //.............................................................................