LibreOffice Module sw (master)  1
FrameControl.hxx
Go to the documentation of this file.
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 
13 #include <vcl/virdev.hxx>
14 
15 #include "edtwin.hxx"
16 
17 class SwEditWin;
18 class SwPageFrame;
19 class SwFrame;
20 class Point;
21 
24 {
25 public:
26  virtual ~ISwFrameControl();
27  virtual void SetReadonly( bool bReadonly ) = 0;
28  virtual void ShowAll( bool bShow ) = 0;
29 
31  virtual bool Contains( const Point &rDocPt ) const = 0;
32 
34  virtual bool IsFocused() const = 0;
35 
36  virtual const SwFrame* GetFrame() = 0;
37  virtual SwEditWin* GetEditWin() = 0;
38 };
39 
40 class SwFrameControl final
41 {
44 public:
45  SwFrameControl( const VclPtr<vcl::Window> &pWindow );
47 
48  vcl::Window* GetWindow() { return mxWindow.get(); }
49 
50  void SetReadonly( bool bReadonly ) { mpIFace->SetReadonly( bReadonly ); }
51  void ShowAll( bool bShow ) { mpIFace->ShowAll( bShow ); }
52  bool Contains( const Point &rDocPt ) const { return mpIFace->Contains( rDocPt ); }
53  bool HasFocus() const { return mpIFace->IsFocused(); }
54 };
55 
59 {
60 protected:
62 private:
64  const SwFrame* m_pFrame;
65 
66 protected:
67  virtual ~SwFrameMenuButtonBase() override { disposeOnce(); }
68  virtual void dispose() override;
69 
70  void SetVirDevFont();
71 
72 public:
73  SwFrameMenuButtonBase(SwEditWin* pEditWin, const SwFrame* pFrame,
74  const OUString& rUIXMLDescription, const OString& rID);
75 
76  virtual const SwFrame* GetFrame() override { return m_pFrame; }
77  virtual SwEditWin* GetEditWin() override { return m_pEditWin; }
78  virtual bool IsFocused() const override { return ControlHasFocus(); }
79  const SwPageFrame* GetPageFrame() const;
80 };
81 
82 #endif
83 
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetReadonly(bool bReadonly)
Base class of the Writer layout elements.
Definition: frame.hxx:298
virtual bool IsFocused() const override
 Returns true if the control has focus.
virtual void dispose() override
SwFrameMenuButtonBase(SwEditWin *pEditWin, const SwFrame *pFrame, const OUString &rUIXMLDescription, const OString &rID)
virtual const SwFrame * GetFrame() override
virtual SwEditWin * GetEditWin()=0
vcl::Window * GetWindow()
bool ControlHasFocus() const
virtual void ShowAll(bool bShow)=0
Abstract interface to be implemented by writer FrameControls.
virtual bool IsFocused() const =0
 Returns true if the control has focus.
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:58
bool Contains(const Point &rDocPt) const
Class sharing some MenuButton code.
virtual ~SwFrameMenuButtonBase() override
VclPtr< vcl::Window > mxWindow
A page of the document layout.
Definition: pagefrm.hxx:41
void ShowAll(bool bShow)
virtual const SwFrame * GetFrame()=0
const SwFrame * m_pFrame
virtual bool Contains(const Point &rDocPt) const =0
Returns true if the point is inside the control.
bool HasFocus() const
VclPtr< SwEditWin > m_pEditWin
const SwPageFrame * GetPageFrame() const
ISwFrameControl * mpIFace
VclPtr< VirtualDevice > m_xVirDev
vcl::Window * get() const
virtual void SetReadonly(bool bReadonly)=0
virtual SwEditWin * GetEditWin() override
SwFrameControl(const VclPtr< vcl::Window > &pWindow)