LibreOffice Module sw (master)  1
PageMarginPopup.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  */
19 #include <PageMarginPopup.hxx>
20 #include "PageMarginControl.hxx"
21 #include <vcl/toolbox.hxx>
22 
23 PageMarginPopup::PageMarginPopup(const css::uno::Reference<css::uno::XComponentContext>& rContext)
24  : PopupWindowController(rContext, nullptr, OUString())
25 {
26 }
27 
28 void PageMarginPopup::initialize( const css::uno::Sequence< css::uno::Any >& rArguments )
29 {
30  PopupWindowController::initialize(rArguments);
31 
32  ToolBox* pToolBox = nullptr;
33  sal_uInt16 nId = 0;
34  if (getToolboxId(nId, &pToolBox) && pToolBox->GetItemCommand(nId) == m_aCommandURL)
35  pToolBox->SetItemBits(nId, ToolBoxItemBits::DROPDOWNONLY | pToolBox->GetItemBits(nId));
36 }
37 
39 {
40 }
41 
42 std::unique_ptr<WeldToolbarPopup> PageMarginPopup::weldPopupWindow()
43 {
44  return std::make_unique<sw::sidebar::PageMarginControl>(this, m_pToolbar);
45 }
46 
48 {
49  mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent,
50  std::make_unique<sw::sidebar::PageMarginControl>(this, pParent->GetFrameWeld()));
51 
52  mxInterimPopover->Show();
53 
54  return mxInterimPopover;
55 }
56 
58 {
59  return "lo.writer.PageMarginToolBoxControl";
60 }
61 
62 css::uno::Sequence<OUString> PageMarginPopup::getSupportedServiceNames()
63 {
64  return { "com.sun.star.frame.ToolbarController" };
65 }
66 
67 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
69  css::uno::XComponentContext* rContext,
70  css::uno::Sequence<css::uno::Any> const & )
71 {
72  return cppu::acquire(new PageMarginPopup(rContext));
73 }
74 
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
ToolBoxItemBits GetItemBits(sal_uInt16 nItemId) const
sal_Int16 nId
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
weld::Window * GetFrameWeld() const
void SetItemBits(sal_uInt16 nItemId, ToolBoxItemBits nBits)
PageMarginPopup(const css::uno::Reference< css::uno::XComponentContext > &rContext)
VclPtr< InterimToolbarPopup > mxInterimPopover
virtual std::unique_ptr< WeldToolbarPopup > weldPopupWindow() override
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * lo_writer_PageMarginToolBoxControl_get_implementation(css::uno::XComponentContext *rContext, css::uno::Sequence< css::uno::Any > const &)
OUString GetItemCommand(sal_uInt16 nItemId) const
virtual ~PageMarginPopup() override
virtual OUString SAL_CALL getImplementationName() override
static VclPtr< reference_type > Create(Arg &&...arg)
virtual VclPtr< vcl::Window > createVclPopupWindow(vcl::Window *pParent) override