1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
24 #include "tp_3D_SceneGeometry.hxx"
25 #include "tp_3D_SceneAppearance.hxx"
26 #include "tp_3D_SceneIllumination.hxx"
27 #include <ChartModelHelper.hxx>
28 #include <com/sun/star/beans/XPropertySet.hpp>
33 using namespace ::com::sun::star
;
34 using namespace ::com::sun::star::chart2
;
36 sal_uInt16
View3DDialog::m_nLastPageId
= 0;
38 View3DDialog::View3DDialog(weld::Window
* pParent
, const uno::Reference
< frame::XModel
> & xChartModel
)
39 : GenericDialogController(pParent
, "modules/schart/ui/3dviewdialog.ui", "3DViewDialog")
40 , m_aControllerLocker(xChartModel
)
41 , m_xTabControl(m_xBuilder
->weld_notebook("tabcontrol"))
43 uno::Reference
< beans::XPropertySet
> xSceneProperties( ChartModelHelper::findDiagram( xChartModel
), uno::UNO_QUERY
);
45 m_xTabControl
->append_page("geometry", SchResId(STR_PAGE_PERSPECTIVE
));
46 m_xGeometry
.reset(new ThreeD_SceneGeometry_TabPage(m_xTabControl
->get_page("geometry"), xSceneProperties
, m_aControllerLocker
));
48 m_xTabControl
->append_page("appearance", SchResId(STR_PAGE_APPEARANCE
));
49 m_xAppearance
.reset(new ThreeD_SceneAppearance_TabPage(m_xTabControl
->get_page("appearance"), xChartModel
, m_aControllerLocker
));
51 m_xTabControl
->append_page("illumination", SchResId(STR_PAGE_ILLUMINATION
));
52 m_xIllumination
.reset(new ThreeD_SceneIllumination_TabPage(m_xTabControl
->get_page("illumination"), m_xDialog
.get(),
53 xSceneProperties
, xChartModel
));
55 m_xTabControl
->connect_enter_page(LINK(this, View3DDialog
, ActivatePageHdl
));
57 m_xTabControl
->set_current_page(m_nLastPageId
);
60 IMPL_LINK(View3DDialog
, ActivatePageHdl
, const OString
&, rPage
, void)
62 if (rPage
== "appearance")
63 m_xAppearance
->ActivatePage();
66 View3DDialog::~View3DDialog()
68 m_nLastPageId
= m_xTabControl
->get_current_page();
71 short View3DDialog::run()
73 short nResult
= GenericDialogController::run();
74 if (nResult
== RET_OK
&& m_xGeometry
)
75 m_xGeometry
->commitPendingChanges();
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */