sw/source/ui/frmdlg/frmpage.cxx | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-)
New commits: commit bc8630daf238450fde6e22ff88547172c7007143 Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Wed Jun 11 11:26:48 2025 +0200 Commit: Balazs Varga <balazs.varga.ext...@allotropia.de> CommitDate: Thu Jun 12 17:35:44 2025 +0200 tdf#166873 - sw UI fix 'relative to' checkbox is unchecked after reopening Image properties dialog Relative size also need to be checked before setting graphic/frame size. Follow up for: 81f7503d2d205f4f6df0bfd1a66ed10cccb556c2 (tdf#132853 - UI: fix different sizes in Image tabs Type & Crop) Change-Id: Ic67b8c384ac2a70506add652a57c9b462bf199b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186362 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 0515723d6a71..8c6ac4b4c3ec 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -1351,11 +1351,20 @@ bool SwFramePage::FillItemSet(SfxItemSet *rSet) aSz.SetHeightSizeType(SwFrameSize::Minimum); bRet |= nullptr != rSet->Put( aSz ); + // and now set the size for "external" - e.g.:Crop - tabpages if (bRet) { - SvxSizeItem aGSz(SID_ATTR_GRAF_FRMSIZE); - aGSz.SetSize(aSz.GetSize()); - bRet |= nullptr != rSet->Put(aGSz); + SwFormatFrameSize aSizeCopy = rSet->Get(RES_FRM_SIZE); + SvxSizeItem aSzItm( SID_ATTR_GRAF_FRMSIZE, aSizeCopy.GetSize() ); + rSet->Put( aSzItm ); + + Size aGrpSz( aSizeCopy.GetWidthPercent(), aSizeCopy.GetHeightPercent() ); + if( SwFormatFrameSize::SYNCED == aGrpSz.Width() ) aGrpSz.setWidth( 0 ); + if( SwFormatFrameSize::SYNCED == aGrpSz.Height() ) aGrpSz.setHeight( 0 ); + + aSzItm.SetSize( aGrpSz ); + aSzItm.SetWhich( SID_ATTR_GRAF_FRMSIZE_PERCENT ); + bRet |= nullptr != rSet->Put( aSzItm ); } } if (m_xFollowTextFlowCB->get_state_changed_from_saved()) @@ -2307,7 +2316,19 @@ void SwFramePage::Init(const SfxItemSet& rSet) if (const SvxSizeItem* pSizeItem = rSet.GetItemIfSet(SID_ATTR_GRAF_FRMSIZE, false)) { if (pSizeItem->GetSize() != rSize.GetSize()) - rSize.SetSize(pSizeItem->GetSize()); + { + const Size& rSz = pSizeItem->GetSize(); + rSize.SetWidth(rSz.Width()); + rSize.SetHeight(rSz.Height()); + + pSizeItem = rSet.GetItemIfSet(SID_ATTR_GRAF_FRMSIZE_PERCENT, false); + if (pSizeItem) + { + const Size& rRelativeSize = pSizeItem->GetSize(); + rSize.SetWidthPercent(static_cast<sal_uInt8>(rRelativeSize.Width())); + rSize.SetHeightPercent(static_cast<sal_uInt8>(rRelativeSize.Height())); + } + } } sal_Int64 nWidth = m_xWidthED->NormalizePercent(rSize.GetWidth());