/src/libreoffice/sw/source/uibase/inc/FrameControl.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_FRAMECONTROL_HXX |
10 | | #define INCLUDED_SW_SOURCE_UIBASE_INC_FRAMECONTROL_HXX |
11 | | |
12 | | #include <vcl/InterimItemWindow.hxx> |
13 | | #include <vcl/virdev.hxx> |
14 | | |
15 | | #include "edtwin.hxx" |
16 | | |
17 | | class SwPageFrame; |
18 | | class SwFrame; |
19 | | class Point; |
20 | | |
21 | | /// Abstract interface to be implemented by writer FrameControls |
22 | | class SAL_LOPLUGIN_ANNOTATE("crosscast") ISwFrameControl |
23 | | { |
24 | | public: |
25 | | virtual ~ISwFrameControl(); |
26 | | virtual void SetReadonly( bool bReadonly ) = 0; |
27 | | virtual void ShowAll( bool bShow ) = 0; |
28 | | |
29 | | /// Returns true if the point is inside the control. |
30 | | virtual bool Contains( const Point &rDocPt ) const = 0; |
31 | | |
32 | | virtual const SwFrame* GetFrame() = 0; |
33 | | virtual SwEditWin* GetEditWin() = 0; |
34 | 0 | virtual weld::Button* GetButton() { return nullptr; }; |
35 | | }; |
36 | | |
37 | | class SwFrameControl final |
38 | | { |
39 | | VclPtr<vcl::Window> mxWindow; |
40 | | ISwFrameControl *mpIFace; |
41 | | public: |
42 | | SwFrameControl( const VclPtr<vcl::Window> &pWindow ); |
43 | | ~SwFrameControl(); |
44 | | |
45 | 0 | vcl::Window* GetWindow() { return mxWindow.get(); } |
46 | 0 | ISwFrameControl* GetIFacePtr() { return mpIFace; } |
47 | | |
48 | 0 | void SetReadonly( bool bReadonly ) { mpIFace->SetReadonly( bReadonly ); } |
49 | 0 | void ShowAll( bool bShow ) { mpIFace->ShowAll( bShow ); } |
50 | 0 | bool Contains( const Point &rDocPt ) const { return mpIFace->Contains( rDocPt ); } |
51 | | }; |
52 | | |
53 | | /** Class sharing some MenuButton code |
54 | | */ |
55 | | class SwFrameMenuButtonBase : public InterimItemWindow, public ISwFrameControl |
56 | | { |
57 | | protected: |
58 | | VclPtr<VirtualDevice> m_xVirDev; |
59 | | private: |
60 | | VclPtr<SwEditWin> m_pEditWin; |
61 | | const SwFrame* m_pFrame; |
62 | | |
63 | | protected: |
64 | 0 | virtual ~SwFrameMenuButtonBase() override { disposeOnce(); } |
65 | | virtual void dispose() override; |
66 | | |
67 | | void SetVirDevFont(); |
68 | | |
69 | | public: |
70 | | SwFrameMenuButtonBase(SwEditWin* pEditWin, const SwFrame* pFrame, |
71 | | const OUString& rUIXMLDescription, const OUString& rID); |
72 | | |
73 | 0 | virtual const SwFrame* GetFrame() override { return m_pFrame; } |
74 | 0 | virtual SwEditWin* GetEditWin() override { return m_pEditWin; } |
75 | | const SwPageFrame* GetPageFrame() const; |
76 | | |
77 | | static const SwPageFrame* GetPageFrame(const SwFrame* pFrame); |
78 | | static void SetVirDevFont(OutputDevice& rDevice); |
79 | | }; |
80 | | |
81 | | #endif |
82 | | |
83 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |