sw/source/core/view/pagepreviewlayout.cxx | 1 + sw/source/uibase/app/appopt.cxx | 6 ++++++ sw/source/uibase/inc/pview.hxx | 4 ++++ sw/source/uibase/uiview/pview.cxx | 10 ++++++++++ 4 files changed, 21 insertions(+)
New commits: commit 6ff39165c3787b7d5994c641712180a4746f0581 Author: Oliver Specht <oliver.spe...@cib.de> AuthorDate: Tue Oct 22 16:10:24 2024 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Mon Oct 28 11:06:30 2024 +0100 tdf#161538 update page preview on changed printer settings Updates the print preview if show/hide automatically generated empty pages is changed. Change-Id: I8ee53c575edb31f16556a66037260cf79f0fb4a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175416 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> (cherry picked from commit b310be24bc0af0871133e55057e3528148346660) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175608 Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index b363d1a42fa6..35bf15bdc48c 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -250,6 +250,7 @@ void SwPagePreviewLayout::ApplyNewZoomAtViewShell( sal_uInt8 _aNewZoom ) */ void SwPagePreviewLayout::ReInit() { + mbPrintEmptyPages = mrParentViewShell.getIDocumentDeviceAccess().getPrintData().IsPrintEmptyPages(); // check environment and parameters { bool bLayoutSettingsValid = mbLayoutInfoValid && mbLayoutSizesValid; diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 32bc1f8d4cae..74d650ccf341 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -379,6 +379,12 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) if (pOpt) { *pOpt = *pAddPrinterAttr; + SwPagePreview* pPagePreview = dynamic_cast<SwPagePreview*>( SfxViewShell::Current()); + if( pPagePreview !=nullptr ) + { + pPagePreview->GetViewShell()->getIDocumentDeviceAccess().setPrintData(*pOpt); + pPagePreview->PrintSettingsChanged(); + } } } diff --git a/sw/source/uibase/inc/pview.hxx b/sw/source/uibase/inc/pview.hxx index e14ff5d419e7..b024f9e59fe5 100644 --- a/sw/source/uibase/inc/pview.hxx +++ b/sw/source/uibase/inc/pview.hxx @@ -152,6 +152,8 @@ public: bool SetBookPreviewMode( const bool _bBookPreview ); virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override; + + void ReInit(); }; /** @@ -289,6 +291,8 @@ public: */ void SetVScrollbarThumbPos( const sal_uInt16 _nNewThumbPos ); + void PrintSettingsChanged(); + SwPagePreview(SfxViewFrame& rFrame, SfxViewShell*); virtual ~SwPagePreview() override; }; diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 25694534a179..9e7646c1b295 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -579,6 +579,10 @@ void SwPagePreviewWin::DataChanged( const DataChangedEvent& rDCEvt ) } } +void SwPagePreviewWin::ReInit() +{ + mpPgPreviewLayout->ReInit(); +} /** help method to execute SfxRequest FN_PAGEUP and FN_PAGEDOWN */ void SwPagePreview::ExecPgUpAndPgDown( const bool _bPgUp, SfxRequest* _pReq ) @@ -1390,6 +1394,12 @@ void SwPagePreview::SetVisArea( const tools::Rectangle &rRect ) m_pViewWin->Invalidate(); } +void SwPagePreview::PrintSettingsChanged() +{ + m_pViewWin->ReInit(); + ChgPage( SwPagePreviewWin::MV_DOC_STT ); +} + IMPL_LINK(SwPagePreview, HoriScrollHdl, weld::Scrollbar&, rScrollbar, void) { ScrollHdl(rScrollbar, true);