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

New commits:
commit 5e88d86d8c41b6790a365fddadbcea76712c11f3
Author:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
AuthorDate: Sun May 12 09:15:18 2024 +0200
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Fri May 17 16:33:45 2024 +0200

    Use less SdOptionsSnapItem->Get/SetEliminatePolyPointLimitAngle
    
    in favor of officecfg
    
    Change-Id: I8a8d910578a438b494567eed30a632db6f191101
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167541
    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 f25649536060..fdd199f6a7d5 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -57,7 +57,6 @@ SdTpOptionsSnap::~SdTpOptionsSnap()
 bool SdTpOptionsSnap::FillItemSet( SfxItemSet* rAttrs )
 {
     SvxGridTabPage::FillItemSet(rAttrs);
-    SdOptionsSnapItem aOptsItem;
     bool bDrawMode = SvxGridTabPage::IsDrawMode();
 
     std::shared_ptr<comphelper::ConfigurationChanges> batch(
@@ -74,6 +73,7 @@ bool SdTpOptionsSnap::FillItemSet( SfxItemSet* rAttrs )
         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 );
         officecfg::Office::Draw::Snap::Position::RotatingValue::set( 
static_cast<sal_Int32>(Degree100(m_xMtrFldAngle->get_value(FieldUnit::DEGREE))),
 batch );
+        officecfg::Office::Draw::Snap::Position::PointReduction::set ( 
static_cast<sal_Int32>(Degree100(m_xMtrFldBezAngle->get_value(FieldUnit::DEGREE))),
 batch );
     }
     else
     {
@@ -86,11 +86,9 @@ bool SdTpOptionsSnap::FillItemSet( SfxItemSet* rAttrs )
         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 );
         officecfg::Office::Impress::Snap::Position::RotatingValue::set( 
static_cast<sal_Int32>(Degree100(m_xMtrFldAngle->get_value(FieldUnit::DEGREE))),
 batch );
+        officecfg::Office::Impress::Snap::Position::PointReduction::set ( 
static_cast<sal_Int32>(Degree100(m_xMtrFldBezAngle->get_value(FieldUnit::DEGREE))),
 batch );
     }
 
-    
aOptsItem.GetOptionsSnap().SetEliminatePolyPointLimitAngle(Degree100(m_xMtrFldBezAngle->get_value(FieldUnit::DEGREE)));
-
-    rAttrs->Put( aOptsItem );
     batch->commit();
 
     // we get a possible existing GridItem, this ensures that we do not set
@@ -102,8 +100,6 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
 {
     SvxGridTabPage::Reset(rAttrs);
 
-    SdOptionsSnapItem aOptsItem( rAttrs->Get( ATTR_OPTIONS_SNAP ) );
-
     bool bDrawMode = SvxGridTabPage::IsDrawMode();
     if (bDrawMode)
     {
@@ -116,6 +112,7 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
         m_xCbxRotate->set_active( 
officecfg::Office::Draw::Snap::Position::Rotating::get() );
         m_xMtrFldSnapArea->set_value( 
officecfg::Office::Draw::Snap::Object::Range::get(), FieldUnit::PIXEL);
         m_xMtrFldAngle->set_value( 
officecfg::Office::Draw::Snap::Position::RotatingValue::get(), 
FieldUnit::DEGREE);
+        m_xMtrFldBezAngle->set_value( 
officecfg::Office::Draw::Snap::Position::PointReduction::get(), 
FieldUnit::DEGREE);
     }
     else
     {
@@ -128,6 +125,7 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
         m_xCbxRotate->set_active( 
officecfg::Office::Impress::Snap::Position::Rotating::get() );
         m_xMtrFldSnapArea->set_value( 
officecfg::Office::Impress::Snap::Object::Range::get(), FieldUnit::PIXEL);
         m_xMtrFldAngle->set_value( 
officecfg::Office::Impress::Snap::Position::RotatingValue::get(), 
FieldUnit::DEGREE);
+        m_xMtrFldBezAngle->set_value( 
officecfg::Office::Impress::Snap::Position::PointReduction::get(), 
FieldUnit::DEGREE);
     }
 
     bool bReadOnly = bDrawMode ? 
officecfg::Office::Draw::Snap::Object::SnapLine::isReadOnly() :
@@ -176,7 +174,6 @@ void SdTpOptionsSnap::Reset( const SfxItemSet* rAttrs )
 
     bReadOnly = bDrawMode ? 
officecfg::Office::Draw::Snap::Position::PointReduction::isReadOnly() :
         
officecfg::Office::Impress::Snap::Position::PointReduction::isReadOnly();
-    
m_xMtrFldBezAngle->set_value(aOptsItem.GetOptionsSnap().GetEliminatePolyPointLimitAngle().get(),
 FieldUnit::DEGREE);
     m_xMtrFldBezAngle->set_sensitive(!bReadOnly);
     m_xMtrFldBezAngleImg->set_visible(bReadOnly);
 
@@ -248,20 +245,20 @@ bool SdTpOptionsContents::FillItemSet( SfxItemSet* )
 
         if (m_bDrawMode)
         {
-            officecfg::Office::Draw::Layout::Display::Ruler::set( 
m_xCbxRuler->get_active(), batch );
-            officecfg::Office::Draw::Layout::Display::Contour::set( 
m_xCbxMoveOutline->get_active(), batch );
-            officecfg::Office::Draw::Layout::Display::Guide::set( 
m_xCbxDragStripes->get_active(), batch );
-            officecfg::Office::Draw::Layout::Display::Bezier::set( 
m_xCbxHandlesBezier->get_active(), batch );
+            
officecfg::Office::Draw::Layout::Display::Ruler::set(m_xCbxRuler->get_active(), 
batch);
+            
officecfg::Office::Draw::Layout::Display::Contour::set(m_xCbxMoveOutline->get_active(),
 batch);
+            
officecfg::Office::Draw::Layout::Display::Guide::set(m_xCbxDragStripes->get_active(),
 batch);
+            
officecfg::Office::Draw::Layout::Display::Bezier::set(m_xCbxHandlesBezier->get_active(),
 batch);
+            batch->commit();
         }
         else
         {
-            officecfg::Office::Impress::Layout::Display::Ruler::set( 
m_xCbxRuler->get_active(), batch );
-            officecfg::Office::Impress::Layout::Display::Contour::set( 
m_xCbxMoveOutline->get_active(), batch );
-            officecfg::Office::Impress::Layout::Display::Guide::set( 
m_xCbxDragStripes->get_active(), batch );
-            officecfg::Office::Impress::Layout::Display::Bezier::set( 
m_xCbxHandlesBezier->get_active(), batch );
+            
officecfg::Office::Impress::Layout::Display::Ruler::set(m_xCbxRuler->get_active(),
 batch);
+            
officecfg::Office::Impress::Layout::Display::Contour::set(m_xCbxMoveOutline->get_active(),
 batch);
+            
officecfg::Office::Impress::Layout::Display::Guide::set(m_xCbxDragStripes->get_active(),
 batch);
+            
officecfg::Office::Impress::Layout::Display::Bezier::set(m_xCbxHandlesBezier->get_active(),
 batch);
+            batch->commit();
         }
-
-        batch->commit();
         bModified = true;
     }
     return bModified;
@@ -271,17 +268,17 @@ void SdTpOptionsContents::Reset( const SfxItemSet* )
 {
     if (m_bDrawMode)
     {
-        m_xCbxRuler->set_active( 
officecfg::Office::Draw::Layout::Display::Ruler::get() );
-        m_xCbxMoveOutline->set_active( 
officecfg::Office::Draw::Layout::Display::Contour::get() );
-        m_xCbxDragStripes->set_active( 
officecfg::Office::Draw::Layout::Display::Guide::get() );
-        m_xCbxHandlesBezier->set_active( 
officecfg::Office::Draw::Layout::Display::Bezier::get() );
+        
m_xCbxRuler->set_active(officecfg::Office::Draw::Layout::Display::Ruler::get());
+        
m_xCbxMoveOutline->set_active(officecfg::Office::Draw::Layout::Display::Contour::get());
+        
m_xCbxDragStripes->set_active(officecfg::Office::Draw::Layout::Display::Guide::get());
+        
m_xCbxHandlesBezier->set_active(officecfg::Office::Draw::Layout::Display::Bezier::get());
     }
     else
     {
-        
m_xCbxRuler->set_active(officecfg::Office::Impress::Layout::Display::Ruler::get()
 );
-        
m_xCbxMoveOutline->set_active(officecfg::Office::Impress::Layout::Display::Contour::get()
 );
-        
m_xCbxDragStripes->set_active(officecfg::Office::Impress::Layout::Display::Guide::get()
 );
-        
m_xCbxHandlesBezier->set_active(officecfg::Office::Impress::Layout::Display::Bezier::get()
 );
+        
m_xCbxRuler->set_active(officecfg::Office::Impress::Layout::Display::Ruler::get());
+        
m_xCbxMoveOutline->set_active(officecfg::Office::Impress::Layout::Display::Contour::get());
+        
m_xCbxDragStripes->set_active(officecfg::Office::Impress::Layout::Display::Guide::get());
+        
m_xCbxHandlesBezier->set_active(officecfg::Office::Impress::Layout::Display::Bezier::get());
     }
 
     bool bReadOnly = m_bDrawMode ? 
officecfg::Office::Draw::Layout::Display::Ruler::isReadOnly() :
@@ -419,7 +416,7 @@ SdTpOptionsMisc::SdTpOptionsMisc(weld::Container* pPage, 
weld::DialogController*
 
     // determine PoolUnit
     SfxItemPool* pPool = rInAttrs.GetPool();
-    assert(pPool && "Where is the Pool?");
+    DBG_ASSERT( pPool, "Where is the Pool?" );
     ePoolUnit = pPool->GetMetric( SID_ATTR_FILL_HATCH );
 
     // Fill the CB
diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx
index f6ef9c350428..3fc4c4089085 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)
         SetDragStripes( 
officecfg::Office::Impress::Layout::Display::Guide::get() );
         SetHlplSnap( officecfg::Office::Impress::Snap::Object::SnapLine::get() 
);
         SetHlplVisible( 
officecfg::Office::Impress::Layout::Display::Helpline::get() );
+        SetEliminatePolyPointLimitAngle( 
Degree100(officecfg::Office::Impress::Snap::Position::PointReduction::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() );
@@ -310,6 +311,7 @@ void FrameView::Update(SdOptions const * pOptions)
         SetDragStripes( officecfg::Office::Draw::Layout::Display::Guide::get() 
);
         SetHlplSnap( officecfg::Office::Draw::Snap::Object::SnapLine::get() );
         SetHlplVisible( 
officecfg::Office::Draw::Layout::Display::Helpline::get() );
+        SetEliminatePolyPointLimitAngle( 
Degree100(officecfg::Office::Draw::Snap::Position::PointReduction::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() 
);
@@ -325,7 +327,6 @@ void FrameView::Update(SdOptions const * pOptions)
     SetMoveOnlyDragging( pOptions->IsMoveOnlyDragging() );
     SetSlantButShear( pOptions->IsMoveOnlyDragging() );
     SetCrookNoContortion( pOptions->IsCrookNoContortion() );
-    SetEliminatePolyPointLimitAngle( 
pOptions->GetEliminatePolyPointLimitAngle() );
     GetModel().SetPickThroughTransparentTextFrames( pOptions->IsPickThrough() 
);
 
     SetSolidDragging( pOptions->IsSolidDragging() );

Reply via email to