diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-12-27 15:19:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-12-28 07:23:03 +0100 |
commit | 9bbe89dab96d13f2a97d653c31128988fd815808 (patch) | |
tree | eba61c73e1fd6994826b8d27d4ecf1d7de904ba3 /chart2 | |
parent | 11b5980ef1cec9e6cf54c963328fb9b3edd3a896 (diff) |
use SdrAngleItem for SCHATTR_TEXT_DEGREES
as a precursor to introdcing a strong_int type for hundredths
of a degree
Change-Id: I63fbaf7e24e50ad90e524ae3c484dfb81b831aef
Change-Id: I1949b3c0b3af3acc386bd80e35175fd8742688e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108371
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
9 files changed, 25 insertions, 16 deletions
diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx index 3ce0a4374a4c..c8dee6c1b750 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.cxx +++ b/chart2/source/controller/dialogs/res_DataLabel.cxx @@ -34,6 +34,7 @@ #include <svl/ilstitem.hxx> #include <editeng/eeitem.hxx> #include <editeng/frmdiritem.hxx> +#include <svx/sdangitm.hxx> #include <svx/svxids.hrc> #include <osl/diagnose.h> @@ -305,7 +306,7 @@ void DataLabelResources::FillItemSet( SfxItemSet* rOutAttrs ) const if( m_xDC_Dial->IsVisible() ) { sal_Int32 nDegrees = m_xDC_Dial->GetRotation(); - rOutAttrs->Put(SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) ); + rOutAttrs->Put(SdrAngleItem( SCHATTR_TEXT_DEGREES, nDegrees ) ); } } @@ -354,7 +355,7 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs) if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, true, &pPoolItem ) == SfxItemState::SET ) { - sal_Int32 nDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); + sal_Int32 nDegrees = static_cast< const SdrAngleItem * >( pPoolItem )->GetValue(); m_xDC_Dial->SetRotation( nDegrees ); } else diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx index 1eaaa4063461..afe98676545d 100644 --- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx +++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx @@ -23,6 +23,7 @@ #include <TextDirectionListBox.hxx> #include <svx/chrtitem.hxx> +#include <svx/sdangitm.hxx> #include <svl/intitem.hxx> #include <editeng/eeitem.hxx> #include <editeng/frmdiritem.hxx> @@ -94,7 +95,7 @@ bool SchAxisLabelTabPage::FillItemSet( SfxItemSet* rOutAttrs ) { sal_Int32 nDegrees = bStacked ? 0 : m_xCtrlDial->GetRotation(); if( !m_bHasInitialDegrees || (nDegrees != m_nInitialDegrees) ) - rOutAttrs->Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) ); + rOutAttrs->Put( SdrAngleItem( SCHATTR_TEXT_DEGREES, nDegrees ) ); } if( m_bShowStaggeringControls ) @@ -157,7 +158,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs ) m_nInitialDegrees = 0; aState = rInAttrs->GetItemState( SCHATTR_TEXT_DEGREES, false, &pPoolItem ); if( aState == SfxItemState::SET ) - m_nInitialDegrees = static_cast< const SfxInt32Item * >( pPoolItem )->GetValue(); + m_nInitialDegrees = static_cast< const SdrAngleItem * >( pPoolItem )->GetValue(); m_bHasInitialDegrees = aState != SfxItemState::DONTCARE; if( m_bHasInitialDegrees ) diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx index d23e393d5f13..d2e1e02ab679 100644 --- a/chart2/source/controller/dialogs/tp_TitleRotation.cxx +++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx @@ -25,6 +25,7 @@ #include <editeng/eeitem.hxx> #include <editeng/frmdiritem.hxx> #include <svl/intitem.hxx> +#include <svx/sdangitm.hxx> namespace chart { @@ -94,7 +95,7 @@ bool SchAlignmentTabPage::FillItemSet(SfxItemSet* rOutAttrs) rOutAttrs->Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) ); sal_Int32 nDegrees = bStacked ? 0 : m_xCtrlDial->GetRotation(); - rOutAttrs->Put( SfxInt32Item( SCHATTR_TEXT_DEGREES, nDegrees ) ); + rOutAttrs->Put( SdrAngleItem( SCHATTR_TEXT_DEGREES, nDegrees ) ); SvxFrameDirection aDirection( m_xLbTextDirection->get_active_id() ); rOutAttrs->Put( SvxFrameDirectionItem( aDirection, EE_PARA_WRITINGDIR ) ); @@ -106,7 +107,7 @@ void SchAlignmentTabPage::Reset(const SfxItemSet* rInAttrs) { const SfxPoolItem* pItem = GetItem( *rInAttrs, SCHATTR_TEXT_DEGREES ); - sal_Int32 nDegrees = pItem ? static_cast<const SfxInt32Item*>(pItem)->GetValue() : 0; + sal_Int32 nDegrees = pItem ? static_cast<const SdrAngleItem*>(pItem)->GetValue() : 0; m_xCtrlDial->SetRotation( nDegrees ); pItem = GetItem( *rInAttrs, SCHATTR_TEXT_STACKED ); diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index 04646b69acb6..7c31c9693ab7 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -46,6 +46,7 @@ #include <o3tl/any.hxx> #include <svl/eitem.hxx> #include <svx/chrtitem.hxx> +#include <svx/sdangitm.hxx> #include <svl/intitem.hxx> #include <rtl/math.hxx> @@ -391,7 +392,7 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fVal ) { - rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >( + rOutItemSet.Put( SdrAngleItem( nWhichId, static_cast< sal_Int32 >( ::rtl::math::round( fVal * 100.0 ) ) )); } } @@ -879,7 +880,7 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet { // convert int to double (divided by 100) double fVal = static_cast< double >( - static_cast< const SfxInt32Item & >( + static_cast< const SdrAngleItem & >( rItemSet.Get( nWhichId )).GetValue()) / 100.0; double fOldVal = 0.0; bool bPropExisted = diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx index 9703f9dd398d..97f66d4c8431 100644 --- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx @@ -45,6 +45,7 @@ #include <svl/stritem.hxx> #include <editeng/brushitem.hxx> #include <svl/ilstitem.hxx> +#include <svx/sdangitm.hxx> #include <tools/diagnose_ex.h> #include <vcl/graph.hxx> #include <oox/helper/containerhelper.hxx> @@ -548,7 +549,7 @@ bool DataPointItemConverter::ApplySpecialItem( case SCHATTR_TEXT_DEGREES: { double fValue = static_cast< double >( - static_cast< const SfxInt32Item & >( + static_cast< const SdrAngleItem & >( rItemSet.Get( nWhichId )).GetValue()) / 100.0; double fOldValue = 0.0; bool bPropExisted = @@ -799,7 +800,7 @@ void DataPointItemConverter::FillSpecialItem( if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fValue ) { - rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >( + rOutItemSet.Put( SdrAngleItem( nWhichId, static_cast< sal_Int32 >( ::rtl::math::round( fValue * 100.0 ) ) )); } } diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx index 1ee04136f45c..dad6ba3b30ef 100644 --- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx @@ -34,6 +34,7 @@ #include <svl/intitem.hxx> #include <svl/stritem.hxx> #include <svx/tabline.hxx> +#include <svx/sdangitm.hxx> #include <tools/diagnose_ex.h> #include <vcl/graph.hxx> #include <rtl/math.hxx> @@ -487,7 +488,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte case SCHATTR_TEXT_DEGREES: { double fValue = static_cast<double>( - static_cast<const SfxInt32Item&>( + static_cast<const SdrAngleItem&>( rItemSet.Get(nWhichId)).GetValue()) / 100.0; double fOldValue = 0.0; bool bPropExisted = @@ -704,7 +705,7 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r if (GetPropertySet()->getPropertyValue("TextRotation") >>= fValue) { rOutItemSet.Put( - SfxInt32Item(nWhichId, static_cast<sal_Int32>(rtl::math::round(fValue * 100.0)))); + SdrAngleItem(nWhichId, static_cast<sal_Int32>(rtl::math::round(fValue * 100.0)))); } } break; diff --git a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx index dfc57623bf2d..6ca38785fb56 100644 --- a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx @@ -24,6 +24,7 @@ #include <CharacterPropertyItemConverter.hxx> #include <MultipleItemConverter.hxx> #include <svl/intitem.hxx> +#include <svx/sdangitm.hxx> #include <rtl/math.hxx> #include <com/sun/star/chart2/XTitle.hpp> @@ -167,7 +168,7 @@ bool TitleItemConverter::ApplySpecialItem( { // convert int to double (divided by 100) double fVal = static_cast< double >( - static_cast< const SfxInt32Item & >( + static_cast< const SdrAngleItem & >( rItemSet.Get( nWhichId )).GetValue()) / 100.0; double fOldVal = 0.0; bool bPropExisted = @@ -197,7 +198,7 @@ void TitleItemConverter::FillSpecialItem( if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fVal ) { - rOutItemSet.Put( SfxInt32Item( nWhichId, static_cast< sal_Int32 >( + rOutItemSet.Put( SdrAngleItem( nWhichId, static_cast< sal_Int32 >( ::rtl::math::round( fVal * 100.0 ) ) )); } } diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx index 9d0e4f9aa896..76f9e702d85b 100644 --- a/chart2/source/inc/chartview/ChartSfxItemIds.hxx +++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx @@ -32,6 +32,7 @@ class SvxBrushItem; class SvxChartKindErrorItem; class SvxChartTextOrderItem; class SvxChartRegressItem; +class SdrAngleItem; // SCHATTR @@ -62,7 +63,7 @@ constexpr sal_uInt16 SCHATTR_LEGEND_END (SCHATTR_LEGEND_N //text constexpr sal_uInt16 SCHATTR_TEXT_START (SCHATTR_LEGEND_END + 1); -constexpr TypedWhichId<SfxInt32Item> SCHATTR_TEXT_DEGREES (SCHATTR_TEXT_START); +constexpr TypedWhichId<SdrAngleItem> SCHATTR_TEXT_DEGREES (SCHATTR_TEXT_START); constexpr TypedWhichId<SfxBoolItem> SCHATTR_TEXT_STACKED (SCHATTR_TEXT_START + 1); constexpr sal_uInt16 SCHATTR_TEXT_END (SCHATTR_TEXT_STACKED); diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx index 4275ebd09b94..fbe61098290e 100644 --- a/chart2/source/view/main/ChartItemPool.cxx +++ b/chart2/source/view/main/ChartItemPool.cxx @@ -20,6 +20,7 @@ #include "ChartItemPool.hxx" #include <chartview/ChartSfxItemIds.hxx> #include <svx/chrtitem.hxx> +#include <svx/sdangitm.hxx> #include <svl/intitem.hxx> #include <editeng/brushitem.hxx> #include <editeng/sizeitem.hxx> @@ -62,7 +63,7 @@ ChartItemPool::ChartItemPool(): rPoolDefaults[SCHATTR_LEGEND_NO_OVERLAY - SCHATTR_START] = new SfxBoolItem(SCHATTR_LEGEND_NO_OVERLAY, true); //text - rPoolDefaults[SCHATTR_TEXT_DEGREES - SCHATTR_START] = new SfxInt32Item(SCHATTR_TEXT_DEGREES, 0); + rPoolDefaults[SCHATTR_TEXT_DEGREES - SCHATTR_START] = new SdrAngleItem(SCHATTR_TEXT_DEGREES, 0); rPoolDefaults[SCHATTR_TEXT_STACKED - SCHATTR_START] = new SfxBoolItem(SCHATTR_TEXT_STACKED,false); //statistic |