diff options
author | Tünde Tóth <tundeth@gmail.com> | 2020-03-02 08:56:11 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-03-05 12:27:04 +0100 |
commit | 9fab1ba8ddc59924c633aa17c65f7330a4762726 (patch) | |
tree | a3c1ad1a03c6970182c7345a41d220a1df726d3a /chart2 | |
parent | d264170ebbc92f8a920cd51d7f6f2744aa465be1 (diff) |
tdf#75330 add a new overlay/no-overlay feature for the legend
Implement "Show the legend without overlapping the chart" option
for chart legend.
Change-Id: Ifbba4c81136e13995d276434dc17a97b0675428c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89810
Tested-by: Jenkins
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/dialogs/res_LegendPosition.cxx | 7 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/tp_LegendPosition.cxx | 11 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/tp_LegendPosition.hxx | 1 | ||||
-rw-r--r-- | chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx | 24 | ||||
-rw-r--r-- | chart2/source/controller/sidebar/ChartElementsPanel.cxx | 69 | ||||
-rw-r--r-- | chart2/source/controller/sidebar/ChartElementsPanel.hxx | 1 | ||||
-rw-r--r-- | chart2/source/inc/chartview/ChartSfxItemIds.hxx | 3 | ||||
-rw-r--r-- | chart2/source/model/main/Legend.cxx | 9 | ||||
-rw-r--r-- | chart2/source/view/main/ChartItemPool.cxx | 1 | ||||
-rw-r--r-- | chart2/source/view/main/VLegend.cxx | 23 | ||||
-rw-r--r-- | chart2/uiconfig/ui/sidebarelements.ui | 110 | ||||
-rw-r--r-- | chart2/uiconfig/ui/tp_LegendPosition.ui | 55 |
12 files changed, 241 insertions, 73 deletions
diff --git a/chart2/source/controller/dialogs/res_LegendPosition.cxx b/chart2/source/controller/dialogs/res_LegendPosition.cxx index 494538ab4ede..50ac0602baef 100644 --- a/chart2/source/controller/dialogs/res_LegendPosition.cxx +++ b/chart2/source/controller/dialogs/res_LegendPosition.cxx @@ -95,16 +95,13 @@ void LegendPositionResources::writeToResources( const uno::Reference< frame::XMo case chart2::LegendPosition_LINE_START: m_xRbtLeft->set_active(true); break; - case chart2::LegendPosition_LINE_END: - m_xRbtRight->set_active(true); - break; case chart2::LegendPosition_PAGE_START: m_xRbtTop->set_active(true); break; case chart2::LegendPosition_PAGE_END: m_xRbtBottom->set_active(true); break; - case chart2::LegendPosition_CUSTOM: + case chart2::LegendPosition_LINE_END: default: m_xRbtRight->set_active(true); break; @@ -207,7 +204,7 @@ void LegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs ) void LegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const { - chart2::LegendPosition nLegendPosition = chart2::LegendPosition_CUSTOM; + chart2::LegendPosition nLegendPosition = chart2::LegendPosition_LINE_END; if( m_xRbtLeft->get_active() ) nLegendPosition = chart2::LegendPosition_LINE_START; else if( m_xRbtTop->get_active() ) diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.cxx b/chart2/source/controller/dialogs/tp_LegendPosition.cxx index 87275ce999ce..04697e75efc9 100644 --- a/chart2/source/controller/dialogs/tp_LegendPosition.cxx +++ b/chart2/source/controller/dialogs/tp_LegendPosition.cxx @@ -20,6 +20,7 @@ #include "tp_LegendPosition.hxx" #include <res_LegendPosition.hxx> #include <TextDirectionListBox.hxx> +#include <chartview/ChartSfxItemIds.hxx> #include <editeng/eeitem.hxx> #include <editeng/frmdiritem.hxx> @@ -30,6 +31,7 @@ SchLegendPosTabPage::SchLegendPosTabPage(weld::Container* pPage, weld::DialogCon : SfxTabPage(pPage, pController, "modules/schart/ui/tp_LegendPosition.ui", "tp_LegendPosition", &rInAttrs) , m_aLegendPositionResources(*m_xBuilder) , m_xLbTextDirection(new TextDirectionListBox(m_xBuilder->weld_combo_box("LB_LEGEND_TEXTDIR"))) + , m_xCBLegendNoOverlay(m_xBuilder->weld_check_button("CB_NO_OVERLAY")) { } @@ -50,6 +52,9 @@ bool SchLegendPosTabPage::FillItemSet(SfxItemSet* rOutAttrs) if (m_xLbTextDirection->get_active() != -1) rOutAttrs->Put(SvxFrameDirectionItem(m_xLbTextDirection->get_active_id(), EE_PARA_WRITINGDIR)); + if (m_xCBLegendNoOverlay->get_visible()) + rOutAttrs->Put(SfxBoolItem(SCHATTR_LEGEND_NO_OVERLAY, m_xCBLegendNoOverlay->get_active())); + return true; } @@ -60,6 +65,12 @@ void SchLegendPosTabPage::Reset(const SfxItemSet* rInAttrs) const SfxPoolItem* pPoolItem = nullptr; if( rInAttrs->GetItemState( EE_PARA_WRITINGDIR, true, &pPoolItem ) == SfxItemState::SET ) m_xLbTextDirection->set_active_id( static_cast<const SvxFrameDirectionItem*>(pPoolItem)->GetValue() ); + + if (rInAttrs->GetItemState(SCHATTR_LEGEND_NO_OVERLAY, true, &pPoolItem) == SfxItemState::SET) + { + bool bVal = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue(); + m_xCBLegendNoOverlay->set_active(bVal); + } } } //namespace chart diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.hxx b/chart2/source/controller/dialogs/tp_LegendPosition.hxx index 178c91ddf717..61e4c8929786 100644 --- a/chart2/source/controller/dialogs/tp_LegendPosition.hxx +++ b/chart2/source/controller/dialogs/tp_LegendPosition.hxx @@ -34,6 +34,7 @@ private: LegendPositionResources m_aLegendPositionResources; std::unique_ptr<TextDirectionListBox> m_xLbTextDirection; + std::unique_ptr<weld::CheckButton> m_xCBLegendNoOverlay; public: SchLegendPosTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs); diff --git a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx index e767b40b15a7..9ae14be68a21 100644 --- a/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx @@ -152,6 +152,23 @@ bool LegendItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSe } } break; + case SCHATTR_LEGEND_NO_OVERLAY: + { + const SfxPoolItem* pPoolItem = nullptr; + if(rInItemSet.GetItemState(SCHATTR_LEGEND_NO_OVERLAY, true, &pPoolItem) == SfxItemState::SET) + { + bool bOverlay = !static_cast<const SfxBoolItem *>(pPoolItem)->GetValue(); + bool bOldOverlay = false; + if(!(GetPropertySet()->getPropertyValue("Overlay") >>= bOldOverlay) || + (bOldOverlay != bOverlay)) + { + GetPropertySet()->setPropertyValue("Overlay", uno::Any(bOverlay)); + bChanged = true; + } + } + + } + break; } return bChanged; @@ -176,6 +193,13 @@ void LegendItemConverter::FillSpecialItem( rOutItemSet.Put( SfxInt32Item(SCHATTR_LEGEND_POS, static_cast<sal_Int32>(eLegendPos) ) ); } break; + case SCHATTR_LEGEND_NO_OVERLAY: + { + bool bOverlay = false; + GetPropertySet()->getPropertyValue("Overlay") >>= bOverlay; + rOutItemSet.Put(SfxBoolItem(SCHATTR_LEGEND_NO_OVERLAY, !bOverlay)); + } + break; } } diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx index 28c86f4a8926..63df9483b8c8 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -105,6 +105,44 @@ void setLegendVisible(const css::uno::Reference<css::frame::XModel>& xModel, boo LegendHelper::hideLegend(*pModel); } +bool isLegendOverlay(const css::uno::Reference<css::frame::XModel>& xModel) +{ + ChartModel* pModel = getChartModel(xModel); + if (!pModel) + return false; + + Reference< beans::XPropertySet > xLegendProp(LegendHelper::getLegend(*pModel), uno::UNO_QUERY); + if( xLegendProp.is()) + { + try + { + bool bOverlay = false; + if(xLegendProp->getPropertyValue("Overlay") >>= bOverlay) + { + return bOverlay; + } + } + catch(const uno::Exception &) + { + } + } + + return false; +} + +void setLegendOverlay(const css::uno::Reference<css::frame::XModel>& xModel, bool bOverlay) +{ + ChartModel* pModel = getChartModel(xModel); + if (!pModel) + return; + + Reference<beans::XPropertySet> xLegendProp(LegendHelper::getLegend(*pModel), uno::UNO_QUERY); + if (!xLegendProp.is()) + return; + + xLegendProp->setPropertyValue("Overlay", css::uno::Any(bOverlay)); +} + bool isTitleVisisble(const css::uno::Reference<css::frame::XModel>& xModel, TitleHelper::eTitleType eTitle) { css::uno::Reference<css::uno::XInterface> xTitle = TitleHelper::getTitle(eTitle, xModel); @@ -197,13 +235,13 @@ sal_Int32 getLegendPos(const css::uno::Reference<css::frame::XModel>& xModel) { ChartModel* pModel = getChartModel(xModel); if (!pModel) - return 4; + return -1; Reference< beans::XPropertySet > xLegendProp( LegendHelper::getLegend(*pModel), uno::UNO_QUERY ); if (!xLegendProp.is()) - return 4; + return -1; - chart2::LegendPosition eLegendPos = chart2::LegendPosition_CUSTOM; + chart2::LegendPosition eLegendPos = chart2::LegendPosition_LINE_END; xLegendProp->getPropertyValue("AnchorPosition") >>= eLegendPos; switch(eLegendPos) { @@ -216,7 +254,7 @@ sal_Int32 getLegendPos(const css::uno::Reference<css::frame::XModel>& xModel) case chart2::LegendPosition_PAGE_END: return 2; default: - return 4; + return -1; } } @@ -230,7 +268,7 @@ void setLegendPos(const css::uno::Reference<css::frame::XModel>& xModel, sal_Int if (!xLegendProp.is()) return; - chart2::LegendPosition eLegendPos = chart2::LegendPosition_CUSTOM; + chart2::LegendPosition eLegendPos = chart2::LegendPosition_LINE_END; css::chart::ChartLegendExpansion eExpansion = css::chart::ChartLegendExpansion_HIGH; switch(nPos) { @@ -248,20 +286,13 @@ void setLegendPos(const css::uno::Reference<css::frame::XModel>& xModel, sal_Int eLegendPos = chart2::LegendPosition_PAGE_END; eExpansion = css::chart::ChartLegendExpansion_WIDE; break; - case 4: - eLegendPos = chart2::LegendPosition_CUSTOM; - break; default: assert(false); } xLegendProp->setPropertyValue("AnchorPosition", css::uno::Any(eLegendPos)); xLegendProp->setPropertyValue("Expansion", css::uno::Any(eExpansion)); - - if (eLegendPos != chart2::LegendPosition_CUSTOM) - { - xLegendProp->setPropertyValue("RelativePosition", uno::Any()); - } + xLegendProp->setPropertyValue("RelativePosition", uno::Any()); } } @@ -283,6 +314,7 @@ ChartElementsPanel::ChartElementsPanel( , mxCB2ndYAxis(m_xBuilder->weld_check_button("checkbutton_2nd_y_axis")) , mxCB2ndYAxisTitle(m_xBuilder->weld_check_button("checkbutton_2nd_y_axis_title")) , mxCBLegend(m_xBuilder->weld_check_button("checkbutton_legend")) + , mxCBLegendNoOverlay(m_xBuilder->weld_check_button("checkbutton_no_overlay")) , mxCBGridVerticalMajor(m_xBuilder->weld_check_button("checkbutton_gridline_vertical_major")) , mxCBGridHorizontalMajor(m_xBuilder->weld_check_button("checkbutton_gridline_horizontal_major")) , mxCBGridVerticalMinor(m_xBuilder->weld_check_button("checkbutton_gridline_vertical_minor")) @@ -326,6 +358,7 @@ void ChartElementsPanel::dispose() mxCB2ndYAxis.reset(); mxCB2ndYAxisTitle.reset(); mxCBLegend.reset(); + mxCBLegendNoOverlay.reset(); mxCBGridVerticalMajor.reset(); mxCBGridHorizontalMajor.reset(); mxCBGridVerticalMinor.reset(); @@ -363,6 +396,7 @@ void ChartElementsPanel::Initialize() mxCB2ndYAxis->connect_toggled(aLink); mxCB2ndYAxisTitle->connect_toggled(aLink); mxCBLegend->connect_toggled(aLink); + mxCBLegendNoOverlay->connect_toggled(aLink); mxCBGridVerticalMajor->connect_toggled(aLink); mxCBGridHorizontalMajor->connect_toggled(aLink); mxCBGridVerticalMinor->connect_toggled(aLink); @@ -410,7 +444,9 @@ void ChartElementsPanel::updateData() SolarMutexGuard aGuard; mxCBLegend->set_active(isLegendVisible(mxModel)); - mxBoxLegend->set_sensitive( isLegendVisible(mxModel) ); + mxCBLegendNoOverlay->set_sensitive(isLegendVisible(mxModel)); + mxCBLegendNoOverlay->set_active(!isLegendOverlay(mxModel)); + mxBoxLegend->set_sensitive(isLegendVisible(mxModel)); mxCBTitle->set_active(isTitleVisisble(mxModel, TitleHelper::MAIN_TITLE)); mxCBSubtitle->set_active(isTitleVisisble(mxModel, TitleHelper::SUB_TITLE)); mxCBXAxisTitle->set_active(isTitleVisisble(mxModel, TitleHelper::X_AXIS_TITLE)); @@ -558,9 +594,12 @@ IMPL_LINK(ChartElementsPanel, CheckBoxHdl, weld::ToggleButton&, rCheckBox, void) setTitleVisible(TitleHelper::SECONDARY_Y_AXIS_TITLE, bChecked); else if (&rCheckBox == mxCBLegend.get()) { - mxBoxLegend->set_sensitive( bChecked ); + mxBoxLegend->set_sensitive(bChecked); + mxCBLegendNoOverlay->set_sensitive(bChecked); setLegendVisible(mxModel, bChecked); } + else if (&rCheckBox == mxCBLegendNoOverlay.get()) + setLegendOverlay(mxModel, !bChecked); else if (&rCheckBox == mxCBGridVerticalMajor.get()) setGridVisible(mxModel, GridType::VERT_MAJOR, bChecked); else if (&rCheckBox == mxCBGridHorizontalMajor.get()) diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx index 9c145f5b078a..9671fc75334e 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx @@ -80,6 +80,7 @@ private: std::unique_ptr<weld::CheckButton> mxCB2ndYAxis; std::unique_ptr<weld::CheckButton> mxCB2ndYAxisTitle; std::unique_ptr<weld::CheckButton> mxCBLegend; + std::unique_ptr<weld::CheckButton> mxCBLegendNoOverlay; std::unique_ptr<weld::CheckButton> mxCBGridVerticalMajor; std::unique_ptr<weld::CheckButton> mxCBGridHorizontalMajor; std::unique_ptr<weld::CheckButton> mxCBGridVerticalMinor; diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx index 8b1e4064639c..82e3f0a535f4 100644 --- a/chart2/source/inc/chartview/ChartSfxItemIds.hxx +++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx @@ -52,7 +52,8 @@ class SvxBrushItem; #define SCHATTR_LEGEND_START (SCHATTR_DATADESCR_END + 1) #define SCHATTR_LEGEND_POS TypedWhichId<SfxInt32Item>(SCHATTR_LEGEND_START) #define SCHATTR_LEGEND_SHOW TypedWhichId<SfxBoolItem>(SCHATTR_LEGEND_START + 1) -#define SCHATTR_LEGEND_END SCHATTR_LEGEND_SHOW +#define SCHATTR_LEGEND_NO_OVERLAY TypedWhichId<SfxBoolItem>(SCHATTR_LEGEND_START + 2) +#define SCHATTR_LEGEND_END SCHATTR_LEGEND_NO_OVERLAY //text #define SCHATTR_TEXT_START (SCHATTR_LEGEND_END + 1) diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx index 6381d232e31d..4c3b9f0e5167 100644 --- a/chart2/source/model/main/Legend.cxx +++ b/chart2/source/model/main/Legend.cxx @@ -53,6 +53,7 @@ enum PROP_LEGEND_ANCHOR_POSITION, PROP_LEGEND_EXPANSION, PROP_LEGEND_SHOW, + PROP_LEGEND_OVERLAY, PROP_LEGEND_REF_PAGE_SIZE, PROP_LEGEND_REL_POS, PROP_LEGEND_REL_SIZE @@ -78,6 +79,13 @@ void lcl_AddPropertiesToVector( cppu::UnoType<bool>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT ); + + rOutProperties.emplace_back( "Overlay", + PROP_LEGEND_OVERLAY, + cppu::UnoType<bool>::get(), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT ); + rOutProperties.emplace_back( "ReferencePageSize", PROP_LEGEND_REF_PAGE_SIZE, cppu::UnoType<awt::Size>::get(), @@ -116,6 +124,7 @@ private: ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_ANCHOR_POSITION, chart2::LegendPosition_LINE_END ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_EXPANSION, css::chart::ChartLegendExpansion_HIGH ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_SHOW, true ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LEGEND_OVERLAY, false ); float fDefaultCharHeight = 10.0; ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight ); diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx index 9b1f66df5bb1..8ca22b635d23 100644 --- a/chart2/source/view/main/ChartItemPool.cxx +++ b/chart2/source/view/main/ChartItemPool.cxx @@ -58,6 +58,7 @@ ChartItemPool::ChartItemPool(): //legend rPoolDefaults[SCHATTR_LEGEND_POS - SCHATTR_START] = new SfxInt32Item(SCHATTR_LEGEND_POS, sal_Int32(css::chart2::LegendPosition_LINE_END) ); rPoolDefaults[SCHATTR_LEGEND_SHOW - SCHATTR_START] = new SfxBoolItem(SCHATTR_LEGEND_SHOW, true); + 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); diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index 54958c11281e..919dc57ddbf3 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -664,10 +664,8 @@ chart2::RelativePosition lcl_getDefaultPosition( LegendPosition ePos, const awt: 0.5, 1.0 - fDistance, drawing::Alignment_BOTTOM ); } break; - - case LegendPosition_CUSTOM: - // to avoid warning case LegendPosition::LegendPosition_MAKE_FIXED_SIZE: + default: // nothing to be set break; } @@ -684,7 +682,8 @@ awt::Point lcl_calculatePositionAndRemainingSpace( const awt::Size & rPageSize, const chart2::RelativePosition& rRelPos, LegendPosition ePos, - const awt::Size& aLegendSize ) + const awt::Size& aLegendSize, + bool bOverlay ) { // calculate position awt::Point aResult( @@ -698,7 +697,7 @@ awt::Point lcl_calculatePositionAndRemainingSpace( // #i109336# Improve auto positioning in chart sal_Int32 nXDistance = lcl_getLegendLeftRightMargin(); sal_Int32 nYDistance = lcl_getLegendTopBottomMargin(); - switch( ePos ) + if (!bOverlay) switch( ePos ) { case LegendPosition_LINE_START: { @@ -899,7 +898,7 @@ void VLegend::createShapes( awt::Size aLegendSize( rAvailableSpace ); bool bCustom = false; - LegendPosition eLegendPosition = LegendPosition_CUSTOM; + LegendPosition eLegendPosition = LegendPosition_LINE_END; if (xLegendProp.is()) { // get Expansion property @@ -1027,16 +1026,18 @@ void VLegend::changePosition( bool bAutoPosition = ! (xLegendProp->getPropertyValue( "RelativePosition") >>= aRelativePosition); - LegendPosition ePos = LegendPosition_CUSTOM; + LegendPosition ePos = LegendPosition_LINE_END; xLegendProp->getPropertyValue( "AnchorPosition") >>= ePos; + bool bOverlay = false; + xLegendProp->getPropertyValue("Overlay") >>= bOverlay; //calculate position if( bAutoPosition ) { // auto position: relative to remaining space aRelativePosition = lcl_getDefaultPosition( ePos, rOutAvailableSpace, rPageSize ); awt::Point aPos = lcl_calculatePositionAndRemainingSpace( - rOutAvailableSpace, rPageSize, aRelativePosition, ePos, aLegendSize ); + rOutAvailableSpace, rPageSize, aRelativePosition, ePos, aLegendSize, bOverlay ); m_xShape->setPosition( aPos ); } else @@ -1044,15 +1045,15 @@ void VLegend::changePosition( // manual position: relative to whole page awt::Rectangle aAvailableSpace( 0, 0, rPageSize.Width, rPageSize.Height ); awt::Point aPos = lcl_calculatePositionAndRemainingSpace( - aAvailableSpace, rPageSize, aRelativePosition, ePos, aLegendSize ); + aAvailableSpace, rPageSize, aRelativePosition, ePos, aLegendSize, bOverlay ); m_xShape->setPosition( aPos ); - if( ePos != LegendPosition_CUSTOM ) + if (!bOverlay) { // calculate remaining space as if having autoposition: aRelativePosition = lcl_getDefaultPosition( ePos, rOutAvailableSpace, rPageSize ); lcl_calculatePositionAndRemainingSpace( - rOutAvailableSpace, rPageSize, aRelativePosition, ePos, aLegendSize ); + rOutAvailableSpace, rPageSize, aRelativePosition, ePos, aLegendSize, bOverlay ); } } } diff --git a/chart2/uiconfig/ui/sidebarelements.ui b/chart2/uiconfig/ui/sidebarelements.ui index 75b25d41ba6d..22b1ff60c87e 100644 --- a/chart2/uiconfig/ui/sidebarelements.ui +++ b/chart2/uiconfig/ui/sidebarelements.ui @@ -94,68 +94,96 @@ <property name="top_padding">6</property> <property name="left_padding">12</property> <child> - <object class="GtkGrid" id="grid5"> + <object class="GtkBox" id="box_legend2"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> <child> - <object class="GtkCheckButton" id="checkbutton_legend"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes" context="sidebarelements|checkbutton_legend|tooltip_text">Show Legend</property> - <property name="margin_right">5</property> - <property name="use_underline">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> - </child> - <child> - <object class="GtkBox" id="box_legend"> + <object class="GtkGrid" id="grid5"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="spacing">6</property> <child> - <object class="GtkLabel" id="placement_label"> + <object class="GtkCheckButton" id="checkbutton_legend"> <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">end</property> - <property name="label" translatable="yes" context="sidebarelements|placement_label">_Placement:</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes" context="sidebarelements|checkbutton_legend|tooltip_text">Show Legend</property> + <property name="margin_right">5</property> <property name="use_underline">True</property> - <property name="ellipsize">end</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> + <property name="left_attach">0</property> + <property name="top_attach">0</property> </packing> </child> <child> - <object class="GtkComboBoxText" id="comboboxtext_legend"> - <property name="width_request">100</property> + <object class="GtkBox" id="box_legend"> <property name="visible">True</property> <property name="can_focus">False</property> - <items> - <item translatable="yes" context="sidebarelements|comboboxtext_legend">Right</item> - <item translatable="yes" context="sidebarelements|comboboxtext_legend">Top</item> - <item translatable="yes" context="sidebarelements|comboboxtext_legend">Bottom</item> - <item translatable="yes" context="sidebarelements|comboboxtext_legend">Left</item> - <item translatable="yes" context="sidebarelements|comboboxtext_legend">Manual</item> - </items> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="placement_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="halign">end</property> + <property name="label" translatable="yes" context="sidebarelements|placement_label">_Placement:</property> + <property name="use_underline">True</property> + <property name="ellipsize">end</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="comboboxtext_legend"> + <property name="width_request">100</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <items> + <item translatable="yes" context="sidebarelements|comboboxtext_legend">Right</item> + <item translatable="yes" context="sidebarelements|comboboxtext_legend">Top</item> + <item translatable="yes" context="sidebarelements|comboboxtext_legend">Bottom</item> + <item translatable="yes" context="sidebarelements|comboboxtext_legend">Left</item> + </items> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> + <property name="left_attach">1</property> + <property name="top_attach">0</property> </packing> </child> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="checkbutton_no_overlay"> + <property name="label" translatable="yes" context="sidebarelements|checkbutton_no_overlay">Show the legend without overlapping the chart</property> + <property name="visible">True</property> + <property name="can_focus">False</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">1</property> </packing> </child> </object> diff --git a/chart2/uiconfig/ui/tp_LegendPosition.ui b/chart2/uiconfig/ui/tp_LegendPosition.ui index 5ea8d662fbf6..993c040962f3 100644 --- a/chart2/uiconfig/ui/tp_LegendPosition.ui +++ b/chart2/uiconfig/ui/tp_LegendPosition.ui @@ -174,5 +174,60 @@ <property name="position">1</property> </packing> </child> + <child> + <object class="GtkFrame" id="frameOVERLAY"> + <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="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkCheckButton" id="CB_NO_OVERLAY"> + <property name="label" translatable="yes" context="tp_LegendPosition|CB_NO_OVERLAY">Show the legend without overlapping the chart</property> + <property name="visible">True</property> + <property name="can_focus">False</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="TXT_OVERLAY"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="tp_LegendPosition|TXT_OVERLAY">Overlay</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> </object> </interface> |