diff options
Diffstat (limited to 'chart2/source/controller/sidebar')
-rw-r--r-- | chart2/source/controller/sidebar/ChartElementsPanel.cxx | 52 | ||||
-rw-r--r-- | chart2/source/controller/sidebar/ChartTypePanel.cxx | 49 |
2 files changed, 50 insertions, 51 deletions
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx index 63df9483b8c8..594cbf827379 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -175,21 +175,21 @@ bool isGridVisible(const css::uno::Reference<css::frame::XModel>& xModel, GridTy void setGridVisible(const css::uno::Reference<css::frame::XModel>& xModel, GridType eType, bool bVisible) { Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel)); - if(xDiagram.is()) - { - sal_Int32 nDimensionIndex = 0; - if (eType == GridType::HOR_MAJOR || eType == GridType::HOR_MINOR) - nDimensionIndex = 1; - sal_Int32 nCooSysIndex = 0; + if(!xDiagram.is()) + return; - bool bMajor = (eType == GridType::HOR_MAJOR || eType == GridType::VERT_MAJOR); + sal_Int32 nDimensionIndex = 0; + if (eType == GridType::HOR_MAJOR || eType == GridType::HOR_MINOR) + nDimensionIndex = 1; + sal_Int32 nCooSysIndex = 0; - if (bVisible) - AxisHelper::showGrid(nDimensionIndex, nCooSysIndex, bMajor, - xDiagram); - else - AxisHelper::hideGrid(nDimensionIndex, nCooSysIndex, bMajor, xDiagram); - } + bool bMajor = (eType == GridType::HOR_MAJOR || eType == GridType::VERT_MAJOR); + + if (bVisible) + AxisHelper::showGrid(nDimensionIndex, nCooSysIndex, bMajor, + xDiagram); + else + AxisHelper::hideGrid(nDimensionIndex, nCooSysIndex, bMajor, xDiagram); } bool isAxisVisible(const css::uno::Reference<css::frame::XModel>& xModel, AxisType eType) @@ -214,21 +214,21 @@ bool isAxisVisible(const css::uno::Reference<css::frame::XModel>& xModel, AxisTy void setAxisVisible(const css::uno::Reference<css::frame::XModel>& xModel, AxisType eType, bool bVisible) { Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel)); - if(xDiagram.is()) - { - sal_Int32 nDimensionIndex = 0; - if (eType == AxisType::Y_MAIN || eType == AxisType::Y_SECOND) - nDimensionIndex = 1; - else if (eType == AxisType::Z_MAIN) - nDimensionIndex = 2; + if(!xDiagram.is()) + return; - bool bMajor = !(eType == AxisType::X_SECOND || eType == AxisType::Y_SECOND); + sal_Int32 nDimensionIndex = 0; + if (eType == AxisType::Y_MAIN || eType == AxisType::Y_SECOND) + nDimensionIndex = 1; + else if (eType == AxisType::Z_MAIN) + nDimensionIndex = 2; - if (bVisible) - AxisHelper::showAxis(nDimensionIndex, bMajor, xDiagram, comphelper::getProcessComponentContext()); - else - AxisHelper::hideAxis(nDimensionIndex, bMajor, xDiagram); - } + bool bMajor = !(eType == AxisType::X_SECOND || eType == AxisType::Y_SECOND); + + if (bVisible) + AxisHelper::showAxis(nDimensionIndex, bMajor, xDiagram, comphelper::getProcessComponentContext()); + else + AxisHelper::hideAxis(nDimensionIndex, bMajor, xDiagram); } sal_Int32 getLegendPos(const css::uno::Reference<css::frame::XModel>& xModel) diff --git a/chart2/source/controller/sidebar/ChartTypePanel.cxx b/chart2/source/controller/sidebar/ChartTypePanel.cxx index f6334864b049..da3166c74cf4 100644 --- a/chart2/source/controller/sidebar/ChartTypePanel.cxx +++ b/chart2/source/controller/sidebar/ChartTypePanel.cxx @@ -405,34 +405,33 @@ void ChartTypePanel::selectMainType() } m_pCurrentMainType = getSelectedMainType(); - if (m_pCurrentMainType) - { - showAllControls(*m_pCurrentMainType); + if (!m_pCurrentMainType) + return; - m_pCurrentMainType->adjustParameterToMainType(aParameter); - 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; - - uno::Reference<css::chart2::XDiagram> xDiagram - = ChartModelHelper::findDiagram(m_xChartModel); - try - { - uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW); - xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues; - } - catch (const uno::Exception&) - { - DBG_UNHANDLED_EXCEPTION("chart2"); - } + showAllControls(*m_pCurrentMainType); - fillAllControls(aParameter); - uno::Reference<beans::XPropertySet> xTemplateProps(getCurrentTemplate(), uno::UNO_QUERY); - m_pCurrentMainType->fillExtraControls(m_xChartModel, xTemplateProps); + m_pCurrentMainType->adjustParameterToMainType(aParameter); + 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; + + uno::Reference<css::chart2::XDiagram> xDiagram = ChartModelHelper::findDiagram(m_xChartModel); + try + { + uno::Reference<beans::XPropertySet> xPropSet(xDiagram, uno::UNO_QUERY_THROW); + xPropSet->getPropertyValue(CHART_UNONAME_SORT_BY_XVALUES) >>= aParameter.bSortByXValues; } + catch (const uno::Exception&) + { + DBG_UNHANDLED_EXCEPTION("chart2"); + } + + fillAllControls(aParameter); + uno::Reference<beans::XPropertySet> xTemplateProps(getCurrentTemplate(), uno::UNO_QUERY); + m_pCurrentMainType->fillExtraControls(m_xChartModel, xTemplateProps); } } // end of namespace ::chart::sidebar |