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 <com/sun/star/frame/XFrame.hpp>
25 #include <sfx2/sidebar/PanelLayout.hxx>
27 #include <sfx2/sidebar/ControllerItem.hxx>
29 #include <svx/rulritem.hxx>
31 #include <svl/intitem.hxx>
32 #include <svl/poolitem.hxx>
33 #include <svl/eitem.hxx>
34 #include <svx/spacinglistbox.hxx>
35 #include <svx/samecontentlistbox.hxx>
37 namespace sw::sidebar
{
39 class PageHeaderPanel
:
41 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
44 static VclPtr
<vcl::Window
> Create(
46 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rxFrame
,
47 SfxBindings
* pBindings
);
49 virtual void NotifyItemUpdate(
50 const sal_uInt16 nSId
,
51 const SfxItemState eState
,
52 const SfxPoolItem
* pState
) override
;
54 virtual void GetControlState(
55 const sal_uInt16
/*nSId*/,
56 boost::property_tree::ptree
& /*rState*/) override
{};
58 SfxBindings
* GetBindings() const { return mpBindings
; }
61 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rxFrame
,
62 SfxBindings
* pBindings
);
63 virtual ~PageHeaderPanel() override
;
64 virtual void dispose() override
;
68 SfxBindings
* mpBindings
;
70 ::sfx2::sidebar::ControllerItem maHFToggleController
;
71 ::sfx2::sidebar::ControllerItem maMetricController
;
72 ::sfx2::sidebar::ControllerItem maHeaderLRMarginController
;
73 ::sfx2::sidebar::ControllerItem maHeaderSpacingController
;
74 ::sfx2::sidebar::ControllerItem maHeaderLayoutController
;
78 OUString aCustomEntry
;
81 void SetMarginsAndSpacingFieldUnit();
82 void UpdateHeaderCheck();
83 void UpdateMarginControl();
84 void UpdateSpacingControl();
85 void UpdateLayoutControl();
87 ::std::unique_ptr
<SfxBoolItem
> mpHeaderItem
;
88 ::std::unique_ptr
<SvxLongLRSpaceItem
> mpHeaderLRMarginItem
;
89 ::std::unique_ptr
<SvxLongULSpaceItem
> mpHeaderSpacingItem
;
90 ::std::unique_ptr
<SfxInt16Item
> mpHeaderLayoutItem
;
92 std::unique_ptr
<weld::CheckButton
> mxHeaderToggle
;
93 std::unique_ptr
<weld::ComboBox
> mxHeaderSpacingLB
;
94 std::unique_ptr
<weld::ComboBox
> mxHeaderMarginPresetLB
;
95 std::unique_ptr
<weld::ComboBox
> mxHeaderLayoutLB
;
96 std::unique_ptr
<weld::Label
> mxCustomEntry
;
98 static FieldUnit
GetCurrentUnit(SfxItemState eState
, const SfxPoolItem
* pState
);
100 DECL_LINK( HeaderToggleHdl
, weld::ToggleButton
&, void );
101 DECL_LINK( HeaderLRMarginHdl
, weld::ComboBox
&, void);
102 DECL_LINK( HeaderSpacingHdl
, weld::ComboBox
&, void);
103 DECL_LINK( HeaderLayoutHdl
, weld::ComboBox
&, void);
106 } //end of namespace sw::sidebar
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */