/src/libreoffice/sw/source/uibase/inc/PageBreakWin.hxx
Line | Count | Source (jump to first uncovered line) |
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_PAGEBREAKWIN_HXX |
10 | | #define INCLUDED_SW_SOURCE_UIBASE_INC_PAGEBREAKWIN_HXX |
11 | | |
12 | | #include "edtwin.hxx" |
13 | | #include "DashedLine.hxx" |
14 | | #include "FrameControl.hxx" |
15 | | #include <vcl/timer.hxx> |
16 | | #include <optional> |
17 | | |
18 | | class SwPageBreakWin; |
19 | | |
20 | | /** Class for the page break control window. |
21 | | |
22 | | This control shows a line indicating a manual page break and a |
23 | | button providing a few actions on that page break. |
24 | | */ |
25 | | class SwBreakDashedLine final : public SwDashedLine, public ISwFrameControl |
26 | | { |
27 | | private: |
28 | | VclPtr<SwPageBreakWin> m_pWin; |
29 | | VclPtr<SwEditWin> m_pEditWin; |
30 | | std::optional<Point> m_xMousePt; |
31 | | ::tools::Rectangle m_aBtnRect; |
32 | | const SwFrame* m_pFrame; |
33 | | |
34 | | SwPageBreakWin& GetOrCreateWin(); |
35 | | |
36 | | public: |
37 | | SwBreakDashedLine(SwEditWin* pEditWin, const SwFrame *pFrame); |
38 | | |
39 | 0 | virtual ~SwBreakDashedLine() override { disposeOnce(); } |
40 | 0 | virtual void dispose() override { m_pWin.disposeAndClear(); m_pEditWin.reset(); SwDashedLine::dispose(); } |
41 | | |
42 | | virtual void MouseMove(const MouseEvent& rMEvt) override; |
43 | | |
44 | 0 | virtual const SwFrame* GetFrame() override { return m_pFrame; } |
45 | 0 | virtual SwEditWin* GetEditWin() override { return m_pEditWin; } |
46 | | virtual void ShowAll(bool bShow) override; |
47 | | virtual bool Contains(const Point &rDocPt) const override; |
48 | | virtual void SetReadonly(bool bReadonly) override; |
49 | | |
50 | | void execute(std::u16string_view rIdent); |
51 | | |
52 | | virtual FactoryFunction GetUITestFactory() const override; |
53 | | |
54 | | void UpdatePosition(const std::optional<Point>& xEvtPt = std::optional<Point>()); |
55 | | void DestroyWin(); |
56 | | }; |
57 | | |
58 | | class SwPageBreakWin final : public InterimItemWindow |
59 | | { |
60 | | std::unique_ptr<weld::MenuButton> m_xMenuButton; |
61 | | VclPtr<SwBreakDashedLine> m_pLine; |
62 | | VclPtr<SwEditWin> m_pEditWin; |
63 | | VclPtr<VirtualDevice> m_xVirDev; |
64 | | const SwFrame* m_pFrame; |
65 | | bool m_bIsAppearing; |
66 | | int m_nFadeRate; |
67 | | int m_nDelayAppearing; ///< Before we show the control, let it transparent for a few timer ticks to avoid appearing with every mouse over. |
68 | | Timer m_aFadeTimer; |
69 | | bool m_bDestroyed; |
70 | | |
71 | | public: |
72 | | SwPageBreakWin(SwBreakDashedLine* pLine, SwEditWin* pEditWin, const SwFrame *pFrame); |
73 | | virtual ~SwPageBreakWin() override; |
74 | | virtual void dispose() override; |
75 | | |
76 | | void Fade( bool bFadeIn ); |
77 | | |
78 | | void SetRectanglePixel(const ::tools::Rectangle& rRect); |
79 | | |
80 | | private: |
81 | | DECL_LINK( FadeHandler, Timer *, void ); |
82 | | /// Hide the button when the menu is toggled closed, e.g by clicking outside |
83 | | DECL_LINK(ToggleHdl, weld::Toggleable&, void); |
84 | | DECL_LINK(SelectHdl, const OUString&, void); |
85 | | void PaintButton(); |
86 | | }; |
87 | | |
88 | | #endif |
89 | | |
90 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |