tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / include / svx / weldeditview.hxx
blob43002a95e58c12afe01afc3e617004d3da99ab9d
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/.
9 */
11 #pragma once
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>
20 class WeldEditAccessible;
22 class SVX_DLLPUBLIC WeldEditView : public weld::CustomWidgetController, public EditViewCallbacks
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;
30 void SetText(const OUString& rStr);
32 OUString GetText() const;
34 virtual FactoryFunction GetUITestFactory() const override;
36 void SetModifyHdl(const Link<LinkParamNone*, void>& rLink);
38 virtual EditView* GetEditView() const;
39 virtual EditEngine* GetEditEngine() const;
41 bool HasSelection() const;
43 void Delete();
44 void Cut();
45 void Copy();
46 void Paste();
48 virtual ~WeldEditView() override;
50 protected:
51 bool m_bAcceptsTab;
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;
56 rtl::Reference<WeldEditAccessible> m_xAccessible;
58 virtual void makeEditEngine();
60 void InitAccessible();
62 void DoPaint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
64 public:
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;
76 virtual css::uno::Reference<css::datatransfer::clipboard::XClipboard>
77 GetClipboard() const override;
78 virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> GetDropTarget() override;
80 // Whether Tab will result in entering a tab or not
81 bool GetAcceptsTab() const { return m_bAcceptsTab; }
83 void SetAcceptsTab(bool bAcceptsTab) { m_bAcceptsTab = bAcceptsTab; }
85 protected:
86 virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;
88 virtual void EditViewInvalidate(const tools::Rectangle& rRect) override { Invalidate(rRect); }
90 virtual void EditViewSelectionChange() override;
92 virtual OutputDevice& EditViewOutputDevice() const override
94 return GetDrawingArea()->get_ref_device();
97 virtual Point EditViewPointerPosPixel() const override;
99 virtual void EditViewInputContext(const InputContext& rInputContext) override
101 SetInputContext(rInputContext);
104 virtual void EditViewCursorRect(const tools::Rectangle& rRect, int nExtTextInputWidth) override
106 OutputDevice& rRefDevice = EditViewOutputDevice();
107 SetCursorRect(rRefDevice.LogicToPixel(rRect),
108 rRefDevice.LogicToPixel(Size(nExtTextInputWidth, 0)).Width());
111 virtual weld::Widget* EditViewPopupParent() const override { return GetDrawingArea(); }
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */