LibreOffice Module svx (master) 1
ParaLineSpacingPopup.cxx
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
21
23#include <vcl/toolbox.hxx>
24
25using namespace svx;
26
27SvxLineSpacingToolBoxControl::SvxLineSpacingToolBoxControl(
28 const css::uno::Reference<css::uno::XComponentContext>& rContext)
29 : PopupWindowController(rContext, nullptr, OUString())
30{
31}
32
34
35void SvxLineSpacingToolBoxControl::initialize(const css::uno::Sequence<css::uno::Any>& rArguments)
36{
37 PopupWindowController::initialize(rArguments);
38
39 if (m_pToolbar)
40 {
41 mxPopoverContainer.reset(new ToolbarPopupContainer(m_pToolbar));
42 m_pToolbar->set_item_popover(m_aCommandURL, mxPopoverContainer->getTopLevel());
43 }
44
45 ToolBox* pToolBox = nullptr;
47 if (getToolboxId(nId, &pToolBox))
48 pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId));
49}
50
51void SAL_CALL SvxLineSpacingToolBoxControl::execute(sal_Int16 /*KeyModifier*/)
52{
53 if (m_pToolbar)
54 {
55 // Toggle the popup also when toolbutton is activated
56 m_pToolbar->set_menu_item_active(m_aCommandURL,
57 !m_pToolbar->get_menu_item_active(m_aCommandURL));
58 }
59 else
60 {
61 // Open the popup also when Enter key is pressed.
63 }
64}
65
66std::unique_ptr<WeldToolbarPopup> SvxLineSpacingToolBoxControl::weldPopupWindow()
67{
68 return std::make_unique<ParaLineSpacingControl>(this, m_pToolbar);
69}
70
72{
74 getFrameInterface(), pParent,
75 std::make_unique<ParaLineSpacingControl>(this, pParent->GetFrameWeld()));
76
77 mxInterimPopover->Show();
78
79 return mxInterimPopover;
80}
81
83{
84 return "com.sun.star.comp.svx.LineSpacingToolBoxControl";
85}
86
88{
89 return { "com.sun.star.frame.ToolbarController" };
90}
91
92extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
94 css::uno::XComponentContext* rContext, css::uno::Sequence<css::uno::Any> const&)
95{
96 return cppu::acquire(new SvxLineSpacingToolBoxControl(rContext));
97}
98
99/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_svx_LineSpacingToolBoxControl_get_implementation(css::uno::XComponentContext *rContext, css::uno::Sequence< css::uno::Any > const &)
ToolBoxItemBits GetItemBits(ToolBoxItemId nItemId) const
void SetItemBits(ToolBoxItemId nItemId, ToolBoxItemBits nBits)
static VclPtr< reference_type > Create(Arg &&... arg)
VclPtr< InterimToolbarPopup > mxInterimPopover
virtual css::uno::Reference< css::awt::XWindow > SAL_CALL createPopupWindow() override
std::unique_ptr< ToolbarPopupContainer > mxPopoverContainer
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual std::unique_ptr< WeldToolbarPopup > weldPopupWindow() override
virtual VclPtr< vcl::Window > createVclPopupWindow(vcl::Window *pParent) override
virtual OUString SAL_CALL getImplementationName() override
virtual void SAL_CALL execute(sal_Int16 KeyModifier) override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
weld::Window * GetFrameWeld() const
sal_Int16 nId