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

New commits:
commit 25e53d411097849ae9a00af40c6d786fa1daf2b6
Author:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
AuthorDate: Tue May 7 09:21:15 2024 +0200
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Mon May 13 21:40:12 2024 +0200

    Use less SdOptionsSnapItem->IsSnapPoints/SetSnapPoints
    
    in favor of officecfg
    
    Change-Id: I578fa667f3a21ebdfacb8602c009558a03facd97
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167535
    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 a45ba6fbf49a..597fe5705dd1 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -68,15 +68,16 @@ bool SdTpOptionsSnap::FillItemSet( SfxItemSet* rAttrs )
         officecfg::Office::Draw::Snap::Object::SnapLine::set( 
m_xCbxSnapHelplines->get_active(), batch );
         officecfg::Office::Draw::Snap::Object::PageMargin::set( 
m_xCbxSnapBorder->get_active(), batch );
         officecfg::Office::Draw::Snap::Object::ObjectFrame::set( 
m_xCbxSnapFrame->get_active(), batch );
+        officecfg::Office::Draw::Snap::Object::ObjectPoint::set( 
m_xCbxSnapPoints->get_active(), batch );
     }
     else
     {
         officecfg::Office::Impress::Snap::Object::SnapLine::set( 
m_xCbxSnapHelplines->get_active(), batch );
         officecfg::Office::Impress::Snap::Object::PageMargin::set( 
m_xCbxSnapBorder->get_active(), batch );
         officecfg::Office::Impress::Snap::Object::ObjectFrame::set( 
m_xCbxSnapFrame->get_active(), batch );
+        officecfg::Office::Impress::Snap::Object::ObjectPoint::set( 
m_xCbxSnapPoints->get_active(), batch );
     }
 
-    aOptsItem.GetOptionsSnap().SetSnapPoints( m_xCbxSnapPoints->get_active() );
     aOptsItem.GetOptionsSnap().SetOrtho( m_xCbxOrtho->get_active() );
     aOptsItem.GetOptionsSnap().SetBigOrtho( m_xCbxBigOrtho->get_active() );
     aOptsItem.GetOptionsSnap().SetRotate( m_xCbxRotate->get_active() );
@@ -104,12 +105,14 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
         m_xCbxSnapHelplines->set_active( 
officecfg::Office::Draw::Snap::Object::SnapLine::get() );
         m_xCbxSnapBorder->set_active( 
officecfg::Office::Draw::Snap::Object::PageMargin::get() );
         m_xCbxSnapFrame->set_active( 
officecfg::Office::Draw::Snap::Object::ObjectFrame::get() );
+        m_xCbxSnapPoints->set_active( 
officecfg::Office::Draw::Snap::Object::ObjectPoint::get() );
     }
     else
     {
         m_xCbxSnapHelplines->set_active( 
officecfg::Office::Impress::Snap::Object::SnapLine::get() );
         m_xCbxSnapBorder->set_active( 
officecfg::Office::Impress::Snap::Object::PageMargin::get() );
         m_xCbxSnapFrame->set_active( 
officecfg::Office::Impress::Snap::Object::ObjectFrame::get() );
+        m_xCbxSnapPoints->set_active( 
officecfg::Office::Impress::Snap::Object::ObjectPoint::get() );
     }
 
     bool bReadOnly = bDrawMode ? 
officecfg::Office::Draw::Snap::Object::SnapLine::isReadOnly() :
@@ -129,7 +132,6 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
 
     bReadOnly = bDrawMode ? 
officecfg::Office::Draw::Snap::Object::ObjectPoint::isReadOnly() :
         officecfg::Office::Impress::Snap::Object::ObjectPoint::isReadOnly();
-    m_xCbxSnapPoints->set_active( aOptsItem.GetOptionsSnap().IsSnapPoints() );
     m_xCbxSnapPoints->set_sensitive(!bReadOnly);
     m_xCbxSnapPointsImg->set_visible(bReadOnly);
 
diff --git a/sd/source/ui/view/drviewsg.cxx b/sd/source/ui/view/drviewsg.cxx
index 36324d7c8909..94fc13e6c606 100644
--- a/sd/source/ui/view/drviewsg.cxx
+++ b/sd/source/ui/view/drviewsg.cxx
@@ -174,7 +174,10 @@ void DrawViewShell::ExecOptionsBar( SfxRequest& rReq )
 
         case SID_SNAP_POINTS:
         {
-            pOptions->SetSnapPoints( !mpDrawView->IsOPntSnap() );
+            if ( GetDoc()->GetDocumentType() == DocumentType::Impress )
+                officecfg::Office::Impress::Snap::Object::ObjectPoint::set( 
!mpDrawView->IsOPntSnap(), batch );
+            else
+                officecfg::Office::Draw::Snap::Object::ObjectPoint::set( 
!mpDrawView->IsOPntSnap(), batch );
         }
         break;
 
diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx
index 7e9a8ec31ab8..dfb73b027b71 100644
--- a/sd/source/ui/view/frmview.cxx
+++ b/sd/source/ui/view/frmview.cxx
@@ -293,6 +293,7 @@ void FrameView::Update(SdOptions const * pOptions)
         SetHlplVisible( 
officecfg::Office::Impress::Layout::Display::Helpline::get() );
         SetNoDragXorPolys ( 
!officecfg::Office::Impress::Layout::Display::Contour::get() );
         SetOFrmSnap( 
officecfg::Office::Impress::Snap::Object::ObjectFrame::get() );
+        SetOPntSnap( 
officecfg::Office::Impress::Snap::Object::ObjectPoint::get() );
         SetPlusHandlesAlwaysVisible( 
officecfg::Office::Impress::Layout::Display::Bezier::get() );
     }
     else
@@ -304,13 +305,13 @@ void FrameView::Update(SdOptions const * pOptions)
         SetHlplVisible( 
officecfg::Office::Draw::Layout::Display::Helpline::get() );
         SetNoDragXorPolys ( 
!officecfg::Office::Draw::Layout::Display::Contour::get() );
         SetOFrmSnap( officecfg::Office::Draw::Snap::Object::ObjectFrame::get() 
);
+        SetOPntSnap( officecfg::Office::Draw::Snap::Object::ObjectPoint::get() 
);
         SetPlusHandlesAlwaysVisible( 
officecfg::Office::Draw::Layout::Display::Bezier::get() );
     }
 
     SetGridVisible( pOptions->IsGridVisible() );
     SetSnapAngle( pOptions->GetAngle() );
     SetGridSnap( pOptions->IsUseGridSnap() );
-    SetOPntSnap( pOptions->IsSnapPoints() );
     SetSnapMagneticPixel( pOptions->GetSnapArea() );
     SetMarkedHitMovesAlways( pOptions->IsMarkedHitMovesAlways() );
     SetMoveOnlyDragging( pOptions->IsMoveOnlyDragging() );

Reply via email to