Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / svx / source / sidebar / paragraph / ParaLineSpacingPopup.cxx
blobc6476185a6ee7c4562bea7ad51ac4a62cf2d1857
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 #include "ParaLineSpacingControl.hxx"
22 #include <ParaLineSpacingPopup.hxx>
23 #include <vcl/toolbox.hxx>
25 using namespace svx;
27 SvxLineSpacingToolBoxControl::SvxLineSpacingToolBoxControl(
28 const css::uno::Reference<css::uno::XComponentContext>& rContext)
29 : PopupWindowController(rContext, nullptr, OUString())
33 SvxLineSpacingToolBoxControl::~SvxLineSpacingToolBoxControl() {}
35 void SvxLineSpacingToolBoxControl::initialize(const css::uno::Sequence<css::uno::Any>& rArguments)
37 PopupWindowController::initialize(rArguments);
39 if (m_pToolbar)
41 mxPopoverContainer.reset(new ToolbarPopupContainer(m_pToolbar));
42 m_pToolbar->set_item_popover(m_aCommandURL, mxPopoverContainer->getTopLevel());
45 ToolBox* pToolBox = nullptr;
46 ToolBoxItemId nId;
47 if (getToolboxId(nId, &pToolBox))
48 pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId));
51 void SAL_CALL SvxLineSpacingToolBoxControl::execute(sal_Int16 /*KeyModifier*/)
53 if (m_pToolbar)
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));
59 else
61 // Open the popup also when Enter key is pressed.
62 createPopupWindow();
66 std::unique_ptr<WeldToolbarPopup> SvxLineSpacingToolBoxControl::weldPopupWindow()
68 return std::make_unique<ParaLineSpacingControl>(this, m_pToolbar);
71 VclPtr<vcl::Window> SvxLineSpacingToolBoxControl::createVclPopupWindow(vcl::Window* pParent)
73 mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(
74 getFrameInterface(), pParent,
75 std::make_unique<ParaLineSpacingControl>(this, pParent->GetFrameWeld()));
77 mxInterimPopover->Show();
79 return mxInterimPopover;
82 OUString SvxLineSpacingToolBoxControl::getImplementationName()
84 return "com.sun.star.comp.svx.LineSpacingToolBoxControl";
87 css::uno::Sequence<OUString> SvxLineSpacingToolBoxControl::getSupportedServiceNames()
89 return { "com.sun.star.frame.ToolbarController" };
92 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
93 com_sun_star_comp_svx_LineSpacingToolBoxControl_get_implementation(
94 css::uno::XComponentContext* rContext, css::uno::Sequence<css::uno::Any> const&)
96 return cppu::acquire(new SvxLineSpacingToolBoxControl(rContext));
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */