Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "tp_ChartType.hxx"
21 : #include "Strings.hrc"
22 : #include "ResId.hxx"
23 : #include "ChartModelHelper.hxx"
24 : #include "DiagramHelper.hxx"
25 : #include "res_BarGeometry.hxx"
26 : #include "ControllerLockGuard.hxx"
27 : #include "macros.hxx"
28 : #include "GL3DBarChartDialogController.hxx"
29 : #include <unonames.hxx>
30 :
31 : #include <svtools/controldims.hrc>
32 :
33 : #include <vcl/layout.hxx>
34 : #include <vcl/msgbox.hxx>
35 :
36 : namespace chart
37 : {
38 : using namespace ::com::sun::star;
39 : using namespace ::com::sun::star::chart2;
40 :
41 : #define POS_3DSCHEME_SIMPLE 0
42 : #define POS_3DSCHEME_REALISTIC 1
43 :
44 0 : class Dim3DLookResourceGroup : public ChangingResource
45 : {
46 : public:
47 : Dim3DLookResourceGroup(VclBuilderContainer* pWindow);
48 :
49 : void showControls( bool bShow );
50 :
51 : void fillControls( const ChartTypeParameter& rParameter );
52 : void fillParameter( ChartTypeParameter& rParameter );
53 :
54 : private:
55 : DECL_LINK( Dim3DLookCheckHdl, void* );
56 : DECL_LINK( SelectSchemeHdl, void* );
57 :
58 : private:
59 : CheckBox* m_pCB_3DLook;
60 : ListBox* m_pLB_Scheme;
61 : };
62 :
63 0 : Dim3DLookResourceGroup::Dim3DLookResourceGroup(VclBuilderContainer* pWindow)
64 0 : : ChangingResource()
65 : {
66 0 : pWindow->get(m_pCB_3DLook, "3dlook");
67 0 : pWindow->get(m_pLB_Scheme, "3dscheme");
68 :
69 0 : m_pCB_3DLook->SetToggleHdl( LINK( this, Dim3DLookResourceGroup, Dim3DLookCheckHdl ) );
70 0 : m_pLB_Scheme->SetSelectHdl( LINK( this, Dim3DLookResourceGroup, SelectSchemeHdl ) );
71 0 : }
72 :
73 0 : void Dim3DLookResourceGroup::showControls( bool bShow )
74 : {
75 0 : m_pCB_3DLook->Show(bShow);
76 0 : m_pLB_Scheme->Show(bShow);
77 0 : }
78 :
79 0 : void Dim3DLookResourceGroup::fillControls( const ChartTypeParameter& rParameter )
80 : {
81 0 : m_pCB_3DLook->Check(rParameter.b3DLook);
82 0 : m_pLB_Scheme->Enable(rParameter.b3DLook);
83 :
84 0 : if( rParameter.eThreeDLookScheme == ThreeDLookScheme_Simple )
85 0 : m_pLB_Scheme->SelectEntryPos(POS_3DSCHEME_SIMPLE);
86 0 : else if( rParameter.eThreeDLookScheme == ThreeDLookScheme_Realistic )
87 0 : m_pLB_Scheme->SelectEntryPos(POS_3DSCHEME_REALISTIC);
88 : else
89 0 : m_pLB_Scheme->SetNoSelection();
90 0 : }
91 :
92 0 : void Dim3DLookResourceGroup::fillParameter( ChartTypeParameter& rParameter )
93 : {
94 0 : rParameter.b3DLook = m_pCB_3DLook->IsChecked();
95 0 : sal_uInt16 nPos = m_pLB_Scheme->GetSelectEntryPos();
96 0 : if( POS_3DSCHEME_SIMPLE == nPos )
97 0 : rParameter.eThreeDLookScheme = ThreeDLookScheme_Simple;
98 0 : else if( POS_3DSCHEME_REALISTIC == nPos )
99 0 : rParameter.eThreeDLookScheme = ThreeDLookScheme_Realistic;
100 : else
101 0 : rParameter.eThreeDLookScheme = ThreeDLookScheme_Unknown;
102 0 : }
103 :
104 0 : IMPL_LINK_NOARG(Dim3DLookResourceGroup, Dim3DLookCheckHdl)
105 : {
106 0 : if(m_pChangeListener)
107 0 : m_pChangeListener->stateChanged(this);
108 0 : return 0;
109 : }
110 :
111 0 : IMPL_LINK_NOARG(Dim3DLookResourceGroup, SelectSchemeHdl)
112 : {
113 0 : if(m_pChangeListener)
114 0 : m_pChangeListener->stateChanged(this);
115 0 : return 0;
116 : }
117 :
118 0 : class SortByXValuesResourceGroup : public ChangingResource
119 : {
120 : public:
121 : SortByXValuesResourceGroup(VclBuilderContainer* pWindow);
122 :
123 : void showControls( bool bShow );
124 :
125 : void fillControls( const ChartTypeParameter& rParameter );
126 : void fillParameter( ChartTypeParameter& rParameter );
127 :
128 : private:
129 : DECL_LINK( SortByXValuesCheckHdl, void* );
130 :
131 : private:
132 : CheckBox* m_pCB_XValueSorting;
133 : };
134 :
135 0 : SortByXValuesResourceGroup::SortByXValuesResourceGroup(VclBuilderContainer* pWindow )
136 0 : : ChangingResource()
137 : {
138 0 : pWindow->get(m_pCB_XValueSorting, "sort");
139 0 : m_pCB_XValueSorting->SetToggleHdl( LINK( this, SortByXValuesResourceGroup, SortByXValuesCheckHdl ) );
140 0 : }
141 :
142 0 : void SortByXValuesResourceGroup::showControls( bool bShow )
143 : {
144 0 : m_pCB_XValueSorting->Show(bShow);
145 0 : }
146 :
147 0 : void SortByXValuesResourceGroup::fillControls( const ChartTypeParameter& rParameter )
148 : {
149 0 : m_pCB_XValueSorting->Check( rParameter.bSortByXValues );
150 0 : }
151 :
152 0 : void SortByXValuesResourceGroup::fillParameter( ChartTypeParameter& rParameter )
153 : {
154 0 : rParameter.bSortByXValues = m_pCB_XValueSorting->IsChecked();
155 0 : }
156 :
157 0 : IMPL_LINK_NOARG(SortByXValuesResourceGroup, SortByXValuesCheckHdl)
158 : {
159 0 : if(m_pChangeListener)
160 0 : m_pChangeListener->stateChanged(this);
161 0 : return 0;
162 : }
163 :
164 0 : class StackingResourceGroup : public ChangingResource
165 : {
166 : public:
167 : StackingResourceGroup(VclBuilderContainer* pWindow);
168 :
169 : void showControls( bool bShow, bool bShowDeepStacking );
170 :
171 : void fillControls( const ChartTypeParameter& rParameter );
172 : void fillParameter( ChartTypeParameter& rParameter );
173 :
174 : private:
175 : DECL_LINK( StackingChangeHdl, RadioButton* );
176 : DECL_LINK( StackingEnableHdl, void* );
177 :
178 : private:
179 : CheckBox* m_pCB_Stacked;
180 : RadioButton* m_pRB_Stack_Y;
181 : RadioButton* m_pRB_Stack_Y_Percent;
182 : RadioButton* m_pRB_Stack_Z;
183 :
184 : bool m_bShowDeepStacking;
185 : };
186 :
187 0 : StackingResourceGroup::StackingResourceGroup(VclBuilderContainer* pWindow)
188 : : ChangingResource()
189 0 : , m_bShowDeepStacking(true)
190 : {
191 0 : pWindow->get(m_pCB_Stacked, "stack");
192 0 : pWindow->get(m_pRB_Stack_Y, "ontop");
193 0 : pWindow->get(m_pRB_Stack_Y_Percent, "percent");
194 0 : pWindow->get(m_pRB_Stack_Z, "deep");
195 :
196 0 : m_pCB_Stacked->SetToggleHdl( LINK( this, StackingResourceGroup, StackingEnableHdl ) );
197 0 : m_pRB_Stack_Y->SetToggleHdl( LINK( this, StackingResourceGroup, StackingChangeHdl ) );
198 0 : m_pRB_Stack_Y_Percent->SetToggleHdl( LINK( this, StackingResourceGroup, StackingChangeHdl ) );
199 0 : m_pRB_Stack_Z->SetToggleHdl( LINK( this, StackingResourceGroup, StackingChangeHdl ) );
200 0 : }
201 :
202 0 : void StackingResourceGroup::showControls( bool bShow, bool bShowDeepStacking )
203 : {
204 0 : m_bShowDeepStacking = bShowDeepStacking;
205 0 : m_pCB_Stacked->Show(bShow);
206 0 : m_pRB_Stack_Y->Show(bShow);
207 0 : m_pRB_Stack_Y_Percent->Show(bShow);
208 0 : m_pRB_Stack_Z->Show(bShow&&bShowDeepStacking);
209 0 : }
210 :
211 0 : void StackingResourceGroup::fillControls( const ChartTypeParameter& rParameter )
212 : {
213 0 : m_pCB_Stacked->Check( rParameter.eStackMode!=GlobalStackMode_NONE
214 0 : && rParameter.eStackMode!=GlobalStackMode_STACK_Z ); //todo remove this condition if z stacking radio button is really used
215 0 : switch( rParameter.eStackMode )
216 : {
217 : case GlobalStackMode_STACK_Y:
218 0 : m_pRB_Stack_Y->Check();
219 0 : break;
220 : case GlobalStackMode_STACK_Y_PERCENT:
221 0 : m_pRB_Stack_Y_Percent->Check();
222 0 : break;
223 : case GlobalStackMode_STACK_Z:
224 : //todo uncomment this condition if z stacking radio button is really used
225 : /*
226 : if( rParameter.b3DLook )
227 : m_pRB_Stack_Z->Check();
228 : else
229 : */
230 0 : m_pRB_Stack_Y->Check();
231 0 : break;
232 : default:
233 0 : m_pRB_Stack_Y->Check();
234 0 : break;
235 : }
236 : //dis/enabling
237 0 : m_pCB_Stacked->Enable( !rParameter.bXAxisWithValues );
238 0 : m_pRB_Stack_Y->Enable( m_pCB_Stacked->IsChecked() && !rParameter.bXAxisWithValues );
239 0 : m_pRB_Stack_Y_Percent->Enable( m_pCB_Stacked->IsChecked() && !rParameter.bXAxisWithValues );
240 0 : m_pRB_Stack_Z->Enable( m_pCB_Stacked->IsChecked() && rParameter.b3DLook );
241 0 : }
242 0 : void StackingResourceGroup::fillParameter( ChartTypeParameter& rParameter )
243 : {
244 0 : if(!m_pCB_Stacked->IsChecked())
245 0 : rParameter.eStackMode = GlobalStackMode_NONE;
246 0 : else if(m_pRB_Stack_Y->IsChecked())
247 0 : rParameter.eStackMode = GlobalStackMode_STACK_Y;
248 0 : else if(m_pRB_Stack_Y_Percent->IsChecked())
249 0 : rParameter.eStackMode = GlobalStackMode_STACK_Y_PERCENT;
250 0 : else if(m_pRB_Stack_Z->IsChecked())
251 0 : rParameter.eStackMode = GlobalStackMode_STACK_Z;
252 0 : }
253 0 : IMPL_LINK( StackingResourceGroup, StackingChangeHdl, RadioButton*, pRadio )
254 : {
255 : //for each radio click ther are coming two change events
256 : //first uncheck of previous button -> ignore that call
257 : //the second call gives the check of the new button
258 0 : if( m_pChangeListener && pRadio && pRadio->IsChecked() )
259 0 : m_pChangeListener->stateChanged(this);
260 0 : return 0;
261 : }
262 0 : IMPL_LINK_NOARG(StackingResourceGroup, StackingEnableHdl)
263 : {
264 0 : if( m_pChangeListener )
265 0 : m_pChangeListener->stateChanged(this);
266 0 : return 0;
267 : }
268 :
269 0 : class GL3DResourceGroup : public ChangingResource
270 : {
271 : public:
272 : GL3DResourceGroup( VclBuilderContainer* pWindow );
273 :
274 : void showControls( bool bShow );
275 : void fillControls( const ChartTypeParameter& rParam );
276 : void fillParameter( ChartTypeParameter& rParam );
277 :
278 : private:
279 : DECL_LINK( SettingChangedHdl, void* );
280 : private:
281 : CheckBox* m_pCB_RoundedEdge;
282 : };
283 :
284 0 : GL3DResourceGroup::GL3DResourceGroup( VclBuilderContainer* pWindow )
285 : {
286 0 : pWindow->get(m_pCB_RoundedEdge, "rounded-edge");
287 0 : m_pCB_RoundedEdge->SetToggleHdl( LINK(this, GL3DResourceGroup, SettingChangedHdl) );
288 0 : }
289 :
290 0 : void GL3DResourceGroup::showControls( bool bShow )
291 : {
292 0 : m_pCB_RoundedEdge->Show(bShow);
293 0 : }
294 :
295 0 : void GL3DResourceGroup::fillControls( const ChartTypeParameter& rParam )
296 : {
297 0 : m_pCB_RoundedEdge->Check(rParam.mbRoundedEdge);
298 0 : }
299 :
300 0 : void GL3DResourceGroup::fillParameter( ChartTypeParameter& rParam )
301 : {
302 0 : rParam.mbRoundedEdge = m_pCB_RoundedEdge->IsChecked();
303 0 : }
304 :
305 0 : IMPL_LINK_NOARG( GL3DResourceGroup, SettingChangedHdl )
306 : {
307 0 : if (m_pChangeListener)
308 0 : m_pChangeListener->stateChanged(this);
309 0 : return 0;
310 : }
311 :
312 : class SplinePropertiesDialog : public ModalDialog
313 : {
314 : public:
315 : SplinePropertiesDialog( Window* pParent );
316 : virtual ~SplinePropertiesDialog();
317 :
318 : void fillControls( const ChartTypeParameter& rParameter );
319 : void fillParameter( ChartTypeParameter& rParameter, bool bSmoothLines );
320 :
321 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
322 :
323 : private:
324 : DECL_LINK( SplineTypeListBoxHdl, void* );
325 :
326 : private:
327 : ListBox* m_pLB_Spline_Type;
328 :
329 : NumericField* m_pMF_SplineResolution;
330 : FixedText* m_pFT_SplineOrder;
331 : NumericField* m_pMF_SplineOrder;
332 : };
333 :
334 : const sal_uInt16 CUBIC_SPLINE_POS = 0;
335 : const sal_uInt16 B_SPLINE_POS = 1;
336 :
337 0 : SplinePropertiesDialog::SplinePropertiesDialog( Window* pParent )
338 0 : : ModalDialog( pParent, "SmoothLinesDialog", "modules/schart/ui/smoothlinesdlg.ui")
339 : {
340 0 : get(m_pLB_Spline_Type, "SplineTypeComboBox");
341 0 : get(m_pMF_SplineResolution, "ResolutionSpinbutton");
342 0 : get(m_pFT_SplineOrder, "PolynomialsLabel");
343 0 : get(m_pMF_SplineOrder, "PolynomialsSpinButton");
344 :
345 0 : this->SetText( SCH_RESSTR( STR_DLG_SMOOTH_LINE_PROPERTIES ) );
346 :
347 0 : m_pLB_Spline_Type->SetSelectHdl( LINK (this, SplinePropertiesDialog, SplineTypeListBoxHdl ) );
348 0 : }
349 :
350 0 : SplinePropertiesDialog::~SplinePropertiesDialog()
351 : {
352 0 : }
353 :
354 0 : void SplinePropertiesDialog::StateChanged( StateChangedType nType )
355 : {
356 0 : Dialog::StateChanged( nType );
357 0 : }
358 :
359 0 : void SplinePropertiesDialog::fillControls( const ChartTypeParameter& rParameter )
360 : {
361 0 : switch(rParameter.eCurveStyle)
362 : {
363 : case CurveStyle_CUBIC_SPLINES:
364 0 : m_pLB_Spline_Type->SelectEntryPos(CUBIC_SPLINE_POS);
365 0 : break;
366 : case CurveStyle_B_SPLINES:
367 0 : m_pLB_Spline_Type->SelectEntryPos(B_SPLINE_POS);
368 0 : break;
369 : default:
370 0 : m_pLB_Spline_Type->SelectEntryPos(CUBIC_SPLINE_POS);
371 0 : break;
372 : }
373 0 : m_pMF_SplineOrder->SetValue( rParameter.nSplineOrder );
374 0 : m_pMF_SplineResolution->SetValue( rParameter.nCurveResolution );
375 :
376 : //dis/enabling
377 0 : m_pFT_SplineOrder->Enable(B_SPLINE_POS == m_pLB_Spline_Type->GetSelectEntryPos());
378 0 : m_pMF_SplineOrder->Enable(B_SPLINE_POS == m_pLB_Spline_Type->GetSelectEntryPos());
379 0 : }
380 0 : void SplinePropertiesDialog::fillParameter( ChartTypeParameter& rParameter, bool bSmoothLines )
381 : {
382 0 : if(!bSmoothLines)
383 0 : rParameter.eCurveStyle=CurveStyle_LINES;
384 0 : else if(CUBIC_SPLINE_POS == m_pLB_Spline_Type->GetSelectEntryPos())
385 0 : rParameter.eCurveStyle=CurveStyle_CUBIC_SPLINES;
386 0 : else if(B_SPLINE_POS == m_pLB_Spline_Type->GetSelectEntryPos())
387 0 : rParameter.eCurveStyle=CurveStyle_B_SPLINES;
388 :
389 0 : rParameter.nCurveResolution = static_cast< sal_Int32 >( m_pMF_SplineResolution->GetValue());
390 0 : rParameter.nSplineOrder = static_cast< sal_Int32 >( m_pMF_SplineOrder->GetValue());
391 0 : }
392 0 : IMPL_LINK_NOARG(SplinePropertiesDialog, SplineTypeListBoxHdl)
393 : {
394 0 : m_pFT_SplineOrder->Enable(B_SPLINE_POS == m_pLB_Spline_Type->GetSelectEntryPos());
395 0 : m_pMF_SplineOrder->Enable(B_SPLINE_POS == m_pLB_Spline_Type->GetSelectEntryPos());
396 0 : return 0;
397 : }
398 :
399 : class SteppedPropertiesDialog : public ModalDialog
400 : {
401 : public:
402 : SteppedPropertiesDialog( Window* pParent );
403 : virtual ~SteppedPropertiesDialog();
404 :
405 : void fillControls( const ChartTypeParameter& rParameter );
406 : void fillParameter( ChartTypeParameter& rParameter, bool bSteppedLines );
407 :
408 : virtual void StateChanged( StateChangedType nType ) SAL_OVERRIDE;
409 :
410 : private:
411 :
412 : private:
413 : RadioButton* m_pRB_Start;
414 : RadioButton* m_pRB_End;
415 : RadioButton* m_pRB_CenterX;
416 : RadioButton* m_pRB_CenterY;
417 : };
418 :
419 0 : SteppedPropertiesDialog::SteppedPropertiesDialog( Window* pParent )
420 0 : : ModalDialog( pParent, "SteppedLinesDialog", "modules/schart/ui/steppedlinesdlg.ui")
421 : {
422 0 : get(m_pRB_Start, "step_start_rb");
423 0 : get(m_pRB_End, "step_end_rb");
424 0 : get(m_pRB_CenterX, "step_center_x_rb");
425 0 : get(m_pRB_CenterY, "step_center_y_rb");
426 :
427 0 : SetText(SCH_RESSTR(STR_DLG_STEPPED_LINE_PROPERTIES));
428 0 : }
429 :
430 0 : SteppedPropertiesDialog::~SteppedPropertiesDialog()
431 : {
432 0 : }
433 :
434 0 : void SteppedPropertiesDialog::StateChanged( StateChangedType nType )
435 : {
436 0 : Dialog::StateChanged( nType );
437 0 : }
438 :
439 0 : void SteppedPropertiesDialog::fillControls( const ChartTypeParameter& rParameter )
440 : {
441 0 : switch(rParameter.eCurveStyle)
442 : {
443 : case CurveStyle_STEP_END:
444 0 : m_pRB_End->Check();
445 0 : break;
446 : case CurveStyle_STEP_CENTER_X:
447 0 : m_pRB_CenterX->Check();
448 0 : break;
449 : case CurveStyle_STEP_CENTER_Y:
450 0 : m_pRB_CenterY->Check();
451 0 : break;
452 : default: // includes CurveStyle_STEP_START
453 0 : m_pRB_Start->Check();
454 0 : break;
455 : }
456 0 : }
457 0 : void SteppedPropertiesDialog::fillParameter( ChartTypeParameter& rParameter, bool bSteppedLines )
458 : {
459 0 : if (!bSteppedLines)
460 0 : rParameter.eCurveStyle=CurveStyle_LINES;
461 0 : else if(m_pRB_CenterY->IsChecked())
462 0 : rParameter.eCurveStyle=CurveStyle_STEP_CENTER_Y;
463 0 : else if(m_pRB_Start->IsChecked())
464 0 : rParameter.eCurveStyle=CurveStyle_STEP_START;
465 0 : else if(m_pRB_End->IsChecked())
466 0 : rParameter.eCurveStyle=CurveStyle_STEP_END;
467 0 : else if(m_pRB_CenterX->IsChecked())
468 0 : rParameter.eCurveStyle=CurveStyle_STEP_CENTER_X;
469 0 : }
470 :
471 : #define POS_LINETYPE_STRAIGHT 0
472 : #define POS_LINETYPE_SMOOTH 1
473 : #define POS_LINETYPE_STEPPED 2
474 :
475 0 : class SplineResourceGroup : public ChangingResource
476 : {
477 : public:
478 : SplineResourceGroup(VclBuilderContainer* pWindow);
479 :
480 : void showControls( bool bShow );
481 :
482 : void fillControls( const ChartTypeParameter& rParameter );
483 : void fillParameter( ChartTypeParameter& rParameter );
484 :
485 : private:
486 : DECL_LINK( LineTypeChangeHdl, void* );
487 : DECL_LINK( SplineDetailsDialogHdl, void* );
488 : DECL_LINK( SteppedDetailsDialogHdl, void* );
489 : SplinePropertiesDialog& getSplinePropertiesDialog();
490 : SteppedPropertiesDialog& getSteppedPropertiesDialog();
491 :
492 : private:
493 : FixedText* m_pFT_LineType;
494 : ListBox* m_pLB_LineType;
495 : PushButton* m_pPB_DetailsDialog;
496 : boost::scoped_ptr< SplinePropertiesDialog > m_pSplinePropertiesDialog;
497 : boost::scoped_ptr< SteppedPropertiesDialog > m_pSteppedPropertiesDialog;
498 : };
499 :
500 0 : SplineResourceGroup::SplineResourceGroup(VclBuilderContainer* pWindow)
501 0 : : ChangingResource()
502 : {
503 0 : pWindow->get(m_pFT_LineType, "linetypeft");
504 0 : pWindow->get(m_pLB_LineType, "linetype");
505 0 : pWindow->get(m_pPB_DetailsDialog, "properties");
506 :
507 0 : m_pLB_LineType->SetSelectHdl( LINK( this, SplineResourceGroup, LineTypeChangeHdl ) );
508 0 : }
509 :
510 0 : SplinePropertiesDialog& SplineResourceGroup::getSplinePropertiesDialog()
511 : {
512 0 : if( !m_pSplinePropertiesDialog.get() )
513 0 : m_pSplinePropertiesDialog.reset( new SplinePropertiesDialog( m_pPB_DetailsDialog->GetParentDialog() ) );
514 0 : return *m_pSplinePropertiesDialog;
515 : }
516 :
517 0 : SteppedPropertiesDialog& SplineResourceGroup::getSteppedPropertiesDialog()
518 : {
519 0 : if( !m_pSteppedPropertiesDialog.get() )
520 : {
521 0 : m_pSteppedPropertiesDialog.reset( new SteppedPropertiesDialog( m_pPB_DetailsDialog->GetParentDialog() ) );
522 : }
523 0 : return *m_pSteppedPropertiesDialog;
524 : }
525 :
526 0 : void SplineResourceGroup::showControls( bool bShow )
527 : {
528 0 : m_pFT_LineType->Show(bShow);
529 0 : m_pLB_LineType->Show(bShow);
530 0 : m_pPB_DetailsDialog->Show(bShow);
531 0 : }
532 :
533 0 : void SplineResourceGroup::fillControls( const ChartTypeParameter& rParameter )
534 : {
535 0 : switch (rParameter.eCurveStyle)
536 : {
537 : case CurveStyle_LINES:
538 0 : m_pLB_LineType->SelectEntryPos(POS_LINETYPE_STRAIGHT);
539 0 : m_pPB_DetailsDialog->Enable(false);
540 0 : break;
541 : case CurveStyle_CUBIC_SPLINES:
542 : case CurveStyle_B_SPLINES:
543 0 : m_pLB_LineType->SelectEntryPos(POS_LINETYPE_SMOOTH);
544 0 : m_pPB_DetailsDialog->Enable(true);
545 0 : m_pPB_DetailsDialog->SetClickHdl( LINK( this, SplineResourceGroup, SplineDetailsDialogHdl ) );
546 0 : m_pPB_DetailsDialog->SetQuickHelpText( SCH_RESSTR(STR_DLG_SMOOTH_LINE_PROPERTIES) );
547 0 : getSplinePropertiesDialog().fillControls( rParameter );
548 0 : break;
549 : case CurveStyle_STEP_START:
550 : case CurveStyle_STEP_END:
551 : case CurveStyle_STEP_CENTER_X:
552 : case CurveStyle_STEP_CENTER_Y:
553 0 : m_pLB_LineType->SelectEntryPos(POS_LINETYPE_STEPPED);
554 0 : m_pPB_DetailsDialog->Enable(true);
555 0 : m_pPB_DetailsDialog->SetClickHdl( LINK( this, SplineResourceGroup, SteppedDetailsDialogHdl ) );
556 0 : m_pPB_DetailsDialog->SetQuickHelpText( SCH_RESSTR(STR_DLG_STEPPED_LINE_PROPERTIES) );
557 0 : getSteppedPropertiesDialog().fillControls( rParameter );
558 0 : break;
559 : default:
560 0 : m_pLB_LineType->SetNoSelection();
561 0 : m_pPB_DetailsDialog->Enable(false);
562 : }
563 0 : }
564 0 : void SplineResourceGroup::fillParameter( ChartTypeParameter& rParameter )
565 : {
566 0 : switch (m_pLB_LineType->GetSelectEntryPos())
567 : {
568 : case POS_LINETYPE_SMOOTH:
569 0 : getSplinePropertiesDialog().fillParameter( rParameter, true );
570 0 : break;
571 : case POS_LINETYPE_STEPPED:
572 0 : getSteppedPropertiesDialog().fillParameter( rParameter, true );
573 0 : break;
574 : default: // includes POS_LINETYPE_STRAIGHT
575 0 : rParameter.eCurveStyle = CurveStyle_LINES;
576 0 : break;
577 : }
578 0 : }
579 0 : IMPL_LINK_NOARG(SplineResourceGroup, LineTypeChangeHdl)
580 : {
581 0 : if( m_pChangeListener )
582 0 : m_pChangeListener->stateChanged(this);
583 0 : return 0;
584 : }
585 0 : IMPL_LINK_NOARG(SplineResourceGroup, SplineDetailsDialogHdl)
586 : {
587 :
588 0 : ChartTypeParameter aOldParameter;
589 0 : getSplinePropertiesDialog().fillParameter( aOldParameter, POS_LINETYPE_SMOOTH == m_pLB_LineType->GetSelectEntryPos() );
590 :
591 0 : sal_uInt16 iOldLineTypePos = m_pLB_LineType->GetSelectEntryPos();
592 0 : m_pLB_LineType->SelectEntryPos(POS_LINETYPE_SMOOTH);
593 0 : if( RET_OK == getSplinePropertiesDialog().Execute() )
594 : {
595 0 : if( m_pChangeListener )
596 0 : m_pChangeListener->stateChanged(this);
597 : }
598 : else
599 : {
600 : //restore old state:
601 0 : m_pLB_LineType->SelectEntryPos( iOldLineTypePos );
602 0 : getSplinePropertiesDialog().fillControls( aOldParameter );
603 : }
604 0 : return 0;
605 : }
606 0 : IMPL_LINK_NOARG(SplineResourceGroup, SteppedDetailsDialogHdl)
607 : {
608 :
609 0 : ChartTypeParameter aOldParameter;
610 0 : getSteppedPropertiesDialog().fillParameter( aOldParameter, POS_LINETYPE_STEPPED == m_pLB_LineType->GetSelectEntryPos() );
611 :
612 0 : sal_uInt16 iOldLineTypePos = m_pLB_LineType->GetSelectEntryPos();
613 0 : m_pLB_LineType->SelectEntryPos(POS_LINETYPE_STEPPED);
614 0 : if( RET_OK == getSteppedPropertiesDialog().Execute() )
615 : {
616 0 : if( m_pChangeListener )
617 0 : m_pChangeListener->stateChanged(this);
618 : }
619 : else
620 : {
621 : //restore old state:
622 0 : m_pLB_LineType->SelectEntryPos( iOldLineTypePos );
623 0 : getSteppedPropertiesDialog().fillControls( aOldParameter );
624 : }
625 0 : return 0;
626 : }
627 :
628 0 : class GeometryResourceGroup : public ChangingResource
629 : {
630 : public:
631 : GeometryResourceGroup(VclBuilderContainer* pWindow);
632 :
633 : void showControls( bool bShow );
634 :
635 : void fillControls( const ChartTypeParameter& rParameter );
636 : void fillParameter( ChartTypeParameter& rParameter );
637 :
638 : private:
639 : DECL_LINK( GeometryChangeHdl, void* );
640 :
641 : private:
642 : BarGeometryResources m_aGeometryResources;
643 : };
644 :
645 0 : GeometryResourceGroup::GeometryResourceGroup(VclBuilderContainer* pWindow )
646 : : ChangingResource()
647 0 : , m_aGeometryResources( pWindow )
648 : {
649 0 : m_aGeometryResources.SetSelectHdl( LINK( this, GeometryResourceGroup, GeometryChangeHdl ) );
650 0 : }
651 :
652 0 : void GeometryResourceGroup::showControls( bool bShow )
653 : {
654 0 : m_aGeometryResources.Show(bShow);
655 0 : }
656 :
657 0 : void GeometryResourceGroup::fillControls( const ChartTypeParameter& rParameter )
658 : {
659 0 : sal_uInt16 nGeometry3D = static_cast<sal_uInt16>(rParameter.nGeometry3D);
660 0 : m_aGeometryResources.SelectEntryPos(nGeometry3D);
661 0 : m_aGeometryResources.Enable(rParameter.b3DLook);
662 0 : }
663 :
664 0 : void GeometryResourceGroup::fillParameter( ChartTypeParameter& rParameter )
665 : {
666 0 : rParameter.nGeometry3D = 1;
667 0 : if( m_aGeometryResources.GetSelectEntryCount() )
668 0 : rParameter.nGeometry3D = m_aGeometryResources.GetSelectEntryPos();
669 0 : }
670 :
671 0 : IMPL_LINK_NOARG(GeometryResourceGroup, GeometryChangeHdl)
672 : {
673 0 : if( m_pChangeListener )
674 0 : m_pChangeListener->stateChanged(this);
675 0 : return 0;
676 : }
677 :
678 0 : ChartTypeTabPage::ChartTypeTabPage(Window* pParent
679 : , const uno::Reference< XChartDocument >& xChartModel
680 : , const uno::Reference< uno::XComponentContext >& xContext
681 : , bool bDoLiveUpdate, bool bHideDescription)
682 : : OWizardPage(pParent, "tp_ChartType",
683 : "modules/schart/ui/tp_ChartType.ui")
684 0 : , m_pDim3DLookResourceGroup( new Dim3DLookResourceGroup(this) )
685 0 : , m_pStackingResourceGroup( new StackingResourceGroup(this) )
686 0 : , m_pSplineResourceGroup( new SplineResourceGroup(this) )
687 0 : , m_pGeometryResourceGroup( new GeometryResourceGroup( this ) )
688 0 : , m_pSortByXValuesResourceGroup( new SortByXValuesResourceGroup( this ) )
689 0 : , m_pGL3DResourceGroup(new GL3DResourceGroup(this))
690 : , m_xChartModel( xChartModel )
691 : , m_xCC( xContext )
692 : , m_aChartTypeDialogControllerList(0)
693 : , m_pCurrentMainType(0)
694 : , m_nChangingCalls(0)
695 : , m_bDoLiveUpdate(bDoLiveUpdate)
696 0 : , m_aTimerTriggeredControllerLock( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) )
697 : {
698 0 : get(m_pFT_ChooseType, "FT_CAPTION_FOR_WIZARD");
699 0 : get(m_pMainTypeList, "charttype");
700 0 : get(m_pSubTypeList, "subtype");
701 0 : Size aSize(m_pSubTypeList->LogicToPixel(Size(150, 50), MAP_APPFONT));
702 0 : m_pSubTypeList->set_width_request(aSize.Width());
703 0 : m_pSubTypeList->set_height_request(aSize.Height());
704 :
705 0 : if( bHideDescription )
706 : {
707 0 : m_pFT_ChooseType->Hide();
708 : }
709 : else
710 : {
711 0 : m_pFT_ChooseType->SetStyle(m_pFT_ChooseType->GetStyle() | WB_NOLABEL);
712 : }
713 :
714 0 : this->SetText( SCH_RESSTR(STR_PAGE_CHARTTYPE) );
715 :
716 0 : m_pMainTypeList->SetStyle(m_pMainTypeList->GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_FLATVALUESET | WB_3DLOOK );
717 0 : m_pMainTypeList->SetSelectHdl( LINK( this, ChartTypeTabPage, SelectMainTypeHdl ) );
718 0 : m_pSubTypeList->SetSelectHdl( LINK( this, ChartTypeTabPage, SelectSubTypeHdl ) );
719 :
720 0 : m_pSubTypeList->SetStyle(m_pSubTypeList->GetStyle() |
721 0 : WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD | WB_FLATVALUESET | WB_3DLOOK );
722 0 : m_pSubTypeList->SetColCount(4);
723 0 : m_pSubTypeList->SetLineCount(1);
724 :
725 0 : bool bEnableComplexChartTypes = true;
726 0 : uno::Reference< beans::XPropertySet > xProps( m_xChartModel, uno::UNO_QUERY );
727 0 : if ( xProps.is() )
728 : {
729 : try
730 : {
731 0 : xProps->getPropertyValue("EnableComplexChartTypes") >>= bEnableComplexChartTypes;
732 : }
733 0 : catch( const uno::Exception& e )
734 : {
735 : ASSERT_EXCEPTION( e );
736 : }
737 : }
738 :
739 0 : m_aChartTypeDialogControllerList.push_back(new ColumnChartDialogController() );
740 0 : m_aChartTypeDialogControllerList.push_back(new BarChartDialogController() );
741 0 : m_aChartTypeDialogControllerList.push_back(new PieChartDialogController() );
742 0 : m_aChartTypeDialogControllerList.push_back(new AreaChartDialogController() );
743 0 : m_aChartTypeDialogControllerList.push_back(new LineChartDialogController() );
744 0 : if (bEnableComplexChartTypes)
745 : {
746 0 : m_aChartTypeDialogControllerList.push_back(new XYChartDialogController() );
747 0 : m_aChartTypeDialogControllerList.push_back(new BubbleChartDialogController() );
748 : }
749 0 : m_aChartTypeDialogControllerList.push_back(new NetChartDialogController() );
750 0 : if (bEnableComplexChartTypes)
751 : {
752 0 : m_aChartTypeDialogControllerList.push_back(new StockChartDialogController() );
753 : }
754 0 : m_aChartTypeDialogControllerList.push_back(new CombiColumnLineChartDialogController() );
755 : #if ENABLE_GL3D_BARCHART
756 0 : m_aChartTypeDialogControllerList.push_back(new GL3DBarChartDialogController());
757 : #endif
758 :
759 0 : ::std::vector< ChartTypeDialogController* >::const_iterator aIter = m_aChartTypeDialogControllerList.begin();
760 0 : const ::std::vector< ChartTypeDialogController* >::const_iterator aEnd = m_aChartTypeDialogControllerList.end();
761 0 : for( ; aIter != aEnd; ++aIter )
762 : {
763 0 : m_pMainTypeList->InsertEntry( (*aIter)->getName(), (*aIter)->getImage() );
764 0 : (*aIter)->setChangeListener( this );
765 : }
766 :
767 0 : m_pDim3DLookResourceGroup->setChangeListener( this );
768 0 : m_pStackingResourceGroup->setChangeListener( this );
769 0 : m_pSplineResourceGroup->setChangeListener( this );
770 0 : m_pGeometryResourceGroup->setChangeListener( this );
771 0 : m_pSortByXValuesResourceGroup->setChangeListener( this );
772 0 : m_pGL3DResourceGroup->setChangeListener(this);
773 0 : }
774 :
775 0 : ChartTypeTabPage::~ChartTypeTabPage()
776 : {
777 : //delete all dialog controller
778 0 : ::std::vector< ChartTypeDialogController* >::const_iterator aIter = m_aChartTypeDialogControllerList.begin();
779 0 : const ::std::vector< ChartTypeDialogController* >::const_iterator aEnd = m_aChartTypeDialogControllerList.end();
780 0 : for( ; aIter != aEnd; ++aIter )
781 : {
782 0 : delete *aIter;
783 : }
784 0 : m_aChartTypeDialogControllerList.clear();
785 :
786 : //delete all resource helper
787 0 : delete m_pDim3DLookResourceGroup;
788 0 : delete m_pStackingResourceGroup;
789 0 : delete m_pSplineResourceGroup;
790 0 : delete m_pGeometryResourceGroup;
791 0 : delete m_pSortByXValuesResourceGroup;
792 0 : delete m_pGL3DResourceGroup;
793 0 : }
794 0 : ChartTypeParameter ChartTypeTabPage::getCurrentParamter() const
795 : {
796 0 : ChartTypeParameter aParameter;
797 0 : aParameter.nSubTypeIndex = static_cast<sal_Int32>( m_pSubTypeList->GetSelectItemId() );
798 0 : m_pDim3DLookResourceGroup->fillParameter( aParameter );
799 0 : m_pStackingResourceGroup->fillParameter( aParameter );
800 0 : m_pSplineResourceGroup->fillParameter( aParameter );
801 0 : m_pGeometryResourceGroup->fillParameter( aParameter );
802 0 : m_pSortByXValuesResourceGroup->fillParameter( aParameter );
803 0 : m_pGL3DResourceGroup->fillParameter(aParameter);
804 0 : return aParameter;
805 : }
806 0 : void ChartTypeTabPage::commitToModel( const ChartTypeParameter& rParameter )
807 : {
808 0 : if( !m_pCurrentMainType )
809 0 : return;
810 :
811 0 : m_aTimerTriggeredControllerLock.startTimer();
812 0 : ControllerLockGuardUNO aLockedControllers( uno::Reference< frame::XModel >( m_xChartModel, uno::UNO_QUERY ) );
813 0 : m_pCurrentMainType->commitToModel( rParameter, m_xChartModel );
814 : }
815 0 : void ChartTypeTabPage::stateChanged( ChangingResource* /*pResource*/ )
816 : {
817 0 : if(m_nChangingCalls)
818 0 : return;
819 0 : m_nChangingCalls++;
820 :
821 0 : ChartTypeParameter aParameter( this->getCurrentParamter() );
822 0 : if( m_pCurrentMainType )
823 : {
824 0 : m_pCurrentMainType->adjustParameterToSubType( aParameter );
825 0 : m_pCurrentMainType->adjustSubTypeAndEnableControls( aParameter );
826 : }
827 0 : if( m_bDoLiveUpdate )
828 0 : commitToModel( aParameter );
829 :
830 : //detect the new ThreeDLookScheme
831 0 : uno::Reference<XDiagram> xDiagram = ChartModelHelper::findDiagram(m_xChartModel);
832 0 : aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme(xDiagram);
833 : try
834 : {
835 0 : uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
836 0 : xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
837 : }
838 0 : catch ( const uno::Exception& ex )
839 : {
840 : ASSERT_EXCEPTION(ex);
841 : }
842 : //the controls have to be enabled/disabled accordingly
843 0 : this->fillAllControls( aParameter );
844 :
845 0 : m_nChangingCalls--;
846 : }
847 0 : ChartTypeDialogController* ChartTypeTabPage::getSelectedMainType()
848 : {
849 0 : ChartTypeDialogController* pTypeController = 0;
850 : ::std::vector< ChartTypeDialogController* >::size_type nM = static_cast< ::std::vector< ChartTypeDialogController* >::size_type >(
851 0 : m_pMainTypeList->GetSelectEntryPos() );
852 0 : if( nM<m_aChartTypeDialogControllerList.size() )
853 0 : pTypeController = m_aChartTypeDialogControllerList[nM];
854 0 : return pTypeController;
855 : }
856 0 : IMPL_LINK_NOARG(ChartTypeTabPage, SelectSubTypeHdl)
857 : {
858 0 : if( m_pCurrentMainType )
859 : {
860 0 : ChartTypeParameter aParameter( this->getCurrentParamter() );
861 0 : m_pCurrentMainType->adjustParameterToSubType( aParameter );
862 0 : this->fillAllControls( aParameter, false );
863 0 : if( m_bDoLiveUpdate )
864 0 : commitToModel( aParameter );
865 : }
866 0 : return 0;
867 : }
868 :
869 0 : IMPL_LINK_NOARG(ChartTypeTabPage, SelectMainTypeHdl)
870 : {
871 0 : selectMainType();
872 0 : return 0;
873 : }
874 :
875 0 : void ChartTypeTabPage::selectMainType()
876 : {
877 0 : ChartTypeParameter aParameter( this->getCurrentParamter() );
878 :
879 0 : if( m_pCurrentMainType )
880 : {
881 0 : m_pCurrentMainType->adjustParameterToSubType( aParameter );
882 0 : m_pCurrentMainType->hideExtraControls();
883 : }
884 :
885 0 : m_pCurrentMainType = this->getSelectedMainType();
886 0 : if( m_pCurrentMainType )
887 : {
888 0 : this->showAllControls(*m_pCurrentMainType);
889 :
890 0 : m_pCurrentMainType->adjustParameterToMainType( aParameter );
891 0 : if( m_bDoLiveUpdate )
892 0 : commitToModel( aParameter );
893 : //detect the new ThreeDLookScheme
894 0 : aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( ChartModelHelper::findDiagram( m_xChartModel ) );
895 0 : if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Realistic )
896 0 : aParameter.eThreeDLookScheme=ThreeDLookScheme_Realistic;
897 :
898 0 : uno::Reference<XDiagram> xDiagram = ChartModelHelper::findDiagram(m_xChartModel);
899 : try
900 : {
901 0 : uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
902 0 : xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
903 : }
904 0 : catch ( const uno::Exception& ex )
905 : {
906 : ASSERT_EXCEPTION(ex);
907 : }
908 :
909 0 : this->fillAllControls( aParameter );
910 0 : uno::Reference< beans::XPropertySet > xTemplateProps( this->getCurrentTemplate(), uno::UNO_QUERY );
911 0 : m_pCurrentMainType->fillExtraControls(aParameter,m_xChartModel,xTemplateProps);
912 0 : }
913 0 : }
914 :
915 0 : void ChartTypeTabPage::showAllControls( ChartTypeDialogController& rTypeController )
916 : {
917 0 : m_pSubTypeList->Show();
918 :
919 0 : bool bShow = rTypeController.shouldShow_3DLookControl();
920 0 : m_pDim3DLookResourceGroup->showControls( bShow );
921 0 : bShow = rTypeController.shouldShow_StackingControl();
922 0 : m_pStackingResourceGroup->showControls( bShow, rTypeController.shouldShow_DeepStackingControl() );
923 0 : bShow = rTypeController.shouldShow_SplineControl();
924 0 : m_pSplineResourceGroup->showControls( bShow );
925 0 : bShow = rTypeController.shouldShow_GeometryControl();
926 0 : m_pGeometryResourceGroup->showControls( bShow );
927 0 : bShow = rTypeController.shouldShow_SortByXValuesResourceGroup();
928 0 : m_pSortByXValuesResourceGroup->showControls( bShow );
929 0 : bShow = rTypeController.shouldShow_GL3DResourceGroup();
930 0 : m_pGL3DResourceGroup->showControls(bShow);
931 0 : rTypeController.showExtraControls(this);
932 0 : }
933 :
934 0 : void ChartTypeTabPage::fillAllControls( const ChartTypeParameter& rParameter, bool bAlsoResetSubTypeList )
935 : {
936 0 : m_nChangingCalls++;
937 0 : if( m_pCurrentMainType && bAlsoResetSubTypeList )
938 : {
939 0 : m_pCurrentMainType->fillSubTypeList(*m_pSubTypeList, rParameter);
940 : }
941 0 : m_pSubTypeList->SelectItem( static_cast<sal_uInt16>( rParameter.nSubTypeIndex) );
942 0 : m_pDim3DLookResourceGroup->fillControls( rParameter );
943 0 : m_pStackingResourceGroup->fillControls( rParameter );
944 0 : m_pSplineResourceGroup->fillControls( rParameter );
945 0 : m_pGeometryResourceGroup->fillControls( rParameter );
946 0 : m_pSortByXValuesResourceGroup->fillControls( rParameter );
947 0 : m_pGL3DResourceGroup->fillControls(rParameter);
948 0 : m_nChangingCalls--;
949 0 : }
950 :
951 0 : void ChartTypeTabPage::initializePage()
952 : {
953 0 : if( !m_xChartModel.is() )
954 0 : return;
955 0 : uno::Reference< lang::XMultiServiceFactory > xTemplateManager( m_xChartModel->getChartTypeManager(), uno::UNO_QUERY );
956 0 : uno::Reference< frame::XModel > xModel( m_xChartModel, uno::UNO_QUERY);
957 0 : uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xModel ) );
958 : DiagramHelper::tTemplateWithServiceName aTemplate =
959 0 : DiagramHelper::getTemplateForDiagram( xDiagram, xTemplateManager );
960 0 : OUString aServiceName( aTemplate.second );
961 :
962 0 : bool bFound = false;
963 :
964 0 : ::std::vector< ChartTypeDialogController* >::iterator aIter = m_aChartTypeDialogControllerList.begin();
965 0 : const ::std::vector< ChartTypeDialogController* >::const_iterator aEnd = m_aChartTypeDialogControllerList.end();
966 0 : for( sal_uInt16 nM=0; aIter != aEnd; ++aIter, ++nM )
967 : {
968 0 : if( (*aIter)->isSubType(aServiceName) )
969 : {
970 0 : bFound = true;
971 :
972 0 : m_pMainTypeList->SelectEntryPos( nM );
973 0 : this->showAllControls( **aIter );
974 0 : uno::Reference< beans::XPropertySet > xTemplateProps( aTemplate.first, uno::UNO_QUERY );
975 0 : ChartTypeParameter aParameter = (*aIter)->getChartTypeParameterForService( aServiceName, xTemplateProps );
976 0 : m_pCurrentMainType = this->getSelectedMainType();
977 :
978 : //set ThreeDLookScheme
979 0 : aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( xDiagram );
980 0 : if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Realistic )
981 0 : aParameter.eThreeDLookScheme=ThreeDLookScheme_Realistic;
982 :
983 : try
984 : {
985 0 : uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
986 0 : xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues;
987 : }
988 0 : catch (const uno::Exception& ex)
989 : {
990 : ASSERT_EXCEPTION(ex);
991 : }
992 :
993 0 : this->fillAllControls( aParameter );
994 0 : if( m_pCurrentMainType )
995 0 : m_pCurrentMainType->fillExtraControls(aParameter,m_xChartModel,xTemplateProps);
996 0 : break;
997 : }
998 : }
999 :
1000 0 : if( !bFound )
1001 : {
1002 0 : m_pSubTypeList->Hide();
1003 0 : m_pDim3DLookResourceGroup->showControls( false );
1004 0 : m_pStackingResourceGroup->showControls( false, false );
1005 0 : m_pSplineResourceGroup->showControls( false );
1006 0 : m_pGeometryResourceGroup->showControls( false );
1007 0 : m_pSortByXValuesResourceGroup->showControls( false );
1008 0 : m_pGL3DResourceGroup->showControls(false);
1009 0 : }
1010 : }
1011 :
1012 0 : bool ChartTypeTabPage::commitPage( ::svt::WizardTypes::CommitPageReason /*eReason*/ )
1013 : {
1014 : //commit changes to model
1015 0 : if( !m_bDoLiveUpdate && m_pCurrentMainType )
1016 : {
1017 0 : ChartTypeParameter aParameter( this->getCurrentParamter() );
1018 0 : m_pCurrentMainType->adjustParameterToSubType( aParameter );
1019 0 : commitToModel( aParameter );
1020 : }
1021 :
1022 0 : return true; // return false if this page should not be left
1023 : }
1024 :
1025 0 : uno::Reference< XChartTypeTemplate > ChartTypeTabPage::getCurrentTemplate() const
1026 : {
1027 0 : if( m_pCurrentMainType && m_xChartModel.is() )
1028 : {
1029 0 : ChartTypeParameter aParameter( this->getCurrentParamter() );
1030 0 : m_pCurrentMainType->adjustParameterToSubType( aParameter );
1031 0 : uno::Reference< lang::XMultiServiceFactory > xTemplateManager( m_xChartModel->getChartTypeManager(), uno::UNO_QUERY );
1032 0 : return m_pCurrentMainType->getCurrentTemplate( aParameter, xTemplateManager );
1033 : }
1034 0 : return 0;
1035 : }
1036 :
1037 45 : } //namespace chart
1038 :
1039 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|