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