cui/source/tabpages/measure.cxx  |    1 +
 cui/source/tabpages/textattr.cxx |    1 +
 cui/source/tabpages/tpshadow.cxx |    1 +
 cui/source/tabpages/transfrm.cxx |    5 ++++-
 include/svx/dlgctrl.hxx          |    3 +++
 svx/source/dialog/dlgctrl.cxx    |   11 ++++++++++-
 6 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit aa46db406fd5c55c848e4d8984def0dc2df72c80
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue Sep 9 10:34:39 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Sep 9 14:03:45 2025 +0200

    Resolves: tdf#152129 Save/IsChanged for the SvxRectCTL
    
    looks to me that we should make this behave like other controls
    and generally set the m_eDefRP when explicitly asked to save
    so that "Reset" resets back to that saved value.
    
    And then we can check if the control is "changed" by comparison
    of m_eDefRP vs m_eRP and use that to apply the properties.
    
    Change-Id: Icef87fb7e3dd653267e6882f4e8d22adb3e0ff68
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190694
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/cui/source/tabpages/measure.cxx b/cui/source/tabpages/measure.cxx
index b589e0f09636..9a70b8d98b75 100644
--- a/cui/source/tabpages/measure.cxx
+++ b/cui/source/tabpages/measure.cxx
@@ -320,6 +320,7 @@ void SvxMeasurePage::Reset( const SfxItemSet* rAttrs )
         m_xTsbAutoPosV->set_state( TRISTATE_INDET );
         m_xTsbAutoPosH->set_state( TRISTATE_INDET );
     }
+    m_aCtlPosition.SaveValue();
 
     // put the attributes to the preview-control,
     // otherwise the control don't know about
diff --git a/cui/source/tabpages/textattr.cxx b/cui/source/tabpages/textattr.cxx
index c93b276bb2be..119a5420d53a 100644
--- a/cui/source/tabpages/textattr.cxx
+++ b/cui/source/tabpages/textattr.cxx
@@ -252,6 +252,7 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
         m_xTsbFullWidth->set_state(TRISTATE_INDET);
         m_xFlPosition->set_sensitive( false );
     }
+    m_aCtlPosition.SaveValue();
 
     // adjust to border
     if (rAttrs->GetItemState(SDRATTR_TEXT_FITTOSIZE) != SfxItemState::INVALID)
diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx
index 86fb46334575..20b64e0adc79 100644
--- a/cui/source/tabpages/tpshadow.cxx
+++ b/cui/source/tabpages/tpshadow.cxx
@@ -393,6 +393,7 @@ void SvxShadowTabPage::Reset( const SfxItemSet* rAttrs )
         m_xMtrDistance->set_text( u""_ustr );
         m_aCtlPosition.SetActualRP( RectPoint::MM );
     }
+    m_aCtlPosition.SaveValue();
 
     if( rAttrs->GetItemState( SDRATTR_SHADOWCOLOR ) != SfxItemState::INVALID )
     {
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index ebab1b826348..96e82b90fb3c 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -767,7 +767,9 @@ 
SvxPositionSizeTabPage::SvxPositionSizeTabPage(weld::Container* pPage, weld::Dia
     mePoolUnit = pPool->GetMetric( SID_ATTR_TRANSFORM_POS_X );
 
     m_aCtlPos.SetActualRP(RectPoint::LT);
+    m_aCtlPos.SaveValue();
     m_aCtlSize.SetActualRP(RectPoint::LT);
+    m_aCtlSize.SaveValue();
     meRP = RectPoint::LT; // see above
 
     m_xMtrWidth->connect_value_changed(LINK(this, SvxPositionSizeTabPage, 
ChangeWidthHdl));
@@ -908,7 +910,7 @@ bool SvxPositionSizeTabPage::FillItemSet( SfxItemSet* 
rOutAttrs )
 
     if( !mbPageDisabled )
     {
-        if (m_xMtrPosX->get_value_changed_from_saved() || 
m_xMtrPosY->get_value_changed_from_saved())
+        if (m_xMtrPosX->get_value_changed_from_saved() || 
m_xMtrPosY->get_value_changed_from_saved() || m_aCtlPos.IsValueModified())
         {
             const double fUIScale(double(mpView->GetModel().GetUIScale()));
             double fX((GetCoreValue( *m_xMtrPosX, mePoolUnit ) + 
maAnchor.getX()) * fUIScale);
@@ -1081,6 +1083,7 @@ void SvxPositionSizeTabPage::Reset( const SfxItemSet*  )
             m_xMtrHeight->set_value(fTmpHeight, FieldUnit::MM_100TH);
         }
     }
+    m_aCtlSize.Reset();
 
     pItem = GetItem( mrOutAttrs, SID_ATTR_TRANSFORM_PROTECT_SIZE );
     if ( pItem )
diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx
index 803fceb8582c..d17a61bbccfd 100644
--- a/include/svx/dlgctrl.hxx
+++ b/include/svx/dlgctrl.hxx
@@ -120,6 +120,9 @@ public:
 
     void                SetState( CTL_STATE nState );
 
+    void SaveValue();
+    bool IsValueModified() const;
+
     static const sal_uInt8 NO_CHILDREN = 9;   // returns number of usable 
radio buttons
 
     tools::Rectangle           CalculateFocusRectangle() const;
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index 2434a26fc911..2f27c12ebb41 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -405,7 +405,6 @@ Point SvxRectCtl::SetActualRPWithoutInvalidate( RectPoint 
eNewRP )
     bool bRTL = AllSettings::GetLayoutRTL();
     eNewRP = GetRPFromPoint( m_aPtNew, bRTL );
 
-    m_eDefRP = eNewRP;
     m_eRP = eNewRP;
 
     return aPtLast;
@@ -574,6 +573,16 @@ void SvxRectCtl::DoCompletelyDisable(bool bNew)
     Invalidate();
 }
 
+void SvxRectCtl::SaveValue()
+{
+    m_eDefRP = m_eRP;
+}
+
+bool SvxRectCtl::IsValueModified() const
+{
+    return m_eDefRP != m_eRP;
+}
+
 // Control for editing bitmaps
 
 rtl::Reference<comphelper::OAccessible> SvxPixelCtl::CreateAccessible()

Reply via email to