LibreOffice Module svtools (master) 1
toolbarmenu.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 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <svtools/svtdllapi.h>
23
24#include <memory>
25
26#include <rtl/ref.hxx>
27#include <vcl/dockwin.hxx>
28#include <vcl/weld.hxx>
29
30namespace com :: sun :: star :: frame { class XFrame; }
31namespace com :: sun :: star :: frame { struct FeatureStateEvent; }
32namespace svt { class FrameStatusListener; }
33
35{
36private:
38
39protected:
40 std::unique_ptr<weld::Builder> m_xBuilder;
41 std::unique_ptr<weld::Container> m_xTopLevel;
42 std::unique_ptr<weld::Container> m_xContainer;
43 css::uno::Reference<css::frame::XFrame> m_xFrame;
45
46public:
47 WeldToolbarPopup(css::uno::Reference<css::frame::XFrame> xFrame,
48 weld::Widget* pParent, const OUString& rUIFile, const OUString& rId);
49 virtual ~WeldToolbarPopup();
50 weld::Container* getTopLevel() { return m_xTopLevel.get(); }
52 void AddStatusListener(const OUString& rCommandURL);
53
54 // Forwarded from XStatusListener (subclasses must override this one to get the status updates):
56 virtual void statusChanged(const css::frame::FeatureStateEvent& Event);
57 virtual void GrabFocus() = 0;
58};
59
60// we want to create WeldToolbarPopup on-demand when a toolbar dropdown is
61// clicked, but the widget to be shown must exist before the dropdown
62// is activated, so ToolbarPopupContainer is that widget and the
63// contents of the on-demand created WeldToolbarPopup is placed
64// within the ToolbarPopupContainer
66{
67private:
69
70 std::unique_ptr<weld::Builder> m_xBuilder;
71 std::unique_ptr<weld::Container> m_xTopLevel;
72 std::unique_ptr<weld::Container> m_xContainer;
73 std::unique_ptr<WeldToolbarPopup> m_xPopup;
74public:
77 weld::Container* getTopLevel() { return m_xTopLevel.get(); }
78
79 void setPopover(std::unique_ptr<WeldToolbarPopup> xPopup);
80 WeldToolbarPopup* getPopover() const { return m_xPopup.get(); }
81 void unsetPopover();
82};
83
85{
86private:
87 css::uno::Reference<css::frame::XFrame> m_xFrame;
88 std::unique_ptr<weld::Builder> m_xBuilder;
89 std::unique_ptr<weld::Container> m_xContainer;
90 std::unique_ptr<WeldToolbarPopup> m_xPopup;
91public:
92 InterimToolbarPopup(const css::uno::Reference<css::frame::XFrame>& rFrame, vcl::Window* pParent,
93 std::unique_ptr<WeldToolbarPopup> xPopup, bool bTearable = false);
94 virtual void dispose() override;
95 virtual ~InterimToolbarPopup() override;
96
97 virtual void GetFocus() override;
98
99 void EndPopupMode();
100};
101
102/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::frame::XFrame > m_xFrame
Definition: toolbarmenu.hxx:87
std::unique_ptr< weld::Builder > m_xBuilder
Definition: toolbarmenu.hxx:88
std::unique_ptr< WeldToolbarPopup > m_xPopup
Definition: toolbarmenu.hxx:90
std::unique_ptr< weld::Container > m_xContainer
Definition: toolbarmenu.hxx:89
std::unique_ptr< weld::Builder > m_xBuilder
Definition: toolbarmenu.hxx:70
std::unique_ptr< weld::Container > m_xContainer
Definition: toolbarmenu.hxx:72
WeldToolbarPopup * getPopover() const
Definition: toolbarmenu.hxx:80
std::unique_ptr< weld::Container > m_xTopLevel
Definition: toolbarmenu.hxx:71
DECL_DLLPRIVATE_LINK(FocusHdl, weld::Widget &, void)
std::unique_ptr< WeldToolbarPopup > m_xPopup
Definition: toolbarmenu.hxx:73
weld::Container * getTopLevel()
Definition: toolbarmenu.hxx:77
std::unique_ptr< weld::Container > m_xTopLevel
Definition: toolbarmenu.hxx:41
rtl::Reference< svt::FrameStatusListener > m_xStatusListener
Definition: toolbarmenu.hxx:44
std::unique_ptr< weld::Container > m_xContainer
Definition: toolbarmenu.hxx:42
virtual void GrabFocus()=0
std::unique_ptr< weld::Builder > m_xBuilder
Definition: toolbarmenu.hxx:40
weld::Container * getContainer()
Definition: toolbarmenu.hxx:51
weld::Container * getTopLevel()
Definition: toolbarmenu.hxx:50
DECL_DLLPRIVATE_LINK(FocusHdl, weld::Widget &, void)
css::uno::Reference< css::frame::XFrame > m_xFrame
Definition: toolbarmenu.hxx:43
void dispose()
Reference< XNameAccess > m_xContainer
#define SVT_DLLPUBLIC
Definition: svtdllapi.h:27