summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-06-06 10:37:21 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-06-08 16:17:45 +0200
commitd00a8b05c057d9260c5a44408d9a815121ee6cba (patch)
tree0ad731b379068244d6477c3c4b1f0af97262712a /chart2/source
parent1d137f07cb7cff1f7bcf12b51ceca6f56059b7ef (diff)
weld View3DDialog
Change-Id: Ifd689c54574c08f026f6760efb39b5f927cb2625 Reviewed-on: https://gerrit.libreoffice.org/73604 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/controller/dialogs/dlg_View3D.cxx54
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx133
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx38
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx197
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx52
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx252
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx79
-rw-r--r--chart2/source/controller/inc/dlg_View3D.hxx24
-rw-r--r--chart2/source/controller/main/ChartController_Properties.cxx4
9 files changed, 379 insertions, 454 deletions
diff --git a/chart2/source/controller/dialogs/dlg_View3D.cxx b/chart2/source/controller/dialogs/dlg_View3D.cxx
index fc329ce6b733..03a5fcc299f5 100644
--- a/chart2/source/controller/dialogs/dlg_View3D.cxx
+++ b/chart2/source/controller/dialogs/dlg_View3D.cxx
@@ -35,52 +35,44 @@ using namespace ::com::sun::star::chart2;
sal_uInt16 View3DDialog::m_nLastPageId = 0;
-View3DDialog::View3DDialog(vcl::Window* pParent, const uno::Reference< frame::XModel > & xChartModel)
- : TabDialog(pParent, "3DViewDialog", "modules/schart/ui/3dviewdialog.ui")
- , m_pGeometry(nullptr)
- , m_pAppearance(nullptr)
- , m_pIllumination(nullptr)
+View3DDialog::View3DDialog(weld::Window* pParent, const uno::Reference< frame::XModel > & xChartModel)
+ : GenericDialogController(pParent, "modules/schart/ui/3dviewdialog.ui", "3DViewDialog")
, m_aControllerLocker(xChartModel)
+ , m_xTabControl(m_xBuilder->weld_notebook("tabcontrol"))
{
- get(m_pTabControl, "tabcontrol");
-
uno::Reference< beans::XPropertySet > xSceneProperties( ChartModelHelper::findDiagram( xChartModel ), uno::UNO_QUERY );
- m_pGeometry = VclPtr<ThreeD_SceneGeometry_TabPage>::Create(m_pTabControl,xSceneProperties,m_aControllerLocker);
- m_pAppearance = VclPtr<ThreeD_SceneAppearance_TabPage>::Create(m_pTabControl,xChartModel,m_aControllerLocker);
- m_pIllumination = VclPtr<ThreeD_SceneIllumination_TabPage>::Create(m_pTabControl,xSceneProperties,xChartModel);
- m_pTabControl->InsertPage( TP_3D_SCENEGEOMETRY, SchResId(STR_PAGE_PERSPECTIVE) );
- m_pTabControl->InsertPage( TP_3D_SCENEAPPEARANCE, SchResId(STR_PAGE_APPEARANCE) );
- m_pTabControl->InsertPage( TP_3D_SCENEILLUMINATION, SchResId(STR_PAGE_ILLUMINATION) );
+ m_xTabControl->append_page("geometry", SchResId(STR_PAGE_PERSPECTIVE));
+ m_xGeometry.reset(new ThreeD_SceneGeometry_TabPage(m_xTabControl->get_page("geometry"), xSceneProperties, m_aControllerLocker));
+
+ m_xTabControl->append_page("appearance", SchResId(STR_PAGE_APPEARANCE));
+ m_xAppearance.reset(new ThreeD_SceneAppearance_TabPage(m_xTabControl->get_page("appearance"), xChartModel, m_aControllerLocker));
+
+ m_xTabControl->append_page("illumination", SchResId(STR_PAGE_ILLUMINATION));
+ m_xIllumination.reset(new ThreeD_SceneIllumination_TabPage(m_xTabControl->get_page("illumination"), m_xDialog.get(),
+ xSceneProperties, xChartModel));
- m_pTabControl->SetTabPage( TP_3D_SCENEGEOMETRY, m_pGeometry );
- m_pTabControl->SetTabPage( TP_3D_SCENEAPPEARANCE, m_pAppearance );
- m_pTabControl->SetTabPage( TP_3D_SCENEILLUMINATION, m_pIllumination );
+ m_xTabControl->connect_enter_page(LINK(this, View3DDialog, ActivatePageHdl));
- m_pTabControl->SelectTabPage( m_nLastPageId );
+ m_xTabControl->set_current_page(m_nLastPageId);
}
-View3DDialog::~View3DDialog()
+IMPL_LINK(View3DDialog, ActivatePageHdl, const OString&, rPage, void)
{
- disposeOnce();
+ if (rPage == "appearance")
+ m_xAppearance->ActivatePage();
}
-void View3DDialog::dispose()
+View3DDialog::~View3DDialog()
{
- m_pGeometry.disposeAndClear();
- m_pAppearance.disposeAndClear();
- m_pIllumination.disposeAndClear();
- if (m_pTabControl)
- m_nLastPageId = m_pTabControl->GetCurPageId();
- m_pTabControl.clear();
- TabDialog::dispose();
+ m_nLastPageId = m_xTabControl->get_current_page();
}
-short View3DDialog::Execute()
+short View3DDialog::run()
{
- short nResult = TabDialog::Execute();
- if( nResult == RET_OK && m_pGeometry )
- m_pGeometry->commitPendingChanges();
+ short nResult = GenericDialogController::run();
+ if (nResult == RET_OK && m_xGeometry)
+ m_xGeometry->commitPendingChanges();
return nResult;
}
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
index 781cd535b47c..1168fe0f18c7 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/drawing/ShadeMode.hpp>
#include <tools/diagnose_ex.h>
+#include <vcl/svapp.hxx>
using namespace ::com::sun::star;
@@ -86,53 +87,34 @@ namespace chart
#define POS_3DSCHEME_REALISTIC 1
#define POS_3DSCHEME_CUSTOM 2
-ThreeD_SceneAppearance_TabPage::ThreeD_SceneAppearance_TabPage(
- vcl::Window* pWindow
- , const uno::Reference< frame::XModel > & xChartModel
- , ControllerLockHelper & rControllerLockHelper )
- : TabPage ( pWindow
- , "tp_3D_SceneAppearance"
- , "modules/schart/ui/tp_3D_SceneAppearance.ui")
- , m_xChartModel ( xChartModel )
- , m_bUpdateOtherControls( true )
- , m_bCommitToModel( true )
- , m_rControllerLockHelper( rControllerLockHelper )
+ThreeD_SceneAppearance_TabPage::ThreeD_SceneAppearance_TabPage(weld::Container* pParent,
+ const uno::Reference<frame::XModel>& xChartModel,
+ ControllerLockHelper& rControllerLockHelper)
+ : m_xChartModel(xChartModel)
+ , m_bUpdateOtherControls(true)
+ , m_bCommitToModel(true)
+ , m_rControllerLockHelper(rControllerLockHelper)
+ , m_xBuilder(Application::CreateBuilder(pParent, "modules/schart/ui/tp_3D_SceneAppearance.ui"))
+ , m_xContainer(m_xBuilder->weld_container("tp_3D_SceneAppearance"))
+ , m_xLB_Scheme(m_xBuilder->weld_combo_box("LB_SCHEME"))
+ , m_xCB_Shading(m_xBuilder->weld_check_button("CB_SHADING"))
+ , m_xCB_ObjectLines(m_xBuilder->weld_check_button("CB_OBJECTLINES"))
+ , m_xCB_RoundedEdge(m_xBuilder->weld_check_button("CB_ROUNDEDEDGE"))
{
+ m_aCustom = m_xLB_Scheme->get_text(POS_3DSCHEME_CUSTOM);
+ m_xLB_Scheme->remove(POS_3DSCHEME_CUSTOM);
- get(m_pLB_Scheme, "LB_SCHEME");
- get(m_pCB_Shading, "CB_SHADING");
- get(m_pCB_ObjectLines, "CB_OBJECTLINES");
- get(m_pCB_RoundedEdge, "CB_ROUNDEDEDGE");
+ m_xLB_Scheme->connect_changed( LINK( this, ThreeD_SceneAppearance_TabPage, SelectSchemeHdl ) );
- m_aCustom = m_pLB_Scheme->GetEntry(POS_3DSCHEME_CUSTOM);
- m_pLB_Scheme->RemoveEntry(POS_3DSCHEME_CUSTOM);
- m_pLB_Scheme->SetDropDownLineCount(2);
-
- m_pLB_Scheme->SetSelectHdl( LINK( this, ThreeD_SceneAppearance_TabPage, SelectSchemeHdl ) );
-
- m_pCB_RoundedEdge->SetToggleHdl( LINK( this, ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines ) );
- m_pCB_Shading->SetToggleHdl( LINK( this, ThreeD_SceneAppearance_TabPage, SelectShading ) );
- m_pCB_ObjectLines->SetToggleHdl( LINK( this, ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines ) );
-
- m_pCB_RoundedEdge->EnableTriState();
- m_pCB_Shading->EnableTriState();
- m_pCB_ObjectLines->EnableTriState();
+ m_xCB_RoundedEdge->connect_toggled( LINK( this, ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines ) );
+ m_xCB_Shading->connect_toggled( LINK( this, ThreeD_SceneAppearance_TabPage, SelectShading ) );
+ m_xCB_ObjectLines->connect_toggled( LINK( this, ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines ) );
initControlsFromModel();
}
ThreeD_SceneAppearance_TabPage::~ThreeD_SceneAppearance_TabPage()
{
- disposeOnce();
-}
-
-void ThreeD_SceneAppearance_TabPage::dispose()
-{
- m_pLB_Scheme.clear();
- m_pCB_Shading.clear();
- m_pCB_ObjectLines.clear();
- m_pCB_RoundedEdge.clear();
- TabPage::dispose();
}
void ThreeD_SceneAppearance_TabPage::ActivatePage()
@@ -147,7 +129,7 @@ void ThreeD_SceneAppearance_TabPage::applyRoundedEdgeAndObjectLinesToModel()
sal_Int32 nObjectLines = -1;
- switch( m_pCB_ObjectLines->GetState())
+ switch( m_xCB_ObjectLines->get_state())
{
case TRISTATE_FALSE:
nObjectLines = 0;
@@ -161,7 +143,7 @@ void ThreeD_SceneAppearance_TabPage::applyRoundedEdgeAndObjectLinesToModel()
}
sal_Int32 nCurrentRoundedEdges = -1;
- switch( m_pCB_RoundedEdge->GetState() )
+ switch( m_xCB_RoundedEdge->get_state() )
{
case TRISTATE_FALSE:
nCurrentRoundedEdges = 0;
@@ -187,7 +169,7 @@ void ThreeD_SceneAppearance_TabPage::applyShadeModeToModel()
drawing::ShadeMode aShadeMode = drawing::ShadeMode_PHONG;
- switch( m_pCB_Shading->GetState())
+ switch( m_xCB_Shading->get_state())
{
case TRISTATE_FALSE:
aShadeMode = drawing::ShadeMode_FLAT;
@@ -212,52 +194,43 @@ void ThreeD_SceneAppearance_TabPage::initControlsFromModel()
if(aProps.m_aShadeMode == drawing::ShadeMode_FLAT)
{
- m_pCB_Shading->EnableTriState( false );
- m_pCB_Shading->Check(false);
+ m_xCB_Shading->set_active(false);
}
else if(aProps.m_aShadeMode == drawing::ShadeMode_SMOOTH)
{
- m_pCB_Shading->EnableTriState( false );
- m_pCB_Shading->Check();
+ m_xCB_Shading->set_active(true);
}
else
{
- m_pCB_Shading->EnableTriState();
- m_pCB_Shading->SetState( TRISTATE_INDET );
+ m_xCB_Shading->set_state(TRISTATE_INDET);
}
if(aProps.m_nObjectLines == 0)
{
- m_pCB_ObjectLines->EnableTriState( false );
- m_pCB_ObjectLines->Check(false);
+ m_xCB_ObjectLines->set_active(false);
}
else if(aProps.m_nObjectLines==1)
{
- m_pCB_ObjectLines->EnableTriState( false );
- m_pCB_ObjectLines->Check();
+ m_xCB_ObjectLines->set_active(true);
}
else
{
- m_pCB_ObjectLines->EnableTriState();
- m_pCB_ObjectLines->SetState( TRISTATE_INDET );
+ m_xCB_ObjectLines->set_state(TRISTATE_INDET);
}
if(aProps.m_nRoundedEdges >= 5)
{
- m_pCB_RoundedEdge->EnableTriState( false );
- m_pCB_RoundedEdge->Check();
+ m_xCB_RoundedEdge->set_active(true);
}
else if(aProps.m_nRoundedEdges<0)
{
- m_pCB_RoundedEdge->EnableTriState( false );
- m_pCB_RoundedEdge->SetState( TRISTATE_INDET );
+ m_xCB_RoundedEdge->set_state(TRISTATE_INDET);
}
else
{
- m_pCB_RoundedEdge->EnableTriState();
- m_pCB_RoundedEdge->Check(false);
+ m_xCB_RoundedEdge->set_active(false);
}
- m_pCB_RoundedEdge->Enable( !m_pCB_ObjectLines->IsChecked() );
+ m_xCB_RoundedEdge->set_sensitive( !m_xCB_ObjectLines->get_active() );
updateScheme();
@@ -269,30 +242,26 @@ void ThreeD_SceneAppearance_TabPage::updateScheme()
{
lcl_ModelProperties aProps( lcl_getPropertiesFromModel( m_xChartModel ));
- if( m_pLB_Scheme->GetEntryCount() == (POS_3DSCHEME_CUSTOM+1) )
- {
- m_pLB_Scheme->RemoveEntry(POS_3DSCHEME_CUSTOM);
- m_pLB_Scheme->SetDropDownLineCount(2);
- }
+ if (m_xLB_Scheme->get_count() == (POS_3DSCHEME_CUSTOM+1))
+ m_xLB_Scheme->remove(POS_3DSCHEME_CUSTOM);
switch( aProps.m_eScheme )
{
case ThreeDLookScheme_Simple:
- m_pLB_Scheme->SelectEntryPos( POS_3DSCHEME_SIMPLE );
+ m_xLB_Scheme->set_active( POS_3DSCHEME_SIMPLE );
break;
case ThreeDLookScheme_Realistic:
- m_pLB_Scheme->SelectEntryPos( POS_3DSCHEME_REALISTIC );
+ m_xLB_Scheme->set_active( POS_3DSCHEME_REALISTIC );
break;
case ThreeDLookScheme_Unknown:
{
- m_pLB_Scheme->InsertEntry(m_aCustom,POS_3DSCHEME_CUSTOM);
- m_pLB_Scheme->SelectEntryPos( POS_3DSCHEME_CUSTOM );
- m_pLB_Scheme->SetDropDownLineCount(3);
+ m_xLB_Scheme->insert_text(POS_3DSCHEME_CUSTOM, m_aCustom);
+ m_xLB_Scheme->set_active(POS_3DSCHEME_CUSTOM);
}
break;
}
}
-IMPL_LINK_NOARG(ThreeD_SceneAppearance_TabPage, SelectSchemeHdl, ListBox&, void)
+IMPL_LINK_NOARG(ThreeD_SceneAppearance_TabPage, SelectSchemeHdl, weld::ComboBox&, void)
{
if( !m_bUpdateOtherControls )
return;
@@ -303,9 +272,9 @@ IMPL_LINK_NOARG(ThreeD_SceneAppearance_TabPage, SelectSchemeHdl, ListBox&, void)
uno::Reference< chart2::XDiagram > xDiagram( ::chart::ChartModelHelper::findDiagram( m_xChartModel ) );
- if( m_pLB_Scheme->GetSelectedEntryPos() == POS_3DSCHEME_REALISTIC )
+ if( m_xLB_Scheme->get_active() == POS_3DSCHEME_REALISTIC )
ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Realistic );
- else if( m_pLB_Scheme->GetSelectedEntryPos() == POS_3DSCHEME_SIMPLE )
+ else if( m_xLB_Scheme->get_active() == POS_3DSCHEME_SIMPLE )
ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Simple );
else
{
@@ -317,31 +286,29 @@ IMPL_LINK_NOARG(ThreeD_SceneAppearance_TabPage, SelectSchemeHdl, ListBox&, void)
initControlsFromModel();
}
-IMPL_LINK_NOARG(ThreeD_SceneAppearance_TabPage, SelectShading, CheckBox&, void)
+IMPL_LINK_NOARG(ThreeD_SceneAppearance_TabPage, SelectShading, weld::ToggleButton&, void)
{
if( !m_bUpdateOtherControls )
return;
- m_pCB_Shading->EnableTriState( false );
applyShadeModeToModel();
updateScheme();
}
-IMPL_LINK( ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines, CheckBox&, rCheckBox, void )
+
+IMPL_LINK(ThreeD_SceneAppearance_TabPage, SelectRoundedEdgeOrObjectLines, weld::ToggleButton&, rCheckBox, void)
{
if( !m_bUpdateOtherControls )
return;
- if( &rCheckBox == m_pCB_ObjectLines )
+ if (&rCheckBox == m_xCB_ObjectLines.get())
{
- m_pCB_ObjectLines->EnableTriState( false );
m_bUpdateOtherControls = false;
- m_pCB_RoundedEdge->Enable( !m_pCB_ObjectLines->IsChecked() );
- if(!m_pCB_RoundedEdge->IsEnabled())
- m_pCB_RoundedEdge->Check(false);
+ m_xCB_RoundedEdge->set_sensitive( !m_xCB_ObjectLines->get_active() );
+ if(!m_xCB_RoundedEdge->get_sensitive())
+ m_xCB_RoundedEdge->set_active(false);
m_bUpdateOtherControls = true;
}
- else
- m_pCB_RoundedEdge->EnableTriState( false );
+
applyRoundedEdgeAndObjectLinesToModel();
updateScheme();
}
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
index f85d33290c67..6a00d3fb71be 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx
@@ -19,9 +19,7 @@
#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_3D_SCENEAPPEARANCE_HXX
#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_3D_SCENEAPPEARANCE_HXX
-#include <vcl/tabpage.hxx>
-#include <vcl/button.hxx>
-#include <vcl/lstbox.hxx>
+#include <vcl/weld.hxx>
namespace chart { class ControllerLockHelper; }
namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
@@ -29,22 +27,20 @@ namespace com { namespace sun { namespace star { namespace frame { class XModel;
namespace chart
{
-class ThreeD_SceneAppearance_TabPage : public TabPage
+class ThreeD_SceneAppearance_TabPage
{
public:
ThreeD_SceneAppearance_TabPage(
- vcl::Window* pWindow,
+ weld::Container* pParent,
const css::uno::Reference< css::frame::XModel > & xChartModel,
ControllerLockHelper & rControllerLockHelper );
- virtual ~ThreeD_SceneAppearance_TabPage() override;
- virtual void dispose() override;
-
- virtual void ActivatePage() override;
+ void ActivatePage();
+ ~ThreeD_SceneAppearance_TabPage();
private:
- DECL_LINK( SelectSchemeHdl, ListBox&, void );
- DECL_LINK( SelectShading, CheckBox&, void );
- DECL_LINK( SelectRoundedEdgeOrObjectLines, CheckBox&, void );
+ DECL_LINK( SelectSchemeHdl, weld::ComboBox&, void );
+ DECL_LINK( SelectShading, weld::ToggleButton&, void );
+ DECL_LINK( SelectRoundedEdgeOrObjectLines, weld::ToggleButton&, void );
void initControlsFromModel();
void applyShadeModeToModel();
@@ -52,20 +48,20 @@ private:
void updateScheme();
private:
- css::uno::Reference< css::frame::XModel >
- m_xChartModel;
-
- VclPtr<ListBox> m_pLB_Scheme;
-
- VclPtr<CheckBox> m_pCB_Shading;
- VclPtr<CheckBox> m_pCB_ObjectLines;
- VclPtr<CheckBox> m_pCB_RoundedEdge;
+ css::uno::Reference<css::frame::XModel> m_xChartModel;
bool m_bUpdateOtherControls;
bool m_bCommitToModel;
OUString m_aCustom;
- ControllerLockHelper & m_rControllerLockHelper;
+ ControllerLockHelper& m_rControllerLockHelper;
+
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<weld::ComboBox> m_xLB_Scheme;
+ std::unique_ptr<weld::CheckButton> m_xCB_Shading;
+ std::unique_ptr<weld::CheckButton> m_xCB_ObjectLines;
+ std::unique_ptr<weld::CheckButton> m_xCB_RoundedEdge;
};
} //namespace chart
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
index 729f9606033e..af08b2e1751c 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx
@@ -26,6 +26,8 @@
#include <com/sun/star/drawing/ProjectionMode.hpp>
#include <tools/diagnose_ex.h>
#include <tools/helpers.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/svapp.hxx>
namespace chart
{
@@ -35,37 +37,33 @@ using namespace ::com::sun::star;
namespace
{
-void lcl_SetMetricFieldLimits( MetricField& rField, sal_Int64 nLimit )
+void lcl_SetMetricFieldLimits(weld::MetricSpinButton& rField, sal_Int64 nLimit)
{
- rField.SetMin(-1*nLimit);
- rField.SetFirst(-1*nLimit);
- rField.SetMax(nLimit);
- rField.SetLast(nLimit);
+ rField.set_range(-1*nLimit, nLimit, FieldUnit::DEGREE);
}
}
-ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage( vcl::Window* pWindow
- , const uno::Reference< beans::XPropertySet > & xSceneProperties
- , ControllerLockHelper & rControllerLockHelper )
- : TabPage ( pWindow
- , "tp_3DSceneGeometry"
- , "modules/schart/ui/tp_3D_SceneGeometry.ui")
- , m_xSceneProperties( xSceneProperties )
- , m_nXRotation(0)
- , m_nYRotation(0)
- , m_nZRotation(0)
- , m_bAngleChangePending( false )
- , m_bPerspectiveChangePending( false )
- , m_rControllerLockHelper( rControllerLockHelper )
-{
- get(m_pCbxRightAngledAxes,"CBX_RIGHT_ANGLED_AXES");
- get(m_pMFXRotation, "MTR_FLD_X_ROTATION");
- get(m_pMFYRotation, "MTR_FLD_Y_ROTATION");
- get(m_pFtZRotation, "FT_Z_ROTATION");
- get(m_pMFZRotation, "MTR_FLD_Z_ROTATION");
- get(m_pCbxPerspective,"CBX_PERSPECTIVE");
- get(m_pMFPerspective, "MTR_FLD_PERSPECTIVE");
+ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage(weld::Container* pParent,
+ const uno::Reference< beans::XPropertySet > & xSceneProperties,
+ ControllerLockHelper & rControllerLockHelper)
+ : m_xSceneProperties( xSceneProperties )
+ , m_nXRotation(0)
+ , m_nYRotation(0)
+ , m_nZRotation(0)
+ , m_bAngleChangePending( false )
+ , m_bPerspectiveChangePending( false )
+ , m_rControllerLockHelper( rControllerLockHelper )
+ , m_xBuilder(Application::CreateBuilder(pParent, "modules/schart/ui/tp_3D_SceneGeometry.ui"))
+ , m_xContainer(m_xBuilder->weld_container("tp_3DSceneGeometry"))
+ , m_xCbxRightAngledAxes(m_xBuilder->weld_check_button("CBX_RIGHT_ANGLED_AXES"))
+ , m_xMFXRotation(m_xBuilder->weld_metric_spin_button("MTR_FLD_X_ROTATION", FieldUnit::DEGREE))
+ , m_xMFYRotation(m_xBuilder->weld_metric_spin_button("MTR_FLD_Y_ROTATION", FieldUnit::DEGREE))
+ , m_xFtZRotation(m_xBuilder->weld_label("FT_Z_ROTATION"))
+ , m_xMFZRotation(m_xBuilder->weld_metric_spin_button("MTR_FLD_Z_ROTATION", FieldUnit::DEGREE))
+ , m_xCbxPerspective(m_xBuilder->weld_check_button("CBX_PERSPECTIVE"))
+ , m_xMFPerspective(m_xBuilder->weld_metric_spin_button("MTR_FLD_PERSPECTIVE", FieldUnit::PERCENT))
+{
double fXAngle, fYAngle, fZAngle;
ThreeDHelper::getRotationAngleFromDiagram( m_xSceneProperties, fXAngle, fYAngle, fZAngle );
@@ -75,83 +73,62 @@ ThreeD_SceneGeometry_TabPage::ThreeD_SceneGeometry_TabPage( vcl::Window* pWindow
OSL_ENSURE( fZAngle>=-90 && fZAngle<=90, "z angle is out of valid range" );
- lcl_SetMetricFieldLimits( *m_pMFZRotation, 90 );
+ lcl_SetMetricFieldLimits( *m_xMFZRotation, 90 );
m_nXRotation = NormAngle180(
- ::basegfx::fround(fXAngle * pow(10.0, m_pMFXRotation->GetDecimalDigits())));
+ ::basegfx::fround(fXAngle * pow(10.0, m_xMFXRotation->get_digits())));
m_nYRotation = NormAngle180(
- ::basegfx::fround(-1.0 * fYAngle * pow(10.0, m_pMFYRotation->GetDecimalDigits())));
+ ::basegfx::fround(-1.0 * fYAngle * pow(10.0, m_xMFYRotation->get_digits())));
m_nZRotation = NormAngle180(
- ::basegfx::fround(-1.0 * fZAngle * pow(10.0, m_pMFZRotation->GetDecimalDigits())));
-
- m_pMFXRotation->SetValue(m_nXRotation);
- m_pMFYRotation->SetValue(m_nYRotation);
- m_pMFZRotation->SetValue(m_nZRotation);
+ ::basegfx::fround(-1.0 * fZAngle * pow(10.0, m_xMFZRotation->get_digits())));
- const sal_uLong nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT;
- Link<Edit&,void> aAngleChangedLink( LINK( this, ThreeD_SceneGeometry_TabPage, AngleChanged ));
- Link<Edit&,void> aAngleEditedLink( LINK( this, ThreeD_SceneGeometry_TabPage, AngleEdited ));
+ m_xMFXRotation->set_value(m_nXRotation, FieldUnit::DEGREE);
+ m_xMFYRotation->set_value(m_nYRotation, FieldUnit::DEGREE);
+ m_xMFZRotation->set_value(m_nZRotation, FieldUnit::DEGREE);
- m_pMFXRotation->EnableUpdateData( nTimeout );
- m_pMFXRotation->SetUpdateDataHdl( aAngleChangedLink );
- m_pMFXRotation->SetModifyHdl( aAngleEditedLink );
+ const int nTimeout = 4*EDIT_UPDATEDATA_TIMEOUT;
+ m_aAngleTimer.SetTimeout(nTimeout);
+ m_aAngleTimer.SetInvokeHandler( LINK( this, ThreeD_SceneGeometry_TabPage, AngleChanged ) );
- m_pMFYRotation->EnableUpdateData( nTimeout );
- m_pMFYRotation->SetUpdateDataHdl( aAngleChangedLink );
- m_pMFYRotation->SetModifyHdl( aAngleEditedLink );
-
- m_pMFZRotation->EnableUpdateData( nTimeout );
- m_pMFZRotation->SetUpdateDataHdl( aAngleChangedLink );
- m_pMFZRotation->SetModifyHdl( aAngleEditedLink );
+ Link<weld::MetricSpinButton&,void> aAngleEditedLink( LINK( this, ThreeD_SceneGeometry_TabPage, AngleEdited ));
+ m_xMFXRotation->connect_value_changed( aAngleEditedLink );
+ m_xMFYRotation->connect_value_changed( aAngleEditedLink );
+ m_xMFZRotation->connect_value_changed( aAngleEditedLink );
drawing::ProjectionMode aProjectionMode = drawing::ProjectionMode_PERSPECTIVE;
m_xSceneProperties->getPropertyValue( "D3DScenePerspective" ) >>= aProjectionMode;
- m_pCbxPerspective->Check( aProjectionMode == drawing::ProjectionMode_PERSPECTIVE );
- m_pCbxPerspective->SetToggleHdl( LINK( this, ThreeD_SceneGeometry_TabPage, PerspectiveToggled ));
+ m_xCbxPerspective->set_active( aProjectionMode == drawing::ProjectionMode_PERSPECTIVE );
+ m_xCbxPerspective->connect_toggled( LINK( this, ThreeD_SceneGeometry_TabPage, PerspectiveToggled ));
sal_Int32 nPerspectivePercentage = 20;
m_xSceneProperties->getPropertyValue( "Perspective" ) >>= nPerspectivePercentage;
- m_pMFPerspective->SetValue( nPerspectivePercentage );
+ m_xMFPerspective->set_value(nPerspectivePercentage, FieldUnit::PERCENT);
- m_pMFPerspective->EnableUpdateData( nTimeout );
- m_pMFPerspective->SetUpdateDataHdl( LINK( this, ThreeD_SceneGeometry_TabPage, PerspectiveChanged ) );
- m_pMFPerspective->SetModifyHdl( LINK( this, ThreeD_SceneGeometry_TabPage, PerspectiveEdited ) );
- m_pMFPerspective->Enable( m_pCbxPerspective->IsChecked() );
+ m_aPerspectiveTimer.SetTimeout(nTimeout);
+ m_aPerspectiveTimer.SetInvokeHandler( LINK( this, ThreeD_SceneGeometry_TabPage, PerspectiveChanged ) );
+ m_xMFPerspective->connect_value_changed( LINK( this, ThreeD_SceneGeometry_TabPage, PerspectiveEdited ) );
+ m_xMFPerspective->set_sensitive( m_xCbxPerspective->get_active() );
//RightAngledAxes
uno::Reference< chart2::XDiagram > xDiagram( m_xSceneProperties, uno::UNO_QUERY );
- if( ChartTypeHelper::isSupportingRightAngledAxes(
- DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ) )
+ if (ChartTypeHelper::isSupportingRightAngledAxes(DiagramHelper::getChartTypeByIndex(xDiagram, 0)))
{
bool bRightAngledAxes = false;
m_xSceneProperties->getPropertyValue( "RightAngledAxes" ) >>= bRightAngledAxes;
- m_pCbxRightAngledAxes->SetToggleHdl( LINK( this, ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled ));
- m_pCbxRightAngledAxes->Check( bRightAngledAxes );
+ m_xCbxRightAngledAxes->connect_toggled( LINK( this, ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled ));
+ m_xCbxRightAngledAxes->set_active( bRightAngledAxes );
+ RightAngledAxesToggled(*m_xCbxRightAngledAxes);
}
else
{
- m_pCbxRightAngledAxes->Enable(false);
+ m_xCbxRightAngledAxes->set_sensitive(false);
}
}
ThreeD_SceneGeometry_TabPage::~ThreeD_SceneGeometry_TabPage()
{
- disposeOnce();
}
-void ThreeD_SceneGeometry_TabPage::dispose()
-{
- m_pCbxRightAngledAxes.clear();
- m_pMFXRotation.clear();
- m_pMFYRotation.clear();
- m_pFtZRotation.clear();
- m_pMFZRotation.clear();
- m_pCbxPerspective.clear();
- m_pMFPerspective.clear();
- TabPage::dispose();
-}
-
-
void ThreeD_SceneGeometry_TabPage::commitPendingChanges()
{
ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
@@ -168,12 +145,12 @@ void ThreeD_SceneGeometry_TabPage::applyAnglesToModel()
double fXAngle = 0.0, fYAngle = 0.0, fZAngle = 0.0;
- if( !m_pMFZRotation->IsEmptyFieldValue() )
- m_nZRotation = m_pMFZRotation->GetValue();
+ if (m_xMFZRotation->get_sensitive())
+ m_nZRotation = m_xMFZRotation->get_value(FieldUnit::DEGREE);
- fXAngle = double(m_nXRotation)/pow(10.0,m_pMFXRotation->GetDecimalDigits());
- fYAngle = double(-1.0*m_nYRotation)/pow(10.0,m_pMFYRotation->GetDecimalDigits());
- fZAngle = double(-1.0*m_nZRotation)/pow(10.0,m_pMFZRotation->GetDecimalDigits());
+ fXAngle = double(m_nXRotation)/pow(10.0,m_xMFXRotation->get_digits());
+ fYAngle = double(-1.0*m_nYRotation)/pow(10.0,m_xMFYRotation->get_digits());
+ fZAngle = double(-1.0*m_nZRotation)/pow(10.0,m_xMFZRotation->get_digits());
fXAngle = basegfx::deg2rad(fXAngle);
fYAngle = basegfx::deg2rad(fYAngle);
@@ -182,17 +159,20 @@ void ThreeD_SceneGeometry_TabPage::applyAnglesToModel()
ThreeDHelper::setRotationAngleToDiagram( m_xSceneProperties, fXAngle, fYAngle, fZAngle );
m_bAngleChangePending = false;
+ m_aAngleTimer.Stop();
}
-IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, AngleEdited, Edit&, void)
+IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, AngleEdited, weld::MetricSpinButton&, void)
{
- m_nXRotation = m_pMFXRotation->GetValue();
- m_nYRotation = m_pMFYRotation->GetValue();
+ m_nXRotation = m_xMFXRotation->get_value(FieldUnit::DEGREE);
+ m_nYRotation = m_xMFYRotation->get_value(FieldUnit::DEGREE);
m_bAngleChangePending = true;
+
+ m_aAngleTimer.Start();
}
-IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, AngleChanged, Edit&, void)
+IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, AngleChanged, Timer *, void)
{
applyAnglesToModel();
}
@@ -201,14 +181,14 @@ void ThreeD_SceneGeometry_TabPage::applyPerspectiveToModel()
{
ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
- drawing::ProjectionMode aMode = m_pCbxPerspective->IsChecked()
+ drawing::ProjectionMode aMode = m_xCbxPerspective->get_active()
? drawing::ProjectionMode_PERSPECTIVE
: drawing::ProjectionMode_PARALLEL;
try
{
m_xSceneProperties->setPropertyValue( "D3DScenePerspective" , uno::Any( aMode ));
- m_xSceneProperties->setPropertyValue( "Perspective" , uno::Any( static_cast<sal_Int32>(m_pMFPerspective->GetValue()) ));
+ m_xSceneProperties->setPropertyValue( "Perspective" , uno::Any( static_cast<sal_Int32>(m_xMFPerspective->get_value(FieldUnit::PERCENT)) ));
}
catch( const uno::Exception & )
{
@@ -216,56 +196,57 @@ void ThreeD_SceneGeometry_TabPage::applyPerspectiveToModel()
}
m_bPerspectiveChangePending = false;
+ m_aPerspectiveTimer.Stop();
}
-IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, PerspectiveEdited, Edit&, void)
+IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, PerspectiveEdited, weld::MetricSpinButton&, void)
{
m_bPerspectiveChangePending = true;
+ m_aPerspectiveTimer.Start();
}
-IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, PerspectiveChanged, Edit&, void)
+IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, PerspectiveChanged, Timer *, void)
{
applyPerspectiveToModel();
}
-IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, PerspectiveToggled, CheckBox&, void)
+IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, PerspectiveToggled, weld::ToggleButton&, void)
{
- m_pMFPerspective->Enable( m_pCbxPerspective->IsChecked() );
+ m_xMFPerspective->set_sensitive(m_xCbxPerspective->get_active());
applyPerspectiveToModel();
}
-IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled, CheckBox&, void)
+IMPL_LINK_NOARG(ThreeD_SceneGeometry_TabPage, RightAngledAxesToggled, weld::ToggleButton&, void)
{
ControllerLockHelperGuard aGuard( m_rControllerLockHelper );
- bool bEnableZ = !m_pCbxRightAngledAxes->IsChecked();
- m_pFtZRotation->Enable( bEnableZ );
- m_pMFZRotation->Enable( bEnableZ );
- m_pMFZRotation->EnableEmptyFieldValue( !bEnableZ );
- if( !bEnableZ )
+ bool bEnableZ = !m_xCbxRightAngledAxes->get_active();
+ m_xFtZRotation->set_sensitive( bEnableZ );
+ m_xMFZRotation->set_sensitive( bEnableZ );
+ if (!bEnableZ)
{
- m_nXRotation = m_pMFXRotation->GetValue();
- m_nYRotation = m_pMFYRotation->GetValue();
- m_nZRotation = m_pMFZRotation->GetValue();
+ m_nXRotation = m_xMFXRotation->get_value(FieldUnit::DEGREE);
+ m_nYRotation = m_xMFYRotation->get_value(FieldUnit::DEGREE);
+ m_nZRotation = m_xMFZRotation->get_value(FieldUnit::DEGREE);
- m_pMFXRotation->SetValue(static_cast<sal_Int64>(ThreeDHelper::getValueClippedToRange(static_cast<double>(m_nXRotation), ThreeDHelper::getXDegreeAngleLimitForRightAngledAxes())));
- m_pMFYRotation->SetValue(static_cast<sal_Int64>(ThreeDHelper::getValueClippedToRange(static_cast<double>(m_nYRotation), ThreeDHelper::getYDegreeAngleLimitForRightAngledAxes())));
- m_pMFZRotation->SetEmptyFieldValue();
+ m_xMFXRotation->set_value(static_cast<sal_Int64>(ThreeDHelper::getValueClippedToRange(static_cast<double>(m_nXRotation), ThreeDHelper::getXDegreeAngleLimitForRightAngledAxes())), FieldUnit::DEGREE);
+ m_xMFYRotation->set_value(static_cast<sal_Int64>(ThreeDHelper::getValueClippedToRange(static_cast<double>(m_nYRotation), ThreeDHelper::getYDegreeAngleLimitForRightAngledAxes())), FieldUnit::DEGREE);
+ m_xMFZRotation->set_text("");
- lcl_SetMetricFieldLimits( *m_pMFXRotation, static_cast<sal_Int64>(ThreeDHelper::getXDegreeAngleLimitForRightAngledAxes()));
- lcl_SetMetricFieldLimits( *m_pMFYRotation, static_cast<sal_Int64>(ThreeDHelper::getYDegreeAngleLimitForRightAngledAxes()));
+ lcl_SetMetricFieldLimits( *m_xMFXRotation, static_cast<sal_Int64>(ThreeDHelper::getXDegreeAngleLimitForRightAngledAxes()));
+ lcl_SetMetricFieldLimits( *m_xMFYRotation, static_cast<sal_Int64>(ThreeDHelper::getYDegreeAngleLimitForRightAngledAxes()));
}
else
{
- lcl_SetMetricFieldLimits( *m_pMFXRotation, 180 );
- lcl_SetMetricFieldLimits( *m_pMFYRotation, 180 );
+ lcl_SetMetricFieldLimits( *m_xMFXRotation, 180 );
+ lcl_SetMetricFieldLimits( *m_xMFYRotation, 180 );
- m_pMFXRotation->SetValue(m_nXRotation);
- m_pMFYRotation->SetValue(m_nYRotation);
- m_pMFZRotation->SetValue(m_nZRotation);
+ m_xMFXRotation->set_value(m_nXRotation, FieldUnit::DEGREE);
+ m_xMFYRotation->set_value(m_nYRotation, FieldUnit::DEGREE);
+ m_xMFZRotation->set_value(m_nZRotation, FieldUnit::DEGREE);
}
- ThreeDHelper::switchRightAngledAxes( m_xSceneProperties, m_pCbxRightAngledAxes->IsChecked() );
+ ThreeDHelper::switchRightAngledAxes( m_xSceneProperties, m_xCbxRightAngledAxes->get_active() );
}
} //namespace chart
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
index 5ce39c0c18ca..22c5651d8995 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.hxx
@@ -19,10 +19,8 @@
#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_3D_SCENEGEOMETRY_HXX
#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_3D_SCENEGEOMETRY_HXX
-#include <vcl/tabpage.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/field.hxx>
-#include <vcl/button.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/weld.hxx>
namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } } } }
namespace chart { class ControllerLockHelper; }
@@ -30,29 +28,28 @@ namespace chart { class ControllerLockHelper; }
namespace chart
{
-class ThreeD_SceneGeometry_TabPage : public TabPage
+class ThreeD_SceneGeometry_TabPage
{
public:
- ThreeD_SceneGeometry_TabPage( vcl::Window* pWindow,
- const css::uno::Reference< css::beans::XPropertySet > & xSceneProperties,
- ControllerLockHelper & rControllerLockHelper );
- virtual ~ThreeD_SceneGeometry_TabPage() override;
- virtual void dispose() override;
+ ThreeD_SceneGeometry_TabPage(weld::Container* pWindow,
+ const css::uno::Reference< css::beans::XPropertySet > & xSceneProperties,
+ ControllerLockHelper & rControllerLockHelper);
+ ~ThreeD_SceneGeometry_TabPage();
// has to be called in case the dialog was closed with OK
void commitPendingChanges();
// is called by timer to apply changes to model
- DECL_LINK( AngleChanged, Edit&, void );
+ DECL_LINK( AngleChanged, Timer *, void);
// is called immediately when a field changes
- DECL_LINK( AngleEdited, Edit&, void );
+ DECL_LINK( AngleEdited, weld::MetricSpinButton&, void );
// is called by timer to apply changes to model
- DECL_LINK( PerspectiveChanged, Edit&, void );
+ DECL_LINK( PerspectiveChanged, Timer *, void);
// is called immediately when a field changes
- DECL_LINK( PerspectiveEdited, Edit&, void );
- DECL_LINK( PerspectiveToggled, CheckBox&, void );
- DECL_LINK( RightAngledAxesToggled, CheckBox&, void );
+ DECL_LINK( PerspectiveEdited, weld::MetricSpinButton&, void );
+ DECL_LINK( PerspectiveToggled, weld::ToggleButton&, void );
+ DECL_LINK( RightAngledAxesToggled, weld::ToggleButton&, void );
private:
void applyAnglesToModel();
@@ -60,17 +57,8 @@ private:
css::uno::Reference< css::beans::XPropertySet > m_xSceneProperties;
- VclPtr<CheckBox> m_pCbxRightAngledAxes;
-
- VclPtr<MetricField> m_pMFXRotation;
-
- VclPtr<MetricField> m_pMFYRotation;
-
- VclPtr<FixedText> m_pFtZRotation;
- VclPtr<MetricField> m_pMFZRotation;
-
- VclPtr<CheckBox> m_pCbxPerspective;
- VclPtr<MetricField> m_pMFPerspective;
+ Timer m_aAngleTimer;
+ Timer m_aPerspectiveTimer;
//to keep old values when switching to right angled axes
sal_Int64 m_nXRotation;
@@ -81,6 +69,16 @@ private:
bool m_bPerspectiveChangePending;
ControllerLockHelper & m_rControllerLockHelper;
+
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<weld::CheckButton> m_xCbxRightAngledAxes;
+ std::unique_ptr<weld::MetricSpinButton> m_xMFXRotation;
+ std::unique_ptr<weld::MetricSpinButton> m_xMFYRotation;
+ std::unique_ptr<weld::Label> m_xFtZRotation;
+ std::unique_ptr<weld::MetricSpinButton> m_xMFZRotation;
+ std::unique_ptr<weld::CheckButton> m_xCbxPerspective;
+ std::unique_ptr<weld::MetricSpinButton> m_xMFPerspective;
};
} //namespace chart
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
index 78b203321c80..b52cbfb0d774 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx
@@ -28,7 +28,7 @@
#include <svtools/colrdlg.hxx>
#include <svx/svx3ditems.hxx>
#include <svx/svddef.hxx>
-#include <vcl/builderfactory.hxx>
+#include <vcl/svapp.hxx>
#include <tools/diagnose_ex.h>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -39,28 +39,22 @@ namespace chart
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
-LightButton::LightButton( vcl::Window* pParent)
- : ImageButton( pParent)
- , m_bLightOn(false)
+LightButton::LightButton(std::unique_ptr<weld::ToggleButton> xButton)
+ : m_xButton(std::move(xButton))
+ , m_bLightOn(false)
{
- SetModeImage(Image(StockImage::Yes, RID_SVXBMP_LAMP_OFF));
+ m_xButton->set_from_icon_name(RID_SVXBMP_LAMP_OFF);
}
-VCL_BUILDER_FACTORY(LightButton)
-
void LightButton::switchLightOn(bool bOn)
{
- if( m_bLightOn==bOn )
+ if (m_bLightOn == bOn)
return;
m_bLightOn = bOn;
- if(m_bLightOn)
- {
- SetModeImage(Image(StockImage::Yes, RID_SVXBMP_LAMP_ON));
- }
+ if (m_bLightOn)
+ m_xButton->set_from_icon_name(RID_SVXBMP_LAMP_ON);
else
- {
- SetModeImage(Image(StockImage::Yes, RID_SVXBMP_LAMP_OFF));
- }
+ m_xButton->set_from_icon_name(RID_SVXBMP_LAMP_OFF);
}
struct LightSource
@@ -78,8 +72,9 @@ struct LightSource
struct LightSourceInfo
{
- VclPtr<LightButton> pButton;
- LightSource aLightSource;
+ LightButton* pButton;
+ bool bButtonActive;
+ LightSource aLightSource;
LightSourceInfo();
void initButtonFromSource();
@@ -87,6 +82,7 @@ struct LightSourceInfo
LightSourceInfo::LightSourceInfo()
: pButton(nullptr)
+ , bButtonActive(false)
, aLightSource()
{
aLightSource.nDiffuseColor = Color(0xffffff); // white
@@ -96,11 +92,9 @@ LightSourceInfo::LightSourceInfo()
void LightSourceInfo::initButtonFromSource()
{
- if(!pButton)
+ if (!pButton)
return;
- pButton->SetModeImage(Image(StockImage::Yes,
- aLightSource.bIsEnabled ? OUString(RID_SVXBMP_LAMP_ON) : OUString(RID_SVXBMP_LAMP_OFF)
- ) );
+ pButton->switchLightOn(aLightSource.bIsEnabled);
}
namespace
@@ -118,7 +112,7 @@ namespace
return aStr;
}
- void lcl_selectColor(SvxColorListBox& rListBox, const Color& rColor)
+ void lcl_selectColor(ColorListBox& rListBox, const Color& rColor)
{
rListBox.SetNoSelection();
rListBox.SelectEntry(std::make_pair(rColor, lcl_makeColorName(rColor)));
@@ -203,88 +197,71 @@ namespace
}
}
-ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage( vcl::Window* pWindow
- , const uno::Reference< beans::XPropertySet > & xSceneProperties
- , const uno::Reference< frame::XModel >& xChartModel )
- : TabPage ( pWindow
- ,"tp_3D_SceneIllumination"
- ,"modules/schart/ui/tp_3D_SceneIllumination.ui")
- , m_xSceneProperties( xSceneProperties )
- , m_aTimerTriggeredControllerLock( xChartModel )
- , m_bInCommitToModel( false )
- , m_xChartModel( xChartModel )
+ThreeD_SceneIllumination_TabPage::ThreeD_SceneIllumination_TabPage(weld::Container* pParent,
+ weld::Window* pTopLevel,
+ const uno::Reference< beans::XPropertySet > & xSceneProperties,
+ const uno::Reference< frame::XModel >& xChartModel)
+ : m_xSceneProperties( xSceneProperties )
+ , m_aTimerTriggeredControllerLock( xChartModel )
+ , m_bInCommitToModel( false )
+ , m_xChartModel( xChartModel )
+ , m_pTopLevel(pTopLevel)
+ , m_xBuilder(Application::CreateBuilder(pParent, "modules/schart/ui/tp_3D_SceneIllumination.ui"))
+ , m_xContainer(m_xBuilder->weld_container("tp_3D_SceneIllumination"))
+ , m_xBtn_Light1(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_1")))
+ , m_xBtn_Light2(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_2")))
+ , m_xBtn_Light3(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_3")))
+ , m_xBtn_Light4(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_4")))
+ , m_xBtn_Light5(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_5")))
+ , m_xBtn_Light6(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_6")))
+ , m_xBtn_Light7(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_7")))
+ , m_xBtn_Light8(new LightButton(m_xBuilder->weld_toggle_button("BTN_LIGHT_8")))
+ , m_xLB_LightSource(new ColorListBox(m_xBuilder->weld_menu_button("LB_LIGHTSOURCE"), pTopLevel))
+ , m_xBtn_LightSource_Color(m_xBuilder->weld_button("BTN_LIGHTSOURCE_COLOR"))
+ , m_xLB_AmbientLight(new ColorListBox(m_xBuilder->weld_menu_button("LB_AMBIENTLIGHT"), pTopLevel))
+ , m_xBtn_AmbientLight_Color(m_xBuilder->weld_button("BTN_AMBIENT_COLOR"))
+ , m_xHoriScale(m_xBuilder->weld_scale("hori"))
+ , m_xVertScale(m_xBuilder->weld_scale("vert"))
+ , m_xBtn_Corner(m_xBuilder->weld_button("corner"))
+ , m_xPreview(new LightControl3D)
+ , m_xPreviewWnd(new weld::CustomWeld(*m_xBuilder, "CTL_LIGHT_PREVIEW", *m_xPreview))
+ , m_xCtl_Preview(new LightCtl3D(*m_xPreview, *m_xHoriScale, *m_xVertScale, *m_xBtn_Corner))
{
- get(m_pBtn_Light1, "BTN_LIGHT_1");
- get(m_pBtn_Light2, "BTN_LIGHT_2");
- get(m_pBtn_Light3, "BTN_LIGHT_3");
- get(m_pBtn_Light4, "BTN_LIGHT_4");
- get(m_pBtn_Light5, "BTN_LIGHT_5");
- get(m_pBtn_Light6, "BTN_LIGHT_6");
- get(m_pBtn_Light7, "BTN_LIGHT_7");
- get(m_pBtn_Light8, "BTN_LIGHT_8");
-
- get(m_pLB_LightSource, "LB_LIGHTSOURCE");
- get(m_pLB_AmbientLight, "LB_AMBIENTLIGHT");
- get(m_pBtn_LightSource_Color, "BTN_LIGHTSOURCE_COLOR");
- get(m_pBtn_AmbientLight_Color, "BTN_AMBIENT_COLOR");
-
- get(m_pCtl_Preview, "CTL_LIGHT_PREVIEW");
-
m_pLightSourceInfoList.reset(new LightSourceInfo[8]);
- m_pLightSourceInfoList[0].pButton = m_pBtn_Light1;
- m_pLightSourceInfoList[1].pButton = m_pBtn_Light2;
- m_pLightSourceInfoList[2].pButton = m_pBtn_Light3;
- m_pLightSourceInfoList[3].pButton = m_pBtn_Light4;
- m_pLightSourceInfoList[4].pButton = m_pBtn_Light5;
- m_pLightSourceInfoList[5].pButton = m_pBtn_Light6;
- m_pLightSourceInfoList[6].pButton = m_pBtn_Light7;
- m_pLightSourceInfoList[7].pButton = m_pBtn_Light8;
+ m_pLightSourceInfoList[0].pButton = m_xBtn_Light1.get();
+ m_pLightSourceInfoList[1].pButton = m_xBtn_Light2.get();
+ m_pLightSourceInfoList[2].pButton = m_xBtn_Light3.get();
+ m_pLightSourceInfoList[3].pButton = m_xBtn_Light4.get();
+ m_pLightSourceInfoList[4].pButton = m_xBtn_Light5.get();
+ m_pLightSourceInfoList[5].pButton = m_xBtn_Light6.get();
+ m_pLightSourceInfoList[6].pButton = m_xBtn_Light7.get();
+ m_pLightSourceInfoList[7].pButton = m_xBtn_Light8.get();
fillControlsFromModel(nullptr);
- m_pBtn_Light1->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_pBtn_Light2->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_pBtn_Light3->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_pBtn_Light4->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_pBtn_Light5->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_pBtn_Light6->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_pBtn_Light7->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_pBtn_Light8->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_xBtn_Light1->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_xBtn_Light2->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_xBtn_Light3->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_xBtn_Light4->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_xBtn_Light5->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_xBtn_Light6->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_xBtn_Light7->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
+ m_xBtn_Light8->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl ) );
- m_pLB_AmbientLight->SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
- m_pLB_LightSource->SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
+ m_xLB_AmbientLight->SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
+ m_xLB_LightSource->SetSelectHdl( LINK( this, ThreeD_SceneIllumination_TabPage, SelectColorHdl ) );
- m_pBtn_AmbientLight_Color->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ColorDialogHdl ) );
- m_pBtn_LightSource_Color->SetClickHdl( LINK( this, ThreeD_SceneIllumination_TabPage, ColorDialogHdl ) );
+ m_xBtn_AmbientLight_Color->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ColorDialogHdl ) );
+ m_xBtn_LightSource_Color->connect_clicked( LINK( this, ThreeD_SceneIllumination_TabPage, ColorDialogHdl ) );
- m_pCtl_Preview->SetUserInteractiveChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewChangeHdl ) );
- m_pCtl_Preview->SetUserSelectionChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewSelectHdl ) );
+ m_xCtl_Preview->SetUserInteractiveChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewChangeHdl ) );
+ m_xCtl_Preview->SetUserSelectionChangeCallback( LINK( this, ThreeD_SceneIllumination_TabPage, PreviewSelectHdl ) );
- ClickLightSourceButtonHdl(m_pBtn_Light2);
+ ClickLightSourceButtonHdl(*m_xBtn_Light2->get_widget());
}
ThreeD_SceneIllumination_TabPage::~ThreeD_SceneIllumination_TabPage()
{
- disposeOnce();
-}
-
-void ThreeD_SceneIllumination_TabPage::dispose()
-{
- m_pLightSourceInfoList.reset();
- m_pBtn_Light1.clear();
- m_pBtn_Light2.clear();
- m_pBtn_Light3.clear();
- m_pBtn_Light4.clear();
- m_pBtn_Light5.clear();
- m_pBtn_Light6.clear();
- m_pBtn_Light7.clear();
- m_pBtn_Light8.clear();
- m_pLB_LightSource.clear();
- m_pBtn_LightSource_Color.clear();
- m_pLB_AmbientLight.clear();
- m_pBtn_AmbientLight_Color.clear();
- m_pCtl_Preview.clear();
- TabPage::dispose();
}
IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, fillControlsFromModel, void*, void)
@@ -298,7 +275,7 @@ IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, fillControlsFromModel, void*,
for( nL=0; nL<8; nL++)
m_pLightSourceInfoList[nL].initButtonFromSource();
- lcl_selectColor( *m_pLB_AmbientLight, lcl_getAmbientColor( m_xSceneProperties ));
+ lcl_selectColor( *m_xLB_AmbientLight, lcl_getAmbientColor( m_xSceneProperties ));
updatePreview();
}
@@ -321,12 +298,12 @@ void ThreeD_SceneIllumination_TabPage::applyLightSourcesToModel()
m_aTimerTriggeredControllerLock.startTimer();
}
-IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, PreviewChangeHdl, SvxLightCtl3D*, void)
+IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, PreviewChangeHdl, LightCtl3D*, void)
{
m_aTimerTriggeredControllerLock.startTimer();
//update m_pLightSourceInfoList from preview
- const SfxItemSet a3DLightAttributes(m_pCtl_Preview->GetSvx3DLightControl().Get3DAttributes());
+ const SfxItemSet a3DLightAttributes(m_xCtl_Preview->GetSvx3DLightControl().Get3DAttributes());
LightSourceInfo* pInfo = &m_pLightSourceInfoList[0];
pInfo->aLightSource.nDiffuseColor = a3DLightAttributes.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1).GetValue();
@@ -371,27 +348,27 @@ IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, PreviewChangeHdl, SvxLightCtl3
applyLightSourcesToModel();
}
-IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, PreviewSelectHdl, SvxLightCtl3D*, void)
+IMPL_LINK_NOARG(ThreeD_SceneIllumination_TabPage, PreviewSelectHdl, LightCtl3D*, void)
{
- sal_uInt32 nLightNumber = m_pCtl_Preview->GetSvx3DLightControl().GetSelectedLight();
+ sal_uInt32 nLightNumber = m_xCtl_Preview->GetSvx3DLightControl().GetSelectedLight();
if(nLightNumber<8)
{
LightButton* pButton = m_pLightSourceInfoList[nLightNumber].pButton;
- if(!pButton->IsChecked())
- ClickLightSourceButtonHdl(pButton);
+ if(!pButton->get_active())
+ ClickLightSourceButtonHdl(*pButton->get_widget());
applyLightSourcesToModel();
}
}
-IMPL_LINK( ThreeD_SceneIllumination_TabPage, ColorDialogHdl, Button*, pButton, void )
+IMPL_LINK( ThreeD_SceneIllumination_TabPage, ColorDialogHdl, weld::Button&, rButton, void )
{
- bool bIsAmbientLight = (pButton==m_pBtn_AmbientLight_Color);
- SvxColorListBox* pListBox = bIsAmbientLight ? m_pLB_AmbientLight.get() : m_pLB_LightSource.get();
+ bool bIsAmbientLight = (&rButton == m_xBtn_AmbientLight_Color.get());
+ ColorListBox* pListBox = bIsAmbientLight ? m_xLB_AmbientLight.get() : m_xLB_LightSource.get();
SvColorDialog aColorDlg;
aColorDlg.SetColor( pListBox->GetSelectEntryColor() );
- if( aColorDlg.Execute(GetFrameWeld()) == RET_OK )
+ if( aColorDlg.Execute(m_pTopLevel) == RET_OK )
{
Color aColor( aColorDlg.GetColor());
lcl_selectColor( *pListBox, aColor );
@@ -409,7 +386,7 @@ IMPL_LINK( ThreeD_SceneIllumination_TabPage, ColorDialogHdl, Button*, pButton, v
for( nL=0; nL<8; nL++)
{
pInfo = &m_pLightSourceInfoList[nL];
- if(pInfo->pButton->IsChecked())
+ if(pInfo->pButton->get_active())
break;
pInfo = nullptr;
}
@@ -420,16 +397,16 @@ IMPL_LINK( ThreeD_SceneIllumination_TabPage, ColorDialogHdl, Button*, pButton, v
}
}
-IMPL_LINK( ThreeD_SceneIllumination_TabPage, SelectColorHdl, SvxColorListBox&, rBox, void )
+IMPL_LINK( ThreeD_SceneIllumination_TabPage, SelectColorHdl, ColorListBox&, rBox, void )
{
- SvxColorListBox* pListBox = &rBox;
- if(pListBox==m_pLB_AmbientLight)
+ ColorListBox* pListBox = &rBox;
+ if (pListBox == m_xLB_AmbientLight.get())
{
m_bInCommitToModel = true;
lcl_setAmbientColor( m_xSceneProperties, pListBox->GetSelectEntryColor());
m_bInCommitToModel = false;
}
- else if(pListBox==m_pLB_LightSource)
+ else if (pListBox == m_xLB_LightSource.get())
{
//get active lightsource:
LightSourceInfo* pInfo = nullptr;
@@ -437,7 +414,7 @@ IMPL_LINK( ThreeD_SceneIllumination_TabPage, SelectColorHdl, SvxColorListBox&, r
for( nL=0; nL<8; nL++)
{
pInfo = &m_pLightSourceInfoList[nL];
- if(pInfo->pButton->IsChecked())
+ if (pInfo->pButton->get_active())
break;
pInfo = nullptr;
}
@@ -450,59 +427,64 @@ IMPL_LINK( ThreeD_SceneIllumination_TabPage, SelectColorHdl, SvxColorListBox&, r
updatePreview();
}
-IMPL_LINK( ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl, Button*, pBtn, void )
+IMPL_LINK(ThreeD_SceneIllumination_TabPage, ClickLightSourceButtonHdl, weld::Button&, rBtn, void)
{
- LightButton* pButton = static_cast<LightButton*>(pBtn);
- if( !pButton )
- return;
-
+ LightButton* pButton = nullptr;
LightSourceInfo* pInfo = nullptr;
sal_Int32 nL=0;
for( nL=0; nL<8; nL++)
{
- if( m_pLightSourceInfoList[nL].pButton == pButton )
+ if (m_pLightSourceInfoList[nL].pButton->get_widget() == &rBtn)
{
+ pButton = m_pLightSourceInfoList[nL].pButton;
pInfo = &m_pLightSourceInfoList[nL];
break;
}
}
- //update light button
- bool bIsChecked = pButton->IsChecked();
- if(bIsChecked)
+ bool bIsChecked = pInfo->bButtonActive;
+
+ ControllerLockGuardUNO aGuard( m_xChartModel );
+ for( nL=0; nL<8; nL++)
{
- pButton->switchLightOn(!pButton->isLightOn());
- if(pInfo)
+ LightButton* pLightButton = m_pLightSourceInfoList[nL].pButton;
+ if (pLightButton == pButton)
{
- pInfo->aLightSource.bIsEnabled=pButton->isLightOn();
- applyLightSourceToModel( nL );
+ pLightButton->set_active(true);
+ if (!pLightButton->get_widget()->has_focus())
+ pLightButton->get_widget()->grab_focus();
+ m_pLightSourceInfoList[nL].bButtonActive = true;
}
- }
- else
- {
- ControllerLockGuardUNO aGuard( m_xChartModel );
- for( nL=0; nL<8; nL++)
+ else
{
- LightButton* pLightButton = m_pLightSourceInfoList[nL].pButton;
- pLightButton->Check( pLightButton == pButton );
+ pLightButton->set_active(false);
+ m_pLightSourceInfoList[nL].bButtonActive = false;
}
}
+ //update light button
+ if (bIsChecked)
+ {
+ pButton->switchLightOn(!pButton->isLightOn());
+ pInfo->aLightSource.bIsEnabled=pButton->isLightOn();
+ applyLightSourceToModel( nL );
+ }
+
//update color list box
if(pInfo)
{
- lcl_selectColor( *m_pLB_LightSource, pInfo->aLightSource.nDiffuseColor );
+ lcl_selectColor( *m_xLB_LightSource, pInfo->aLightSource.nDiffuseColor );
}
updatePreview();
}
void ThreeD_SceneIllumination_TabPage::updatePreview()
{
- SfxItemSet aItemSet(m_pCtl_Preview->GetSvx3DLightControl().Get3DAttributes());
+ SfxItemSet aItemSet(m_xCtl_Preview->GetSvx3DLightControl().Get3DAttributes());
LightSourceInfo* pInfo = &m_pLightSourceInfoList[0];
// AmbientColor
- aItemSet.Put(makeSvx3DAmbientcolorItem(m_pLB_AmbientLight->GetSelectEntryColor()));
+ aItemSet.Put(makeSvx3DAmbientcolorItem(m_xLB_AmbientLight->GetSelectEntryColor()));
aItemSet.Put(makeSvx3DLightcolor1Item(pInfo->aLightSource.nDiffuseColor));
aItemSet.Put(makeSvx3DLightOnOff1Item(pInfo->aLightSource.bIsEnabled));
@@ -544,15 +526,15 @@ void ThreeD_SceneIllumination_TabPage::updatePreview()
aItemSet.Put(makeSvx3DLightDirection8Item(Direction3DToB3DVector(pInfo->aLightSource.aDirection)));
// set lights and ambient light
- m_pCtl_Preview->GetSvx3DLightControl().Set3DAttributes(aItemSet);
+ m_xCtl_Preview->GetSvx3DLightControl().Set3DAttributes(aItemSet);
// select light
for(sal_uInt32 a(0); a < 8; a++)
{
- if(m_pLightSourceInfoList[a].pButton->IsChecked())
+ if (m_pLightSourceInfoList[a].pButton->get_active())
{
- m_pCtl_Preview->GetSvx3DLightControl().SelectLight(a);
- m_pCtl_Preview->CheckSelection();
+ m_xCtl_Preview->GetSvx3DLightControl().SelectLight(a);
+ m_xCtl_Preview->CheckSelection();
break;
}
}
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
index 72e39d673539..81bb278e28eb 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.hxx
@@ -20,48 +20,56 @@
#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_3D_SCENEILLUMINATION_HXX
#include <TimerTriggeredControllerLock.hxx>
-
-#include <vcl/tabpage.hxx>
-#include <vcl/button.hxx>
+#include <vcl/weld.hxx>
#include <svx/dlgctl3d.hxx>
namespace com { namespace sun { namespace star { namespace beans { class XPropertySet; } } } }
-class SvxColorListBox;
+class ColorListBox;
namespace chart
{
-class LightButton : public ImageButton
+class LightButton
{
public:
- explicit LightButton( vcl::Window* pParent);
+ explicit LightButton(std::unique_ptr<weld::ToggleButton> xButton);
void switchLightOn(bool bOn);
bool isLightOn() const { return m_bLightOn;}
+ bool get_active() const { return m_xButton->get_active(); }
+ void set_active(bool bActive) { m_xButton->set_active(bActive); }
+
+ weld::ToggleButton* get_widget() const { return m_xButton.get(); }
+
+ void connect_clicked(const Link<weld::Button&, void>& rLink)
+ {
+ m_xButton->connect_clicked(rLink);
+ }
+
private:
+ std::unique_ptr<weld::ToggleButton> m_xButton;
bool m_bLightOn;
};
struct LightSourceInfo;
-class ThreeD_SceneIllumination_TabPage : public TabPage
+class ThreeD_SceneIllumination_TabPage
{
public:
ThreeD_SceneIllumination_TabPage(
- vcl::Window* pWindow,
+ weld::Container* pParent, weld::Window* pTopLevel,
const css::uno::Reference< css::beans::XPropertySet > & xSceneProperties,
const css::uno::Reference< css::frame::XModel >& xChartModel );
- virtual ~ThreeD_SceneIllumination_TabPage() override;
- virtual void dispose() override;
+ ~ThreeD_SceneIllumination_TabPage();
private:
- DECL_LINK( ClickLightSourceButtonHdl, Button*, void );
- DECL_LINK( SelectColorHdl, SvxColorListBox&, void );
- DECL_LINK( ColorDialogHdl, Button*, void );
- DECL_LINK( PreviewChangeHdl, SvxLightCtl3D*, void );
- DECL_LINK( PreviewSelectHdl, SvxLightCtl3D*, void );
+ DECL_LINK( ClickLightSourceButtonHdl, weld::Button&, void );
+ DECL_LINK( SelectColorHdl, ColorListBox&, void );
+ DECL_LINK( ColorDialogHdl, weld::Button&, void );
+ DECL_LINK( PreviewChangeHdl, LightCtl3D*, void );
+ DECL_LINK( PreviewSelectHdl, LightCtl3D*, void );
void updatePreview();
@@ -71,23 +79,6 @@ private:
void applyLightSourceToModel( sal_uInt32 nLightNumber );
void applyLightSourcesToModel();
- VclPtr<LightButton> m_pBtn_Light1;
- VclPtr<LightButton> m_pBtn_Light2;
- VclPtr<LightButton> m_pBtn_Light3;
- VclPtr<LightButton> m_pBtn_Light4;
- VclPtr<LightButton> m_pBtn_Light5;
- VclPtr<LightButton> m_pBtn_Light6;
- VclPtr<LightButton> m_pBtn_Light7;
- VclPtr<LightButton> m_pBtn_Light8;
-
- VclPtr<SvxColorListBox> m_pLB_LightSource;
- VclPtr<PushButton> m_pBtn_LightSource_Color;
-
- VclPtr<SvxColorListBox> m_pLB_AmbientLight;
- VclPtr<PushButton> m_pBtn_AmbientLight_Color;
-
- VclPtr<SvxLightCtl3D> m_pCtl_Preview;
-
std::unique_ptr<LightSourceInfo[]> m_pLightSourceInfoList;
css::uno::Reference< css::beans::XPropertySet > m_xSceneProperties;
@@ -96,7 +87,29 @@ private:
bool m_bInCommitToModel;
- css::uno::Reference< css::frame::XModel > m_xChartModel;
+ css::uno::Reference<css::frame::XModel> m_xChartModel;
+
+ weld::Window* m_pTopLevel;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::Container> m_xContainer;
+ std::unique_ptr<LightButton> m_xBtn_Light1;
+ std::unique_ptr<LightButton> m_xBtn_Light2;
+ std::unique_ptr<LightButton> m_xBtn_Light3;
+ std::unique_ptr<LightButton> m_xBtn_Light4;
+ std::unique_ptr<LightButton> m_xBtn_Light5;
+ std::unique_ptr<LightButton> m_xBtn_Light6;
+ std::unique_ptr<LightButton> m_xBtn_Light7;
+ std::unique_ptr<LightButton> m_xBtn_Light8;
+ std::unique_ptr<ColorListBox> m_xLB_LightSource;
+ std::unique_ptr<weld::Button> m_xBtn_LightSource_Color;
+ std::unique_ptr<ColorListBox> m_xLB_AmbientLight;
+ std::unique_ptr<weld::Button> m_xBtn_AmbientLight_Color;
+ std::unique_ptr<weld::Scale> m_xHoriScale;
+ std::unique_ptr<weld::Scale> m_xVertScale;
+ std::unique_ptr<weld::Button> m_xBtn_Corner;
+ std::unique_ptr<LightControl3D> m_xPreview;
+ std::unique_ptr<weld::CustomWeld> m_xPreviewWnd;
+ std::unique_ptr<LightCtl3D> m_xCtl_Preview;
};
} //namespace chart
diff --git a/chart2/source/controller/inc/dlg_View3D.hxx b/chart2/source/controller/inc/dlg_View3D.hxx
index 300b4cb1d989..d386a9f33b94 100644
--- a/chart2/source/controller/inc/dlg_View3D.hxx
+++ b/chart2/source/controller/inc/dlg_View3D.hxx
@@ -19,9 +19,7 @@
#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_VIEW3D_HXX
#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_VIEW3D_HXX
-#include <vcl/tabdlg.hxx>
-#include <vcl/tabctrl.hxx>
-
+#include <vcl/weld.hxx>
#include <ControllerLockGuard.hxx>
namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
@@ -32,27 +30,25 @@ class ThreeD_SceneGeometry_TabPage;
class ThreeD_SceneAppearance_TabPage;
class ThreeD_SceneIllumination_TabPage;
-class View3DDialog : public TabDialog
+class View3DDialog : public weld::GenericDialogController
{
public:
- View3DDialog( vcl::Window* pWindow,
- const css::uno::Reference< css::frame::XModel > & xChartModel );
+ View3DDialog(weld::Window* pWindow, const css::uno::Reference<css::frame::XModel> & xChartModel);
virtual ~View3DDialog() override;
- virtual void dispose() override;
- // from Dialog (base of TabDialog)
- virtual short Execute() override;
+ virtual short run() override;
private:
- VclPtr<TabControl> m_pTabControl;
-
- VclPtr<ThreeD_SceneGeometry_TabPage> m_pGeometry;
- VclPtr<ThreeD_SceneAppearance_TabPage> m_pAppearance;
- VclPtr<ThreeD_SceneIllumination_TabPage> m_pIllumination;
+ DECL_LINK(ActivatePageHdl, const OString&, void);
ControllerLockHelper m_aControllerLocker;
static sal_uInt16 m_nLastPageId;
+
+ std::unique_ptr<weld::Notebook> m_xTabControl;
+ std::unique_ptr<ThreeD_SceneGeometry_TabPage> m_xGeometry;
+ std::unique_ptr<ThreeD_SceneAppearance_TabPage> m_xAppearance;
+ std::unique_ptr<ThreeD_SceneIllumination_TabPage> m_xIllumination;
};
} //namespace chart
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx
index 9ba3f1f712e4..69fc84fdda90 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -820,8 +820,8 @@ void ChartController::executeDispatch_View3D()
//open dialog
SolarMutexGuard aSolarGuard;
- ScopedVclPtrInstance< View3DDialog > aDlg(GetChartWindow(), getModel());
- if( aDlg->Execute() == RET_OK )
+ View3DDialog aDlg(GetChartFrame(), getModel());
+ if (aDlg.run() == RET_OK)
aUndoGuard.commit();
}
catch(const uno::RuntimeException& e)