Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / inc / contentcontrolbutton.hxx
blob28b9e49c3057b5590a415cd80ef099f60039ef98
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/.
8 */
10 #pragma once
12 #include <vcl/ctrl.hxx>
13 #include <vcl/weld.hxx>
14 #include <swrect.hxx>
16 class SwEditWin;
17 class SwContentControl;
19 /// This button is shown when the cursor is inside a content control with drop-down capability.
20 class SwContentControlButton : public Control
22 public:
23 SwContentControlButton(SwEditWin* pEditWin, std::shared_ptr<SwContentControl> pContentControl);
24 virtual ~SwContentControlButton() override;
25 virtual void dispose() override;
27 void CalcPosAndSize(const SwRect& rPortionPaintArea);
28 void SetRTL(bool bRTL) { m_bRTL = bRTL; }
30 virtual void MouseButtonDown(const MouseEvent& rMEvt) override;
31 DECL_LINK(PopupModeEndHdl, weld::Popover&, void);
32 /// Shared MouseButtonDown() and KeyInput() code.
33 void StartPopup();
35 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override;
36 virtual WindowHitTest ImplHitTest(const Point& rFramePos) override;
38 virtual void LaunchPopup();
39 virtual void DestroyPopup();
41 const std::shared_ptr<SwContentControl>& GetContentControl() const { return m_pContentControl; }
43 private:
44 tools::Rectangle m_aFramePixel;
46 protected:
47 std::shared_ptr<SwContentControl> m_pContentControl;
48 std::unique_ptr<weld::Builder> m_xPopupBuilder;
49 std::unique_ptr<weld::Popover> m_xPopup;
50 bool m_bRTL = false;
53 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */