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