chart2/source/controller/dialogs/res_DataLabel.cxx | 5 chart2/source/controller/dialogs/res_DataLabel.hxx | 2 chart2/source/controller/inc/TextLabelItemConverter.hxx | 2 chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx | 36 ++++++ chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx | 37 ++++++ chart2/source/inc/chartview/ChartSfxItemIds.hxx | 5 chart2/source/view/main/ChartItemPool.cxx | 1 chart2/uiconfig/ui/dlg_DataLabel.ui | 55 ++++++++++ chart2/uiconfig/ui/tp_DataLabel.ui | 55 ++++++++++ 9 files changed, 195 insertions(+), 3 deletions(-)
New commits: commit 28b53da4c49b2dc8550f28b07183fb7c60e1c298 Author: Balazs Varga <balazs.varga...@gmail.com> AuthorDate: Tue Sep 8 10:21:33 2020 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Tue Sep 15 09:57:54 2020 +0200 tdf#133227 chart UI: option to hide leader lines between data points and displaced data labels of a data series. Follow-up of the following commits related to the new UNO property ShowCustomLeaderLines for data labels: commit e2f4e65a7b8024c00b049eebf0d87637efda7f24 (tdf#134571 chart2, xmloff: add loext:custom-leader-lines) commit 5d67d70b26706ce8a08612c12a68821f984210a2 (tdf#134563 Add UNO API for custom leader lines) Change-Id: Id8a953b16ff737ca924c0c2c3241fba4e3ac904b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102221 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx index 35f96f775e01..62568fc71296 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.cxx +++ b/chart2/source/controller/dialogs/res_DataLabel.cxx @@ -111,6 +111,7 @@ DataLabelResources::DataLabelResources(weld::Builder* pBuilder, weld::Window* pP , m_xLB_TextDirection(new TextDirectionListBox(pBuilder->weld_combo_box("LB_LABEL_TEXTDIR"))) , m_xDC_Dial(new svx::DialControl) , m_xDC_DialWin(new weld::CustomWeld(*pBuilder, "CT_DIAL", *m_xDC_Dial)) + , m_xCBCustomLeaderLines(pBuilder->weld_check_button("CB_CUSTOM_LEADER_LINES")) { m_xDC_Dial->SetText(m_xFT_Dial->get_label()); @@ -143,6 +144,7 @@ DataLabelResources::DataLabelResources(weld::Builder* pBuilder, weld::Window* pP m_xCBCategory->connect_toggled( LINK( this, DataLabelResources, CheckHdl )); m_xCBSymbol->connect_toggled( LINK( this, DataLabelResources, CheckHdl )); m_xCBWrapText->connect_toggled( LINK( this, DataLabelResources, CheckHdl )); + m_xCBCustomLeaderLines->connect_toggled( LINK( this, DataLabelResources, CheckHdl )); m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState ); m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState); @@ -280,6 +282,8 @@ void DataLabelResources::FillItemSet( SfxItemSet* rOutAttrs ) const rOutAttrs->Put( SfxBoolItem( SCHATTR_DATADESCR_SHOW_SYMBOL, m_xCBSymbol->get_active()) ); if( m_xCBWrapText->get_state()!= TRISTATE_INDET ) rOutAttrs->Put( SfxBoolItem( SCHATTR_DATADESCR_WRAP_TEXT, m_xCBWrapText->get_active()) ); + if( m_xCBCustomLeaderLines->get_state() != TRISTATE_INDET ) + rOutAttrs->Put(SfxBoolItem( SCHATTR_DATADESCR_CUSTOM_LEADER_LINES, m_xCBCustomLeaderLines->get_active()) ); auto const aSep = our_aLBEntryMap[m_xLB_Separator->get_active()]; rOutAttrs->Put( SfxStringItem( SCHATTR_DATADESCR_SEPARATOR, aSep) ); @@ -311,6 +315,7 @@ void DataLabelResources::Reset(const SfxItemSet& rInAttrs) lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_CATEGORY, *m_xCBCategory ); lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_SHOW_SYMBOL, *m_xCBSymbol ); lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_WRAP_TEXT, *m_xCBWrapText ); + lcl_setBoolItemToCheckBox( rInAttrs, SCHATTR_DATADESCR_CUSTOM_LEADER_LINES, *m_xCBCustomLeaderLines ); m_bNumberFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_SOURCE, m_nNumberFormatForValue, m_bSourceFormatForValue, m_bSourceFormatMixedState ); m_bPercentFormatMixedState = !lcl_ReadNumberFormatFromItemSet( rInAttrs, SCHATTR_PERCENT_NUMBERFORMAT_VALUE, SCHATTR_PERCENT_NUMBERFORMAT_SOURCE, m_nNumberFormatForPercent, m_bSourceFormatForPercent , m_bPercentSourceMixedState); diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx index f926d45c0d42..5358c0345495 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.hxx +++ b/chart2/source/controller/dialogs/res_DataLabel.hxx @@ -83,6 +83,8 @@ private: std::unique_ptr<svx::DialControl> m_xDC_Dial; std::unique_ptr<weld::CustomWeld> m_xDC_DialWin; + std::unique_ptr<weld::CheckButton> m_xCBCustomLeaderLines; + DECL_LINK(NumberFormatDialogHdl, weld::Button&, void ); DECL_LINK(CheckHdl, weld::ToggleButton&, void ); void EnableControls(); diff --git a/chart2/source/controller/inc/TextLabelItemConverter.hxx b/chart2/source/controller/inc/TextLabelItemConverter.hxx index 0f5cfb0175d1..ebe1b3961d89 100644 --- a/chart2/source/controller/inc/TextLabelItemConverter.hxx +++ b/chart2/source/controller/inc/TextLabelItemConverter.hxx @@ -63,6 +63,8 @@ private: bool mbDataSeries:1; bool mbForbidPercentValue:1; + + css::uno::Reference<css::chart2::XDataSeries> m_xSeries; }; } diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx index 4920d2b727e0..6328a222b622 100644 --- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx @@ -581,6 +581,26 @@ bool DataPointItemConverter::ApplySpecialItem( } } break; + + case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES: + { + try + { + 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 ) + { + xSeriesProp->setPropertyValue("ShowCustomLeaderLines", uno::Any(bNew)); + bChanged = true; + } + } + catch (const uno::Exception&) + { + TOOLS_WARN_EXCEPTION("chart2", ""); + } + } + break; } return bChanged; @@ -728,6 +748,22 @@ void DataPointItemConverter::FillSpecialItem( } break; + case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES: + { + try + { + bool bValue = true; + Reference<beans::XPropertySet> xSeriesProp(m_xSeries, uno::UNO_QUERY); + if( xSeriesProp->getPropertyValue( "ShowCustomLeaderLines" ) >>= bValue ) + rOutItemSet.Put(SfxBoolItem(nWhichId, bValue)); + } + catch (const uno::Exception&) + { + TOOLS_WARN_EXCEPTION("chart2", ""); + } + } + break; + case SCHATTR_STYLE_SYMBOL: { chart2::Symbol aSymbol; diff --git a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx index 496b25e2692f..bdeffbf6cf3c 100644 --- a/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TextLabelItemConverter.cxx @@ -201,7 +201,8 @@ TextLabelItemConverter::TextLabelItemConverter( mnNumberFormat(nNumberFormat), mnPercentNumberFormat(nPercentNumberFormat), mbDataSeries(bDataSeries), - mbForbidPercentValue(true) + mbForbidPercentValue(true), + m_xSeries(xSeries) { maConverters.emplace_back(new CharacterPropertyItemConverter(rPropertySet, rItemPool, pRefSize, "ReferencePageSize")); @@ -498,6 +499,25 @@ bool TextLabelItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxIte } } break; + case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES: + { + try + { + 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 ) + { + xSeriesProp->setPropertyValue("ShowCustomLeaderLines", uno::Any(bNew)); + bChanged = true; + } + } + catch (const uno::Exception&) + { + TOOLS_WARN_EXCEPTION("chart2", ""); + } + } + break; } return bChanged; @@ -635,6 +655,21 @@ void TextLabelItemConverter::FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet& r rOutItemSet.Put(SfxBoolItem(nWhichId, mbForbidPercentValue)); } break; + case SCHATTR_DATADESCR_CUSTOM_LEADER_LINES: + { + try + { + bool bValue = true; + Reference<beans::XPropertySet> xSeriesProp(m_xSeries, uno::UNO_QUERY); + if( xSeriesProp->getPropertyValue( "ShowCustomLeaderLines" ) >>= bValue ) + rOutItemSet.Put(SfxBoolItem(nWhichId, bValue)); + } + catch (const uno::Exception&) + { + TOOLS_WARN_EXCEPTION("chart2", ""); + } + } + break; case SCHATTR_STYLE_SYMBOL: { chart2::Symbol aSymbol; diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx index ac3e91fa187d..9d0e4f9aa896 100644 --- a/chart2/source/inc/chartview/ChartSfxItemIds.hxx +++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx @@ -48,8 +48,9 @@ constexpr TypedWhichId<SfxStringItem> SCHATTR_DATADESCR_SEPARATOR constexpr TypedWhichId<SfxInt32Item> SCHATTR_DATADESCR_PLACEMENT (SCHATTR_DATADESCR_START + 6); constexpr TypedWhichId<SfxIntegerListItem> SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS (SCHATTR_DATADESCR_START + 7); constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_NO_PERCENTVALUE (SCHATTR_DATADESCR_START + 8); //percentage values should not be offered -constexpr TypedWhichId<SfxUInt32Item> SCHATTR_PERCENT_NUMBERFORMAT_VALUE (SCHATTR_DATADESCR_START + 9); -constexpr TypedWhichId<SfxBoolItem> SCHATTR_PERCENT_NUMBERFORMAT_SOURCE (SCHATTR_DATADESCR_START + 10); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_CUSTOM_LEADER_LINES (SCHATTR_DATADESCR_START + 9); +constexpr TypedWhichId<SfxUInt32Item> SCHATTR_PERCENT_NUMBERFORMAT_VALUE (SCHATTR_DATADESCR_START + 10); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_PERCENT_NUMBERFORMAT_SOURCE (SCHATTR_DATADESCR_START + 11); constexpr sal_uInt16 SCHATTR_DATADESCR_END (SCHATTR_PERCENT_NUMBERFORMAT_SOURCE); //legend diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx index 7e428942f0db..4275ebd09b94 100644 --- a/chart2/source/view/main/ChartItemPool.cxx +++ b/chart2/source/view/main/ChartItemPool.cxx @@ -52,6 +52,7 @@ ChartItemPool::ChartItemPool(): rPoolDefaults[SCHATTR_DATADESCR_PLACEMENT - SCHATTR_START] = new SfxInt32Item(SCHATTR_DATADESCR_PLACEMENT,0); rPoolDefaults[SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS - SCHATTR_START] = new SfxIntegerListItem(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, std::vector < sal_Int32 >() ); rPoolDefaults[SCHATTR_DATADESCR_NO_PERCENTVALUE - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_NO_PERCENTVALUE); + rPoolDefaults[SCHATTR_DATADESCR_CUSTOM_LEADER_LINES - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_CUSTOM_LEADER_LINES, true); rPoolDefaults[SCHATTR_PERCENT_NUMBERFORMAT_VALUE - SCHATTR_START] = new SfxUInt32Item(SCHATTR_PERCENT_NUMBERFORMAT_VALUE, 0); rPoolDefaults[SCHATTR_PERCENT_NUMBERFORMAT_SOURCE - SCHATTR_START] = new SfxBoolItem(SCHATTR_PERCENT_NUMBERFORMAT_SOURCE); diff --git a/chart2/uiconfig/ui/dlg_DataLabel.ui b/chart2/uiconfig/ui/dlg_DataLabel.ui index 4d40f5070a21..4cb5649d018f 100644 --- a/chart2/uiconfig/ui/dlg_DataLabel.ui +++ b/chart2/uiconfig/ui/dlg_DataLabel.ui @@ -537,6 +537,61 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkFrame" id="frame3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkCheckButton" id="CB_CUSTOM_LEADER_LINES"> + <property name="label" translatable="yes" context="dlg_DataLabel|CB_CUSTOM_LEADER_LINES">_Connect displaced data labels to data points</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="dlg_DataLabel|label3">Leader Lines</property> + <property name="xalign">0</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> <child internal-child="accessible"> <object class="AtkObject" id="tp_DataLabel-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="dlg_DataLabel|extended_tip|tp_DataLabel">Opens the Data Labels dialog, which enables you to set the data labels.</property> diff --git a/chart2/uiconfig/ui/tp_DataLabel.ui b/chart2/uiconfig/ui/tp_DataLabel.ui index 72c86c90b69a..0dc2bf8559b2 100644 --- a/chart2/uiconfig/ui/tp_DataLabel.ui +++ b/chart2/uiconfig/ui/tp_DataLabel.ui @@ -469,6 +469,61 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkFrame" id="frame3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkCheckButton" id="CB_CUSTOM_LEADER_LINES"> + <property name="label" translatable="yes" context="tp_DataLabel|CB_CUSTOM_LEADER_LINES">_Connect displaced data labels to data points</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="tp_DataLabel|label3">Leader Lines</property> + <property name="xalign">0</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> <child internal-child="accessible"> <object class="AtkObject" id="tp_DataLabel-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="tp_DataLabel|extended_tip|tp_DataLabel">Opens the Data Labels dialog, which enables you to set the data labels.</property> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits