LibreOffice Module svx (master)  1
weldeditview.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  */
10 
11 #pragma once
12 
13 #include <sal/config.h>
14 #include <svx/svxdllapi.h>
15 #include <editeng/editeng.hxx>
16 #include <editeng/editview.hxx>
17 #include <vcl/customweld.hxx>
18 #include <vcl/outdev.hxx>
19 
20 class WeldEditAccessible;
21 
22 class SVX_DLLPUBLIC WeldEditView : public weld::CustomWidgetController, public EditViewCallbacks
23 {
24 public:
25  WeldEditView();
26  virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
27  virtual int GetSurroundingText(OUString& rSurrounding) override;
28  virtual bool DeleteSurroundingText(const Selection& rRange) override;
29 
30  void SetText(const OUString& rStr);
31 
32  OUString GetText() const;
33 
34  virtual FactoryFunction GetUITestFactory() const override;
35 
36  void SetModifyHdl(const Link<LinkParamNone*, void>& rLink);
37 
38  virtual EditView* GetEditView() const;
39  virtual EditEngine* GetEditEngine() const;
40 
41  bool HasSelection() const;
42 
43  void Cut();
44  void Copy();
45  void Paste();
46 
47  virtual ~WeldEditView() override;
48 
49 protected:
50  std::unique_ptr<EditEngine> m_xEditEngine;
51  std::unique_ptr<EditView> m_xEditView;
53 
54  virtual void makeEditEngine();
55 
56  void InitAccessible();
57 
58  void DoPaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
59 
60  virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
61  virtual bool MouseMove(const MouseEvent& rMEvt) override;
62  virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
63  virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
64  virtual bool KeyInput(const KeyEvent& rKEvt) override;
65  virtual bool Command(const CommandEvent& rCEvt) override;
66  virtual void GetFocus() override;
67  virtual void LoseFocus() override;
68  virtual void Resize() override;
69 
70  virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
71 
72  virtual void EditViewInvalidate(const tools::Rectangle& rRect) override { Invalidate(rRect); }
73 
74  virtual void EditViewSelectionChange() override { Invalidate(); }
75 
76  virtual OutputDevice& EditViewOutputDevice() const override
77  {
78  return GetDrawingArea()->get_ref_device();
79  }
80 
81  virtual void EditViewInputContext(const InputContext& rInputContext) override
82  {
83  SetInputContext(rInputContext);
84  }
85 
86  virtual void EditViewCursorRect(const tools::Rectangle& rRect, int nExtTextInputWidth) override
87  {
88  OutputDevice& rRefDevice = EditViewOutputDevice();
89  SetCursorRect(rRefDevice.LogicToPixel(rRect),
90  rRefDevice.LogicToPixel(Size(nExtTextInputWidth, 0)).Width());
91  }
92 
93  virtual weld::Widget* EditViewPopupParent() const override { return GetDrawingArea(); }
94 };
95 
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual FactoryFunction GetUITestFactory() const
virtual void EditViewSelectionChange() override
virtual bool MouseButtonUp(const MouseEvent &)
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual bool MouseMove(const MouseEvent &)
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
virtual OutputDevice & get_ref_device()=0
virtual weld::Widget * EditViewPopupParent() const override
void SetCursorRect(const tools::Rectangle &rCursorRect, int nExtTextInputWidth)
virtual void EditViewCursorRect(const tools::Rectangle &rRect, int nExtTextInputWidth) override
virtual bool DeleteSurroundingText(const Selection &)
void SetInputContext(const InputContext &rInputContext)
std::unique_ptr< EditView > m_xEditView
virtual bool KeyInput(const KeyEvent &)
virtual void EditViewInvalidate(const tools::Rectangle &rRect) override
Point LogicToPixel(const Point &rLogicPt) const
virtual void EditViewInputContext(const InputContext &rInputContext) override
weld::DrawingArea * GetDrawingArea() const
virtual int GetSurroundingText(OUString &)
virtual bool MouseButtonDown(const MouseEvent &)
rtl::Reference< WeldEditAccessible > m_xAccessible
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea)
std::unique_ptr< EditEngine > m_xEditEngine
virtual OutputDevice & EditViewOutputDevice() const override
virtual bool Command(const CommandEvent &)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)=0
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible()