Update git submodules
[LibreOffice.git] / framework / inc / uielement / buttontoolbarcontroller.hxx
blob759775ef8b65cc70150d988cf06ba3c7d8e534e4
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 <com/sun/star/lang/XInitialization.hpp>
23 #include <com/sun/star/util/XUpdatable.hpp>
24 #include <com/sun/star/frame/XFrame.hpp>
25 #include <com/sun/star/frame/XStatusListener.hpp>
26 #include <com/sun/star/util/XURLTransformer.hpp>
27 #include <com/sun/star/frame/XToolbarController.hpp>
28 #include <com/sun/star/uno/XComponentContext.hpp>
30 #include <cppuhelper/basemutex.hxx>
31 #include <cppuhelper/weak.hxx>
32 #include <vcl/vclptr.hxx>
34 class ToolBox;
36 namespace framework
39 class ButtonToolbarController final : public css::frame::XStatusListener,
40 public css::frame::XToolbarController,
41 public css::lang::XInitialization,
42 public css::util::XUpdatable,
43 public css::lang::XComponent,
44 public ::cppu::BaseMutex,
45 public ::cppu::OWeakObject
47 public:
48 ButtonToolbarController( css::uno::Reference< css::uno::XComponentContext > xContext,
49 ToolBox* pToolBar,
50 OUString aCommand );
51 virtual ~ButtonToolbarController() override;
53 // XInterface
54 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
55 virtual void SAL_CALL acquire() noexcept override;
56 virtual void SAL_CALL release() noexcept override;
58 // XInitialization
59 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
61 // XUpdatable
62 virtual void SAL_CALL update() override;
64 // XComponent
65 virtual void SAL_CALL dispose() override;
66 virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override;
67 virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override;
69 // XEventListener
70 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
72 // XStatusListener
73 virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override;
75 // XToolbarController
76 virtual void SAL_CALL execute( sal_Int16 KeyModifier ) override;
77 virtual void SAL_CALL click() override;
78 virtual void SAL_CALL doubleClick() override;
79 virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override;
80 virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createItemWindow( const css::uno::Reference< css::awt::XWindow >& Parent ) override;
82 private:
83 bool m_bInitialized : 1,
84 m_bDisposed : 1;
85 OUString m_aCommandURL;
86 css::uno::Reference< css::frame::XFrame > m_xFrame;
87 css::uno::Reference< css::uno::XComponentContext > m_xContext;
88 css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer;
89 VclPtr<ToolBox> m_pToolbar;
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */