diff options
Diffstat (limited to 'chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx')
-rw-r--r-- | chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx index 36a0686e95f7..a8838f3b24e0 100644 --- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx @@ -20,10 +20,11 @@ #include <TextLabelItemConverter.hxx> #include <CharacterPropertyItemConverter.hxx> #include <ChartModel.hxx> -#include <ChartModelHelper.hxx> +#include <ChartType.hxx> #include <ChartTypeHelper.hxx> +#include <DataSeries.hxx> #include <DataSeriesHelper.hxx> -#include <DiagramHelper.hxx> +#include <DataSeriesProperties.hxx> #include <Diagram.hxx> #include <ItemPropertyMap.hxx> #include "SchWhichPairs.hxx" @@ -37,7 +38,7 @@ #include <svl/stritem.hxx> #include <svx/tabline.hxx> #include <svx/sdangitm.hxx> -#include <tools/diagnose_ex.h> +#include <comphelper/diagnose_ex.hxx> #include <vcl/graph.hxx> #include <rtl/math.hxx> @@ -46,12 +47,12 @@ #include <com/sun/star/chart2/DataPointLabel.hpp> #include <com/sun/star/chart2/Symbol.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> -#include <com/sun/star/frame/XModel.hpp> #include <memory> using namespace com::sun::star; using namespace com::sun::star::chart2; using com::sun::star::uno::Reference; +using namespace ::chart::DataSeriesProperties; namespace chart::wrapper { @@ -100,7 +101,7 @@ bool numberFormatFromItemToPropertySet( if (!xPropertySet.is()) return bChanged; - OUString aPropertyName = (nWhichId == SID_ATTR_NUMBERFORMAT_VALUE) ? OUString(CHART_UNONAME_NUMFMT) : OUString("PercentageNumberFormat"); + OUString aPropertyName = (nWhichId == SID_ATTR_NUMBERFORMAT_VALUE) ? CHART_UNONAME_NUMFMT : OUString("PercentageNumberFormat"); sal_uInt16 nSourceWhich = (nWhichId == SID_ATTR_NUMBERFORMAT_VALUE) ? SID_ATTR_NUMBERFORMAT_SOURCE : SCHATTR_PERCENT_NUMBERFORMAT_SOURCE; if (rItemSet.GetItemState(nSourceWhich) != SfxItemState::SET) @@ -125,7 +126,7 @@ bool numberFormatFromItemToPropertySet( uno::Any aOldValue = xPropertySet->getPropertyValue(aPropertyName); if (bOverwriteDataPoints) { - Reference<chart2::XDataSeries> xSeries(xPropertySet, uno::UNO_QUERY); + rtl::Reference<DataSeries> xSeries( dynamic_cast<DataSeries*>(xPropertySet.get()) ); if (aValue != aOldValue || ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, aPropertyName, aOldValue)) { @@ -148,7 +149,7 @@ bool useSourceFormatFromItemToPropertySet( bool bChanged = false; if (!xPropertySet.is()) return bChanged; - OUString aPropertyName = (nWhichId == SID_ATTR_NUMBERFORMAT_SOURCE) ? OUString(CHART_UNONAME_NUMFMT) : OUString("PercentageNumberFormat"); + OUString aPropertyName = (nWhichId == SID_ATTR_NUMBERFORMAT_SOURCE) ? CHART_UNONAME_NUMFMT : OUString("PercentageNumberFormat"); sal_uInt16 nFormatWhich = (nWhichId == SID_ATTR_NUMBERFORMAT_SOURCE) ? SID_ATTR_NUMBERFORMAT_VALUE : SCHATTR_PERCENT_NUMBERFORMAT_VALUE; if (rItemSet.GetItemState(nWhichId) != SfxItemState::SET) @@ -175,7 +176,7 @@ bool useSourceFormatFromItemToPropertySet( uno::Any aOldValue(xPropertySet->getPropertyValue(aPropertyName)); if (bOverwriteDataPoints) { - Reference<chart2::XDataSeries> xSeries(xPropertySet, uno::UNO_QUERY); + rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(xPropertySet.get())); if (aNewValue != aOldValue || ::chart::DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, aPropertyName, aOldValue)) { @@ -197,8 +198,8 @@ bool useSourceFormatFromItemToPropertySet( TextLabelItemConverter::TextLabelItemConverter( const rtl::Reference<::chart::ChartModel>& xChartModel, const uno::Reference<beans::XPropertySet>& rPropertySet, - const uno::Reference<XDataSeries>& xSeries, - SfxItemPool& rItemPool, const awt::Size* pRefSize, + const rtl::Reference<DataSeries>& xSeries, + SfxItemPool& rItemPool, const std::optional<awt::Size>& pRefSize, bool bDataSeries, sal_Int32 nNumberFormat, sal_Int32 nPercentNumberFormat ) : ItemConverter(rPropertySet, rItemPool), mnNumberFormat(nNumberFormat), @@ -209,11 +210,11 @@ TextLabelItemConverter::TextLabelItemConverter( { maConverters.emplace_back(new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize")); - rtl::Reference< Diagram > xDiagram(ChartModelHelper::findDiagram(xChartModel)); - uno::Reference<XChartType> xChartType(DiagramHelper::getChartTypeOfSeries(xDiagram, xSeries)); + rtl::Reference< Diagram > xDiagram(xChartModel->getFirstChartDiagram()); + rtl::Reference< ChartType > xChartType(xDiagram->getChartTypeOfSeries(xSeries)); bool bFound = false; bool bAmbiguous = false; - bool bSwapXAndY = DiagramHelper::getVertical(xDiagram, bFound, bAmbiguous); + bool bSwapXAndY = xDiagram->getVertical(bFound, bAmbiguous); maAvailableLabelPlacements = ChartTypeHelper::getSupportedLabelPlacements(xChartType, bSwapXAndY, xSeries); mbForbidPercentValue = ChartTypeHelper::getAxisType(xChartType, 0) != AxisType::CATEGORY; @@ -287,7 +288,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte rValue = rItem.GetValue(); if (mbDataSeries) { - Reference<chart2::XDataSeries> xSeries(GetPropertySet(), uno::UNO_QUERY); + rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get())); if (bOldValue != bool(rValue) || DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, CHART_UNONAME_LABEL, aOldValue)) { @@ -325,7 +326,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte GetPropertySet()->getPropertyValue("LabelSeparator") >>= aOldValue; if (mbDataSeries) { - Reference<chart2::XDataSeries> xSeries(GetPropertySet(), uno::UNO_QUERY); + rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get())); if (aOldValue != aNewValue || DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, "LabelSeparator", uno::Any(aOldValue))) { @@ -355,7 +356,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte GetPropertySet()->getPropertyValue( "TextWordWrap" ) >>= bOld; if( mbDataSeries ) { - Reference< chart2::XDataSeries > xSeries( GetPropertySet(), uno::UNO_QUERY); + rtl::Reference< DataSeries > xSeries( dynamic_cast<DataSeries*>(GetPropertySet().get()) ); if( bOld!=bNew || DataSeriesHelper::hasAttributedDataPointDifferentValue( xSeries, "TextWordWrap", uno::Any( bOld ) ) ) { @@ -385,7 +386,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte GetPropertySet()->getPropertyValue("LabelPlacement") >>= nOld; if (mbDataSeries) { - Reference<chart2::XDataSeries> xSeries(GetPropertySet(), uno::UNO_QUERY); + rtl::Reference<DataSeries> xSeries(dynamic_cast<DataSeries*>(GetPropertySet().get())); if (nOld != nNew || DataSeriesHelper::hasAttributedDataPointDifferentValue(xSeries, "LabelPlacement", uno::Any(nOld))) { @@ -397,6 +398,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte { GetPropertySet()->setPropertyValue("LabelPlacement", uno::Any(nNew)); GetPropertySet()->setPropertyValue("CustomLabelPosition", uno::Any()); + GetPropertySet()->setPropertyValue("CustomLabelSize", uno::Any()); bChanged = true; } } @@ -511,10 +513,9 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte { bool bNew = static_cast<const SfxBoolItem&>(rItemSet.Get(nWhichId)).GetValue(); bool bOld = true; - Reference<beans::XPropertySet> xSeriesProp(m_xSeries, uno::UNO_QUERY); - if( (xSeriesProp->getPropertyValue("ShowCustomLeaderLines") >>= bOld) && bOld != bNew ) + if( (m_xSeries->getFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES) >>= bOld) && bOld != bNew ) { - xSeriesProp->setPropertyValue("ShowCustomLeaderLines", uno::Any(bNew)); + m_xSeries->setFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES, uno::Any(bNew)); bChanged = true; } } @@ -552,7 +553,7 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r if (mbDataSeries) { if (DataSeriesHelper::hasAttributedDataPointDifferentValue( - Reference<chart2::XDataSeries>(GetPropertySet(), uno::UNO_QUERY), CHART_UNONAME_LABEL, uno::Any(aLabel))) + dynamic_cast<DataSeries*>(GetPropertySet().get()), CHART_UNONAME_LABEL, uno::Any(aLabel))) { rOutItemSet.InvalidateItem(nWhichId); } @@ -668,8 +669,7 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r try { bool bValue = true; - Reference<beans::XPropertySet> xSeriesProp(m_xSeries, uno::UNO_QUERY); - if( xSeriesProp->getPropertyValue( "ShowCustomLeaderLines" ) >>= bValue ) + if( m_xSeries->getFastPropertyValue( PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES ) >>= bValue ) rOutItemSet.Put(SfxBoolItem(nWhichId, bValue)); } catch (const uno::Exception&) @@ -711,7 +711,7 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r if (GetPropertySet()->getPropertyValue("TextRotation") >>= fValue) { rOutItemSet.Put( - SdrAngleItem(nWhichId, Degree100(static_cast<sal_Int32>(rtl::math::round(fValue * 100.0))))); + SdrAngleItem(SCHATTR_TEXT_DEGREES, Degree100(static_cast<sal_Int32>(rtl::math::round(fValue * 100.0))))); } } break; |