tdf#157882 svx: Remove cap/corner styles and move arrowhead control to new row

Change-Id: Ifa38ec7ba9969627ff26abe22c58d06ec373ecb1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162403
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
This commit is contained in:
AkshayWarrier 2024-01-22 20:31:16 +05:30 committed by Hossein
parent d04f64c068
commit 8cd4cd31e9
7 changed files with 29 additions and 372 deletions

View file

@ -232,23 +232,6 @@ void ChartLinePanel::updateModel(css::uno::Reference<css::frame::XModel> xModel)
doUpdateModel(pModel);
}
void ChartLinePanel::setLineJoint(const XLineJointItem* pItem)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
getPropSet(mxModel);
if (!xPropSet.is())
return;
PreventUpdate aPreventUpdate(mbUpdate);
if (pItem)
xPropSet->setPropertyValue("LineJoint", css::uno::Any(pItem->GetValue()));
}
void ChartLinePanel::setLineCap(const XLineCapItem* /*pItem*/)
{
}
void ChartLinePanel::setLineTransparency(const XLineTransparenceItem& rItem)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =

View file

@ -16,10 +16,8 @@
#include "ChartSidebarSelectionListener.hxx"
#include "ChartColorWrapper.hxx"
class XLineCapItem;
class XLineDashItem;
class XLineEndItem;
class XLineJointItem;
class XLineStartItem;
class XLineStyleItem;
class XLineTransparenceItem;
@ -62,8 +60,6 @@ public:
protected:
virtual void setLineTransparency(const XLineTransparenceItem& rItem) override;
virtual void setLineJoint(const XLineJointItem* pItem) override;
virtual void setLineCap(const XLineCapItem* pItem) override;
virtual void updateLineWidth(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem) override;

View file

@ -34,8 +34,6 @@ class XLineStartItem;
class XLineWidthItem;
class XLineEndItem;
class XLineEndList;
class XLineJointItem;
class XLineCapItem;
class XLineTransparenceItem;
class XDashList;
@ -73,13 +71,9 @@ protected:
void ActivateControls();
virtual void setLineTransparency(const XLineTransparenceItem& rItem) = 0;
virtual void setLineJoint(const XLineJointItem* pItem) = 0;
virtual void setLineCap(const XLineCapItem* pItem) = 0;
void updateLineTransparence(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
virtual void updateLineWidth(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
void updateLineJoint(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
void updateLineCap(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
void setMapUnit(MapUnit eMapUnit);
@ -101,12 +95,9 @@ private:
std::unique_ptr<weld::Toolbar> mxTBWidth;
std::unique_ptr<weld::Label> mxFTTransparency;
std::unique_ptr<weld::MetricSpinButton> mxMFTransparent;
std::unique_ptr<weld::Label> mxFTEdgeStyle;
std::unique_ptr<weld::ComboBox> mxLBEdgeStyle;
std::unique_ptr<weld::Label> mxFTCapStyle;
std::unique_ptr<weld::ComboBox> mxLBCapStyle;
std::unique_ptr<weld::Widget> mxGridLineProps;
std::unique_ptr<weld::Widget> mxBoxArrowProps;
std::unique_ptr<weld::Label> mxArrowHeadStyleFT;
std::unique_ptr<weld::Toolbar> mxArrowHeadStyleTB;
std::unique_ptr<ToolbarUnoDispatcher> mxArrowHeadStyleDispatch;
//popup windows
std::unique_ptr<LineWidthPopup> mxLineWidthPopup;
@ -129,8 +120,6 @@ private:
DECL_DLLPRIVATE_LINK(ToolboxWidthSelectHdl, const OUString&, void);
DECL_DLLPRIVATE_LINK(ChangeTransparentHdl, weld::MetricSpinButton&, void);
DECL_DLLPRIVATE_LINK(ChangeEdgeStyleHdl, weld::ComboBox&, void);
DECL_DLLPRIVATE_LINK(ChangeCapStyleHdl, weld::ComboBox&, void);
};
} // end of namespace svx::sidebar

View file

@ -42,8 +42,6 @@ LinePropertyPanel::LinePropertyPanel(
maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this),
maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this),
maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this),
maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this),
maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this),
mpBindings(pBindings)
{
setMapUnit(maWidthControl.GetCoreMetric());
@ -55,8 +53,6 @@ LinePropertyPanel::~LinePropertyPanel()
maDashControl.dispose();
maWidthControl.dispose();
maTransControl.dispose();
maEdgeStyle.dispose();
maCapStyle.dispose();
}
std::unique_ptr<PanelLayout> LinePropertyPanel::Create (
@ -94,16 +90,6 @@ void LinePropertyPanel::NotifyItemUpdate(
updateLineWidth(bDisabled, bSetOrDefault, pState);
break;
}
case SID_ATTR_LINE_JOINT:
{
updateLineJoint(bDisabled, bSetOrDefault, pState);
break;
}
case SID_ATTR_LINE_CAP:
{
updateLineCap(bDisabled, bSetOrDefault, pState);
break;
}
}
ActivateControls();
}
@ -137,18 +123,6 @@ void LinePropertyPanel::HandleContextChange(
enableArrowHead();
}
void LinePropertyPanel::setLineJoint(const XLineJointItem* pItem)
{
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_LINE_JOINT,
SfxCallMode::RECORD, { pItem });
}
void LinePropertyPanel::setLineCap(const XLineCapItem* pItem)
{
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_LINE_CAP,
SfxCallMode::RECORD, { pItem });
}
void LinePropertyPanel::setLineTransparency(const XLineTransparenceItem& rItem)
{
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_LINE_STYLE,

View file

@ -73,8 +73,6 @@ public:
protected:
virtual void setLineTransparency(const XLineTransparenceItem& rItem) override;
virtual void setLineJoint(const XLineJointItem* pItem) override;
virtual void setLineCap(const XLineCapItem* pItem) override;
private:
//ControllerItem
@ -82,8 +80,6 @@ private:
sfx2::sidebar::ControllerItem maDashControl;
sfx2::sidebar::ControllerItem maWidthControl;
sfx2::sidebar::ControllerItem maTransControl;
sfx2::sidebar::ControllerItem maEdgeStyle;
sfx2::sidebar::ControllerItem maCapStyle;
SfxBindings* mpBindings;
vcl::EnumContext maContext;

View file

@ -77,12 +77,9 @@ LinePropertyPanelBase::LinePropertyPanelBase(
mxTBWidth(m_xBuilder->weld_toolbar("width")),
mxFTTransparency(m_xBuilder->weld_label("translabel")),
mxMFTransparent(m_xBuilder->weld_metric_spin_button("linetransparency", FieldUnit::PERCENT)),
mxFTEdgeStyle(m_xBuilder->weld_label("cornerlabel")),
mxLBEdgeStyle(m_xBuilder->weld_combo_box("edgestyle")),
mxFTCapStyle(m_xBuilder->weld_label("caplabel")),
mxLBCapStyle(m_xBuilder->weld_combo_box("linecapstyle")),
mxGridLineProps(m_xBuilder->weld_widget("lineproperties")),
mxBoxArrowProps(m_xBuilder->weld_widget("arrowproperties")),
mxArrowHeadStyleFT(m_xBuilder->weld_label("arrowlabel")),
mxArrowHeadStyleTB(m_xBuilder->weld_toolbar("arrowheadstyle")),
mxArrowHeadStyleDispatch(new ToolbarUnoDispatcher(*mxArrowHeadStyleTB, *m_xBuilder, rxFrame)),
mxLineWidthPopup(new LineWidthPopup(mxTBWidth.get(), *this)),
mxLineStyleNoneChange(new LineStyleNoneChange(*this)),
mnTrans(0),
@ -106,12 +103,8 @@ LinePropertyPanelBase::~LinePropertyPanelBase()
mxMFTransparent.reset();
mxLineStyleDispatch.reset();
mxLineStyleTB.reset();
mxFTEdgeStyle.reset();
mxLBEdgeStyle.reset();
mxFTCapStyle.reset();
mxLBCapStyle.reset();
mxGridLineProps.reset();
mxBoxArrowProps.reset();
mxArrowHeadStyleTB.reset();
mxArrowHeadStyleFT.reset();
}
void LinePropertyPanelBase::Initialize()
@ -133,10 +126,6 @@ void LinePropertyPanelBase::Initialize()
mxMFTransparent->connect_value_changed(LINK(this, LinePropertyPanelBase, ChangeTransparentHdl));
mxLBEdgeStyle->connect_changed( LINK( this, LinePropertyPanelBase, ChangeEdgeStyleHdl ) );
mxLBCapStyle->connect_changed( LINK( this, LinePropertyPanelBase, ChangeCapStyleHdl ) );
SvxLineStyleToolBoxControl* pLineStyleControl = getLineStyleToolBoxControl(*mxLineStyleDispatch);
pLineStyleControl->setLineStyleIsNoneFunction(*mxLineStyleNoneChange);
}
@ -198,177 +187,6 @@ void LinePropertyPanelBase::updateLineWidth(bool bDisabled, bool bSetOrDefault,
SetWidthIcon();
}
void LinePropertyPanelBase::updateLineJoint(bool bDisabled, bool bSetOrDefault,
const SfxPoolItem* pState)
{
if(bDisabled)
{
mxLBEdgeStyle->set_sensitive(false);
mxFTEdgeStyle->set_sensitive(false);
}
else
{
mxLBEdgeStyle->set_sensitive(true);
mxFTEdgeStyle->set_sensitive(true);
}
if(bSetOrDefault)
{
if (const XLineJointItem* pItem = dynamic_cast<const XLineJointItem*>(pState))
{
sal_Int32 nEntryPos(0);
switch(pItem->GetValue())
{
case drawing::LineJoint_ROUND:
{
nEntryPos = 1;
break;
}
case drawing::LineJoint_NONE:
{
nEntryPos = 2;
break;
}
case drawing::LineJoint_MIDDLE:
case drawing::LineJoint_MITER:
{
nEntryPos = 3;
break;
}
case drawing::LineJoint_BEVEL:
{
nEntryPos = 4;
break;
}
default:
break;
}
if(nEntryPos)
{
mxLBEdgeStyle->set_active(nEntryPos - 1);
return;
}
}
}
mxLBEdgeStyle->set_active(-1);
}
void LinePropertyPanelBase::updateLineCap(bool bDisabled, bool bSetOrDefault,
const SfxPoolItem* pState)
{
mxLBCapStyle->set_sensitive(!bDisabled);
mxFTCapStyle->set_sensitive(!bDisabled);
if(bSetOrDefault)
{
if (const XLineCapItem* pItem = dynamic_cast<const XLineCapItem*>(pState))
{
sal_Int32 nEntryPos(0);
switch(pItem->GetValue())
{
case drawing::LineCap_BUTT:
{
nEntryPos = 1;
break;
}
case drawing::LineCap_ROUND:
{
nEntryPos = 2;
break;
}
case drawing::LineCap_SQUARE:
{
nEntryPos = 3;
break;
}
default:
break;
}
if(nEntryPos)
{
mxLBCapStyle->set_active(nEntryPos - 1);
return;
}
}
}
mxLBCapStyle->set_active(-1);
}
IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeEdgeStyleHdl, weld::ComboBox&, void)
{
const sal_Int32 nPos(mxLBEdgeStyle->get_active());
if (nPos == -1 || !mxLBEdgeStyle->get_value_changed_from_saved())
return;
std::unique_ptr<XLineJointItem> pItem;
switch(nPos)
{
case 0: // rounded
{
pItem.reset(new XLineJointItem(drawing::LineJoint_ROUND));
break;
}
case 1: // none
{
pItem.reset(new XLineJointItem(drawing::LineJoint_NONE));
break;
}
case 2: // mitered
{
pItem.reset(new XLineJointItem(drawing::LineJoint_MITER));
break;
}
case 3: // beveled
{
pItem.reset(new XLineJointItem(drawing::LineJoint_BEVEL));
break;
}
}
setLineJoint(pItem.get());
}
IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeCapStyleHdl, weld::ComboBox&, void)
{
const sal_Int32 nPos(mxLBCapStyle->get_active());
if (!(nPos != -1 && mxLBCapStyle->get_value_changed_from_saved()))
return;
std::unique_ptr<XLineCapItem> pItem;
switch(nPos)
{
case 0: // flat
{
pItem.reset(new XLineCapItem(drawing::LineCap_BUTT));
break;
}
case 1: // round
{
pItem.reset(new XLineCapItem(drawing::LineCap_ROUND));
break;
}
case 2: // square
{
pItem.reset(new XLineCapItem(drawing::LineCap_SQUARE));
break;
}
}
setLineCap(pItem.get());
}
IMPL_LINK_NOARG(LinePropertyPanelBase, ToolboxWidthSelectHdl, const OUString&, void)
{
mxTBWidth->set_menu_item_active(SELECTWIDTH, !mxTBWidth->get_menu_item_active(SELECTWIDTH));
@ -437,12 +255,10 @@ void LinePropertyPanelBase::SetWidth(tools::Long nWidth)
void LinePropertyPanelBase::ActivateControls()
{
mxGridLineProps->set_sensitive(!mbNoneLineStyle);
mxBoxArrowProps->set_sensitive(!mbNoneLineStyle);
mxLineStyleTB->set_item_sensitive(".uno:LineEndStyle", !mbNoneLineStyle);
mxArrowHeadStyleTB->set_item_sensitive(".uno:LineEndStyle", !mbNoneLineStyle);
mxBoxArrowProps->set_visible(mbArrowSupported);
mxLineStyleTB->set_item_visible(".uno:LineEndStyle", mbArrowSupported);
mxArrowHeadStyleFT->set_visible(mbArrowSupported);
mxArrowHeadStyleTB->set_item_visible(".uno:LineEndStyle", mbArrowSupported);
}
void LinePropertyPanelBase::setMapUnit(MapUnit eMapUnit)

View file

@ -14,7 +14,7 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<!-- n-columns=2 n-rows=7 -->
<!-- n-columns=2 n-rows=4 -->
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can-focus">False</property>
@ -44,17 +44,6 @@
<property name="toolbar-style">icons</property>
<property name="show-arrow">False</property>
<property name="icon_size">2</property>
<child>
<object class="GtkMenuToolButton" id=".uno:LineEndStyle">
<property name="visible">True</property>
<property name="tooltip-text" translatable="yes" context="sidebarline|linestyle|tooltip_text">Select the style of the arrowheads.</property>
<property name="use-underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<object class="GtkMenuToolButton" id=".uno:XLineStyle">
<property name="visible">True</property>
@ -190,12 +179,12 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="cornerlabel">
<object class="GtkLabel" id="arrowlabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes" context="sidebarline|cornerlabel">_Corner style:</property>
<property name="label" translatable="yes" context="sidebarline|arrowlabel">Arrow styles:</property>
<property name="use-underline">True</property>
<property name="mnemonic-widget">edgestyle</property>
<property name="mnemonic-widget">width</property>
<property name="xalign">0</property>
</object>
<packing>
@ -204,57 +193,23 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="caplabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes" context="sidebarline|caplabel">Ca_p style:</property>
<property name="use-underline">True</property>
<property name="mnemonic-widget">linecapstyle</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="linecapstyle">
<object class="GtkToolbar" id="arrowheadstyle">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes" context="sidebarline|linecapstyle|tooltip_text">Select the style of the line caps.</property>
<property name="hexpand">True</property>
<items>
<item translatable="yes" context="sidebarline|linecapstyle">Flat</item>
<item translatable="yes" context="sidebarline|linecapstyle">Round</item>
<item translatable="yes" context="sidebarline|linecapstyle">Square</item>
</items>
<child internal-child="accessible">
<object class="AtkObject" id="linecapstyle-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebarline|linecapstyle-atkobject">Cap Style</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="edgestyle">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="tooltip-text" translatable="yes" context="sidebarline|edgestyle|tooltip_text">Select the style of the edge connections.</property>
<property name="hexpand">True</property>
<items>
<item translatable="yes" context="sidebarline|edgestyle">Rounded</item>
<item translatable="yes" context="sidebarline|edgestyle">- none -</item>
<item translatable="yes" context="sidebarline|edgestyle">Mitered</item>
<item translatable="yes" context="sidebarline|edgestyle">Beveled</item>
</items>
<child internal-child="accessible">
<object class="AtkObject" id="edgestyle-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebarline|edgestyle-atkobject">Corner Style</property>
<property name="halign">end</property>
<property name="toolbar-style">icons</property>
<property name="show-arrow">False</property>
<property name="icon_size">2</property>
<child>
<object class="GtkMenuToolButton" id=".uno:LineEndStyle">
<property name="visible">True</property>
<property name="tooltip-text" translatable="yes" context="sidebarline|arrowheadstyle|tooltip_text">Select the style of the arrowheads.</property>
<property name="use-underline">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="homogeneous">False</property>
</packing>
</child>
</object>
<packing>
@ -262,58 +217,6 @@
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkBox" id="arrowproperties">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
<!-- n-columns=3 n-rows=3 -->
<object class="GtkGrid" id="lineproperties">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">6</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">0</property>