update dev300-m58
[ooovba.git] / chart2 / source / controller / dialogs / dlg_View3D.cxx
blobe3808c3173aafda2c1bb740d20360ca39e39edfa
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dlg_View3D.cxx,v $
10 * $Revision: 1.4 $
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 "dlg_View3D.hxx"
35 #include "dlg_View3D.hrc"
36 #include "Strings.hrc"
37 #include "TabPages.hrc"
38 #include "ResId.hxx"
39 #include "NoWarningThisInCTOR.hxx"
40 #include "tp_3D_SceneGeometry.hxx"
41 #include "tp_3D_SceneAppearance.hxx"
42 #include "tp_3D_SceneIllumination.hxx"
43 #include "ChartModelHelper.hxx"
44 #include "macros.hxx"
45 #include "ControllerLockGuard.hxx"
46 #include <com/sun/star/beans/XPropertySet.hpp>
48 // for RET_OK
49 #include <vcl/msgbox.hxx>
51 //.............................................................................
52 namespace chart
54 //.............................................................................
56 using namespace ::com::sun::star;
57 using namespace ::com::sun::star::chart2;
59 //-----------------------------------------------------------------------------
60 //-------------------------------------------------------------------
61 //-------------------------------------------------------------------
63 // static
64 USHORT View3DDialog::m_nLastPageId = 0;
66 View3DDialog::View3DDialog(Window* pParent, const uno::Reference< frame::XModel > & xChartModel, XColorTable* pColorTable )
67 : TabDialog(pParent,SchResId(DLG_3D_VIEW))
68 , m_aTabControl(this,SchResId(TABCTRL))
69 , m_aBtnOK(this,SchResId(BTN_OK))
70 , m_aBtnCancel(this,SchResId(BTN_CANCEL))
71 , m_aBtnHelp(this,SchResId(BTN_HELP))
72 , m_pGeometry(0)
73 , m_pAppearance(0)
74 , m_pIllumination(0)
75 , m_aControllerLocker(xChartModel)
77 FreeResource();
79 uno::Reference< beans::XPropertySet > xSceneProperties( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
80 m_pGeometry = new ThreeD_SceneGeometry_TabPage(&m_aTabControl,xSceneProperties,m_aControllerLocker);
81 m_pAppearance = new ThreeD_SceneAppearance_TabPage(&m_aTabControl,xChartModel,m_aControllerLocker);
82 m_pIllumination = new ThreeD_SceneIllumination_TabPage(&m_aTabControl,xSceneProperties,xChartModel,pColorTable);
84 m_aTabControl.InsertPage( TP_3D_SCENEGEOMETRY, String(SchResId(STR_PAGE_PERSPECTIVE)) );
85 m_aTabControl.InsertPage( TP_3D_SCENEAPPEARANCE, String(SchResId(STR_PAGE_APPEARANCE)) );
86 m_aTabControl.InsertPage( TP_3D_SCENEILLUMINATION, String(SchResId(STR_PAGE_ILLUMINATION)) );
88 m_aTabControl.SetTabPage( TP_3D_SCENEGEOMETRY, m_pGeometry );
89 m_aTabControl.SetTabPage( TP_3D_SCENEAPPEARANCE, m_pAppearance );
90 m_aTabControl.SetTabPage( TP_3D_SCENEILLUMINATION, m_pIllumination );
92 m_aTabControl.SelectTabPage( m_nLastPageId );
95 View3DDialog::~View3DDialog()
97 delete m_pGeometry;
98 delete m_pAppearance;
99 delete m_pIllumination;
101 m_nLastPageId = m_aTabControl.GetCurPageId();
104 short View3DDialog::Execute()
106 short nResult = TabDialog::Execute();
107 if( nResult == RET_OK )
109 if( m_pGeometry )
110 m_pGeometry->commitPendingChanges();
111 if( m_pAppearance )
112 m_pAppearance->commitPendingChanges();
113 if( m_pIllumination )
114 m_pIllumination->commitPendingChanges();
116 return nResult;
119 //.............................................................................
120 } //namespace chart
121 //.............................................................................