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 <heiko.tietze@documentfoundation.org>
This commit is contained in:
committed by
Heiko Tietze
parent
1fe039c6f8
commit
68c17f5e97
@@ -9,19 +9,26 @@
|
||||
|
||||
#include <DashedLine.hxx>
|
||||
|
||||
#include <basegfx/matrix/b2dhommatrixtools.hxx>
|
||||
#include <basegfx/color/bcolortools.hxx>
|
||||
#include <basegfx/polygon/b2dpolygon.hxx>
|
||||
#include <drawinglayer/attribute/fontattribute.hxx>
|
||||
#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
|
||||
#include <drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx>
|
||||
#include <drawinglayer/primitive2d/PolyPolygonStrokePrimitive2D.hxx>
|
||||
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
|
||||
#include <drawinglayer/processor2d/processor2dtools.hxx>
|
||||
#include <drawinglayer/primitive2d/textprimitive2d.hxx>
|
||||
#include <vcl/metric.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/settings.hxx>
|
||||
#include <memory>
|
||||
|
||||
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: */
|
||||
|
||||
@@ -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<SwFrameControl>(
|
||||
VclPtr<SwBreakDashedLine>::Create( m_pEditWin, pPageFrame ).get() );
|
||||
VclPtr<SwBreakDashedLine>::Create( m_pEditWin, pPageFrame, sPageStyleName ).get() );
|
||||
const SwViewOption* pViewOpt = m_pEditWin->GetView().GetWrtShell().GetViewOptions();
|
||||
pNewControl->SetReadonly( pViewOpt->IsReadonly() );
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
Reference in New Issue
Block a user