Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / uibase / inc / HeaderFooterWin.hxx
blob6931e00f82d00d39015090dd5b86b31c0872ce01
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_HEADERFOOTERWIN_HXX
10 #define INCLUDED_SW_SOURCE_UIBASE_INC_HEADERFOOTERWIN_HXX
12 #include "edtwin.hxx"
13 #include "DashedLine.hxx"
14 #include "FrameControl.hxx"
15 #include <vcl/timer.hxx>
16 #include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
18 /**
19 * Button painter helper class used to paint a runtime button positioned to a writer frame.
20 * See header/footer button.
22 class SwFrameButtonPainter
24 public:
26 static void PaintButton(drawinglayer::primitive2d::Primitive2DContainer& rSeq,
27 const tools::Rectangle& rRect, bool bOnTop);
30 class SwHeaderFooterWin;
32 /** Class for the header and footer separator control window.
34 This control is showing the header / footer style name and provides
35 a few useful actions to the user.
37 class SwHeaderFooterDashedLine final : public SwDashedLine, public ISwFrameControl
39 private:
40 VclPtr<SwHeaderFooterWin> m_pWin;
41 VclPtr<SwEditWin> m_pEditWin;
42 const SwFrame* m_pFrame;
43 bool m_bIsHeader;
45 void EnsureWin();
47 bool IsOnScreen();
49 public:
50 SwHeaderFooterDashedLine(SwEditWin* pEditWin, const SwFrame *pFrame, bool bIsHeader);
52 virtual ~SwHeaderFooterDashedLine() override { disposeOnce(); }
53 virtual void dispose() override { m_pWin.disposeAndClear(); m_pEditWin.clear(); SwDashedLine::dispose(); }
55 virtual const SwFrame* GetFrame() override { return m_pFrame; }
56 virtual SwEditWin* GetEditWin() override { return m_pEditWin; }
57 virtual void ShowAll(bool bShow) override;
58 virtual bool Contains(const Point &rDocPt) const override;
59 virtual void SetReadonly(bool bReadonly) override;
61 void SetOffset( Point aOffset, tools::Long nXLineStart, tools::Long nXLineEnd );
62 bool IsHeader() const { return m_bIsHeader; };
65 class SwHeaderFooterWin final : public InterimItemWindow
67 std::unique_ptr<weld::MenuButton> m_xMenuButton;
68 std::unique_ptr<weld::Button> m_xPushButton;
69 VclPtr<SwEditWin> m_pEditWin;
70 VclPtr<VirtualDevice> m_xVirDev;
71 const SwFrame* m_pFrame;
72 OUString m_sLabel;
73 bool m_bIsHeader;
74 bool m_bIsAppearing;
75 int m_nFadeRate;
76 Timer m_aFadeTimer;
78 public:
79 SwHeaderFooterWin(SwEditWin *pEditWin, const SwFrame *pFrame, bool bHeader);
80 virtual ~SwHeaderFooterWin( ) override;
81 virtual void dispose() override;
83 void SetOffset(Point aOffset);
84 void ShowAll(bool bShow);
85 bool Contains(const Point &rDocPt) const;
87 bool IsEmptyHeaderFooter( ) const;
89 void ExecuteCommand(std::u16string_view rIdent);
91 private:
92 DECL_LINK(FadeHandler, Timer *, void);
93 DECL_LINK(ClickHdl, weld::Button&, void);
94 DECL_LINK(SelectHdl, const OUString&, void);
95 void PaintButton();
98 #endif
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */