1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_chart2.hxx"
30 
31 #include "dlg_View3D.hxx"
32 #include "dlg_View3D.hrc"
33 #include "Strings.hrc"
34 #include "TabPages.hrc"
35 #include "ResId.hxx"
36 #include "NoWarningThisInCTOR.hxx"
37 #include "tp_3D_SceneGeometry.hxx"
38 #include "tp_3D_SceneAppearance.hxx"
39 #include "tp_3D_SceneIllumination.hxx"
40 #include "ChartModelHelper.hxx"
41 #include "macros.hxx"
42 #include "ControllerLockGuard.hxx"
43 #include <com/sun/star/beans/XPropertySet.hpp>
44 
45 // for RET_OK
46 #include <vcl/msgbox.hxx>
47 
48 //.............................................................................
49 namespace chart
50 {
51 //.............................................................................
52 
53 using namespace ::com::sun::star;
54 using namespace ::com::sun::star::chart2;
55 
56 //-----------------------------------------------------------------------------
57 //-------------------------------------------------------------------
58 //-------------------------------------------------------------------
59 
60 sal_uInt16 View3DDialog::m_nLastPageId = 0;
61 
62 View3DDialog::View3DDialog(Window* pParent, const uno::Reference< frame::XModel > & xChartModel, XColorTable* pColorTable )
63     : TabDialog(pParent,SchResId(DLG_3D_VIEW))
64     , m_aTabControl(this,SchResId(TABCTRL))
65     , m_aBtnOK(this,SchResId(BTN_OK))
66 	, m_aBtnCancel(this,SchResId(BTN_CANCEL))
67 	, m_aBtnHelp(this,SchResId(BTN_HELP))
68     , m_pGeometry(0)
69     , m_pAppearance(0)
70     , m_pIllumination(0)
71     , m_aControllerLocker(xChartModel)
72 {
73     FreeResource();
74 
75     uno::Reference< beans::XPropertySet > xSceneProperties( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
76     m_pGeometry   = new ThreeD_SceneGeometry_TabPage(&m_aTabControl,xSceneProperties,m_aControllerLocker);
77     m_pAppearance = new ThreeD_SceneAppearance_TabPage(&m_aTabControl,xChartModel,m_aControllerLocker);
78     m_pIllumination = new ThreeD_SceneIllumination_TabPage(&m_aTabControl,xSceneProperties,xChartModel,pColorTable);
79 
80     m_aTabControl.InsertPage( TP_3D_SCENEGEOMETRY, String(SchResId(STR_PAGE_PERSPECTIVE)) );
81     m_aTabControl.InsertPage( TP_3D_SCENEAPPEARANCE, String(SchResId(STR_PAGE_APPEARANCE)) );
82     m_aTabControl.InsertPage( TP_3D_SCENEILLUMINATION, String(SchResId(STR_PAGE_ILLUMINATION)) );
83 
84     m_aTabControl.SetTabPage( TP_3D_SCENEGEOMETRY, m_pGeometry );
85     m_aTabControl.SetTabPage( TP_3D_SCENEAPPEARANCE, m_pAppearance );
86     m_aTabControl.SetTabPage( TP_3D_SCENEILLUMINATION, m_pIllumination );
87 
88     m_aTabControl.SelectTabPage( m_nLastPageId );
89 }
90 
91 View3DDialog::~View3DDialog()
92 {
93     delete m_pGeometry;
94     delete m_pAppearance;
95     delete m_pIllumination;
96 
97     m_nLastPageId = m_aTabControl.GetCurPageId();
98 }
99 
100 short View3DDialog::Execute()
101 {
102     short nResult = TabDialog::Execute();
103     if( nResult == RET_OK )
104     {
105         if( m_pGeometry )
106             m_pGeometry->commitPendingChanges();
107         if( m_pAppearance )
108             m_pAppearance->commitPendingChanges();
109         if( m_pIllumination )
110             m_pIllumination->commitPendingChanges();
111     }
112     return nResult;
113 }
114 
115 //.............................................................................
116 } //namespace chart
117 //.............................................................................
118