diff options
Diffstat (limited to 'svx')
-rw-r--r-- | svx/Library_svx.mk | 1 | ||||
-rw-r--r-- | svx/UIConfig_svx.mk | 1 | ||||
-rw-r--r-- | svx/sdi/svx.sdi | 51 | ||||
-rw-r--r-- | svx/source/sidebar/PanelFactory.cxx | 5 | ||||
-rw-r--r-- | svx/source/sidebar/glow/GlowPropertyPanel.cxx | 169 | ||||
-rw-r--r-- | svx/source/sidebar/glow/GlowPropertyPanel.hxx | 60 | ||||
-rw-r--r-- | svx/source/svdraw/svdattr.cxx | 4 | ||||
-rw-r--r-- | svx/uiconfig/ui/sidebarglow.ui | 128 |
8 files changed, 419 insertions, 0 deletions
diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index a7d72db44ccd..d3eff20b6769 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -197,6 +197,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/sidebar/area/AreaPropertyPanel \ svx/source/sidebar/area/AreaPropertyPanelBase \ svx/source/sidebar/area/AreaTransparencyGradientPopup \ + svx/source/sidebar/glow/GlowPropertyPanel \ svx/source/sidebar/shadow/ShadowPropertyPanel \ svx/source/sidebar/graphic/GraphicPropertyPanel \ svx/source/sidebar/line/LinePropertyPanel \ diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index 542c42ad8b7b..414361b8a316 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -115,6 +115,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/selectionmenu \ svx/uiconfig/ui/sidebararea \ svx/uiconfig/ui/sidebarempty \ + svx/uiconfig/ui/sidebarglow \ svx/uiconfig/ui/sidebarshadow \ svx/uiconfig/ui/sidebargallery \ svx/uiconfig/ui/sidebargraphic \ diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index d8a8af6c71e6..433bde068fb6 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -12218,3 +12218,54 @@ SfxVoidItem AccessibilityCheck SID_ACCESSIBILITY_CHECK ToolBoxConfig = FALSE, GroupId = SfxGroupId::Modify; ] + +SdrOnOffItem Glow SID_ATTR_GLOW + +[ + AutoUpdate = TRUE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = TRUE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = FALSE, + MenuConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Document; +] + +XColorItem GlowColor SID_ATTR_GLOW_COLOR + +[ + AutoUpdate = TRUE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = FALSE, + MenuConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = SfxGroupId::Document; +] + +SdrMetricItem GlowRadius SID_ATTR_GLOW_RADIUS + +[ + AutoUpdate = TRUE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = FALSE, + MenuConfig = FALSE, + ToolBoxConfig = FALSE, + GroupId = SfxGroupId::Document; +] diff --git a/svx/source/sidebar/PanelFactory.cxx b/svx/source/sidebar/PanelFactory.cxx index 5800099ecfa8..38e252c9b820 100644 --- a/svx/source/sidebar/PanelFactory.cxx +++ b/svx/source/sidebar/PanelFactory.cxx @@ -24,6 +24,7 @@ #include "paragraph/ParaPropertyPanel.hxx" #include "lists/ListsPropertyPanel.hxx" #include "area/AreaPropertyPanel.hxx" +#include "glow/GlowPropertyPanel.hxx" #include "shadow/ShadowPropertyPanel.hxx" #include "graphic/GraphicPropertyPanel.hxx" #include "line/LinePropertyPanel.hxx" @@ -138,6 +139,10 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( { pControl = AreaPropertyPanel::Create(pParentWindow, xFrame, pBindings); } + else if (rsResourceURL.endsWith("/GlowPropertyPanel")) + { + pControl = GlowPropertyPanel::Create(pParentWindow, xFrame, pBindings); + } else if (rsResourceURL.endsWith("/ShadowPropertyPanel")) { pControl = ShadowPropertyPanel::Create(pParentWindow, xFrame, pBindings); diff --git a/svx/source/sidebar/glow/GlowPropertyPanel.cxx b/svx/source/sidebar/glow/GlowPropertyPanel.cxx new file mode 100644 index 000000000000..545394e5f7b6 --- /dev/null +++ b/svx/source/sidebar/glow/GlowPropertyPanel.cxx @@ -0,0 +1,169 @@ +/* -*- 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/. + */ + +#include <sal/config.h> + +#include "GlowPropertyPanel.hxx" + +#include <sfx2/dispatch.hxx> +#include <svx/colorbox.hxx> +#include <svx/sdmetitm.hxx> +#include <svx/sdooitm.hxx> +#include <svx/svddef.hxx> +#include <svx/svxids.hrc> +#include <svx/xcolit.hxx> + +namespace +{ +sal_Int32 EMU2Pt(sal_Int32 nEMU) +{ + return static_cast<sal_Int32>(rtl::math::round(nEMU / 12700.0)); +} +sal_Int32 Pt2EMU(sal_Int32 nPt) { return nPt * 12700; } +} + +namespace svx::sidebar +{ +GlowPropertyPanel::GlowPropertyPanel(vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) + : PanelLayout(pParent, "GlowPropertyPanel", "svx/ui/sidebarglow.ui", rxFrame, true) + , maGlowController(SID_ATTR_GLOW, *pBindings, *this) + , maGlowColorController(SID_ATTR_GLOW_COLOR, *pBindings, *this) + , maGlowRadiusController(SID_ATTR_GLOW_RADIUS, *pBindings, *this) + , mpBindings(pBindings) + , mxShowGlow(m_xBuilder->weld_check_button("SHOW_GLOW")) + , mxGlowRadius(m_xBuilder->weld_metric_spin_button("LB_GLOW_RADIUS", FieldUnit::POINT)) + , mxLBGlowColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_GLOW_COLOR"), GetFrameWeld())) + , mxFTRadius(m_xBuilder->weld_label("radius")) + , mxFTColor(m_xBuilder->weld_label("color")) +{ + Initialize(); +} + +GlowPropertyPanel::~GlowPropertyPanel() { disposeOnce(); } + +void GlowPropertyPanel::dispose() +{ + mxShowGlow.reset(); + mxFTRadius.reset(); + mxGlowRadius.reset(); + mxFTColor.reset(); + mxLBGlowColor.reset(); + + maGlowController.dispose(); + maGlowColorController.dispose(); + maGlowRadiusController.dispose(); + PanelLayout::dispose(); +} + +void GlowPropertyPanel::Initialize() +{ + mxShowGlow->set_state(TRISTATE_FALSE); + mxShowGlow->connect_toggled(LINK(this, GlowPropertyPanel, ClickGlowHdl)); + mxLBGlowColor->SetSelectHdl(LINK(this, GlowPropertyPanel, ModifyGlowColorHdl)); + mxGlowRadius->connect_value_changed(LINK(this, GlowPropertyPanel, ModifyGlowRadiusHdl)); +} + +IMPL_LINK_NOARG(GlowPropertyPanel, ClickGlowHdl, weld::ToggleButton&, void) +{ + SdrOnOffItem aItem(SDRATTR_GLOW, mxShowGlow->get_state() != TRISTATE_FALSE); + mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_GLOW, SfxCallMode::RECORD, { &aItem }); +} + +IMPL_LINK_NOARG(GlowPropertyPanel, ModifyGlowColorHdl, ColorListBox&, void) +{ + XColorItem aItem(SDRATTR_GLOW_COLOR, mxLBGlowColor->GetSelectEntryColor()); + mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_GLOW_COLOR, SfxCallMode::RECORD, { &aItem }); +} + +IMPL_LINK_NOARG(GlowPropertyPanel, ModifyGlowRadiusHdl, weld::MetricSpinButton&, void) +{ + SdrMetricItem aItem(SDRATTR_GLOW_RAD, Pt2EMU(mxGlowRadius->get_value(FieldUnit::POINT))); + mpBindings->GetDispatcher()->ExecuteList(SID_ATTR_GLOW_RADIUS, SfxCallMode::RECORD, { &aItem }); +} + +void GlowPropertyPanel::UpdateControls() +{ + const bool bEnabled = mxShowGlow->get_state() != TRISTATE_FALSE; + mxGlowRadius->set_sensitive(bEnabled); + mxLBGlowColor->set_sensitive(bEnabled); + mxFTRadius->set_sensitive(bEnabled); + mxFTColor->set_sensitive(bEnabled); +} + +void GlowPropertyPanel::NotifyItemUpdate(sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState) +{ + switch (nSID) + { + case SID_ATTR_GLOW: + { + if (eState >= SfxItemState::DEFAULT) + { + const SdrOnOffItem* pItem = dynamic_cast<const SdrOnOffItem*>(pState); + if (pItem) + { + if (pItem->GetValue()) + mxShowGlow->set_state(TRISTATE_TRUE); + else + mxShowGlow->set_state(TRISTATE_FALSE); + } + } + } + break; + + case SID_ATTR_GLOW_COLOR: + { + if (eState >= SfxItemState::DEFAULT) + { + const XColorItem* pColorItem = dynamic_cast<const XColorItem*>(pState); + if (pColorItem) + { + mxLBGlowColor->SelectEntry(pColorItem->GetColorValue()); + } + } + } + break; + case SID_ATTR_GLOW_RADIUS: + { + if (eState >= SfxItemState::DEFAULT) + { + const SdrMetricItem* pRadiusItem = dynamic_cast<const SdrMetricItem*>(pState); + if (pRadiusItem) + { + mxGlowRadius->set_value(EMU2Pt(pRadiusItem->GetValue()), FieldUnit::POINT); + } + } + } + break; + } + UpdateControls(); +} + +VclPtr<vcl::Window> +GlowPropertyPanel::Create(vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings) +{ + if (pParent == nullptr) + throw css::lang::IllegalArgumentException( + "no parent Window given to GlowPropertyPanel::Create", nullptr, 0); + if (!rxFrame.is()) + throw css::lang::IllegalArgumentException("no XFrame given to GlowPropertyPanel::Create", + nullptr, 1); + if (pBindings == nullptr) + throw css::lang::IllegalArgumentException( + "no SfxBindings given to GlowPropertyPanel::Create", nullptr, 2); + + return VclPtr<GlowPropertyPanel>::Create(pParent, rxFrame, pBindings); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sidebar/glow/GlowPropertyPanel.hxx b/svx/source/sidebar/glow/GlowPropertyPanel.hxx new file mode 100644 index 000000000000..fe954311ce1a --- /dev/null +++ b/svx/source/sidebar/glow/GlowPropertyPanel.hxx @@ -0,0 +1,60 @@ +/* -*- 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/. + */ +#ifndef INCLUDED_SVX_SOURCE_SIDEBAR_GLOW_GLOWPROPERTYPANEL_HXX +#define INCLUDED_SVX_SOURCE_SIDEBAR_GLOW_GLOWPROPERTYPANEL_HXX + +#include <vcl/vclptr.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <svx/sidebar/PanelLayout.hxx> + +class ColorListBox; + +namespace svx::sidebar +{ +class GlowPropertyPanel : public PanelLayout, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + GlowPropertyPanel(vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + virtual ~GlowPropertyPanel() override; + virtual void dispose() override; + + static VclPtr<vcl::Window> Create(vcl::Window* pParent, + const css::uno::Reference<css::frame::XFrame>& rxFrame, + SfxBindings* pBindings); + + virtual void NotifyItemUpdate(const sal_uInt16 nSId, const SfxItemState eState, + const SfxPoolItem* pState) override; + +private: + sfx2::sidebar::ControllerItem maGlowController; + sfx2::sidebar::ControllerItem maGlowColorController; + sfx2::sidebar::ControllerItem maGlowRadiusController; + + SfxBindings* mpBindings; + + std::unique_ptr<weld::CheckButton> mxShowGlow; + std::unique_ptr<weld::MetricSpinButton> mxGlowRadius; + std::unique_ptr<ColorListBox> mxLBGlowColor; + std::unique_ptr<weld::Label> mxFTRadius; + std::unique_ptr<weld::Label> mxFTColor; + + void Initialize(); + void UpdateControls(); + + DECL_LINK(ClickGlowHdl, weld::ToggleButton&, void); + DECL_LINK(ModifyGlowColorHdl, ColorListBox&, void); + DECL_LINK(ModifyGlowRadiusHdl, weld::MetricSpinButton&, void); +}; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index af8d7f7d45b9..38a1f235d583 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -344,6 +344,10 @@ SdrItemPool::SdrItemPool( mpLocalItemInfos[SDRATTR_TABLE_BORDER_TLBR - SDRATTR_START ]._nSID = SID_ATTR_BORDER_DIAG_TLBR; mpLocalItemInfos[SDRATTR_TABLE_BORDER_BLTR - SDRATTR_START ]._nSID = SID_ATTR_BORDER_DIAG_BLTR; + mpLocalItemInfos[SDRATTR_GLOW - SDRATTR_START]._nSID = SID_ATTR_GLOW; + mpLocalItemInfos[SDRATTR_GLOW_RAD - SDRATTR_START]._nSID = SID_ATTR_GLOW_RADIUS; + mpLocalItemInfos[SDRATTR_GLOW_COLOR - SDRATTR_START]._nSID = SID_ATTR_GLOW_COLOR; + // it's my own creation level, set Defaults and ItemInfos SetDefaults(mpLocalPoolDefaults); SetItemInfos(mpLocalItemInfos.get()); diff --git a/svx/uiconfig/ui/sidebarglow.ui b/svx/uiconfig/ui/sidebarglow.ui new file mode 100644 index 000000000000..cc3accb4f8fa --- /dev/null +++ b/svx/uiconfig/ui/sidebarglow.ui @@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> +<interface domain="svx"> + <requires lib="gtk+" version="3.18"/> + <object class="GtkAdjustment" id="adjustment1"> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> + <object class="GtkGrid" id="GlowPropertyPanel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkGrid" id="grid3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="border_width">6</property> + <child> + <object class="GtkBox" id="box2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkLabel" id="radius"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="sidebarglow|radius">Radius:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">LB_GLOW_RADIUS</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkSpinButton" id="LB_GLOW_RADIUS"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="adjustment">adjustment1</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="color"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="sidebarglow|color">Color:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">LB_GLOW_COLOR</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkMenuButton" id="LB_GLOW_COLOR"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="hexpand">True</property> + <property name="draw_indicator">True</property> + <property name="label" translatable="no"></property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="SHOW_GLOW"> + <property name="label" translatable="yes" context="sidebarglow|SHOW_GLOW">Enable</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> +</interface> |