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