sd/source/core/drawdoc.cxx  |    3 ++-
 sd/source/ui/app/sdmod2.cxx |   10 ++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit edcfc1ba8ea4159c3c6f24b43f65ffe0b7b897a3
Author:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
AuthorDate: Thu Apr 25 10:21:21 2024 +0200
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Fri May 10 14:11:23 2024 +0200

    Use less SdOptionsZoom->GetScale/SetScale in favor of officecfg
    
    Change-Id: I34fca9ba9546f10268d22f92aaa5249d88f607d0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166629
    Tested-by: Jenkins
    Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>

diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 55e3a1fe6240..237deadabd30 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -158,7 +158,8 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, 
SfxObjectShell* pDrDocSh)
     // Set measuring unit (of the application) and scale (of SdMod)
     sal_Int32 nX, nY;
     SdOptions* pOptions = SD_MOD()->GetSdOptions(meDocType);
-    pOptions->GetScale( nX, nY );
+    nX = officecfg::Office::Draw::Zoom::ScaleX::get();
+    nY = officecfg::Office::Draw::Zoom::ScaleY::get();
     SvtSysLocale aSysLocale;
 
     // Allow UI scale only for draw documents.
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index 7e98287c2bc7..a30c4f303016 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -543,7 +543,8 @@ std::optional<SfxItemSet> SdModule::CreateItemSet( 
sal_uInt16 nSlot )
     else
     {
         // Get options from configuration file
-        pOptions->GetScale( nX, nY );
+        nX = officecfg::Office::Draw::Zoom::ScaleX::get();
+        nY = officecfg::Office::Draw::Zoom::ScaleY::get();
     }
 
     aRet.Put( SfxInt32Item( ATTR_OPTIONS_SCALE_X, nX ) );
@@ -660,7 +661,12 @@ void SdModule::ApplyItemSet( sal_uInt16 nSlot, const 
SfxItemSet& rSet )
         if( pItem )
         {
             sal_Int32 nY = pItem->GetValue();
-            pOptions->SetScale( nX, nY );
+            std::shared_ptr<comphelper::ConfigurationChanges> batch(
+                comphelper::ConfigurationChanges::create());
+
+            officecfg::Office::Draw::Zoom::ScaleX::set(nX, batch);
+            officecfg::Office::Draw::Zoom::ScaleY::set(nY, batch);
+            batch->commit();
 
             // Apply to document only if doc type match
             if( pDocSh && pDoc && eDocType == pDoc->GetDocumentType() )

Reply via email to