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 .
23 #include <sfx2/sidebar/PanelLayout.hxx>
24 #include <sfx2/sidebar/ControllerItem.hxx>
25 #include <svl/intitem.hxx>
26 #include <svl/poolitem.hxx>
27 #include <svl/eitem.hxx>
28 #include <svx/rulritem.hxx>
30 namespace sw::sidebar
{
32 class PageHeaderPanel
:
34 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
37 static std::unique_ptr
<PanelLayout
> Create(
38 weld::Widget
* pParent
,
39 SfxBindings
* pBindings
);
41 virtual void NotifyItemUpdate(
42 const sal_uInt16 nSId
,
43 const SfxItemState eState
,
44 const SfxPoolItem
* pState
) override
;
46 virtual void GetControlState(
47 const sal_uInt16
/*nSId*/,
48 boost::property_tree::ptree
& /*rState*/) override
{};
50 SfxBindings
* GetBindings() const { return mpBindings
; }
52 weld::Widget
* pParent
,
53 SfxBindings
* pBindings
);
54 virtual ~PageHeaderPanel() override
;
58 SfxBindings
* mpBindings
;
60 ::sfx2::sidebar::ControllerItem maHFToggleController
;
61 ::sfx2::sidebar::ControllerItem maMetricController
;
62 ::sfx2::sidebar::ControllerItem maHeaderLRMarginController
;
63 ::sfx2::sidebar::ControllerItem maHeaderSpacingController
;
64 ::sfx2::sidebar::ControllerItem maHeaderLayoutController
;
68 OUString m_aCustomEntry
;
71 void SetMarginsAndSpacingFieldUnit();
72 void UpdateHeaderCheck();
73 void UpdateMarginControl();
74 void UpdateSpacingControl();
75 void UpdateLayoutControl();
77 ::std::unique_ptr
<SfxBoolItem
> mpHeaderItem
;
78 ::std::unique_ptr
<SvxLongLRSpaceItem
> mpHeaderLRMarginItem
;
79 ::std::unique_ptr
<SvxLongULSpaceItem
> mpHeaderSpacingItem
;
80 ::std::unique_ptr
<SfxInt16Item
> mpHeaderLayoutItem
;
82 std::unique_ptr
<weld::CheckButton
> mxHeaderToggle
;
83 std::unique_ptr
<weld::ComboBox
> mxHeaderSpacingLB
;
84 std::unique_ptr
<weld::ComboBox
> mxHeaderMarginPresetLB
;
85 std::unique_ptr
<weld::ComboBox
> mxHeaderLayoutLB
;
86 std::unique_ptr
<weld::Label
> mxCustomEntry
;
88 static FieldUnit
GetCurrentUnit(SfxItemState eState
, const SfxPoolItem
* pState
);
90 DECL_LINK( HeaderToggleHdl
, weld::Toggleable
&, void );
91 DECL_LINK( HeaderLRMarginHdl
, weld::ComboBox
&, void);
92 DECL_LINK( HeaderSpacingHdl
, weld::ComboBox
&, void);
93 DECL_LINK( HeaderLayoutHdl
, weld::ComboBox
&, void);
96 } //end of namespace sw::sidebar
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */