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 3df9a50322dc9f24c87d0095316aadf1ad09ec3e
Author:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
AuthorDate: Fri May 3 11:41:49 2024 +0200
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Sun May 12 21:18:01 2024 +0200

    Use less SdOptionsSnapItem->IsSnapBorder/SetSnapBorder
    
    in favor of officecfg
    
    Change-Id: Iaa6801ef773de7d3dcb1f08d4eac4a4f62ac656b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167533
    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 1a2bfee07646..2708d8d933fa 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -66,13 +66,14 @@ bool SdTpOptionsSnap::FillItemSet( SfxItemSet* rAttrs )
     if (bDrawMode)
     {
         officecfg::Office::Draw::Snap::Object::SnapLine::set( 
m_xCbxSnapHelplines->get_active(), batch );
+        officecfg::Office::Draw::Snap::Object::PageMargin::set( 
m_xCbxSnapBorder->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 );
     }
 
-    aOptsItem.GetOptionsSnap().SetSnapBorder( m_xCbxSnapBorder->get_active() );
     aOptsItem.GetOptionsSnap().SetSnapFrame( m_xCbxSnapFrame->get_active() );
     aOptsItem.GetOptionsSnap().SetSnapPoints( m_xCbxSnapPoints->get_active() );
     aOptsItem.GetOptionsSnap().SetOrtho( m_xCbxOrtho->get_active() );
@@ -100,10 +101,12 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
     if (bDrawMode)
     {
         m_xCbxSnapHelplines->set_active( 
officecfg::Office::Draw::Snap::Object::SnapLine::get() );
+        m_xCbxSnapBorder->set_active( 
officecfg::Office::Draw::Snap::Object::PageMargin::get() );
     }
     else
     {
         m_xCbxSnapHelplines->set_active( 
officecfg::Office::Impress::Snap::Object::SnapLine::get() );
+        m_xCbxSnapBorder->set_active( 
officecfg::Office::Impress::Snap::Object::PageMargin::get() );
     }
 
     bool bReadOnly = bDrawMode ? 
officecfg::Office::Draw::Snap::Object::SnapLine::isReadOnly() :
@@ -113,7 +116,6 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
 
     bReadOnly = bDrawMode ? 
officecfg::Office::Draw::Snap::Object::PageMargin::isReadOnly() :
         officecfg::Office::Impress::Snap::Object::PageMargin::isReadOnly();
-    m_xCbxSnapBorder->set_active( aOptsItem.GetOptionsSnap().IsSnapBorder() );
     m_xCbxSnapBorder->set_sensitive(!bReadOnly);
     m_xCbxSnapBorderImg->set_visible(bReadOnly);
 
diff --git a/sd/source/ui/view/drviewsg.cxx b/sd/source/ui/view/drviewsg.cxx
index e256ef926172..20a7814abbee 100644
--- a/sd/source/ui/view/drviewsg.cxx
+++ b/sd/source/ui/view/drviewsg.cxx
@@ -156,7 +156,10 @@ void DrawViewShell::ExecOptionsBar( SfxRequest& rReq )
 
         case SID_SNAP_BORDER:
         {
-            pOptions->SetSnapBorder( !mpDrawView->IsBordSnap() );
+            if ( GetDoc()->GetDocumentType() == DocumentType::Impress )
+                officecfg::Office::Impress::Snap::Object::PageMargin::set( 
!mpDrawView->IsBordSnap(), batch );
+            else
+                officecfg::Office::Draw::Snap::Object::PageMargin::set( 
!mpDrawView->IsBordSnap(), batch );
         }
         break;
 
diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx
index ad500cfb4eed..c252b6183a6a 100644
--- a/sd/source/ui/view/frmview.cxx
+++ b/sd/source/ui/view/frmview.cxx
@@ -287,6 +287,7 @@ void FrameView::Update(SdOptions const * pOptions)
     if (bImpress)
     {
         mbRuler = officecfg::Office::Impress::Layout::Display::Ruler::get();
+        SetBordSnap( 
officecfg::Office::Impress::Snap::Object::PageMargin::get() );
         SetDragStripes( 
officecfg::Office::Impress::Layout::Display::Guide::get() );
         SetHlplSnap( officecfg::Office::Impress::Snap::Object::SnapLine::get() 
);
         SetHlplVisible( 
officecfg::Office::Impress::Layout::Display::Helpline::get() );
@@ -296,6 +297,7 @@ void FrameView::Update(SdOptions const * pOptions)
     else
     {
         mbRuler = officecfg::Office::Draw::Layout::Display::Ruler::get();
+        SetBordSnap( officecfg::Office::Draw::Snap::Object::PageMargin::get() 
);
         SetDragStripes( officecfg::Office::Draw::Layout::Display::Guide::get() 
);
         SetHlplSnap( officecfg::Office::Draw::Snap::Object::SnapLine::get() );
         SetHlplVisible( 
officecfg::Office::Draw::Layout::Display::Helpline::get() );
@@ -306,7 +308,6 @@ void FrameView::Update(SdOptions const * pOptions)
     SetGridVisible( pOptions->IsGridVisible() );
     SetSnapAngle( pOptions->GetAngle() );
     SetGridSnap( pOptions->IsUseGridSnap() );
-    SetBordSnap( pOptions->IsSnapBorder()  );
     SetOFrmSnap( pOptions->IsSnapFrame() );
     SetOPntSnap( pOptions->IsSnapPoints() );
     SetSnapMagneticPixel( pOptions->GetSnapArea() );

Reply via email to