1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <PageSizePopup.hxx>
20 #include "PageSizeControl.hxx"
21 #include <editeng/sizeitem.hxx>
22 #include <vcl/toolbox.hxx>
24 PageSizePopup::PageSizePopup(const css::uno::Reference
<css::uno::XComponentContext
>& rContext
)
25 : PopupWindowController(rContext
, nullptr, OUString())
29 void PageSizePopup::initialize( const css::uno::Sequence
< css::uno::Any
>& rArguments
)
31 PopupWindowController::initialize(rArguments
);
33 ToolBox
* pToolBox
= nullptr;
35 if (getToolboxId(nId
, &pToolBox
))
36 pToolBox
->SetItemBits(nId
, ToolBoxItemBits::DROPDOWNONLY
| pToolBox
->GetItemBits(nId
));
39 PageSizePopup::~PageSizePopup()
43 std::unique_ptr
<WeldToolbarPopup
> PageSizePopup::weldPopupWindow()
45 return std::make_unique
<sw::sidebar::PageSizeControl
>(this, m_pToolbar
);
48 VclPtr
<vcl::Window
> PageSizePopup::createVclPopupWindow( vcl::Window
* pParent
)
50 mxInterimPopover
= VclPtr
<InterimToolbarPopup
>::Create(getFrameInterface(), pParent
,
51 std::make_unique
<sw::sidebar::PageSizeControl
>(this, pParent
->GetFrameWeld()));
53 mxInterimPopover
->Show();
55 return mxInterimPopover
;
58 OUString
PageSizePopup::getImplementationName()
60 return "lo.writer.PageSizeToolBoxControl";
63 css::uno::Sequence
<OUString
> PageSizePopup::getSupportedServiceNames()
65 return { "com.sun.star.frame.ToolbarController" };
68 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
69 lo_writer_PageSizeToolBoxControl_get_implementation(
70 css::uno::XComponentContext
* rContext
,
71 css::uno::Sequence
<css::uno::Any
> const & )
73 return cppu::acquire(new PageSizePopup(rContext
));
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */