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  */
20 #include "TextUnderlineControl.hxx"
21 #include <vcl/toolbox.hxx>
22 
23 using namespace svx;
24 
26  const css::uno::Reference<css::uno::XComponentContext>& rContext)
27  : PopupWindowController(rContext, nullptr, OUString())
28 {
29 }
30 
32 
33 void 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 
49 std::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 
70 css::uno::Sequence<OUString> TextUnderlinePopup::getSupportedServiceNames()
71 {
72  return { "com.sun.star.frame.ToolbarController" };
73 }
74 
75 extern "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: */
virtual OUString SAL_CALL getImplementationName() override
ToolBoxItemBits GetItemBits(ToolBoxItemId nItemId) const
OUString GetItemCommand(ToolBoxItemId nItemId) const
std::unique_ptr< ToolbarPopupContainer > mxPopoverContainer
virtual VclPtr< vcl::Window > createVclPopupWindow(vcl::Window *pParent) override
sal_Int16 nId
weld::Window * GetFrameWeld() const
void SetItemBits(ToolBoxItemId nItemId, ToolBoxItemBits nBits)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual std::unique_ptr< WeldToolbarPopup > weldPopupWindow() override
virtual ~TextUnderlinePopup() override
VclPtr< InterimToolbarPopup > mxInterimPopover
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 &)
static VclPtr< reference_type > Create(Arg &&...arg)
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
TextUnderlinePopup(const css::uno::Reference< css::uno::XComponentContext > &rContext)