/src/libreoffice/sw/source/uibase/inc/HeaderFooterWin.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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 |
11 | | |
12 | | #include "edtwin.hxx" |
13 | | #include "DashedLine.hxx" |
14 | | #include "FrameControl.hxx" |
15 | | #include <vcl/timer.hxx> |
16 | | #include <drawinglayer/primitive2d/Primitive2DContainer.hxx> |
17 | | |
18 | | namespace weld |
19 | | { |
20 | | class MenuButton; |
21 | | } |
22 | | |
23 | | /** |
24 | | * Button painter helper class used to paint a runtime button positioned to a writer frame. |
25 | | * See header/footer button. |
26 | | */ |
27 | | class SwFrameButtonPainter |
28 | | { |
29 | | public: |
30 | | |
31 | | static void PaintButton(drawinglayer::primitive2d::Primitive2DContainer& rSeq, |
32 | | const tools::Rectangle& rRect, bool bOnTop); |
33 | | }; |
34 | | |
35 | | class SwHeaderFooterWin; |
36 | | |
37 | | /** Class for the header and footer separator control window. |
38 | | |
39 | | This control is showing the header / footer style name and provides |
40 | | a few useful actions to the user. |
41 | | */ |
42 | | class SwHeaderFooterDashedLine final : public SwDashedLine, public ISwFrameControl |
43 | | { |
44 | | private: |
45 | | VclPtr<SwHeaderFooterWin> m_pWin; |
46 | | VclPtr<SwEditWin> m_pEditWin; |
47 | | const SwFrame* m_pFrame; |
48 | | bool m_bIsHeader; |
49 | | |
50 | | void EnsureWin(); |
51 | | |
52 | | bool IsOnScreen(); |
53 | | |
54 | | public: |
55 | | SwHeaderFooterDashedLine(SwEditWin* pEditWin, const SwFrame *pFrame, bool bIsHeader); |
56 | | |
57 | 0 | virtual ~SwHeaderFooterDashedLine() override { disposeOnce(); } |
58 | 0 | virtual void dispose() override { m_pWin.disposeAndClear(); m_pEditWin.reset(); SwDashedLine::dispose(); } |
59 | | |
60 | 0 | virtual const SwFrame* GetFrame() override { return m_pFrame; } |
61 | 0 | virtual SwEditWin* GetEditWin() override { return m_pEditWin; } |
62 | | virtual void ShowAll(bool bShow) override; |
63 | | virtual bool Contains(const Point &rDocPt) const override; |
64 | | virtual void SetReadonly(bool bReadonly) override; |
65 | | |
66 | | void SetOffset( Point aOffset, tools::Long nXLineStart, tools::Long nXLineEnd ); |
67 | 0 | bool IsHeader() const { return m_bIsHeader; }; |
68 | | }; |
69 | | |
70 | | class SwHeaderFooterWin final : public InterimItemWindow |
71 | | { |
72 | | std::unique_ptr<weld::MenuButton> m_xMenuButton; |
73 | | std::unique_ptr<weld::Button> m_xPushButton; |
74 | | VclPtr<SwEditWin> m_pEditWin; |
75 | | VclPtr<VirtualDevice> m_xVirDev; |
76 | | const SwFrame* m_pFrame; |
77 | | OUString m_sLabel; |
78 | | bool m_bIsHeader; |
79 | | bool m_bIsAppearing; |
80 | | int m_nFadeRate; |
81 | | Timer m_aFadeTimer; |
82 | | |
83 | | public: |
84 | | SwHeaderFooterWin(SwEditWin *pEditWin, const SwFrame *pFrame, bool bHeader); |
85 | | virtual ~SwHeaderFooterWin( ) override; |
86 | | virtual void dispose() override; |
87 | | |
88 | | void SetOffset(Point aOffset); |
89 | | void ShowAll(bool bShow); |
90 | | bool Contains(const Point &rDocPt) const; |
91 | | |
92 | | bool IsEmptyHeaderFooter( ) const; |
93 | | |
94 | | void ExecuteCommand(std::u16string_view rIdent); |
95 | | |
96 | | private: |
97 | | DECL_LINK(FadeHandler, Timer *, void); |
98 | | DECL_LINK(ClickHdl, weld::Button&, void); |
99 | | DECL_LINK(SelectHdl, const OUString&, void); |
100 | | void PaintButton(); |
101 | | }; |
102 | | |
103 | | #endif |
104 | | |
105 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |