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
21
23{
24public:
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 Delete();
44 void Cut();
45 void Copy();
46 void Paste();
47
48 virtual ~WeldEditView() override;
49
50protected:
52 // m_xDropTarget must outlive m_xEditView
53 css::uno::Reference<css::datatransfer::dnd::XDropTarget> m_xDropTarget;
54 std::unique_ptr<EditEngine> m_xEditEngine;
55 std::unique_ptr<EditView> m_xEditView;
57
58 virtual void makeEditEngine();
59
60 void InitAccessible();
61
62 void DoPaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
63
64public:
65 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
66 virtual bool MouseMove(const MouseEvent& rMEvt) override;
67 virtual bool MouseButtonDown(const MouseEvent& rMEvt) override;
68 virtual bool MouseButtonUp(const MouseEvent& rMEvt) override;
69 virtual bool KeyInput(const KeyEvent& rKEvt) override;
70 virtual bool Command(const CommandEvent& rCEvt) override;
71 virtual bool CanFocus() const;
72 virtual void GetFocus() override;
73 virtual void LoseFocus() override;
74 virtual void Resize() override;
75
76 virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard>
77 GetClipboard() const override;
78 virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> GetDropTarget() override;
79
80 // Whether Tab will result in entering a tab or not
81 bool GetAcceptsTab() const { return m_bAcceptsTab; }
82
83 void SetAcceptsTab(bool bAcceptsTab) { m_bAcceptsTab = bAcceptsTab; }
84
85protected:
86 virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
87
88 virtual void EditViewInvalidate(const tools::Rectangle& rRect) override { Invalidate(rRect); }
89
90 virtual void EditViewSelectionChange() override { Invalidate(); }
91
92 virtual OutputDevice& EditViewOutputDevice() const override
93 {
95 }
96
97 virtual Point EditViewPointerPosPixel() const override;
98
99 virtual void EditViewInputContext(const InputContext& rInputContext) override
100 {
101 SetInputContext(rInputContext);
102 }
103
104 virtual void EditViewCursorRect(const tools::Rectangle& rRect, int nExtTextInputWidth) override
105 {
106 OutputDevice& rRefDevice = EditViewOutputDevice();
107 SetCursorRect(rRefDevice.LogicToPixel(rRect),
108 rRefDevice.LogicToPixel(Size(nExtTextInputWidth, 0)).Width());
109 }
110
111 virtual weld::Widget* EditViewPopupParent() const override { return GetDrawingArea(); }
112};
113
114/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OutputDevice & EditViewOutputDevice() const=0
virtual Point EditViewPointerPosPixel() const=0
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
virtual void EditViewCursorRect(const tools::Rectangle &rRect, int nExtTextInputWidth) override
virtual weld::Widget * EditViewPopupParent() const override
std::unique_ptr< EditEngine > m_xEditEngine
std::unique_ptr< EditView > m_xEditView
void SetAcceptsTab(bool bAcceptsTab)
virtual OutputDevice & EditViewOutputDevice() const override
css::uno::Reference< css::datatransfer::dnd::XDropTarget > m_xDropTarget
bool GetAcceptsTab() const
virtual void EditViewInputContext(const InputContext &rInputContext) override
virtual void EditViewInvalidate(const tools::Rectangle &rRect) override
virtual void EditViewSelectionChange() override
rtl::Reference< WeldEditAccessible > m_xAccessible
virtual bool KeyInput(const KeyEvent &)
css::uno::Reference< css::datatransfer::dnd::XDropTarget > GetDropTarget()
virtual void SetDrawingArea(weld::DrawingArea *pDrawingArea)
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)=0
virtual bool MouseMove(const MouseEvent &)
virtual FactoryFunction GetUITestFactory() const
virtual bool MouseButtonDown(const MouseEvent &)
weld::DrawingArea * GetDrawingArea() const
virtual int GetSurroundingText(OUString &)
virtual bool MouseButtonUp(const MouseEvent &)
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible()
virtual bool DeleteSurroundingText(const Selection &)
void SetCursorRect(const tools::Rectangle &rCursorRect, int nExtTextInputWidth)
void SetInputContext(const InputContext &rInputContext)
virtual bool Command(const CommandEvent &)
css::uno::Reference< css::datatransfer::clipboard::XClipboard > GetClipboard() const
virtual OutputDevice & get_ref_device()=0
virtual void SetText(const OUString &rStr) override
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28