Bump version to 24.04.3.4
[LibreOffice.git] / svx / source / sidebar / text / TextUnderlinePopup.cxx
blobbefa2b80dcc3a4706b726249f031845aa905cafe
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 .
19 #include <TextUnderlinePopup.hxx>
20 #include "TextUnderlineControl.hxx"
21 #include <vcl/toolbox.hxx>
23 using namespace svx;
25 TextUnderlinePopup::TextUnderlinePopup(
26 const css::uno::Reference<css::uno::XComponentContext>& rContext)
27 : PopupWindowController(rContext, nullptr, OUString())
31 TextUnderlinePopup::~TextUnderlinePopup() {}
33 void TextUnderlinePopup::initialize(const css::uno::Sequence<css::uno::Any>& rArguments)
35 PopupWindowController::initialize(rArguments);
37 if (m_pToolbar)
39 mxPopoverContainer.reset(new ToolbarPopupContainer(m_pToolbar));
40 m_pToolbar->set_item_popover(m_aCommandURL, mxPopoverContainer->getTopLevel());
43 ToolBox* pToolBox = nullptr;
44 ToolBoxItemId nId;
45 if (getToolboxId(nId, &pToolBox) && pToolBox->GetItemCommand(nId) == m_aCommandURL)
46 pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWN | pToolBox->GetItemBits(nId));
49 std::unique_ptr<WeldToolbarPopup> TextUnderlinePopup::weldPopupWindow()
51 return std::make_unique<TextUnderlineControl>(this, m_pToolbar);
54 VclPtr<vcl::Window> TextUnderlinePopup::createVclPopupWindow(vcl::Window* pParent)
56 mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(
57 getFrameInterface(), pParent,
58 std::make_unique<TextUnderlineControl>(this, pParent->GetFrameWeld()));
60 mxInterimPopover->Show();
62 return mxInterimPopover;
65 OUString TextUnderlinePopup::getImplementationName()
67 return "com.sun.star.comp.svx.UnderlineToolBoxControl";
70 css::uno::Sequence<OUString> TextUnderlinePopup::getSupportedServiceNames()
72 return { "com.sun.star.frame.ToolbarController" };
75 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
76 com_sun_star_comp_svx_UnderlineToolBoxControl_get_implementation(
77 css::uno::XComponentContext* rContext, css::uno::Sequence<css::uno::Any> const&)
79 return cppu::acquire(new TextUnderlinePopup(rContext));
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */