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 :
21 : #include "dlg_View3D.hxx"
22 : #include "dlg_View3D.hrc"
23 : #include "Strings.hrc"
24 : #include "TabPages.hrc"
25 : #include "ResId.hxx"
26 : #include "NoWarningThisInCTOR.hxx"
27 : #include "tp_3D_SceneGeometry.hxx"
28 : #include "tp_3D_SceneAppearance.hxx"
29 : #include "tp_3D_SceneIllumination.hxx"
30 : #include "ChartModelHelper.hxx"
31 : #include "macros.hxx"
32 : #include "ControllerLockGuard.hxx"
33 : #include <com/sun/star/beans/XPropertySet.hpp>
34 :
35 : // for RET_OK
36 : #include <vcl/msgbox.hxx>
37 :
38 : //.............................................................................
39 : namespace chart
40 : {
41 : //.............................................................................
42 :
43 : using namespace ::com::sun::star;
44 : using namespace ::com::sun::star::chart2;
45 :
46 : //-----------------------------------------------------------------------------
47 : //-------------------------------------------------------------------
48 : //-------------------------------------------------------------------
49 :
50 : sal_uInt16 View3DDialog::m_nLastPageId = 0;
51 :
52 0 : View3DDialog::View3DDialog(Window* pParent, const uno::Reference< frame::XModel > & xChartModel, const XColorListRef &pColorTable )
53 : : TabDialog(pParent,SchResId(DLG_3D_VIEW))
54 : , m_aTabControl(this,SchResId(TABCTRL))
55 : , m_aBtnOK(this,SchResId(BTN_OK))
56 : , m_aBtnCancel(this,SchResId(BTN_CANCEL))
57 : , m_aBtnHelp(this,SchResId(BTN_HELP))
58 : , m_pGeometry(0)
59 : , m_pAppearance(0)
60 : , m_pIllumination(0)
61 0 : , m_aControllerLocker(xChartModel)
62 : {
63 0 : FreeResource();
64 :
65 0 : uno::Reference< beans::XPropertySet > xSceneProperties( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
66 0 : m_pGeometry = new ThreeD_SceneGeometry_TabPage(&m_aTabControl,xSceneProperties,m_aControllerLocker);
67 0 : m_pAppearance = new ThreeD_SceneAppearance_TabPage(&m_aTabControl,xChartModel,m_aControllerLocker);
68 0 : m_pIllumination = new ThreeD_SceneIllumination_TabPage(&m_aTabControl,xSceneProperties,xChartModel,pColorTable);
69 :
70 0 : m_aTabControl.InsertPage( TP_3D_SCENEGEOMETRY, String(SchResId(STR_PAGE_PERSPECTIVE)) );
71 0 : m_aTabControl.InsertPage( TP_3D_SCENEAPPEARANCE, String(SchResId(STR_PAGE_APPEARANCE)) );
72 0 : m_aTabControl.InsertPage( TP_3D_SCENEILLUMINATION, String(SchResId(STR_PAGE_ILLUMINATION)) );
73 :
74 0 : m_aTabControl.SetTabPage( TP_3D_SCENEGEOMETRY, m_pGeometry );
75 0 : m_aTabControl.SetTabPage( TP_3D_SCENEAPPEARANCE, m_pAppearance );
76 0 : m_aTabControl.SetTabPage( TP_3D_SCENEILLUMINATION, m_pIllumination );
77 :
78 0 : m_aTabControl.SelectTabPage( m_nLastPageId );
79 0 : }
80 :
81 0 : View3DDialog::~View3DDialog()
82 : {
83 0 : delete m_pGeometry;
84 0 : delete m_pAppearance;
85 0 : delete m_pIllumination;
86 :
87 0 : m_nLastPageId = m_aTabControl.GetCurPageId();
88 0 : }
89 :
90 0 : short View3DDialog::Execute()
91 : {
92 0 : short nResult = TabDialog::Execute();
93 0 : if( nResult == RET_OK )
94 : {
95 0 : if( m_pGeometry )
96 0 : m_pGeometry->commitPendingChanges();
97 0 : if( m_pAppearance )
98 0 : m_pAppearance->commitPendingChanges();
99 0 : if( m_pIllumination )
100 0 : m_pIllumination->commitPendingChanges();
101 : }
102 0 : return nResult;
103 : }
104 :
105 : //.............................................................................
106 3 : } //namespace chart
107 : //.............................................................................
108 :
109 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|