summaryrefslogtreecommitdiff
path: root/chart2/source/controller
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2020-12-22 15:42:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-01-02 15:26:38 +0100
commit11e52fe2979b0947814a49b9c17ec373795cbf8e (patch)
tree48268579f052b7fdfcc2c334fffe8c91d29cb234 /chart2/source/controller
parent610ceb05025c9c7a9a34dddcb0dac506b8eab441 (diff)
introduce Degree100 strong_int type
Change-Id: I78f837a1340be0ca5c49097f543a481b7b43a632 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108367 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/controller')
-rw-r--r--chart2/source/controller/dialogs/res_DataLabel.cxx6
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.cxx4
-rw-r--r--chart2/source/controller/dialogs/tp_AxisLabel.hxx3
-rw-r--r--chart2/source/controller/dialogs/tp_PolarOptions.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_TitleRotation.cxx4
-rw-r--r--chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx6
-rw-r--r--chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx6
-rw-r--r--chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx4
-rw-r--r--chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx4
-rw-r--r--chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx6
-rw-r--r--chart2/source/controller/main/DrawCommandDispatch.cxx2
11 files changed, 24 insertions, 23 deletions
diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx
index c8dee6c1b750..7934e90871dc 100644
--- a/chart2/source/controller/dialogs/res_DataLabel.cxx
+++ b/chart2/source/controller/dialogs/res_DataLabel.cxx
@@ -305,7 +305,7 @@ void DataLabelResources::FillItemSet( SfxItemSet* rOutAttrs ) const
if( m_xDC_Dial->IsVisible() )
{
- sal_Int32 nDegrees = m_xDC_Dial->GetRotation();
+ Degree100 nDegrees = m_xDC_Dial->GetRotation();
rOutAttrs->Put(SdrAngleItem( SCHATTR_TEXT_DEGREES, nDegrees ) );
}
}
@@ -355,11 +355,11 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs)
if( rInAttrs.GetItemState( SCHATTR_TEXT_DEGREES, true, &pPoolItem ) == SfxItemState::SET )
{
- sal_Int32 nDegrees = static_cast< const SdrAngleItem * >( pPoolItem )->GetValue();
+ Degree100 nDegrees = static_cast< const SdrAngleItem * >( pPoolItem )->GetValue();
m_xDC_Dial->SetRotation( nDegrees );
}
else
- m_xDC_Dial->SetRotation( 0 );
+ m_xDC_Dial->SetRotation( 0_deg100 );
EnableControls();
}
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.cxx b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
index afe98676545d..de028152e386 100644
--- a/chart2/source/controller/dialogs/tp_AxisLabel.cxx
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.cxx
@@ -93,7 +93,7 @@ bool SchAxisLabelTabPage::FillItemSet( SfxItemSet* rOutAttrs )
if( m_xCtrlDial->HasRotation() )
{
- sal_Int32 nDegrees = bStacked ? 0 : m_xCtrlDial->GetRotation();
+ Degree100 nDegrees = bStacked ? 0_deg100 : m_xCtrlDial->GetRotation();
if( !m_bHasInitialDegrees || (nDegrees != m_nInitialDegrees) )
rOutAttrs->Put( SdrAngleItem( SCHATTR_TEXT_DEGREES, nDegrees ) );
}
@@ -155,7 +155,7 @@ void SchAxisLabelTabPage::Reset( const SfxItemSet* rInAttrs )
// Rotation as orient item or in degrees ----------
// check new degree item
- m_nInitialDegrees = 0;
+ m_nInitialDegrees = 0_deg100;
aState = rInAttrs->GetItemState( SCHATTR_TEXT_DEGREES, false, &pPoolItem );
if( aState == SfxItemState::SET )
m_nInitialDegrees = static_cast< const SdrAngleItem * >( pPoolItem )->GetValue();
diff --git a/chart2/source/controller/dialogs/tp_AxisLabel.hxx b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
index 370eda70d6b0..0923c91118d5 100644
--- a/chart2/source/controller/dialogs/tp_AxisLabel.hxx
+++ b/chart2/source/controller/dialogs/tp_AxisLabel.hxx
@@ -20,6 +20,7 @@
#include <sfx2/tabdlg.hxx>
#include <svx/dialcontrol.hxx>
+#include <tools/degree.hxx>
namespace chart { class TextDirectionListBox; }
namespace weld {
@@ -39,7 +40,7 @@ class SchAxisLabelTabPage : public SfxTabPage
private:
bool m_bShowStaggeringControls;
- sal_Int32 m_nInitialDegrees;
+ Degree100 m_nInitialDegrees;
bool m_bHasInitialDegrees; /// false = DialControl in tristate
bool m_bInitialStacking;
bool m_bHasInitialStacking; /// false = checkbox in tristate
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
index 865736b3b66d..59422b3a613e 100644
--- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx
+++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx
@@ -74,7 +74,7 @@ void PolarOptionsTabPage::Reset(const SfxItemSet* rInAttrs)
if (rInAttrs->GetItemState(SCHATTR_STARTING_ANGLE, true, &pPoolItem) == SfxItemState::SET)
{
- sal_Int32 nTmp = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
+ Degree100 nTmp = static_cast<const SdrAngleItem*>(pPoolItem)->GetValue();
m_xAngleDial->SetRotation( nTmp );
}
else
diff --git a/chart2/source/controller/dialogs/tp_TitleRotation.cxx b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
index d2e1e02ab679..ede27edbac9d 100644
--- a/chart2/source/controller/dialogs/tp_TitleRotation.cxx
+++ b/chart2/source/controller/dialogs/tp_TitleRotation.cxx
@@ -94,7 +94,7 @@ bool SchAlignmentTabPage::FillItemSet(SfxItemSet* rOutAttrs)
bool bStacked = m_xCbStacked->get_active();
rOutAttrs->Put( SfxBoolItem( SCHATTR_TEXT_STACKED, bStacked ) );
- sal_Int32 nDegrees = bStacked ? 0 : m_xCtrlDial->GetRotation();
+ Degree100 nDegrees = bStacked ? 0_deg100 : m_xCtrlDial->GetRotation();
rOutAttrs->Put( SdrAngleItem( SCHATTR_TEXT_DEGREES, nDegrees ) );
SvxFrameDirection aDirection( m_xLbTextDirection->get_active_id() );
@@ -107,7 +107,7 @@ void SchAlignmentTabPage::Reset(const SfxItemSet* rInAttrs)
{
const SfxPoolItem* pItem = GetItem( *rInAttrs, SCHATTR_TEXT_DEGREES );
- sal_Int32 nDegrees = pItem ? static_cast<const SdrAngleItem*>(pItem)->GetValue() : 0;
+ Degree100 nDegrees = pItem ? static_cast<const SdrAngleItem*>(pItem)->GetValue() : 0_deg100;
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 7c31c9693ab7..297b3de704ee 100644
--- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx
@@ -392,8 +392,8 @@ void AxisItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutI
if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fVal )
{
- rOutItemSet.Put( SdrAngleItem( nWhichId, static_cast< sal_Int32 >(
- ::rtl::math::round( fVal * 100.0 ) ) ));
+ rOutItemSet.Put( SdrAngleItem( nWhichId, Degree100(static_cast< sal_Int32 >(
+ ::rtl::math::round( fVal * 100.0 )) ) ));
}
}
break;
@@ -881,7 +881,7 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet
// convert int to double (divided by 100)
double fVal = static_cast< double >(
static_cast< const SdrAngleItem & >(
- rItemSet.Get( nWhichId )).GetValue()) / 100.0;
+ rItemSet.Get( nWhichId )).GetValue().get()) / 100.0;
double fOldVal = 0.0;
bool bPropExisted =
( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldVal );
diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
index 97f66d4c8431..7693c6ccfa37 100644
--- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx
@@ -550,7 +550,7 @@ bool DataPointItemConverter::ApplySpecialItem(
{
double fValue = static_cast< double >(
static_cast< const SdrAngleItem & >(
- rItemSet.Get( nWhichId )).GetValue()) / 100.0;
+ rItemSet.Get( nWhichId )).GetValue().get()) / 100.0;
double fOldValue = 0.0;
bool bPropExisted =
( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldValue );
@@ -800,8 +800,8 @@ void DataPointItemConverter::FillSpecialItem(
if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fValue )
{
- rOutItemSet.Put( SdrAngleItem( nWhichId, static_cast< sal_Int32 >(
- ::rtl::math::round( fValue * 100.0 ) ) ));
+ rOutItemSet.Put( SdrAngleItem( nWhichId, Degree100(static_cast< sal_Int32 >(
+ ::rtl::math::round( fValue * 100.0 ) ) )));
}
}
break;
diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
index 3c8fbcca9990..fc25407d1a58 100644
--- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
@@ -277,7 +277,7 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
{
if( m_bSupportingStartingAngle )
{
- m_nStartingAngle = static_cast< const SdrAngleItem & >( rItemSet.Get( nWhichId )).GetValue() / 100;
+ m_nStartingAngle = static_cast< const SdrAngleItem & >( rItemSet.Get( nWhichId )).GetValue().get() / 100;
uno::Reference< beans::XPropertySet > xDiagramProperties( ChartModelHelper::findDiagram(m_xChartModel), uno::UNO_QUERY );
if( xDiagramProperties.is() )
{
@@ -399,7 +399,7 @@ void SeriesOptionsItemConverter::FillSpecialItem(
case SCHATTR_STARTING_ANGLE:
{
if( m_bSupportingStartingAngle )
- rOutItemSet.Put( SdrAngleItem(nWhichId,m_nStartingAngle*100));
+ rOutItemSet.Put( SdrAngleItem(nWhichId, Degree100(m_nStartingAngle*100)) );
break;
}
case SCHATTR_CLOCKWISE:
diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
index dad6ba3b30ef..adc0b849414b 100644
--- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx
@@ -489,7 +489,7 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte
{
double fValue = static_cast<double>(
static_cast<const SdrAngleItem&>(
- rItemSet.Get(nWhichId)).GetValue()) / 100.0;
+ rItemSet.Get(nWhichId)).GetValue().get()) / 100.0;
double fOldValue = 0.0;
bool bPropExisted =
(GetPropertySet()->getPropertyValue("TextRotation") >>= fOldValue);
@@ -705,7 +705,7 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r
if (GetPropertySet()->getPropertyValue("TextRotation") >>= fValue)
{
rOutItemSet.Put(
- SdrAngleItem(nWhichId, static_cast<sal_Int32>(rtl::math::round(fValue * 100.0))));
+ SdrAngleItem(nWhichId, Degree100(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 6ca38785fb56..9109bc3ea3a1 100644
--- a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx
@@ -169,7 +169,7 @@ bool TitleItemConverter::ApplySpecialItem(
// convert int to double (divided by 100)
double fVal = static_cast< double >(
static_cast< const SdrAngleItem & >(
- rItemSet.Get( nWhichId )).GetValue()) / 100.0;
+ rItemSet.Get( nWhichId )).GetValue().get()) / 100.0;
double fOldVal = 0.0;
bool bPropExisted =
( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fOldVal );
@@ -198,8 +198,8 @@ void TitleItemConverter::FillSpecialItem(
if( GetPropertySet()->getPropertyValue( "TextRotation" ) >>= fVal )
{
- rOutItemSet.Put( SdrAngleItem( nWhichId, static_cast< sal_Int32 >(
- ::rtl::math::round( fVal * 100.0 ) ) ));
+ rOutItemSet.Put( SdrAngleItem( nWhichId, Degree100(static_cast< sal_Int32 >(
+ ::rtl::math::round( fVal * 100.0 ) ) )));
}
}
break;
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx
index 53ed1cfc7a32..ef0bdfd5af5b 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.cxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.cxx
@@ -142,7 +142,7 @@ void DrawCommandDispatch::setAttributes( SdrObject* pObj )
EE_ITEMS_START, EE_ITEMS_END>{});
aDest.Set( rSource );
pObj->SetMergedItemSet( aDest );
- sal_Int32 nAngle = pSourceObj->GetRotateAngle();
+ Degree100 nAngle = pSourceObj->GetRotateAngle();
if ( nAngle )
pObj->NbcRotate( pObj->GetSnapRect().Center(), nAngle );
bAttributesAppliedFromGallery = true;