rework line style to be a wide toolbar button

involves converting SvxLineStyleToolBoxControl to a PopupWindowController

because chart is doing interesting things in its panel there needs to be
a non-standard way to report/detect the selected line style, which is
then reused to disable/enable the arrows when none is selected/deselected
in non-chart sidebars

SvxLineBox becomes a toolbar dropdown instead of a combobox itemwindow

linectrl.cxx split into linewidthctrl.cxx and linewidthctrl because
SvxLineBox is now needed in svxcore

Change-Id: Icf0ef5e612b894a43d389af8a2908138c2e9c580
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87164
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2020-01-21 15:43:46 +00:00
parent 2399373778
commit eae55d7397
29 changed files with 824 additions and 802 deletions

View File

@ -10,11 +10,17 @@
#include "ChartColorWrapper.hxx"
#include <ObjectIdentifier.hxx>
#include <PropertyHelper.hxx>
#include <com/sun/star/chart2/XDiagram.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <svx/linectrl.hxx>
#include <svx/tbcontrl.hxx>
#include <svx/xlndsit.hxx>
#include <svx/unomid.hxx>
namespace chart::sidebar {
@ -104,6 +110,101 @@ void ChartColorWrapper::updateData()
mpControl->statusChanged(aEvent);
}
ChartLineStyleWrapper::ChartLineStyleWrapper(
css::uno::Reference<css::frame::XModel> const & xModel,
SvxLineStyleToolBoxControl* pControl)
: mxModel(xModel)
, mpControl(pControl)
{
}
void ChartLineStyleWrapper::updateModel(const css::uno::Reference<css::frame::XModel>& xModel)
{
mxModel = xModel;
}
namespace
{
css::uno::Any getLineDash(
const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rDashName)
{
css::uno::Reference<css::lang::XMultiServiceFactory> xFact(xModel, css::uno::UNO_QUERY);
css::uno::Reference<css::container::XNameAccess> xNameAccess(
xFact->createInstance("com.sun.star.drawing.DashTable"),
css::uno::UNO_QUERY );
if(xNameAccess.is())
{
if (!xNameAccess->hasByName(rDashName))
return css::uno::Any();
return xNameAccess->getByName(rDashName);
}
return css::uno::Any();
}
}
void ChartLineStyleWrapper::updateData()
{
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
if (!xPropSet.is())
return;
css::util::URL aUrl;
aUrl.Complete = ".uno:XLineStyle";
css::frame::FeatureStateEvent aEvent;
aEvent.IsEnabled = true;
aEvent.FeatureURL = aUrl;
aEvent.State = xPropSet->getPropertyValue("LineStyle");
mpControl->statusChanged(aEvent);
aUrl.Complete = ".uno:LineDash";
auto aLineDashName = xPropSet->getPropertyValue("LineDashName");
OUString aDashName;
aLineDashName >>= aDashName;
css::uno::Any aLineDash = getLineDash(mxModel, aDashName);
XLineDashItem aDashItem;
aDashItem.PutValue(aLineDash, MID_LINEDASH);
aEvent.FeatureURL = aUrl;
aDashItem.QueryValue(aEvent.State);
mpControl->statusChanged(aEvent);
}
bool ChartLineStyleWrapper::operator()(const OUString& rCommand, const css::uno::Any& rValue)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet = getPropSet(mxModel);
if (!xPropSet.is())
{
SAL_WARN("chart2", "Invalid reference to xPropSet");
return false;
}
if (rCommand == ".uno:XLineStyle")
{
xPropSet->setPropertyValue("LineStyle", rValue);
return true;
}
else if (rCommand == ".uno:LineDash")
{
XLineDashItem aDashItem;
aDashItem.PutValue(rValue, 0);
css::uno::Any aAny;
aDashItem.QueryValue(aAny, MID_LINEDASH);
OUString aDashName = PropertyHelper::addLineDashUniqueNameToTable(aAny,
css::uno::Reference<css::lang::XMultiServiceFactory>(mxModel, css::uno::UNO_QUERY),
"");
xPropSet->setPropertyValue("LineDash", aAny);
xPropSet->setPropertyValue("LineDashName", css::uno::Any(aDashName));
return true;
}
return false;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -16,13 +16,12 @@
namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
class SvxColorToolBoxControl;
class SvxLineStyleToolBoxControl;
namespace chart { namespace sidebar {
class ChartColorWrapper
{
private:
public:
ChartColorWrapper(css::uno::Reference<css::frame::XModel> const & xModel,
SvxColorToolBoxControl* pControl,
@ -43,6 +42,25 @@ private:
OUString maPropertyName;
};
class ChartLineStyleWrapper
{
public:
ChartLineStyleWrapper(css::uno::Reference<css::frame::XModel> const & xModel,
SvxLineStyleToolBoxControl* pControl);
bool operator()(const OUString& rCommand, const css::uno::Any& rValue);
void updateModel(const css::uno::Reference<css::frame::XModel>& xModel);
void updateData();
private:
css::uno::Reference<css::frame::XModel> mxModel;
SvxLineStyleToolBoxControl* mpControl;
};
} }
#endif

View File

@ -19,6 +19,7 @@
#include <svx/xlntrit.hxx>
#include <svx/unomid.hxx>
#include <svx/linectrl.hxx>
#include <svx/tbcontrl.hxx>
#include <sfx2/weldutils.hxx>
#include <vcl/svapp.hxx>
@ -31,9 +32,16 @@ namespace chart::sidebar {
namespace {
SvxColorToolBoxControl* getColorToolBoxControl(ToolbarUnoDispatcher& rToolBoxColor)
SvxLineStyleToolBoxControl* getLineStyleToolBoxControl(ToolbarUnoDispatcher& rToolBoxColor)
{
css::uno::Reference<css::frame::XToolbarController> xController = rToolBoxColor.GetControllerForCommand(".uno:XLineColor");
css::uno::Reference<css::frame::XToolbarController> xController = rToolBoxColor.GetControllerForCommand(".uno:XLineStyle");
SvxLineStyleToolBoxControl* pToolBoxLineStyleControl = dynamic_cast<SvxLineStyleToolBoxControl*>(xController.get());
return pToolBoxLineStyleControl;
}
SvxColorToolBoxControl* getColorToolBoxControl(ToolbarUnoDispatcher& rToolBoxLineStyle)
{
css::uno::Reference<css::frame::XToolbarController> xController = rToolBoxLineStyle.GetControllerForCommand(".uno:XLineColor");
SvxColorToolBoxControl* pToolBoxColorControl = dynamic_cast<SvxColorToolBoxControl*>(xController.get());
return pToolBoxColorControl;
}
@ -76,24 +84,6 @@ css::uno::Reference<css::beans::XPropertySet> getPropSet(
return xPropSet;
}
css::uno::Any getLineDash(
const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rDashName)
{
css::uno::Reference<css::lang::XMultiServiceFactory> xFact(xModel, css::uno::UNO_QUERY);
css::uno::Reference<css::container::XNameAccess> xNameAccess(
xFact->createInstance("com.sun.star.drawing.DashTable"),
css::uno::UNO_QUERY );
if(xNameAccess.is())
{
if (!xNameAccess->hasByName(rDashName))
return css::uno::Any();
return xNameAccess->getByName(rDashName);
}
return css::uno::Any();
}
class PreventUpdate
{
public:
@ -137,7 +127,8 @@ ChartLinePanel::ChartLinePanel(vcl::Window* pParent,
mxSelectionListener(new ChartSidebarSelectionListener(this)),
mbUpdate(true),
mbModelValid(true),
maLineColorWrapper(mxModel, getColorToolBoxControl(*mxColorDispatch), "LineColor")
maLineColorWrapper(mxModel, getColorToolBoxControl(*mxColorDispatch), "LineColor"),
maLineStyleWrapper(mxModel, getLineStyleToolBoxControl(*mxLineStyleDispatch))
{
disableArrowHead();
std::vector<ObjectType> aAcceptedTypes { OBJECTTYPE_PAGE, OBJECTTYPE_DIAGRAM,
@ -177,6 +168,9 @@ void ChartLinePanel::Initialize()
SvxColorToolBoxControl* pToolBoxColor = getColorToolBoxControl(*mxColorDispatch);
pToolBoxColor->setColorSelectFunction(maLineColorWrapper);
SvxLineStyleToolBoxControl* pToolBoxLineStyle = getLineStyleToolBoxControl(*mxLineStyleDispatch);
pToolBoxLineStyle->setLineStyleSelectFunction(maLineStyleWrapper);
setMapUnit(MapUnit::Map100thMM);
updateData();
}
@ -196,19 +190,7 @@ void ChartLinePanel::updateData()
XLineTransparenceItem aLineTransparenceItem(nLineTransparence);
updateLineTransparence(false, true, &aLineTransparenceItem);
css::drawing::LineStyle eStyle = css::drawing::LineStyle_SOLID;
xPropSet->getPropertyValue("LineStyle") >>= eStyle;
XLineStyleItem aStyleItem(eStyle);
updateLineStyle(false, true, &aStyleItem);
css::uno::Any aLineDashName = xPropSet->getPropertyValue("LineDashName");
OUString aDashName;
aLineDashName >>= aDashName;
css::uno::Any aLineDash = getLineDash(mxModel, aDashName);
XLineDashItem aDashItem;
aDashItem.PutValue(aLineDash, MID_LINEDASH);
updateLineDash(false, true, &aDashItem);
maLineStyleWrapper.updateData();
maLineColorWrapper.updateData();
}
@ -235,6 +217,7 @@ void ChartLinePanel::updateModel(
mxModel = xModel;
mbModelValid = true;
maLineStyleWrapper.updateModel(mxModel);
maLineColorWrapper.updateModel(mxModel);
css::uno::Reference<css::util::XModifyBroadcaster> xBroadcasterNew(mxModel, css::uno::UNO_QUERY_THROW);
@ -245,44 +228,6 @@ void ChartLinePanel::updateModel(
xSelectionSupplier->addSelectionChangeListener(mxSelectionListener.get());
}
void ChartLinePanel::setLineStyle(const XLineStyleItem& rItem)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
getPropSet(mxModel);
if (!xPropSet.is())
return;
PreventUpdate aPreventUpdate(mbUpdate);
xPropSet->setPropertyValue("LineStyle", css::uno::Any(rItem.GetValue()));
}
void ChartLinePanel::setLineDash(const XLineDashItem& rItem)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =
getPropSet(mxModel);
if (!xPropSet.is())
return;
PreventUpdate aPreventUpdate(mbUpdate);
css::uno::Any aAny;
rItem.QueryValue(aAny, MID_LINEDASH);
OUString aDashName = PropertyHelper::addLineDashUniqueNameToTable(aAny,
css::uno::Reference<css::lang::XMultiServiceFactory>(mxModel, css::uno::UNO_QUERY),
"");
xPropSet->setPropertyValue("LineDash", aAny);
xPropSet->setPropertyValue("LineDashName", css::uno::Any(aDashName));
}
void ChartLinePanel::setLineEndStyle(const XLineEndItem* /*pItem*/)
{
}
void ChartLinePanel::setLineStartStyle(const XLineStartItem* /*pItem*/)
{
}
void ChartLinePanel::setLineJoint(const XLineJointItem* pItem)
{
css::uno::Reference<css::beans::XPropertySet> xPropSet =

View File

@ -64,10 +64,6 @@ public:
protected:
virtual void setLineStyle(const XLineStyleItem& rItem) override;
virtual void setLineDash(const XLineDashItem& rItem) override;
virtual void setLineEndStyle(const XLineEndItem* pItem) override;
virtual void setLineStartStyle(const XLineStartItem* pItem) override;
virtual void setLineTransparency(const XLineTransparenceItem& rItem) override;
virtual void setLineJoint(const XLineJointItem* pItem) override;
virtual void setLineCap(const XLineCapItem* pItem) override;
@ -83,6 +79,7 @@ private:
bool mbUpdate;
bool mbModelValid;
ChartColorWrapper maLineColorWrapper;
ChartLineStyleWrapper maLineStyleWrapper;
};
} } // end of namespace svx::sidebar

View File

@ -772,8 +772,6 @@ svx/source/sidebar/line/LinePropertyPanel.hxx:85
svx::sidebar::LinePropertyPanel maStyleControl sfx2::sidebar::ControllerItem
svx/source/sidebar/line/LinePropertyPanel.hxx:86
svx::sidebar::LinePropertyPanel maDashControl sfx2::sidebar::ControllerItem
svx/source/sidebar/line/LinePropertyPanel.hxx:91
svx::sidebar::LinePropertyPanel maLineStyleListControl sfx2::sidebar::ControllerItem
svx/source/sidebar/line/LinePropertyPanel.hxx:92
svx::sidebar::LinePropertyPanel maTransControl sfx2::sidebar::ControllerItem
svx/source/sidebar/line/LinePropertyPanel.hxx:93

View File

@ -20,40 +20,31 @@
#define INCLUDED_SVX_ITEMWIN_HXX
#include <vcl/field.hxx>
#include <svtools/toolbarmenu.hxx>
#include <svx/dlgctrl.hxx>
#include <svx/svxdllapi.h>
class XLineWidthItem;
class SfxObjectShell;
class SvtValueSet;
class SvxLineStyleToolBoxControl;
class SvxLineBox final : public ListBox
class SvxLineBox final : public WeldToolbarPopup
{
sal_uInt16 nCurPos;
Timer aDelayTimer;
Size const aLogicalSize;
bool bRelease;
SfxObjectShell* mpSh;
css::uno::Reference< css::frame::XFrame > mxFrame;
DECL_LINK(DelayHdl_Impl, Timer *, void);
void ReleaseFocus_Impl();
public:
SvxLineBox( vcl::Window* pParent,
const css::uno::Reference< css::frame::XFrame >& rFrame );
rtl::Reference<SvxLineStyleToolBoxControl> mxControl;
std::unique_ptr<SvtValueSet> mxLineStyleSet;
std::unique_ptr<weld::CustomWeld> mxLineStyleSetWin;
void FillControl();
void Fill(const XDashListRef &pList);
private:
virtual void Select() override;
virtual bool PreNotify( NotifyEvent& rNEvt ) override;
virtual bool EventNotify( NotifyEvent& rNEvt ) override;
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
DECL_LINK(SelectHdl, SvtValueSet*, void);
virtual void GrabFocus() override;
public:
SvxLineBox(SvxLineStyleToolBoxControl* pControl, weld::Widget* pParent, int nInitialIndex);
virtual ~SvxLineBox() override;
};
class SVX_DLLPUBLIC SvxMetricField : public MetricField

View File

@ -19,42 +19,58 @@
#ifndef INCLUDED_SVX_LINECTRL_HXX
#define INCLUDED_SVX_LINECTRL_HXX
#include <sfx2/tbxctrl.hxx>
#include <svtools/popupwindowcontroller.hxx>
#include <svx/svxdllapi.h>
#include <memory>
namespace svx {
class ToolboxButtonLineStyleUpdater;
}
class XLineStyleItem;
class XLineDashItem;
typedef std::function<bool(const OUString&, const css::uno::Any&)> LineStyleSelectFunction;
// SvxLineStyleController:
class SVX_DLLPUBLIC SvxLineStyleToolBoxControl final : public SfxToolBoxControl
class SVX_DLLPUBLIC SvxLineStyleToolBoxControl final : public svt::PopupWindowController
{
private:
std::unique_ptr<XLineStyleItem> pStyleItem;
std::unique_ptr<XLineDashItem> pDashItem;
std::unique_ptr<svx::ToolboxButtonLineStyleUpdater> m_xBtnUpdater;
bool bUpdate;
LineStyleSelectFunction m_aLineStyleSelectFunction;
public:
SFX_DECL_TOOLBOX_CONTROL();
SvxLineStyleToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence<css::uno::Any>& rArguments ) override;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() override;
virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
virtual void SAL_CALL execute(sal_Int16 nKeyModifier) override;
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& rEvent) override;
SvxLineStyleToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
virtual ~SvxLineStyleToolBoxControl() override;
virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState ) override;
void Update( const SfxPoolItem* pState );
virtual VclPtr<vcl::Window> CreateItemWindow( vcl::Window *pParent ) override;
void setLineStyleSelectFunction(const LineStyleSelectFunction& aLineStyleSelectFunction);
void dispatchLineStyleCommand(const OUString& rCommand, const css::uno::Sequence<css::beans::PropertyValue>& rArgs);
int GetStyleIndex() const;
private:
virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override;
virtual VclPtr<vcl::Window> createVclPopupWindow( vcl::Window* pParent ) override;
};
// SvxLineWidthController:
class SVX_DLLPUBLIC SvxLineWidthToolBoxControl final : public SfxToolBoxControl
{
public:

View File

@ -45,15 +45,14 @@ namespace svx
namespace sidebar
{
class DisableArrowsWrapper;
class SVX_DLLPUBLIC LinePropertyPanelBase : public PanelLayout
{
public:
virtual ~LinePropertyPanelBase() override;
virtual void dispose() override;
virtual void DataChanged(
const DataChangedEvent& rEvent) override;
void SetWidth(long nWidth);
void SetWidthIcon(int n);
void SetWidthIcon();
@ -67,28 +66,28 @@ public:
virtual void setLineWidth(const XLineWidthItem& rItem) = 0;
void SetNoneLineStyle(bool bNoneLineStyle)
{
if (bNoneLineStyle != mbNoneLineStyle)
{
mbNoneLineStyle = bNoneLineStyle;
ActivateControls();
}
}
protected:
virtual void setLineStyle(const XLineStyleItem& rItem) = 0;
virtual void setLineDash(const XLineDashItem& rItem) = 0;
virtual void setLineEndStyle(const XLineEndItem* pItem) = 0;
virtual void setLineStartStyle(const XLineStartItem* pItem) = 0;
void ActivateControls();
virtual void setLineTransparency(const XLineTransparenceItem& rItem) = 0;
virtual void setLineJoint(const XLineJointItem* pItem) = 0;
virtual void setLineCap(const XLineCapItem* pItem) = 0;
void updateLineStyle(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
void updateLineDash(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
void updateLineTransparence(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem);
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 FillLineStyleList();
void SelectLineStyle();
void ActivateControls();
void setMapUnit(MapUnit eMapUnit);
void enableArrowHead();
@ -99,15 +98,15 @@ protected:
std::unique_ptr<weld::Toolbar> mxTBColor;
std::unique_ptr<ToolbarUnoDispatcher> mxColorDispatch;
std::unique_ptr<weld::Toolbar> mxLineStyleTB;
std::unique_ptr<ToolbarUnoDispatcher> mxLineStyleDispatch;
private:
//ui controls
std::unique_ptr<weld::Label> mxFTWidth;
std::unique_ptr<weld::Toolbar> mxTBWidth;
std::unique_ptr<SvxLineLB> mxLBStyle;
std::unique_ptr<weld::Label> mxFTTransparency;
std::unique_ptr<weld::MetricSpinButton> mxMFTransparent;
std::unique_ptr<weld::Toolbar> mxArrowsTB;
std::unique_ptr<ToolbarUnoDispatcher> mxArrowsDispatch;
std::unique_ptr<weld::Label> mxFTEdgeStyle;
std::unique_ptr<weld::ComboBox> mxLBEdgeStyle;
std::unique_ptr<weld::Label> mxFTCapStyle;
@ -117,13 +116,11 @@ private:
//popup windows
std::unique_ptr<LineWidthPopup> mxLineWidthPopup;
std::unique_ptr<XLineStyleItem> mpStyleItem;
std::unique_ptr<XLineDashItem> mpDashItem;
std::unique_ptr<DisableArrowsWrapper> mxDisableArrowsWrapper;
sal_uInt16 mnTrans;
MapUnit meMapUnit;
sal_Int32 mnWidthCoreValue;
XDashListRef mxLineStyleList;
// images from resource
OUString maIMGNone;
@ -133,6 +130,7 @@ private:
bool mbWidthValuable : 1;
bool mbArrowSupported;
bool mbNoneLineStyle;
void Initialize();

View File

@ -27,6 +27,8 @@
#include <vcl/vclenum.hxx>
#include <vcl/vclptr.hxx>
#include <svx/Palette.hxx>
#include <com/sun/star/drawing/LineStyle.hpp>
#include <com/sun/star/frame/FeatureStateEvent.hpp>
#include <com/sun/star/frame/XFrame.hpp>
class ToolBox;
@ -122,6 +124,17 @@ namespace svx
virtual vcl::ImageType GetImageSize() const override;
virtual Size GetItemSize() const override;
};
class ToolboxButtonLineStyleUpdater
{
private:
css::drawing::LineStyle m_eXLS;
int m_nDashStyleIndex;
public:
ToolboxButtonLineStyleUpdater();
void Update(const css::frame::FeatureStateEvent& rEvent);
int GetStyleIndex() const;
};
}
#endif // INCLUDED_SVX_TBXCOLORUPDATE_HXX

View File

@ -1371,6 +1371,17 @@
<value>com.sun.star.comp.svx.LineEndToolBoxControl</value>
</prop>
</node>
<node oor:name="LineStyleToolBoxControl" oor:op="replace">
<prop oor:name="Command">
<value>.uno:XLineStyle</value>
</prop>
<prop oor:name="Module">
<value/>
</prop>
<prop oor:name="Controller">
<value>com.sun.star.comp.svx.LineStyleToolBoxControl</value>
</prop>
</node>
<node oor:name="LineSpacingToolBoxControl" oor:op="replace">
<prop oor:name="Command">
<value>.uno:LineSpacing</value>

View File

@ -146,7 +146,6 @@ void ScDLL::Init()
// SvxToolboxController
SvxTbxCtlDraw ::RegisterControl(SID_INSERT_DRAW, pMod);
SvxFillToolBoxControl ::RegisterControl(0, pMod);
SvxLineStyleToolBoxControl ::RegisterControl(0, pMod);
SvxLineWidthToolBoxControl ::RegisterControl(0, pMod);
SvxStyleToolBoxControl ::RegisterControl(SID_STYLE_APPLY, pMod);
SvxClipBoardControl ::RegisterControl(SID_PASTE, pMod );

View File

@ -177,7 +177,6 @@ void SdDLL::RegisterControllers(SdModule* pMod)
::sfx2::sidebar::SidebarChildWindow::RegisterChildWindow(false, pMod);
SvxFillToolBoxControl::RegisterControl(0, pMod);
SvxLineStyleToolBoxControl::RegisterControl(0, pMod);
SvxLineWidthToolBoxControl::RegisterControl(0, pMod);
SvxStyleToolBoxControl::RegisterControl(0, pMod);

View File

@ -14444,6 +14444,7 @@ svx/source/tbxctrls/itemwin.cxx
svx/source/tbxctrls/layctrl.cxx
svx/source/tbxctrls/lboxctrl.cxx
svx/source/tbxctrls/linectrl.cxx
svx/source/tbxctrls/linewidthctrl.cxx
svx/source/tbxctrls/tbcontrl.cxx
svx/source/tbxctrls/tbunocontroller.cxx
svx/source/tbxctrls/tbunosearchcontrollers.cxx

View File

@ -232,7 +232,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
svx/source/tbxctrls/itemwin \
svx/source/tbxctrls/layctrl \
svx/source/tbxctrls/lboxctrl \
svx/source/tbxctrls/linectrl \
svx/source/tbxctrls/linewidthctrl \
svx/source/tbxctrls/tbunocontroller \
svx/source/tbxctrls/tbunosearchcontrollers \
svx/source/tbxctrls/tbxcolor \

View File

@ -370,6 +370,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/table/viewcontactoftableobj \
svx/source/tbxctrls/extrusioncontrols \
svx/source/tbxctrls/fontworkgallery \
svx/source/tbxctrls/linectrl \
svx/source/tbxctrls/Palette \
svx/source/tbxctrls/PaletteManager \
svx/source/tbxctrls/tbcontrl \

View File

@ -51,6 +51,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
svx/uiconfig/ui/floatingframeborder \
svx/uiconfig/ui/floatinglineend \
svx/uiconfig/ui/floatinglineproperty \
svx/uiconfig/ui/floatinglinestyle \
svx/uiconfig/ui/floatingundoredo \
svx/uiconfig/ui/fontworkgallerydialog \
svx/uiconfig/ui/fontworkspacingdialog \

View File

@ -54,7 +54,6 @@ LinePropertyPanel::LinePropertyPanel(
maStyleControl(SID_ATTR_LINE_STYLE, *pBindings, *this),
maDashControl (SID_ATTR_LINE_DASH, *pBindings, *this),
maWidthControl(SID_ATTR_LINE_WIDTH, *pBindings, *this),
maLineStyleListControl(SID_DASH_LIST, *pBindings, *this),
maTransControl(SID_ATTR_LINE_TRANSPARENCE, *pBindings, *this),
maEdgeStyle(SID_ATTR_LINE_JOINT, *pBindings, *this),
maCapStyle(SID_ATTR_LINE_CAP, *pBindings, *this),
@ -74,7 +73,6 @@ void LinePropertyPanel::dispose()
maStyleControl.dispose();
maDashControl.dispose();
maWidthControl.dispose();
maLineStyleListControl.dispose();
maTransControl.dispose();
maEdgeStyle.dispose();
maCapStyle.dispose();
@ -107,16 +105,6 @@ void LinePropertyPanel::NotifyItemUpdate(
switch(nSID)
{
case SID_ATTR_LINE_DASH:
{
updateLineDash(bDisabled, bSetOrDefault, pState);
break;
}
case SID_ATTR_LINE_STYLE:
{
updateLineStyle(bDisabled, bSetOrDefault, pState);
break;
}
case SID_ATTR_LINE_TRANSPARENCE:
{
updateLineTransparence(bDisabled, bSetOrDefault, pState);
@ -127,12 +115,6 @@ void LinePropertyPanel::NotifyItemUpdate(
updateLineWidth(bDisabled, bSetOrDefault, pState);
break;
}
case SID_DASH_LIST:
{
FillLineStyleList();
SelectLineStyle();
break;
}
case SID_ATTR_LINE_JOINT:
{
updateLineJoint(bDisabled, bSetOrDefault, pState);
@ -176,30 +158,6 @@ void LinePropertyPanel::HandleContextChange(
enableArrowHead();
}
void LinePropertyPanel::setLineStyle(const XLineStyleItem& rItem)
{
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_LINE_STYLE,
SfxCallMode::RECORD, { &rItem });
}
void LinePropertyPanel::setLineDash(const XLineDashItem& rItem)
{
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_LINE_DASH,
SfxCallMode::RECORD, { &rItem });
}
void LinePropertyPanel::setLineEndStyle(const XLineEndItem* pItem)
{
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_LINEEND_STYLE,
SfxCallMode::RECORD, { pItem });
}
void LinePropertyPanel::setLineStartStyle(const XLineStartItem* pItem)
{
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_LINEEND_STYLE,
SfxCallMode::RECORD, { pItem });
}
void LinePropertyPanel::setLineJoint(const XLineJointItem* pItem)
{
GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_LINE_JOINT,

View File

@ -72,10 +72,6 @@ public:
protected:
virtual void setLineStyle(const XLineStyleItem& rItem) override;
virtual void setLineDash(const XLineDashItem& rItem) override;
virtual void setLineEndStyle(const XLineEndItem* pItem) override;
virtual void setLineStartStyle(const XLineStartItem* pItem) override;
virtual void setLineTransparency(const XLineTransparenceItem& rItem) override;
virtual void setLineJoint(const XLineJointItem* pItem) override;
virtual void setLineCap(const XLineCapItem* pItem) override;
@ -85,7 +81,6 @@ private:
sfx2::sidebar::ControllerItem maStyleControl;
sfx2::sidebar::ControllerItem maDashControl;
sfx2::sidebar::ControllerItem maWidthControl;
sfx2::sidebar::ControllerItem maLineStyleListControl;
sfx2::sidebar::ControllerItem maTransControl;
sfx2::sidebar::ControllerItem maEdgeStyle;
sfx2::sidebar::ControllerItem maCapStyle;

View File

@ -32,6 +32,7 @@
#include <svx/xtable.hxx>
#include <svx/xdash.hxx>
#include <svx/drawitem.hxx>
#include <svx/linectrl.hxx>
#include <svx/svxitems.hrc>
#include <svtools/valueset.hxx>
#include <unotools/pathoptions.hxx>
@ -55,19 +56,53 @@ const char SELECTWIDTH[] = "SelectWidth";
namespace svx::sidebar {
// trigger disabling the arrows if the none line style is selected
class DisableArrowsWrapper
{
private:
LinePropertyPanelBase& m_rPanel;
public:
DisableArrowsWrapper(LinePropertyPanelBase& rPanel)
: m_rPanel(rPanel)
{
}
bool operator()(const OUString& rCommand, const css::uno::Any& rValue)
{
if (rCommand == ".uno:XLineStyle")
{
css::drawing::LineStyle eLineStyle(css::drawing::LineStyle_NONE);
rValue >>= eLineStyle;
m_rPanel.SetNoneLineStyle(eLineStyle == css::drawing::LineStyle_NONE);
}
return false;
}
};
namespace
{
SvxLineStyleToolBoxControl* getLineStyleToolBoxControl(ToolbarUnoDispatcher& rToolBoxColor)
{
css::uno::Reference<css::frame::XToolbarController> xController = rToolBoxColor.GetControllerForCommand(".uno:XLineStyle");
SvxLineStyleToolBoxControl* pToolBoxLineStyleControl = dynamic_cast<SvxLineStyleToolBoxControl*>(xController.get());
return pToolBoxLineStyleControl;
}
}
LinePropertyPanelBase::LinePropertyPanelBase(
vcl::Window* pParent,
const uno::Reference<css::frame::XFrame>& rxFrame)
: PanelLayout(pParent, "LinePropertyPanel", "svx/ui/sidebarline.ui", rxFrame, true),
mxTBColor(m_xBuilder->weld_toolbar("color")),
mxColorDispatch(new ToolbarUnoDispatcher(*mxTBColor, rxFrame)),
mxLineStyleTB(m_xBuilder->weld_toolbar("linestyle")),
mxLineStyleDispatch(new ToolbarUnoDispatcher(*mxLineStyleTB, rxFrame)),
mxFTWidth(m_xBuilder->weld_label("widthlabel")),
mxTBWidth(m_xBuilder->weld_toolbar("width")),
mxLBStyle(new SvxLineLB(m_xBuilder->weld_combo_box("linestyle"))),
mxFTTransparency(m_xBuilder->weld_label("translabel")),
mxMFTransparent(m_xBuilder->weld_metric_spin_button("linetransparency", FieldUnit::PERCENT)),
mxArrowsTB(m_xBuilder->weld_toolbar("arrowheads")),
mxArrowsDispatch(new ToolbarUnoDispatcher(*mxArrowsTB, rxFrame)),
mxFTEdgeStyle(m_xBuilder->weld_label("cornerlabel")),
mxLBEdgeStyle(m_xBuilder->weld_combo_box("edgestyle")),
mxFTCapStyle(m_xBuilder->weld_label("caplabel")),
@ -75,14 +110,14 @@ LinePropertyPanelBase::LinePropertyPanelBase(
mxGridLineProps(m_xBuilder->weld_widget("lineproperties")),
mxBoxArrowProps(m_xBuilder->weld_widget("arrowproperties")),
mxLineWidthPopup(new LineWidthPopup(mxTBWidth.get(), *this)),
mpStyleItem(),
mpDashItem(),
mxDisableArrowsWrapper(new DisableArrowsWrapper(*this)),
mnTrans(0),
meMapUnit(MapUnit::MapMM),
mnWidthCoreValue(0),
maIMGNone(BMP_NONE_ICON),
mbWidthValuable(true),
mbArrowSupported(true)
mbArrowSupported(true),
mbNoneLineStyle(false)
{
Initialize();
}
@ -99,11 +134,10 @@ void LinePropertyPanelBase::dispose()
mxTBWidth.reset();
mxColorDispatch.reset();
mxTBColor.reset();
mxLBStyle.reset();
mxFTTransparency.reset();
mxMFTransparent.reset();
mxArrowsDispatch.reset();
mxArrowsTB.reset();
mxLineStyleDispatch.reset();
mxLineStyleTB.reset();
mxFTEdgeStyle.reset();
mxLBEdgeStyle.reset();
mxFTCapStyle.reset();
@ -127,10 +161,6 @@ void LinePropertyPanelBase::Initialize()
maIMGWidthIcon[6] = BMP_WIDTH7_ICON;
maIMGWidthIcon[7] = BMP_WIDTH8_ICON;
FillLineStyleList();
SelectLineStyle();
mxLBStyle->connect_changed( LINK( this, LinePropertyPanelBase, ChangeLineStyleHdl ) );
mxTBWidth->set_item_icon_name(SELECTWIDTH, maIMGWidthIcon[0]);
mxTBWidth->connect_clicked(LINK(this, LinePropertyPanelBase, ToolboxWidthSelectHdl));
@ -139,62 +169,9 @@ void LinePropertyPanelBase::Initialize()
mxLBEdgeStyle->connect_changed( LINK( this, LinePropertyPanelBase, ChangeEdgeStyleHdl ) );
mxLBCapStyle->connect_changed( LINK( this, LinePropertyPanelBase, ChangeCapStyleHdl ) );
}
void LinePropertyPanelBase::DataChanged(const DataChangedEvent& /*rEvent*/)
{
}
void LinePropertyPanelBase::updateLineStyle(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem)
{
if(bDisabled)
{
mxLBStyle->set_sensitive(false);
}
else
{
mxLBStyle->set_sensitive(true);
}
if(bSetOrDefault)
{
if(pItem)
{
mpStyleItem.reset(static_cast<XLineStyleItem*>(pItem->Clone()));
}
}
else
{
mpStyleItem.reset();
}
SelectLineStyle();
}
void LinePropertyPanelBase::updateLineDash(bool bDisabled, bool bSetOrDefault, const SfxPoolItem* pItem)
{
if(bDisabled)
{
mxLBStyle->set_sensitive(false);
}
else
{
mxLBStyle->set_sensitive(true);
}
if(bSetOrDefault)
{
if(pItem)
{
mpDashItem.reset(static_cast<XLineDashItem*>(pItem->Clone()));
}
}
else
{
mpDashItem.reset();
}
SelectLineStyle();
SvxLineStyleToolBoxControl* pLineStyleControl = getLineStyleToolBoxControl(*mxLineStyleDispatch);
pLineStyleControl->setLineStyleSelectFunction(*mxDisableArrowsWrapper);
}
void LinePropertyPanelBase::updateLineTransparence(bool bDisabled, bool bSetOrDefault,
@ -366,44 +343,6 @@ void LinePropertyPanelBase::updateLineCap(bool bDisabled, bool bSetOrDefault,
mxLBCapStyle->set_active(-1);
}
IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeLineStyleHdl, weld::ComboBox&, void)
{
const sal_Int32 nPos(mxLBStyle->get_active());
if (nPos != -1 && mxLBStyle->get_value_changed_from_saved())
{
if(0 == nPos)
{
// drawing::LineStyle_NONE
const XLineStyleItem aItem(drawing::LineStyle_NONE);
setLineStyle(aItem);
}
else if(1 == nPos)
{
// drawing::LineStyle_SOLID
const XLineStyleItem aItem(drawing::LineStyle_SOLID);
setLineStyle(aItem);
}
else if (mxLineStyleList.is() && mxLineStyleList->Count() > static_cast<long>(nPos - 2))
{
// drawing::LineStyle_DASH
const XLineStyleItem aItemA(drawing::LineStyle_DASH);
const XDashEntry* pDashEntry = mxLineStyleList->GetDash(nPos - 2);
OSL_ENSURE(pDashEntry, "OOps, got empty XDash from XDashList (!)");
const XLineDashItem aItemB(
pDashEntry ? pDashEntry->GetName() : OUString(),
pDashEntry ? pDashEntry->GetDash() : XDash());
setLineStyle(aItemA);
setLineDash(aItemB);
}
}
ActivateControls();
}
IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeEdgeStyleHdl, weld::ComboBox&, void)
{
const sal_Int32 nPos(mxLBEdgeStyle->get_active());
@ -533,79 +472,12 @@ void LinePropertyPanelBase::SetWidth(long nWidth)
mxLineWidthPopup->SetWidthSelect(mnWidthCoreValue, mbWidthValuable, meMapUnit);
}
void LinePropertyPanelBase::FillLineStyleList()
{
SfxObjectShell* pSh = SfxObjectShell::Current();
if ( pSh && pSh->GetItem( SID_DASH_LIST ) )
{
mxLBStyle->set_sensitive(true);
mxLineStyleList = pSh->GetItem( SID_DASH_LIST )->GetDashList();
if (mxLineStyleList.is())
{
mxLBStyle->Fill(mxLineStyleList);
}
mxLBStyle->set_active(0);
}
else
{
mxLBStyle->set_sensitive(false);
}
}
void LinePropertyPanelBase::SelectLineStyle()
{
if (!mpStyleItem || !mpDashItem)
{
mxLBStyle->set_active(-1);
mxLBStyle->set_sensitive(false);
return;
}
const drawing::LineStyle eXLS(mpStyleItem->GetValue());
bool bSelected(false);
switch(eXLS)
{
case drawing::LineStyle_NONE:
break;
case drawing::LineStyle_SOLID:
mxLBStyle->set_active(1);
bSelected = true;
break;
default:
if(mxLineStyleList.is())
{
const XDash& rDash = mpDashItem->GetDashValue();
for(long a(0);!bSelected && a < mxLineStyleList->Count(); a++)
{
const XDashEntry* pEntry = mxLineStyleList->GetDash(a);
const XDash& rEntry = pEntry->GetDash();
if(rDash == rEntry)
{
mxLBStyle->set_active(a + 2);
bSelected = true;
}
}
}
break;
}
if(!bSelected)
mxLBStyle->set_active( 0 );
ActivateControls();
}
void LinePropertyPanelBase::ActivateControls()
{
const sal_Int32 nPos(mxLBStyle->get_active());
bool bLineStyle( nPos != 0 );
mxGridLineProps->set_sensitive( bLineStyle );
mxBoxArrowProps->set_sensitive( bLineStyle );
mxArrowsTB->set_sensitive( bLineStyle && mbArrowSupported );
mxGridLineProps->set_sensitive(mbNoneLineStyle);
mxBoxArrowProps->set_sensitive(mbNoneLineStyle);
mxLineStyleTB->set_item_visible(".uno:LineEndStyle", mbArrowSupported);
mxLineStyleTB->set_item_sensitive(".uno:LineEndStyle", !mbNoneLineStyle);
}
void LinePropertyPanelBase::setMapUnit(MapUnit eMapUnit)

View File

@ -34,8 +34,6 @@
#include <svx/svxids.hrc>
#define DELAY_TIMEOUT 100
#include <svx/xlnclit.hxx>
#include <svx/xlnwtit.hxx>
#include <svx/xlineit0.hxx>
@ -47,6 +45,7 @@
#include <svx/linectrl.hxx>
#include <svtools/colorcfg.hxx>
#include <svtools/unitconv.hxx>
#include <svtools/valueset.hxx>
#include <boost/property_tree/json_parser.hpp>
@ -56,231 +55,6 @@ using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::beans;
SvxLineBox::SvxLineBox( vcl::Window* pParent, const Reference< XFrame >& rFrame ) :
ListBox(pParent, WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL),
nCurPos ( 0 ),
aLogicalSize(40,140),
bRelease ( true ),
mpSh ( nullptr ),
mxFrame ( rFrame )
{
SetSizePixel(LogicToPixel(aLogicalSize, MapMode(MapUnit::MapAppFont)));
Show();
aDelayTimer.SetTimeout( DELAY_TIMEOUT );
aDelayTimer.SetInvokeHandler( LINK( this, SvxLineBox, DelayHdl_Impl ) );
aDelayTimer.Start();
}
// Fills the listbox (provisional) with strings
void SvxLineBox::Fill( const XDashListRef &pList )
{
Clear();
if( !pList.is() )
return;
// entry for 'none'
InsertEntry(pList->GetStringForUiNoLine());
// entry for solid line
InsertEntry(pList->GetStringForUiSolidLine(),
Image(pList->GetBitmapForUISolidLine()));
// entries for dashed lines
long nCount = pList->Count();
SetUpdateMode( false );
for( long i = 0; i < nCount; i++ )
{
const XDashEntry* pEntry = pList->GetDash(i);
const BitmapEx aBitmap = pList->GetUiBitmap( i );
if( !aBitmap.IsEmpty() )
{
InsertEntry(pEntry->GetName(), Image(aBitmap));
}
else
InsertEntry( pEntry->GetName() );
}
AdaptDropDownLineCountToMaximum();
SetUpdateMode( true );
}
IMPL_LINK_NOARG(SvxLineBox, DelayHdl_Impl, Timer *, void)
{
if ( GetEntryCount() == 0 )
{
mpSh = SfxObjectShell::Current();
FillControl();
}
}
void SvxLineBox::Select()
{
// Call the parent's Select() member to trigger accessibility events.
ListBox::Select();
if ( IsTravelSelect() )
return;
drawing::LineStyle eXLS;
sal_Int32 nPos = GetSelectedEntryPos();
switch ( nPos )
{
case 0:
eXLS = drawing::LineStyle_NONE;
break;
case 1:
eXLS = drawing::LineStyle_SOLID;
break;
default:
{
eXLS = drawing::LineStyle_DASH;
if ( nPos != LISTBOX_ENTRY_NOTFOUND &&
SfxObjectShell::Current() &&
SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) )
{
// LineDashItem will only be sent if it also has a dash.
// Notify cares!
SvxDashListItem const * pItem = SfxObjectShell::Current()->GetItem( SID_DASH_LIST );
XLineDashItem aLineDashItem( GetSelectedEntry(),
pItem->GetDashList()->GetDash( nPos - 2 )->GetDash() );
Any a;
Sequence< PropertyValue > aArgs( 1 );
aArgs[0].Name = "LineDash";
aLineDashItem.QueryValue ( a );
aArgs[0].Value = a;
SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
".uno:LineDash",
aArgs );
}
}
break;
}
XLineStyleItem aLineStyleItem( eXLS );
Any a;
Sequence< PropertyValue > aArgs( 1 );
aArgs[0].Name = "XLineStyle";
aLineStyleItem.QueryValue ( a );
aArgs[0].Value = a;
SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( mxFrame->getController(), UNO_QUERY ),
".uno:XLineStyle",
aArgs );
nCurPos = GetSelectedEntryPos();
ReleaseFocus_Impl();
}
bool SvxLineBox::PreNotify( NotifyEvent& rNEvt )
{
MouseNotifyEvent nType = rNEvt.GetType();
switch(nType)
{
case MouseNotifyEvent::MOUSEBUTTONDOWN:
case MouseNotifyEvent::GETFOCUS:
nCurPos = GetSelectedEntryPos();
break;
case MouseNotifyEvent::LOSEFOCUS:
SelectEntryPos(nCurPos);
break;
case MouseNotifyEvent::KEYINPUT:
{
const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
if( pKEvt->GetKeyCode().GetCode() == KEY_TAB)
{
bRelease = false;
Select();
}
}
break;
default:
break;
}
return ListBox::PreNotify( rNEvt );
}
bool SvxLineBox::EventNotify( NotifyEvent& rNEvt )
{
bool bHandled = ListBox::EventNotify( rNEvt );
if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT )
{
const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
switch ( pKEvt->GetKeyCode().GetCode() )
{
case KEY_RETURN:
Select();
bHandled = true;
break;
case KEY_ESCAPE:
SelectEntryPos( nCurPos );
ReleaseFocus_Impl();
bHandled = true;
break;
}
}
return bHandled;
}
void SvxLineBox::ReleaseFocus_Impl()
{
if(!bRelease)
{
bRelease = true;
return;
}
if( SfxViewShell::Current() )
{
vcl::Window* pShellWnd = SfxViewShell::Current()->GetWindow();
if ( pShellWnd )
pShellWnd->GrabFocus();
}
}
void SvxLineBox::DataChanged( const DataChangedEvent& rDCEvt )
{
if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
{
SetSizePixel(LogicToPixel(aLogicalSize, MapMode(MapUnit::MapAppFont)));
}
ListBox::DataChanged( rDCEvt );
}
void SvxLineBox::FillControl()
{
// FillStyles();
if ( !mpSh )
mpSh = SfxObjectShell::Current();
if( mpSh )
{
const SvxDashListItem* pItem = mpSh->GetItem( SID_DASH_LIST );
if ( pItem )
Fill( pItem->GetDashList() );
}
}
SvxMetricField::SvxMetricField(
vcl::Window* pParent, const Reference< XFrame >& rFrame )
: MetricField(pParent, WB_BORDER | WB_SPIN | WB_REPEAT)
@ -303,7 +77,6 @@ SvxMetricField::SvxMetricField(
Show();
}
void SvxMetricField::Update( const XLineWidthItem* pItem )
{
if ( pItem )
@ -315,7 +88,6 @@ void SvxMetricField::Update( const XLineWidthItem* pItem )
SetText( "" );
}
void SvxMetricField::Modify()
{
MetricField::Modify();
@ -332,7 +104,6 @@ void SvxMetricField::Modify()
aArgs );
}
void SvxMetricField::ReleaseFocus_Impl()
{
if( SfxViewShell::Current() )

View File

@ -19,6 +19,8 @@
#include <string>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <vcl/toolbox.hxx>
#include <sfx2/app.hxx>
#include <sfx2/dispatch.hxx>
@ -42,6 +44,7 @@
#include <svx/linectrl.hxx>
#include <svx/itemwin.hxx>
#include <svx/dialmgr.hxx>
#include <svx/tbxcolorupdate.hxx>
#include <svx/unoapi.hxx>
#include <memory>
@ -55,198 +58,171 @@ using namespace ::com::sun::star;
// For End Line Controller
#define MAX_LINES 12
SFX_IMPL_TOOLBOX_CONTROL( SvxLineStyleToolBoxControl, XLineStyleItem );
SFX_IMPL_TOOLBOX_CONTROL( SvxLineWidthToolBoxControl, XLineWidthItem );
SvxLineStyleToolBoxControl::SvxLineStyleToolBoxControl( sal_uInt16 nSlotId,
sal_uInt16 nId,
ToolBox& rTbx ) :
SfxToolBoxControl( nSlotId, nId, rTbx ),
bUpdate ( false )
SvxLineStyleToolBoxControl::SvxLineStyleToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext )
: svt::PopupWindowController( rContext, nullptr, OUString() )
{
addStatusListener( ".uno:LineDash");
addStatusListener( ".uno:DashListState");
addStatusListener(".uno:LineDash");
}
SvxLineStyleToolBoxControl::~SvxLineStyleToolBoxControl()
{
}
void SvxLineStyleToolBoxControl::StateChanged (
sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
void SAL_CALL SvxLineStyleToolBoxControl::statusChanged( const frame::FeatureStateEvent& rEvent )
{
SvxLineBox* pBox = static_cast<SvxLineBox*>( GetToolBox().GetItemWindow( GetId() ) );
DBG_ASSERT( pBox, "Window not found!" );
ToolBox* pToolBox = nullptr;
sal_uInt16 nId = 0;
if (!getToolboxId(nId, &pToolBox) && !m_pToolbar)
return;
if( eState == SfxItemState::DISABLED )
OString sId(m_aCommandURL.toUtf8());
if ( rEvent.FeatureURL.Complete == m_aCommandURL )
{
pBox->Disable();
pBox->SetNoSelection();
}
else
{
pBox->Enable();
if ( eState == SfxItemState::DEFAULT )
{
if( nSID == SID_ATTR_LINE_STYLE )
{
pStyleItem.reset( static_cast<XLineStyleItem*>(pState->Clone()) );
}
else if( nSID == SID_ATTR_LINE_DASH )
{
pDashItem.reset( static_cast<XLineDashItem*>(pState->Clone()) );
}
bUpdate = true;
Update( pState );
}
else if ( nSID != SID_DASH_LIST )
{
// no or ambiguous status
pBox->SetNoSelection();
}
}
}
void SvxLineStyleToolBoxControl::Update( const SfxPoolItem* pState )
{
if ( pState && bUpdate )
{
bUpdate = false;
SvxLineBox* pBox = static_cast<SvxLineBox*>(GetToolBox().GetItemWindow( GetId() ));
DBG_ASSERT( pBox, "Window not found!" );
// Since the timer can strike unexpectedly, it may happen that
// the LB is not yet filled. A ClearCache() on the control
// in DelayHdl () was unsuccessful.
if( pBox->GetEntryCount() == 0 )
pBox->FillControl();
drawing::LineStyle eXLS;
if ( pStyleItem )
eXLS = pStyleItem->GetValue();
if (m_pToolbar)
m_pToolbar->set_item_sensitive(sId, rEvent.IsEnabled);
else
eXLS = drawing::LineStyle_NONE;
pToolBox->EnableItem( nId, rEvent.IsEnabled );
}
switch( eXLS )
m_xBtnUpdater->Update(rEvent);
SfxObjectShell* pSh = SfxObjectShell::Current();
if (pSh)
{
const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST );
if (pItem)
{
case drawing::LineStyle_NONE:
pBox->SelectEntryPos( 0 );
break;
case drawing::LineStyle_SOLID:
pBox->SelectEntryPos( 1 );
break;
case drawing::LineStyle_DASH:
XDashListRef xList = pItem->GetDashList();
int nIndex = m_xBtnUpdater->GetStyleIndex();
switch (nIndex)
{
if( pDashItem )
case -1:
case 0:
{
OUString aString = SvxUnogetInternalNameForItem(
XATTR_LINEDASH, pDashItem->GetName());
pBox->SelectEntry( aString );
BitmapEx aEmpty(xList->GetBitmapForUISolidLine());
aEmpty.Erase(Application::GetSettings().GetStyleSettings().GetFieldColor());
if (m_pToolbar)
{
Graphic aGraf(aEmpty);
m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
}
else
pToolBox->SetItemImage(nId, Image(aEmpty));
break;
}
else
pBox->SetNoSelection();
case 1:
if (m_pToolbar)
{
Graphic aGraf(xList->GetBitmapForUISolidLine());
m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
}
else
pToolBox->SetItemImage(nId, Image(xList->GetBitmapForUISolidLine()));
break;
default:
if (m_pToolbar)
{
Graphic aGraf(xList->GetUiBitmap(nIndex - 2));
m_pToolbar->set_item_image(sId, aGraf.GetXGraphic());
}
else
pToolBox->SetItemImage(nId, Image(xList->GetUiBitmap(nIndex - 2)));
break;
}
break;
default:
OSL_FAIL( "Unsupported type of line" );
break;
}
}
}
if ( auto pDashListItem = dynamic_cast<const SvxDashListItem*>( pState) )
void SAL_CALL SvxLineStyleToolBoxControl::execute(sal_Int16 /*KeyModifier*/)
{
if (m_pToolbar)
{
// The list of line styles has changed
SvxLineBox* pBox = static_cast<SvxLineBox*>(GetToolBox().GetItemWindow( GetId() ));
DBG_ASSERT( pBox, "Window not found!" );
OUString aString( pBox->GetSelectedEntry() );
pBox->Clear();
pBox->InsertEntry( SvxResId(RID_SVXSTR_INVISIBLE) );
pBox->InsertEntry( SvxResId(RID_SVXSTR_SOLID) );
pBox->Fill( pDashListItem->GetDashList() );
pBox->SelectEntry( aString );
}
}
VclPtr<vcl::Window> SvxLineStyleToolBoxControl::CreateItemWindow( vcl::Window *pParent )
{
return VclPtr<SvxLineBox>::Create( pParent, m_xFrame ).get();
}
SvxLineWidthToolBoxControl::SvxLineWidthToolBoxControl(
sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
SfxToolBoxControl( nSlotId, nId, rTbx )
{
addStatusListener( ".uno:MetricUnit");
}
SvxLineWidthToolBoxControl::~SvxLineWidthToolBoxControl()
{
}
void SvxLineWidthToolBoxControl::StateChanged(
sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
{
SvxMetricField* pFld = static_cast<SvxMetricField*>(
GetToolBox().GetItemWindow( GetId() ));
DBG_ASSERT( pFld, "Window not found" );
if ( nSID == SID_ATTR_METRIC )
{
pFld->RefreshDlgUnit();
// Toggle the popup also when toolbutton is activated
const OString aId(m_aCommandURL.toUtf8());
m_pToolbar->set_menu_item_active(aId, !m_pToolbar->get_menu_item_active(aId));
}
else
{
if ( eState == SfxItemState::DISABLED )
{
pFld->Disable();
pFld->SetText( "" );
}
else
{
pFld->Enable();
if ( eState == SfxItemState::DEFAULT )
{
DBG_ASSERT( dynamic_cast<const XLineWidthItem*>( pState) != nullptr, "wrong ItemType" );
// Core-Unit handed over to MetricField
// Should not happen in CreateItemWin ()!
// CD!!! GetCoreMetric();
pFld->SetCoreUnit( MapUnit::Map100thMM );
pFld->Update( static_cast<const XLineWidthItem*>(pState) );
}
else
pFld->Update( nullptr );
}
// Open the popup also when Enter key is pressed.
createPopupWindow();
}
}
VclPtr<vcl::Window> SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *pParent )
void SvxLineStyleToolBoxControl::initialize( const css::uno::Sequence<css::uno::Any>& rArguments )
{
return VclPtr<SvxMetricField>::Create( pParent, m_xFrame ).get();
svt::PopupWindowController::initialize( rArguments );
if (m_pToolbar)
{
mxPopoverContainer.reset(new ToolbarPopupContainer(m_pToolbar));
m_pToolbar->set_item_popover(m_aCommandURL.toUtf8(), mxPopoverContainer->getTopLevel());
}
ToolBox* pToolBox = nullptr;
sal_uInt16 nId = 0;
if ( getToolboxId( nId, &pToolBox ) )
{
pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY );
}
m_xBtnUpdater.reset(new svx::ToolboxButtonLineStyleUpdater);
}
void SvxLineStyleToolBoxControl::setLineStyleSelectFunction(const LineStyleSelectFunction& rLineStyleSelectFunction)
{
m_aLineStyleSelectFunction = rLineStyleSelectFunction;
}
void SvxLineStyleToolBoxControl::dispatchLineStyleCommand(const OUString& rCommand, const Sequence<PropertyValue>& rArgs)
{
if (m_aLineStyleSelectFunction && m_aLineStyleSelectFunction(rCommand, rArgs[0].Value))
return;
dispatchCommand(rCommand, rArgs);
}
int SvxLineStyleToolBoxControl::GetStyleIndex() const
{
return m_xBtnUpdater->GetStyleIndex();
}
std::unique_ptr<WeldToolbarPopup> SvxLineStyleToolBoxControl::weldPopupWindow()
{
return std::make_unique<SvxLineBox>(this, m_pToolbar, m_xBtnUpdater->GetStyleIndex());
}
VclPtr<vcl::Window> SvxLineStyleToolBoxControl::createVclPopupWindow( vcl::Window* pParent )
{
mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent,
std::make_unique<SvxLineBox>(this, pParent->GetFrameWeld(), m_xBtnUpdater->GetStyleIndex()));
mxInterimPopover->Show();
return mxInterimPopover;
}
OUString SvxLineStyleToolBoxControl::getImplementationName()
{
return "com.sun.star.comp.svx.LineStyleToolBoxControl";
}
css::uno::Sequence<OUString> SvxLineStyleToolBoxControl::getSupportedServiceNames()
{
return { "com.sun.star.frame.ToolbarController" };
}
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
com_sun_star_comp_svx_LineStyleToolBoxControl_get_implementation(
css::uno::XComponentContext* rContext,
css::uno::Sequence<css::uno::Any> const & )
{
return cppu::acquire( new SvxLineStyleToolBoxControl( rContext ) );
}
namespace {
class SvxLineEndToolBoxControl : public svt::PopupWindowController
class SvxLineEndToolBoxControl final : public svt::PopupWindowController
{
public:
explicit SvxLineEndToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext );
@ -529,4 +505,136 @@ com_sun_star_comp_svx_LineEndToolBoxControl_get_implementation(
return cppu::acquire( new SvxLineEndToolBoxControl( rContext ) );
}
SvxLineBox::SvxLineBox(SvxLineStyleToolBoxControl* pControl, weld::Widget* pParent, int nInitialIndex)
: WeldToolbarPopup(pControl->getFrameInterface(), pParent, "svx/ui/floatinglinestyle.ui", "FloatingLineStyle")
, mxControl(pControl)
, mxLineStyleSet(new SvtValueSet(m_xBuilder->weld_scrolled_window("valuesetwin")))
, mxLineStyleSetWin(new weld::CustomWeld(*m_xBuilder, "valueset", *mxLineStyleSet))
{
mxLineStyleSet->SetStyle(WB_FLATVALUESET | WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT);
FillControl();
mxLineStyleSet->SelectItem(nInitialIndex + 1);
mxLineStyleSet->SetSelectHdl( LINK( this, SvxLineBox, SelectHdl ) );
}
void SvxLineBox::GrabFocus()
{
mxLineStyleSet->GrabFocus();
}
SvxLineBox::~SvxLineBox()
{
}
// Fills the listbox (provisional) with strings
void SvxLineBox::Fill( const XDashListRef &pList )
{
mxLineStyleSet->Clear();
if( !pList.is() )
return;
// entry for 'none'
mxLineStyleSet->InsertItem(1, Image(), pList->GetStringForUiNoLine());
// entry for solid line
auto aBmp = pList->GetBitmapForUISolidLine();
Size aBmpSize = aBmp.GetSizePixel();
mxLineStyleSet->InsertItem(2, Image(aBmp), pList->GetStringForUiSolidLine());
// entries for dashed lines
long nCount = pList->Count();
for( long i = 0; i < nCount; i++ )
{
const XDashEntry* pEntry = pList->GetDash(i);
const BitmapEx aBitmap = pList->GetUiBitmap(i);
mxLineStyleSet->InsertItem(i + 3, Image(aBitmap), pEntry->GetName());
}
sal_uInt16 nLines = std::min( static_cast<sal_uInt16>(nCount + 2), sal_uInt16(MAX_LINES) );
mxLineStyleSet->SetLineCount(nLines);
WinBits nBits = mxLineStyleSet->GetStyle();
if ( nLines == mxLineStyleSet->GetItemCount() )
nBits &= ~WB_VSCROLL;
else
nBits |= WB_VSCROLL;
mxLineStyleSet->SetStyle( nBits );
Size aSize(aBmpSize);
aSize.AdjustWidth(6);
aSize.AdjustHeight(6);
aSize = mxLineStyleSet->CalcWindowSizePixel(aSize);
mxLineStyleSet->GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height());
mxLineStyleSet->SetOutputSizePixel(aSize);
}
IMPL_LINK_NOARG(SvxLineBox, SelectHdl, SvtValueSet*, void)
{
drawing::LineStyle eXLS;
sal_Int32 nPos = mxLineStyleSet->GetSelectedItemId();
--nPos; // ids start at 1, get the pos of the id
switch ( nPos )
{
case 0:
eXLS = drawing::LineStyle_NONE;
break;
case 1:
eXLS = drawing::LineStyle_SOLID;
break;
default:
{
eXLS = drawing::LineStyle_DASH;
if ( nPos != -1 &&
SfxObjectShell::Current() &&
SfxObjectShell::Current()->GetItem( SID_DASH_LIST ) )
{
// LineDashItem will only be sent if it also has a dash.
// Notify cares!
SvxDashListItem const * pItem = SfxObjectShell::Current()->GetItem( SID_DASH_LIST );
const XDashEntry* pEntry = pItem->GetDashList()->GetDash(nPos - 2);
XLineDashItem aLineDashItem(pEntry->GetName(), pEntry->GetDash());
Any a;
Sequence< PropertyValue > aArgs( 1 );
aArgs[0].Name = "LineDash";
aLineDashItem.QueryValue ( a );
aArgs[0].Value = a;
mxControl->dispatchLineStyleCommand(".uno:LineDash", aArgs);
}
}
break;
}
XLineStyleItem aLineStyleItem( eXLS );
Any a;
Sequence< PropertyValue > aArgs( 1 );
aArgs[0].Name = "XLineStyle";
aLineStyleItem.QueryValue ( a );
aArgs[0].Value = a;
mxControl->dispatchLineStyleCommand(".uno:XLineStyle", aArgs);
mxControl->EndPopupMode();
}
void SvxLineBox::FillControl()
{
SfxObjectShell* pSh = SfxObjectShell::Current();
if (pSh)
{
const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST );
if (pItem)
Fill(pItem->GetDashList());
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -0,0 +1,116 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <string>
#include <vcl/toolbox.hxx>
#include <sfx2/app.hxx>
#include <sfx2/dispatch.hxx>
#include <sfx2/objsh.hxx>
#include <svtools/toolbarmenu.hxx>
#include <svtools/popupwindowcontroller.hxx>
#include <svtools/valueset.hxx>
#include <svx/strings.hrc>
#include <svx/svxids.hrc>
#include <helpids.h>
#include <svx/drawitem.hxx>
#include <svx/xlineit0.hxx>
#include <svx/xlnwtit.hxx>
#include <svx/xlndsit.hxx>
#include <svx/xlnstit.hxx>
#include <svx/xlnedit.hxx>
#include <svx/xtable.hxx>
#include <svx/linectrl.hxx>
#include <svx/itemwin.hxx>
#include <svx/dialmgr.hxx>
#include <svx/tbxcolorupdate.hxx>
#include <svx/unoapi.hxx>
#include <memory>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star;
SFX_IMPL_TOOLBOX_CONTROL( SvxLineWidthToolBoxControl, XLineWidthItem );
SvxLineWidthToolBoxControl::SvxLineWidthToolBoxControl(
sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
SfxToolBoxControl( nSlotId, nId, rTbx )
{
addStatusListener( ".uno:MetricUnit");
}
SvxLineWidthToolBoxControl::~SvxLineWidthToolBoxControl()
{
}
void SvxLineWidthToolBoxControl::StateChanged(
sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
{
SvxMetricField* pFld = static_cast<SvxMetricField*>(
GetToolBox().GetItemWindow( GetId() ));
DBG_ASSERT( pFld, "Window not found" );
if ( nSID == SID_ATTR_METRIC )
{
pFld->RefreshDlgUnit();
}
else
{
if ( eState == SfxItemState::DISABLED )
{
pFld->Disable();
pFld->SetText( "" );
}
else
{
pFld->Enable();
if ( eState == SfxItemState::DEFAULT )
{
DBG_ASSERT( dynamic_cast<const XLineWidthItem*>( pState) != nullptr, "wrong ItemType" );
// Core-Unit handed over to MetricField
// Should not happen in CreateItemWin ()!
// CD!!! GetCoreMetric();
pFld->SetCoreUnit( MapUnit::Map100thMM );
pFld->Update( static_cast<const XLineWidthItem*>(pState) );
}
else
pFld->Update( nullptr );
}
}
}
VclPtr<vcl::Window> SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *pParent )
{
return VclPtr<SvxMetricField>::Create( pParent, m_xFrame ).get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -17,9 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <sfx2/objsh.hxx>
#include <svx/drawitem.hxx>
#include <svx/tbxcolorupdate.hxx>
#include <svx/svxids.hrc>
#include <svx/unomid.hxx>
#include <svx/xdef.hxx>
#include <svx/xlineit0.hxx>
#include <svx/xlndsit.hxx>
#include <vcl/commandinfoprovider.hxx>
#include <vcl/svapp.hxx>
@ -275,6 +280,67 @@ namespace svx
return Size(nWidth, nHeight);
}
ToolboxButtonLineStyleUpdater::ToolboxButtonLineStyleUpdater()
: m_eXLS(css::drawing::LineStyle_NONE)
, m_nDashStyleIndex(-1)
{
}
void ToolboxButtonLineStyleUpdater::Update(const com::sun::star::frame::FeatureStateEvent& rEvent)
{
if (rEvent.FeatureURL.Complete == ".uno:LineDash")
{
m_nDashStyleIndex = -1;
SfxObjectShell* pSh = SfxObjectShell::Current();
if (!pSh)
return;
const SvxDashListItem* pItem = pSh->GetItem( SID_DASH_LIST );
if (!pItem)
return;
XLineDashItem aDashItem;
aDashItem.PutValue(rEvent.State, 0);
const XDash& rDash = aDashItem.GetDashValue();
XDashListRef xLineStyleList = pItem->GetDashList();
for (long i = 0; i < xLineStyleList->Count(); ++i)
{
const XDashEntry* pEntry = xLineStyleList->GetDash(i);
const XDash& rEntry = pEntry->GetDash();
if (rDash == rEntry)
{
m_nDashStyleIndex = i;
break;
}
}
}
else if (rEvent.FeatureURL.Complete == ".uno:XLineStyle")
{
XLineStyleItem aLineStyleItem;
aLineStyleItem.PutValue(rEvent.State, 0);
m_eXLS = aLineStyleItem.GetValue();
}
}
int ToolboxButtonLineStyleUpdater::GetStyleIndex() const
{
int nRet;
switch (m_eXLS)
{
case css::drawing::LineStyle_NONE:
nRet = 0;
break;
case css::drawing::LineStyle_SOLID:
nRet = 1;
break;
default:
nRet = m_nDashStyleIndex + 2;
break;
}
return nRet;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="sc">
<requires lib="gtk+" version="3.18"/>
<object class="GtkPopover" id="FloatingLineStyle">
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="border_width">4</property>
<child>
<object class="GtkBox" id="container">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkScrolledWindow" id="valuesetwin">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkDrawingArea" id="valueset">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@ -7,18 +7,6 @@
<property name="step_increment">10</property>
<property name="page_increment">20</property>
</object>
<object class="GtkListStore" id="liststore5">
<columns>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
<!-- column-name image -->
<column type="GdkPixbuf"/>
<!-- column-name surface -->
<column type="CairoSurface"/>
</columns>
</object>
<object class="GtkGrid" id="LinePropertyPanel">
<property name="visible">True</property>
<property name="can_focus">False</property>
@ -42,33 +30,13 @@
<property name="can_focus">False</property>
<property name="spacing">3</property>
<child>
<object class="GtkComboBox" id="linestyle">
<property name="width_request">105</property>
<object class="GtkLabel" id="linelabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes" context="sidebarline|linestyle|tooltip_text">Select the style of the line.</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="model">liststore5</property>
<property name="entry_text_column">0</property>
<property name="id_column">1</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext7"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
<child>
<object class="GtkCellRendererPixbuf" id="cellrenderertext11"/>
<attributes>
<attribute name="surface">3</attribute>
</attributes>
</child>
<child internal-child="accessible">
<object class="AtkObject" id="linestyle-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="sidebarline|linestyle-atkobject">Style</property>
</object>
</child>
<property name="label" translatable="yes" context="sidebarline|widthlabel">_Line:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">linestyle</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@ -77,18 +45,17 @@
</packing>
</child>
<child>
<object class="GtkToolbar" id="arrowheads">
<object class="GtkToolbar" id="linestyle">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes" context="sidebarline|arrowheads|tooltip_text">Select the style of the arrowheads.</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">
<object class="GtkMenuToolButton" id=".uno:XLineStyle">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes" context="sidebarline|arrowheads|tooltip_text">Select the style of the arrowheads.</property>
<property name="tooltip_text" translatable="yes" context="sidebarline|linestyle|tooltip_text">Select the style of the line.</property>
<property name="use_underline">True</property>
</object>
<packing>
@ -96,10 +63,17 @@
<property name="homogeneous">False</property>
</packing>
</child>
<child internal-child="accessible">
<object class="AtkObject" id="arrowheads-atkobject">
<property name="AtkObject::accessible-name" context="sidebarline|arrowheads-atkobject" translatable="yes">Arrow Styles</property>
<child>
<object class="GtkMenuToolButton" id=".uno:LineEndStyle">
<property name="visible">True</property>
<property name="can_focus">False</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>
</object>
<packing>
@ -360,4 +334,24 @@
<widget name="color"/>
</widgets>
</object>
<object class="GtkSizeGroup">
<widgets>
<widget name="linelabel"/>
<widget name="widthlabel"/>
<widget name="colorlabel"/>
<widget name="translabel"/>
</widgets>
</object>
<object class="GtkListStore" id="liststore5">
<columns>
<!-- column-name text -->
<column type="gchararray"/>
<!-- column-name id -->
<column type="gchararray"/>
<!-- column-name image -->
<column type="GdkPixbuf"/>
<!-- column-name surface -->
<column type="CairoSurface"/>
</columns>
</object>
</interface>

View File

@ -100,10 +100,6 @@
constructor="com_sun_star_comp_svx_SmartTagMenuController_get_implementation">
<service name="com.sun.star.frame.PopupMenuController"/>
</implementation>
<implementation name="com.sun.star.comp.svx.LineEndToolBoxControl"
constructor="com_sun_star_comp_svx_LineEndToolBoxControl_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
<implementation name="com.sun.star.comp.svx.LineSpacingToolBoxControl"
constructor="com_sun_star_comp_svx_LineSpacingToolBoxControl_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>

View File

@ -62,6 +62,14 @@
constructor="com_sun_star_comp_svx_FontNameToolBoxControl_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
<implementation name="com.sun.star.comp.svx.LineEndToolBoxControl"
constructor="com_sun_star_comp_svx_LineEndToolBoxControl_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
<implementation name="com.sun.star.comp.svx.LineStyleToolBoxControl"
constructor="com_sun_star_comp_svx_LineStyleToolBoxControl_get_implementation">
<service name="com.sun.star.frame.ToolbarController"/>
</implementation>
<implementation name="com.sun.star.comp.Svx.GraphicExportHelper"
constructor="com_sun_star_comp_Svx_GraphicExportHelper_get_implementation">
<service name="com.sun.star.document.BinaryStreamResolver"/>

View File

@ -284,7 +284,6 @@ void SwDLL::RegisterControls()
svx::FormatPaintBrushToolBoxControl::RegisterControl(SID_FORMATPAINTBRUSH, pMod );
SvxFillToolBoxControl::RegisterControl(SID_ATTR_FILL_STYLE, pMod );
SvxLineStyleToolBoxControl::RegisterControl(SID_ATTR_LINE_STYLE, pMod );
SvxLineWidthToolBoxControl::RegisterControl(SID_ATTR_LINE_WIDTH, pMod );
SvxStyleToolBoxControl::RegisterControl(SID_STYLE_APPLY, pMod );

View File

@ -7405,7 +7405,7 @@ private:
gtk_tool_button_set_icon_widget(pItem, pImage);
}
static void set_item_image(GtkToolButton* pItem, VirtualDevice* pDevice)
void set_item_image(GtkToolButton* pItem, VirtualDevice* pDevice)
{
GtkWidget* pImage = nullptr;
@ -7416,6 +7416,7 @@ private:
}
gtk_tool_button_set_icon_widget(pItem, pImage);
gtk_widget_queue_draw(GTK_WIDGET(m_pToolbar));
}
public: