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 d9d699756125db28bd45d7c92d4c9c2dc243f418
Author:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
AuthorDate: Fri May 3 11:57:10 2024 +0200
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Mon May 13 09:15:04 2024 +0200

    Use less SdOptionsSnapItem->IsSnapFrame/SetSnapFrame
    
    in favor of officecfg
    
    Change-Id: Ia9d36f3c2d0f85250da6f3483176c551226164a4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167534
    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 2708d8d933fa..a45ba6fbf49a 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -67,14 +67,15 @@ 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 );
     }
     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 );
     }
 
-    aOptsItem.GetOptionsSnap().SetSnapFrame( m_xCbxSnapFrame->get_active() );
     aOptsItem.GetOptionsSnap().SetSnapPoints( m_xCbxSnapPoints->get_active() );
     aOptsItem.GetOptionsSnap().SetOrtho( m_xCbxOrtho->get_active() );
     aOptsItem.GetOptionsSnap().SetBigOrtho( m_xCbxBigOrtho->get_active() );
@@ -102,11 +103,13 @@ 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() );
     }
     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() );
     }
 
     bool bReadOnly = bDrawMode ? 
officecfg::Office::Draw::Snap::Object::SnapLine::isReadOnly() :
@@ -121,7 +124,6 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
 
     bReadOnly = bDrawMode ? 
officecfg::Office::Draw::Snap::Object::ObjectFrame::isReadOnly() :
         officecfg::Office::Impress::Snap::Object::ObjectFrame::isReadOnly();
-    m_xCbxSnapFrame->set_active( aOptsItem.GetOptionsSnap().IsSnapFrame() );
     m_xCbxSnapFrame->set_sensitive(!bReadOnly);
     m_xCbxSnapFrameImg->set_visible(bReadOnly);
 
diff --git a/sd/source/ui/view/drviewsg.cxx b/sd/source/ui/view/drviewsg.cxx
index 20a7814abbee..36324d7c8909 100644
--- a/sd/source/ui/view/drviewsg.cxx
+++ b/sd/source/ui/view/drviewsg.cxx
@@ -165,7 +165,10 @@ void DrawViewShell::ExecOptionsBar( SfxRequest& rReq )
 
         case SID_SNAP_FRAME:
         {
-            pOptions->SetSnapFrame( !mpDrawView->IsOFrmSnap() );
+            if ( GetDoc()->GetDocumentType() == DocumentType::Impress )
+                
officecfg::Office::Impress::Snap::Object::ObjectFrame::set(!mpDrawView->IsOFrmSnap(),
 batch);
+            else
+                
officecfg::Office::Draw::Snap::Object::ObjectFrame::set(!mpDrawView->IsOFrmSnap(),
 batch);
         }
         break;
 
diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx
index c252b6183a6a..7e9a8ec31ab8 100644
--- a/sd/source/ui/view/frmview.cxx
+++ b/sd/source/ui/view/frmview.cxx
@@ -292,6 +292,7 @@ void FrameView::Update(SdOptions const * pOptions)
         SetHlplSnap( officecfg::Office::Impress::Snap::Object::SnapLine::get() 
);
         SetHlplVisible( 
officecfg::Office::Impress::Layout::Display::Helpline::get() );
         SetNoDragXorPolys ( 
!officecfg::Office::Impress::Layout::Display::Contour::get() );
+        SetOFrmSnap( 
officecfg::Office::Impress::Snap::Object::ObjectFrame::get() );
         SetPlusHandlesAlwaysVisible( 
officecfg::Office::Impress::Layout::Display::Bezier::get() );
     }
     else
@@ -302,13 +303,13 @@ void FrameView::Update(SdOptions const * pOptions)
         SetHlplSnap( officecfg::Office::Draw::Snap::Object::SnapLine::get() );
         SetHlplVisible( 
officecfg::Office::Draw::Layout::Display::Helpline::get() );
         SetNoDragXorPolys ( 
!officecfg::Office::Draw::Layout::Display::Contour::get() );
+        SetOFrmSnap( officecfg::Office::Draw::Snap::Object::ObjectFrame::get() 
);
         SetPlusHandlesAlwaysVisible( 
officecfg::Office::Draw::Layout::Display::Bezier::get() );
     }
 
     SetGridVisible( pOptions->IsGridVisible() );
     SetSnapAngle( pOptions->GetAngle() );
     SetGridSnap( pOptions->IsUseGridSnap() );
-    SetOFrmSnap( pOptions->IsSnapFrame() );
     SetOPntSnap( pOptions->IsSnapPoints() );
     SetSnapMagneticPixel( pOptions->GetSnapArea() );
     SetMarkedHitMovesAlways( pOptions->IsMarkedHitMovesAlways() );

Reply via email to