diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2023-07-10 17:09:14 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2023-07-10 20:46:27 +0200 |
commit | f7974dc8d6d0cca08da52c4fbdb312ed6b7d71da (patch) | |
tree | 80c66e1ec748a75e996300d65f6ebb282252d25d /sw | |
parent | c6619100ed6d0524ac5294c1a9e1467a4371aee0 (diff) |
tdf#148729 sw: PDF export: fix link targets when "comments in margin"
... is enabled but there are no comments; the conditions in
SwViewShell::PrintOrPDFExport() and
SwEnhancedPDFExportHelper::SwRectToPDFRect() were out of sync.
(regression from commit c77e01d63b4bd4805c4a499e4e0cab917d0eb403)
Change-Id: I617185e6f30843a79190a54b73a5f44666697388
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154279
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/inc/vprint.hxx (renamed from sw/source/core/view/vprint.hxx) | 7 | ||||
-rw-r--r-- | sw/source/core/text/EnhancedPDFExportHelper.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/view/viewpg.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/view/vprint.cxx | 18 |
4 files changed, 25 insertions, 8 deletions
diff --git a/sw/source/core/view/vprint.hxx b/sw/source/core/inc/vprint.hxx index 60f2750caeb9..9d2c7fe3722f 100644 --- a/sw/source/core/view/vprint.hxx +++ b/sw/source/core/inc/vprint.hxx @@ -22,6 +22,13 @@ class SwRootFrame; class SwPageFrame; +class SwPrintData; + SwPageFrame const* sw_getPage(SwRootFrame const& rLayout, sal_Int32 const nPage); +namespace sw +{ +bool IsShrinkPageForPostIts(SwViewShell const& rShell, SwPrintData const&); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index 431137a92257..25be18e0d521 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -74,6 +74,7 @@ #include <i18nlangtag/languagetag.hxx> #include <IMark.hxx> #include <printdata.hxx> +#include <vprint.hxx> #include <SwNodeNum.hxx> #include <calbck.hxx> #include <stack> @@ -1714,9 +1715,10 @@ SwEnhancedPDFExportHelper::~SwEnhancedPDFExportHelper() tools::Rectangle SwEnhancedPDFExportHelper::SwRectToPDFRect(const SwPageFrame* pCurrPage, const tools::Rectangle& rRectangle) const { - SwPostItMode nPostItMode = mrPrintData.GetPrintPostIts(); - if (nPostItMode != SwPostItMode::InMargins) + if (!::sw::IsShrinkPageForPostIts(mrSh, mrPrintData)) // tdf#148729 + { return rRectangle; + } //the page has been scaled by 75% and vertically centered, so adjust these //rectangles equivalently tools::Rectangle aRect(rRectangle); diff --git a/sw/source/core/view/viewpg.cxx b/sw/source/core/view/viewpg.cxx index 4d2385483c92..02ebd1a69e12 100644 --- a/sw/source/core/view/viewpg.cxx +++ b/sw/source/core/view/viewpg.cxx @@ -28,7 +28,7 @@ #include <ptqueue.hxx> #include <fntcache.hxx> -#include "vprint.hxx" +#include <vprint.hxx> using namespace ::com::sun::star; diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 3cd0c524007e..bc5dd5bd6c86 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -47,7 +47,7 @@ #include <viscrs.hxx> #include <fmtpdsc.hxx> #include <PostItMgr.hxx> -#include "vprint.hxx" +#include <vprint.hxx> using namespace ::com::sun::star; @@ -429,6 +429,17 @@ sw_getPage(SwRootFrame const& rLayout, sal_Int32 const nPage) return nullptr; } +namespace sw +{ + // tdf#91680 Reserve space in margin for comments only if there are comments + bool IsShrinkPageForPostIts(SwViewShell const& rShell, SwPrintData const& rPrintData) + { + SwPostItMode const nPostItMode(rPrintData.GetPrintPostIts()); + return nPostItMode == SwPostItMode::InMargins + && sw_GetPostIts(rShell.GetDoc()->getIDocumentFieldsAccess(), nullptr); + } +} + bool SwViewShell::PrintOrPDFExport( OutputDevice *pOutDev, SwPrintData const& rPrintData, @@ -446,11 +457,8 @@ bool SwViewShell::PrintOrPDFExport( // output device is now provided by a call from outside the Writer) pOutDev->Push(); - SwPostItMode nPostItMode = rPrintData.GetPrintPostIts(); - // tdf#91680 Reserve space in margin for comments only if there are comments - const bool bHasPostItsToPrintInMargins = ( nPostItMode == SwPostItMode::InMargins ) && - sw_GetPostIts( GetDoc()->getIDocumentFieldsAccess(), nullptr ); + const bool bHasPostItsToPrintInMargins(::sw::IsShrinkPageForPostIts(*this, rPrintData)); ::std::optional<tools::Long> oOrigHeight; // Print/PDF export for (multi-)selection has already generated a |