diff options
Diffstat (limited to 'chart2/source/controller/sidebar/ChartElementsPanel.cxx')
-rw-r--r-- | chart2/source/controller/sidebar/ChartElementsPanel.cxx | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx index 572ea7de4bd3..1e5e6e9403fa 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -19,8 +19,6 @@ #include <com/sun/star/chart2/LegendPosition.hpp> #include <com/sun/star/chart/ChartLegendExpansion.hpp> -#include <com/sun/star/chart2/XChartTypeContainer.hpp> -#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> #include <vcl/svapp.hxx> @@ -28,11 +26,11 @@ #include <ChartController.hxx> #include <comphelper/processfactory.hxx> +#include <Legend.hxx> #include <LegendHelper.hxx> -#include <ChartModelHelper.hxx> #include <AxisHelper.hxx> -#include <DiagramHelper.hxx> #include <Diagram.hxx> +#include <ChartType.hxx> #include <ChartTypeHelper.hxx> #include <ChartModel.hxx> #include <BaseCoordinateSystem.hxx> @@ -75,7 +73,7 @@ bool isLegendVisible(const css::uno::Reference<css::frame::XModel>& xModel) if (!pModel) return false; - Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend(*pModel), uno::UNO_QUERY ); + rtl::Reference< Legend > xLegendProp = LegendHelper::getLegend(*pModel); if( xLegendProp.is()) { try @@ -112,7 +110,7 @@ bool isLegendOverlay(const css::uno::Reference<css::frame::XModel>& xModel) if (!pModel) return false; - Reference< beans::XPropertySet > xLegendProp(LegendHelper::getLegend(*pModel), uno::UNO_QUERY); + rtl::Reference< Legend > xLegendProp = LegendHelper::getLegend(*pModel); if( xLegendProp.is()) { try @@ -137,7 +135,7 @@ void setLegendOverlay(const css::uno::Reference<css::frame::XModel>& xModel, boo if (!pModel) return; - Reference<beans::XPropertySet> xLegendProp(LegendHelper::getLegend(*pModel), uno::UNO_QUERY); + rtl::Reference<Legend> xLegendProp = LegendHelper::getLegend(*pModel); if (!xLegendProp.is()) return; @@ -146,19 +144,18 @@ void setLegendOverlay(const css::uno::Reference<css::frame::XModel>& xModel, boo bool isTitleVisible(const rtl::Reference<::chart::ChartModel>& xModel, TitleHelper::eTitleType eTitle) { - css::uno::Reference<css::uno::XInterface> xTitle = TitleHelper::getTitle(eTitle, xModel); + rtl::Reference<Title> xTitle = TitleHelper::getTitle(eTitle, xModel); if (!xTitle.is()) return false; - css::uno::Reference<css::beans::XPropertySet> xPropSet(xTitle, css::uno::UNO_QUERY_THROW); - css::uno::Any aAny = xPropSet->getPropertyValue("Visible"); + css::uno::Any aAny = xTitle->getPropertyValue("Visible"); bool bVisible = aAny.get<bool>(); return bVisible; } bool isGridVisible(const rtl::Reference<::chart::ChartModel>& xModel, GridType eType) { - rtl::Reference< Diagram > xDiagram(ChartModelHelper::findDiagram(xModel)); + rtl::Reference< Diagram > xDiagram(xModel->getFirstChartDiagram()); if(xDiagram.is()) { sal_Int32 nDimensionIndex = 0; @@ -175,7 +172,7 @@ bool isGridVisible(const rtl::Reference<::chart::ChartModel>& xModel, GridType e void setGridVisible(const rtl::Reference<::chart::ChartModel>& xModel, GridType eType, bool bVisible) { - rtl::Reference< Diagram > xDiagram(ChartModelHelper::findDiagram(xModel)); + rtl::Reference< Diagram > xDiagram(xModel->getFirstChartDiagram()); if(!xDiagram.is()) return; @@ -195,7 +192,7 @@ void setGridVisible(const rtl::Reference<::chart::ChartModel>& xModel, GridType bool isAxisVisible(const rtl::Reference<::chart::ChartModel>& xModel, AxisType eType) { - rtl::Reference< Diagram > xDiagram(ChartModelHelper::findDiagram(xModel)); + rtl::Reference< Diagram > xDiagram(xModel->getFirstChartDiagram()); if(xDiagram.is()) { sal_Int32 nDimensionIndex = 0; @@ -214,7 +211,7 @@ bool isAxisVisible(const rtl::Reference<::chart::ChartModel>& xModel, AxisType e void setAxisVisible(const rtl::Reference<::chart::ChartModel>& xModel, AxisType eType, bool bVisible) { - rtl::Reference< Diagram > xDiagram(ChartModelHelper::findDiagram(xModel)); + rtl::Reference< Diagram > xDiagram(xModel->getFirstChartDiagram()); if(!xDiagram.is()) return; @@ -238,7 +235,7 @@ sal_Int32 getLegendPos(const css::uno::Reference<css::frame::XModel>& xModel) if (!pModel) return -1; - Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend(*pModel), uno::UNO_QUERY ); + rtl::Reference< Legend > xLegendProp = LegendHelper::getLegend(*pModel); if (!xLegendProp.is()) return -1; @@ -265,7 +262,7 @@ void setLegendPos(const css::uno::Reference<css::frame::XModel>& xModel, sal_Int if (!pModel) return; - Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend(*pModel), uno::UNO_QUERY ); + rtl::Reference< Legend > xLegendProp = LegendHelper::getLegend(*pModel); if (!xLegendProp.is()) return; @@ -406,21 +403,21 @@ void ChartElementsPanel::Initialize() namespace { -css::uno::Reference<css::chart2::XChartType> getChartType(const rtl::Reference<ChartModel>& xModel) +rtl::Reference<ChartType> getChartType(const rtl::Reference<ChartModel>& xModel) { rtl::Reference<Diagram > xDiagram = xModel->getFirstChartDiagram(); if (!xDiagram.is()) - return css::uno::Reference<css::chart2::XChartType>(); + return nullptr; const std::vector<rtl::Reference<BaseCoordinateSystem>> & xCooSysSequence(xDiagram->getBaseCoordinateSystems()); if (xCooSysSequence.empty()) - return css::uno::Reference<css::chart2::XChartType>(); + return nullptr; - css::uno::Sequence<css::uno::Reference<css::chart2::XChartType>> xChartTypeSequence(xCooSysSequence[0]->getChartTypes()); + const std::vector<rtl::Reference<ChartType>> & xChartTypeSequence(xCooSysSequence[0]->getChartTypes2()); - if (!xChartTypeSequence.hasElements()) - return css::uno::Reference<css::chart2::XChartType>(); + if (xChartTypeSequence.empty()) + return nullptr; return xChartTypeSequence[0]; } @@ -432,8 +429,10 @@ void ChartElementsPanel::updateData() if (!mbModelValid) return; - rtl::Reference< Diagram > xDiagram(ChartModelHelper::findDiagram(mxModel)); - sal_Int32 nDimension = DiagramHelper::getDimension(xDiagram); + rtl::Reference< Diagram > xDiagram(mxModel->getFirstChartDiagram()); + sal_Int32 nDimension = 0; + if (xDiagram) + nDimension = xDiagram->getDimension(); SolarMutexGuard aGuard; mxCBLegend->set_active(isLegendVisible(mxModel)); @@ -556,7 +555,7 @@ void ChartElementsPanel::modelInvalid() mbModelValid = false; } -void ChartElementsPanel::doUpdateModel(rtl::Reference<::chart::ChartModel> xModel) +void ChartElementsPanel::doUpdateModel(const rtl::Reference<::chart::ChartModel>& xModel) { if (mbModelValid) { @@ -635,7 +634,8 @@ IMPL_LINK(ChartElementsPanel, EditHdl, weld::Entry&, rEdit, void) // set it OUString aText(rEdit.get_text()); - TitleHelper::setCompleteString(aText, TitleHelper::getTitle(aTitleType, mxModel), comphelper::getProcessComponentContext()); + TitleHelper::setCompleteString(aText, TitleHelper::getTitle(aTitleType, mxModel), + comphelper::getProcessComponentContext(), nullptr, true); } IMPL_LINK_NOARG(ChartElementsPanel, LegendPosHdl, weld::ComboBox&, void) |