summaryrefslogtreecommitdiff
path: root/cui/source/tabpages/grfpage.cxx
diff options
context:
space:
mode:
authorAndrea Rosetti <andreamassimo03@gmail.com>2023-08-02 11:40:25 +0200
committerHeiko Tietze <heiko.tietze@documentfoundation.org>2023-08-25 07:37:33 +0200
commit826300d55b8f18593c4b56fb448d09fac52820bd (patch)
tree9de7e9eb4a97c89aa788adffd7bbb61797d43252 /cui/source/tabpages/grfpage.cxx
parente15bf7363adb20c77aee51e09b6f2604d741619b (diff)
tdf#86628 Add reset crop function to dialog
Added a function that uncrops the image, keeping the modified size (which can be restored using the already existing Original Size button) Change-Id: I8e98de2b586c68d52f819955ce5a74f20cbe6698 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155219 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'cui/source/tabpages/grfpage.cxx')
-rw-r--r--cui/source/tabpages/grfpage.cxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index aa49c2a7267c..fac0bfb6ab05 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -75,6 +75,7 @@ SvxGrfCropPage::SvxGrfCropPage(weld::Container* pPage, weld::DialogController* p
, m_xOrigSizeGrid(m_xBuilder->weld_widget("origsizegrid"))
, m_xOrigSizeFT(m_xBuilder->weld_label("origsizeft"))
, m_xOrigSizePB(m_xBuilder->weld_button("origsize"))
+ , m_xUncropPB(m_xBuilder->weld_button("uncrop"))
, m_xExampleWN(new weld::CustomWeld(*m_xBuilder, "preview", m_aExampleWN))
{
SetExchangeSupport();
@@ -104,6 +105,7 @@ SvxGrfCropPage::SvxGrfCropPage(weld::Container* pPage, weld::DialogController* p
m_xBottomMF->connect_value_changed( aLk );
m_xOrigSizePB->connect_clicked(LINK(this, SvxGrfCropPage, OrigSizeHdl));
+ m_xUncropPB->connect_clicked(LINK(this, SvxGrfCropPage, UncropHdl));
}
SvxGrfCropPage::~SvxGrfCropPage()
@@ -524,6 +526,32 @@ IMPL_LINK_NOARG(SvxGrfCropPage, OrigSizeHdl, weld::Button&, void)
m_xHeightZoomMF->set_value(100, FieldUnit::NONE);
m_bSetOrigSize = true;
}
+
+/*--------------------------------------------------------------------
+ description: reset crop
+ --------------------------------------------------------------------*/
+
+IMPL_LINK_NOARG(SvxGrfCropPage, UncropHdl, weld::Button&, void)
+{
+ SfxItemPool* pPool = GetItemSet().GetPool();
+ DBG_ASSERT( pPool, "Where is the pool?" );
+
+ m_xLeftMF->set_value(0, FieldUnit::NONE);
+ m_xRightMF->set_value(0, FieldUnit::NONE);
+ m_xTopMF->set_value(0, FieldUnit::NONE);
+ m_xBottomMF->set_value(0, FieldUnit::NONE);
+
+ m_aExampleWN.SetLeft(0);
+ m_aExampleWN.SetRight(0);
+ m_aExampleWN.SetTop(0);
+ m_aExampleWN.SetBottom(0);
+
+ m_aExampleWN.Invalidate();
+ CalcMinMaxBorder();
+
+}
+
+
/*--------------------------------------------------------------------
description: compute scale
--------------------------------------------------------------------*/