summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2021-05-16 11:02:32 +0200
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2021-05-19 09:31:24 +0200
commitb238522ca121ca8f863fe4d3394ade088a65ad01 (patch)
tree3e7e32fb6002b50698060985fc74d3f118464283 /chart2/source
parent95d109fd5f254f694684c0effe447f133872f40d (diff)
tdf#124295 - Always select a 3D scheme in the chart wizard
Change-Id: Ic0a39b4cb6f7af6fbdd99fc93677a0c2d966234d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115671 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/controller/dialogs/ChartResourceGroups.cxx33
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.cxx4
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx12
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx16
-rw-r--r--chart2/source/controller/sidebar/ChartTypePanel.cxx10
-rw-r--r--chart2/source/inc/ThreeDHelper.hxx2
-rw-r--r--chart2/source/model/main/ChartModel_Persistence.cxx2
-rw-r--r--chart2/source/tools/ThreeDHelper.cxx24
8 files changed, 61 insertions, 42 deletions
diff --git a/chart2/source/controller/dialogs/ChartResourceGroups.cxx b/chart2/source/controller/dialogs/ChartResourceGroups.cxx
index 199606abef69..9ab5dff70f20 100644
--- a/chart2/source/controller/dialogs/ChartResourceGroups.cxx
+++ b/chart2/source/controller/dialogs/ChartResourceGroups.cxx
@@ -48,24 +48,31 @@ void Dim3DLookResourceGroup::fillControls(const ChartTypeParameter& rParameter)
m_xCB_3DLook->set_active(rParameter.b3DLook);
m_xLB_Scheme->set_sensitive(rParameter.b3DLook);
- if (rParameter.eThreeDLookScheme == ThreeDLookScheme_Simple)
- m_xLB_Scheme->set_active(POS_3DSCHEME_SIMPLE);
- else if (rParameter.eThreeDLookScheme == ThreeDLookScheme_Realistic)
- m_xLB_Scheme->set_active(POS_3DSCHEME_REALISTIC);
- else
- m_xLB_Scheme->set_active(-1);
+ // tdf#124295 - select always a 3D scheme
+ switch (rParameter.eThreeDLookScheme)
+ {
+ case ThreeDLookScheme::ThreeDLookScheme_Simple:
+ m_xLB_Scheme->set_active(POS_3DSCHEME_SIMPLE);
+ break;
+ case ThreeDLookScheme::ThreeDLookScheme_Realistic:
+ case ThreeDLookScheme::ThreeDLookScheme_Unknown:
+ m_xLB_Scheme->set_active(POS_3DSCHEME_REALISTIC);
+ break;
+ }
}
void Dim3DLookResourceGroup::fillParameter(ChartTypeParameter& rParameter)
{
rParameter.b3DLook = m_xCB_3DLook->get_active();
- const int nPos = m_xLB_Scheme->get_active();
- if (nPos == POS_3DSCHEME_SIMPLE)
- rParameter.eThreeDLookScheme = ThreeDLookScheme_Simple;
- else if (nPos == POS_3DSCHEME_REALISTIC)
- rParameter.eThreeDLookScheme = ThreeDLookScheme_Realistic;
- else
- rParameter.eThreeDLookScheme = ThreeDLookScheme_Unknown;
+ // tdf#124295 - select always a 3D scheme
+ switch (m_xLB_Scheme->get_active())
+ {
+ case POS_3DSCHEME_SIMPLE:
+ rParameter.eThreeDLookScheme = ThreeDLookScheme::ThreeDLookScheme_Simple;
+ break;
+ default:
+ rParameter.eThreeDLookScheme = ThreeDLookScheme::ThreeDLookScheme_Realistic;
+ }
}
IMPL_LINK_NOARG(Dim3DLookResourceGroup, Dim3DLookCheckHdl, weld::ToggleButton&, void)
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index 748df3e1b40e..b0fda08c72f6 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -53,7 +53,7 @@ ChartTypeParameter::ChartTypeParameter()
, nCurveResolution(20)
, nSplineOrder(3)
, nGeometry3D(DataPointGeometry3D::CUBOID)
- , eThreeDLookScheme(ThreeDLookScheme_Realistic)
+ , eThreeDLookScheme(ThreeDLookScheme::ThreeDLookScheme_Realistic)
, bSortByXValues(false)
, mbRoundedEdge(false)
{
@@ -73,7 +73,7 @@ ChartTypeParameter::ChartTypeParameter( sal_Int32 SubTypeIndex, bool HasXAxisWit
, nCurveResolution(20)
, nSplineOrder(3)
, nGeometry3D(DataPointGeometry3D::CUBOID)
- , eThreeDLookScheme(ThreeDLookScheme_Realistic)
+ , eThreeDLookScheme(ThreeDLookScheme::ThreeDLookScheme_Realistic)
, bSortByXValues(false)
, mbRoundedEdge(false)
{
diff --git a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
index c24cf6fab0d9..2ca07dd15676 100644
--- a/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
+++ b/chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx
@@ -44,7 +44,7 @@ struct lcl_ModelProperties
: m_aShadeMode(drawing::ShadeMode_FLAT)
, m_nRoundedEdges(-1)
, m_nObjectLines(-1)
- , m_eScheme(::chart::ThreeDLookScheme_Unknown)
+ , m_eScheme(::chart::ThreeDLookScheme::ThreeDLookScheme_Unknown)
{}
};
@@ -248,13 +248,13 @@ void ThreeD_SceneAppearance_TabPage::updateScheme()
m_xLB_Scheme->remove(POS_3DSCHEME_CUSTOM);
switch( aProps.m_eScheme )
{
- case ThreeDLookScheme_Simple:
+ case ThreeDLookScheme::ThreeDLookScheme_Simple:
m_xLB_Scheme->set_active( POS_3DSCHEME_SIMPLE );
break;
- case ThreeDLookScheme_Realistic:
+ case ThreeDLookScheme::ThreeDLookScheme_Realistic:
m_xLB_Scheme->set_active( POS_3DSCHEME_REALISTIC );
break;
- case ThreeDLookScheme_Unknown:
+ case ThreeDLookScheme::ThreeDLookScheme_Unknown:
{
m_xLB_Scheme->insert_text(POS_3DSCHEME_CUSTOM, m_aCustom);
m_xLB_Scheme->set_active(POS_3DSCHEME_CUSTOM);
@@ -275,9 +275,9 @@ IMPL_LINK_NOARG(ThreeD_SceneAppearance_TabPage, SelectSchemeHdl, weld::ComboBox&
uno::Reference< chart2::XDiagram > xDiagram( ::chart::ChartModelHelper::findDiagram( m_xChartModel ) );
if( m_xLB_Scheme->get_active() == POS_3DSCHEME_REALISTIC )
- ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Realistic );
+ ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme::ThreeDLookScheme_Realistic );
else if( m_xLB_Scheme->get_active() == POS_3DSCHEME_SIMPLE )
- ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Simple );
+ ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme::ThreeDLookScheme_Simple );
else
{
OSL_FAIL( "Invalid Entry selected" );
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index e209f508e3cc..19084e9e5180 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -178,7 +178,11 @@ void ChartTypeTabPage::stateChanged()
//detect the new ThreeDLookScheme
uno::Reference<XDiagram> xDiagram = ChartModelHelper::findDiagram(m_xChartModel);
- aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme(xDiagram);
+ // tdf#124295 - select always a 3D scheme
+ if (ThreeDLookScheme aThreeDLookScheme = ThreeDHelper::detectScheme(xDiagram);
+ aThreeDLookScheme != ThreeDLookScheme::ThreeDLookScheme_Unknown)
+ aParameter.eThreeDLookScheme = aThreeDLookScheme;
+
try
{
uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW);
@@ -240,8 +244,9 @@ void ChartTypeTabPage::selectMainType()
commitToModel( aParameter );
//detect the new ThreeDLookScheme
aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( ChartModelHelper::findDiagram( m_xChartModel ) );
- if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Realistic )
- aParameter.eThreeDLookScheme=ThreeDLookScheme_Realistic;
+ if (!aParameter.b3DLook
+ && aParameter.eThreeDLookScheme != ThreeDLookScheme::ThreeDLookScheme_Realistic)
+ aParameter.eThreeDLookScheme = ThreeDLookScheme::ThreeDLookScheme_Realistic;
uno::Reference<XDiagram> xDiagram = ChartModelHelper::findDiagram(m_xChartModel);
try
@@ -320,8 +325,9 @@ void ChartTypeTabPage::initializePage()
//set ThreeDLookScheme
aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme( xDiagram );
- if(!aParameter.b3DLook && aParameter.eThreeDLookScheme!=ThreeDLookScheme_Realistic )
- aParameter.eThreeDLookScheme=ThreeDLookScheme_Realistic;
+ if (!aParameter.b3DLook
+ && aParameter.eThreeDLookScheme != ThreeDLookScheme::ThreeDLookScheme_Realistic)
+ aParameter.eThreeDLookScheme = ThreeDLookScheme::ThreeDLookScheme_Realistic;
try
{
diff --git a/chart2/source/controller/sidebar/ChartTypePanel.cxx b/chart2/source/controller/sidebar/ChartTypePanel.cxx
index 66ffaa97c819..8ff15267760b 100644
--- a/chart2/source/controller/sidebar/ChartTypePanel.cxx
+++ b/chart2/source/controller/sidebar/ChartTypePanel.cxx
@@ -184,8 +184,9 @@ void ChartTypePanel::Initialize()
//set ThreeDLookScheme
aParameter.eThreeDLookScheme = ThreeDHelper::detectScheme(xDiagram);
- if (!aParameter.b3DLook && aParameter.eThreeDLookScheme != ThreeDLookScheme_Realistic)
- aParameter.eThreeDLookScheme = ThreeDLookScheme_Realistic;
+ if (!aParameter.b3DLook
+ && aParameter.eThreeDLookScheme != ThreeDLookScheme::ThreeDLookScheme_Realistic)
+ aParameter.eThreeDLookScheme = ThreeDLookScheme::ThreeDLookScheme_Realistic;
try
{
@@ -412,8 +413,9 @@ void ChartTypePanel::selectMainType()
//detect the new ThreeDLookScheme
aParameter.eThreeDLookScheme
= ThreeDHelper::detectScheme(ChartModelHelper::findDiagram(m_xChartModel));
- if (!aParameter.b3DLook && aParameter.eThreeDLookScheme != ThreeDLookScheme_Realistic)
- aParameter.eThreeDLookScheme = ThreeDLookScheme_Realistic;
+ if (!aParameter.b3DLook
+ && aParameter.eThreeDLookScheme != ThreeDLookScheme::ThreeDLookScheme_Realistic)
+ aParameter.eThreeDLookScheme = ThreeDLookScheme::ThreeDLookScheme_Realistic;
uno::Reference<css::chart2::XDiagram> xDiagram = ChartModelHelper::findDiagram(m_xChartModel);
try
diff --git a/chart2/source/inc/ThreeDHelper.hxx b/chart2/source/inc/ThreeDHelper.hxx
index e3d600b37219..93b1c995f388 100644
--- a/chart2/source/inc/ThreeDHelper.hxx
+++ b/chart2/source/inc/ThreeDHelper.hxx
@@ -28,7 +28,7 @@ namespace com::sun::star::chart2 { class XDiagram; }
namespace chart
{
-enum ThreeDLookScheme
+enum class ThreeDLookScheme
{
ThreeDLookScheme_Simple,
ThreeDLookScheme_Realistic,
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
index b26cf6815d72..b0bf0d1050a4 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -434,7 +434,7 @@ void ChartModel::insertDefaultChart()
{
xDiagramProperties->setPropertyValue( "RightAngledAxes", uno::Any( true ));
xDiagramProperties->setPropertyValue( "D3DScenePerspective", uno::Any( drawing::ProjectionMode_PARALLEL ));
- ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme_Realistic );
+ ThreeDHelper::setScheme( xDiagram, ThreeDLookScheme::ThreeDLookScheme_Realistic );
}
//set some new 'defaults' for wall and floor
diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx
index fe788397d40d..8c48d359c7b4 100644
--- a/chart2/source/tools/ThreeDHelper.cxx
+++ b/chart2/source/tools/ThreeDHelper.cxx
@@ -205,14 +205,14 @@ void lcl_setLightsForScheme( const uno::Reference< beans::XPropertySet >& xDiagr
{
if(!xDiagramProps.is())
return;
- if( rScheme == ThreeDLookScheme_Unknown)
+ if( rScheme == ThreeDLookScheme::ThreeDLookScheme_Unknown)
return;
xDiagramProps->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_2, uno::Any( true ) );
uno::Reference< chart2::XDiagram > xDiagram( xDiagramProps, uno::UNO_QUERY );
uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
- uno::Any aADirection( rScheme == ThreeDLookScheme_Simple
+ uno::Any aADirection( rScheme == ThreeDLookScheme::ThreeDLookScheme_Simple
? ChartTypeHelper::getDefaultSimpleLightDirection(xChartType)
: ChartTypeHelper::getDefaultRealisticLightDirection(xChartType) );
@@ -232,10 +232,12 @@ void lcl_setLightsForScheme( const uno::Reference< beans::XPropertySet >& xDiagr
}
}
- sal_Int32 nColor = ::chart::ChartTypeHelper::getDefaultDirectLightColor( rScheme==ThreeDLookScheme_Simple, xChartType );
+ sal_Int32 nColor = ::chart::ChartTypeHelper::getDefaultDirectLightColor(
+ rScheme == ThreeDLookScheme::ThreeDLookScheme_Simple, xChartType);
xDiagramProps->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTCOLOR_2, uno::Any( nColor ) );
- sal_Int32 nAmbientColor = ::chart::ChartTypeHelper::getDefaultAmbientLightColor( rScheme==ThreeDLookScheme_Simple, xChartType );
+ sal_Int32 nAmbientColor = ::chart::ChartTypeHelper::getDefaultAmbientLightColor(
+ rScheme == ThreeDLookScheme::ThreeDLookScheme_Simple, xChartType);
xDiagramProps->setPropertyValue( UNO_NAME_3D_SCENE_AMBIENTCOLOR, uno::Any( nAmbientColor ) );
}
@@ -1152,7 +1154,7 @@ double ThreeDHelper::PerspectiveToCameraDistance( double fPerspective )
ThreeDLookScheme ThreeDHelper::detectScheme( const uno::Reference< XDiagram >& xDiagram )
{
- ThreeDLookScheme aScheme = ThreeDLookScheme_Unknown;
+ ThreeDLookScheme aScheme = ThreeDLookScheme::ThreeDLookScheme_Unknown;
sal_Int32 nRoundedEdges;
sal_Int32 nObjectLines;
@@ -1174,12 +1176,12 @@ ThreeDLookScheme ThreeDHelper::detectScheme( const uno::Reference< XDiagram >& x
if( lcl_isSimpleScheme( aShadeMode, nRoundedEdges, nObjectLines, xDiagram ) )
{
if( lcl_isSimpleLightScheme(xDiagramProps) )
- aScheme = ThreeDLookScheme_Simple;
+ aScheme = ThreeDLookScheme::ThreeDLookScheme_Simple;
}
else if( lcl_isRealisticScheme( aShadeMode, nRoundedEdges, nObjectLines ) )
{
if( lcl_isRealisticLightScheme(xDiagramProps) )
- aScheme = ThreeDLookScheme_Realistic;
+ aScheme = ThreeDLookScheme::ThreeDLookScheme_Realistic;
}
return aScheme;
@@ -1187,14 +1189,14 @@ ThreeDLookScheme ThreeDHelper::detectScheme( const uno::Reference< XDiagram >& x
void ThreeDHelper::setScheme( const uno::Reference< XDiagram >& xDiagram, ThreeDLookScheme aScheme )
{
- if( aScheme == ThreeDLookScheme_Unknown )
+ if( aScheme == ThreeDLookScheme::ThreeDLookScheme_Unknown )
return;
drawing::ShadeMode aShadeMode;
sal_Int32 nRoundedEdges;
sal_Int32 nObjectLines;
- if( aScheme == ThreeDLookScheme_Simple )
+ if( aScheme == ThreeDLookScheme::ThreeDLookScheme_Simple )
lcl_setSimpleScheme(aShadeMode,nRoundedEdges,nObjectLines,xDiagram);
else
lcl_setRealisticScheme(aShadeMode,nRoundedEdges,nObjectLines);
@@ -1278,7 +1280,9 @@ void ThreeDHelper::setDefaultIllumination( const uno::Reference< beans::XPropert
DBG_UNHANDLED_EXCEPTION("chart2");
}
- ThreeDLookScheme aScheme = (aShadeMode==drawing::ShadeMode_FLAT) ? ThreeDLookScheme_Simple : ThreeDLookScheme_Realistic;
+ ThreeDLookScheme aScheme = (aShadeMode == drawing::ShadeMode_FLAT)
+ ? ThreeDLookScheme::ThreeDLookScheme_Simple
+ : ThreeDLookScheme::ThreeDLookScheme_Realistic;
lcl_setLightsForScheme( xSceneProperties, aScheme );
}