sd/source/ui/app/sdmod2.cxx | 7 +++++++ sd/source/ui/dlg/tpoption.cxx | 24 ++++++++++++++++++++---- sd/source/ui/inc/tpoption.hxx | 5 +++++ 3 files changed, 32 insertions(+), 4 deletions(-)
New commits: commit 34d3f383b62ebd87f842e48e6627dbf5ed369667 Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Mon Nov 27 14:03:20 2023 +0100 Commit: Balazs Varga <balazs.varga.ext...@allotropia.de> CommitDate: Wed Nov 29 09:45:40 2023 +0100 tdf#158243 - UI: Part 44 - Unify lockdown behavior of Options dialog for Draw - View Page. Change-Id: If06945482e5a441903d6eb44b66242bd8806bcd6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159995 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx index cccf425172bc..8a6424d16263 100644 --- a/sd/source/ui/app/sdmod2.cxx +++ b/sd/source/ui/app/sdmod2.cxx @@ -736,7 +736,14 @@ std::unique_ptr<SfxTabPage> SdModule::CreateTabPage( sal_uInt16 nId, weld::Conta { ::CreateTabPage fnCreatePage = pFact->GetSdOptionsContentsTabPageCreatorFunc(); if( fnCreatePage ) + { xRet = (*fnCreatePage)( pPage, pController, &rSet ); + if (SID_SD_TP_CONTENTS == nId) + aSet.Put(SfxUInt32Item(SID_SDMODE_FLAG, SD_DRAW_MODE)); + else + aSet.Put(SfxUInt32Item(SID_SDMODE_FLAG, SD_IMPRESS_MODE)); + xRet->PageCreated(aSet); + } } break; case SID_SD_TP_SNAP: diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx index f6f5b4f5aa7e..8c5416c9cb09 100644 --- a/sd/source/ui/dlg/tpoption.cxx +++ b/sd/source/ui/dlg/tpoption.cxx @@ -148,6 +148,7 @@ std::unique_ptr<SfxTabPage> SdTpOptionsSnap::Create( weld::Container* pPage, wel \************************************************************************/ SdTpOptionsContents::SdTpOptionsContents(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs) : SfxTabPage(pPage, pController, "modules/simpress/ui/sdviewpage.ui", "SdViewPage", &rInAttrs) + , m_bDrawMode(false) , m_xCbxRuler(m_xBuilder->weld_check_button("ruler")) , m_xCbxRulerImg(m_xBuilder->weld_widget("lockruler")) , m_xCbxDragStripes(m_xBuilder->weld_check_button("dragstripes")) @@ -216,19 +217,23 @@ void SdTpOptionsContents::Reset( const SfxItemSet* rAttrs ) m_xCbxDragStripes->set_active( aLayoutItem.GetOptionsLayout().IsDragStripes() ); m_xCbxHandlesBezier->set_active( aLayoutItem.GetOptionsLayout().IsHandlesBezier() ); - bool bReadOnly = officecfg::Office::Impress::Layout::Display::Ruler::isReadOnly(); + bool bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Layout::Display::Ruler::isReadOnly() : + officecfg::Office::Impress::Layout::Display::Ruler::isReadOnly(); m_xCbxRuler->set_sensitive(!bReadOnly); m_xCbxRulerImg->set_visible(bReadOnly); - bReadOnly = officecfg::Office::Impress::Layout::Display::Contour::isReadOnly(); + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Layout::Display::Contour::isReadOnly() : + officecfg::Office::Impress::Layout::Display::Contour::isReadOnly(); m_xCbxMoveOutline->set_sensitive(!bReadOnly); m_xCbxMoveOutlineImg->set_visible(bReadOnly); - bReadOnly = officecfg::Office::Impress::Layout::Display::Guide::isReadOnly(); + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Layout::Display::Guide::isReadOnly() : + officecfg::Office::Impress::Layout::Display::Guide::isReadOnly(); m_xCbxDragStripes->set_sensitive(!bReadOnly); m_xCbxDragStripesImg->set_visible(bReadOnly); - bReadOnly = officecfg::Office::Impress::Layout::Display::Bezier::isReadOnly(); + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Layout::Display::Bezier::isReadOnly() : + officecfg::Office::Impress::Layout::Display::Bezier::isReadOnly(); m_xCbxHandlesBezier->set_sensitive(!bReadOnly); m_xCbxHandlesBezierImg->set_visible(bReadOnly); @@ -244,6 +249,17 @@ std::unique_ptr<SfxTabPage> SdTpOptionsContents::Create( weld::Container* pPage, return std::make_unique<SdTpOptionsContents>(pPage, pController, *rAttrs); } +void SdTpOptionsContents::PageCreated( const SfxAllItemSet& aSet ) +{ + const SfxUInt32Item* pFlagItem = aSet.GetItem<SfxUInt32Item>(SID_SDMODE_FLAG, false); + if (pFlagItem) + { + sal_uInt32 nFlags = pFlagItem->GetValue(); + if ((nFlags & SD_DRAW_MODE) == SD_DRAW_MODE) + SetDrawMode(); + } +} + /************************************************************************* |* |* TabPage to adjust the misc options diff --git a/sd/source/ui/inc/tpoption.hxx b/sd/source/ui/inc/tpoption.hxx index e53c55284cf0..e1065eb28b1b 100644 --- a/sd/source/ui/inc/tpoption.hxx +++ b/sd/source/ui/inc/tpoption.hxx @@ -42,6 +42,7 @@ public: class SdTpOptionsContents final : public SfxTabPage { private: + bool m_bDrawMode; std::unique_ptr<weld::CheckButton> m_xCbxRuler; std::unique_ptr<weld::Widget> m_xCbxRulerImg; std::unique_ptr<weld::CheckButton> m_xCbxDragStripes; @@ -60,6 +61,10 @@ public: virtual bool FillItemSet( SfxItemSet* ) override; virtual void Reset( const SfxItemSet * ) override; + + virtual void PageCreated(const SfxAllItemSet& aSet) override; + + void SetDrawMode() { m_bDrawMode = true; } }; /**