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