/src/libreoffice/svx/source/sidebar/text/TextCharacterSpacingPopup.cxx
Line | Count | Source |
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 | | #include <TextCharacterSpacingPopup.hxx> |
20 | | #include "TextCharacterSpacingControl.hxx" |
21 | | #include <vcl/toolbox.hxx> |
22 | | #include <vcl/weld/Toolbar.hxx> |
23 | | |
24 | | using namespace svx; |
25 | | |
26 | | TextCharacterSpacingPopup::TextCharacterSpacingPopup( |
27 | | const css::uno::Reference<css::uno::XComponentContext>& rContext) |
28 | 0 | : PopupWindowController(rContext, nullptr, OUString()) |
29 | 0 | { |
30 | 0 | } |
31 | | |
32 | | void TextCharacterSpacingPopup::initialize(const css::uno::Sequence<css::uno::Any>& rArguments) |
33 | 0 | { |
34 | 0 | PopupWindowController::initialize(rArguments); |
35 | |
|
36 | 0 | if (m_pToolbar) |
37 | 0 | { |
38 | 0 | mxPopoverContainer.reset(new ToolbarPopupContainer(m_pToolbar)); |
39 | 0 | m_pToolbar->set_item_popover(m_aCommandURL, mxPopoverContainer->getTopLevel()); |
40 | 0 | } |
41 | |
|
42 | 0 | ToolBox* pToolBox = nullptr; |
43 | 0 | ToolBoxItemId nId; |
44 | 0 | if (getToolboxId(nId, &pToolBox)) |
45 | 0 | pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId)); |
46 | 0 | } |
47 | | |
48 | 0 | TextCharacterSpacingPopup::~TextCharacterSpacingPopup() {} |
49 | | |
50 | | std::unique_ptr<WeldToolbarPopup> TextCharacterSpacingPopup::weldPopupWindow() |
51 | 0 | { |
52 | 0 | return std::make_unique<TextCharacterSpacingControl>(this, m_pToolbar); |
53 | 0 | } |
54 | | |
55 | | VclPtr<vcl::Window> TextCharacterSpacingPopup::createVclPopupWindow(vcl::Window* pParent) |
56 | 0 | { |
57 | 0 | mxInterimPopover = VclPtr<InterimToolbarPopup>::Create( |
58 | 0 | getFrameInterface(), pParent, |
59 | 0 | std::make_unique<TextCharacterSpacingControl>(this, pParent->GetFrameWeld())); |
60 | |
|
61 | 0 | mxInterimPopover->Show(); |
62 | |
|
63 | 0 | return mxInterimPopover; |
64 | 0 | } |
65 | | |
66 | | OUString TextCharacterSpacingPopup::getImplementationName() |
67 | 0 | { |
68 | 0 | return u"com.sun.star.comp.svx.CharacterSpacingToolBoxControl"_ustr; |
69 | 0 | } |
70 | | |
71 | | css::uno::Sequence<OUString> TextCharacterSpacingPopup::getSupportedServiceNames() |
72 | 0 | { |
73 | 0 | return { u"com.sun.star.frame.ToolbarController"_ustr }; |
74 | 0 | } |
75 | | |
76 | | extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* |
77 | | com_sun_star_comp_svx_CharacterSpacingToolBoxControl_get_implementation( |
78 | | css::uno::XComponentContext* rContext, css::uno::Sequence<css::uno::Any> const&) |
79 | 0 | { |
80 | 0 | return cppu::acquire(new TextCharacterSpacingPopup(rContext)); |
81 | 0 | } |
82 | | |
83 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |