sd/source/ui/view/drviewse.cxx | 15 ++++++++++++--- sd/source/ui/view/frmview.cxx | 13 ++++++++++++- 2 files changed, 24 insertions(+), 4 deletions(-)
New commits: commit 3029019cd930fd672ceda413376a26a33fdbad38 Author: Gabor Kelemen <[email protected]> AuthorDate: Tue Apr 16 14:16:19 2024 +0200 Commit: Gabor Kelemen <[email protected]> CommitDate: Fri Apr 26 09:38:25 2024 +0200 Use less SdOptionsLayout->IsRulerVisible/SetRulerVisible in favor of officecfg Change-Id: I0f6b38d364fb880e8dcd3cae08f2c5298cb7a5bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166594 Tested-by: Jenkins Reviewed-by: Gabor Kelemen <[email protected]> diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index a49ce83b15e3..d7cc62eb9ce0 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -96,6 +96,8 @@ #include <fuzoom.hxx> #include <sdmod.hxx> #include <basegfx/utils/zoomtools.hxx> +#include <officecfg/Office/Draw.hxx> +#include <officecfg/Office/Impress.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -1117,12 +1119,19 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) if(bOldHasRuler != bHasRuler) { - SdOptions* pOptions = SD_MOD()->GetSdOptions(GetDoc()->GetDocumentType()); + std::shared_ptr<comphelper::ConfigurationChanges> batch( + comphelper::ConfigurationChanges::create()); - if(pOptions && pOptions->IsRulerVisible() != bHasRuler) + if (GetDoc()->GetDocumentType() == DocumentType::Impress) { - pOptions->SetRulerVisible(bHasRuler); + officecfg::Office::Impress::Layout::Display::Ruler::set(bHasRuler, batch); } + else + { + officecfg::Office::Draw::Layout::Display::Ruler::set(bHasRuler, batch); + } + + batch->commit(); } Invalidate (SID_RULER); diff --git a/sd/source/ui/view/frmview.cxx b/sd/source/ui/view/frmview.cxx index 50cf9d636396..6d8fad05af9d 100644 --- a/sd/source/ui/view/frmview.cxx +++ b/sd/source/ui/view/frmview.cxx @@ -41,6 +41,7 @@ #include <comphelper/processfactory.hxx> #include <sfx2/viewfrm.hxx> #include <officecfg/Office/Common.hxx> +#include <officecfg/Office/Draw.hxx> #include <officecfg/Office/Impress.hxx> using namespace ::com::sun::star; @@ -280,7 +281,17 @@ void FrameView::Update(SdOptions const * pOptions) if (!pOptions) return; - mbRuler = pOptions->IsRulerVisible(); + SdDrawDocument* pDrawDocument = dynamic_cast<SdDrawDocument*>(&GetModel()); + + if (pDrawDocument->GetDocumentType() == DocumentType::Impress) + { + mbRuler = officecfg::Office::Impress::Layout::Display::Ruler::get(); + } + else + { + mbRuler = officecfg::Office::Draw::Layout::Display::Ruler::get(); + } + SetGridVisible( pOptions->IsGridVisible() ); SetSnapAngle( pOptions->GetAngle() ); SetGridSnap( pOptions->IsUseGridSnap() );
