lok: calc - send other views our selection in their co-ordinates.
[LibreOffice.git] / include / sfx2 / infobar.hxx
blobf725a27044f2f18a74424e73affe234853dcb8db
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/.
8 */
9 #ifndef INCLUDED_SFX2_INFOBAR_HXX
10 #define INCLUDED_SFX2_INFOBAR_HXX
12 #include <vector>
14 #include <basegfx/color/bcolor.hxx>
15 #include <vcl/button.hxx>
16 #include <vcl/fixed.hxx>
18 #include <sfx2/childwin.hxx>
19 #include <sfx2/dllapi.h>
21 // These must match the values in offapi/com/sun/star/frame/InfobarType.idl
22 enum class InfobarType
24 INFO = 0,
25 SUCCESS = 1,
26 WARNING = 2,
27 DANGER = 3
30 class InfobarData
32 public:
33 OUString msId;
34 OUString msPrimaryMessage;
35 OUString msSecondaryMessage;
36 InfobarType maInfobarType;
37 bool mbShowCloseButton;
40 /** SfxChildWindow for positioning the InfoBar in the view.
42 class SFX2_DLLPUBLIC SfxInfoBarContainerChild final : public SfxChildWindow
44 private:
45 SfxBindings* const m_pBindings;
47 public:
48 SfxInfoBarContainerChild(vcl::Window* pParent, sal_uInt16 nId, SfxBindings* pBindings,
49 SfxChildWinInfo* pInfo);
50 virtual ~SfxInfoBarContainerChild() override;
52 SFX_DECL_CHILDWINDOW_WITHID(SfxInfoBarContainerChild);
54 void Update();
57 /** Class representing a single InfoBar to be added in a SfxInfoBarContainerWindow.
59 class SFX2_DLLPUBLIC SfxInfoBarWindow final : public vcl::Window
61 private:
62 OUString const m_sId;
63 InfobarType m_eType;
64 VclPtr<FixedImage> m_pImage;
65 VclPtr<FixedText> m_pPrimaryMessage;
66 VclPtr<FixedText> m_pSecondaryMessage;
67 VclPtr<Button> m_pCloseBtn;
68 std::vector<VclPtr<PushButton>> m_aActionBtns;
70 void SetForeAndBackgroundColors(InfobarType eType);
72 public:
73 SfxInfoBarWindow(vcl::Window* parent, const OUString& sId, const OUString& sPrimaryMessage,
74 const OUString& sSecondaryMessage, InfobarType InfobarType,
75 bool bShowCloseButton, WinBits nMessageStyle);
76 virtual ~SfxInfoBarWindow() override;
77 virtual void dispose() override;
79 const OUString& getId() const { return m_sId; }
80 virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) override;
81 virtual void Resize() override;
82 void Update(const OUString& sPrimaryMessage, const OUString& sSecondaryMessage,
83 InfobarType eType);
84 basegfx::BColor m_aBackgroundColor;
85 basegfx::BColor m_aForegroundColor;
87 /** Add button to Infobar.
88 * Infobar takes ownership of the button so the button is
89 * destroyed when the infobar gets destroyed.
91 void addButton(PushButton* pButton);
93 private:
94 DECL_LINK(CloseHandler, Button*, void);
97 class SfxInfoBarContainerWindow final : public vcl::Window
99 private:
100 SfxInfoBarContainerChild* m_pChildWin;
101 std::vector<VclPtr<SfxInfoBarWindow>> m_pInfoBars;
103 public:
104 SfxInfoBarContainerWindow(SfxInfoBarContainerChild* pChildWin);
105 virtual ~SfxInfoBarContainerWindow() override;
106 virtual void dispose() override;
108 VclPtr<SfxInfoBarWindow> appendInfoBar(const OUString& sId, const OUString& sPrimaryMessage,
109 const OUString& sSecondaryMessage, InfobarType ibType,
110 WinBits nMessageStyle, bool bShowCloseButton);
111 VclPtr<SfxInfoBarWindow> getInfoBar(const OUString& sId);
112 bool hasInfoBarWithID(const OUString& sId);
113 void removeInfoBar(VclPtr<SfxInfoBarWindow> const& pInfoBar);
115 virtual void Resize() override;
118 #endif
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */