diff options
author | Heiko Tietze <tietze.heiko@gmail.com> | 2023-12-08 12:18:47 +0100 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2024-02-12 12:56:05 +0100 |
commit | fe4e750d32cb88a9ce7a7539af6c6883d4194220 (patch) | |
tree | e4bac0e20cb71d8e4aa45fb6acaf6098ef54af1f /sw/source | |
parent | d4c34206bcf64b94eac4f0761aeacc285e08af55 (diff) |
Resolves tdf#158531 - Connector lines for Keep Ratio setting
Icons taken from https://thenounproject.com/icon/lock-89649/ and
https://thenounproject.com/icon/unlock-89647/ (licensed PD)
Change-Id: I7efd25e83726ced7dee4f876cf4bb4c8f54408df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160460
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/ui/frmdlg/frmpage.cxx | 20 | ||||
-rw-r--r-- | sw/source/uibase/inc/frmpage.hxx | 9 |
2 files changed, 28 insertions, 1 deletions
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index b3e2a873ad18..da72a4e73505 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -76,6 +76,8 @@ #include <comphelper/lok.hxx> #include <memory> +#include <bitmaps.hlst> + using namespace ::com::sun::star; using namespace ::sfx2; @@ -643,6 +645,8 @@ SwFramePage::SwFramePage(weld::Container* pPage, weld::DialogController* pContro , m_bAllowVertPositioning( true ) , m_bIsMathOLE(false) , m_bIsMathBaselineAlignment(true) + , m_aRatioTop(ConnectorType::Top) + , m_aRatioBottom(ConnectorType::Bottom) , m_xWidthFT(m_xBuilder->weld_label("widthft")) , m_xWidthAutoFT(m_xBuilder->weld_label("autowidthft")) , m_xRelWidthCB(m_xBuilder->weld_check_button("relwidth")) @@ -653,7 +657,10 @@ SwFramePage::SwFramePage(weld::Container* pPage, weld::DialogController* pContro , m_xRelHeightCB(m_xBuilder->weld_check_button("relheight")) , m_xRelHeightRelationLB(m_xBuilder->weld_combo_box("relheightrelation")) , m_xAutoHeightCB(m_xBuilder->weld_check_button("autoheight")) - , m_xFixedRatioCB(m_xBuilder->weld_check_button("ratio")) + , m_xFixedRatioCB(m_xBuilder->weld_check_button("CBX_SCALE")) + , m_xCbxScaleImg(m_xBuilder->weld_image("imRatio")) + , m_xImgRatioTop(new weld::CustomWeld(*m_xBuilder, "daRatioTop", m_aRatioTop)) + , m_xImgRatioBottom(new weld::CustomWeld(*m_xBuilder, "daRatioBottom", m_aRatioBottom)) , m_xRealSizeBT(m_xBuilder->weld_button("origsize")) , m_xAnchorFrame(m_xBuilder->weld_widget("anchorframe")) , m_xAnchorAtPageRB(m_xBuilder->weld_radio_button("topage")) @@ -718,6 +725,8 @@ SwFramePage::SwFramePage(weld::Container* pPage, weld::DialogController* pContro m_xAutoWidthCB->connect_toggled(LINK(this, SwFramePage, AutoWidthClickHdl)); m_xAutoHeightCB->connect_toggled(LINK(this, SwFramePage, AutoHeightClickHdl)); + m_xFixedRatioCB->connect_toggled(LINK(this, SwFramePage, RatioClickHdl)); + if (comphelper::LibreOfficeKit::isActive()) { m_xAnchorAtPageRB->hide(); @@ -975,7 +984,10 @@ void SwFramePage::Reset( const SfxItemSet *rSet ) } if (m_sDlgType == "PictureDialog") + { m_xFixedRatioCB->set_active(false); + m_xCbxScaleImg->set_from_icon_name(RID_SVXBMP_UNLOCKED); + } else { if ( m_bNew ) @@ -2163,6 +2175,11 @@ IMPL_LINK_NOARG(SwFramePage, AutoHeightClickHdl, weld::Toggleable&, void) HandleAutoCB(m_xAutoHeightCB->get_active(), *m_xHeightFT, *m_xHeightAutoFT, *m_xWidthED->get()); } +IMPL_LINK_NOARG(SwFramePage, RatioClickHdl, weld::Toggleable&, void) +{ + m_xCbxScaleImg->set_from_icon_name(m_xFixedRatioCB->get_active() ? RID_SVXBMP_LOCKED : RID_SVXBMP_UNLOCKED); +} + IMPL_LINK( SwFramePage, ModifyHdl, weld::MetricSpinButton&, rEdit, void ) { SwTwips nWidth = static_cast< SwTwips >(m_xWidthED->DenormalizePercent(m_xWidthED->get_value(FieldUnit::TWIP))); @@ -2391,6 +2408,7 @@ void SwFramePage::Init(const SfxItemSet& rSet) m_xRelHeightRelationLB->set_active(1); else m_xRelHeightRelationLB->set_active(0); + m_xCbxScaleImg->set_from_icon_name(m_xFixedRatioCB->get_active() ? RID_SVXBMP_LOCKED : RID_SVXBMP_UNLOCKED); } void SwFramePage::SetFormatUsed(bool bFormatUsed) diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx index 6f05ca1d651a..46e9bfdb5125 100644 --- a/sw/source/uibase/inc/frmpage.hxx +++ b/sw/source/uibase/inc/frmpage.hxx @@ -22,6 +22,7 @@ #include <sfx2/tabdlg.hxx> #include <svx/dialcontrol.hxx> +#include <svx/dlgutil.hxx> #include <svx/frmdirlbox.hxx> #include <svx/swframeexample.hxx> #include <swtypes.hxx> @@ -74,6 +75,9 @@ class SwFramePage final : public SfxTabPage SwFrameExample m_aExampleWN; + SvxRatioConnector m_aRatioTop; + SvxRatioConnector m_aRatioBottom; + // size std::unique_ptr<weld::Label> m_xWidthFT; std::unique_ptr<weld::Label> m_xWidthAutoFT; @@ -88,6 +92,10 @@ class SwFramePage final : public SfxTabPage std::unique_ptr<weld::CheckButton> m_xAutoHeightCB; std::unique_ptr<weld::CheckButton> m_xFixedRatioCB; + std::unique_ptr<weld::Image> m_xCbxScaleImg; + std::unique_ptr<weld::CustomWeld> m_xImgRatioTop; + std::unique_ptr<weld::CustomWeld> m_xImgRatioBottom; + std::unique_ptr<weld::Button> m_xRealSizeBT; // anchor @@ -142,6 +150,7 @@ class SwFramePage final : public SfxTabPage DECL_LINK(AutoWidthClickHdl, weld::Toggleable&, void); DECL_LINK(AutoHeightClickHdl, weld::Toggleable&, void); + DECL_LINK(RatioClickHdl, weld::Toggleable&, void); // update example void UpdateExample(); |