1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_chart2.hxx"
26 
27 #include "dlg_View3D.hxx"
28 #include "dlg_View3D.hrc"
29 #include "Strings.hrc"
30 #include "TabPages.hrc"
31 #include "ResId.hxx"
32 #include "NoWarningThisInCTOR.hxx"
33 #include "tp_3D_SceneGeometry.hxx"
34 #include "tp_3D_SceneAppearance.hxx"
35 #include "tp_3D_SceneIllumination.hxx"
36 #include "ChartModelHelper.hxx"
37 #include "macros.hxx"
38 #include "ControllerLockGuard.hxx"
39 #include <com/sun/star/beans/XPropertySet.hpp>
40 
41 // for RET_OK
42 #include <vcl/msgbox.hxx>
43 
44 //.............................................................................
45 namespace chart
46 {
47 //.............................................................................
48 
49 using namespace ::com::sun::star;
50 using namespace ::com::sun::star::chart2;
51 
52 //-----------------------------------------------------------------------------
53 //-------------------------------------------------------------------
54 //-------------------------------------------------------------------
55 
56 sal_uInt16 View3DDialog::m_nLastPageId = 0;
57 
58 View3DDialog::View3DDialog(Window* pParent, const uno::Reference< frame::XModel > & xChartModel, XColorList* pColorTable )
59     : TabDialog(pParent,SchResId(DLG_3D_VIEW))
60     , m_aTabControl(this,SchResId(TABCTRL))
61     , m_aBtnOK(this,SchResId(BTN_OK))
62 	, m_aBtnCancel(this,SchResId(BTN_CANCEL))
63 	, m_aBtnHelp(this,SchResId(BTN_HELP))
64     , m_pGeometry(0)
65     , m_pAppearance(0)
66     , m_pIllumination(0)
67     , m_aControllerLocker(xChartModel)
68 {
69     FreeResource();
70 
71     uno::Reference< beans::XPropertySet > xSceneProperties( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
72     m_pGeometry   = new ThreeD_SceneGeometry_TabPage(&m_aTabControl,xSceneProperties,m_aControllerLocker);
73     m_pAppearance = new ThreeD_SceneAppearance_TabPage(&m_aTabControl,xChartModel,m_aControllerLocker);
74     m_pIllumination = new ThreeD_SceneIllumination_TabPage(&m_aTabControl,xSceneProperties,xChartModel,pColorTable);
75 
76     m_aTabControl.InsertPage( TP_3D_SCENEGEOMETRY, String(SchResId(STR_PAGE_PERSPECTIVE)) );
77     m_aTabControl.InsertPage( TP_3D_SCENEAPPEARANCE, String(SchResId(STR_PAGE_APPEARANCE)) );
78     m_aTabControl.InsertPage( TP_3D_SCENEILLUMINATION, String(SchResId(STR_PAGE_ILLUMINATION)) );
79 
80     m_aTabControl.SetTabPage( TP_3D_SCENEGEOMETRY, m_pGeometry );
81     m_aTabControl.SetTabPage( TP_3D_SCENEAPPEARANCE, m_pAppearance );
82     m_aTabControl.SetTabPage( TP_3D_SCENEILLUMINATION, m_pIllumination );
83 
84     m_aTabControl.SelectTabPage( m_nLastPageId );
85 }
86 
87 View3DDialog::~View3DDialog()
88 {
89     delete m_pGeometry;
90     delete m_pAppearance;
91     delete m_pIllumination;
92 
93     m_nLastPageId = m_aTabControl.GetCurPageId();
94 }
95 
96 short View3DDialog::Execute()
97 {
98     short nResult = TabDialog::Execute();
99     if( nResult == RET_OK )
100     {
101         if( m_pGeometry )
102             m_pGeometry->commitPendingChanges();
103         if( m_pAppearance )
104             m_pAppearance->commitPendingChanges();
105         if( m_pIllumination )
106             m_pIllumination->commitPendingChanges();
107     }
108     return nResult;
109 }
110 
111 //.............................................................................
112 } //namespace chart
113 //.............................................................................
114