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 = VclPtr<ThreeD_SceneGeometry_TabPage>::Create(m_pTabControl,xSceneProperties,m_aControllerLocker);
53 0 : m_pAppearance = VclPtr<ThreeD_SceneAppearance_TabPage>::Create(m_pTabControl,xChartModel,m_aControllerLocker);
54 0 : m_pIllumination = VclPtr<ThreeD_SceneIllumination_TabPage>::Create(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 : disposeOnce();
70 0 : }
71 :
72 0 : void View3DDialog::dispose()
73 : {
74 0 : m_pGeometry.disposeAndClear();
75 0 : m_pAppearance.disposeAndClear();
76 0 : m_pIllumination.disposeAndClear();
77 0 : if (m_pTabControl)
78 0 : m_nLastPageId = m_pTabControl->GetCurPageId();
79 0 : m_pTabControl.clear();
80 0 : TabDialog::dispose();
81 0 : }
82 :
83 0 : short View3DDialog::Execute()
84 : {
85 0 : short nResult = TabDialog::Execute();
86 0 : if( nResult == RET_OK )
87 : {
88 0 : if( m_pGeometry )
89 0 : m_pGeometry->commitPendingChanges();
90 : }
91 0 : return nResult;
92 : }
93 :
94 57 : } //namespace chart
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|