Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / chart2 / source / controller / dialogs / dlg_View3D.cxx
blob8c7e97122f08a0f20d8d547018ef23ae05ef22f8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <dlg_View3D.hxx>
21 #include <strings.hrc>
22 #include "TabPageIds.h"
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 <ControllerLockGuard.hxx>
29 #include <com/sun/star/beans/XPropertySet.hpp>
31 namespace chart
34 using namespace ::com::sun::star;
35 using namespace ::com::sun::star::chart2;
37 sal_uInt16 View3DDialog::m_nLastPageId = 0;
39 View3DDialog::View3DDialog(vcl::Window* pParent, const uno::Reference< frame::XModel > & xChartModel)
40 : TabDialog(pParent, "3DViewDialog", "modules/schart/ui/3dviewdialog.ui")
41 , m_pGeometry(nullptr)
42 , m_pAppearance(nullptr)
43 , m_pIllumination(nullptr)
44 , m_aControllerLocker(xChartModel)
46 get(m_pTabControl, "tabcontrol");
48 uno::Reference< beans::XPropertySet > xSceneProperties( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
49 m_pGeometry = VclPtr<ThreeD_SceneGeometry_TabPage>::Create(m_pTabControl,xSceneProperties,m_aControllerLocker);
50 m_pAppearance = VclPtr<ThreeD_SceneAppearance_TabPage>::Create(m_pTabControl,xChartModel,m_aControllerLocker);
51 m_pIllumination = VclPtr<ThreeD_SceneIllumination_TabPage>::Create(m_pTabControl,xSceneProperties,xChartModel);
53 m_pTabControl->InsertPage( TP_3D_SCENEGEOMETRY, SchResId(STR_PAGE_PERSPECTIVE) );
54 m_pTabControl->InsertPage( TP_3D_SCENEAPPEARANCE, SchResId(STR_PAGE_APPEARANCE) );
55 m_pTabControl->InsertPage( TP_3D_SCENEILLUMINATION, SchResId(STR_PAGE_ILLUMINATION) );
57 m_pTabControl->SetTabPage( TP_3D_SCENEGEOMETRY, m_pGeometry );
58 m_pTabControl->SetTabPage( TP_3D_SCENEAPPEARANCE, m_pAppearance );
59 m_pTabControl->SetTabPage( TP_3D_SCENEILLUMINATION, m_pIllumination );
61 m_pTabControl->SelectTabPage( m_nLastPageId );
64 View3DDialog::~View3DDialog()
66 disposeOnce();
69 void View3DDialog::dispose()
71 m_pGeometry.disposeAndClear();
72 m_pAppearance.disposeAndClear();
73 m_pIllumination.disposeAndClear();
74 if (m_pTabControl)
75 m_nLastPageId = m_pTabControl->GetCurPageId();
76 m_pTabControl.clear();
77 TabDialog::dispose();
80 short View3DDialog::Execute()
82 short nResult = TabDialog::Execute();
83 if( nResult == RET_OK )
85 if( m_pGeometry )
86 m_pGeometry->commitPendingChanges();
88 return nResult;
91 } //namespace chart
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */