sd/source/ui/dlg/tpoption.cxx |    6 ++++--
 sd/source/ui/view/frmview.cxx |    3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit f1c91993e54858f9bc7ed78d25485a09157c04be
Author:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
AuthorDate: Sat May 11 22:31:37 2024 +0200
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Thu May 16 19:15:16 2024 +0200

    Use less SdOptionsSnapItem->GetSnapArea/SetSnapArea
    
    in favor of officecfg
    
    Change-Id: I0457f565f3f5d68018a307de7afbed9dbd009d42
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167539
    Tested-by: Jenkins
    Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>

diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index ac35cbeea34f..d66536348a8f 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -72,6 +72,7 @@ bool SdTpOptionsSnap::FillItemSet( SfxItemSet* rAttrs )
         officecfg::Office::Draw::Snap::Position::CreatingMoving::set( 
m_xCbxOrtho->get_active(), batch );
         officecfg::Office::Draw::Snap::Position::ExtendEdges::set( 
m_xCbxBigOrtho->get_active(), batch );
         officecfg::Office::Draw::Snap::Position::Rotating::set( 
m_xCbxRotate->get_active(), batch );
+        officecfg::Office::Draw::Snap::Object::Range::set( 
static_cast<sal_Int16>(m_xMtrFldSnapArea->get_value(FieldUnit::PIXEL)), batch );
     }
     else
     {
@@ -82,9 +83,9 @@ bool SdTpOptionsSnap::FillItemSet( SfxItemSet* rAttrs )
         officecfg::Office::Impress::Snap::Position::CreatingMoving::set( 
m_xCbxOrtho->get_active(), batch );
         officecfg::Office::Impress::Snap::Position::ExtendEdges::set( 
m_xCbxBigOrtho->get_active(), batch );
         officecfg::Office::Impress::Snap::Position::Rotating::set( 
m_xCbxRotate->get_active(), batch );
+        officecfg::Office::Impress::Snap::Object::Range::set( 
static_cast<sal_Int16>(m_xMtrFldSnapArea->get_value(FieldUnit::PIXEL)), batch );
     }
 
-    
aOptsItem.GetOptionsSnap().SetSnapArea(static_cast<sal_Int16>(m_xMtrFldSnapArea->get_value(FieldUnit::PIXEL)));
     
aOptsItem.GetOptionsSnap().SetAngle(Degree100(m_xMtrFldAngle->get_value(FieldUnit::DEGREE)));
     
aOptsItem.GetOptionsSnap().SetEliminatePolyPointLimitAngle(Degree100(m_xMtrFldBezAngle->get_value(FieldUnit::DEGREE)));
 
@@ -112,6 +113,7 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
         m_xCbxOrtho->set_active( 
officecfg::Office::Draw::Snap::Position::CreatingMoving::get() );
         m_xCbxBigOrtho->set_active( 
officecfg::Office::Draw::Snap::Position::ExtendEdges::get() );
         m_xCbxRotate->set_active( 
officecfg::Office::Draw::Snap::Position::Rotating::get() );
+
     }
     else
     {
@@ -122,6 +124,7 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
         m_xCbxOrtho->set_active( 
officecfg::Office::Impress::Snap::Position::CreatingMoving::get() );
         m_xCbxBigOrtho->set_active( 
officecfg::Office::Impress::Snap::Position::ExtendEdges::get() );
         m_xCbxRotate->set_active( 
officecfg::Office::Impress::Snap::Position::Rotating::get() );
+        m_xMtrFldSnapArea->set_value( 
officecfg::Office::Impress::Snap::Object::Range::get(), FieldUnit::PIXEL);
     }
 
     bool bReadOnly = bDrawMode ? 
officecfg::Office::Draw::Snap::Object::SnapLine::isReadOnly() :
@@ -161,7 +164,6 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
 
     bReadOnly = bDrawMode ? 
officecfg::Office::Draw::Snap::Object::Range::isReadOnly() :
         officecfg::Office::Impress::Snap::Object::Range::isReadOnly();
-    m_xMtrFldSnapArea->set_value(aOptsItem.GetOptionsSnap().GetSnapArea(), 
FieldUnit::PIXEL);
     m_xMtrFldSnapArea->set_sensitive(!bReadOnly);
     m_xMtrFldSnapAreaImg->set_visible(bReadOnly);
 
diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx
index 318cd0be5f55..1a543d0afc06 100644
--- a/sd/source/ui/view/frmview.cxx
+++ b/sd/source/ui/view/frmview.cxx
@@ -298,6 +298,7 @@ void FrameView::Update(SdOptions const * pOptions)
         SetOPntSnap( 
officecfg::Office::Impress::Snap::Object::ObjectPoint::get() );
         SetOrtho( 
officecfg::Office::Impress::Snap::Position::CreatingMoving::get() );
         SetPlusHandlesAlwaysVisible( 
officecfg::Office::Impress::Layout::Display::Bezier::get() );
+        SetSnapMagneticPixel( 
officecfg::Office::Impress::Snap::Object::Range::get() );
     }
     else
     {
@@ -313,12 +314,12 @@ void FrameView::Update(SdOptions const * pOptions)
         SetOPntSnap( officecfg::Office::Draw::Snap::Object::ObjectPoint::get() 
);
         SetOrtho( 
officecfg::Office::Draw::Snap::Position::CreatingMoving::get() );
         SetPlusHandlesAlwaysVisible( 
officecfg::Office::Draw::Layout::Display::Bezier::get() );
+        SetSnapMagneticPixel( 
officecfg::Office::Draw::Snap::Object::Range::get() );
     }
 
     SetGridVisible( pOptions->IsGridVisible() );
     SetSnapAngle( pOptions->GetAngle() );
     SetGridSnap( pOptions->IsUseGridSnap() );
-    SetSnapMagneticPixel( pOptions->GetSnapArea() );
     SetMarkedHitMovesAlways( pOptions->IsMarkedHitMovesAlways() );
     SetMoveOnlyDragging( pOptions->IsMoveOnlyDragging() );
     SetSlantButShear( pOptions->IsMoveOnlyDragging() );

Reply via email to