nss: upgrade to release 3.73
[LibreOffice.git] / include / svtools / toolbarmenu.hxx
bloba9b0a9f5415c8aaaa45b3f3927ca577740b67996
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 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include <config_options.h>
23 #include <svtools/svtdllapi.h>
25 #include <memory>
27 #include <rtl/ref.hxx>
28 #include <vcl/dockwin.hxx>
29 #include <vcl/weld.hxx>
31 namespace com :: sun :: star :: frame { class XFrame; }
32 namespace com :: sun :: star :: frame { struct FeatureStateEvent; }
33 namespace svt { class FrameStatusListener; }
35 class SVT_DLLPUBLIC WeldToolbarPopup
37 private:
38 DECL_LINK(FocusHdl, weld::Widget&, void);
40 protected:
41 std::unique_ptr<weld::Builder> m_xBuilder;
42 std::unique_ptr<weld::Container> m_xTopLevel;
43 std::unique_ptr<weld::Container> m_xContainer;
44 css::uno::Reference<css::frame::XFrame> m_xFrame;
45 rtl::Reference<svt::FrameStatusListener> m_xStatusListener;
47 public:
48 WeldToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame,
49 weld::Widget* pParent, const OUString& rUIFile, const OString& rId);
50 virtual ~WeldToolbarPopup();
51 weld::Container* getTopLevel() { return m_xTopLevel.get(); }
52 weld::Container* getContainer() { return m_xContainer.get(); }
53 void AddStatusListener(const OUString& rCommandURL);
55 // Forwarded from XStatusListener (subclasses must override this one to get the status updates):
56 /// @throws css::uno::RuntimeException
57 virtual void statusChanged(const css::frame::FeatureStateEvent& Event);
58 virtual void GrabFocus() = 0;
61 // we want to create WeldToolbarPopup on-demand when a toolbar dropdown is
62 // clicked, but the widget to be shown must exist before the dropdown
63 // is activated, so ToolbarPopupContainer is that widget and the
64 // contents of the on-demand created WeldToolbarPopup is placed
65 // within the ToolbarPopupContainer
66 class SVT_DLLPUBLIC ToolbarPopupContainer final
68 private:
69 DECL_LINK(FocusHdl, weld::Widget&, void);
71 std::unique_ptr<weld::Builder> m_xBuilder;
72 std::unique_ptr<weld::Container> m_xTopLevel;
73 std::unique_ptr<weld::Container> m_xContainer;
74 std::unique_ptr<WeldToolbarPopup> m_xPopup;
75 public:
76 ToolbarPopupContainer(weld::Widget* pParent);
77 ~ToolbarPopupContainer();
78 weld::Container* getTopLevel() { return m_xTopLevel.get(); }
80 void setPopover(std::unique_ptr<WeldToolbarPopup> xPopup);
81 WeldToolbarPopup* getPopover() const { return m_xPopup.get(); }
82 void unsetPopover();
85 class SVT_DLLPUBLIC InterimToolbarPopup final : public DockingWindow
87 private:
88 VclPtr<vcl::Window> m_xBox;
89 css::uno::Reference<css::frame::XFrame> m_xFrame;
90 std::unique_ptr<weld::Builder> m_xBuilder;
91 std::unique_ptr<weld::Container> m_xContainer;
92 std::unique_ptr<WeldToolbarPopup> m_xPopup;
93 public:
94 InterimToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame, vcl::Window* pParent,
95 std::unique_ptr<WeldToolbarPopup> xPopup, bool bTearable = false);
96 virtual void dispose() override;
97 virtual ~InterimToolbarPopup() override;
99 virtual void GetFocus() override;
101 void EndPopupMode();
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */