LibreOffice Module svx (master) 1
TextUnderlinePopup.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 */
21#include <vcl/toolbox.hxx>
22
23using namespace svx;
24
25TextUnderlinePopup::TextUnderlinePopup(
26 const css::uno::Reference<css::uno::XComponentContext>& rContext)
27 : PopupWindowController(rContext, nullptr, OUString())
28{
29}
30
32
33void TextUnderlinePopup::initialize(const css::uno::Sequence<css::uno::Any>& rArguments)
34{
35 PopupWindowController::initialize(rArguments);
36
37 if (m_pToolbar)
38 {
39 mxPopoverContainer.reset(new ToolbarPopupContainer(m_pToolbar));
40 m_pToolbar->set_item_popover(m_aCommandURL.toUtf8(), mxPopoverContainer->getTopLevel());
41 }
42
43 ToolBox* pToolBox = nullptr;
45 if (getToolboxId(nId, &pToolBox) && pToolBox->GetItemCommand(nId) == m_aCommandURL)
46 pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWN | pToolBox->GetItemBits(nId));
47}
48
49std::unique_ptr<WeldToolbarPopup> TextUnderlinePopup::weldPopupWindow()
50{
51 return std::make_unique<TextUnderlineControl>(this, m_pToolbar);
52}
53
55{
57 getFrameInterface(), pParent,
58 std::make_unique<TextUnderlineControl>(this, pParent->GetFrameWeld()));
59
60 mxInterimPopover->Show();
61
62 return mxInterimPopover;
63}
64
66{
67 return "com.sun.star.comp.svx.UnderlineToolBoxControl";
68}
69
71{
72 return { "com.sun.star.frame.ToolbarController" };
73}
74
75extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
77 css::uno::XComponentContext* rContext, css::uno::Sequence<css::uno::Any> const&)
78{
79 return cppu::acquire(new TextUnderlinePopup(rContext));
80}
81
82/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_svx_UnderlineToolBoxControl_get_implementation(css::uno::XComponentContext *rContext, css::uno::Sequence< css::uno::Any > const &)
OUString GetItemCommand(ToolBoxItemId nItemId) const
ToolBoxItemBits GetItemBits(ToolBoxItemId nItemId) const
void SetItemBits(ToolBoxItemId nItemId, ToolBoxItemBits nBits)
static VclPtr< reference_type > Create(Arg &&... arg)
VclPtr< InterimToolbarPopup > mxInterimPopover
std::unique_ptr< ToolbarPopupContainer > mxPopoverContainer
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getImplementationName() override
virtual ~TextUnderlinePopup() override
virtual VclPtr< vcl::Window > createVclPopupWindow(vcl::Window *pParent) override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
virtual std::unique_ptr< WeldToolbarPopup > weldPopupWindow() override
weld::Window * GetFrameWeld() const
sal_Int16 nId