diff options
Diffstat (limited to 'chart2/source/controller/dialogs/tp_PolarOptions.cxx')
-rw-r--r-- | chart2/source/controller/dialogs/tp_PolarOptions.cxx | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx index 804c4221247a..cb646e3266be 100644 --- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx +++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx @@ -21,20 +21,21 @@ #include <chartview/ChartSfxItemIds.hxx> #include <svl/eitem.hxx> -#include <svl/intitem.hxx> +#include <svx/sdangitm.hxx> +#include <officecfg/Office/Compatibility.hxx> namespace chart { PolarOptionsTabPage::PolarOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs) - : SfxTabPage(pPage, pController, "modules/schart/ui/tp_PolarOptions.ui", "tp_PolarOptions", &rInAttrs) - , m_xCB_Clockwise(m_xBuilder->weld_check_button("CB_CLOCKWISE")) - , m_xFL_StartingAngle(m_xBuilder->weld_frame("frameANGLE")) - , m_xNF_StartingAngle(m_xBuilder->weld_metric_spin_button("NF_STARTING_ANGLE", FieldUnit::DEGREE)) - , m_xFL_PlotOptions(m_xBuilder->weld_frame("framePLOT_OPTIONS")) - , m_xCB_IncludeHiddenCells(m_xBuilder->weld_check_button("CB_INCLUDE_HIDDEN_CELLS_POLAR")) + : SfxTabPage(pPage, pController, u"modules/schart/ui/tp_PolarOptions.ui"_ustr, u"tp_PolarOptions"_ustr, &rInAttrs) + , m_xCB_Clockwise(m_xBuilder->weld_check_button(u"CB_CLOCKWISE"_ustr)) + , m_xFL_StartingAngle(m_xBuilder->weld_frame(u"frameANGLE"_ustr)) + , m_xNF_StartingAngle(m_xBuilder->weld_metric_spin_button(u"NF_STARTING_ANGLE"_ustr, FieldUnit::DEGREE)) + , m_xFL_PlotOptions(m_xBuilder->weld_frame(u"framePLOT_OPTIONS"_ustr)) + , m_xCB_IncludeHiddenCells(m_xBuilder->weld_check_button(u"CB_INCLUDE_HIDDEN_CELLS_POLAR"_ustr)) , m_xAngleDial(new svx::DialControl) - , m_xAngleDialWin(new weld::CustomWeld(*m_xBuilder, "CT_ANGLE_DIAL", *m_xAngleDial)) + , m_xAngleDialWin(new weld::CustomWeld(*m_xBuilder, u"CT_ANGLE_DIAL"_ustr, *m_xAngleDial)) { m_xAngleDial->SetLinkedField(m_xNF_StartingAngle.get()); } @@ -54,8 +55,7 @@ bool PolarOptionsTabPage::FillItemSet( SfxItemSet* rOutAttrs ) { if (m_xAngleDialWin->get_visible()) { - rOutAttrs->Put(SfxInt32Item(SCHATTR_STARTING_ANGLE, - static_cast< sal_Int32 >(m_xAngleDial->GetRotation()/100))); + rOutAttrs->Put(SdrAngleItem(SCHATTR_STARTING_ANGLE, m_xAngleDial->GetRotation())); } if( m_xCB_Clockwise->get_visible() ) @@ -69,29 +69,30 @@ bool PolarOptionsTabPage::FillItemSet( SfxItemSet* rOutAttrs ) void PolarOptionsTabPage::Reset(const SfxItemSet* rInAttrs) { - const SfxPoolItem *pPoolItem = nullptr; - - if (rInAttrs->GetItemState(SCHATTR_STARTING_ANGLE, true, &pPoolItem) == SfxItemState::SET) + if (const SdrAngleItem* pAngleItem = rInAttrs->GetItemIfSet(SCHATTR_STARTING_ANGLE)) { - long nTmp = static_cast<long>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue()); - m_xAngleDial->SetRotation( nTmp*100 ); + Degree100 nTmp = pAngleItem->GetValue(); + m_xAngleDial->SetRotation( nTmp ); } else { m_xFL_StartingAngle->hide(); } - if (rInAttrs->GetItemState(SCHATTR_CLOCKWISE, true, &pPoolItem) == SfxItemState::SET) + // tdf#108059 Hide clockwise orientation checkbox in OOXML-heavy environments it would be useless anyways + const SfxBoolItem* pClockWiseItem = nullptr; + if (!officecfg::Office::Compatibility::View::ClockwisePieChartDirection::get() && + (pClockWiseItem = rInAttrs->GetItemIfSet(SCHATTR_CLOCKWISE))) { - bool bCheck = static_cast< const SfxBoolItem * >( pPoolItem )->GetValue(); + bool bCheck = pClockWiseItem->GetValue(); m_xCB_Clockwise->set_active(bCheck); } else { m_xCB_Clockwise->hide(); } - if (rInAttrs->GetItemState(SCHATTR_INCLUDE_HIDDEN_CELLS, true, &pPoolItem) == SfxItemState::SET) + if (const SfxBoolItem* pHiddenCellsItem = rInAttrs->GetItemIfSet(SCHATTR_INCLUDE_HIDDEN_CELLS)) { - bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue(); + bool bVal = pHiddenCellsItem->GetValue(); m_xCB_IncludeHiddenCells->set_active(bVal); } else |