Debian Codegraph @

chart2/source/controller/dialogs/dlg_View3D.cxx

raw
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
22 #include "tp_3D_SceneGeometry.hxx"
23 #include "tp_3D_SceneAppearance.hxx"
24 #include "tp_3D_SceneIllumination.hxx"
25 #include <ChartModel.hxx>
26 #include <Diagram.hxx>
27
28 #include <vcl/tabs.hrc>
29
30 namespace chart
31 {
32
33 using namespace ::com::sun::star;
34
35 sal_uInt16 View3DDialog::m_nLastPageId = 0;
36
37 View3DDialog::View3DDialog(weld::Window* pParent, const rtl::Reference<::chart::ChartModel> & xChartModel)
38 : GenericDialogController(pParent, u"modules/schart/ui/3dviewdialog.ui"_ustr, u"3DViewDialog"_ustr)
39 , m_aControllerLocker(xChartModel)
40 , m_xTabControl(m_xBuilder->weld_notebook(u"tabcontrol"_ustr))
41 {
42 rtl::Reference< Diagram > xSceneProperties = xChartModel->getFirstChartDiagram();
43 OUString aStr = RID_L + RID_TAB_CHART_PERSPECTIVE.sIconName;
44 m_xTabControl->append_page(u"geometry"_ustr, TabResId(RID_TAB_CHART_PERSPECTIVE.aLabel), &aStr);
45 m_xGeometry.reset(new ThreeD_SceneGeometry_TabPage(m_xTabControl->get_page(u"geometry"_ustr), xSceneProperties, m_aControllerLocker));
46
47 aStr = RID_L + RID_TAB_CHART_APPEARANCE.sIconName;
48 m_xTabControl->append_page(u"appearance"_ustr, TabResId(RID_TAB_CHART_APPEARANCE.aLabel), &aStr);
49 m_xAppearance.reset(new ThreeD_SceneAppearance_TabPage(m_xTabControl->get_page(u"appearance"_ustr), xChartModel, m_aControllerLocker));
50
51 aStr = RID_L + RID_TAB_CHART_ILLUMINATION.sIconName;
52 m_xTabControl->append_page(u"illumination"_ustr, TabResId(RID_TAB_CHART_ILLUMINATION.aLabel), &aStr);
53 m_xIllumination.reset(new ThreeD_SceneIllumination_TabPage(m_xTabControl->get_page(u"illumination"_ustr), m_xDialog.get(),
54 xSceneProperties, xChartModel));
55
56 m_xTabControl->connect_enter_page(LINK(this, View3DDialog, ActivatePageHdl));
57
58 m_xTabControl->set_current_page(m_nLastPageId);
59 }
60
61 IMPL_LINK(View3DDialog, ActivatePageHdl, const OUString&, rPage, void)
62 {
63 if (rPage == "appearance")
64 m_xAppearance->ActivatePage();
65 }
66
67 View3DDialog::~View3DDialog()
68 {
69 m_nLastPageId = m_xTabControl->get_current_page();
70 }
71
72 short View3DDialog::run()
73 {
74 short nResult = GenericDialogController::run();
75 if (nResult == RET_OK && m_xGeometry)
76 m_xGeometry->commitPendingChanges();
77 return nResult;
78 }
79
80 } //namespace chart
81
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */