From 68c17f5e97282eec6c59217eddd634da79f0e1f8 Mon Sep 17 00:00:00 2001 From: Heiko Tietze Date: Wed, 6 May 2026 12:37:03 +0200 Subject: [PATCH] Resolves tdf#128616 - Add decorations to manual page break marker line Show the page style on the page break line Change-Id: Iac9fa69e93bf234e12d22f011f12c8f6195a6653 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204868 Tested-by: Jenkins Reviewed-by: Heiko Tietze --- sw/source/uibase/docvw/DashedLine.cxx | 22 ++++++++++++++++--- .../uibase/docvw/FrameControlsManager.cxx | 3 ++- sw/source/uibase/docvw/PageBreakWin.cxx | 5 +++-- sw/source/uibase/inc/DashedLine.hxx | 5 +++-- sw/source/uibase/inc/PageBreakWin.hxx | 2 +- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/sw/source/uibase/docvw/DashedLine.cxx b/sw/source/uibase/docvw/DashedLine.cxx index 8c9a38f1375c..d30957168e04 100644 --- a/sw/source/uibase/docvw/DashedLine.cxx +++ b/sw/source/uibase/docvw/DashedLine.cxx @@ -9,19 +9,26 @@ #include +#include #include #include +#include +#include #include #include #include #include +#include +#include #include #include #include -SwDashedLine::SwDashedLine( vcl::Window* pParent, const Color& ( SwViewOption::* pColorFn )() const ) - : Control( pParent, WB_DIALOGCONTROL | WB_HORZ ) - , m_pColorFn( pColorFn ) +SwDashedLine::SwDashedLine(vcl::Window* pParent, const Color& (SwViewOption::*pColorFn)() const, + const OUString& rText) + : Control(pParent, WB_DIALOGCONTROL | WB_HORZ) + , m_pColorFn(pColorFn) + , m_sText(rText) { } @@ -84,6 +91,15 @@ void SwDashedLine::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan drawinglayer::attribute::StrokeAttribute(std::move(aStrokePattern)))); pProcessor->process(aSeq); + + if (!m_sText.isEmpty()) + { + vcl::Font rFont(rRenderContext.GetFont()); + rFont.SetFontHeight(aRect.GetHeight()); + rRenderContext.SetFont(rFont); + rRenderContext.SetTextFillColor(rRenderContext.GetBackgroundColor()); + rRenderContext.DrawText(aRect, m_sText, DrawTextFlags::Center | DrawTextFlags::VCenter); + }; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/docvw/FrameControlsManager.cxx b/sw/source/uibase/docvw/FrameControlsManager.cxx index 4ec8ae27f520..a2a6cd273602 100644 --- a/sw/source/uibase/docvw/FrameControlsManager.cxx +++ b/sw/source/uibase/docvw/FrameControlsManager.cxx @@ -125,8 +125,9 @@ void SwFrameControlsManager::SetPageBreakControl( const SwPageFrame* pPageFrame pControl = lb->second; else { + const OUString sPageStyleName = pPageFrame->GetPageDesc()->GetName().toString(); SwFrameControlPtr pNewControl = std::make_shared( - VclPtr::Create( m_pEditWin, pPageFrame ).get() ); + VclPtr::Create( m_pEditWin, pPageFrame, sPageStyleName ).get() ); const SwViewOption* pViewOpt = m_pEditWin->GetView().GetWrtShell().GetViewOptions(); pNewControl->SetReadonly( pViewOpt->IsReadonly() ); diff --git a/sw/source/uibase/docvw/PageBreakWin.cxx b/sw/source/uibase/docvw/PageBreakWin.cxx index fd99aad8e800..ade53b8875d7 100644 --- a/sw/source/uibase/docvw/PageBreakWin.cxx +++ b/sw/source/uibase/docvw/PageBreakWin.cxx @@ -61,8 +61,9 @@ using namespace basegfx; using namespace basegfx::utils; -SwBreakDashedLine::SwBreakDashedLine(SwEditWin* pEditWin, const SwFrame *pFrame) - : SwDashedLine(pEditWin, &SwViewOption::GetPageBreakColor) +SwBreakDashedLine::SwBreakDashedLine(SwEditWin* pEditWin, const SwFrame* pFrame, + const OUString& rText) + : SwDashedLine(pEditWin, &SwViewOption::GetPageBreakColor, rText) , m_pEditWin(pEditWin) , m_pFrame(pFrame) { diff --git a/sw/source/uibase/inc/DashedLine.hxx b/sw/source/uibase/inc/DashedLine.hxx index e958a9c462ca..e44fe4ba7182 100644 --- a/sw/source/uibase/inc/DashedLine.hxx +++ b/sw/source/uibase/inc/DashedLine.hxx @@ -17,11 +17,12 @@ class SwDashedLine : public Control { const Color& (SwViewOption::*m_pColorFn)() const; + const OUString m_sText; public: - SwDashedLine(vcl::Window* pParent, const Color& (SwViewOption::*pColorFn)() const); + SwDashedLine(vcl::Window* pParent, const Color& (SwViewOption::*pColorFn)() const, + const OUString& rText = u""_ustr); virtual ~SwDashedLine() override; - virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; }; diff --git a/sw/source/uibase/inc/PageBreakWin.hxx b/sw/source/uibase/inc/PageBreakWin.hxx index 83cca13ea8f0..14716d6a138d 100644 --- a/sw/source/uibase/inc/PageBreakWin.hxx +++ b/sw/source/uibase/inc/PageBreakWin.hxx @@ -39,7 +39,7 @@ private: SwPageBreakWin& GetOrCreateWin(); public: - SwBreakDashedLine(SwEditWin* pEditWin, const SwFrame *pFrame); + SwBreakDashedLine(SwEditWin* pEditWin, const SwFrame *pFrame, const OUString& rText = u""_ustr); virtual ~SwBreakDashedLine() override { disposeOnce(); } virtual void dispose() override { m_pWin.disposeAndClear(); m_pEditWin.reset(); SwDashedLine::dispose(); }