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 .
21 #include <sfx2/sidebar/PanelLayout.hxx>
22 #include <sfx2/sidebar/ControllerItem.hxx>
24 #include <svx/pageitem.hxx>
25 #include <svx/rulritem.hxx>
26 #include <svx/papersizelistbox.hxx>
28 #include <tools/fldunit.hxx>
29 #include <svl/poolitem.hxx>
30 #include <svx/relfld.hxx>
34 namespace sw::sidebar
{
36 class PageFormatPanel
:
38 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
41 static std::unique_ptr
<PanelLayout
> Create(
42 weld::Widget
* pParent
,
43 SfxBindings
* pBindings
);
45 virtual void NotifyItemUpdate(
46 const sal_uInt16 nSId
,
47 const SfxItemState eState
,
48 const SfxPoolItem
* pState
) override
;
50 virtual void GetControlState(
51 const sal_uInt16
/*nSId*/,
52 boost::property_tree::ptree
& /*rState*/) override
{};
55 weld::Widget
* pParent
,
56 SfxBindings
* pBindings
);
57 virtual ~PageFormatPanel() override
;
59 static FieldUnit
GetCurrentUnit( SfxItemState eState
, const SfxPoolItem
* pState
);
63 SfxBindings
* mpBindings
;
65 std::unique_ptr
<SvxPaperSizeListBox
> mxPaperSizeBox
;
66 std::unique_ptr
<SvxRelativeField
> mxPaperWidth
;
67 std::unique_ptr
<SvxRelativeField
> mxPaperHeight
;
68 std::unique_ptr
<weld::ComboBox
> mxPaperOrientation
;
69 std::unique_ptr
<weld::ComboBox
> mxMarginSelectBox
;
70 std::unique_ptr
<weld::Label
> mxCustomEntry
;
72 ::sfx2::sidebar::ControllerItem maPaperSizeController
;
73 ::sfx2::sidebar::ControllerItem maPaperOrientationController
;
74 ::sfx2::sidebar::ControllerItem maMetricController
;
75 ::sfx2::sidebar::ControllerItem maSwPageLRControl
;
76 ::sfx2::sidebar::ControllerItem maSwPageULControl
;
78 std::unique_ptr
<SvxPageItem
> mpPageItem
;
79 std::unique_ptr
<SvxLongLRSpaceItem
> mpPageLRMarginItem
;
80 std::unique_ptr
<SvxLongULSpaceItem
> mpPageULMarginItem
;
85 tools::Long mnPageLeftMargin
;
86 tools::Long mnPageRightMargin
;
87 tools::Long mnPageTopMargin
;
88 tools::Long mnPageBottomMargin
;
89 OUString m_aCustomEntry
;
92 void SetMarginFieldUnit();
93 void UpdateMarginBox();
94 void ExecuteMarginLRChange( const tools::Long nPageLeftMargin
, const tools::Long nPageRightMargin
);
95 void ExecuteMarginULChange( const tools::Long nPageTopMargin
, const tools::Long nPageBottomMargin
);
96 DECL_LINK(PaperFormatModifyHdl
, weld::ComboBox
&, void);
97 DECL_LINK(PaperSizeModifyHdl
, weld::MetricSpinButton
&, void);
98 DECL_LINK(PaperModifyMarginHdl
, weld::ComboBox
&, void );
101 } //end of namespace sw::sidebar
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */