sd/source/ui/dlg/prntopts.cxx | 76 +++++++++++++++++++++++++++++------------- sd/source/ui/inc/prntopts.hxx | 2 + 2 files changed, 55 insertions(+), 23 deletions(-)
New commits: commit 05f60be48a51a64ce99a7a7b62ae030002b16a14 Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Tue Nov 28 14:06:09 2023 +0100 Commit: Balazs Varga <balazs.varga.ext...@allotropia.de> CommitDate: Wed Nov 29 11:00:41 2023 +0100 tdf#158245 - UI: Part 46 - Unify lockdown behavior of Options dialog for Draw - Print Page. Change-Id: I9c5004253b0b871a14fe92475339cdad598491a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160027 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> diff --git a/sd/source/ui/dlg/prntopts.cxx b/sd/source/ui/dlg/prntopts.cxx index 6a608932adce..0349fe688919 100644 --- a/sd/source/ui/dlg/prntopts.cxx +++ b/sd/source/ui/dlg/prntopts.cxx @@ -23,12 +23,14 @@ #include <app.hrc> #include <svl/intitem.hxx> #include <officecfg/Office/Impress.hxx> +#include <officecfg/Office/Draw.hxx> /** * dialog to adjust print options */ SdPrintOptions::SdPrintOptions(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs) : SfxTabPage(pPage, pController, "modules/simpress/ui/prntopts.ui", "prntopts", &rInAttrs) + , m_bDrawMode(false) , m_xFrmContent(m_xBuilder->weld_frame("contentframe")) , m_xCbxDraw(m_xBuilder->weld_check_button("drawingcb")) , m_xCbxNotes(m_xBuilder->weld_check_button("notecb")) @@ -200,41 +202,59 @@ void SdPrintOptions::Reset( const SfxItemSet* rAttrs ) m_xRbtBlackWhite->set_active(true); } - bool bReadOnly = officecfg::Office::Impress::Print::Page::PageSize::isReadOnly() || - officecfg::Office::Impress::Print::Page::PageTile::isReadOnly() || - officecfg::Office::Impress::Print::Page::Booklet::isReadOnly(); + bool bReadOnly = false; + if (m_bDrawMode) + { + bReadOnly = officecfg::Office::Draw::Print::Page::PageSize::isReadOnly() || + officecfg::Office::Draw::Print::Page::PageTile::isReadOnly() || + officecfg::Office::Draw::Print::Page::Booklet::isReadOnly(); + } + else + { + bReadOnly = officecfg::Office::Impress::Print::Page::PageSize::isReadOnly() || + officecfg::Office::Impress::Print::Page::PageTile::isReadOnly() || + officecfg::Office::Impress::Print::Page::Booklet::isReadOnly(); + } m_xGridPageOpt->set_sensitive(!bReadOnly); m_xRbtPageOptImg->set_visible(bReadOnly); - bReadOnly = officecfg::Office::Impress::Print::Page::BookletFront::isReadOnly(); + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Print::Page::BookletFront::isReadOnly() : + officecfg::Office::Impress::Print::Page::BookletFront::isReadOnly(); m_xCbxFront->set_sensitive(!bReadOnly); m_xCbxFrontImg->set_visible(bReadOnly); - bReadOnly = officecfg::Office::Impress::Print::Page::BookletBack::isReadOnly(); + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Print::Page::BookletBack::isReadOnly() : + officecfg::Office::Impress::Print::Page::BookletBack::isReadOnly(); m_xCbxBack->set_sensitive(!bReadOnly); m_xCbxBackImg->set_visible(bReadOnly); - bReadOnly = officecfg::Office::Impress::Print::Other::FromPrinterSetup::isReadOnly(); + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Print::Other::FromPrinterSetup::isReadOnly() : + officecfg::Office::Impress::Print::Other::FromPrinterSetup::isReadOnly(); m_xCbxPaperbin->set_sensitive(!bReadOnly); m_xCbxPaperbinImg->set_visible(bReadOnly); - bReadOnly = officecfg::Office::Impress::Print::Other::PageName::isReadOnly(); + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Print::Other::PageName::isReadOnly() : + officecfg::Office::Impress::Print::Other::PageName::isReadOnly(); m_xCbxPagename->set_sensitive(!bReadOnly); m_xCbxPagenameImg->set_visible(bReadOnly); - bReadOnly = officecfg::Office::Impress::Print::Other::Date::isReadOnly(); + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Print::Other::Date::isReadOnly() : + officecfg::Office::Impress::Print::Other::Date::isReadOnly(); m_xCbxDate->set_sensitive(!bReadOnly); m_xCbxDateImg->set_visible(bReadOnly); - bReadOnly = officecfg::Office::Impress::Print::Other::Time::isReadOnly(); + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Print::Other::Time::isReadOnly() : + officecfg::Office::Impress::Print::Other::Time::isReadOnly(); m_xCbxTime->set_sensitive(!bReadOnly); m_xCbxTimeImg->set_visible(bReadOnly); - bReadOnly = officecfg::Office::Impress::Print::Other::HiddenPage::isReadOnly(); + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Print::Other::HiddenPage::isReadOnly() : + officecfg::Office::Impress::Print::Other::HiddenPage::isReadOnly(); m_xCbxHiddenPages->set_sensitive(!bReadOnly); m_xCbxHiddenPagesImg->set_visible(bReadOnly); - bReadOnly = officecfg::Office::Impress::Print::Other::Quality::isReadOnly(); + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Print::Other::Quality::isReadOnly() : + officecfg::Office::Impress::Print::Other::Quality::isReadOnly(); m_xRbtColor->set_sensitive(!bReadOnly); m_xRbtGrayscale->set_sensitive(!bReadOnly); m_xRbtBlackWhite->set_sensitive(!bReadOnly); @@ -281,13 +301,25 @@ IMPL_LINK_NOARG(SdPrintOptions, ClickBookletHdl, weld::Toggleable&, void) void SdPrintOptions::updateControls() { - m_xCbxFront->set_sensitive(m_xRbtBooklet->get_active() && !officecfg::Office::Impress::Print::Page::BookletFront::isReadOnly()); - m_xCbxBack->set_sensitive(m_xRbtBooklet->get_active() && !officecfg::Office::Impress::Print::Page::BookletBack::isReadOnly()); + bool bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Print::Page::BookletFront::isReadOnly() : + officecfg::Office::Impress::Print::Page::BookletFront::isReadOnly(); + m_xCbxFront->set_sensitive(m_xRbtBooklet->get_active() && !bReadOnly); + + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Print::Page::BookletBack::isReadOnly() : + officecfg::Office::Impress::Print::Page::BookletBack::isReadOnly(); + m_xCbxBack->set_sensitive(m_xRbtBooklet->get_active() && !bReadOnly); - m_xCbxDate->set_sensitive( !m_xRbtBooklet->get_active() && !officecfg::Office::Impress::Print::Other::Date::isReadOnly() ); - m_xCbxTime->set_sensitive( !m_xRbtBooklet->get_active() && !officecfg::Office::Impress::Print::Other::Time::isReadOnly() ); + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Print::Other::Date::isReadOnly() : + officecfg::Office::Impress::Print::Other::Date::isReadOnly(); + m_xCbxDate->set_sensitive(!m_xRbtBooklet->get_active() && !bReadOnly); - m_xCbxPagename->set_sensitive( !m_xRbtBooklet->get_active() && !officecfg::Office::Impress::Print::Other::PageName::isReadOnly() && + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Print::Other::Time::isReadOnly() : + officecfg::Office::Impress::Print::Other::Time::isReadOnly(); + m_xCbxTime->set_sensitive(!m_xRbtBooklet->get_active() && !bReadOnly); + + bReadOnly = m_bDrawMode ? officecfg::Office::Draw::Print::Other::PageName::isReadOnly() : + officecfg::Office::Impress::Print::Other::PageName::isReadOnly(); + m_xCbxPagename->set_sensitive( !m_xRbtBooklet->get_active() && !bReadOnly && (m_xCbxDraw->get_active() || m_xCbxNotes->get_active() || m_xCbxOutline->get_active()) ); } @@ -299,20 +331,18 @@ void SdPrintOptions::SetDrawMode() } } -void SdPrintOptions::PageCreated (const SfxAllItemSet& -#ifdef MACOSX - aSet -#endif - ) +void SdPrintOptions::PageCreated (const SfxAllItemSet& aSet) { -#ifdef MACOSX 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(); + m_bDrawMode = true; } +#ifdef MACOSX + if (m_bDrawMode) + SetDrawMode(); #else SetDrawMode(); #endif diff --git a/sd/source/ui/inc/prntopts.hxx b/sd/source/ui/inc/prntopts.hxx index abeb84ee3bd6..2c391ae3283a 100644 --- a/sd/source/ui/inc/prntopts.hxx +++ b/sd/source/ui/inc/prntopts.hxx @@ -26,6 +26,8 @@ class SdPrintOptions final : public SfxTabPage friend class SdModule; private: + bool m_bDrawMode; + std::unique_ptr<weld::Frame> m_xFrmContent; std::unique_ptr<weld::CheckButton> m_xCbxDraw; std::unique_ptr<weld::CheckButton> m_xCbxNotes;